@dss-kit/ui-kit 0.3.9 → 0.3.10
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/components/controls/Button/Button.js +66 -63
- package/dist/components/controls/Button/types.d.ts +2 -1
- package/dist/components/controls/MarkdownTextEditor/MarkdownTextEditor.js +6 -6
- package/dist/components/controls/RadioGroup/Radio.d.ts +10 -1
- package/dist/components/controls/RadioGroup/Radio.js +68 -63
- package/dist/components/shared/Badge/Badge.d.ts +1 -1
- package/dist/components/shared/Badge/Badge.js +51 -42
- package/dist/components/shared/MarkdownText/MarkdownText.js +10 -10
- package/dist/ui-kit.cjs +8 -8
- package/package.json +1 -1
|
@@ -1,88 +1,91 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { cx as
|
|
3
|
-
import { motion as
|
|
4
|
-
import { useMemo as
|
|
5
|
-
import { cornerRadiusValues as
|
|
6
|
-
import { Loader as
|
|
7
|
-
import { AnimatedText as
|
|
8
|
-
import { theme as
|
|
9
|
-
import { Box as
|
|
1
|
+
import { jsx as o, jsxs as b, Fragment as O } from "react/jsx-runtime";
|
|
2
|
+
import { cx as w, css as P } from "@emotion/css";
|
|
3
|
+
import { motion as k } from "framer-motion";
|
|
4
|
+
import { useMemo as n } from "react";
|
|
5
|
+
import { cornerRadiusValues as m, baseButton as q, getVariantStyles as D, typeStyles as E, sizeValues as G } from "./styles.js";
|
|
6
|
+
import { Loader as H } from "../../builders/Loader/Loader.js";
|
|
7
|
+
import { AnimatedText as I } from "../../builders/Text/Text.js";
|
|
8
|
+
import { theme as J } from "../../../utils/theme/index.js";
|
|
9
|
+
import { Box as K } from "../../builders/Box/Box.js";
|
|
10
10
|
import { Ripple as Q } from "../../builders/Ripple/Ripple.js";
|
|
11
|
-
const { color:
|
|
12
|
-
disabled:
|
|
11
|
+
const { color: u } = J, sr = ({
|
|
12
|
+
disabled: a,
|
|
13
13
|
loading: l,
|
|
14
14
|
className: g,
|
|
15
15
|
wrapperClassName: S,
|
|
16
16
|
buttonClassName: _,
|
|
17
17
|
buttonDisabledClassName: $,
|
|
18
18
|
textClassName: N,
|
|
19
|
-
children:
|
|
20
|
-
variant:
|
|
19
|
+
children: B,
|
|
20
|
+
variant: e = "filled",
|
|
21
21
|
backgroundColor: f,
|
|
22
22
|
textColor: d,
|
|
23
23
|
textFontWeight: U,
|
|
24
|
-
borderColor:
|
|
25
|
-
color:
|
|
24
|
+
borderColor: i,
|
|
25
|
+
color: r = "accent",
|
|
26
26
|
opacity: p,
|
|
27
27
|
borderRadius: x,
|
|
28
|
-
width:
|
|
28
|
+
width: c = "auto",
|
|
29
29
|
size: s = "md",
|
|
30
|
-
iconLeft:
|
|
30
|
+
iconLeft: v,
|
|
31
31
|
iconRight: R,
|
|
32
32
|
intensity: t = "primary",
|
|
33
33
|
flex: T,
|
|
34
34
|
type: V = "button",
|
|
35
35
|
...j
|
|
36
36
|
}) => {
|
|
37
|
-
const h =
|
|
38
|
-
switch (
|
|
37
|
+
const h = n(() => {
|
|
38
|
+
switch (c) {
|
|
39
39
|
case "full":
|
|
40
40
|
return "100%";
|
|
41
41
|
case "auto":
|
|
42
42
|
return "fit-content";
|
|
43
43
|
default:
|
|
44
|
-
return
|
|
44
|
+
return c;
|
|
45
45
|
}
|
|
46
|
-
}, [
|
|
46
|
+
}, [c]), A = n(() => f || (e === "filled" ? r === "neutral" ? u.fill.neutralSecondary : r === "neutral-primary" ? u.fill.neutralPrimary : `var(--fill-${r}-${t})` : "transparent"), [e, f, r, t]), F = n(() => {
|
|
47
47
|
if (t === "primary") {
|
|
48
|
-
if (
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return
|
|
52
|
-
|
|
48
|
+
if (r === "neutral" || r === "neutral-primary")
|
|
49
|
+
return u.text.secondary;
|
|
50
|
+
if (e === "filled") return u.text.inverse;
|
|
51
|
+
} else if (r === "neutral") return u.text.secondary;
|
|
52
|
+
return `var(--text-${r})`;
|
|
53
|
+
}, [t, r, e]), y = n(() => {
|
|
53
54
|
if (t === "primary") {
|
|
54
|
-
if (
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
if (r === "neutral" || r === "neutral-primary")
|
|
56
|
+
return "secondary";
|
|
57
|
+
if (e === "filled") return "inverse";
|
|
58
|
+
} else if (r === "neutral" || r === "neutral-primary")
|
|
59
|
+
return "secondary";
|
|
60
|
+
return r;
|
|
61
|
+
}, [e, r, t]), W = n(() => i || (e === "outline" ? r === "neutral-primary" ? u.border.neutralAlphaBasic : `var(--border-${r}-${t})` : "transparent"), [e, i, r, t]), C = n(() => {
|
|
59
62
|
switch (s) {
|
|
60
63
|
case "lg":
|
|
61
|
-
return
|
|
64
|
+
return m.lg;
|
|
62
65
|
case "md":
|
|
63
66
|
case "sm":
|
|
64
|
-
return
|
|
67
|
+
return m.md;
|
|
65
68
|
case "xs":
|
|
66
|
-
return
|
|
69
|
+
return m.sm;
|
|
67
70
|
default:
|
|
68
|
-
return
|
|
71
|
+
return m.md;
|
|
69
72
|
}
|
|
70
|
-
}, [s]), L =
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
borderRadius: x ?
|
|
77
|
-
backgroundColor:
|
|
78
|
-
borderColor:
|
|
79
|
-
color: d ?? `var(--text-${
|
|
73
|
+
}, [s]), L = w(
|
|
74
|
+
q,
|
|
75
|
+
D(e, r, t, a),
|
|
76
|
+
E[e],
|
|
77
|
+
a ? $ : void 0,
|
|
78
|
+
P({
|
|
79
|
+
borderRadius: x ? m[x] : C,
|
|
80
|
+
backgroundColor: A,
|
|
81
|
+
borderColor: W,
|
|
82
|
+
color: d ?? `var(--text-${y})`,
|
|
80
83
|
width: h,
|
|
81
|
-
height:
|
|
82
|
-
opacity: p || (
|
|
84
|
+
height: G[s],
|
|
85
|
+
opacity: p || (a ? 0.7 : 1)
|
|
83
86
|
}),
|
|
84
87
|
_
|
|
85
|
-
), M =
|
|
88
|
+
), M = n(() => {
|
|
86
89
|
switch (s) {
|
|
87
90
|
case "lg":
|
|
88
91
|
case "md":
|
|
@@ -94,44 +97,44 @@ const { color: m } = K, ue = ({
|
|
|
94
97
|
return "body-1";
|
|
95
98
|
}
|
|
96
99
|
}, [s]);
|
|
97
|
-
return /* @__PURE__ */
|
|
98
|
-
|
|
100
|
+
return /* @__PURE__ */ o(
|
|
101
|
+
K,
|
|
99
102
|
{
|
|
100
|
-
className:
|
|
103
|
+
className: w(S, g),
|
|
101
104
|
w: h,
|
|
102
105
|
flex: T,
|
|
103
106
|
relative: !0,
|
|
104
107
|
overflow: "hidden",
|
|
105
|
-
children: /* @__PURE__ */
|
|
106
|
-
|
|
108
|
+
children: /* @__PURE__ */ b(
|
|
109
|
+
k.button,
|
|
107
110
|
{
|
|
108
111
|
...j,
|
|
109
|
-
whileTap: !
|
|
112
|
+
whileTap: !a && !l ? {
|
|
110
113
|
scale: 0.99,
|
|
111
114
|
boxShadow: "inset 0 0 0 10000px rgba(0,0,0,0.1)",
|
|
112
115
|
transition: { duration: 0 }
|
|
113
116
|
} : {},
|
|
114
|
-
disabled:
|
|
117
|
+
disabled: a || l,
|
|
115
118
|
className: L,
|
|
116
119
|
type: V,
|
|
117
120
|
children: [
|
|
118
|
-
l ? /* @__PURE__ */
|
|
119
|
-
|
|
120
|
-
/* @__PURE__ */
|
|
121
|
-
|
|
121
|
+
l ? /* @__PURE__ */ o(H, { color: F }) : /* @__PURE__ */ b(O, { children: [
|
|
122
|
+
v,
|
|
123
|
+
/* @__PURE__ */ o(
|
|
124
|
+
I,
|
|
122
125
|
{
|
|
123
126
|
style: { color: d },
|
|
124
|
-
colorName:
|
|
127
|
+
colorName: y,
|
|
125
128
|
variant: M,
|
|
126
129
|
className: N,
|
|
127
130
|
textOverflow: "ellipsis",
|
|
128
131
|
overflow: "hidden",
|
|
129
|
-
children:
|
|
132
|
+
children: B
|
|
130
133
|
}
|
|
131
134
|
),
|
|
132
135
|
R
|
|
133
136
|
] }),
|
|
134
|
-
/* @__PURE__ */
|
|
137
|
+
/* @__PURE__ */ o(Q, {})
|
|
135
138
|
]
|
|
136
139
|
}
|
|
137
140
|
)
|
|
@@ -139,5 +142,5 @@ const { color: m } = K, ue = ({
|
|
|
139
142
|
);
|
|
140
143
|
};
|
|
141
144
|
export {
|
|
142
|
-
|
|
145
|
+
sr as Button
|
|
143
146
|
};
|
|
@@ -11,8 +11,9 @@ export type ButtonType = "clear" | "filled" | "outline";
|
|
|
11
11
|
* Использует системные токены:
|
|
12
12
|
* - `accent` — акцентный цвет
|
|
13
13
|
* - `neutral` — нейтральный
|
|
14
|
+
* - `neutral-primary` — нейтральный основной
|
|
14
15
|
* - `negative` — негативный (ошибки/отмена)
|
|
15
16
|
* - `positive` — позитивный (успех)
|
|
16
17
|
* - `warning` — предупреждение
|
|
17
18
|
*/
|
|
18
|
-
export type ButtonColor = AccentType | NeutralType | NegativeType | PositiveType | WarningType | TransferType;
|
|
19
|
+
export type ButtonColor = AccentType | NeutralType | "neutral-primary" | NegativeType | PositiveType | WarningType | TransferType;
|
|
@@ -8,10 +8,10 @@ import { MarkdownShortcutPlugin as U } from "@lexical/react/LexicalMarkdownShort
|
|
|
8
8
|
import { OnChangePlugin as W } from "@lexical/react/LexicalOnChangePlugin";
|
|
9
9
|
import { TablePlugin as H } from "@lexical/react/LexicalTablePlugin";
|
|
10
10
|
import { useState as u, useMemo as a, useCallback as p } from "react";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { getEditorConfig as K } from "./configs/editor.config.js";
|
|
12
|
+
import { MARKDOWN_TOOLBAR_DEFAULT_ACTIONS as q } from "./MarkdownTextEditor.const.js";
|
|
13
|
+
import { MarkdownTextEditorLocaleProvider as z } from "./MarkdownTextEditor.locale.js";
|
|
13
14
|
import { EDITOR_TRANSFORMERS as g } from "./transformers/index.js";
|
|
14
|
-
import { getEditorConfig as z } from "./configs/editor.config.js";
|
|
15
15
|
import { EditorStateContext as G } from "./contexts/EditorStateContext/EditorStateContext.js";
|
|
16
16
|
import { ToolbarContext as J } from "./contexts/ToolbarContext/ToolbarContext.js";
|
|
17
17
|
import { EditorToolbar as Q } from "./components/EditorToolbar/EditorToolbar.js";
|
|
@@ -40,7 +40,7 @@ function No({
|
|
|
40
40
|
fieldClassName: R,
|
|
41
41
|
previewClassName: v
|
|
42
42
|
}) {
|
|
43
|
-
const [d, A] = u(""), [i, N] = u(!1), { availableActions: s, onImagesUpload: O } = P || {}, I = a(() =>
|
|
43
|
+
const [d, A] = u(""), [i, N] = u(!1), { availableActions: s, onImagesUpload: O } = P || {}, I = a(() => K(), []), L = a(
|
|
44
44
|
() => ({
|
|
45
45
|
isEditable: !m,
|
|
46
46
|
isPreviewMode: i,
|
|
@@ -49,7 +49,7 @@ function No({
|
|
|
49
49
|
}),
|
|
50
50
|
[m, i, d]
|
|
51
51
|
), F = a(() => ({
|
|
52
|
-
availableActions: s ||
|
|
52
|
+
availableActions: s || q
|
|
53
53
|
}), [s]), f = p(
|
|
54
54
|
(t) => {
|
|
55
55
|
A(t), r.onMarkdownChange && r.onMarkdownChange(t);
|
|
@@ -64,7 +64,7 @@ function No({
|
|
|
64
64
|
},
|
|
65
65
|
[f, r]
|
|
66
66
|
);
|
|
67
|
-
return /* @__PURE__ */ o(
|
|
67
|
+
return /* @__PURE__ */ o(z, { locale: M, children: /* @__PURE__ */ o(D, { initialConfig: I, children: /* @__PURE__ */ o(G.Provider, { value: L, children: /* @__PURE__ */ c(J.Provider, { value: F, children: [
|
|
68
68
|
/* @__PURE__ */ c(
|
|
69
69
|
h,
|
|
70
70
|
{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { Size } from '../../../types';
|
|
2
|
+
import { AccentType, NeutralType, Size } from '../../../types';
|
|
3
3
|
/**
|
|
4
4
|
* Radio — доступная реализация визуального радио-переключателя.
|
|
5
5
|
*
|
|
@@ -44,6 +44,15 @@ export type RadioProps = {
|
|
|
44
44
|
* @default "left"
|
|
45
45
|
*/
|
|
46
46
|
side?: "left" | "right";
|
|
47
|
+
/**
|
|
48
|
+
* Цветовая схема радиокнопки в выбранном (checked) состоянии.
|
|
49
|
+
* - `accent` — заливка индикатора акцентным цветом (стандартное поведение).
|
|
50
|
+
* - `neutral` — индикатор остаётся незалитым: видимая нейтральная рамка
|
|
51
|
+
* (`border/neutral-primary`) и точка нейтрального цвета (`icon/secondary`)
|
|
52
|
+
* вместо заливки. Не влияет на состояние ошибки — `error` всегда приоритетнее.
|
|
53
|
+
* @default "accent"
|
|
54
|
+
*/
|
|
55
|
+
color?: AccentType | NeutralType;
|
|
47
56
|
/**
|
|
48
57
|
* Делает конкретное Radio доступной только для чтения.
|
|
49
58
|
* - Изменение выбранного значения запрещено.
|
|
@@ -1,113 +1,118 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { cx as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { useRadioGroupContext as
|
|
5
|
-
import { styles as
|
|
6
|
-
import { useControlled as
|
|
7
|
-
import { theme as
|
|
8
|
-
import { Box as
|
|
9
|
-
import { Text as
|
|
10
|
-
const { color:
|
|
1
|
+
import { jsxs as x, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { cx as J } from "@emotion/css";
|
|
3
|
+
import { forwardRef as K } from "react";
|
|
4
|
+
import { useRadioGroupContext as Q } from "./context.js";
|
|
5
|
+
import { styles as n } from "./styles.js";
|
|
6
|
+
import { useControlled as X } from "../../../utils/hooks/useControlled.js";
|
|
7
|
+
import { theme as Y } from "../../../utils/theme/index.js";
|
|
8
|
+
import { Box as u } from "../../builders/Box/Box.js";
|
|
9
|
+
import { Text as R } from "../../builders/Text/Text.js";
|
|
10
|
+
const { color: r, cornerRadius: N } = Y, m = {
|
|
11
11
|
sm: {
|
|
12
12
|
inner: 12,
|
|
13
|
+
// neutral: точка вдвое меньше, чем у accent (см. md — подтверждено в Figma)
|
|
14
|
+
neutralInner: 6,
|
|
13
15
|
outer: 20
|
|
14
16
|
},
|
|
15
17
|
md: {
|
|
16
18
|
inner: 16,
|
|
19
|
+
// neutral: 8px точка в 24px внешнем круге — Figma node 8677:5697, состояние Selected
|
|
20
|
+
neutralInner: 8,
|
|
17
21
|
outer: 24
|
|
18
22
|
}
|
|
19
|
-
},
|
|
23
|
+
}, Z = K(
|
|
20
24
|
({
|
|
21
|
-
value:
|
|
25
|
+
value: s,
|
|
22
26
|
children: v,
|
|
23
|
-
checked:
|
|
27
|
+
checked: d,
|
|
24
28
|
defaultChecked: C,
|
|
25
|
-
onChange:
|
|
26
|
-
disabled:
|
|
27
|
-
className:
|
|
28
|
-
description:
|
|
29
|
-
size:
|
|
30
|
-
side:
|
|
31
|
-
readOnly:
|
|
29
|
+
onChange: k,
|
|
30
|
+
disabled: B,
|
|
31
|
+
className: I,
|
|
32
|
+
description: f,
|
|
33
|
+
size: S,
|
|
34
|
+
side: w,
|
|
35
|
+
readOnly: z,
|
|
32
36
|
error: O,
|
|
37
|
+
color: P = "accent",
|
|
33
38
|
outerCircleClassName: T,
|
|
34
39
|
innerCircleClassName: V,
|
|
35
40
|
labelContainerClassName: j,
|
|
36
41
|
labelClassName: G,
|
|
37
|
-
descriptionClassName:
|
|
38
|
-
},
|
|
39
|
-
const
|
|
40
|
-
|
|
42
|
+
descriptionClassName: W
|
|
43
|
+
}, A) => {
|
|
44
|
+
const o = Q(), b = !!o, y = d !== void 0, [D, L] = X(
|
|
45
|
+
d,
|
|
41
46
|
C
|
|
42
|
-
), e =
|
|
43
|
-
|
|
44
|
-
},
|
|
47
|
+
), e = b ? o.value === s : y ? d : D, c = o?.disabled || B, a = S ?? o?.size ?? "md", M = w ?? o?.side ?? "left", p = z ?? o?.readOnly ?? !1, i = O ?? o?.error ?? !1, t = P === "neutral", h = m[a].outer, g = t ? m[a].neutralInner : m[a].inner, U = () => {
|
|
48
|
+
c || p || (b ? o.setValue?.(s) : (y || L(!e), k?.(!e)));
|
|
49
|
+
}, q = i ? e ? r.fill.negativeTint : r.fill.bgSecondary : e ? t ? r.fill.neutralPrimary : r.fill.accentTint : r.fill.bgSecondary, E = e ? i ? r.fill.negativePrimary : t ? r.icon.secondary : r.fill.accentPrimary : void 0, F = i ? r.border.negativeSecondary : e && t ? r.border.neutralPrimary : r.border.neutralAlphaLow, H = e && (!t || i) ? 0 : 1;
|
|
45
50
|
return (
|
|
46
51
|
// biome-ignore lint/a11y/useSemanticElements: <нарочное допущение тк с button проще работать чем с input>
|
|
47
|
-
/* @__PURE__ */
|
|
52
|
+
/* @__PURE__ */ x(
|
|
48
53
|
"button",
|
|
49
54
|
{
|
|
50
|
-
ref:
|
|
55
|
+
ref: A,
|
|
51
56
|
role: "radio",
|
|
52
57
|
type: "button",
|
|
53
|
-
"data-value":
|
|
58
|
+
"data-value": s,
|
|
54
59
|
"aria-checked": e,
|
|
55
|
-
"aria-disabled":
|
|
60
|
+
"aria-disabled": c || void 0,
|
|
56
61
|
tabIndex: e ? 0 : -1,
|
|
57
|
-
className:
|
|
58
|
-
|
|
59
|
-
e &&
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
className: J([
|
|
63
|
+
n.radio,
|
|
64
|
+
e && n.checked,
|
|
65
|
+
c && n.disabled,
|
|
66
|
+
M === "right" && n.sideRight,
|
|
67
|
+
p && n.readOnly,
|
|
68
|
+
I
|
|
64
69
|
]),
|
|
65
|
-
onClick:
|
|
70
|
+
onClick: U,
|
|
66
71
|
children: [
|
|
67
|
-
/* @__PURE__ */
|
|
68
|
-
|
|
72
|
+
/* @__PURE__ */ l(
|
|
73
|
+
u,
|
|
69
74
|
{
|
|
70
|
-
w:
|
|
71
|
-
h
|
|
72
|
-
backgroundColor:
|
|
73
|
-
borderWidth:
|
|
74
|
-
borderColor:
|
|
75
|
+
w: h,
|
|
76
|
+
h,
|
|
77
|
+
backgroundColor: q,
|
|
78
|
+
borderWidth: H,
|
|
79
|
+
borderColor: F,
|
|
75
80
|
borderStyle: "solid",
|
|
76
81
|
center: !0,
|
|
77
|
-
borderRadius:
|
|
82
|
+
borderRadius: N.fullRound,
|
|
78
83
|
className: T,
|
|
79
|
-
children: /* @__PURE__ */
|
|
80
|
-
|
|
84
|
+
children: /* @__PURE__ */ l(
|
|
85
|
+
u,
|
|
81
86
|
{
|
|
82
|
-
w:
|
|
83
|
-
h:
|
|
84
|
-
backgroundColor:
|
|
85
|
-
borderRadius:
|
|
87
|
+
w: g,
|
|
88
|
+
h: g,
|
|
89
|
+
backgroundColor: E,
|
|
90
|
+
borderRadius: N.fullRound,
|
|
86
91
|
"aria-hidden": !0,
|
|
87
92
|
className: V
|
|
88
93
|
}
|
|
89
94
|
)
|
|
90
95
|
}
|
|
91
96
|
),
|
|
92
|
-
/* @__PURE__ */
|
|
93
|
-
/* @__PURE__ */
|
|
94
|
-
|
|
97
|
+
/* @__PURE__ */ x(u, { alignItems: "flex-start", className: j, children: [
|
|
98
|
+
/* @__PURE__ */ l(
|
|
99
|
+
R,
|
|
95
100
|
{
|
|
96
|
-
variant:
|
|
101
|
+
variant: a === "sm" ? "body-2" : "body-1",
|
|
97
102
|
tag: "span",
|
|
98
103
|
left: !0,
|
|
99
104
|
className: G,
|
|
100
105
|
children: v
|
|
101
106
|
}
|
|
102
107
|
),
|
|
103
|
-
|
|
104
|
-
|
|
108
|
+
f && /* @__PURE__ */ l(
|
|
109
|
+
R,
|
|
105
110
|
{
|
|
106
111
|
tag: "span",
|
|
107
112
|
variant: "body-2",
|
|
108
113
|
colorName: "secondary",
|
|
109
|
-
className:
|
|
110
|
-
children:
|
|
114
|
+
className: W,
|
|
115
|
+
children: f
|
|
111
116
|
}
|
|
112
117
|
)
|
|
113
118
|
] })
|
|
@@ -117,7 +122,7 @@ const { color: o, cornerRadius: x } = K, R = {
|
|
|
117
122
|
);
|
|
118
123
|
}
|
|
119
124
|
);
|
|
120
|
-
|
|
125
|
+
Z.displayName = "Radio";
|
|
121
126
|
export {
|
|
122
|
-
|
|
127
|
+
Z as Radio
|
|
123
128
|
};
|
|
@@ -2,7 +2,7 @@ import { FC, MouseEvent, ReactNode } from 'react';
|
|
|
2
2
|
import { AccentType, NegativeType, NeutralType, PositiveType, Size, TransferType, WarningType } from '../../../types/tokens.types';
|
|
3
3
|
export type BadgeVariant = "filled" | "outline" | "clear";
|
|
4
4
|
export type BadgeColor = NeutralType | AccentType | WarningType | PositiveType | NegativeType | TransferType;
|
|
5
|
-
export type BadgeSize = Extract<Size, "sm" | "md" | "lg">;
|
|
5
|
+
export type BadgeSize = Extract<Size, "xs" | "sm" | "md" | "lg">;
|
|
6
6
|
export type BadgeTextAlign = "left" | "center" | "right";
|
|
7
7
|
export interface BadgeProps {
|
|
8
8
|
/** Содержимое лейбла бейджа. Текст всегда центрируется по вертикали внутри бейджа. */
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsxs as k, jsx as
|
|
2
|
-
import { cx as y, css as
|
|
1
|
+
import { jsxs as k, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { cx as y, css as x } from "@emotion/css";
|
|
3
3
|
import B from "../../../assets/svg/shared/close-outline.svg.js";
|
|
4
4
|
import { Box as L } from "../../builders/Box/Box.js";
|
|
5
5
|
import { theme as $ } from "../../../utils/theme/index.js";
|
|
6
6
|
import { Ripple as j } from "../../builders/Ripple/Ripple.js";
|
|
7
7
|
import { Text as h } from "../../builders/Text/Text.js";
|
|
8
|
-
const { color: e, cornerRadius:
|
|
8
|
+
const { color: e, cornerRadius: l, spacing: a } = $, b = {
|
|
9
9
|
neutral: {
|
|
10
10
|
border: e.border.neutralAlphaLow,
|
|
11
11
|
bg: e.status.neutralTint,
|
|
@@ -42,32 +42,42 @@ const { color: e, cornerRadius: g, spacing: l } = $, b = {
|
|
|
42
42
|
color: "var(--text-transfer)",
|
|
43
43
|
colorName: "transfer"
|
|
44
44
|
}
|
|
45
|
-
},
|
|
45
|
+
}, p = {
|
|
46
|
+
xs: {
|
|
47
|
+
h: 18,
|
|
48
|
+
text: "caption-2",
|
|
49
|
+
corner: l.xs,
|
|
50
|
+
p: `3px ${a.xs}`,
|
|
51
|
+
gap: "2px"
|
|
52
|
+
},
|
|
46
53
|
sm: {
|
|
47
54
|
h: 24,
|
|
48
55
|
text: "caption-1",
|
|
49
|
-
corner:
|
|
50
|
-
p: `6px ${
|
|
56
|
+
corner: l.xs,
|
|
57
|
+
p: `6px ${a.sm}`,
|
|
58
|
+
gap: a.sm
|
|
51
59
|
},
|
|
52
60
|
md: {
|
|
53
61
|
h: 32,
|
|
54
62
|
text: "body-2",
|
|
55
|
-
corner:
|
|
56
|
-
p: `6px ${
|
|
63
|
+
corner: l.sm,
|
|
64
|
+
p: `6px ${a.md}`,
|
|
65
|
+
gap: a.sm
|
|
57
66
|
},
|
|
58
67
|
lg: {
|
|
59
68
|
h: 40,
|
|
60
69
|
text: "body-2",
|
|
61
|
-
corner:
|
|
62
|
-
p: `6px ${
|
|
70
|
+
corner: l.md,
|
|
71
|
+
p: `6px ${a.lg}`,
|
|
72
|
+
gap: a.sm
|
|
63
73
|
}
|
|
64
|
-
}, R = (d,
|
|
65
|
-
const t = b[
|
|
66
|
-
let r = t.bg,
|
|
67
|
-
const
|
|
74
|
+
}, R = (d, s, o, m) => {
|
|
75
|
+
const t = b[s];
|
|
76
|
+
let r = t.bg, c = "none";
|
|
77
|
+
const i = t.color;
|
|
68
78
|
switch (d) {
|
|
69
79
|
case "outline":
|
|
70
|
-
r = "transparent",
|
|
80
|
+
r = "transparent", c = `1px solid ${t.border}`;
|
|
71
81
|
break;
|
|
72
82
|
case "clear":
|
|
73
83
|
r = "transparent";
|
|
@@ -76,64 +86,63 @@ const { color: e, cornerRadius: g, spacing: l } = $, b = {
|
|
|
76
86
|
r = t.bg;
|
|
77
87
|
break;
|
|
78
88
|
}
|
|
79
|
-
return
|
|
80
|
-
cursor: o ? "not-allowed" :
|
|
89
|
+
return x({
|
|
90
|
+
cursor: o ? "not-allowed" : m ? "pointer" : "default",
|
|
81
91
|
opacity: o ? 0.5 : 1,
|
|
82
92
|
userSelect: "none",
|
|
83
93
|
position: "relative",
|
|
84
94
|
transition: "background-color 0.2s, opacity 0.2s",
|
|
85
95
|
backgroundColor: r,
|
|
86
|
-
color:
|
|
87
|
-
border:
|
|
96
|
+
color: i,
|
|
97
|
+
border: c
|
|
88
98
|
});
|
|
89
|
-
}, I =
|
|
99
|
+
}, I = x({
|
|
90
100
|
display: "inline-flex",
|
|
91
101
|
cursor: "pointer",
|
|
92
102
|
opacity: 0.6,
|
|
93
103
|
"&:hover": { opacity: 1 }
|
|
94
|
-
}), w =
|
|
104
|
+
}), w = x({
|
|
95
105
|
display: "inline-flex",
|
|
96
106
|
alignItems: "center",
|
|
97
107
|
color: "inherit"
|
|
98
108
|
}), O = ({
|
|
99
109
|
label: d,
|
|
100
|
-
color:
|
|
110
|
+
color: s = "neutral",
|
|
101
111
|
size: o = "md",
|
|
102
|
-
variant:
|
|
112
|
+
variant: m = "filled",
|
|
103
113
|
width: t,
|
|
104
114
|
textAlign: r = "center",
|
|
105
|
-
leftElement:
|
|
106
|
-
rightElement:
|
|
107
|
-
disabled:
|
|
108
|
-
onClick:
|
|
115
|
+
leftElement: c,
|
|
116
|
+
rightElement: i,
|
|
117
|
+
disabled: u,
|
|
118
|
+
onClick: g,
|
|
109
119
|
onDelete: f,
|
|
110
120
|
className: N,
|
|
111
121
|
labelClassName: C,
|
|
112
122
|
deleteButtonClassName: S
|
|
113
123
|
}) => {
|
|
114
|
-
const T = R(
|
|
124
|
+
const T = R(m, s, u, g);
|
|
115
125
|
return /* @__PURE__ */ k(
|
|
116
126
|
L,
|
|
117
127
|
{
|
|
118
128
|
row: !0,
|
|
119
129
|
alignItems: "center",
|
|
120
130
|
justifyContent: "center",
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
h: i[o].h,
|
|
131
|
+
p: p[o].p,
|
|
132
|
+
h: p[o].h,
|
|
124
133
|
w: t,
|
|
125
134
|
overflow: "hidden",
|
|
126
|
-
borderRadius:
|
|
127
|
-
onClick:
|
|
135
|
+
borderRadius: p[o].corner,
|
|
136
|
+
onClick: g,
|
|
128
137
|
className: y(T, N),
|
|
129
138
|
children: [
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
/* @__PURE__ */
|
|
139
|
+
g && /* @__PURE__ */ n(j, {}),
|
|
140
|
+
c && /* @__PURE__ */ n("span", { className: w, children: c }),
|
|
141
|
+
/* @__PURE__ */ n(
|
|
133
142
|
h,
|
|
134
143
|
{
|
|
135
|
-
variant:
|
|
136
|
-
colorName: b[
|
|
144
|
+
variant: p[o].text,
|
|
145
|
+
colorName: b[s].colorName,
|
|
137
146
|
textOverflow: "ellipsis",
|
|
138
147
|
left: r === "left",
|
|
139
148
|
center: r === "center",
|
|
@@ -143,16 +152,16 @@ const { color: e, cornerRadius: g, spacing: l } = $, b = {
|
|
|
143
152
|
children: d
|
|
144
153
|
}
|
|
145
154
|
),
|
|
146
|
-
|
|
147
|
-
f && !
|
|
155
|
+
i && /* @__PURE__ */ n("span", { className: w, children: i }),
|
|
156
|
+
f && !u && /* @__PURE__ */ n(
|
|
148
157
|
h,
|
|
149
158
|
{
|
|
150
159
|
className: y(I, S),
|
|
151
|
-
colorName: b[
|
|
160
|
+
colorName: b[s].colorName,
|
|
152
161
|
onClick: (v) => {
|
|
153
162
|
v.stopPropagation(), f(v);
|
|
154
163
|
},
|
|
155
|
-
children: /* @__PURE__ */
|
|
164
|
+
children: /* @__PURE__ */ n(B, {})
|
|
156
165
|
}
|
|
157
166
|
)
|
|
158
167
|
]
|