├── .gitignore ├── README.md ├── examples ├── README.md ├── components │ ├── buttons │ │ └── buttons.js │ ├── checkbox-groups │ │ └── checkbox-groups.js │ ├── checkboxes │ │ └── checkboxes.js │ ├── dropdowns │ │ └── dropdowns.js │ ├── icons │ │ ├── icons.jsx │ │ └── icons.styl │ ├── images │ │ └── images.js │ ├── inputs │ │ └── inputs.js │ ├── links │ │ └── links.js │ ├── menus │ │ └── menus.js │ ├── popups │ │ ├── popups.jsx │ │ └── popups.styl │ ├── progressbars │ │ └── progressbars.js │ ├── radio-groups │ │ └── radio-groups.js │ ├── radios │ │ └── radios.js │ ├── react │ │ └── react.bemhtml.js │ ├── selects │ │ ├── selects.jsx │ │ └── selects.styl │ ├── spins │ │ └── spins.js │ └── textareas │ │ └── textareas.js ├── design │ ├── attach │ │ ├── attach.css │ │ └── attach.deps.js │ ├── button │ │ ├── button.css │ │ └── button.deps.js │ ├── checkbox-group │ │ ├── checkbox-group.css │ │ └── checkbox-group.deps.js │ ├── checkbox │ │ ├── checkbox.css │ │ └── checkbox.deps.js │ ├── dropdown │ │ ├── dropdown.css │ │ └── dropdown.deps.js │ ├── input │ │ ├── input.css │ │ └── input.deps.js │ ├── link │ │ ├── link.css │ │ └── link.deps.js │ ├── menu-item │ │ ├── menu-item.css │ │ └── menu-item.deps.js │ ├── menu │ │ ├── menu.css │ │ └── menu.deps.js │ ├── modal │ │ ├── modal.css │ │ └── modal.deps.js │ ├── popup │ │ ├── popup.css │ │ └── popup.deps.js │ ├── progressbar │ │ ├── progressbar.css │ │ └── progressbar.deps.js │ ├── radio-group │ │ ├── radio-group.css │ │ └── radio-group.deps.js │ ├── radio │ │ ├── radio.css │ │ └── radio.deps.js │ ├── select │ │ ├── select.css │ │ └── select.deps.js │ ├── spin │ │ ├── spin.css │ │ └── spin.deps.js │ └── textarea │ │ ├── textarea.css │ │ └── textarea.deps.js ├── index.jsx ├── package.json ├── server.js └── webpack.config.js ├── package.json ├── src ├── components │ ├── attach │ │ └── attach.js │ ├── button │ │ └── button.js │ ├── checkbox-group │ │ ├── checkbox-group.bemhtml.js │ │ └── checkbox-group.js │ ├── checkbox │ │ ├── __control │ │ │ └── checkbox__control.bemhtml.js │ │ ├── _type │ │ │ └── checkbox_type_button.bemhtml.js │ │ ├── checkbox.deps.js │ │ └── checkbox.js │ ├── control │ │ └── control.js │ ├── dropdown │ │ ├── _switcher │ │ │ └── dropdown_switcher_link.bemhtml.js │ │ ├── dropdown.deps.js │ │ └── dropdown.js │ ├── icon │ │ └── icon.js │ ├── image │ │ └── image.js │ ├── input │ │ ├── __control │ │ │ └── input__control.bemhtml.js │ │ ├── _has-clear │ │ │ └── input_has-clear.bemhtml.js │ │ ├── input.deps.js │ │ └── input.js │ ├── link │ │ ├── link.bemhtml.js │ │ └── link.js │ ├── menu-item │ │ └── menu-item.js │ ├── menu │ │ ├── __group │ │ │ └── menu__group.js │ │ ├── menu.bemhtml.js │ │ └── menu.js │ ├── modal │ │ └── modal.js │ ├── popup │ │ ├── calc-drawing-params.js │ │ └── popup.js │ ├── progressbar │ │ └── progressbar.js │ ├── radio-group │ │ ├── radio-group.bemhtml.js │ │ └── radio-group.js │ ├── radio │ │ ├── __control │ │ │ └── radio__control.bemhtml.js │ │ ├── _type │ │ │ └── radio_type_button.bemhtml.js │ │ ├── radio.deps.js │ │ └── radio.js │ ├── select │ │ ├── __button │ │ │ └── select__button.bemhtml.js │ │ ├── __menu │ │ │ └── select__menu.bemhtml.js │ │ ├── __popup │ │ │ └── select__popup.bemhtml.js │ │ ├── select.deps.js │ │ └── select.js │ ├── spin │ │ └── spin.js │ └── textarea │ │ ├── textarea.bemhtml.js │ │ └── textarea.js ├── core │ └── bem │ │ └── bem.js ├── index.js ├── lib │ └── window.js └── provider │ └── provider.js └── webpack.config.js /.gitignore: -------------------------------------------------------------------------------- 1 | bower_components 2 | node_modules 3 | npm-debug.log 4 | dist 5 | examples/index.html 6 | src/provider/templates.js 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # react-bl 2 | 3 | Powerful React components which uses XJST. Wtf? [Russian](https://github.com/bem/bem-forum-content-ru/issues/961) 4 | 5 | > npm i && cd examples && npm i && npm start 6 | 7 | ### License 8 | 9 | MIT 10 | -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | # react-components examples 2 | 3 | > npm i && npm start && open http://localhost:8080 4 | -------------------------------------------------------------------------------- /examples/components/buttons/buttons.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const React = require('react'); 4 | 5 | const Button = require('../../../src').Button; 6 | require('bem-loader!../../design/button/button.css'); 7 | 8 | module.exports = class Buttons extends React.Component { 9 | 10 | render() { 11 | return ( 12 |
13 |

Buttons

14 | 15 |
39 | ); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /examples/components/checkbox-groups/checkbox-groups.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const React = require('react'); 4 | 5 | const CheckboxGroup = require('../../../src').CheckboxGroup; 6 | require('bem-loader!../../design/checkbox-group/checkbox-group.css'); 7 | 8 | module.exports = class CheckboxGroups extends React.Component { 9 | 10 | render() { 11 | return ( 12 |
13 |

Checkbox groups

14 | 15 | 24 |   25 | 33 | 34 |   35 | 45 |
46 | ); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /examples/components/checkboxes/checkboxes.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const React = require('react'); 4 | 5 | const Checkbox = require('../../../src').Checkbox; 6 | require('bem-loader!../../design/checkbox/checkbox.css'); 7 | 8 | module.exports = class Checkboxes extends React.Component { 9 | 10 | render() { 11 | return ( 12 |
13 |

Checkboxes

14 | 15 | 16 |   17 | 18 |   19 | 20 |   21 | 22 |
23 | 24 |   25 | 26 |   27 | 28 |   29 | 30 |
31 | ); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /examples/components/dropdowns/dropdowns.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const React = require('react'); 4 | 5 | const Dropdown = require('../../../src').Dropdown; 6 | require('bem-loader!../../design/popup/popup.css'); 7 | 8 | module.exports = class Dropdowns extends React.Component { 9 | 10 | render() { 11 | return ( 12 |
13 |

Dropdowns

14 | 15 | 21 |
22 | ); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /examples/components/icons/icons.jsx: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const React = require('react'); 4 | 5 | const Icon = require('../../../src').Icon; 6 | require('./icons.styl'); 7 | 8 | module.exports = class Icons extends React.Component { 9 | 10 | render() { 11 | return ( 12 |
13 |

Icons

14 | 15 | 18 |   19 | 20 | 21 | 22 | 23 | 24 |
25 | ); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /examples/components/icons/icons.styl: -------------------------------------------------------------------------------- 1 | .icon_theme_islands { 2 | background-size: contain; 3 | width: 50px; 4 | height: 50px; 5 | display: inline-block; 6 | } 7 | -------------------------------------------------------------------------------- /examples/components/images/images.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const React = require('react'); 4 | 5 | const Image = require('../../../src').Image; 6 | 7 | module.exports = class Images extends React.Component { 8 | 9 | render() { 10 | return ( 11 |
12 |

Images

13 | 14 | 18 |   19 | 24 |   25 | 26 | 27 | 28 | 29 | 30 |
31 | ); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /examples/components/inputs/inputs.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const React = require('react'); 4 | 5 | const Input = require('../../../src').Input; 6 | require('bem-loader!../../design/input/input.css'); 7 | 8 | module.exports = class Inputs extends React.Component { 9 | 10 | render() { 11 | return ( 12 |
13 |

Inputs

14 | 15 | 16 | 17 |   18 |
19 | 20 |   21 | 22 |
23 | 24 |   25 | 26 |
27 | 28 |   29 | 30 |
31 | 32 |
33 | ); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /examples/components/links/links.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const React = require('react'); 4 | 5 | const Link = require('../../../src').Link; 6 | require('bem-loader!../../design/link/link.css'); 7 | 8 | module.exports = class Buttons extends React.Component { 9 | 10 | render() { 11 | return ( 12 |
13 |

Links

14 | 15 | Link S 16 |   17 | Link S 18 |   19 | Link S 20 |
21 | Link M 22 |   23 | Link M 24 |   25 | Link M 26 |
27 | Link L 28 |   29 | Link L 30 |   31 | Link L 32 |
33 | Link XL 34 |   35 | Link XL 36 |   37 | Link XL 38 |
39 | ); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /examples/components/menus/menus.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const React = require('react'); 4 | 5 | const Menu = require('../../../src').Menu; 6 | const MenuItem = require('../../../src').MenuItem; 7 | require('bem-loader!../../design/menu/menu.css'); 8 | require('bem-loader!../../design/menu-item/menu-item.css'); 9 | 10 | module.exports = class Menus extends React.Component { 11 | 12 | render() { 13 | return ( 14 |
15 |

Menus

16 | 17 | 18 | 19 | text 1 20 | 21 | 22 | text 2 23 | 24 | 25 | 26 | text 3 27 | 28 | 29 | text 4 30 | 31 | 32 | 33 |
34 | ); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /examples/components/popups/popups.jsx: -------------------------------------------------------------------------------- 1 | const React = require('react'); 2 | const ReactDOM = require('react-dom'); 3 | 4 | const Popup = require('../../../src').Popup; 5 | require('bem-loader!../../design/popup/popup.css'); 6 | require('./popups.styl'); 7 | const Link = require('../../../src/').Link; 8 | 9 | const DIRECTIONS = [ 10 | 'bottom-left', 'bottom-center', 'bottom-right', 11 | 'top-left', 'top-center', 'top-right', 12 | 'right-top', 'right-center', 'right-bottom', 13 | 'left-top', 'left-center', 'left-bottom', 14 | ]; 15 | 16 | const POPUPS = DIRECTIONS.map(d => ({ directions: [d], id: d, })); 17 | POPUPS.push({ 18 | directions: null, 19 | id: 'popup-at-50x50', 20 | position: { 21 | top: 50, 22 | left: 50, 23 | }, 24 | }); 25 | 26 | module.exports = class Popups extends React.Component { 27 | 28 | constructor(props) { 29 | super(props); 30 | 31 | this.state = POPUPS.reduce((acc, cur) => { 32 | acc[cur.id] = false; 33 | return acc; 34 | }, {}); 35 | } 36 | 37 | componentDidMount() { 38 | POPUPS.forEach(p => { 39 | if (p.directions) { 40 | this.refs[p.id].setTarget(ReactDOM.findDOMNode(this.refs['target_' + p.id])); 41 | } else if(p.position) { 42 | this.refs[p.id].setPosition(p.position.top, p.position.left); 43 | } 44 | }); 45 | } 46 | 47 | renderPopupWithTarget(id, directions, isAutoclosable=false) { 48 | return (
49 | { this.setState({ [id]: !this.state[id] }); } } 54 | > 55 | { id } 56 | 57 | { this.setState({ [id]: false }); } 61 | : () => {} 62 | } 63 | className='test-popup' 64 | ref={ id } 65 | directions={ directions } 66 | theme='islands' 67 | visible={ this.state[id] } 68 | size='s' 69 | > 70 | { id } 71 | 72 |
); 73 | } 74 | 75 | render() { 76 | return ( 77 |
78 |

Popups

79 | 80 | 81 | 82 | 85 | 88 | 91 | 92 | 93 | 94 | 97 | 100 | 103 | 104 | 105 | 108 | 111 | 112 | 113 | 116 | 119 | 120 | 121 | 122 | 125 | 128 | < 131 | td className="directions__cell"> 132 | 133 |
83 | { this.renderPopupWithTarget('top-left', ['top-left']) } 84 | 86 | { this.renderPopupWithTarget('top-center', ['top-center'], true) } 87 | 89 | { this.renderPopupWithTarget('top-right', ['top-right']) } 90 |
95 | { this.renderPopupWithTarget('left-top', ['left-top']) } 96 | 98 | { this.renderPopupWithTarget('popup-at-50x50', null) } 99 | 101 | { this.renderPopupWithTarget('right-top', ['right-top']) } 102 |
106 | { this.renderPopupWithTarget('left-center', ['left-center']) } 107 | 109 | { this.renderPopupWithTarget('right-center', ['right-center']) } 110 |
114 | { this.renderPopupWithTarget('left-bottom', ['left-bottom']) } 115 | 117 | { this.renderPopupWithTarget('right-bottom', ['right-bottom']) } 118 |
123 | { this.renderPopupWithTarget('bottom-left', ['bottom-left']) } 124 | 126 | { this.renderPopupWithTarget('bottom-center', ['bottom-center']) } 127 | 129 | { this.renderPopupWithTarget('bottom-right', ['bottom-right']) } 130 |
134 |
135 | ); 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /examples/components/popups/popups.styl: -------------------------------------------------------------------------------- 1 | .directions { 2 | padding: 70px; 3 | } 4 | 5 | .directions__cell { 6 | padding: 8px; 7 | } 8 | 9 | .directions__cell_border_yes { 10 | border: 1px solid #ccc; 11 | } 12 | 13 | .directions__cell_align_left { 14 | text-align: left; 15 | } 16 | 17 | .directions__cell_align_center { 18 | text-align: center; 19 | } 20 | 21 | .directions__cell_align_right { 22 | text-align: right; 23 | } 24 | 25 | .popup_visible { 26 | display: block; 27 | } 28 | 29 | .test-popup { 30 | padding: 16px; 31 | } 32 | -------------------------------------------------------------------------------- /examples/components/progressbars/progressbars.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const React = require('react'); 4 | 5 | const Progressbar = require('../../../src').Progressbar; 6 | require('bem-loader!../../design/progressbar/progressbar.css'); 7 | 8 | module.exports = class Progressbars extends React.Component { 9 | 10 | render() { 11 | return ( 12 |
13 |

Progressbars

14 | 15 | 16 |
17 | 18 |
19 | 20 |
21 | ); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /examples/components/radio-groups/radio-groups.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const React = require('react'); 4 | 5 | const RadioGroup = require('../../../src').RadioGroup; 6 | require('bem-loader!../../design/radio-group/radio-group.css'); 7 | 8 | module.exports = class RadioGroups extends React.Component { 9 | 10 | render() { 11 | return ( 12 |
13 |

Radio groups

14 | 15 | 24 |   25 | 33 | 34 |   35 | 44 |
45 | ); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /examples/components/radios/radios.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const React = require('react'); 4 | 5 | const Radio = require('../../../src').Radio; 6 | require('bem-loader!../../design/radio/radio.css'); 7 | 8 | module.exports = class Radios extends React.Component { 9 | 10 | render() { 11 | return ( 12 |
13 |

Radios

14 | 15 | 16 | 17 |
18 | 19 | 20 |
21 | ); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /examples/components/react/react.bemhtml.js: -------------------------------------------------------------------------------- 1 | block('react')( 2 | attrs()(function() { 3 | return { 4 | id: 'root' 5 | }; 6 | }) 7 | ); 8 | -------------------------------------------------------------------------------- /examples/components/selects/selects.jsx: -------------------------------------------------------------------------------- 1 | const React = require('react'); 2 | const ReactDOM = require('react-dom'); 3 | 4 | const Select = require('../../../src').Select; 5 | const Icon = require('../../../src').Icon; 6 | 7 | require('bem-loader!../../design/select/select.css'); 8 | require('./selects.styl'); 9 | 10 | const OPTIONS_1 = [ 11 | { 12 | value: 1, 13 | text: 'Green', 14 | }, 15 | { 16 | value: 2, 17 | text: 'Gold', 18 | }, 19 | { 20 | value: 3, 21 | text: 'Rose', 22 | } 23 | ]; 24 | 25 | const OPTIONS_2 = [ 26 | { 27 | value: 1, 28 | text: 'Ivan', 29 | }, 30 | { 31 | value: 2, 32 | text: 'Anton', 33 | }, 34 | { 35 | value: 3, 36 | text: 'Nikita', 37 | } 38 | ]; 39 | 40 | 41 | module.exports = class Selects extends React.Component { 42 | 43 | constructor(props) { 44 | super(props); 45 | } 46 | 47 | render() { 48 | return ( 49 |
50 |

Selects

51 |

Radio mode

52 | 67 |
68 | ); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /examples/components/selects/selects.styl: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /examples/components/spins/spins.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const React = require('react'); 4 | 5 | const Spin = require('../../../src').Spin; 6 | require('bem-loader!../../design/spin/spin.css'); 7 | 8 | module.exports = class Spins extends React.Component { 9 | 10 | render() { 11 | return ( 12 |
13 |

Spins

14 | 15 | 16 | 17 | 18 | 19 |
20 | ); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /examples/components/textareas/textareas.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const React = require('react'); 4 | 5 | const Textarea = require('../../../src').Textarea; 6 | require('bem-loader!../../design/textarea/textarea.css'); 7 | 8 | module.exports = class Textareas extends React.Component { 9 | 10 | render() { 11 | return ( 12 |
13 |

Textareas

14 | 15 |