@koslibs/components 1.7.0 → 1.9.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.
@@ -0,0 +1,25 @@
1
+ import "./index_module.css";
2
+ const index_module = {
3
+ component: "component-p4fC6J",
4
+ "size-20": "size-20-RGtFYL",
5
+ size20: "size-20-RGtFYL",
6
+ "size-24": "size-24-80Sg54",
7
+ size24: "size-24-80Sg54",
8
+ "size-32": "size-32-SU7Krr",
9
+ size32: "size-32-SU7Krr",
10
+ "size-40": "size-40-TbyUxw",
11
+ size40: "size-40-TbyUxw",
12
+ rectangular: "rectangular-ykPeeK",
13
+ rounded: "rounded-yFfN8M",
14
+ green: "green-Jd9YVz",
15
+ orange: "orange-tRGq_X",
16
+ red: "red-QhwnhH",
17
+ blue: "blue-AisEDx",
18
+ grey: "grey-T_mrQo",
19
+ teal: "teal-E4zwls",
20
+ purple: "purple-UK0BCp",
21
+ sand: "sand-Bcwhyf",
22
+ label: "label-Oml2a7",
23
+ addon: "addon-MKQxtF"
24
+ };
25
+ export default index_module;
@@ -0,0 +1,109 @@
1
+ @import "../../styles/theme.css";
2
+ @import "./vars.css";
3
+
4
+ .component-p4fC6J {
5
+ box-sizing: border-box;
6
+ vertical-align: middle;
7
+ width: fit-content;
8
+ min-width: 0;
9
+ max-width: 100%;
10
+ height: var(--status-height);
11
+ padding: 0 var(--status-padding);
12
+ justify-content: center;
13
+ align-items: center;
14
+ gap: var(--status-geometry-gap);
15
+ border-radius: var(--status-radius);
16
+ display: inline-flex;
17
+ }
18
+
19
+ .size-20-RGtFYL {
20
+ --status-height: var(--status-geometry-height-20);
21
+ --status-padding: var(--status-geometry-padding-20);
22
+ --status-rectangular-radius: var(--status-geometry-radius-rectangular-20);
23
+ --status-rounded-radius: var(--status-geometry-radius-rounded-20);
24
+ }
25
+
26
+ .size-24-80Sg54 {
27
+ --status-height: var(--status-geometry-height-24);
28
+ --status-padding: var(--status-geometry-padding-24);
29
+ --status-rectangular-radius: var(--status-geometry-radius-rectangular-24);
30
+ --status-rounded-radius: var(--status-geometry-radius-rounded-24);
31
+ }
32
+
33
+ .size-32-SU7Krr {
34
+ --status-height: var(--status-geometry-height-32);
35
+ --status-padding: var(--status-geometry-padding-32);
36
+ --status-rectangular-radius: var(--status-geometry-radius-rectangular-32);
37
+ --status-rounded-radius: var(--status-geometry-radius-rounded-32);
38
+ }
39
+
40
+ .size-40-TbyUxw {
41
+ --status-height: var(--status-geometry-height-40);
42
+ --status-padding: var(--status-geometry-padding-40);
43
+ --status-rectangular-radius: var(--status-geometry-radius-rectangular-40);
44
+ --status-rounded-radius: var(--status-geometry-radius-rounded-40);
45
+ }
46
+
47
+ .rectangular-ykPeeK {
48
+ --status-radius: var(--status-rectangular-radius);
49
+ }
50
+
51
+ .rounded-yFfN8M {
52
+ --status-radius: var(--status-rounded-radius);
53
+ }
54
+
55
+ .green-Jd9YVz {
56
+ background-color: var(--status-color-green-background);
57
+ color: var(--status-color-green-foreground);
58
+ }
59
+
60
+ .orange-tRGq_X {
61
+ background-color: var(--status-color-orange-background);
62
+ color: var(--status-color-orange-foreground);
63
+ }
64
+
65
+ .red-QhwnhH {
66
+ background-color: var(--status-color-red-background);
67
+ color: var(--status-color-red-foreground);
68
+ }
69
+
70
+ .blue-AisEDx {
71
+ background-color: var(--status-color-blue-background);
72
+ color: var(--status-color-blue-foreground);
73
+ }
74
+
75
+ .grey-T_mrQo {
76
+ background-color: var(--status-color-grey-background);
77
+ color: var(--status-color-grey-foreground);
78
+ }
79
+
80
+ .teal-E4zwls {
81
+ background-color: var(--status-color-teal-background);
82
+ color: var(--status-color-teal-foreground);
83
+ }
84
+
85
+ .purple-UK0BCp {
86
+ background-color: var(--status-color-purple-background);
87
+ color: var(--status-color-purple-foreground);
88
+ }
89
+
90
+ .sand-Bcwhyf {
91
+ background-color: var(--status-color-sand-background);
92
+ color: var(--status-color-sand-foreground);
93
+ }
94
+
95
+ .component-p4fC6J .label-Oml2a7 {
96
+ text-overflow: ellipsis;
97
+ white-space: nowrap;
98
+ min-width: 0;
99
+ line-height: normal;
100
+ overflow: hidden;
101
+ }
102
+
103
+ .addon-MKQxtF {
104
+ flex-shrink: 0;
105
+ justify-content: center;
106
+ align-items: center;
107
+ display: flex;
108
+ }
109
+
@@ -0,0 +1,85 @@
1
+ import { type HTMLAttributes, type ReactNode } from 'react';
2
+ export type StatusProps = Omit<HTMLAttributes<HTMLSpanElement>, 'children' | 'color'> & {
3
+ /**
4
+ * Высота плашки в пикселях.
5
+ * @default 24
6
+ */
7
+ size?: 20 | 24 | 32 | 40;
8
+ /**
9
+ * Форма плашки.
10
+ * @default 'rectangular'
11
+ */
12
+ shape?: 'rounded' | 'rectangular';
13
+ /**
14
+ * Цвет фона, подписи и аддонов.
15
+ * @default 'grey'
16
+ */
17
+ color?: 'green' | 'orange' | 'red' | 'blue' | 'grey' | 'teal' | 'purple' | 'sand';
18
+ /**
19
+ * Короткая подпись статуса. При ограничении ширины сокращается многоточием.
20
+ */
21
+ message: string;
22
+ /**
23
+ * Отображать подпись заглавными буквами.
24
+ * @default false
25
+ */
26
+ uppercase?: boolean;
27
+ /**
28
+ * Декоративный элемент слева от подписи, скрытый от скринридера.
29
+ */
30
+ leftAddon?: ReactNode;
31
+ /**
32
+ * Декоративный элемент справа от подписи, скрытый от скринридера.
33
+ */
34
+ rightAddon?: ReactNode;
35
+ /**
36
+ * Дополнительный CSS-класс подписи.
37
+ */
38
+ labelClassName?: string;
39
+ /**
40
+ * Идентификатор корневого элемента для тестов.
41
+ */
42
+ dataTestId?: string;
43
+ };
44
+ export declare const Status: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLSpanElement>, "color" | "children"> & {
45
+ /**
46
+ * Высота плашки в пикселях.
47
+ * @default 24
48
+ */
49
+ size?: 20 | 24 | 32 | 40;
50
+ /**
51
+ * Форма плашки.
52
+ * @default 'rectangular'
53
+ */
54
+ shape?: "rounded" | "rectangular";
55
+ /**
56
+ * Цвет фона, подписи и аддонов.
57
+ * @default 'grey'
58
+ */
59
+ color?: "green" | "orange" | "red" | "blue" | "grey" | "teal" | "purple" | "sand";
60
+ /**
61
+ * Короткая подпись статуса. При ограничении ширины сокращается многоточием.
62
+ */
63
+ message: string;
64
+ /**
65
+ * Отображать подпись заглавными буквами.
66
+ * @default false
67
+ */
68
+ uppercase?: boolean;
69
+ /**
70
+ * Декоративный элемент слева от подписи, скрытый от скринридера.
71
+ */
72
+ leftAddon?: ReactNode;
73
+ /**
74
+ * Декоративный элемент справа от подписи, скрытый от скринридера.
75
+ */
76
+ rightAddon?: ReactNode;
77
+ /**
78
+ * Дополнительный CSS-класс подписи.
79
+ */
80
+ labelClassName?: string;
81
+ /**
82
+ * Идентификатор корневого элемента для тестов.
83
+ */
84
+ dataTestId?: string;
85
+ } & import("react").RefAttributes<HTMLSpanElement>>;
@@ -0,0 +1,35 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import classnames from "classnames";
3
+ import { forwardRef } from "react";
4
+ import { TypographyText } from "../Typography/text.js";
5
+ import index_module from "./index.module.js";
6
+ function hasAddon(addon) {
7
+ return null != addon && 'boolean' != typeof addon;
8
+ }
9
+ const Status = /*#__PURE__*/ forwardRef(({ size = 24, shape = 'rectangular', color = 'grey', leftAddon, rightAddon, message, uppercase = false, className, labelClassName, dataTestId, ...restProps }, ref)=>/*#__PURE__*/ jsxs("span", {
10
+ ...restProps,
11
+ ref: ref,
12
+ className: classnames(index_module.component, index_module[`size-${size}`], index_module[shape], index_module[color], className),
13
+ "data-test-id": dataTestId,
14
+ children: [
15
+ hasAddon(leftAddon) && /*#__PURE__*/ jsx("span", {
16
+ className: index_module.addon,
17
+ "aria-hidden": "true",
18
+ children: leftAddon
19
+ }),
20
+ /*#__PURE__*/ jsx(TypographyText, {
21
+ size: size <= 24 ? 12 : 14,
22
+ weight: "medium",
23
+ caps: uppercase,
24
+ className: classnames(index_module.label, labelClassName),
25
+ children: message
26
+ }),
27
+ hasAddon(rightAddon) && /*#__PURE__*/ jsx("span", {
28
+ className: index_module.addon,
29
+ "aria-hidden": "true",
30
+ children: rightAddon
31
+ })
32
+ ]
33
+ }));
34
+ Status.displayName = 'Status';
35
+ export { Status };
@@ -0,0 +1,36 @@
1
+ :root {
2
+ --status-color-green-background: #d1f1d7;
3
+ --status-color-green-foreground: #08752a;
4
+ --status-color-orange-background: #ffe6cc;
5
+ --status-color-orange-foreground: #9a4600;
6
+ --status-color-red-background: #fde0df;
7
+ --status-color-red-foreground: #b42318;
8
+ --status-color-blue-background: #ddebff;
9
+ --status-color-blue-foreground: #175cd3;
10
+ --status-color-grey-background: #e9eaec;
11
+ --status-color-grey-foreground: #535862;
12
+ --status-color-teal-background: #d4f1ed;
13
+ --status-color-teal-foreground: #0b6b60;
14
+ --status-color-purple-background: #e9e2ff;
15
+ --status-color-purple-foreground: #6941c6;
16
+ --status-color-sand-background: #ede9de;
17
+ --status-color-sand-foreground: #736554;
18
+ --status-geometry-height-20: var(--size-20);
19
+ --status-geometry-height-24: var(--size-24);
20
+ --status-geometry-height-32: var(--size-32);
21
+ --status-geometry-height-40: var(--size-40);
22
+ --status-geometry-padding-20: var(--size-8);
23
+ --status-geometry-padding-24: var(--size-12);
24
+ --status-geometry-padding-32: var(--size-16);
25
+ --status-geometry-padding-40: var(--size-20);
26
+ --status-geometry-radius-rectangular-20: var(--border-radius-6);
27
+ --status-geometry-radius-rectangular-24: var(--border-radius-6);
28
+ --status-geometry-radius-rectangular-32: var(--border-radius-10);
29
+ --status-geometry-radius-rectangular-40: var(--border-radius-12);
30
+ --status-geometry-radius-rounded-20: var(--border-radius-10);
31
+ --status-geometry-radius-rounded-24: var(--border-radius-12);
32
+ --status-geometry-radius-rounded-32: var(--border-radius-16);
33
+ --status-geometry-radius-rounded-40: var(--border-radius-20);
34
+ --status-geometry-gap: var(--size-6);
35
+ }
36
+
package/dist/index.d.ts CHANGED
@@ -2,12 +2,16 @@ export { Button } from './components/Button/index.js';
2
2
  export type { ButtonProps } from './components/Button/index.js';
3
3
  export { Input } from './components/Input/index.js';
4
4
  export type { InputProps } from './components/Input/index.js';
5
+ export { Select } from './components/Select/index.js';
6
+ export type { SelectProps, SelectOption, SelectChangeEvent, SelectChangePayload, } from './components/Select/index.js';
5
7
  export { Textarea } from './components/Textarea/index.js';
6
8
  export type { TextareaProps } from './components/Textarea/index.js';
7
9
  export { Tab, Tabs } from './components/Tabs/index.js';
8
10
  export type { TabProps, TabsProps } from './components/Tabs/index.js';
9
11
  export { Spinner } from './components/Spinner/index.js';
10
12
  export type { SpinnerProps } from './components/Spinner/index.js';
13
+ export { Status } from './components/Status/index.js';
14
+ export type { StatusProps } from './components/Status/index.js';
11
15
  export { Typography, TypographyText, TypographyTitle, Text, Title } from './components/Typography/index.js';
12
16
  export type { TextProps, TitleProps, TypographyColor, TypographyWeight, } from './components/Typography/index.js';
13
17
  export { Popover } from './components/Popover/index.js';
package/dist/index.js CHANGED
@@ -1,8 +1,10 @@
1
1
  export { Button } from "./components/Button/index.js";
2
2
  export { Input } from "./components/Input/index.js";
3
+ export { Select } from "./components/Select/index.js";
3
4
  export { Textarea } from "./components/Textarea/index.js";
4
5
  export { Tab, Tabs } from "./components/Tabs/index.js";
5
6
  export { Spinner } from "./components/Spinner/index.js";
7
+ export { Status } from "./components/Status/index.js";
6
8
  export { Text, Title, Typography, TypographyText, TypographyTitle } from "./components/Typography/index.js";
7
9
  export { Popover } from "./components/Popover/index.js";
8
10
  export { Collapse } from "./components/Collapse/index.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koslibs/components",
3
- "version": "1.7.0",
3
+ "version": "1.9.0",
4
4
  "description": "Shared React components for koslibs projects",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",