treege 3.0.0-beta.94 → 3.0.0-beta.96

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,1909 +0,0 @@
1
- import { D as e, E as t, F as n, L as r, M as i, N as a, O as o, P as s, S as c, T as l, V as u, _ as d, g as f, h as p, j as m, k as h, s as g, v as _, w as v, x as y, y as b } from "./ThemeContext-CE3SE9DG.js";
2
- import * as x from "react";
3
- import { createContext as S, forwardRef as C, useCallback as w, useContext as T, useEffect as E, useMemo as ee, useRef as D, useState as O } from "react";
4
- import { Fragment as te, jsx as k, jsxs as A } from "react/jsx-runtime";
5
- import { Check as ne, CheckIcon as re, ChevronDownIcon as j, ChevronLeftIcon as ie, ChevronRightIcon as ae, ChevronUpIcon as M, ChevronsUpDown as oe, CircleIcon as N, File as P, FileUp as se, Loader2 as F, MapPin as I, SearchIcon as ce, X as le, XIcon as L } from "lucide-react";
6
- import { Slot as ue } from "@radix-ui/react-slot";
7
- import { cva as R } from "class-variance-authority";
8
- import { clsx as de } from "clsx";
9
- import { extendTailwindMerge as z } from "tailwind-merge";
10
- import * as fe from "@radix-ui/react-checkbox";
11
- import * as pe from "@radix-ui/react-label";
12
- import * as B from "@radix-ui/react-popover";
13
- import * as V from "@radix-ui/react-select";
14
- import * as H from "@radix-ui/react-tooltip";
15
- import * as me from "@radix-ui/react-separator";
16
- import { Command as U } from "cmdk";
17
- import * as W from "@radix-ui/react-dialog";
18
- import { DayPicker as he, getDefaultClassNames as ge } from "react-day-picker";
19
- import * as _e from "@radix-ui/react-radio-group";
20
- import * as G from "@radix-ui/react-switch";
21
- //#region src/shared/lib/utils.ts
22
- var ve = z({ prefix: "tg" });
23
- function K(...e) {
24
- return ve(de(e));
25
- }
26
- //#endregion
27
- //#region src/shared/components/ui/button.tsx
28
- var ye = R("tg:inline-flex tg:items-center tg:justify-center tg:gap-2 tg:whitespace-nowrap tg:rounded-md tg:text-sm tg:font-medium tg:transition-all tg:disabled:pointer-events-none tg:disabled:opacity-50 tg:[&_svg]:pointer-events-none tg:[&_svg:not([class*='size-'])]:size-4 tg:shrink-0 tg:[&_svg]:shrink-0 tg:outline-none tg:focus-visible:border-ring tg:focus-visible:ring-ring/50 tg:focus-visible:ring-[3px] tg:aria-invalid:ring-destructive/20 tg:dark:aria-invalid:ring-destructive/40 tg:aria-invalid:border-destructive", {
29
- defaultVariants: {
30
- size: "default",
31
- variant: "default"
32
- },
33
- variants: {
34
- size: {
35
- default: "tg:h-9 tg:px-4 tg:py-2 tg:has-[>svg]:px-3",
36
- icon: "tg:size-9",
37
- "icon-lg": "tg:size-10",
38
- "icon-sm": "tg:size-8",
39
- lg: "tg:h-10 tg:rounded-md tg:px-6 tg:has-[>svg]:px-4",
40
- sm: "tg:h-8 tg:rounded-md tg:gap-1.5 tg:px-3 tg:has-[>svg]:px-2.5",
41
- xs: "tg:h-6 tg:rounded-md tg:gap-1 tg:px-2 tg:text-xs tg:has-[>svg]:px-1.5"
42
- },
43
- variant: {
44
- default: "tg:bg-primary tg:text-primary-foreground tg:hover:bg-primary/90",
45
- destructive: "tg:bg-destructive tg:text-white tg:hover:bg-destructive/90 tg:focus-visible:ring-destructive/20 tg:dark:focus-visible:ring-destructive/40 tg:dark:bg-destructive/60",
46
- ghost: "tg:hover:bg-accent tg:hover:text-accent-foreground tg:dark:hover:bg-accent/50",
47
- icon: "tg:opacity-60 tg:hover:bg-transparent! tg:hover:opacity-100",
48
- link: "tg:text-primary tg:underline-offset-4 tg:hover:underline",
49
- outline: "tg:border tg:bg-background tg:shadow-xs tg:hover:bg-accent tg:hover:text-accent-foreground tg:dark:bg-input/30 tg:dark:border-input tg:dark:hover:bg-input/50",
50
- secondary: "tg:bg-secondary tg:text-secondary-foreground tg:hover:bg-secondary/80"
51
- }
52
- }
53
- });
54
- function q({ className: e, variant: t, size: n, asChild: r = !1, ...i }) {
55
- return /* @__PURE__ */ k(r ? ue : "button", {
56
- "data-slot": "button",
57
- className: K(ye({
58
- className: e,
59
- size: n,
60
- variant: t
61
- })),
62
- ...i
63
- });
64
- }
65
- //#endregion
66
- //#region src/shared/components/ui/checkbox.tsx
67
- function be({ className: e, ...t }) {
68
- return /* @__PURE__ */ k(fe.Root, {
69
- "data-slot": "checkbox",
70
- className: K("tg:peer tg:size-4 tg:shrink-0 tg:rounded-[4px] tg:border tg:border-input tg:shadow-xs tg:outline-none tg:transition-shadow tg:focus-visible:border-ring tg:focus-visible:ring-[3px] tg:focus-visible:ring-ring/50 tg:disabled:cursor-not-allowed tg:disabled:opacity-50 tg:aria-invalid:border-destructive tg:aria-invalid:ring-destructive/20 tg:data-[state=checked]:border-primary tg:data-[state=checked]:bg-primary tg:data-[state=checked]:text-primary-foreground tg:dark:bg-input/30 tg:dark:data-[state=checked]:bg-primary tg:dark:aria-invalid:ring-destructive/40", e),
71
- ...t,
72
- children: /* @__PURE__ */ k(fe.Indicator, {
73
- "data-slot": "checkbox-indicator",
74
- className: "tg:grid tg:place-content-center tg:text-current tg:transition-none",
75
- children: /* @__PURE__ */ k(re, { className: "tg:size-3.5" })
76
- })
77
- });
78
- }
79
- //#endregion
80
- //#region src/shared/components/ui/form.tsx
81
- function J({ className: e, ...t }) {
82
- return /* @__PURE__ */ k("div", {
83
- "data-slot": "form-item",
84
- className: K("tg:grid tg:gap-2", e),
85
- ...t
86
- });
87
- }
88
- function Y({ className: e, ...t }) {
89
- return /* @__PURE__ */ k("p", {
90
- "data-slot": "form-description",
91
- className: K("tg:text-muted-foreground tg:text-xs", e),
92
- ...t
93
- });
94
- }
95
- function X({ className: e, ...t }) {
96
- return /* @__PURE__ */ k("p", {
97
- "data-slot": "form-error",
98
- className: K("tg:text-destructive tg:text-xs", e),
99
- ...t
100
- });
101
- }
102
- //#endregion
103
- //#region src/shared/components/ui/input.tsx
104
- function Z({ className: e, type: t, ...n }) {
105
- return /* @__PURE__ */ k("input", {
106
- type: t,
107
- "data-slot": "input",
108
- className: K("tg:h-9 tg:w-full tg:min-w-0 tg:rounded-md tg:border tg:border-input tg:bg-transparent tg:px-3 tg:py-1 tg:text-base tg:shadow-xs tg:outline-none tg:transition-[color,box-shadow] tg:selection:bg-primary tg:selection:text-primary-foreground tg:file:inline-flex tg:file:h-7 tg:file:border-0 tg:file:bg-transparent tg:file:font-medium tg:file:text-foreground tg:file:text-sm tg:placeholder:text-muted-foreground tg:disabled:pointer-events-none tg:disabled:cursor-not-allowed tg:disabled:opacity-50 tg:md:text-sm tg:dark:bg-input/30", "tg:focus-visible:border-ring tg:focus-visible:ring-[3px] tg:focus-visible:ring-ring/50", "tg:aria-invalid:border-destructive tg:aria-invalid:ring-destructive/20 tg:dark:aria-invalid:ring-destructive/40", e),
109
- ...n
110
- });
111
- }
112
- //#endregion
113
- //#region src/shared/components/ui/label.tsx
114
- var Q = ({ className: e, ...t }) => /* @__PURE__ */ k(pe.Root, {
115
- "data-slot": "label",
116
- className: K("tg:flex tg:select-none tg:items-center tg:gap-2 tg:font-medium tg:text-muted-foreground tg:text-sm tg:leading-none tg:peer-disabled:cursor-not-allowed tg:peer-disabled:opacity-50 tg:group-data-[disabled=true]:pointer-events-none tg:group-data-[disabled=true]:opacity-50", e),
117
- ...t
118
- }), xe = S(null), $ = () => T(xe), Se = ({ container: e, children: t }) => /* @__PURE__ */ k(xe.Provider, {
119
- value: e,
120
- children: t
121
- });
122
- //#endregion
123
- //#region src/shared/components/ui/popover.tsx
124
- function Ce({ ...e }) {
125
- return /* @__PURE__ */ k(B.Root, {
126
- "data-slot": "popover",
127
- ...e
128
- });
129
- }
130
- function we({ ...e }) {
131
- return /* @__PURE__ */ k(B.Trigger, {
132
- "data-slot": "popover-trigger",
133
- ...e
134
- });
135
- }
136
- function Te({ className: e, align: t = "center", sideOffset: n = 4, disablePortal: r = !1, container: i, ...a }) {
137
- let o = $(), s = i ?? o, c = /* @__PURE__ */ k(B.Content, {
138
- "data-slot": "popover-content",
139
- align: t,
140
- sideOffset: n,
141
- className: K("tg:data-[state=closed]:fade-out-0 tg:data-[state=open]:fade-in-0 tg:data-[state=closed]:zoom-out-95 tg:data-[state=open]:zoom-in-95 tg:data-[side=bottom]:slide-in-from-top-2 tg:data-[side=left]:slide-in-from-right-2 tg:data-[side=right]:slide-in-from-left-2 tg:data-[side=top]:slide-in-from-bottom-2 tg:z-[2000] tg:w-72 tg:origin-(--radix-popover-content-transform-origin) tg:rounded-md tg:border tg:bg-popover tg:p-4 tg:text-popover-foreground tg:shadow-md tg:outline-hidden tg:data-[state=closed]:animate-out tg:data-[state=open]:animate-in", e),
142
- ...a
143
- });
144
- return r ? c : /* @__PURE__ */ k(B.Portal, {
145
- container: s ?? void 0,
146
- children: c
147
- });
148
- }
149
- //#endregion
150
- //#region src/shared/components/ui/select.tsx
151
- var Ee = ({ ...e }) => /* @__PURE__ */ k(V.Root, {
152
- "data-slot": "select",
153
- ...e
154
- }), De = ({ ...e }) => /* @__PURE__ */ k(V.Group, {
155
- "data-slot": "select-group",
156
- ...e
157
- }), Oe = ({ ...e }) => /* @__PURE__ */ k(V.Value, {
158
- "data-slot": "select-value",
159
- ...e
160
- }), ke = ({ className: e, size: t = "default", children: n, ...r }) => /* @__PURE__ */ A(V.Trigger, {
161
- "data-slot": "select-trigger",
162
- "data-size": t,
163
- className: K("tg:flex tg:w-fit tg:items-center tg:justify-between tg:gap-2 tg:whitespace-nowrap tg:rounded-md tg:border tg:border-input tg:bg-transparent tg:px-3 tg:py-2 tg:text-sm tg:shadow-xs tg:outline-none tg:transition-[color,box-shadow] tg:focus-visible:border-ring tg:focus-visible:ring-[3px] tg:focus-visible:ring-ring/50 tg:disabled:cursor-not-allowed tg:disabled:opacity-50 tg:aria-invalid:border-destructive tg:aria-invalid:ring-destructive/20 tg:data-[size=default]:h-9 tg:data-[size=sm]:h-8 tg:data-[placeholder]:text-muted-foreground tg:*:data-[slot=select-value]:line-clamp-1 tg:*:data-[slot=select-value]:flex tg:*:data-[slot=select-value]:items-center tg:*:data-[slot=select-value]:gap-2 tg:dark:bg-input/30 tg:dark:aria-invalid:ring-destructive/40 tg:dark:hover:bg-input/50 tg:[&_svg:not([class*='size-'])]:size-4 tg:[&_svg:not([class*='text-'])]:text-muted-foreground tg:[&_svg]:pointer-events-none tg:[&_svg]:shrink-0", e),
164
- ...r,
165
- children: [n, /* @__PURE__ */ k(V.Icon, {
166
- asChild: !0,
167
- children: /* @__PURE__ */ k(j, { className: "tg:size-4 tg:opacity-50" })
168
- })]
169
- }), Ae = ({ className: e, children: t, position: n = "popper", ...r }) => /* @__PURE__ */ k(V.Portal, {
170
- container: $() ?? void 0,
171
- children: /* @__PURE__ */ A(V.Content, {
172
- "data-slot": "select-content",
173
- className: K("tg:data-[state=closed]:fade-out-0 tg:data-[state=open]:fade-in-0 tg:data-[state=closed]:zoom-out-95 tg:data-[state=open]:zoom-in-95 tg:data-[side=bottom]:slide-in-from-top-2 tg:data-[side=left]:slide-in-from-right-2 tg:data-[side=right]:slide-in-from-left-2 tg:data-[side=top]:slide-in-from-bottom-2 tg:relative tg:z-[2000] tg:max-h-(--radix-select-content-available-height) tg:min-w-[8rem] tg:origin-(--radix-select-content-transform-origin) tg:overflow-y-auto tg:overflow-x-hidden tg:rounded-md tg:border tg:bg-popover tg:text-popover-foreground tg:shadow-md tg:data-[state=closed]:animate-out tg:data-[state=open]:animate-in", n === "popper" && "tg:data-[side=left]:-translate-x-1 tg:data-[side=top]:-translate-y-1 tg:data-[side=right]:translate-x-1 tg:data-[side=bottom]:translate-y-1", e),
174
- position: n,
175
- ...r,
176
- children: [
177
- /* @__PURE__ */ k(Pe, {}),
178
- /* @__PURE__ */ k(V.Viewport, {
179
- className: K("tg:p-1", n === "popper" && "tg:h-[var(--radix-select-trigger-height)] tg:w-full tg:min-w-[var(--radix-select-trigger-width)] tg:scroll-my-1"),
180
- children: t
181
- }),
182
- /* @__PURE__ */ k(Fe, {})
183
- ]
184
- })
185
- }), je = ({ className: e, htmlFor: t, children: n, ...r }) => /* @__PURE__ */ k(V.Label, {
186
- "data-slot": "select-label",
187
- className: K("tg:pb-1.5 tg:font-medium tg:text-muted-foreground tg:text-sm", e),
188
- ...r,
189
- children: /* @__PURE__ */ k("label", {
190
- htmlFor: t,
191
- children: n
192
- })
193
- }), Me = ({ className: e, children: t, ...n }) => /* @__PURE__ */ A(V.Item, {
194
- "data-slot": "select-item",
195
- className: K("tg:relative tg:flex tg:w-full tg:cursor-pointer tg:select-none tg:items-center tg:gap-2 tg:rounded-sm tg:py-1.5 tg:pr-8 tg:pl-2 tg:text-sm tg:outline-hidden tg:focus:bg-accent tg:focus:text-accent-foreground tg:data-[disabled]:pointer-events-none tg:data-[disabled]:opacity-50 tg:[&_svg:not([class*='size-'])]:size-4 tg:[&_svg:not([class*='text-'])]:text-muted-foreground tg:[&_svg]:pointer-events-none tg:[&_svg]:shrink-0 tg:*:[span]:last:flex tg:*:[span]:last:items-center tg:*:[span]:last:gap-2", e),
196
- ...n,
197
- children: [/* @__PURE__ */ k("span", {
198
- className: "tg:absolute tg:right-2 tg:flex tg:size-3.5 tg:items-center tg:justify-center",
199
- children: /* @__PURE__ */ k(V.ItemIndicator, { children: /* @__PURE__ */ k(re, { className: "tg:size-4" }) })
200
- }), /* @__PURE__ */ k(V.ItemText, { children: t })]
201
- }), Ne = ({ className: e, ...t }) => /* @__PURE__ */ k(V.Separator, {
202
- "data-slot": "select-separator",
203
- className: K("tg:-mx-1 tg:pointer-events-none tg:my-1 tg:h-px tg:bg-border", e),
204
- ...t
205
- }), Pe = ({ className: e, ...t }) => /* @__PURE__ */ k(V.ScrollUpButton, {
206
- "data-slot": "select-scroll-up-button",
207
- className: K("tg:flex tg:cursor-default tg:items-center tg:justify-center tg:py-1", e),
208
- ...t,
209
- children: /* @__PURE__ */ k(M, { className: "tg:size-4" })
210
- }), Fe = ({ className: e, ...t }) => /* @__PURE__ */ k(V.ScrollDownButton, {
211
- "data-slot": "select-scroll-down-button",
212
- className: K("tg:flex tg:cursor-default tg:items-center tg:justify-center tg:py-1", e),
213
- ...t,
214
- children: /* @__PURE__ */ k(j, { className: "tg:size-4" })
215
- }), Ie = {
216
- address: "address",
217
- autocomplete: "autocomplete",
218
- checkbox: "checkbox",
219
- date: "date",
220
- daterange: "daterange",
221
- file: "file",
222
- hidden: "hidden",
223
- http: "http",
224
- number: "number",
225
- password: "password",
226
- radio: "radio",
227
- select: "select",
228
- submit: "submit",
229
- switch: "switch",
230
- text: "text",
231
- textarea: "textarea",
232
- time: "time",
233
- timerange: "timerange"
234
- }, Le = [
235
- Ie.radio,
236
- Ie.select,
237
- Ie.checkbox,
238
- Ie.autocomplete
239
- ];
240
- //#endregion
241
- //#region src/shared/components/ui/tooltip.tsx
242
- function Re({ delayDuration: e = 0, ...t }) {
243
- return /* @__PURE__ */ k(H.Provider, {
244
- "data-slot": "tooltip-provider",
245
- delayDuration: e,
246
- ...t
247
- });
248
- }
249
- function ze({ ...e }) {
250
- return /* @__PURE__ */ k(Re, { children: /* @__PURE__ */ k(H.Root, {
251
- "data-slot": "tooltip",
252
- ...e
253
- }) });
254
- }
255
- function Be({ ...e }) {
256
- return /* @__PURE__ */ k(H.Trigger, {
257
- "data-slot": "tooltip-trigger",
258
- ...e
259
- });
260
- }
261
- function Ve({ className: e, sideOffset: t = 0, children: n, ...r }) {
262
- return /* @__PURE__ */ k(H.Portal, {
263
- container: $() ?? void 0,
264
- children: /* @__PURE__ */ A(H.Content, {
265
- "data-slot": "tooltip-content",
266
- sideOffset: t,
267
- className: K("tg:fade-in-0 tg:zoom-in-95 tg:data-[state=closed]:fade-out-0 tg:data-[state=closed]:zoom-out-95 tg:data-[side=bottom]:slide-in-from-top-2 tg:data-[side=left]:slide-in-from-right-2 tg:data-[side=right]:slide-in-from-left-2 tg:data-[side=top]:slide-in-from-bottom-2 tg:z-[2000] tg:w-fit tg:origin-(--radix-tooltip-content-transform-origin) tg:animate-in tg:text-balance tg:rounded-md tg:bg-foreground tg:px-3 tg:py-1.5 tg:text-background tg:text-xs tg:data-[state=closed]:animate-out", e),
268
- ...r,
269
- children: [n, /* @__PURE__ */ k(H.Arrow, { className: "tg:z-[2000] tg:size-2.5 tg:translate-y-[calc(-50%_-_2px)] tg:rotate-45 tg:rounded-[2px] tg:bg-foreground tg:fill-foreground" })]
270
- })
271
- });
272
- }
273
- //#endregion
274
- //#region src/shared/components/ui/badge.tsx
275
- var He = R("tg:inline-flex tg:w-fit tg:shrink-0 tg:items-center tg:justify-center tg:gap-1 tg:overflow-hidden tg:rounded-full tg:border tg:border-transparent tg:px-2 tg:py-0.5 tg:text-xs tg:font-medium tg:whitespace-nowrap tg:transition-[color,box-shadow] tg:focus-visible:border-ring tg:focus-visible:ring-[3px] tg:focus-visible:ring-ring/50 tg:aria-invalid:border-destructive tg:aria-invalid:ring-destructive/20 tg:dark:aria-invalid:ring-destructive/40 tg:[&>svg]:pointer-events-none tg:[&>svg]:size-3", {
276
- defaultVariants: { variant: "default" },
277
- variants: { variant: {
278
- blue: "tg:bg-blue-500 tg:text-white tg:dark:bg-blue-600",
279
- default: "tg:border-transparent tg:bg-primary tg:text-primary-foreground tg:[a&]:hover:bg-primary/90",
280
- destructive: "tg:border-transparent tg:bg-destructive tg:text-white tg:[a&]:hover:bg-destructive/90 tg:focus-visible:ring-destructive/20 tg:dark:focus-visible:ring-destructive/40 tg:dark:bg-destructive/60",
281
- outline: "tg:border-foreground/30 tg:text-foreground tg:[a&]:hover:bg-accent tg:[a&]:hover:text-accent-foreground",
282
- purple: "tg:bg-purple-600 tg:hover:bg-purple-700 tg:text-white",
283
- secondary: "tg:border-transparent tg:bg-secondary tg:text-secondary-foreground tg:[a&]:hover:bg-secondary/90"
284
- } }
285
- });
286
- function Ue({ className: e, variant: t, asChild: n = !1, ...r }) {
287
- return /* @__PURE__ */ k(n ? ue : "span", {
288
- "data-slot": "badge",
289
- className: K(He({ variant: t }), e),
290
- ...r
291
- });
292
- }
293
- //#endregion
294
- //#region src/shared/components/ui/separator.tsx
295
- function We({ className: e, orientation: t = "horizontal", decorative: n = !0, ...r }) {
296
- return /* @__PURE__ */ k(me.Root, {
297
- "data-slot": "separator",
298
- decorative: n,
299
- orientation: t,
300
- className: K("tg:shrink-0 tg:bg-border tg:data-[orientation=horizontal]:h-px tg:data-[orientation=vertical]:h-full tg:data-[orientation=horizontal]:w-full tg:data-[orientation=vertical]:w-px", e),
301
- ...r
302
- });
303
- }
304
- //#endregion
305
- //#region src/renderer/features/TreegeRenderer/web/components/DefaultInputLabel.tsx
306
- var Ge = ({ label: e, required: t, htmlFor: n, id: r, className: i }) => e ? /* @__PURE__ */ A(Q, {
307
- htmlFor: n,
308
- id: r,
309
- className: i,
310
- children: [e, t && /* @__PURE__ */ k("span", {
311
- className: "tg:text-red-500",
312
- children: "*"
313
- })]
314
- }) : null;
315
- //#endregion
316
- //#region src/shared/components/ui/dialog.tsx
317
- function Ke({ ...e }) {
318
- return /* @__PURE__ */ k(W.Root, {
319
- "data-slot": "dialog",
320
- ...e
321
- });
322
- }
323
- function qe({ ...e }) {
324
- return /* @__PURE__ */ k(W.Trigger, {
325
- "data-slot": "dialog-trigger",
326
- ...e
327
- });
328
- }
329
- function Je({ ...e }) {
330
- return /* @__PURE__ */ k(W.Portal, {
331
- "data-slot": "dialog-portal",
332
- ...e
333
- });
334
- }
335
- function Ye({ className: e, ...t }) {
336
- return /* @__PURE__ */ k(W.Overlay, {
337
- "data-slot": "dialog-overlay",
338
- className: K("tg:data-[state=closed]:fade-out-0 tg:data-[state=open]:fade-in-0 tg:fixed tg:inset-0 tg:z-[2000] tg:bg-black/50 tg:data-[state=closed]:animate-out tg:data-[state=open]:animate-in", e),
339
- ...t
340
- });
341
- }
342
- function Xe({ className: e, children: t, showCloseButton: n = !0, ...r }) {
343
- let [i, a] = x.useState(null);
344
- return /* @__PURE__ */ A(Je, {
345
- "data-slot": "dialog-portal",
346
- children: [/* @__PURE__ */ k(Ye, {}), /* @__PURE__ */ k(W.Content, {
347
- ref: a,
348
- "data-slot": "dialog-content",
349
- className: K("tg:data-[state=closed]:fade-out-0 tg:data-[state=open]:fade-in-0 tg:data-[state=closed]:zoom-out-95 tg:data-[state=open]:zoom-in-95 tg:fixed tg:top-[50%] tg:left-[50%] tg:z-[2000] tg:grid tg:w-full tg:max-w-[calc(100%-2rem)] tg:translate-x-[-50%] tg:translate-y-[-50%] tg:gap-4 tg:rounded-lg tg:border tg:bg-background tg:p-6 tg:shadow-lg tg:duration-200 tg:data-[state=closed]:animate-out tg:data-[state=open]:animate-in tg:sm:max-w-lg", e),
350
- ...r,
351
- children: /* @__PURE__ */ A(Se, {
352
- container: i,
353
- children: [t, n && /* @__PURE__ */ A(W.Close, {
354
- "data-slot": "dialog-close",
355
- className: "tg:absolute tg:top-4 tg:right-4 tg:rounded-xs tg:opacity-70 tg:ring-offset-background tg:transition-opacity tg:hover:opacity-100 tg:focus:outline-hidden tg:focus:ring-2 tg:focus:ring-ring tg:focus:ring-offset-2 tg:disabled:pointer-events-none tg:data-[state=open]:bg-accent tg:data-[state=open]:text-muted-foreground tg:[&_svg:not([class*='size-'])]:size-4 tg:[&_svg]:pointer-events-none tg:[&_svg]:shrink-0",
356
- children: [/* @__PURE__ */ k(L, {}), /* @__PURE__ */ k("span", {
357
- className: "tg:sr-only",
358
- children: "Close"
359
- })]
360
- })]
361
- })
362
- })]
363
- });
364
- }
365
- function Ze({ className: e, ...t }) {
366
- return /* @__PURE__ */ k("div", {
367
- "data-slot": "dialog-header",
368
- className: K("tg:flex tg:flex-col tg:gap-2 tg:text-center tg:sm:text-left", e),
369
- ...t
370
- });
371
- }
372
- function Qe({ className: e, ...t }) {
373
- return /* @__PURE__ */ k("div", {
374
- "data-slot": "dialog-footer",
375
- className: K("tg:flex tg:flex-col-reverse tg:gap-2 tg:sm:flex-row tg:sm:justify-end", e),
376
- ...t
377
- });
378
- }
379
- function $e({ className: e, ...t }) {
380
- return /* @__PURE__ */ k(W.Title, {
381
- "data-slot": "dialog-title",
382
- className: K("tg:font-semibold tg:text-lg tg:leading-none", e),
383
- ...t
384
- });
385
- }
386
- function et({ className: e, ...t }) {
387
- return /* @__PURE__ */ k(W.Description, {
388
- "data-slot": "dialog-description",
389
- className: K("tg:text-muted-foreground tg:text-sm", e),
390
- ...t
391
- });
392
- }
393
- //#endregion
394
- //#region src/shared/components/ui/command.tsx
395
- function tt({ className: e, ...t }) {
396
- return /* @__PURE__ */ k(U, {
397
- "data-slot": "command",
398
- className: K("tg:flex tg:h-full tg:w-full tg:flex-col tg:overflow-hidden tg:rounded-md tg:bg-popover tg:text-popover-foreground", e),
399
- ...t
400
- });
401
- }
402
- function nt({ className: e, ...t }) {
403
- return /* @__PURE__ */ A("div", {
404
- "data-slot": "command-input-wrapper",
405
- className: "tg:flex tg:h-9 tg:items-center tg:gap-2 tg:border-b tg:px-3",
406
- children: [/* @__PURE__ */ k(ce, { className: "tg:size-4 tg:shrink-0 tg:opacity-50" }), /* @__PURE__ */ k(U.Input, {
407
- "data-slot": "command-input",
408
- className: K("tg:flex tg:h-10 tg:w-full tg:rounded-md tg:bg-transparent tg:py-3 tg:text-sm tg:outline-hidden tg:placeholder:text-muted-foreground tg:disabled:cursor-not-allowed tg:disabled:opacity-50", e),
409
- ...t
410
- })]
411
- });
412
- }
413
- function rt({ className: e, ...t }) {
414
- return /* @__PURE__ */ k(U.List, {
415
- "data-slot": "command-list",
416
- className: K("tg:max-h-[300px] tg:scroll-py-1 tg:overflow-y-auto tg:overflow-x-hidden", e),
417
- ...t
418
- });
419
- }
420
- function it({ ...e }) {
421
- return /* @__PURE__ */ k(U.Empty, {
422
- "data-slot": "command-empty",
423
- className: "tg:py-6 tg:text-center tg:text-sm",
424
- ...e
425
- });
426
- }
427
- function at({ className: e, ...t }) {
428
- return /* @__PURE__ */ k(U.Group, {
429
- "data-slot": "command-group",
430
- className: K("tg:overflow-hidden tg:p-1 tg:text-foreground tg:[&_[cmdk-group-heading]]:px-2 tg:[&_[cmdk-group-heading]]:py-1.5 tg:[&_[cmdk-group-heading]]:font-medium tg:[&_[cmdk-group-heading]]:text-muted-foreground tg:[&_[cmdk-group-heading]]:text-xs", e),
431
- ...t
432
- });
433
- }
434
- function ot({ className: e, ...t }) {
435
- return /* @__PURE__ */ k(U.Item, {
436
- "data-slot": "command-item",
437
- className: K("tg:relative tg:flex tg:cursor-default tg:select-none tg:items-center tg:gap-2 tg:rounded-sm tg:px-2 tg:py-1.5 tg:text-sm tg:outline-hidden tg:data-[disabled=true]:pointer-events-none tg:data-[selected=true]:bg-accent tg:data-[selected=true]:text-accent-foreground tg:data-[disabled=true]:opacity-50 tg:[&_svg:not([class*='size-'])]:size-4 tg:[&_svg:not([class*='text-'])]:text-muted-foreground tg:[&_svg]:pointer-events-none tg:[&_svg]:shrink-0", e),
438
- ...t
439
- });
440
- }
441
- //#endregion
442
- //#region src/renderer/features/TreegeRenderer/web/components/inputs/DefaultAddressInput.tsx
443
- var st = async (e, t) => {
444
- if (!e || e.trim().length < 3) return [];
445
- try {
446
- let n = await fetch(`https://nominatim.openstreetmap.org/search?q=${encodeURIComponent(e)}&format=jsonv2&addressdetails=1&limit=5`, { headers: {
447
- Accept: "application/json",
448
- "User-Agent": "Treege Renderer",
449
- ...t && { "Accept-Language": t }
450
- } });
451
- return n.ok ? (await n.json()).map((e) => ({
452
- label: e.display_name,
453
- value: e.display_name
454
- })) : [];
455
- } catch (e) {
456
- return console.error("Nominatim fetch error:", e), [];
457
- }
458
- }, ct = (e) => !e || e.trim().length < 3 ? Promise.resolve([]) : new Promise((t) => {
459
- if (!window.google?.maps?.places) {
460
- console.warn("Google Places SDK not loaded yet"), t([]);
461
- return;
462
- }
463
- new window.google.maps.places.AutocompleteService().getPlacePredictions({ input: e }, (e, n) => {
464
- if (n !== google.maps.places.PlacesServiceStatus.OK || !e) {
465
- console.warn("Google Places API status:", n), t([]);
466
- return;
467
- }
468
- t(e.map((e) => ({
469
- label: e.description,
470
- value: e.description
471
- })));
472
- });
473
- }), lt = ({ field: e, extra: t }) => {
474
- let [r, i] = O(""), [a, o] = O([]), [s, c] = O(!1), { id: l, name: d, value: f, placeholder: p } = e, { InputLabel: m, node: h, setValue: g, error: _, label: v, helperText: y } = t, { googleApiKey: b, language: x } = u(), S = n(), C = w((e) => {
475
- g(e.value), i(e.value), c(!1);
476
- }, [g]), T = w((e) => {
477
- g(e), i(e), e.length >= 3 && c(!0);
478
- }, [g]);
479
- return E(() => {
480
- if (!r || r.trim().length < 3) {
481
- o([]);
482
- return;
483
- }
484
- let e = setTimeout(async () => {
485
- o(b ? await ct(r) : await st(r, x));
486
- }, 300);
487
- return () => clearTimeout(e);
488
- }, [
489
- r,
490
- b,
491
- x
492
- ]), /* @__PURE__ */ A(te, { children: [b && /* @__PURE__ */ k("script", {
493
- async: !0,
494
- src: `https://maps.googleapis.com/maps/api/js?key=${b}&libraries=places`
495
- }), /* @__PURE__ */ A(J, {
496
- className: "tg:mb-4",
497
- children: [
498
- /* @__PURE__ */ k(m, {
499
- htmlFor: l,
500
- label: v,
501
- required: h.data.required
502
- }),
503
- /* @__PURE__ */ A("div", {
504
- className: "tg:relative",
505
- children: [
506
- /* @__PURE__ */ k(Z, {
507
- type: "text",
508
- id: l,
509
- name: d,
510
- "aria-label": v || h.data.name,
511
- value: f || "",
512
- onChange: (e) => T(e.target.value),
513
- onFocus: () => {
514
- a.length > 0 && c(!0);
515
- },
516
- placeholder: p || S("renderer.defaultAddressInput.enterAddress"),
517
- className: "tg:pr-10",
518
- autoComplete: "off"
519
- }),
520
- /* @__PURE__ */ k(I, { className: "tg:pointer-events-none tg:absolute tg:top-1/2 tg:right-3 tg:h-4 tg:w-4 tg:-translate-y-1/2 tg:text-muted-foreground" }),
521
- s && /* @__PURE__ */ k("div", {
522
- className: "tg:absolute tg:z-50 tg:mt-1 tg:w-full tg:rounded-md tg:border tg:bg-popover tg:shadow-md",
523
- children: /* @__PURE__ */ k(tt, { children: /* @__PURE__ */ A(rt, { children: [/* @__PURE__ */ k(it, { children: S("renderer.defaultAddressInput.noAddressesFound") }), /* @__PURE__ */ k(at, { children: a.map((e, t) => /* @__PURE__ */ A(ot, {
524
- value: e.value,
525
- onSelect: () => C(e),
526
- onMouseDown: (e) => e.preventDefault(),
527
- children: [/* @__PURE__ */ k(I, { className: "tg:mr-2 tg:h-4 tg:w-4" }), e.label]
528
- }, t)) })] }) })
529
- })
530
- ]
531
- }),
532
- _ && /* @__PURE__ */ k(X, { children: _ }),
533
- y && !_ && /* @__PURE__ */ k(Y, { children: y })
534
- ]
535
- })] });
536
- }, ut = ({ missing: e }) => /* @__PURE__ */ A(te, { children: [/* @__PURE__ */ k("p", {
537
- className: "tg:font-medium",
538
- children: n()("renderer.dependencyHint.title")
539
- }), /* @__PURE__ */ k("ul", {
540
- className: "tg:mt-1 tg:list-disc tg:pl-4",
541
- children: e.map((e) => /* @__PURE__ */ k("li", { children: e.label }, e.id))
542
- })] }), dt = ({ missing: e, children: t }) => e.length === 0 ? /* @__PURE__ */ k(te, { children: t }) : /* @__PURE__ */ k(Re, { children: /* @__PURE__ */ A(ze, { children: [/* @__PURE__ */ k(Be, {
543
- asChild: !0,
544
- children: /* @__PURE__ */ k("div", {
545
- className: "tg:w-full",
546
- children: t
547
- })
548
- }), /* @__PURE__ */ k(Ve, { children: /* @__PURE__ */ k(ut, { missing: e }) })] }) }), ft = ({ missing: e }) => e.length === 0 ? null : /* @__PURE__ */ k("div", {
549
- className: "tg:text-muted-foreground tg:text-sm",
550
- children: /* @__PURE__ */ k(ut, { missing: e })
551
- });
552
- R("tg:group/item tg:flex tg:flex-wrap tg:items-center tg:rounded-md tg:border tg:border-transparent tg:text-sm tg:outline-none tg:transition-colors tg:duration-100 tg:focus-visible:border-ring tg:focus-visible:ring-[3px] tg:focus-visible:ring-ring/50 tg:[a]:transition-colors tg:[a]:hover:bg-accent/50", {
553
- defaultVariants: {
554
- size: "default",
555
- variant: "default"
556
- },
557
- variants: {
558
- size: {
559
- default: "tg:gap-4 tg:p-4",
560
- sm: "tg:gap-2.5 tg:px-4 tg:py-3"
561
- },
562
- variant: {
563
- default: "tg:bg-transparent",
564
- muted: "tg:bg-muted/50",
565
- outline: "tg:border-border"
566
- }
567
- }
568
- });
569
- var pt = R("tg:flex tg:shrink-0 tg:items-center tg:justify-center tg:gap-2 tg:group-has-[[data-slot=item-description]]/item:translate-y-0.5 tg:group-has-[[data-slot=item-description]]/item:self-start tg:[&_svg]:pointer-events-none", {
570
- defaultVariants: { variant: "default" },
571
- variants: { variant: {
572
- default: "tg:bg-transparent",
573
- icon: "tg:size-8 tg:rounded-sm tg:border tg:bg-muted tg:[&_svg:not([class*='size-'])]:size-4",
574
- image: "tg:size-10 tg:overflow-hidden tg:rounded-sm tg:[&_img]:size-full tg:[&_img]:object-cover"
575
- } }
576
- });
577
- function mt({ className: e, variant: t = "default", ...n }) {
578
- return /* @__PURE__ */ k("div", {
579
- "data-slot": "item-media",
580
- "data-variant": t,
581
- className: K(pt({
582
- className: e,
583
- variant: t
584
- })),
585
- ...n
586
- });
587
- }
588
- function ht({ className: e, ...t }) {
589
- return /* @__PURE__ */ k("div", {
590
- "data-slot": "item-content",
591
- className: K("tg:flex tg:flex-1 tg:flex-col tg:gap-1 tg:[&+[data-slot=item-content]]:flex-none", e),
592
- ...t
593
- });
594
- }
595
- function gt({ className: e, ...t }) {
596
- return /* @__PURE__ */ k("div", {
597
- "data-slot": "item-title",
598
- className: K("tg:flex tg:w-fit tg:items-center tg:gap-2 tg:font-medium tg:text-sm tg:leading-snug", e),
599
- ...t
600
- });
601
- }
602
- function _t({ className: e, ...t }) {
603
- return /* @__PURE__ */ k("p", {
604
- "data-slot": "item-description",
605
- className: K("tg:line-clamp-2 tg:text-balance tg:font-normal tg:text-muted-foreground tg:text-sm tg:leading-normal", "tg:[&>a]:underline tg:[&>a]:underline-offset-4 tg:[&>a:hover]:text-primary", e),
606
- ...t
607
- });
608
- }
609
- //#endregion
610
- //#region src/renderer/features/TreegeRenderer/web/components/OptionItemContent.tsx
611
- var vt = ({ label: e, description: t, image: n }) => /* @__PURE__ */ A(te, { children: [n && /* @__PURE__ */ k(mt, {
612
- variant: "image",
613
- children: /* @__PURE__ */ k("img", {
614
- src: n,
615
- alt: ""
616
- })
617
- }), /* @__PURE__ */ A(ht, {
618
- className: "tg:min-w-0 tg:gap-0",
619
- children: [/* @__PURE__ */ k(gt, {
620
- className: "tg:block tg:w-full tg:truncate tg:font-normal",
621
- children: e
622
- }), t && /* @__PURE__ */ k(_t, {
623
- className: "tg:line-clamp-1",
624
- children: t
625
- })]
626
- })] }), yt = /\{\{([\w-]+)}}/g, bt = (e) => {
627
- let [n, r] = O({
628
- error: null,
629
- fetched: null,
630
- isLoading: !1
631
- }), { baseUrl: s, formValues: l, headers: d } = u(), f = e.data.optionsSource, p = e.data.options, g = ee(() => {
632
- if (!(f?.url && f.mapping?.valueField && f.mapping?.labelField) || !Array.from(f.url.matchAll(yt), (e) => e[1]).every((e) => {
633
- let t = l[e];
634
- return t != null && t !== "";
635
- })) return null;
636
- let e = f.method ?? "GET", t = {
637
- body: [
638
- "POST",
639
- "PUT",
640
- "PATCH"
641
- ].includes(e) ? v(f.body, l, []) : void 0,
642
- headers: h(i(d, l), i(f.headers, l)),
643
- mapping: f.mapping,
644
- method: e,
645
- queryParams: i(f.queryParams, l) ?? {},
646
- responsePath: f.responsePath,
647
- url: a(m(f.url, l, { encode: !0 }), s)
648
- };
649
- return JSON.stringify(t);
650
- }, [
651
- s,
652
- f,
653
- l,
654
- d
655
- ]);
656
- E(() => {
657
- if (!g) {
658
- r({
659
- error: null,
660
- fetched: null,
661
- isLoading: !1
662
- });
663
- return;
664
- }
665
- let e = JSON.parse(g), n = new AbortController();
666
- return r((e) => ({
667
- ...e,
668
- error: null,
669
- isLoading: !0
670
- })), (async () => {
671
- let i = await o({
672
- body: e.body,
673
- headers: e.headers,
674
- method: e.method,
675
- queryParams: e.queryParams,
676
- signal: n.signal,
677
- url: e.url
678
- });
679
- if (!n.signal.aborted) {
680
- if (!i.success) {
681
- r({
682
- error: i.error ?? "Fetch failed",
683
- fetched: null,
684
- isLoading: !1
685
- });
686
- return;
687
- }
688
- r({
689
- error: null,
690
- fetched: t(i.data, e.responsePath, e.mapping),
691
- isLoading: !1
692
- });
693
- }
694
- })(), () => n.abort();
695
- }, [g]);
696
- let _ = e.data.normalizeOptionLabels !== !1, y = ee(() => n.fetched ? _ ? n.fetched.map((e) => ({
697
- ...e,
698
- label: c(e.label)
699
- })) : n.fetched : p ?? [], [
700
- n.fetched,
701
- p,
702
- _
703
- ]);
704
- return {
705
- error: n.error,
706
- isLoading: n.isLoading,
707
- options: y
708
- };
709
- }, xt = ({ field: e, extra: t }) => {
710
- let [r, i] = O(!1), { id: a, value: o, placeholder: s } = e, { InputLabel: c, node: l, setValue: u, error: d, label: f, helperText: p, missingDependencies: m } = t, { options: h, isLoading: g, error: _ } = bt(l), v = n(), y = `${a}-trigger`, b = `${a}-error`, x = h.find((e) => e.value === o);
711
- return /* @__PURE__ */ A(J, {
712
- className: "tg:mb-4",
713
- children: [
714
- /* @__PURE__ */ k(c, {
715
- htmlFor: y,
716
- label: f,
717
- required: l.data.required
718
- }),
719
- /* @__PURE__ */ k(dt, {
720
- missing: m,
721
- children: /* @__PURE__ */ A("div", {
722
- className: "tg:relative",
723
- children: [
724
- /* @__PURE__ */ A(Ce, {
725
- open: r,
726
- onOpenChange: i,
727
- children: [/* @__PURE__ */ k(we, {
728
- asChild: !0,
729
- children: /* @__PURE__ */ A(q, {
730
- id: y,
731
- variant: "outline",
732
- role: "combobox",
733
- "aria-label": f || l.data.name,
734
- "aria-expanded": r,
735
- "aria-invalid": !!d || void 0,
736
- "aria-describedby": d ? b : void 0,
737
- disabled: g || m.length > 0,
738
- className: K("tg:w-full tg:justify-between tg:font-normal", (o || g) && "tg:pr-14"),
739
- children: [/* @__PURE__ */ k("span", {
740
- className: "tg:flex tg:items-center tg:gap-2 tg:truncate",
741
- children: o ? x?.label ? v(x.label) : o : s || v("renderer.defaultAutocompleteInput.selectOption")
742
- }), /* @__PURE__ */ k(oe, { className: "tg:ml-2 tg:size-4 tg:shrink-0 tg:opacity-50" })]
743
- })
744
- }), /* @__PURE__ */ k(Te, {
745
- className: "tg:w-(--radix-popover-trigger-width) tg:p-0",
746
- align: "start",
747
- children: /* @__PURE__ */ A(tt, { children: [/* @__PURE__ */ k(nt, { placeholder: s || v("renderer.defaultAutocompleteInput.search") }), /* @__PURE__ */ A(rt, { children: [/* @__PURE__ */ k(it, { children: v("renderer.defaultAutocompleteInput.noResults") }), /* @__PURE__ */ k(at, { children: h.map((e) => /* @__PURE__ */ A(ot, {
748
- value: e.value,
749
- disabled: e.disabled,
750
- onSelect: () => {
751
- u(e.value === o ? "" : e.value), i(!1);
752
- },
753
- children: [/* @__PURE__ */ k(ne, { className: K("tg:mr-2 tg:size-4", o === e.value ? "tg:opacity-100" : "tg:opacity-0") }), /* @__PURE__ */ k(vt, {
754
- label: v(e.label) || e.value,
755
- description: v(e.description),
756
- image: e.image
757
- })]
758
- }, e.value)) })] })] })
759
- })]
760
- }),
761
- g && /* @__PURE__ */ k(F, { className: "tg:-translate-y-1/2 tg:pointer-events-none tg:absolute tg:top-1/2 tg:right-8 tg:size-4 tg:animate-spin tg:text-muted-foreground" }),
762
- o && !g && m.length === 0 && /* @__PURE__ */ k("button", {
763
- type: "button",
764
- "aria-label": v("common.clear"),
765
- onClick: () => u(""),
766
- className: "tg:-translate-y-1/2 tg:absolute tg:top-1/2 tg:right-8 tg:rounded-sm tg:p-0.5 tg:text-muted-foreground tg:opacity-70 tg:transition-opacity tg:hover:opacity-100",
767
- children: /* @__PURE__ */ k(le, { className: "tg:size-4" })
768
- })
769
- ]
770
- })
771
- }),
772
- d && /* @__PURE__ */ k(X, {
773
- id: b,
774
- children: d
775
- }),
776
- _ && !d && /* @__PURE__ */ k(X, { children: _ }),
777
- p && !d && !_ && /* @__PURE__ */ k(Y, { children: p })
778
- ]
779
- });
780
- }, St = ({ field: e, extra: t }) => {
781
- let { id: r, name: i, value: a } = e, { InputLabel: o, node: s, setValue: c, error: l, label: d, helperText: f, renderOptionExtras: p, compactOptions: m, missingDependencies: h } = t, { options: g, isLoading: _, error: v } = bt(s), { optionsDisplayLimit: y } = u(), b = n();
782
- if (g.length > 0 || s.data.optionsSource) {
783
- let e = `${r}-label`, t = Array.isArray(a) ? a.map(String) : [], n = y ? g.slice(0, y) : g, u = g.length - n.length, x = (e, n) => {
784
- c(n ? [...t, e] : t.filter((t) => t !== e));
785
- };
786
- return /* @__PURE__ */ A(J, {
787
- className: "tg:mb-4",
788
- children: [
789
- /* @__PURE__ */ k(o, {
790
- className: "tg:mb-1",
791
- id: e,
792
- label: d,
793
- required: s.data.required
794
- }),
795
- /* @__PURE__ */ k(ft, { missing: h }),
796
- _ && /* @__PURE__ */ A("div", {
797
- className: "tg:flex tg:items-center tg:gap-2 tg:py-2 tg:text-muted-foreground tg:text-sm",
798
- children: [/* @__PURE__ */ k(F, { className: "tg:h-4 tg:w-4 tg:animate-spin" }), /* @__PURE__ */ k("span", { children: b("renderer.defaultCheckboxInput.loadingOptions") })]
799
- }),
800
- /* @__PURE__ */ A("div", {
801
- role: "group",
802
- "aria-labelledby": d ? e : void 0,
803
- "aria-label": d ? void 0 : s.data.name,
804
- className: "tg:min-w-0 tg:space-y-2",
805
- children: [n.map((e, n) => {
806
- let a = b(e.description);
807
- return /* @__PURE__ */ A("div", {
808
- className: K("tg:group/option tg:pointer-events-auto tg:relative tg:flex tg:items-start tg:gap-3", m && "tg:pr-22"),
809
- children: [
810
- /* @__PURE__ */ k(be, {
811
- id: `${r}-${e.value}`,
812
- name: i,
813
- checked: t.includes(String(e.value)),
814
- onCheckedChange: (t) => x(String(e.value), !!t),
815
- disabled: e.disabled,
816
- className: "tg:mt-0.5"
817
- }),
818
- e.image && /* @__PURE__ */ k("img", {
819
- src: e.image,
820
- alt: "",
821
- className: "tg:h-8 tg:w-8 tg:shrink-0 tg:rounded tg:object-cover"
822
- }),
823
- /* @__PURE__ */ A("div", {
824
- className: K("tg:flex tg:flex-col", m && "tg:min-w-0 tg:flex-1 tg:overflow-hidden"),
825
- children: [/* @__PURE__ */ k(Q, {
826
- htmlFor: `${r}-${e.value}`,
827
- className: K("tg:cursor-pointer tg:font-normal tg:text-sm", m && "tg:block tg:max-w-full tg:truncate"),
828
- children: b(e.label) ? b(e.label) : e.value
829
- }), a && /* @__PURE__ */ k("span", {
830
- className: K("tg:text-muted-foreground tg:text-xs", m && "tg:block tg:max-w-full tg:truncate"),
831
- children: a
832
- })]
833
- }),
834
- p?.({
835
- index: n,
836
- option: e
837
- })
838
- ]
839
- }, e.value + n);
840
- }), u > 0 && /* @__PURE__ */ k("div", {
841
- className: "tg:px-2 tg:text-muted-foreground tg:text-xs",
842
- children: "…"
843
- })]
844
- }),
845
- l && /* @__PURE__ */ k(X, { children: l }),
846
- v && !l && /* @__PURE__ */ k(X, { children: v }),
847
- f && !l && !v && /* @__PURE__ */ k(Y, { children: f })
848
- ]
849
- });
850
- }
851
- return /* @__PURE__ */ A(J, {
852
- className: "tg:mb-4",
853
- children: [/* @__PURE__ */ A("div", {
854
- className: "tg:flex tg:items-center tg:gap-3",
855
- children: [/* @__PURE__ */ k(be, {
856
- id: r,
857
- name: i,
858
- "aria-label": d || s.data.name,
859
- checked: typeof a == "boolean" ? a : !1,
860
- onCheckedChange: (e) => c(!!e)
861
- }), /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k(o, {
862
- htmlFor: r,
863
- label: d,
864
- required: s.data.required,
865
- className: "tg:cursor-pointer tg:font-medium tg:text-sm"
866
- }), f && !l && /* @__PURE__ */ k(Y, { children: f })] })]
867
- }), l && /* @__PURE__ */ k(X, { children: l })]
868
- });
869
- };
870
- //#endregion
871
- //#region src/shared/components/ui/calendar.tsx
872
- function Ct({ className: e, classNames: t, showOutsideDays: n = !0, captionLayout: r = "label", buttonVariant: i = "ghost", formatters: a, components: o, ...s }) {
873
- let c = ge();
874
- return /* @__PURE__ */ k(he, {
875
- showOutsideDays: n,
876
- className: K("tg:group/calendar tg:bg-background tg:p-3 tg:[--cell-size:--spacing(8)] tg:[[data-slot=card-content]_&]:bg-transparent tg:[[data-slot=popover-content]_&]:bg-transparent", String.raw`tg:rtl:**:[.rdp-button\_next>svg]:rotate-180`, String.raw`tg:rtl:**:[.rdp-button\_previous>svg]:rotate-180`, e),
877
- captionLayout: r,
878
- formatters: {
879
- formatMonthDropdown: (e) => e.toLocaleString("default", { month: "short" }),
880
- ...a
881
- },
882
- classNames: {
883
- button_next: K(ye({ variant: i }), "tg:size-(--cell-size) tg:aria-disabled:opacity-50 tg:p-0 tg:select-none", c.button_next),
884
- button_previous: K(ye({ variant: i }), "tg:size-(--cell-size) tg:aria-disabled:opacity-50 tg:p-0 tg:select-none", c.button_previous),
885
- caption_label: K("tg:select-none tg:font-medium", r === "label" ? "tg:text-sm" : "tg:rounded-md tg:pl-2 tg:pr-1 tg:flex tg:items-center tg:gap-1 tg:text-sm tg:h-8 tg:[&>svg]:text-muted-foreground tg:[&>svg]:size-3.5", c.caption_label),
886
- day: K("tg:relative tg:w-full tg:h-full tg:p-0 tg:text-center tg:[&:first-child[data-selected=true]_button]:rounded-l-md tg:[&:last-child[data-selected=true]_button]:rounded-r-md tg:group/day tg:aspect-square tg:select-none", c.day),
887
- disabled: K("tg:text-muted-foreground tg:opacity-50", c.disabled),
888
- dropdown: K("tg:absolute tg:bg-popover tg:inset-0 tg:opacity-0", c.dropdown),
889
- dropdown_root: K("tg:relative tg:has-focus:border-ring tg:border tg:border-input tg:shadow-xs tg:has-focus:ring-ring/50 tg:has-focus:ring-[3px] tg:rounded-md", c.dropdown_root),
890
- dropdowns: K("tg:w-full tg:flex tg:items-center tg:text-sm tg:font-medium tg:justify-center tg:h-(--cell-size) tg:gap-1.5", c.dropdowns),
891
- hidden: K("tg:invisible", c.hidden),
892
- month: K("tg:flex tg:flex-col tg:w-full tg:gap-4", c.month),
893
- month_caption: K("tg:flex tg:items-center tg:justify-center tg:h-(--cell-size) tg:w-full tg:px-(--cell-size)", c.month_caption),
894
- months: K("tg:flex tg:gap-4 tg:flex-col tg:md:flex-row tg:relative", c.months),
895
- nav: K("tg:flex tg:items-center tg:gap-1 tg:w-full tg:absolute tg:top-0 tg:inset-x-0 tg:justify-between", c.nav),
896
- outside: K("tg:text-muted-foreground tg:aria-selected:text-muted-foreground", c.outside),
897
- range_end: K("tg:rounded-r-md tg:bg-accent", c.range_end),
898
- range_middle: K("tg:rounded-none", c.range_middle),
899
- range_start: K("tg:rounded-l-md tg:bg-accent", c.range_start),
900
- root: K("tg:w-fit", c.root),
901
- table: "tg:w-full tg:border-collapse",
902
- today: K("tg:bg-accent tg:text-accent-foreground tg:rounded-md tg:data-[selected=true]:rounded-none", c.today),
903
- week: K("tg:flex tg:w-full tg:mt-2", c.week),
904
- week_number: K("tg:text-[0.8rem] tg:select-none tg:text-muted-foreground", c.week_number),
905
- week_number_header: K("tg:select-none tg:w-(--cell-size)", c.week_number_header),
906
- weekday: K("tg:text-muted-foreground tg:rounded-md tg:flex-1 tg:font-normal tg:text-[0.8rem] tg:select-none", c.weekday),
907
- weekdays: K("tg:flex", c.weekdays),
908
- ...t
909
- },
910
- components: {
911
- Chevron: ({ className: e, orientation: t, ...n }) => k(t === "left" ? ie : t === "right" ? ae : j, {
912
- className: K("tg:size-4", e),
913
- ...n
914
- }),
915
- DayButton: wt,
916
- Root: ({ className: e, rootRef: t, ...n }) => /* @__PURE__ */ k("div", {
917
- "data-slot": "calendar",
918
- ref: t,
919
- className: K(e),
920
- ...n
921
- }),
922
- WeekNumber: ({ children: e, ...t }) => /* @__PURE__ */ k("td", {
923
- ...t,
924
- children: /* @__PURE__ */ k("div", {
925
- className: "tg:flex tg:size-(--cell-size) tg:items-center tg:justify-center tg:text-center",
926
- children: e
927
- })
928
- }),
929
- ...o
930
- },
931
- ...s
932
- });
933
- }
934
- function wt({ className: e, day: t, modifiers: n, ...r }) {
935
- let i = ge(), a = x.useRef(null);
936
- return x.useEffect(() => {
937
- n.focused && a.current?.focus();
938
- }, [n.focused]), /* @__PURE__ */ k(q, {
939
- ref: a,
940
- variant: "ghost",
941
- size: "icon",
942
- "data-day": t.date.toLocaleDateString(),
943
- "data-selected-single": n.selected && !n.range_start && !n.range_end && !n.range_middle,
944
- "data-range-start": n.range_start,
945
- "data-range-end": n.range_end,
946
- "data-range-middle": n.range_middle,
947
- className: K("tg:flex tg:aspect-square tg:size-auto tg:w-full tg:min-w-(--cell-size) tg:flex-col tg:gap-1 tg:font-normal tg:leading-none tg:data-[range-end=true]:rounded-md tg:data-[range-middle=true]:rounded-none tg:data-[range-start=true]:rounded-md tg:data-[range-end=true]:rounded-r-md tg:data-[range-start=true]:rounded-l-md tg:data-[range-end=true]:bg-primary tg:data-[range-middle=true]:bg-accent tg:data-[range-start=true]:bg-primary tg:data-[selected-single=true]:bg-primary tg:data-[range-end=true]:text-primary-foreground tg:data-[range-middle=true]:text-accent-foreground tg:data-[range-start=true]:text-primary-foreground tg:data-[selected-single=true]:text-primary-foreground tg:group-data-[focused=true]/day:relative tg:group-data-[focused=true]/day:z-10 tg:group-data-[focused=true]/day:border-ring tg:group-data-[focused=true]/day:ring-[3px] tg:group-data-[focused=true]/day:ring-ring/50 tg:dark:hover:text-accent-foreground tg:[&>span]:text-xs tg:[&>span]:opacity-70", i.day, e),
948
- ...r
949
- });
950
- }
951
- //#endregion
952
- //#region src/renderer/features/TreegeRenderer/web/components/inputs/DefaultDateInput.tsx
953
- var Tt = ({ field: e, extra: t }) => {
954
- let [r, i] = O(!1), { id: a, name: o, value: s, placeholder: c } = e, { InputLabel: l, node: u, setValue: d, error: f, label: p, helperText: m } = t, h = n(), g = s ? new Date(s) : void 0;
955
- return /* @__PURE__ */ A(J, {
956
- className: "tg:mb-4",
957
- children: [
958
- /* @__PURE__ */ k(l, {
959
- htmlFor: a,
960
- label: p,
961
- required: u.data.required
962
- }),
963
- /* @__PURE__ */ A(Ce, {
964
- open: r,
965
- onOpenChange: i,
966
- children: [/* @__PURE__ */ k(we, {
967
- asChild: !0,
968
- children: /* @__PURE__ */ A(q, {
969
- variant: "outline",
970
- id: a,
971
- name: o,
972
- "aria-label": p || u.data.name,
973
- className: "tg:w-full tg:justify-between tg:font-normal",
974
- children: [g ? g.toLocaleDateString() : c || h("renderer.defaultInputs.selectDate"), /* @__PURE__ */ k(j, { className: "tg:size-4" })]
975
- })
976
- }), /* @__PURE__ */ k(Te, {
977
- className: "tg:w-auto tg:overflow-hidden tg:p-0",
978
- align: "start",
979
- children: /* @__PURE__ */ k(Ct, {
980
- mode: "single",
981
- selected: g,
982
- captionLayout: "dropdown",
983
- disabled: (e) => {
984
- if (u.data.disablePast) {
985
- let t = /* @__PURE__ */ new Date();
986
- return t.setHours(0, 0, 0, 0), e < t;
987
- }
988
- return !1;
989
- },
990
- onSelect: (e) => {
991
- d(e ? e.toISOString() : ""), i(!1);
992
- }
993
- })
994
- })]
995
- }),
996
- f && /* @__PURE__ */ k(X, { children: f }),
997
- m && !f && /* @__PURE__ */ k(Y, { children: m })
998
- ]
999
- });
1000
- }, Et = ({ field: e, extra: t }) => {
1001
- let [r, i] = O(!1), { id: a, value: o } = e, { InputLabel: s, node: c, setValue: l, error: u, label: d, helperText: f } = t, p = n(), m = Array.isArray(o) ? o : [], h = m[0] ? new Date(m[0]) : void 0, g = m[1] ? new Date(m[1]) : void 0;
1002
- return /* @__PURE__ */ A(J, {
1003
- className: "tg:mb-4",
1004
- children: [
1005
- /* @__PURE__ */ k(s, {
1006
- htmlFor: a,
1007
- label: d,
1008
- required: c.data.required
1009
- }),
1010
- /* @__PURE__ */ A(Ce, {
1011
- open: r,
1012
- onOpenChange: i,
1013
- children: [/* @__PURE__ */ k(we, {
1014
- asChild: !0,
1015
- children: /* @__PURE__ */ A(q, {
1016
- id: a,
1017
- variant: "outline",
1018
- "aria-label": d || c.data.name,
1019
- className: "tg:w-full tg:justify-between tg:font-normal",
1020
- children: [h && g ? `${h.toLocaleDateString()} - ${g.toLocaleDateString()}` : h ? h.toLocaleDateString() : p("renderer.defaultInputs.selectDateRange"), /* @__PURE__ */ k(j, { className: "tg:size-4" })]
1021
- })
1022
- }), /* @__PURE__ */ k(Te, {
1023
- className: "tg:w-auto tg:overflow-hidden tg:p-0",
1024
- align: "start",
1025
- children: /* @__PURE__ */ k(Ct, {
1026
- mode: "range",
1027
- min: 1,
1028
- selected: {
1029
- from: h,
1030
- to: g
1031
- },
1032
- captionLayout: "dropdown",
1033
- disabled: (e) => {
1034
- if (c.data.disablePast) {
1035
- let t = /* @__PURE__ */ new Date();
1036
- return t.setHours(0, 0, 0, 0), e < t;
1037
- }
1038
- return !1;
1039
- },
1040
- onSelect: (e, t) => {
1041
- if (h && g) {
1042
- l([t.toISOString(), void 0]);
1043
- return;
1044
- }
1045
- l([e?.from ? e.from.toISOString() : void 0, e?.to ? e.to.toISOString() : void 0]), e?.from && e?.to && i(!1);
1046
- },
1047
- numberOfMonths: 2
1048
- })
1049
- })]
1050
- }),
1051
- u && /* @__PURE__ */ k(X, { children: u }),
1052
- f && !u && /* @__PURE__ */ k(Y, { children: f })
1053
- ]
1054
- });
1055
- }, Dt = ({ field: e, extra: t }) => {
1056
- let { id: r, name: i, value: a } = e, { InputLabel: o, node: s, setValue: c, error: l, label: u, helperText: m } = t, h = n(), g = D(null), v = b(a), y = s.data.multiple, x = async (e) => {
1057
- let { files: t } = e.target;
1058
- if (!(!t || t.length === 0)) {
1059
- if (y) {
1060
- let e = await f(Array.from(t));
1061
- c([...v, ...e]);
1062
- } else c(await p(t[0]));
1063
- e.target.value = "";
1064
- }
1065
- }, S = (e) => {
1066
- let t = v.filter((t, n) => n !== e);
1067
- c(t.length > 0 ? t : null);
1068
- };
1069
- return /* @__PURE__ */ A(J, {
1070
- className: "tg:mb-4",
1071
- children: [
1072
- /* @__PURE__ */ k(o, {
1073
- htmlFor: r,
1074
- label: u,
1075
- required: s.data.required
1076
- }),
1077
- v.length > 0 && /* @__PURE__ */ k("ul", {
1078
- className: "tg:flex tg:flex-col tg:gap-2",
1079
- children: v.map((e, t) => /* @__PURE__ */ A("li", {
1080
- className: "tg:flex tg:items-center tg:gap-2 tg:rounded-md tg:border tg:bg-card tg:px-3 tg:py-2 tg:text-sm",
1081
- children: [
1082
- /* @__PURE__ */ k(P, { className: "tg:size-4 tg:shrink-0 tg:text-muted-foreground" }),
1083
- _(e.data) ? /* @__PURE__ */ k("a", {
1084
- href: e.data,
1085
- target: "_blank",
1086
- rel: "noreferrer",
1087
- className: "tg:flex-1 tg:truncate tg:text-primary tg:underline tg:underline-offset-2",
1088
- title: e.name,
1089
- children: e.name
1090
- }) : /* @__PURE__ */ k("span", {
1091
- className: "tg:flex-1 tg:truncate",
1092
- title: e.name,
1093
- children: e.name
1094
- }),
1095
- e.size > 0 && /* @__PURE__ */ k("span", {
1096
- className: "tg:shrink-0 tg:text-muted-foreground tg:text-xs",
1097
- children: d(e.size)
1098
- }),
1099
- /* @__PURE__ */ k(q, {
1100
- type: "button",
1101
- variant: "ghost",
1102
- size: "icon-sm",
1103
- onClick: () => S(t),
1104
- "aria-label": h("renderer.defaultInputs.removeFile"),
1105
- children: /* @__PURE__ */ k(le, { className: "tg:size-4" })
1106
- })
1107
- ]
1108
- }, `${e.name}-${t}`))
1109
- }),
1110
- /* @__PURE__ */ k("input", {
1111
- ref: g,
1112
- type: "file",
1113
- name: i,
1114
- id: r,
1115
- className: "tg:hidden",
1116
- onChange: x,
1117
- multiple: y
1118
- }),
1119
- /* @__PURE__ */ A(q, {
1120
- type: "button",
1121
- variant: "outline",
1122
- onClick: () => g.current?.click(),
1123
- "aria-label": u || s.data.name,
1124
- children: [/* @__PURE__ */ k(se, { className: "tg:size-4" }), v.length === 0 ? h(y ? "renderer.defaultInputs.selectFiles" : "renderer.defaultInputs.selectFile") : h(y ? "renderer.defaultInputs.addMoreFiles" : "renderer.defaultInputs.replaceFile")]
1125
- }),
1126
- l && /* @__PURE__ */ k(X, { children: l }),
1127
- m && !l && /* @__PURE__ */ k(Y, { children: m })
1128
- ]
1129
- });
1130
- }, Ot = ({ field: e }) => {
1131
- let { id: t, name: n, value: r } = e;
1132
- return /* @__PURE__ */ k(Z, {
1133
- type: "hidden",
1134
- id: t,
1135
- name: n,
1136
- value: r ?? ""
1137
- });
1138
- }, kt = (e) => {
1139
- let t = e.matchAll(/{{([\w-]+)}}/g);
1140
- return Array.from(t, (e) => e[1]);
1141
- }, At = (e, t) => kt(e).every((e) => {
1142
- let n = t[e];
1143
- return n != null && n !== "";
1144
- }), jt = (e, t, n = !1) => e.replace(/{{([\w-]+)}}/g, (e, r) => {
1145
- let i = t[r], a = i == null ? "" : String(i);
1146
- return n ? encodeURIComponent(a) : a;
1147
- }), Mt = ({ field: t, extra: o }) => {
1148
- let [c, d] = O(!1), [f, p] = O(null), [m, _] = O([]), [b, x] = O(""), [S, C] = O(!1), { id: T, name: re, value: j, placeholder: ie } = t, { InputLabel: ae, node: M, setValue: N, error: P, label: se, helperText: I, missingDependencies: ce } = o, { formValues: L, inputNodes: ue, headers: R, baseUrl: de } = u(), { httpConfig: z } = M.data, fe = D(!1), pe = D(!1), B = D(""), V = n(), H = D(z), me = D(L), U = D(ue), W = D(R), he = D(de), ge = D(N), _e = D(null), G = D(null), ve = D(M.data.normalizeOptionLabels !== !1), ye = ee(() => z?.url ? kt(z.url) : [], [z?.url]), be = ye.length > 0, Q = ee(() => ye.map((e) => `${e}:${String(L[e] ?? "")}`).join("|"), [ye, L]), xe = ee(() => z?.url ? be ? At(z.url, L) : !0 : !1, [
1149
- z?.url,
1150
- be,
1151
- L
1152
- ]), $ = w(async (t) => {
1153
- G.current && G.current.abort();
1154
- let n = new AbortController();
1155
- G.current = n;
1156
- let o = H.current, c = me.current, u = ge.current;
1157
- if (!o?.url) {
1158
- p(V("renderer.defaultHttpInput.noUrlConfigured")), G.current = null;
1159
- return;
1160
- }
1161
- if (o.url && !At(o.url, c)) {
1162
- G.current = null;
1163
- return;
1164
- }
1165
- d(!0), p(null);
1166
- try {
1167
- let d = a(jt(o.url, c, !0), he.current), f = l(o.searchParam && t ? `${d}${d.includes("?") ? "&" : "?"}${o.searchParam}=${encodeURIComponent(t)}` : d, i(o.queryParams, c)), m = h({ "Content-Type": "application/json" }, i(W.current, c), i(o.headers, c)), b = [
1168
- "POST",
1169
- "PUT",
1170
- "PATCH"
1171
- ].includes(o.method || "") ? o.sendAllFormValues ? JSON.stringify(g(c, U.current)) : v(o.body, c, U.current) : void 0, x = setTimeout(() => n.abort(), 3e4), S = await fetch(f, {
1172
- body: b || void 0,
1173
- headers: Object.fromEntries(Object.entries(m).filter(([, e]) => e)),
1174
- method: o.method || "GET",
1175
- signal: n.signal
1176
- });
1177
- if (clearTimeout(x), !S.ok) {
1178
- p(`HTTP Error ${S.status}: ${S.statusText}`);
1179
- return;
1180
- }
1181
- let C = s(await S.text());
1182
- if (!C.ok) {
1183
- p(V("renderer.defaultHttpInput.invalidJson"));
1184
- return;
1185
- }
1186
- let w = r(C.value), T = o.responsePath ? e(w, o.responsePath) : w;
1187
- if (o.responseMapping && Array.isArray(T)) {
1188
- let { valueField: t = "value", labelField: n = "label", descriptionField: r, imageField: i } = o.responseMapping, a = ve.current;
1189
- _(T.map((o) => {
1190
- let s = r ? e(o, r) : void 0, c = i ? e(o, i) : void 0, l = String(e(o, n) || "");
1191
- return {
1192
- description: s != null && s !== "" ? String(s) : void 0,
1193
- image: typeof c == "string" && c !== "" ? c : void 0,
1194
- label: a ? y(l) : l,
1195
- value: String(e(o, t) || "")
1196
- };
1197
- }));
1198
- } else u(typeof T == "string" ? T : JSON.stringify(T));
1199
- } catch (e) {
1200
- if (e instanceof Error && e.name === "AbortError") return;
1201
- p(e instanceof Error ? e.message : V("renderer.defaultHttpInput.fetchFailed")), console.error("HTTP Input fetch error:", e);
1202
- } finally {
1203
- G.current === n && (d(!1), G.current = null);
1204
- }
1205
- }, [V]);
1206
- if (E(() => {
1207
- H.current = z, me.current = L, U.current = ue, W.current = R, he.current = de, ge.current = N, _e.current = $, ve.current = M.data.normalizeOptionLabels !== !1;
1208
- }, [
1209
- z,
1210
- L,
1211
- ue,
1212
- R,
1213
- de,
1214
- N,
1215
- $,
1216
- M.data.normalizeOptionLabels
1217
- ]), E(() => () => {
1218
- G.current && G.current.abort(), fe.current = !1, pe.current = !1;
1219
- }, []), E(() => {
1220
- if (fe.current) return;
1221
- fe.current = !0;
1222
- let e = H.current, t = me.current, n = _e.current, r = e?.url && At(e.url, t);
1223
- e?.fetchOnMount && r && n && (n(), e.url && (B.current = kt(e.url).map((e) => `${e}:${String(t[e] ?? "")}`).join("|")));
1224
- }, []), E(() => {
1225
- if (!fe.current || !be || B.current === Q || !xe) return;
1226
- let e = setTimeout(() => {
1227
- $(), B.current = Q;
1228
- }, 500);
1229
- return () => clearTimeout(e);
1230
- }, [
1231
- Q,
1232
- be,
1233
- xe,
1234
- $
1235
- ]), E(() => {
1236
- if (!pe.current) {
1237
- pe.current = !0;
1238
- return;
1239
- }
1240
- let e = H.current, t = me.current, n = _e.current, r = e?.url && At(e.url, t);
1241
- e?.fetchOnMount && r && n && (n(), e.url && (B.current = kt(e.url).map((e) => `${e}:${String(t[e] ?? "")}`).join("|")));
1242
- }, [ee(() => JSON.stringify({
1243
- body: z?.body,
1244
- fetchOnMount: z?.fetchOnMount,
1245
- headers: z?.headers,
1246
- method: z?.method,
1247
- queryParams: z?.queryParams,
1248
- responseMapping: z?.responseMapping,
1249
- responsePath: z?.responsePath,
1250
- searchParam: z?.searchParam,
1251
- sendAllFormValues: z?.sendAllFormValues,
1252
- url: z?.url
1253
- }), [z])]), E(() => {
1254
- if (!(z?.searchParam && b)) return;
1255
- let e = setTimeout(() => {
1256
- $(b);
1257
- }, 300);
1258
- return () => clearTimeout(e);
1259
- }, [
1260
- b,
1261
- z?.searchParam,
1262
- $
1263
- ]), z?.responseMapping) {
1264
- let e = Array.isArray(j) ? j[0] : j, t = m.find((t) => t.value === e);
1265
- if (z.searchParam) {
1266
- let n = c && z?.showLoading, r = t?.label || ie || V("renderer.defaultHttpInput.search");
1267
- return /* @__PURE__ */ A(J, {
1268
- className: "tg:mb-4",
1269
- children: [
1270
- /* @__PURE__ */ k(ae, {
1271
- htmlFor: T,
1272
- label: se,
1273
- required: M.data.required
1274
- }),
1275
- /* @__PURE__ */ k(dt, {
1276
- missing: ce,
1277
- children: /* @__PURE__ */ A("div", {
1278
- className: "tg:relative",
1279
- children: [
1280
- /* @__PURE__ */ A(Ce, {
1281
- open: S,
1282
- onOpenChange: C,
1283
- children: [/* @__PURE__ */ k(we, {
1284
- asChild: !0,
1285
- children: /* @__PURE__ */ A(q, {
1286
- id: T,
1287
- variant: "outline",
1288
- role: "combobox",
1289
- "aria-label": se || M.data.name,
1290
- "aria-expanded": S,
1291
- disabled: ce.length > 0,
1292
- className: K("tg:w-full tg:justify-between", (e || n) && "tg:pr-14"),
1293
- children: [/* @__PURE__ */ k("span", {
1294
- className: "tg:truncate",
1295
- children: r
1296
- }), /* @__PURE__ */ k(oe, { className: "tg:ml-2 tg:h-4 tg:w-4 tg:shrink-0 tg:opacity-50" })]
1297
- })
1298
- }), /* @__PURE__ */ k(Te, {
1299
- className: "tg:w-[var(--radix-popover-trigger-width)] tg:p-0",
1300
- align: "start",
1301
- children: /* @__PURE__ */ A(tt, {
1302
- shouldFilter: !1,
1303
- children: [/* @__PURE__ */ k(nt, {
1304
- placeholder: V("renderer.defaultHttpInput.search"),
1305
- value: b,
1306
- onValueChange: (e) => {
1307
- x(e), p(null);
1308
- }
1309
- }), /* @__PURE__ */ A(rt, { children: [
1310
- c && /* @__PURE__ */ k("div", {
1311
- className: "tg:flex tg:items-center tg:justify-center tg:p-4",
1312
- children: /* @__PURE__ */ k(F, { className: "tg:h-4 tg:w-4 tg:animate-spin" })
1313
- }),
1314
- !c && f && /* @__PURE__ */ A("div", {
1315
- className: "tg:p-4 tg:text-destructive tg:text-sm",
1316
- children: [/* @__PURE__ */ k("div", { children: f }), /* @__PURE__ */ k("button", {
1317
- type: "button",
1318
- onClick: () => $(b),
1319
- className: "tg:mt-2 tg:block tg:text-primary tg:hover:underline",
1320
- children: V("renderer.defaultHttpInput.retry")
1321
- })]
1322
- }),
1323
- !(c || f) && /* @__PURE__ */ A(te, { children: [/* @__PURE__ */ k(it, { children: V("renderer.defaultHttpInput.noResults") }), /* @__PURE__ */ k(at, { children: m.map((e) => /* @__PURE__ */ A(ot, {
1324
- value: e.value,
1325
- onSelect: () => {
1326
- N(e.value === j ? "" : e.value), C(!1);
1327
- },
1328
- children: [/* @__PURE__ */ k(ne, { className: K("tg:mr-2 tg:h-4 tg:w-4", j === e.value ? "tg:opacity-100" : "tg:opacity-0") }), /* @__PURE__ */ k(vt, {
1329
- label: e.label,
1330
- description: e.description,
1331
- image: e.image
1332
- })]
1333
- }, e.value)) })] })
1334
- ] })]
1335
- })
1336
- })]
1337
- }),
1338
- n && /* @__PURE__ */ k(F, { className: "tg:-translate-y-1/2 tg:pointer-events-none tg:absolute tg:top-1/2 tg:right-8 tg:size-4 tg:animate-spin tg:text-muted-foreground" }),
1339
- e && !n && ce.length === 0 && /* @__PURE__ */ k("button", {
1340
- type: "button",
1341
- "aria-label": V("common.clear"),
1342
- onClick: () => N(""),
1343
- className: "tg:-translate-y-1/2 tg:absolute tg:top-1/2 tg:right-8 tg:rounded-sm tg:p-0.5 tg:text-muted-foreground tg:opacity-70 tg:transition-opacity tg:hover:opacity-100",
1344
- children: /* @__PURE__ */ k(le, { className: "tg:size-4" })
1345
- })
1346
- ]
1347
- })
1348
- }),
1349
- P && /* @__PURE__ */ k(X, { children: P }),
1350
- I && !P && /* @__PURE__ */ k(Y, { children: I })
1351
- ]
1352
- });
1353
- }
1354
- let n = c && z?.showLoading, r = ce.length === 0 && m.length === 0 && !n ? f ?? V("renderer.defaultHttpInput.noDataAvailable") : void 0, i = Array.isArray(j) ? j[0] ?? "" : j ?? "", a = /* @__PURE__ */ A("div", {
1355
- className: "tg:relative",
1356
- children: [
1357
- /* @__PURE__ */ A(Ee, {
1358
- value: i,
1359
- onValueChange: (e) => N(e),
1360
- disabled: n || m.length === 0,
1361
- name: re,
1362
- children: [/* @__PURE__ */ k(ke, {
1363
- id: T,
1364
- name: re,
1365
- "aria-label": se || M.data.name,
1366
- className: K("tg:w-full", (i || n) && "tg:pr-14"),
1367
- children: /* @__PURE__ */ k(Oe, { placeholder: ie || V("renderer.defaultHttpInput.selectOption") })
1368
- }), /* @__PURE__ */ k(Ae, { children: /* @__PURE__ */ k(De, { children: m.map((e, t) => /* @__PURE__ */ k(Me, {
1369
- value: e.value,
1370
- children: /* @__PURE__ */ k(vt, {
1371
- label: e.label,
1372
- description: e.description,
1373
- image: e.image
1374
- })
1375
- }, e.value + t)) }) })]
1376
- }),
1377
- n && /* @__PURE__ */ k(F, { className: "tg:-translate-y-1/2 tg:pointer-events-none tg:absolute tg:top-1/2 tg:right-8 tg:size-4 tg:animate-spin tg:text-muted-foreground" }),
1378
- i && !n && /* @__PURE__ */ k("button", {
1379
- type: "button",
1380
- "aria-label": V("common.clear"),
1381
- onClick: () => N(""),
1382
- className: "tg:-translate-y-1/2 tg:absolute tg:top-1/2 tg:right-8 tg:rounded-sm tg:p-0.5 tg:text-muted-foreground tg:opacity-70 tg:transition-opacity tg:hover:opacity-100",
1383
- children: /* @__PURE__ */ k(le, { className: "tg:size-4" })
1384
- })
1385
- ]
1386
- });
1387
- return /* @__PURE__ */ A(J, {
1388
- className: "tg:mb-4",
1389
- children: [
1390
- /* @__PURE__ */ k(ae, {
1391
- htmlFor: T,
1392
- label: se,
1393
- required: M.data.required
1394
- }),
1395
- /* @__PURE__ */ k(dt, {
1396
- missing: ce,
1397
- children: r ? /* @__PURE__ */ k(Re, { children: /* @__PURE__ */ A(ze, { children: [/* @__PURE__ */ k(Be, {
1398
- asChild: !0,
1399
- children: /* @__PURE__ */ k("div", {
1400
- className: "tg:w-full",
1401
- children: a
1402
- })
1403
- }), /* @__PURE__ */ k(Ve, { children: /* @__PURE__ */ k("p", { children: r }) })] }) }) : a
1404
- }),
1405
- P && /* @__PURE__ */ k(X, { children: P }),
1406
- I && !P && /* @__PURE__ */ k(Y, { children: I })
1407
- ]
1408
- });
1409
- }
1410
- return /* @__PURE__ */ A(J, {
1411
- className: "tg:mb-4",
1412
- children: [
1413
- /* @__PURE__ */ k(ae, {
1414
- htmlFor: T,
1415
- label: se,
1416
- required: M.data.required
1417
- }),
1418
- /* @__PURE__ */ k(Z, {
1419
- type: "text",
1420
- name: re,
1421
- id: T,
1422
- "aria-label": se || M.data.name,
1423
- value: typeof j == "string" ? j : JSON.stringify(j),
1424
- readOnly: !0,
1425
- disabled: !0
1426
- }),
1427
- P && /* @__PURE__ */ k(X, { children: P }),
1428
- I && !P && /* @__PURE__ */ k(Y, { children: I })
1429
- ]
1430
- });
1431
- }, Nt = ({ field: e, extra: t }) => {
1432
- let { id: n, name: r, value: i, placeholder: a } = e, { InputLabel: o, node: s, setValue: c, error: l, label: u, helperText: d } = t;
1433
- return /* @__PURE__ */ A(J, {
1434
- className: "tg:mb-4",
1435
- children: [
1436
- /* @__PURE__ */ k(o, {
1437
- htmlFor: n,
1438
- label: u,
1439
- required: s.data.required
1440
- }),
1441
- /* @__PURE__ */ k(Z, {
1442
- id: n,
1443
- type: "number",
1444
- name: r,
1445
- "aria-label": u || s.data.name,
1446
- value: i ?? "",
1447
- onChange: (e) => c(e.target.value === "" ? null : Number(e.target.value)),
1448
- placeholder: a
1449
- }),
1450
- l && /* @__PURE__ */ k(X, { children: l }),
1451
- d && !l && /* @__PURE__ */ k(Y, { children: d })
1452
- ]
1453
- });
1454
- }, Pt = ({ field: e, extra: t }) => {
1455
- let { id: n, name: r, value: i, placeholder: a } = e, { InputLabel: o, node: s, setValue: c, error: l, label: u, helperText: d } = t;
1456
- return /* @__PURE__ */ A(J, {
1457
- className: "tg:mb-4",
1458
- children: [
1459
- /* @__PURE__ */ k(o, {
1460
- htmlFor: n,
1461
- label: u,
1462
- required: s.data.required
1463
- }),
1464
- /* @__PURE__ */ k(Z, {
1465
- id: n,
1466
- name: r,
1467
- type: "password",
1468
- "aria-label": u || s.data.name,
1469
- value: i ?? "",
1470
- onChange: (e) => c(e.target.value),
1471
- placeholder: a,
1472
- autoComplete: "new-password"
1473
- }),
1474
- l && /* @__PURE__ */ k(X, { children: l }),
1475
- d && !l && /* @__PURE__ */ k(Y, { children: d })
1476
- ]
1477
- });
1478
- }, Ft = R("tg:group/field tg:flex tg:w-full tg:gap-3 tg:data-[invalid=true]:text-destructive", {
1479
- defaultVariants: { orientation: "vertical" },
1480
- variants: { orientation: {
1481
- horizontal: [
1482
- "tg:flex-row tg:items-center",
1483
- "tg:[&>[data-slot=field-label]]:flex-auto",
1484
- "tg:has-[>[data-slot=field-content]]:items-start tg:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
1485
- ],
1486
- responsive: [
1487
- "tg:flex-col tg:@md/field-group:flex-row tg:@md/field-group:items-center tg:[&>*]:w-full tg:@md/field-group:[&>*]:w-auto tg:[&>.sr-only]:w-auto",
1488
- "tg:@md/field-group:[&>[data-slot=field-label]]:flex-auto",
1489
- "tg:@md/field-group:has-[>[data-slot=field-content]]:items-start tg:@md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
1490
- ],
1491
- vertical: ["tg:flex-col tg:[&>*]:w-full tg:[&>.sr-only]:w-auto"]
1492
- } }
1493
- });
1494
- function It({ className: e, orientation: t = "vertical", ...n }) {
1495
- return /* @__PURE__ */ k("div", {
1496
- role: "group",
1497
- "data-slot": "field",
1498
- "data-orientation": t,
1499
- className: K(Ft({ orientation: t }), e),
1500
- ...n
1501
- });
1502
- }
1503
- function Lt({ className: e, ...t }) {
1504
- return /* @__PURE__ */ k("div", {
1505
- "data-slot": "field-content",
1506
- className: K("tg:group/field-content tg:flex tg:flex-1 tg:flex-col tg:gap-1.5 tg:leading-snug", e),
1507
- ...t
1508
- });
1509
- }
1510
- function Rt({ className: e, ...t }) {
1511
- return /* @__PURE__ */ k(Q, {
1512
- "data-slot": "field-label",
1513
- className: K("tg:group/field-label tg:peer/field-label tg:flex tg:w-fit tg:gap-2 tg:leading-snug tg:group-data-[disabled=true]/field:opacity-50", "tg:has-[>[data-slot=field]]:w-full tg:has-[>[data-slot=field]]:flex-col tg:has-[>[data-slot=field]]:rounded-md tg:has-[>[data-slot=field]]:border tg:[&>*]:data-[slot=field]:p-4", "tg:has-data-[state=checked]:border-primary tg:has-data-[state=checked]:bg-primary/5 tg:dark:has-data-[state=checked]:bg-primary/10", e),
1514
- ...t
1515
- });
1516
- }
1517
- function zt({ className: e, ...t }) {
1518
- return /* @__PURE__ */ k("div", {
1519
- "data-slot": "field-label",
1520
- className: K("tg:flex tg:w-fit tg:items-center tg:gap-2 tg:font-medium tg:text-sm tg:leading-snug tg:group-data-[disabled=true]/field:opacity-50", e),
1521
- ...t
1522
- });
1523
- }
1524
- function Bt({ className: e, ...t }) {
1525
- return /* @__PURE__ */ k("p", {
1526
- "data-slot": "field-description",
1527
- className: K("tg:font-normal tg:text-muted-foreground tg:text-sm tg:leading-normal tg:group-has-[[data-orientation=horizontal]]/field:text-balance", "tg:last:mt-0 tg:nth-last-2:-mt-1 tg:[[data-variant=legend]+&]:-mt-1.5", "tg:[&>a]:underline tg:[&>a]:underline-offset-4 tg:[&>a:hover]:text-primary", e),
1528
- ...t
1529
- });
1530
- }
1531
- //#endregion
1532
- //#region src/shared/components/ui/radio-group.tsx
1533
- function Vt({ className: e, ...t }) {
1534
- return /* @__PURE__ */ k(_e.Root, {
1535
- "data-slot": "radio-group",
1536
- className: K("tg:grid tg:gap-3", e),
1537
- ...t
1538
- });
1539
- }
1540
- function Ht({ className: e, ...t }) {
1541
- return /* @__PURE__ */ k(_e.Item, {
1542
- "data-slot": "radio-group-item",
1543
- className: K("tg:aspect-square tg:size-4 tg:shrink-0 tg:rounded-full tg:border tg:border-input tg:text-primary tg:shadow-xs tg:outline-none tg:transition-[color,box-shadow] tg:focus-visible:border-ring tg:focus-visible:ring-[3px] tg:focus-visible:ring-ring/50 tg:disabled:cursor-not-allowed tg:disabled:opacity-50 tg:aria-invalid:border-destructive tg:aria-invalid:ring-destructive/20 tg:dark:bg-input/30 tg:dark:aria-invalid:ring-destructive/40", e),
1544
- ...t,
1545
- children: /* @__PURE__ */ k(_e.Indicator, {
1546
- "data-slot": "radio-group-indicator",
1547
- className: "tg:relative tg:flex tg:items-center tg:justify-center",
1548
- children: /* @__PURE__ */ k(N, { className: "tg:-translate-x-1/2 tg:-translate-y-1/2 tg:absolute tg:top-1/2 tg:left-1/2 tg:size-2 tg:fill-primary" })
1549
- })
1550
- });
1551
- }
1552
- //#endregion
1553
- //#region src/renderer/features/TreegeRenderer/web/components/inputs/DefaultRadioInput.tsx
1554
- var Ut = ({ field: e, extra: t }) => {
1555
- let { id: r, name: i, value: a } = e, { InputLabel: o, node: s, setValue: c, error: l, label: d, helperText: f, renderOptionExtras: p, compactOptions: m, missingDependencies: h } = t, { options: g, isLoading: _, error: v } = bt(s), { optionsDisplayLimit: y } = u(), b = n(), x = a ? String(a) : "", S = s.data.variant !== "default", C = `${r}-label`, w = y ? g.slice(0, y) : g, T = g.length - w.length;
1556
- return /* @__PURE__ */ A(J, {
1557
- className: "tg:mb-4",
1558
- children: [
1559
- /* @__PURE__ */ k(o, {
1560
- className: "tg:mb-1",
1561
- id: C,
1562
- label: d,
1563
- required: s.data.required
1564
- }),
1565
- /* @__PURE__ */ k(ft, { missing: h }),
1566
- _ && /* @__PURE__ */ A("div", {
1567
- className: "tg:flex tg:items-center tg:gap-2 tg:py-2 tg:text-muted-foreground tg:text-sm",
1568
- children: [/* @__PURE__ */ k(F, { className: "tg:h-4 tg:w-4 tg:animate-spin" }), /* @__PURE__ */ k("span", { children: b("renderer.defaultRadioInput.loadingOptions") })]
1569
- }),
1570
- /* @__PURE__ */ A(Vt, {
1571
- value: x,
1572
- onValueChange: (e) => c(e),
1573
- "aria-labelledby": d ? C : void 0,
1574
- "aria-label": d ? void 0 : s.data.name,
1575
- name: i,
1576
- className: K("tg:min-w-0", S && "tg:flex tg:flex-col tg:gap-2"),
1577
- children: [w.map((e, t) => {
1578
- let n = `${r}-${e.value}`, i = b(e.label) || e.value, a = b(e.description), o = String(e.value);
1579
- return S ? /* @__PURE__ */ A(Rt, {
1580
- htmlFor: n,
1581
- className: K("tg:group/option tg:pointer-events-auto tg:relative", m && "tg:group-hover/option:pr-16"),
1582
- children: [/* @__PURE__ */ A(It, {
1583
- orientation: "horizontal",
1584
- "data-disabled": e.disabled || void 0,
1585
- children: [
1586
- e.image && /* @__PURE__ */ k("img", {
1587
- src: e.image,
1588
- alt: "",
1589
- className: "tg:h-10 tg:w-10 tg:shrink-0 tg:self-center tg:rounded tg:object-cover"
1590
- }),
1591
- /* @__PURE__ */ A(Lt, {
1592
- className: K(m && "tg:min-w-0 tg:flex-1 tg:overflow-hidden"),
1593
- children: [/* @__PURE__ */ k(zt, {
1594
- className: K(m && "tg:block tg:max-w-full tg:truncate"),
1595
- children: i
1596
- }), a && /* @__PURE__ */ k(Bt, {
1597
- className: K(m && "tg:block tg:max-w-full tg:truncate"),
1598
- children: a
1599
- })]
1600
- }),
1601
- /* @__PURE__ */ k(Ht, {
1602
- value: o,
1603
- id: n,
1604
- disabled: e.disabled,
1605
- className: K(m && "tg:ml-auto tg:shrink-0 tg:group-hover/option:invisible")
1606
- })
1607
- ]
1608
- }), p?.({
1609
- index: t,
1610
- option: e,
1611
- variant: "card"
1612
- })]
1613
- }, e.value + t) : /* @__PURE__ */ A("div", {
1614
- className: K("tg:group/option tg:pointer-events-auto tg:relative tg:flex tg:items-start tg:space-x-2", m && "tg:min-w-0 tg:pr-22"),
1615
- children: [
1616
- /* @__PURE__ */ k(Ht, {
1617
- value: o,
1618
- id: n,
1619
- disabled: e.disabled,
1620
- className: "tg:mt-0.5"
1621
- }),
1622
- e.image && /* @__PURE__ */ k("img", {
1623
- src: e.image,
1624
- alt: "",
1625
- className: "tg:h-8 tg:w-8 tg:rounded tg:object-cover"
1626
- }),
1627
- /* @__PURE__ */ A("div", {
1628
- className: K("tg:flex tg:flex-col", m && "tg:min-w-0 tg:flex-1 tg:overflow-hidden"),
1629
- children: [/* @__PURE__ */ k(Q, {
1630
- htmlFor: n,
1631
- className: K("tg:cursor-pointer tg:font-normal tg:text-sm", m && "tg:block tg:max-w-full tg:truncate"),
1632
- children: i
1633
- }), a && /* @__PURE__ */ k("span", {
1634
- className: K("tg:text-muted-foreground tg:text-xs", m && "tg:block tg:max-w-full tg:truncate"),
1635
- children: a
1636
- })]
1637
- }),
1638
- p?.({
1639
- index: t,
1640
- option: e,
1641
- variant: "default"
1642
- })
1643
- ]
1644
- }, e.value + t);
1645
- }), T > 0 && /* @__PURE__ */ k("div", {
1646
- className: "tg:px-2 tg:py-1 tg:text-muted-foreground tg:text-xs",
1647
- children: "…"
1648
- })]
1649
- }),
1650
- l && /* @__PURE__ */ k(X, { children: l }),
1651
- v && !l && /* @__PURE__ */ k(X, { children: v }),
1652
- f && !l && !v && /* @__PURE__ */ k(Y, { children: f })
1653
- ]
1654
- });
1655
- }, Wt = ({ field: e, extra: t }) => {
1656
- let { id: r, name: i, value: a, placeholder: o } = e, { InputLabel: s, node: c, setValue: l, error: u, label: d, helperText: f, missingDependencies: p } = t, { options: m, isLoading: h, error: g } = bt(c), _ = n(), v = a ? String(a) : "";
1657
- return /* @__PURE__ */ A(J, {
1658
- className: "tg:mb-4",
1659
- children: [
1660
- /* @__PURE__ */ k(s, {
1661
- htmlFor: r,
1662
- label: d,
1663
- required: c.data.required
1664
- }),
1665
- /* @__PURE__ */ k(dt, {
1666
- missing: p,
1667
- children: /* @__PURE__ */ A("div", {
1668
- className: "tg:relative",
1669
- children: [
1670
- /* @__PURE__ */ A(Ee, {
1671
- name: i,
1672
- value: v,
1673
- onValueChange: (e) => l(e),
1674
- disabled: h || p.length > 0,
1675
- children: [/* @__PURE__ */ k(ke, {
1676
- id: r,
1677
- name: i,
1678
- "aria-label": d || c.data.name,
1679
- className: K("tg:w-full", (v || h) && "tg:pr-14"),
1680
- children: /* @__PURE__ */ k(Oe, { placeholder: o || _("renderer.defaultSelectInput.selectOption") })
1681
- }), /* @__PURE__ */ k(Ae, { children: /* @__PURE__ */ k(De, { children: m.map((e, t) => /* @__PURE__ */ k(Me, {
1682
- value: String(e.value),
1683
- disabled: e.disabled,
1684
- children: /* @__PURE__ */ k(vt, {
1685
- label: _(e.label) || e.value,
1686
- description: _(e.description),
1687
- image: e.image
1688
- })
1689
- }, `${e.value}-${t}`)) }) })]
1690
- }),
1691
- h && /* @__PURE__ */ k(F, { className: "tg:-translate-y-1/2 tg:pointer-events-none tg:absolute tg:top-1/2 tg:right-8 tg:size-4 tg:animate-spin tg:text-muted-foreground" }),
1692
- v && !h && p.length === 0 && /* @__PURE__ */ k("button", {
1693
- type: "button",
1694
- "aria-label": _("common.clear"),
1695
- onClick: () => l(""),
1696
- className: "tg:-translate-y-1/2 tg:absolute tg:top-1/2 tg:right-8 tg:rounded-sm tg:p-0.5 tg:text-muted-foreground tg:opacity-70 tg:transition-opacity tg:hover:opacity-100",
1697
- children: /* @__PURE__ */ k(le, { className: "tg:size-4" })
1698
- })
1699
- ]
1700
- })
1701
- }),
1702
- u && /* @__PURE__ */ k(X, { children: u }),
1703
- g && !u && /* @__PURE__ */ k(X, { children: g }),
1704
- f && !u && !g && /* @__PURE__ */ k(Y, { children: f })
1705
- ]
1706
- });
1707
- }, Gt = (e) => null;
1708
- //#endregion
1709
- //#region src/shared/components/ui/switch.tsx
1710
- function Kt({ className: e, ...t }) {
1711
- return /* @__PURE__ */ k(G.Root, {
1712
- "data-slot": "switch",
1713
- className: K("tg:peer tg:inline-flex tg:h-[1.15rem] tg:w-8 tg:shrink-0 tg:items-center tg:rounded-full tg:border tg:border-transparent tg:shadow-xs tg:outline-none tg:transition-all tg:focus-visible:border-ring tg:focus-visible:ring-[3px] tg:focus-visible:ring-ring/50 tg:disabled:cursor-not-allowed tg:disabled:opacity-50 tg:data-[state=checked]:bg-primary tg:data-[state=unchecked]:bg-input tg:dark:data-[state=unchecked]:bg-input/80", e),
1714
- ...t,
1715
- children: /* @__PURE__ */ k(G.Thumb, {
1716
- "data-slot": "switch-thumb",
1717
- className: K("tg:pointer-events-none tg:block tg:size-4 tg:rounded-full tg:bg-background tg:ring-0 tg:transition-transform tg:data-[state=checked]:translate-x-[calc(100%-2px)] tg:data-[state=unchecked]:translate-x-0 tg:dark:data-[state=checked]:bg-primary-foreground tg:dark:data-[state=unchecked]:bg-foreground")
1718
- })
1719
- });
1720
- }
1721
- //#endregion
1722
- //#region src/renderer/features/TreegeRenderer/web/components/inputs/DefaultSwitchInput.tsx
1723
- var qt = ({ field: e, extra: t }) => {
1724
- let { id: n, name: r, value: i } = e, { InputLabel: a, node: o, setValue: s, error: c, label: l, helperText: u } = t;
1725
- return /* @__PURE__ */ A(J, {
1726
- className: "tg:mb-4",
1727
- children: [
1728
- /* @__PURE__ */ k(a, {
1729
- htmlFor: n,
1730
- label: l,
1731
- required: o.data.required
1732
- }),
1733
- /* @__PURE__ */ k(Kt, {
1734
- id: n,
1735
- name: r,
1736
- "aria-label": l || o.data.name,
1737
- checked: i,
1738
- onCheckedChange: s
1739
- }),
1740
- u && !c && /* @__PURE__ */ k(Y, { children: u }),
1741
- c && /* @__PURE__ */ k(X, { children: c })
1742
- ]
1743
- });
1744
- };
1745
- //#endregion
1746
- //#region src/shared/components/ui/textarea.tsx
1747
- function Jt({ className: e, ...t }) {
1748
- return /* @__PURE__ */ k("textarea", {
1749
- "data-slot": "textarea",
1750
- className: K("tg:field-sizing-content tg:flex tg:min-h-16 tg:w-full tg:rounded-md tg:border tg:border-input tg:bg-transparent tg:px-3 tg:py-2 tg:text-base tg:shadow-xs tg:outline-none tg:transition-[color,box-shadow] tg:placeholder:text-muted-foreground tg:focus-visible:border-ring tg:focus-visible:ring-[3px] tg:focus-visible:ring-ring/50 tg:disabled:cursor-not-allowed tg:disabled:opacity-50 tg:aria-invalid:border-destructive tg:aria-invalid:ring-destructive/20 tg:md:text-sm tg:dark:bg-input/30 tg:dark:aria-invalid:ring-destructive/40", e),
1751
- ...t
1752
- });
1753
- }
1754
- //#endregion
1755
- //#region src/renderer/features/TreegeRenderer/web/components/inputs/DefaultTextAreaInput.tsx
1756
- var Yt = ({ field: e, extra: t }) => {
1757
- let { id: n, name: r, value: i, placeholder: a } = e, { InputLabel: o, node: s, setValue: c, error: l, label: u, helperText: d } = t;
1758
- return /* @__PURE__ */ A(J, {
1759
- className: "tg:mb-4",
1760
- children: [
1761
- /* @__PURE__ */ k(o, {
1762
- htmlFor: n,
1763
- label: u,
1764
- required: s.data.required
1765
- }),
1766
- /* @__PURE__ */ k(Jt, {
1767
- id: n,
1768
- name: r,
1769
- "aria-label": u || s.data.name,
1770
- value: i ?? "",
1771
- onChange: (e) => c(e.target.value),
1772
- placeholder: a,
1773
- className: "tg:w-full tg:rounded-md tg:border tg:px-3 tg:py-2",
1774
- rows: 4
1775
- }),
1776
- l && /* @__PURE__ */ k(X, { children: l }),
1777
- d && !l && /* @__PURE__ */ k(Y, { children: d })
1778
- ]
1779
- });
1780
- }, Xt = ({ field: e, extra: t }) => {
1781
- let { id: n, name: r, value: i, placeholder: a } = e, { InputLabel: o, node: s, setValue: c, error: l, label: u, helperText: d } = t;
1782
- return /* @__PURE__ */ A(J, {
1783
- className: "tg:mb-4",
1784
- children: [
1785
- /* @__PURE__ */ k(o, {
1786
- htmlFor: n,
1787
- label: u,
1788
- required: s.data.required
1789
- }),
1790
- /* @__PURE__ */ k(Z, {
1791
- type: "text",
1792
- id: n,
1793
- name: r,
1794
- "aria-label": u || s.data.name,
1795
- value: i ?? "",
1796
- onChange: (e) => c(e.target.value),
1797
- placeholder: a
1798
- }),
1799
- l && /* @__PURE__ */ k(X, { children: l }),
1800
- d && !l && /* @__PURE__ */ k(Y, { children: d })
1801
- ]
1802
- });
1803
- }, Zt = ({ field: e, extra: t }) => {
1804
- let { id: n, name: r, value: i, placeholder: a } = e, { InputLabel: o, node: s, setValue: c, error: l, label: u, helperText: d } = t;
1805
- return /* @__PURE__ */ A(J, {
1806
- className: "tg:mb-4",
1807
- children: [
1808
- /* @__PURE__ */ k(o, {
1809
- htmlFor: n,
1810
- label: u,
1811
- required: s.data.required
1812
- }),
1813
- /* @__PURE__ */ k(Z, {
1814
- type: "time",
1815
- id: n,
1816
- name: r,
1817
- "aria-label": u || s.data.name,
1818
- value: i ?? "",
1819
- onChange: (e) => c(e.target.value),
1820
- placeholder: a,
1821
- className: "tg:bg-background tg:[color-scheme:light] tg:dark:[color-scheme:dark]"
1822
- }),
1823
- l && /* @__PURE__ */ k(X, { children: l }),
1824
- d && !l && /* @__PURE__ */ k(Y, { children: d })
1825
- ]
1826
- });
1827
- }, Qt = ({ field: e, extra: t }) => {
1828
- let { id: r, name: i, value: a } = e, { InputLabel: o, node: s, setValue: c, error: l, label: u, helperText: d } = t, f = n(), p = Array.isArray(a) ? a : [], m = p[0] || "", h = p[1] || "", g = (e) => {
1829
- c([e, h]);
1830
- }, _ = (e) => {
1831
- c([m, e]);
1832
- };
1833
- return /* @__PURE__ */ A(J, {
1834
- className: "tg:mb-4",
1835
- children: [
1836
- /* @__PURE__ */ k(o, {
1837
- htmlFor: `${r}-start`,
1838
- label: u,
1839
- required: s.data.required
1840
- }),
1841
- /* @__PURE__ */ A("div", {
1842
- className: "tg:flex tg:gap-2",
1843
- children: [/* @__PURE__ */ k(Z, {
1844
- id: `${r}-start`,
1845
- name: `${i}-start`,
1846
- "aria-label": `${u || s.data.name} - ${f("renderer.defaultInputs.startTime")}`,
1847
- "aria-invalid": !!l,
1848
- "aria-describedby": l ? `${s.id}-error` : void 0,
1849
- type: "time",
1850
- value: m,
1851
- onChange: (e) => g(e.target.value),
1852
- placeholder: f("renderer.defaultInputs.startTime"),
1853
- className: "tg:flex-1 tg:bg-background tg:[color-scheme:light] tg:dark:[color-scheme:dark]"
1854
- }), /* @__PURE__ */ k(Z, {
1855
- id: `${r}-end`,
1856
- name: `${i}-end`,
1857
- "aria-label": `${u || s.data.name} - ${f("renderer.defaultInputs.endTime")}`,
1858
- "aria-invalid": !!l,
1859
- "aria-describedby": l ? `${s.id}-error` : void 0,
1860
- type: "time",
1861
- value: h,
1862
- onChange: (e) => _(e.target.value),
1863
- placeholder: f("renderer.defaultInputs.endTime"),
1864
- className: "tg:flex-1 tg:bg-background tg:[color-scheme:light] tg:dark:[color-scheme:dark]"
1865
- })]
1866
- }),
1867
- l && /* @__PURE__ */ k(X, { children: l }),
1868
- d && !l && /* @__PURE__ */ k(Y, { children: d })
1869
- ]
1870
- });
1871
- }, $t = {
1872
- address: lt,
1873
- autocomplete: xt,
1874
- checkbox: St,
1875
- date: Tt,
1876
- daterange: Et,
1877
- file: Dt,
1878
- hidden: Ot,
1879
- http: Mt,
1880
- number: Nt,
1881
- password: Pt,
1882
- radio: Ut,
1883
- select: Wt,
1884
- submit: Gt,
1885
- switch: qt,
1886
- text: Xt,
1887
- textarea: Yt,
1888
- time: Zt,
1889
- timerange: Qt
1890
- }, en = C(({ label: e, id: t, disabled: r, isSubmitting: i, onBlur: a, onClick: o, onFocus: s, onPointerDown: c, onPointerLeave: l, onPointerMove: u, ...d }, f) => {
1891
- let p = n();
1892
- return /* @__PURE__ */ A("button", {
1893
- ref: f,
1894
- id: t,
1895
- onBlur: a,
1896
- onClick: o,
1897
- onFocus: s,
1898
- onPointerDown: c,
1899
- disabled: r || i,
1900
- onPointerLeave: l,
1901
- onPointerMove: u,
1902
- type: "submit",
1903
- className: "tg:inline-flex tg:items-center tg:justify-center tg:gap-2 tg:rounded-md tg:bg-gray-900 tg:px-4 tg:py-2 tg:font-medium tg:text-sm tg:text-white tg:transition-colors tg:hover:bg-gray-800 tg:focus:outline-none tg:focus:ring-2 tg:focus:ring-gray-900 tg:focus:ring-offset-2 tg:disabled:cursor-not-allowed tg:disabled:opacity-50 tg:dark:bg-white tg:dark:text-gray-900 tg:dark:focus:ring-white tg:dark:hover:bg-gray-100",
1904
- ...d,
1905
- children: [i && /* @__PURE__ */ k(F, { className: "tg:h-4 tg:w-4 tg:animate-spin" }), e || p("renderer.defaultSubmitButton.submit")]
1906
- });
1907
- });
1908
- //#endregion
1909
- export { Oe as $, Ke as A, ze as B, lt as C, nt as D, at as E, $e as F, Le as G, Re as H, qe as I, De as J, Ee as K, Ge as L, et as M, Qe as N, ot as O, Ze as P, ke as Q, We as R, xt as S, it as T, Be as U, Ve as V, Ie as W, je as X, Me as Y, Ne as Z, Ot as _, Xt as a, Q as at, Tt as b, qt as c, J as ct, Ut as d, K as dt, Ce as et, Vt as f, Mt as g, Nt as h, Zt as i, $ as it, Xe as j, rt as k, Kt as l, be as lt, Pt as m, $t as n, we as nt, Yt as o, Z as ot, Ht as p, Ae as q, Qt as r, Se as rt, Jt as s, Y as st, en as t, Te as tt, Wt as u, q as ut, Dt as v, tt as w, St as x, Et as y, Ue as z };