@dss-kit/ui-kit 0.3.9 → 1.0.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/dist/components/builders/Modal/Modal.js +3 -3
- package/dist/components/builders/Modal/ModalFooter/ModalFooter.js +7 -7
- package/dist/components/builders/Modal/ModalHeader/ModalHeader.js +15 -15
- package/dist/components/builders/Modal/ModalMain/styles.js +3 -3
- package/dist/components/builders/Modal/styles.js +2 -2
- package/dist/components/builders/Table/Table.js +66 -58
- package/dist/components/builders/Table/Table.utils.js +5 -5
- package/dist/components/builders/Table/TableBodyRow/TableBodyRow.js +5 -5
- package/dist/components/builders/Table/TableHeadRow/TableHeadRow.js +4 -4
- package/dist/components/builders/Table/TablePagination/TablePagination.js +44 -44
- package/dist/components/builders/Table/TableWrapper/TableWrapper.js +19 -19
- package/dist/components/charts/LineChart/constants.js +16 -16
- package/dist/components/charts/LineChart/utils.js +2 -2
- package/dist/components/charts/PieProgressChart/constants.js +16 -10
- package/dist/components/controls/Button/Button.js +56 -53
- package/dist/components/controls/Button/styles.js +4 -4
- package/dist/components/controls/Button/types.d.ts +2 -1
- package/dist/components/controls/Checkbox/styles.js +7 -7
- package/dist/components/controls/IconButton/styles.js +27 -27
- package/dist/components/controls/Input/styles.js +10 -10
- package/dist/components/controls/MarkdownTextEditor/MarkdownTextEditor.js +28 -28
- package/dist/components/controls/MarkdownTextEditor/components/EditorToolbar/ActionMenuButton/ActionMenuButton.js +13 -13
- package/dist/components/controls/MarkdownTextEditor/components/EditorToolbar/ActionMenuButton/ActionMenuButton.styles.js +2 -2
- package/dist/components/controls/MarkdownTextEditor/components/EditorToolbar/EditorToolbar.js +43 -43
- package/dist/components/controls/MarkdownTextEditor/nodes/CustomLinkNode/parts/CustomLinkNodeComponent/CustomLinkNodeComponent.styles.js +3 -3
- package/dist/components/controls/MarkdownTextEditor/nodes/ImageRowNode/parts/ImageRowNodeComponent/ImageRowNodeComponent.styles.js +2 -2
- package/dist/components/controls/MarkdownTextEditor/themes/editor.theme.js +1 -1
- package/dist/components/controls/OtpInput/styles.js +11 -11
- package/dist/components/controls/RadioGroup/Radio.d.ts +10 -1
- package/dist/components/controls/RadioGroup/Radio.js +78 -73
- package/dist/components/controls/SegmentControl/SegmentControl.js +12 -12
- package/dist/components/controls/SegmentControl/styles.js +8 -8
- package/dist/components/controls/Select/styles.js +19 -19
- package/dist/components/controls/Switch/styles.js +12 -12
- package/dist/components/controls/Tabs/Tabs.js +10 -10
- package/dist/components/shared/Avatar/Avatar.js +8 -8
- package/dist/components/shared/Badge/Badge.d.ts +1 -1
- package/dist/components/shared/Badge/Badge.js +75 -66
- package/dist/components/shared/Hint/styles.js +6 -6
- package/dist/components/shared/MarkdownText/MarkdownText.styles.js +4 -4
- package/dist/components/shared/Popover/PopoverContent/PopoverContent.js +2 -2
- package/dist/components/shared/Skeleton/Skeleton.js +11 -11
- package/dist/components/shared/Tag/Tag.js +14 -14
- package/dist/components/shared/Toast/Toast.js +30 -30
- package/dist/components/shared/Tooltip/Tooltip.js +28 -28
- package/dist/components/shared/Tooltip/constants.js +3 -3
- package/dist/index.js +37 -34
- package/dist/providers/ThemeProviderScoped/ThemeProviderScoped.const.d.ts +8 -0
- package/dist/providers/ThemeProviderScoped/ThemeProviderScoped.context.d.ts +12 -0
- package/dist/providers/ThemeProviderScoped/ThemeProviderScoped.context.js +12 -0
- package/dist/providers/ThemeProviderScoped/ThemeProviderScoped.d.ts +1 -1
- package/dist/providers/ThemeProviderScoped/ThemeProviderScoped.js +37 -26
- package/dist/providers/ThemeProviderScoped/ThemeProviderScoped.types.d.ts +30 -5
- package/dist/providers/ThemeProviderScoped/index.d.ts +1 -0
- package/dist/root.css +1 -1
- package/dist/ui-kit.cjs +8 -8
- package/dist/ui-kit.css +1 -1
- package/dist/utils/theme/index.d.ts +141 -141
- package/dist/utils/theme/index.js +14 -14
- package/dist/utils/theme/palette.d.ts +184 -0
- package/dist/utils/theme/palette.js +187 -0
- package/package.json +1 -1
- package/dist/providers/ThemeProviderScoped/styles.module.scss.js +0 -7
- package/dist/utils/theme/color.d.ts +0 -184
- package/dist/utils/theme/color.js +0 -187
package/dist/components/controls/MarkdownTextEditor/components/EditorToolbar/EditorToolbar.js
CHANGED
|
@@ -2,21 +2,21 @@ import { jsx as o, jsxs as w } from "react/jsx-runtime";
|
|
|
2
2
|
import { INSERT_ORDERED_LIST_COMMAND as ie, INSERT_UNORDERED_LIST_COMMAND as se } from "@lexical/list";
|
|
3
3
|
import { useLexicalComposerContext as ce } from "@lexical/react/LexicalComposerContext";
|
|
4
4
|
import { INSERT_TABLE_COMMAND as le } from "@lexical/table";
|
|
5
|
-
import { $getSelection as ae, $isRangeSelection as ue, $createTextNode as de, $insertNodes as me, FORMAT_ELEMENT_COMMAND as
|
|
5
|
+
import { $getSelection as ae, $isRangeSelection as ue, $createTextNode as de, $insertNodes as me, FORMAT_ELEMENT_COMMAND as P, FORMAT_TEXT_COMMAND as x } from "lexical";
|
|
6
6
|
import pe from "lodash.debounce";
|
|
7
|
-
import { useState as
|
|
7
|
+
import { useState as B, useRef as V, useMemo as p, useCallback as b, Fragment as fe, useEffect as he } from "react";
|
|
8
8
|
import be from "../../../../../assets/svg/markdown/eye.svg.js";
|
|
9
9
|
import { useMarkdownTextEditorLocale as ve } from "../../MarkdownTextEditor.locale.js";
|
|
10
10
|
import { previewStyles as Ce } from "./EditorToolbar.styles.js";
|
|
11
11
|
import { defaultOnImagesUpload as ge } from "./EditorToolbar.utils.js";
|
|
12
12
|
import { TextSizeSelect as Ee } from "./TextSizeSelect/TextSizeSelect.js";
|
|
13
13
|
import { useToolbarActions as Te } from "../../hooks/useToolbarActions/useToolbarActions.js";
|
|
14
|
-
import { createCustomLinkNode as
|
|
15
|
-
import { createImageRowNode as
|
|
14
|
+
import { createCustomLinkNode as Le } from "../../nodes/CustomLinkNode/CustomLinkNode.utils.js";
|
|
15
|
+
import { createImageRowNode as Ne } from "../../nodes/ImageRowNode/ImageRowNode.utils.js";
|
|
16
16
|
import { MarkdownToolbarAction as c } from "../../hooks/useToolbarActions/useToolbarActions.const.js";
|
|
17
17
|
import { LinkPopoverContent as q } from "./LinkPopoverContent/LinkPopoverContent.js";
|
|
18
18
|
import { TablePopoverContent as X } from "./TablePopoverContent/TablePopoverContent.js";
|
|
19
|
-
import { ActionMenuButton as
|
|
19
|
+
import { ActionMenuButton as Ae } from "./ActionMenuButton/ActionMenuButton.js";
|
|
20
20
|
import { useEditorStates as Me } from "../../contexts/EditorStateContext/EditorStateContext.hook.js";
|
|
21
21
|
import { Popover as I } from "../../../../shared/Popover/Popover.js";
|
|
22
22
|
import { IconButton as W } from "../../../IconButton/IconButton.js";
|
|
@@ -28,12 +28,12 @@ function eo({
|
|
|
28
28
|
onImagesUpload: U = ge,
|
|
29
29
|
className: J
|
|
30
30
|
}) {
|
|
31
|
-
const [d, Q] =
|
|
31
|
+
const [d, Q] = B(11), [v, T] = B(null), [C, L] = B(
|
|
32
32
|
null
|
|
33
|
-
),
|
|
33
|
+
), N = V(null), { toolbar: Y } = ve(), _ = Y.preview, [r] = ce(), { isEditable: F, isPreviewMode: f, setPreviewMode: Z } = Me(), { availableActionGroups: A } = Te(), S = V(null), m = p(() => !F || f, [F, f]), ee = p(() => f ? _.hide : _.show, [f, _]), { toolbarGroups: k, menuGroups: $ } = p(() => {
|
|
34
34
|
const e = [], t = [];
|
|
35
35
|
let s = 0;
|
|
36
|
-
for (const i of
|
|
36
|
+
for (const i of A) {
|
|
37
37
|
const l = [], n = [];
|
|
38
38
|
for (const a of i)
|
|
39
39
|
s += 1, s <= d ? l.push(a) : n.push(a);
|
|
@@ -43,13 +43,13 @@ function eo({
|
|
|
43
43
|
toolbarGroups: e,
|
|
44
44
|
menuGroups: t
|
|
45
45
|
};
|
|
46
|
-
}, [
|
|
46
|
+
}, [A, d]), oe = p(() => typeof v == "number" && v > d - 1, [v, d]), te = p(() => typeof C == "number" && C > d - 1, [C, d]), y = b(
|
|
47
47
|
(e) => {
|
|
48
48
|
const { text: t, url: s } = e;
|
|
49
49
|
r.update(() => {
|
|
50
50
|
const i = ae();
|
|
51
51
|
if (ue(i)) {
|
|
52
|
-
const l =
|
|
52
|
+
const l = Le({
|
|
53
53
|
text: t,
|
|
54
54
|
url: s
|
|
55
55
|
});
|
|
@@ -60,17 +60,17 @@ function eo({
|
|
|
60
60
|
}), T(null);
|
|
61
61
|
},
|
|
62
62
|
[r]
|
|
63
|
-
),
|
|
63
|
+
), G = b(
|
|
64
64
|
(e) => {
|
|
65
65
|
const { rows: t, columns: s } = e;
|
|
66
66
|
r.dispatchCommand(le, {
|
|
67
67
|
rows: t,
|
|
68
68
|
columns: s
|
|
69
|
-
}),
|
|
69
|
+
}), L(null);
|
|
70
70
|
},
|
|
71
71
|
[r]
|
|
72
72
|
), j = b(() => {
|
|
73
|
-
|
|
73
|
+
S.current && S.current.click();
|
|
74
74
|
}, []), ne = b(
|
|
75
75
|
async (e) => {
|
|
76
76
|
try {
|
|
@@ -79,7 +79,7 @@ function eo({
|
|
|
79
79
|
return;
|
|
80
80
|
const s = await U(t);
|
|
81
81
|
r.update(() => {
|
|
82
|
-
const i =
|
|
82
|
+
const i = Ne(s);
|
|
83
83
|
i && me([i]);
|
|
84
84
|
});
|
|
85
85
|
} catch (t) {
|
|
@@ -105,13 +105,13 @@ function eo({
|
|
|
105
105
|
r.dispatchCommand(x, "strikethrough");
|
|
106
106
|
},
|
|
107
107
|
[c.ALIGN_LEFT]: () => {
|
|
108
|
-
r.dispatchCommand(
|
|
108
|
+
r.dispatchCommand(P, "left");
|
|
109
109
|
},
|
|
110
110
|
[c.ALIGN_CENTER]: () => {
|
|
111
|
-
r.dispatchCommand(
|
|
111
|
+
r.dispatchCommand(P, "center");
|
|
112
112
|
},
|
|
113
113
|
[c.ALIGN_RIGHT]: () => {
|
|
114
|
-
r.dispatchCommand(
|
|
114
|
+
r.dispatchCommand(P, "right");
|
|
115
115
|
},
|
|
116
116
|
[c.LINK]: () => {
|
|
117
117
|
T(t);
|
|
@@ -120,7 +120,7 @@ function eo({
|
|
|
120
120
|
j();
|
|
121
121
|
},
|
|
122
122
|
[c.TABLE]: () => {
|
|
123
|
-
|
|
123
|
+
L(t);
|
|
124
124
|
},
|
|
125
125
|
[c.BULLET_LIST]: () => {
|
|
126
126
|
r.dispatchCommand(se, void 0);
|
|
@@ -131,8 +131,8 @@ function eo({
|
|
|
131
131
|
})[e]();
|
|
132
132
|
},
|
|
133
133
|
[j, r]
|
|
134
|
-
), re = p(() =>
|
|
135
|
-
const s =
|
|
134
|
+
), re = p(() => k.map((e, t) => {
|
|
135
|
+
const s = k.slice(0, t).reduce((n, a) => n + a.length, 0);
|
|
136
136
|
if (!e.length)
|
|
137
137
|
return null;
|
|
138
138
|
const i = e.map(
|
|
@@ -141,11 +141,11 @@ function eo({
|
|
|
141
141
|
return u === c.LINK ? /* @__PURE__ */ o(
|
|
142
142
|
I,
|
|
143
143
|
{
|
|
144
|
-
content: /* @__PURE__ */ o(q, { onSave:
|
|
144
|
+
content: /* @__PURE__ */ o(q, { onSave: y }),
|
|
145
145
|
placement: "bottom",
|
|
146
146
|
open: v === h,
|
|
147
|
-
onChange: (
|
|
148
|
-
T(
|
|
147
|
+
onChange: (D) => {
|
|
148
|
+
T(D ? h : null);
|
|
149
149
|
},
|
|
150
150
|
children: /* @__PURE__ */ o(W, { size: "xs", color: "no-bg", disabled: m, children: /* @__PURE__ */ o(n, {}) })
|
|
151
151
|
},
|
|
@@ -153,11 +153,11 @@ function eo({
|
|
|
153
153
|
) : u === c.TABLE ? /* @__PURE__ */ o(
|
|
154
154
|
I,
|
|
155
155
|
{
|
|
156
|
-
content: /* @__PURE__ */ o(X, { onSave:
|
|
156
|
+
content: /* @__PURE__ */ o(X, { onSave: G }),
|
|
157
157
|
placement: "bottom",
|
|
158
158
|
open: C === h,
|
|
159
|
-
onChange: (
|
|
160
|
-
|
|
159
|
+
onChange: (D) => {
|
|
160
|
+
L(D ? h : null);
|
|
161
161
|
},
|
|
162
162
|
children: /* @__PURE__ */ o(
|
|
163
163
|
W,
|
|
@@ -190,25 +190,25 @@ function eo({
|
|
|
190
190
|
{
|
|
191
191
|
w: 1,
|
|
192
192
|
h: 32,
|
|
193
|
-
backgroundColor: E.border.
|
|
193
|
+
backgroundColor: E.border.neutral_alpha_basic
|
|
194
194
|
}
|
|
195
195
|
)
|
|
196
196
|
] }, e.flatMap((n) => n.id).join("-"));
|
|
197
197
|
}), [
|
|
198
|
-
|
|
198
|
+
k,
|
|
199
199
|
O,
|
|
200
200
|
v,
|
|
201
201
|
m,
|
|
202
202
|
C,
|
|
203
|
-
|
|
204
|
-
|
|
203
|
+
y,
|
|
204
|
+
G
|
|
205
205
|
]), H = b(() => {
|
|
206
|
-
const e =
|
|
206
|
+
const e = N.current;
|
|
207
207
|
if (!e)
|
|
208
208
|
return;
|
|
209
209
|
const t = e.clientWidth, s = 40, i = 4, l = 1, n = i + l + i + s + i;
|
|
210
210
|
let a = t - n, u = 0;
|
|
211
|
-
for (const M of
|
|
211
|
+
for (const M of A)
|
|
212
212
|
if (M.length) {
|
|
213
213
|
for (const h of M) {
|
|
214
214
|
const g = s + i;
|
|
@@ -220,19 +220,19 @@ function eo({
|
|
|
220
220
|
a -= l + i;
|
|
221
221
|
}
|
|
222
222
|
Q(u);
|
|
223
|
-
}, [
|
|
223
|
+
}, [A]), K = p(() => pe(H, 20, {}), [H]);
|
|
224
224
|
return he(() => {
|
|
225
|
-
if (!
|
|
225
|
+
if (!N.current)
|
|
226
226
|
return;
|
|
227
227
|
const e = new ResizeObserver(() => {
|
|
228
228
|
K();
|
|
229
229
|
});
|
|
230
|
-
return e.observe(
|
|
230
|
+
return e.observe(N.current), () => e.disconnect();
|
|
231
231
|
}, [K]), /* @__PURE__ */ w(
|
|
232
232
|
R,
|
|
233
233
|
{
|
|
234
|
-
backgroundColor: E.fill.
|
|
235
|
-
border: `1px solid ${E.border.
|
|
234
|
+
backgroundColor: E.fill.neutral_primary,
|
|
235
|
+
border: `1px solid ${E.border.neutral_alpha_basic}`,
|
|
236
236
|
borderRadius: Ie.md,
|
|
237
237
|
flex: !0,
|
|
238
238
|
row: !0,
|
|
@@ -245,7 +245,7 @@ function eo({
|
|
|
245
245
|
/* @__PURE__ */ o(
|
|
246
246
|
"input",
|
|
247
247
|
{
|
|
248
|
-
ref:
|
|
248
|
+
ref: S,
|
|
249
249
|
type: "file",
|
|
250
250
|
accept: "image/*",
|
|
251
251
|
hidden: !0,
|
|
@@ -258,7 +258,7 @@ function eo({
|
|
|
258
258
|
/* @__PURE__ */ o(
|
|
259
259
|
I,
|
|
260
260
|
{
|
|
261
|
-
content: /* @__PURE__ */ o(q, { onSave:
|
|
261
|
+
content: /* @__PURE__ */ o(q, { onSave: y }),
|
|
262
262
|
placement: "bottom",
|
|
263
263
|
open: oe,
|
|
264
264
|
onChange: (e) => {
|
|
@@ -270,11 +270,11 @@ function eo({
|
|
|
270
270
|
/* @__PURE__ */ o(
|
|
271
271
|
I,
|
|
272
272
|
{
|
|
273
|
-
content: /* @__PURE__ */ o(X, { onSave:
|
|
273
|
+
content: /* @__PURE__ */ o(X, { onSave: G }),
|
|
274
274
|
placement: "bottom",
|
|
275
275
|
open: te,
|
|
276
276
|
onChange: (e) => {
|
|
277
|
-
e ||
|
|
277
|
+
e || L(null);
|
|
278
278
|
},
|
|
279
279
|
children: /* @__PURE__ */ o("div", {})
|
|
280
280
|
}
|
|
@@ -289,11 +289,11 @@ function eo({
|
|
|
289
289
|
w: "full",
|
|
290
290
|
ml: z.xs,
|
|
291
291
|
overflow: "hidden",
|
|
292
|
-
ref:
|
|
292
|
+
ref: N,
|
|
293
293
|
children: [
|
|
294
294
|
re,
|
|
295
295
|
$.length ? /* @__PURE__ */ o(
|
|
296
|
-
|
|
296
|
+
Ae,
|
|
297
297
|
{
|
|
298
298
|
disabled: m,
|
|
299
299
|
onAction: O,
|
|
@@ -8,7 +8,7 @@ const { color: o, cornerRadius: r, spacing: n, transition: c } = t, a = e({
|
|
|
8
8
|
}), l = e({
|
|
9
9
|
color: o.text.accent,
|
|
10
10
|
":hover": {
|
|
11
|
-
color: o.text.
|
|
11
|
+
color: o.text.accent_hover
|
|
12
12
|
}
|
|
13
13
|
}), p = e({
|
|
14
14
|
width: "16px",
|
|
@@ -17,10 +17,10 @@ const { color: o, cornerRadius: r, spacing: n, transition: c } = t, a = e({
|
|
|
17
17
|
cursor: "pointer",
|
|
18
18
|
transition: c.general,
|
|
19
19
|
":hover": {
|
|
20
|
-
color: o.icon.
|
|
20
|
+
color: o.icon.negative_hover
|
|
21
21
|
}
|
|
22
22
|
}), x = e({
|
|
23
|
-
boxShadow: `0 2px 10px 4px ${o.effect.
|
|
23
|
+
boxShadow: `0 2px 10px 4px ${o.effect.shadow_l}`,
|
|
24
24
|
borderRadius: r.md,
|
|
25
25
|
padding: n.sm
|
|
26
26
|
});
|
|
@@ -12,10 +12,10 @@ const { color: o, cornerRadius: t, spacing: i, transition: s } = r, p = e({
|
|
|
12
12
|
cursor: "pointer",
|
|
13
13
|
transition: s.general,
|
|
14
14
|
":hover": {
|
|
15
|
-
color: o.icon.
|
|
15
|
+
color: o.icon.negative_hover
|
|
16
16
|
}
|
|
17
17
|
}), d = e({
|
|
18
|
-
boxShadow: `0 2px 10px 4px ${o.effect.
|
|
18
|
+
boxShadow: `0 2px 10px 4px ${o.effect.shadow_l}`,
|
|
19
19
|
borderRadius: t.xs,
|
|
20
20
|
padding: i.xs
|
|
21
21
|
});
|
|
@@ -5,7 +5,7 @@ const { color: o, spacing: r } = l, n = t({
|
|
|
5
5
|
borderSpacing: "0",
|
|
6
6
|
borderCollapse: "separate"
|
|
7
7
|
}), i = t({
|
|
8
|
-
border: `1px solid ${o.border.
|
|
8
|
+
border: `1px solid ${o.border.neutral_primary}`,
|
|
9
9
|
padding: `${r.sm} ${r.sm}`
|
|
10
10
|
}), a = t({
|
|
11
11
|
color: o.text.accent
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { css as o } from "@emotion/css";
|
|
2
2
|
import { typography as e } from "../../../styles/utils/typography.js";
|
|
3
3
|
import { theme as i } from "../../../utils/theme/index.js";
|
|
4
|
-
const { color: r } = i,
|
|
4
|
+
const { color: r } = i, s = {
|
|
5
5
|
input: o({
|
|
6
6
|
...e.common,
|
|
7
7
|
...e.body1,
|
|
@@ -9,7 +9,7 @@ const { color: r } = i, l = {
|
|
|
9
9
|
height: 48,
|
|
10
10
|
textAlign: "center",
|
|
11
11
|
borderRadius: 12,
|
|
12
|
-
border: `1px solid ${r.border.
|
|
12
|
+
border: `1px solid ${r.border.neutral_alpha_basic}`,
|
|
13
13
|
color: r.text.primary,
|
|
14
14
|
outline: "none",
|
|
15
15
|
transition: "border-color 0.5s ease, background-color 0.5s ease, box-shadow 0.5s ease",
|
|
@@ -17,11 +17,11 @@ const { color: r } = i, l = {
|
|
|
17
17
|
color: r.text.tertiary
|
|
18
18
|
},
|
|
19
19
|
"&:focus-visible": {
|
|
20
|
-
borderColor: r.border.
|
|
21
|
-
boxShadow: `0 0 0 1px ${r.border.
|
|
20
|
+
borderColor: r.border.accent_primary,
|
|
21
|
+
boxShadow: `0 0 0 1px ${r.border.accent_primary}`
|
|
22
22
|
},
|
|
23
23
|
"&:not(.disabled):hover": {
|
|
24
|
-
backgroundColor: r.fill.
|
|
24
|
+
backgroundColor: r.fill.neutral_primary_hover
|
|
25
25
|
},
|
|
26
26
|
"&:disabled": {
|
|
27
27
|
opacity: 0.6,
|
|
@@ -29,20 +29,20 @@ const { color: r } = i, l = {
|
|
|
29
29
|
}
|
|
30
30
|
}),
|
|
31
31
|
error: o({
|
|
32
|
-
borderColor: r.border.
|
|
32
|
+
borderColor: r.border.negative_primary
|
|
33
33
|
}),
|
|
34
34
|
success: o({
|
|
35
|
-
borderColor: r.border.
|
|
35
|
+
borderColor: r.border.positive_primary
|
|
36
36
|
}),
|
|
37
37
|
disabled: o({
|
|
38
38
|
pointerEvents: "none",
|
|
39
39
|
opacity: 0.5
|
|
40
40
|
}),
|
|
41
41
|
white: o({
|
|
42
|
-
background: r.fill.
|
|
42
|
+
background: r.fill.bg_primary
|
|
43
43
|
}),
|
|
44
44
|
gray: o({
|
|
45
|
-
background: r.fill.
|
|
45
|
+
background: r.fill.bg_secondary
|
|
46
46
|
}),
|
|
47
47
|
glow: o({
|
|
48
48
|
position: "absolute",
|
|
@@ -51,9 +51,9 @@ const { color: r } = i, l = {
|
|
|
51
51
|
pointerEvents: "none",
|
|
52
52
|
opacity: 0,
|
|
53
53
|
transformOrigin: "center",
|
|
54
|
-
background: r.fill.
|
|
54
|
+
background: r.fill.accent_primary
|
|
55
55
|
})
|
|
56
56
|
};
|
|
57
57
|
export {
|
|
58
|
-
|
|
58
|
+
s as styles
|
|
59
59
|
};
|
|
@@ -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 _, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { cx as K } from "@emotion/css";
|
|
3
|
+
import { forwardRef as L } from "react";
|
|
4
|
+
import { useRadioGroupContext as P } from "./context.js";
|
|
5
|
+
import { styles as n } from "./styles.js";
|
|
6
|
+
import { useControlled as Q } from "../../../utils/hooks/useControlled.js";
|
|
7
|
+
import { theme as X } from "../../../utils/theme/index.js";
|
|
8
|
+
import { Box as u } from "../../builders/Box/Box.js";
|
|
9
|
+
import { Text as x } from "../../builders/Text/Text.js";
|
|
10
|
+
const { color: r, cornerRadius: R } = X, 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
|
+
}, Y = L(
|
|
20
24
|
({
|
|
21
|
-
value:
|
|
22
|
-
children:
|
|
23
|
-
checked:
|
|
24
|
-
defaultChecked:
|
|
25
|
-
onChange:
|
|
25
|
+
value: s,
|
|
26
|
+
children: N,
|
|
27
|
+
checked: d,
|
|
28
|
+
defaultChecked: v,
|
|
29
|
+
onChange: C,
|
|
26
30
|
disabled: k,
|
|
27
|
-
className:
|
|
28
|
-
description:
|
|
29
|
-
size:
|
|
30
|
-
side:
|
|
31
|
-
readOnly:
|
|
31
|
+
className: B,
|
|
32
|
+
description: f,
|
|
33
|
+
size: I,
|
|
34
|
+
side: w,
|
|
35
|
+
readOnly: z,
|
|
32
36
|
error: O,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
color: V = "accent",
|
|
38
|
+
outerCircleClassName: j,
|
|
39
|
+
innerCircleClassName: G,
|
|
40
|
+
labelContainerClassName: S,
|
|
41
|
+
labelClassName: T,
|
|
42
|
+
descriptionClassName: W
|
|
43
|
+
}, D) => {
|
|
44
|
+
const o = P(), b = !!o, p = d !== void 0, [M, U] = Q(
|
|
45
|
+
d,
|
|
46
|
+
v
|
|
47
|
+
), e = b ? o.value === s : p ? d : M, c = o?.disabled || k, a = I ?? o?.size ?? "md", q = w ?? o?.side ?? "left", y = z ?? o?.readOnly ?? !1, i = O ?? o?.error ?? !1, t = V === "neutral", h = m[a].outer, g = t ? m[a].neutralInner : m[a].inner, A = () => {
|
|
48
|
+
c || y || (b ? o.setValue?.(s) : (p || U(!e), C?.(!e)));
|
|
49
|
+
}, E = i ? e ? r.fill.negative_tint : r.fill.bg_secondary : e ? t ? r.fill.neutral_primary : r.fill.accent_tint : r.fill.bg_secondary, F = e ? i ? r.fill.negative_primary : t ? r.icon.secondary : r.fill.accent_primary : void 0, H = i ? r.border.negative_secondary : e && t ? r.border.neutral_primary : r.border.neutral_alpha_low, J = e && (!t || i) ? 0 : 1;
|
|
45
50
|
return (
|
|
46
51
|
// biome-ignore lint/a11y/useSemanticElements: <нарочное допущение тк с button проще работать чем с input>
|
|
47
|
-
/* @__PURE__ */
|
|
52
|
+
/* @__PURE__ */ _(
|
|
48
53
|
"button",
|
|
49
54
|
{
|
|
50
|
-
ref:
|
|
55
|
+
ref: D,
|
|
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: K([
|
|
63
|
+
n.radio,
|
|
64
|
+
e && n.checked,
|
|
65
|
+
c && n.disabled,
|
|
66
|
+
q === "right" && n.sideRight,
|
|
67
|
+
y && n.readOnly,
|
|
68
|
+
B
|
|
64
69
|
]),
|
|
65
|
-
onClick:
|
|
70
|
+
onClick: A,
|
|
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: E,
|
|
78
|
+
borderWidth: J,
|
|
79
|
+
borderColor: H,
|
|
75
80
|
borderStyle: "solid",
|
|
76
81
|
center: !0,
|
|
77
|
-
borderRadius:
|
|
78
|
-
className:
|
|
79
|
-
children: /* @__PURE__ */
|
|
80
|
-
|
|
82
|
+
borderRadius: R.fullRound,
|
|
83
|
+
className: j,
|
|
84
|
+
children: /* @__PURE__ */ l(
|
|
85
|
+
u,
|
|
81
86
|
{
|
|
82
|
-
w:
|
|
83
|
-
h:
|
|
84
|
-
backgroundColor:
|
|
85
|
-
borderRadius:
|
|
87
|
+
w: g,
|
|
88
|
+
h: g,
|
|
89
|
+
backgroundColor: F,
|
|
90
|
+
borderRadius: R.fullRound,
|
|
86
91
|
"aria-hidden": !0,
|
|
87
|
-
className:
|
|
92
|
+
className: G
|
|
88
93
|
}
|
|
89
94
|
)
|
|
90
95
|
}
|
|
91
96
|
),
|
|
92
|
-
/* @__PURE__ */
|
|
93
|
-
/* @__PURE__ */
|
|
94
|
-
|
|
97
|
+
/* @__PURE__ */ _(u, { alignItems: "flex-start", className: S, children: [
|
|
98
|
+
/* @__PURE__ */ l(
|
|
99
|
+
x,
|
|
95
100
|
{
|
|
96
|
-
variant:
|
|
101
|
+
variant: a === "sm" ? "body-2" : "body-1",
|
|
97
102
|
tag: "span",
|
|
98
103
|
left: !0,
|
|
99
|
-
className:
|
|
100
|
-
children:
|
|
104
|
+
className: T,
|
|
105
|
+
children: N
|
|
101
106
|
}
|
|
102
107
|
),
|
|
103
|
-
|
|
104
|
-
|
|
108
|
+
f && /* @__PURE__ */ l(
|
|
109
|
+
x,
|
|
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
|
+
Y.displayName = "Radio";
|
|
121
126
|
export {
|
|
122
|
-
|
|
127
|
+
Y as Radio
|
|
123
128
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as t, jsxs as c } from "react/jsx-runtime";
|
|
2
2
|
import { cx as l } from "@emotion/css";
|
|
3
|
-
import
|
|
3
|
+
import _ from "react";
|
|
4
4
|
import { styles as e } from "./styles.js";
|
|
5
5
|
import { Box as i } from "../../builders/Box/Box.js";
|
|
6
|
-
import { theme as
|
|
7
|
-
import { Text as
|
|
8
|
-
import { Ripple as
|
|
9
|
-
const { color: m, cornerRadius:
|
|
10
|
-
function
|
|
6
|
+
import { theme as C } from "../../../utils/theme/index.js";
|
|
7
|
+
import { Text as R } from "../../builders/Text/Text.js";
|
|
8
|
+
import { Ripple as j } from "../../builders/Ripple/Ripple.js";
|
|
9
|
+
const { color: m, cornerRadius: k, spacing: d } = C;
|
|
10
|
+
function q({
|
|
11
11
|
value: u,
|
|
12
12
|
onChange: f,
|
|
13
13
|
options: b,
|
|
@@ -26,13 +26,13 @@ function P({
|
|
|
26
26
|
{
|
|
27
27
|
row: !0,
|
|
28
28
|
alignItems: "center",
|
|
29
|
-
borderRadius:
|
|
29
|
+
borderRadius: k.md,
|
|
30
30
|
p: d.xs,
|
|
31
31
|
gap: d.md,
|
|
32
32
|
className: l(e[n], s && e["full-width"], p),
|
|
33
33
|
children: b.map((r) => {
|
|
34
34
|
const a = r.value === u, o = r.disabled, w = r.separatorAfter ?? !1;
|
|
35
|
-
return /* @__PURE__ */ c(
|
|
35
|
+
return /* @__PURE__ */ c(_.Fragment, { children: [
|
|
36
36
|
/* @__PURE__ */ c(
|
|
37
37
|
"button",
|
|
38
38
|
{
|
|
@@ -60,14 +60,14 @@ function P({
|
|
|
60
60
|
}
|
|
61
61
|
),
|
|
62
62
|
r.label && /* @__PURE__ */ t(
|
|
63
|
-
|
|
63
|
+
R,
|
|
64
64
|
{
|
|
65
65
|
colorName: a ? "primary" : "tertiary",
|
|
66
66
|
className: N,
|
|
67
67
|
children: r.label
|
|
68
68
|
}
|
|
69
69
|
),
|
|
70
|
-
!o && /* @__PURE__ */ t(
|
|
70
|
+
!o && /* @__PURE__ */ t(j, { color: m.fill.bg_overlay_primary })
|
|
71
71
|
]
|
|
72
72
|
}
|
|
73
73
|
),
|
|
@@ -76,7 +76,7 @@ function P({
|
|
|
76
76
|
{
|
|
77
77
|
w: 1,
|
|
78
78
|
h: 24,
|
|
79
|
-
backgroundColor: m.fill.
|
|
79
|
+
backgroundColor: m.fill.bg_tertiary,
|
|
80
80
|
className: v
|
|
81
81
|
}
|
|
82
82
|
)
|
|
@@ -86,5 +86,5 @@ function P({
|
|
|
86
86
|
);
|
|
87
87
|
}
|
|
88
88
|
export {
|
|
89
|
-
|
|
89
|
+
q as SegmentControl
|
|
90
90
|
};
|