Git Product home page Git Product logo

bem-react-components's Introduction

BEM React Components

bem-react-components is an library that provides a set of visual components build with bem-react-core. React Components are called blocks according to BEM methodology. Check bem-info for deeper dive.

๐Ÿšง Hard Work is in Progress ๐Ÿšง

Blocks

Build

Right now bem-react-components is heavily relying on assemble, so it's necessary to use one. There are several implementations:

For fast start you could use create-bem-react-app.

Webpack

Example of webpack.conf.js

module: {
  rules: [
    {
      test: /\.(js)$/,
      include: ['./node_modules/bem-react-components', './src'],
      use: [
        {
          loader: 'webpack-bem-loader',
          options: {
            levels: [
              './node_modules/bem-react-components/blocks',
              './src/my-awesome-blocks'
            ],
            techs: ['js', 'css']
          }
        },
        {
          loader: 'babel-loader',
          options: { ... }
        }
      ]
    }
  ]
}

To use more options of bem-loader check docs.

Babel

NB: Babel couldn't build css files, only js and js-like.

Example of .babelrc

{
  "presets": [["es2015", { "loose":true }], "react"],
  "plugins": [
    ["bem-import", {
      "levels": [
        "./node_modules/bem-react-components/blocks",
        "./src/my-awesome-blocks"
      ]
    }]
  ]
}

To use more options of bem-import check docs.

Maintainers

License

Code and documentation ยฉ 2017 YANDEX LLC. Code released under the Mozilla Public License 2.0.

bem-react-components's People

Contributors

alexbaumgertner avatar awinogradov avatar dfilatov avatar guria avatar poalrom avatar tadatuta avatar veged avatar yeti-or avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bem-react-components's Issues

Modal mix

Hi guys,

For some reason, if I define the mix prop on Modal block it doesn't extend the actual block:

export default decl({
  block: 'MyModal',

  render () {
    return (
      <Modal mix={{block: this.block}}>
        Modal content
      </Modal>
    )
  }
})

Could you please have a look into this issue?

Cheers,
E

Implement Select

  • _mode
    • _check
    • _radio
    • _radio-check
  • _focused
  • _disabled
  • -Button
  • -Control
  • -Menu
  • aria
  • keyboard navigation
    • item select by arrows
    • fuzzy search?

Support popup for react v16

  • react version: 16.2.0
  • react-dom version: 16.2.0
  • bem-react-components version: master

Description:

When popup is rendered, the value of this._domNode is null. An error occurs here.

Uncaught TypeError: Cannot read property 'offsetWidth' of null (Popup_target.js:105)

This is most likely due to the fact that the render method in Portal-Popup returns null. Removing the method should solve the problem. Alternatively, you can use ReactDom.createPortal for react 16.

Build fail

Seems like npm run build broken. At first, it failed with

ERROR in ./~/bem-react-core/index.js
Module build failed: ReferenceError: Unknown plugin "transform-object-assign" specified in "/Users/dndushkin/open-source/bem-react-components/node_modules/bem-react-core/.babelrc" at 1, attempted to resolve relative to "/Users/dndushkin/open-source/bem-react-components/node_modules/bem-react-core"

After $ npm i babel-plugin-transform-object-assign.

$ npm run build
ERROR in ./~/bem-react-core/dist/index.js
Module build failed: ReferenceError: [BABEL] /Users/dndushkin/open-source/bem-react-components/node_modules/bem-react-core/dist/index.js: Unknown option: /Users/dndushkin/open-source/bem-react-components/node_modules/react/react.js.Children. Check out http://babeljs.io/docs/usage/options/ for more information about options.

A common cause of this error is the presence of a configuration options object without the corresponding preset name. Example:

Invalid:
  `{ presets: [{option: value}] }`
Valid:
  `{ presets: [['presetName', {option: value}]] }`

Is it bem-loader issue?

Implement Menu

  • _mode
    • _check
    • _radio
    • _radio-check
  • _focused
  • _disabled
  • Item
    • _type_link
    • _focused
    • _disabled
  • Group
  • aria

Docs

  • Readme.[ru,en].md
  • Contributind.[ru,en].md
  • License.txt cp

Write basic JS for all blocks from bem-components

  • link
  • button
  • input
  • textarea
  • checkbox
  • checkbox-group
  • radio
  • radio-group
  • menu
  • popup
  • dropdown
  • select
  • icon
  • image
  • modal
  • spin
  • progressbar
  • attach
  • z-index-group
  • interfaces
    • stylable
    • focusable
    • hoverable
    • ? pressable

Hint: Jest configuration

Hi guys,

Recently stumble upon the problem where I was trying to test my own blocks that imports the bem-react-components and in order to make it work make sure you got the following configuration:

.babelrc

{
  "presets": [
    "es2015",
    "react-app"
  ],
  "env": {
    "test": {
      "plugins": [
        [
          "bem-import",
          {
            "techs": [
              "js"
            ]
          }
        ]
      ]
    }
  }
}

.bemrc

{
  "root": true,
  "levels": {
    "src/components": {
      "scheme": "nested",
      "default": true
    },
    "node_modules/bem-react-components/blocks": {
      "scheme": "nested",
      "default": true
    }
  }
}

package.json

{
  ...
  "devDependencies": {
    ...
    "babel-plugin-bem-import": "1.4.2",
    "babel-preset-es2015": "6.24.1",
    ...
  },
  "jest": {
    "verbose": true,
    "transformIgnorePatterns": [
      "node_modules/(?!bem-react-components)"
    ]
  },
  "scripts": {
    "test": "jest"
  }
}

The main thing here is to compile bem-react-components that are located in node_modules. Hope that will help someone!

Cheers,
E

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.