@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.
Files changed (65) hide show
  1. package/dist/components/builders/Modal/Modal.js +3 -3
  2. package/dist/components/builders/Modal/ModalFooter/ModalFooter.js +7 -7
  3. package/dist/components/builders/Modal/ModalHeader/ModalHeader.js +15 -15
  4. package/dist/components/builders/Modal/ModalMain/styles.js +3 -3
  5. package/dist/components/builders/Modal/styles.js +2 -2
  6. package/dist/components/builders/Table/Table.js +66 -58
  7. package/dist/components/builders/Table/Table.utils.js +5 -5
  8. package/dist/components/builders/Table/TableBodyRow/TableBodyRow.js +5 -5
  9. package/dist/components/builders/Table/TableHeadRow/TableHeadRow.js +4 -4
  10. package/dist/components/builders/Table/TablePagination/TablePagination.js +44 -44
  11. package/dist/components/builders/Table/TableWrapper/TableWrapper.js +19 -19
  12. package/dist/components/charts/LineChart/constants.js +16 -16
  13. package/dist/components/charts/LineChart/utils.js +2 -2
  14. package/dist/components/charts/PieProgressChart/constants.js +16 -10
  15. package/dist/components/controls/Button/Button.js +56 -53
  16. package/dist/components/controls/Button/styles.js +4 -4
  17. package/dist/components/controls/Button/types.d.ts +2 -1
  18. package/dist/components/controls/Checkbox/styles.js +7 -7
  19. package/dist/components/controls/IconButton/styles.js +27 -27
  20. package/dist/components/controls/Input/styles.js +10 -10
  21. package/dist/components/controls/MarkdownTextEditor/MarkdownTextEditor.js +28 -28
  22. package/dist/components/controls/MarkdownTextEditor/components/EditorToolbar/ActionMenuButton/ActionMenuButton.js +13 -13
  23. package/dist/components/controls/MarkdownTextEditor/components/EditorToolbar/ActionMenuButton/ActionMenuButton.styles.js +2 -2
  24. package/dist/components/controls/MarkdownTextEditor/components/EditorToolbar/EditorToolbar.js +43 -43
  25. package/dist/components/controls/MarkdownTextEditor/nodes/CustomLinkNode/parts/CustomLinkNodeComponent/CustomLinkNodeComponent.styles.js +3 -3
  26. package/dist/components/controls/MarkdownTextEditor/nodes/ImageRowNode/parts/ImageRowNodeComponent/ImageRowNodeComponent.styles.js +2 -2
  27. package/dist/components/controls/MarkdownTextEditor/themes/editor.theme.js +1 -1
  28. package/dist/components/controls/OtpInput/styles.js +11 -11
  29. package/dist/components/controls/RadioGroup/Radio.d.ts +10 -1
  30. package/dist/components/controls/RadioGroup/Radio.js +78 -73
  31. package/dist/components/controls/SegmentControl/SegmentControl.js +12 -12
  32. package/dist/components/controls/SegmentControl/styles.js +8 -8
  33. package/dist/components/controls/Select/styles.js +19 -19
  34. package/dist/components/controls/Switch/styles.js +12 -12
  35. package/dist/components/controls/Tabs/Tabs.js +10 -10
  36. package/dist/components/shared/Avatar/Avatar.js +8 -8
  37. package/dist/components/shared/Badge/Badge.d.ts +1 -1
  38. package/dist/components/shared/Badge/Badge.js +75 -66
  39. package/dist/components/shared/Hint/styles.js +6 -6
  40. package/dist/components/shared/MarkdownText/MarkdownText.styles.js +4 -4
  41. package/dist/components/shared/Popover/PopoverContent/PopoverContent.js +2 -2
  42. package/dist/components/shared/Skeleton/Skeleton.js +11 -11
  43. package/dist/components/shared/Tag/Tag.js +14 -14
  44. package/dist/components/shared/Toast/Toast.js +30 -30
  45. package/dist/components/shared/Tooltip/Tooltip.js +28 -28
  46. package/dist/components/shared/Tooltip/constants.js +3 -3
  47. package/dist/index.js +37 -34
  48. package/dist/providers/ThemeProviderScoped/ThemeProviderScoped.const.d.ts +8 -0
  49. package/dist/providers/ThemeProviderScoped/ThemeProviderScoped.context.d.ts +12 -0
  50. package/dist/providers/ThemeProviderScoped/ThemeProviderScoped.context.js +12 -0
  51. package/dist/providers/ThemeProviderScoped/ThemeProviderScoped.d.ts +1 -1
  52. package/dist/providers/ThemeProviderScoped/ThemeProviderScoped.js +37 -26
  53. package/dist/providers/ThemeProviderScoped/ThemeProviderScoped.types.d.ts +30 -5
  54. package/dist/providers/ThemeProviderScoped/index.d.ts +1 -0
  55. package/dist/root.css +1 -1
  56. package/dist/ui-kit.cjs +8 -8
  57. package/dist/ui-kit.css +1 -1
  58. package/dist/utils/theme/index.d.ts +141 -141
  59. package/dist/utils/theme/index.js +14 -14
  60. package/dist/utils/theme/palette.d.ts +184 -0
  61. package/dist/utils/theme/palette.js +187 -0
  62. package/package.json +1 -1
  63. package/dist/providers/ThemeProviderScoped/styles.module.scss.js +0 -7
  64. package/dist/utils/theme/color.d.ts +0 -184
  65. package/dist/utils/theme/color.js +0 -187
@@ -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 D, FORMAT_TEXT_COMMAND as x } from "lexical";
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 P, useRef as V, useMemo as p, useCallback as b, Fragment as fe, useEffect as he } from "react";
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 Ae } from "../../nodes/CustomLinkNode/CustomLinkNode.utils.js";
15
- import { createImageRowNode as Le } from "../../nodes/ImageRowNode/ImageRowNode.utils.js";
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 Ne } from "./ActionMenuButton/ActionMenuButton.js";
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] = P(11), [v, T] = P(null), [C, A] = P(
31
+ const [d, Q] = B(11), [v, T] = B(null), [C, L] = B(
32
32
  null
33
- ), L = V(null), { toolbar: Y } = ve(), S = Y.preview, [r] = ce(), { isEditable: F, isPreviewMode: f, setPreviewMode: Z } = Me(), { availableActionGroups: N } = Te(), k = V(null), m = p(() => !F || f, [F, f]), ee = p(() => f ? S.hide : S.show, [f, S]), { toolbarGroups: y, menuGroups: $ } = p(() => {
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 N) {
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
- }, [N, d]), oe = p(() => typeof v == "number" && v > d - 1, [v, d]), te = p(() => typeof C == "number" && C > d - 1, [C, d]), G = b(
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 = Ae({
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
- ), _ = b(
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
- }), A(null);
69
+ }), L(null);
70
70
  },
71
71
  [r]
72
72
  ), j = b(() => {
73
- k.current && k.current.click();
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 = Le(s);
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(D, "left");
108
+ r.dispatchCommand(P, "left");
109
109
  },
110
110
  [c.ALIGN_CENTER]: () => {
111
- r.dispatchCommand(D, "center");
111
+ r.dispatchCommand(P, "center");
112
112
  },
113
113
  [c.ALIGN_RIGHT]: () => {
114
- r.dispatchCommand(D, "right");
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
- A(t);
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(() => y.map((e, t) => {
135
- const s = y.slice(0, t).reduce((n, a) => n + a.length, 0);
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: G }),
144
+ content: /* @__PURE__ */ o(q, { onSave: y }),
145
145
  placement: "bottom",
146
146
  open: v === h,
147
- onChange: (B) => {
148
- T(B ? h : null);
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: (B) => {
160
- A(B ? h : null);
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.neutralAlphaBasic
193
+ backgroundColor: E.border.neutral_alpha_basic
194
194
  }
195
195
  )
196
196
  ] }, e.flatMap((n) => n.id).join("-"));
197
197
  }), [
198
- y,
198
+ k,
199
199
  O,
200
200
  v,
201
201
  m,
202
202
  C,
203
- G,
204
- _
203
+ y,
204
+ G
205
205
  ]), H = b(() => {
206
- const e = L.current;
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 N)
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
- }, [N]), K = p(() => pe(H, 20, {}), [H]);
223
+ }, [A]), K = p(() => pe(H, 20, {}), [H]);
224
224
  return he(() => {
225
- if (!L.current)
225
+ if (!N.current)
226
226
  return;
227
227
  const e = new ResizeObserver(() => {
228
228
  K();
229
229
  });
230
- return e.observe(L.current), () => e.disconnect();
230
+ return e.observe(N.current), () => e.disconnect();
231
231
  }, [K]), /* @__PURE__ */ w(
232
232
  R,
233
233
  {
234
- backgroundColor: E.fill.neutralPrimary,
235
- border: `1px solid ${E.border.neutralAlphaBasic}`,
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: k,
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: G }),
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 || A(null);
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: L,
292
+ ref: N,
293
293
  children: [
294
294
  re,
295
295
  $.length ? /* @__PURE__ */ o(
296
- Ne,
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.accentHover
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.negativeHover
20
+ color: o.icon.negative_hover
21
21
  }
22
22
  }), x = e({
23
- boxShadow: `0 2px 10px 4px ${o.effect.shadowL}`,
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.negativeHover
15
+ color: o.icon.negative_hover
16
16
  }
17
17
  }), d = e({
18
- boxShadow: `0 2px 10px 4px ${o.effect.shadowL}`,
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.neutralPrimary}`,
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, l = {
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.neutralAlphaBasic}`,
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.accentPrimary,
21
- boxShadow: `0 0 0 1px ${r.border.accentPrimary}`
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.neutralPrimaryHover
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.negativePrimary
32
+ borderColor: r.border.negative_primary
33
33
  }),
34
34
  success: o({
35
- borderColor: r.border.positivePrimary
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.bgPrimary
42
+ background: r.fill.bg_primary
43
43
  }),
44
44
  gray: o({
45
- background: r.fill.bgSecondary
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.accentPrimary
54
+ background: r.fill.accent_primary
55
55
  })
56
56
  };
57
57
  export {
58
- l as styles
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 h, jsx as n } from "react/jsx-runtime";
2
- import { cx as E } from "@emotion/css";
3
- import { forwardRef as F } from "react";
4
- import { useRadioGroupContext as H } from "./context.js";
5
- import { styles as t } from "./styles.js";
6
- import { useControlled as J } from "../../../utils/hooks/useControlled.js";
7
- import { theme as K } from "../../../utils/theme/index.js";
8
- import { Box as c } from "../../builders/Box/Box.js";
9
- import { Text as g } from "../../builders/Text/Text.js";
10
- const { color: o, cornerRadius: x } = K, R = {
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
- }, Q = F(
23
+ }, Y = L(
20
24
  ({
21
- value: i,
22
- children: v,
23
- checked: s,
24
- defaultChecked: C,
25
- onChange: N,
25
+ value: s,
26
+ children: N,
27
+ checked: d,
28
+ defaultChecked: v,
29
+ onChange: C,
26
30
  disabled: k,
27
- className: S,
28
- description: m,
29
- size: w,
30
- side: z,
31
- readOnly: B,
31
+ className: B,
32
+ description: f,
33
+ size: I,
34
+ side: w,
35
+ readOnly: z,
32
36
  error: O,
33
- outerCircleClassName: T,
34
- innerCircleClassName: V,
35
- labelContainerClassName: j,
36
- labelClassName: G,
37
- descriptionClassName: I
38
- }, P) => {
39
- const r = H(), u = !!r, f = s !== void 0, [A, D] = J(
40
- s,
41
- C
42
- ), e = u ? r.value === i : f ? s : A, d = r?.disabled || k, l = w ?? r?.size ?? "md", L = z ?? r?.side ?? "left", b = B ?? r?.readOnly ?? !1, a = O ?? r?.error ?? !1, p = R[l].outer, y = R[l].inner, M = () => {
43
- d || b || (u ? r.setValue?.(i) : (f || D(!e), N?.(!e)));
44
- }, U = e && a ? o.fill.negativeTint : e ? o.fill.accentTint : o.fill.bgSecondary, W = e && a ? o.fill.negativePrimary : e ? o.fill.accentPrimary : void 0, q = e && a || a && !e ? o.border.negativeSecondary : o.border.neutralAlphaLow;
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__ */ h(
52
+ /* @__PURE__ */ _(
48
53
  "button",
49
54
  {
50
- ref: P,
55
+ ref: D,
51
56
  role: "radio",
52
57
  type: "button",
53
- "data-value": i,
58
+ "data-value": s,
54
59
  "aria-checked": e,
55
- "aria-disabled": d || void 0,
60
+ "aria-disabled": c || void 0,
56
61
  tabIndex: e ? 0 : -1,
57
- className: E([
58
- t.radio,
59
- e && t.checked,
60
- d && t.disabled,
61
- L === "right" && t.sideRight,
62
- b && t.readOnly,
63
- S
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: M,
70
+ onClick: A,
66
71
  children: [
67
- /* @__PURE__ */ n(
68
- c,
72
+ /* @__PURE__ */ l(
73
+ u,
69
74
  {
70
- w: p,
71
- h: p,
72
- backgroundColor: U,
73
- borderWidth: e ? 0 : 1,
74
- borderColor: q,
75
+ w: h,
76
+ h,
77
+ backgroundColor: E,
78
+ borderWidth: J,
79
+ borderColor: H,
75
80
  borderStyle: "solid",
76
81
  center: !0,
77
- borderRadius: x.fullRound,
78
- className: T,
79
- children: /* @__PURE__ */ n(
80
- c,
82
+ borderRadius: R.fullRound,
83
+ className: j,
84
+ children: /* @__PURE__ */ l(
85
+ u,
81
86
  {
82
- w: y,
83
- h: y,
84
- backgroundColor: W,
85
- borderRadius: x.fullRound,
87
+ w: g,
88
+ h: g,
89
+ backgroundColor: F,
90
+ borderRadius: R.fullRound,
86
91
  "aria-hidden": !0,
87
- className: V
92
+ className: G
88
93
  }
89
94
  )
90
95
  }
91
96
  ),
92
- /* @__PURE__ */ h(c, { alignItems: "flex-start", className: j, children: [
93
- /* @__PURE__ */ n(
94
- g,
97
+ /* @__PURE__ */ _(u, { alignItems: "flex-start", className: S, children: [
98
+ /* @__PURE__ */ l(
99
+ x,
95
100
  {
96
- variant: l === "sm" ? "body-2" : "body-1",
101
+ variant: a === "sm" ? "body-2" : "body-1",
97
102
  tag: "span",
98
103
  left: !0,
99
- className: G,
100
- children: v
104
+ className: T,
105
+ children: N
101
106
  }
102
107
  ),
103
- m && /* @__PURE__ */ n(
104
- g,
108
+ f && /* @__PURE__ */ l(
109
+ x,
105
110
  {
106
111
  tag: "span",
107
112
  variant: "body-2",
108
113
  colorName: "secondary",
109
- className: I,
110
- children: m
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
- Q.displayName = "Radio";
125
+ Y.displayName = "Radio";
121
126
  export {
122
- Q as Radio
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 C from "react";
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 R } from "../../../utils/theme/index.js";
7
- import { Text as j } from "../../builders/Text/Text.js";
8
- import { Ripple as k } from "../../builders/Ripple/Ripple.js";
9
- const { color: m, cornerRadius: T, spacing: d } = R;
10
- function P({
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: T.md,
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(C.Fragment, { children: [
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
- j,
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(k, { color: m.fill.bgOverlayPrimary })
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.bgTertiary,
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
- P as SegmentControl
89
+ q as SegmentControl
90
90
  };