@chobantonov/jsonforms-react-shadcn-extended-renderers 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +30 -2
  3. package/lib/components/FileFeedback.d.ts +6 -0
  4. package/lib/components/ShadcnArrayFrame.d.ts +3 -0
  5. package/lib/components/ShadcnEditorButton.d.ts +5 -0
  6. package/lib/components/ShadcnEditorFrame.d.ts +3 -0
  7. package/lib/index.d.ts +13 -0
  8. package/lib/jsonforms-react-shadcn-extended.cjs.js +2 -0
  9. package/lib/jsonforms-react-shadcn-extended.cjs.js.map +1 -0
  10. package/lib/jsonforms-react-shadcn-extended.esm.js +1142 -0
  11. package/lib/jsonforms-react-shadcn-extended.esm.js.map +1 -0
  12. package/lib/renderers/AgGridArrayControlRenderer.d.ts +3 -0
  13. package/lib/renderers/ButtonRenderer.d.ts +7 -0
  14. package/lib/renderers/ColorControlRenderer.d.ts +6 -0
  15. package/lib/renderers/CronControlRenderer.d.ts +6 -0
  16. package/lib/renderers/DurationControlRenderer.d.ts +5 -0
  17. package/lib/renderers/FileControlRenderer.d.ts +15 -0
  18. package/lib/renderers/MarkupLabelRenderer.d.ts +3 -0
  19. package/lib/renderers/MaskControlRenderer.d.ts +5 -0
  20. package/lib/renderers/NullControlRenderer.d.ts +5 -0
  21. package/lib/renderers/ShadcnAgGridControlRenderer.d.ts +2 -0
  22. package/lib/renderers/ShadcnMonacoControlRenderer.d.ts +2 -0
  23. package/lib/renderers/SplitLayoutRenderer.d.ts +6 -0
  24. package/lib/renderers/index.d.ts +8 -0
  25. package/lib/theme.d.ts +8 -0
  26. package/lib/util/duration.d.ts +8 -0
  27. package/package.json +79 -3
  28. package/src/components/FileFeedback.tsx +51 -0
  29. package/src/components/ShadcnArrayFrame.tsx +53 -0
  30. package/src/components/ShadcnEditorButton.tsx +45 -0
  31. package/src/components/ShadcnEditorFrame.tsx +19 -0
  32. package/src/index.tsx +96 -0
  33. package/src/renderers/AgGridArrayControlRenderer.tsx +16 -0
  34. package/src/renderers/ButtonRenderer.tsx +49 -0
  35. package/src/renderers/ColorControlRenderer.tsx +336 -0
  36. package/src/renderers/CronControlRenderer.tsx +363 -0
  37. package/src/renderers/DurationControlRenderer.tsx +210 -0
  38. package/src/renderers/FileControlRenderer.tsx +294 -0
  39. package/src/renderers/MarkupLabelRenderer.tsx +17 -0
  40. package/src/renderers/MaskControlRenderer.tsx +65 -0
  41. package/src/renderers/NullControlRenderer.tsx +63 -0
  42. package/src/renderers/ShadcnAgGridControlRenderer.tsx +40 -0
  43. package/src/renderers/ShadcnMonacoControlRenderer.tsx +11 -0
  44. package/src/renderers/SplitLayoutRenderer.tsx +94 -0
  45. package/src/renderers/index.ts +9 -0
  46. package/src/theme.ts +35 -0
  47. package/src/util/duration.ts +37 -0
@@ -0,0 +1,1142 @@
1
+ import e, { useCallback as t, useRef as n, useState as r } from "react";
2
+ import { CRON_FIELDS as i, DEFAULT_CRON as a, FIELD_RANGE as o, buttonRendererTester as s, createAgGridControl as c, createAgGridControlRenderer as l, createButtonRenderer as u, createExtendedRenderers as d, createMarkupLabelRenderer as f, createMonacoControlRenderer as p, durationFieldMax as m, extendedAgGridTester as h, extendedAgGridTester as g, extendedMaskTester as _, formatField as v, initialSplitSizes as y, labelFor as b, markupLabelTester as x, monacoControlTester as S, parseField as C, resolveExtendedOption as ee, splitCssSize as w, useCronPicker as T, useDurationControl as E, useExtendedTranslator as D } from "@chobantonov/jsonforms-react-extended-renderers";
3
+ import { jsx as O, jsxs as k } from "react/jsx-runtime";
4
+ import { ArrayPanelToggle as A, ClearValueButton as j, ErrorIndicator as M, InputShell as N, RowDetailEditButton as te, RowDetailFrame as ne, ShadcnCellMode as re, ShadcnGridCellFrame as ie, asShadcnCell as P, makeId as F, useConfirmation as ae } from "@chobantonov/jsonforms-react-shadcn-renderers";
5
+ import { JsonFormsDispatch as oe, withJsonFormsControlProps as I, withJsonFormsLayoutProps as se, withTranslateProps as ce } from "@jsonforms/react";
6
+ import { Input as L } from "@jsonforms-react-shadcn-ui/input";
7
+ import { useMaskedInput as le } from "@chobantonov/jsonforms-react-renderer-common/formats/useMaskedInput";
8
+ import { createDeleteConfirmation as ue } from "@chobantonov/jsonforms-react-renderer-common/interaction/createDeleteConfirmation";
9
+ import { CalendarClock as de, Check as fe, ChevronDown as pe, CircleAlert as me, Eye as he, EyeOff as ge, File as _e, Maximize as ve, Minimize as ye, Pencil as be, Plus as xe, Timer as Se, Trash2 as Ce, TriangleAlert as we, X as Te } from "lucide-react";
10
+ import { useArrayPanelState as Ee } from "@chobantonov/jsonforms-react-renderer-common/collections/useArrayPanelState";
11
+ import { Button as R } from "@jsonforms-react-shadcn-ui/button";
12
+ import { and as z, formatIs as B, isStringControl as V, optionIs as De, or as H, rankWith as U, schemaMatches as Oe, uiTypeIs as W } from "@jsonforms/core";
13
+ import { Popover as G, PopoverContent as K, PopoverTrigger as q } from "@jsonforms-react-shadcn-ui/popover";
14
+ import { useI18n as J, useTranslator as ke } from "@chobantonov/jsonforms-react-renderer-common/locale/translate";
15
+ import { hsbToRgb as Ae, isTransparent as je, parseColor as Me, rgbToHsb as Ne, serializeColor as Pe, toCssColor as Fe } from "@chobantonov/jsonforms-react-renderer-common/formats/colorFormat";
16
+ import { Select as Ie, SelectContent as Le, SelectItem as Re, SelectTrigger as ze, SelectValue as Be } from "@jsonforms-react-shadcn-ui/select";
17
+ import { FileArrayInput as Ve, attachmentName as He, fileArrayTester as Ue, fileItemSchema as We } from "@chobantonov/jsonforms-react-renderer-common/controls/FileArrayInput";
18
+ import { Checkbox as Ge } from "@jsonforms-react-shadcn-ui/checkbox";
19
+ import { useEffectiveElements as Ke } from "@chobantonov/jsonforms-react-renderer-common/layout/layoutContext";
20
+ import { ResizableHandle as qe, ResizablePanel as Je, ResizablePanelGroup as Ye } from "@jsonforms-react-shadcn-ui/resizable";
21
+ import { EMPTY_DURATION as Xe, formatDurationComponents as Ze, parseDuration as Qe, sanitizeComponents as $e } from "@chobantonov/jsonforms-react-renderer-common/formats/duration";
22
+ export * from "@chobantonov/jsonforms-react-extended-renderers";
23
+ // src/renderers/MarkupLabelRenderer.tsx
24
+ var et = f(({ block: e, children: t }) => /* @__PURE__ */ O(e ? "div" : "span", {
25
+ "data-markup-typography": !0,
26
+ className: "text-sm leading-relaxed [&_a]:text-primary [&_a]:underline [&_p]:my-2 [&_ul]:list-disc [&_ul]:pl-6",
27
+ children: t
28
+ }));
29
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/typeof.js
30
+ function Y(e) {
31
+ "@babel/helpers - typeof";
32
+ return Y = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
33
+ return typeof e;
34
+ } : function(e) {
35
+ return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
36
+ }, Y(e);
37
+ }
38
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/toPrimitive.js
39
+ function tt(e, t) {
40
+ if (Y(e) != "object" || !e) return e;
41
+ var n = e[Symbol.toPrimitive];
42
+ if (n !== void 0) {
43
+ var r = n.call(e, t || "default");
44
+ if (Y(r) != "object") return r;
45
+ throw TypeError("@@toPrimitive must return a primitive value.");
46
+ }
47
+ return (t === "string" ? String : Number)(e);
48
+ }
49
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/toPropertyKey.js
50
+ function nt(e) {
51
+ var t = tt(e, "string");
52
+ return Y(t) == "symbol" ? t : t + "";
53
+ }
54
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/defineProperty.js
55
+ function rt(e, t, n) {
56
+ return (t = nt(t)) in e ? Object.defineProperty(e, t, {
57
+ value: n,
58
+ enumerable: !0,
59
+ configurable: !0,
60
+ writable: !0
61
+ }) : e[t] = n, e;
62
+ }
63
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/objectSpread2.js
64
+ function it(e, t) {
65
+ var n = Object.keys(e);
66
+ if (Object.getOwnPropertySymbols) {
67
+ var r = Object.getOwnPropertySymbols(e);
68
+ t && (r = r.filter(function(t) {
69
+ return Object.getOwnPropertyDescriptor(e, t).enumerable;
70
+ })), n.push.apply(n, r);
71
+ }
72
+ return n;
73
+ }
74
+ function X(e) {
75
+ for (var t = 1; t < arguments.length; t++) {
76
+ var n = arguments[t] == null ? {} : arguments[t];
77
+ t % 2 ? it(Object(n), !0).forEach(function(t) {
78
+ rt(e, t, n[t]);
79
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : it(Object(n)).forEach(function(t) {
80
+ Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
81
+ });
82
+ }
83
+ return e;
84
+ }
85
+ // src/renderers/MaskControlRenderer.tsx
86
+ var at = e.memo(function(e) {
87
+ var r;
88
+ let { data: i, enabled: a, path: o } = e, s = n(null), c = t(() => s.current, []), { appliedUiSchemaOptions: l, settings: u, display: d, onClear: f, onChange: p, onCompositionStart: m, onCompositionEnd: h } = le(e, c, "defer");
89
+ if (e.visible === !1) return null;
90
+ let g = F(o, e.label);
91
+ return /* @__PURE__ */ O(N, X(X({}, e), {}, {
92
+ id: g,
93
+ children: /* @__PURE__ */ k("div", {
94
+ className: "group relative w-full",
95
+ children: [/* @__PURE__ */ O(j, {
96
+ clearable: l.clearable !== !1,
97
+ data: i,
98
+ enabled: a && !e.readonly,
99
+ onClear: f
100
+ }), /* @__PURE__ */ O(L, {
101
+ ref: s,
102
+ value: d,
103
+ onChange: p,
104
+ onCompositionStart: m,
105
+ onCompositionEnd: h,
106
+ className: "pr-10",
107
+ id: g,
108
+ disabled: !a || e.readonly,
109
+ "aria-invalid": !!e.errors,
110
+ autoFocus: l.focus,
111
+ style: { width: "100%" },
112
+ placeholder: (r = l.placeholder) == null ? typeof (u == null ? void 0 : u.mask) == "string" ? u.mask : void 0 : r,
113
+ "data-mask-input": !0
114
+ })]
115
+ })
116
+ }));
117
+ }), ot = _, st = I(at), ct = ({ options: e, config: t, label: n, description: r, errors: i, actions: a, children: o }) => {
118
+ let s = Ee(e, t);
119
+ return /* @__PURE__ */ k("div", {
120
+ className: "shadcn-jsonforms-array",
121
+ children: [
122
+ /* @__PURE__ */ k("div", {
123
+ className: "flex items-center justify-between gap-2 pb-2",
124
+ children: [/* @__PURE__ */ k("div", {
125
+ className: "flex items-center gap-2",
126
+ children: [n && /* @__PURE__ */ O("h3", { children: n }), i && /* @__PURE__ */ O(M, {
127
+ local: !0,
128
+ errors: i
129
+ })]
130
+ }), /* @__PURE__ */ k("div", {
131
+ className: "ml-auto flex gap-1",
132
+ children: [a == null ? void 0 : a.map((e) => /* @__PURE__ */ O(R, {
133
+ type: "button",
134
+ size: "icon-sm",
135
+ variant: e.danger ? "destructive" : "default",
136
+ title: e.label,
137
+ "aria-label": e.label,
138
+ disabled: e.disabled,
139
+ onClick: e.onClick,
140
+ children: e.icon
141
+ }, e.key)), /* @__PURE__ */ O(A, {
142
+ panel: s,
143
+ label: n
144
+ })]
145
+ })]
146
+ }),
147
+ r && /* @__PURE__ */ O("p", {
148
+ className: "text-sm text-muted-foreground",
149
+ children: r
150
+ }),
151
+ /* @__PURE__ */ O("div", {
152
+ id: s.contentId,
153
+ hidden: s.collapsed,
154
+ children: o
155
+ })
156
+ ]
157
+ });
158
+ };
159
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/objectWithoutPropertiesLoose.js
160
+ function lt(e, t) {
161
+ if (e == null) return {};
162
+ var n = {};
163
+ for (var r in e) if ({}.hasOwnProperty.call(e, r)) {
164
+ if (t.includes(r)) continue;
165
+ n[r] = e[r];
166
+ }
167
+ return n;
168
+ }
169
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/objectWithoutProperties.js
170
+ function Z(e, t) {
171
+ if (e == null) return {};
172
+ var n, r, i = lt(e, t);
173
+ if (Object.getOwnPropertySymbols) {
174
+ var a = Object.getOwnPropertySymbols(e);
175
+ for (r = 0; r < a.length; r++) n = a[r], t.includes(n) || {}.propertyIsEnumerable.call(e, n) && (i[n] = e[n]);
176
+ }
177
+ return i;
178
+ }
179
+ // src/components/ShadcnEditorButton.tsx
180
+ var ut = [
181
+ "variant",
182
+ "icon",
183
+ "children"
184
+ ], dt = [
185
+ "variant",
186
+ "icon",
187
+ "children"
188
+ ], ft = (e) => {
189
+ let { variant: t, icon: n, children: r } = e, i = Z(e, ut);
190
+ return /* @__PURE__ */ k(R, X(X({
191
+ type: "button",
192
+ variant: t === "danger" ? "destructive" : t === "primary" ? "default" : "outline"
193
+ }, i), {}, { children: [n, r] }));
194
+ }, pt = (e) => {
195
+ let { variant: t, icon: n, children: r } = e, i = Z(e, dt);
196
+ return /* @__PURE__ */ k(R, X(X({
197
+ type: "button",
198
+ variant: "ghost",
199
+ size: "icon",
200
+ className: "h-8 w-8"
201
+ }, i), {}, { children: [n, r] }));
202
+ }, mt = ["children"], ht = (e) => {
203
+ let { children: t } = e, n = Z(e, mt);
204
+ return /* @__PURE__ */ O(N, X(X({}, n), {}, {
205
+ id: n.id,
206
+ label: n.label,
207
+ required: n.required,
208
+ description: n.description,
209
+ errors: n.errors,
210
+ children: t
211
+ }));
212
+ }, gt = ue(ae, "agGrid"), _t = l({
213
+ RowErrorIndicator: ({ message: e }) => /* @__PURE__ */ O(M, { errors: e }),
214
+ Frame: ht,
215
+ RowDetailButton: (e) => {
216
+ var t, n;
217
+ return /* @__PURE__ */ O(te, {
218
+ label: (t = (n = e["aria-label"]) == null ? e.title : n) == null ? "" : t,
219
+ onClick: e.onClick,
220
+ disabled: e.disabled
221
+ });
222
+ },
223
+ RowDetailFrame: ne,
224
+ useRemoveConfirmation: gt,
225
+ EditIcon: be,
226
+ ShowDetailsIcon: he,
227
+ HideDetailsIcon: ge,
228
+ CellFrame: ie,
229
+ ArrayFrame: ct,
230
+ AddIcon: xe,
231
+ RemoveIcon: Ce,
232
+ Button: ft
233
+ }), vt = p({
234
+ Frame: ht,
235
+ Button: pt,
236
+ MaximizeIcon: () => /* @__PURE__ */ O(ve, { "aria-hidden": "true" }),
237
+ MinimizeIcon: () => /* @__PURE__ */ O(ye, { "aria-hidden": "true" })
238
+ }), yt = ["icon", "children"], bt = s, xt = {
239
+ primary: "default",
240
+ secondary: "outline",
241
+ alternative: "secondary",
242
+ success: "default",
243
+ warning: "outline",
244
+ error: "destructive"
245
+ }, St = u({
246
+ withProps: !1,
247
+ ButtonComponent: (e) => {
248
+ let { icon: t, children: n } = e, r = Z(e, yt);
249
+ return /* @__PURE__ */ k(R, X(X({}, r), {}, { children: [t ? /* @__PURE__ */ O("span", {
250
+ "aria-hidden": "true",
251
+ children: t
252
+ }) : null, n] }));
253
+ },
254
+ getButtonProps: ({ color: e, icon: t, uischema: n }) => {
255
+ var r, i, a, o;
256
+ return {
257
+ icon: t,
258
+ variant: (r = (i = (a = n.options) == null ? void 0 : a.variant) == null ? e ? xt[e] : void 0 : i) == null ? "default" : r,
259
+ className: [e === "warning" && "text-destructive", ((o = n.options) == null ? void 0 : o.fullWidth) === !0 && "w-full"].filter(Boolean).join(" ") || void 0
260
+ };
261
+ }
262
+ }), Ct = se(ce(St)), wt = c({
263
+ Frame: ht,
264
+ CellFrame: ie,
265
+ ArrayFrame: ct,
266
+ AddIcon: xe,
267
+ RemoveIcon: Ce,
268
+ Button: ft
269
+ }), Tt = U(2, z(V, B("color"))), Et = (e) => typeof e == "string" ? /^#[0-9a-f]{3}$/i.test(e) ? `#${e.slice(1).split("").map((e) => e + e).join("")}` : /^#[0-9a-f]{8}$/i.test(e) ? e.slice(0, 7) : /^#[0-9a-f]{6}$/i.test(e) ? e : "#000000" : "#000000", Dt = (e, t, n) => `#${[
270
+ e,
271
+ t,
272
+ n
273
+ ].map((e) => e.toString(16).padStart(2, "0")).join("")}`, Q = (e, t, n) => Math.min(n, Math.max(t, e)), Ot = (t) => {
274
+ var n, i, a, o;
275
+ let s = D(), c = J(), [l, u] = r(), [d, f] = e.useState(t.data);
276
+ Object.is(d, t.data) || (f(() => t.data), u(void 0));
277
+ let p = ee(t.uischema.options, t.config, "colorSaveFormat", "hex") === "hex3", m = l == null ? t.data : l, h = Me(m), g = p && h !== void 0 && je(h), _ = [t.errors, g ? s("color.hex3Transparency") : ""].filter(Boolean).join(" "), v = (e) => {
278
+ if (!t.enabled || t.readonly) return;
279
+ let n = Me(e);
280
+ p && n && je(n) ? u(e) : (u(void 0), t.handleChange(t.path, (p && n ? Pe(n, "hex3") : e) || void 0));
281
+ };
282
+ if (!t.visible) return null;
283
+ let y = F(t.path, t.label), b = typeof m == "string" ? m : "", x = !t.enabled || !!t.readonly, S = ((n = (i = t.uischema.options) == null ? void 0 : i.clearable) == null ? (a = t.config) == null ? void 0 : a.clearable : n) !== !1, C = () => {
284
+ x || (u(void 0), t.handleChange(t.path, void 0));
285
+ }, w = h == null ? {
286
+ r: 0,
287
+ g: 0,
288
+ b: 0,
289
+ a: 1
290
+ } : h, { h: T, s: E, b: A } = Ne(w), M = (e, t, n) => v(Dt(e, t, n)), te = (e, t, n) => {
291
+ let r = n.getBoundingClientRect();
292
+ if (!r.width || !r.height) return;
293
+ let i = Q((e - r.left) / r.width * 100, 0, 100), a = Q(100 - (t - r.top) / r.height * 100, 0, 100), o = Ae(T, i, a);
294
+ M(o.r, o.g, o.b);
295
+ };
296
+ return /* @__PURE__ */ O(N, X(X({}, t), {}, {
297
+ id: y,
298
+ label: t.label,
299
+ required: t.required,
300
+ description: t.description,
301
+ errors: _,
302
+ children: /* @__PURE__ */ k("div", {
303
+ className: "shadcn-jsonforms-color-control group relative min-w-0",
304
+ children: [
305
+ /* @__PURE__ */ O(L, {
306
+ className: "min-w-0 pl-10 pr-10",
307
+ id: y,
308
+ value: b,
309
+ placeholder: p ? "#RGB" : "#RRGGBB",
310
+ "aria-invalid": !!_,
311
+ disabled: x,
312
+ onChange: (e) => {
313
+ let t = e.currentTarget.value;
314
+ v(t);
315
+ }
316
+ }),
317
+ /* @__PURE__ */ k(G, { children: [/* @__PURE__ */ O(q, {
318
+ asChild: !0,
319
+ children: /* @__PURE__ */ O(R, {
320
+ type: "button",
321
+ variant: "ghost",
322
+ size: "icon",
323
+ className: "absolute start-1 top-1/2 h-8 w-8 -translate-y-1/2 p-1",
324
+ "aria-label": c("color.pickerLabel", { label: t.label || c("color.label") }),
325
+ disabled: x,
326
+ children: /* @__PURE__ */ O("span", {
327
+ "data-color-empty-swatch": b === "" ? "" : void 0,
328
+ "aria-hidden": "true",
329
+ className: "h-full w-full rounded border border-input",
330
+ style: b === "" ? {
331
+ backgroundColor: "hsl(var(--background, 0 0% 100%))",
332
+ backgroundImage: "conic-gradient(hsl(var(--muted-foreground, 0 0% 65%) / .3) 25%, transparent 0 50%, hsl(var(--muted-foreground, 0 0% 65%) / .3) 0 75%, transparent 0)",
333
+ backgroundSize: "12px 12px"
334
+ } : { backgroundColor: (o = Fe(b)) == null ? Et(b) : o }
335
+ })
336
+ })
337
+ }), /* @__PURE__ */ k(K, {
338
+ align: "start",
339
+ className: "w-72 space-y-3",
340
+ children: [
341
+ /* @__PURE__ */ k("div", {
342
+ role: "slider",
343
+ "aria-label": c("color.saturationLabel", { label: t.label || c("color.label") }),
344
+ "aria-valuemin": 0,
345
+ "aria-valuemax": 100,
346
+ "aria-valuenow": E,
347
+ "aria-valuetext": `${E}% saturation, ${A}% brightness`,
348
+ tabIndex: g ? -1 : 0,
349
+ className: "relative h-40 w-full cursor-crosshair touch-none overflow-hidden rounded border border-input",
350
+ style: { backgroundColor: `hsl(${T} 100% 50%)` },
351
+ onPointerDown: (e) => {
352
+ g || (e.currentTarget.setPointerCapture(e.pointerId), te(e.clientX, e.clientY, e.currentTarget));
353
+ },
354
+ onPointerMove: (e) => {
355
+ !g && e.currentTarget.hasPointerCapture(e.pointerId) && te(e.clientX, e.clientY, e.currentTarget);
356
+ },
357
+ onKeyDown: (e) => {
358
+ let t = e.shiftKey ? 10 : 1, n = E + (e.key === "ArrowRight" ? t : e.key === "ArrowLeft" ? -t : 0), r = A + (e.key === "ArrowUp" ? t : e.key === "ArrowDown" ? -t : 0);
359
+ if (n === E && r === A) return;
360
+ e.preventDefault();
361
+ let i = Ae(T, Q(n, 0, 100), Q(r, 0, 100));
362
+ M(i.r, i.g, i.b);
363
+ },
364
+ children: [
365
+ /* @__PURE__ */ O("div", {
366
+ className: "absolute inset-0",
367
+ style: { background: "linear-gradient(to right, white, transparent)" }
368
+ }),
369
+ /* @__PURE__ */ O("div", {
370
+ className: "absolute inset-0",
371
+ style: { background: "linear-gradient(to top, black, transparent)" }
372
+ }),
373
+ /* @__PURE__ */ O("span", {
374
+ "aria-hidden": "true",
375
+ className: "absolute h-3 w-3 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white shadow-[0_0_0_1px_black]",
376
+ style: {
377
+ left: `${E}%`,
378
+ top: `${100 - A}%`
379
+ }
380
+ })
381
+ ]
382
+ }),
383
+ /* @__PURE__ */ O("input", {
384
+ type: "range",
385
+ min: 0,
386
+ max: 359,
387
+ value: T,
388
+ "aria-label": c("color.hueLabel", { label: t.label || c("color.label") }),
389
+ disabled: g,
390
+ className: "w-full cursor-pointer",
391
+ style: { background: "linear-gradient(to right, red, yellow, lime, cyan, blue, magenta, red)" },
392
+ onChange: (e) => {
393
+ let t = Ae(Number(e.currentTarget.value), E, A);
394
+ M(t.r, t.g, t.b);
395
+ }
396
+ }),
397
+ /* @__PURE__ */ O("div", {
398
+ className: "grid grid-cols-3 gap-2",
399
+ children: [
400
+ "r",
401
+ "g",
402
+ "b"
403
+ ].map((e) => /* @__PURE__ */ k("label", {
404
+ className: "text-center text-xs uppercase",
405
+ children: [/* @__PURE__ */ O(L, {
406
+ type: "number",
407
+ min: 0,
408
+ max: 255,
409
+ value: w[e],
410
+ "aria-label": c("color.channelLabel", {
411
+ label: t.label || c("color.label"),
412
+ channel: e.toUpperCase()
413
+ }),
414
+ disabled: g,
415
+ className: "mb-1 h-9 px-1 text-center",
416
+ onChange: (t) => {
417
+ let n = Number(t.currentTarget.value);
418
+ !Number.isInteger(n) || n < 0 || n > 255 || M(e === "r" ? n : w.r, e === "g" ? n : w.g, e === "b" ? n : w.b);
419
+ }
420
+ }), e]
421
+ }, e))
422
+ }),
423
+ S && b !== "" && /* @__PURE__ */ O(R, {
424
+ type: "button",
425
+ variant: "ghost",
426
+ className: "w-full",
427
+ "data-color-panel-clear": "",
428
+ onClick: C,
429
+ children: c("control.clearValue")
430
+ })
431
+ ]
432
+ })] }),
433
+ /* @__PURE__ */ O(j, {
434
+ data: m,
435
+ enabled: t.enabled,
436
+ readonly: t.readonly,
437
+ clearable: S,
438
+ onClear: C
439
+ })
440
+ ]
441
+ })
442
+ }));
443
+ }, kt = I(Ot), At = U(3, z(V, H(B("duration"), De("format", "duration")))), jt = (e) => {
444
+ var t;
445
+ let n = E(e), r = J(), i = ke(), a = D();
446
+ if (!e.visible) return null;
447
+ let o = F(e.path, e.label), s = (e) => r(`duration.${e}`);
448
+ return /* @__PURE__ */ O(N, X(X({}, e), {}, {
449
+ id: o,
450
+ label: e.label,
451
+ required: e.required,
452
+ description: e.description,
453
+ errors: n.error,
454
+ children: /* @__PURE__ */ k("div", {
455
+ className: "group relative",
456
+ children: [
457
+ /* @__PURE__ */ O(L, {
458
+ id: o,
459
+ className: "pl-10 pr-10",
460
+ value: n.value,
461
+ placeholder: (t = n.options.placeholder) == null ? "P1DT2H" : t,
462
+ autoFocus: n.options.focus,
463
+ disabled: n.disabled,
464
+ "aria-invalid": !!n.error,
465
+ "aria-describedby": n.error ? `${o}-errors` : void 0,
466
+ onChange: (e) => n.changeText(e.currentTarget.value)
467
+ }),
468
+ /* @__PURE__ */ k(G, {
469
+ open: n.open,
470
+ onOpenChange: (e) => e ? n.openPicker() : n.close(),
471
+ children: [/* @__PURE__ */ O(q, {
472
+ asChild: !0,
473
+ children: /* @__PURE__ */ O(R, {
474
+ type: "button",
475
+ variant: "ghost",
476
+ size: "icon",
477
+ className: "absolute start-1 top-1/2 h-8 w-8 -translate-y-1/2",
478
+ disabled: n.disabled,
479
+ "aria-label": a("editor.chooseDuration"),
480
+ title: a("editor.chooseDuration"),
481
+ children: /* @__PURE__ */ O(Se, { "aria-hidden": "true" })
482
+ })
483
+ }), /* @__PURE__ */ k(K, {
484
+ align: "start",
485
+ className: "w-80 space-y-3",
486
+ children: [
487
+ /* @__PURE__ */ O("div", {
488
+ className: "flex gap-2",
489
+ children: ["components", "weeks"].map((e) => /* @__PURE__ */ O(R, {
490
+ type: "button",
491
+ variant: n.mode === e ? "default" : "outline",
492
+ "aria-pressed": n.mode === e,
493
+ disabled: n.disabled,
494
+ onClick: () => n.setMode(e),
495
+ children: r(e === "weeks" ? "duration.modeWeeks" : "duration.modeComponents")
496
+ }, e))
497
+ }),
498
+ n.activeFields.map((e) => /* @__PURE__ */ k("div", {
499
+ className: "grid grid-cols-[1fr_2rem] items-center gap-1",
500
+ children: [/* @__PURE__ */ k("label", {
501
+ className: "grid grid-cols-2 items-center gap-2",
502
+ children: [/* @__PURE__ */ O(L, {
503
+ type: "number",
504
+ min: 0,
505
+ max: m,
506
+ step: 1,
507
+ value: n.draft[e],
508
+ "aria-label": s(e),
509
+ disabled: n.disabled,
510
+ onChange: (t) => n.changePart(e, Number(t.currentTarget.value))
511
+ }), /* @__PURE__ */ O("span", { children: s(e) })]
512
+ }), n.mode === "components" && n.activeFields.length > 1 && /* @__PURE__ */ O(R, {
513
+ type: "button",
514
+ size: "icon",
515
+ variant: "ghost",
516
+ className: "h-8 w-8",
517
+ disabled: n.disabled,
518
+ "aria-label": r("duration.removeUnit", { unit: s(e) }),
519
+ title: r("duration.removeUnit", { unit: s(e) }),
520
+ onClick: () => n.removeField(e),
521
+ children: /* @__PURE__ */ O(Te, { "aria-hidden": "true" })
522
+ })]
523
+ }, e)),
524
+ n.addableFields.length > 0 && /* @__PURE__ */ k(Ie, {
525
+ value: "",
526
+ disabled: n.disabled,
527
+ onValueChange: (e) => n.addField(e),
528
+ children: [/* @__PURE__ */ O(ze, {
529
+ "aria-label": r("duration.addUnit"),
530
+ children: /* @__PURE__ */ O(Be, { placeholder: r("duration.addUnit") })
531
+ }), /* @__PURE__ */ O(Le, { children: n.addableFields.map((e) => /* @__PURE__ */ O(Re, {
532
+ value: e,
533
+ children: s(e)
534
+ }, e)) })]
535
+ }),
536
+ n.showActions && /* @__PURE__ */ k("div", {
537
+ className: "flex justify-end gap-2",
538
+ children: [/* @__PURE__ */ O(R, {
539
+ type: "button",
540
+ variant: "outline",
541
+ onClick: n.close,
542
+ children: n.options.cancelLabel ? i(n.options.cancelLabel, n.options.cancelLabel) : r("duration.cancel")
543
+ }), /* @__PURE__ */ O(R, {
544
+ type: "button",
545
+ disabled: n.disabled,
546
+ onClick: n.apply,
547
+ children: n.options.okLabel ? i(n.options.okLabel, n.options.okLabel) : r("duration.ok")
548
+ })]
549
+ })
550
+ ]
551
+ })]
552
+ }),
553
+ /* @__PURE__ */ O(j, {
554
+ clearable: n.options.clearable !== !1,
555
+ data: e.data,
556
+ enabled: !n.disabled,
557
+ onClear: () => n.changeText("")
558
+ })
559
+ ]
560
+ })
561
+ }));
562
+ }, Mt = I(jt), Nt = ({ message: t, cell: n, severity: r }) => {
563
+ let [i, a] = e.useState(!1), o = r === "warning" ? "text-amber-600 dark:text-amber-400" : "text-destructive", s = r === "warning" ? we : me;
564
+ return n ? /* @__PURE__ */ k(G, {
565
+ open: i,
566
+ onOpenChange: a,
567
+ children: [/* @__PURE__ */ O(q, {
568
+ asChild: !0,
569
+ children: /* @__PURE__ */ O(R, {
570
+ type: "button",
571
+ variant: "ghost",
572
+ size: "icon",
573
+ className: "h-6 w-6 shrink-0 " + o,
574
+ "aria-label": t,
575
+ onMouseEnter: () => a(!0),
576
+ onFocus: () => a(!0),
577
+ children: /* @__PURE__ */ O(s, { className: "h-4 w-4" })
578
+ })
579
+ }), /* @__PURE__ */ O(K, {
580
+ onOpenAutoFocus: (e) => e.preventDefault(),
581
+ className: "max-w-sm text-sm",
582
+ children: t
583
+ })]
584
+ }) : /* @__PURE__ */ O("div", {
585
+ role: "alert",
586
+ className: "text-sm " + o,
587
+ children: t
588
+ });
589
+ };
590
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/asyncToGenerator.js
591
+ function Pt(e, t, n, r, i, a, o) {
592
+ try {
593
+ var s = e[a](o), c = s.value;
594
+ } catch (e) {
595
+ n(e);
596
+ return;
597
+ }
598
+ s.done ? t(c) : Promise.resolve(c).then(r, i);
599
+ }
600
+ function Ft(e) {
601
+ return function() {
602
+ var t = this, n = arguments;
603
+ return new Promise(function(r, i) {
604
+ var a = e.apply(t, n);
605
+ function o(e) {
606
+ Pt(a, r, i, o, s, "next", e);
607
+ }
608
+ function s(e) {
609
+ Pt(a, r, i, o, s, "throw", e);
610
+ }
611
+ o(void 0);
612
+ });
613
+ };
614
+ }
615
+ // src/renderers/FileControlRenderer.tsx
616
+ var It = (e) => /* @__PURE__ */ O(R, X(X({}, e), {}, {
617
+ type: "button",
618
+ variant: "ghost",
619
+ size: "sm"
620
+ })), Lt = (e) => /* @__PURE__ */ O("span", X(X({}, e), {}, { className: "bg-secondary text-secondary-foreground text-sm" })), Rt = (e) => e.type === "string" && (e.contentEncoding === "base64" || e.format === "binary" || e.format === "byte"), zt = U(2, z(W("Control"), Oe(Rt))), Bt = (e, t, n) => Math.max(zt(e, t, n), Ue(e, t, n)), Vt = (e) => {
621
+ let t = Number(e);
622
+ return e !== void 0 && Number.isFinite(t) && t >= 0 ? t : void 0;
623
+ }, Ht = (e, t) => new Promise((n, r) => {
624
+ let i = new FileReader();
625
+ i.onerror = () => {
626
+ var e;
627
+ return r((e = i.error) == null ? /* @__PURE__ */ Error("Failed to read file") : e);
628
+ }, i.onload = () => {
629
+ var r;
630
+ let a = String((r = i.result) == null ? "" : r);
631
+ if (t.format === "uri") n(a);
632
+ else if (t.format === "binary") {
633
+ let t = a.indexOf(";base64,");
634
+ n(t < 0 ? a : `${a.slice(0, t)};filename=${encodeURIComponent(e.name)}${a.slice(t)}`);
635
+ } else n(a.slice(a.indexOf(",") + 1));
636
+ }, i.readAsDataURL(e);
637
+ }), Ut = (t) => {
638
+ var n, r, i, a, o, s, c;
639
+ let l = e.useRef(null), u = J(), [d, f] = e.useState(), [p, m] = e.useState(!1), h = e.useContext(re), [g, _] = e.useState("warning"), [v, y] = e.useState(""), [b, x] = e.useState(t.data);
640
+ if (Object.is(b, t.data) || (x(() => t.data), y("")), !t.visible) return null;
641
+ let S = t.schema, C = X(X({}, t.config), t.uischema.options), ee = F(t.path, t.label), w = Vt((n = (r = (i = S.formatMinimum) == null ? S.formatExclusiveMinimum : i) == null ? C.formatMinimum : r) == null ? C.formatExclusiveMinimum : n), T = Vt((a = (o = (s = S.formatMaximum) == null ? S.formatExclusiveMaximum : s) == null ? C.formatMaximum : o) == null ? C.formatExclusiveMaximum : a), E = S.formatMinimum === void 0 && (S.formatExclusiveMinimum !== void 0 || C.formatExclusiveMinimum !== void 0), D = S.formatMaximum === void 0 && (S.formatExclusiveMaximum !== void 0 || C.formatExclusiveMaximum !== void 0), A = t.data ? (c = He(t.data)) == null ? d && d.value === t.data ? d.name : u("file.attached") : c : "";
642
+ return /* @__PURE__ */ k(N, X(X({}, t), {}, {
643
+ id: ee,
644
+ label: t.label,
645
+ required: t.required,
646
+ description: t.description,
647
+ errors: t.errors,
648
+ children: [
649
+ /* @__PURE__ */ k("div", {
650
+ className: "shadcn-jsonforms-file-control group relative flex items-center min-w-0 w-full",
651
+ children: [
652
+ /* @__PURE__ */ O(L, {
653
+ ref: l,
654
+ style: { display: "none" },
655
+ id: ee,
656
+ type: "file",
657
+ accept: S.contentMediaType || (typeof C.accept == "string" ? C.accept : void 0),
658
+ required: t.required,
659
+ disabled: !t.enabled || t.readonly || p,
660
+ onChange: function() {
661
+ var e = Ft(function* (e) {
662
+ var n;
663
+ let r = (n = e.currentTarget.files) == null ? void 0 : n[0];
664
+ if (r) {
665
+ if (_("warning"), w !== void 0 && (E ? r.size <= w : r.size < w)) y(u("file.rejected", {
666
+ name: r.name,
667
+ reason: u("file.sizeBound", {
668
+ name: r.name,
669
+ bound: u(E ? "file.moreThan" : "file.atLeast"),
670
+ limit: w
671
+ })
672
+ })), e.currentTarget.value = "";
673
+ else if (T !== void 0 && (D ? r.size >= T : r.size > T)) y(u("file.rejected", {
674
+ name: r.name,
675
+ reason: u("file.sizeBound", {
676
+ name: r.name,
677
+ bound: u(D ? "file.lessThan" : "file.atMost"),
678
+ limit: T
679
+ })
680
+ })), e.currentTarget.value = "";
681
+ else {
682
+ m(!0), y("");
683
+ try {
684
+ let e = yield Ht(r, S);
685
+ t.handleChange(t.path, e), f({
686
+ value: e,
687
+ name: r.name
688
+ });
689
+ } catch (e) {
690
+ _("error"), y(u("file.readFailed"));
691
+ } finally {
692
+ m(!1);
693
+ }
694
+ }
695
+ }
696
+ });
697
+ return function(t) {
698
+ return e.apply(this, arguments);
699
+ };
700
+ }()
701
+ }),
702
+ /* @__PURE__ */ O(R, {
703
+ type: "button",
704
+ variant: "ghost",
705
+ size: "icon",
706
+ className: "absolute left-1 z-10 h-7 w-7",
707
+ disabled: !t.enabled || t.readonly || p,
708
+ onClick: () => {
709
+ var e;
710
+ return (e = l.current) == null ? void 0 : e.click();
711
+ },
712
+ "aria-label": t.label ? t.label + ": " + u("file.select") : u("file.select"),
713
+ children: /* @__PURE__ */ O(_e, { className: "h-4 w-4" })
714
+ }),
715
+ /* @__PURE__ */ O(L, {
716
+ readOnly: !0,
717
+ disabled: !t.enabled || t.readonly,
718
+ className: h && v ? "pl-10 pr-16" : "pl-10 pr-10",
719
+ "aria-label": t.label,
720
+ "aria-invalid": !!t.errors,
721
+ value: A,
722
+ title: A
723
+ }),
724
+ h && v && /* @__PURE__ */ O("div", {
725
+ className: "absolute right-10",
726
+ children: /* @__PURE__ */ O(Nt, {
727
+ message: v,
728
+ cell: !0,
729
+ severity: g
730
+ })
731
+ }),
732
+ /* @__PURE__ */ O(j, {
733
+ data: t.data,
734
+ enabled: t.enabled && !p,
735
+ readonly: t.readonly,
736
+ clearable: C.clearable !== !1,
737
+ onClear: () => {
738
+ t.handleChange(t.path, void 0), f(void 0), y(""), l.current && (l.current.value = "");
739
+ }
740
+ })
741
+ ]
742
+ }),
743
+ v && !h && /* @__PURE__ */ O(Nt, {
744
+ message: v,
745
+ severity: g
746
+ }),
747
+ p ? /* @__PURE__ */ O("div", {
748
+ role: "status",
749
+ children: u("file.reading")
750
+ }) : null
751
+ ]
752
+ }));
753
+ }, Wt = (t) => {
754
+ let n = e.useContext(re);
755
+ if (!We(t.schema, t.rootSchema)) return /* @__PURE__ */ O(Ut, X({}, t));
756
+ if (!t.visible) return null;
757
+ let r = F(t.path, t.label);
758
+ return /* @__PURE__ */ O(N, X(X({}, t), {}, {
759
+ id: r,
760
+ children: /* @__PURE__ */ O(Ve, X(X({}, t), {}, {
761
+ isValid: !t.errors,
762
+ cell: n,
763
+ FeedbackComponent: Nt,
764
+ id: r,
765
+ ButtonComponent: It,
766
+ PillComponent: Lt
767
+ }))
768
+ }));
769
+ }, Gt = I(Wt), Kt = U(2, z(W("Control"), Oe((e) => e.type === "null"))), qt = (e) => {
770
+ if (!e.visible) return null;
771
+ let t = F(e.path, e.label);
772
+ return /* @__PURE__ */ O(N, X(X({}, e), {}, {
773
+ id: t,
774
+ label: void 0,
775
+ description: e.description,
776
+ errors: e.errors,
777
+ children: /* @__PURE__ */ k("label", {
778
+ className: "shadcn-jsonforms-checkbox-label",
779
+ htmlFor: t,
780
+ children: [/* @__PURE__ */ O(Ge, {
781
+ className: "shadcn-jsonforms-checkbox-control",
782
+ id: t,
783
+ checked: e.data === null || e.data !== void 0 && "indeterminate",
784
+ disabled: !e.enabled || e.readonly,
785
+ onCheckedChange: (t) => e.handleChange(e.path, t ? null : void 0)
786
+ }), /* @__PURE__ */ k("span", { children: [e.label, e.required ? " *" : ""] })]
787
+ })
788
+ }));
789
+ }, Jt = I(qt), Yt = (e) => {
790
+ var t, n;
791
+ return String((t = (n = e.options) == null ? void 0 : n.variant) == null ? "" : t).toLowerCase() === "splitter";
792
+ }, Xt = U(5, z(H(W("HorizontalLayout"), W("VerticalLayout")), Yt)), Zt = (t) => {
793
+ var n;
794
+ let r = J(), i = t.uischema, a = Ke(i.elements, t.path, t.config), o = i.type === "HorizontalLayout", s = X(X({}, t.config), i.options), c = y(a);
795
+ return !t.visible || !a.length ? null : /* @__PURE__ */ O(Ye, {
796
+ orientation: o ? "horizontal" : "vertical",
797
+ disabled: s.resizable === !1,
798
+ "data-layout-diagnostic": s.wrap ? "`wrap` is not supported together with the splitter variant; ignored." : void 0,
799
+ style: {
800
+ width: "100%",
801
+ minWidth: 0,
802
+ height: o ? void 0 : (n = w(s.height)) == null ? "20rem" : n
803
+ },
804
+ children: a.map((n, i) => /* @__PURE__ */ k(e.Fragment, { children: [i > 0 && /* @__PURE__ */ O(qe, {
805
+ withHandle: !0,
806
+ "aria-label": r("layout.resizePane", { index: i }),
807
+ disabled: s.resizable === !1
808
+ }), /* @__PURE__ */ O(Je, {
809
+ defaultSize: `${c[i]}%`,
810
+ minSize: "1%",
811
+ style: {
812
+ overflow: "auto",
813
+ padding: 8
814
+ },
815
+ children: /* @__PURE__ */ O(oe, {
816
+ schema: t.schema,
817
+ uischema: n,
818
+ path: t.path,
819
+ enabled: t.enabled,
820
+ renderers: t.renderers,
821
+ cells: t.cells
822
+ })
823
+ })] }, i))
824
+ });
825
+ }, Qt = se(Zt), $t = U(3, z(V, H(B("cron"), De("format", "cron")))), en = [
826
+ "year",
827
+ "month",
828
+ "week",
829
+ "day",
830
+ "hour",
831
+ "minute",
832
+ "second"
833
+ ], tn = ({ name: e, value: t, disabled: n, invalid: r, placeholder: i, onChange: a }) => {
834
+ let o = J();
835
+ return /* @__PURE__ */ k("div", {
836
+ className: "group/cron-popup-input relative min-w-0",
837
+ children: [/* @__PURE__ */ O(L, {
838
+ className: "w-full pe-10",
839
+ "aria-label": e,
840
+ "aria-invalid": !!r,
841
+ value: t,
842
+ disabled: n,
843
+ placeholder: i,
844
+ onChange: (e) => a(e.currentTarget.value)
845
+ }), t !== "" && !n && /* @__PURE__ */ O(R, {
846
+ type: "button",
847
+ variant: "ghost",
848
+ size: "icon",
849
+ className: "invisible absolute inset-y-0 end-1 my-auto h-8 w-8 opacity-0 transition-opacity group-hover/cron-popup-input:visible group-hover/cron-popup-input:opacity-100 group-focus-within/cron-popup-input:visible group-focus-within/cron-popup-input:opacity-100",
850
+ "aria-label": `${o("control.clearValue")}: ${e}`,
851
+ onMouseDown: (e) => e.preventDefault(),
852
+ onPointerDown: (e) => e.preventDefault(),
853
+ onClick: () => a(""),
854
+ children: /* @__PURE__ */ O(Te, {
855
+ className: "h-4 w-4",
856
+ "aria-hidden": "true"
857
+ })
858
+ })]
859
+ });
860
+ }, nn = ({ field: e, value: t, disabled: n, onChange: r }) => {
861
+ let i = J(), a = C(t, e), [s, c] = o[e], l = i(`cron.${e}`);
862
+ if (a === void 0) return /* @__PURE__ */ k("div", {
863
+ className: "grid grid-cols-[7rem_minmax(0,1fr)] items-center gap-2",
864
+ children: [/* @__PURE__ */ O("span", { children: l }), /* @__PURE__ */ O(tn, {
865
+ name: l,
866
+ value: t,
867
+ disabled: n,
868
+ onChange: r
869
+ })]
870
+ });
871
+ let u = a.length === c - s + 1 ? [] : a;
872
+ return /* @__PURE__ */ k("div", {
873
+ className: "grid grid-cols-[7rem_minmax(0,1fr)] items-center gap-2",
874
+ children: [/* @__PURE__ */ O("span", { children: l }), /* @__PURE__ */ k("div", {
875
+ className: "group/cron-choice relative min-w-0",
876
+ children: [/* @__PURE__ */ k(G, { children: [/* @__PURE__ */ O(q, {
877
+ asChild: !0,
878
+ children: /* @__PURE__ */ k(R, {
879
+ type: "button",
880
+ variant: "outline",
881
+ disabled: n,
882
+ "aria-label": l,
883
+ className: "w-full min-w-0 justify-between pe-3",
884
+ children: [/* @__PURE__ */ O("span", {
885
+ className: "min-w-0 flex-1 truncate text-start pe-10",
886
+ children: u.length ? u.map((t) => b(t, e)).join(", ") : i("cron.every")
887
+ }), /* @__PURE__ */ O(pe, {
888
+ className: "h-4 w-4 shrink-0 opacity-60",
889
+ "aria-hidden": "true"
890
+ })]
891
+ })
892
+ }), /* @__PURE__ */ O(K, {
893
+ align: "start",
894
+ className: "w-[var(--radix-popover-trigger-width)] max-h-64 overflow-y-auto p-1",
895
+ children: /* @__PURE__ */ O("div", {
896
+ role: "listbox",
897
+ "aria-label": l,
898
+ "aria-multiselectable": "true",
899
+ children: Array.from({ length: c - s + 1 }, (e, t) => s + t).map((t) => /* @__PURE__ */ k(R, {
900
+ type: "button",
901
+ variant: "ghost",
902
+ role: "option",
903
+ "aria-selected": u.includes(t),
904
+ className: "w-full justify-between font-normal",
905
+ onClick: () => r(v(u.includes(t) ? u.filter((e) => e !== t) : [...u, t], e)),
906
+ children: [b(t, e), u.includes(t) && /* @__PURE__ */ O(fe, {
907
+ className: "h-4 w-4",
908
+ "aria-hidden": "true"
909
+ })]
910
+ }, t))
911
+ })
912
+ })] }), u.length > 0 && !n && /* @__PURE__ */ O(R, {
913
+ type: "button",
914
+ variant: "ghost",
915
+ size: "icon",
916
+ className: "absolute end-8 top-1/2 h-6 w-6 -translate-y-1/2 opacity-0 group-hover/cron-choice:opacity-100 group-focus-within/cron-choice:opacity-100",
917
+ "aria-label": `${i("cron.every")}: ${l}`,
918
+ title: `${i("cron.every")}: ${l}`,
919
+ onMouseDown: (e) => e.preventDefault(),
920
+ onPointerDown: (e) => e.preventDefault(),
921
+ onClick: (e) => {
922
+ e.stopPropagation(), r("*");
923
+ },
924
+ children: /* @__PURE__ */ O(Te, {
925
+ className: "h-3 w-3",
926
+ "aria-hidden": "true"
927
+ })
928
+ })]
929
+ })]
930
+ });
931
+ }, rn = (e) => {
932
+ var t;
933
+ let { label: n, expression: r, open: o, setOpen: s, text: c, period: l, options: u, showActions: d, disabled: f, localError: p, draft: m, changeField: h, changeText: g, changePeriod: _, editedProblem: v, shownFields: y, hasCustomField: b, openOn: x, accept: S } = T(e);
934
+ if (!e.visible) return null;
935
+ let C = F(e.path, e.label);
936
+ return /* @__PURE__ */ O(N, X(X({}, e), {}, {
937
+ id: C,
938
+ label: e.label,
939
+ required: e.required,
940
+ description: e.description,
941
+ errors: p || e.errors,
942
+ children: /* @__PURE__ */ k("div", {
943
+ className: "group relative",
944
+ children: [
945
+ /* @__PURE__ */ O(L, {
946
+ id: C,
947
+ className: "pl-10 pr-10",
948
+ value: r,
949
+ disabled: f,
950
+ placeholder: (t = u.placeholder) == null ? a : t,
951
+ autoFocus: u.focus,
952
+ "aria-invalid": !!(p || e.errors),
953
+ "aria-describedby": p || e.errors ? `${C}-errors` : void 0,
954
+ onChange: (t) => e.handleChange(e.path, t.currentTarget.value || void 0)
955
+ }),
956
+ /* @__PURE__ */ k(G, {
957
+ open: o,
958
+ onOpenChange: x,
959
+ children: [/* @__PURE__ */ O(q, {
960
+ asChild: !0,
961
+ children: /* @__PURE__ */ O(R, {
962
+ type: "button",
963
+ variant: "ghost",
964
+ size: "icon",
965
+ className: "absolute start-1 top-1/2 h-8 w-8 -translate-y-1/2",
966
+ disabled: f,
967
+ "aria-label": n("cron.choose"),
968
+ title: n("cron.choose"),
969
+ children: /* @__PURE__ */ O(de, { "aria-hidden": "true" })
970
+ })
971
+ }), /* @__PURE__ */ k(K, {
972
+ align: "start",
973
+ className: "w-96 max-w-[calc(100vw-2rem)] space-y-3",
974
+ children: [
975
+ /* @__PURE__ */ k("div", {
976
+ className: "grid grid-cols-[7rem_minmax(0,1fr)] items-center gap-2",
977
+ children: [/* @__PURE__ */ O("span", { children: n("cron.repeats") }), /* @__PURE__ */ k(Ie, {
978
+ value: l == null ? "" : l,
979
+ disabled: f,
980
+ onValueChange: (e) => _(e),
981
+ children: [/* @__PURE__ */ O(ze, {
982
+ "aria-label": n("cron.repeats"),
983
+ children: /* @__PURE__ */ O(Be, { placeholder: n("cron.chooseRepeats") })
984
+ }), /* @__PURE__ */ O(Le, { children: en.map((e) => /* @__PURE__ */ O(Re, {
985
+ value: e,
986
+ children: n(`cron.period.${e}`)
987
+ }, e)) })]
988
+ })]
989
+ }),
990
+ y.map((e) => {
991
+ var t;
992
+ return /* @__PURE__ */ O(nn, {
993
+ field: e,
994
+ value: (t = m[i.indexOf(e)]) == null ? "*" : t,
995
+ disabled: f,
996
+ onChange: (t) => h(e, t)
997
+ }, e);
998
+ }),
999
+ b && /* @__PURE__ */ O("p", {
1000
+ className: "text-sm text-muted-foreground",
1001
+ children: n("cron.advanced")
1002
+ }),
1003
+ /* @__PURE__ */ k("div", {
1004
+ className: "grid grid-cols-[7rem_minmax(0,1fr)] items-center gap-2",
1005
+ children: [/* @__PURE__ */ O("span", { children: n("cron.expression") }), /* @__PURE__ */ O(tn, {
1006
+ name: n("cron.expression"),
1007
+ value: c,
1008
+ disabled: f,
1009
+ placeholder: a,
1010
+ invalid: !!v,
1011
+ onChange: g
1012
+ })]
1013
+ }),
1014
+ v && /* @__PURE__ */ O("p", {
1015
+ role: "alert",
1016
+ children: n(`cron.error.${v}`)
1017
+ }),
1018
+ d && /* @__PURE__ */ k("div", {
1019
+ className: "flex justify-end gap-2",
1020
+ children: [/* @__PURE__ */ O(R, {
1021
+ type: "button",
1022
+ variant: "outline",
1023
+ onClick: () => s(!1),
1024
+ children: n("cron.cancel")
1025
+ }), /* @__PURE__ */ O(R, {
1026
+ type: "button",
1027
+ disabled: f || !!v,
1028
+ onClick: S,
1029
+ children: n("cron.ok")
1030
+ })]
1031
+ })
1032
+ ]
1033
+ })]
1034
+ }),
1035
+ /* @__PURE__ */ O(j, {
1036
+ clearable: u.clearable !== !1,
1037
+ data: e.data,
1038
+ enabled: !f,
1039
+ onClear: () => e.handleChange(e.path, void 0)
1040
+ })
1041
+ ]
1042
+ })
1043
+ }));
1044
+ }, an = I(rn), $ = {
1045
+ accentColor: "#0f172a",
1046
+ borderRadius: 6,
1047
+ density: "comfortable"
1048
+ }, on = (e = $, t = !1) => {
1049
+ var n, r;
1050
+ let i = (n = e.borderRadius) == null ? $.borderRadius : n, a = (r = e.accentColor) == null ? $.accentColor : r, o = t && a === $.accentColor ? "#f8fafc" : a, s = e.density === "compact";
1051
+ return {
1052
+ "--shadcn-jsonforms-accent": o,
1053
+ "--shadcn-jsonforms-radius": `${i}px`,
1054
+ colorScheme: t ? "dark" : "light",
1055
+ fontSize: s ? "13px" : "14px"
1056
+ };
1057
+ }, sn = X({ weeks: 0 }, Xe), cn = RegExp("^P(?<weeks>\\d+)W$", "i"), ln = (e) => e ? Number.parseInt(e, 10) : 0, un = (e) => {
1058
+ if (typeof e != "string" || !e.trim()) return null;
1059
+ let t = e.trim().match(cn);
1060
+ if (t != null && t.groups) return X(X({}, sn), {}, { weeks: ln(t.groups.weeks) });
1061
+ let n = Qe(e);
1062
+ return n ? X({ weeks: 0 }, n) : null;
1063
+ }, dn = (e) => {
1064
+ let t = $e(e);
1065
+ return t.weeks ? X(X({}, sn), {}, { weeks: t.weeks }) : t;
1066
+ }, fn = (e) => {
1067
+ let t = dn(e);
1068
+ return t.weeks ? `P${t.weeks}W` : Ze(t);
1069
+ }, pn = () => [
1070
+ {
1071
+ tester: x,
1072
+ renderer: et
1073
+ },
1074
+ {
1075
+ tester: ot,
1076
+ renderer: st
1077
+ },
1078
+ {
1079
+ tester: h,
1080
+ renderer: _t
1081
+ },
1082
+ {
1083
+ tester: S,
1084
+ renderer: vt
1085
+ },
1086
+ {
1087
+ tester: bt,
1088
+ renderer: Ct
1089
+ },
1090
+ {
1091
+ tester: $t,
1092
+ renderer: an
1093
+ },
1094
+ {
1095
+ tester: Tt,
1096
+ renderer: kt
1097
+ },
1098
+ {
1099
+ tester: At,
1100
+ renderer: Mt
1101
+ },
1102
+ {
1103
+ tester: Bt,
1104
+ renderer: Gt
1105
+ },
1106
+ {
1107
+ tester: Kt,
1108
+ renderer: Jt
1109
+ },
1110
+ {
1111
+ tester: Xt,
1112
+ renderer: Qt
1113
+ },
1114
+ ...d({
1115
+ components: void 0,
1116
+ includeButtonRenderer: !1
1117
+ }).filter((e) => e.tester !== x)
1118
+ ], mn = pn(), hn = mn, gn = () => [
1119
+ {
1120
+ tester: Bt,
1121
+ cell: P(Gt)
1122
+ },
1123
+ {
1124
+ tester: Tt,
1125
+ cell: P(kt)
1126
+ },
1127
+ {
1128
+ tester: At,
1129
+ cell: P(Mt)
1130
+ },
1131
+ {
1132
+ tester: $t,
1133
+ cell: P(an)
1134
+ },
1135
+ {
1136
+ tester: Kt,
1137
+ cell: P(Jt)
1138
+ }
1139
+ ], _n = gn();
1140
+ export { _t as AgGridArrayControlRenderer, _t as ShadcnAgGridControlRenderer, kt as ColorControlRenderer, an as CronControlRenderer, Mt as DurationControlRenderer, sn as EMPTY_DURATION_PARTS, Gt as FileControlRenderer, st as MaskControlRenderer, Jt as NullControlRenderer, wt as ShadcnAgGridArrayControl, St as ShadcnButtonRenderer, Ct as ShadcnButtonRendererWithProps, Ot as ShadcnColorControl, rn as ShadcnCronControl, jt as ShadcnDurationControl, Wt as ShadcnFileControl, at as ShadcnMaskControl, vt as ShadcnMonacoControlRenderer, qt as ShadcnNullControl, Zt as ShadcnSplitLayout, Qt as SplitLayoutRenderer, hn as advancedShadcnRenderers, g as agGridArrayTester, Tt as colorControlTester, gn as createShadcnExtendedCells, pn as createShadcnExtendedRenderers, on as createShadcnRendererStyle, $t as cronControlTester, $ as defaultShadcnRendererSettings, At as durationControlTester, Bt as fileControlTester, fn as formatDurationIso, Yt as hasSplitLayoutVariant, Rt as isStringFileSchema, ot as maskControlTester, Et as normalizeColor, Kt as nullControlTester, un as parseDuration, Ht as readFile, dn as sanitizeDurationParts, bt as shadcnButtonRendererTester, _n as shadcnExtendedCells, mn as shadcnExtendedRenderers, Xt as splitLayoutTester };
1141
+
1142
+ //# sourceMappingURL=jsonforms-react-shadcn-extended.esm.js.map