treege 3.0.0-beta.40 → 3.0.0-beta.42
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.
- package/dist/DefaultInputs-Cr6wTVNE.js +1558 -0
- package/dist/{ThemeContext-Ejgu9Mwr.js → ThemeContext-CUHjGVUf.js} +87 -87
- package/dist/editor/features/TreegeEditor/TreegeEditor.d.ts +1 -1
- package/dist/editor/features/TreegeEditor/controls/MiniMapControl.d.ts +6 -0
- package/dist/editor/{hooks/useAutoLayout.d.ts → features/TreegeEditor/layout/AutoLayout.d.ts} +3 -3
- package/dist/editor/features/TreegeEditor/panel/ActionsPanel.d.ts +3 -1
- package/dist/editor/types/editor.d.ts +23 -0
- package/dist/{editor-DWJ95r4g.js → editor-CE8g1o72.js} +1381 -1345
- package/dist/editor.js +2 -2
- package/dist/main.js +3 -3
- package/dist/renderer-native.js +413 -413
- package/dist/renderer.js +2 -2
- package/dist/shared/hooks/useMediaQuery.d.ts +12 -0
- package/package.json +7 -8
- package/dist/DefaultInputs-8yJMEyMh.js +0 -1557
|
@@ -0,0 +1,1558 @@
|
|
|
1
|
+
import { S as e, _ as t, c as n, f as r, i, m as a, o, p as s, r as c, s as l, t as u, u as d, w as f } from "./ThemeContext-CUHjGVUf.js";
|
|
2
|
+
import * as p from "react";
|
|
3
|
+
import { forwardRef as m, useCallback as h, useEffect as g, useMemo as _, useRef as v, useState as y } from "react";
|
|
4
|
+
import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
5
|
+
import { Check as C, CheckIcon as w, ChevronDownIcon as T, ChevronLeftIcon as E, ChevronRightIcon as D, ChevronUpIcon as ee, ChevronsUpDown as te, CircleIcon as O, Loader2 as k, MapPin as ne, SearchIcon as re, XIcon as ie } from "lucide-react";
|
|
6
|
+
import { Slot as A } from "@radix-ui/react-slot";
|
|
7
|
+
import { cva as j } from "class-variance-authority";
|
|
8
|
+
import { clsx as M } from "clsx";
|
|
9
|
+
import { extendTailwindMerge as N } from "tailwind-merge";
|
|
10
|
+
import * as P from "@radix-ui/react-checkbox";
|
|
11
|
+
import * as ae from "@radix-ui/react-label";
|
|
12
|
+
import * as F from "@radix-ui/react-popover";
|
|
13
|
+
import * as I from "@radix-ui/react-select";
|
|
14
|
+
import { Command as L } from "cmdk";
|
|
15
|
+
import * as R from "@radix-ui/react-dialog";
|
|
16
|
+
import { DayPicker as oe, getDefaultClassNames as z } from "react-day-picker";
|
|
17
|
+
import * as B from "@radix-ui/react-tooltip";
|
|
18
|
+
import * as V from "@radix-ui/react-radio-group";
|
|
19
|
+
import * as se from "@radix-ui/react-separator";
|
|
20
|
+
import * as H from "@radix-ui/react-switch";
|
|
21
|
+
//#region src/shared/lib/utils.ts
|
|
22
|
+
var U = N({ prefix: "tg" });
|
|
23
|
+
function W(...e) {
|
|
24
|
+
return U(M(e));
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/shared/components/ui/button.tsx
|
|
28
|
+
var ce = j("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
|
+
link: "tg:text-primary tg:underline-offset-4 tg:hover:underline",
|
|
48
|
+
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",
|
|
49
|
+
secondary: "tg:bg-secondary tg:text-secondary-foreground tg:hover:bg-secondary/80"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
function G({ className: e, variant: t, size: n, asChild: r = !1, ...i }) {
|
|
54
|
+
return /* @__PURE__ */ x(r ? A : "button", {
|
|
55
|
+
"data-slot": "button",
|
|
56
|
+
className: W(ce({
|
|
57
|
+
className: e,
|
|
58
|
+
size: n,
|
|
59
|
+
variant: t
|
|
60
|
+
})),
|
|
61
|
+
...i
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region src/shared/components/ui/checkbox.tsx
|
|
66
|
+
function le({ className: e, ...t }) {
|
|
67
|
+
return /* @__PURE__ */ x(P.Root, {
|
|
68
|
+
"data-slot": "checkbox",
|
|
69
|
+
className: W("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),
|
|
70
|
+
...t,
|
|
71
|
+
children: /* @__PURE__ */ x(P.Indicator, {
|
|
72
|
+
"data-slot": "checkbox-indicator",
|
|
73
|
+
className: "tg:grid tg:place-content-center tg:text-current tg:transition-none",
|
|
74
|
+
children: /* @__PURE__ */ x(w, { className: "tg:size-3.5" })
|
|
75
|
+
})
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
//#endregion
|
|
79
|
+
//#region src/shared/components/ui/form.tsx
|
|
80
|
+
function K({ className: e, ...t }) {
|
|
81
|
+
return /* @__PURE__ */ x("div", {
|
|
82
|
+
"data-slot": "form-item",
|
|
83
|
+
className: W("tg:grid tg:gap-2", e),
|
|
84
|
+
...t
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
function q({ className: e, ...t }) {
|
|
88
|
+
return /* @__PURE__ */ x("p", {
|
|
89
|
+
"data-slot": "form-description",
|
|
90
|
+
className: W("tg:text-muted-foreground tg:text-xs", e),
|
|
91
|
+
...t
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
function J({ className: e, ...t }) {
|
|
95
|
+
return /* @__PURE__ */ x("p", {
|
|
96
|
+
"data-slot": "form-error",
|
|
97
|
+
className: W("tg:text-destructive tg:text-xs", e),
|
|
98
|
+
...t
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region src/shared/components/ui/input.tsx
|
|
103
|
+
function Y({ className: e, type: t, ...n }) {
|
|
104
|
+
return /* @__PURE__ */ x("input", {
|
|
105
|
+
type: t,
|
|
106
|
+
"data-slot": "input",
|
|
107
|
+
className: W("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),
|
|
108
|
+
...n
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
//#endregion
|
|
112
|
+
//#region src/shared/components/ui/label.tsx
|
|
113
|
+
var X = ({ className: e, ...t }) => /* @__PURE__ */ x(ae.Root, {
|
|
114
|
+
"data-slot": "label",
|
|
115
|
+
className: W("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),
|
|
116
|
+
...t
|
|
117
|
+
});
|
|
118
|
+
//#endregion
|
|
119
|
+
//#region src/shared/components/ui/popover.tsx
|
|
120
|
+
function Z({ ...e }) {
|
|
121
|
+
return /* @__PURE__ */ x(F.Root, {
|
|
122
|
+
"data-slot": "popover",
|
|
123
|
+
...e
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
function Q({ ...e }) {
|
|
127
|
+
return /* @__PURE__ */ x(F.Trigger, {
|
|
128
|
+
"data-slot": "popover-trigger",
|
|
129
|
+
...e
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
function $({ className: e, align: t = "center", sideOffset: n = 4, disablePortal: r = !1, ...i }) {
|
|
133
|
+
let a = /* @__PURE__ */ x(F.Content, {
|
|
134
|
+
"data-slot": "popover-content",
|
|
135
|
+
align: t,
|
|
136
|
+
sideOffset: n,
|
|
137
|
+
className: W("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-50 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),
|
|
138
|
+
...i
|
|
139
|
+
});
|
|
140
|
+
return r ? a : /* @__PURE__ */ x(F.Portal, { children: a });
|
|
141
|
+
}
|
|
142
|
+
//#endregion
|
|
143
|
+
//#region src/shared/components/ui/select.tsx
|
|
144
|
+
var ue = ({ ...e }) => /* @__PURE__ */ x(I.Root, {
|
|
145
|
+
"data-slot": "select",
|
|
146
|
+
...e
|
|
147
|
+
}), de = ({ ...e }) => /* @__PURE__ */ x(I.Group, {
|
|
148
|
+
"data-slot": "select-group",
|
|
149
|
+
...e
|
|
150
|
+
}), fe = ({ ...e }) => /* @__PURE__ */ x(I.Value, {
|
|
151
|
+
"data-slot": "select-value",
|
|
152
|
+
...e
|
|
153
|
+
}), pe = ({ className: e, size: t = "default", children: n, ...r }) => /* @__PURE__ */ S(I.Trigger, {
|
|
154
|
+
"data-slot": "select-trigger",
|
|
155
|
+
"data-size": t,
|
|
156
|
+
className: W("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),
|
|
157
|
+
...r,
|
|
158
|
+
children: [n, /* @__PURE__ */ x(I.Icon, {
|
|
159
|
+
asChild: !0,
|
|
160
|
+
children: /* @__PURE__ */ x(T, { className: "tg:size-4 tg:opacity-50" })
|
|
161
|
+
})]
|
|
162
|
+
}), me = ({ className: e, children: t, position: n = "popper", ...r }) => /* @__PURE__ */ x(I.Portal, { children: /* @__PURE__ */ S(I.Content, {
|
|
163
|
+
"data-slot": "select-content",
|
|
164
|
+
className: W("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-50 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),
|
|
165
|
+
position: n,
|
|
166
|
+
...r,
|
|
167
|
+
children: [
|
|
168
|
+
/* @__PURE__ */ x(ve, {}),
|
|
169
|
+
/* @__PURE__ */ x(I.Viewport, {
|
|
170
|
+
className: W("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"),
|
|
171
|
+
children: t
|
|
172
|
+
}),
|
|
173
|
+
/* @__PURE__ */ x(ye, {})
|
|
174
|
+
]
|
|
175
|
+
}) }), he = ({ className: e, htmlFor: t, children: n, ...r }) => /* @__PURE__ */ x(I.Label, {
|
|
176
|
+
"data-slot": "select-label",
|
|
177
|
+
className: W("tg:pb-1.5 tg:font-medium tg:text-muted-foreground tg:text-sm", e),
|
|
178
|
+
...r,
|
|
179
|
+
children: /* @__PURE__ */ x("label", {
|
|
180
|
+
htmlFor: t,
|
|
181
|
+
children: n
|
|
182
|
+
})
|
|
183
|
+
}), ge = ({ className: e, children: t, ...n }) => /* @__PURE__ */ S(I.Item, {
|
|
184
|
+
"data-slot": "select-item",
|
|
185
|
+
className: W("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),
|
|
186
|
+
...n,
|
|
187
|
+
children: [/* @__PURE__ */ x("span", {
|
|
188
|
+
className: "tg:absolute tg:right-2 tg:flex tg:size-3.5 tg:items-center tg:justify-center",
|
|
189
|
+
children: /* @__PURE__ */ x(I.ItemIndicator, { children: /* @__PURE__ */ x(w, { className: "tg:size-4" }) })
|
|
190
|
+
}), /* @__PURE__ */ x(I.ItemText, { children: t })]
|
|
191
|
+
}), _e = ({ className: e, ...t }) => /* @__PURE__ */ x(I.Separator, {
|
|
192
|
+
"data-slot": "select-separator",
|
|
193
|
+
className: W("tg:-mx-1 tg:pointer-events-none tg:my-1 tg:h-px tg:bg-border", e),
|
|
194
|
+
...t
|
|
195
|
+
}), ve = ({ className: e, ...t }) => /* @__PURE__ */ x(I.ScrollUpButton, {
|
|
196
|
+
"data-slot": "select-scroll-up-button",
|
|
197
|
+
className: W("tg:flex tg:cursor-default tg:items-center tg:justify-center tg:py-1", e),
|
|
198
|
+
...t,
|
|
199
|
+
children: /* @__PURE__ */ x(ee, { className: "tg:size-4" })
|
|
200
|
+
}), ye = ({ className: e, ...t }) => /* @__PURE__ */ x(I.ScrollDownButton, {
|
|
201
|
+
"data-slot": "select-scroll-down-button",
|
|
202
|
+
className: W("tg:flex tg:cursor-default tg:items-center tg:justify-center tg:py-1", e),
|
|
203
|
+
...t,
|
|
204
|
+
children: /* @__PURE__ */ x(T, { className: "tg:size-4" })
|
|
205
|
+
});
|
|
206
|
+
//#endregion
|
|
207
|
+
//#region src/shared/components/ui/dialog.tsx
|
|
208
|
+
function be({ ...e }) {
|
|
209
|
+
return /* @__PURE__ */ x(R.Root, {
|
|
210
|
+
"data-slot": "dialog",
|
|
211
|
+
...e
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
function xe({ ...e }) {
|
|
215
|
+
return /* @__PURE__ */ x(R.Trigger, {
|
|
216
|
+
"data-slot": "dialog-trigger",
|
|
217
|
+
...e
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
function Se({ ...e }) {
|
|
221
|
+
return /* @__PURE__ */ x(R.Portal, {
|
|
222
|
+
"data-slot": "dialog-portal",
|
|
223
|
+
...e
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
function Ce({ className: e, ...t }) {
|
|
227
|
+
return /* @__PURE__ */ x(R.Overlay, {
|
|
228
|
+
"data-slot": "dialog-overlay",
|
|
229
|
+
className: W("tg:data-[state=closed]:fade-out-0 tg:data-[state=open]:fade-in-0 tg:fixed tg:inset-0 tg:z-50 tg:bg-black/50 tg:data-[state=closed]:animate-out tg:data-[state=open]:animate-in", e),
|
|
230
|
+
...t
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
function we({ className: e, children: t, showCloseButton: n = !0, ...r }) {
|
|
234
|
+
return /* @__PURE__ */ S(Se, {
|
|
235
|
+
"data-slot": "dialog-portal",
|
|
236
|
+
children: [/* @__PURE__ */ x(Ce, {}), /* @__PURE__ */ S(R.Content, {
|
|
237
|
+
"data-slot": "dialog-content",
|
|
238
|
+
className: W("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-50 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),
|
|
239
|
+
...r,
|
|
240
|
+
children: [t, n && /* @__PURE__ */ S(R.Close, {
|
|
241
|
+
"data-slot": "dialog-close",
|
|
242
|
+
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",
|
|
243
|
+
children: [/* @__PURE__ */ x(ie, {}), /* @__PURE__ */ x("span", {
|
|
244
|
+
className: "tg:sr-only",
|
|
245
|
+
children: "Close"
|
|
246
|
+
})]
|
|
247
|
+
})]
|
|
248
|
+
})]
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
function Te({ className: e, ...t }) {
|
|
252
|
+
return /* @__PURE__ */ x("div", {
|
|
253
|
+
"data-slot": "dialog-header",
|
|
254
|
+
className: W("tg:flex tg:flex-col tg:gap-2 tg:text-center tg:sm:text-left", e),
|
|
255
|
+
...t
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
function Ee({ className: e, ...t }) {
|
|
259
|
+
return /* @__PURE__ */ x("div", {
|
|
260
|
+
"data-slot": "dialog-footer",
|
|
261
|
+
className: W("tg:flex tg:flex-col-reverse tg:gap-2 tg:sm:flex-row tg:sm:justify-end", e),
|
|
262
|
+
...t
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
function De({ className: e, ...t }) {
|
|
266
|
+
return /* @__PURE__ */ x(R.Title, {
|
|
267
|
+
"data-slot": "dialog-title",
|
|
268
|
+
className: W("tg:font-semibold tg:text-lg tg:leading-none", e),
|
|
269
|
+
...t
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
function Oe({ className: e, ...t }) {
|
|
273
|
+
return /* @__PURE__ */ x(R.Description, {
|
|
274
|
+
"data-slot": "dialog-description",
|
|
275
|
+
className: W("tg:text-muted-foreground tg:text-sm", e),
|
|
276
|
+
...t
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
//#endregion
|
|
280
|
+
//#region src/shared/components/ui/command.tsx
|
|
281
|
+
function ke({ className: e, ...t }) {
|
|
282
|
+
return /* @__PURE__ */ x(L, {
|
|
283
|
+
"data-slot": "command",
|
|
284
|
+
className: W("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),
|
|
285
|
+
...t
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
function Ae({ className: e, ...t }) {
|
|
289
|
+
return /* @__PURE__ */ S("div", {
|
|
290
|
+
"data-slot": "command-input-wrapper",
|
|
291
|
+
className: "tg:flex tg:h-9 tg:items-center tg:gap-2 tg:border-b tg:px-3",
|
|
292
|
+
children: [/* @__PURE__ */ x(re, { className: "tg:size-4 tg:shrink-0 tg:opacity-50" }), /* @__PURE__ */ x(L.Input, {
|
|
293
|
+
"data-slot": "command-input",
|
|
294
|
+
className: W("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),
|
|
295
|
+
...t
|
|
296
|
+
})]
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
function je({ className: e, ...t }) {
|
|
300
|
+
return /* @__PURE__ */ x(L.List, {
|
|
301
|
+
"data-slot": "command-list",
|
|
302
|
+
className: W("tg:max-h-[300px] tg:scroll-py-1 tg:overflow-y-auto tg:overflow-x-hidden", e),
|
|
303
|
+
...t
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
function Me({ ...e }) {
|
|
307
|
+
return /* @__PURE__ */ x(L.Empty, {
|
|
308
|
+
"data-slot": "command-empty",
|
|
309
|
+
className: "tg:py-6 tg:text-center tg:text-sm",
|
|
310
|
+
...e
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
function Ne({ className: e, ...t }) {
|
|
314
|
+
return /* @__PURE__ */ x(L.Group, {
|
|
315
|
+
"data-slot": "command-group",
|
|
316
|
+
className: W("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),
|
|
317
|
+
...t
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
function Pe({ className: e, ...t }) {
|
|
321
|
+
return /* @__PURE__ */ x(L.Item, {
|
|
322
|
+
"data-slot": "command-item",
|
|
323
|
+
className: W("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),
|
|
324
|
+
...t
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
//#endregion
|
|
328
|
+
//#region src/renderer/features/TreegeRenderer/web/components/inputs/DefaultAddressInput.tsx
|
|
329
|
+
var Fe = async (e, t) => {
|
|
330
|
+
if (!e || e.trim().length < 3) return [];
|
|
331
|
+
try {
|
|
332
|
+
let n = await fetch(`https://nominatim.openstreetmap.org/search?q=${encodeURIComponent(e)}&format=jsonv2&addressdetails=1&limit=5`, { headers: {
|
|
333
|
+
Accept: "application/json",
|
|
334
|
+
"User-Agent": "Treege Renderer",
|
|
335
|
+
...t && { "Accept-Language": t }
|
|
336
|
+
} });
|
|
337
|
+
return n.ok ? (await n.json()).map((e) => ({
|
|
338
|
+
label: e.display_name,
|
|
339
|
+
value: e.display_name
|
|
340
|
+
})) : [];
|
|
341
|
+
} catch (e) {
|
|
342
|
+
return console.error("Nominatim fetch error:", e), [];
|
|
343
|
+
}
|
|
344
|
+
}, Ie = (e) => !e || e.trim().length < 3 ? Promise.resolve([]) : new Promise((t) => {
|
|
345
|
+
if (!window.google?.maps?.places) {
|
|
346
|
+
console.warn("Google Places SDK not loaded yet"), t([]);
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
new window.google.maps.places.AutocompleteService().getPlacePredictions({ input: e }, (e, n) => {
|
|
350
|
+
if (n !== google.maps.places.PlacesServiceStatus.OK || !e) {
|
|
351
|
+
console.warn("Google Places API status:", n), t([]);
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
t(e.map((e) => ({
|
|
355
|
+
label: e.description,
|
|
356
|
+
value: e.description
|
|
357
|
+
})));
|
|
358
|
+
});
|
|
359
|
+
}), Le = ({ node: e, value: t, setValue: n, error: r, label: i, placeholder: o, helperText: s, id: c, name: l }) => {
|
|
360
|
+
let [u, f] = y(""), [p, m] = y([]), [_, v] = y(!1), { googleApiKey: C, language: w } = a(), T = d(), E = h((e) => {
|
|
361
|
+
n(e.value), f(e.value), v(!1);
|
|
362
|
+
}, [n]);
|
|
363
|
+
g(() => {
|
|
364
|
+
if (!u || u.trim().length < 3) {
|
|
365
|
+
m([]);
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
let e = setTimeout(async () => {
|
|
369
|
+
m(C ? await Ie(u) : await Fe(u, w));
|
|
370
|
+
}, 300);
|
|
371
|
+
return () => clearTimeout(e);
|
|
372
|
+
}, [
|
|
373
|
+
u,
|
|
374
|
+
C,
|
|
375
|
+
w
|
|
376
|
+
]);
|
|
377
|
+
let D = h((e) => {
|
|
378
|
+
n(e), f(e), e.length >= 3 && v(!0);
|
|
379
|
+
}, [n]);
|
|
380
|
+
return /* @__PURE__ */ S(b, { children: [C && /* @__PURE__ */ x("script", {
|
|
381
|
+
async: !0,
|
|
382
|
+
src: `https://maps.googleapis.com/maps/api/js?key=${C}&libraries=places`
|
|
383
|
+
}), /* @__PURE__ */ S(K, {
|
|
384
|
+
className: "tg:mb-4",
|
|
385
|
+
children: [
|
|
386
|
+
/* @__PURE__ */ S(X, {
|
|
387
|
+
htmlFor: c,
|
|
388
|
+
children: [i || e.data.name, e.data.required && /* @__PURE__ */ x("span", {
|
|
389
|
+
className: "tg:text-red-500",
|
|
390
|
+
children: "*"
|
|
391
|
+
})]
|
|
392
|
+
}),
|
|
393
|
+
/* @__PURE__ */ S("div", {
|
|
394
|
+
className: "tg:relative",
|
|
395
|
+
children: [
|
|
396
|
+
/* @__PURE__ */ x(Y, {
|
|
397
|
+
type: "text",
|
|
398
|
+
id: c,
|
|
399
|
+
name: l,
|
|
400
|
+
value: t || "",
|
|
401
|
+
onChange: (e) => D(e.target.value),
|
|
402
|
+
onFocus: () => {
|
|
403
|
+
p.length > 0 && v(!0);
|
|
404
|
+
},
|
|
405
|
+
placeholder: o || T("renderer.defaultAddressInput.enterAddress"),
|
|
406
|
+
className: "tg:pr-10",
|
|
407
|
+
autoComplete: "off"
|
|
408
|
+
}),
|
|
409
|
+
/* @__PURE__ */ x(ne, { className: "tg:-translate-y-1/2 tg:pointer-events-none tg:absolute tg:top-1/2 tg:right-3 tg:h-4 tg:w-4 tg:text-muted-foreground" }),
|
|
410
|
+
_ && /* @__PURE__ */ x("div", {
|
|
411
|
+
className: "tg:absolute tg:z-50 tg:mt-1 tg:w-full tg:rounded-md tg:border tg:bg-popover tg:shadow-md",
|
|
412
|
+
children: /* @__PURE__ */ x(ke, { children: /* @__PURE__ */ S(je, { children: [/* @__PURE__ */ x(Me, { children: T("renderer.defaultAddressInput.noAddressesFound") }), /* @__PURE__ */ x(Ne, { children: p.map((e, t) => /* @__PURE__ */ S(Pe, {
|
|
413
|
+
value: e.value,
|
|
414
|
+
onSelect: () => E(e),
|
|
415
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
416
|
+
children: [/* @__PURE__ */ x(ne, { className: "tg:mr-2 tg:h-4 tg:w-4" }), e.label]
|
|
417
|
+
}, t)) })] }) })
|
|
418
|
+
})
|
|
419
|
+
]
|
|
420
|
+
}),
|
|
421
|
+
r && /* @__PURE__ */ x(J, { children: r }),
|
|
422
|
+
s && !r && /* @__PURE__ */ x(q, { children: s })
|
|
423
|
+
]
|
|
424
|
+
})] });
|
|
425
|
+
}, Re = ({ node: e, value: t, setValue: n, error: r, label: i, placeholder: a, helperText: o, id: s }) => {
|
|
426
|
+
let c = d(), [l, u] = y(!1), f = `${s}-trigger`, p = `${s}-error`, m = e.data.options || [], h = m.find((e) => e.value === t);
|
|
427
|
+
return /* @__PURE__ */ S(K, {
|
|
428
|
+
className: "tg:mb-4",
|
|
429
|
+
children: [
|
|
430
|
+
/* @__PURE__ */ S(X, {
|
|
431
|
+
htmlFor: f,
|
|
432
|
+
children: [i || e.data.name, e.data.required && /* @__PURE__ */ x("span", {
|
|
433
|
+
className: "tg:text-red-500",
|
|
434
|
+
children: "*"
|
|
435
|
+
})]
|
|
436
|
+
}),
|
|
437
|
+
/* @__PURE__ */ S(Z, {
|
|
438
|
+
open: l,
|
|
439
|
+
onOpenChange: u,
|
|
440
|
+
children: [/* @__PURE__ */ x(Q, {
|
|
441
|
+
asChild: !0,
|
|
442
|
+
children: /* @__PURE__ */ S(G, {
|
|
443
|
+
id: f,
|
|
444
|
+
variant: "outline",
|
|
445
|
+
role: "combobox",
|
|
446
|
+
"aria-expanded": l,
|
|
447
|
+
"aria-invalid": !!r || void 0,
|
|
448
|
+
"aria-describedby": r ? p : void 0,
|
|
449
|
+
className: "tg:w-full tg:justify-between tg:font-normal",
|
|
450
|
+
children: [t ? h?.label ? c(h.label) : t : a || c("renderer.defaultAutocompleteInput.selectOption"), /* @__PURE__ */ x(te, { className: "tg:ml-2 tg:size-4 tg:shrink-0 tg:opacity-50" })]
|
|
451
|
+
})
|
|
452
|
+
}), /* @__PURE__ */ x($, {
|
|
453
|
+
className: "tg:w-full tg:p-0",
|
|
454
|
+
align: "start",
|
|
455
|
+
children: /* @__PURE__ */ S(ke, { children: [/* @__PURE__ */ x(Ae, { placeholder: a || c("renderer.defaultAutocompleteInput.search") }), /* @__PURE__ */ S(je, { children: [/* @__PURE__ */ x(Me, { children: c("renderer.defaultAutocompleteInput.noResults") }), /* @__PURE__ */ x(Ne, { children: m.map((e) => /* @__PURE__ */ S(Pe, {
|
|
456
|
+
value: e.value,
|
|
457
|
+
disabled: e.disabled,
|
|
458
|
+
onSelect: (e) => {
|
|
459
|
+
n(e === t ? "" : e), u(!1);
|
|
460
|
+
},
|
|
461
|
+
children: [/* @__PURE__ */ x(C, { className: W("tg:mr-2 tg:size-4", t === e.value ? "tg:opacity-100" : "tg:opacity-0") }), c(e.label)]
|
|
462
|
+
}, e.value)) })] })] })
|
|
463
|
+
})]
|
|
464
|
+
}),
|
|
465
|
+
r && /* @__PURE__ */ x(J, {
|
|
466
|
+
id: p,
|
|
467
|
+
children: r
|
|
468
|
+
}),
|
|
469
|
+
o && !r && /* @__PURE__ */ x(q, { children: o })
|
|
470
|
+
]
|
|
471
|
+
});
|
|
472
|
+
}, ze = ({ node: e, value: t, setValue: n, error: r, label: i, helperText: a, id: o, name: s }) => {
|
|
473
|
+
let c = d();
|
|
474
|
+
if (e.data.options && e.data.options.length > 0) {
|
|
475
|
+
let l = Array.isArray(t) ? t.map(String) : [], u = (e, t) => {
|
|
476
|
+
n(t ? [...l, e] : l.filter((t) => t !== e));
|
|
477
|
+
};
|
|
478
|
+
return /* @__PURE__ */ S(K, {
|
|
479
|
+
className: "tg:mb-4",
|
|
480
|
+
children: [
|
|
481
|
+
/* @__PURE__ */ S(X, {
|
|
482
|
+
className: "tg:mb-1",
|
|
483
|
+
children: [i || e.data.name, e.data.required && /* @__PURE__ */ x("span", {
|
|
484
|
+
className: "tg:text-red-500",
|
|
485
|
+
children: "*"
|
|
486
|
+
})]
|
|
487
|
+
}),
|
|
488
|
+
/* @__PURE__ */ x("div", {
|
|
489
|
+
className: "tg:space-y-2",
|
|
490
|
+
children: e.data.options.map((e, t) => {
|
|
491
|
+
let n = c(e.description);
|
|
492
|
+
return /* @__PURE__ */ S("div", {
|
|
493
|
+
className: "tg:flex tg:items-start tg:gap-3",
|
|
494
|
+
children: [/* @__PURE__ */ x(le, {
|
|
495
|
+
id: `${o}-${e.value}`,
|
|
496
|
+
name: s,
|
|
497
|
+
checked: l.includes(String(e.value)),
|
|
498
|
+
onCheckedChange: (t) => u(String(e.value), !!t),
|
|
499
|
+
disabled: e.disabled,
|
|
500
|
+
className: "tg:mt-0.5"
|
|
501
|
+
}), /* @__PURE__ */ S("div", {
|
|
502
|
+
className: "tg:flex tg:flex-col",
|
|
503
|
+
children: [/* @__PURE__ */ x(X, {
|
|
504
|
+
htmlFor: `${o}-${e.value}`,
|
|
505
|
+
className: "tg:cursor-pointer tg:font-normal tg:text-sm",
|
|
506
|
+
children: c(e.label) ? c(e.label) : e.value
|
|
507
|
+
}), n && /* @__PURE__ */ x("span", {
|
|
508
|
+
className: "tg:text-muted-foreground tg:text-xs",
|
|
509
|
+
children: n
|
|
510
|
+
})]
|
|
511
|
+
})]
|
|
512
|
+
}, e.value + t);
|
|
513
|
+
})
|
|
514
|
+
}),
|
|
515
|
+
r && /* @__PURE__ */ x(J, { children: r }),
|
|
516
|
+
a && !r && /* @__PURE__ */ x(q, { children: a })
|
|
517
|
+
]
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
return /* @__PURE__ */ S(K, {
|
|
521
|
+
className: "tg:mb-4",
|
|
522
|
+
children: [/* @__PURE__ */ S("div", {
|
|
523
|
+
className: "tg:flex tg:items-center tg:gap-3",
|
|
524
|
+
children: [/* @__PURE__ */ x(le, {
|
|
525
|
+
id: o,
|
|
526
|
+
name: s,
|
|
527
|
+
checked: typeof t == "boolean" ? t : !1,
|
|
528
|
+
onCheckedChange: (e) => n(!!e)
|
|
529
|
+
}), /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ S(X, {
|
|
530
|
+
htmlFor: o,
|
|
531
|
+
className: "tg:cursor-pointer tg:font-medium tg:text-sm",
|
|
532
|
+
children: [i || e.data.name, e.data.required && /* @__PURE__ */ x("span", {
|
|
533
|
+
className: "tg:text-red-500",
|
|
534
|
+
children: "*"
|
|
535
|
+
})]
|
|
536
|
+
}), a && !r && /* @__PURE__ */ x(q, { children: a })] })]
|
|
537
|
+
}), r && /* @__PURE__ */ x(J, { children: r })]
|
|
538
|
+
});
|
|
539
|
+
};
|
|
540
|
+
//#endregion
|
|
541
|
+
//#region src/shared/components/ui/calendar.tsx
|
|
542
|
+
function Be({ className: e, classNames: t, showOutsideDays: n = !0, captionLayout: r = "label", buttonVariant: i = "ghost", formatters: a, components: o, ...s }) {
|
|
543
|
+
let c = z();
|
|
544
|
+
return /* @__PURE__ */ x(oe, {
|
|
545
|
+
showOutsideDays: n,
|
|
546
|
+
className: W("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),
|
|
547
|
+
captionLayout: r,
|
|
548
|
+
formatters: {
|
|
549
|
+
formatMonthDropdown: (e) => e.toLocaleString("default", { month: "short" }),
|
|
550
|
+
...a
|
|
551
|
+
},
|
|
552
|
+
classNames: {
|
|
553
|
+
button_next: W(ce({ variant: i }), "tg:size-(--cell-size) tg:aria-disabled:opacity-50 tg:p-0 tg:select-none", c.button_next),
|
|
554
|
+
button_previous: W(ce({ variant: i }), "tg:size-(--cell-size) tg:aria-disabled:opacity-50 tg:p-0 tg:select-none", c.button_previous),
|
|
555
|
+
caption_label: W("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),
|
|
556
|
+
day: W("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),
|
|
557
|
+
disabled: W("tg:text-muted-foreground tg:opacity-50", c.disabled),
|
|
558
|
+
dropdown: W("tg:absolute tg:bg-popover tg:inset-0 tg:opacity-0", c.dropdown),
|
|
559
|
+
dropdown_root: W("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),
|
|
560
|
+
dropdowns: W("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),
|
|
561
|
+
hidden: W("tg:invisible", c.hidden),
|
|
562
|
+
month: W("tg:flex tg:flex-col tg:w-full tg:gap-4", c.month),
|
|
563
|
+
month_caption: W("tg:flex tg:items-center tg:justify-center tg:h-(--cell-size) tg:w-full tg:px-(--cell-size)", c.month_caption),
|
|
564
|
+
months: W("tg:flex tg:gap-4 tg:flex-col tg:md:flex-row tg:relative", c.months),
|
|
565
|
+
nav: W("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),
|
|
566
|
+
outside: W("tg:text-muted-foreground tg:aria-selected:text-muted-foreground", c.outside),
|
|
567
|
+
range_end: W("tg:rounded-r-md tg:bg-accent", c.range_end),
|
|
568
|
+
range_middle: W("tg:rounded-none", c.range_middle),
|
|
569
|
+
range_start: W("tg:rounded-l-md tg:bg-accent", c.range_start),
|
|
570
|
+
root: W("tg:w-fit", c.root),
|
|
571
|
+
table: "tg:w-full tg:border-collapse",
|
|
572
|
+
today: W("tg:bg-accent tg:text-accent-foreground tg:rounded-md tg:data-[selected=true]:rounded-none", c.today),
|
|
573
|
+
week: W("tg:flex tg:w-full tg:mt-2", c.week),
|
|
574
|
+
week_number: W("tg:text-[0.8rem] tg:select-none tg:text-muted-foreground", c.week_number),
|
|
575
|
+
week_number_header: W("tg:select-none tg:w-(--cell-size)", c.week_number_header),
|
|
576
|
+
weekday: W("tg:text-muted-foreground tg:rounded-md tg:flex-1 tg:font-normal tg:text-[0.8rem] tg:select-none", c.weekday),
|
|
577
|
+
weekdays: W("tg:flex", c.weekdays),
|
|
578
|
+
...t
|
|
579
|
+
},
|
|
580
|
+
components: {
|
|
581
|
+
Chevron: ({ className: e, orientation: t, ...n }) => x(t === "left" ? E : t === "right" ? D : T, {
|
|
582
|
+
className: W("tg:size-4", e),
|
|
583
|
+
...n
|
|
584
|
+
}),
|
|
585
|
+
DayButton: Ve,
|
|
586
|
+
Root: ({ className: e, rootRef: t, ...n }) => /* @__PURE__ */ x("div", {
|
|
587
|
+
"data-slot": "calendar",
|
|
588
|
+
ref: t,
|
|
589
|
+
className: W(e),
|
|
590
|
+
...n
|
|
591
|
+
}),
|
|
592
|
+
WeekNumber: ({ children: e, ...t }) => /* @__PURE__ */ x("td", {
|
|
593
|
+
...t,
|
|
594
|
+
children: /* @__PURE__ */ x("div", {
|
|
595
|
+
className: "tg:flex tg:size-(--cell-size) tg:items-center tg:justify-center tg:text-center",
|
|
596
|
+
children: e
|
|
597
|
+
})
|
|
598
|
+
}),
|
|
599
|
+
...o
|
|
600
|
+
},
|
|
601
|
+
...s
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
function Ve({ className: e, day: t, modifiers: n, ...r }) {
|
|
605
|
+
let i = z(), a = p.useRef(null);
|
|
606
|
+
return p.useEffect(() => {
|
|
607
|
+
n.focused && a.current?.focus();
|
|
608
|
+
}, [n.focused]), /* @__PURE__ */ x(G, {
|
|
609
|
+
ref: a,
|
|
610
|
+
variant: "ghost",
|
|
611
|
+
size: "icon",
|
|
612
|
+
"data-day": t.date.toLocaleDateString(),
|
|
613
|
+
"data-selected-single": n.selected && !n.range_start && !n.range_end && !n.range_middle,
|
|
614
|
+
"data-range-start": n.range_start,
|
|
615
|
+
"data-range-end": n.range_end,
|
|
616
|
+
"data-range-middle": n.range_middle,
|
|
617
|
+
className: W("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),
|
|
618
|
+
...r
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
//#endregion
|
|
622
|
+
//#region src/renderer/features/TreegeRenderer/web/components/inputs/DefaultDateInput.tsx
|
|
623
|
+
var He = ({ node: e, value: t, setValue: n, error: r, label: i, placeholder: a, helperText: o, id: s, name: c }) => {
|
|
624
|
+
let [l, u] = y(!1), f = d(), p = t ? new Date(t) : void 0;
|
|
625
|
+
return /* @__PURE__ */ S(K, {
|
|
626
|
+
className: "tg:mb-4",
|
|
627
|
+
children: [
|
|
628
|
+
/* @__PURE__ */ S(X, {
|
|
629
|
+
htmlFor: s,
|
|
630
|
+
children: [i || e.data.name, e.data.required && /* @__PURE__ */ x("span", {
|
|
631
|
+
className: "tg:text-red-500",
|
|
632
|
+
children: "*"
|
|
633
|
+
})]
|
|
634
|
+
}),
|
|
635
|
+
/* @__PURE__ */ S(Z, {
|
|
636
|
+
open: l,
|
|
637
|
+
onOpenChange: u,
|
|
638
|
+
children: [/* @__PURE__ */ x(Q, {
|
|
639
|
+
asChild: !0,
|
|
640
|
+
children: /* @__PURE__ */ S(G, {
|
|
641
|
+
variant: "outline",
|
|
642
|
+
id: s,
|
|
643
|
+
name: c,
|
|
644
|
+
className: "tg:w-full tg:justify-between tg:font-normal",
|
|
645
|
+
children: [p ? p.toLocaleDateString() : a || f("renderer.defaultInputs.selectDate"), /* @__PURE__ */ x(T, { className: "tg:size-4" })]
|
|
646
|
+
})
|
|
647
|
+
}), /* @__PURE__ */ x($, {
|
|
648
|
+
className: "tg:w-auto tg:overflow-hidden tg:p-0",
|
|
649
|
+
align: "start",
|
|
650
|
+
children: /* @__PURE__ */ x(Be, {
|
|
651
|
+
mode: "single",
|
|
652
|
+
selected: p,
|
|
653
|
+
captionLayout: "dropdown",
|
|
654
|
+
disabled: (t) => {
|
|
655
|
+
if (e.data.disablePast) {
|
|
656
|
+
let e = /* @__PURE__ */ new Date();
|
|
657
|
+
return e.setHours(0, 0, 0, 0), t < e;
|
|
658
|
+
}
|
|
659
|
+
return !1;
|
|
660
|
+
},
|
|
661
|
+
onSelect: (e) => {
|
|
662
|
+
n(e ? e.toISOString() : ""), u(!1);
|
|
663
|
+
}
|
|
664
|
+
})
|
|
665
|
+
})]
|
|
666
|
+
}),
|
|
667
|
+
r && /* @__PURE__ */ x(J, { children: r }),
|
|
668
|
+
o && !r && /* @__PURE__ */ x(q, { children: o })
|
|
669
|
+
]
|
|
670
|
+
});
|
|
671
|
+
}, Ue = ({ node: e, value: t, setValue: n, error: r, label: i, helperText: a, id: o }) => {
|
|
672
|
+
let [s, c] = y(!1), l = d(), u = Array.isArray(t) ? t : [], f = u[0] ? new Date(u[0]) : void 0, p = u[1] ? new Date(u[1]) : void 0;
|
|
673
|
+
return /* @__PURE__ */ S(K, {
|
|
674
|
+
className: "tg:mb-4",
|
|
675
|
+
children: [
|
|
676
|
+
/* @__PURE__ */ S(X, {
|
|
677
|
+
htmlFor: o,
|
|
678
|
+
children: [i || e.data.name, e.data.required && /* @__PURE__ */ x("span", {
|
|
679
|
+
className: "tg:text-red-500",
|
|
680
|
+
children: "*"
|
|
681
|
+
})]
|
|
682
|
+
}),
|
|
683
|
+
/* @__PURE__ */ S(Z, {
|
|
684
|
+
open: s,
|
|
685
|
+
onOpenChange: c,
|
|
686
|
+
children: [/* @__PURE__ */ x(Q, {
|
|
687
|
+
asChild: !0,
|
|
688
|
+
children: /* @__PURE__ */ S(G, {
|
|
689
|
+
id: o,
|
|
690
|
+
variant: "outline",
|
|
691
|
+
className: "tg:w-full tg:justify-between tg:font-normal",
|
|
692
|
+
children: [f && p ? `${f.toLocaleDateString()} - ${p.toLocaleDateString()}` : f ? f.toLocaleDateString() : l("renderer.defaultInputs.selectDateRange"), /* @__PURE__ */ x(T, { className: "tg:size-4" })]
|
|
693
|
+
})
|
|
694
|
+
}), /* @__PURE__ */ x($, {
|
|
695
|
+
className: "tg:w-auto tg:overflow-hidden tg:p-0",
|
|
696
|
+
align: "start",
|
|
697
|
+
children: /* @__PURE__ */ x(Be, {
|
|
698
|
+
mode: "range",
|
|
699
|
+
selected: {
|
|
700
|
+
from: f,
|
|
701
|
+
to: p
|
|
702
|
+
},
|
|
703
|
+
captionLayout: "dropdown",
|
|
704
|
+
disabled: (t) => {
|
|
705
|
+
if (e.data.disablePast) {
|
|
706
|
+
let e = /* @__PURE__ */ new Date();
|
|
707
|
+
return e.setHours(0, 0, 0, 0), t < e;
|
|
708
|
+
}
|
|
709
|
+
return !1;
|
|
710
|
+
},
|
|
711
|
+
onSelect: (e) => {
|
|
712
|
+
n([e?.from ? e.from.toISOString() : void 0, e?.to ? e.to.toISOString() : void 0]);
|
|
713
|
+
},
|
|
714
|
+
numberOfMonths: 2
|
|
715
|
+
})
|
|
716
|
+
})]
|
|
717
|
+
}),
|
|
718
|
+
r && /* @__PURE__ */ x(J, { children: r }),
|
|
719
|
+
a && !r && /* @__PURE__ */ x(q, { children: a })
|
|
720
|
+
]
|
|
721
|
+
});
|
|
722
|
+
}, We = ({ node: e, setValue: t, error: r, label: i, placeholder: a, helperText: o, name: s, id: c }) => /* @__PURE__ */ S(K, {
|
|
723
|
+
className: "tg:mb-4",
|
|
724
|
+
children: [
|
|
725
|
+
/* @__PURE__ */ S(X, {
|
|
726
|
+
htmlFor: c,
|
|
727
|
+
children: [i || e.data.name, e.data.required && /* @__PURE__ */ x("span", {
|
|
728
|
+
className: "tg:text-red-500",
|
|
729
|
+
children: "*"
|
|
730
|
+
})]
|
|
731
|
+
}),
|
|
732
|
+
/* @__PURE__ */ x(Y, {
|
|
733
|
+
type: "file",
|
|
734
|
+
name: s,
|
|
735
|
+
id: c,
|
|
736
|
+
onChange: async (r) => {
|
|
737
|
+
let { files: i } = r.target;
|
|
738
|
+
if (!i || i.length === 0) {
|
|
739
|
+
t(null);
|
|
740
|
+
return;
|
|
741
|
+
}
|
|
742
|
+
if (e.data.multiple) {
|
|
743
|
+
t(await n(Array.from(i)));
|
|
744
|
+
return;
|
|
745
|
+
}
|
|
746
|
+
t(await l(i[0]));
|
|
747
|
+
},
|
|
748
|
+
multiple: e.data.multiple,
|
|
749
|
+
placeholder: a
|
|
750
|
+
}),
|
|
751
|
+
r && /* @__PURE__ */ x(J, { children: r }),
|
|
752
|
+
o && !r && /* @__PURE__ */ x(q, { children: o })
|
|
753
|
+
]
|
|
754
|
+
}), Ge = ({ value: e, name: t, id: n }) => /* @__PURE__ */ x(Y, {
|
|
755
|
+
type: "hidden",
|
|
756
|
+
id: n,
|
|
757
|
+
name: t,
|
|
758
|
+
value: e ?? ""
|
|
759
|
+
});
|
|
760
|
+
//#endregion
|
|
761
|
+
//#region src/shared/components/ui/tooltip.tsx
|
|
762
|
+
function Ke({ delayDuration: e = 0, ...t }) {
|
|
763
|
+
return /* @__PURE__ */ x(B.Provider, {
|
|
764
|
+
"data-slot": "tooltip-provider",
|
|
765
|
+
delayDuration: e,
|
|
766
|
+
...t
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
function qe({ ...e }) {
|
|
770
|
+
return /* @__PURE__ */ x(Ke, { children: /* @__PURE__ */ x(B.Root, {
|
|
771
|
+
"data-slot": "tooltip",
|
|
772
|
+
...e
|
|
773
|
+
}) });
|
|
774
|
+
}
|
|
775
|
+
function Je({ ...e }) {
|
|
776
|
+
return /* @__PURE__ */ x(B.Trigger, {
|
|
777
|
+
"data-slot": "tooltip-trigger",
|
|
778
|
+
...e
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
function Ye({ className: e, sideOffset: t = 0, children: n, ...r }) {
|
|
782
|
+
return /* @__PURE__ */ x(B.Portal, { children: /* @__PURE__ */ S(B.Content, {
|
|
783
|
+
"data-slot": "tooltip-content",
|
|
784
|
+
sideOffset: t,
|
|
785
|
+
className: W("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-50 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),
|
|
786
|
+
...r,
|
|
787
|
+
children: [n, /* @__PURE__ */ x(B.Arrow, { className: "tg:z-50 tg:size-2.5 tg:translate-y-[calc(-50%_-_2px)] tg:rotate-45 tg:rounded-[2px] tg:bg-foreground tg:fill-foreground" })]
|
|
788
|
+
}) });
|
|
789
|
+
}
|
|
790
|
+
//#endregion
|
|
791
|
+
//#region src/renderer/features/TreegeRenderer/web/components/inputs/DefaultHttpInput.tsx
|
|
792
|
+
var Xe = (e, t) => t ? t.split(".").reduce((e, t) => {
|
|
793
|
+
if (e == null) return;
|
|
794
|
+
let n = t.match(/^(\w+)\[(\d+)]$/);
|
|
795
|
+
if (n) {
|
|
796
|
+
let [, t, r] = n, i = e[t];
|
|
797
|
+
return Array.isArray(i) ? i[Number.parseInt(r, 10)] : i;
|
|
798
|
+
}
|
|
799
|
+
return e[t];
|
|
800
|
+
}, e) : e, Ze = (e) => {
|
|
801
|
+
let t = e.matchAll(/{{([\w-]+)}}/g);
|
|
802
|
+
return Array.from(t, (e) => e[1]);
|
|
803
|
+
}, Qe = (e, t) => Ze(e).every((e) => {
|
|
804
|
+
let n = t[e];
|
|
805
|
+
return n != null && n !== "";
|
|
806
|
+
}), $e = (e, t, n = !1) => e.replace(/{{([\w-]+)}}/g, (e, r) => {
|
|
807
|
+
let i = t[r], a = i == null ? "" : String(i);
|
|
808
|
+
return n ? encodeURIComponent(a) : a;
|
|
809
|
+
}), et = ({ node: t, value: n, setValue: i, error: o, label: s, placeholder: c, helperText: l, id: u, name: p }) => {
|
|
810
|
+
let [m, w] = y(!1), [T, E] = y(null), [D, ee] = y([]), [O, ne] = y(""), [re, ie] = y(!1), { formValues: A, inputNodes: j } = a(), M = d(), { httpConfig: N } = t.data, P = v(!1), ae = v(""), F = v(N), I = v(A), L = v(j), R = v(i), oe = v(null), z = v(null), B = _(() => N?.url ? Ze(N.url) : [], [N?.url]), V = B.length > 0, se = _(() => B.map((e) => `${e}:${String(A[e] ?? "")}`).join("|"), [B, A]), H = _(() => N?.url ? V ? Qe(N.url, A) : !0 : !1, [
|
|
811
|
+
N?.url,
|
|
812
|
+
V,
|
|
813
|
+
A
|
|
814
|
+
]), U = h(async (t) => {
|
|
815
|
+
z.current && z.current.abort();
|
|
816
|
+
let n = new AbortController();
|
|
817
|
+
z.current = n;
|
|
818
|
+
let i = F.current, a = I.current, o = R.current;
|
|
819
|
+
if (!i?.url) {
|
|
820
|
+
E(M("renderer.defaultHttpInput.noUrlConfigured")), z.current = null;
|
|
821
|
+
return;
|
|
822
|
+
}
|
|
823
|
+
if (i.url && !Qe(i.url, a)) {
|
|
824
|
+
z.current = null;
|
|
825
|
+
return;
|
|
826
|
+
}
|
|
827
|
+
w(!0), E(null);
|
|
828
|
+
try {
|
|
829
|
+
let s = $e(i.url, a, !0), c = i.searchParam && t ? `${s}${s.includes("?") ? "&" : "?"}${i.searchParam}=${encodeURIComponent(t)}` : s, l = {};
|
|
830
|
+
i.headers?.forEach((e) => {
|
|
831
|
+
l[e.key] = $e(e.value, a);
|
|
832
|
+
});
|
|
833
|
+
let u = [
|
|
834
|
+
"POST",
|
|
835
|
+
"PUT",
|
|
836
|
+
"PATCH"
|
|
837
|
+
].includes(i.method || "") ? i.sendAllFormValues ? JSON.stringify(e(a, L.current)) : i.body ? $e(i.body, a) : void 0 : void 0, d = setTimeout(() => n.abort(), 3e4), f = await fetch(c, {
|
|
838
|
+
body: u || void 0,
|
|
839
|
+
headers: {
|
|
840
|
+
"Content-Type": "application/json",
|
|
841
|
+
...l
|
|
842
|
+
},
|
|
843
|
+
method: i.method || "GET",
|
|
844
|
+
signal: n.signal
|
|
845
|
+
});
|
|
846
|
+
if (clearTimeout(d), !f.ok) {
|
|
847
|
+
E(`HTTP Error ${f.status}: ${f.statusText}`), w(!1);
|
|
848
|
+
return;
|
|
849
|
+
}
|
|
850
|
+
let p = r(await f.json()), m = i.responsePath ? Xe(p, i.responsePath) : p;
|
|
851
|
+
if (i.responseMapping && Array.isArray(m)) {
|
|
852
|
+
let { valueField: e = "value", labelField: t = "label" } = i.responseMapping;
|
|
853
|
+
ee(m.map((n) => ({
|
|
854
|
+
label: String(Xe(n, t) || ""),
|
|
855
|
+
value: String(Xe(n, e) || "")
|
|
856
|
+
})));
|
|
857
|
+
} else o(typeof m == "string" ? m : JSON.stringify(m));
|
|
858
|
+
} catch (e) {
|
|
859
|
+
if (e instanceof Error && e.name === "AbortError") return;
|
|
860
|
+
E(e instanceof Error ? e.message : M("renderer.defaultHttpInput.fetchFailed")), console.error("HTTP Input fetch error:", e);
|
|
861
|
+
} finally {
|
|
862
|
+
w(!1), z.current = null;
|
|
863
|
+
}
|
|
864
|
+
}, [M]);
|
|
865
|
+
if (g(() => {
|
|
866
|
+
F.current = N, I.current = A, L.current = j, R.current = i, oe.current = U;
|
|
867
|
+
}, [
|
|
868
|
+
N,
|
|
869
|
+
A,
|
|
870
|
+
j,
|
|
871
|
+
i,
|
|
872
|
+
U
|
|
873
|
+
]), g(() => () => {
|
|
874
|
+
z.current && z.current.abort();
|
|
875
|
+
}, []), g(() => {
|
|
876
|
+
if (P.current) return;
|
|
877
|
+
P.current = !0;
|
|
878
|
+
let e = F.current, t = I.current, n = oe.current, r = e?.url && Qe(e.url, t);
|
|
879
|
+
e?.fetchOnMount && r && n && (n(), e.url && (ae.current = Ze(e.url).map((e) => `${e}:${String(t[e] ?? "")}`).join("|")));
|
|
880
|
+
}, []), g(() => {
|
|
881
|
+
if (!P.current || !V || ae.current === se || !H) return;
|
|
882
|
+
let e = setTimeout(() => {
|
|
883
|
+
U(), ae.current = se;
|
|
884
|
+
}, 500);
|
|
885
|
+
return () => clearTimeout(e);
|
|
886
|
+
}, [
|
|
887
|
+
se,
|
|
888
|
+
V,
|
|
889
|
+
H,
|
|
890
|
+
U
|
|
891
|
+
]), g(() => {
|
|
892
|
+
if (!(N?.searchParam && O)) return;
|
|
893
|
+
let e = setTimeout(() => {
|
|
894
|
+
U(O);
|
|
895
|
+
}, 300);
|
|
896
|
+
return () => clearTimeout(e);
|
|
897
|
+
}, [
|
|
898
|
+
O,
|
|
899
|
+
N?.searchParam,
|
|
900
|
+
U
|
|
901
|
+
]), N?.responseMapping) {
|
|
902
|
+
let e = Array.isArray(n) ? n[0] : n, r = D.find((t) => t.value === e);
|
|
903
|
+
if (N.searchParam) {
|
|
904
|
+
let e = m && N?.showLoading ? /* @__PURE__ */ S("div", {
|
|
905
|
+
className: "tg:flex tg:items-center tg:gap-2",
|
|
906
|
+
children: [/* @__PURE__ */ x(k, { className: "tg:h-4 tg:w-4 tg:animate-spin" }), /* @__PURE__ */ x("span", {
|
|
907
|
+
className: "tg:text-muted-foreground",
|
|
908
|
+
children: r?.label || c || M("renderer.defaultHttpInput.search")
|
|
909
|
+
})]
|
|
910
|
+
}) : r?.label || c || M("renderer.defaultHttpInput.search");
|
|
911
|
+
return /* @__PURE__ */ S(K, {
|
|
912
|
+
className: "tg:mb-4",
|
|
913
|
+
children: [
|
|
914
|
+
/* @__PURE__ */ S(X, { children: [s || t.data.name, t.data.required && /* @__PURE__ */ x("span", {
|
|
915
|
+
className: "tg:text-red-500",
|
|
916
|
+
children: "*"
|
|
917
|
+
})] }),
|
|
918
|
+
/* @__PURE__ */ S(Z, {
|
|
919
|
+
open: re,
|
|
920
|
+
onOpenChange: ie,
|
|
921
|
+
children: [/* @__PURE__ */ x(Q, {
|
|
922
|
+
asChild: !0,
|
|
923
|
+
children: /* @__PURE__ */ S(G, {
|
|
924
|
+
variant: "outline",
|
|
925
|
+
role: "combobox",
|
|
926
|
+
"aria-expanded": re,
|
|
927
|
+
className: "tg:w-full tg:justify-between",
|
|
928
|
+
children: [e, /* @__PURE__ */ x(te, { className: "tg:ml-2 tg:h-4 tg:w-4 tg:shrink-0 tg:opacity-50" })]
|
|
929
|
+
})
|
|
930
|
+
}), /* @__PURE__ */ x($, {
|
|
931
|
+
className: "tg:w-[300px] tg:p-0",
|
|
932
|
+
align: "start",
|
|
933
|
+
children: /* @__PURE__ */ S(ke, {
|
|
934
|
+
shouldFilter: !1,
|
|
935
|
+
children: [/* @__PURE__ */ x(Ae, {
|
|
936
|
+
placeholder: M("renderer.defaultHttpInput.search"),
|
|
937
|
+
value: O,
|
|
938
|
+
onValueChange: (e) => {
|
|
939
|
+
ne(e), E(null);
|
|
940
|
+
}
|
|
941
|
+
}), /* @__PURE__ */ S(je, { children: [
|
|
942
|
+
m && /* @__PURE__ */ x("div", {
|
|
943
|
+
className: "tg:flex tg:items-center tg:justify-center tg:p-4",
|
|
944
|
+
children: /* @__PURE__ */ x(k, { className: "tg:h-4 tg:w-4 tg:animate-spin" })
|
|
945
|
+
}),
|
|
946
|
+
!m && T && /* @__PURE__ */ S("div", {
|
|
947
|
+
className: "tg:p-4 tg:text-destructive tg:text-sm",
|
|
948
|
+
children: [/* @__PURE__ */ x("div", { children: T }), /* @__PURE__ */ x("button", {
|
|
949
|
+
type: "button",
|
|
950
|
+
onClick: () => U(O),
|
|
951
|
+
className: "tg:mt-2 tg:block tg:text-primary tg:hover:underline",
|
|
952
|
+
children: M("renderer.defaultHttpInput.retry")
|
|
953
|
+
})]
|
|
954
|
+
}),
|
|
955
|
+
!(m || T) && /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(Me, { children: M("renderer.defaultHttpInput.noResults") }), /* @__PURE__ */ x(Ne, { children: D.map((e) => /* @__PURE__ */ S(Pe, {
|
|
956
|
+
value: e.value,
|
|
957
|
+
onSelect: () => {
|
|
958
|
+
i(e.value), ie(!1);
|
|
959
|
+
},
|
|
960
|
+
children: [/* @__PURE__ */ x(C, { className: W("tg:mr-2 tg:h-4 tg:w-4", n === e.value ? "tg:opacity-100" : "tg:opacity-0") }), e.label]
|
|
961
|
+
}, e.value)) })] })
|
|
962
|
+
] })]
|
|
963
|
+
})
|
|
964
|
+
})]
|
|
965
|
+
}),
|
|
966
|
+
o && /* @__PURE__ */ x(J, { children: o }),
|
|
967
|
+
l && !o && /* @__PURE__ */ x(q, { children: l })
|
|
968
|
+
]
|
|
969
|
+
});
|
|
970
|
+
}
|
|
971
|
+
let a = m && N?.showLoading, d = B.filter((e) => {
|
|
972
|
+
let t = A[e];
|
|
973
|
+
return t == null || t === "";
|
|
974
|
+
}), h = d.map((e) => f(e, j) || e), g = D.length === 0 && !a ? T || (d.length > 0 ? `${M("renderer.defaultHttpInput.waitingForRequiredFields")}: ${h.join(", ")}` : M("renderer.defaultHttpInput.noDataAvailable")) : void 0, _ = /* @__PURE__ */ S(ue, {
|
|
975
|
+
value: Array.isArray(n) ? n[0] ?? "" : n ?? "",
|
|
976
|
+
onValueChange: (e) => i(e),
|
|
977
|
+
disabled: a || D.length === 0,
|
|
978
|
+
name: p,
|
|
979
|
+
children: [/* @__PURE__ */ S(pe, {
|
|
980
|
+
id: u,
|
|
981
|
+
name: p,
|
|
982
|
+
className: "tg:w-full",
|
|
983
|
+
children: [a && /* @__PURE__ */ x(k, { className: "tg:mr-2 tg:h-4 tg:w-4 tg:animate-spin" }), /* @__PURE__ */ x(fe, { placeholder: c || M("renderer.defaultHttpInput.selectOption") })]
|
|
984
|
+
}), /* @__PURE__ */ x(me, { children: /* @__PURE__ */ x(de, { children: D.map((e, t) => /* @__PURE__ */ x(ge, {
|
|
985
|
+
value: e.value,
|
|
986
|
+
children: e.label
|
|
987
|
+
}, e.value + t)) }) })]
|
|
988
|
+
});
|
|
989
|
+
return /* @__PURE__ */ S(K, {
|
|
990
|
+
className: "tg:mb-4",
|
|
991
|
+
children: [
|
|
992
|
+
/* @__PURE__ */ S(X, {
|
|
993
|
+
htmlFor: u,
|
|
994
|
+
children: [s || t.data.name, t.data.required && /* @__PURE__ */ x("span", {
|
|
995
|
+
className: "tg:text-red-500",
|
|
996
|
+
children: "*"
|
|
997
|
+
})]
|
|
998
|
+
}),
|
|
999
|
+
g ? /* @__PURE__ */ x(Ke, { children: /* @__PURE__ */ S(qe, { children: [/* @__PURE__ */ x(Je, {
|
|
1000
|
+
asChild: !0,
|
|
1001
|
+
children: /* @__PURE__ */ x("div", {
|
|
1002
|
+
className: "tg:w-full",
|
|
1003
|
+
children: _
|
|
1004
|
+
})
|
|
1005
|
+
}), /* @__PURE__ */ x(Ye, { children: /* @__PURE__ */ x("p", { children: g }) })] }) }) : _,
|
|
1006
|
+
o && /* @__PURE__ */ x(J, { children: o }),
|
|
1007
|
+
l && !o && /* @__PURE__ */ x(q, { children: l })
|
|
1008
|
+
]
|
|
1009
|
+
});
|
|
1010
|
+
}
|
|
1011
|
+
return /* @__PURE__ */ S(K, {
|
|
1012
|
+
className: "tg:mb-4",
|
|
1013
|
+
children: [
|
|
1014
|
+
/* @__PURE__ */ S(X, {
|
|
1015
|
+
htmlFor: u,
|
|
1016
|
+
children: [s || t.data.name, t.data.required && /* @__PURE__ */ x("span", {
|
|
1017
|
+
className: "tg:text-red-500",
|
|
1018
|
+
children: "*"
|
|
1019
|
+
})]
|
|
1020
|
+
}),
|
|
1021
|
+
/* @__PURE__ */ x(Y, {
|
|
1022
|
+
type: "text",
|
|
1023
|
+
name: p,
|
|
1024
|
+
id: u,
|
|
1025
|
+
value: typeof n == "string" ? n : JSON.stringify(n),
|
|
1026
|
+
readOnly: !0,
|
|
1027
|
+
disabled: !0
|
|
1028
|
+
}),
|
|
1029
|
+
o && /* @__PURE__ */ x(J, { children: o }),
|
|
1030
|
+
l && !o && /* @__PURE__ */ x(q, { children: l })
|
|
1031
|
+
]
|
|
1032
|
+
});
|
|
1033
|
+
}, tt = ({ node: e, value: t, setValue: n, error: r, label: i, placeholder: a, helperText: o, name: s, id: c }) => /* @__PURE__ */ S(K, {
|
|
1034
|
+
className: "tg:mb-4",
|
|
1035
|
+
children: [
|
|
1036
|
+
/* @__PURE__ */ S(X, {
|
|
1037
|
+
htmlFor: c,
|
|
1038
|
+
children: [i || e.data.name, e.data.required && /* @__PURE__ */ x("span", {
|
|
1039
|
+
className: "tg:text-red-500",
|
|
1040
|
+
children: "*"
|
|
1041
|
+
})]
|
|
1042
|
+
}),
|
|
1043
|
+
/* @__PURE__ */ x(Y, {
|
|
1044
|
+
id: c,
|
|
1045
|
+
type: "number",
|
|
1046
|
+
name: s,
|
|
1047
|
+
value: t ?? "",
|
|
1048
|
+
onChange: (e) => n(e.target.value === "" ? null : Number(e.target.value)),
|
|
1049
|
+
placeholder: a
|
|
1050
|
+
}),
|
|
1051
|
+
r && /* @__PURE__ */ x(J, { children: r }),
|
|
1052
|
+
o && !r && /* @__PURE__ */ x(q, { children: o })
|
|
1053
|
+
]
|
|
1054
|
+
}), nt = ({ node: e, value: t, setValue: n, error: r, label: i, placeholder: a, helperText: o, name: s, id: c }) => /* @__PURE__ */ S(K, {
|
|
1055
|
+
className: "tg:mb-4",
|
|
1056
|
+
children: [
|
|
1057
|
+
/* @__PURE__ */ S(X, {
|
|
1058
|
+
htmlFor: c,
|
|
1059
|
+
children: [i || e.data.name, e.data.required && /* @__PURE__ */ x("span", {
|
|
1060
|
+
className: "tg:text-red-500",
|
|
1061
|
+
children: "*"
|
|
1062
|
+
})]
|
|
1063
|
+
}),
|
|
1064
|
+
/* @__PURE__ */ x(Y, {
|
|
1065
|
+
id: c,
|
|
1066
|
+
name: s,
|
|
1067
|
+
type: "password",
|
|
1068
|
+
value: t ?? "",
|
|
1069
|
+
onChange: (e) => n(e.target.value),
|
|
1070
|
+
placeholder: a,
|
|
1071
|
+
autoComplete: "new-password"
|
|
1072
|
+
}),
|
|
1073
|
+
r && /* @__PURE__ */ x(J, { children: r }),
|
|
1074
|
+
o && !r && /* @__PURE__ */ x(q, { children: o })
|
|
1075
|
+
]
|
|
1076
|
+
});
|
|
1077
|
+
//#endregion
|
|
1078
|
+
//#region src/shared/components/ui/radio-group.tsx
|
|
1079
|
+
function rt({ className: e, ...t }) {
|
|
1080
|
+
return /* @__PURE__ */ x(V.Root, {
|
|
1081
|
+
"data-slot": "radio-group",
|
|
1082
|
+
className: W("tg:grid tg:gap-3", e),
|
|
1083
|
+
...t
|
|
1084
|
+
});
|
|
1085
|
+
}
|
|
1086
|
+
function it({ className: e, ...t }) {
|
|
1087
|
+
return /* @__PURE__ */ x(V.Item, {
|
|
1088
|
+
"data-slot": "radio-group-item",
|
|
1089
|
+
className: W("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),
|
|
1090
|
+
...t,
|
|
1091
|
+
children: /* @__PURE__ */ x(V.Indicator, {
|
|
1092
|
+
"data-slot": "radio-group-indicator",
|
|
1093
|
+
className: "tg:relative tg:flex tg:items-center tg:justify-center",
|
|
1094
|
+
children: /* @__PURE__ */ x(O, { 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" })
|
|
1095
|
+
})
|
|
1096
|
+
});
|
|
1097
|
+
}
|
|
1098
|
+
//#endregion
|
|
1099
|
+
//#region src/renderer/features/TreegeRenderer/web/components/inputs/DefaultRadioInput.tsx
|
|
1100
|
+
var at = ({ node: e, value: t, setValue: n, error: r, label: i, helperText: a, id: o, name: s }) => {
|
|
1101
|
+
let c = d(), l = t ? String(t) : "", u = e.data.variant === "card";
|
|
1102
|
+
return /* @__PURE__ */ S(K, {
|
|
1103
|
+
className: "tg:mb-4",
|
|
1104
|
+
children: [
|
|
1105
|
+
/* @__PURE__ */ S(X, {
|
|
1106
|
+
className: "tg:mb-1",
|
|
1107
|
+
htmlFor: o,
|
|
1108
|
+
children: [i || e.data.name, e.data.required && /* @__PURE__ */ x("span", {
|
|
1109
|
+
className: "tg:text-red-500",
|
|
1110
|
+
children: "*"
|
|
1111
|
+
})]
|
|
1112
|
+
}),
|
|
1113
|
+
/* @__PURE__ */ x(rt, {
|
|
1114
|
+
value: l,
|
|
1115
|
+
onValueChange: (e) => n(e),
|
|
1116
|
+
id: o,
|
|
1117
|
+
name: s,
|
|
1118
|
+
className: u ? "tg:flex tg:flex-col tg:gap-2" : void 0,
|
|
1119
|
+
children: e.data.options?.map((e, t) => {
|
|
1120
|
+
let n = `${o}-${e.value}`, r = c(e.label) || e.value, i = c(e.description), a = l === String(e.value);
|
|
1121
|
+
return u ? /* @__PURE__ */ S(X, {
|
|
1122
|
+
htmlFor: n,
|
|
1123
|
+
className: W("tg:flex tg:cursor-pointer tg:items-start tg:gap-3 tg:rounded-md tg:border tg:p-3 tg:transition-colors", "tg:hover:border-primary/50", a && "tg:border-primary tg:bg-primary/5", e.disabled && "tg:pointer-events-none tg:opacity-50"),
|
|
1124
|
+
children: [
|
|
1125
|
+
/* @__PURE__ */ x(it, {
|
|
1126
|
+
value: String(e.value),
|
|
1127
|
+
id: n,
|
|
1128
|
+
disabled: e.disabled,
|
|
1129
|
+
className: "tg:mt-1"
|
|
1130
|
+
}),
|
|
1131
|
+
e.image && /* @__PURE__ */ x("img", {
|
|
1132
|
+
src: e.image,
|
|
1133
|
+
alt: "",
|
|
1134
|
+
className: "tg:h-10 tg:w-10 tg:shrink-0 tg:rounded tg:object-cover"
|
|
1135
|
+
}),
|
|
1136
|
+
/* @__PURE__ */ S("div", {
|
|
1137
|
+
className: "tg:flex tg:min-w-0 tg:flex-col",
|
|
1138
|
+
children: [/* @__PURE__ */ x("span", {
|
|
1139
|
+
className: "tg:font-medium tg:text-sm",
|
|
1140
|
+
children: r
|
|
1141
|
+
}), i && /* @__PURE__ */ x("span", {
|
|
1142
|
+
className: "tg:text-muted-foreground tg:text-xs",
|
|
1143
|
+
children: i
|
|
1144
|
+
})]
|
|
1145
|
+
})
|
|
1146
|
+
]
|
|
1147
|
+
}, e.value + t) : /* @__PURE__ */ S("div", {
|
|
1148
|
+
className: "tg:flex tg:items-start tg:space-x-2",
|
|
1149
|
+
children: [
|
|
1150
|
+
/* @__PURE__ */ x(it, {
|
|
1151
|
+
value: String(e.value),
|
|
1152
|
+
id: n,
|
|
1153
|
+
disabled: e.disabled,
|
|
1154
|
+
className: "tg:mt-0.5"
|
|
1155
|
+
}),
|
|
1156
|
+
e.image && /* @__PURE__ */ x("img", {
|
|
1157
|
+
src: e.image,
|
|
1158
|
+
alt: "",
|
|
1159
|
+
className: "tg:h-8 tg:w-8 tg:rounded tg:object-cover"
|
|
1160
|
+
}),
|
|
1161
|
+
/* @__PURE__ */ S("div", {
|
|
1162
|
+
className: "tg:flex tg:flex-col",
|
|
1163
|
+
children: [/* @__PURE__ */ x(X, {
|
|
1164
|
+
htmlFor: n,
|
|
1165
|
+
className: "tg:cursor-pointer tg:font-normal tg:text-sm",
|
|
1166
|
+
children: r
|
|
1167
|
+
}), i && /* @__PURE__ */ x("span", {
|
|
1168
|
+
className: "tg:text-muted-foreground tg:text-xs",
|
|
1169
|
+
children: i
|
|
1170
|
+
})]
|
|
1171
|
+
})
|
|
1172
|
+
]
|
|
1173
|
+
}, e.value + t);
|
|
1174
|
+
})
|
|
1175
|
+
}),
|
|
1176
|
+
r && /* @__PURE__ */ x(J, { children: r }),
|
|
1177
|
+
a && !r && /* @__PURE__ */ x(q, { children: a })
|
|
1178
|
+
]
|
|
1179
|
+
});
|
|
1180
|
+
}, ot = ({ node: e, value: t, setValue: n, error: r, label: i, placeholder: a, helperText: o, name: s, id: c }) => {
|
|
1181
|
+
let l = d(), u = t ? String(t) : "";
|
|
1182
|
+
return /* @__PURE__ */ S(K, {
|
|
1183
|
+
className: "tg:mb-4",
|
|
1184
|
+
children: [
|
|
1185
|
+
/* @__PURE__ */ S(X, {
|
|
1186
|
+
htmlFor: c,
|
|
1187
|
+
children: [i || e.data.name, e.data.required && /* @__PURE__ */ x("span", {
|
|
1188
|
+
className: "tg:text-red-500",
|
|
1189
|
+
children: "*"
|
|
1190
|
+
})]
|
|
1191
|
+
}),
|
|
1192
|
+
/* @__PURE__ */ S(ue, {
|
|
1193
|
+
name: s,
|
|
1194
|
+
value: u,
|
|
1195
|
+
onValueChange: (e) => n(e),
|
|
1196
|
+
children: [/* @__PURE__ */ x(pe, {
|
|
1197
|
+
id: c,
|
|
1198
|
+
name: s,
|
|
1199
|
+
className: "tg:w-full",
|
|
1200
|
+
children: /* @__PURE__ */ x(fe, { placeholder: a || l("renderer.defaultSelectInput.selectOption") })
|
|
1201
|
+
}), /* @__PURE__ */ x(me, { children: /* @__PURE__ */ x(de, { children: e.data.options?.map((e, t) => /* @__PURE__ */ x(ge, {
|
|
1202
|
+
value: String(e.value),
|
|
1203
|
+
disabled: e.disabled,
|
|
1204
|
+
children: l(e.label) ? l(e.label) : e.value
|
|
1205
|
+
}, `${e.value}-${t}`)) }) })]
|
|
1206
|
+
}),
|
|
1207
|
+
r && /* @__PURE__ */ x(J, { children: r }),
|
|
1208
|
+
o && !r && /* @__PURE__ */ x(q, { children: o })
|
|
1209
|
+
]
|
|
1210
|
+
});
|
|
1211
|
+
}, st = ({ children: e, onSubmit: t }) => /* @__PURE__ */ x("form", {
|
|
1212
|
+
onSubmit: t,
|
|
1213
|
+
className: "tg:mx-auto tg:max-w-2xl tg:gap-y-3",
|
|
1214
|
+
children: e
|
|
1215
|
+
}), ct = ({ node: e, children: t }) => {
|
|
1216
|
+
let n = d()(e.data.label);
|
|
1217
|
+
return /* @__PURE__ */ S("section", {
|
|
1218
|
+
className: "tg:mb-6 tg:rounded-lg tg:border tg:p-4",
|
|
1219
|
+
children: [n && /* @__PURE__ */ x("h3", {
|
|
1220
|
+
className: "tg:mb-4 tg:font-semibold tg:text-lg",
|
|
1221
|
+
children: n
|
|
1222
|
+
}), t]
|
|
1223
|
+
});
|
|
1224
|
+
}, lt = m(({ label: e, id: t, disabled: n, onBlur: r, onClick: i, onFocus: a, onPointerDown: o, onPointerLeave: s, onPointerMove: c, ...l }, u) => {
|
|
1225
|
+
let f = d();
|
|
1226
|
+
return /* @__PURE__ */ x("button", {
|
|
1227
|
+
ref: u,
|
|
1228
|
+
id: t,
|
|
1229
|
+
onBlur: r,
|
|
1230
|
+
onClick: i,
|
|
1231
|
+
onFocus: a,
|
|
1232
|
+
onPointerDown: o,
|
|
1233
|
+
disabled: n,
|
|
1234
|
+
onPointerLeave: s,
|
|
1235
|
+
onPointerMove: c,
|
|
1236
|
+
type: "submit",
|
|
1237
|
+
className: "tg:mt-4 tg:rounded-md tg:bg-blue-500 tg:px-4 tg:py-2 tg:font-medium tg:text-white tg:transition-colors tg:hover:bg-blue-600 tg:focus:outline-none tg:focus:ring-2 tg:focus:ring-blue-500 tg:focus:ring-offset-2 tg:disabled:cursor-not-allowed tg:disabled:opacity-50",
|
|
1238
|
+
...l,
|
|
1239
|
+
children: e || f("renderer.defaultSubmitButton.submit")
|
|
1240
|
+
});
|
|
1241
|
+
});
|
|
1242
|
+
//#endregion
|
|
1243
|
+
//#region src/shared/components/ui/separator.tsx
|
|
1244
|
+
function ut({ className: e, orientation: t = "horizontal", decorative: n = !0, ...r }) {
|
|
1245
|
+
return /* @__PURE__ */ x(se.Root, {
|
|
1246
|
+
"data-slot": "separator",
|
|
1247
|
+
decorative: n,
|
|
1248
|
+
orientation: t,
|
|
1249
|
+
className: W("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),
|
|
1250
|
+
...r
|
|
1251
|
+
});
|
|
1252
|
+
}
|
|
1253
|
+
//#endregion
|
|
1254
|
+
//#region src/renderer/features/TreegeRenderer/web/components/DefaultUI.tsx
|
|
1255
|
+
var dt = ({ node: e }) => {
|
|
1256
|
+
let t = d()(e.data?.label);
|
|
1257
|
+
return t ? /* @__PURE__ */ S("div", {
|
|
1258
|
+
className: "tg:flex tg:items-center tg:gap-x-3",
|
|
1259
|
+
children: [
|
|
1260
|
+
/* @__PURE__ */ x(ut, { className: "tg:my-8 tg:flex-1" }),
|
|
1261
|
+
/* @__PURE__ */ x("h4", {
|
|
1262
|
+
className: "tg:font-semibold tg:text-sm",
|
|
1263
|
+
children: t
|
|
1264
|
+
}),
|
|
1265
|
+
/* @__PURE__ */ x(ut, { className: "tg:my-8 tg:flex-1" })
|
|
1266
|
+
]
|
|
1267
|
+
}) : /* @__PURE__ */ x(ut, { className: "tg:my-8" });
|
|
1268
|
+
}, ft = ({ node: e }) => {
|
|
1269
|
+
let { edges: n } = a(), r = d();
|
|
1270
|
+
return /* @__PURE__ */ x("h2", {
|
|
1271
|
+
className: W("tg:mb-5 tg:font-bold tg:text-2xl", !t(e.id, n) && "tg:mt-10"),
|
|
1272
|
+
children: r(e.data?.label)
|
|
1273
|
+
});
|
|
1274
|
+
}, pt = {
|
|
1275
|
+
divider: dt,
|
|
1276
|
+
title: ft
|
|
1277
|
+
}, mt = ({ children: e, missingFields: t = [] }) => {
|
|
1278
|
+
let n = t.length > 0, r = d();
|
|
1279
|
+
return n ? /* @__PURE__ */ x(Ke, { children: /* @__PURE__ */ S(qe, { children: [/* @__PURE__ */ x(Je, {
|
|
1280
|
+
asChild: !0,
|
|
1281
|
+
children: e
|
|
1282
|
+
}), /* @__PURE__ */ x(Ye, { children: /* @__PURE__ */ S("div", {
|
|
1283
|
+
className: "tg:space-y-1",
|
|
1284
|
+
children: [/* @__PURE__ */ S("p", {
|
|
1285
|
+
className: "tg:font-semibold",
|
|
1286
|
+
children: [r("renderer.defaultSubmitButton.requiredFieldsMissing"), ":"]
|
|
1287
|
+
}), /* @__PURE__ */ x("ul", {
|
|
1288
|
+
className: "tg:list-inside tg:list-disc",
|
|
1289
|
+
children: t.map((e, t) => /* @__PURE__ */ x("li", { children: e }, t))
|
|
1290
|
+
})]
|
|
1291
|
+
}) })] }) }) : e;
|
|
1292
|
+
}, ht = ({ components: e, className: t, flows: n, googleApiKey: r, language: a, onChange: o, onSubmit: l, theme: d, validate: f, validationMode: p, initialValues: m = {} }) => {
|
|
1293
|
+
let { canSubmit: g, clearSubmitMessage: _, config: v, firstErrorFieldId: y, formErrors: b, formValues: C, handleSubmit: w, inputNodes: T, isSubmitting: E, mergedFlow: D, missingRequiredFields: ee, setFieldValue: te, submitMessage: O, t: k, visibleNodes: ne, visibleRootNodes: re } = i({
|
|
1294
|
+
components: e,
|
|
1295
|
+
flows: n,
|
|
1296
|
+
googleApiKey: r,
|
|
1297
|
+
initialValues: m,
|
|
1298
|
+
language: a,
|
|
1299
|
+
onChange: o,
|
|
1300
|
+
onSubmit: l,
|
|
1301
|
+
theme: d,
|
|
1302
|
+
validate: f,
|
|
1303
|
+
validationMode: p
|
|
1304
|
+
}), { FormWrapper: ie, SubmitButton: A, SubmitButtonWrapper: j, renderNode: M } = c({
|
|
1305
|
+
config: v,
|
|
1306
|
+
DefaultFormWrapper: st,
|
|
1307
|
+
DefaultGroup: ct,
|
|
1308
|
+
DefaultSubmitButton: lt,
|
|
1309
|
+
DefaultSubmitButtonWrapper: mt,
|
|
1310
|
+
defaultInputRenderers: wt,
|
|
1311
|
+
defaultUI: pt,
|
|
1312
|
+
formErrors: b,
|
|
1313
|
+
formValues: C,
|
|
1314
|
+
missingRequiredFields: ee,
|
|
1315
|
+
setFieldValue: te,
|
|
1316
|
+
visibleNodes: ne
|
|
1317
|
+
}), N = h(async (e) => {
|
|
1318
|
+
e.preventDefault(), !await w() && y && document.getElementById(y)?.focus();
|
|
1319
|
+
}, [w, y]);
|
|
1320
|
+
return /* @__PURE__ */ x("div", {
|
|
1321
|
+
className: W("treege", t),
|
|
1322
|
+
children: /* @__PURE__ */ x(u, {
|
|
1323
|
+
theme: v.theme,
|
|
1324
|
+
storageKey: "treege-renderer-theme",
|
|
1325
|
+
children: /* @__PURE__ */ S(s, {
|
|
1326
|
+
value: {
|
|
1327
|
+
flows: D,
|
|
1328
|
+
formErrors: b,
|
|
1329
|
+
formValues: C,
|
|
1330
|
+
googleApiKey: v.googleApiKey,
|
|
1331
|
+
inputNodes: T,
|
|
1332
|
+
language: v.language,
|
|
1333
|
+
setFieldValue: te
|
|
1334
|
+
},
|
|
1335
|
+
children: [/* @__PURE__ */ S(ie, {
|
|
1336
|
+
onSubmit: N,
|
|
1337
|
+
children: [
|
|
1338
|
+
re.map((e) => M(e)),
|
|
1339
|
+
g && /* @__PURE__ */ x(j, {
|
|
1340
|
+
missingFields: ee,
|
|
1341
|
+
children: /* @__PURE__ */ x(A, {
|
|
1342
|
+
label: k("renderer.defaultSubmitButton.submit"),
|
|
1343
|
+
disabled: E
|
|
1344
|
+
})
|
|
1345
|
+
}),
|
|
1346
|
+
/* @__PURE__ */ x("p", {
|
|
1347
|
+
className: "tg:py-2 tg:text-muted-foreground tg:text-xs",
|
|
1348
|
+
children: "Powered by Treege"
|
|
1349
|
+
})
|
|
1350
|
+
]
|
|
1351
|
+
}), O && /* @__PURE__ */ x("div", {
|
|
1352
|
+
className: `tg:my-4 tg:rounded-md tg:p-4 ${O.type === "success" ? "bg-green-50 text-green-800 dark:bg-green-900/20 dark:text-green-300" : "bg-red-50 text-red-800 dark:bg-red-900/20 dark:text-red-300"}`,
|
|
1353
|
+
role: "alert",
|
|
1354
|
+
children: /* @__PURE__ */ S("div", {
|
|
1355
|
+
className: "tg:flex tg:items-center tg:justify-between",
|
|
1356
|
+
children: [/* @__PURE__ */ x("p", {
|
|
1357
|
+
className: "tg:font-medium tg:text-sm",
|
|
1358
|
+
children: O.message
|
|
1359
|
+
}), /* @__PURE__ */ x("button", {
|
|
1360
|
+
type: "button",
|
|
1361
|
+
onClick: _,
|
|
1362
|
+
className: "tg:ml-4 tg:font-medium tg:text-sm tg:underline tg:hover:no-underline tg:focus:outline-none",
|
|
1363
|
+
children: k("common.close")
|
|
1364
|
+
})]
|
|
1365
|
+
})
|
|
1366
|
+
})]
|
|
1367
|
+
})
|
|
1368
|
+
})
|
|
1369
|
+
});
|
|
1370
|
+
}, gt = ({ missingRequiredFields: e, isSubmitting: t, label: n }) => {
|
|
1371
|
+
let r = o(), i = r?.components?.submitButton, a = r?.components?.submitButtonWrapper;
|
|
1372
|
+
return /* @__PURE__ */ x(a || mt, {
|
|
1373
|
+
missingFields: e,
|
|
1374
|
+
children: /* @__PURE__ */ x(i || lt, {
|
|
1375
|
+
label: n,
|
|
1376
|
+
disabled: t
|
|
1377
|
+
})
|
|
1378
|
+
});
|
|
1379
|
+
};
|
|
1380
|
+
//#endregion
|
|
1381
|
+
//#region src/shared/components/ui/switch.tsx
|
|
1382
|
+
function _t({ className: e, ...t }) {
|
|
1383
|
+
return /* @__PURE__ */ x(H.Root, {
|
|
1384
|
+
"data-slot": "switch",
|
|
1385
|
+
className: W("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),
|
|
1386
|
+
...t,
|
|
1387
|
+
children: /* @__PURE__ */ x(H.Thumb, {
|
|
1388
|
+
"data-slot": "switch-thumb",
|
|
1389
|
+
className: W("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")
|
|
1390
|
+
})
|
|
1391
|
+
});
|
|
1392
|
+
}
|
|
1393
|
+
//#endregion
|
|
1394
|
+
//#region src/renderer/features/TreegeRenderer/web/components/inputs/DefaultSwitchInput.tsx
|
|
1395
|
+
var vt = ({ node: e, value: t, setValue: n, error: r, label: i, helperText: a, name: o, id: s }) => /* @__PURE__ */ S(K, {
|
|
1396
|
+
className: "tg:mb-4",
|
|
1397
|
+
children: [
|
|
1398
|
+
/* @__PURE__ */ S(X, {
|
|
1399
|
+
htmlFor: s,
|
|
1400
|
+
children: [i || e.data.name, e.data.required && /* @__PURE__ */ x("span", {
|
|
1401
|
+
className: "tg:text-red-500",
|
|
1402
|
+
children: "*"
|
|
1403
|
+
})]
|
|
1404
|
+
}),
|
|
1405
|
+
/* @__PURE__ */ x(_t, {
|
|
1406
|
+
id: s,
|
|
1407
|
+
name: o,
|
|
1408
|
+
checked: t,
|
|
1409
|
+
onCheckedChange: n
|
|
1410
|
+
}),
|
|
1411
|
+
a && !r && /* @__PURE__ */ x(q, { children: a }),
|
|
1412
|
+
r && /* @__PURE__ */ x(J, { children: r })
|
|
1413
|
+
]
|
|
1414
|
+
});
|
|
1415
|
+
//#endregion
|
|
1416
|
+
//#region src/shared/components/ui/textarea.tsx
|
|
1417
|
+
function yt({ className: e, ...t }) {
|
|
1418
|
+
return /* @__PURE__ */ x("textarea", {
|
|
1419
|
+
"data-slot": "textarea",
|
|
1420
|
+
className: W("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),
|
|
1421
|
+
...t
|
|
1422
|
+
});
|
|
1423
|
+
}
|
|
1424
|
+
//#endregion
|
|
1425
|
+
//#region src/renderer/features/TreegeRenderer/web/components/inputs/DefaultTextAreaInput.tsx
|
|
1426
|
+
var bt = ({ node: e, value: t, setValue: n, error: r, label: i, placeholder: a, helperText: o, name: s, id: c }) => /* @__PURE__ */ S(K, {
|
|
1427
|
+
className: "tg:mb-4",
|
|
1428
|
+
children: [
|
|
1429
|
+
/* @__PURE__ */ S(X, {
|
|
1430
|
+
htmlFor: c,
|
|
1431
|
+
children: [i || e.data.name, e.data.required && /* @__PURE__ */ x("span", {
|
|
1432
|
+
className: "tg:text-red-500",
|
|
1433
|
+
children: "*"
|
|
1434
|
+
})]
|
|
1435
|
+
}),
|
|
1436
|
+
/* @__PURE__ */ x(yt, {
|
|
1437
|
+
id: c,
|
|
1438
|
+
name: s,
|
|
1439
|
+
value: t ?? "",
|
|
1440
|
+
onChange: (e) => n(e.target.value),
|
|
1441
|
+
placeholder: a,
|
|
1442
|
+
className: "tg:w-full tg:rounded-md tg:border tg:px-3 tg:py-2",
|
|
1443
|
+
rows: 4
|
|
1444
|
+
}),
|
|
1445
|
+
r && /* @__PURE__ */ x(J, { children: r }),
|
|
1446
|
+
o && !r && /* @__PURE__ */ x(q, { children: o })
|
|
1447
|
+
]
|
|
1448
|
+
}), xt = ({ node: e, value: t, setValue: n, error: r, label: i, placeholder: a, helperText: o, name: s, id: c }) => /* @__PURE__ */ S(K, {
|
|
1449
|
+
className: "tg:mb-4",
|
|
1450
|
+
children: [
|
|
1451
|
+
/* @__PURE__ */ S(X, {
|
|
1452
|
+
htmlFor: c,
|
|
1453
|
+
children: [i || e.data.name, e.data.required && /* @__PURE__ */ x("span", {
|
|
1454
|
+
className: "tg:text-red-500",
|
|
1455
|
+
children: "*"
|
|
1456
|
+
})]
|
|
1457
|
+
}),
|
|
1458
|
+
/* @__PURE__ */ x(Y, {
|
|
1459
|
+
type: "text",
|
|
1460
|
+
id: c,
|
|
1461
|
+
name: s,
|
|
1462
|
+
value: t ?? "",
|
|
1463
|
+
onChange: (e) => n(e.target.value),
|
|
1464
|
+
placeholder: a
|
|
1465
|
+
}),
|
|
1466
|
+
r && /* @__PURE__ */ x(J, { children: r }),
|
|
1467
|
+
o && !r && /* @__PURE__ */ x(q, { children: o })
|
|
1468
|
+
]
|
|
1469
|
+
}), St = ({ node: e, value: t, setValue: n, error: r, label: i, placeholder: a, helperText: o, name: s, id: c }) => /* @__PURE__ */ S(K, {
|
|
1470
|
+
className: "tg:mb-4",
|
|
1471
|
+
children: [
|
|
1472
|
+
/* @__PURE__ */ S(X, {
|
|
1473
|
+
htmlFor: c,
|
|
1474
|
+
children: [i || e.data.name, e.data.required && /* @__PURE__ */ x("span", {
|
|
1475
|
+
className: "tg:text-red-500",
|
|
1476
|
+
children: "*"
|
|
1477
|
+
})]
|
|
1478
|
+
}),
|
|
1479
|
+
/* @__PURE__ */ x(Y, {
|
|
1480
|
+
type: "time",
|
|
1481
|
+
id: c,
|
|
1482
|
+
name: s,
|
|
1483
|
+
value: t ?? "",
|
|
1484
|
+
onChange: (e) => n(e.target.value),
|
|
1485
|
+
placeholder: a,
|
|
1486
|
+
className: "tg:bg-background tg:[color-scheme:light] tg:dark:[color-scheme:dark]"
|
|
1487
|
+
}),
|
|
1488
|
+
r && /* @__PURE__ */ x(J, { children: r }),
|
|
1489
|
+
o && !r && /* @__PURE__ */ x(q, { children: o })
|
|
1490
|
+
]
|
|
1491
|
+
}), Ct = ({ node: e, value: t, setValue: n, error: r, label: i, helperText: a, id: o, name: s }) => {
|
|
1492
|
+
let c = d(), l = Array.isArray(t) ? t : [], u = l[0] || "", f = l[1] || "", p = (e) => {
|
|
1493
|
+
n([e, f]);
|
|
1494
|
+
}, m = (e) => {
|
|
1495
|
+
n([u, e]);
|
|
1496
|
+
};
|
|
1497
|
+
return /* @__PURE__ */ S(K, {
|
|
1498
|
+
className: "tg:mb-4",
|
|
1499
|
+
children: [
|
|
1500
|
+
/* @__PURE__ */ S(X, {
|
|
1501
|
+
htmlFor: `${o}-start`,
|
|
1502
|
+
children: [i || e.data.name, e.data.required && /* @__PURE__ */ x("span", {
|
|
1503
|
+
className: "tg:text-red-500",
|
|
1504
|
+
children: "*"
|
|
1505
|
+
})]
|
|
1506
|
+
}),
|
|
1507
|
+
/* @__PURE__ */ S("div", {
|
|
1508
|
+
className: "tg:flex tg:gap-2",
|
|
1509
|
+
children: [/* @__PURE__ */ x(Y, {
|
|
1510
|
+
id: `${o}-start`,
|
|
1511
|
+
name: `${s}-start`,
|
|
1512
|
+
"aria-label": `${i || e.data.name} - ${c("renderer.defaultInputs.startTime")}`,
|
|
1513
|
+
"aria-invalid": !!r,
|
|
1514
|
+
"aria-describedby": r ? `${e.id}-error` : void 0,
|
|
1515
|
+
type: "time",
|
|
1516
|
+
value: u,
|
|
1517
|
+
onChange: (e) => p(e.target.value),
|
|
1518
|
+
placeholder: c("renderer.defaultInputs.startTime"),
|
|
1519
|
+
className: "tg:flex-1 tg:bg-background tg:[color-scheme:light] tg:dark:[color-scheme:dark]"
|
|
1520
|
+
}), /* @__PURE__ */ x(Y, {
|
|
1521
|
+
id: `${o}-end`,
|
|
1522
|
+
name: `${s}-end`,
|
|
1523
|
+
"aria-label": `${i || e.data.name} - ${c("renderer.defaultInputs.endTime")}`,
|
|
1524
|
+
"aria-invalid": !!r,
|
|
1525
|
+
"aria-describedby": r ? `${e.id}-error` : void 0,
|
|
1526
|
+
type: "time",
|
|
1527
|
+
value: f,
|
|
1528
|
+
onChange: (e) => m(e.target.value),
|
|
1529
|
+
placeholder: c("renderer.defaultInputs.endTime"),
|
|
1530
|
+
className: "tg:flex-1 tg:bg-background tg:[color-scheme:light] tg:dark:[color-scheme:dark]"
|
|
1531
|
+
})]
|
|
1532
|
+
}),
|
|
1533
|
+
r && /* @__PURE__ */ x(J, { children: r }),
|
|
1534
|
+
a && !r && /* @__PURE__ */ x(q, { children: a })
|
|
1535
|
+
]
|
|
1536
|
+
});
|
|
1537
|
+
}, wt = {
|
|
1538
|
+
address: Le,
|
|
1539
|
+
autocomplete: Re,
|
|
1540
|
+
checkbox: ze,
|
|
1541
|
+
date: He,
|
|
1542
|
+
daterange: Ue,
|
|
1543
|
+
file: We,
|
|
1544
|
+
hidden: Ge,
|
|
1545
|
+
http: et,
|
|
1546
|
+
number: tt,
|
|
1547
|
+
password: nt,
|
|
1548
|
+
radio: at,
|
|
1549
|
+
select: ot,
|
|
1550
|
+
submit: gt,
|
|
1551
|
+
switch: vt,
|
|
1552
|
+
text: xt,
|
|
1553
|
+
textarea: bt,
|
|
1554
|
+
time: St,
|
|
1555
|
+
timerange: Ct
|
|
1556
|
+
};
|
|
1557
|
+
//#endregion
|
|
1558
|
+
export { X as $, Me as A, De as B, We as C, Re as D, ze as E, be as F, ge as G, ue as H, we as I, pe as J, he as K, Oe as L, Ae as M, Pe as N, Le as O, je as P, Q, Ee as R, Ge as S, He as T, me as U, xe as V, de as W, Z as X, fe as Y, $ as Z, rt as _, bt as a, W as at, tt as b, _t as c, ft as d, Y as et, pt as f, at as g, ot as h, xt as i, G as it, Ne as j, ke as k, ht as l, ct as m, Ct as n, K as nt, yt as o, ut as p, _e as q, St as r, le as rt, vt as s, wt as t, q as tt, dt as u, it as v, Ue as w, et as x, nt as y, Te as z };
|