├── .gitignore
├── docs
├── build
│ ├── img
│ │ └── bg_1.png
│ ├── fonts
│ │ ├── roboto
│ │ │ ├── Roboto-Bold.ttf
│ │ │ ├── Roboto-Thin.ttf
│ │ │ ├── Roboto-Bold.woff
│ │ │ ├── Roboto-Bold.woff2
│ │ │ ├── Roboto-Light.ttf
│ │ │ ├── Roboto-Light.woff
│ │ │ ├── Roboto-Light.woff2
│ │ │ ├── Roboto-Medium.ttf
│ │ │ ├── Roboto-Medium.woff
│ │ │ ├── Roboto-Regular.ttf
│ │ │ ├── Roboto-Thin.woff
│ │ │ ├── Roboto-Thin.woff2
│ │ │ ├── Roboto-Medium.woff2
│ │ │ ├── Roboto-Regular.woff
│ │ │ └── Roboto-Regular.woff2
│ │ └── icons
│ │ │ ├── Material-Design-Icons.eot
│ │ │ ├── Material-Design-Icons.ttf
│ │ │ ├── Material-Design-Icons.woff
│ │ │ ├── Material-Design-Icons.woff2
│ │ │ └── LICENSE.txt
│ ├── index.html
│ ├── css
│ │ ├── docs.css
│ │ └── prism.css
│ └── js
│ │ ├── prism.js
│ │ └── material.min.js
└── src
│ ├── components
│ ├── index.js
│ ├── docComponents.js
│ ├── docCode.js
│ └── docComponent.js
│ ├── views
│ ├── startView.js
│ ├── index.js
│ ├── benchmarkView.js
│ ├── slidersView.js
│ ├── badgesView.js
│ ├── tablesView.js
│ ├── textfieldsView.js
│ ├── togglesView.js
│ ├── loadingView.js
│ ├── menusView.js
│ ├── layoutView.js
│ ├── cardsView.js
│ └── buttonsView.js
│ └── app.js
├── lib
├── menuItem.js
├── layout
│ ├── layoutContent.js
│ ├── layoutDrawer.js
│ ├── layoutSpacer.js
│ ├── layoutHeaderRow.js
│ ├── layoutTitle.js
│ ├── layout.js
│ └── layoutHeader.js
├── navigation
│ ├── navigation.js
│ └── navigationLink.js
├── tabs
│ ├── tabsPanel.js
│ └── tabs.js
├── badge.js
├── icon.js
├── card
│ ├── cardMenu.js
│ ├── cardActions.js
│ ├── cardSupportingText.js
│ ├── card.js
│ ├── cardMedia.js
│ └── cardTitle.js
├── menu.js
├── spinner.js
├── grid
│ ├── grid.js
│ └── gridCell.js
├── slider.js
├── progress.js
├── button.js
├── toggle.js
├── textfield.js
├── table.js
└── index.js
├── package.json
├── webpack.config.js
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | !docs/build/
--------------------------------------------------------------------------------
/docs/build/img/bg_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zarxor/mdl-reactjs/HEAD/docs/build/img/bg_1.png
--------------------------------------------------------------------------------
/docs/build/fonts/roboto/Roboto-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zarxor/mdl-reactjs/HEAD/docs/build/fonts/roboto/Roboto-Bold.ttf
--------------------------------------------------------------------------------
/docs/build/fonts/roboto/Roboto-Thin.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zarxor/mdl-reactjs/HEAD/docs/build/fonts/roboto/Roboto-Thin.ttf
--------------------------------------------------------------------------------
/docs/build/fonts/roboto/Roboto-Bold.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zarxor/mdl-reactjs/HEAD/docs/build/fonts/roboto/Roboto-Bold.woff
--------------------------------------------------------------------------------
/docs/build/fonts/roboto/Roboto-Bold.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zarxor/mdl-reactjs/HEAD/docs/build/fonts/roboto/Roboto-Bold.woff2
--------------------------------------------------------------------------------
/docs/build/fonts/roboto/Roboto-Light.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zarxor/mdl-reactjs/HEAD/docs/build/fonts/roboto/Roboto-Light.ttf
--------------------------------------------------------------------------------
/docs/build/fonts/roboto/Roboto-Light.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zarxor/mdl-reactjs/HEAD/docs/build/fonts/roboto/Roboto-Light.woff
--------------------------------------------------------------------------------
/docs/build/fonts/roboto/Roboto-Light.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zarxor/mdl-reactjs/HEAD/docs/build/fonts/roboto/Roboto-Light.woff2
--------------------------------------------------------------------------------
/docs/build/fonts/roboto/Roboto-Medium.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zarxor/mdl-reactjs/HEAD/docs/build/fonts/roboto/Roboto-Medium.ttf
--------------------------------------------------------------------------------
/docs/build/fonts/roboto/Roboto-Medium.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zarxor/mdl-reactjs/HEAD/docs/build/fonts/roboto/Roboto-Medium.woff
--------------------------------------------------------------------------------
/docs/build/fonts/roboto/Roboto-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zarxor/mdl-reactjs/HEAD/docs/build/fonts/roboto/Roboto-Regular.ttf
--------------------------------------------------------------------------------
/docs/build/fonts/roboto/Roboto-Thin.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zarxor/mdl-reactjs/HEAD/docs/build/fonts/roboto/Roboto-Thin.woff
--------------------------------------------------------------------------------
/docs/build/fonts/roboto/Roboto-Thin.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zarxor/mdl-reactjs/HEAD/docs/build/fonts/roboto/Roboto-Thin.woff2
--------------------------------------------------------------------------------
/docs/build/fonts/roboto/Roboto-Medium.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zarxor/mdl-reactjs/HEAD/docs/build/fonts/roboto/Roboto-Medium.woff2
--------------------------------------------------------------------------------
/docs/build/fonts/roboto/Roboto-Regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zarxor/mdl-reactjs/HEAD/docs/build/fonts/roboto/Roboto-Regular.woff
--------------------------------------------------------------------------------
/docs/build/fonts/roboto/Roboto-Regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zarxor/mdl-reactjs/HEAD/docs/build/fonts/roboto/Roboto-Regular.woff2
--------------------------------------------------------------------------------
/docs/build/fonts/icons/Material-Design-Icons.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zarxor/mdl-reactjs/HEAD/docs/build/fonts/icons/Material-Design-Icons.eot
--------------------------------------------------------------------------------
/docs/build/fonts/icons/Material-Design-Icons.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zarxor/mdl-reactjs/HEAD/docs/build/fonts/icons/Material-Design-Icons.ttf
--------------------------------------------------------------------------------
/docs/build/fonts/icons/Material-Design-Icons.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zarxor/mdl-reactjs/HEAD/docs/build/fonts/icons/Material-Design-Icons.woff
--------------------------------------------------------------------------------
/docs/build/fonts/icons/Material-Design-Icons.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zarxor/mdl-reactjs/HEAD/docs/build/fonts/icons/Material-Design-Icons.woff2
--------------------------------------------------------------------------------
/docs/src/components/index.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | DocCode: require('./docCode'),
3 | DocComponent: require('./docComponent'),
4 | DocComponents: require('./docComponents'),
5 | };
6 |
--------------------------------------------------------------------------------
/docs/src/components/docComponents.js:
--------------------------------------------------------------------------------
1 | var React = require("react");
2 |
3 | module.exports = React.createClass({
4 |
5 | getDefaultProps: function() {
6 | return {
7 | };
8 | },
9 |
10 | render: function () {
11 | return
12 | {this.props.children}
13 |
;
14 | },
15 |
16 | componentDidMount: function() {
17 | }
18 | });
19 |
--------------------------------------------------------------------------------
/docs/src/views/startView.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import readmeFile from '../../../README.md';
3 |
4 | export default class StartView extends React.Component {
5 | constructor(props) {
6 | super(props);
7 | }
8 |
9 | render() {
10 | return (
11 |
14 | );
15 | }
16 | }
--------------------------------------------------------------------------------
/docs/src/components/docCode.js:
--------------------------------------------------------------------------------
1 | var React = require("react");
2 |
3 | module.exports = React.createClass({
4 |
5 | getDefaultProps: function() {
6 | return {
7 | language: 'jsx'
8 | };
9 | },
10 |
11 | render: function () {
12 | return
13 | {this.props.title}
14 |
15 | {this.props.children}
16 |
17 |
18 | },
19 |
20 | componentDidMount: function() {
21 | Prism.highlightAll();
22 | }
23 | });
24 |
--------------------------------------------------------------------------------
/docs/src/components/docComponent.js:
--------------------------------------------------------------------------------
1 | var React = require("react");
2 |
3 | module.exports = React.createClass({
4 |
5 | getDefaultProps: function() {
6 | return {
7 | caption: ''
8 | };
9 | },
10 |
11 | render: function () {
12 | return
13 |
14 | {this.props.children}
15 |
16 |
17 | {this.props.caption}
18 |
19 |
20 | },
21 |
22 | componentDidMount: function() {
23 | }
24 | });
25 |
--------------------------------------------------------------------------------
/lib/menuItem.js:
--------------------------------------------------------------------------------
1 |
2 | var React = require("react"),
3 | cx = require('classnames'),
4 | _ = require('lodash');
5 |
6 | var _defaultProps = {
7 | };
8 |
9 |
10 | module.exports = React.createClass({
11 | displayName : 'MDL.MenuItem',
12 |
13 | propTypes: {
14 |
15 | },
16 |
17 | getDefaultProps: function() {
18 | return _defaultProps;
19 | },
20 |
21 | _getClasses: function() {
22 | var classes = {
23 | 'mdl-menu__item': true
24 | };
25 | return cx(classes);
26 | },
27 |
28 | _getElement: function() {
29 | return React.createElement("li", null, this.props.children)
30 | },
31 |
32 | render: function () {
33 | var element = this._getElement();
34 | var newProps = __functions.joinProps(_defaultProps, this.props, element.props, this._getClasses());
35 | return React.cloneElement(element, newProps);
36 | },
37 |
38 | componentDidMount: function() {
39 | __functions.updateComponents();
40 | }
41 | });
42 |
--------------------------------------------------------------------------------
/docs/src/views/index.js:
--------------------------------------------------------------------------------
1 | import StartView from './startView';
2 |
3 | import BadgesView from './badgesView';
4 | import BenchmarkView from './benchmarkView';
5 | import ButtonsView from './buttonsView';
6 | import CardsView from './cardsView';
7 | import LayoutView from './layoutView';
8 | import LoadingView from './loadingView';
9 | import MenusView from './menusView';
10 | import SlidersView from './slidersView';
11 | import TablesView from './tablesView';
12 | import TextfieldsView from './textfieldsView';
13 | import TogglesView from './togglesView';
14 |
15 | module.exports = {
16 | StartView: StartView,
17 | BadgesView: BadgesView,
18 | BenchmarkView: BenchmarkView,
19 | ButtonsView: ButtonsView,
20 | CardsView: CardsView,
21 | LayoutView: LayoutView,
22 | LoadingView: LoadingView,
23 | MenusView: MenusView,
24 | SlidersView: SlidersView,
25 | TablesView: TablesView,
26 | TextfieldsView: TextfieldsView,
27 | TogglesView: TogglesView
28 | };
29 |
--------------------------------------------------------------------------------
/lib/layout/layoutContent.js:
--------------------------------------------------------------------------------
1 |
2 | var React = require("react"),
3 | cx = require('classnames'),
4 | _ = require('lodash');
5 |
6 | var _defaultProps = {
7 | tag: 'main'
8 | };
9 |
10 | module.exports = React.createClass({
11 | displayName : 'MDL.Layout',
12 |
13 | propTypes: {
14 |
15 | },
16 |
17 | getDefaultProps: function() {
18 | return _defaultProps;
19 | },
20 |
21 | _getClasses: function() {
22 | var classes = {
23 | 'mdl-layout__content': true,
24 | };
25 | return cx(classes);
26 | },
27 |
28 | _getElement: function() {
29 | return React.createElement(this.props.tag, {}, this.props.children);
30 | },
31 |
32 | render: function () {
33 | var element = this._getElement();
34 | var newProps = __functions.joinProps(_defaultProps, this.props, element.props, this._getClasses());
35 |
36 | return React.cloneElement(element, newProps);
37 | },
38 |
39 | componentDidMount: function() {
40 | __functions.updateComponents();
41 | }
42 | });
43 |
--------------------------------------------------------------------------------
/lib/navigation/navigation.js:
--------------------------------------------------------------------------------
1 |
2 | var React = require("react");
3 | var cx = require('classnames');
4 | var _ = require('lodash');
5 |
6 | var _defaultProps = {
7 | tag: 'nav',
8 | };
9 |
10 | module.exports = React.createClass({
11 | displayName : 'MDL.Navigation',
12 |
13 | propTypes: {
14 |
15 | },
16 |
17 | getDefaultProps: function() {
18 | return _defaultProps;
19 | },
20 |
21 | _getClasses: function() {
22 | var classes = {
23 | 'mdl-navigation': true,
24 | };
25 | return cx(classes);
26 | },
27 |
28 | _getElement: function() {
29 | var element = React.createElement(this.props.tag, {}, this.props.children);
30 | return element;
31 | },
32 |
33 | render: function () {
34 | var element = this._getElement();
35 | var newProps = __functions.joinProps(_defaultProps, this.props, element.props, this._getClasses());
36 |
37 | return React.cloneElement(element, newProps);
38 | },
39 |
40 | componentDidMount: function() {
41 | __functions.updateComponents();
42 | }
43 | });
44 |
--------------------------------------------------------------------------------
/lib/layout/layoutDrawer.js:
--------------------------------------------------------------------------------
1 |
2 | var React = require("react");
3 | var cx = require('classnames');
4 | var _ = require('lodash');
5 |
6 | var _defaultProps = {
7 | tag: 'div'
8 | };
9 |
10 | module.exports = React.createClass({
11 | displayName : 'MDL.LayoutDrawer',
12 |
13 | propTypes: {
14 |
15 | },
16 |
17 | getDefaultProps: function() {
18 | return _defaultProps;
19 | },
20 |
21 | _getClasses: function() {
22 | var classes = {
23 | 'mdl-layout__drawer': true,
24 | };
25 | return cx(classes);
26 | },
27 |
28 | _getElement: function() {
29 | var element = React.createElement(this.props.tag, {}, this.props.children);
30 |
31 | return element;
32 | },
33 |
34 | render: function () {
35 | var element = this._getElement();
36 | var newProps = __functions.joinProps(_defaultProps, this.props, element.props, this._getClasses());
37 |
38 | return React.cloneElement(element, newProps);
39 | },
40 |
41 | componentDidMount: function() {
42 | __functions.updateComponents();
43 | }
44 | });
45 |
--------------------------------------------------------------------------------
/docs/src/views/benchmarkView.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import MDL from '../../../lib/';
3 |
4 | export default class BenchmarkView extends React.Component {
5 | componentWillMount() {
6 | this.renderStart = new Date().getTime();
7 | }
8 |
9 | componentDidMount() {
10 | var elapsed = new Date().getTime()-this.renderStart;
11 | console.log(elapsed);
12 | }
13 |
14 | render() {
15 | var benchMarkItems = [];
16 | for (var x = 0; x < 1000; x++) {
17 | benchMarkItems.push(
18 |
19 | asdf
20 |
21 |
22 | 1
23 | 2
24 | 3
25 | 4
26 | 5
27 | 6
28 |
29 |
30 | );
31 | }
32 |
33 | return (
34 |
35 | {benchMarkItems}
36 |
37 | );
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/lib/navigation/navigationLink.js:
--------------------------------------------------------------------------------
1 |
2 | var React = require("react");
3 | var cx = require('classnames');
4 | var _ = require('lodash');
5 |
6 | var _defaultProps = {
7 | tag: 'a'
8 | };
9 |
10 | module.exports = React.createClass({
11 | displayName : 'MDL.NavigationLink',
12 |
13 | propTypes: {
14 |
15 | },
16 |
17 | getDefaultProps: function() {
18 | return _defaultProps;
19 | },
20 |
21 | _getClasses: function() {
22 | var classes = {
23 | 'mdl-navigation__link': true,
24 | };
25 | return cx(classes);
26 | },
27 |
28 | _getElement: function() {
29 | var element = React.createElement(this.props.tag, {
30 | children: this.props.children
31 | });
32 |
33 | return element;
34 | },
35 |
36 | render: function () {
37 | var element = this._getElement();
38 | var newProps = __functions.joinProps(_defaultProps, this.props, element.props, this._getClasses());
39 |
40 | return React.cloneElement(element, newProps);
41 | },
42 |
43 | componentDidMount: function() {
44 | __functions.updateComponents();
45 | }
46 | });
47 |
--------------------------------------------------------------------------------
/lib/layout/layoutSpacer.js:
--------------------------------------------------------------------------------
1 |
2 | var React = require("react");
3 | var cx = require('classnames');
4 | var _ = require('lodash');
5 |
6 | module.exports = React.createClass({
7 | displayName : 'MDL.LayoutSpacer',
8 |
9 | getDefaultProps: function() {
10 | return {
11 | };
12 | },
13 |
14 | _getClasses: function() {
15 | var classes = {
16 | 'mdl-layout-spacer': true
17 | };
18 | return cx(classes);
19 | },
20 |
21 | _getElement: function() {
22 | return React.createElement("div", null, this.props.children)
23 | },
24 |
25 | render: function () {
26 | var element = this._getElement();
27 | var classname = element.props.className || '';
28 |
29 | var newProps = {
30 | className : classname + ' ' + this._getClasses(),
31 | disabled : this.props.disabled,
32 | style : _.extend(element.props.style || {}, this.props.style),
33 | id : this.props.id,
34 | };
35 |
36 | return React.cloneElement(element, newProps);
37 | },
38 |
39 | componentDidMount: function() {
40 | __functions.updateComponents();
41 | }
42 | });
43 |
--------------------------------------------------------------------------------
/lib/tabs/tabsPanel.js:
--------------------------------------------------------------------------------
1 |
2 | var React = require("react"),
3 | cx = require('classnames'),
4 | _ = require('lodash');
5 |
6 | var _defaultProps = {
7 | tag: 'div',
8 | ripple: false,
9 | title: '',
10 | active: false
11 | };
12 |
13 | module.exports = React.createClass({
14 | displayName : 'MDL.TabsPanel',
15 |
16 | propTypes: {
17 |
18 | },
19 |
20 | getDefaultProps: function() {
21 | return _defaultProps;
22 | },
23 |
24 | _getClasses: function() {
25 | var classes = {
26 | 'mdl-tabs__panel': true,
27 | 'is-active': this.props.active,
28 | };
29 | return cx(classes);
30 | },
31 |
32 | _getElement: function() {
33 | return React.createElement(this.props.tag, {}, this.props.children);
34 | },
35 |
36 | render: function () {
37 | var element = this._getElement();
38 | var newProps = __functions.joinProps(_defaultProps, this.props, element.props, this._getClasses());
39 | return React.cloneElement(element, newProps);
40 | },
41 |
42 | componentDidMount: function() {
43 | __functions.updateComponents();
44 | }
45 | });
46 |
--------------------------------------------------------------------------------
/lib/layout/layoutHeaderRow.js:
--------------------------------------------------------------------------------
1 |
2 | var React = require("react");
3 | var cx = require('classnames');
4 | var _ = require('lodash');
5 |
6 | module.exports = React.createClass({
7 | displayName : 'MDL.LayoutHeaderRow',
8 |
9 | propTypes: {
10 |
11 | },
12 |
13 | getDefaultProps: function() {
14 | return {
15 | tag: 'div',
16 | isTransparent: false
17 | };
18 | },
19 |
20 | _getClasses: function() {
21 | var classes = {
22 | 'mdl-layout__header-row': true,
23 | };
24 | return cx(classes);
25 | },
26 |
27 | _getElement: function() {
28 | var element = React.createElement(this.props.tag, {}, this.props.children);
29 | return element;
30 | },
31 |
32 | render: function () {
33 | var element = this._getElement();
34 | var classname = element.props.className || '';
35 |
36 | var newProps = {
37 | className : classname + ' ' + this._getClasses(),
38 | style : _.extend(element.props.style || {}, this.props.style),
39 | id : this.props.id,
40 | };
41 |
42 | return React.cloneElement(element, newProps);
43 | },
44 |
45 | componentDidMount: function() {
46 | __functions.updateComponents();
47 | }
48 | });
49 |
--------------------------------------------------------------------------------
/lib/layout/layoutTitle.js:
--------------------------------------------------------------------------------
1 |
2 | var React = require("react");
3 | var cx = require('classnames');
4 | var _ = require('lodash');
5 |
6 | module.exports = React.createClass({
7 | displayName : 'MDL.LayoutTitle',
8 |
9 | propTypes: {
10 |
11 | },
12 |
13 | getDefaultProps: function() {
14 | return {
15 | tag: 'div',
16 | isTransparent: false
17 | };
18 | },
19 |
20 | _getClasses: function() {
21 | var classes = {
22 | 'mdl-layout-title': true
23 | };
24 | return cx(classes);
25 | },
26 |
27 | _getElement: function() {
28 | var element = React.createElement(this.props.tag, {
29 | children: this.props.children
30 | });;
31 |
32 | return element;
33 | },
34 |
35 | render: function () {
36 | var element = this._getElement();
37 | var classname = element.props.className || '';
38 |
39 | var newProps = {
40 | className : classname + ' ' + this._getClasses(),
41 | style : _.extend(element.props.style || {}, this.props.style),
42 | id : this.props.id,
43 | };
44 |
45 | return React.cloneElement(element, newProps);
46 | },
47 |
48 | componentDidMount: function() {
49 | __functions.updateComponents();
50 | }
51 | });
52 |
--------------------------------------------------------------------------------
/lib/badge.js:
--------------------------------------------------------------------------------
1 |
2 | var React = require("react"),
3 | cx = require('classnames'),
4 | _ = require('lodash');
5 |
6 | var _defaultProps = {
7 | isIcon: false,
8 | tag: 'span',
9 | data: '',
10 | background: true
11 | };
12 |
13 | module.exports = React.createClass({
14 | displayName : 'MDL.Badge',
15 |
16 | propTypes: {
17 |
18 | },
19 |
20 | getDefaultProps: function() {
21 | return _defaultProps;
22 | },
23 |
24 | _getClasses: function() {
25 | var classes = {
26 | 'mdl-badge': true,
27 | 'material-icons': this.props.isIcon,
28 | 'mdl-badge--no-background': !this.props.background
29 | };
30 | return cx(classes);
31 | },
32 |
33 | _getElement: function() {
34 | var element = React.createElement(this.props.tag, {
35 | 'data-badge': this.props.data
36 | }, this.props.children);
37 |
38 | return element;
39 | },
40 |
41 | render: function () {
42 | var element = this._getElement();
43 | var newProps = __functions.joinProps(_defaultProps, this.props, element.props, this._getClasses());
44 |
45 | return React.cloneElement(element, newProps);
46 | },
47 |
48 | componentDidMount: function() {
49 | __functions.updateComponents();
50 | }
51 | });
52 |
--------------------------------------------------------------------------------
/lib/icon.js:
--------------------------------------------------------------------------------
1 |
2 | var React = require("react");
3 | var cx = require('classnames');
4 | var _ = require('lodash');
5 |
6 | var _generalProps = {
7 | colors: true,
8 | };
9 | var _defaultProps = __functions.makeDefaultProps({
10 | }, _generalProps);
11 |
12 | var _propTypes = __functions.makeDefaultPropTypes({
13 | }, _generalProps);
14 |
15 | module.exports = React.createClass({
16 | displayName : 'MDL.Icon',
17 |
18 | propTypes: _propTypes,
19 |
20 | getDefaultProps: function() {
21 | return _defaultProps;
22 | },
23 |
24 | _getClasses: function() {
25 | var classes = {
26 | 'material-icons': true
27 | };
28 |
29 | classes = __functions.addGeneralClasses(classes, this.props);
30 |
31 | return cx(classes);
32 | },
33 |
34 | _getElement: function() {
35 | return React.createElement("i", null, this.props.children)
36 | },
37 |
38 | render: function () {
39 | var element = this._getElement();
40 | var newProps = __functions.joinProps(_defaultProps, this.props, element.props, this._getClasses());
41 |
42 | return React.cloneElement(element, newProps);
43 | },
44 |
45 | componentDidMount: function() {
46 | __functions.updateComponents();
47 | }
48 | });
49 |
--------------------------------------------------------------------------------
/lib/layout/layout.js:
--------------------------------------------------------------------------------
1 | var React = require("react"),
2 | cx = require('classnames'),
3 | _ = require('lodash');
4 |
5 | var _defaultProps = {
6 | tag: 'div',
7 | isFixedHeader: false,
8 | isFixedDrawer: false,
9 | };
10 |
11 | module.exports = React.createClass({
12 | displayName: 'MDL.Layout',
13 |
14 | propTypes: {
15 |
16 | },
17 |
18 | getDefaultProps: function () {
19 | return _defaultProps;
20 | },
21 |
22 | _getClasses: function () {
23 | var classes = {
24 | 'mdl-layout': true,
25 | 'mdl-js-layout': true,
26 | 'mdl-layout--fixed-header': this.props.isFixedHeader,
27 | 'mdl-layout--fixed-drawer': this.props.isFixedDrawer,
28 | };
29 | return cx(classes);
30 | },
31 |
32 | _getElement: function () {
33 | return React.createElement(this.props.tag, {}, this.props.children);
34 | },
35 |
36 | render: function () {
37 | var element = this._getElement();
38 | var newProps = __functions.joinProps(_defaultProps, this.props, element.props, this._getClasses());
39 |
40 | return React.createElement("div", {
41 | className: "mdl-layout__container--root"
42 | }, React.cloneElement(element, newProps));
43 | },
44 |
45 | componentDidMount: function () {
46 | __functions.updateComponents();
47 | }
48 | });
--------------------------------------------------------------------------------
/lib/card/cardMenu.js:
--------------------------------------------------------------------------------
1 |
2 | var React = require("react"),
3 | cx = require('classnames'),
4 | _ = require('lodash');
5 |
6 | var _generalProps = {
7 | shadow: true,
8 | colors: true
9 | };
10 |
11 | var _defaultProps = __functions.makeDefaultProps({
12 | shadow: 0
13 | }, _generalProps);
14 |
15 | var _propTypes = __functions.makeDefaultPropTypes({
16 | }, _generalProps);
17 |
18 | module.exports = React.createClass({
19 | displayName : 'MDL.CardMenu',
20 |
21 | propTypes: _propTypes,
22 |
23 | getDefaultProps: function() {
24 | return _defaultProps;
25 | },
26 |
27 | _getClasses: function() {
28 | var classes = {
29 | 'mdl-card__menu': true,
30 | };
31 | classes = __functions.addGeneralClasses(classes, this.props);
32 | return cx(classes);
33 | },
34 |
35 | _getElement: function() {
36 | return React.createElement("div", null, this.props.children)
37 | },
38 |
39 | render: function () {
40 | var element = this._getElement();
41 | var newProps = __functions.joinProps(_defaultProps, this.props, element.props, this._getClasses());
42 |
43 | return React.cloneElement(element, newProps);
44 | },
45 |
46 | componentDidMount: function() {
47 | __functions.updateComponents();
48 | }
49 | });
50 |
--------------------------------------------------------------------------------
/lib/menu.js:
--------------------------------------------------------------------------------
1 |
2 | var React = require("react"),
3 | cx = require('classnames'),
4 | _ = require('lodash');
5 |
6 | var _defaultProps = {
7 | ripple: true,
8 | position: 'bottom-left'
9 | };
10 |
11 |
12 | module.exports = React.createClass({
13 | displayName : 'MDL.Menu',
14 |
15 | propTypes: {
16 | position : React.PropTypes.oneOf([
17 | 'bottom-left',
18 | 'bottom-right',
19 | 'top-right',
20 | 'top-left',
21 | ]),
22 | },
23 |
24 | getDefaultProps: function() {
25 | return _defaultProps;
26 | },
27 |
28 | _getClasses: function() {
29 | var classes = {
30 | 'mdl-menu': true,
31 | 'mdl-js-menu': true,
32 | 'mdl-js-ripple-effect': this.props.ripple
33 | };
34 |
35 | classes['mdl-menu--' + this.props.position] = true;
36 |
37 | return cx(classes);
38 | },
39 |
40 | _getElement: function() {
41 | return React.createElement("ul", null, this.props.children)
42 | },
43 |
44 | render: function () {
45 | var element = this._getElement();
46 | var newProps = __functions.joinProps(_defaultProps, this.props, element.props, this._getClasses());
47 |
48 | return React.cloneElement(element, newProps);
49 | },
50 |
51 | componentDidMount: function() {
52 | __functions.updateComponents();
53 | }
54 | });
55 |
--------------------------------------------------------------------------------
/lib/spinner.js:
--------------------------------------------------------------------------------
1 |
2 | var React = require("react");
3 | var cx = require('classnames');
4 | var _ = require('lodash');
5 |
6 | module.exports = React.createClass({
7 | displayName : 'MDL.Spinner',
8 |
9 | propTypes: {
10 | id: React.PropTypes.string.isRequired,
11 | },
12 |
13 | getDefaultProps: function() {
14 | return {
15 | active: false,
16 | singleColor: false,
17 | tag: 'div'
18 | };
19 | },
20 |
21 | _getClasses: function() {
22 | var classes = {
23 | 'mdl-spinner': true,
24 | 'mdl-js-spinner': true,
25 | 'is-active': this.props.active,
26 | 'mdl-spinner--single-color': this.props.singleColor
27 | };
28 | return cx(classes);
29 | },
30 |
31 | _getElement: function() {
32 | return React.createElement(this.props.tag);
33 | },
34 |
35 | render: function () {
36 | var element = this._getElement();
37 | var classname = element.props.className || '';
38 |
39 | var newProps = {
40 | className : classname + ' ' + this._getClasses(),
41 | style : _.extend(element.props.style || {}, this.props.style),
42 | id : this.props.id,
43 | };
44 |
45 | return React.cloneElement(element, newProps);
46 | },
47 |
48 | componentDidMount: function() {
49 | __functions.updateComponents();
50 | }
51 | });
52 |
--------------------------------------------------------------------------------
/lib/grid/grid.js:
--------------------------------------------------------------------------------
1 |
2 | var React = require("react"),
3 | cx = require('classnames'),
4 | _ = require('lodash');
5 |
6 | var _generalProps = {
7 | colors: true,
8 | };
9 |
10 | var _defaultProps = __functions.makeDefaultProps({
11 | tag: 'div',
12 | 'no-spacing': false
13 | }, _generalProps);
14 |
15 | var _propTypes = __functions.makeDefaultPropTypes({
16 | }, _generalProps);
17 |
18 | module.exports = React.createClass({
19 | displayName : 'MDL.Grid',
20 |
21 | propTypes: _propTypes,
22 |
23 | getDefaultProps: function() {
24 | return _defaultProps;
25 | },
26 |
27 | _getClasses: function() {
28 | var classes = {
29 | 'mdl-grid': true,
30 | 'mdl-grid--no-spacing': this.props['no-spacing']
31 | };
32 |
33 | classes = __functions.addGeneralClasses(classes, this.props);
34 |
35 | return cx(classes);
36 | },
37 |
38 | _getElement: function() {
39 | return React.createElement(this.props.tag, {}, this.props.children);
40 | },
41 |
42 | render: function () {
43 | var element = this._getElement();
44 | var newProps = __functions.joinProps(_defaultProps, this.props, element.props, this._getClasses());
45 |
46 | return React.cloneElement(element, newProps);
47 | },
48 |
49 | componentDidMount: function() {
50 | __functions.updateComponents();
51 | }
52 | });
53 |
--------------------------------------------------------------------------------
/lib/layout/layoutHeader.js:
--------------------------------------------------------------------------------
1 |
2 | var React = require("react");
3 | var cx = require('classnames');
4 | var _ = require('lodash');
5 |
6 | var _defaultProps = {
7 | tag: 'header',
8 | transparent: false,
9 | scroll: false,
10 | waterfall: false,
11 | };
12 |
13 | module.exports = React.createClass({
14 | displayName : 'MDL.LayoutHeader',
15 |
16 | propTypes: {
17 |
18 | },
19 |
20 | getDefaultProps: function() {
21 | return _defaultProps;
22 | },
23 |
24 | _getClasses: function() {
25 | var classes = {
26 | 'mdl-layout__header': true,
27 | 'mdl-layout__header--transparent': this.props.transparent,
28 | 'mdl-layout__header--scroll': this.props.scroll,
29 | 'mdl-layout__header--waterfall': this.props.waterfall,
30 | };
31 | return cx(classes);
32 | },
33 |
34 | _getElement: function() {
35 | var element = React.createElement(this.props.tag, {
36 | children: this.props.children
37 | });;
38 |
39 | return element;
40 | },
41 |
42 | render: function () {
43 | var element = this._getElement();
44 | var newProps = __functions.joinProps(_defaultProps, this.props, element.props, this._getClasses());
45 |
46 | return React.cloneElement(element, newProps);
47 | },
48 |
49 | componentDidMount: function() {
50 | __functions.updateComponents();
51 | }
52 | });
53 |
--------------------------------------------------------------------------------
/lib/card/cardActions.js:
--------------------------------------------------------------------------------
1 | var React = require("react"),
2 | cx = require('classnames'),
3 | _ = require('lodash');
4 |
5 | var _generalProps = {
6 | shadow: true,
7 | colors: true
8 | };
9 |
10 | var _defaultProps = __functions.makeDefaultProps({
11 | isExpand: false,
12 | border: false,
13 | shadow: 0
14 | }, _generalProps);
15 |
16 | var _propTypes = __functions.makeDefaultPropTypes({
17 | }, _generalProps);
18 |
19 | module.exports = React.createClass({
20 | displayName : 'MDL.CardActions',
21 |
22 | propTypes: _propTypes,
23 |
24 | getDefaultProps: function() {
25 | return _defaultProps;
26 | },
27 |
28 | _getClasses: function() {
29 | var classes = {
30 | 'mdl-card__actions': true,
31 | 'mdl-card--border': this.props.border
32 | };
33 | classes = __functions.addGeneralClasses(classes, this.props);
34 | return cx(classes);
35 | },
36 |
37 | _getElement: function() {
38 | return React.createElement("div", null, this.props.children)
39 | },
40 |
41 | render: function () {
42 | var element = this._getElement();
43 | var newProps = __functions.joinProps(_defaultProps, this.props, element.props, this._getClasses());
44 |
45 | return React.cloneElement(element, newProps);
46 | },
47 |
48 | componentDidMount: function() {
49 | __functions.updateComponents();
50 | }
51 | });
52 |
--------------------------------------------------------------------------------
/lib/card/cardSupportingText.js:
--------------------------------------------------------------------------------
1 |
2 | var React = require("react"),
3 | cx = require('classnames'),
4 | _ = require('lodash');
5 |
6 | var _generalProps = {
7 | shadow: true,
8 | colors: true
9 | };
10 |
11 | var _defaultProps = __functions.makeDefaultProps({
12 | isExpand: false,
13 | border: false,
14 | shadow: 0
15 | }, _generalProps);
16 |
17 | var _propTypes = __functions.makeDefaultPropTypes({
18 | }, _generalProps);
19 |
20 | module.exports = React.createClass({
21 | displayName : 'MDL.CardSupportingText',
22 |
23 | propTypes: _propTypes,
24 |
25 | getDefaultProps: function() {
26 | return _defaultProps;
27 | },
28 |
29 | _getClasses: function() {
30 | var classes = {
31 | 'mdl-card__supporting-text': true,
32 | 'mdl-card--expand': this.props.isExpand,
33 | 'mdl-card--border': this.props.border
34 | };
35 | classes = __functions.addGeneralClasses(classes, this.props);
36 | return cx(classes);
37 | },
38 |
39 | _getElement: function() {
40 | return React.createElement("div", null, this.props.children)
41 | },
42 |
43 | render: function () {
44 | var element = this._getElement();
45 | var newProps = __functions.joinProps(_defaultProps, this.props, element.props, this._getClasses());
46 |
47 | return React.cloneElement(element, newProps);
48 | },
49 |
50 | componentDidMount: function() {
51 | __functions.updateComponents();
52 | }
53 | });
54 |
--------------------------------------------------------------------------------
/docs/build/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | Material Design for React Js
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/lib/card/card.js:
--------------------------------------------------------------------------------
1 | var React = require("react"),
2 | cx = require('classnames'),
3 | _ = require('lodash');
4 |
5 | var _generalProps = {
6 | shadow: true,
7 | colors: true
8 | };
9 |
10 | var _defaultProps = __functions.makeDefaultProps({
11 | shadow: 2,
12 | useChild: false
13 | }, _generalProps);
14 |
15 | var _propTypes = __functions.makeDefaultPropTypes({
16 | }, _generalProps);
17 |
18 | module.exports = React.createClass({
19 | displayName : 'MDL.Card',
20 | propTypes: _propTypes,
21 |
22 | getDefaultProps: function() {
23 | return _defaultProps;
24 | },
25 |
26 | _getClasses: function() {
27 | var classes = {
28 | 'mdl-card': true
29 | };
30 |
31 | classes = __functions.addGeneralClasses(classes, this.props);
32 |
33 | return cx(classes);
34 | },
35 |
36 | _getElement: function() {
37 | var child = this.props.children instanceof Array
38 | ? this.props.children[0]
39 | : this.props.children;
40 |
41 | if (this.props.useChild && child && !_.isString(child)) {
42 | return child;
43 | } else {
44 | return React.createElement("div", null, this.props.children)
45 | }
46 | },
47 |
48 | render: function () {
49 | var element = this._getElement();
50 | var newProps = __functions.joinProps(_defaultProps, this.props, element.props, this._getClasses());
51 |
52 | return React.cloneElement(element, newProps);
53 | },
54 |
55 | componentDidMount: function() {
56 | __functions.updateComponents();
57 | }
58 | });
59 |
--------------------------------------------------------------------------------
/lib/slider.js:
--------------------------------------------------------------------------------
1 |
2 | var React = require("react");
3 | var cx = require('classnames');
4 | var _ = require('lodash');
5 |
6 | module.exports = React.createClass({
7 | displayName : 'MDL.Button',
8 |
9 | getDefaultProps: function() {
10 | return {
11 | min: 0,
12 | max: 100,
13 | defaultValue: 0,
14 | step: 1,
15 | useChild: false
16 | };
17 | },
18 |
19 | _getClasses: function() {
20 | var classes = {
21 | 'mdl-slider': true,
22 | 'mdl-js-slider': true
23 | };
24 | return cx(classes);
25 | },
26 |
27 | _getElement: function() {
28 | var child = this.props.children instanceof Array
29 | ? this.props.children[0]
30 | : this.props.children;
31 |
32 | if (this.props.useChild && child && !_.isString(child)) {
33 | return child;
34 | } else {
35 | return React.createElement("input", {className: this.props.className || ''})
36 | }
37 | },
38 |
39 | render: function () {
40 | var element = this._getElement();
41 | var classname = element.props.className || '';
42 |
43 | var newProps = {
44 | className : classname + ' ' + this._getClasses(),
45 | disabled : this.props.disabled,
46 | style : _.extend(element.props.style || {}, this.props.style),
47 | id : this.props.id,
48 | min : this.props.min,
49 | max : this.props.max,
50 | defaultValue : this.props.defaultValue,
51 | step : this.props.step,
52 | type : 'range'
53 | };
54 |
55 | return React.cloneElement(element, newProps);
56 | },
57 |
58 | componentDidMount: function() {
59 | __functions.updateComponents();
60 | }
61 | });
62 |
--------------------------------------------------------------------------------
/lib/card/cardMedia.js:
--------------------------------------------------------------------------------
1 | var React = require("react"),
2 | cx = require('classnames'),
3 | _ = require('lodash');
4 |
5 | var _generalProps = {
6 | shadow: true,
7 | colors: true
8 | };
9 |
10 | var _defaultProps = __functions.makeDefaultProps({
11 | isExpand: false,
12 | imgSrc: '',
13 | imgProps: {},
14 | border: false,
15 | shadow: 0
16 | }, _generalProps);
17 |
18 | var _propTypes = __functions.makeDefaultPropTypes({
19 | }, _generalProps);
20 |
21 | module.exports = React.createClass({
22 | displayName : 'MDL.CardMedia',
23 |
24 | propTypes: _propTypes,
25 |
26 | getDefaultProps: function() {
27 | return _defaultProps;
28 | },
29 |
30 | _getClasses: function() {
31 | var classes = {
32 | 'mdl-card__media': true,
33 | 'mdl-card--expand': this.props.isExpand,
34 | 'mdl-card--border': this.props.border
35 | };
36 | classes = __functions.addGeneralClasses(classes, this.props);
37 | return cx(classes);
38 | },
39 |
40 | _getElement: function() {
41 | var inner;
42 | if (this.props.imgSrc.length > 0) {
43 | inner = React.createElement("img", React.__spread({src: this.props.imgSrc}, this.props.imgProps))
44 | } else {
45 | inner = this.props.children;
46 | }
47 |
48 | return React.createElement("div", null, inner)
49 | },
50 |
51 | render: function () {
52 | var element = this._getElement();
53 | var newProps = __functions.joinProps(_defaultProps, this.props, element.props, this._getClasses());
54 |
55 | return React.cloneElement(element, newProps);
56 | },
57 |
58 | componentDidMount: function() {
59 | __functions.updateComponents();
60 | }
61 | });
62 |
--------------------------------------------------------------------------------
/docs/build/css/docs.css:
--------------------------------------------------------------------------------
1 | .docs-layout > header {
2 | background-color: #C2185B;
3 | }
4 |
5 | .docs-components {
6 | margin: 50px 0 30px;
7 | text-align: center;
8 | }
9 |
10 | .docs-component {
11 | display: inline-block;padding: 10px 20px;
12 | }
13 |
14 | .docs-component__body > * {
15 | text-align: left;
16 | }
17 |
18 | .docs-component__caption {
19 | margin-top: 20px;
20 | background-color: rgba(0,0,0,0.1);
21 | padding: 10px 20px;
22 | border-radius: 3px;
23 | }
24 |
25 |
26 | .docs-text {
27 | margin: 0 50px;
28 | }
29 | .docs-text h1 {
30 | font-size: 1.5em;
31 | }
32 | .docs-text h2, .docs-text--centred h2 {
33 | font-size: 1.3em;
34 | }
35 | .docs-text--centred table {
36 | text-align: left;
37 | }
38 | .docs-text--centred code, .docs-text pre {
39 | background: #EFEFEF;
40 | padding: 5px;
41 | }
42 | .docs-text--centred {
43 | max-width: 640px;
44 | width: 100%;
45 | margin: 0 auto;
46 | }
47 | .docs-view {
48 | padding-bottom: 100px;
49 | }
50 | .docs-view pre[class*='language-'] {
51 | padding: 2em 2em 1em;
52 | margin: 0;
53 | }
54 |
55 | .docs-view pre[class*='language-']:hover {
56 | background-color: rgb(255,223,234);
57 | }
58 | .docs-view-code {
59 | position: relative;
60 | }
61 | .docs-view-code__title {
62 | font-size: 1em;
63 | display: inline-block;
64 | margin: 0;
65 | background-color: #DDD;
66 | padding: 0 10px;
67 | line-height: inherit;
68 | top: 0px;
69 | left: 0px;
70 | position: absolute;
71 | }
72 |
73 | /*
74 | Layout
75 | */
76 | .docs-view .mdl-cell {
77 | background: #999;
78 | padding: 10px;
79 | color: #FFF;
80 | }
81 |
82 | #docs-navigation > .mdl-navigation__link {
83 | padding: 8px 20px;
84 | }
85 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "mdl-reactjs",
3 | "version": "0.1.1",
4 | "description": "React implementation of googles Material Design Lite (http://getmdl.io)",
5 | "main": "./lib",
6 | "keywords": [
7 | "React",
8 | "Material Design",
9 | "mdl",
10 | "material-design",
11 | "badge",
12 | "button",
13 | "card",
14 | "layout",
15 | "loading",
16 | "spinner",
17 | "menu",
18 | "slider",
19 | "toggles",
20 | "textfield",
21 | "fab-button",
22 | "icon",
23 | "icon-button",
24 | "switch",
25 | "progress",
26 | "progress bar",
27 | "tooltip",
28 | "dropdown",
29 | "grid",
30 | "tabs"
31 | ],
32 | "scripts": {
33 | "dev-build": "webpack --config webpack.config.js --colors",
34 | "dev-watch": "webpack --config webpack.config.js --watch --colors",
35 | "dev-server": "webpack-dev-server --config webpack.config.js --content-base ./docs/build/ --colors"
36 | },
37 | "author": "Johan Bostrom",
38 | "license": "GPL-3.0",
39 | "dependencies": {
40 | "react": "^15.3.2",
41 | "react-dom": "^15.3.2",
42 | "classnames": "^2.1.3",
43 | "lodash": "^3.10.1"
44 | },
45 | "devDependencies": {
46 | "babel-core": "^6.18.2",
47 | "babel-loader": "^6.2.7",
48 | "babel-preset-es2015": "^6.18.0",
49 | "babel-preset-react": "^6.16.0",
50 | "html-loader": "^0.4.4",
51 | "markdown-loader": "^0.1.7",
52 | "react-router": "^3.0.0",
53 | "webpack": "^1.13.3",
54 | "webpack-dev-server": "^1.16.2"
55 | },
56 | "directories": {
57 | "doc": "docs"
58 | },
59 | "repository": {
60 | "type": "git",
61 | "url": "https://github.com/zarxor/mdl-reactjs.git"
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/webpack.config.js:
--------------------------------------------------------------------------------
1 | var Path = require("path");
2 | var Webpack = require("webpack");
3 | var Pkg = require("./package.json");
4 |
5 | /*
6 | * Default webpack configuration for development
7 | */
8 | var Config = {
9 | devtool: "eval-source-map",
10 | cache: true,
11 | entry: {
12 | app: Path.join(__dirname, "docs", "src", "app.js")
13 | },
14 | output: {
15 | path: Path.join(__dirname, "docs", "build"),
16 | filename: "[name].js",
17 | sourceMapFilename: "[file].map"
18 | },
19 | resolve: {
20 | modulesDirectories: ["node_modules"]
21 | },
22 | plugins: [
23 | new Webpack.OldWatchingPlugin() //needed to make watch work. see http://stackoverflow.com/a/29292578/1434764
24 | ],
25 | resolveLoader: {
26 | 'fallback': Path.join(__dirname, "node_modules")
27 | },
28 | module: {
29 | loaders: [
30 | {
31 | test: /\.md$/,
32 | loader: "html!markdown"
33 | }, {
34 | test: /(\.js)$/,
35 | exclude: [/node_modules/],
36 | loader: "babel-loader",
37 | query: {
38 | presets: ["es2015", "react"]
39 | }
40 | }
41 | ]
42 | }
43 | }
44 |
45 | /*
46 | * If bundling for production, optimize output
47 | */
48 | if (process.env.NODE_ENV === "production") {
49 | Config.devtool = false;
50 |
51 | Config.plugins = [
52 | new Webpack
53 | .optimize
54 | .OccurenceOrderPlugin(),
55 |
56 | new Webpack
57 | .optimize
58 | .UglifyJsPlugin({
59 | comments: false,
60 | compress: {
61 | warnings: false
62 | }
63 | }),
64 | new Webpack.DefinePlugin({
65 | 'process.env': {
66 | NODE_ENV: JSON.stringify("production")
67 | }
68 | })
69 | ];
70 | };
71 |
72 | module.exports = Config;
--------------------------------------------------------------------------------
/lib/tabs/tabs.js:
--------------------------------------------------------------------------------
1 | var React = require("react"),
2 | cx = require('classnames'),
3 | _ = require('lodash');
4 |
5 | var _defaultProps = {
6 | tag: 'div',
7 | ripple: false,
8 | tabBarProps: {}
9 | };
10 |
11 | module.exports = React.createClass({
12 | displayName: 'MDL.Tabs',
13 |
14 | propTypes: {},
15 |
16 | getDefaultProps: function () {
17 | return _defaultProps;
18 | },
19 |
20 | _getClasses: function () {
21 | var classes = {
22 | 'mdl-tabs': true,
23 | 'mdl-js-tabs': true,
24 | 'mdl-js-ripple-effect': this.props.ripple
25 | };
26 | return cx(classes);
27 | },
28 |
29 | _getTabBar: function (panels) {
30 | var tabBarProps = __functions.joinProps({}, this.props.tabBarProps, {}, "mdl-tabs__tab-bar");
31 | var tabBarTabs = panels.map(function (panel, panelKey) {
32 | return (React.createElement("a", {
33 | key: panelKey,
34 | href: "#" + panel.props.id,
35 | className: "mdl-tabs__tab" + (panel.props.active
36 | ? " is-active"
37 | : "")
38 | }, panel.props.title));
39 | });
40 |
41 | return React.cloneElement(React.createElement("div", {key: "tabBar"}), tabBarProps, tabBarTabs);
42 | },
43 |
44 | _getElement: function () {
45 | var tabBar = this._getTabBar(this.props.children);
46 | var children = [tabBar].concat(this.props.children);
47 | return React.createElement(this.props.tag, {}, children);
48 | },
49 |
50 | render: function () {
51 | var element = this._getElement();
52 | var newProps = __functions.joinProps(_defaultProps, this.props, element.props, this._getClasses());
53 | return React.cloneElement(element, newProps);
54 | },
55 |
56 | componentDidMount: function () {
57 | __functions.updateComponents();
58 | }
59 | });
60 |
--------------------------------------------------------------------------------
/docs/src/views/slidersView.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import MDL from '../../../lib/';
3 | import DOCS from '../components';
4 |
5 | export default class SlidersView extends React.Component {
6 | render() {
7 | return (
8 |
9 |
10 |
SLIDERS
11 |
Selecting a value out of a range.
12 |
13 | {/*
14 | Colored FAB
15 | */}
16 |
17 |
18 | this.defaultSlider = x} min={0} max={100} defaultValue={0} />
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | {' '}
27 |
28 |
29 | {' '}
30 |
31 |
32 | {/*
33 | Documentation text
34 | */}
35 |
36 |
37 |
CONFIGURATION OPTIONS
38 |
39 | Down below you can find all the attributes that can be applied to the component
40 |
41 |
42 |
43 |
44 | Attribute
45 | Effect
46 | Values
47 |
48 |
49 |
50 |
51 | Attribute
52 | Effect
53 | Values
54 |
55 |
56 |
57 |
58 |
59 | );
60 | }
61 | }
--------------------------------------------------------------------------------
/docs/src/views/badgesView.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import MDL from '../../../lib/';
3 | import DOCS from '../components';
4 |
5 | export default class BadgesView extends React.Component {
6 | constructor(props) {
7 | super(props);
8 | this.state = {
9 | };
10 | }
11 | render() {
12 | return (
13 |
14 |
15 |
Badges!
16 |
Small status descriptors for UI elements.
17 |
18 | {/*
19 | Colored FAB
20 | */}
21 |
22 |
23 | account_box
24 |
25 |
26 | account_box
27 |
28 |
29 |
30 |
31 | {'account_box '}
32 |
33 |
34 | {'account_box '}
35 |
36 |
37 | {/*
38 | Documentation text
39 | */}
40 |
41 |
42 |
CONFIGURATION OPTIONS
43 |
44 | Down below you can find all the attributes that can be applied to the component
45 |
46 |
47 |
48 |
49 | Attribute
50 | Effect
51 | Values
52 |
53 |
54 |
55 |
56 | Attribute
57 | Effect
58 | Values
59 |
60 |
61 |
62 |
63 |
64 | );
65 | }
66 | }
--------------------------------------------------------------------------------
/lib/grid/gridCell.js:
--------------------------------------------------------------------------------
1 |
2 | var React = require("react"),
3 | cx = require('classnames'),
4 | _ = require('lodash');
5 |
6 | var _defaultProps = {
7 | col: 1,
8 | colPhone: 0,
9 | colTablet: 0,
10 | colDesktop: 0,
11 |
12 | hidePhone: false,
13 | hideTable: false,
14 | hideDesktop: false,
15 |
16 | spacing: true,
17 | stretch: false,
18 | align: '',
19 |
20 | tag: 'div'
21 | };
22 |
23 | module.exports = React.createClass({
24 | displayName : 'MDL.GridCell',
25 |
26 | propTypes: {
27 |
28 | },
29 |
30 | getDefaultProps: function() {
31 | return _defaultProps;
32 | },
33 |
34 | _getClasses: function() {
35 | var classes = {
36 | 'mdl-cell': true,
37 | 'mdl-grid--no-spacing': !this.props.spacing,
38 |
39 | 'mdl-cell-hide-phone': this.props.hidePhone,
40 | 'mdl-cell-hide-tablet': this.props.hideTablet,
41 | 'mdl-cell-hide-desktop': this.props.hideDesktop,
42 |
43 | 'mdl-cell--stretch': this.props.stretch,
44 | };
45 | classes['mdl-cell--' + this.props.col + '-col'] = true;
46 | classes['mdl-cell--' + this.props.colPhone + '-col-phone'] = (this.props.colPhone > 0);
47 | classes['mdl-cell--' + this.props.colTablet + '-col-tablet'] = (this.props.colTablet > 0);
48 | classes['mdl-cell--' + this.props.colDesktop + '-col-desktop'] = (this.props.colDesktop > 0);
49 | classes['mdl-cell--' + this.props.align + ''] = (this.props.align.length > 0);
50 |
51 | return cx(classes);
52 | },
53 |
54 | _getElement: function() {
55 | var element = React.createElement(this.props.tag, {}, this.props.children);
56 | return element;
57 | },
58 |
59 | render: function () {
60 | var element = this._getElement();
61 | var newProps = __functions.joinProps(_defaultProps, this.props, element.props, this._getClasses());
62 |
63 | return React.cloneElement(element, newProps);
64 | },
65 |
66 | componentDidMount: function() {
67 | __functions.updateComponents();
68 | }
69 | });
70 |
--------------------------------------------------------------------------------
/lib/card/cardTitle.js:
--------------------------------------------------------------------------------
1 | var React = require("react"),
2 | cx = require('classnames'),
3 | _ = require('lodash');
4 |
5 | var _generalProps = {
6 | shadow: true,
7 | colors: true
8 | };
9 |
10 | var _defaultProps = __functions.makeDefaultProps({
11 | useChild: false,
12 | textTag: 'h2',
13 | textTagOff: false,
14 | border: false,
15 | expand: false,
16 | shadow: 0
17 | }, _generalProps);
18 |
19 | var _propTypes = __functions.makeDefaultPropTypes({}, _generalProps);
20 |
21 | module.exports = React.createClass({
22 | displayName: 'MDL.CardTitle',
23 |
24 | propTypes: _propTypes,
25 |
26 | getDefaultProps: function () {
27 | return _defaultProps;
28 | },
29 |
30 | _getClasses: function () {
31 | var classes = {
32 | 'mdl-card__title': true,
33 | 'mdl-card--expand': this.props.expand,
34 | 'mdl-card--border': this.props.border
35 | };
36 | classes = __functions.addGeneralClasses(classes, this.props);
37 | return cx(classes);
38 | },
39 |
40 | _getElement: function () {
41 | var child = this.props.children instanceof Array ?
42 | this.props.children[0] :
43 | this.props.children;
44 |
45 | if (this.props.useChild && child && !_.isString(child)) {
46 | return child;
47 | } else {
48 | var text;
49 | if (this.props.textTagOff || typeof this.props.children != 'string') {
50 | text = this.props.children;
51 | } else {
52 | text = React.createElement(this.props.textTag, {
53 | children: this.props.children,
54 | className: "mdl-card__title-text"
55 | });
56 | }
57 | return React.createElement("div", null, text)
58 | }
59 | },
60 |
61 | render: function () {
62 | var element = this._getElement();
63 | var newProps = __functions.joinProps(_defaultProps, this.props, element.props, this._getClasses());
64 |
65 | return React.cloneElement(element, newProps);
66 | },
67 |
68 | componentDidMount: function () {
69 | __functions.updateComponents();
70 | }
71 | });
--------------------------------------------------------------------------------
/lib/progress.js:
--------------------------------------------------------------------------------
1 | var React = require("react"),
2 | ReactDOM = require("react-dom"),
3 | cx = require('classnames'),
4 | _ = require('lodash');
5 |
6 | var _generalProps = {
7 | shadow: true,
8 | };
9 |
10 | var _defaultProps = __functions.makeDefaultProps({
11 | indeterminate: false,
12 | progress: 0,
13 | buffer: -1,
14 | }, _generalProps),
15 | _propTypes = __functions.makeDefaultPropTypes({
16 | id: React.PropTypes.string.isRequired,
17 | }, _generalProps);
18 |
19 | module.exports = React.createClass({
20 | displayName: 'MDL.Progress',
21 |
22 | propTypes: _propTypes,
23 |
24 | getDefaultProps: function () {
25 | return _defaultProps;
26 | },
27 |
28 | getInitialState: function () {
29 | return {
30 | progress: this.props.progress,
31 | buffer: this.props.buffer
32 | };
33 | },
34 |
35 | _getClasses: function () {
36 | var classes = {
37 | 'mdl-progress': true,
38 | 'mdl-js-progress': true,
39 | 'mdl-progress__indeterminate': this.props.indeterminate
40 | };
41 | return cx(classes);
42 | },
43 |
44 | _getElement: function () {
45 | return React.createElement("div", null);
46 | },
47 |
48 | render: function () {
49 | var element = this._getElement();
50 | var classname = element.props.className || '';
51 |
52 | var newProps = {
53 | className: classname + ' ' + this._getClasses(),
54 | style: _.extend(element.props.style || {}, this.props.style),
55 | id: this.props.id,
56 | };
57 |
58 | return React.cloneElement(element, newProps);
59 | },
60 |
61 | _refreshProgress: function () {
62 | var element = ReactDOM.findDOMNode(this);
63 | var progress = this.props.progress;
64 | var buffer = this.props.buffer;
65 |
66 | if (element.MaterialProgress != undefined) {
67 | element.MaterialProgress.setProgress(progress);
68 | } else {
69 | element.addEventListener('mdl-componentupgraded', function () {
70 | this.MaterialProgress.setProgress(progress);
71 | if (buffer > -1)
72 | this.MaterialProgress.setBuffer(buffer);
73 | });
74 | }
75 |
76 | __functions.updateComponents();
77 | },
78 |
79 |
80 |
81 | componentDidUpdate: function () {
82 | this._refreshProgress();
83 | },
84 |
85 | componentDidMount: function () {
86 | this._refreshProgress();
87 | }
88 | });
--------------------------------------------------------------------------------
/lib/button.js:
--------------------------------------------------------------------------------
1 |
2 | var React = require("react"),
3 | cx = require('classnames'),
4 | _ = require('lodash');
5 |
6 | var _generalProps = {
7 | colors: true,
8 | };
9 |
10 | var _defaultProps = __functions.makeDefaultProps({
11 | ripple: false,
12 | fab: false,
13 | size: false,
14 | icon: '',
15 | useChild: false,
16 | colored: false,
17 | raised: false,
18 | primary: false,
19 | accent: false,
20 |
21 | children: []
22 | }, _generalProps);
23 |
24 | var _propTypes = __functions.makeDefaultPropTypes({
25 | }, _generalProps);
26 |
27 | module.exports = React.createClass({
28 | displayName: 'MDL.Button',
29 |
30 | propTypes: _propTypes,
31 |
32 | getDefaultProps: function () {
33 | return _defaultProps;
34 | },
35 |
36 | _getClasses: function () {
37 | var classes = {
38 | 'mdl-button': true,
39 | 'mdl-button--fab': this.props.fab,
40 | 'mdl-button--mini-fab': (this.props.fab && this.props.size == "mini"),
41 |
42 | 'mdl-button--raised': this.props.raised,
43 | 'mdl-button--colored': this.props.colored,
44 | 'mdl-button--accent': this.props.accent,
45 | 'mdl-button--primary': this.props.primary,
46 |
47 | 'mdl-button--icon': (this.props.icon.length > 0 && !this.props.fab),
48 |
49 | 'mdl-js-button': true,
50 | 'mdl-js-ripple-effect': this.props.ripple
51 | };
52 |
53 | classes = __functions.addGeneralClasses(classes, this.props);
54 |
55 | return cx(classes);
56 | },
57 |
58 | _getElement: function () {
59 |
60 | var child = this.props.children instanceof Array
61 | ? this.props.children[0]
62 | : this.props.children;
63 |
64 | if (this.props.useChild && child && !_.isString(child)) {
65 | return child;
66 | } else if (this.props.icon.length > 0) {
67 | return (React.createElement("button", null, React.createElement("i", {className: "material-icons"}, this.props.icon), this.props.children));
68 | } else {
69 | return (React.createElement("button", null, this.props.children));
70 | }
71 | },
72 |
73 | render: function () {
74 | var element = this._getElement();
75 | var newProps = __functions.joinProps(_defaultProps, this.props, element.props, this._getClasses());
76 |
77 | return React.cloneElement(element, newProps);
78 | },
79 |
80 | componentDidMount: function () {
81 | __functions.updateComponents();
82 | }
83 | });
84 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Material Design Lite for React JS
2 | Material Design Lite for React JS lets you add a Material Design look and feel to your websites using the React framework.
3 |
4 | [You can find documentation and examples here](https://zarxor.github.io/mdl-reactjs/docs/build/)
5 |
6 | ## Usage ##
7 | To install run
8 | ```jsx
9 | npm install mdl-reactjs
10 | ```
11 | How to include in project
12 | ```jsx
13 | var MDL = require('mdl-reactjs');
14 | var Button = MDL.Button;
15 | var Card = MDL.Card;
16 | ```
17 |
18 | Include the MDL css and js in your project
19 | ```
20 |
21 |
22 |
23 |
24 | ```
25 |
26 | ### How to run the demo / documentation ###
27 | ```
28 | npm install
29 | npm run dev-server
30 | // Open http://localhost:8080/
31 | ```
32 | ## Project status ##
33 | The project is still under development and will be adding features and functions
34 |
35 | ### Components list / Todo
36 | - [x] Badge [[Docs](https://zarxor.github.io/mdl-reactjs/docs/build/#/badges)] [[getmdl.io](http://www.getmdl.io/components/index.html#badges-section)]
37 | - [x] Buttons [[Docs](https://zarxor.github.io/mdl-reactjs/docs/build/#/buttons)] [[getmdl.io](http://www.getmdl.io/components/index.html#buttons-section)]
38 | - Loading [[Docs](https://zarxor.github.io/mdl-reactjs/docs/build/#/loading)] [[getmdl.io](http://www.getmdl.io/components/index.html#loading-section)]
39 | - [x] Progress
40 | - [x] Spinner
41 | - [x] Sliders [[Docs](https://zarxor.github.io/mdl-reactjs/docs/build/#/sliders)] [[getmdl.io](http://www.getmdl.io/components/index.html#sliders-section)]
42 | - [x] Icon [Docs]
43 | - [x] Textfields [[Docs](https://zarxor.github.io/mdl-reactjs/docs/build/#/textfields)] [[getmdl.io](http://www.getmdl.io/components/index.html#textfields-section)]
44 | - [x] Cards [[Docs](https://zarxor.github.io/mdl-reactjs/docs/build/#/cards)] [[getmdl.io](http://www.getmdl.io/components/index.html#cards-section)]
45 | - Layout [[Docs](https://zarxor.github.io/mdl-reactjs/docs/build/#/layout)] [[getmdl.io](http://www.getmdl.io/components/index.html#layout-section)]
46 | - [x] Header + Rows
47 | - [x] Drawer
48 | - [x] Title
49 | - [x] Content
50 | - [x] Navigation + Links
51 | - [x] Grid
52 | - [x] Layout Tabs
53 | - [x] Tabs
54 | - [ ] Footer
55 | - [x] Menus [[Docs](https://zarxor.github.io/mdl-reactjs/docs/build/#/menus)] [[getmdl.io](http://www.getmdl.io/components/index.html#menus-section)]
56 |
--------------------------------------------------------------------------------
/docs/src/views/tablesView.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import MDL from '../../../lib/';
3 | import DOCS from '../components';
4 |
5 | export default class TablesView extends React.Component {
6 | render() {
7 | return (
8 |
9 |
10 |
Tables
11 |
Choose between states.
12 |
13 | {/*
14 |
15 | */}
16 |
17 |
18 |
27 |
28 |
29 |
38 |
39 |
40 |
41 |
42 | {'See docs source code..'}
43 |
44 |
45 | {/*
46 | Documentation text
47 | */}
48 |
49 |
50 |
CONFIGURATION OPTIONS
51 |
52 | Down below you can find all the attributes that can be applied to the component
53 |
54 |
55 |
56 |
57 | Attribute
58 | Effect
59 | Values
60 |
61 |
62 |
63 |
64 | Attribute
65 | Effect
66 | Values
67 |
68 |
69 |
70 |
71 |
72 | );
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/lib/toggle.js:
--------------------------------------------------------------------------------
1 |
2 | var React = require("react");
3 | var ReactDOM = require("react-dom");
4 | var cx = require('classnames');
5 | var _ = require('lodash');
6 |
7 | var _defaultProps = {
8 | ripple: false,
9 | checked: false,
10 | label: null,
11 | id: null, // Sets in getDefaultProps
12 | type: 'checkbox',
13 | name: null,
14 | defaultValue: null,
15 | required: false
16 | };
17 |
18 | module.exports = React.createClass({
19 | displayName: 'MDL.Toggle',
20 |
21 | propTypes: {
22 | type: React.PropTypes.oneOf(['checkbox', 'icon-toggle', 'radio', 'switch']),
23 | },
24 |
25 | getInitialState: function () {
26 | return { isChecked: this.props.checked };
27 | },
28 |
29 | getDefaultProps: function () {
30 | return _defaultProps;
31 | },
32 |
33 | _getClasses: function () {
34 | var classes = {
35 | 'mdl-js-ripple-effect': this.props.ripple,
36 | };
37 |
38 | classes['mdl-' + this.props.type] = true;
39 | classes['mdl-js-' + this.props.type] = true;
40 |
41 | return cx(classes);
42 | },
43 |
44 | _handleChange: function () {
45 | var node = ReactDOM.findDOMNode(this.refs.toggleInput)
46 | this.setState({ isChecked: node.checked });
47 |
48 | if (node.checked && typeof (this.props.onChecked) == 'function') {
49 | this.props.onChecked();
50 | } else if (!node.checked && typeof (this.props.onUnchecked) == 'function') {
51 | this.props.onUnchecked()
52 | }
53 | },
54 |
55 | _getElement: function () {
56 | var _id = this.props.id || ('toggle' + Math.floor((Math.random() * 10000) + 1000));
57 | var _name = this.props.name || _id;
58 | var _type = this.props.type == "radio" ? "radio" : "checkbox";
59 |
60 | var _inputClassname = "mdl-" + this.props.type + "__input";
61 | var _labelClassname = "mdl-" + this.props.type + "__label";
62 | var _labelTag = "span";
63 |
64 | switch (this.props.type) {
65 | case 'radio':
66 | _inputClassname = "mdl-" + this.props.type + "__button";
67 | break;
68 | case 'icon-toggle':
69 | _labelTag = "i";
70 | _labelClassname += " material-icons";
71 | break;
72 | }
73 |
74 | return (
75 | React.createElement("label", {htmlFor: _id},
76 | React.createElement("input", {required: this.props.required, ref: "toggleInput", name: _name, type: _type, id: _id, className: _inputClassname, defaultChecked: this.props.checked, defaultValue: this.props.defaultValue, onChange: this._handleChange}),
77 | React.createElement(_labelTag, { className: _labelClassname, children: (this.props.label || this.props.children) })
78 | )
79 | );
80 | },
81 |
82 | render: function () {
83 | var element = this._getElement();
84 | var newProps = __functions.joinProps(_defaultProps, this.props, element.props, this._getClasses());
85 |
86 | return React.cloneElement(element, newProps);
87 | },
88 |
89 | componentDidMount: function () {
90 | __functions.updateComponents();
91 | }
92 | });
93 |
--------------------------------------------------------------------------------
/docs/src/app.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { render } from 'react-dom'
3 | import { Router, Route, Link, IndexRoute, hashHistory } from 'react-router'
4 | import _ from 'lodash';
5 | import MDL from '../../lib';
6 | import Views, { StartView, BadgesView, TextfieldsView, BenchmarkView } from './views';
7 |
8 |
9 | var navRoutes = [
10 | { name: "home", to: "/", text: "Home", icon: "domain", view: StartView },
11 | { name: "badges", to: "/badges", text: "Badges", icon: "chat_bubble", view: BadgesView },
12 | { name: "buttons", to: "/buttons", text: "Buttons", icon: "chevron_right", view: Views.ButtonsView },
13 | { name: "cards", to: "/cards", text: "Cards (partial)", icon: "web", view: Views.CardsView },
14 | { name: "layout", to: "/layout", text: "Layout (partial)", icon: "view_quilt", view: Views.LayoutView },
15 | { name: "loading", to: "/loading", text: "Loading (partial)", icon: "replay", view: Views.LoadingView },
16 | { name: "menus", to: "/menus", text: "Menus (partial)", icon: "format_align_justify", view: Views.MenusView },
17 | { name: "sliders", to: "/sliders", text: "Sliders (partial)", icon: "tune", view: Views.SlidersView },
18 | { name: "toggles", to: "/toggles", text: "Toggles (partial)", icon: "exposure", view: Views.TogglesView },
19 | { name: "tables", to: "/tables", text: "Tables (todo)", icon: "view_list", view: Views.TablesView },
20 | { name: "textfields", to: "/textfields", text: "Text fields (partial)", icon: "font_download", view: TextfieldsView },
21 | //{ name: "", to: "/", text: "Tooltips (todo)", icon: "beenhere" },
22 |
23 | // { name: "benchmark", to: "/benchmark", text: "Benchmark", icon: "beenhere", view: BenchmarkView },
24 | ];
25 |
26 | class App extends React.Component {
27 | getNav() {
28 | return (
29 | {navRoutes.map(function (item, i) {
30 | return (
31 |
32 | {item.text}
33 |
34 | );
35 | })}
36 | );
37 | }
38 |
39 | render() {
40 | return (
41 |
42 |
43 |
44 |
45 | Material Design Lite components for ReactJS
46 |
47 |
48 |
49 |
50 | MDL-REACTJS
51 | {this.getNav()}
52 |
53 |
54 | {this.props.children}
55 |
56 |
57 | );
58 | }
59 | }
60 |
61 | var routes = (
62 |
63 | {_.map(navRoutes, function (route) {
64 | if (route.to.length > 0) {
65 | return
66 | }
67 | })}
68 | );
69 |
70 | render({routes} , document.getElementById('app'));
--------------------------------------------------------------------------------
/lib/textfield.js:
--------------------------------------------------------------------------------
1 | var React = require("react"),
2 | cx = require('classnames'),
3 | _ = require('lodash');
4 |
5 | var _defaultProps = {
6 | type: "text",
7 | floatingLabel: false,
8 | expandable: false,
9 | multiline: false,
10 | icon: "",
11 | label: "",
12 | error: "",
13 | onChange: null,
14 | autogrow: false,
15 | rows: 1,
16 | required: false,
17 | disabled: false
18 | };
19 |
20 | module.exports = React.createClass({
21 | displayName : 'MDL.Textfield',
22 |
23 | propTypes: {
24 |
25 | },
26 |
27 | getDefaultProps: function() {
28 | return _defaultProps;
29 | },
30 |
31 | _getClasses: function() {
32 | var classes = {
33 | 'mdl-textfield': true,
34 | 'mdl-js-textfield': true,
35 | 'mdl-textfield--floating-label': this.props.floatingLabel,
36 | 'mdl-textfield--expandable': this.props.expandable,
37 | };
38 | return cx(classes);
39 | },
40 |
41 | change: function (a,b,c) {
42 | if (this.props.onChange) {
43 | this.props.onChange(a,b,c);
44 | }
45 | if (this.props.multiline && this.props.autogrow) {
46 | var element = React.findDOMNode(this.refs.mdlTextfield);
47 | element.style.height = 'auto';
48 | element.style.height = element.scrollHeight+'px';
49 | }
50 | },
51 |
52 | _getElement: function() {
53 | var children = [];
54 | var tag = this.props.multiline ? 'textarea' : 'input';
55 |
56 | children.push(React.createElement(tag, {
57 | className : "mdl-textfield__input",
58 | defaultValue : this.props.defaultValue,
59 | value : this.props.value,
60 | id : this.props.id,
61 | name : this.props.id,
62 | rows : this.props.rows,
63 | type : this.props.type,
64 | pattern : this.props.pattern,
65 | disabled : this.props.disabled,
66 | onChange : this.change,
67 | ref: 'mdlTextfield',
68 | required: this.props.required,
69 | key: 'textfield'
70 | }));
71 |
72 | if (this.props.label.length > 0) {
73 | children.push(React.createElement("label", {
74 | className: "mdl-textfield__label",
75 | htmlFor: this.props.id,
76 | key: 'label'
77 | }, this.props.label));
78 | }
79 |
80 | if (this.props.error.length > 0) {
81 | children.push(React.createElement("label", {
82 | className: "mdl-textfield__error",
83 | key: 'errorlabel'
84 | }, this.props.error));
85 | }
86 |
87 | if (this.props.expandable > 0) {
88 | children = [
89 | React.createElement("label", {
90 | className: "mdl-button mdl-js-button mdl-button--icon",
91 | htmlFor: this.props.id,
92 | key: 'expandablelabel'
93 | }, React.createElement("i", {
94 | className: "material-icons",
95 | key: 'expandablelabelicon'
96 | }, this.props.icon)),
97 | React.createElement("div", {
98 | className: "mdl-textfield__expandable-holder",
99 | key: 'expandableholder'
100 | }, children)
101 | ];
102 | }
103 |
104 | return React.createElement("div", null, children);
105 | },
106 |
107 | render: function () {
108 | var element = this._getElement();
109 | var newProps = __functions.joinProps(_defaultProps, this.props, element.props, this._getClasses());
110 | return React.cloneElement(element, newProps);
111 | },
112 |
113 | componentDidMount: function() {
114 | __functions.updateComponents();
115 | }
116 | });
117 |
--------------------------------------------------------------------------------
/docs/src/views/textfieldsView.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import MDL from '../../../lib/';
3 | import DOCS from '../components';
4 |
5 | export default class TextfieldsView extends React.Component {
6 | render() {
7 | return (
8 |
9 |
10 |
TEXT FIELDS
11 |
Textual input components.
12 |
13 | {/*
14 |
15 | */}
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | {' '}
27 |
28 |
29 | {' '}
30 |
31 |
32 | {/*
33 |
34 | */}
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 | {' '}
46 |
47 |
48 |
49 | {' '}
50 |
51 |
52 | {/*
53 |
54 | */}
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 | {' '}
66 |
67 |
68 | {' '}
69 |
70 |
71 | {/*
72 | Documentation text
73 | */}
74 |
75 |
76 |
CONFIGURATION OPTIONS
77 |
78 | Down below you can find all the attributes that can be applied to the component
79 |
80 |
81 |
82 |
83 | Attribute
84 | Effect
85 | Values
86 |
87 |
88 |
89 |
90 | Attribute
91 | Effect
92 | Values
93 |
94 |
95 |
96 |
97 |
98 | );
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/docs/src/views/togglesView.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import MDL from '../../../lib/';
3 | import DOCS from '../components';
4 |
5 | export default class TogglesView extends React.Component {
6 | render() {
7 | return (
8 |
9 |
10 |
TOGGLES
11 |
Choose between states.
12 |
Checkbox
13 |
14 | {/*
15 |
16 | */}
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | {' '}
28 |
29 |
30 | {' '}
31 |
32 |
33 | {/*
34 |
35 | */}
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 | {' '}
47 |
48 |
49 | {' '}
50 |
51 |
52 | {/*
53 |
54 | */}
55 |
56 |
57 | format_bold
58 |
59 |
60 | format_italic
61 |
62 |
63 |
64 |
65 | {'format_bold '}
66 |
67 |
68 | {'format_italic '}
69 |
70 |
71 | {/*
72 |
73 | */}
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 | {' '}
85 |
86 |
87 | {' '}
88 |
89 |
90 | {/*
91 | Documentation text
92 | */}
93 |
94 |
95 |
CONFIGURATION OPTIONS
96 |
97 | Down below you can find all the attributes that can be applied to the component
98 |
99 |
100 |
101 |
102 | Attribute
103 | Effect
104 | Values
105 |
106 |
107 |
108 |
109 | Attribute
110 | Effect
111 | Values
112 |
113 |
114 |
115 |
116 |
117 | );
118 | }
119 | }
--------------------------------------------------------------------------------
/docs/build/css/prism.css:
--------------------------------------------------------------------------------
1 | /* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+jsx&plugins=line-numbers */
2 | /**
3 | * prism.js default theme for JavaScript, CSS and HTML
4 | * Based on dabblet (http://dabblet.com)
5 | * @author Lea Verou
6 | */
7 |
8 | code[class*="language-"],
9 | pre[class*="language-"] {
10 | color: black;
11 | text-shadow: 0 1px white;
12 | font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
13 | direction: ltr;
14 | text-align: left;
15 | white-space: pre;
16 | word-spacing: normal;
17 | word-break: normal;
18 | line-height: 1.5;
19 |
20 | -moz-tab-size: 4;
21 | -o-tab-size: 4;
22 | tab-size: 4;
23 |
24 | -webkit-hyphens: none;
25 | -moz-hyphens: none;
26 | -ms-hyphens: none;
27 | hyphens: none;
28 | }
29 |
30 | pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection,
31 | code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection {
32 | text-shadow: none;
33 | background: #b3d4fc;
34 | }
35 |
36 | pre[class*="language-"]::selection, pre[class*="language-"] ::selection,
37 | code[class*="language-"]::selection, code[class*="language-"] ::selection {
38 | text-shadow: none;
39 | background: #b3d4fc;
40 | }
41 |
42 | @media print {
43 | code[class*="language-"],
44 | pre[class*="language-"] {
45 | text-shadow: none;
46 | }
47 | }
48 |
49 | /* Code blocks */
50 | pre[class*="language-"] {
51 | padding: 1em;
52 | margin: .5em 0;
53 | overflow: auto;
54 | }
55 |
56 | :not(pre) > code[class*="language-"],
57 | pre[class*="language-"] {
58 | background: #f5f2f0;
59 | }
60 |
61 | /* Inline code */
62 | :not(pre) > code[class*="language-"] {
63 | padding: .1em;
64 | border-radius: .3em;
65 | }
66 |
67 | .token.comment,
68 | .token.prolog,
69 | .token.doctype,
70 | .token.cdata {
71 | color: slategray;
72 | }
73 |
74 | .token.punctuation {
75 | color: #999;
76 | }
77 |
78 | .namespace {
79 | opacity: .7;
80 | }
81 |
82 | .token.property,
83 | .token.tag,
84 | .token.boolean,
85 | .token.number,
86 | .token.constant,
87 | .token.symbol,
88 | .token.deleted {
89 | color: #905;
90 | }
91 |
92 | .token.selector,
93 | .token.attr-name,
94 | .token.string,
95 | .token.char,
96 | .token.builtin,
97 | .token.inserted {
98 | color: #690;
99 | }
100 |
101 | .token.operator,
102 | .token.entity,
103 | .token.url,
104 | .language-css .token.string,
105 | .style .token.string {
106 | color: #a67f59;
107 | background: hsla(0, 0%, 100%, .5);
108 | }
109 |
110 | .token.atrule,
111 | .token.attr-value,
112 | .token.keyword {
113 | color: #07a;
114 | }
115 |
116 | .token.function {
117 | color: #DD4A68;
118 | }
119 |
120 | .token.regex,
121 | .token.important,
122 | .token.variable {
123 | color: #e90;
124 | }
125 |
126 | .token.important,
127 | .token.bold {
128 | font-weight: bold;
129 | }
130 | .token.italic {
131 | font-style: italic;
132 | }
133 |
134 | .token.entity {
135 | cursor: help;
136 | }
137 |
138 | pre.line-numbers {
139 | position: relative;
140 | padding-left: 3.8em;
141 | counter-reset: linenumber;
142 | }
143 |
144 | pre.line-numbers > code {
145 | position: relative;
146 | }
147 |
148 | .line-numbers .line-numbers-rows {
149 | position: absolute;
150 | pointer-events: none;
151 | top: 0;
152 | font-size: 100%;
153 | left: -3.8em;
154 | width: 3em; /* works for line-numbers below 1000 lines */
155 | letter-spacing: -1px;
156 | border-right: 1px solid #999;
157 |
158 | -webkit-user-select: none;
159 | -moz-user-select: none;
160 | -ms-user-select: none;
161 | user-select: none;
162 |
163 | }
164 |
165 | .line-numbers-rows > span {
166 | pointer-events: none;
167 | display: block;
168 | counter-increment: linenumber;
169 | }
170 |
171 | .line-numbers-rows > span:before {
172 | content: counter(linenumber);
173 | color: #999;
174 | display: block;
175 | padding-right: 0.8em;
176 | text-align: right;
177 | }
178 |
--------------------------------------------------------------------------------
/docs/src/views/loadingView.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import MDL from '../../../lib/';
3 | import DOCS from '../components';
4 |
5 | export default class LoadingView extends React.Component {
6 | constructor(props) {
7 | super(props);
8 | this.state = {
9 | progressOne: 11
10 | };
11 | }
12 |
13 | setProgressOne() {
14 | this.setState({progressOne: 44});
15 | }
16 |
17 | render() {
18 | return (
19 |
20 |
21 |
Loading
22 |
Indicate loading and progress states.
23 |
Progress bar
24 |
25 |
26 | {/*
27 | Default
28 | */}
29 |
30 |
31 | this.progressOne = x} id="prog_1" progress={this.state.progressOne} />
32 | this.setState({progressOne: 44}) }>Set progress to 44
33 |
34 |
35 |
36 |
37 | {' '}
38 |
39 |
40 | {/*
41 | Default
42 | */}
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | {' '}
51 |
52 |
53 | {/*
54 | Default
55 | */}
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 | {' '}
64 |
65 |
66 | {/*
67 | Documentation text
68 | */}
69 |
70 |
71 |
CONFIGURATION OPTIONS
72 |
73 | Down below you can find all the attributes that can be applied to the component
74 |
75 |
76 |
77 |
78 | Attribute
79 | Effect
80 | Values
81 |
82 |
83 |
84 |
85 | Attribute
86 | Effect
87 | Values
88 |
89 |
90 |
91 |
92 |
93 | {/*
94 | Titles
95 | */}
96 |
97 |
98 |
Spinner
99 |
100 |
101 | {/*
102 | Default
103 | */}
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 | {' '}
116 |
117 |
118 | {' '}
119 |
120 |
121 | {/*
122 | Documentation text
123 | */}
124 |
125 |
126 |
CONFIGURATION OPTIONS
127 |
128 | Down below you can find all the attributes that can be applied to the component
129 |
130 |
131 |
132 |
133 | Attribute
134 | Effect
135 | Values
136 |
137 |
138 |
139 |
140 | Attribute
141 | Effect
142 | Values
143 |
144 |
145 |
146 |
147 |
148 | );
149 | }
150 | }
151 |
--------------------------------------------------------------------------------
/docs/src/views/menusView.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import MDL from '../../../lib/';
3 | import DOCS from '../components';
4 |
5 | export default class MenusView extends React.Component {
6 | render() {
7 | return (
8 |
9 |
10 |
Menus
11 |
Lists of clickable actions.
12 |
13 | {/*
14 | Colored FAB
15 | */}
16 |
17 |
18 |
19 |
20 |
21 | Some action
22 | Another action
23 | Disabled action
24 | Yet another action
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | Some action
33 | Another action
34 | Disabled action
35 | Yet another action
36 |
37 |
38 |
39 |
40 |
41 |
42 | {'See docs source code..'}
43 |
44 |
45 | {'See docs source code..'}
46 |
47 |
48 | {/*
49 | Colored FAB
50 | */}
51 |
52 |
53 |
54 |
55 |
56 | Some action
57 | Another action
58 | Disabled action
59 | Yet another action
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 | Some action
68 | Another action
69 | Disabled action
70 | Yet another action
71 |
72 |
73 |
74 |
75 |
76 |
77 | {'See docs source code..'}
78 |
79 |
80 | {'See docs source code..'}
81 |
82 |
83 | {/*
84 | Documentation text
85 | */}
86 |
87 |
88 |
CONFIGURATION OPTIONS
89 |
90 | Down below you can find all the attributes that can be applied to the component
91 |
92 |
93 |
94 |
95 | Attribute
96 | Effect
97 | Values
98 |
99 |
100 |
101 |
102 | Attribute
103 | Effect
104 | Values
105 |
106 |
107 |
108 |
109 |
110 | );
111 | }
112 | }
--------------------------------------------------------------------------------
/lib/table.js:
--------------------------------------------------------------------------------
1 |
2 | var React = require("react"),
3 | ReactDOM = require('react-dom'),
4 | cx = require('classnames'),
5 | _ = require('lodash');
6 |
7 | var _defaultProps = __functions.makeDefaultProps({
8 | columns: null,
9 | data: null,
10 | shadow: 2,
11 | selectable: false,
12 | 'no-head': false,
13 | }, {
14 | colors: true,
15 | shadow: true,
16 | });
17 |
18 | module.exports = React.createClass({
19 | displayName : 'MDL.Table',
20 |
21 | propTypes: {
22 | columns: React.PropTypes.arrayOf(
23 | React.PropTypes.shape({
24 | label: React.PropTypes.string,
25 | key: React.PropTypes.string,
26 | isNumeric: React.PropTypes.bool
27 | })
28 | ).isRequired,
29 | data: React.PropTypes.arrayOf(
30 | React.PropTypes.object
31 | ).isRequired,
32 | },
33 |
34 | getInitialState: function() {
35 | return { isChecked: this.props.checked };
36 | },
37 |
38 | getDefaultProps: function() {
39 | return _defaultProps;
40 | },
41 |
42 | _getClasses: function() {
43 | var classes = {
44 | 'mdl-data-table' : true,
45 | 'mdl-js-data-table' : true,
46 |
47 | 'mdl-data-table--selectable': this.props.selectable && !this.props['no-head'],
48 | };
49 |
50 | classes = __functions.addGeneralClasses(classes, this.props);
51 |
52 | return cx(classes);
53 | },
54 |
55 | _handleChange: function () {
56 | this.setState({ isChecked: !this.state.isChecked });
57 | if (!this.state.isChecked) {
58 | // todo: implement onChecked event
59 | } else {
60 | // todo: implement onUnchecked event
61 | }
62 | },
63 |
64 | _getCellClasses: function (column) {
65 | return cx(__functions.addGeneralClasses({
66 | 'mdl-data-table__cell--non-numeric' : !column.isNumeric,
67 | }, column));
68 | },
69 |
70 | _getRowClasses: function (row) {
71 | return cx(__functions.addGeneralClasses({}, row));
72 | },
73 |
74 | _rowClicked: function (row, i) {
75 | },
76 |
77 | _getElement: function() {
78 | return (
79 | React.createElement("table", null,
80 |
81 | !this.props['no-head']
82 | ? React.createElement("thead", null,
83 | React.createElement("tr", null,
84 | this.props.columns.map(function (column) {
85 | return (
86 | React.createElement("th", {key: column.key, className: this._getCellClasses(column), style: column.style}, column.label)
87 | );
88 | }.bind(this))
89 | )
90 | )
91 | : null,
92 |
93 | React.createElement("tbody", null,
94 | this.props.data.map(function (row, i) {
95 | return (
96 | React.createElement("tr", {key: i, className: this._getRowClasses(row)},
97 | this.props.columns.map(function (column) {
98 | return (
99 | React.createElement("td", {key: column.key, className: this._getCellClasses(column)}, column.prefix, row[column.key], column.suffix)
100 | );
101 | }.bind(this))
102 | )
103 | );
104 | }.bind(this))
105 | )
106 | )
107 | );
108 | },
109 |
110 | render: function () {
111 | var element = this._getElement();
112 | var newProps = __functions.joinProps(_defaultProps, this.props, element.props, this._getClasses());
113 | return React.cloneElement(element, newProps);
114 | },
115 |
116 | componentDidMount: function() {
117 | __functions.updateComponents();
118 | if (this.props.selectable && !this.props['no-head']) {
119 | var elem = ReactDOM.findDOMNode(this);
120 | var selectBoxes = this._findElementsByClass(elem, "mdl-checkbox__input");
121 | for (var i = 0; i < selectBoxes.length; i++) {
122 | selectBoxes[i].addEventListener("change", this.props.onChange);
123 | }
124 | }
125 | },
126 |
127 | getSelectedRows: function () {
128 | //return this.
129 | },
130 |
131 | _findElementsByClass: function(element, className) {
132 | var foundElements = [];
133 | function recurse(element, className) {
134 | for (var i = 0; i < element.childNodes.length; i++) {
135 | var el = element.childNodes[i];
136 | var classes = el.className != undefined? el.className.split(" ") : [];
137 | for (var j = 0, jl = classes.length; j < jl; j++) {
138 | if (classes[j] == className) {
139 | foundElements.push(element.childNodes[i]) ;
140 | }
141 | }
142 |
143 | recurse(element.childNodes[i], className);
144 | }
145 | }
146 | recurse(element, className);
147 | return foundElements;
148 | }
149 | });
150 |
--------------------------------------------------------------------------------
/lib/index.js:
--------------------------------------------------------------------------------
1 | var React = require("react"),
2 | _ = require('lodash');
3 |
4 | global.__functions = {
5 | updateComponents: _.debounce(function () {
6 | componentHandler.upgradeDom();
7 | }, 10),
8 |
9 | objDiff: function (obj1, obj2) {
10 | var _keysObj1 = _.keys(obj1);
11 | var _keysObj2 = _.keys(obj2);
12 |
13 | var _keysDiff = _.remove(_keysObj2, function(n) {
14 | return (_(_keysObj1).indexOf(n) == -1);
15 | });
16 |
17 | return _.pick(obj2, function (value, key) {
18 | return _(_keysDiff).indexOf(key) != -1;
19 | });
20 | },
21 |
22 | joinProps: function (defaultProps, currentProps, elementProps, classes) {
23 | var diffedProps = this.objDiff(defaultProps, currentProps);
24 | var joinedProps = _.assign(diffedProps, elementProps);
25 | return _.assign(joinedProps, {
26 | className: _.trimLeft((currentProps.className || '') + ' ' + (elementProps.className || '') + ' ' + classes)
27 | });
28 | },
29 |
30 | addColorClasses: function (classArray, color, colorSpectrum, textColor, textColorSpectrum) {
31 | colorSpectrum = colorSpectrum || 400;
32 | textColorSpectrum = textColorSpectrum || 400;
33 |
34 | if (color && color.length) {
35 | if (color == "white" || color == "black") {
36 | classArray["mdl-color--" + color] = true;
37 | } else {
38 | classArray["mdl-color--" + color + "-" + colorSpectrum] = true;
39 | }
40 | }
41 | if (textColor && textColor.length) {
42 | if (textColor == "white" || textColor == "black") {
43 | classArray["mdl-color-text--" + textColor] = true;
44 | } else {
45 | classArray["mdl-color-text--" + textColor + "-" + textColorSpectrum] = true;
46 | }
47 | }
48 | return classArray;
49 | },
50 |
51 | addShadowClasses: function (classArray, depth) {
52 | if (depth && depth > 0) {
53 | classArray['mdl-shadow--' + depth + 'dp'] = true;
54 | }
55 |
56 | return classArray;
57 | },
58 |
59 | addGeneralClasses: function (classArray, props) {
60 | classArray = this.addColorClasses(classArray, props.color, props.colorSpectrum, props.textColor, props.textColorSpectrum);
61 | classArray = this.addShadowClasses(classArray, props.shadow);
62 |
63 | return classArray;
64 | },
65 |
66 | makeDefaultProps: function (props, settings) {
67 | settings = _.assign({
68 | colors: false,
69 | shadow: false,
70 | }, settings);
71 |
72 | props = settings.colors ? _.assign({
73 | color: '',
74 | colorSpectrum: '',
75 | textColor: '',
76 | textColorSpectrum: '',
77 | }, props) : props;
78 |
79 | props = settings.shadow ? _.assign({
80 | shadow: 2
81 | }, props) : props;
82 |
83 | return props;
84 | },
85 |
86 | makeDefaultPropTypes: function (props, settings) {
87 | settings = _.assign({
88 | colors: false,
89 | shadow: false,
90 | }, settings);
91 |
92 | var _colors = ['', 'white', 'black', 'red','pink','purple','deep-purple','indigo','blue','light-blue','cyan','teal','green','light-green','lime','yellow','amber','orange','deep-orange','brown','grey','blue-grey'];
93 | var _spectrums = ['', 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 'A100', 'A200', 'A400', 'A700'];
94 |
95 | props = settings.colors ? _.assign({
96 | color: React.PropTypes.oneOf(_colors),
97 | colorSpectrum: React.PropTypes.oneOf(_spectrums),
98 | textColor: React.PropTypes.oneOf(_colors),
99 | textColorSpectrum: React.PropTypes.oneOf(_spectrums),
100 | }, props) : props;
101 |
102 | props = settings.shadow ? _.assign({
103 | shadow: React.PropTypes.oneOf([ 0, 2, 3, 4, 6, 8, 16 ]),
104 | }, props) : props;
105 |
106 | return props;
107 | },
108 | };
109 |
110 | module.exports = {
111 | Badge: require('./badge.js'),
112 | Button: require('./button.js'),
113 | Icon: require('./icon.js'),
114 | Menu: require('./menu.js'),
115 | MenuItem: require('./menuItem.js'),
116 | Progress: require('./progress.js'),
117 | Slider: require('./slider.js'),
118 | Spinner: require('./spinner.js'),
119 | Textfield: require('./textfield.js'),
120 | Toggle: require('./toggle.js'),
121 | Table: require('./table.js'),
122 |
123 | // Card
124 | Card: require('./card/card.js'),
125 | CardActions: require('./card/cardActions.js'),
126 | CardMedia: require('./card/cardMedia.js'),
127 | CardMenu: require('./card/cardMenu.js'),
128 | CardSupportingText: require('./card/cardSupportingText.js'),
129 | CardTitle: require('./card/cardTitle.js'),
130 |
131 | // Layout
132 | Layout: require('./layout/layout.js'),
133 | LayoutContent: require('./layout/layoutContent.js'),
134 | LayoutDrawer: require('./layout/layoutDrawer.js'),
135 | LayoutHeader: require('./layout/layoutHeader.js'),
136 | LayoutHeaderRow: require('./layout/layoutHeaderRow.js'),
137 | LayoutSpacer: require('./layout/layoutSpacer.js'),
138 | LayoutTitle: require('./layout/layoutTitle.js'),
139 |
140 | // Tabs
141 | Tabs: require('./tabs/tabs.js'),
142 | TabsPanel: require('./tabs/tabsPanel.js'),
143 |
144 | // Navigation
145 | Navigation: require('./navigation/navigation.js'),
146 | NavigationLink: require('./navigation/navigationLink.js'),
147 |
148 | // Grid
149 | Grid: require('./grid/grid.js'),
150 | GridCell: require('./grid/gridCell.js'),
151 | };
152 |
--------------------------------------------------------------------------------
/docs/src/views/layoutView.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import MDL from '../../../lib/';
3 | import DOCS from '../components';
4 |
5 | export default class LayoutView extends React.Component {
6 | // handleChange(name, e) {
7 | // console.log('change');
8 | // }
9 |
10 | // handleEvent(e) {
11 | // console.log(e);
12 | // }
13 |
14 | render() {
15 | return (
16 |
17 |
18 |
Layout
19 |
Building blocks for constructing a page layout.
20 |
Grid
21 |
22 | {/*
23 |
24 | */}
25 |
26 | 1
27 | 1
28 | 1
29 | 1
30 | 1
31 | 1
32 | 1
33 | 1
34 | 1
35 | 1
36 | 1
37 | 1
38 |
39 |
40 | 4
41 | 4
42 | 4
43 |
44 |
45 | 6
46 | 4
47 | 2
48 |
49 |
50 | 6 (8 tablet)
51 | 4 (6 tablet)
52 | 2 (4 phone)
53 |
54 |
55 |
56 | {' '}{'\n'}
57 | {' 1 '}{'\n'}
58 | {' 1 '}{'\n'}
59 | {' 1 '}{'\n'}
60 | {' 1 '}{'\n'}
61 | {' 1 '}{'\n'}
62 | {' 1 '}{'\n'}
63 | {' 1 '}{'\n'}
64 | {' 1 '}{'\n'}
65 | {' 1 '}{'\n'}
66 | {' 1 '}{'\n'}
67 | {' 1 '}{'\n'}
68 | {' 1 '}{'\n'}
69 | {' '}{'\n'}
70 | {' '}{'\n'}
71 | {' 4 '}{'\n'}
72 | {' 4 '}{'\n'}
73 | {' 4 '}{'\n'}
74 | {' '}{'\n'}
75 | {' '}{'\n'}
76 | {' 6 '}{'\n'}
77 | {' 4 '}{'\n'}
78 | {' 2 '}{'\n'}
79 | {' '}{'\n'}
80 | {' '}{'\n'}
81 | {' 6 (8 tablet) '}{'\n'}
82 | {' 4 (6 tablet) '}{'\n'}
83 | {' 2 (4 phone) '}{'\n'}
84 | {' '}
85 |
86 |
87 | {/*
88 | Documentation text
89 | */}
90 |
91 |
92 |
CONFIGURATION OPTIONS
93 |
94 | Down below you can find all the attributes that can be applied to the component GridCell
95 |
96 |
97 |
98 |
99 | Attribute
100 | Effect
101 | Values
102 |
103 |
104 |
105 |
106 | col
107 | Sets the column size for the cell
108 | INT [1-12]
109 |
110 |
111 | colDesktop
112 | Sets the column size for the cell for desktop mode only
113 | INT [1-12]
114 |
115 |
116 | colTablet
117 | Sets the column size for the cell for tablet mode only
118 | INT [1-12]
119 |
120 |
121 | colPhone
122 | Sets the column size for the cell for phone mode only
123 | INT [1-12]
124 |
125 |
126 | hideDesktop
127 | Hides the cell when in desktop mode
128 | boolean
129 |
130 |
131 | hideTablet
132 | Hides the cell when in tablet mode
133 | boolean
134 |
135 |
136 | hidePhone
137 | Hides the cell when in phone mode
138 | boolean
139 |
140 |
141 | stretch
142 | Stretches the cell vertically to fill the parent
143 | boolean
144 |
145 |
146 | align
147 | Defines tow the cell alignes to the parent
148 | [left/right/top/bottom]
149 |
150 |
151 |
152 |
153 |
154 |
155 |
Tabs
156 |
157 | {/*
158 |
159 | */}
160 |
161 | {/*
162 | Wide
163 | */}
164 |
165 |
166 |
167 |
168 | This is the content of the first tab!
169 |
170 |
171 | And here you have the content of the second tab...
172 |
173 |
174 |
175 |
176 |
177 |
178 | );
179 | }
180 | }
--------------------------------------------------------------------------------
/docs/src/views/cardsView.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import MDL from '../../../lib/';
3 | import DOCS from '../components';
4 |
5 | export default class CardsView extends React.Component {
6 | render() {
7 | return (
8 |
9 |
10 |
Cards
11 |
Self-contained pieces of paper with data.
12 |
13 |
14 | {/*
15 | Wide
16 | */}
17 |
18 |
19 |
20 |
25 | Welcome
26 |
27 |
28 | Lorem ipsum dolor sit amet, consectetur adipiscing elit.
29 | Mauris sagittis pellentesque lacus eleifend lacinia...
30 |
31 |
32 | Get started
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | {
43 | '\n' +
44 | ' \n' +
49 | ' Welcome\n' +
50 | ' \n' +
51 | ' \n' +
52 | ' Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n' +
53 | ' Mauris sagittis pellentesque lacus eleifend lacinia...\n' +
54 | ' \n' +
55 | ' \n' +
56 | ' Get started \n' +
57 | ' \n' +
58 | ' \n' +
59 | ' \n' +
60 | ' \n' +
61 | ' '
62 | }
63 |
64 |
65 | {/*
66 | Square
67 | */}
68 |
69 |
70 |
74 |
79 | Update
80 |
81 |
82 | Lorem ipsum dolor sit amet, consectetur adipiscing elit.
83 |
84 |
85 | View updates
86 |
87 |
88 |
89 |
90 |
91 |
92 | {
93 | '\n' +
94 | ' height: 320,\n' +
95 | ' width: 320\n' +
96 | '}}>\n' +
97 | ' \n' +
102 | ' Update\n' +
103 | ' \n' +
104 | ' \n' +
105 | ' Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n' +
106 | ' \n' +
107 | ' \n' +
108 | ' View updates \n' +
109 | ' \n' +
110 | ' '
111 | }
112 |
113 |
114 | {/*
115 | Square
116 | */}
117 |
118 |
119 |
124 |
125 |
130 | Image.jpg
131 |
132 |
133 |
134 |
135 |
141 |
142 |
143 | Featured event:
144 | May 24, 2016
145 | 7-11pm
146 |
147 |
148 |
153 |
154 | Add to calendar
155 |
156 |
157 | event
158 |
159 |
160 |
161 |
162 |
163 |
164 | {
165 | 'See docs source code..'
166 | }
167 |
168 |
169 | {
170 | 'See docs source code..'
171 | }
172 |
173 |
174 | {/*
175 | Documentation text
176 | */}
177 |
178 |
179 |
CONFIGURATION OPTIONS
180 |
181 | Down below you can find all the attributes that can be applied to the component
182 |
183 |
184 |
185 |
186 | Attribute
187 | Effect
188 | Values
189 |
190 |
191 |
192 |
193 | Attribute
194 | Effect
195 | Values
196 |
197 |
198 |
199 |
200 |
201 | );
202 | }
203 | }
204 |
--------------------------------------------------------------------------------
/docs/src/views/buttonsView.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import MDL from '../../../lib/';
3 | import DOCS from '../components';
4 |
5 | export default class ButonsView extends React.Component {
6 | render() {
7 | return (
8 |
9 |
10 |
Buttons
11 |
Variations on Material Design buttons.
12 |
13 |
14 | {/*
15 | Colored FAB
16 | */}
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | {' '}
28 |
29 |
30 | {' '}
31 |
32 |
33 | {/*
34 | Plain FAB
35 | */}
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | {' '}
50 |
51 |
52 | {' '}
53 |
54 |
55 | {' '}
56 |
57 |
58 | {/*
59 | Raised Buttons
60 | */}
61 |
62 |
63 | Button
64 |
65 |
66 | Button
67 |
68 |
69 | Button
70 |
71 |
72 |
73 |
74 | {'Button '}
75 |
76 |
77 | {'Button '}
78 |
79 |
80 | {'Button '}
81 |
82 |
83 | {/*
84 | Raised Buttons
85 | */}
86 |
87 |
88 | Button
89 |
90 |
91 | Button
92 |
93 |
94 | Button
95 |
96 |
97 |
98 |
99 | {'Button '}
100 |
101 |
102 | {'Button '}
103 |
104 |
105 | {'Button '}
106 |
107 |
108 | {/*
109 | Flat Buttons
110 | */}
111 |
112 |
113 | Button
114 |
115 |
116 | Button
117 |
118 |
119 | Button
120 |
121 |
122 |
123 |
124 | {'Button '}
125 |
126 |
127 | {'Button '}
128 |
129 |
130 | {'Button '}
131 |
132 |
133 | {/*
134 | Flat colored Buttons
135 | */}
136 |
137 |
138 | Button
139 |
140 |
141 | Button
142 |
143 |
144 |
145 |
146 | {'Button '}
147 |
148 |
149 | {'Button '}
150 |
151 |
152 | {/*
153 | Icon buttons
154 | */}
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 | {' '}
166 |
167 |
168 | {' '}
169 |
170 |
171 | {/*
172 | Mini fab buttons
173 | */}
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 | {' '}
185 |
186 |
187 | {' '}
188 |
189 |
190 |
191 |
CONFIGURATION OPTIONS
192 |
193 | Down below you can find all the attributes that can be applied to the <button /> component
194 |
195 |
196 |
197 |
198 | Attribute
199 | Effect
200 | Values
201 |
202 |
203 |
204 |
205 | ripple
206 | Applies ripple display effect
207 | boolean
208 |
209 |
210 | fab
211 | Applies fab (circular) display effect
212 | boolean
213 |
214 |
215 |
216 |
217 |
218 | );
219 | }
220 | };
221 |
--------------------------------------------------------------------------------
/docs/build/js/prism.js:
--------------------------------------------------------------------------------
1 | /* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+jsx&plugins=line-numbers */
2 | var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(){var e=/\blang(?:uage)?-(?!\*)(\w+)\b/i,t=_self.Prism={util:{encode:function(e){return e instanceof n?new n(e.type,t.util.encode(e.content),e.alias):"Array"===t.util.type(e)?e.map(t.util.encode):e.replace(/&/g,"&").replace(/e.length)break e;if(!(d instanceof a)){u.lastIndex=0;var m=u.exec(d);if(m){g&&(f=m[1].length);var y=m.index-1+f,m=m[0].slice(f),v=m.length,k=y+v,b=d.slice(0,y+1),w=d.slice(k+1),N=[p,1];b&&N.push(b);var O=new a(l,c?t.tokenize(m,c):m,h);N.push(O),w&&N.push(w),Array.prototype.splice.apply(r,N)}}}}}return r},hooks:{all:{},add:function(e,n){var a=t.hooks.all;a[e]=a[e]||[],a[e].push(n)},run:function(e,n){var a=t.hooks.all[e];if(a&&a.length)for(var r,i=0;r=a[i++];)r(n)}}},n=t.Token=function(e,t,n){this.type=e,this.content=t,this.alias=n};if(n.stringify=function(e,a,r){if("string"==typeof e)return e;if("Array"===t.util.type(e))return e.map(function(t){return n.stringify(t,a,e)}).join("");var i={type:e.type,content:n.stringify(e.content,a,r),tag:"span",classes:["token",e.type],attributes:{},language:a,parent:r};if("comment"==i.type&&(i.attributes.spellcheck="true"),e.alias){var l="Array"===t.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(i.classes,l)}t.hooks.run("wrap",i);var o="";for(var s in i.attributes)o+=s+'="'+(i.attributes[s]||"")+'"';return"<"+i.tag+' class="'+i.classes.join(" ")+'" '+o+">"+i.content+""+i.tag+">"},!_self.document)return _self.addEventListener?(_self.addEventListener("message",function(e){var n=JSON.parse(e.data),a=n.language,r=n.code;_self.postMessage(JSON.stringify(t.util.encode(t.tokenize(r,t.languages[a])))),_self.close()},!1),_self.Prism):_self.Prism;var a=document.getElementsByTagName("script");return a=a[a.length-1],a&&(t.filename=a.src,document.addEventListener&&!a.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",t.highlightAll)),_self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism);;
3 | Prism.languages.markup={comment://,prolog:/<\?[\w\W]+?\?>/,doctype://,cdata://i,tag:{pattern:/<\/?[^\s>\/]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i,inside:{punctuation:/[=>"']/}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/?[\da-z]{1,8};/i},Prism.hooks.add("wrap",function(t){"entity"===t.type&&(t.attributes.title=t.content.replace(/&/,"&"))});;
4 | Prism.languages.css={comment:/\/\*[\w\W]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^\{\}\s][^\{\};]*?(?=\s*\{)/,string:/("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/,property:/(\b|\B)[\w-]+(?=\s*:)/i,important:/\B!important\b/i,"function":/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},Prism.languages.css.atrule.inside.rest=Prism.util.clone(Prism.languages.css),Prism.languages.markup&&(Prism.languages.insertBefore("markup","tag",{style:{pattern:/