@koslibs/components 1.6.0 → 1.8.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.
Files changed (53) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +85 -0
  3. package/dist/components/Button/button.js +20 -4
  4. package/dist/components/Button/index_module.css +1 -27
  5. package/dist/components/Collapse/collapse.js +3 -1
  6. package/dist/components/Collapse/index_module.css +2 -4
  7. package/dist/components/Input/index_module.css +9 -20
  8. package/dist/components/Input/input.d.ts +1 -1
  9. package/dist/components/Input/vars.css +7 -7
  10. package/dist/components/Modal/components/footer/index_module.css +1 -1
  11. package/dist/components/Modal/components/header/index.d.ts +1 -1
  12. package/dist/components/Modal/components/header/index_module.css +3 -3
  13. package/dist/components/Modal/index_module.css +2 -2
  14. package/dist/components/Popover/components/popover-surface/index.js +1 -1
  15. package/dist/components/Popover/{use-popover-position.d.ts → hooks/use-popover-position.d.ts} +1 -1
  16. package/dist/components/Spinner/preset_module.css +3 -1
  17. package/dist/components/Status/index.d.ts +2 -0
  18. package/dist/components/Status/index.js +1 -0
  19. package/dist/components/Status/index.module.js +25 -0
  20. package/dist/components/Status/index_module.css +109 -0
  21. package/dist/components/Status/status.d.ts +85 -0
  22. package/dist/components/Status/status.js +35 -0
  23. package/dist/components/Status/vars.css +36 -0
  24. package/dist/components/Tabs/context.d.ts +10 -0
  25. package/dist/components/Tabs/context.js +3 -0
  26. package/dist/components/Tabs/hooks/use-tab-indicator.d.ts +11 -0
  27. package/dist/components/Tabs/hooks/use-tab-indicator.js +43 -0
  28. package/dist/components/Tabs/index.d.ts +3 -0
  29. package/dist/components/Tabs/index.js +2 -0
  30. package/dist/components/Tabs/index.module.js +12 -0
  31. package/dist/components/Tabs/index_module.css +92 -0
  32. package/dist/components/Tabs/tab.d.ts +9 -0
  33. package/dist/components/Tabs/tab.js +38 -0
  34. package/dist/components/Tabs/tabs.d.ts +13 -0
  35. package/dist/components/Tabs/tabs.js +116 -0
  36. package/dist/components/Tabs/types.d.ts +61 -0
  37. package/dist/components/Tabs/types.js +0 -0
  38. package/dist/components/Tabs/vars.css +20 -0
  39. package/dist/components/Textarea/index_module.css +8 -19
  40. package/dist/components/Textarea/textarea.d.ts +1 -1
  41. package/dist/components/Typography/index.d.ts +1 -1
  42. package/dist/components/Typography/index_module.css +2 -2
  43. package/dist/components/Typography/preset.module.js +2 -0
  44. package/dist/components/Typography/preset_module.css +4 -0
  45. package/dist/components/Typography/shared.d.ts +1 -1
  46. package/dist/components/Typography/text.d.ts +1 -1
  47. package/dist/components/Typography/vars.css +1 -1
  48. package/dist/index.d.ts +4 -0
  49. package/dist/index.js +2 -0
  50. package/dist/styles/theme.css +1 -0
  51. package/dist/styles/variables.css +63 -0
  52. package/package.json +2 -1
  53. /package/dist/components/Popover/{use-popover-position.js → hooks/use-popover-position.js} +0 -0
@@ -0,0 +1,61 @@
1
+ import type { HTMLAttributes, MouseEvent, ReactNode } from 'react';
2
+ export type TabProps = {
3
+ /**
4
+ * Уникальный стабильный идентификатор вкладки.
5
+ */
6
+ id: string;
7
+ /**
8
+ * Текст заголовка вкладки.
9
+ */
10
+ title: ReactNode;
11
+ /**
12
+ * Неотрицательное целое число. Неизвестное значение скрывается, 0 отображается.
13
+ */
14
+ count?: number;
15
+ /**
16
+ * Запрещает выбор вкладки.
17
+ * @default false
18
+ */
19
+ disabled?: boolean;
20
+ };
21
+ export type TabsProps = Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'onChange'> & {
22
+ /**
23
+ * Дочерние Tab в порядке отображения. id должны быть уникальными.
24
+ * Поддерживаются массивы, условные элементы и Fragment.
25
+ */
26
+ children?: ReactNode;
27
+ /**
28
+ * Идентификатор активной вкладки в controlled-режиме.
29
+ */
30
+ selectedId?: string;
31
+ /**
32
+ * Начальная вкладка в uncontrolled-режиме. По умолчанию — первая доступная.
33
+ */
34
+ defaultSelectedId?: string;
35
+ /**
36
+ * Запрос выбора другой вкладки пользователем: событие и { selectedId }.
37
+ * В controlled-режиме обновите selectedId. Повторный выбор и изменение children
38
+ * не вызывают обработчик.
39
+ */
40
+ onChange?: (event: MouseEvent<HTMLButtonElement>, payload: {
41
+ selectedId: string;
42
+ }) => void;
43
+ /**
44
+ * Высота заголовков вкладок в пикселях.
45
+ * @default 40
46
+ */
47
+ size?: 40 | 48;
48
+ /**
49
+ * Общее пустое состояние, когда нет доступных вкладок.
50
+ */
51
+ emptyState?: ReactNode;
52
+ /**
53
+ * Класс ряда заголовков.
54
+ */
55
+ listClassName?: string;
56
+ /**
57
+ * Идентификатор корня. Части получают суффиксы -list, -indicator,
58
+ * -tab-{id}.
59
+ */
60
+ dataTestId?: string;
61
+ };
File without changes
@@ -0,0 +1,20 @@
1
+ :root {
2
+ --tabs-color: #1c1a18;
3
+ --tabs-muted-color: #736554;
4
+ --tabs-disabled-color: #9da099;
5
+ --tabs-indicator-color: #d95300;
6
+ --tabs-hover-indicator-color: #c8beaa;
7
+ --tabs-counter-background-color: #e0dbce;
8
+ --tabs-disabled-counter-background-color: #e0dbce73;
9
+ --tabs-divider-color: #e0dbce;
10
+ --tabs-height-40: 40px;
11
+ --tabs-height-48: 48px;
12
+ --tabs-padding: var(--size-12);
13
+ --tabs-gap: var(--size-8);
14
+ --tabs-border-radius: var(--border-radius-4);
15
+ --tabs-indicator-height: 2px;
16
+ --tabs-indicator-transition-duration: .2s;
17
+ --tabs-counter-padding: var(--size-6);
18
+ --tabs-counter-border-radius: var(--border-radius-pill);
19
+ }
20
+
@@ -108,11 +108,6 @@
108
108
  font-variant-numeric: tabular-nums;
109
109
  flex-shrink: 0;
110
110
  margin-left: auto;
111
- line-height: 16px;
112
- }
113
-
114
- .innerHeader-N47qW7 .counter-XxZoUu {
115
- line-height: 15px;
116
111
  }
117
112
 
118
113
  .label-fhdpHS {
@@ -122,7 +117,6 @@
122
117
  cursor: inherit;
123
118
  flex: 1;
124
119
  font-size: 13px;
125
- line-height: 16px;
126
120
  display: block;
127
121
  }
128
122
 
@@ -130,31 +124,27 @@
130
124
  white-space: nowrap;
131
125
  text-overflow: ellipsis;
132
126
  font-size: var(--textarea-font-size);
133
- line-height: var(--textarea-line-height);
134
- transition: transform .18s, font-size .18s, line-height .18s;
127
+ transition: transform .18s, font-size .18s;
135
128
  overflow: hidden;
136
129
  transform: translateY(7.5px);
137
130
 
138
131
  & > span {
139
132
  font-size: inherit;
140
- line-height: inherit;
141
133
  }
142
134
  }
143
135
 
144
136
  .component-K9LhZN[data-inner-label][data-filled] .label-fhdpHS, .component-K9LhZN[data-inner-label]:not([data-disabled], [data-read-only]) .value-pi9twE:focus-within .label-fhdpHS {
145
137
  font-size: 12px;
146
- line-height: 15px;
147
138
  transform: translateY(0);
148
139
  }
149
140
 
150
141
  .component-K9LhZN[data-inner-label] .value-pi9twE:has(.textarea-vCe_J9:autofill) .label-fhdpHS {
151
142
  font-size: 12px;
152
- line-height: 15px;
153
143
  transform: translateY(0);
154
144
  }
155
145
 
156
146
  .component-K9LhZN[data-inner-header] .textarea-vCe_J9 {
157
- margin-top: 15px;
147
+ margin-top: calc(var(--size-30) / 2);
158
148
  }
159
149
 
160
150
  .component-K9LhZN[data-inner-label] .textarea-vCe_J9::placeholder {
@@ -172,6 +162,9 @@
172
162
  min-width: 0;
173
163
  height: calc(var(--textarea-rows) * var(--textarea-line-height));
174
164
  min-height: calc(var(--textarea-rows) * var(--textarea-line-height));
165
+ margin: var(--size-0);
166
+ padding: var(--size-0);
167
+ border-radius: var(--border-radius-0);
175
168
  color: var(--field-color);
176
169
  font-family: var(--font-primary);
177
170
  font-size: var(--textarea-font-size);
@@ -184,10 +177,7 @@
184
177
  scrollbar-width: auto;
185
178
  background: none;
186
179
  border: 0;
187
- border-radius: 0;
188
180
  outline: none;
189
- margin: 0;
190
- padding: 0;
191
181
  display: block;
192
182
  overflow: auto;
193
183
 
@@ -216,8 +206,8 @@
216
206
  }
217
207
 
218
208
  &::-webkit-scrollbar-thumb {
209
+ border-radius: var(--border-radius-pill);
219
210
  background: var(--field-icon-color);
220
- border-radius: 999px;
221
211
  }
222
212
 
223
213
  &::placeholder {
@@ -247,11 +237,11 @@
247
237
  min-width: 0;
248
238
  height: 24px;
249
239
  min-height: 0;
240
+ margin: var(--size-0) var(--size-4-neg);
241
+ padding: var(--size-0);
250
242
  color: var(--field-icon-color);
251
243
  background: none;
252
244
  flex: 0 0 24px;
253
- margin: 0 -4px;
254
- padding: 0;
255
245
 
256
246
  &:hover, &:active {
257
247
  color: var(--field-icon-color);
@@ -267,7 +257,6 @@
267
257
  .component-K9LhZN .message-_mT8Ov {
268
258
  color: var(--input-hint-color);
269
259
  overflow-wrap: anywhere;
270
- line-height: 15px;
271
260
  }
272
261
 
273
262
  .component-K9LhZN[data-error] .message-_mT8Ov {
@@ -1,5 +1,5 @@
1
1
  import { type ChangeEvent, type MouseEvent } from 'react';
2
- export declare const Textarea: import("react").ForwardRefExoticComponent<Omit<import("react").TextareaHTMLAttributes<HTMLTextAreaElement>, "value" | "defaultValue" | "children" | "onChange" | "maxLength" | "rows"> & {
2
+ export declare const Textarea: import("react").ForwardRefExoticComponent<Omit<import("react").TextareaHTMLAttributes<HTMLTextAreaElement>, "children" | "defaultValue" | "onChange" | "value" | "maxLength" | "rows"> & {
3
3
  value?: string;
4
4
  defaultValue?: string;
5
5
  maxLength?: number;
@@ -14,7 +14,7 @@ export declare const Typography: {
14
14
  rowLimit?: 1 | 2 | 3;
15
15
  dataTestId?: string;
16
16
  } & {
17
- size?: 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 20;
17
+ size?: 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 20;
18
18
  tag?: "span" | "p" | "div" | "li";
19
19
  } & import("react").RefAttributes<import("./shared.js").TextElement>>;
20
20
  Title: import("react").ForwardRefExoticComponent<Omit<import("react").HTMLAttributes<HTMLElement>, "className" | "style" | "color" | "children"> & {
@@ -5,9 +5,9 @@
5
5
  margin: var(--size-0, 0px);
6
6
  padding: var(--size-0, 0px);
7
7
  font-family: var(--font-primary);
8
- font-style: normal;
9
- line-height: var(--typography-line-height);
10
8
  letter-spacing: var(--typography-letter-spacing);
9
+ font-style: normal;
10
+ line-height: normal;
11
11
  }
12
12
 
13
13
  .weight-regular-cOlAcy {
@@ -18,6 +18,8 @@ const preset_module = {
18
18
  size15: "size-15-DxWyW2",
19
19
  "size-16": "size-16-OgafBi",
20
20
  size16: "size-16-OgafBi",
21
+ "size-18": "size-18-MSiKUJ",
22
+ size18: "size-18-MSiKUJ",
21
23
  "size-20": "size-20-eTO0D7",
22
24
  size20: "size-20-eTO0D7",
23
25
  "size-24": "size-24-lZpjdx",
@@ -36,6 +36,10 @@
36
36
  font-size: var(--typography-font-size-16);
37
37
  }
38
38
 
39
+ .size-18-MSiKUJ {
40
+ font-size: var(--typography-font-size-18);
41
+ }
42
+
39
43
  .size-20-eTO0D7 {
40
44
  font-size: var(--typography-font-size-20);
41
45
  }
@@ -44,7 +44,7 @@ export type TextProps = BaseProps & {
44
44
  * Размер шрифта в пикселях.
45
45
  * @default 13
46
46
  */
47
- size?: 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 20;
47
+ size?: 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 20;
48
48
  /**
49
49
  * HTML-тег, определяющий семантику текста.
50
50
  * @default span
@@ -10,6 +10,6 @@ export declare const TypographyText: import("react").ForwardRefExoticComponent<O
10
10
  rowLimit?: 1 | 2 | 3;
11
11
  dataTestId?: string;
12
12
  } & {
13
- size?: 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 20;
13
+ size?: 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 20;
14
14
  tag?: "span" | "p" | "div" | "li";
15
15
  } & import("react").RefAttributes<TextElement>>;
@@ -1,5 +1,4 @@
1
1
  :root {
2
- --typography-line-height: normal;
3
2
  --typography-letter-spacing: 0;
4
3
  --typography-regular-font-weight: 400;
5
4
  --typography-medium-font-weight: 500;
@@ -19,6 +18,7 @@
19
18
  --typography-font-size-14: 14px;
20
19
  --typography-font-size-15: 15px;
21
20
  --typography-font-size-16: 16px;
21
+ --typography-font-size-18: 18px;
22
22
  --typography-font-size-20: 20px;
23
23
  --typography-font-size-24: 24px;
24
24
  --typography-font-size-28: 28px;
package/dist/index.d.ts CHANGED
@@ -4,8 +4,12 @@ export { Input } from './components/Input/index.js';
4
4
  export type { InputProps } from './components/Input/index.js';
5
5
  export { Textarea } from './components/Textarea/index.js';
6
6
  export type { TextareaProps } from './components/Textarea/index.js';
7
+ export { Tab, Tabs } from './components/Tabs/index.js';
8
+ export type { TabProps, TabsProps } from './components/Tabs/index.js';
7
9
  export { Spinner } from './components/Spinner/index.js';
8
10
  export type { SpinnerProps } from './components/Spinner/index.js';
11
+ export { Status } from './components/Status/index.js';
12
+ export type { StatusProps } from './components/Status/index.js';
9
13
  export { Typography, TypographyText, TypographyTitle, Text, Title } from './components/Typography/index.js';
10
14
  export type { TextProps, TitleProps, TypographyColor, TypographyWeight, } from './components/Typography/index.js';
11
15
  export { Popover } from './components/Popover/index.js';
package/dist/index.js CHANGED
@@ -1,7 +1,9 @@
1
1
  export { Button } from "./components/Button/index.js";
2
2
  export { Input } from "./components/Input/index.js";
3
3
  export { Textarea } from "./components/Textarea/index.js";
4
+ export { Tab, Tabs } from "./components/Tabs/index.js";
4
5
  export { Spinner } from "./components/Spinner/index.js";
6
+ export { Status } from "./components/Status/index.js";
5
7
  export { Text, Title, Typography, TypographyText, TypographyTitle } from "./components/Typography/index.js";
6
8
  export { Popover } from "./components/Popover/index.js";
7
9
  export { Collapse } from "./components/Collapse/index.js";
@@ -1,4 +1,5 @@
1
1
  @import "./fonts.css";
2
+ @import "./variables.css";
2
3
 
3
4
  @layer koslibs {
4
5
  :root {
@@ -0,0 +1,63 @@
1
+ @layer koslibs {
2
+ :root {
3
+ --size-0: 0;
4
+ --size-2: 2px;
5
+ --size-4: 4px;
6
+ --size-6: 6px;
7
+ --size-8: 8px;
8
+ --size-12: 12px;
9
+ --size-16: 16px;
10
+ --size-20: 20px;
11
+ --size-22: 22px;
12
+ --size-24: 24px;
13
+ --size-28: 28px;
14
+ --size-30: 30px;
15
+ --size-32: 32px;
16
+ --size-36: 36px;
17
+ --size-40: 40px;
18
+ --size-44: 44px;
19
+ --size-48: 48px;
20
+ --size-56: 56px;
21
+ --size-64: 64px;
22
+ --size-72: 72px;
23
+ --size-80: 80px;
24
+ --size-96: 96px;
25
+ --size-128: 128px;
26
+ --size-2-neg: -2px;
27
+ --size-4-neg: -4px;
28
+ --size-8-neg: -8px;
29
+ --size-12-neg: -12px;
30
+ --size-16-neg: -16px;
31
+ --size-20-neg: -20px;
32
+ --size-22-neg: -22px;
33
+ --size-24-neg: -24px;
34
+ --size-28-neg: -28px;
35
+ --size-32-neg: -32px;
36
+ --size-36-neg: -36px;
37
+ --size-40-neg: -40px;
38
+ --size-44-neg: -44px;
39
+ --size-48-neg: -48px;
40
+ --size-56-neg: -56px;
41
+ --size-64-neg: -64px;
42
+ --size-72-neg: -72px;
43
+ --size-80-neg: -80px;
44
+ --size-96-neg: -96px;
45
+ --size-128-neg: -128px;
46
+ --border-radius-0: 0;
47
+ --border-radius-2: 2px;
48
+ --border-radius-4: 4px;
49
+ --border-radius-6: 6px;
50
+ --border-radius-8: 8px;
51
+ --border-radius-10: 10px;
52
+ --border-radius-12: 12px;
53
+ --border-radius-16: 16px;
54
+ --border-radius-20: 20px;
55
+ --border-radius-24: 24px;
56
+ --border-radius-32: 32px;
57
+ --border-radius-36: 36px;
58
+ --border-radius-64: 64px;
59
+ --border-radius-circle: 50%;
60
+ --border-radius-pill: 99px;
61
+ }
62
+ }
63
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koslibs/components",
3
- "version": "1.6.0",
3
+ "version": "1.8.0",
4
4
  "description": "Shared React components for koslibs projects",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -11,6 +11,7 @@
11
11
  "import": "./dist/index.js"
12
12
  },
13
13
  "./theme.css": "./dist/styles/theme.css",
14
+ "./variables.css": "./dist/styles/variables.css",
14
15
  "./*": {
15
16
  "types": "./dist/components/*/index.d.ts",
16
17
  "import": "./dist/components/*/index.js"