-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/improve-handling-aria-props
- Loading branch information
Showing
1,134 changed files
with
17,054 additions
and
1,975 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import React from 'react'; | ||
import * as React from 'react'; | ||
|
||
import type {Decorator} from '@storybook/react'; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
# UIKit · [![npm package](https://img.shields.io/npm/v/@gravity-ui/uikit)](https://www.npmjs.com/package/@gravity-ui/uikit) [![CI](https://img.shields.io/github/actions/workflow/status/gravity-ui/uikit/.github/workflows/ci.yml?branch=main&label=CI&logo=github)](https://github.com/gravity-ui/uikit/actions/workflows/ci.yml?query=branch:main) [![storybook](https://img.shields.io/badge/Storybook-deployed-ff4685)](https://preview.gravity-ui.com/uikit/) | ||
|
||
Набор гибких, универсальных и высокоэффективных React-компонентов для создания сложных веб-приложений. | ||
|
||
<!--GITHUB_BLOCK--> | ||
|
||
![Cover image](https://raw.githubusercontent.com/gravity-ui/uikit/main/docs/assets/uikit_cover.png) | ||
|
||
## Ресурсы | ||
|
||
### ![Globe Logo Light](https://raw.githubusercontent.com/gravity-ui/uikit/main/docs/assets/globe_light.svg#gh-light-mode-only) ![Globe Logo Dark](https://raw.githubusercontent.com/gravity-ui/uikit/main/docs/assets/globe_dark.svg#gh-dark-mode-only) [Веб-сайт](https://gravity-ui.com) | ||
|
||
### ![Documentation Logo Light](https://raw.githubusercontent.com/gravity-ui/uikit/main/docs/assets/book-open_light.svg#gh-light-mode-only) ![Documentation Logo Dark](https://raw.githubusercontent.com/gravity-ui/uikit/main/docs/assets/book-open_dark.svg#gh-dark-mode-only) [Документация](https://gravity-ui.com/components/uikit/alert) | ||
|
||
### ![Figma Logo Light](https://raw.githubusercontent.com/gravity-ui/uikit/main/docs/assets/figma_light.svg#gh-light-mode-only) ![Figma Logo Dark](https://raw.githubusercontent.com/gravity-ui/uikit/main/docs/assets/figma_dark.svg#gh-dark-mode-only) [Figma](<https://www.figma.com/community/file/1271150067798118027/Gravity-UI-Design-System-(Beta)>) | ||
|
||
### ![Themer Logo Light](https://raw.githubusercontent.com/gravity-ui/uikit/main/docs/assets/bucket-paint_light.svg#gh-light-mode-only) ![Themer Logo Dark](https://raw.githubusercontent.com/gravity-ui/uikit/main/docs/assets/bucket-paint_dark.svg#gh-dark-mode-only) [Themer](https://gravity-ui.com/themer) | ||
|
||
### ![Storybook Logo Light](https://raw.githubusercontent.com/gravity-ui/uikit/main/docs/assets/storybook_light.svg#gh-light-mode-only) ![Storybook Logo Dark](https://raw.githubusercontent.com/gravity-ui/uikit/main/docs/assets/storybook_dark.svg#gh-dark-mode-only) [Storybook](https://preview.gravity-ui.com/uikit/) | ||
|
||
### ![Community Logo Light](https://raw.githubusercontent.com/gravity-ui/uikit/main/docs/assets/telegram_light.svg#gh-light-mode-only) ![Community Logo Dark](https://raw.githubusercontent.com/gravity-ui/uikit/main/docs/assets/telegram_dark.svg#gh-dark-mode-only) [Сообщество](https://t.me/gravity_ui) | ||
|
||
<!--/GITHUB_BLOCK--> | ||
|
||
## Установка | ||
|
||
```shell | ||
npm install --save-dev @gravity-ui/uikit | ||
``` | ||
|
||
## Использование | ||
|
||
```jsx | ||
import React from 'react'; | ||
import {Button} from '@gravity-ui/uikit'; | ||
|
||
const SubmitButton = <Button view="action" size="l" />; | ||
``` | ||
|
||
### Стили | ||
|
||
UIKit включает в себя базовое стилизованное оформление и тему. Чтобы подключить их, добавьте следующий фрагмент кода в начало точки входа приложения: | ||
|
||
```js | ||
// index.js | ||
|
||
import '@gravity-ui/uikit/styles/fonts.css'; | ||
import '@gravity-ui/uikit/styles/styles.css'; | ||
|
||
// ... | ||
``` | ||
|
||
UIKit поддерживает несколько тем: светлая, темная и их контрастные версии. Приложение должно быть отрисовано внутри компонента `ThemeProvider`: | ||
|
||
```js | ||
import {createRoot} from 'react-dom/client'; | ||
import {ThemeProvider} from '@gravity-ui/uikit'; | ||
|
||
const root = createRoot(document.getElementById('root')); | ||
root.render( | ||
<ThemeProvider theme="light"> | ||
<App /> | ||
</ThemeProvider>, | ||
); | ||
``` | ||
|
||
Для предотвращения мигания темы можно сгенерировать исходные CSS-классы для корневого элемента во время серверного рендеринга. | ||
|
||
```js | ||
import {getRootClassName} from '@gravity-ui/uikit/server'; | ||
|
||
const theme = 'dark'; | ||
const rootClassName = getRootClassName({theme}); | ||
|
||
const html = ` | ||
<html> | ||
<body> | ||
<div id="root" class="${rootClassName}"></div> | ||
</body> | ||
</html> | ||
`; | ||
``` | ||
|
||
Также предусмотрен файл с SCSS-[миксинами](styles/mixins.scss), которые можно использовать в приложении. | ||
|
||
### I18N | ||
|
||
Некоторые компоненты содержат текстовые токены (слова и фразы), доступные на двух языках: `en` (по умолчанию) и `ru`. | ||
Для настройки языка используйте функцию `configure`: | ||
|
||
```js | ||
// index.js | ||
|
||
import {configure} from '@gravity-ui/uikit'; | ||
|
||
configure({ | ||
lang: 'ru', | ||
}); | ||
``` | ||
|
||
## Разработка | ||
|
||
Для запуска Storybook в режиме разработки выполните следующую команду: | ||
|
||
```shell | ||
npm start | ||
``` |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<!--GITHUB_BLOCK--> | ||
|
||
# ActionTooltip | ||
|
||
<!--/GITHUB_BLOCK--> | ||
|
||
`ActionTooltip` — это простая текстовая подсказка, использующая в качестве якоря дочерний элемент. Для правильной работы элемент-якорь должен поддерживать события мыши и события получения или потери фокуса. | ||
|
||
## Использование | ||
|
||
```tsx | ||
import {ActionTooltip} from '@gravity-ui/uikit'; | ||
|
||
<ActionTooltip title="Content"> | ||
<div tabIndex={0}>Anchor</div> | ||
</ActionTooltip>; | ||
``` | ||
|
||
## Свойства | ||
|
||
| Имя | Описание | Тип | Значение по умолчанию | | ||
| :--------------- | ------------------------------------------------------------------------------------------ | :----------------------------------------------: | :-------------------: | | ||
| children | Элемент-якорь для `Tooltip`. Должен принимать `ref` для передачи DOM-элемента. | `React.ReactElement` | | | ||
| closeDelay | Время задержки в миллисекундах перед скрытием `Tooltip` после увода курсора с элемента. | `number` | `0` | | ||
| openDelay | Время задержки в миллисекундах перед показом `Tooltip` после наведения курсора на элемент. | `number` | `250` | | ||
| placement | Положение `Tooltip` относительно якоря. | [`PopupPlacement`](../Popup/README.md#placement) | | | ||
| qa | HTML-атрибут `data-qa`, используется для тестирования. | `string` | | | ||
| title | Текст заголовка для тултипа. | `string` | | | ||
| description | Текст описания в тултипе. | `string` | | | ||
| hotkey | Горячие клавиши, назначенные на действие в интерфейсе. | `string` | | | ||
| id | Используется для реализации логики доступности. | `string` | | | ||
| disablePortal | Отключает использование `Portal` для дочерних элементов. | `boolean` | | | ||
| contentClassName | HTML-атрибут `class` для узла с содержимым. | `string` | | | ||
| disabled | Блокирует открытие всплывающего окна. | `boolean` | `false` | |
Oops, something went wrong.