@koslibs/components 1.5.0 → 1.7.0
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/CHANGELOG.md +31 -0
- package/README.md +85 -0
- package/dist/components/Button/button.js +20 -4
- package/dist/components/Button/index_module.css +1 -27
- package/dist/components/Collapse/collapse.js +3 -1
- package/dist/components/Collapse/index_module.css +2 -4
- package/dist/components/Input/index_module.css +9 -20
- package/dist/components/Input/input.d.ts +1 -1
- package/dist/components/Input/vars.css +7 -7
- package/dist/components/Modal/components/footer/index_module.css +1 -1
- package/dist/components/Modal/components/header/index.d.ts +1 -1
- package/dist/components/Modal/components/header/index_module.css +3 -3
- package/dist/components/Modal/index_module.css +2 -2
- package/dist/components/Popover/components/popover-surface/index.js +1 -1
- package/dist/components/Popover/{use-popover-position.d.ts → hooks/use-popover-position.d.ts} +1 -1
- package/dist/components/Spinner/preset_module.css +3 -1
- package/dist/components/Tabs/context.d.ts +10 -0
- package/dist/components/Tabs/context.js +3 -0
- package/dist/components/Tabs/hooks/use-tab-indicator.d.ts +11 -0
- package/dist/components/Tabs/hooks/use-tab-indicator.js +43 -0
- package/dist/components/Tabs/index.d.ts +3 -0
- package/dist/components/Tabs/index.js +2 -0
- package/dist/components/Tabs/index.module.js +12 -0
- package/dist/components/Tabs/index_module.css +92 -0
- package/dist/components/Tabs/tab.d.ts +9 -0
- package/dist/components/Tabs/tab.js +38 -0
- package/dist/components/Tabs/tabs.d.ts +13 -0
- package/dist/components/Tabs/tabs.js +116 -0
- package/dist/components/Tabs/types.d.ts +61 -0
- package/dist/components/Tabs/types.js +0 -0
- package/dist/components/Tabs/vars.css +20 -0
- package/dist/components/Textarea/hooks/use-autosize.d.ts +2 -0
- package/dist/components/Textarea/hooks/use-autosize.js +106 -0
- package/dist/components/Textarea/index.d.ts +2 -0
- package/dist/components/Textarea/index.js +1 -0
- package/dist/components/Textarea/index.module.js +14 -0
- package/dist/components/Textarea/index_module.css +269 -0
- package/dist/components/Textarea/textarea.d.ts +27 -0
- package/dist/components/Textarea/textarea.js +173 -0
- package/dist/components/Textarea/types.d.ts +108 -0
- package/dist/components/Textarea/types.js +0 -0
- package/dist/components/Textarea/vars.css +9 -0
- package/dist/components/Typography/index.d.ts +1 -1
- package/dist/components/Typography/index_module.css +2 -2
- package/dist/components/Typography/preset.module.js +2 -0
- package/dist/components/Typography/preset_module.css +4 -0
- package/dist/components/Typography/shared.d.ts +1 -1
- package/dist/components/Typography/text.d.ts +1 -1
- package/dist/components/Typography/vars.css +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +2 -0
- package/dist/styles/theme.css +1 -0
- package/dist/styles/variables.css +63 -0
- package/package.json +2 -1
- /package/dist/components/Popover/{use-popover-position.js → hooks/use-popover-position.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @koslibs/components
|
|
2
2
|
|
|
3
|
+
## 1.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#8](https://github.com/koslibs/components/pull/8) [`5b8e35c`](https://github.com/koslibs/components/commit/5b8e35cdfc7d0586b93d986661ff0ddcafa97452) Thanks [@holypower777](https://github.com/holypower777)! - Добавлены Tabs и дочерний Tab по документации Figma: selectedId/defaultSelectedId,
|
|
8
|
+
onChange(event, { selectedId }), размеры 40/48, счётчики, controlled/uncontrolled,
|
|
9
|
+
плавное перемещение активного индикатора. Ряд вкладок должен помещаться в доступную
|
|
10
|
+
ширину; горизонтальная прокрутка и перенос не поддерживаются. Содержимое выбранной вкладки
|
|
11
|
+
отображается отдельно в приложении.
|
|
12
|
+
В документации показаны props обоих компонентов: Tabs и Tab.
|
|
13
|
+
Tab отображает кнопку вкладки; Tabs управляет общим состоянием через внутренний контекст.
|
|
14
|
+
|
|
15
|
+
Текст Tabs, Button и Collapse использует общий TypographyText. Добавлен размер
|
|
16
|
+
18 px для TypographyText; сохранены размеры текста. Все размеры Typography используют
|
|
17
|
+
line-height: normal по документации Figma Auto. Удалены локальные переопределения
|
|
18
|
+
высоты строки в Tabs, Button, Collapse, а также подписях, подсказках и счётчиках
|
|
19
|
+
Input и Textarea.
|
|
20
|
+
|
|
21
|
+
Добавлен импорт @koslibs/components/variables.css со шкалами --size-_ и
|
|
22
|
+
--border-radius-_. Общая тема включает переменные автоматически; отступы и
|
|
23
|
+
скругления компонентов используют эти шкалы. Использование и переопределение
|
|
24
|
+
задокументированы в README и Storybook.
|
|
25
|
+
|
|
26
|
+
## 1.6.0
|
|
27
|
+
|
|
28
|
+
### Minor Changes
|
|
29
|
+
|
|
30
|
+
- [#7](https://github.com/koslibs/components/pull/7) [`4e937d7`](https://github.com/koslibs/components/commit/4e937d7e18b3c7d592e3b8cb161817d482bf2c55) Thanks [@holypower777](https://github.com/holypower777)! - Добавлен Textarea по документации Figma: primary/secondary, inner/outer label,
|
|
31
|
+
Typography, hint/error, счётчик длины, очистка, autosize и вертикальный resize.
|
|
32
|
+
Внутренний скроллбар оформлен без стрелок и фона, с тонким закруглённым ползунком.
|
|
33
|
+
|
|
3
34
|
## 1.5.0
|
|
4
35
|
|
|
5
36
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -30,6 +30,63 @@ import '@koslibs/components/theme.css';
|
|
|
30
30
|
Файлы своего шрифта подключите в приложении. Тема задаёт только переменную и
|
|
31
31
|
`@font-face`; она не изменяет шрифт `body` или элементов, которые её не используют.
|
|
32
32
|
|
|
33
|
+
## Глобальные переменные
|
|
34
|
+
|
|
35
|
+
Отступы и скругления доступны отдельным импортом без шрифтов:
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
import '@koslibs/components/variables.css';
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
`theme.css` уже включает эти переменные вместе с Inter. Компоненты подключают
|
|
42
|
+
нужные стили автоматически; отдельный импорт нужен, если вы используете переменные
|
|
43
|
+
в собственных элементах приложения.
|
|
44
|
+
|
|
45
|
+
Используйте `--size-*` в `margin`, `padding`, `gap`, `row-gap` и `column-gap`,
|
|
46
|
+
а `--border-radius-*` — в `border-radius`:
|
|
47
|
+
|
|
48
|
+
```css
|
|
49
|
+
.card {
|
|
50
|
+
display: flex;
|
|
51
|
+
flex-direction: column;
|
|
52
|
+
margin: var(--size-0);
|
|
53
|
+
padding: var(--size-24);
|
|
54
|
+
gap: var(--size-12);
|
|
55
|
+
border-radius: var(--border-radius-12);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.badge {
|
|
59
|
+
margin-left: var(--size-4-neg);
|
|
60
|
+
padding: var(--size-2) var(--size-8);
|
|
61
|
+
border-radius: var(--border-radius-pill);
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
| Семейство | Суффиксы переменных | Значения по умолчанию |
|
|
66
|
+
| --- | --- | --- |
|
|
67
|
+
| `--size-*` | 0, 2, 4, 6, 8, 12, 16, 20, 22, 24, 28, 30, 32, 36, 40, 44, 48, 56, 64, 72, 80, 96, 128 | `0` для нуля, остальные — в px |
|
|
68
|
+
| `--size-*-neg` | 2, 4, 8, 12, 16, 20, 22, 24, 28, 32, 36, 40, 44, 48, 56, 64, 72, 80, 96, 128 | Отрицательное значение в px, например `--size-8-neg: -8px` |
|
|
69
|
+
| `--border-radius-*` | 0, 2, 4, 6, 8, 10, 12, 16, 20, 24, 32, 36, 64 | `0` для нуля, остальные — в px |
|
|
70
|
+
| `--border-radius-circle` | — | `50%` |
|
|
71
|
+
| `--border-radius-pill` | — | `99px` |
|
|
72
|
+
|
|
73
|
+
Значения объявлены в CSS-слое `koslibs`. Переопределяйте их в обычном `:root`
|
|
74
|
+
приложения; порядок подключения относительно библиотечных стилей не важен:
|
|
75
|
+
|
|
76
|
+
```css
|
|
77
|
+
:root {
|
|
78
|
+
--size-24: 20px;
|
|
79
|
+
--border-radius-12: 10px;
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Это меняет значения во всех компонентах, которые используют соответствующий токен.
|
|
84
|
+
Переменные компонента сохраняют приоритет для его отдельной настройки, например
|
|
85
|
+
`--tabs-gap: var(--size-6)` или `--input-border-radius: var(--border-radius-4)`.
|
|
86
|
+
Нулевые отступы также задавайте через `--size-0`; `auto` и проценты сохраняйте
|
|
87
|
+
по назначению. Для точного значения вне шкалы используйте `calc()`, например
|
|
88
|
+
`calc(var(--size-30) / 2)` для 15 px.
|
|
89
|
+
|
|
33
90
|
## Добавление компонента
|
|
34
91
|
|
|
35
92
|
Рекомендуемая структура:
|
|
@@ -40,6 +97,8 @@ src/components/Button/
|
|
|
40
97
|
button.tsx
|
|
41
98
|
button.module.css
|
|
42
99
|
CHANGELOG.md
|
|
100
|
+
hooks/
|
|
101
|
+
use-button-hook.ts
|
|
43
102
|
docs/
|
|
44
103
|
button.stories.tsx
|
|
45
104
|
button.docs.tsx
|
|
@@ -68,6 +127,32 @@ src/components/Button/
|
|
|
68
127
|
`koslibs-builder lib:test`; `npm test` также проверяет отдельные импорты.
|
|
69
128
|
6. Выполните сборку и проверьте реальные пути JS, деклараций и CSS в `dist`.
|
|
70
129
|
|
|
130
|
+
### Расположение хуков
|
|
131
|
+
|
|
132
|
+
- Хуки, относящиеся к конкретному компоненту, храните в `src/components/<Name>/hooks/`.
|
|
133
|
+
Например, хук индикатора Tabs находится в `src/components/Tabs/hooks/use-tab-indicator.ts`.
|
|
134
|
+
- Общие хуки, используемые разными компонентами, храните в `src/hooks/`.
|
|
135
|
+
Например, `src/hooks/use-data-test-id.ts`.
|
|
136
|
+
|
|
137
|
+
Файлы хуков именуйте в kebab-case с префиксом `use-`. Папку `hooks` компонента
|
|
138
|
+
создавайте, когда у него появляются собственные хуки.
|
|
139
|
+
|
|
140
|
+
### Типографика компонентов
|
|
141
|
+
|
|
142
|
+
Текстовые подписи, заголовки, подсказки и счётчики отображайте через `TypographyText`
|
|
143
|
+
или `TypographyTitle`. Размер и начертание задавайте пропами `size` и `weight`,
|
|
144
|
+
цвет — пропом `color` либо наследованием от компонента для его состояний.
|
|
145
|
+
Внутри библиотеки импортируйте нужный компонент напрямую из `Typography/text`
|
|
146
|
+
или `Typography/title`, чтобы не подключать весь публичный API Typography.
|
|
147
|
+
|
|
148
|
+
В CSS компонента оставляйте оформление и отступы. Высоту строки задаёт Typography:
|
|
149
|
+
для всех размеров используется `line-height: normal`, соответствующий Figma Auto.
|
|
150
|
+
Не переопределяйте высоту строки Typography в компонентах и примерах.
|
|
151
|
+
CSS шрифта допустим для нативных `input` и `textarea`, их placeholder,
|
|
152
|
+
анимации плавающей подписи и других случаев, где текст нельзя оформить через
|
|
153
|
+
Typography без изменения поведения. Произвольное содержимое приложения
|
|
154
|
+
не оборачивайте в Typography автоматически.
|
|
155
|
+
|
|
71
156
|
После публикации предполагается такой импорт:
|
|
72
157
|
|
|
73
158
|
```tsx
|
|
@@ -2,6 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import classnames from "classnames";
|
|
3
3
|
import react, { forwardRef, useEffect, useRef, useState } from "react";
|
|
4
4
|
import { Spinner } from "../Spinner/index.js";
|
|
5
|
+
import { TypographyText } from "../Typography/text.js";
|
|
5
6
|
import colors_module from "./colors.module.js";
|
|
6
7
|
import index_module from "./index.module.js";
|
|
7
8
|
const Button = /*#__PURE__*/ forwardRef(({ view = 'primary', shape = 'rectangular', size = 40, leftAddon, rightAddon, hint, block = false, loading = false, dataTestId, className, labelClassName, hintClassName, spinnerClassName, children, onClick, ...restProps }, ref)=>{
|
|
@@ -13,20 +14,33 @@ const Button = /*#__PURE__*/ forwardRef(({ view = 'primary', shape = 'rectangula
|
|
|
13
14
|
64,
|
|
14
15
|
72
|
|
15
16
|
].includes(size);
|
|
17
|
+
const textSize = {
|
|
18
|
+
32: 14,
|
|
19
|
+
40: 14,
|
|
20
|
+
48: 16,
|
|
21
|
+
56: 16,
|
|
22
|
+
64: 18,
|
|
23
|
+
72: 18
|
|
24
|
+
}[size];
|
|
16
25
|
const { disabled, type = 'button', ...restButtonProps } = restProps;
|
|
17
26
|
const buttonChildren = /*#__PURE__*/ jsxs(react.Fragment, {
|
|
18
27
|
children: [
|
|
19
|
-
leftAddon && /*#__PURE__*/ jsx(
|
|
28
|
+
leftAddon && /*#__PURE__*/ jsx(TypographyText, {
|
|
29
|
+
size: textSize,
|
|
30
|
+
weight: "medium",
|
|
20
31
|
className: index_module.addons,
|
|
21
32
|
children: leftAddon
|
|
22
33
|
}),
|
|
23
|
-
children && /*#__PURE__*/ jsxs(
|
|
34
|
+
children && /*#__PURE__*/ jsxs(TypographyText, {
|
|
35
|
+
size: textSize,
|
|
36
|
+
weight: "medium",
|
|
24
37
|
className: classnames(index_module.label, labelClassName, {
|
|
25
38
|
[index_module.stretchText]: !(leftAddon || rightAddon)
|
|
26
39
|
}),
|
|
27
40
|
children: [
|
|
28
41
|
children,
|
|
29
|
-
showHint && /*#__PURE__*/ jsx(
|
|
42
|
+
showHint && /*#__PURE__*/ jsx(TypographyText, {
|
|
43
|
+
size: 14,
|
|
30
44
|
className: classnames(index_module.hint, colors_module.hint, hintClassName),
|
|
31
45
|
children: hint
|
|
32
46
|
})
|
|
@@ -38,7 +52,9 @@ const Button = /*#__PURE__*/ forwardRef(({ view = 'primary', shape = 'rectangula
|
|
|
38
52
|
visible: true,
|
|
39
53
|
className: classnames(index_module.loader, colors_module.loader, spinnerClassName)
|
|
40
54
|
}),
|
|
41
|
-
rightAddon && /*#__PURE__*/ jsx(
|
|
55
|
+
rightAddon && /*#__PURE__*/ jsx(TypographyText, {
|
|
56
|
+
size: textSize,
|
|
57
|
+
weight: "medium",
|
|
42
58
|
className: index_module.addons,
|
|
43
59
|
children: rightAddon
|
|
44
60
|
})
|
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
box-sizing: border-box;
|
|
6
6
|
vertical-align: middle;
|
|
7
7
|
width: fit-content;
|
|
8
|
-
font
|
|
9
|
-
font-size: var(--size-16, 16px);
|
|
8
|
+
font: inherit;
|
|
10
9
|
text-align: center;
|
|
11
10
|
margin: var(--size-0, 0px);
|
|
12
11
|
padding: var(--size-0, 0px) var(--size-24, 24px);
|
|
@@ -24,13 +23,6 @@
|
|
|
24
23
|
position: relative;
|
|
25
24
|
}
|
|
26
25
|
|
|
27
|
-
.size-32-oD8MDp, .size-40-Pu2_h6 {
|
|
28
|
-
font-size: 14px;
|
|
29
|
-
font-weight: 500;
|
|
30
|
-
line-height: 20px;
|
|
31
|
-
font-family: var(--font-family-system, system-ui, sans-serif);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
26
|
.size-32-oD8MDp {
|
|
35
27
|
min-width: 80px;
|
|
36
28
|
min-height: 32px;
|
|
@@ -43,13 +35,6 @@
|
|
|
43
35
|
padding: var(--size-0, 0px) var(--size-20, 20px);
|
|
44
36
|
}
|
|
45
37
|
|
|
46
|
-
.size-48-U3XIYx, .size-56-P_94sz {
|
|
47
|
-
font-size: 16px;
|
|
48
|
-
font-weight: 500;
|
|
49
|
-
line-height: 20px;
|
|
50
|
-
font-family: var(--font-family-system, system-ui, sans-serif);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
38
|
.size-48-U3XIYx {
|
|
54
39
|
min-width: 104px;
|
|
55
40
|
min-height: 48px;
|
|
@@ -62,13 +47,6 @@
|
|
|
62
47
|
padding: var(--size-0, 0px) var(--size-28, 28px);
|
|
63
48
|
}
|
|
64
49
|
|
|
65
|
-
.size-64-ZlQLt3, .size-72-zkSrcs {
|
|
66
|
-
font-size: 18px;
|
|
67
|
-
font-weight: 500;
|
|
68
|
-
line-height: 24px;
|
|
69
|
-
font-family: var(--font-family-system, system-ui, sans-serif);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
50
|
.size-64-ZlQLt3 {
|
|
73
51
|
min-width: 160px;
|
|
74
52
|
min-height: 64px;
|
|
@@ -222,10 +200,6 @@
|
|
|
222
200
|
}
|
|
223
201
|
|
|
224
202
|
.hint-AFu_zz {
|
|
225
|
-
font-size: 14px;
|
|
226
|
-
font-weight: 400;
|
|
227
|
-
line-height: 18px;
|
|
228
|
-
font-family: var(--font-primary);
|
|
229
203
|
color: var(--button-hint-color);
|
|
230
204
|
display: block;
|
|
231
205
|
}
|
|
@@ -2,6 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { ChevronDownIcon } from "@koslibs/icons/ChevronDownIcon";
|
|
3
3
|
import classnames from "classnames";
|
|
4
4
|
import { forwardRef, useId, useLayoutEffect, useRef, useState } from "react";
|
|
5
|
+
import { TypographyText } from "../Typography/text.js";
|
|
5
6
|
import index_module from "./index.module.js";
|
|
6
7
|
const Collapse = /*#__PURE__*/ forwardRef(({ expanded, defaultExpanded = false, collapsedLabel, expandedLabel, showRightChevron = true, showLeftChevron = false, onExpandedChange, onTransitionEnd, expandedContentClassName, dataTestId, className, children, ...restProps }, ref)=>{
|
|
7
8
|
const [expandedState, setExpandedState] = useState(defaultExpanded);
|
|
@@ -67,7 +68,8 @@ const Collapse = /*#__PURE__*/ forwardRef(({ expanded, defaultExpanded = false,
|
|
|
67
68
|
}),
|
|
68
69
|
"aria-hidden": "true"
|
|
69
70
|
}),
|
|
70
|
-
/*#__PURE__*/ jsx(
|
|
71
|
+
/*#__PURE__*/ jsx(TypographyText, {
|
|
72
|
+
size: 13,
|
|
71
73
|
children: label
|
|
72
74
|
}),
|
|
73
75
|
showRightChevron && /*#__PURE__*/ jsx(ChevronDownIcon, {
|
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
align-items: center;
|
|
29
29
|
gap: var(--size-4, 4px);
|
|
30
30
|
max-width: 100%;
|
|
31
|
-
|
|
31
|
+
margin: var(--size-0);
|
|
32
|
+
padding: var(--size-8, 8px) var(--size-0);
|
|
32
33
|
color: var(--collapse-color);
|
|
33
34
|
font: inherit;
|
|
34
35
|
text-align: left;
|
|
@@ -36,9 +37,6 @@
|
|
|
36
37
|
cursor: pointer;
|
|
37
38
|
background: none;
|
|
38
39
|
border: 0;
|
|
39
|
-
margin: 0;
|
|
40
|
-
font-size: 13px;
|
|
41
|
-
line-height: 20px;
|
|
42
40
|
display: inline-flex;
|
|
43
41
|
|
|
44
42
|
&:hover {
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
gap: var(--input-gap);
|
|
87
87
|
width: 100%;
|
|
88
88
|
height: var(--field-height);
|
|
89
|
-
padding: 0 var(--field-padding);
|
|
89
|
+
padding: var(--size-0) var(--field-padding);
|
|
90
90
|
border-radius: var(--input-border-radius);
|
|
91
91
|
background: var(--field-background);
|
|
92
92
|
box-shadow: inset 0 0 0 1px var(--field-border);
|
|
@@ -143,11 +143,6 @@
|
|
|
143
143
|
font-variant-numeric: tabular-nums;
|
|
144
144
|
flex-shrink: 0;
|
|
145
145
|
margin-left: auto;
|
|
146
|
-
line-height: 16px;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
.innerHeader-Iga0Hb .counter-C758Bk {
|
|
150
|
-
line-height: 15px;
|
|
151
146
|
}
|
|
152
147
|
|
|
153
148
|
.label-tvCOwp {
|
|
@@ -157,7 +152,6 @@
|
|
|
157
152
|
cursor: inherit;
|
|
158
153
|
flex: 1;
|
|
159
154
|
font-size: 13px;
|
|
160
|
-
line-height: 16px;
|
|
161
155
|
display: block;
|
|
162
156
|
}
|
|
163
157
|
|
|
@@ -165,31 +159,27 @@
|
|
|
165
159
|
white-space: nowrap;
|
|
166
160
|
text-overflow: ellipsis;
|
|
167
161
|
font-size: var(--field-font-size);
|
|
168
|
-
|
|
169
|
-
transition: transform .18s, font-size .18s, line-height .18s;
|
|
162
|
+
transition: transform .18s, font-size .18s;
|
|
170
163
|
overflow: hidden;
|
|
171
164
|
transform: translateY(7.5px);
|
|
172
165
|
|
|
173
166
|
& > span {
|
|
174
167
|
font-size: inherit;
|
|
175
|
-
line-height: inherit;
|
|
176
168
|
}
|
|
177
169
|
}
|
|
178
170
|
|
|
179
171
|
.component-aUdiT5[data-inner-label][data-filled] .label-tvCOwp, .component-aUdiT5[data-inner-label]:not([data-disabled], [data-read-only]) .value-ehhHJ8:focus-within .label-tvCOwp {
|
|
180
172
|
font-size: 12px;
|
|
181
|
-
line-height: 15px;
|
|
182
173
|
transform: translateY(0);
|
|
183
174
|
}
|
|
184
175
|
|
|
185
176
|
.component-aUdiT5[data-inner-label] .value-ehhHJ8:has(.input-IlmcAi:autofill) .label-tvCOwp {
|
|
186
177
|
font-size: 12px;
|
|
187
|
-
line-height: 15px;
|
|
188
178
|
transform: translateY(0);
|
|
189
179
|
}
|
|
190
180
|
|
|
191
181
|
.component-aUdiT5[data-inner-label] .input-IlmcAi {
|
|
192
|
-
margin-top:
|
|
182
|
+
margin-top: calc(var(--size-30) / 2);
|
|
193
183
|
|
|
194
184
|
&::placeholder {
|
|
195
185
|
opacity: 0;
|
|
@@ -202,7 +192,7 @@
|
|
|
202
192
|
}
|
|
203
193
|
|
|
204
194
|
.component-aUdiT5[data-inner-counter]:not([data-inner-label]) .input-IlmcAi {
|
|
205
|
-
margin-top:
|
|
195
|
+
margin-top: calc(var(--size-30) / 2);
|
|
206
196
|
}
|
|
207
197
|
|
|
208
198
|
@media (prefers-reduced-motion: reduce) {
|
|
@@ -216,6 +206,9 @@
|
|
|
216
206
|
width: 100%;
|
|
217
207
|
min-width: 0;
|
|
218
208
|
height: var(--field-line-height);
|
|
209
|
+
margin: var(--size-0);
|
|
210
|
+
padding: var(--size-0);
|
|
211
|
+
border-radius: var(--border-radius-0);
|
|
219
212
|
color: var(--field-color);
|
|
220
213
|
font-family: var(--font-primary);
|
|
221
214
|
font-size: var(--field-font-size);
|
|
@@ -225,10 +218,7 @@
|
|
|
225
218
|
appearance: none;
|
|
226
219
|
background: none;
|
|
227
220
|
border: 0;
|
|
228
|
-
border-radius: 0;
|
|
229
221
|
outline: none;
|
|
230
|
-
margin: 0;
|
|
231
|
-
padding: 0;
|
|
232
222
|
display: block;
|
|
233
223
|
|
|
234
224
|
&:focus {
|
|
@@ -274,11 +264,11 @@
|
|
|
274
264
|
min-width: 0;
|
|
275
265
|
height: 24px;
|
|
276
266
|
min-height: 0;
|
|
267
|
+
margin: var(--size-0) var(--size-4-neg);
|
|
268
|
+
padding: var(--size-0);
|
|
277
269
|
color: var(--field-icon-color);
|
|
278
270
|
background: none;
|
|
279
271
|
flex: 0 0 24px;
|
|
280
|
-
margin: 0 -4px;
|
|
281
|
-
padding: 0;
|
|
282
272
|
|
|
283
273
|
&:hover, &:active {
|
|
284
274
|
color: var(--field-icon-color);
|
|
@@ -299,7 +289,6 @@
|
|
|
299
289
|
.component-aUdiT5 .message-ArUnJU {
|
|
300
290
|
color: var(--input-hint-color);
|
|
301
291
|
overflow-wrap: anywhere;
|
|
302
|
-
line-height: 15px;
|
|
303
292
|
}
|
|
304
293
|
|
|
305
294
|
.component-aUdiT5[data-error] .message-ArUnJU {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ChangeEvent, type MouseEvent } from 'react';
|
|
2
|
-
export declare const Input: import("react").ForwardRefExoticComponent<Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "size" | "
|
|
2
|
+
export declare const Input: import("react").ForwardRefExoticComponent<Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "size" | "children" | "defaultValue" | "onChange" | "value" | "maxLength"> & {
|
|
3
3
|
value?: string;
|
|
4
4
|
defaultValue?: string;
|
|
5
5
|
maxLength?: number;
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
--input-disabled-background-color: #cfd1cb;
|
|
15
15
|
--input-disabled-color: #858981;
|
|
16
16
|
--input-read-only-border-color: #c8beaa;
|
|
17
|
-
--input-border-radius:
|
|
18
|
-
--input-gap:
|
|
17
|
+
--input-border-radius: var(--border-radius-8);
|
|
18
|
+
--input-gap: var(--size-8);
|
|
19
19
|
--input-icon-size: 16px;
|
|
20
20
|
--input-width: 320px;
|
|
21
21
|
--input-font-size-40: 13px;
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
--input-font-size-56: 14px;
|
|
24
24
|
--input-font-size-64: 14px;
|
|
25
25
|
--input-font-size-72: 16px;
|
|
26
|
-
--input-padding-40:
|
|
27
|
-
--input-padding-48:
|
|
28
|
-
--input-padding-56:
|
|
29
|
-
--input-padding-64:
|
|
30
|
-
--input-padding-72:
|
|
26
|
+
--input-padding-40: var(--size-12);
|
|
27
|
+
--input-padding-48: var(--size-12);
|
|
28
|
+
--input-padding-56: var(--size-16);
|
|
29
|
+
--input-padding-64: var(--size-16);
|
|
30
|
+
--input-padding-72: var(--size-20);
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -20,7 +20,7 @@ export type HeaderProps = Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'onClos
|
|
|
20
20
|
*/
|
|
21
21
|
dataTestId?: string;
|
|
22
22
|
};
|
|
23
|
-
export declare const Header: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "
|
|
23
|
+
export declare const Header: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "children" | "title" | "onClose"> & {
|
|
24
24
|
/**
|
|
25
25
|
* Заголовок окна.
|
|
26
26
|
*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
justify-content: space-between;
|
|
3
3
|
align-items: flex-start;
|
|
4
4
|
gap: var(--size-24, 24px);
|
|
5
|
-
padding: var(--modal-padding) var(--modal-padding) 0;
|
|
5
|
+
padding: var(--modal-padding) var(--modal-padding) var(--size-0);
|
|
6
6
|
flex-shrink: 0;
|
|
7
7
|
display: flex;
|
|
8
8
|
}
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
.component-sqEuYd > .closer-odHjP5 {
|
|
20
|
-
flex-shrink: 0;
|
|
21
20
|
width: 48px;
|
|
22
21
|
min-width: 48px;
|
|
23
|
-
padding: 0;
|
|
22
|
+
padding: var(--size-0);
|
|
23
|
+
flex-shrink: 0;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
.closerLabel-r61y3R {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
@import "./vars.css";
|
|
3
3
|
|
|
4
4
|
.component-kCkvk3 {
|
|
5
|
+
padding: var(--size-0);
|
|
5
6
|
border-radius: var(--border-radius-12, 12px);
|
|
6
7
|
max-width: calc(100vw - var(--size-32, 32px));
|
|
7
8
|
max-height: calc(100dvh - var(--size-32, 32px));
|
|
@@ -11,7 +12,6 @@
|
|
|
11
12
|
box-shadow: var(--modal-shadow);
|
|
12
13
|
border: none;
|
|
13
14
|
margin: auto;
|
|
14
|
-
padding: 0;
|
|
15
15
|
overflow: hidden;
|
|
16
16
|
|
|
17
17
|
&[open] {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
.size-fullscreen-exf2cb {
|
|
40
|
-
border-radius: 0;
|
|
40
|
+
border-radius: var(--border-radius-0);
|
|
41
41
|
width: 100vw;
|
|
42
42
|
max-width: none;
|
|
43
43
|
height: 100dvh;
|
|
@@ -2,7 +2,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import classnames from "classnames";
|
|
3
3
|
import { forwardRef, useEffect, useImperativeHandle, useMemo, useState } from "react";
|
|
4
4
|
import { createSizeModifier } from "../../create-size-modifier.js";
|
|
5
|
-
import { usePopoverPosition } from "../../use-popover-position.js";
|
|
5
|
+
import { usePopoverPosition } from "../../hooks/use-popover-position.js";
|
|
6
6
|
import index_module from "../../index.module.js";
|
|
7
7
|
const DEFAULT_OFFSET = [
|
|
8
8
|
0,
|
package/dist/components/Popover/{use-popover-position.d.ts → hooks/use-popover-position.d.ts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Modifier } from '@popperjs/core';
|
|
2
2
|
import { type CSSProperties } from 'react';
|
|
3
|
-
import type { PopoverPosition } from '
|
|
3
|
+
import type { PopoverPosition } from '../types.js';
|
|
4
4
|
export declare function usePopoverPosition(anchorElement: HTMLElement, popperElement: HTMLDivElement | null, position: PopoverPosition, modifiers: Partial<Modifier<string, object>>[]): {
|
|
5
5
|
update: () => Promise<Partial<import("@popperjs/core").State>> | undefined;
|
|
6
6
|
styles: CSSProperties;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TabsProps } from './types.js';
|
|
2
|
+
type TabsContextValue = {
|
|
3
|
+
selectedId?: string;
|
|
4
|
+
size: NonNullable<TabsProps['size']>;
|
|
5
|
+
dataTestId?: string;
|
|
6
|
+
registerTab: (id: string, button: HTMLButtonElement | null) => void;
|
|
7
|
+
selectTab: (id: string, event: Parameters<NonNullable<TabsProps['onChange']>>[0]) => void;
|
|
8
|
+
};
|
|
9
|
+
export declare const TabsContext: import("react").Context<TabsContextValue | null>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type MutableRefObject, type RefObject } from 'react';
|
|
2
|
+
import type { TabProps, TabsProps } from '../types.js';
|
|
3
|
+
type TabIndicatorOptions = {
|
|
4
|
+
selectedId?: string;
|
|
5
|
+
items: readonly TabProps[];
|
|
6
|
+
size: NonNullable<TabsProps['size']>;
|
|
7
|
+
listRef: RefObject<HTMLDivElement>;
|
|
8
|
+
buttons: MutableRefObject<Map<string, HTMLButtonElement>>;
|
|
9
|
+
};
|
|
10
|
+
export declare function useTabIndicator({ selectedId, items, size, listRef, buttons, }: TabIndicatorOptions): RefObject<HTMLDivElement>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { useLayoutEffect, useRef } from "react";
|
|
2
|
+
function useTabIndicator({ selectedId, items, size, listRef, buttons }) {
|
|
3
|
+
const indicatorRef = useRef(null);
|
|
4
|
+
const indicatorPosition = useRef();
|
|
5
|
+
useLayoutEffect(()=>{
|
|
6
|
+
const list = listRef.current;
|
|
7
|
+
const indicator = indicatorRef.current;
|
|
8
|
+
const button = void 0 !== selectedId ? buttons.current.get(selectedId) : void 0;
|
|
9
|
+
if (!list || !indicator || !button || void 0 === selectedId) {
|
|
10
|
+
indicatorPosition.current = void 0;
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const updateIndicator = ()=>{
|
|
14
|
+
const left = button.offsetLeft;
|
|
15
|
+
const width = button.offsetWidth;
|
|
16
|
+
const previous = indicatorPosition.current;
|
|
17
|
+
if (previous?.element === indicator && previous.id === selectedId && previous.left === left && previous.width === width) return;
|
|
18
|
+
indicator.style.transition = previous?.element === indicator && previous.id !== selectedId ? '' : 'none';
|
|
19
|
+
indicator.style.width = `${width}px`;
|
|
20
|
+
indicator.style.transform = `translateX(${left}px)`;
|
|
21
|
+
indicatorPosition.current = {
|
|
22
|
+
id: selectedId,
|
|
23
|
+
left,
|
|
24
|
+
width,
|
|
25
|
+
element: indicator
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
updateIndicator();
|
|
29
|
+
if ("u" < typeof ResizeObserver) return;
|
|
30
|
+
const observer = new ResizeObserver(updateIndicator);
|
|
31
|
+
observer.observe(list);
|
|
32
|
+
for (const tab of buttons.current.values())observer.observe(tab);
|
|
33
|
+
return ()=>observer.disconnect();
|
|
34
|
+
}, [
|
|
35
|
+
items,
|
|
36
|
+
selectedId,
|
|
37
|
+
size,
|
|
38
|
+
listRef,
|
|
39
|
+
buttons
|
|
40
|
+
]);
|
|
41
|
+
return indicatorRef;
|
|
42
|
+
}
|
|
43
|
+
export { useTabIndicator };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import "./index_module.css";
|
|
2
|
+
const index_module = {
|
|
3
|
+
component: "component-mEZo4o",
|
|
4
|
+
list: "list-pbTqPB",
|
|
5
|
+
tab: "tab-yKhKqB",
|
|
6
|
+
size40: "size40-F0WNwL",
|
|
7
|
+
size48: "size48-cLRBaS",
|
|
8
|
+
selected: "selected-Lm0vXW",
|
|
9
|
+
counter: "counter-Tokn9i",
|
|
10
|
+
indicator: "indicator-LDebsI"
|
|
11
|
+
};
|
|
12
|
+
export default index_module;
|