@epam/ai-dial-ui-kit 0.15.0-dev.45 → 0.15.0-dev.47

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 (66) hide show
  1. package/README.md +2 -0
  2. package/dist/CHANGELOG.md +9 -0
  3. package/dist/{DateCellRenderer-Cl_mNbi1.cjs → DateCellRenderer-CZNa4jVJ.cjs} +1 -1
  4. package/dist/{DateCellRenderer-ChqbDlQ2.cjs → DateCellRenderer-X6vXPDIG.cjs} +1 -1
  5. package/dist/components/New/SchemaRenderer/SchemaRenderer.js +164 -0
  6. package/dist/components/New/SchemaRenderer/components/SchemaAnyOfEditor.js +65 -0
  7. package/dist/components/New/SchemaRenderer/components/SchemaArrayEditor.js +109 -0
  8. package/dist/components/New/SchemaRenderer/components/SchemaField.js +83 -0
  9. package/dist/components/New/SchemaRenderer/components/SchemaFieldContent.js +72 -0
  10. package/dist/components/New/SchemaRenderer/components/SchemaJsonEditor.js +41 -0
  11. package/dist/components/New/SchemaRenderer/components/SchemaKeyValueEditor.js +250 -0
  12. package/dist/components/New/SchemaRenderer/components/SchemaObjectEditor.js +36 -0
  13. package/dist/components/New/SchemaRenderer/components/SchemaOneOfEditor.js +163 -0
  14. package/dist/components/New/SchemaRenderer/components/SchemaPrimitiveField.js +150 -0
  15. package/dist/components/New/SchemaRenderer/components/SchemaSection.js +135 -0
  16. package/dist/components/New/SchemaRenderer/context.js +17 -0
  17. package/dist/components/New/Slider/Slider.js +151 -90
  18. package/dist/components/New/Slider/utils.js +12 -0
  19. package/dist/components/New/Textarea/Textarea.js +21 -20
  20. package/dist/components/SchemaRenderer/SchemaRenderer.js +16 -15
  21. package/dist/components/SchemaRenderer/components/SchemaAnyOfEditor.js +2 -2
  22. package/dist/components/SchemaRenderer/components/SchemaArrayEditor.js +1 -1
  23. package/dist/components/SchemaRenderer/components/SchemaField.js +8 -8
  24. package/dist/components/SchemaRenderer/components/SchemaFieldContent.js +2 -2
  25. package/dist/components/SchemaRenderer/components/SchemaKeyValueEditor.js +2 -2
  26. package/dist/components/SchemaRenderer/components/SchemaObjectEditor.js +1 -1
  27. package/dist/components/SchemaRenderer/components/SchemaOneOfEditor.js +13 -13
  28. package/dist/components/SchemaRenderer/components/SchemaPrimitiveField.js +5 -5
  29. package/dist/components-manifest.json +175 -12
  30. package/dist/constants/public-class-names.js +8 -0
  31. package/dist/{components/SchemaRenderer/types.js → constants/schema-renderer.js} +2 -7
  32. package/dist/dial-ui-kit.cjs +2 -2
  33. package/dist/dial-ui-kit.js +241 -239
  34. package/dist/file-manager.cjs +1 -1
  35. package/dist/grid.cjs +1 -1
  36. package/dist/index.css +2 -2
  37. package/dist/migration-guides/0.15.0/slider-redesign.md +110 -0
  38. package/dist/migration-guides/README.md +1 -0
  39. package/dist/src/components/New/SchemaRenderer/SchemaRenderer.d.ts +38 -0
  40. package/dist/src/components/New/SchemaRenderer/components/SchemaAnyOfEditor.d.ts +37 -0
  41. package/dist/src/components/New/SchemaRenderer/components/SchemaArrayEditor.d.ts +35 -0
  42. package/dist/src/components/New/SchemaRenderer/components/SchemaField.d.ts +33 -0
  43. package/dist/src/components/New/SchemaRenderer/components/SchemaFieldContent.d.ts +30 -0
  44. package/dist/src/components/New/SchemaRenderer/components/SchemaJsonEditor.d.ts +29 -0
  45. package/dist/src/components/New/SchemaRenderer/components/SchemaKeyValueEditor.d.ts +37 -0
  46. package/dist/src/components/New/SchemaRenderer/components/SchemaObjectEditor.d.ts +32 -0
  47. package/dist/src/components/New/SchemaRenderer/components/SchemaOneOfEditor.d.ts +39 -0
  48. package/dist/src/components/New/SchemaRenderer/components/SchemaPrimitiveField.d.ts +38 -0
  49. package/dist/src/components/New/SchemaRenderer/components/SchemaSection.d.ts +39 -0
  50. package/dist/src/components/New/SchemaRenderer/context.d.ts +8 -0
  51. package/dist/src/components/New/SchemaRenderer/types.d.ts +76 -0
  52. package/dist/src/components/New/Slider/Slider.d.ts +20 -1
  53. package/dist/src/components/New/Slider/utils.d.ts +6 -0
  54. package/dist/src/components/New/Slider/utils.spec.d.ts +1 -0
  55. package/dist/src/components/SchemaRenderer/types.d.ts +5 -93
  56. package/dist/src/components/SchemaRenderer/utils.d.ts +1 -22
  57. package/dist/src/constants/public-class-names.d.ts +8 -0
  58. package/dist/src/constants/schema-renderer.d.ts +2 -0
  59. package/dist/src/index.d.ts +3 -1
  60. package/dist/src/models/json-schema.d.ts +71 -0
  61. package/dist/src/types/json-schema.d.ts +22 -0
  62. package/dist/src/utils/json-schema.d.ts +23 -0
  63. package/dist/types/json-schema.js +7 -0
  64. package/dist/{use-file-manager-tabs-C-dMqEFy.cjs → use-file-manager-tabs-Bzzwwcgk.cjs} +1 -1
  65. package/dist/{components/SchemaRenderer/utils.js → utils/json-schema.js} +1 -1
  66. package/package.json +1 -1
@@ -0,0 +1,150 @@
1
+ import { jsx as l } from "react/jsx-runtime";
2
+ import { Input as b } from "../../Input/Input.js";
3
+ import { NumberInput as A } from "../../NumberInput/NumberInput.js";
4
+ import { PasswordInput as w } from "../../PasswordInput/PasswordInput.js";
5
+ import { RadioGroup as O } from "../../RadioGroup/RadioGroup.js";
6
+ import { Select as I } from "../../Select/Select.js";
7
+ import { Switch as T } from "../../Switch/Switch.js";
8
+ import { JsonSchemaType as p, SchemaDisplayMode as v, SchemaOrientation as V } from "../../../../types/json-schema.js";
9
+ import { RadioGroupOrientation as N } from "../../../../types/radio-group.js";
10
+ import { useSchemaContext as F } from "../context.js";
11
+ const R = (e) => typeof e == "string" ? e : e[0], g = (e) => e != null ? String(e) : "", B = (e) => e !== void 0 ? Number(e) : void 0, K = ({
12
+ schema: e,
13
+ value: t,
14
+ onChange: i,
15
+ invalid: c,
16
+ id: o,
17
+ ariaLabel: n
18
+ }) => {
19
+ const {
20
+ texts: a,
21
+ readonly: s = !1,
22
+ inputClassName: u,
23
+ acceptableResourceTypes: C
24
+ } = F(), P = e.const !== void 0, d = Array.isArray(e.enum) ? e.enum : [], S = d.length > 0;
25
+ if (e["dial:resource"] === !0 && Array.isArray(e.acceptableResourceTypes) && e.acceptableResourceTypes.length > 0 && (e.type === p.String || e.type === void 0)) {
26
+ const r = (e.acceptableResourceTypes ?? []).flatMap(
27
+ (m) => {
28
+ const y = C?.[m];
29
+ return Array.isArray(y) ? y.map((h) => {
30
+ const f = String(h);
31
+ return { value: f, label: f };
32
+ }) : [];
33
+ }
34
+ );
35
+ return /* @__PURE__ */ l(
36
+ I,
37
+ {
38
+ id: o,
39
+ ariaLabel: n,
40
+ options: r,
41
+ value: t != null ? String(t) : void 0,
42
+ invalid: c,
43
+ disabled: s,
44
+ onChange: (m) => i(R(m)),
45
+ placeholder: a.enumSelectPlaceholder,
46
+ className: u
47
+ }
48
+ );
49
+ }
50
+ if (P)
51
+ return /* @__PURE__ */ l(
52
+ b,
53
+ {
54
+ id: o,
55
+ "aria-label": n,
56
+ value: String(e.const ?? ""),
57
+ disabled: !0,
58
+ containerClassName: u
59
+ }
60
+ );
61
+ if (S && e.enumDisplay === v.Radio)
62
+ return /* @__PURE__ */ l(
63
+ O,
64
+ {
65
+ id: o,
66
+ ariaLabel: n,
67
+ items: d.map((r) => ({ value: String(r), label: String(r) })),
68
+ value: t != null ? String(t) : void 0,
69
+ orientation: e.enumOrientation === V.Row ? N.Row : N.Column,
70
+ disabled: s,
71
+ onChange: (r) => i(r)
72
+ }
73
+ );
74
+ if (S)
75
+ return /* @__PURE__ */ l(
76
+ I,
77
+ {
78
+ id: o,
79
+ ariaLabel: n,
80
+ options: d.map((r) => ({
81
+ value: String(r),
82
+ label: String(r)
83
+ })),
84
+ value: t != null ? String(t) : void 0,
85
+ invalid: c,
86
+ disabled: s,
87
+ onChange: (r) => i(R(r)),
88
+ placeholder: a.enumSelectPlaceholder,
89
+ className: u
90
+ }
91
+ );
92
+ switch (e.type) {
93
+ case p.Boolean:
94
+ return /* @__PURE__ */ l(
95
+ T,
96
+ {
97
+ id: o,
98
+ "aria-label": n,
99
+ isOn: !!t,
100
+ disabled: s,
101
+ onChange: (r) => i(r)
102
+ }
103
+ );
104
+ case p.Integer:
105
+ case p.Number:
106
+ return /* @__PURE__ */ l(
107
+ A,
108
+ {
109
+ id: o,
110
+ "aria-label": n,
111
+ integer: e.type === p.Integer,
112
+ value: g(t),
113
+ invalid: c,
114
+ disabled: s,
115
+ onChange: (r) => i(B(r)),
116
+ placeholder: e.type === p.Integer ? a.integerInputPlaceholder : a.numberInputPlaceholder,
117
+ containerClassName: u
118
+ }
119
+ );
120
+ default:
121
+ return e.isProtected ? /* @__PURE__ */ l(
122
+ w,
123
+ {
124
+ id: o,
125
+ "aria-label": n,
126
+ value: g(t),
127
+ invalid: c,
128
+ disabled: s,
129
+ onChange: (r) => i(r ?? void 0),
130
+ placeholder: a.stringInputPlaceholder,
131
+ containerClassName: u
132
+ }
133
+ ) : /* @__PURE__ */ l(
134
+ b,
135
+ {
136
+ id: o,
137
+ "aria-label": n,
138
+ value: g(t),
139
+ invalid: c,
140
+ disabled: s,
141
+ onChange: (r) => i(r ?? void 0),
142
+ placeholder: a.stringInputPlaceholder,
143
+ containerClassName: u
144
+ }
145
+ );
146
+ }
147
+ };
148
+ export {
149
+ K as SchemaPrimitiveField
150
+ };
@@ -0,0 +1,135 @@
1
+ import { jsxs as i, jsx as e } from "react/jsx-runtime";
2
+ import { useState as N, useId as k } from "react";
3
+ import { IconChevronDown as b, IconAlertTriangle as y, IconCheck as g, IconTrash as v } from "@tabler/icons-react";
4
+ import { DIAL_KIT_ICON_STROKE as a } from "../../constants/icon.js";
5
+ import { DangerIconButton as _ } from "../../IconButton/IconButtonWrappers.js";
6
+ import { InfoButton as w } from "../../InfoButton/InfoButton.js";
7
+ import { DIAL_ICON_SIZE as o } from "../../../../constants/icon.js";
8
+ import { DIAL_KIT_CLASS as z } from "../../../../constants/public-class-names.js";
9
+ import { ElementSize as C } from "../../../../types/size.js";
10
+ import { mergeClasses as t } from "../../../../utils/merge-classes.js";
11
+ const R = ({
12
+ title: m,
13
+ description: p,
14
+ summary: l,
15
+ errorCount: n = 0,
16
+ level: x = 0,
17
+ children: f,
18
+ onRemove: c,
19
+ defaultExpanded: h = !0,
20
+ removeItemAriaLabel: u = "Remove item"
21
+ }) => {
22
+ const [r, I] = N(h), d = k(), s = x === 0;
23
+ return /* @__PURE__ */ i(
24
+ "div",
25
+ {
26
+ className: t(
27
+ "flex flex-col border border-tertiary",
28
+ s ? "rounded-xl bg-layer-raised" : "rounded-lg",
29
+ z.schemaRendererSection
30
+ ),
31
+ children: [
32
+ /* @__PURE__ */ i(
33
+ "div",
34
+ {
35
+ className: t(
36
+ "flex items-center gap-2",
37
+ s ? "px-4 py-3" : "px-3 py-2"
38
+ ),
39
+ children: [
40
+ /* @__PURE__ */ i(
41
+ "button",
42
+ {
43
+ type: "button",
44
+ "aria-expanded": r,
45
+ "aria-controls": r ? d : void 0,
46
+ onClick: () => I((S) => !S),
47
+ className: "flex min-w-0 flex-1 items-center gap-2 rounded text-left text-primary focus-visible:outline focus-visible:outline-focus",
48
+ children: [
49
+ /* @__PURE__ */ e(
50
+ b,
51
+ {
52
+ size: o.SM,
53
+ stroke: a,
54
+ "aria-hidden": "true",
55
+ className: t(
56
+ "shrink-0 text-secondary transition-transform",
57
+ !r && "-rotate-90"
58
+ )
59
+ }
60
+ ),
61
+ /* @__PURE__ */ e(
62
+ "span",
63
+ {
64
+ className: t(
65
+ "truncate",
66
+ s ? "dial-small-semi-text" : "dial-small-text"
67
+ ),
68
+ children: m
69
+ }
70
+ )
71
+ ]
72
+ }
73
+ ),
74
+ /* @__PURE__ */ e(w, { caption: p }),
75
+ l && /* @__PURE__ */ e("span", { className: "dial-tiny-text whitespace-nowrap text-secondary", children: l }),
76
+ n > 0 ? /* @__PURE__ */ i("span", { className: "flex items-center gap-1 whitespace-nowrap dial-tiny-text text-error", children: [
77
+ /* @__PURE__ */ e(
78
+ y,
79
+ {
80
+ size: o.SM,
81
+ stroke: a,
82
+ "aria-hidden": "true",
83
+ className: "shrink-0"
84
+ }
85
+ ),
86
+ n,
87
+ " error",
88
+ n > 1 ? "s" : ""
89
+ ] }) : /* @__PURE__ */ e(
90
+ g,
91
+ {
92
+ size: o.SM,
93
+ stroke: a,
94
+ "aria-hidden": "true",
95
+ className: "shrink-0 text-success"
96
+ }
97
+ ),
98
+ c && /* @__PURE__ */ e(
99
+ _,
100
+ {
101
+ size: C.Small,
102
+ icon: /* @__PURE__ */ e(
103
+ v,
104
+ {
105
+ size: o.SM,
106
+ stroke: a,
107
+ "aria-hidden": "true"
108
+ }
109
+ ),
110
+ "aria-label": u,
111
+ onClick: c,
112
+ className: "shrink-0"
113
+ }
114
+ )
115
+ ]
116
+ }
117
+ ),
118
+ r && /* @__PURE__ */ e(
119
+ "div",
120
+ {
121
+ id: d,
122
+ className: t(
123
+ "border-t border-tertiary",
124
+ s ? "p-4" : "p-3"
125
+ ),
126
+ children: f
127
+ }
128
+ )
129
+ ]
130
+ }
131
+ );
132
+ };
133
+ export {
134
+ R as SchemaSection
135
+ };
@@ -0,0 +1,17 @@
1
+ import { createContext as c, useContext as u } from "react";
2
+ const a = c(null), f = () => {
3
+ const e = u(a);
4
+ if (!e)
5
+ throw new Error("useSchemaContext must be used inside SchemaRenderer");
6
+ return e;
7
+ }, m = (e, t = /* @__PURE__ */ new Set(), r = !1, n = !1) => {
8
+ if (!r || t.has(e)) return !0;
9
+ if (!n) return !1;
10
+ const s = e + ".";
11
+ return [...t].some((o) => o.startsWith(s));
12
+ };
13
+ export {
14
+ a as SchemaRendererContext,
15
+ m as isPathTouched,
16
+ f as useSchemaContext
17
+ };
@@ -1,112 +1,173 @@
1
- import { jsxs as n, jsx as e, Fragment as C } from "react/jsx-runtime";
2
- import { useId as w, useCallback as A } from "react";
3
- import { mergeClasses as i } from "../../../utils/merge-classes.js";
4
- import { resolveAccessibleName as B } from "../../../utils/accessible-name.js";
5
- import { ErrorText as H, CaptionText as L } from "../CaptionText/CaptionText.js";
6
- import { Label as U } from "../Label/Label.js";
7
- const Z = 16, _ = (o) => (o.toString().split(".")[1] ?? "").length, O = ({
8
- id: o,
1
+ import { jsxs as n, jsx as e, Fragment as k } from "react/jsx-runtime";
2
+ import { useId as Z, useCallback as q } from "react";
3
+ import { mergeClasses as a } from "../../../utils/merge-classes.js";
4
+ import { resolveAccessibleName as D } from "../../../utils/accessible-name.js";
5
+ import { ErrorText as J, CaptionText as K } from "../CaptionText/CaptionText.js";
6
+ import { Label as O } from "../Label/Label.js";
7
+ import { getTickPercents as Q } from "./utils.js";
8
+ const R = 12, W = (t) => (t.toString().split(".")[1] ?? "").length, F = (t) => `calc(${t}% + ${(0.5 - t / 100) * R}px)`, X = (t, r) => t && r ? "grid-cols-[auto_minmax(0,1fr)_auto]" : t ? "grid-cols-[auto_minmax(0,1fr)]" : r ? "grid-cols-[minmax(0,1fr)_auto]" : "grid-cols-[minmax(0,1fr)]", le = ({
9
+ id: t,
9
10
  value: r,
10
- min: d = 0,
11
- max: h = 1,
12
- step: x = 0.1,
13
- disabled: a,
14
- labelProps: l,
15
- labels: t,
16
- formatValue: m,
17
- showValue: p = !1,
18
- caption: f,
11
+ min: m = 0,
12
+ max: g = 1,
13
+ step: h = 0.1,
14
+ disabled: i,
15
+ labelProps: s,
16
+ labels: l,
17
+ formatValue: x,
18
+ showValue: v = !1,
19
+ showTooltip: S = !1,
20
+ showTicks: j = !1,
21
+ leftContent: N,
22
+ rightContent: y,
23
+ caption: b,
19
24
  error: c,
20
- onChange: g,
21
- containerClassName: $,
22
- trackClassName: F,
23
- fillClassName: M,
24
- className: S,
25
- ...u
25
+ onChange: w,
26
+ containerClassName: z,
27
+ trackClassName: B,
28
+ fillClassName: E,
29
+ className: L,
30
+ ...I
26
31
  }) => {
27
- const T = w(), s = o ?? T, v = f && !c ? `${s}-caption` : void 0, N = c ? `${s}-error` : void 0, y = h - d, b = y > 0 ? Math.min(100, Math.max(0, (r - d) / y * 100)) : 0, j = `calc(${b}% + ${(0.5 - b / 100) * Z}px)`, I = m ? m(r) : r.toFixed(_(x)), k = A(
28
- (E) => {
29
- g?.(Number(E.target.value));
32
+ const A = Z(), o = t ?? A, C = b && !c ? `${o}-caption` : void 0, T = c ? `${o}-error` : void 0, f = g - m, G = f > 0 ? Math.min(100, Math.max(0, (r - m) / f * 100)) : 0, _ = F(G), H = j && !i ? Q(f, h) : [], M = S && !i, u = N != null, $ = y != null, p = x ? x(r) : r.toFixed(W(h)), U = q(
33
+ (d) => {
34
+ w?.(Number(d.target.value));
30
35
  },
31
- [g]
36
+ [w]
32
37
  );
33
- return /* @__PURE__ */ n("div", { className: i("flex flex-col gap-2", $), children: [
34
- (l || p) && /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
35
- l && /* @__PURE__ */ e(U, { ...l, htmlFor: s }),
36
- p && // The input already reports its value to assistive tech, so this is
38
+ return /* @__PURE__ */ n("div", { className: a("flex flex-col gap-2", z), children: [
39
+ (s || v) && /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
40
+ s && /* @__PURE__ */ e(O, { ...s, htmlFor: o }),
41
+ v && // The input already reports its value to assistive tech, so this is
37
42
  // a visual echo rather than a second announcement.
38
43
  /* @__PURE__ */ e(
39
44
  "span",
40
45
  {
41
46
  "aria-hidden": "true",
42
- className: i(
47
+ className: a(
43
48
  "dial-small-text ml-auto",
44
- a ? "text-control-disable-primary" : "text-primary"
49
+ i ? "text-control-disable-primary" : "text-primary"
45
50
  ),
46
- children: I
51
+ children: p
47
52
  }
48
53
  )
49
54
  ] }),
50
55
  /* @__PURE__ */ n("div", { className: "flex flex-col gap-1", children: [
51
- /* @__PURE__ */ n("div", { className: "relative flex h-6 items-center", children: [
52
- /* @__PURE__ */ e(
53
- "div",
54
- {
55
- className: i(
56
- "pointer-events-none absolute inset-x-0 h-1 rounded-full",
57
- a ? "bg-control-disable-primary" : "bg-control-neutral-active",
58
- F
59
- )
60
- }
61
- ),
62
- /* @__PURE__ */ e(
63
- "div",
64
- {
65
- className: i(
66
- "pointer-events-none absolute left-0 h-1 rounded-full",
67
- a ? "bg-control-disable-secondary" : "bg-control-accent",
68
- M
69
- ),
70
- style: { width: j }
71
- }
72
- ),
73
- /* @__PURE__ */ e(
74
- "input",
75
- {
76
- ...u,
77
- type: "range",
78
- id: s,
79
- value: r,
80
- min: d,
81
- max: h,
82
- step: x,
83
- disabled: a,
84
- onChange: k,
85
- "aria-label": B(
86
- typeof l?.label != "string" ? u["aria-label"] : void 0
87
- ),
88
- "aria-valuetext": m ? I : void 0,
89
- "aria-describedby": N ?? v,
90
- className: i(
91
- "dial-kit-slider absolute inset-0 h-full w-full",
92
- S
56
+ /* @__PURE__ */ n(
57
+ "div",
58
+ {
59
+ className: a(
60
+ "grid items-center gap-x-3 gap-y-1",
61
+ X(u, $),
62
+ // Room for the value bubble, which hangs above the track row.
63
+ M && "mt-7"
64
+ ),
65
+ children: [
66
+ u && /* @__PURE__ */ e("div", { className: "flex items-center", children: N }),
67
+ /* @__PURE__ */ n("div", { className: "relative flex h-6 items-center", children: [
68
+ /* @__PURE__ */ e(
69
+ "div",
70
+ {
71
+ className: a(
72
+ "pointer-events-none absolute inset-x-0 h-1 rounded-full",
73
+ i ? "bg-control-disable-primary" : "bg-control-accent-muted",
74
+ B
75
+ )
76
+ }
77
+ ),
78
+ H.map((d) => /* @__PURE__ */ e(
79
+ "span",
80
+ {
81
+ "aria-hidden": "true",
82
+ className: "pointer-events-none absolute size-0.5 -translate-x-1/2 rounded-full bg-control-neutral-default",
83
+ style: { left: F(d) }
84
+ },
85
+ d
86
+ )),
87
+ /* @__PURE__ */ e(
88
+ "div",
89
+ {
90
+ className: a(
91
+ "pointer-events-none absolute left-0 h-1 rounded-full",
92
+ i ? "bg-control-disable-secondary" : "bg-control-accent",
93
+ E
94
+ ),
95
+ style: { width: _ }
96
+ }
97
+ ),
98
+ M && // A visual echo like `showValue`: the input already announces
99
+ // its value, so the bubble stays out of the accessibility tree.
100
+ /* @__PURE__ */ n(
101
+ "span",
102
+ {
103
+ "aria-hidden": "true",
104
+ className: "pointer-events-none absolute bottom-full mb-0.5 flex -translate-x-1/2 flex-col items-center",
105
+ style: { left: _ },
106
+ children: [
107
+ /* @__PURE__ */ e("span", { className: "whitespace-nowrap rounded-md bg-control-inverted px-2 py-0.5 dial-small-text text-control-inverted shadow-xs", children: p }),
108
+ /* @__PURE__ */ e(
109
+ "svg",
110
+ {
111
+ width: "8",
112
+ height: "4",
113
+ viewBox: "0 0 8 4",
114
+ className: "fill-control-inverted",
115
+ children: /* @__PURE__ */ e("path", { d: "M0 0h8L4 4z" })
116
+ }
117
+ )
118
+ ]
119
+ }
120
+ ),
121
+ /* @__PURE__ */ e(
122
+ "input",
123
+ {
124
+ ...I,
125
+ type: "range",
126
+ id: o,
127
+ value: r,
128
+ min: m,
129
+ max: g,
130
+ step: h,
131
+ disabled: i,
132
+ onChange: U,
133
+ "aria-label": D(
134
+ typeof s?.label != "string" ? I["aria-label"] : void 0
135
+ ),
136
+ "aria-valuetext": x ? p : void 0,
137
+ "aria-describedby": T ?? C,
138
+ className: a(
139
+ "dial-kit-slider absolute inset-0 h-full w-full",
140
+ L
141
+ )
142
+ }
143
+ )
144
+ ] }),
145
+ $ && /* @__PURE__ */ e("div", { className: "flex items-center", children: y }),
146
+ l && /* @__PURE__ */ e(
147
+ "div",
148
+ {
149
+ className: a(
150
+ "dial-tiny-text flex text-secondary",
151
+ u && "col-start-2"
152
+ ),
153
+ children: l.length === 3 ? /* @__PURE__ */ n(k, { children: [
154
+ /* @__PURE__ */ e("span", { children: l[0] }),
155
+ /* @__PURE__ */ e("span", { className: "flex-1 text-center", children: l[1] }),
156
+ /* @__PURE__ */ e("span", { children: l[2] })
157
+ ] }) : /* @__PURE__ */ n(k, { children: [
158
+ /* @__PURE__ */ e("span", { children: l[0] }),
159
+ /* @__PURE__ */ e("span", { className: "ml-auto", children: l[1] })
160
+ ] })
161
+ }
93
162
  )
94
- }
95
- )
96
- ] }),
97
- t && /* @__PURE__ */ e("div", { className: "dial-tiny-text flex text-secondary", children: t.length === 3 ? /* @__PURE__ */ n(C, { children: [
98
- /* @__PURE__ */ e("span", { children: t[0] }),
99
- /* @__PURE__ */ e("span", { className: "flex-1 text-center", children: t[1] }),
100
- /* @__PURE__ */ e("span", { children: t[2] })
101
- ] }) : /* @__PURE__ */ n(C, { children: [
102
- /* @__PURE__ */ e("span", { children: t[0] }),
103
- /* @__PURE__ */ e("span", { className: "ml-auto", children: t[1] })
104
- ] }) }),
105
- /* @__PURE__ */ e(H, { id: N, text: c }),
106
- !c && /* @__PURE__ */ e(L, { id: v, text: f })
163
+ ]
164
+ }
165
+ ),
166
+ /* @__PURE__ */ e(J, { id: T, text: c }),
167
+ !c && /* @__PURE__ */ e(K, { id: C, text: b })
107
168
  ] })
108
169
  ] });
109
170
  };
110
171
  export {
111
- O as Slider
172
+ le as Slider
112
173
  };
@@ -0,0 +1,12 @@
1
+ const e = (r, t) => {
2
+ if (r <= 0 || t <= 0)
3
+ return [];
4
+ const o = Math.floor(r / t + 1e-9);
5
+ return Array.from(
6
+ { length: o + 1 },
7
+ (n, c) => c * t / r * 100
8
+ );
9
+ };
10
+ export {
11
+ e as getTickPercents
12
+ };
@@ -1,55 +1,56 @@
1
1
  import { jsxs as i, jsx as t } from "react/jsx-runtime";
2
2
  import "react";
3
3
  import { mergeClasses as n } from "../../../utils/merge-classes.js";
4
- import { ErrorText as u, CaptionText as v } from "../CaptionText/CaptionText.js";
5
- import { Label as N } from "../Label/Label.js";
6
- var b = /* @__PURE__ */ ((e) => (e.None = "none", e.Both = "both", e.Horizontal = "horizontal", e.Vertical = "vertical", e))(b || {});
4
+ import { ErrorText as v, CaptionText as N } from "../CaptionText/CaptionText.js";
5
+ import { Label as b } from "../Label/Label.js";
6
+ var C = /* @__PURE__ */ ((e) => (e.None = "none", e.Both = "both", e.Horizontal = "horizontal", e.Vertical = "vertical", e))(C || {});
7
7
  const s = {
8
8
  none: "resize-none",
9
9
  both: "resize",
10
10
  horizontal: "resize-x",
11
11
  vertical: "resize-y"
12
- }, C = (e) => typeof e == "boolean" ? s[
12
+ }, g = (e) => typeof e == "boolean" ? s[
13
13
  e ? "both" : "none"
14
14
  /* None */
15
- ] : s[e], B = ({
15
+ ] : s[e], E = ({
16
16
  className: e = "",
17
17
  value: m,
18
18
  onChange: c,
19
19
  error: r,
20
20
  containerClassName: x,
21
- resize: d = !1,
22
- labelProps: o,
21
+ resize: p = !1,
22
+ labelProps: a,
23
23
  caption: f,
24
- id: l,
25
- ...a
24
+ id: o,
25
+ invalid: d,
26
+ ...l
26
27
  }) => {
27
28
  const h = n(
28
29
  "dial-kit-textarea dial-kit-input px-3 py-2",
29
- a.invalid && "dial-kit-input-error",
30
- a.disabled && "dial-kit-input-disable",
31
- C(d),
30
+ d && "dial-kit-input-error",
31
+ l.disabled && "dial-kit-input-disable",
32
+ g(p),
32
33
  e
33
34
  );
34
35
  return /* @__PURE__ */ i("div", { className: n("flex flex-col gap-2", x), children: [
35
- o && /* @__PURE__ */ t(N, { ...o, htmlFor: l }),
36
+ a && /* @__PURE__ */ t(b, { ...a, htmlFor: o }),
36
37
  /* @__PURE__ */ i("div", { className: "flex flex-col gap-1", children: [
37
38
  /* @__PURE__ */ t(
38
39
  "textarea",
39
40
  {
40
- id: l,
41
+ id: o,
41
42
  value: m || "",
42
43
  className: h,
43
- onChange: (p) => c?.(p.currentTarget.value),
44
- ...a
44
+ onChange: (u) => c?.(u.currentTarget.value),
45
+ ...l
45
46
  }
46
47
  ),
47
- /* @__PURE__ */ t(u, { text: r }),
48
- !r && /* @__PURE__ */ t(v, { text: f })
48
+ /* @__PURE__ */ t(v, { text: r }),
49
+ !r && /* @__PURE__ */ t(N, { text: f })
49
50
  ] })
50
51
  ] });
51
52
  };
52
53
  export {
53
- B as Textarea,
54
- b as TextareaResize
54
+ E as Textarea,
55
+ C as TextareaResize
55
56
  };