Home
Softono
b

bem

Professional software vendor delivering innovative solutions on the Softono platform. Specialized in both open-source and proprietary software development.

Total Products
3

Software by bem

yandex-ui
Open Source

yandex-ui

# @yandex/ui · [![npm (scoped)](https://img.shields.io/npm/v/@yandex/ui.svg)](https://www.npmjs.com/package/@yandex/ui) Yandex UI Kit build on React and [bem-react][bem-react]. ## Installation ```bash #⠀package with components npm i -P @yandex/ui #⠀peer dependencies npm i -P @bem-react/core @bem-react/di @bem-react/classname ``` ## Usage Detailed docs and example usage can be found at [Storybook][storybook]. ## Supported platforms We support stable versions of all major browsers including IE11. | Browser | Version | | ----------------- | --------------------- | | Chrome | Last 2 versions | | Opera | >= 12.1 | | Firefox | >= 23 | | Android | >= 4 | | iOS Safari | >= 5.1 | | Internet Explorer | >= 11 | [bem-react]: https://github.com/bem/bem-react [storybook]: https://yastatic.net/s3/frontend/lego/storybook/index.html?path=/docsx/lego-components-docs-readme--document

JavaScript Libraries & Components
357 Github Stars
themekit
Open Source

themekit

[![themekit](https://user-images.githubusercontent.com/7934638/83977761-b6831600-a90b-11ea-84a4-8c4dd3b60cc1.png)](https://github.com/bem/themekit) [![npm](https://img.shields.io/npm/v/@yandex/themekit.svg?style=flat-square&labelColor=111)][npm] [![examples](https://img.shields.io/badge/examples-folder-007ecc?style=flat-square&labelColor=111)][examples] [![node](https://img.shields.io/badge/node-8+-007ecc?style=flat-square&labelColor=111)][node] Themkit is a build system for design-tokens for any platform. This system is based on [style-dictionary](sd-github) API and [redefinition levels](#-platforms), which allows you to describe platform-specific values. Themkit provides you to extend existing themes in order to supplement or redefine existing tokens, it also allows you to use the basic theme set and add it to the service. ## Features - 🔍 Clear format (json or yaml) for developers and designers. - 📚 Define tokens once and get result for any format, for example js, css or json. - 🛠 Every part of the theme or some of the tokens is extendable and overridable. - 💻 Tokens may be defined for several web platforms, for example desktop and touch. ## Installation ```sh # via npm npm i -DE @yandex/themekit # or yarn yarn add --dev @yandex/themekit ``` ## Usage A themekit is available as a CLI tool. ### `build` ```sh Builds themes for configured formats. USAGE $ themekit build OPTIONS -c, --config=config [default: themekit.config.{js,json,yml}] The path to a themekit config file. -e, --entry=entry Builds selected entries. -o, --output=output Builds selected outputs. -w, --watch Auto rebuilds themes after change sources. ``` ## Get started More usage cases you can see in [examples][examples]. ### Tool configuration First, you need to create a config file `themekit.config.json` at project root: ```json { "entry": { "light": "./src/theme/light.theme.json" }, "output": { "css": { "transforms": ["name/cti/kebab"], "buildPath": "./src/theme/themes", "files": [ { "destination": "[entry]/[platform]/root.css", "format": "css/variables" } ] } } } ``` A output section based on style-dictionary [platforms](https://amzn.github.io/style-dictionary/#/config?id=configjson) config. #### themekit config interface ```ts { /** * Map with themes */ entry: Record<string, string> /** * Map with output formats * * @see https://amzn.github.io/style-dictionary/#/config?id=configjson */ output: Record<string, { /** * List of transforms should be applied for each token * * @see https://amzn.github.io/style-dictionary/#/transforms */ transforms: string[] /** * A preset that contains the transforms set * * @see https://amzn.github.io/style-dictionary/#/transform_groups */ transformGroup?: string /** * Output directory for building results */ buildPath: string /** * @see https://amzn.github.io/style-dictionary/#/actions */ actions: string[] /** * List of files to get at the output */ files: Array<{ /** * Output filepath, also supports helper placeholders: * [entry] — theme name * [platform] — platform name */ destination: string /** * Output format * * @see https://amzn.github.io/style-dictionary/#/formats */ format: string /** * Filter applied for each tokens */ filter: any }> }> } ``` ### Theme configuration The basic theme configuration consists of the sources section, which lists which tokens should include to this theme (you can specify the full path or glob). ```json { "sources": [ "./src/theme/tokens/typography.tokens.yml", "./src/theme/tokens/color-light.tokens.yml", "./src/components/**/*.tokens.yml" ] } ``` #### theme config interface ```ts { /** * Extendable theme */ extends?: string /** * Platforms that should be included in the theme (default common) */ platforms?: Array<'common' | 'deskpad' | 'desktop' | 'touch' | 'touch-pad' | 'touch-phone'> /** * Mappers list */ mappers?: string[] /** * Sources list */ sources: string[] } ``` ### Tokens Tokens can include additional properties such as comment or group for documentation or meta information for processing, also can be used as aliases, see more at style-dictionary [properties](https://amzn.github.io/style-dictionary/#/properties). A themekit support write tokens in `json` or `yaml` format: #### yaml ```yml component: type: base: fillColor: value: '#000' typoColor: value: '#fff' danger: fillColor: value: '#f00' typoColor: value: '#fff' ``` #### json ```json { "component": { "type": { "base": { "fillColor": { "value": "#000" }, "typoColor": { "value": "#fff" } }, "danger": { "fillColor": { "value": "#f00" }, "typoColor": { "value": "#fff" } } } } } ``` #### token interface ```ts { /** * Token value */ value: string /** * Token group */ group?: string /** * Token comment */ comment?: string } ``` ## Additional features ### 💻 Platforms A themekit supports platforms allows you to collect tokens for a specific platform such as `desktop` or `touch`, by default tokens included only from `common` platform. Each platform contains a several levels: | platforms | levels | | :---------- | :----------------------------------- | | common | common | | deskpad | common + deskpad | | desktop | common + deskpad + desktop | | touch | common + touch | | touch-pad | common + deskpad + touch + touch-pad | | touch-phone | common + touch + touch-phone | #### theme config Platform should be written in file name after `@` symbol (exclude `common` level). ```json { "platforms": ["desktop", "touch"], "sources": [ "./tokens/project.tokens.yml", "./tokens/[email protected]", "./tokens/[email protected]" ] } ``` ### 🌈 Color processing A themekit supports [modifying colors](https://github.com/ianstormtaylor/css-color-function) for token values. Available next modifiers: - `h` — change hue - `s` — change saturation - `l` — change lightness - `a` — change alpha channel #### tool config Need define `process-color` for output actions: ```json { "output": { "css": { "actions": ["process-color"] } } } ``` #### tokens Just use a necessary modifier for your color: ```yml component: type: base: fillColor: value: 'color(#000 a(80%))' ``` #### result At result you get plain value with color: ```css :root { --component-type-base-fill-color: rgba(0, 0, 0, 0.8); } ``` ## Formats ### 🗂 css/variables #### tool config ```json { "output": { "css": { "transforms": ["name/cti/kebab"], "buildPath": "./src/theme/themes", "files": [ { "destination": "[entry]/[platform]/root.css", "format": "css/variables", "options": { // default: ":root" "selector": ".MyTheme", // default: false "useAliasVariables": true } } ] } } } ``` ## License [MPL-2.0][license] [node]: https://nodejs.org/en/ [npm]: https://www.npmjs.com/package/@yandex/themekit [license]: https://github.com/bem/themekit/blob/master/LICENSE.md [examples]: https://github.com/bem/themekit/tree/master/examples [sd-github]: https://github.com/amzn/style-dictionary

Design Systems & Tokens Documentation
75 Github Stars
bem-components
Open Source

bem-components

# BEM Components Library `bem-components` is an open-source library that provides a set of ready-made visual components ([blocks](https://en.bem.info/methodology/key-concepts/#block)) for creating web interfaces. The library provides design themes. This version introduces the `islands` theme, which implements the new Yandex design. Features include supporting multiple themes at once, and creating new themes. [![GitHub Release](https://img.shields.io/github/release/bem/bem-components.svg?style=flat)](https://github.com/bem/bem-components/releases) ## Contents * [Levels](#levels) * [Blocks](#blocks) * [Supported browsers](#supported-browsers) * [Technologies](#technologies) * [Tools](#tools) * [Usage](#usage) * [Development](#development) * [Maintainers](#maintainers) * [Workflow](#workflow) **Additional information** * [Changelog](./CHANGELOG.md) * [Migration to future versions](./MIGRATION.md) ## Levels * `common.blocks` — support of any devices and browsers. * `desktop.blocks` — support of desktop browsers. * `touch.blocks` — implementation of specific features for touch platforms. * `touch-phone.blocks` — implementation of specific features for smartphones. * `touch-pad.blocks` — implementation of specific features for tablets. * `design/<common|desktop|touch|touch-phone|touch-pad>.blocks` — implementation of various designs (themes). ## Blocks * [attach](common.blocks/attach/attach.en.md) * [button](common.blocks/button/button.en.md) * [checkbox](common.blocks/checkbox/checkbox.en.md) * [checkbox-group](common.blocks/checkbox-group/checkbox-group.en.md) * [control](common.blocks/control/control.en.md) * [control-group](common.blocks/control-group/control-group.en.md) * [dropdown](common.blocks/dropdown/dropdown.en.md) * [icon](common.blocks/icon/icon.en.md) * [image](common.blocks/image/image.en.md) * [input](common.blocks/input/input.en.md) * [link](common.blocks/link/link.en.md) * [menu](common.blocks/menu/menu.en.md) * [menu-item](common.blocks/menu-item/menu-item.en.md) * [modal](common.blocks/modal/modal.en.md) * [popup](common.blocks/popup/popup.en.md) * [progressbar](common.blocks/progressbar/progressbar.en.md) * [radio](common.blocks/radio/radio.en.md) * [radio-group](common.blocks/radio-group/radio-group.en.md) * [select](common.blocks/select/select.en.md) * [spin](common.blocks/spin/spin.en.md) * [textarea](common.blocks/textarea/textarea.en.md) * [z-index-group](common.blocks/z-index-group/z-index-group.en.md) ## Supported browsers * **Desktop** * Firefox *(the last two stable versions)* * Chrome *(the last two stable versions)* * Safari *(the last two stable versions)* * Yandex *(the last two stable versions)* * **Touch** * Android 5+ * iOS 12+ ## Technologies * [ES modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) * [i-bem.js](https://en.bem.info/tutorials/bem-js-tutorial/) * [BEMHTML](https://en.bem.info/technology/bemhtml/current/reference/) * [DEPS](https://en.bem.info/technology/deps/about/) * [PostCSS](http://postcss.org/) ## Tools **Build** * [Vite](https://vite.dev/) — build tool and dev server * [PostCSS](http://postcss.org/) — CSS processing (via Vite) * [Autoprefixer](https://github.com/ai/autoprefixer/) — vendor prefixes **Code analysis** * [ESLint 10](https://eslint.org/) — JavaScript linting **Testing** * [Playwright](https://playwright.dev/) — browser regression testing ## Usage ### Installation ```bash npm install bem-components ``` **Requirements:** Node.js >= 20 **Peer dependencies:** * `bem-core` ^5.0.0 * `jquery` ^4.0.0 ### Building from source ```bash git clone https://github.com/bem/bem-components.git cd bem-components npm install npm run build ``` The build produces output for three platforms in the `dist/` directory: * `dist/desktop/` * `dist/touch-pad/` * `dist/touch-phone/` ### Library concepts #### The block and its states The library consists of blocks, which you can see represented visually in the [`bem-components` showcase](https://ru.bem.info/libs/bem-components/current/showcase/). Blocks have states that determine the behavioral model. A block’s state is expressed through modifiers and specialized fields. Changing a modifier creates an event that can be used for working with the block. There is no need to create a special BEM event if you can work with the modifier change event. Depending on what is used for changing a component’s state (a modifier or a field), different events are used: * To respond to changing the "state" of `value` fields, the `change` event is used. * To respond to setting or removing a modifier, various modifier change events are used. #### Controls in `bem-components` The controls in `bem-components` can be used as the basis for creating other library components. Such controls don't have models as in HTML, and they can be used for tasks that don't require the semantics of a specific HTML model. As an example, think of the "behavioral model" for the [HTMLInputElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement), which is a higher-level interface designed specifically for editing data. What is different about `bem-components` blocks is that they can be used as the basis of a block in another library that will solve the same problem. But along with that, they can serve other purposes in the interface that don't require `HTML input` semantics. #### Implementation details ##### `focused` modifier Controls in bem-components have two types of focus, which are set using the modifiers `focused` and `focused-hard`. The type of focus determines the appearance of the control. The modifier is chosen automatically based on how the focus is set: * `focused` — Set for a mouse click on the control. * `focused-hard` — Set when the control is selected using the keyboard or through JavaScript. It highlights the component more obviously when it gets the focus. For example, in the `Islands` theme, most of the controls get an extra border when `focused-hard` is set. ## Development * [Working copy](#working-copy) * [How to contribute](./CONTRIBUTING.md) * [Testing](#testing) ### Working copy Get sources: ```bash git clone git://github.com/bem/bem-components.git cd bem-components ``` Install dependencies: ```bash npm install ``` Build all platforms: ```bash npm run build ``` Start the development server: ```bash npm run dev ``` Code analysis: ```bash npm run lint ``` ### Testing #### Browser regression tests [Playwright](https://playwright.dev/) is used for browser testing. ```bash npm run test:browser # run tests headless npm run test:browser:ui # run tests with Playwright UI ``` #### Run all checks ```bash npm test # runs lint + test:browser ``` Tests are run automatically on GitHub Actions for each pull request. ## Maintainers * [veged](https://github.com/veged) * [dfilatov](https://github.com/dfilatov) * [tadatuta](https://github.com/tadatuta) ## Workflow Current tasks are tracked via [GitHub Issues](https://github.com/bem/bem-components/issues). ## License Code and documentation © 2012 YANDEX LLC. Code released under the [Mozilla Public License 2.0](LICENSE.txt).

CSS Frameworks & UI Kits
329 Github Stars