@epam/ai-dial-ui-kit 0.15.0-dev.6 → 0.15.0-dev.9

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 (73) hide show
  1. package/README.md +140 -0
  2. package/dist/CHANGELOG.md +12 -0
  3. package/dist/{DateCellRenderer-BVM-Q8yx.cjs → DateCellRenderer-Bu40QyHE.cjs} +26 -26
  4. package/dist/DateCellRenderer-C3e61i75.cjs +1 -0
  5. package/dist/components/Dropdown/Dropdown.js +70 -65
  6. package/dist/components/Dropdown/DropdownSubMenuItem.js +63 -55
  7. package/dist/components/Dropdown/constants.js +14 -12
  8. package/dist/components/DropdownIcon/DropdownIcon.js +43 -32
  9. package/dist/components/New/Accordion/Accordion.js +39 -37
  10. package/dist/components/New/ButtonDropdown/ButtonDropdown.js +7 -6
  11. package/dist/components/New/Calendar/Calendar.js +253 -222
  12. package/dist/components/New/CaptionText/CaptionText.js +18 -15
  13. package/dist/components/New/CardShell/CardShell.js +4 -2
  14. package/dist/components/New/Checkbox/Checkbox.js +67 -56
  15. package/dist/components/New/Checkbox/CheckboxBox.js +4 -2
  16. package/dist/components/New/CloseButton/CloseButton.js +18 -16
  17. package/dist/components/New/CollapsibleSidebar/CollapsibleSidebar.js +39 -34
  18. package/dist/components/New/ConfirmationPopup/ConfirmationPopup.js +44 -39
  19. package/dist/components/New/Dropdown/Dropdown.js +101 -95
  20. package/dist/components/New/EllipsisTooltip/EllipsisTooltip.js +19 -17
  21. package/dist/components/New/FileDropzone/FileDropzone.js +27 -25
  22. package/dist/components/New/FilterChips/FilterChips.js +43 -0
  23. package/dist/components/New/FilterChips/constants.js +5 -0
  24. package/dist/components/New/FolderPath/FolderPath.js +29 -28
  25. package/dist/components/New/Highlight/Highlight.js +23 -30
  26. package/dist/components/New/InfoButton/InfoButton.js +12 -10
  27. package/dist/components/New/InlineSelect/InlineSelect.js +43 -41
  28. package/dist/components/New/InteractiveTooltip/InteractiveTooltip.js +40 -38
  29. package/dist/components/New/Label/Label.js +13 -8
  30. package/dist/components/New/MenuItem/MenuItem.js +29 -27
  31. package/dist/components/New/MenuItem/constants.js +9 -8
  32. package/dist/components/New/NoDataContent/NoDataContent.js +20 -18
  33. package/dist/components/New/Notification/Notification.js +18 -16
  34. package/dist/components/New/NumberInput/NumberInput.js +42 -33
  35. package/dist/components/New/PasswordInput/PasswordInput.js +41 -35
  36. package/dist/components/New/Popup/Popup.js +45 -43
  37. package/dist/components/New/Radio/Radio.js +75 -64
  38. package/dist/components/New/RadioGroup/RadioGroup.js +76 -65
  39. package/dist/components/New/RadioGroupPopupField/RadioGroupPopupField.js +117 -106
  40. package/dist/components/New/ResizableContainer/ResizableContainer.js +42 -40
  41. package/dist/components/New/Search/Search.js +28 -26
  42. package/dist/components/New/SegmentedControl/SegmentedControl.js +29 -23
  43. package/dist/components/New/Select/Select.js +120 -109
  44. package/dist/components/New/Switch/Switch.js +69 -58
  45. package/dist/components/New/Tabs/Tabs.js +28 -22
  46. package/dist/components/New/Tag/Tag.js +42 -40
  47. package/dist/components/New/TagInput/TagInput.js +44 -42
  48. package/dist/components/New/ToggleIconButton/ToggleIconButton.js +25 -23
  49. package/dist/components/New/Tooltip/TooltipContent.js +10 -8
  50. package/dist/components/ProgressBar/ProgressBar.js +45 -31
  51. package/dist/components/SchemaRenderer/components/SchemaAdditionalPropertiesEditor.js +46 -31
  52. package/dist/components/SchemaRenderer/components/SchemaKeyValueEditor.js +223 -135
  53. package/dist/components/SchemaRenderer/types.js +19 -8
  54. package/dist/components/SchemaRenderer/utils.js +121 -96
  55. package/dist/components/Skeleton/Skeleton.js +25 -19
  56. package/dist/components/Spinner/Spinner.js +6 -4
  57. package/dist/components-manifest.json +85 -2
  58. package/dist/constants/public-class-names.js +157 -0
  59. package/dist/dial-ui-kit.cjs +2 -2
  60. package/dist/dial-ui-kit.js +214 -210
  61. package/dist/file-manager.cjs +1 -1
  62. package/dist/grid.cjs +1 -1
  63. package/dist/index.css +1 -1
  64. package/dist/src/components/New/FilterChips/FilterChips.d.ts +69 -0
  65. package/dist/src/components/New/FilterChips/constants.d.ts +13 -0
  66. package/dist/src/components/SchemaRenderer/types.d.ts +11 -0
  67. package/dist/src/components/SchemaRenderer/utils.d.ts +5 -1
  68. package/dist/src/constants/public-class-names.d.ts +148 -0
  69. package/dist/src/index.d.ts +3 -0
  70. package/dist/use-file-manager-tabs-9DWkp9IJ.cjs +3 -0
  71. package/package.json +1 -1
  72. package/dist/DateCellRenderer-ssp7eaZY.cjs +0 -1
  73. package/dist/use-file-manager-tabs-DjdR_mYM.cjs +0 -3
@@ -1,6 +1,6 @@
1
- import { jsx as l, jsxs as g, Fragment as Be } from "react/jsx-runtime";
2
- import { IconChevronDown as _e } from "@tabler/icons-react";
3
- import { useId as je, useState as j, useCallback as f, useMemo as m, useEffect as Ke, useImperativeHandle as ze, Fragment as Ue } from "react";
1
+ import { jsx as l, jsxs as S, Fragment as _e } from "react/jsx-runtime";
2
+ import { IconChevronDown as Be } from "@tabler/icons-react";
3
+ import { useId as Ke, useState as K, useCallback as f, useMemo as m, useEffect as je, useImperativeHandle as ze, Fragment as Ue } from "react";
4
4
  import { Checkbox as Ve } from "../Checkbox/Checkbox.js";
5
5
  import { Dropdown as qe } from "../Dropdown/Dropdown.js";
6
6
  import { EllipsisTooltip as Ge } from "../EllipsisTooltip/EllipsisTooltip.js";
@@ -13,73 +13,74 @@ import { DialNoDataContent as Je } from "../../NoDataContent/NoDataContent.js";
13
13
  import { DIAL_KIT_ICON_STROKE as Xe } from "../constants/icon.js";
14
14
  import { DIAL_ICON_SIZE as re } from "../../../constants/icon.js";
15
15
  import { MenuItem as ae } from "../MenuItem/MenuItem.js";
16
- import { MenuItemMark as K } from "../../../types/menu-item.js";
17
- import { ElementSize as O } from "../../../types/size.js";
16
+ import { MenuItemMark as j } from "../../../types/menu-item.js";
17
+ import { ElementSize as k } from "../../../types/size.js";
18
18
  import { resolveAccessibleName as ie } from "../../../utils/accessible-name.js";
19
19
  import { mergeClasses as p } from "../../../utils/merge-classes.js";
20
20
  import { MultiSelectTags as Ye } from "./MultiSelectTags.js";
21
21
  import { SelectSubMenuItem as Pe } from "./SelectSubMenuItem.js";
22
22
  import { selectFieldIconClassName as el, selectListWidthClassName as ll, selectOverlayBaseClassName as tl, selectSearchThreshold as nl, selectSearchIcon as rl, selectCloseIcon as al, selectOptionBaseClassName as il, selectOptionsScrollClassName as ol, selectEmptyStateIcon as sl } from "./constants.js";
23
- const Fl = ({
23
+ import { DIAL_KIT_CLASS as cl } from "../../../constants/public-class-names.js";
24
+ const El = ({
24
25
  options: a,
25
26
  multiple: n = !1,
26
27
  id: oe,
27
- value: A,
28
+ value: O,
28
29
  defaultValue: se,
29
- size: z = O.Standard,
30
+ size: z = k.Standard,
30
31
  prefix: U,
31
32
  customSelectedValue: V,
32
33
  placeholder: ce = "Select...",
33
- labelProps: S,
34
+ labelProps: g,
34
35
  error: q,
35
36
  caption: de,
36
37
  ariaLabel: G,
37
38
  searchable: H = !1,
38
- searchSize: fe = O.Standard,
39
+ searchSize: fe = k.Standard,
39
40
  searchPlaceholder: Q,
40
41
  selectAll: me = !1,
41
42
  invalid: ue,
42
43
  selectAllLabel: he = "Select all",
43
- selectedOptionMark: R = K.Tint,
44
+ selectedOptionMark: R = j.Tint,
44
45
  emptyStateTitle: pe = "No options available",
45
46
  emptyStateDescription: ve,
46
47
  emptyStateIcon: be,
47
48
  disabled: v = !1,
48
49
  className: Ce,
49
50
  fieldClassName: Ne,
50
- listClassName: ge,
51
+ listClassName: Se,
51
52
  closable: D = !1,
52
- header: x,
53
- footer: I,
53
+ header: I,
54
+ footer: x,
54
55
  onClose: W,
55
56
  onChange: Z,
56
- dismissRef: Se,
57
+ dismissRef: ge,
57
58
  onFooterClick: J,
58
59
  open: X,
59
60
  onOpenChange: Y,
60
61
  onSearchQueryChange: P,
61
62
  customMultiSelectTagsRenderer: ee
62
63
  }) => {
63
- const xe = je(), u = oe || xe, le = `list-${u}`, te = z === O.Small, [Ie, we] = j(!1), F = X !== void 0, d = F ? !!X : Ie, c = f(
64
+ const Ie = Ke(), u = oe || Ie, le = `list-${u}`, te = z === k.Small, [xe, we] = K(!1), F = X !== void 0, d = F ? !!X : xe, c = f(
64
65
  (e) => {
65
66
  F || we(e), Y?.(e);
66
67
  },
67
68
  [F, Y]
68
- ), [h, ye] = j(""), L = f(
69
+ ), [h, ye] = K(""), L = f(
69
70
  (e) => {
70
71
  e !== h && (ye(e || ""), P?.(e || ""));
71
72
  },
72
73
  [P, h]
73
- ), E = A !== void 0, [Te, ke] = j(se), b = E ? A : Te, r = m(() => n ? Array.isArray(b) ? b : [] : typeof b == "string" ? [b] : [], [b, n]), w = m(() => {
74
+ ), E = O !== void 0, [Te, Ae] = K(se), b = E ? O : Te, r = m(() => n ? Array.isArray(b) ? b : [] : typeof b == "string" ? [b] : [], [b, n]), w = m(() => {
74
75
  const e = h.trim().toLowerCase();
75
76
  return e ? a.filter((t) => t.label.toLowerCase().includes(e)) : a;
76
77
  }, [a, h]);
77
- Ke(() => {
78
+ je(() => {
78
79
  d || L("");
79
80
  }, [d, L]);
80
81
  const s = f(
81
82
  (e) => {
82
- E || ke(e), Z?.(e);
83
+ E || Ae(e), Z?.(e);
83
84
  },
84
85
  [E, Z]
85
86
  ), $ = f(
@@ -98,25 +99,25 @@ const Fl = ({
98
99
  s("");
99
100
  return;
100
101
  }
101
- const k = r.filter((Me) => Me !== t);
102
- s(k);
102
+ const A = r.filter((Me) => Me !== t);
103
+ s(A);
103
104
  },
104
105
  [n, r, s]
105
106
  ), o = m(
106
107
  () => w.filter((e) => !e.disabled),
107
108
  [w]
108
- ), B = m(
109
+ ), _ = m(
109
110
  () => o.filter((e) => r.includes(e.value)).length,
110
111
  [o, r]
111
- ), { allSelectedInFiltered: _, someSelectedInFiltered: Oe } = m(() => {
112
- const e = o.length > 0 && B === o.length;
112
+ ), { allSelectedInFiltered: B, someSelectedInFiltered: ke } = m(() => {
113
+ const e = o.length > 0 && _ === o.length;
113
114
  return {
114
115
  allSelectedInFiltered: e,
115
- someSelectedInFiltered: B > 0 && !e
116
+ someSelectedInFiltered: _ > 0 && !e
116
117
  };
117
- }, [o, B]), Ae = f(() => {
118
+ }, [o, _]), Oe = f(() => {
118
119
  if (!(!n || o.length === 0))
119
- if (_) {
120
+ if (B) {
120
121
  const e = new Set(o.map((t) => t.value));
121
122
  s(r.filter((t) => !e.has(t)));
122
123
  } else {
@@ -124,7 +125,7 @@ const Fl = ({
124
125
  o.forEach((t) => e.add(t.value)), s(Array.from(e));
125
126
  }
126
127
  }, [
127
- _,
128
+ B,
128
129
  n,
129
130
  o,
130
131
  r,
@@ -143,7 +144,7 @@ const Fl = ({
143
144
  selectedValues: r,
144
145
  handleRemoveTag: M
145
146
  }
146
- ) }) : null : !i || !i.labelNode && !i.description ? null : /* @__PURE__ */ g("span", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
147
+ ) }) : null : !i || !i.labelNode && !i.description ? null : /* @__PURE__ */ S("span", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
147
148
  /* @__PURE__ */ l(
148
149
  Ge,
149
150
  {
@@ -160,11 +161,11 @@ const Fl = ({
160
161
  C,
161
162
  r,
162
163
  i
163
- ]), De = n || N ? "" : C || (V && A ? V : ""), Fe = typeof S?.label == "string" ? S.label : void 0, Le = N ? [
164
+ ]), De = n || N ? "" : C || (V && O ? V : ""), Fe = typeof g?.label == "string" ? g.label : void 0, Le = N ? [
164
165
  ie(G, Fe),
165
166
  n ? r.map((e) => a.find((t) => t.value === e)?.label ?? e).join(", ") : C
166
167
  ].filter(Boolean).join(", ") || void 0 : ie(G);
167
- ze(Se, () => ({
168
+ ze(ge, () => ({
168
169
  dismiss: () => {
169
170
  c(!1);
170
171
  }
@@ -174,7 +175,7 @@ const Fl = ({
174
175
  v || (e.key === "ArrowDown" || e.key === "ArrowUp") && (e.preventDefault(), d || c(!0));
175
176
  },
176
177
  [v, d, c]
177
- ), $e = () => /* @__PURE__ */ g(
178
+ ), $e = () => /* @__PURE__ */ S(
178
179
  "div",
179
180
  {
180
181
  id: le,
@@ -182,8 +183,8 @@ const Fl = ({
182
183
  "aria-multiselectable": n || void 0,
183
184
  className: tl,
184
185
  children: [
185
- x && /* @__PURE__ */ l(Be, { children: typeof x == "function" ? x() : x }),
186
- (H || D) && (a.length > nl || !!h) && /* @__PURE__ */ g("div", { className: "flex items-center gap-2 px-2 pt-2", children: [
186
+ I && /* @__PURE__ */ l(_e, { children: typeof I == "function" ? I() : I }),
187
+ (H || D) && (a.length > nl || !!h) && /* @__PURE__ */ S("div", { className: "flex items-center gap-2 px-2 pt-2", children: [
187
188
  H && /* @__PURE__ */ l(
188
189
  ne,
189
190
  {
@@ -202,7 +203,7 @@ const Fl = ({
202
203
  {
203
204
  "aria-label": "Close select",
204
205
  className: "shrink-0",
205
- size: O.Small,
206
+ size: k.Small,
206
207
  icon: al,
207
208
  onClick: (e) => {
208
209
  W?.(e), c(!1);
@@ -215,9 +216,9 @@ const Fl = ({
215
216
  {
216
217
  id: `${u}-selectAll`,
217
218
  labelProps: { label: he },
218
- isSelected: _,
219
- isIndeterminate: Oe,
220
- onChange: Ae
219
+ isSelected: B,
220
+ isIndeterminate: ke,
221
+ onChange: Oe
221
222
  }
222
223
  ) }),
223
224
  /* @__PURE__ */ l("div", { role: "none", className: ol, children: w.length === 0 ? /* @__PURE__ */ l("div", { className: "px-2 py-3", children: /* @__PURE__ */ l(
@@ -235,12 +236,12 @@ const Fl = ({
235
236
  {
236
237
  opt: e,
237
238
  selectedValues: r,
238
- mark: n ? K.Checkbox : R,
239
+ mark: n ? j.Checkbox : R,
239
240
  onSelect: $
240
241
  },
241
242
  e.value
242
243
  );
243
- const k = n ? (
244
+ const A = n ? (
244
245
  /*
245
246
  The row itself is the control: one `option` whose state rides on
246
247
  `aria-selected`, with a decorative box drawing the check. A real
@@ -256,7 +257,7 @@ const Fl = ({
256
257
  "aria-selected": t,
257
258
  "aria-disabled": !!e.disabled,
258
259
  disabled: e.disabled,
259
- mark: K.Checkbox,
260
+ mark: j.Checkbox,
260
261
  selected: t,
261
262
  icon: e.icon,
262
263
  label: e.labelNode ?? e.label,
@@ -289,91 +290,101 @@ const Fl = ({
289
290
  placement: e.interactiveTooltip.placement,
290
291
  content: e.interactiveTooltip.content,
291
292
  contentClassName: e.interactiveTooltip.contentClassName,
292
- children: k
293
+ children: A
293
294
  }
294
- ) : k }, e.value);
295
+ ) : A }, e.value);
295
296
  }) }),
296
- I && /* @__PURE__ */ l(
297
+ x && /* @__PURE__ */ l(
297
298
  "div",
298
299
  {
299
300
  onClick: (e) => {
300
301
  J?.(e), J && c(!1);
301
302
  },
302
- children: typeof I == "function" ? I() : I
303
+ children: typeof x == "function" ? x() : x
303
304
  }
304
305
  )
305
306
  ]
306
307
  }
307
308
  );
308
- return /* @__PURE__ */ g("div", { className: p("flex w-full flex-col gap-2", Ce), children: [
309
- S && /* @__PURE__ */ l(Ze, { ...S, htmlFor: u }),
310
- /* @__PURE__ */ g("div", { className: "flex flex-col gap-1", children: [
311
- /* @__PURE__ */ l(
312
- qe,
313
- {
314
- open: d,
315
- onOpenChange: c,
316
- disabled: v,
317
- closable: D,
318
- onClose: W,
319
- placement: "bottom-start",
320
- allowedPlacements: ["bottom-start", "top-start"],
321
- listClassName: p(ll, ge),
322
- className: "w-full",
323
- renderOverlay: $e,
324
- children: /* @__PURE__ */ l(
325
- ne,
309
+ return /* @__PURE__ */ S(
310
+ "div",
311
+ {
312
+ className: p(
313
+ cl.select,
314
+ "flex w-full flex-col gap-2",
315
+ Ce
316
+ ),
317
+ children: [
318
+ g && /* @__PURE__ */ l(Ze, { ...g, htmlFor: u }),
319
+ /* @__PURE__ */ S("div", { className: "flex flex-col gap-1", children: [
320
+ /* @__PURE__ */ l(
321
+ qe,
326
322
  {
327
- id: u,
328
- size: z,
323
+ open: d,
324
+ onOpenChange: c,
329
325
  disabled: v,
330
- invalid: ue,
331
- value: De,
332
- placeholder: N ? void 0 : ce,
333
- readOnly: !0,
334
- iconBefore: n ? void 0 : i?.icon,
335
- iconAfter: /* @__PURE__ */ l(
336
- _e,
326
+ closable: D,
327
+ onClose: W,
328
+ placement: "bottom-start",
329
+ allowedPlacements: ["bottom-start", "top-start"],
330
+ listClassName: p(ll, Se),
331
+ className: "w-full",
332
+ renderOverlay: $e,
333
+ children: /* @__PURE__ */ l(
334
+ ne,
337
335
  {
338
- size: te ? re.SM : re.MD,
339
- stroke: Xe,
340
- "aria-hidden": "true",
336
+ id: u,
337
+ size: z,
338
+ disabled: v,
339
+ invalid: ue,
340
+ value: De,
341
+ placeholder: N ? void 0 : ce,
342
+ readOnly: !0,
343
+ iconBefore: n ? void 0 : i?.icon,
344
+ iconAfter: /* @__PURE__ */ l(
345
+ Be,
346
+ {
347
+ size: te ? re.SM : re.MD,
348
+ stroke: Xe,
349
+ "aria-hidden": "true",
350
+ className: p(
351
+ el,
352
+ d && "rotate-180"
353
+ )
354
+ }
355
+ ),
356
+ role: "combobox",
357
+ "aria-haspopup": "listbox",
358
+ "aria-expanded": d,
359
+ "aria-controls": le,
360
+ "aria-autocomplete": "none",
361
+ "aria-label": Le,
362
+ containerClassName: "w-full",
363
+ wrapperClassName: p(
364
+ !v && "cursor-pointer",
365
+ n && y && [
366
+ "!h-auto flex-wrap py-1.5",
367
+ te ? "min-h-[24px]" : "min-h-[40px]"
368
+ ],
369
+ Ne
370
+ ),
341
371
  className: p(
342
- el,
343
- d && "rotate-180"
344
- )
372
+ "cursor-pointer",
373
+ N && "w-0 min-w-0 flex-none p-0"
374
+ ),
375
+ onKeyDown: Ee,
376
+ children: N
345
377
  }
346
- ),
347
- role: "combobox",
348
- "aria-haspopup": "listbox",
349
- "aria-expanded": d,
350
- "aria-controls": le,
351
- "aria-autocomplete": "none",
352
- "aria-label": Le,
353
- containerClassName: "w-full",
354
- wrapperClassName: p(
355
- !v && "cursor-pointer",
356
- n && y && [
357
- "!h-auto flex-wrap py-1.5",
358
- te ? "min-h-[24px]" : "min-h-[40px]"
359
- ],
360
- Ne
361
- ),
362
- className: p(
363
- "cursor-pointer",
364
- N && "w-0 min-w-0 flex-none p-0"
365
- ),
366
- onKeyDown: Ee,
367
- children: N
378
+ )
368
379
  }
369
- )
370
- }
371
- ),
372
- /* @__PURE__ */ l(Qe, { text: q }),
373
- !q && /* @__PURE__ */ l(Re, { text: de })
374
- ] })
375
- ] });
380
+ ),
381
+ /* @__PURE__ */ l(Qe, { text: q }),
382
+ !q && /* @__PURE__ */ l(Re, { text: de })
383
+ ] })
384
+ ]
385
+ }
386
+ );
376
387
  };
377
388
  export {
378
- Fl as Select
389
+ El as Select
379
390
  };
@@ -1,11 +1,12 @@
1
- import { jsxs as d, jsx as e } from "react/jsx-runtime";
1
+ import { jsxs as m, jsx as e } from "react/jsx-runtime";
2
2
  import { useId as b, useCallback as g } from "react";
3
3
  import { ElementSize as x } from "../../../types/size.js";
4
4
  import { mergeClasses as r } from "../../../utils/merge-classes.js";
5
5
  import { resolveAccessibleName as y } from "../../../utils/accessible-name.js";
6
6
  import { Label as v } from "../Label/Label.js";
7
- const S = ({
8
- id: m,
7
+ import { DIAL_KIT_CLASS as N } from "../../../constants/public-class-names.js";
8
+ const C = ({
9
+ id: d,
9
10
  labelProps: o,
10
11
  isOn: t = !1,
11
12
  disabled: l,
@@ -14,72 +15,82 @@ const S = ({
14
15
  className: u,
15
16
  ...i
16
17
  }) => {
17
- const p = b(), s = m ?? p, n = c ? `${s}-caption` : void 0, f = g(
18
+ const p = b(), s = d ?? p, n = c ? `${s}-caption` : void 0, f = g(
18
19
  (h) => {
19
20
  a?.(h.target.checked);
20
21
  },
21
22
  [a]
22
23
  );
23
- return /* @__PURE__ */ d("div", { className: "flex flex-col gap-1", children: [
24
- /* @__PURE__ */ d("div", { className: r("flex items-center gap-2", u), children: [
25
- /* @__PURE__ */ e(
26
- "input",
27
- {
28
- ...i,
29
- type: "checkbox",
30
- role: "switch",
31
- id: s,
32
- checked: t,
33
- "aria-checked": t,
34
- disabled: l,
35
- onChange: f,
36
- "aria-label": y(
37
- typeof o?.label != "string" ? i["aria-label"] : void 0
24
+ return /* @__PURE__ */ m("div", { className: "flex flex-col gap-1", children: [
25
+ /* @__PURE__ */ m(
26
+ "div",
27
+ {
28
+ className: r(
29
+ N.switch,
30
+ "flex items-center gap-2",
31
+ u
32
+ ),
33
+ children: [
34
+ /* @__PURE__ */ e(
35
+ "input",
36
+ {
37
+ ...i,
38
+ type: "checkbox",
39
+ role: "switch",
40
+ id: s,
41
+ checked: t,
42
+ "aria-checked": t,
43
+ disabled: l,
44
+ onChange: f,
45
+ "aria-label": y(
46
+ typeof o?.label != "string" ? i["aria-label"] : void 0
47
+ ),
48
+ "aria-describedby": n,
49
+ className: "peer sr-only"
50
+ }
38
51
  ),
39
- "aria-describedby": n,
40
- className: "peer sr-only"
41
- }
42
- ),
43
- /* @__PURE__ */ e(
44
- "label",
45
- {
46
- htmlFor: s,
47
- className: r(
48
- "flex h-[18px] w-[36px] shrink-0 items-center rounded-full p-0.5 transition-colors duration-200",
49
- "peer-focus-visible:outline peer-focus-visible:outline-offset-2 peer-focus-visible:outline-focus",
50
- t ? "justify-end" : "justify-start",
51
- l ? "cursor-not-allowed bg-control-disable-primary" : r(
52
- "cursor-pointer",
53
- t ? "bg-control-accent hover:bg-control-accent-hover" : "bg-control-neutral-default hover:bg-control-neutral-hover-strong"
54
- )
52
+ /* @__PURE__ */ e(
53
+ "label",
54
+ {
55
+ htmlFor: s,
56
+ className: r(
57
+ "flex h-[18px] w-[36px] shrink-0 items-center rounded-full p-0.5 transition-colors duration-200",
58
+ "peer-focus-visible:outline peer-focus-visible:outline-offset-2 peer-focus-visible:outline-focus",
59
+ t ? "justify-end" : "justify-start",
60
+ l ? "cursor-not-allowed bg-control-disable-primary" : r(
61
+ "cursor-pointer",
62
+ t ? "bg-control-accent hover:bg-control-accent-hover" : "bg-control-neutral-default hover:bg-control-neutral-hover-strong"
63
+ )
64
+ ),
65
+ children: /* @__PURE__ */ e(
66
+ "span",
67
+ {
68
+ className: r(
69
+ "size-3.5 shrink-0 rounded-full",
70
+ l ? "bg-control-disable-secondary" : "bg-control-neutral"
71
+ )
72
+ }
73
+ )
74
+ }
55
75
  ),
56
- children: /* @__PURE__ */ e(
57
- "span",
76
+ o && /* @__PURE__ */ e(
77
+ v,
58
78
  {
79
+ size: x.Standard,
80
+ ...o,
81
+ htmlFor: s,
59
82
  className: r(
60
- "size-3.5 shrink-0 rounded-full",
61
- l ? "bg-control-disable-secondary" : "bg-control-neutral"
83
+ // `Label` defaults to the secondary colour; the switch's own label
84
+ // has always been primary while the control is usable.
85
+ "py-[1px]",
86
+ l ? "cursor-not-allowed text-control-disable-primary" : "cursor-pointer text-primary",
87
+ o.className
62
88
  )
63
89
  }
64
90
  )
65
- }
66
- ),
67
- o && /* @__PURE__ */ e(
68
- v,
69
- {
70
- size: x.Standard,
71
- ...o,
72
- htmlFor: s,
73
- className: r(
74
- // `Label` defaults to the secondary colour; the switch's own label
75
- // has always been primary while the control is usable.
76
- "py-[1px]",
77
- l ? "cursor-not-allowed text-control-disable-primary" : "cursor-pointer text-primary",
78
- o.className
79
- )
80
- }
81
- )
82
- ] }),
91
+ ]
92
+ }
93
+ ),
83
94
  c && /* @__PURE__ */ e(
84
95
  "span",
85
96
  {
@@ -91,5 +102,5 @@ const S = ({
91
102
  ] });
92
103
  };
93
104
  export {
94
- S as Switch
105
+ C as Switch
95
106
  };
@@ -1,54 +1,59 @@
1
- import { jsx as u, jsxs as k } from "react/jsx-runtime";
2
- import { useRef as g, useCallback as w } from "react";
1
+ import { jsx as u, jsxs as g } from "react/jsx-runtime";
2
+ import { useRef as A, useCallback as w } from "react";
3
3
  import { mergeClasses as f } from "../../../utils/merge-classes.js";
4
- const A = ["ArrowRight", "ArrowLeft", "Home", "End"], R = ({
4
+ import { DIAL_KIT_CLASS as m } from "../../../constants/public-class-names.js";
5
+ const I = ["ArrowRight", "ArrowLeft", "Home", "End"], R = ({
5
6
  tabs: n,
6
7
  activeTabId: i,
7
- onTabChange: o,
8
+ onTabChange: l,
8
9
  ariaLabel: x,
9
- className: m,
10
- tabClassName: b
10
+ className: b,
11
+ tabClassName: y
11
12
  }) => {
12
- const p = g({}), a = n.find((e) => e.id === i), y = a && !a.disabled ? a.id : n.find((e) => !e.disabled)?.id, h = w(
13
+ const p = A({}), a = n.find((e) => e.id === i), h = a && !a.disabled ? a.id : n.find((e) => !e.disabled)?.id, k = w(
13
14
  (e) => {
14
- if (!A.includes(e.key) || n.length === 0) return;
15
+ if (!I.includes(e.key) || n.length === 0) return;
15
16
  const r = n.filter((c) => !c.disabled);
16
17
  if (r.length === 0) return;
17
18
  const t = Math.max(
18
19
  r.findIndex((c) => c.id === i),
19
20
  0
20
21
  ), s = r.length - 1;
21
- let l = t;
22
+ let o = t;
22
23
  switch (e.key) {
23
24
  case "ArrowRight":
24
- l = t === s ? 0 : t + 1;
25
+ o = t === s ? 0 : t + 1;
25
26
  break;
26
27
  case "ArrowLeft":
27
- l = t === 0 ? s : t - 1;
28
+ o = t === 0 ? s : t - 1;
28
29
  break;
29
30
  case "Home":
30
- l = 0;
31
+ o = 0;
31
32
  break;
32
33
  case "End":
33
- l = s;
34
+ o = s;
34
35
  break;
35
36
  }
36
37
  e.preventDefault();
37
- const d = r[l];
38
- p.current[d.id]?.focus(), d.id !== i && o(d.id);
38
+ const d = r[o];
39
+ p.current[d.id]?.focus(), d.id !== i && l(d.id);
39
40
  },
40
- [n, i, o]
41
+ [n, i, l]
41
42
  );
42
43
  return /* @__PURE__ */ u(
43
44
  "div",
44
45
  {
45
46
  role: "tablist",
46
47
  "aria-label": x,
47
- onKeyDown: h,
48
- className: f("flex justify-start gap-1", m),
48
+ onKeyDown: k,
49
+ className: f(
50
+ m.tabs,
51
+ "flex justify-start gap-1",
52
+ b
53
+ ),
49
54
  children: n.map((e) => {
50
55
  const r = i === e.id, t = !!e.disabled;
51
- return /* @__PURE__ */ k(
56
+ return /* @__PURE__ */ g(
52
57
  "button",
53
58
  {
54
59
  ref: (s) => {
@@ -58,16 +63,17 @@ const A = ["ArrowRight", "ArrowLeft", "Home", "End"], R = ({
58
63
  role: "tab",
59
64
  "aria-selected": r,
60
65
  disabled: t,
61
- tabIndex: e.id === y ? 0 : -1,
62
- onClick: () => o(e.id),
66
+ tabIndex: e.id === h ? 0 : -1,
67
+ onClick: () => l(e.id),
63
68
  className: f(
69
+ m.tab,
64
70
  "dial-small-paragraph-semi-text dial-kit-enhanced-target",
65
71
  "border-b-2 border-transparent flex items-center gap-2 px-3 py-2 text-start",
66
72
  "transition-colors motion-reduce:transition-none",
67
73
  "focus-visible:outline focus-visible:outline-offset-2 focus-visible:outline-focus",
68
74
  t && "cursor-not-allowed border-control-disable-primary text-control-disable-primary",
69
75
  !t && (r ? "dial-kit-tab-selected-underline text-primary" : "border-transparent text-secondary"),
70
- b
76
+ y
71
77
  ),
72
78
  children: [
73
79
  /* @__PURE__ */ u("span", { children: e.label }),