@epam/ai-dial-ui-kit 0.1.0-rc → 0.1.0-rc.1

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,444 +1,138 @@
1
- import me, { createContext as pe, useState as be, useRef as ge, useMemo as xe, useContext as ve, forwardRef as Q, isValidElement as je, cloneElement as he } from "react";
2
- import j from "classnames";
3
- import { useFloating as Ee, offset as ke, flip as Re, shift as Te, arrow as _e, autoUpdate as Ne, useHover as we, useFocus as Ce, useDismiss as ye, useRole as Se, useInteractions as Oe, useMergeRefs as K, FloatingPortal as Ae, FloatingArrow as Fe } from "@floating-ui/react";
4
- import "monaco-editor";
5
- import { Editor as Pe } from "@monaco-editor/react";
6
- var O = { exports: {} }, C = {};
7
- /**
8
- * @license React
9
- * react-jsx-runtime.production.js
10
- *
11
- * Copyright (c) Meta Platforms, Inc. and affiliates.
12
- *
13
- * This source code is licensed under the MIT license found in the
14
- * LICENSE file in the root directory of this source tree.
15
- */
16
- var V;
17
- function De() {
18
- if (V) return C;
19
- V = 1;
20
- var r = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
21
- function a(l, n, i) {
22
- var c = null;
23
- if (i !== void 0 && (c = "" + i), n.key !== void 0 && (c = "" + n.key), "key" in n) {
24
- i = {};
25
- for (var d in n)
26
- d !== "key" && (i[d] = n[d]);
27
- } else i = n;
28
- return n = i.ref, {
29
- $$typeof: r,
30
- type: l,
31
- key: c,
32
- ref: n !== void 0 ? n : null,
33
- props: i
34
- };
35
- }
36
- return C.Fragment = t, C.jsx = a, C.jsxs = a, C;
37
- }
38
- var y = {};
39
- /**
40
- * @license React
41
- * react-jsx-runtime.development.js
42
- *
43
- * Copyright (c) Meta Platforms, Inc. and affiliates.
44
- *
45
- * This source code is licensed under the MIT license found in the
46
- * LICENSE file in the root directory of this source tree.
47
- */
48
- var H;
49
- function Le() {
50
- return H || (H = 1, process.env.NODE_ENV !== "production" && (function() {
51
- function r(e) {
52
- if (e == null) return null;
53
- if (typeof e == "function")
54
- return e.$$typeof === ue ? null : e.displayName || e.name || null;
55
- if (typeof e == "string") return e;
56
- switch (e) {
57
- case h:
58
- return "Fragment";
59
- case R:
60
- return "Profiler";
61
- case S:
62
- return "StrictMode";
63
- case ae:
64
- return "Suspense";
65
- case le:
66
- return "SuspenseList";
67
- case ce:
68
- return "Activity";
69
- }
70
- if (typeof e == "object")
71
- switch (typeof e.tag == "number" && console.error(
72
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
73
- ), e.$$typeof) {
74
- case w:
75
- return "Portal";
76
- case F:
77
- return (e.displayName || "Context") + ".Provider";
78
- case T:
79
- return (e._context.displayName || "Context") + ".Consumer";
80
- case se:
81
- var s = e.render;
82
- return e = e.displayName, e || (e = s.displayName || s.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
83
- case ie:
84
- return s = e.displayName || null, s !== null ? s : r(e.type) || "Memo";
85
- case B:
86
- s = e._payload, e = e._init;
87
- try {
88
- return r(e(s));
89
- } catch {
90
- }
91
- }
92
- return null;
93
- }
94
- function t(e) {
95
- return "" + e;
96
- }
97
- function a(e) {
98
- try {
99
- t(e);
100
- var s = !1;
101
- } catch {
102
- s = !0;
103
- }
104
- if (s) {
105
- s = console;
106
- var u = s.error, p = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
107
- return u.call(
108
- s,
109
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
110
- p
111
- ), t(e);
112
- }
113
- }
114
- function l(e) {
115
- if (e === h) return "<>";
116
- if (typeof e == "object" && e !== null && e.$$typeof === B)
117
- return "<...>";
118
- try {
119
- var s = r(e);
120
- return s ? "<" + s + ">" : "<...>";
121
- } catch {
122
- return "<...>";
123
- }
124
- }
125
- function n() {
126
- var e = P.A;
127
- return e === null ? null : e.getOwner();
128
- }
129
- function i() {
130
- return Error("react-stack-top-frame");
131
- }
132
- function c(e) {
133
- if (W.call(e, "key")) {
134
- var s = Object.getOwnPropertyDescriptor(e, "key").get;
135
- if (s && s.isReactWarning) return !1;
136
- }
137
- return e.key !== void 0;
138
- }
139
- function d(e, s) {
140
- function u() {
141
- U || (U = !0, console.error(
142
- "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
143
- s
144
- ));
145
- }
146
- u.isReactWarning = !0, Object.defineProperty(e, "key", {
147
- get: u,
148
- configurable: !0
149
- });
150
- }
151
- function f() {
152
- var e = r(this.type);
153
- return z[e] || (z[e] = !0, console.error(
154
- "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
155
- )), e = this.props.ref, e !== void 0 ? e : null;
156
- }
157
- function g(e, s, u, p, k, v, L, Y) {
158
- return u = v.ref, e = {
159
- $$typeof: _,
160
- type: e,
161
- key: s,
162
- props: v,
163
- _owner: k
164
- }, (u !== void 0 ? u : null) !== null ? Object.defineProperty(e, "ref", {
165
- enumerable: !1,
166
- get: f
167
- }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
168
- configurable: !1,
169
- enumerable: !1,
170
- writable: !0,
171
- value: 0
172
- }), Object.defineProperty(e, "_debugInfo", {
173
- configurable: !1,
174
- enumerable: !1,
175
- writable: !0,
176
- value: null
177
- }), Object.defineProperty(e, "_debugStack", {
178
- configurable: !1,
179
- enumerable: !1,
180
- writable: !0,
181
- value: L
182
- }), Object.defineProperty(e, "_debugTask", {
183
- configurable: !1,
184
- enumerable: !1,
185
- writable: !0,
186
- value: Y
187
- }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
188
- }
189
- function m(e, s, u, p, k, v, L, Y) {
190
- var b = s.children;
191
- if (b !== void 0)
192
- if (p)
193
- if (de(b)) {
194
- for (p = 0; p < b.length; p++)
195
- x(b[p]);
196
- Object.freeze && Object.freeze(b);
197
- } else
198
- console.error(
199
- "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
200
- );
201
- else x(b);
202
- if (W.call(s, "key")) {
203
- b = r(e);
204
- var N = Object.keys(s).filter(function(fe) {
205
- return fe !== "key";
206
- });
207
- p = 0 < N.length ? "{key: someKey, " + N.join(": ..., ") + ": ...}" : "{key: someKey}", J[b + p] || (N = 0 < N.length ? "{" + N.join(": ..., ") + ": ...}" : "{}", console.error(
208
- `A props object containing a "key" prop is being spread into JSX:
209
- let props = %s;
210
- <%s {...props} />
211
- React keys must be passed directly to JSX without using spread:
212
- let props = %s;
213
- <%s key={someKey} {...props} />`,
214
- p,
215
- b,
216
- N,
217
- b
218
- ), J[b + p] = !0);
219
- }
220
- if (b = null, u !== void 0 && (a(u), b = "" + u), c(s) && (a(s.key), b = "" + s.key), "key" in s) {
221
- u = {};
222
- for (var I in s)
223
- I !== "key" && (u[I] = s[I]);
224
- } else u = s;
225
- return b && d(
226
- u,
227
- typeof e == "function" ? e.displayName || e.name || "Unknown" : e
228
- ), g(
229
- e,
230
- b,
231
- v,
232
- k,
233
- n(),
234
- u,
235
- L,
236
- Y
237
- );
238
- }
239
- function x(e) {
240
- typeof e == "object" && e !== null && e.$$typeof === _ && e._store && (e._store.validated = 1);
241
- }
242
- var E = me, _ = Symbol.for("react.transitional.element"), w = Symbol.for("react.portal"), h = Symbol.for("react.fragment"), S = Symbol.for("react.strict_mode"), R = Symbol.for("react.profiler"), T = Symbol.for("react.consumer"), F = Symbol.for("react.context"), se = Symbol.for("react.forward_ref"), ae = Symbol.for("react.suspense"), le = Symbol.for("react.suspense_list"), ie = Symbol.for("react.memo"), B = Symbol.for("react.lazy"), ce = Symbol.for("react.activity"), ue = Symbol.for("react.client.reference"), P = E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, W = Object.prototype.hasOwnProperty, de = Array.isArray, D = console.createTask ? console.createTask : function() {
243
- return null;
244
- };
245
- E = {
246
- react_stack_bottom_frame: function(e) {
247
- return e();
248
- }
249
- };
250
- var U, z = {}, q = E.react_stack_bottom_frame.bind(
251
- E,
252
- i
253
- )(), G = D(l(i)), J = {};
254
- y.Fragment = h, y.jsx = function(e, s, u, p, k) {
255
- var v = 1e4 > P.recentlyCreatedOwnerStacks++;
256
- return m(
257
- e,
258
- s,
259
- u,
260
- !1,
261
- p,
262
- k,
263
- v ? Error("react-stack-top-frame") : q,
264
- v ? D(l(e)) : G
265
- );
266
- }, y.jsxs = function(e, s, u, p, k) {
267
- var v = 1e4 > P.recentlyCreatedOwnerStacks++;
268
- return m(
269
- e,
270
- s,
271
- u,
272
- !0,
273
- p,
274
- k,
275
- v ? Error("react-stack-top-frame") : q,
276
- v ? D(l(e)) : G
277
- );
278
- };
279
- })()), y;
280
- }
281
- var X;
282
- function Ye() {
283
- return X || (X = 1, process.env.NODE_ENV === "production" ? O.exports = De() : O.exports = Le()), O.exports;
284
- }
285
- var o = Ye();
286
- const A = ({ icon: r, className: t }) => r ? /* @__PURE__ */ o.jsx("span", { className: j("flex-shrink-0", t), children: r }) : null, Ke = ({
287
- title: r,
1
+ import { jsx as l, jsxs as m, Fragment as _ } from "react/jsx-runtime";
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 = ({
6
+ title: e,
288
7
  cssClass: t,
289
- ref: a,
290
- onClick: l,
291
- disable: n,
292
- iconAfter: i,
293
- iconBefore: c,
294
- hideTitleOnMobile: d,
295
- ariaLabel: f
8
+ ref: n,
9
+ onClick: r,
10
+ disable: s,
11
+ iconAfter: o,
12
+ iconBefore: a,
13
+ hideTitleOnMobile: c,
14
+ ariaLabel: i
296
15
  }) => {
297
- const g = j(
16
+ const p = d(
298
17
  "dial-small-semi",
299
- i ? "mr-2" : "",
300
- c ? "ml-2" : "",
301
- d ? "hidden sm:inline" : "inline"
302
- ), m = j(
18
+ o ? "mr-2" : "",
19
+ a ? "ml-2" : "",
20
+ c ? "hidden sm:inline" : "inline"
21
+ ), u = d(
303
22
  t,
304
23
  "focus-visible:outline outline-offset-0"
305
24
  );
306
- return /* @__PURE__ */ o.jsxs(
25
+ return /* @__PURE__ */ m(
307
26
  "button",
308
27
  {
309
- ref: a,
28
+ ref: n,
310
29
  type: "button",
311
- className: m,
312
- onClick: (x) => l?.(x),
313
- disabled: n,
314
- "aria-label": r || f,
30
+ className: u,
31
+ onClick: (f) => r?.(f),
32
+ disabled: s,
33
+ "aria-label": e || i,
315
34
  children: [
316
- /* @__PURE__ */ o.jsx(A, { icon: c }),
317
- r && /* @__PURE__ */ o.jsx("span", { className: g, children: r }),
318
- /* @__PURE__ */ o.jsx(A, { icon: i })
35
+ /* @__PURE__ */ l(y, { icon: a }),
36
+ e && /* @__PURE__ */ l("span", { className: p, children: e }),
37
+ /* @__PURE__ */ l(y, { icon: o })
319
38
  ]
320
39
  }
321
40
  );
322
- }, ee = ({ errorText: r }) => r && /* @__PURE__ */ o.jsx("span", { className: "text-error dial-tiny mt-1", children: r }), re = ({
323
- fieldTitle: r,
41
+ }, S = ({ errorText: e }) => e && /* @__PURE__ */ l("span", { className: "text-error dial-tiny mt-1", children: e }), A = ({
42
+ fieldTitle: e,
324
43
  htmlFor: t,
325
- optional: a,
326
- optionalText: l,
327
- cssClass: n
328
- }) => r ? /* @__PURE__ */ o.jsxs(
44
+ optional: n,
45
+ optionalText: r,
46
+ cssClass: s
47
+ }) => e ? /* @__PURE__ */ m(
329
48
  "label",
330
49
  {
331
- className: j(
50
+ className: d(
332
51
  "dial-tiny text-secondary",
333
- n,
334
- !n?.includes("mb") && "mb-2"
52
+ s,
53
+ !s?.includes("mb") && "mb-2"
335
54
  ),
336
55
  htmlFor: t,
337
56
  children: [
338
- /* @__PURE__ */ o.jsx("span", { className: "min-h-4", children: r }),
339
- a && /* @__PURE__ */ o.jsx("span", { className: "ml-1", children: l ?? "(Optional)" })
57
+ /* @__PURE__ */ l("span", { className: "min-h-4", children: e }),
58
+ n && /* @__PURE__ */ l("span", { className: "ml-1", children: r ?? "(Optional)" })
340
59
  ]
341
60
  }
342
- ) : null, Ie = ({
343
- value: r,
344
- textareaId: t,
345
- placeholder: a,
346
- cssClass: l = "",
347
- disabled: n,
348
- invalid: i,
349
- readonly: c,
350
- onChange: d
351
- }) => /* @__PURE__ */ o.jsx(
352
- "textarea",
353
- {
354
- id: t,
355
- placeholder: a,
356
- value: r,
357
- disabled: n,
358
- className: j(
359
- "dial-textarea dial-input",
360
- i ? "dial-input-error" : "",
361
- n && "dial-input-disable",
362
- c && "dial-input-readonly",
363
- l
364
- ),
365
- onChange: (f) => !c && d?.(f.currentTarget.value)
366
- }
367
- ), Me = 7, $e = 2, te = pe(null), ne = () => {
368
- const r = ve(te);
369
- if (r == null)
61
+ ) : null, ie = 7, ce = 2, I = ee(null), V = () => {
62
+ const e = le(I);
63
+ if (e == null)
370
64
  throw new Error("Tooltip components must be wrapped in <Tooltip />");
371
- return r;
372
- }, Be = ({
373
- initialOpen: r = !1,
65
+ return e;
66
+ }, ue = ({
67
+ initialOpen: e = !1,
374
68
  placement: t = "bottom",
375
- isTriggerClickable: a = !1,
376
- open: l,
377
- onOpenChange: n
69
+ isTriggerClickable: n = !1,
70
+ open: r,
71
+ onOpenChange: s
378
72
  } = {}) => {
379
- const [i, c] = be(r), d = ge(null), f = l ?? i, g = n ?? c, m = Ee({
73
+ const [o, a] = te(e), c = ne(null), i = r ?? o, p = s ?? a, u = K({
380
74
  placement: t,
381
- open: f,
382
- onOpenChange: g,
383
- whileElementsMounted: Ne,
75
+ open: i,
76
+ onOpenChange: p,
77
+ whileElementsMounted: $,
384
78
  middleware: [
385
- ke(Me + $e),
386
- Re({
79
+ M(ie + ce),
80
+ z({
387
81
  crossAxis: t.includes("-"),
388
82
  fallbackAxisSideDirection: "start",
389
83
  padding: 5
390
84
  }),
391
- Te({ padding: 5 }),
392
- _e({
393
- element: d
85
+ G({ padding: 5 }),
86
+ O({
87
+ element: c
394
88
  })
395
89
  ]
396
- }), x = we(m.context, {
90
+ }), f = Y(u.context, {
397
91
  move: !1,
398
- enabled: l == null,
399
- mouseOnly: a,
92
+ enabled: r == null,
93
+ mouseOnly: n,
400
94
  delay: { open: 500, close: 0 }
401
- }), E = Ce(m.context, {
402
- enabled: l == null
403
- }), _ = ye(m.context), w = Se(m.context, { role: "tooltip" }), h = Oe([x, E, _, w]);
404
- return xe(
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(
405
99
  () => ({
406
- open: f,
407
- setOpen: g,
408
- arrowRef: d,
100
+ open: i,
101
+ setOpen: p,
102
+ arrowRef: c,
409
103
  ...h,
410
- ...m
104
+ ...u
411
105
  }),
412
- [f, g, h, m]
106
+ [i, p, h, u]
413
107
  );
414
- }, We = ({
415
- children: r,
108
+ }, de = ({
109
+ children: e,
416
110
  ...t
417
111
  }) => {
418
- const a = Be(t);
419
- return /* @__PURE__ */ o.jsx(te.Provider, { value: a, children: r });
420
- }, Ue = Q(function({ style: t, ...a }, l) {
421
- const n = ne(), i = K([n.refs.setFloating, l]);
422
- return n.open ? /* @__PURE__ */ o.jsx(Ae, { id: "tooltip-portal", children: /* @__PURE__ */ o.jsxs(
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(
423
117
  "div",
424
118
  {
425
- ref: i,
119
+ ref: o,
426
120
  style: {
427
- ...n.floatingStyles,
121
+ ...s.floatingStyles,
428
122
  ...t
429
123
  },
430
- ...n.getFloatingProps(a),
431
- className: j(
124
+ ...s.getFloatingProps(n),
125
+ className: d(
432
126
  "z-[55] whitespace-pre-wrap rounded border border-primary bg-blackout px-2 py-1 dial-tiny shadow max-w-[300px]",
433
- n.getFloatingProps(a).className
127
+ s.getFloatingProps(n).className
434
128
  ),
435
129
  children: [
436
- a.children,
437
- /* @__PURE__ */ o.jsx(
438
- Fe,
130
+ n.children,
131
+ /* @__PURE__ */ l(
132
+ X,
439
133
  {
440
- ref: n.arrowRef,
441
- context: n.context,
134
+ ref: s.arrowRef,
135
+ context: s.context,
442
136
  fill: "currentColor",
443
137
  strokeWidth: 1,
444
138
  className: "stroke-primary w-2 text-[var(--bg-layer-0,_#000000)]"
@@ -447,332 +141,345 @@ const A = ({ icon: r, className: t }) => r ? /* @__PURE__ */ o.jsx("span", { cla
447
141
  ]
448
142
  }
449
143
  ) }) : null;
450
- }), ze = Q(function({ children: t, asChild: a = !1, ...l }, n) {
451
- const i = ne(), d = t && typeof t == "object" && "ref" in t && t.ref !== void 0 ? t.ref : void 0, f = K([i.refs.setReference, n, d]);
452
- return a && je(t) ? he(
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(
453
147
  t,
454
- i.getReferenceProps({
455
- ref: f,
456
- ...l,
148
+ o.getReferenceProps({
149
+ ref: i,
150
+ ...r,
457
151
  ...t.props
458
152
  })
459
- ) : /* @__PURE__ */ o.jsx(
153
+ ) : /* @__PURE__ */ l(
460
154
  "span",
461
155
  {
462
- ref: f,
463
- ...i.getReferenceProps(l),
464
- className: l.className ?? "dial-tooltip-trigger text-left",
156
+ ref: i,
157
+ ...o.getReferenceProps(r),
158
+ className: r.className ?? "dial-tooltip-trigger text-left",
465
159
  children: t
466
160
  }
467
161
  );
468
- }), Z = ({
469
- hideTooltip: r,
162
+ }), C = ({
163
+ hideTooltip: e,
470
164
  tooltip: t,
471
- children: a,
472
- triggerClassName: l,
473
- contentClassName: n,
474
- ...i
475
- }) => r || !t ? /* @__PURE__ */ o.jsx("span", { className: l, children: a }) : /* @__PURE__ */ o.jsxs(We, { ...i, children: [
476
- /* @__PURE__ */ o.jsx(ze, { className: l, children: a }),
477
- /* @__PURE__ */ o.jsx(
478
- Ue,
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,
479
173
  {
480
- className: j("text-primary", n),
174
+ className: d(
175
+ "text-primary",
176
+ s,
177
+ "max-w-[300px]",
178
+ (e || !t) && "hidden"
179
+ ),
481
180
  children: t
482
181
  }
483
182
  )
484
- ] }), M = ({
485
- iconBeforeInput: r,
486
- iconAfterInput: t,
487
- hideBorder: a,
488
- value: l,
489
- elementId: n,
490
- placeholder: i = "",
491
- cssClass: c = "",
492
- containerCssClass: d,
493
- type: f = "text",
494
- disabled: g,
495
- readonly: m,
496
- invalid: x,
497
- onChange: E,
498
- min: _,
499
- max: w,
500
- prefix: h,
501
- suffix: S,
502
- textBeforeInput: R,
503
- textAfterInput: T
504
- }) => /* @__PURE__ */ o.jsxs(
505
- "div",
183
+ ] }), fe = ({
184
+ 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(
193
+ "textarea",
506
194
  {
507
- className: j(
508
- "dial-input-field flex flex-row items-center justify-between",
509
- a ? "dial-input-no-border" : "dial-input",
510
- x && "dial-input-error",
511
- g && "dial-input-disable",
512
- m && "dial-input-readonly",
513
- !R && "pl-1",
514
- !T && "pr-1",
515
- d
195
+ id: t,
196
+ placeholder: n,
197
+ value: e || "",
198
+ disabled: s,
199
+ className: d(
200
+ "dial-textarea dial-input",
201
+ o ? "dial-input-error" : "",
202
+ s && "dial-input-disable",
203
+ a && "dial-input-readonly",
204
+ r
516
205
  ),
517
- children: [
518
- R && /* @__PURE__ */ o.jsx(Z, { tooltip: R, children: /* @__PURE__ */ o.jsx(
519
- M,
520
- {
521
- hideBorder: !0,
522
- containerCssClass: "rounded-r-none border-r-0",
523
- cssClass: "px-2 overflow-hidden overflow-ellipsis dial-small",
524
- value: R,
525
- disabled: !0,
526
- elementId: R + "textBefore"
527
- }
528
- ) }),
529
- h && /* @__PURE__ */ o.jsxs("p", { className: "text-secondary dial-small pl-2", children: [
530
- " ",
531
- h
532
- ] }),
533
- /* @__PURE__ */ o.jsx(A, { icon: r, className: "pl-2" }),
534
- /* @__PURE__ */ o.jsx(
535
- "input",
536
- {
537
- type: f,
538
- autoComplete: "new-password",
539
- id: n,
540
- placeholder: i,
541
- value: l ?? "",
542
- title: l ? String(l) : "",
543
- disabled: g,
544
- min: _,
545
- max: w,
546
- className: j("border-0 bg-transparent px-2", c),
547
- onChange: (F) => !m && E?.(F.currentTarget.value)
206
+ onChange: (i) => !a && c?.(i.currentTarget.value)
207
+ }
208
+ ) }), he = [
209
+ "ArrowLeft",
210
+ "ArrowRight",
211
+ "ArrowUp",
212
+ "ArrowDown",
213
+ "Backspace",
214
+ "Delete",
215
+ "Tab",
216
+ "Enter",
217
+ "Escape",
218
+ "Home",
219
+ "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("."))) {
222
+ if (!/^[0-9]$/.test(e.key)) {
223
+ e.preventDefault();
224
+ return;
225
+ }
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) {
230
+ e.preventDefault();
231
+ return;
548
232
  }
549
- ),
550
- /* @__PURE__ */ o.jsx(A, { icon: t, className: "pr-2" }),
551
- S && /* @__PURE__ */ o.jsxs("p", { className: "text-secondary dial-small pr-2", children: [
552
- " ",
553
- S
554
- ] }),
555
- T && /* @__PURE__ */ o.jsx(Z, { tooltip: T, children: /* @__PURE__ */ o.jsx(
556
- M,
557
- {
558
- hideBorder: !0,
559
- containerCssClass: "rounded-l-none border-l-0",
560
- cssClass: "px-2",
561
- value: T,
562
- disabled: !0,
563
- elementId: T + "textAfter"
233
+ if (r !== void 0 && i > r) {
234
+ e.preventDefault();
235
+ return;
564
236
  }
565
- ) })
566
- ]
237
+ }
238
+ }
567
239
  }
568
- ), qe = /^0+\.(\d+)?$/, Ge = /^0+/, oe = ({
569
- fieldTitle: r,
570
- errorText: t,
571
- optional: a,
572
- elementCssClass: l,
573
- elementContainerCssClass: n,
574
- elementId: i,
240
+ }, F = ({
241
+ iconBeforeInput: e,
242
+ iconAfterInput: t,
243
+ hideBorder: n,
244
+ value: r,
245
+ elementId: s,
246
+ placeholder: o = "",
247
+ cssClass: a = "",
575
248
  containerCssClass: c,
576
- readonly: d,
577
- defaultEmptyText: f,
249
+ tooltipTriggerClassName: i,
250
+ type: p = "text",
251
+ disabled: u,
252
+ readonly: f,
253
+ invalid: D,
254
+ onChange: T,
578
255
  min: g,
579
- max: m,
580
- ...x
581
- }) => /* @__PURE__ */ o.jsxs("div", { className: j("flex flex-col", c), children: [
582
- /* @__PURE__ */ o.jsx(
583
- re,
256
+ max: h,
257
+ prefix: k,
258
+ suffix: R,
259
+ textBeforeInput: N,
260
+ textAfterInput: x
261
+ }) => {
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))
269
+ return;
270
+ }
271
+ T?.(v);
272
+ };
273
+ return /* @__PURE__ */ m(
274
+ "div",
584
275
  {
585
- fieldTitle: r,
586
- optional: a,
587
- htmlFor: i
276
+ className: d(
277
+ "dial-input-field flex flex-row items-center justify-between",
278
+ n ? "dial-input-no-border" : "dial-input",
279
+ D && "dial-input-error",
280
+ u && "dial-input-disable",
281
+ f && "dial-input-readonly",
282
+ !N && "pl-1",
283
+ !x && "pr-1",
284
+ c
285
+ ),
286
+ children: [
287
+ N && /* @__PURE__ */ l(C, { tooltip: N, children: /* @__PURE__ */ l(
288
+ F,
289
+ {
290
+ hideBorder: !0,
291
+ containerCssClass: "rounded-r-none border-r-0",
292
+ cssClass: "px-2 overflow-hidden overflow-ellipsis dial-small",
293
+ value: N,
294
+ disabled: !0,
295
+ elementId: N + "textBefore"
296
+ }
297
+ ) }),
298
+ k && /* @__PURE__ */ m("p", { className: "text-secondary dial-small pl-2", children: [
299
+ " ",
300
+ k
301
+ ] }),
302
+ /* @__PURE__ */ l(y, { icon: e, className: "pl-2" }),
303
+ /* @__PURE__ */ l(C, { tooltip: r, triggerClassName: i, children: /* @__PURE__ */ l(
304
+ "input",
305
+ {
306
+ type: p,
307
+ autoComplete: "off",
308
+ id: s,
309
+ placeholder: o,
310
+ value: r ?? "",
311
+ title: r ? String(r) : "",
312
+ disabled: u,
313
+ className: d("border-0 bg-transparent px-2", a),
314
+ onChange: (b) => !f && U?.(b),
315
+ onKeyDown: L,
316
+ onWheel: j,
317
+ min: g,
318
+ max: h
319
+ }
320
+ ) }),
321
+ /* @__PURE__ */ l(y, { icon: t, className: "pr-2" }),
322
+ R && /* @__PURE__ */ m("p", { className: "text-secondary dial-small pr-2", children: [
323
+ " ",
324
+ R
325
+ ] }),
326
+ x && /* @__PURE__ */ l(C, { tooltip: x, children: /* @__PURE__ */ l(
327
+ F,
328
+ {
329
+ hideBorder: !0,
330
+ containerCssClass: "rounded-l-none border-l-0",
331
+ cssClass: "px-2",
332
+ value: x,
333
+ disabled: !0,
334
+ elementId: x + "textAfter"
335
+ }
336
+ ) })
337
+ ]
338
+ }
339
+ );
340
+ }, be = /^0+\.(\d+)?$/, Ne = /^0+/, W = ({
341
+ 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,
351
+ max: u,
352
+ ...f
353
+ }) => /* @__PURE__ */ m("div", { className: d("flex flex-col", a), children: [
354
+ /* @__PURE__ */ l(
355
+ A,
356
+ {
357
+ fieldTitle: e,
358
+ optional: n,
359
+ htmlFor: o
588
360
  }
589
361
  ),
590
- d ? /* @__PURE__ */ o.jsx("span", { children: x.value || (f ?? "None") }) : /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
591
- /* @__PURE__ */ o.jsx(
592
- M,
362
+ c ? /* @__PURE__ */ l("span", { children: f.value || (i ?? "None") }) : /* @__PURE__ */ m(_, { children: [
363
+ /* @__PURE__ */ l(
364
+ F,
593
365
  {
594
- elementId: i,
595
- cssClass: l,
596
- containerCssClass: n,
366
+ elementId: o,
367
+ cssClass: r,
368
+ containerCssClass: s,
597
369
  invalid: t != null,
598
- min: g,
599
- max: m,
600
- ...x
370
+ min: p,
371
+ max: u,
372
+ ...f
601
373
  }
602
374
  ),
603
- /* @__PURE__ */ o.jsx(ee, { errorText: t })
375
+ /* @__PURE__ */ l(S, { errorText: t })
604
376
  ] })
605
- ] }), er = ({
606
- onChange: r,
377
+ ] }), De = ({
378
+ onChange: e,
607
379
  value: t,
608
- min: a,
609
- max: l,
610
- ...n
380
+ min: n,
381
+ max: r,
382
+ ...s
611
383
  }) => {
612
- const i = (c) => String(c)?.match(qe) ? String(c)?.replace(Ge, "0") : Number(c);
613
- return /* @__PURE__ */ o.jsx(
614
- oe,
384
+ const o = (a) => String(a)?.match(be) ? String(a)?.replace(Ne, "0") : Number(a);
385
+ return /* @__PURE__ */ l(
386
+ W,
615
387
  {
616
388
  type: "number",
617
- onChange: (c) => r?.(i(c)),
389
+ onChange: (a) => e?.(o(a)),
618
390
  value: t,
619
- min: a,
620
- max: l,
621
- ...n
391
+ min: n,
392
+ max: r,
393
+ ...s
622
394
  }
623
395
  );
624
- }, rr = ({
625
- onChange: r,
396
+ }, Te = ({
397
+ onChange: e,
626
398
  ...t
627
- }) => /* @__PURE__ */ o.jsx(
628
- oe,
399
+ }) => /* @__PURE__ */ l(
400
+ W,
629
401
  {
630
402
  type: "text",
631
- onChange: (a) => r?.(a),
403
+ onChange: (n) => e?.(n),
632
404
  ...t
633
405
  }
634
- ), tr = ({
635
- fieldTitle: r,
406
+ ), Fe = ({
407
+ fieldTitle: e,
636
408
  optional: t,
637
- elementId: a,
638
- elementCssClass: l,
639
- errorText: n,
640
- ...i
641
- }) => /* @__PURE__ */ o.jsxs("div", { className: "flex flex-col", children: [
642
- /* @__PURE__ */ o.jsx(
643
- re,
409
+ elementId: n,
410
+ elementCssClass: r,
411
+ errorText: s,
412
+ ...o
413
+ }) => /* @__PURE__ */ m("div", { className: "flex flex-col", children: [
414
+ /* @__PURE__ */ l(
415
+ A,
644
416
  {
645
- fieldTitle: r,
417
+ fieldTitle: e,
646
418
  optional: t,
647
- htmlFor: a
419
+ htmlFor: n
648
420
  }
649
421
  ),
650
- /* @__PURE__ */ o.jsx(
651
- Ie,
422
+ /* @__PURE__ */ l(
423
+ fe,
652
424
  {
653
- textareaId: a,
654
- cssClass: l,
655
- ...i
425
+ textareaId: n,
426
+ cssClass: r,
427
+ ...o
656
428
  }
657
429
  ),
658
- /* @__PURE__ */ o.jsx(ee, { errorText: n })
659
- ] });
660
- var $ = /* @__PURE__ */ ((r) => (r.dark = "dark", r.light = "light", r))($ || {});
661
- const Je = {
662
- [$.dark]: {
663
- base: "vs-dark",
664
- inherit: !1,
665
- rules: [
666
- { token: "string.key.json", foreground: "#37BABC" },
667
- { token: "string.value.json", foreground: "#5C8DEA" },
668
- { token: "number", foreground: "#D97C27" },
669
- { token: "keyword.json", foreground: "#F4CE46" },
670
- { token: "delimiter", foreground: "#F3F4F6" },
671
- { token: "delimiter.bracket.json", foreground: "#A972FF" },
672
- { token: "delimiter.parenthesis", foreground: "#A972FF" }
673
- ],
674
- colors: {
675
- "editor.foreground": "#F76464",
676
- "editor.background": "#141A23",
677
- "editorCursor.foreground": "#F3F4F6",
678
- "editor.selectionBackground": "#5C8DEA2B",
679
- "editorLineNumber.foreground": "#333942",
680
- "scrollbarSlider.background": "#333942",
681
- "scrollbarSlider.hoverBackground": "#333942",
682
- "scrollbarSlider.activeBackground": "#333942"
683
- }
684
- },
685
- [$.light]: {
686
- base: "vs",
687
- inherit: !1,
688
- rules: [
689
- { token: "string.key.json", foreground: "#009D9F" },
690
- { token: "string.value.json", foreground: "#2764D9" },
691
- { token: "number", foreground: "#B25500" },
692
- { token: "keyword.json", foreground: "#3F3D25" },
693
- { token: "delimiter", foreground: "#141A23" },
694
- { token: "delimiter.bracket.json", foreground: "#843EF3" },
695
- { token: "delimiter.parenthesis", foreground: "#843EF3" }
696
- ],
697
- colors: {
698
- "editor.foreground": "#AE2F2F",
699
- "editor.background": "#F3F4F6",
700
- "editorCursor.foreground": "#141A23",
701
- "editor.selectionBackground": "#5C8DEA2B",
702
- "editorLineNumber.foreground": "#333942",
703
- "scrollbarSlider.background": "#333942",
704
- "scrollbarSlider.hoverBackground": "#333942",
705
- "scrollbarSlider.activeBackground": "#333942"
706
- }
707
- }
708
- }, nr = ({
709
- value: r,
710
- onChange: t,
711
- onValidateJSON: a,
712
- options: l,
713
- currentTheme: n,
714
- themesConfig: i = Je
430
+ /* @__PURE__ */ l(S, { errorText: s })
431
+ ] }), ke = ({
432
+ title: e,
433
+ switchId: t,
434
+ isOn: n = !1,
435
+ disabled: r,
436
+ onChange: s
715
437
  }) => {
716
- function c(d) {
717
- d?.editor?.defineTheme(
718
- n,
719
- i[n]
720
- ), d.languages.json.jsonDefaults.setDiagnosticsOptions({
721
- validate: !0,
722
- enableSchemaRequest: !1,
723
- schemas: [
724
- {
725
- uri: "http://custom-schema/object-required.json",
726
- fileMatch: ["*"],
727
- schema: {
728
- type: "object",
729
- description: "Top-level value must be an object",
730
- additionalProperties: !0
731
- }
732
- }
733
- ]
734
- });
735
- }
736
- return /* @__PURE__ */ o.jsx(
737
- Pe,
738
- {
739
- beforeMount: c,
740
- height: "100%",
741
- defaultLanguage: "json",
742
- value: r,
743
- onChange: t,
744
- theme: n,
745
- onValidate: a,
746
- options: {
747
- minimap: { enabled: !1 },
748
- formatOnType: !0,
749
- formatOnPaste: !0,
750
- selectOnLineNumbers: !1,
751
- automaticLayout: !0,
752
- scrollBeyondLastLine: !1,
753
- wordWrap: "on",
754
- smoothScrolling: !0,
755
- overviewRulerLanes: 0,
756
- scrollbar: {
757
- horizontal: "hidden",
758
- verticalScrollbarSize: 4,
759
- verticalSliderSize: 4
760
- },
761
- ...l ?? {}
762
- }
763
- }
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);
446
+ },
447
+ [s, n]
764
448
  );
449
+ return /* @__PURE__ */ m("div", { className: "flex flex-row items-center", children: [
450
+ /* @__PURE__ */ l(
451
+ "input",
452
+ {
453
+ type: "checkbox",
454
+ onChange: a,
455
+ id: t,
456
+ disabled: r,
457
+ className: "invisible w-0 h-0",
458
+ checked: n
459
+ }
460
+ ),
461
+ /* @__PURE__ */ l("label", { htmlFor: t, className: o, children: /* @__PURE__ */ l(
462
+ "span",
463
+ {
464
+ className: d(
465
+ "size-3 rounded-full",
466
+ r ? n ? "bg-controls-disable" : "bg-layer-4" : "bg-controls-enable-primary"
467
+ )
468
+ }
469
+ ) }),
470
+ e && /* @__PURE__ */ l("span", { className: "h-[14px] pl-2 small text-primary", children: e })
471
+ ] });
765
472
  };
766
473
  export {
767
- Ke as DialButton,
768
- ee as DialErrorText,
769
- re as DialFieldLabel,
770
- A as DialIcon,
771
- M as DialInput,
772
- nr as DialJsonEditor,
773
- er as DialNumberInputField,
774
- tr as DialTextAreaField,
775
- rr as DialTextInputField,
776
- Ie as DialTextarea,
777
- Z as DialTooltip
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
778
485
  };