@epam/ai-dial-ui-kit 0.2.0-rc.0 → 0.2.0-rc.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,138 +1,220 @@
1
- import { jsx as l, jsxs as m, Fragment as _ } from "react/jsx-runtime";
1
+ import { jsx as n, jsxs as m, Fragment as $ } from "react/jsx-runtime";
2
2
  import d from "classnames";
3
- import { useFloating as K, offset as M, flip as z, shift as G, arrow as O, autoUpdate as $, useHover as Y, useFocus as Z, useDismiss as q, useRole as B, useInteractions as J, useMergeRefs as P, FloatingPortal as Q, FloatingArrow as X } from "@floating-ui/react";
4
- import { createContext as ee, useState as te, useRef as ne, useMemo as re, useContext as le, forwardRef as E, isValidElement as se, cloneElement as oe, useCallback as ae } from "react";
5
- const y = ({ icon: e, className: t }) => e ? /* @__PURE__ */ l("span", { className: d("flex-shrink-0", t), children: e }) : null, ye = ({
3
+ import { IconCircleCheck as G, IconAlertTriangle as Z, IconAlertCircle as X, IconInfoCircle as Y, IconX as q, IconLoader as J, IconMinus as Q, IconCheck as A, IconExclamationCircle as ee } from "@tabler/icons-react";
4
+ import { createContext as re, useState as te, useRef as ne, useMemo as se, useContext as oe, forwardRef as L, isValidElement as ae, cloneElement as le, useCallback as O } from "react";
5
+ import { useFloating as ie, offset as ce, flip as de, shift as ue, arrow as me, autoUpdate as fe, useHover as pe, useFocus as be, useDismiss as he, useRole as ge, useInteractions as xe, useMergeRefs as z, FloatingPortal as ye, FloatingArrow as Ne } from "@floating-ui/react";
6
+ const N = ({ icon: e, className: r }) => e ? /* @__PURE__ */ n("span", { className: d("flex-shrink-0", r), children: e }) : null;
7
+ var k = /* @__PURE__ */ ((e) => (e.Primary = "primary", e.Secondary = "secondary", e.Tertiary = "tertiary", e))(k || {});
8
+ const Ce = {
9
+ [k.Primary]: "dial-primary-button",
10
+ [k.Secondary]: "dial-secondary-button",
11
+ [k.Tertiary]: "dial-tertiary-button"
12
+ }, we = ({
6
13
  title: e,
14
+ variant: r,
7
15
  cssClass: t,
8
- ref: n,
9
- onClick: r,
10
- disable: s,
11
- iconAfter: o,
12
- iconBefore: a,
16
+ ref: s,
17
+ onClick: o,
18
+ disable: a,
19
+ iconAfter: l,
20
+ iconBefore: i,
13
21
  hideTitleOnMobile: c,
14
- ariaLabel: i
22
+ ariaLabel: f
15
23
  }) => {
16
- const p = d(
24
+ const u = d(
17
25
  "dial-small-semi",
18
- o ? "mr-2" : "",
19
- a ? "ml-2" : "",
26
+ l ? "mr-2" : "",
27
+ i ? "ml-2" : "",
20
28
  c ? "hidden sm:inline" : "inline"
21
- ), u = d(
29
+ ), b = d(
30
+ r && Ce[r],
22
31
  t,
23
32
  "focus-visible:outline outline-offset-0"
24
33
  );
25
34
  return /* @__PURE__ */ m(
26
35
  "button",
27
36
  {
28
- ref: n,
37
+ ref: s,
29
38
  type: "button",
30
- className: u,
31
- onClick: (f) => r?.(f),
32
- disabled: s,
33
- "aria-label": e || i,
39
+ className: b,
40
+ onClick: (C) => o?.(C),
41
+ disabled: a,
42
+ "aria-label": e || f,
34
43
  children: [
35
- /* @__PURE__ */ l(y, { icon: a }),
36
- e && /* @__PURE__ */ l("span", { className: p, children: e }),
37
- /* @__PURE__ */ l(y, { icon: o })
44
+ /* @__PURE__ */ n(N, { icon: i }),
45
+ e && /* @__PURE__ */ n("span", { className: u, children: e }),
46
+ /* @__PURE__ */ n(N, { icon: l })
38
47
  ]
39
48
  }
40
49
  );
41
- }, S = ({ errorText: e }) => e && /* @__PURE__ */ l("span", { className: "text-error dial-tiny mt-1", children: e }), A = ({
50
+ }, V = ({ errorText: e }) => e && /* @__PURE__ */ n("span", { className: "text-error dial-tiny mt-1", children: e }), _ = ({
42
51
  fieldTitle: e,
43
- htmlFor: t,
44
- optional: n,
45
- optionalText: r,
46
- cssClass: s
52
+ htmlFor: r,
53
+ optional: t,
54
+ optionalText: s,
55
+ cssClass: o
47
56
  }) => e ? /* @__PURE__ */ m(
48
57
  "label",
49
58
  {
50
59
  className: d(
51
60
  "dial-tiny text-secondary",
52
- s,
53
- !s?.includes("mb") && "mb-2"
61
+ o,
62
+ !o?.includes("mb") && "mb-2"
54
63
  ),
55
- htmlFor: t,
64
+ htmlFor: r,
56
65
  children: [
57
- /* @__PURE__ */ l("span", { className: "min-h-4", children: e }),
58
- n && /* @__PURE__ */ l("span", { className: "ml-1", children: r ?? "(Optional)" })
66
+ /* @__PURE__ */ n("span", { className: "min-h-4", children: e }),
67
+ t && /* @__PURE__ */ n("span", { className: "ml-1", children: s ?? "(Optional)" })
59
68
  ]
60
69
  }
61
- ) : null, ie = 7, ce = 2, I = ee(null), V = () => {
62
- const e = le(I);
70
+ ) : null;
71
+ var y = /* @__PURE__ */ ((e) => (e.Info = "info", e.Success = "success", e.Warning = "warning", e.Error = "error", e))(y || {});
72
+ const ve = {
73
+ info: /* @__PURE__ */ n(Y, { size: 24, stroke: 2 }),
74
+ error: /* @__PURE__ */ n(X, { size: 24, stroke: 2 }),
75
+ warning: /* @__PURE__ */ n(Z, { size: 24, stroke: 2 }),
76
+ success: /* @__PURE__ */ n(G, { size: 24, stroke: 2 })
77
+ }, De = {
78
+ [y.Info]: "bg-info border-info text-info",
79
+ [y.Success]: "bg-success border-success text-success",
80
+ [y.Warning]: "bg-warning border-warning text-warning",
81
+ [y.Error]: "bg-error border-error text-error"
82
+ }, Ie = "items-center justify-between gap-2 p-3 border border-solid dial-small-150 rounded flex", Ze = ({
83
+ variant: e = y.Info,
84
+ message: r,
85
+ cssClass: t,
86
+ closable: s = !1,
87
+ onClose: o
88
+ }) => /* @__PURE__ */ m(
89
+ "div",
90
+ {
91
+ role: "alert",
92
+ className: d(
93
+ Ie,
94
+ De[e],
95
+ t
96
+ ),
97
+ children: [
98
+ /* @__PURE__ */ m("div", { className: "flex items-center gap-2", children: [
99
+ /* @__PURE__ */ n(N, { icon: ve[e] }),
100
+ /* @__PURE__ */ n("div", { className: "text-primary", children: r })
101
+ ] }),
102
+ s && /* @__PURE__ */ n(
103
+ we,
104
+ {
105
+ cssClass: "ml-2 text-secondary hover:text-primary",
106
+ ariaLabel: "Close alert",
107
+ iconBefore: /* @__PURE__ */ n(q, { size: 16 }),
108
+ onClick: (a) => o?.(a)
109
+ }
110
+ )
111
+ ]
112
+ }
113
+ ), Re = "flex items-center justify-center text-secondary", ke = "shrink-0 grow-0 basis-auto animate-spin-steps", Xe = ({
114
+ size: e = 18,
115
+ cssClass: r,
116
+ iconClass: t,
117
+ fullWidth: s = !0,
118
+ ariaLabel: o = "Loading"
119
+ }) => /* @__PURE__ */ n(
120
+ "div",
121
+ {
122
+ role: "status",
123
+ "aria-label": o,
124
+ className: d({
125
+ [Re]: !0,
126
+ "w-full h-full": s,
127
+ [r || ""]: !!r
128
+ }),
129
+ children: /* @__PURE__ */ n(
130
+ N,
131
+ {
132
+ icon: /* @__PURE__ */ n(
133
+ J,
134
+ {
135
+ width: e,
136
+ height: e,
137
+ className: d(ke, t)
138
+ }
139
+ )
140
+ }
141
+ )
142
+ }
143
+ ), Te = 7, Ee = 2, j = re(null), W = () => {
144
+ const e = oe(j);
63
145
  if (e == null)
64
146
  throw new Error("Tooltip components must be wrapped in <Tooltip />");
65
147
  return e;
66
- }, ue = ({
148
+ }, Fe = ({
67
149
  initialOpen: e = !1,
68
- placement: t = "bottom",
69
- isTriggerClickable: n = !1,
70
- open: r,
71
- onOpenChange: s
150
+ placement: r = "bottom",
151
+ isTriggerClickable: t = !1,
152
+ open: s,
153
+ onOpenChange: o
72
154
  } = {}) => {
73
- const [o, a] = te(e), c = ne(null), i = r ?? o, p = s ?? a, u = K({
74
- placement: t,
75
- open: i,
76
- onOpenChange: p,
77
- whileElementsMounted: $,
155
+ const [a, l] = te(e), i = ne(null), c = s ?? a, f = o ?? l, u = ie({
156
+ placement: r,
157
+ open: c,
158
+ onOpenChange: f,
159
+ whileElementsMounted: fe,
78
160
  middleware: [
79
- M(ie + ce),
80
- z({
81
- crossAxis: t.includes("-"),
161
+ ce(Te + Ee),
162
+ de({
163
+ crossAxis: r.includes("-"),
82
164
  fallbackAxisSideDirection: "start",
83
165
  padding: 5
84
166
  }),
85
- G({ padding: 5 }),
86
- O({
87
- element: c
167
+ ue({ padding: 5 }),
168
+ me({
169
+ element: i
88
170
  })
89
171
  ]
90
- }), f = Y(u.context, {
172
+ }), b = pe(u.context, {
91
173
  move: !1,
92
- enabled: r == null,
93
- mouseOnly: n,
174
+ enabled: s == null,
175
+ mouseOnly: t,
94
176
  delay: { open: 500, close: 0 }
95
- }), D = Z(u.context, {
96
- enabled: r == null
97
- }), T = q(u.context), g = B(u.context, { role: "tooltip" }), h = J([f, D, T, g]);
98
- return re(
177
+ }), C = be(u.context, {
178
+ enabled: s == null
179
+ }), T = he(u.context), g = ge(u.context, { role: "tooltip" }), h = xe([b, C, T, g]);
180
+ return se(
99
181
  () => ({
100
- open: i,
101
- setOpen: p,
102
- arrowRef: c,
182
+ open: c,
183
+ setOpen: f,
184
+ arrowRef: i,
103
185
  ...h,
104
186
  ...u
105
187
  }),
106
- [i, p, h, u]
188
+ [c, f, h, u]
107
189
  );
108
- }, de = ({
190
+ }, Pe = ({
109
191
  children: e,
110
- ...t
192
+ ...r
111
193
  }) => {
112
- const n = ue(t);
113
- return /* @__PURE__ */ l(I.Provider, { value: n, children: e });
114
- }, pe = E(function({ style: t, ...n }, r) {
115
- const s = V(), o = P([s.refs.setFloating, r]);
116
- return s.open ? /* @__PURE__ */ l(Q, { id: "tooltip-portal", children: /* @__PURE__ */ m(
194
+ const t = Fe(r);
195
+ return /* @__PURE__ */ n(j.Provider, { value: t, children: e });
196
+ }, Se = L(function({ style: r, ...t }, s) {
197
+ const o = W(), a = z([o.refs.setFloating, s]);
198
+ return o.open ? /* @__PURE__ */ n(ye, { id: "tooltip-portal", children: /* @__PURE__ */ m(
117
199
  "div",
118
200
  {
119
- ref: o,
201
+ ref: a,
120
202
  style: {
121
- ...s.floatingStyles,
122
- ...t
203
+ ...o.floatingStyles,
204
+ ...r
123
205
  },
124
- ...s.getFloatingProps(n),
206
+ ...o.getFloatingProps(t),
125
207
  className: d(
126
208
  "z-[55] whitespace-pre-wrap rounded border border-primary bg-blackout px-2 py-1 dial-tiny shadow max-w-[300px]",
127
- s.getFloatingProps(n).className
209
+ o.getFloatingProps(t).className
128
210
  ),
129
211
  children: [
130
- n.children,
131
- /* @__PURE__ */ l(
132
- X,
212
+ t.children,
213
+ /* @__PURE__ */ n(
214
+ Ne,
133
215
  {
134
- ref: s.arrowRef,
135
- context: s.context,
216
+ ref: o.arrowRef,
217
+ context: o.context,
136
218
  fill: "currentColor",
137
219
  strokeWidth: 1,
138
220
  className: "stroke-primary w-2 text-[var(--bg-layer-0,_#000000)]"
@@ -141,71 +223,194 @@ const y = ({ icon: e, className: t }) => e ? /* @__PURE__ */ l("span", { classNa
141
223
  ]
142
224
  }
143
225
  ) }) : null;
144
- }), me = E(function({ children: t, asChild: n = !1, ...r }, s) {
145
- const o = V(), c = t && typeof t == "object" && "ref" in t && t.ref !== void 0 ? t.ref : void 0, i = P([o.refs.setReference, s, c]);
146
- return n && se(t) ? oe(
147
- t,
148
- o.getReferenceProps({
149
- ref: i,
150
- ...r,
151
- ...t.props
226
+ }), Ae = L(function({ children: r, asChild: t = !1, ...s }, o) {
227
+ const a = W(), i = r && typeof r == "object" && "ref" in r && r.ref !== void 0 ? r.ref : void 0, c = z([a.refs.setReference, o, i]);
228
+ return t && ae(r) ? le(
229
+ r,
230
+ a.getReferenceProps({
231
+ ref: c,
232
+ ...s,
233
+ ...r.props
152
234
  })
153
- ) : /* @__PURE__ */ l(
235
+ ) : /* @__PURE__ */ n(
154
236
  "span",
155
237
  {
156
- ref: i,
157
- ...o.getReferenceProps(r),
158
- className: r.className ?? "dial-tooltip-trigger text-left",
159
- children: t
238
+ ref: c,
239
+ ...a.getReferenceProps(s),
240
+ className: s.className ?? "dial-tooltip-trigger text-left",
241
+ children: r
160
242
  }
161
243
  );
162
- }), C = ({
244
+ }), I = ({
163
245
  hideTooltip: e,
164
- tooltip: t,
165
- children: n,
166
- triggerClassName: r,
167
- contentClassName: s,
168
- ...o
169
- }) => e || !t ? /* @__PURE__ */ l("span", { className: r, children: n }) : /* @__PURE__ */ m(de, { ...o, children: [
170
- /* @__PURE__ */ l(me, { className: d(r, "truncate"), children: n }),
171
- /* @__PURE__ */ l(
172
- pe,
246
+ tooltip: r,
247
+ children: t,
248
+ triggerClassName: s,
249
+ contentClassName: o,
250
+ ...a
251
+ }) => e || !r ? /* @__PURE__ */ n("span", { className: s, children: t }) : /* @__PURE__ */ m(Pe, { ...a, children: [
252
+ /* @__PURE__ */ n(Ae, { className: d(s, "truncate"), children: t }),
253
+ /* @__PURE__ */ n(
254
+ Se,
173
255
  {
174
256
  className: d(
175
257
  "text-primary",
176
- s,
258
+ o,
177
259
  "max-w-[300px]",
178
- (e || !t) && "hidden"
260
+ (e || !r) && "hidden"
179
261
  ),
180
- children: t
262
+ children: r
181
263
  }
182
264
  )
183
- ] }), fe = ({
265
+ ] }), Le = 18, S = {
266
+ size: Le,
267
+ stroke: 2
268
+ }, Ye = ({
269
+ label: e,
270
+ id: r,
271
+ checked: t,
272
+ indeterminate: s,
273
+ disabled: o,
274
+ ariaLabel: a,
275
+ onChange: l
276
+ }) => {
277
+ const i = O(
278
+ (u) => {
279
+ u.stopPropagation(), l?.(u.target.checked, r);
280
+ },
281
+ [l, r]
282
+ ), c = d(
283
+ "flex flex-row items-center cursor-pointer text-accent-primary small-medium flex-1 min-w-0",
284
+ `${t ? "" : 'before:content-[""] before:inline-block before:w-[18px] before:h-[18px] before:border before:border-hover before:rounded before:mr-2'}`,
285
+ o ? "pointer-events-none text-secondary before:border-icon-secondary before:bg-layer-4" : ""
286
+ ), f = d(
287
+ "mr-2 border rounded",
288
+ o ? "bg-layer-4 border-icon-secondary" : ""
289
+ );
290
+ return /* @__PURE__ */ m("label", { className: c, htmlFor: r, children: [
291
+ t && (s ? /* @__PURE__ */ n(Q, { className: f, ...S }) : /* @__PURE__ */ n(A, { className: f, ...S })),
292
+ e && /* @__PURE__ */ n(I, { tooltip: e, triggerClassName: "flex-1 min-w-0", children: /* @__PURE__ */ n("p", { className: "text-primary w-full truncate", children: e }) }),
293
+ /* @__PURE__ */ n(
294
+ "input",
295
+ {
296
+ type: "checkbox",
297
+ onChange: i,
298
+ id: r,
299
+ checked: t,
300
+ "aria-checked": s ? "mixed" : t,
301
+ "aria-disabled": o || void 0,
302
+ "aria-label": e ? void 0 : a,
303
+ className: "invisible w-0 h-0"
304
+ }
305
+ )
306
+ ] });
307
+ };
308
+ var p = /* @__PURE__ */ ((e) => (e.VALID = "valid", e.ERROR = "error", e))(p || {});
309
+ const Oe = (e, r) => {
310
+ if (r === e.id)
311
+ switch (e.status) {
312
+ case p.VALID:
313
+ return "border-accent-secondary text-primary";
314
+ case p.ERROR:
315
+ return "border-red-900 text-primary";
316
+ default:
317
+ return "border-accent-primary text-primary";
318
+ }
319
+ switch (e.status) {
320
+ case p.VALID:
321
+ return "border-primary text-white";
322
+ case p.ERROR:
323
+ return "border-red-900 text-error";
324
+ default:
325
+ return "border-primary text-secondary";
326
+ }
327
+ }, ze = (e, r) => {
328
+ if (r === e.id)
329
+ switch (e.status) {
330
+ case p.VALID:
331
+ return "bg-accent-secondary";
332
+ case p.ERROR:
333
+ return "bg-red-400";
334
+ default:
335
+ return "bg-accent-primary";
336
+ }
337
+ switch (e.status) {
338
+ case p.VALID:
339
+ return "bg-accent-secondary";
340
+ case p.ERROR:
341
+ return "bg-red-400";
342
+ default:
343
+ return "bg-layer-4";
344
+ }
345
+ }, Ve = ({
346
+ step: e,
347
+ index: r,
348
+ currentStep: t,
349
+ handleStepChange: s
350
+ }) => {
351
+ const o = "h-[32px] flex flex-1 min-w-[180px] items-center dial-tiny border-t-2 cursor-pointer", a = "w-[22px] h-[22px] flex justify-center items-center mr-2 rounded-full text-white", l = () => t === e.id && e.status === p.ERROR ? /* @__PURE__ */ n(ee, { stroke: 2, size: 16 }) : t !== e.id && e.status === p.VALID ? /* @__PURE__ */ n(A, { stroke: 2, size: 16 }) : r + 1;
352
+ return /* @__PURE__ */ m(
353
+ "button",
354
+ {
355
+ className: d(o, Oe(e, t)),
356
+ onClick: () => s(e.id),
357
+ children: [
358
+ /* @__PURE__ */ n(
359
+ "span",
360
+ {
361
+ className: d(a, ze(e, t)),
362
+ children: l()
363
+ }
364
+ ),
365
+ /* @__PURE__ */ n("span", { children: e.name })
366
+ ]
367
+ }
368
+ );
369
+ }, qe = ({
370
+ steps: e,
371
+ currentStep: r,
372
+ setCurrentStep: t
373
+ }) => {
374
+ const s = (o) => {
375
+ const a = e.findIndex((i) => i.id === r), l = e.findIndex((i) => i.id === o);
376
+ (o !== r && e[a].status === p.VALID || l < a) && t(o);
377
+ };
378
+ return /* @__PURE__ */ n("div", { id: "steps", className: "flex gap-x-3", children: e.map((o, a) => /* @__PURE__ */ n(
379
+ Ve,
380
+ {
381
+ currentStep: r,
382
+ handleStepChange: s,
383
+ step: o,
384
+ index: a
385
+ },
386
+ o.id
387
+ )) });
388
+ }, _e = ({
184
389
  value: e,
185
- textareaId: t,
186
- placeholder: n,
187
- cssClass: r = "",
188
- disabled: s,
189
- invalid: o,
190
- readonly: a,
191
- onChange: c
192
- }) => /* @__PURE__ */ l(C, { tooltip: e, triggerClassName: "flex", children: /* @__PURE__ */ l(
390
+ textareaId: r,
391
+ placeholder: t,
392
+ cssClass: s = "",
393
+ disabled: o,
394
+ invalid: a,
395
+ readonly: l,
396
+ onChange: i
397
+ }) => /* @__PURE__ */ n(I, { tooltip: e, triggerClassName: "flex", children: /* @__PURE__ */ n(
193
398
  "textarea",
194
399
  {
195
- id: t,
196
- placeholder: n,
400
+ id: r,
401
+ placeholder: t,
197
402
  value: e || "",
198
- disabled: s,
403
+ disabled: o,
199
404
  className: d(
200
405
  "dial-textarea dial-input",
201
- o ? "dial-input-error" : "",
202
- s && "dial-input-disable",
203
- a && "dial-input-readonly",
204
- r
406
+ a ? "dial-input-error" : "",
407
+ o && "dial-input-disable",
408
+ l && "dial-input-readonly",
409
+ s
205
410
  ),
206
- onChange: (i) => !a && c?.(i.currentTarget.value)
411
+ onChange: (c) => !l && i?.(c.currentTarget.value)
207
412
  }
208
- ) }), he = [
413
+ ) }), je = [
209
414
  "ArrowLeft",
210
415
  "ArrowRight",
211
416
  "ArrowUp",
@@ -217,269 +422,276 @@ const y = ({ icon: e, className: t }) => e ? /* @__PURE__ */ l("span", { classNa
217
422
  "Escape",
218
423
  "Home",
219
424
  "End"
220
- ], ge = (e, t, n, r) => {
221
- if ((t === "number" || n !== void 0 || r !== void 0) && !he.includes(e.key) && !(e.key === "-" && e.currentTarget.selectionStart === 0 && (n === void 0 || n < 0)) && !(e.key === "." && t === "number" && !e.currentTarget.value.includes("."))) {
425
+ ], We = (e, r, t, s) => {
426
+ if ((r === "number" || t !== void 0 || s !== void 0) && !je.includes(e.key) && !(e.key === "-" && e.currentTarget.selectionStart === 0 && (t === void 0 || t < 0)) && !(e.key === "." && r === "number" && !e.currentTarget.value.includes("."))) {
222
427
  if (!/^[0-9]$/.test(e.key)) {
223
428
  e.preventDefault();
224
429
  return;
225
430
  }
226
- if (n !== void 0 || r !== void 0) {
227
- const o = e.currentTarget.value, a = e.currentTarget.selectionStart || 0, c = o.slice(0, a) + e.key + o.slice(a), i = parseFloat(c);
228
- if (!isNaN(i)) {
229
- if (n !== void 0 && i < n) {
431
+ if (t !== void 0 || s !== void 0) {
432
+ const a = e.currentTarget.value, l = e.currentTarget.selectionStart || 0, i = a.slice(0, l) + e.key + a.slice(l), c = parseFloat(i);
433
+ if (!isNaN(c)) {
434
+ if (t !== void 0 && c < t) {
230
435
  e.preventDefault();
231
436
  return;
232
437
  }
233
- if (r !== void 0 && i > r) {
438
+ if (s !== void 0 && c > s) {
234
439
  e.preventDefault();
235
440
  return;
236
441
  }
237
442
  }
238
443
  }
239
444
  }
240
- }, F = ({
445
+ }, E = ({
241
446
  iconBeforeInput: e,
242
- iconAfterInput: t,
243
- hideBorder: n,
244
- value: r,
245
- elementId: s,
246
- placeholder: o = "",
247
- cssClass: a = "",
248
- containerCssClass: c,
249
- tooltipTriggerClassName: i,
250
- type: p = "text",
447
+ iconAfterInput: r,
448
+ hideBorder: t,
449
+ value: s,
450
+ elementId: o,
451
+ placeholder: a = "",
452
+ cssClass: l = "",
453
+ containerCssClass: i,
454
+ tooltipTriggerClassName: c,
455
+ type: f = "text",
251
456
  disabled: u,
252
- readonly: f,
253
- invalid: D,
457
+ readonly: b,
458
+ invalid: C,
254
459
  onChange: T,
255
460
  min: g,
256
461
  max: h,
257
- prefix: k,
258
- suffix: R,
259
- textBeforeInput: N,
260
- textAfterInput: x
462
+ prefix: F,
463
+ suffix: P,
464
+ textBeforeInput: w,
465
+ textAfterInput: v
261
466
  }) => {
262
- const j = (b) => b.target.blur(), H = p === "number" || g !== void 0 || h !== void 0, L = (b) => {
263
- ge(b, p, g, h);
264
- }, U = (b) => {
265
- const v = b.currentTarget.value;
266
- if (H && v !== "") {
267
- const w = parseFloat(v);
268
- if (isNaN(w) && v !== "-" && v !== "." || !isNaN(w) && (g !== void 0 && w < g || h !== void 0 && w > h))
467
+ const B = (x) => x.target.blur(), H = f === "number" || g !== void 0 || h !== void 0, U = (x) => {
468
+ We(x, f, g, h);
469
+ }, K = (x) => {
470
+ const D = x.currentTarget.value;
471
+ if (H && D !== "") {
472
+ const R = parseFloat(D);
473
+ if (isNaN(R) && D !== "-" && D !== "." || !isNaN(R) && (g !== void 0 && R < g || h !== void 0 && R > h))
269
474
  return;
270
475
  }
271
- T?.(v);
476
+ T?.(D);
272
477
  };
273
478
  return /* @__PURE__ */ m(
274
479
  "div",
275
480
  {
276
481
  className: d(
277
482
  "dial-input-field flex flex-row items-center justify-between",
278
- n ? "dial-input-no-border" : "dial-input",
279
- D && "dial-input-error",
483
+ t ? "dial-input-no-border" : "dial-input",
484
+ C && "dial-input-error",
280
485
  u && "dial-input-disable",
281
- f && "dial-input-readonly",
282
- !N && "pl-1",
283
- !x && "pr-1",
284
- c
486
+ b && "dial-input-readonly",
487
+ !w && "pl-1",
488
+ !v && "pr-1",
489
+ i
285
490
  ),
286
491
  children: [
287
- N && /* @__PURE__ */ l(C, { tooltip: N, children: /* @__PURE__ */ l(
288
- F,
492
+ w && /* @__PURE__ */ n(I, { tooltip: w, children: /* @__PURE__ */ n(
493
+ E,
289
494
  {
290
495
  hideBorder: !0,
291
496
  containerCssClass: "rounded-r-none border-r-0",
292
497
  cssClass: "px-2 overflow-hidden overflow-ellipsis dial-small",
293
- value: N,
498
+ value: w,
294
499
  disabled: !0,
295
- elementId: N + "textBefore"
500
+ elementId: w + "textBefore"
296
501
  }
297
502
  ) }),
298
- k && /* @__PURE__ */ m("p", { className: "text-secondary dial-small pl-2", children: [
503
+ F && /* @__PURE__ */ m("p", { className: "text-secondary dial-small pl-2", children: [
299
504
  " ",
300
- k
505
+ F
301
506
  ] }),
302
- /* @__PURE__ */ l(y, { icon: e, className: "pl-2" }),
303
- /* @__PURE__ */ l(C, { tooltip: r, triggerClassName: i, children: /* @__PURE__ */ l(
507
+ /* @__PURE__ */ n(N, { icon: e, className: "pl-2" }),
508
+ /* @__PURE__ */ n(I, { tooltip: s, triggerClassName: c, children: /* @__PURE__ */ n(
304
509
  "input",
305
510
  {
306
- type: p,
511
+ type: f,
307
512
  autoComplete: "off",
308
- id: s,
309
- placeholder: o,
310
- value: r ?? "",
311
- title: r ? String(r) : "",
513
+ id: o,
514
+ placeholder: a,
515
+ value: s ?? "",
516
+ title: s ? String(s) : "",
312
517
  disabled: u,
313
- className: d("border-0 bg-transparent px-2", a),
314
- onChange: (b) => !f && U?.(b),
315
- onKeyDown: L,
316
- onWheel: j,
518
+ className: d("border-0 bg-transparent px-2", l),
519
+ onChange: (x) => !b && K?.(x),
520
+ onKeyDown: U,
521
+ onWheel: B,
317
522
  min: g,
318
523
  max: h
319
524
  }
320
525
  ) }),
321
- /* @__PURE__ */ l(y, { icon: t, className: "pr-2" }),
322
- R && /* @__PURE__ */ m("p", { className: "text-secondary dial-small pr-2", children: [
526
+ /* @__PURE__ */ n(N, { icon: r, className: "pr-2" }),
527
+ P && /* @__PURE__ */ m("p", { className: "text-secondary dial-small pr-2", children: [
323
528
  " ",
324
- R
529
+ P
325
530
  ] }),
326
- x && /* @__PURE__ */ l(C, { tooltip: x, children: /* @__PURE__ */ l(
327
- F,
531
+ v && /* @__PURE__ */ n(I, { tooltip: v, children: /* @__PURE__ */ n(
532
+ E,
328
533
  {
329
534
  hideBorder: !0,
330
535
  containerCssClass: "rounded-l-none border-l-0",
331
536
  cssClass: "px-2",
332
- value: x,
537
+ value: v,
333
538
  disabled: !0,
334
- elementId: x + "textAfter"
539
+ elementId: v + "textAfter"
335
540
  }
336
541
  ) })
337
542
  ]
338
543
  }
339
544
  );
340
- }, be = /^0+\.(\d+)?$/, Ne = /^0+/, W = ({
545
+ }, Me = /^0+\.(\d+)?$/, Be = /^0+/, M = ({
341
546
  fieldTitle: e,
342
- errorText: t,
343
- optional: n,
344
- elementCssClass: r,
345
- elementContainerCssClass: s,
346
- elementId: o,
347
- containerCssClass: a,
348
- readonly: c,
349
- defaultEmptyText: i,
350
- min: p,
547
+ errorText: r,
548
+ optional: t,
549
+ elementCssClass: s,
550
+ elementContainerCssClass: o,
551
+ elementId: a,
552
+ containerCssClass: l,
553
+ readonly: i,
554
+ defaultEmptyText: c,
555
+ min: f,
351
556
  max: u,
352
- ...f
353
- }) => /* @__PURE__ */ m("div", { className: d("flex flex-col", a), children: [
354
- /* @__PURE__ */ l(
355
- A,
557
+ ...b
558
+ }) => /* @__PURE__ */ m("div", { className: d("flex flex-col", l), children: [
559
+ /* @__PURE__ */ n(
560
+ _,
356
561
  {
357
562
  fieldTitle: e,
358
- optional: n,
359
- htmlFor: o
563
+ optional: t,
564
+ htmlFor: a
360
565
  }
361
566
  ),
362
- c ? /* @__PURE__ */ l("span", { children: f.value || (i ?? "None") }) : /* @__PURE__ */ m(_, { children: [
363
- /* @__PURE__ */ l(
364
- F,
567
+ i ? /* @__PURE__ */ n("span", { children: b.value || (c ?? "None") }) : /* @__PURE__ */ m($, { children: [
568
+ /* @__PURE__ */ n(
569
+ E,
365
570
  {
366
- elementId: o,
367
- cssClass: r,
368
- containerCssClass: s,
369
- invalid: t != null,
370
- min: p,
571
+ elementId: a,
572
+ cssClass: s,
573
+ containerCssClass: o,
574
+ invalid: r != null,
575
+ min: f,
371
576
  max: u,
372
- ...f
577
+ ...b
373
578
  }
374
579
  ),
375
- /* @__PURE__ */ l(S, { errorText: t })
580
+ /* @__PURE__ */ n(V, { errorText: r })
376
581
  ] })
377
- ] }), De = ({
582
+ ] }), Je = ({
378
583
  onChange: e,
379
- value: t,
380
- min: n,
381
- max: r,
382
- ...s
584
+ value: r,
585
+ min: t,
586
+ max: s,
587
+ ...o
383
588
  }) => {
384
- const o = (a) => String(a)?.match(be) ? String(a)?.replace(Ne, "0") : Number(a);
385
- return /* @__PURE__ */ l(
386
- W,
589
+ const a = (l) => String(l)?.match(Me) ? String(l)?.replace(Be, "0") : Number(l);
590
+ return /* @__PURE__ */ n(
591
+ M,
387
592
  {
388
593
  type: "number",
389
- onChange: (a) => e?.(o(a)),
390
- value: t,
391
- min: n,
392
- max: r,
393
- ...s
594
+ onChange: (l) => e?.(a(l)),
595
+ value: r,
596
+ min: t,
597
+ max: s,
598
+ ...o
394
599
  }
395
600
  );
396
- }, Te = ({
601
+ }, Qe = ({
397
602
  onChange: e,
398
- ...t
399
- }) => /* @__PURE__ */ l(
400
- W,
603
+ ...r
604
+ }) => /* @__PURE__ */ n(
605
+ M,
401
606
  {
402
607
  type: "text",
403
- onChange: (n) => e?.(n),
404
- ...t
608
+ onChange: (t) => e?.(t),
609
+ ...r
405
610
  }
406
- ), Fe = ({
611
+ ), er = ({
407
612
  fieldTitle: e,
408
- optional: t,
409
- elementId: n,
410
- elementCssClass: r,
411
- errorText: s,
412
- ...o
613
+ optional: r,
614
+ elementId: t,
615
+ elementCssClass: s,
616
+ errorText: o,
617
+ ...a
413
618
  }) => /* @__PURE__ */ m("div", { className: "flex flex-col", children: [
414
- /* @__PURE__ */ l(
415
- A,
619
+ /* @__PURE__ */ n(
620
+ _,
416
621
  {
417
622
  fieldTitle: e,
418
- optional: t,
419
- htmlFor: n
623
+ optional: r,
624
+ htmlFor: t
420
625
  }
421
626
  ),
422
- /* @__PURE__ */ l(
423
- fe,
627
+ /* @__PURE__ */ n(
628
+ _e,
424
629
  {
425
- textareaId: n,
426
- cssClass: r,
427
- ...o
630
+ textareaId: t,
631
+ cssClass: s,
632
+ ...a
428
633
  }
429
634
  ),
430
- /* @__PURE__ */ l(S, { errorText: s })
431
- ] }), ke = ({
635
+ /* @__PURE__ */ n(V, { errorText: o })
636
+ ] }), rr = ({
432
637
  title: e,
433
- switchId: t,
434
- isOn: n = !1,
435
- disabled: r,
436
- onChange: s
638
+ switchId: r,
639
+ isOn: t = !1,
640
+ disabled: s,
641
+ onChange: o
437
642
  }) => {
438
- const o = d(
439
- "flex w-[36px] h-[18px] cursor-pointer items-center gap-1 rounded-full p-0.5 transition-all duration-200",
440
- n ? "flex-row-reverse" : "flex-row",
441
- r ? "pointer-events-none" : "",
442
- r ? n ? "bg-controls-disable" : "bg-layer-4" : n ? "bg-accent-primary" : "bg-layer-4"
443
- ), a = ae(
444
- (c) => {
445
- c.stopPropagation(), s?.(!n);
643
+ const a = d(
644
+ "flex w-[36px] h-[18px] cursor-pointer items-center gap-1 rounded-full p-0.5 transition-all duration-200",
645
+ t ? "flex-row-reverse" : "flex-row",
646
+ s ? "pointer-events-none" : "",
647
+ s ? t ? "bg-controls-disable" : "bg-layer-4" : t ? "bg-accent-primary" : "bg-layer-4"
648
+ ), l = O(
649
+ (i) => {
650
+ i.stopPropagation(), o?.(!t);
446
651
  },
447
- [s, n]
652
+ [o, t]
448
653
  );
449
654
  return /* @__PURE__ */ m("div", { className: "flex flex-row items-center", children: [
450
- /* @__PURE__ */ l(
655
+ /* @__PURE__ */ n(
451
656
  "input",
452
657
  {
453
658
  type: "checkbox",
454
- onChange: a,
455
- id: t,
456
- disabled: r,
659
+ onChange: l,
660
+ id: r,
661
+ disabled: s,
457
662
  className: "invisible w-0 h-0",
458
- checked: n
663
+ checked: t
459
664
  }
460
665
  ),
461
- /* @__PURE__ */ l("label", { htmlFor: t, className: o, children: /* @__PURE__ */ l(
666
+ /* @__PURE__ */ n("label", { htmlFor: r, className: a, children: /* @__PURE__ */ n(
462
667
  "span",
463
668
  {
464
669
  className: d(
465
670
  "size-3 rounded-full",
466
- r ? n ? "bg-controls-disable" : "bg-layer-4" : "bg-controls-enable-primary"
671
+ s ? t ? "bg-layer-4" : "bg-controls-disable" : "bg-controls-enable-primary"
467
672
  )
468
673
  }
469
674
  ) }),
470
- e && /* @__PURE__ */ l("span", { className: "h-[14px] pl-2 small text-primary", children: e })
675
+ e && /* @__PURE__ */ n("span", { className: "pl-2 dial-small text-primary", children: e })
471
676
  ] });
472
677
  };
473
678
  export {
474
- ye as DialButton,
475
- S as DialErrorText,
476
- A as DialFieldLabel,
477
- y as DialIcon,
478
- F as DialInput,
479
- De as DialNumberInputField,
480
- ke as DialSwitch,
481
- Fe as DialTextAreaField,
482
- Te as DialTextInputField,
483
- fe as DialTextarea,
484
- C as DialTooltip
679
+ y as AlertVariant,
680
+ k as ButtonVariant,
681
+ Ze as DialAlert,
682
+ we as DialButton,
683
+ Ye as DialCheckbox,
684
+ V as DialErrorText,
685
+ _ as DialFieldLabel,
686
+ N as DialIcon,
687
+ E as DialInput,
688
+ Xe as DialLoader,
689
+ Je as DialNumberInputField,
690
+ qe as DialSteps,
691
+ rr as DialSwitch,
692
+ er as DialTextAreaField,
693
+ Qe as DialTextInputField,
694
+ _e as DialTextarea,
695
+ I as DialTooltip,
696
+ p as StepStatus
485
697
  };