├── circle.yml ├── docs ├── SimpleWrapper.json ├── BasicComponent.json ├── Tab.json ├── TabActive.json ├── TabInactive.json ├── BottomToolbar.json ├── Row.json ├── ListHeader.json ├── CarouselItem.json ├── Ripple.json ├── SplitterContent.json ├── Col.json ├── Toolbar.json ├── ToolbarButton.json ├── Splitter.json ├── Range.json ├── Switch.json ├── Button.json ├── BackButton.json ├── SpeedDialItem.json ├── ProgressCircular.json ├── ProgressBar.json ├── ListItem.json ├── LazyList.json ├── List.json ├── SpeedDial.json ├── Modal.json ├── Fab.json ├── PullHook.json ├── Icon.json ├── Input.json ├── Page.json ├── Tabbar.json ├── Dialog.json ├── AlertDialog.json ├── Popover.json ├── SplitterSide.json └── Carousel.json ├── .gitmodules ├── tests.webpack.js ├── ISSUE_TEMPLATE.md ├── test ├── todo ├── col-test.js ├── fab-test.js ├── row-test.js ├── tab-test.js ├── icon-test.js ├── input.js ├── range-test.js ├── switch-test.js ├── button-test.js ├── page-test.js ├── ripple-test.js ├── carousel-test.js ├── modal-test.js ├── toolbar-test.js ├── pullHook-test.js ├── splitter-test.js ├── tabActive-test.js ├── speedDial-test.js ├── backButton-test.js ├── tabInactive-test.js ├── bottomToolbar-test.js ├── carouselItem-test.js ├── progressBar-test.js ├── listHeader-test.js ├── speedDialItem-test.js ├── toolbarButton-test.js ├── listItem-test.js ├── splitterContent-test.js ├── splitterSide-test.js ├── progressBarCircular-test.js ├── tabbar-test.js ├── testUtil.js ├── list-test.js └── lazyList-test.js ├── scripts └── react-docgen.js ├── demo ├── examples │ ├── MyToolbar.js │ ├── Ripple.js │ ├── BackButton.js │ ├── Switch.js │ ├── BottomToolbar.js │ ├── LazyList.js │ ├── Range.js │ ├── ProgressBar.js │ ├── SpeedDial.js │ ├── List.js │ ├── Page.js │ ├── AlertDialog.js │ ├── PullHook.js │ ├── Tabbar.js │ ├── Icon.js │ ├── Modal.js │ ├── Carousel.js │ ├── Input.js │ ├── Splitter.js │ └── Popover.js └── index.html ├── src ├── components │ ├── Tab.jsx │ ├── SimpleWrapper.jsx │ ├── TabActive.jsx │ ├── TabInactive.jsx │ ├── BottomToolbar.jsx │ ├── Util.js │ ├── ListHeader.jsx │ ├── BasicComponent.jsx │ ├── CarouselItem.jsx │ ├── Row.jsx │ ├── SplitterContent.jsx │ ├── Ripple.jsx │ ├── Toolbar.jsx │ ├── Splitter.jsx │ ├── ToolbarButton.jsx │ ├── Col.jsx │ ├── Button.jsx │ ├── BackButton.jsx │ ├── SpeedDialItem.jsx │ ├── ProgressCircular.jsx │ ├── Switch.jsx │ ├── ProgressBar.jsx │ ├── Range.jsx │ ├── SpeedDial.jsx │ ├── Fab.jsx │ ├── ListItem.jsx │ ├── List.jsx │ ├── Modal.jsx │ ├── BaseDialog.jsx │ ├── PullHook.jsx │ ├── Icon.jsx │ ├── LazyList.jsx │ ├── Dialog.jsx │ ├── Input.jsx │ └── AlertDialog.jsx └── index.js ├── CHANGELOG.md ├── .gitignore ├── .npmignore ├── docgen.js ├── index.html ├── karma.conf.js ├── rollup.config.js ├── webpack.config.js ├── githubRelease.js ├── package.json └── README.md /circle.yml: -------------------------------------------------------------------------------- 1 | machine: 2 | node: 3 | version: 6.2.0 4 | -------------------------------------------------------------------------------- /docs/SimpleWrapper.json: -------------------------------------------------------------------------------- 1 | {"description":"","methods":[]} 2 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "OnsenUI"] 2 | path = OnsenUI 3 | url = https://github.com/OnsenUI/OnsenUI.git 4 | -------------------------------------------------------------------------------- /tests.webpack.js: -------------------------------------------------------------------------------- 1 | var context = require.context('./test', true, /-test\.js$/); 2 | context.keys().forEach(context); 3 | -------------------------------------------------------------------------------- /docs/BasicComponent.json: -------------------------------------------------------------------------------- 1 | {"description":"","methods":[{"name":"updateClasses","docblock":null,"modifiers":[],"params":[],"returns":null}]} 2 | -------------------------------------------------------------------------------- /ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /test/todo: -------------------------------------------------------------------------------- 1 | ../src/components/SimpleWrapper.jsx 2 | ../src/components/Popover.jsx 3 | ../src/components/Navigator.jsx 4 | ../src/components/AlertDialog.jsx 5 | ../src/components/BaseDialog.jsx 6 | ../src/components/Dialog.jsx 7 | ../src/components/BasicComponent.jsx 8 | -------------------------------------------------------------------------------- /docs/Tab.json: -------------------------------------------------------------------------------- 1 | {"description":"@original ons-tab\n@category tabbar\n@tutorial react/Reference/tabbar\n@description\n[en] Represents a tab inside tab bar.\n [/en]\n[jp][/jp]\n@example\n\n Home\n","methods":[{"name":"_getDomNodeName","docblock":null,"modifiers":[],"params":[],"returns":null}]} 2 | -------------------------------------------------------------------------------- /test/col-test.js: -------------------------------------------------------------------------------- 1 | /* global describe it assert */ 2 | 3 | import React from 'react'; 4 | import ReactDOM from 'react-dom'; 5 | import {Col} from '../dist/react-onsenui.js'; 6 | import TestUtils from 'react/lib/ReactTestUtils'; 7 | import rendersToComponent from './testUtil.js'; 8 | 9 | describe('Col', function() { 10 | rendersToComponent( 11 | , 12 | 'ons-col' 13 | ); 14 | }); 15 | -------------------------------------------------------------------------------- /test/fab-test.js: -------------------------------------------------------------------------------- 1 | /* global describe it assert */ 2 | 3 | import React from 'react'; 4 | import ReactDOM from 'react-dom'; 5 | import {Fab} from '../dist/react-onsenui.js'; 6 | import TestUtils from 'react/lib/ReactTestUtils'; 7 | import rendersToComponent from './testUtil.js'; 8 | 9 | describe('Fab', function() { 10 | rendersToComponent( 11 | , 12 | 'ons-fab' 13 | ); 14 | }); 15 | -------------------------------------------------------------------------------- /test/row-test.js: -------------------------------------------------------------------------------- 1 | /* global describe it assert */ 2 | 3 | import React from 'react'; 4 | import ReactDOM from 'react-dom'; 5 | import {Row} from '../dist/react-onsenui.js'; 6 | import TestUtils from 'react/lib/ReactTestUtils'; 7 | import rendersToComponent from './testUtil.js'; 8 | 9 | describe('Row', function() { 10 | rendersToComponent( 11 | , 12 | 'ons-row' 13 | ); 14 | }); 15 | -------------------------------------------------------------------------------- /test/tab-test.js: -------------------------------------------------------------------------------- 1 | /* global describe it assert */ 2 | 3 | import React from 'react'; 4 | import ReactDOM from 'react-dom'; 5 | import {Tab} from '../dist/react-onsenui.js'; 6 | import TestUtils from 'react/lib/ReactTestUtils'; 7 | import rendersToComponent from './testUtil.js'; 8 | 9 | describe('Tab', function() { 10 | rendersToComponent( 11 | , 12 | 'ons-tab' 13 | ); 14 | }); 15 | -------------------------------------------------------------------------------- /test/icon-test.js: -------------------------------------------------------------------------------- 1 | /* global describe it assert */ 2 | 3 | import React from 'react'; 4 | import ReactDOM from 'react-dom'; 5 | import {Icon} from '../dist/react-onsenui.js'; 6 | import TestUtils from 'react/lib/ReactTestUtils'; 7 | import rendersToComponent from './testUtil.js'; 8 | 9 | describe('Icon', function() { 10 | rendersToComponent( 11 | , 12 | 'ons-icon' 13 | ); 14 | }); 15 | -------------------------------------------------------------------------------- /test/input.js: -------------------------------------------------------------------------------- 1 | /* global describe it assert */ 2 | 3 | import React from 'react'; 4 | import ReactDOM from 'react-dom'; 5 | import {Input} from '../dist/react-onsenui.js'; 6 | import TestUtils from 'react/lib/ReactTestUtils'; 7 | import rendersToComponent from './testUtil.js'; 8 | 9 | describe('Input', function() { 10 | rendersToComponent( 11 | , 12 | 'ons-input' 13 | ); 14 | }); 15 | -------------------------------------------------------------------------------- /scripts/react-docgen.js: -------------------------------------------------------------------------------- 1 | var Module = require('module'); 2 | var originalRequire = Module.prototype.require; 3 | 4 | Module.prototype.require = function(){ 5 | if (arguments[0].indexOf('isReactComponentClass') > -1) { 6 | return function() { 7 | return true; 8 | } 9 | } 10 | 11 | return originalRequire.apply(this, arguments); 12 | }; 13 | 14 | require('../node_modules/.bin/react-docgen'); 15 | -------------------------------------------------------------------------------- /test/range-test.js: -------------------------------------------------------------------------------- 1 | /* global describe it assert */ 2 | 3 | import React from 'react'; 4 | import ReactDOM from 'react-dom'; 5 | import {Range} from '../dist/react-onsenui.js'; 6 | import TestUtils from 'react/lib/ReactTestUtils'; 7 | 8 | import rendersToComponent from './testUtil.js'; 9 | 10 | describe('Range', function() { 11 | rendersToComponent( 12 | , 13 | 'ons-range' 14 | ); 15 | }); 16 | -------------------------------------------------------------------------------- /test/switch-test.js: -------------------------------------------------------------------------------- 1 | /* global describe it assert */ 2 | 3 | import React from 'react'; 4 | import ReactDOM from 'react-dom'; 5 | import {Switch} from '../dist/react-onsenui.js'; 6 | import TestUtils from 'react/lib/ReactTestUtils'; 7 | import rendersToComponent from './testUtil.js'; 8 | 9 | describe('Switch', function() { 10 | rendersToComponent( 11 | , 12 | 'ons-switch' 13 | ); 14 | }); 15 | -------------------------------------------------------------------------------- /docs/TabActive.json: -------------------------------------------------------------------------------- 1 | {"description":"@original ons-tab-active\n@category tabbar\n@tutorial react/Reference/tabbar\n@description\n[en] Tab element for showing shown when the tab is active [/en]\n[jp][/jp]\n@example\n\n \n HOME\n \n \n home\n \n ","methods":[{"name":"_getDomNodeName","docblock":null,"modifiers":[],"params":[],"returns":null}]} 2 | -------------------------------------------------------------------------------- /test/button-test.js: -------------------------------------------------------------------------------- 1 | /* global describe it assert */ 2 | 3 | import React from 'react'; 4 | import ReactDOM from 'react-dom'; 5 | import {Button} from '../dist/react-onsenui.js'; 6 | import TestUtils from 'react/lib/ReactTestUtils'; 7 | 8 | import rendersToComponent from './testUtil.js'; 9 | 10 | describe('Button', function() { 11 | rendersToComponent( 12 | 33 |
34 |
35 | 1
36 | 1
37 | 1
38 | 39 | 40 |

41 | 42 | ); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/components/BasicComponent.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | 4 | import ons from 'onsenui'; 5 | 6 | class BasicComponent extends React.Component { 7 | constructor(...args) { 8 | super(...args); 9 | this.updateClasses = this.updateClasses.bind(this); 10 | } 11 | 12 | updateClasses() { 13 | var node = ReactDOM.findDOMNode(this); 14 | 15 | if (typeof this.props.className !== 'undefined') { 16 | if (this.lastClass) { 17 | node.className = node.className.replace(this.lastClass, ' '); 18 | } 19 | 20 | this.lastClass = ' ' + this.props.className.trim(); 21 | 22 | node.className = node.className.trim() + this.lastClass; 23 | } 24 | 25 | if (!ons) { 26 | throw new Error("react-onsenui requires `onsenui`, make sure you are loading it with `import onsenui` or `require('onsenui')` before using the components"); 27 | } 28 | 29 | ons._autoStyle.prepare(node); 30 | } 31 | 32 | componentDidMount() { 33 | this.updateClasses(); 34 | } 35 | 36 | componentDidUpdate() { 37 | this.updateClasses(); 38 | } 39 | } 40 | 41 | export default BasicComponent; 42 | -------------------------------------------------------------------------------- /src/components/CarouselItem.jsx: -------------------------------------------------------------------------------- 1 | import SimpleWrapper from './SimpleWrapper.jsx'; 2 | import React from 'react'; 3 | 4 | /** 5 | * @original ons-carousel-item 6 | * @category carousel 7 | * @tutorial react/Reference/carousel 8 | * @description 9 | * [en] Carousel item component. Used as a child of the `` element. 10 | [/en] 11 | * [jp][/jp] 12 | * @example 13 | * 14 | 15 |
GRAY
16 |
17 | 18 |
BLUE
19 |
20 |
21 | */ 22 | class CarouselItem extends SimpleWrapper { 23 | _getDomNodeName() { 24 | return 'ons-carousel-item'; 25 | } 26 | }; 27 | 28 | CarouselItem.propTypes = { 29 | /** 30 | * @name modifier 31 | * @type string 32 | * @description 33 | * [en] 34 | * Specify modifier name to specify custom styles. Optional. 35 | * [/en] 36 | * [jp] どうしよう[/jp] 37 | */ 38 | modifier: React.PropTypes.string 39 | }; 40 | 41 | export default CarouselItem; 42 | -------------------------------------------------------------------------------- /docs/Button.json: -------------------------------------------------------------------------------- 1 | {"description":"@original ons-button\n@category form\n@tutorial react/Reference/button\n@description\n[en] Button component. If you want to place a button in a toolbar, use `ToolbarButton` or `BackButton` instead. Will automatically display as a Material Design button with a ripple effect on Android.\n [/en]\n[jp][/jp]\n@example\n","methods":[{"name":"_getDomNodeName","docblock":null,"modifiers":[],"params":[],"returns":null}],"props":{"modifier":{"type":{"name":"string"},"required":false,"description":"@name modifier\n@type string\n@required false\n@description\n [en]The appearance of the button.[/en]\n [jp] [/jp]"},"disabled":{"type":{"name":"bool"},"required":false,"description":"@name disabled\n@type bool\n@description\n [en]\n Specifies whether the button is disabled.\n [/en]\n [jp] [/jp]"},"ripple":{"type":{"name":"bool"},"required":false,"description":"@name ripple\n@type bool\n@description\n [en]\n Specifies whether the button has a ripple effect.\n [/en]\n [jp] [/jp]"},"onClick":{"type":{"name":"func"},"required":false,"description":"@name onClick\n@type function\n@description\n [en] This function will be called ones the button is clicked. [/en]\n [jp] [/jp]"}}} 2 | -------------------------------------------------------------------------------- /src/components/Row.jsx: -------------------------------------------------------------------------------- 1 | import SimpleWrapper from './SimpleWrapper.jsx'; 2 | import React from 'react'; 3 | import Util from './Util.js'; 4 | 5 | /** 6 | * @original ons-row 7 | * @category grid 8 | * @description 9 | * [en] 10 | * Represents a row in the grid system. Use with `Col` to layout components. 11 | * [/en] 12 | * [jp][/jp] 13 | * 14 | * 15 | * 16 | * 17 | * Text 18 | * 19 | */ 20 | class Row extends SimpleWrapper { 21 | _getDomNodeName() { 22 | return 'ons-row'; 23 | } 24 | 25 | render() { 26 | var {...others} = this.props; 27 | 28 | Util.convert(others, 'verticalAlign', {newName: 'vertical-align'}); 29 | 30 | return React.createElement(this._getDomNodeName(), others, this.props.children); 31 | } 32 | 33 | }; 34 | 35 | Row.propTypes = { 36 | 37 | /** 38 | * @name verticalAlign 39 | * @type {String} 40 | * @description 41 | * [en]Short hand attribute for aligning vertically. Valid values are top, bottom, and center.[/en] 42 | * [ja][/ja] 43 | */ 44 | verticalAlign: React.PropTypes.oneOf(['top', 'bottom', 'center']) 45 | 46 | }; 47 | 48 | export default Row; 49 | -------------------------------------------------------------------------------- /src/components/SplitterContent.jsx: -------------------------------------------------------------------------------- 1 | import SimpleWrapper from './SimpleWrapper.jsx'; 2 | /** 3 | * @original ons-splitter-content 4 | * @category menu 5 | * @tutorial react/Reference/splitter 6 | * @description 7 | * [en] The SplitterContent element is used as a child element of Splitter. 8 | * It contains the main content of the page while SplitterSide contains the list. 9 | [/en] 10 | * [jp][/jp] 11 | * @example 12 | 13 | 17 | Page Left 18 | 19 | 20 | Page Content 21 | 22 | 30 | Page Right 31 | 32 | 33 | */ 34 | class SplitterContent extends SimpleWrapper { 35 | _getDomNodeName() { 36 | return 'ons-splitter-content'; 37 | } 38 | }; 39 | 40 | export default SplitterContent; 41 | -------------------------------------------------------------------------------- /karma.conf.js: -------------------------------------------------------------------------------- 1 | var webpack = require('webpack'); 2 | 3 | module.exports = function(config) { 4 | config.set({ 5 | browsers: [ 'Chrome' ], // run in Chrome 6 | singleRun: true, // just run once by default 7 | frameworks: [ 'mocha', 'chai' ], // use the mocha test framework 8 | files: [ 9 | 'node_modules/onsenui/css/onsenui.css', 10 | 'node_modules/onsenui/css/onsen-css-components.css', 11 | 'tests.webpack.js' // just load this file 12 | ], 13 | preprocessors: { 14 | 'tests.webpack.js': [ 'webpack', 'sourcemap' ] // preprocess with webpack and our sourcemap loader 15 | }, 16 | reporters: [ 'dots' ], // report results in this format 17 | webpack: { // kind of a copy of your webpack config 18 | devtool: 'inline-source-map', // just do inline source maps instead of the default 19 | 20 | module: { 21 | loaders: [ 22 | { test: /\.js$/, loader: 'babel-loader', 23 | exclude: [/node_modules/, /onsenui\.js/], 24 | query: { presets: ['es2015', 'react'] } 25 | } 26 | ] 27 | } 28 | }, 29 | webpackServer: { 30 | noInfo: true // please don't spam the console when running in karma! 31 | } 32 | }); 33 | }; 34 | -------------------------------------------------------------------------------- /docs/BackButton.json: -------------------------------------------------------------------------------- 1 | {"description":"@original ons-back-button\n@category navigation\n@tutorial react/Reference/navigator\n@description\n[en]\n Back button component for Toolbar. It enables to automatically to pop the top page of the navigator. When only presented with one page, the button is hidden automatically.\n\n The default behavior can be overridden using the `onClick` prop.\n[/en]\n[jp][/jp]\n@example\n\n
Back
\n
{this.props.title}
\n
","methods":[{"name":"_getDomNodeName","docblock":null,"modifiers":[],"params":[],"returns":null},{"name":"_updateOnClick","docblock":null,"modifiers":[],"params":[{"name":"props","type":null}],"returns":null}],"props":{"modifier":{"type":{"name":"string"},"required":false,"description":"@name modifier\n@type string\n@required false\n@description\n [en]The appearance of the back button.[/en]\n [jp][/jp]"},"onClick":{"type":{"name":"func"},"required":false,"description":"@name onClick\n@type function\n@description\n [en]This function will be called ones the button is clicked. It overrides the default behavior of the back button.[/en]\n [jp][/jp]"}}} 2 | -------------------------------------------------------------------------------- /demo/examples/LazyList.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | import MyToolbar from './MyToolbar'; 4 | import ons from '../../OnsenUI/build/js/onsenui.js'; 5 | 6 | import { 7 | Page, 8 | BackButton, 9 | Button, 10 | ListItem, 11 | LazyList, 12 | Toolbar 13 | } from '../../src/index.js'; 14 | 15 | export default class extends React.Component { 16 | 17 | constructor(props) { 18 | super(props); 19 | this.state = { 20 | length: 0 21 | }; 22 | } 23 | 24 | renderRow(index) { 25 | return ( 26 | 27 | {'Item ' + (index + 1)} 28 | 29 | ); 30 | } 31 | 32 | render() { 33 | return ( 34 | } > 35 |
36 | 37 | 38 | ons.platform.isAndroid() ? 76 : 45} 42 | /> 43 |
44 |
45 | ); 46 | } 47 | } 48 | 49 | -------------------------------------------------------------------------------- /docs/SpeedDialItem.json: -------------------------------------------------------------------------------- 1 | {"description":"@original ons-speed-dial-item\n@category control\n@tutorial react/Reference/speed-dial\n@description\n[en] This component displays the child elements of the Material Design Speed dial component. [/en]\n[jp][/jp]\n@example\n console.log('test1')} position='left bottom'>\n \n \n \n console.log('speed A')}> A \n console.log('speed B')}> B \n console.log('speed C')}> C \n console.log('speed D')}> D \n ","methods":[{"name":"_getDomNodeName","docblock":null,"modifiers":[],"params":[],"returns":null}],"props":{"modifier":{"type":{"name":"string"},"required":false,"description":"@name modifier\n@type string\n@required false\n@description\n [en]The appearance of the button.[/en]\n [jp] [/jp]"},"onClick":{"type":{"name":"func"},"required":false,"description":"@name onClick\n@type function\n@description\n [en] This function will be called ones the button is clicked. [/en]\n [jp] [/jp]"}}} 2 | -------------------------------------------------------------------------------- /rollup.config.js: -------------------------------------------------------------------------------- 1 | import {readFileSync} from 'fs'; 2 | import babel from 'rollup-plugin-babel'; 3 | import nodeResolve from 'rollup-plugin-node-resolve'; 4 | import replace from 'rollup-plugin-replace'; 5 | import commonjs from 'rollup-plugin-commonjs'; 6 | 7 | const pkg = JSON.parse(readFileSync('package.json', 'utf-8' )); 8 | 9 | export default { 10 | entry: 'src/index.js', 11 | dest: 'dist/react-onsenui.js', 12 | plugins: [ 13 | babel({presets: ['es2015-rollup', 'react', 'stage-2']}), 14 | nodeResolve(), 15 | commonjs({ 16 | 'node_modules/react-dom/server.js': ['ReactDOMServer'] 17 | }), 18 | replace({ 19 | 'process.env.NODE_ENV': JSON.stringify('production') 20 | }), 21 | babel({ 22 | externalHelpers: true, presets: ['es2015-rollup'], plugins: ['transform-react-jsx', 'transform-object-rest-spread'] 23 | }) 24 | ], 25 | external: [ 26 | 'react', 27 | 'react-dom/server', 28 | 'react-dom', 29 | 'onsenui' 30 | ], 31 | globals: { 32 | 'react': 'React', 33 | 'react-dom': 'ReactDOM', 34 | 'react-dom/server': 'ReactDOMServer', 35 | 'onsenui': 'ons' 36 | }, 37 | format: 'umd', 38 | moduleName: 'Ons', 39 | banner: `/*! ${pkg.name} v${pkg.version} - ${new Date()} */`, 40 | sourceMap: true 41 | }; 42 | -------------------------------------------------------------------------------- /demo/examples/Range.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | import { 4 | Page, 5 | Range 6 | } from '../../src/index.js'; 7 | 8 | import MyToolbar from './MyToolbar'; 9 | 10 | export default class extends React.Component { 11 | constructor(props) { 12 | super(props); 13 | this.changeFirstRange = this.changeFirstRange.bind(this); 14 | this.changeSecondRange = this.changeSecondRange.bind(this); 15 | this.state = {value: 20, value2: 50}; 16 | } 17 | 18 | changeFirstRange(event) { 19 | console.log(event.target.value); 20 | this.setState({ 21 | value: parseInt(event.target.value) 22 | }); 23 | } 24 | 25 | changeSecondRange(event) { 26 | this.setState({ 27 | value2: parseInt(event.target.value) 28 | }); 29 | } 30 | 31 | render() { 32 | return ( 33 | } > 34 |
35 | 36 | {this.state.value} 37 |
38 | 39 | {this.state.value2} 40 |
41 | 42 |
43 |
44 | ); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/components/Ripple.jsx: -------------------------------------------------------------------------------- 1 | import SimpleWrapper from './SimpleWrapper.jsx'; 2 | import React from 'react'; 3 | 4 | /** 5 | * @original ons-ripple 6 | * @category visual 7 | * @tutorial react/Reference/ripple 8 | * @description 9 | * [en] 10 | * Adds a Material Design "ripple" effect to an element. 11 | * [/en] 12 | * [jp][/jp] 13 | * @example 14 |
15 | 16 |
17 | */ 18 | class Ripple extends SimpleWrapper { 19 | _getDomNodeName() { 20 | return 'ons-ripple'; 21 | } 22 | }; 23 | 24 | Ripple.propTypes = { 25 | /** 26 | * @name color 27 | * @type string 28 | * @required false 29 | * @description 30 | * [en]Color of the ripple effect.[/en] 31 | * [jp] [/jp] 32 | */ 33 | color: React.PropTypes.string, 34 | 35 | /** 36 | * @name background 37 | * @type string 38 | * @required false 39 | * @description 40 | * [en]Color of the background.[/en] 41 | * [jp] [/jp] 42 | */ 43 | background: React.PropTypes.string, 44 | 45 | /** 46 | * @name disabled 47 | * @type bool 48 | * @description 49 | * [en] 50 | * Specifies whether the button is disabled. 51 | * [/en] 52 | * [jp] [/jp] 53 | */ 54 | disabled: React.PropTypes.bool 55 | }; 56 | 57 | export default Ripple; 58 | -------------------------------------------------------------------------------- /src/components/Toolbar.jsx: -------------------------------------------------------------------------------- 1 | import SimpleWrapper from './SimpleWrapper.jsx'; 2 | import React from 'react'; 3 | 4 | /** 5 | * @original ons-toolbar 6 | * @category page 7 | * @tutorial react/Reference/page 8 | * @description 9 | * [en]Toolbar component that can be used with navigation. Left, center and right container can be specified by class names. This component will automatically displays as a Material Design toolbar when running on Android devices.[/en] 10 | * [jp] どうしよう[/jp] 11 | * @example 12 | * 13 | 14 | 15 |
16 | 17 | Back 18 | 19 |
20 |
21 | Title 22 |
23 |
24 | 25 | 26 | 27 |
28 |
} 29 | /> 30 | */ 31 | class Toolbar extends SimpleWrapper { 32 | _getDomNodeName() { 33 | return 'ons-toolbar'; 34 | } 35 | }; 36 | 37 | Toolbar.propTypes = { 38 | /** 39 | * @name modifier 40 | * @type string 41 | * @description 42 | * [en] 43 | * Specify modifier name to specify custom styles. Optional. 44 | * [/en] 45 | * [jp] どうしよう[/jp] 46 | */ 47 | modifier: React.PropTypes.string 48 | }; 49 | 50 | export default Toolbar; 51 | -------------------------------------------------------------------------------- /docs/ProgressCircular.json: -------------------------------------------------------------------------------- 1 | {"description":"@original ons-progress-circular\n@category visual\n@tutorial react/Reference/progress\n@description\n[en] This component displays a circular progress indicator. It can either be used to show how much of a task has been completed or to show a looping animation to indicate that an operation is currently running.\n[/en]\n[jp][/jp]\n@example\n\n","methods":[{"name":"_getDomNodeName","docblock":null,"modifiers":[],"params":[],"returns":null}],"props":{"modifier":{"type":{"name":"string"},"required":false,"description":"@name modifier\n@type string\n@required false\n@description\n [en]The appearance of the progress indicator.[/en]\n [jp] [/jp]"},"value":{"type":{"name":"number"},"required":false,"description":"@name value\n@type number\n@description\n [en]\n Current progress. Should be a value between 0 and 100.\n [/en]\n [jp] [/jp]"},"secondaryValue":{"type":{"name":"number"},"required":false,"description":"@name secondaryValue\n@type bool\n@description\n [en]\n Current secondary progress. Should be a value between 0 and 100.\n [/en]\n [jp] [/jp]"},"indeterminate":{"type":{"name":"bool"},"required":false,"description":"@name intermediate\n@type bool\n@description\n [en] If this property is set, an infinite looping animation will be shown. [/en]\n [jp] [/jp]"}}} 2 | -------------------------------------------------------------------------------- /src/components/Splitter.jsx: -------------------------------------------------------------------------------- 1 | import SimpleWrapper from './SimpleWrapper.jsx'; 2 | 3 | /** 4 | * @original ons-splitter 5 | * @category menu 6 | * @tutorial react/Reference/splitter 7 | * @description 8 | * [en] A component that enables responsive layout by implementing both a two-column layout and a sliding menu layout. 9 | * 10 | * It can be configured to automatically expand into a column layout on large screens and collapse the menu on smaller screens. When the menu is collapsed the user can open it by swiping. 11 | [/en] 12 | * [jp] どうしよう[/jp] 13 | * @example 14 | 15 | 19 | Page Left 20 | 21 | 22 | Page Content 23 | 24 | 32 | Page Right 33 | 34 | 35 | */ 36 | 37 | class Splitter extends SimpleWrapper { 38 | _getDomNodeName() { 39 | return 'ons-splitter'; 40 | } 41 | }; 42 | 43 | export default Splitter; 44 | -------------------------------------------------------------------------------- /docs/ProgressBar.json: -------------------------------------------------------------------------------- 1 | {"description":"@original ons-progress-bar\n@category visual\n@tutorial react/Reference/progress\n@description\n[en] The component is used to display a linear progress bar. It can either display a progress bar that shows the user how much of a task has been completed. In the case where the percentage is not known it can be used to display an animated progress bar so the user can see that an operation is in progress. [/en]\n[jp][/jp]\n@example\n\n","methods":[{"name":"_getDomNodeName","docblock":null,"modifiers":[],"params":[],"returns":null}],"props":{"modifier":{"type":{"name":"string"},"required":false,"description":"@name modifier\n@type string\n@required false\n@description\n [en]The appearance of the progress indicator.[/en]\n [jp] [/jp]"},"value":{"type":{"name":"number"},"required":false,"description":"@name value\n@type number\n@description\n [en]\n Current progress. Should be a value between 0 and 100.\n [/en]\n [jp] [/jp]"},"secondaryValue":{"type":{"name":"number"},"required":false,"description":"@name secondaryValue\n@type bool\n@description\n [en]\n Current secondary progress. Should be a value between 0 and 100.\n [/en]\n [jp] [/jp]"},"indeterminate":{"type":{"name":"bool"},"required":false,"description":"@name intermediate\n@type bool\n@description\n [en] If this property is set, an infinite looping animation will be shown. [/en]\n [jp] [/jp]"}}} 2 | -------------------------------------------------------------------------------- /src/components/ToolbarButton.jsx: -------------------------------------------------------------------------------- 1 | import SimpleWrapper from './SimpleWrapper.jsx'; 2 | import React from 'react'; 3 | 4 | /** 5 | * @original ons-toolbar-button 6 | * @category page 7 | * @tutorial react/Reference/page 8 | * @description 9 | * [en] 10 | * Button component for the Toolbar. Using this component gives a nice default style. 11 | * 12 | * 13 | * [/en] 14 | * [jp][/jp] 15 | * @example 16 | * 18 | 19 |
Back
20 |
Input
21 |
22 | Add 23 |
24 |
25 | }> 26 | Page Content 27 |
28 | */ 29 | class ToolbarButton extends SimpleWrapper { 30 | _getDomNodeName() { 31 | return 'ons-toolbar-button'; 32 | } 33 | }; 34 | 35 | ToolbarButton.propTypes = { 36 | /** 37 | * @name modifier 38 | * @type string 39 | * @required false 40 | * @description 41 | * [en]The appearance of the button.[/en] 42 | * [jp] [/jp] 43 | */ 44 | modifier: React.PropTypes.string, 45 | 46 | /** 47 | * @name disabled 48 | * @type bool 49 | * @description 50 | * [en] 51 | * Indicates whether the button is disabled. 52 | * [/en] 53 | * [jp] [/jp] 54 | */ 55 | disabled: React.PropTypes.bool 56 | }; 57 | 58 | export default ToolbarButton; 59 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | var webpack = require('webpack'); 2 | var path = require('path'); 3 | 4 | module.exports = { 5 | devtool: 'eval-source-map', 6 | context: __dirname + "/demo", 7 | entry: [ 8 | 'webpack-dev-server/client?http://0.0.0.0:9000', 9 | 'webpack/hot/only-dev-server', 10 | './index.js' 11 | ], 12 | output: { 13 | path: __dirname + '/demo', 14 | filename: "bundle.js" 15 | }, 16 | devServer: { 17 | // contentBase 18 | colors: true, 19 | historyApiFallback: true, 20 | inline: false, 21 | port: 9000, 22 | hot: true 23 | }, 24 | resolve: { 25 | alias: { 26 | 'onsenui': path.join(__dirname, 'OnsenUI/build/js/onsenui.js') 27 | } 28 | }, 29 | module: { 30 | loaders: [ 31 | // font-awesome 32 | { 33 | test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, 34 | loader: 'url-loader?limit=10000&minetype=application/font-woff' 35 | }, 36 | { test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, 37 | loader: 'file-loader' 38 | }, 39 | { 40 | test: /\.json$/, 41 | loader: 'json' 42 | }, 43 | { 44 | test: /\.css$/, 45 | loader: 'style!css' 46 | }, 47 | { test: /\.js$|\.jsx$/, 48 | exclude: [/node_modules/, /onsenui\.js/], 49 | loaders: [ 'react-hot', 50 | 'babel?' + JSON.stringify({presets: ['stage-2', 'es2015', 'react']}) 51 | ] 52 | } 53 | ] 54 | }, 55 | plugins: [ 56 | new webpack.HotModuleReplacementPlugin() 57 | ] 58 | }; 59 | -------------------------------------------------------------------------------- /demo/examples/ProgressBar.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | import { 4 | Page, 5 | ProgressBar, 6 | ProgressCircular 7 | } from '../../src/index.js'; 8 | 9 | import MyToolbar from './MyToolbar'; 10 | 11 | export default class extends React.Component { 12 | constructor(props) { 13 | super(props); 14 | 15 | this.state = { 16 | modifier: 'material', 17 | value: 0, 18 | secondValue: 100 19 | }; 20 | 21 | this.increaseTime = this.increaseTime.bind(this); 22 | this.increaseTime(); 23 | } 24 | 25 | increaseTime() { 26 | this.timeout = setTimeout(() => { 27 | let val = this.state.value + 5; 28 | if (val > 100) val -= 100; 29 | this.setState({value: val}, this.increaseTime); 30 | }, 500); 31 | } 32 | 33 | componentWillUnmount() { 34 | clearTimeout(this.timeout); 35 | } 36 | 37 | render() { 38 | return ( 39 | } 41 | modifier={this.state.modifier} > 42 |
43 |

44 | Progress Bar: 45 |

46 | 47 | 48 | 49 |
50 |

51 | Circular Progress Bar: 52 |

53 | 54 | 55 | 56 |
57 | ); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/components/Col.jsx: -------------------------------------------------------------------------------- 1 | import SimpleWrapper from './SimpleWrapper.jsx'; 2 | import React from 'react'; 3 | import Util from './Util.js'; 4 | 5 | /** 6 | * @original ons-col 7 | * @category grid 8 | * @description 9 | * [en] 10 | * Represents a column in the grid system. Use with `` to layout components. 11 | * [/en] 12 | * [jp][/jp] 13 | * 14 | * 15 | * 16 | * 17 | * Text 18 | * 19 | */ 20 | class Col extends SimpleWrapper { 21 | _getDomNodeName() { 22 | return 'ons-col'; 23 | } 24 | 25 | render() { 26 | var {...others} = this.props; 27 | 28 | Util.convert(others, 'verticalAlign', {newName: 'vertical-align'}); 29 | Util.convert(others, 'width', {fun: Util.sizeConverter}); 30 | 31 | return React.createElement(this._getDomNodeName(), others, this.props.children); 32 | } 33 | 34 | }; 35 | 36 | Col.propTypes = { 37 | 38 | /** 39 | * @name verticalAlign 40 | * @type {String} 41 | * @description 42 | * [en]Short hand attribute for aligning vertically. Valid values are top, bottom, and center.[/en] 43 | * [ja][/ja] 44 | */ 45 | verticalAlign: React.PropTypes.oneOf(['top', 'bottom', 'center']), 46 | 47 | /** 48 | * @name width 49 | * @type {String} 50 | * @description 51 | * [en]The width of the column. Valid values are css width values ("10%", 50).[/en] 52 | * [ja][/ja] 53 | */ 54 | width: React.PropTypes.oneOfType([React.PropTypes.number, React.PropTypes.string]) 55 | }; 56 | 57 | export default Col; 58 | -------------------------------------------------------------------------------- /docs/ListItem.json: -------------------------------------------------------------------------------- 1 | {"description":"@original ons-list-item\n@category list\n@tutorial react/Reference/list\n@description\n [en]\n Component that represents each item in the list. Must be put inside the `List` component. The list item is composed of three parts that are represented with the `left`, `center` and `right` classes. These classes can be used to ensure that the content of the list items is properly aligned.\n [/en]\n[jp][/jp]\n@example\n \n
Left
\n
Center
\n
Right
\n
","methods":[{"name":"_getDomNodeName","docblock":null,"modifiers":[],"params":[],"returns":null}],"props":{"modifier":{"type":{"name":"string"},"required":false,"description":"@name modifier\n@type string\n@required false\n@description\n [en] The appearance of the list item.[/en]\n [jp] [/jp]"},"tappable":{"type":{"name":"bool"},"required":false,"description":"@name tappable\n@type bool\n@description\n [en]\n Specifies whether the list item is tappable.\n [/en]\n [jp] [/jp]"},"tapBackgroundColor":{"type":{"name":"string"},"required":false,"description":"@name tapBackgroundColor\n@type string\n@description\n [en]\n Changes the background color when tapped. For this to work, the attribute \"tappable\" needs to be set. The default color is \"#d9d9d9\". It will display as a ripple effect on Android.\n [/en]\n [jp] [/jp]"},"lockOnDrag":{"type":{"name":"bool"},"required":false,"description":"@name lockOnDrag\n@type bool\n@description\n [en] Prevent vertical scrolling when the user drags horizontally. [/en]\n [jp] [/jp]"}}} 2 | -------------------------------------------------------------------------------- /demo/examples/SpeedDial.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | import { 4 | Page, 5 | Icon, 6 | Fab, 7 | SpeedDial, 8 | SpeedDialItem, 9 | Toolbar, 10 | BackButton 11 | } from '../../src/index.js'; 12 | 13 | export default class extends React.Component { 14 | constructor(props) { 15 | super(props); 16 | 17 | this.state = { 18 | modifier: 'material', 19 | }; 20 | } 21 | 22 | renderToolbar() { 23 | return ( 24 | 25 |
26 | Back 27 |
28 |
29 | Speed Dial 30 |
31 |
32 | ); 33 | } 34 | 35 | renderFixed() { 36 | return ( 37 | console.log('test1')} position='bottom right'> 38 | 39 | 44 | 45 | console.log('speed A')}> A 46 | console.log('speed B')}> B 47 | console.log('speed C')}> C 48 | console.log('speed D')}> D 49 | 50 | ); 51 | } 52 | 53 | render() { 54 | return ( 55 | 56 | 57 | ); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/components/Button.jsx: -------------------------------------------------------------------------------- 1 | import SimpleWrapper from './SimpleWrapper.jsx'; 2 | import React from 'react'; 3 | 4 | /** 5 | * @original ons-button 6 | * @category form 7 | * @tutorial react/Reference/button 8 | * @description 9 | * [en] Button component. If you want to place a button in a toolbar, use `ToolbarButton` or `BackButton` instead. Will automatically display as a Material Design button with a ripple effect on Android. 10 | [/en] 11 | * [jp][/jp] 12 | * @example 13 | * 16 | */ 17 | class Button extends SimpleWrapper { 18 | _getDomNodeName() { 19 | return 'ons-button'; 20 | } 21 | }; 22 | 23 | Button.propTypes = { 24 | /** 25 | * @name modifier 26 | * @type string 27 | * @required false 28 | * @description 29 | * [en]The appearance of the button.[/en] 30 | * [jp] [/jp] 31 | */ 32 | modifier: React.PropTypes.string, 33 | 34 | /** 35 | * @name disabled 36 | * @type bool 37 | * @description 38 | * [en] 39 | * Specifies whether the button is disabled. 40 | * [/en] 41 | * [jp] [/jp] 42 | */ 43 | disabled: React.PropTypes.bool, 44 | 45 | /** 46 | * @name ripple 47 | * @type bool 48 | * @description 49 | * [en] 50 | * Specifies whether the button has a ripple effect. 51 | * [/en] 52 | * [jp] [/jp] 53 | */ 54 | ripple: React.PropTypes.bool, 55 | 56 | /** 57 | * @name onClick 58 | * @type function 59 | * @description 60 | * [en] This function will be called ones the button is clicked. [/en] 61 | * [jp] [/jp] 62 | */ 63 | onClick: React.PropTypes.func 64 | }; 65 | 66 | export default Button; 67 | -------------------------------------------------------------------------------- /demo/examples/List.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import MyToolbar from './MyToolbar'; 3 | 4 | import { 5 | Page, 6 | List, 7 | ListItem, 8 | ListHeader, 9 | Toolbar, 10 | ToolbarButton, 11 | BackButton, 12 | Button 13 | } from '../../src/index.js'; 14 | 15 | export default class extends React.Component { 16 | constructor(props) { 17 | super(props); 18 | 19 | this.state = { 20 | data: [1, 2, 3, 4, 5, 6] 21 | }; 22 | } 23 | 24 | reverseData() { 25 | this.setState({ 26 | data: this.state.data.reverse() 27 | }); 28 | } 29 | 30 | remove(idx) { 31 | const data = this.state.data; 32 | data.splice(idx, 1); 33 | 34 | this.setState({ 35 | data: data 36 | }); 37 | } 38 | 39 | add() { 40 | const data = this.state.data; 41 | data.push(data.length); 42 | 43 | this.setState({ 44 | data: data 45 | }); 46 | } 47 | 48 | render() { 49 | return ( 50 | } > 51 | Header Text } 54 | renderRow={(row, idx) => ( 55 | 56 | {row} 57 | 58 | 59 | )} 60 | renderFooter={() => ( 61 | 62 | )} 63 | /> 64 | 65 | ); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /demo/examples/Page.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | import {Page, Button} from '../../src/index.js'; 4 | 5 | import MyToolbar from './MyToolbar'; 6 | 7 | class Page2 extends React.Component { 8 | constructor(props) { 9 | super(props); 10 | this.state = {}; 11 | } 12 | render() { 13 | console.log('props'); 14 | console.log(this.props); 15 | return ( 16 | 17 | lala 18 | 19 | 20 | ); 21 | } 22 | }; 23 | 24 | export default class extends React.Component { 25 | constructor(props) { 26 | super(props); 27 | 28 | this.state = { 29 | modifier: 'material' 30 | }; 31 | } 32 | 33 | toggleModifier() { 34 | this.setState({ 35 | modifier: this.state.modifier === 'material' ? '' : 'material' 36 | }); 37 | } 38 | 39 | render() { 40 | return ( 41 | } 44 | modifier={this.state.modifier} > 45 |

46 | This is a page! 47 |

48 |

49 | 50 |
51 |
52 | 62 |

63 |
64 | ); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /githubRelease.js: -------------------------------------------------------------------------------- 1 | var prompt = require('prompt'); 2 | var GitHubApi = require('github'); 3 | var colors = require('colors'); 4 | 5 | colors.setTheme({ warn: 'yellow', error: 'red', success: 'green' }); 6 | 7 | prompt.start(); 8 | 9 | var github = new GitHubApi({version: '3.0.0'}); 10 | 11 | var properties = [ 12 | { 13 | description: 'GitHub username', 14 | name: 'username' 15 | }, 16 | { 17 | description: 'GitHub password', 18 | name: 'password', 19 | hidden: true 20 | } 21 | ]; 22 | 23 | var login = (callback) => { 24 | prompt.get(properties, (err, result) => { 25 | github.authenticate({ 26 | type: 'basic', 27 | username: result.username, 28 | password: result.password 29 | }); 30 | 31 | github.repos.getLatestRelease({ 32 | user: 'OnsenUI', 33 | repo: 'react-onsenui' 34 | }, (err, res) => { 35 | if (err != null) { 36 | console.log('Wrong Username/Password'.warn); 37 | return login(callback); 38 | } else { 39 | callback(res); 40 | } 41 | }); 42 | }); 43 | }; 44 | 45 | var data = login((res) => { 46 | var tagname = res.tag_name; 47 | var nodeJSON = require('./package.json'); 48 | var version = nodeJSON.version; 49 | 50 | if (tagname == version) { 51 | console.log('Error: Version has already been released, update package.json first'.error); 52 | } else { 53 | github.repos.createRelease( { 54 | user: 'OnsenUI', 55 | repo: 'react-onsenui', 56 | tag_name: version 57 | }, function(err, war) { 58 | if (err) { 59 | console.log('An error occurred'.error); 60 | } else { 61 | console.log(('New version ' + version + ' released').success); 62 | } 63 | }); 64 | } 65 | }); 66 | -------------------------------------------------------------------------------- /docs/LazyList.json: -------------------------------------------------------------------------------- 1 | {"description":"@original ons-lazy-repeat\n@category list\n@tutorial react/Reference/lazy-list\n@description\n[en] Using this component a list with millions of items can be rendered without a drop in performance.\n It does that by \"lazily\" loading elements into the DOM when they come into view and\n removing items from the DOM when they are not visible.\n [/en]\n[jp][/jp]\n@example\n\n renderRow(index) {\n return (\n \n {'Item ' + (index + 1)}\n \n );\n }\n\n render() {\n return (\n } >\n
\n \n \n {'Item ' + (index + 1)}\n \n }\n calculateItemHeight={() => 44}\n />\n
\n
\n );\n }\n}","methods":[{"name":"update","docblock":null,"modifiers":[],"params":[{"name":"props","type":null}],"returns":null}],"props":{"modifier":{"type":{"name":"string"},"required":false,"description":"@name modifier\n@type string\n@required false\n@description\n [en]The appearance of the lazy list.[/en]\n [jp] [/jp]"},"length":{"type":{"name":"number"},"required":true,"description":"@name length\n@type number\n@description\n [en]The length of the list.[/en]\n [jp] [/jp]"},"renderRow":{"type":{"name":"func"},"required":true,"description":"@name renderRow\n@type function\n@description\n [en] A function given the index of the to display row, renders it.[/en]\n [jp] [/jp]"},"calculateItemHeight":{"type":{"name":"func"},"required":true,"description":"@name calculateItemHeight\n@type function\n@description\n [en] A function given the index of the to row, returns the height of it.[/en]\n [jp] [/jp]"}}} 2 | -------------------------------------------------------------------------------- /src/components/BackButton.jsx: -------------------------------------------------------------------------------- 1 | import SimpleWrapper from './SimpleWrapper.jsx'; 2 | import React from 'react'; 3 | import ReactDOM from 'react-dom'; 4 | 5 | /** 6 | * @original ons-back-button 7 | * @category navigation 8 | * @tutorial react/Reference/navigator 9 | * @description 10 | * [en] 11 | * Back button component for Toolbar. It enables to automatically to pop the top page of the navigator. When only presented with one page, the button is hidden automatically. 12 | * 13 | * The default behavior can be overridden using the `onClick` prop. 14 | * [/en] 15 | * [jp][/jp] 16 | * @example 17 | * 18 |
Back
19 |
{this.props.title}
20 |
21 | */ 22 | class BackButton extends SimpleWrapper { 23 | _getDomNodeName() { 24 | return 'ons-back-button'; 25 | } 26 | 27 | _updateOnClick(props) { 28 | const node = ReactDOM.findDOMNode(this); 29 | 30 | if (props.onClick) { 31 | node.onClick = () => null; 32 | } else { 33 | delete node.onClick; 34 | } 35 | } 36 | 37 | componentDidMount() { 38 | this._updateOnClick(this.props); 39 | } 40 | 41 | componentWillReceiveProps(props) { 42 | this._updateOnClick(props); 43 | } 44 | }; 45 | 46 | BackButton.propTypes = { 47 | /** 48 | * @name modifier 49 | * @type string 50 | * @required false 51 | * @description 52 | * [en]The appearance of the back button.[/en] 53 | * [jp][/jp] 54 | */ 55 | modifier: React.PropTypes.string, 56 | 57 | /** 58 | * @name onClick 59 | * @type function 60 | * @description 61 | * [en]This function will be called ones the button is clicked. It overrides the default behavior of the back button.[/en] 62 | * [jp][/jp] 63 | */ 64 | onClick: React.PropTypes.func 65 | }; 66 | 67 | export default BackButton; 68 | -------------------------------------------------------------------------------- /docs/List.json: -------------------------------------------------------------------------------- 1 | {"description":"@original ons-list\n@category list\n@tutorial react/Reference/list\n@description\n [en]\n Component for representing a list. It takes an array called datasource and calls renderRow(row, index) for every row. Furthermore, the header and the footer can be specified with `renderRow` and `renderHeader` respectivly. [/en]\n[jp][/jp]\n@example\n (\n \n {row}\n \n \n )}\n renderFooter={this.renderFooter}\n />","methods":[],"props":{"modifier":{"type":{"name":"string"},"required":false,"description":"@name modifier\n@type string\n@description\n [en]\n Specify modifier name to specify custom styles.\n [/en]\n [jp] どうしよう[/jp]"},"dataSource":{"type":{"name":"array"},"required":false,"description":"@name dataSource\n@type string\n@description\n [en]\n Source of the list data. Should be an array.\n [/en]\n [jp] どうしよう[/jp]","defaultValue":{"value":"[]","computed":false}},"renderRow":{"type":{"name":"func"},"required":false,"description":"@name renderRow\n@type function\n@description\n [en]\n Function to specify the rendering function for every element in\n in the dataSource.\n [/en]\n [jp] どうしよう[/jp]","defaultValue":{"value":"() => null","computed":false}},"renderHeader":{"type":{"name":"func"},"required":false,"description":"@name renderHeader\n@type function\n@description\n [en]\n Function to specify the rendering function for the header\n [/en]\n [jp] どうしよう[/jp]","defaultValue":{"value":"() => null","computed":false}},"renderFooter":{"type":{"name":"func"},"required":false,"description":"@name renderFooter\n@type function\n@description\n [en]\n Function to specify the rendering function for the footer\n [/en]\n [jp] どうしよう[/jp]","defaultValue":{"value":"() => null","computed":false}}}} 2 | -------------------------------------------------------------------------------- /demo/examples/AlertDialog.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | import {Page, Toolbar, Button, BackButton, AlertDialog} from '../../src/index.js'; 4 | 5 | export default class extends React.Component { 6 | constructor(props) { 7 | super(props); 8 | 9 | this.state = { 10 | isOpen: false 11 | }; 12 | } 13 | 14 | handleClick() { 15 | this.setState({ 16 | isOpen: true 17 | }); 18 | } 19 | 20 | handleCancel() { 21 | this.setState({ 22 | isOpen: false 23 | }); 24 | } 25 | 26 | render() { 27 | return ( 28 | 31 |
32 | Back 33 |
34 |
35 | Alert dialog 36 |
37 |
38 | } 39 | > 40 | 41 |

42 | 43 |

44 | 45 | 53 |
Warning!
54 |
55 | An error has occurred! 56 |
57 |
58 | 61 | 64 |
65 |
66 |
67 | ); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/components/SpeedDialItem.jsx: -------------------------------------------------------------------------------- 1 | import SimpleWrapper from './SimpleWrapper.jsx'; 2 | import ReactDOM from 'react-dom'; 3 | import React from 'react'; 4 | 5 | /** 6 | * @original ons-speed-dial-item 7 | * @category control 8 | * @tutorial react/Reference/speed-dial 9 | * @description 10 | * [en] This component displays the child elements of the Material Design Speed dial component. [/en] 11 | * [jp][/jp] 12 | * @example 13 | * console.log('test1')} position='left bottom'> 14 | 15 | 16 | 17 | console.log('speed A')}> A 18 | console.log('speed B')}> B 19 | console.log('speed C')}> C 20 | console.log('speed D')}> D 21 | 22 | */ 23 | class SpeedDialItem extends SimpleWrapper { 24 | _getDomNodeName() { 25 | return 'ons-speed-dial-item'; 26 | } 27 | 28 | componentDidMount() { 29 | super.componentDidMount(); 30 | var node = ReactDOM.findDOMNode(this); 31 | node.addEventListener('click', this.props.onClick); 32 | } 33 | 34 | componentWillUnmount() { 35 | var node = ReactDOM.findDOMNode(this); 36 | node.removeEventListener('click', this.props.onClick); 37 | } 38 | }; 39 | 40 | SpeedDialItem.propTypes = { 41 | /** 42 | * @name modifier 43 | * @type string 44 | * @required false 45 | * @description 46 | * [en]The appearance of the button.[/en] 47 | * [jp] [/jp] 48 | */ 49 | modifier: React.PropTypes.string, 50 | 51 | /** 52 | * @name onClick 53 | * @type function 54 | * @description 55 | * [en] This function will be called ones the button is clicked. [/en] 56 | * [jp] [/jp] 57 | */ 58 | onClick: React.PropTypes.func 59 | }; 60 | 61 | export default SpeedDialItem; 62 | -------------------------------------------------------------------------------- /demo/examples/PullHook.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | import { 4 | Page, 5 | PullHook, 6 | Fab, 7 | Icon, 8 | Toolbar, 9 | List, 10 | ListItem 11 | } from '../../src/index.js'; 12 | 13 | import MyToolbar from './MyToolbar.js'; 14 | 15 | class MyPullHook extends React.Component { 16 | constructor(props) { 17 | super(props); 18 | this.onLoad = this.onLoad.bind(this); 19 | this.onChange = this.onChange.bind(this); 20 | this.state = {pullHookState: 'initial'}; 21 | } 22 | 23 | onLoad(done) { 24 | setTimeout(done, 1000); 25 | } 26 | 27 | onChange(event) { 28 | console.log('state : ' + event.state); 29 | this.setState({pullHookState: event.state}); 30 | } 31 | 32 | render() { 33 | var child; 34 | 35 | if (this.state.pullHookState === 'initial') { 36 | child = 37 | 41 | Pull down to refresh 42 | ; 43 | } else if (this.state.pullHookState === 'preaction') { 44 | child = Release to refresh; 45 | } else { 46 | child = Loading data...; 47 | } 48 | 49 | return ( 50 | 51 | {child} 52 | 53 | ); 54 | } 55 | }; 56 | 57 | export default class extends React.Component { 58 | constructor(props) { 59 | super(props); 60 | 61 | this.state = { 62 | modifier: 'material' 63 | }; 64 | } 65 | 66 | render() { 67 | return ( 68 | } 70 | renderFixed={() => }> 71 | 72 | 73 | {data}} /> 76 | 77 | ); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /docs/SpeedDial.json: -------------------------------------------------------------------------------- 1 | {"description":"@original ons-speed-dial\n@category control\n@tutorial react/Reference/speed-dial\n@description\n[en] Element that displays a Material Design Speed Dialog component. It is useful when there are more than one primary action that can be performed in a page.\n The Speed dial looks like a `Fab` element but will expand a menu when tapped.\n [/en]\n[jp][/jp]\n@example\n console.log('test1')} position='left bottom'>\n \n \n \n console.log('speed A')}> A \n console.log('speed B')}> B \n console.log('speed C')}> C \n console.log('speed D')}> D \n ","methods":[{"name":"_getDomNodeName","docblock":null,"modifiers":[],"params":[],"returns":null}],"props":{"modifier":{"type":{"name":"string"},"required":false,"description":"@name modifier\n@type string\n@required false\n@description\n [en]The appearance of the speed dial.[/en]\n [jp] [/jp]"},"position":{"type":{"name":"string"},"required":false,"description":"@name position\n@type string\n@description\n [en]Specify the vertical and horizontal position of the component.\n I.e. to display it in the top right corner specify \"right top\".\n Choose from \"right\", \"left\", \"top\" and \"bottom\".\n[/en]\n [jp] [/jp]"},"direction":{"type":{"name":"enum","value":[{"value":"'up'","computed":false},{"value":"'down'","computed":false},{"value":"'left'","computed":false},{"value":"'right'","computed":false}]},"required":false,"description":"@name direction\n@type string\n@description\n [en]Specify the direction the items are displayed. Possible values are \"up\", \"down\", \"left\" and \"right\".[/en]\n [jp] [/jp]"},"disabled":{"type":{"name":"bool"},"required":false,"description":"@name disabled\n@type string\n@description\n [en]Specify if button should be disabled.[/en]\n [jp] [/jp]"}}} 2 | -------------------------------------------------------------------------------- /demo/examples/Tabbar.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | import {Tabbar, Tab, Page, Button} from '../../src/index.js'; 4 | import MyToolbar from './MyToolbar'; 5 | 6 | class TabPage extends React.Component { 7 | render() { 8 | return ( 9 | } > 10 | {this.props.active 11 | ?

This is the {this.props.title} page.

12 | : null} 13 | 14 |
15 | ); 16 | } 17 | } 18 | 19 | export default class extends React.Component { 20 | 21 | constructor(props) { 22 | super(props); 23 | this.state = { 24 | index: 0 25 | }; 26 | this.renderTabs = this.renderTabs.bind(this); 27 | } 28 | 29 | renderTabs(activeIndex, tabbar) { 30 | console.log('index : ' , activeIndex); 31 | return [ 32 | { 33 | content: { this.setState({index: 1}); }} 34 | title='Home' active={activeIndex == 0} tabbar={tabbar} />, 35 | tab: console.log('click home')} 37 | label='Home' 38 | icon='md-home' /> 39 | }, 40 | { 41 | content: { this.setState({index: 0}); }} 43 | 44 | title='Settings' active={activeIndex == 1} tabbar={tabbar} />, 45 | tab: console.log('click setting')} label='Settings' icon='md-settings' /> 46 | } 47 | ]; 48 | } 49 | 50 | render() { 51 | return ( 52 | 53 | 56 | { 57 | this.setState({index: event.index}); 58 | console.log('preChange', event.index); 59 | } 60 | } 61 | onPostChange={() => console.log('postChange')} 62 | onReactive={() => console.log('postChange')} 63 | position='bottom' 64 | renderTabs={this.renderTabs} 65 | /> 66 | 67 | ); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /demo/examples/Icon.js: -------------------------------------------------------------------------------- 1 | 2 | import React from 'react'; 3 | 4 | import {Button, Page, Icon} from '../../src/index.js'; 5 | 6 | import MyToolbar from './MyToolbar'; 7 | 8 | export default class extends React.Component { 9 | constructor(props) { 10 | super(props); 11 | 12 | this.changeModifier = this.changeModifier.bind(this); 13 | this.state = { 14 | showMaterial: false, 15 | btnText: 'Switch to material design', 16 | modifier: 'defaullt', 17 | }; 18 | } 19 | 20 | changeModifier() { 21 | if (this.state.showMaterial) { 22 | this.setState({ 23 | showMaterial: false, 24 | btnText: 'Switch to material design', 25 | modifier: 'defaullt', 26 | }); 27 | } else { 28 | this.setState({ 29 | showMaterial: true, 30 | btnText: 'Switch to default design', 31 | modifier: 'material' 32 | }); 33 | } 34 | } 35 | 36 | render() { 37 | return ( 38 | } > 39 |
40 |

41 | 42 |

modifier: {this.state.modifier}

43 |

Button standard

44 | 48 |

Button standard2

49 | {[0, 90, 180, 270].map((val) => 50 | 51 | 63 | )} 64 |
65 |
66 | ); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /docs/Modal.json: -------------------------------------------------------------------------------- 1 | {"description":"@original ons-modal\n@category dialog\n@tutorial react/Reference/modal\n@description\n[en]\n A modal component covers the entire screen. Underlying components are not\n subject to any events while the modal component is shown.\n\n This component can be used to block user input while some operation is\n running or to show some information to the user.\n[/en]\n[jp]\n 画面全体をマスクするモーダル用コンポーネントです。下側にあるコンポーネントは、\n モーダルが表示されている間はイベント通知が行われません\n[/jp]\n@example\n (\n \n Loading ...\n \n )}>\n
Page content
\n
","methods":[{"name":"_update","docblock":null,"modifiers":[],"params":[{"name":"props","type":null},{"name":"isOpen","type":null}],"returns":null}],"props":{"animation":{"type":{"name":"enum","value":[{"value":"'none'","computed":false},{"value":"'fade'","computed":false}]},"required":false,"description":"@property animation\n@type {String}\n@description\n [en]\n Animation name. Available animations are `\"slide\"`, `\"lift\"`, `\"fade\"` and `\"none\"`.\n These are platform based animations. For fixed animations, add `\"-ios\"` or `\"-md\"` suffix to the animation name. E.g. `\"lift-ios\"`, `\"lift-md\"`. Defaults values are `\"slide-ios\"` and `\"fade-md\"`.\n [/en]","defaultValue":{"value":"'none'","computed":false}},"animationOptions":{"type":{"name":"object"},"required":false,"description":"@name animationOptions\n@type object\n@description\n [en]Specify the animation's duration, delay and timing. E.g. `{duration: 0.2, delay: 0.4, timing: 'ease-in'}`.[/en]"},"onShow":{"type":{"name":"func"},"required":false,"description":"@name onShow\n@type function\n@required false\n@description\n [en]\n Called Fired right after the modal is shown.\n [/en]"},"onHide":{"type":{"name":"func"},"required":false,"description":"@name onHide\n@type function\n@required false\n@description\n [en]\n Called after the modal is hidden.\n [/en]"},"isOpen":{"type":{"name":"bool"},"required":false,"description":"@name isOpen\n@type boolean\n@description\n [en]When `true` the modal will show itself.[/en]","defaultValue":{"value":"false","computed":false}}}} 2 | -------------------------------------------------------------------------------- /src/components/ProgressCircular.jsx: -------------------------------------------------------------------------------- 1 | import SimpleWrapper from './SimpleWrapper.jsx'; 2 | import React from 'react'; 3 | import Util from './Util.js'; 4 | 5 | /** 6 | * @original ons-progress-circular 7 | * @category visual 8 | * @tutorial react/Reference/progress 9 | * @description 10 | * [en] This component displays a circular progress indicator. It can either be used to show how much of a task has been completed or to show a looping animation to indicate that an operation is currently running. 11 | * [/en] 12 | * [jp][/jp] 13 | * @example 14 | * 15 | * 16 | */ 17 | class ProgressCircular extends SimpleWrapper { 18 | _getDomNodeName() { 19 | return 'ons-progress-circular'; 20 | } 21 | 22 | render() { 23 | var {...others} = this.props; 24 | 25 | Util.convert(others, 'indeterminate'); 26 | Util.convert(others, 'secondaryValue', {newName: 'secondary-value'}); 27 | 28 | return React.createElement(this._getDomNodeName(), others, this.props.children); 29 | } 30 | 31 | }; 32 | 33 | ProgressCircular.propTypes = { 34 | /** 35 | * @name modifier 36 | * @type string 37 | * @required false 38 | * @description 39 | * [en]The appearance of the progress indicator.[/en] 40 | * [jp] [/jp] 41 | */ 42 | modifier: React.PropTypes.string, 43 | 44 | /** 45 | * @name value 46 | * @type number 47 | * @description 48 | * [en] 49 | * Current progress. Should be a value between 0 and 100. 50 | * [/en] 51 | * [jp] [/jp] 52 | */ 53 | value: React.PropTypes.number, 54 | 55 | /** 56 | * @name secondaryValue 57 | * @type bool 58 | * @description 59 | * [en] 60 | * Current secondary progress. Should be a value between 0 and 100. 61 | * [/en] 62 | * [jp] [/jp] 63 | */ 64 | secondaryValue: React.PropTypes.number, 65 | 66 | /** 67 | * @name intermediate 68 | * @type bool 69 | * @description 70 | * [en] If this property is set, an infinite looping animation will be shown. [/en] 71 | * [jp] [/jp] 72 | */ 73 | indeterminate: React.PropTypes.bool 74 | }; 75 | 76 | export default ProgressCircular; 77 | -------------------------------------------------------------------------------- /src/components/Switch.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import BasicComponent from './BasicComponent.jsx'; 3 | import Util from './Util.js'; 4 | 5 | /** 6 | * @original ons-switch 7 | * @category form 8 | * @tutorial react/Reference/switch 9 | * @description 10 | * [en] Switch component. The switch can be toggled both by dragging and tapping. 11 | * Will automatically displays a Material Design switch on Android devices. 12 | [/en] 13 | * [jp][/jp] 14 | * @example 15 | * 16 | */ 17 | class Switch extends BasicComponent { 18 | 19 | componentDidMount() { 20 | super.componentDidMount(); 21 | this.refs.switch.addEventListener('change', this.props.onChange); 22 | } 23 | 24 | componentWillUnmount() { 25 | this.refs.switch.removeEventListener('change', this.props.onChange); 26 | } 27 | 28 | render() { 29 | var {checked, inputId, ...other} = this.props; 30 | 31 | Util.convert(other, 'disabled'); 32 | 33 | if (inputId) { 34 | other['input-id'] = inputId; 35 | } 36 | return ( 37 | 38 | ); 39 | } 40 | }; 41 | 42 | Switch.propTypes = { 43 | /** 44 | * @name onChange 45 | * @type function 46 | * @description 47 | * [en] Called when the value of the switch changes (checked/unchecked) [/en] 48 | * [jp] [/jp] 49 | */ 50 | onChange: React.PropTypes.func, 51 | 52 | /** 53 | * @name checked 54 | * @type bool 55 | * @description 56 | * [en] Whether the switch is checked.[/en] 57 | * [jp] [/jp] 58 | */ 59 | checked: React.PropTypes.bool, 60 | 61 | /** 62 | * @name disabled 63 | * @type bool 64 | * @description 65 | * [en] If set, the switch is disabled.[/en] 66 | * [jp] [/jp] 67 | */ 68 | disabled: React.PropTypes.bool, 69 | 70 | /** 71 | * @name inputId 72 | * @type bool 73 | * @description 74 | * [en] Specify the `id` attribute of the inner `` element. This is useful when using `