@itcase/ui 1.8.18 → 1.8.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Avatar_cjs_CiQ14ufF.js +240 -0
- package/dist/Avatar_es_No9vSqji.js +236 -0
- package/dist/{Button_cjs_DjCsrrlr.js → Button_cjs_CnStmeGt.js} +12 -4
- package/dist/{Button_es_CHDT0-8K.js → Button_es_BV1bepl1.js} +12 -4
- package/dist/{ChipsGroup_cjs_CTpMiyQb.js → ChipsGroup_cjs_CL00pWKy.js} +2 -2
- package/dist/{ChipsGroup_es_CP_xm25C.js → ChipsGroup_es_Ciln2otW.js} +2 -2
- package/dist/{DatePicker_cjs_DPtOL1eW.js → DatePicker_cjs_DGgkpGbI.js} +4 -4
- package/dist/{DatePicker_es_DCuzMD0T.js → DatePicker_es_BIOyGm22.js} +4 -4
- package/dist/{DropdownItem_cjs_DW0UXopm.js → DropdownItem_cjs_DT-zspEr.js} +15 -15
- package/dist/{DropdownItem_es_vuNthDPa.js → DropdownItem_es_BJLFqVuH.js} +15 -15
- package/dist/{Group_cjs_DFmNT5Mq.js → Group_cjs_Cwt0gWk4.js} +10 -3
- package/dist/{Group_es_CRGwi5XI.js → Group_es_CYW2Hquh.js} +10 -3
- package/dist/{Image_cjs_DuIBtUq5.js → Image_cjs_CCWqbNn4.js} +11 -3
- package/dist/{Image_es_CSzHhlA1.js → Image_es_DZUVp0FS.js} +11 -3
- package/dist/{Label_cjs_mw4pHZR1.js → Label_cjs_Cqcf6ffp.js} +2 -2
- package/dist/{Label_es_CiPEDFcR.js → Label_es_CeNdA70T.js} +2 -2
- package/dist/Link_cjs_BlXrJ15R.js +303 -0
- package/dist/Link_es_CyJn7NFb.js +298 -0
- package/dist/{Loader_cjs_DZbIy6Ko.js → Loader_cjs_3VRzFLI2.js} +14 -2
- package/dist/{Loader_es_SHdP0IkA.js → Loader_es_DEYowVdU.js} +14 -2
- package/dist/Text_cjs_DPhKj3wf.js +68 -0
- package/dist/{Text_es_D012qJ8s.js → Text_es_BRb3qqKM.js} +8 -3
- package/dist/{Tooltip_cjs_BKOjNMkt.js → Tooltip_cjs_Cq5kuaIK.js} +480 -17
- package/dist/{Tooltip_es_C7zstTA2.js → Tooltip_es_D0PSqI2c.js} +480 -17
- package/dist/cjs/components/Accordion.js +3 -3
- package/dist/cjs/components/Avatar.js +13 -236
- package/dist/cjs/components/AvatarStack.js +35 -0
- package/dist/cjs/components/Badge.js +3 -3
- package/dist/cjs/components/Breadcrumbs.js +3 -3
- package/dist/cjs/components/Button.js +5 -5
- package/dist/cjs/components/Cell.js +4 -4
- package/dist/cjs/components/Checkbox.js +1 -1
- package/dist/cjs/components/Chips.js +4 -4
- package/dist/cjs/components/Choice.js +6 -6
- package/dist/cjs/components/CookiesWarning.js +13 -6
- package/dist/cjs/components/DatePeriod.js +8 -8
- package/dist/cjs/components/DatePicker.js +7 -7
- package/dist/cjs/components/Drawer.js +26 -2
- package/dist/cjs/components/Dropdown.js +5 -2
- package/dist/cjs/components/Group.js +1 -1
- package/dist/cjs/components/Icon.js +3 -3
- package/dist/cjs/components/Image.js +2 -2
- package/dist/cjs/components/InputPassword.js +226 -46
- package/dist/cjs/components/Label.js +4 -4
- package/dist/cjs/components/Link.js +1 -1
- package/dist/cjs/components/List.js +1 -1
- package/dist/cjs/components/Loader.js +2 -2
- package/dist/cjs/components/Logo.js +1 -1
- package/dist/cjs/components/MenuItem.js +2 -2
- package/dist/cjs/components/Modal.js +6 -6
- package/dist/cjs/components/ModalSheetBottom.js +7 -0
- package/dist/cjs/components/Notification.js +1 -1
- package/dist/cjs/components/Pagination.js +11 -9
- package/dist/cjs/components/Panel.js +2 -2
- package/dist/cjs/components/Radio.js +1 -1
- package/dist/cjs/components/Response.js +227 -183
- package/dist/cjs/components/Search.js +126 -13
- package/dist/cjs/components/Segmented.js +1 -1
- package/dist/cjs/components/Select.js +4 -4
- package/dist/cjs/components/Swiper.js +3 -3
- package/dist/cjs/components/Switch.js +238 -3
- package/dist/cjs/components/Tab.js +3 -3
- package/dist/cjs/components/Text.js +1 -1
- package/dist/cjs/components/Tile.js +240 -5
- package/dist/cjs/components/Title.js +3 -3
- package/dist/cjs/components/Tooltip.js +3 -3
- package/dist/components/Accordion.js +3 -3
- package/dist/components/Avatar.js +10 -237
- package/dist/components/AvatarStack.js +33 -0
- package/dist/components/Badge.js +3 -3
- package/dist/components/Breadcrumbs.js +3 -3
- package/dist/components/Button.js +5 -5
- package/dist/components/Cell.js +4 -4
- package/dist/components/Checkbox.js +1 -1
- package/dist/components/Chips.js +4 -4
- package/dist/components/Choice.js +6 -6
- package/dist/components/CookiesWarning.js +13 -7
- package/dist/components/DatePeriod.js +8 -8
- package/dist/components/DatePicker.js +7 -7
- package/dist/components/Drawer.js +26 -2
- package/dist/components/Dropdown.js +5 -2
- package/dist/components/Group.js +1 -1
- package/dist/components/Icon.js +3 -3
- package/dist/components/Image.js +2 -2
- package/dist/components/InputPassword.js +226 -45
- package/dist/components/Label.js +4 -4
- package/dist/components/Link.js +1 -1
- package/dist/components/List.js +1 -1
- package/dist/components/Loader.js +2 -2
- package/dist/components/Logo.js +1 -1
- package/dist/components/MenuItem.js +2 -2
- package/dist/components/Modal.js +6 -6
- package/dist/components/ModalSheetBottom.js +7 -1
- package/dist/components/Notification.js +1 -1
- package/dist/components/Pagination.js +11 -9
- package/dist/components/Panel.js +2 -2
- package/dist/components/Radio.js +1 -1
- package/dist/components/Response.js +227 -183
- package/dist/components/Search.js +126 -13
- package/dist/components/Segmented.js +1 -1
- package/dist/components/Select.js +4 -4
- package/dist/components/Swiper.js +3 -3
- package/dist/components/Switch.js +238 -3
- package/dist/components/Tab.js +3 -3
- package/dist/components/Text.js +1 -1
- package/dist/components/Tile.js +240 -5
- package/dist/components/Title.js +3 -3
- package/dist/components/Tooltip.js +3 -3
- package/dist/css/components/AvatarStack/AvatarStack.css +67 -0
- package/dist/css/components/Group/Group.css +6 -10
- package/dist/css/components/Icon/Icon.css +132 -8
- package/dist/css/components/Modal/Modal.css +20 -0
- package/dist/css/components/Text/Text.css +0 -9
- package/dist/css/styles/border-color/border-color_hover.css +6 -8
- package/dist/css/styles/fill/fill_active.css +19 -9
- package/dist/css/styles/fill/fill_active_hover.css +19 -0
- package/dist/css/styles/fill/fill_hover.css +19 -0
- package/dist/css/styles/text-color/text-color_active.css +17 -0
- package/dist/css/styles/text-color/text-color_active_hover.css +40 -0
- package/dist/stories/index.stories.js +49 -0
- package/dist/stories/useDevicePropsGenerator.mdx +76 -102
- package/dist/stories/useMediaQueries.mdx +32 -7
- package/dist/stories/useStyles.mdx +50 -2
- package/dist/types/components/AvatarStack/AvatarStack.d.ts +3 -0
- package/dist/types/components/AvatarStack/AvatarStack.interface.d.ts +9 -0
- package/dist/types/components/AvatarStack/index.d.ts +2 -0
- package/dist/types/components/Button/appearance/buttonDanger.d.ts +8 -0
- package/dist/types/components/CookiesWarning/CookiesWarning.appearance.d.ts +5 -0
- package/dist/types/components/CookiesWarning/index.d.ts +2 -1
- package/dist/types/components/Drawer/appearance/drawerSurface.d.ts +25 -0
- package/dist/types/components/Dropdown/appearance/dropdownAccent.d.ts +0 -6
- package/dist/types/components/Dropdown/appearance/dropdownSurface.d.ts +5 -0
- package/dist/types/components/InputPassword/InputPassword.appearance.d.ts +2 -3
- package/dist/types/components/InputPassword/InputPassword.interface.d.ts +4 -11
- package/dist/types/components/InputPassword/appearance/inputPasswordAccent.d.ts +20 -0
- package/dist/types/components/InputPassword/appearance/inputPasswordDanger.d.ts +7 -0
- package/dist/types/components/InputPassword/appearance/inputPasswordDisabled.d.ts +20 -0
- package/dist/types/components/InputPassword/appearance/inputPasswordError.d.ts +11 -0
- package/dist/types/components/InputPassword/appearance/inputPasswordInfo.d.ts +21 -0
- package/dist/types/components/InputPassword/appearance/inputPasswordPrimary.d.ts +8 -0
- package/dist/types/components/InputPassword/appearance/inputPasswordRequire.d.ts +20 -0
- package/dist/types/components/InputPassword/appearance/inputPasswordSecondary.d.ts +8 -0
- package/dist/types/components/InputPassword/appearance/inputPasswordSize.d.ts +59 -0
- package/dist/types/components/InputPassword/appearance/inputPasswordStyle.d.ts +16 -0
- package/dist/types/components/InputPassword/appearance/inputPasswordSuccess.d.ts +11 -0
- package/dist/types/components/InputPassword/appearance/inputPasswordSurface.d.ts +25 -0
- package/dist/types/components/InputPassword/appearance/inputPasswordWarning.d.ts +11 -0
- package/dist/types/components/InputPassword/index.d.ts +1 -1
- package/dist/types/components/Link/appearance/linkAccent.d.ts +20 -0
- package/dist/types/components/Link/appearance/linkDanger.d.ts +7 -0
- package/dist/types/components/Link/appearance/linkDisabled.d.ts +20 -0
- package/dist/types/components/Link/appearance/linkError.d.ts +11 -0
- package/dist/types/components/Link/appearance/linkInfo.d.ts +21 -0
- package/dist/types/components/Link/appearance/linkPrimary.d.ts +8 -0
- package/dist/types/components/Link/appearance/linkRequire.d.ts +20 -0
- package/dist/types/components/Link/appearance/linkSecondary.d.ts +8 -0
- package/dist/types/components/Link/appearance/linkSize.d.ts +59 -0
- package/dist/types/components/Link/appearance/linkStyle.d.ts +16 -0
- package/dist/types/components/Link/appearance/linkSuccess.d.ts +11 -0
- package/dist/types/components/Link/appearance/linkSurface.d.ts +25 -0
- package/dist/types/components/Link/appearance/linkWarning.d.ts +11 -0
- package/dist/types/components/Loader/Loader.appearance.d.ts +3 -2
- package/dist/types/components/Loader/Loader.interface.d.ts +16 -17
- package/dist/types/components/Loader/appearance/loaderSize.d.ts +12 -0
- package/dist/types/components/ModalSheetBottom/ModalSheetBottom.appearance.d.ts +5 -0
- package/dist/types/components/ModalSheetBottom/index.d.ts +1 -0
- package/dist/types/components/Pagination/appearance/paginationSize.d.ts +8 -0
- package/dist/types/components/Pagination/appearance/paginationSurface.d.ts +2 -0
- package/dist/types/components/Response/Response.appearance.d.ts +2 -2
- package/dist/types/components/Response/appearance/responseAccent.d.ts +20 -0
- package/dist/types/components/Response/appearance/responseDanger.d.ts +7 -0
- package/dist/types/components/Response/appearance/responseDisabled.d.ts +20 -0
- package/dist/types/components/Response/appearance/responseError.d.ts +11 -0
- package/dist/types/components/Response/appearance/responseInfo.d.ts +21 -0
- package/dist/types/components/Response/appearance/responsePrimary.d.ts +8 -0
- package/dist/types/components/Response/appearance/responseRequire.d.ts +20 -0
- package/dist/types/components/Response/appearance/responseSecondary.d.ts +8 -0
- package/dist/types/components/Response/appearance/responseSize.d.ts +59 -0
- package/dist/types/components/Response/appearance/responseStyle.d.ts +16 -0
- package/dist/types/components/Response/appearance/responseSuccess.d.ts +11 -0
- package/dist/types/components/Response/appearance/responseSurface.d.ts +25 -0
- package/dist/types/components/Response/appearance/responseWarning.d.ts +11 -0
- package/dist/types/components/Search/appearance/searchDefault.d.ts +24 -0
- package/dist/types/components/Search/appearance/searchDisabled.d.ts +20 -0
- package/dist/types/components/Search/appearance/searchError.d.ts +20 -0
- package/dist/types/components/Search/appearance/searchRequire.d.ts +20 -0
- package/dist/types/components/Search/appearance/searchSize.d.ts +18 -8
- package/dist/types/components/Search/appearance/searchSuccess.d.ts +20 -0
- package/dist/types/components/Switch/Switch.appearance.d.ts +1 -1
- package/dist/types/components/Switch/appearance/switchAccent.d.ts +20 -0
- package/dist/types/components/Switch/appearance/switchDanger.d.ts +7 -0
- package/dist/types/components/Switch/appearance/switchDisabled.d.ts +20 -0
- package/dist/types/components/Switch/appearance/switchError.d.ts +11 -0
- package/dist/types/components/Switch/appearance/switchInfo.d.ts +21 -0
- package/dist/types/components/Switch/appearance/switchPrimary.d.ts +8 -0
- package/dist/types/components/Switch/appearance/switchRequire.d.ts +20 -0
- package/dist/types/components/Switch/appearance/switchSecondary.d.ts +8 -0
- package/dist/types/components/Switch/appearance/switchSize.d.ts +59 -0
- package/dist/types/components/Switch/appearance/switchStyle.d.ts +16 -0
- package/dist/types/components/Switch/appearance/switchSuccess.d.ts +11 -0
- package/dist/types/components/Switch/appearance/switchSurface.d.ts +25 -0
- package/dist/types/components/Switch/appearance/switchWarning.d.ts +11 -0
- package/dist/types/components/Tile/appearance/tileAccent.d.ts +20 -0
- package/dist/types/components/Tile/appearance/tileDanger.d.ts +7 -0
- package/dist/types/components/Tile/appearance/tileDisabled.d.ts +20 -0
- package/dist/types/components/Tile/appearance/tileError.d.ts +11 -0
- package/dist/types/components/Tile/appearance/tileInfo.d.ts +21 -0
- package/dist/types/components/Tile/appearance/tilePrimary.d.ts +8 -0
- package/dist/types/components/Tile/appearance/tileRequire.d.ts +20 -0
- package/dist/types/components/Tile/appearance/tileSecondary.d.ts +8 -0
- package/dist/types/components/Tile/appearance/tileSize.d.ts +59 -0
- package/dist/types/components/Tile/appearance/tileStyle.d.ts +16 -0
- package/dist/types/components/Tile/appearance/tileSuccess.d.ts +11 -0
- package/dist/types/components/Tile/appearance/tileSurface.d.ts +25 -0
- package/dist/types/components/Tile/appearance/tileWarning.d.ts +11 -0
- package/dist/types/components/Title/Title.appearance.d.ts +2 -2
- package/dist/types/components/Title/Title.interface.d.ts +3 -3
- package/dist/types/components/Title/appearance/titleAccent.d.ts +20 -0
- package/dist/types/components/Title/appearance/titleDanger.d.ts +7 -0
- package/dist/types/components/Title/appearance/titleDisabled.d.ts +20 -0
- package/dist/types/components/Title/appearance/titleError.d.ts +11 -0
- package/dist/types/components/Title/appearance/titleInfo.d.ts +21 -0
- package/dist/types/components/Title/appearance/titlePrimary.d.ts +8 -0
- package/dist/types/components/Title/appearance/titleRequire.d.ts +20 -0
- package/dist/types/components/Title/appearance/titleSecondary.d.ts +8 -0
- package/dist/types/components/Title/appearance/titleSize.d.ts +59 -0
- package/dist/types/components/Title/appearance/titleStyle.d.ts +16 -0
- package/dist/types/components/Title/appearance/titleSuccess.d.ts +11 -0
- package/dist/types/components/Title/appearance/titleSurface.d.ts +25 -0
- package/dist/types/components/Title/appearance/titleWarning.d.ts +11 -0
- package/dist/types/components/Tooltip/Tooltip.appearance.d.ts +1 -1
- package/dist/types/components/Tooltip/appearance/tooltipAccent.d.ts +20 -0
- package/dist/types/components/Tooltip/appearance/tooltipDanger.d.ts +7 -0
- package/dist/types/components/Tooltip/appearance/tooltipDisabled.d.ts +20 -0
- package/dist/types/components/Tooltip/appearance/tooltipError.d.ts +11 -0
- package/dist/types/components/Tooltip/appearance/tooltipInfo.d.ts +21 -0
- package/dist/types/components/Tooltip/appearance/tooltipPrimary.d.ts +8 -0
- package/dist/types/components/Tooltip/appearance/tooltipRequire.d.ts +20 -0
- package/dist/types/components/Tooltip/appearance/tooltipSecondary.d.ts +8 -0
- package/dist/types/components/Tooltip/appearance/tooltipSize.d.ts +59 -0
- package/dist/types/components/Tooltip/appearance/tooltipStyle.d.ts +16 -0
- package/dist/types/components/Tooltip/appearance/tooltipSuccess.d.ts +11 -0
- package/dist/types/components/Tooltip/appearance/tooltipSurface.d.ts +25 -0
- package/dist/types/components/Tooltip/appearance/tooltipWarning.d.ts +11 -0
- package/package.json +11 -11
- package/dist/Link_cjs_yht44xJv.js +0 -68
- package/dist/Link_es_DkW06IM-.js +0 -63
- package/dist/Text_cjs_iL1l_7V1.js +0 -63
- package/dist/stories/Pagination.mdx +0 -11
- package/dist/stories/Tile.mdx +0 -11
|
@@ -3,7 +3,62 @@ import { Meta } from '@storybook/blocks'
|
|
|
3
3
|
<Meta title="Hooks / useDevicePropsGenerator" />
|
|
4
4
|
|
|
5
5
|
# `useDevicePropsGenerator`
|
|
6
|
-
Хук позволяет автоматически получать значения
|
|
6
|
+
Хук позволяет автоматически получать значения `props` или `appearance`, которые соответствуют `viewport` пользователя, а также преобразовывать их в `CSS‑классы`.
|
|
7
|
+
|
|
8
|
+
Важно учитывать приоритет при котором будут применяться стили:
|
|
9
|
+
|
|
10
|
+
1. Сначала используется значение из props, соответствующее текущему устройству
|
|
11
|
+
- Передали
|
|
12
|
+
|
|
13
|
+
```jsx
|
|
14
|
+
<Component textAlignMobile="center" />
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
- Получили
|
|
18
|
+
```jsx
|
|
19
|
+
<Component style={{ textAlign: 'center' }} />
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
2. Если такого нет — используется значение из props без учёта устройства
|
|
23
|
+
- Передали
|
|
24
|
+
|
|
25
|
+
```jsx
|
|
26
|
+
<Component textAlign="right" />
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
- Получили
|
|
30
|
+
|
|
31
|
+
```jsx
|
|
32
|
+
<Component style={{ textAlign: 'right' }} />
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
3. Если и его нет — берётся значение из appearance-конфига для текущего устройства
|
|
36
|
+
|
|
37
|
+
- Передали
|
|
38
|
+
|
|
39
|
+
```js
|
|
40
|
+
{
|
|
41
|
+
textAlignMobile: 'left'
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
- Получили
|
|
46
|
+
|
|
47
|
+
```jsx
|
|
48
|
+
<Component style={{ textAlign: 'left' }} />
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
4. И в последнюю очередь — значение из appearance-конфига без учёта устройства
|
|
52
|
+
|
|
53
|
+
- Передали
|
|
54
|
+
```jsx
|
|
55
|
+
textAlign: 'justify'
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
- Получили
|
|
59
|
+
```jsx
|
|
60
|
+
<Component style={{ textAlign: 'justify' }} />
|
|
61
|
+
```
|
|
7
62
|
|
|
8
63
|
## Использование
|
|
9
64
|
|
|
@@ -19,35 +74,25 @@ const componentConfig: ComponentConfig = {
|
|
|
19
74
|
```
|
|
20
75
|
|
|
21
76
|
2. Для того чтобы передавать несколько appearance в одной строке, например:
|
|
22
|
-
|
|
23
77
|
```jsx
|
|
24
78
|
<Component appearance='errorPrimary sizeM' />
|
|
25
79
|
```
|
|
26
80
|
|
|
27
81
|
где `errorPrimary` это
|
|
28
|
-
|
|
29
82
|
```js
|
|
30
83
|
{
|
|
31
84
|
fill: 'errorTertiary',
|
|
32
|
-
borderColor: 'errorBorderQuaternary',
|
|
33
|
-
borderHover: 'errorBorderQuaternary',
|
|
34
|
-
textColor: 'surfaceTextPrimary',
|
|
35
|
-
iconBeforeFill: 'errorItemQuaternary',
|
|
36
|
-
iconClearFill: 'errorItemPrimary',
|
|
37
|
-
placeholderTextColor: 'surfaceTextQuaternary',
|
|
38
85
|
}
|
|
39
86
|
```
|
|
40
87
|
|
|
41
88
|
а `sizeM` это
|
|
42
|
-
|
|
43
|
-
```js
|
|
89
|
+
```ts
|
|
44
90
|
{
|
|
45
91
|
size: 'm',
|
|
46
|
-
textSize: 'm',
|
|
47
92
|
}
|
|
48
93
|
```
|
|
49
94
|
|
|
50
|
-
|
|
95
|
+
Нужен appearanceConfig
|
|
51
96
|
```js
|
|
52
97
|
const appearanceConfig = appearance?.split(' ').reduce(
|
|
53
98
|
(resultConfig, appearanceKey) => ({
|
|
@@ -57,19 +102,12 @@ const componentConfig: ComponentConfig = {
|
|
|
57
102
|
{},
|
|
58
103
|
)
|
|
59
104
|
```
|
|
60
|
-
|
|
105
|
+
Которому передается созданный ранее componentConfig и его результатом будет единый объект со свойствами из разных appearance
|
|
61
106
|
|
|
62
107
|
```js
|
|
63
108
|
{
|
|
64
109
|
fill: 'errorTertiary',
|
|
65
|
-
borderColor: 'errorBorderQuaternary',
|
|
66
|
-
borderHover: 'errorBorderQuaternary',
|
|
67
|
-
textColor: 'surfaceTextPrimary',
|
|
68
|
-
iconBeforeFill: 'errorItemQuaternary',
|
|
69
|
-
iconClearFill: 'errorItemPrimary',
|
|
70
|
-
placeholderTextColor: 'surfaceTextQuaternary',
|
|
71
110
|
size: "m",
|
|
72
|
-
textSize: "m"
|
|
73
111
|
}
|
|
74
112
|
```
|
|
75
113
|
|
|
@@ -106,7 +144,7 @@ const componentConfig: ComponentConfig = {
|
|
|
106
144
|
</table>
|
|
107
145
|
|
|
108
146
|
|
|
109
|
-
Из propsGenerator получаем переменные со строками, которые соответствуют appearance переданными в хук. Если указать просто fill
|
|
147
|
+
Из propsGenerator получаем переменные со строками, которые соответствуют appearance переданными в хук. Если указать просто `fill`, то получим `errorTertiary`,
|
|
110
148
|
если укажем `fillClass` то получим `error-tertiary`, поэтому везде в приведенном ниже примере указан суффикс `Class`.
|
|
111
149
|
|
|
112
150
|
```js
|
|
@@ -114,100 +152,36 @@ const componentConfig: ComponentConfig = {
|
|
|
114
152
|
|
|
115
153
|
const {
|
|
116
154
|
fillClass,
|
|
117
|
-
borderColorClass,
|
|
118
|
-
borderHoverClass,
|
|
119
|
-
borderWidthClass,
|
|
120
|
-
textColorClass,
|
|
121
|
-
textSizeClass,
|
|
122
|
-
textWeightClass,
|
|
123
|
-
caretClass,
|
|
124
|
-
placeholderTextColorClass,
|
|
125
|
-
shapeClass,
|
|
126
155
|
sizeClass,
|
|
127
|
-
widthClass,
|
|
128
156
|
} = propsGenerator
|
|
129
157
|
```
|
|
130
158
|
|
|
131
159
|
4. Применяем стили к компоненту. Важно учитывать, если в названии класса указывается сначала название компонента, это означает что он ссылается на стили,
|
|
132
|
-
которые определены внутри директории этого компонента
|
|
160
|
+
которые определены внутри директории этого компонента `src/components/Component/css`
|
|
133
161
|
|
|
134
|
-
```
|
|
135
|
-
|
|
162
|
+
```jsx
|
|
163
|
+
'textarea__input'
|
|
136
164
|
```
|
|
137
165
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
```js
|
|
166
|
+
Если в названии класса нет название компонента, это означает что ссылаемся на глобальный класс, который определен `src/styles`
|
|
167
|
+
```jsx
|
|
141
168
|
`fill_${fillClass}`
|
|
142
169
|
```
|
|
143
170
|
|
|
144
|
-
|
|
171
|
+
```jsx
|
|
145
172
|
<textarea
|
|
146
|
-
id={id}
|
|
147
173
|
className={clsx(
|
|
148
174
|
'textarea__input',
|
|
149
|
-
(textSizeClass || textColorClass || textWeightClass) && 'text',
|
|
150
|
-
caretClass && `caret-color_${caretClass}`,
|
|
151
175
|
fillClass && `fill_${fillClass}`,
|
|
152
|
-
|
|
153
|
-
borderWidthClass && `border-width_${borderWidthClass}`,
|
|
154
|
-
borderHoverClass && `border-color_hover_${borderHoverClass}`,
|
|
155
|
-
placeholderTextColorClass && `placeholder-text-color_${placeholderTextColorClass}`,
|
|
156
|
-
textSizeClass && `text_size_${textSizeClass}`,
|
|
157
|
-
textColorClass && `text-color_${textColorClass}`,
|
|
158
|
-
textWeightClass && `text-weight_${textWeightClass}`,
|
|
159
|
-
widthClass && `width_${widthClass}`,
|
|
176
|
+
sizeClass && `size_${sizeClass}`,
|
|
160
177
|
)}
|
|
161
178
|
/>
|
|
162
179
|
```
|
|
163
|
-
к примеру `fill`, будет отображаться в браузере как `fill_`
|
|
164
180
|
|
|
165
|
-
|
|
181
|
+
К примеру fill, будет отображаться в браузере как `fill_error-tertiary`.
|
|
166
182
|
|
|
167
|
-
Возьмем appearance из приведенного ранее примера
|
|
168
|
-
```js
|
|
169
|
-
{
|
|
170
|
-
fill: 'errorTertiary',
|
|
171
|
-
borderColor: 'errorBorderQuaternary',
|
|
172
|
-
borderHover: 'errorBorderQuaternary',
|
|
173
|
-
textColor: 'surfaceTextPrimary',
|
|
174
|
-
iconBeforeFill: 'errorItemQuaternary',
|
|
175
|
-
iconClearFill: 'errorItemPrimary',
|
|
176
|
-
placeholderTextColor: 'surfaceTextQuaternary',
|
|
177
|
-
size: "m",
|
|
178
|
-
textSize: "m"
|
|
179
|
-
}
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
и возьмем из него свойство `fill_error-tertiary`
|
|
183
|
-
|
|
184
|
-
5. Cоздаются классы, которые соответствуют структуре определенной в css-файлах, например глобальный класс `fill`
|
|
185
|
-
|
|
186
|
-
```css
|
|
187
|
-
.fill {
|
|
188
|
-
&_none {
|
|
189
|
-
background-color: transparent;
|
|
190
|
-
}
|
|
191
|
-
@each $type in accent, primary, secondary, tertiary, quaternary, surface,
|
|
192
|
-
error, success, warning, info, danger, gradient, disabled, hover, inverse {
|
|
193
|
-
@each $color in primary, secondary, tertiary, quaternary, accent, disabled,
|
|
194
|
-
hover, inverse {
|
|
195
|
-
&_$(type) {
|
|
196
|
-
&-item {
|
|
197
|
-
&-$(color) {
|
|
198
|
-
background: var(--color-$(type)-item-$(color));
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
&-$(color) {
|
|
202
|
-
background: var(--color-$(type)-$(color));
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
```
|
|
209
183
|
|
|
210
|
-
6. Чтобы применить стили в зависимости от viewPort
|
|
184
|
+
6. Чтобы применить стили в зависимости от `viewPort`, для этого нужно указать в `appearance` суффикс `Mobile` или `Desktop` или `Tablet`
|
|
211
185
|
|
|
212
186
|
```js
|
|
213
187
|
{
|
|
@@ -215,16 +189,16 @@ const componentConfig: ComponentConfig = {
|
|
|
215
189
|
textSizeMobile: 'm',
|
|
216
190
|
}
|
|
217
191
|
```
|
|
218
|
-
|
|
192
|
+
|
|
193
|
+
Или напрямую при использовании компонента
|
|
219
194
|
|
|
220
195
|
```js
|
|
221
196
|
<Component sizeMobile="m"/>
|
|
222
197
|
```
|
|
223
198
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
3. Desktop
|
|
199
|
+
Всего доступны 3 типа размеров
|
|
200
|
+
1. Mobile (от `240px` до `768px`)
|
|
201
|
+
2. Tablet (от `768px` до `960px`)
|
|
202
|
+
3. Desktop (от `960px` до `1920px`)
|
|
229
203
|
|
|
230
|
-
|
|
204
|
+
Подробнее об этом можно узнать в `src/context/UIContext.tsx`, ознакомиться с размерами для (`Mobile`, `Tablet`, `Desktop`) можно в `src/hooks/useMediaQueries/mediaQueries.json`
|
|
@@ -23,20 +23,45 @@ import { Meta } from '@storybook/blocks'
|
|
|
23
23
|
<td>userDevice</td>
|
|
24
24
|
<td>UserDeviceState</td>
|
|
25
25
|
<td>`{}`</td>
|
|
26
|
-
<td
|
|
26
|
+
<td>`Boolean` флаги устройства пользователя</td>
|
|
27
27
|
</tr>
|
|
28
28
|
</tbody>
|
|
29
29
|
</table>
|
|
30
30
|
|
|
31
31
|
### Возвращает объект
|
|
32
32
|
|
|
33
|
-
`deviceTypes` - который является объектом в котором находятся все флаги
|
|
33
|
+
`deviceTypes` - который является объектом в котором находятся все `boolean` флаги
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
<table>
|
|
36
|
+
<thead>
|
|
37
|
+
<tr>
|
|
38
|
+
<th>Флаг</th>
|
|
39
|
+
<th>Диапазон(px)</th>
|
|
40
|
+
</tr>
|
|
41
|
+
</thead>
|
|
42
|
+
<tbody>
|
|
43
|
+
<tr>
|
|
44
|
+
<td>`isMobile`</td>
|
|
45
|
+
<td>`≥ 240px и ≤ 768px`</td>
|
|
46
|
+
</tr>
|
|
47
|
+
<tr>
|
|
48
|
+
<td>`isMobileHuge`</td>
|
|
49
|
+
<td>`≥ 640px и ≤ 768px`</td>
|
|
50
|
+
</tr>
|
|
51
|
+
<tr>
|
|
52
|
+
<td>`isTablet`</td>
|
|
53
|
+
<td>`≥ 768px и ≤ 960px`</td>
|
|
54
|
+
</tr>
|
|
55
|
+
<tr>
|
|
56
|
+
<td>`isDesktop`</td>
|
|
57
|
+
<td>`≥ 960px и ≤ 1920px`</td>
|
|
58
|
+
</tr>
|
|
59
|
+
<tr>
|
|
60
|
+
<td>`isDesktopMega`</td>
|
|
61
|
+
<td>`≥ 2560px`</td>
|
|
62
|
+
</tr>
|
|
63
|
+
</tbody>
|
|
64
|
+
</table>
|
|
40
65
|
|
|
41
66
|
### Использование
|
|
42
67
|
|
|
@@ -4,15 +4,63 @@ import { Meta } from '@storybook/blocks'
|
|
|
4
4
|
|
|
5
5
|
# `useStyles`
|
|
6
6
|
|
|
7
|
-
Хук конвертирует
|
|
7
|
+
Хук конвертирует props компонента в inline стили.
|
|
8
8
|
|
|
9
9
|
Важно учитывать приоритет при котором будут применяться стили:
|
|
10
10
|
|
|
11
|
-
1. Сначала используется значение из props, соответствующее текущему устройству
|
|
11
|
+
1. Сначала используется значение из props, соответствующее текущему устройству
|
|
12
|
+
- Передали
|
|
13
|
+
|
|
14
|
+
```jsx
|
|
15
|
+
<Component textAlignMobile="center" />
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
- Получили
|
|
19
|
+
```jsx
|
|
20
|
+
<Component style={{ textAlign: 'center' }} />
|
|
21
|
+
```
|
|
22
|
+
|
|
12
23
|
2. Если такого нет — используется значение из props без учёта устройства
|
|
24
|
+
- Передали
|
|
25
|
+
|
|
26
|
+
```jsx
|
|
27
|
+
<Component textAlign="right" />
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
- Получили
|
|
31
|
+
|
|
32
|
+
```jsx
|
|
33
|
+
<Component style={{ textAlign: 'right' }} />
|
|
34
|
+
```
|
|
35
|
+
|
|
13
36
|
3. Если и его нет — берётся значение из appearance-конфига для текущего устройства
|
|
37
|
+
|
|
38
|
+
- Передали
|
|
39
|
+
|
|
40
|
+
```js
|
|
41
|
+
{
|
|
42
|
+
textAlignMobile: 'left'
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
- Получили
|
|
47
|
+
|
|
48
|
+
```jsx
|
|
49
|
+
<Component style={{ textAlign: 'left' }} />
|
|
50
|
+
```
|
|
51
|
+
|
|
14
52
|
4. И в последнюю очередь — значение из appearance-конфига без учёта устройства
|
|
15
53
|
|
|
54
|
+
- Передали
|
|
55
|
+
```jsx
|
|
56
|
+
textAlign: 'justify'
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
- Получили
|
|
60
|
+
```jsx
|
|
61
|
+
<Component style={{ textAlign: 'justify' }} />
|
|
62
|
+
```
|
|
63
|
+
|
|
16
64
|
## API
|
|
17
65
|
|
|
18
66
|
### Параметры
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SizePXProps, TextSizeProps } from '@itcase/ui/types';
|
|
2
|
+
interface AvatarStackProps {
|
|
3
|
+
avatarSize: SizePXProps;
|
|
4
|
+
showCountUsers?: number;
|
|
5
|
+
textSize?: TextSizeProps;
|
|
6
|
+
userFirstName?: string;
|
|
7
|
+
userLastName?: string;
|
|
8
|
+
}
|
|
9
|
+
export type { AvatarStackProps };
|
|
@@ -7,5 +7,13 @@ declare const buttonAppearanceDanger: {
|
|
|
7
7
|
loaderFill: string;
|
|
8
8
|
loaderItemFill: string;
|
|
9
9
|
};
|
|
10
|
+
dangerPrimary: {
|
|
11
|
+
fill: string;
|
|
12
|
+
fillHover: string;
|
|
13
|
+
labelTextColor: string;
|
|
14
|
+
labelTextColorHover: string;
|
|
15
|
+
loaderFill: string;
|
|
16
|
+
loaderItemFill: string;
|
|
17
|
+
};
|
|
10
18
|
};
|
|
11
19
|
export { buttonAppearanceDanger };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
declare const drawerAppearanceSurface: {
|
|
2
|
+
surfacePrimary: {
|
|
3
|
+
fill: string;
|
|
4
|
+
fillHover: string;
|
|
5
|
+
labelTextColor: string;
|
|
6
|
+
};
|
|
7
|
+
surfaceQuaternary: {
|
|
8
|
+
fill: string;
|
|
9
|
+
fillHover: string;
|
|
10
|
+
labelTextColor: string;
|
|
11
|
+
};
|
|
12
|
+
surfaceSecondary: {
|
|
13
|
+
fill: string;
|
|
14
|
+
fillHover: string;
|
|
15
|
+
labelTextColor: string;
|
|
16
|
+
loaderFill: string;
|
|
17
|
+
loaderItemFill: string;
|
|
18
|
+
};
|
|
19
|
+
surfaceTertiary: {
|
|
20
|
+
fill: string;
|
|
21
|
+
fillHover: string;
|
|
22
|
+
labelTextColor: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export { drawerAppearanceSurface };
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
declare const dropdownAppearanceAccent: {
|
|
2
|
-
accent: {
|
|
3
|
-
fill: string;
|
|
4
|
-
fillHover: string;
|
|
5
|
-
};
|
|
6
2
|
accentPrimary: {
|
|
7
3
|
fill: string;
|
|
8
4
|
fillHover: string;
|
|
@@ -14,8 +10,6 @@ declare const dropdownAppearanceAccent: {
|
|
|
14
10
|
labelTextColor: string;
|
|
15
11
|
labelTextColorHover: string;
|
|
16
12
|
borderColor: string;
|
|
17
|
-
loaderFill: string;
|
|
18
|
-
loaderItemFill: string;
|
|
19
13
|
};
|
|
20
14
|
};
|
|
21
15
|
export { dropdownAppearanceAccent };
|
|
@@ -3,6 +3,11 @@ declare const dropdownAppearanceSurface: {
|
|
|
3
3
|
fill: string;
|
|
4
4
|
fillHover: string;
|
|
5
5
|
labelTextColor: string;
|
|
6
|
+
labelTextColorActive: string;
|
|
7
|
+
labelTextColorActiveHover: string;
|
|
8
|
+
labelTextColorHover: string;
|
|
9
|
+
iconAfterFillIcon: string;
|
|
10
|
+
iconBeforeFillIcon: string;
|
|
6
11
|
};
|
|
7
12
|
surfaceQuaternary: {
|
|
8
13
|
fill: string;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const InputPasswordState: InputState;
|
|
1
|
+
import { InputPasswordAppearanceType } from './InputPassword.interface';
|
|
2
|
+
export declare const inputPasswordAppearance: InputPasswordAppearanceType;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AppearanceKeysDefault, BorderColorProps, BorderWidthProps, FillProps, IconSizeProps, ItemColorProps, ShapeProps, SizeProps,
|
|
1
|
+
import { AppearanceKeysDefault, BorderColorProps, BorderWidthProps, FillProps, IconSizeProps, ItemColorProps, ShapeProps, SizeProps, TextColorProps, TextSizeProps, TextWeightProps, WidthProps } from '@itcase/types';
|
|
2
2
|
import { StyleAttributes } from 'src/hooks/useStyles/styleAttributes.interface';
|
|
3
3
|
export interface InputThemeColor {
|
|
4
4
|
[key: number | string | symbol]: any;
|
|
@@ -15,19 +15,13 @@ export interface InputThemeColor {
|
|
|
15
15
|
width?: WidthProps;
|
|
16
16
|
}
|
|
17
17
|
type AppearanceKeys = AppearanceKeysDefault & {};
|
|
18
|
-
type
|
|
19
|
-
export type InputState = {
|
|
20
|
-
[key in stateKeysType]?: InputThemeColor;
|
|
21
|
-
};
|
|
22
|
-
export type InputAppearance = {
|
|
18
|
+
export type InputPasswordAppearanceType = {
|
|
23
19
|
[key in AppearanceKeys]?: InputThemeColor;
|
|
24
20
|
};
|
|
25
21
|
export interface InputPasswordConfig {
|
|
26
22
|
[key: number | string | symbol]: any;
|
|
27
|
-
appearance:
|
|
28
|
-
|
|
29
|
-
setAppearance: (newComponent: InputAppearance) => void;
|
|
30
|
-
setState: (newComponent: InputState) => void;
|
|
23
|
+
appearance: InputPasswordAppearanceType | undefined;
|
|
24
|
+
setAppearance: (newComponent: InputPasswordAppearanceType) => void;
|
|
31
25
|
}
|
|
32
26
|
export interface InputPasswordProps extends InputThemeColor, StyleAttributes {
|
|
33
27
|
id?: number | string;
|
|
@@ -44,7 +38,6 @@ export interface InputPasswordProps extends InputThemeColor, StyleAttributes {
|
|
|
44
38
|
imageRevealableHide?: string;
|
|
45
39
|
imageRevealableShow?: string;
|
|
46
40
|
placeholder?: string;
|
|
47
|
-
state?: stateKeysType;
|
|
48
41
|
value?: string;
|
|
49
42
|
isRevealable?: boolean;
|
|
50
43
|
onBlur?: () => void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
declare const inputPasswordAppearanceAccent: {
|
|
2
|
+
accent: {
|
|
3
|
+
fill: string;
|
|
4
|
+
fillHover: string;
|
|
5
|
+
};
|
|
6
|
+
accentPrimary: {
|
|
7
|
+
fill: string;
|
|
8
|
+
fillHover: string;
|
|
9
|
+
borderColor: string;
|
|
10
|
+
};
|
|
11
|
+
accentSecondary: {
|
|
12
|
+
fill: string;
|
|
13
|
+
fillHover: string;
|
|
14
|
+
labelTextColor: string;
|
|
15
|
+
labelTextColorHover: string;
|
|
16
|
+
borderColor: string;
|
|
17
|
+
loaderItemFill: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export { inputPasswordAppearanceAccent };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
declare const inputPasswordAppearanceDisabled: {
|
|
2
|
+
disabledPrimary: {
|
|
3
|
+
fill: string;
|
|
4
|
+
borderColor: string;
|
|
5
|
+
borderHover: string;
|
|
6
|
+
textColor: string;
|
|
7
|
+
iconBeforeFill: string;
|
|
8
|
+
iconClearFill: string;
|
|
9
|
+
placeholderTextColor: string;
|
|
10
|
+
};
|
|
11
|
+
disabledSecondary: {
|
|
12
|
+
fill: string;
|
|
13
|
+
borderColor: string;
|
|
14
|
+
borderHover: string;
|
|
15
|
+
iconBeforeFill: string;
|
|
16
|
+
iconClearFill: string;
|
|
17
|
+
placeholderTextColor: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export { inputPasswordAppearanceDisabled };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
declare const inputPasswordAppearanceInfo: {
|
|
2
|
+
info: {
|
|
3
|
+
fill: string;
|
|
4
|
+
fillHover: string;
|
|
5
|
+
labelTextColor: string;
|
|
6
|
+
labelTextColorHover: string;
|
|
7
|
+
borderColor: string;
|
|
8
|
+
loaderFill: string;
|
|
9
|
+
loaderItemFill: string;
|
|
10
|
+
};
|
|
11
|
+
infoSecondary: {
|
|
12
|
+
fill: string;
|
|
13
|
+
fillHover: string;
|
|
14
|
+
labelTextColor: string;
|
|
15
|
+
labelTextColorHover: string;
|
|
16
|
+
borderColor: string;
|
|
17
|
+
loaderFill: string;
|
|
18
|
+
loaderItemFill: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export { inputPasswordAppearanceInfo };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
declare const inputPasswordAppearanceRequire: {
|
|
2
|
+
requirePrimary: {
|
|
3
|
+
fill: string;
|
|
4
|
+
borderColor: string;
|
|
5
|
+
borderHover: string;
|
|
6
|
+
textColor: string;
|
|
7
|
+
iconBeforeFill: string;
|
|
8
|
+
iconClearFill: string;
|
|
9
|
+
placeholderTextColor: string;
|
|
10
|
+
};
|
|
11
|
+
requireSecondary: {
|
|
12
|
+
fill: string;
|
|
13
|
+
borderColor: string;
|
|
14
|
+
borderHover: string;
|
|
15
|
+
iconBeforeFill: string;
|
|
16
|
+
iconClearFill: string;
|
|
17
|
+
placeholderTextColor: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export { inputPasswordAppearanceRequire };
|