Skip to content

Commit

Permalink
Initial import.
Browse files Browse the repository at this point in the history
  • Loading branch information
n1k0 committed Dec 16, 2015
0 parents commit 0764819
Show file tree
Hide file tree
Showing 11 changed files with 784 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"stage": 0,
"env": {
"development": {
"plugins": ["react-transform"]
}
}
}

31 changes: 31 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"parser": "babel-eslint",
"rules": {
"react/jsx-uses-react": 2,
"react/jsx-uses-vars": 2,
"react/react-in-jsx-scope": 2,

"curly": [2],
"indent": [2, 2],
"quotes": [2, "double"],
"linebreak-style": [2, "unix"],
"semi": [2, "always"],
"comma-dangle": [0],
"no-unused-vars": [2, {"vars": "all", "args": "none"}],
"no-console": [0]
},
"env": {
"es6": true,
"browser": true,
"node": true
},
"extends": "eslint:recommended",
"ecmaFeatures": {
"modules": true,
"jsx": true,
"experimentalObjectRestSpread": true
},
"plugins": [
"react"
]
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
lib
Empty file added .npmignore
Empty file.
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
sudo: false
language:
- node_js
node_js:
- "4"
env:
- ACTION=test
- ACTION="run lint"
script:
- npm $ACTION
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
react-jsonschema-form
=====================

A simple [React]() component capable of building forms from a [JSON schema]().

Requires React 0.14+.

## Installation

```
$ npm install react-jsonschema-form --save
```

## Usage

```js
import React, { Component } from "react";
import { render } from "react-dom";

import Form from "react-jsonschema-form";

const schema = {
title: "Todo Tasks",
type: "object",
required: ["title"],
properties: {
title: {type: "string", title: "Title", default: "A new task"},
done: {type: "boolean", title: "Done?", default: false}
}
};

const log = (type) => console.log.bind(console, type);

const App = ({schema}) => {
return <Form schema={schema}
onChange={log("changed")}
onSubmit={log("submitted")}
onError={log("errors")} />;
};

render(<App schema={schema} />, document.getElementById("app"));
```

## License

Apache 2
55 changes: 55 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"name": "react-jsonschema-form",
"version": "0.1.0",
"description": "A simple React component capable of building forms from a JSON schema.",
"scripts": {
"build": "babel-node -d lib/ src/",
"lint": "eslint src test",
"tdd": "npm run test -- -w",
"test": "NODE_ENV=test mocha --compilers js:babel/register --recursive --require ./test/setup-jsdom.js $(find test -name '*_test.js')"
},
"main": "lib/index.js",
"files": [
"lib"
],
"peerDependencies": {
"react": "^0.14.3",
"react-dom": "^0.14.3"
},
"dependencies": {
"jsonschema": "^1.0.2"
},
"devDependencies": {
"babel": "^5.8.20",
"babel-eslint": "^4.1.6",
"babel-loader": "^5.3.2",
"babel-plugin-react-transform": "^1.1.1",
"chai": "^3.3.0",
"css-loader": "^0.15.6",
"eslint": "^1.8.0",
"eslint-plugin-react": "^3.6.3",
"gh-pages": "^0.4.0",
"jsdom": "^7.1.0",
"json-loader": "^0.5.4",
"mocha": "^2.3.0",
"react-addons-test-utils": "^0.14.3",
"rimraf": "^2.4.4",
"sinon": "^1.17.2",
"style-loader": "^0.12.3"
},
"directories": {
"test": "test"
},
"repository": {
"type": "git",
"url": "git+https://github.com/mozilla-services/react-jsonschema-form.git"
},
"author": "Nicolas Perriault <[email protected]>",
"keywords": [
"react",
"form",
"json-schema"
],
"license": "Apache-2.0",
"homepage": "https://github.com/mozilla-services/react-jsonschema-form#readme"
}
Loading

0 comments on commit 0764819

Please sign in to comment.