@fuma-content/studio 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/build/client/assets/{QueryClientProvider-DqiXnN2L.js → QueryClientProvider-BFSUF51X.js} +1 -1
  2. package/build/client/assets/actions-ByenKsIt.js +1 -0
  3. package/build/client/assets/actions-ClHPL1CP.js +1 -0
  4. package/build/client/assets/badge-BnhEE6iu.js +1 -0
  5. package/build/client/assets/{client-OSVRoCKH.js → client-BEKU4RIg.js} +148 -146
  6. package/build/client/assets/client-DBU2dkUR.js +1 -0
  7. package/build/client/assets/client-DvwvjHta.js +1 -0
  8. package/build/client/assets/client-wd2sce2I.js +8 -0
  9. package/build/client/assets/dropdown-menu-By_XeFX4.js +1 -0
  10. package/build/client/assets/entry.rsc-J_U0YQEr.js +1 -0
  11. package/build/client/assets/{index-BdrDVoE8.js → index-B5GacMxj.js} +1 -1
  12. package/build/client/assets/index-BTaHNKf7.js +1 -0
  13. package/build/client/assets/index-BgFxGtat.js +1 -0
  14. package/build/client/assets/index-CG_0cSZQ.js +1 -0
  15. package/build/client/assets/index-CfCSvolS.js +1 -0
  16. package/build/client/assets/{index-Bx93mXy1.js → index-D8KuzOxG.js} +1 -1
  17. package/build/client/assets/index-DrT4Adhh.js +41 -0
  18. package/build/client/assets/{index-BpILsqFO.js → index-El_a1Yhs.js} +1 -1
  19. package/build/client/assets/index-QYLIz8qa.js +1 -0
  20. package/build/client/assets/layout-BPVd8vtW.js +1 -0
  21. package/build/client/assets/{mdx-BNErtsK6.js → mdx-DBJIR6uw.js} +1 -1
  22. package/build/client/assets/page-BJL5nvn-.js +1 -0
  23. package/build/client/assets/page-eyuUZvVn.js +1 -0
  24. package/build/client/assets/popover-BowiFsDm.js +1 -0
  25. package/build/client/assets/{react-B8--K7an.js → react-CzFdRS7Y.js} +7 -7
  26. package/build/client/assets/root-7fvd-0uP.js +1 -0
  27. package/build/client/assets/root-B0B6-NU5.css +1 -0
  28. package/build/client/assets/{root-B_CXTQpA.js → root-jg-0qm8s.js} +1 -1
  29. package/build/client/assets/route-BLLsZ_zO.js +1 -0
  30. package/build/client/assets/{router-a9jyj9wf.js → router-QEl8O8lm.js} +1 -1
  31. package/build/client/assets/select-BI356bZ1.js +1 -0
  32. package/build/client/assets/separator-0kwG7IIM.js +1 -0
  33. package/build/client/assets/sidebar-ByyQE2QS.js +12 -0
  34. package/build/client/assets/{site-header-DQkKe-WA.js → site-header-iBpA4Sim.js} +1 -1
  35. package/build/client/assets/spinner-D35u7i0p.js +1 -0
  36. package/build/client/assets/tooltip-v-_I4rCw.js +16 -0
  37. package/build/client/assets/use-sync-yCWvjE_m.js +2 -0
  38. package/build/client/assets/{yaml-Cloe7OVn.js → yaml-BnQf_2Zt.js} +1 -1
  39. package/build/server/__ssr_build/__vite_rsc_assets_manifest.js +213 -133
  40. package/build/server/__ssr_build/assets/{actions-BFtCTvOL.js → actions-C5Kv8XYU.js} +2 -2
  41. package/build/server/__ssr_build/assets/{actions-B50-3n-a.js → actions-DQIBBM15.js} +4 -4
  42. package/build/server/__ssr_build/assets/{badge-DYFvBSp8.js → badge-B48L9yYO.js} +1 -1
  43. package/build/server/__ssr_build/assets/{client-CU90j0R8.js → client-AuWNsacU.js} +3 -3
  44. package/build/server/__ssr_build/assets/client-BHaLyky8.js +1162 -0
  45. package/build/server/__ssr_build/assets/{client--HXec13w.js → client-BogEWrwz.js} +10 -6
  46. package/build/server/__ssr_build/assets/{client-BqW9rGyi.js → client-DXOHI3cC.js} +2994 -4866
  47. package/build/server/__ssr_build/assets/{dropdown-menu-D2YyT3lP.js → dropdown-menu-CnDgV_JY.js} +7 -10
  48. package/build/server/__ssr_build/assets/{entry.rsc-Cg_DxYkh.js → entry.rsc-aOU-YPkj.js} +1 -1
  49. package/build/server/__ssr_build/assets/{index-PpqpVA51.js → index-B6ajh-UP.js} +1 -1
  50. package/build/server/__ssr_build/assets/index-BPd5y8T-.js +76 -0
  51. package/build/server/__ssr_build/assets/{button-C_-b_vqm.js → index-By9m5mBe.js} +3295 -3195
  52. package/build/server/__ssr_build/assets/index-Ch7b9Ofo.js +37 -0
  53. package/build/server/__ssr_build/assets/{index-B-gno69w.js → index-Cw6b1mnl.js} +8 -7
  54. package/build/server/__ssr_build/assets/{index-DBc0nhEL.js → index-kCa2P0Xn.js} +4 -75
  55. package/build/server/__ssr_build/assets/{index-Dtw6X3NW.js → index-tFzyztyE.js} +2 -2
  56. package/build/server/__ssr_build/assets/{layout-CPnSx9PI.js → layout-CC-HJHWR.js} +13 -11
  57. package/build/server/__ssr_build/assets/{mdx-bmeV1kyx.js → mdx-D9VFmsYC.js} +1 -1
  58. package/build/server/__ssr_build/assets/{page-BwoghW3K.js → page-BVUd9aDy.js} +10 -8
  59. package/build/server/__ssr_build/assets/{page-HxttullC.js → page-C_wQzy3_.js} +13 -11
  60. package/build/server/__ssr_build/assets/popover-CzQgoguQ.js +321 -0
  61. package/build/server/__ssr_build/assets/{root-CS7F-km4.js → root-BmMc6_zA.js} +1 -1
  62. package/build/server/__ssr_build/assets/route-CNYc37pV.js +860 -0
  63. package/build/server/__ssr_build/assets/{spinner-BXcLlTNs.js → select-B8QQSB6X.js} +10 -25
  64. package/build/server/__ssr_build/assets/{separator-8UA_ceSq.js → separator-C601eKPH.js} +2 -2
  65. package/build/server/__ssr_build/assets/{sidebar-BzNOZeBO.js → sidebar-C6fHDjcx.js} +237 -65
  66. package/build/server/__ssr_build/assets/{site-header-CXHKSzqk.js → site-header-Bmsr3a30.js} +2 -2
  67. package/build/server/__ssr_build/assets/spinner-D5zAJQcS.js +19 -0
  68. package/build/server/__ssr_build/assets/{tooltip-DZ4WdJt-.js → tooltip-B3A57zPO.js} +1211 -1214
  69. package/build/server/__ssr_build/assets/{use-sync-TRS0zL-Y.js → use-sync-DTZgOM1O.js} +259 -1498
  70. package/build/server/__ssr_build/assets/{yaml-BEdFfhvc.js → yaml-xJU1Ur4O.js} +1 -1
  71. package/build/server/__ssr_build/index.js +31 -15
  72. package/build/server/__vite_rsc_assets_manifest.js +213 -133
  73. package/build/server/assets/{actions-C92yn6jE.js → actions-BbMzIy5J.js} +2 -2
  74. package/build/server/assets/{actions-CWWFIcb1.js → actions-CjWBMAed.js} +2 -2
  75. package/build/server/assets/{actions-DZdN0IBq.js → actions-cRzXiMyR.js} +2 -2
  76. package/build/server/assets/{config-Cb909uq6.js → config-Dka4Bvz4.js} +10 -10
  77. package/build/server/assets/{layout-CRw_6FCt.js → layout-CIIfFN0v.js} +2 -2
  78. package/build/server/assets/{page-zlF_Ew1s.js → page-pyqagPXb.js} +2 -2
  79. package/build/server/assets/root-B0B6-NU5.css +1 -0
  80. package/build/server/assets/{root-CVOXO6T9.js → root-D1ebFoST.js} +1 -1
  81. package/build/server/assets/{route-o-6k10r9.js → route-C7QEArEP.js} +12571 -4431
  82. package/build/server/index.js +40 -15
  83. package/dist/bin.mjs +4 -4
  84. package/dist/package.mjs +1 -1
  85. package/package.json +36 -18
  86. package/build/client/assets/actions-DkbV2Z0p.js +0 -1
  87. package/build/client/assets/actions-DpkI7OTF.js +0 -1
  88. package/build/client/assets/badge-CZkdLoIP.js +0 -1
  89. package/build/client/assets/button-Bm94vje1.js +0 -41
  90. package/build/client/assets/client-BWBqEatf.js +0 -1
  91. package/build/client/assets/client-Crg-pMcu.js +0 -1
  92. package/build/client/assets/dropdown-menu-EF-sTINr.js +0 -1
  93. package/build/client/assets/entry.rsc-D51PwnQL.js +0 -1
  94. package/build/client/assets/index-CQRgqbuL.js +0 -1
  95. package/build/client/assets/index-DOs5iMXj.js +0 -1
  96. package/build/client/assets/index-DTzAH5JX.js +0 -1
  97. package/build/client/assets/layout-CnpYRqF0.js +0 -1
  98. package/build/client/assets/page-DOzl4Kpa.js +0 -1
  99. package/build/client/assets/page-uNpJU_rv.js +0 -1
  100. package/build/client/assets/root-D3NoAGI1.js +0 -1
  101. package/build/client/assets/root-z8crlXSh.css +0 -1
  102. package/build/client/assets/separator-tWFpvpUX.js +0 -1
  103. package/build/client/assets/sidebar-BBYit8gY.js +0 -12
  104. package/build/client/assets/spinner-BdPhtfsc.js +0 -1
  105. package/build/client/assets/tooltip-Dvh-iHDG.js +0 -16
  106. package/build/client/assets/use-sync-ZgcwUdu_.js +0 -9
  107. package/build/server/assets/root-z8crlXSh.css +0 -1
  108. /package/build/server/__ssr_build/assets/{root-D-Y-rGw5.js → root-S8l7oX7x.js} +0 -0
  109. /package/build/server/assets/{root-dGb6ch_9.js → root-DRYtk85G.js} +0 -0
@@ -1,30 +1,254 @@
1
- import { d as We, r as reactExports, j as jsxRuntimeExports } from "../index.js";
2
- import { C as ChevronDown, S as Select, a as SelectTrigger, b as SelectValue, c as SelectContent, d as SelectItem, e as Spinner } from "./spinner-BXcLlTNs.js";
3
- import { c as createLucideIcon, P as Primitive, h as useControllableState, a as createContextScope, k as useId, b as composeEventHandlers, g as Presence, s as cn, v as buttonVariants, X } from "./button-C_-b_vqm.js";
1
+ import { r as reactExports, j as jsxRuntimeExports, W as We } from "../index.js";
2
+ import { c as createLucideIcon, f as useControllableState, P as Primitive, u as useId, g as composeEventHandlers, q as Presence, h as createContextScope, b as cn } from "./index-By9m5mBe.js";
3
+ import { R as Root$1, I as Item, c as createRovingFocusGroupScope } from "./index-kCa2P0Xn.js";
4
+ import { u as useDirection, C as Check } from "./index-BPd5y8T-.js";
5
+ import { P as Primitive$1 } from "./index-Ch7b9Ofo.js";
4
6
  import { cva } from "class-variance-authority";
5
- import { Ajv2020 } from "ajv/dist/2020.js";
6
- import { u as useDirection, c as createRovingFocusGroupScope, R as Root$1, I as Item, C as Check } from "./index-DBc0nhEL.js";
7
- const __iconNode$3 = [
7
+ import { S as Spinner } from "./spinner-D5zAJQcS.js";
8
+ const __iconNode$1 = [
8
9
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
9
10
  ["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
10
11
  ["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
11
12
  ];
12
- const CircleAlert = createLucideIcon("circle-alert", __iconNode$3);
13
- const __iconNode$2 = [["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]];
14
- const Circle = createLucideIcon("circle", __iconNode$2);
15
- const __iconNode$1 = [
16
- ["path", { d: "M5 12h14", key: "1ays0h" }],
17
- ["path", { d: "M12 5v14", key: "s699le" }]
18
- ];
19
- const Plus = createLucideIcon("plus", __iconNode$1);
20
- const __iconNode = [
21
- ["path", { d: "M10 11v6", key: "nco0om" }],
22
- ["path", { d: "M14 11v6", key: "outv1u" }],
23
- ["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
24
- ["path", { d: "M3 6h18", key: "d0wm0j" }],
25
- ["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
26
- ];
27
- const Trash2 = createLucideIcon("trash-2", __iconNode);
13
+ const CircleAlert = createLucideIcon("circle-alert", __iconNode$1);
14
+ const __iconNode = [["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]];
15
+ const Circle = createLucideIcon("circle", __iconNode);
16
+ var TABS_NAME = "Tabs";
17
+ var [createTabsContext] = createContextScope(TABS_NAME, [
18
+ createRovingFocusGroupScope
19
+ ]);
20
+ var useRovingFocusGroupScope = createRovingFocusGroupScope();
21
+ var [TabsProvider, useTabsContext] = createTabsContext(TABS_NAME);
22
+ var Tabs$1 = reactExports.forwardRef(
23
+ (props, forwardedRef) => {
24
+ const {
25
+ __scopeTabs,
26
+ value: valueProp,
27
+ onValueChange,
28
+ defaultValue,
29
+ orientation = "horizontal",
30
+ dir,
31
+ activationMode = "automatic",
32
+ ...tabsProps
33
+ } = props;
34
+ const direction = useDirection(dir);
35
+ const [value, setValue] = useControllableState({
36
+ prop: valueProp,
37
+ onChange: onValueChange,
38
+ defaultProp: defaultValue ?? "",
39
+ caller: TABS_NAME
40
+ });
41
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
42
+ TabsProvider,
43
+ {
44
+ scope: __scopeTabs,
45
+ baseId: useId(),
46
+ value,
47
+ onValueChange: setValue,
48
+ orientation,
49
+ dir: direction,
50
+ activationMode,
51
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
52
+ Primitive.div,
53
+ {
54
+ dir: direction,
55
+ "data-orientation": orientation,
56
+ ...tabsProps,
57
+ ref: forwardedRef
58
+ }
59
+ )
60
+ }
61
+ );
62
+ }
63
+ );
64
+ Tabs$1.displayName = TABS_NAME;
65
+ var TAB_LIST_NAME = "TabsList";
66
+ var TabsList$1 = reactExports.forwardRef(
67
+ (props, forwardedRef) => {
68
+ const { __scopeTabs, loop = true, ...listProps } = props;
69
+ const context = useTabsContext(TAB_LIST_NAME, __scopeTabs);
70
+ const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeTabs);
71
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
72
+ Root$1,
73
+ {
74
+ asChild: true,
75
+ ...rovingFocusGroupScope,
76
+ orientation: context.orientation,
77
+ dir: context.dir,
78
+ loop,
79
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
80
+ Primitive.div,
81
+ {
82
+ role: "tablist",
83
+ "aria-orientation": context.orientation,
84
+ ...listProps,
85
+ ref: forwardedRef
86
+ }
87
+ )
88
+ }
89
+ );
90
+ }
91
+ );
92
+ TabsList$1.displayName = TAB_LIST_NAME;
93
+ var TRIGGER_NAME = "TabsTrigger";
94
+ var TabsTrigger$1 = reactExports.forwardRef(
95
+ (props, forwardedRef) => {
96
+ const { __scopeTabs, value, disabled = false, ...triggerProps } = props;
97
+ const context = useTabsContext(TRIGGER_NAME, __scopeTabs);
98
+ const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeTabs);
99
+ const triggerId = makeTriggerId(context.baseId, value);
100
+ const contentId = makeContentId(context.baseId, value);
101
+ const isSelected = value === context.value;
102
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
103
+ Item,
104
+ {
105
+ asChild: true,
106
+ ...rovingFocusGroupScope,
107
+ focusable: !disabled,
108
+ active: isSelected,
109
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
110
+ Primitive.button,
111
+ {
112
+ type: "button",
113
+ role: "tab",
114
+ "aria-selected": isSelected,
115
+ "aria-controls": contentId,
116
+ "data-state": isSelected ? "active" : "inactive",
117
+ "data-disabled": disabled ? "" : void 0,
118
+ disabled,
119
+ id: triggerId,
120
+ ...triggerProps,
121
+ ref: forwardedRef,
122
+ onMouseDown: composeEventHandlers(props.onMouseDown, (event) => {
123
+ if (!disabled && event.button === 0 && event.ctrlKey === false) {
124
+ context.onValueChange(value);
125
+ } else {
126
+ event.preventDefault();
127
+ }
128
+ }),
129
+ onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
130
+ if ([" ", "Enter"].includes(event.key)) context.onValueChange(value);
131
+ }),
132
+ onFocus: composeEventHandlers(props.onFocus, () => {
133
+ const isAutomaticActivation = context.activationMode !== "manual";
134
+ if (!isSelected && !disabled && isAutomaticActivation) {
135
+ context.onValueChange(value);
136
+ }
137
+ })
138
+ }
139
+ )
140
+ }
141
+ );
142
+ }
143
+ );
144
+ TabsTrigger$1.displayName = TRIGGER_NAME;
145
+ var CONTENT_NAME = "TabsContent";
146
+ var TabsContent$1 = reactExports.forwardRef(
147
+ (props, forwardedRef) => {
148
+ const { __scopeTabs, value, forceMount, children, ...contentProps } = props;
149
+ const context = useTabsContext(CONTENT_NAME, __scopeTabs);
150
+ const triggerId = makeTriggerId(context.baseId, value);
151
+ const contentId = makeContentId(context.baseId, value);
152
+ const isSelected = value === context.value;
153
+ const isMountAnimationPreventedRef = reactExports.useRef(isSelected);
154
+ reactExports.useEffect(() => {
155
+ const rAF = requestAnimationFrame(() => isMountAnimationPreventedRef.current = false);
156
+ return () => cancelAnimationFrame(rAF);
157
+ }, []);
158
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || isSelected, children: ({ present }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
159
+ Primitive.div,
160
+ {
161
+ "data-state": isSelected ? "active" : "inactive",
162
+ "data-orientation": context.orientation,
163
+ role: "tabpanel",
164
+ "aria-labelledby": triggerId,
165
+ hidden: !present,
166
+ id: contentId,
167
+ tabIndex: 0,
168
+ ...contentProps,
169
+ ref: forwardedRef,
170
+ style: {
171
+ ...props.style,
172
+ animationDuration: isMountAnimationPreventedRef.current ? "0s" : void 0
173
+ },
174
+ children: present && children
175
+ }
176
+ ) });
177
+ }
178
+ );
179
+ TabsContent$1.displayName = CONTENT_NAME;
180
+ function makeTriggerId(baseId, value) {
181
+ return `${baseId}-trigger-${value}`;
182
+ }
183
+ function makeContentId(baseId, value) {
184
+ return `${baseId}-content-${value}`;
185
+ }
186
+ var Root2 = Tabs$1;
187
+ var List = TabsList$1;
188
+ var Trigger = TabsTrigger$1;
189
+ var Content = TabsContent$1;
190
+ function Tabs({
191
+ className,
192
+ orientation = "horizontal",
193
+ ...props
194
+ }) {
195
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
196
+ Root2,
197
+ {
198
+ "data-slot": "tabs",
199
+ "data-orientation": orientation,
200
+ className: cn("group/tabs flex gap-2 data-horizontal:flex-col", className),
201
+ ...props
202
+ }
203
+ );
204
+ }
205
+ function TabsList({ className, ...props }) {
206
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
207
+ List,
208
+ {
209
+ "data-slot": "tabs-list",
210
+ className: cn(
211
+ "rounded-4xl bg-muted p-1 group-data-horizontal/tabs:h-9 group-data-vertical/tabs:rounded-2xl group/tabs-list text-muted-foreground inline-flex w-fit items-center justify-center group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col",
212
+ className
213
+ ),
214
+ ...props
215
+ }
216
+ );
217
+ }
218
+ function TabsTrigger({ className, ...props }) {
219
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
220
+ Trigger,
221
+ {
222
+ "data-slot": "tabs-trigger",
223
+ className: cn(
224
+ "relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 whitespace-nowrap rounded-xl border border-transparent px-2 py-1 font-medium text-foreground/60 text-sm transition-colors hover:text-foreground focus-visible:border-ring focus-visible:outline-1 focus-visible:outline-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start group-data-vertical/tabs:px-2.5 group-data-vertical/tabs:py-1.5 dark:text-muted-foreground dark:hover:text-foreground [&_svg]:size-4 [&_svg]:shrink-0",
225
+ "data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground",
226
+ className
227
+ ),
228
+ ...props
229
+ }
230
+ );
231
+ }
232
+ function TabsContent({ className, ...props }) {
233
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
234
+ Content,
235
+ {
236
+ "data-slot": "tabs-content",
237
+ className: cn("flex-1 text-sm outline-none", className),
238
+ ...props
239
+ }
240
+ );
241
+ }
242
+ const Editor = reactExports.lazy(() => import("./yaml-xJU1Ur4O.js").then((mod) => ({ default: mod.YamlEditor })));
243
+ function YamlEditorLazy(props) {
244
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
245
+ reactExports.Suspense,
246
+ {
247
+ fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col bg-secondary text-secondary-foreground overflow-hidden border rounded-lg", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-2 h-[240px] text-sm font-mono flex items-center justify-center text-muted-foreground", children: "Loading editor..." }) }),
248
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Editor, { ...props })
249
+ }
250
+ );
251
+ }
28
252
  var isCheckBoxInput = (element) => element.type === "checkbox";
29
253
  var isDateObject = (value) => value instanceof Date;
30
254
  var isNullOrUndefined = (value) => value == null;
@@ -176,7 +400,7 @@ var generateWatchOutput = (names, _names, formValues, isGlobal, defaultValue) =>
176
400
  return formValues;
177
401
  };
178
402
  var isPrimitive = (value) => isNullOrUndefined(value) || !isObjectType(value);
179
- function deepEqual$1(object1, object2, _internal_visited = /* @__PURE__ */ new WeakSet()) {
403
+ function deepEqual(object1, object2, _internal_visited = /* @__PURE__ */ new WeakSet()) {
180
404
  if (isPrimitive(object1) || isPrimitive(object2)) {
181
405
  return Object.is(object1, object2);
182
406
  }
@@ -200,7 +424,7 @@ function deepEqual$1(object1, object2, _internal_visited = /* @__PURE__ */ new W
200
424
  }
201
425
  if (key !== "ref") {
202
426
  const val2 = object2[key];
203
- if (isDateObject(val1) && isDateObject(val2) || isObject(val1) && isObject(val2) || Array.isArray(val1) && Array.isArray(val2) ? !deepEqual$1(val1, val2, _internal_visited) : !Object.is(val1, val2)) {
427
+ if (isDateObject(val1) && isDateObject(val2) || isObject(val1) && isObject(val2) || Array.isArray(val1) && Array.isArray(val2) ? !deepEqual(val1, val2, _internal_visited) : !Object.is(val1, val2)) {
204
428
  return false;
205
429
  }
206
430
  }
@@ -229,7 +453,7 @@ function useWatch(props) {
229
453
  const formValues = generateWatchOutput(name, control._names, values || control._formValues, false, _defaultValue.current);
230
454
  if (_compute.current) {
231
455
  const computedFormValues = _compute.current(formValues);
232
- if (!deepEqual$1(computedFormValues, _computeFormValues.current)) {
456
+ if (!deepEqual(computedFormValues, _computeFormValues.current)) {
233
457
  updateValue(computedFormValues);
234
458
  _computeFormValues.current = computedFormValues;
235
459
  }
@@ -239,7 +463,7 @@ function useWatch(props) {
239
463
  }
240
464
  }, [control._formValues, control._names, disabled, name]);
241
465
  useIsomorphicLayoutEffect(() => {
242
- if (_prevControl.current !== control || !deepEqual$1(_prevName.current, name)) {
466
+ if (_prevControl.current !== control || !deepEqual(_prevName.current, name)) {
243
467
  _prevControl.current = control;
244
468
  _prevName.current = name;
245
469
  refreshValue();
@@ -262,7 +486,7 @@ function useWatch(props) {
262
486
  if (disabled) {
263
487
  return null;
264
488
  }
265
- const nameChanged = !controlChanged && !deepEqual$1(prevName, name);
489
+ const nameChanged = !controlChanged && !deepEqual(prevName, name);
266
490
  const shouldReturnImmediate = controlChanged || nameChanged;
267
491
  return shouldReturnImmediate ? getCurrentOutput() : null;
268
492
  }, [disabled, controlChanged, name, prevName, getCurrentOutput]);
@@ -392,49 +616,6 @@ function useController(props) {
392
616
  const Controller = (props) => props.render(useController(props));
393
617
  const HookFormContext = We.createContext(null);
394
618
  HookFormContext.displayName = "HookFormContext";
395
- const useFormContext = () => We.useContext(HookFormContext);
396
- const FormProvider = (props) => {
397
- const { children, watch, getValues, getFieldState, setError, clearErrors, setValue, trigger, formState, resetField, reset, handleSubmit, unregister, control, register, setFocus, subscribe } = props;
398
- return We.createElement(
399
- HookFormContext.Provider,
400
- { value: We.useMemo(() => ({
401
- watch,
402
- getValues,
403
- getFieldState,
404
- setError,
405
- clearErrors,
406
- setValue,
407
- trigger,
408
- formState,
409
- resetField,
410
- reset,
411
- handleSubmit,
412
- unregister,
413
- control,
414
- register,
415
- setFocus,
416
- subscribe
417
- }), [
418
- clearErrors,
419
- control,
420
- formState,
421
- getFieldState,
422
- getValues,
423
- handleSubmit,
424
- register,
425
- reset,
426
- resetField,
427
- setError,
428
- setFocus,
429
- setValue,
430
- subscribe,
431
- trigger,
432
- unregister,
433
- watch
434
- ]) },
435
- We.createElement(HookFormControlContext.Provider, { value: control }, children)
436
- );
437
- };
438
619
  var appendErrors = (name, validateAllFieldCriteria, errors, type, message) => validateAllFieldCriteria ? {
439
620
  ...errors[name],
440
621
  types: {
@@ -567,7 +748,7 @@ function getDirtyFields(data, formValues, dirtyFieldsFromValues) {
567
748
  }
568
749
  } else {
569
750
  const formValue = formValues[key];
570
- dirtyFieldsFromValues[key] = !deepEqual$1(value, formValue);
751
+ dirtyFieldsFromValues[key] = !deepEqual(value, formValue);
571
752
  }
572
753
  }
573
754
  return dirtyFieldsFromValues;
@@ -1051,7 +1232,7 @@ function createFormControl(props = {}) {
1051
1232
  _formState.isDirty = output.isDirty = _getDirty();
1052
1233
  shouldUpdateField = isPreviousDirty !== output.isDirty;
1053
1234
  }
1054
- const isCurrentFieldPristine = deepEqual$1(get(_defaultValues, name), fieldValue);
1235
+ const isCurrentFieldPristine = deepEqual(get(_defaultValues, name), fieldValue);
1055
1236
  isPreviousDirty = !!get(_formState.dirtyFields, name);
1056
1237
  isCurrentFieldPristine ? unset(_formState.dirtyFields, name) : set(_formState.dirtyFields, name, true);
1057
1238
  output.dirtyFields = _formState.dirtyFields;
@@ -1080,7 +1261,7 @@ function createFormControl(props = {}) {
1080
1261
  delayErrorCallback = null;
1081
1262
  error ? set(_formState.errors, name, error) : unset(_formState.errors, name);
1082
1263
  }
1083
- if ((error ? !deepEqual$1(previousFieldError, error) : previousFieldError) || !isEmptyObject(fieldState) || shouldUpdateValid) {
1264
+ if ((error ? !deepEqual(previousFieldError, error) : previousFieldError) || !isEmptyObject(fieldState) || shouldUpdateValid) {
1084
1265
  const updatedFormState = {
1085
1266
  ...fieldState,
1086
1267
  ...shouldUpdateValid && isBoolean(isValid) ? { isValid } : {},
@@ -1149,7 +1330,7 @@ function createFormControl(props = {}) {
1149
1330
  }
1150
1331
  _names.unMount = /* @__PURE__ */ new Set();
1151
1332
  };
1152
- const _getDirty = (name, data) => !_options.disabled && (name && data && set(_formValues, name, data), !deepEqual$1(getValues(), _defaultValues));
1333
+ const _getDirty = (name, data) => !_options.disabled && (name && data && set(_formValues, name, data), !deepEqual(getValues(), _defaultValues));
1153
1334
  const _getWatch = (names, defaultValue, isGlobal) => generateWatchOutput(names, _names, {
1154
1335
  ..._state.mount ? _formValues : isUndefined(defaultValue) ? _defaultValues : isString(names) ? { [names]: defaultValue } : defaultValue
1155
1336
  }, isGlobal, defaultValue);
@@ -1245,7 +1426,7 @@ function createFormControl(props = {}) {
1245
1426
  let isFieldValueUpdated = true;
1246
1427
  const field = get(_fields, name);
1247
1428
  const _updateIsFieldValueUpdated = (fieldValue) => {
1248
- isFieldValueUpdated = Number.isNaN(fieldValue) || isDateObject(fieldValue) && isNaN(fieldValue.getTime()) || deepEqual$1(fieldValue, get(_formValues, name, fieldValue));
1429
+ isFieldValueUpdated = Number.isNaN(fieldValue) || isDateObject(fieldValue) && isNaN(fieldValue.getTime()) || deepEqual(fieldValue, get(_formValues, name, fieldValue));
1249
1430
  };
1250
1431
  const validationModeBeforeSubmit = getValidationModes(_options.mode);
1251
1432
  const validationModeAfterSubmit = getValidationModes(_options.reValidateMode);
@@ -1678,7 +1859,7 @@ function createFormControl(props = {}) {
1678
1859
  }
1679
1860
  _subjects.state.next({
1680
1861
  submitCount: keepStateOptions.keepSubmitCount ? _formState.submitCount : 0,
1681
- isDirty: isEmptyResetValues ? false : keepStateOptions.keepDirty ? _formState.isDirty : !!(keepStateOptions.keepDefaultValues && !deepEqual$1(formValues, _defaultValues)),
1862
+ isDirty: isEmptyResetValues ? false : keepStateOptions.keepDirty ? _formState.isDirty : !!(keepStateOptions.keepDefaultValues && !deepEqual(formValues, _defaultValues)),
1682
1863
  isSubmitted: keepStateOptions.keepIsSubmitted ? _formState.isSubmitted : false,
1683
1864
  dirtyFields: isEmptyResetValues ? {} : keepStateOptions.keepDirtyValues ? keepStateOptions.keepDefaultValues && _formValues ? getDirtyFields(_defaultValues, _formValues) : _formState.dirtyFields : keepStateOptions.keepDefaultValues && formValues ? getDirtyFields(_defaultValues, formValues) : keepStateOptions.keepDirty ? _formState.dirtyFields : {},
1684
1865
  touchedFields: keepStateOptions.keepTouched ? _formState.touchedFields : {},
@@ -1792,236 +1973,6 @@ function createFormControl(props = {}) {
1792
1973
  formControl: methods
1793
1974
  };
1794
1975
  }
1795
- var generateId = () => {
1796
- if (typeof crypto !== "undefined" && crypto.randomUUID) {
1797
- return crypto.randomUUID();
1798
- }
1799
- const d = typeof performance === "undefined" ? Date.now() : performance.now() * 1e3;
1800
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
1801
- const r = (Math.random() * 16 + d) % 16 | 0;
1802
- return (c == "x" ? r : r & 3 | 8).toString(16);
1803
- });
1804
- };
1805
- var getFocusFieldName = (name, index, options = {}) => options.shouldFocus || isUndefined(options.shouldFocus) ? options.focusName || `${name}.${isUndefined(options.focusIndex) ? index : options.focusIndex}.` : "";
1806
- var appendAt = (data, value) => [
1807
- ...data,
1808
- ...convertToArrayPayload(value)
1809
- ];
1810
- var fillEmptyArray = (value) => Array.isArray(value) ? value.map(() => void 0) : void 0;
1811
- function insert(data, index, value) {
1812
- return [
1813
- ...data.slice(0, index),
1814
- ...convertToArrayPayload(value),
1815
- ...data.slice(index)
1816
- ];
1817
- }
1818
- var moveArrayAt = (data, from, to) => {
1819
- if (!Array.isArray(data)) {
1820
- return [];
1821
- }
1822
- if (isUndefined(data[to])) {
1823
- data[to] = void 0;
1824
- }
1825
- data.splice(to, 0, data.splice(from, 1)[0]);
1826
- return data;
1827
- };
1828
- var prependAt = (data, value) => [
1829
- ...convertToArrayPayload(value),
1830
- ...convertToArrayPayload(data)
1831
- ];
1832
- function removeAtIndexes(data, indexes) {
1833
- let i = 0;
1834
- const temp = [...data];
1835
- for (const index of indexes) {
1836
- temp.splice(index - i, 1);
1837
- i++;
1838
- }
1839
- return compact(temp).length ? temp : [];
1840
- }
1841
- var removeArrayAt = (data, index) => isUndefined(index) ? [] : removeAtIndexes(data, convertToArrayPayload(index).sort((a, b) => a - b));
1842
- var swapArrayAt = (data, indexA, indexB) => {
1843
- [data[indexA], data[indexB]] = [data[indexB], data[indexA]];
1844
- };
1845
- var updateAt = (fieldValues, index, value) => {
1846
- fieldValues[index] = value;
1847
- return fieldValues;
1848
- };
1849
- function useFieldArray(props) {
1850
- const formControl = useFormControlContext();
1851
- const { control = formControl, name, keyName = "id", shouldUnregister, rules } = props;
1852
- const [fields, setFields] = We.useState(control._getFieldArray(name));
1853
- const ids = We.useRef(control._getFieldArray(name).map(generateId));
1854
- const _actioned = We.useRef(false);
1855
- control._names.array.add(name);
1856
- We.useMemo(() => rules && fields.length >= 0 && control.register(name, rules), [control, name, fields.length, rules]);
1857
- useIsomorphicLayoutEffect(() => control._subjects.array.subscribe({
1858
- next: ({ values, name: fieldArrayName }) => {
1859
- if (fieldArrayName === name || !fieldArrayName) {
1860
- const fieldValues = get(values, name);
1861
- if (Array.isArray(fieldValues)) {
1862
- setFields(fieldValues);
1863
- ids.current = fieldValues.map(generateId);
1864
- }
1865
- }
1866
- }
1867
- }).unsubscribe, [control, name]);
1868
- const updateValues = We.useCallback((updatedFieldArrayValues) => {
1869
- _actioned.current = true;
1870
- control._setFieldArray(name, updatedFieldArrayValues);
1871
- }, [control, name]);
1872
- const append = (value, options) => {
1873
- const appendValue = convertToArrayPayload(cloneObject(value));
1874
- const updatedFieldArrayValues = appendAt(control._getFieldArray(name), appendValue);
1875
- control._names.focus = getFocusFieldName(name, updatedFieldArrayValues.length - 1, options);
1876
- ids.current = appendAt(ids.current, appendValue.map(generateId));
1877
- updateValues(updatedFieldArrayValues);
1878
- setFields(updatedFieldArrayValues);
1879
- control._setFieldArray(name, updatedFieldArrayValues, appendAt, {
1880
- argA: fillEmptyArray(value)
1881
- });
1882
- };
1883
- const prepend = (value, options) => {
1884
- const prependValue = convertToArrayPayload(cloneObject(value));
1885
- const updatedFieldArrayValues = prependAt(control._getFieldArray(name), prependValue);
1886
- control._names.focus = getFocusFieldName(name, 0, options);
1887
- ids.current = prependAt(ids.current, prependValue.map(generateId));
1888
- updateValues(updatedFieldArrayValues);
1889
- setFields(updatedFieldArrayValues);
1890
- control._setFieldArray(name, updatedFieldArrayValues, prependAt, {
1891
- argA: fillEmptyArray(value)
1892
- });
1893
- };
1894
- const remove = (index) => {
1895
- const updatedFieldArrayValues = removeArrayAt(control._getFieldArray(name), index);
1896
- ids.current = removeArrayAt(ids.current, index);
1897
- updateValues(updatedFieldArrayValues);
1898
- setFields(updatedFieldArrayValues);
1899
- !Array.isArray(get(control._fields, name)) && set(control._fields, name, void 0);
1900
- control._setFieldArray(name, updatedFieldArrayValues, removeArrayAt, {
1901
- argA: index
1902
- });
1903
- };
1904
- const insert$1 = (index, value, options) => {
1905
- const insertValue = convertToArrayPayload(cloneObject(value));
1906
- const updatedFieldArrayValues = insert(control._getFieldArray(name), index, insertValue);
1907
- control._names.focus = getFocusFieldName(name, index, options);
1908
- ids.current = insert(ids.current, index, insertValue.map(generateId));
1909
- updateValues(updatedFieldArrayValues);
1910
- setFields(updatedFieldArrayValues);
1911
- control._setFieldArray(name, updatedFieldArrayValues, insert, {
1912
- argA: index,
1913
- argB: fillEmptyArray(value)
1914
- });
1915
- };
1916
- const swap = (indexA, indexB) => {
1917
- const updatedFieldArrayValues = control._getFieldArray(name);
1918
- swapArrayAt(updatedFieldArrayValues, indexA, indexB);
1919
- swapArrayAt(ids.current, indexA, indexB);
1920
- updateValues(updatedFieldArrayValues);
1921
- setFields(updatedFieldArrayValues);
1922
- control._setFieldArray(name, updatedFieldArrayValues, swapArrayAt, {
1923
- argA: indexA,
1924
- argB: indexB
1925
- }, false);
1926
- };
1927
- const move = (from, to) => {
1928
- const updatedFieldArrayValues = control._getFieldArray(name);
1929
- moveArrayAt(updatedFieldArrayValues, from, to);
1930
- moveArrayAt(ids.current, from, to);
1931
- updateValues(updatedFieldArrayValues);
1932
- setFields(updatedFieldArrayValues);
1933
- control._setFieldArray(name, updatedFieldArrayValues, moveArrayAt, {
1934
- argA: from,
1935
- argB: to
1936
- }, false);
1937
- };
1938
- const update = (index, value) => {
1939
- const updateValue = cloneObject(value);
1940
- const updatedFieldArrayValues = updateAt(control._getFieldArray(name), index, updateValue);
1941
- ids.current = [...updatedFieldArrayValues].map((item, i) => !item || i === index ? generateId() : ids.current[i]);
1942
- updateValues(updatedFieldArrayValues);
1943
- setFields([...updatedFieldArrayValues]);
1944
- control._setFieldArray(name, updatedFieldArrayValues, updateAt, {
1945
- argA: index,
1946
- argB: updateValue
1947
- }, true, false);
1948
- };
1949
- const replace = (value) => {
1950
- const updatedFieldArrayValues = convertToArrayPayload(cloneObject(value));
1951
- ids.current = updatedFieldArrayValues.map(generateId);
1952
- updateValues([...updatedFieldArrayValues]);
1953
- setFields([...updatedFieldArrayValues]);
1954
- control._setFieldArray(name, [...updatedFieldArrayValues], (data) => data, {}, true, false);
1955
- };
1956
- We.useEffect(() => {
1957
- control._state.action = false;
1958
- isWatched(name, control._names) && control._subjects.state.next({
1959
- ...control._formState
1960
- });
1961
- if (_actioned.current && (!getValidationModes(control._options.mode).isOnSubmit || control._formState.isSubmitted) && !getValidationModes(control._options.reValidateMode).isOnSubmit) {
1962
- if (control._options.resolver) {
1963
- control._runSchema([name]).then((result) => {
1964
- control._updateIsValidating([name]);
1965
- const error = get(result.errors, name);
1966
- const existingError = get(control._formState.errors, name);
1967
- if (existingError ? !error && existingError.type || error && (existingError.type !== error.type || existingError.message !== error.message) : error && error.type) {
1968
- error ? set(control._formState.errors, name, error) : unset(control._formState.errors, name);
1969
- control._subjects.state.next({
1970
- errors: control._formState.errors
1971
- });
1972
- }
1973
- });
1974
- } else {
1975
- const field = get(control._fields, name);
1976
- if (field && field._f && !(getValidationModes(control._options.reValidateMode).isOnSubmit && getValidationModes(control._options.mode).isOnSubmit)) {
1977
- validateField(field, control._names.disabled, control._formValues, control._options.criteriaMode === VALIDATION_MODE.all, control._options.shouldUseNativeValidation, true).then((error) => !isEmptyObject(error) && control._subjects.state.next({
1978
- errors: updateFieldArrayRootError(control._formState.errors, error, name)
1979
- }));
1980
- }
1981
- }
1982
- }
1983
- control._subjects.state.next({
1984
- name,
1985
- values: cloneObject(control._formValues)
1986
- });
1987
- control._names.focus && iterateFieldsByAction(control._fields, (ref, key) => {
1988
- if (control._names.focus && key.startsWith(control._names.focus) && ref.focus) {
1989
- ref.focus();
1990
- return 1;
1991
- }
1992
- return;
1993
- });
1994
- control._names.focus = "";
1995
- control._setValid();
1996
- _actioned.current = false;
1997
- }, [fields, name, control]);
1998
- We.useEffect(() => {
1999
- !get(control._formValues, name) && control._setFieldArray(name);
2000
- return () => {
2001
- const updateMounted = (name2, value) => {
2002
- const field = get(control._fields, name2);
2003
- if (field && field._f) {
2004
- field._f.mount = value;
2005
- }
2006
- };
2007
- control._options.shouldUnregister || shouldUnregister ? control.unregister(name) : updateMounted(name, false);
2008
- };
2009
- }, [name, control, keyName, shouldUnregister]);
2010
- return {
2011
- swap: We.useCallback(swap, [updateValues, name, control]),
2012
- move: We.useCallback(move, [updateValues, name, control]),
2013
- prepend: We.useCallback(prepend, [updateValues, name, control]),
2014
- append: We.useCallback(append, [updateValues, name, control]),
2015
- remove: We.useCallback(remove, [updateValues, name, control]),
2016
- insert: We.useCallback(insert$1, [updateValues, name, control]),
2017
- update: We.useCallback(update, [updateValues, name, control]),
2018
- replace: We.useCallback(replace, [updateValues, name, control]),
2019
- fields: We.useMemo(() => fields.map((field, index) => ({
2020
- ...field,
2021
- [keyName]: ids.current[index] || generateId()
2022
- })), [fields, keyName])
2023
- };
2024
- }
2025
1976
  function useForm(props = {}) {
2026
1977
  const _formControl = We.useRef(void 0);
2027
1978
  const _values = We.useRef(void 0);
@@ -2106,7 +2057,7 @@ function useForm(props = {}) {
2106
2057
  }, [control, formState.isDirty]);
2107
2058
  We.useEffect(() => {
2108
2059
  var _a;
2109
- if (props.values && !deepEqual$1(props.values, _values.current)) {
2060
+ if (props.values && !deepEqual(props.values, _values.current)) {
2110
2061
  control._reset(props.values, {
2111
2062
  keepFieldsRef: true,
2112
2063
  ...control._options.resetOptions
@@ -2137,7 +2088,7 @@ function useForm(props = {}) {
2137
2088
  var NAME = "Label";
2138
2089
  var Label$1 = reactExports.forwardRef((props, forwardedRef) => {
2139
2090
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
2140
- Primitive.label,
2091
+ Primitive$1.label,
2141
2092
  {
2142
2093
  ...props,
2143
2094
  ref: forwardedRef,
@@ -2152,1197 +2103,12 @@ var Label$1 = reactExports.forwardRef((props, forwardedRef) => {
2152
2103
  });
2153
2104
  Label$1.displayName = NAME;
2154
2105
  var Root = Label$1;
2155
- var TABS_NAME = "Tabs";
2156
- var [createTabsContext] = createContextScope(TABS_NAME, [
2157
- createRovingFocusGroupScope
2158
- ]);
2159
- var useRovingFocusGroupScope = createRovingFocusGroupScope();
2160
- var [TabsProvider, useTabsContext] = createTabsContext(TABS_NAME);
2161
- var Tabs$1 = reactExports.forwardRef(
2162
- (props, forwardedRef) => {
2163
- const {
2164
- __scopeTabs,
2165
- value: valueProp,
2166
- onValueChange,
2167
- defaultValue,
2168
- orientation = "horizontal",
2169
- dir,
2170
- activationMode = "automatic",
2171
- ...tabsProps
2172
- } = props;
2173
- const direction = useDirection(dir);
2174
- const [value, setValue] = useControllableState({
2175
- prop: valueProp,
2176
- onChange: onValueChange,
2177
- defaultProp: defaultValue ?? "",
2178
- caller: TABS_NAME
2179
- });
2180
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
2181
- TabsProvider,
2182
- {
2183
- scope: __scopeTabs,
2184
- baseId: useId(),
2185
- value,
2186
- onValueChange: setValue,
2187
- orientation,
2188
- dir: direction,
2189
- activationMode,
2190
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
2191
- Primitive.div,
2192
- {
2193
- dir: direction,
2194
- "data-orientation": orientation,
2195
- ...tabsProps,
2196
- ref: forwardedRef
2197
- }
2198
- )
2199
- }
2200
- );
2201
- }
2202
- );
2203
- Tabs$1.displayName = TABS_NAME;
2204
- var TAB_LIST_NAME = "TabsList";
2205
- var TabsList$1 = reactExports.forwardRef(
2206
- (props, forwardedRef) => {
2207
- const { __scopeTabs, loop = true, ...listProps } = props;
2208
- const context = useTabsContext(TAB_LIST_NAME, __scopeTabs);
2209
- const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeTabs);
2210
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
2211
- Root$1,
2212
- {
2213
- asChild: true,
2214
- ...rovingFocusGroupScope,
2215
- orientation: context.orientation,
2216
- dir: context.dir,
2217
- loop,
2218
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
2219
- Primitive.div,
2220
- {
2221
- role: "tablist",
2222
- "aria-orientation": context.orientation,
2223
- ...listProps,
2224
- ref: forwardedRef
2225
- }
2226
- )
2227
- }
2228
- );
2229
- }
2230
- );
2231
- TabsList$1.displayName = TAB_LIST_NAME;
2232
- var TRIGGER_NAME = "TabsTrigger";
2233
- var TabsTrigger$1 = reactExports.forwardRef(
2234
- (props, forwardedRef) => {
2235
- const { __scopeTabs, value, disabled = false, ...triggerProps } = props;
2236
- const context = useTabsContext(TRIGGER_NAME, __scopeTabs);
2237
- const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeTabs);
2238
- const triggerId = makeTriggerId(context.baseId, value);
2239
- const contentId = makeContentId(context.baseId, value);
2240
- const isSelected = value === context.value;
2241
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
2242
- Item,
2243
- {
2244
- asChild: true,
2245
- ...rovingFocusGroupScope,
2246
- focusable: !disabled,
2247
- active: isSelected,
2248
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
2249
- Primitive.button,
2250
- {
2251
- type: "button",
2252
- role: "tab",
2253
- "aria-selected": isSelected,
2254
- "aria-controls": contentId,
2255
- "data-state": isSelected ? "active" : "inactive",
2256
- "data-disabled": disabled ? "" : void 0,
2257
- disabled,
2258
- id: triggerId,
2259
- ...triggerProps,
2260
- ref: forwardedRef,
2261
- onMouseDown: composeEventHandlers(props.onMouseDown, (event) => {
2262
- if (!disabled && event.button === 0 && event.ctrlKey === false) {
2263
- context.onValueChange(value);
2264
- } else {
2265
- event.preventDefault();
2266
- }
2267
- }),
2268
- onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
2269
- if ([" ", "Enter"].includes(event.key)) context.onValueChange(value);
2270
- }),
2271
- onFocus: composeEventHandlers(props.onFocus, () => {
2272
- const isAutomaticActivation = context.activationMode !== "manual";
2273
- if (!isSelected && !disabled && isAutomaticActivation) {
2274
- context.onValueChange(value);
2275
- }
2276
- })
2277
- }
2278
- )
2279
- }
2280
- );
2281
- }
2282
- );
2283
- TabsTrigger$1.displayName = TRIGGER_NAME;
2284
- var CONTENT_NAME = "TabsContent";
2285
- var TabsContent$1 = reactExports.forwardRef(
2286
- (props, forwardedRef) => {
2287
- const { __scopeTabs, value, forceMount, children, ...contentProps } = props;
2288
- const context = useTabsContext(CONTENT_NAME, __scopeTabs);
2289
- const triggerId = makeTriggerId(context.baseId, value);
2290
- const contentId = makeContentId(context.baseId, value);
2291
- const isSelected = value === context.value;
2292
- const isMountAnimationPreventedRef = reactExports.useRef(isSelected);
2293
- reactExports.useEffect(() => {
2294
- const rAF = requestAnimationFrame(() => isMountAnimationPreventedRef.current = false);
2295
- return () => cancelAnimationFrame(rAF);
2296
- }, []);
2297
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || isSelected, children: ({ present }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
2298
- Primitive.div,
2299
- {
2300
- "data-state": isSelected ? "active" : "inactive",
2301
- "data-orientation": context.orientation,
2302
- role: "tabpanel",
2303
- "aria-labelledby": triggerId,
2304
- hidden: !present,
2305
- id: contentId,
2306
- tabIndex: 0,
2307
- ...contentProps,
2308
- ref: forwardedRef,
2309
- style: {
2310
- ...props.style,
2311
- animationDuration: isMountAnimationPreventedRef.current ? "0s" : void 0
2312
- },
2313
- children: present && children
2314
- }
2315
- ) });
2316
- }
2317
- );
2318
- TabsContent$1.displayName = CONTENT_NAME;
2319
- function makeTriggerId(baseId, value) {
2320
- return `${baseId}-trigger-${value}`;
2321
- }
2322
- function makeContentId(baseId, value) {
2323
- return `${baseId}-content-${value}`;
2324
- }
2325
- var Root2 = Tabs$1;
2326
- var List = TabsList$1;
2327
- var Trigger = TabsTrigger$1;
2328
- var Content = TabsContent$1;
2329
- function Input({ className, type, ...props }) {
2330
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
2331
- "input",
2332
- {
2333
- type,
2334
- "data-slot": "input",
2335
- className: cn(
2336
- "h-9 w-full min-w-0 rounded-4xl border border-input bg-input/30 px-3 py-1 text-base outline-none transition-colors file:inline-flex file:h-7 file:border-0 file:bg-transparent file:font-medium file:text-foreground file:text-sm placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-[3px] aria-invalid:ring-destructive/20 md:text-sm dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
2337
- className
2338
- ),
2339
- ...props
2340
- }
2341
- );
2342
- }
2343
2106
  const labelVariants = cva(
2344
2107
  "flex select-none items-center gap-2 font-medium text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-50 group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50"
2345
2108
  );
2346
2109
  function Label({ className, ...props }) {
2347
2110
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Root, { "data-slot": "label", className: cn(labelVariants(), className), ...props });
2348
2111
  }
2349
- function getDefaultValue(schema) {
2350
- if (typeof schema === "boolean") return null;
2351
- const type = schema.type;
2352
- if (Array.isArray(type))
2353
- return getDefaultValue({
2354
- ...schema,
2355
- type: type[0]
2356
- });
2357
- if (type === "object" && typeof schema === "object")
2358
- return Object.fromEntries(
2359
- Object.entries(schema.properties ?? {}).map(([key, prop]) => {
2360
- return [key, getDefaultValue(prop)];
2361
- })
2362
- );
2363
- if (type === "array") return [];
2364
- if (type === "null") return null;
2365
- if (type === "string") {
2366
- if (typeof schema === "object" && schema.format === "binary") return void 0;
2367
- return "";
2368
- }
2369
- if (type === "number" || type === "integer") return 0;
2370
- if (type === "boolean") return false;
2371
- }
2372
- function deepEqual(a, b) {
2373
- if (a === b) {
2374
- return true;
2375
- }
2376
- if (a == null || b == null) {
2377
- return false;
2378
- }
2379
- if (typeof a !== "object" || typeof b !== "object") {
2380
- return false;
2381
- }
2382
- if (Array.isArray(a) && Array.isArray(b)) {
2383
- if (a.length !== b.length) {
2384
- return false;
2385
- }
2386
- return a.every((item, index) => deepEqual(item, b[index]));
2387
- }
2388
- if (Array.isArray(a) || Array.isArray(b)) {
2389
- return false;
2390
- }
2391
- const keysA = Object.keys(a);
2392
- const keysB = Object.keys(b);
2393
- if (keysA.length !== keysB.length) {
2394
- return false;
2395
- }
2396
- return keysA.every(
2397
- (key) => Object.prototype.hasOwnProperty.call(b, key) && deepEqual(a[key], b[key])
2398
- );
2399
- }
2400
- function mergeAllOf(schema) {
2401
- if (typeof schema === "boolean" || !schema.allOf) return schema;
2402
- const { allOf, ...rest } = schema;
2403
- let result = rest;
2404
- for (const item of allOf) {
2405
- result = intersection(result, item);
2406
- }
2407
- return result;
2408
- }
2409
- function intersection(a, b) {
2410
- a = mergeAllOf(a);
2411
- b = mergeAllOf(b);
2412
- if (typeof a === "boolean" && typeof b === "boolean") return a && b;
2413
- if (typeof a === "boolean") return a;
2414
- if (typeof b === "boolean") return b;
2415
- const result = { ...a };
2416
- for (const _k in b) {
2417
- const key = _k;
2418
- switch (key) {
2419
- case "$id":
2420
- case "$comment":
2421
- case "description":
2422
- case "additionalItems":
2423
- case "examples":
2424
- case "allOf":
2425
- case "writeOnly":
2426
- case "readOnly":
2427
- break;
2428
- case "title": {
2429
- const value = b[key];
2430
- if (value === void 0) break;
2431
- if (result[key]) {
2432
- result[key] = `${result[key]} & ${value}`;
2433
- } else {
2434
- result[key] = value;
2435
- }
2436
- break;
2437
- }
2438
- case "minItems":
2439
- case "minimum":
2440
- case "exclusiveMinimum":
2441
- case "minProperties":
2442
- case "minContains":
2443
- case "minLength": {
2444
- const value = b[key];
2445
- if (value === void 0) break;
2446
- result[key] = result[key] === void 0 ? value : Math.max(result[key], value);
2447
- break;
2448
- }
2449
- case "maxContains":
2450
- case "maxItems":
2451
- case "maxLength":
2452
- case "maxProperties":
2453
- case "maximum":
2454
- case "exclusiveMaximum": {
2455
- const value = b[key];
2456
- if (value === void 0) break;
2457
- result[key] = result[key] === void 0 ? value : Math.min(result[key], value);
2458
- break;
2459
- }
2460
- // intersection
2461
- case "enum":
2462
- case "anyOf":
2463
- case "oneOf": {
2464
- const value = b[key];
2465
- if (value === void 0) break;
2466
- result[key] = result[key] === void 0 ? value : intersectArray(result[key], value);
2467
- break;
2468
- }
2469
- // require same
2470
- case "format":
2471
- case "const":
2472
- case "type": {
2473
- const value = b[key];
2474
- if (value === void 0) break;
2475
- result[key] ??= value;
2476
- if (!deepEqual(result[key], value)) return false;
2477
- break;
2478
- }
2479
- // add
2480
- case "required": {
2481
- const value = b[key];
2482
- if (value === void 0) break;
2483
- result[key] = [...result[key] ?? [], ...value];
2484
- break;
2485
- }
2486
- case "properties":
2487
- case "patternProperties": {
2488
- const value = b[key];
2489
- if (value === void 0) break;
2490
- if (result[key] === void 0) {
2491
- result[key] = value;
2492
- break;
2493
- }
2494
- const out = {};
2495
- const allProps = /* @__PURE__ */ new Set();
2496
- for (const k in result[key]) allProps.add(k);
2497
- for (const k in value) allProps.add(k);
2498
- for (const prop of allProps) {
2499
- const aProp = result[key][prop];
2500
- const bProp = value[prop];
2501
- if (aProp === void 0) {
2502
- out[prop] = bProp;
2503
- } else if (bProp === void 0) {
2504
- out[prop] = aProp;
2505
- } else {
2506
- out[prop] = intersection(aProp, bProp);
2507
- }
2508
- }
2509
- result[key] = out;
2510
- break;
2511
- }
2512
- case "additionalProperties":
2513
- case "contains":
2514
- case "items": {
2515
- const value = b[key];
2516
- if (value === void 0) break;
2517
- result[key] = result[key] === void 0 ? value : intersection(result[key], value);
2518
- break;
2519
- }
2520
- case "not": {
2521
- const value = b[key];
2522
- if (value === void 0) break;
2523
- if (result[key] && value) {
2524
- result.not = { anyOf: [result[key], value] };
2525
- } else if (value) {
2526
- result.not = value;
2527
- }
2528
- break;
2529
- }
2530
- default:
2531
- result[key] = b[key];
2532
- }
2533
- }
2534
- return result;
2535
- }
2536
- function intersectArray(a, b) {
2537
- const out = /* @__PURE__ */ new Set();
2538
- for (const item of a) {
2539
- if (b.includes(item)) out.add(item);
2540
- }
2541
- for (const item of b) {
2542
- if (a.includes(item)) out.add(item);
2543
- }
2544
- return Array.from(out);
2545
- }
2546
- const SchemaContext = reactExports.createContext(void 0);
2547
- const anyFields = {
2548
- type: ["string", "number", "boolean", "array", "object"],
2549
- items: true,
2550
- additionalProperties: true
2551
- };
2552
- function SchemaProvider({
2553
- schema,
2554
- readOnly,
2555
- writeOnly,
2556
- children
2557
- }) {
2558
- const fieldInfoMap = reactExports.useMemo(() => /* @__PURE__ */ new Map(), []);
2559
- const ajv = reactExports.useMemo(
2560
- () => new Ajv2020({
2561
- strict: false,
2562
- validateSchema: false,
2563
- validateFormats: false,
2564
- schemas: [schema]
2565
- }),
2566
- [schema]
2567
- );
2568
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
2569
- SchemaContext,
2570
- {
2571
- value: reactExports.useMemo(
2572
- () => ({ schema, fieldInfoMap, ajv, readOnly, writeOnly }),
2573
- [schema, fieldInfoMap, ajv, readOnly, writeOnly]
2574
- ),
2575
- children
2576
- }
2577
- );
2578
- }
2579
- function useSchema() {
2580
- return reactExports.use(SchemaContext);
2581
- }
2582
- function useFieldInfo(fieldName, schema, depth) {
2583
- const { fieldInfoMap, ajv } = reactExports.use(SchemaContext);
2584
- const form = useFormContext();
2585
- const keyName = `${fieldName}:${depth}`;
2586
- const [info, setInfo] = reactExports.useState(() => {
2587
- const value = form.getValues(fieldName);
2588
- const initialInfo = fieldInfoMap.get(keyName);
2589
- if (initialInfo) return initialInfo;
2590
- const out = {
2591
- oneOf: -1
2592
- };
2593
- const union = getUnion(schema);
2594
- if (union) {
2595
- const [members, field] = union;
2596
- out.oneOf = members.findIndex((item) => ajv.validate(item, value));
2597
- if (out.oneOf === -1) out.oneOf = 0;
2598
- out.unionField = field;
2599
- }
2600
- if (Array.isArray(schema.type)) {
2601
- const types = schema.type;
2602
- out.selectedType = types.find((type) => {
2603
- schema.type = type;
2604
- const match = ajv.validate(schema, value);
2605
- schema.type = types;
2606
- return match;
2607
- }) ?? types.at(0);
2608
- }
2609
- if (schema.allOf) {
2610
- const merged = mergeAllOf(schema);
2611
- if (typeof merged !== "boolean")
2612
- out.intersection = {
2613
- merged
2614
- };
2615
- }
2616
- return out;
2617
- });
2618
- fieldInfoMap.set(keyName, info);
2619
- return {
2620
- info,
2621
- updateInfo(value) {
2622
- const updated = {
2623
- ...info,
2624
- ...value
2625
- };
2626
- if (updated.oneOf === info.oneOf && updated.selectedType === info.selectedType) return;
2627
- setInfo(updated);
2628
- let valueSchema = schema;
2629
- if (updated.unionField) {
2630
- valueSchema = schema[updated.unionField][updated.oneOf];
2631
- } else if (updated.selectedType) {
2632
- valueSchema = { ...schema, type: updated.selectedType };
2633
- }
2634
- form.setValue(fieldName, getDefaultValue(valueSchema));
2635
- }
2636
- };
2637
- }
2638
- function useResolvedSchema(schema) {
2639
- const { ajv } = reactExports.use(SchemaContext);
2640
- return reactExports.useMemo(() => fallbackAny(dereference(schema, { ajv })), [ajv, schema]);
2641
- }
2642
- function fallbackAny(schema) {
2643
- return typeof schema === "boolean" ? anyFields : schema;
2644
- }
2645
- function getUnion(schema) {
2646
- if (schema.anyOf) {
2647
- return [schema.anyOf, "anyOf"];
2648
- }
2649
- if (schema.oneOf) return [schema.oneOf, "oneOf"];
2650
- }
2651
- function dereference(schema, { ajv }) {
2652
- if (typeof schema === "boolean") return schema;
2653
- if (schema.$ref) return ajv.getSchema(schema.$ref)?.schema ?? false;
2654
- return schema;
2655
- }
2656
- var FormatFlags = /* @__PURE__ */ ((FormatFlags2) => {
2657
- FormatFlags2[FormatFlags2["None"] = 0] = "None";
2658
- FormatFlags2[FormatFlags2["UseAlias"] = 1] = "UseAlias";
2659
- return FormatFlags2;
2660
- })(FormatFlags || {});
2661
- function schemaToString(value, ctx, flags = 0) {
2662
- function union(union2, sep, flags2) {
2663
- const members = /* @__PURE__ */ new Set();
2664
- let nullable = false;
2665
- for (const item of union2) {
2666
- const result2 = run(
2667
- item,
2668
- flags2 | 1
2669
- /* UseAlias */
2670
- );
2671
- if (result2 === "null") {
2672
- nullable = true;
2673
- } else if (result2 !== "unknown") {
2674
- members.add(result2);
2675
- }
2676
- }
2677
- const result = Array.from(members).join(sep);
2678
- return nullable ? `${result} | null` : result;
2679
- }
2680
- function run(schema, flags2) {
2681
- if (schema === true) return "any";
2682
- else if (schema === false) return "never";
2683
- if ((flags2 & 1) === 1) {
2684
- if (schema.title) return schema.title;
2685
- const ref = schema.$ref?.split("/");
2686
- if (ref && ref.length > 0) return ref[ref.length - 1];
2687
- } else if (schema.$ref) {
2688
- const out = dereference(schema, ctx);
2689
- if (typeof out !== "boolean") schema = out;
2690
- }
2691
- if (Array.isArray(schema.type)) {
2692
- return union(
2693
- schema.type.map((type) => ({
2694
- ...schema,
2695
- type
2696
- })),
2697
- " | ",
2698
- flags2
2699
- );
2700
- }
2701
- if (schema.type === "array")
2702
- return `array<${schema.items ? run(
2703
- schema.items,
2704
- flags2 | 1
2705
- /* UseAlias */
2706
- ) : "unknown"}>`;
2707
- const or = schema.oneOf ?? schema.anyOf;
2708
- if (schema.oneOf && schema.anyOf) {
2709
- return `(${union(schema.oneOf, " | ", flags2)}) & (${union(schema.anyOf, " | ", flags2)})`;
2710
- } else if (or) {
2711
- return union(or, " | ", flags2);
2712
- }
2713
- if (schema.allOf) {
2714
- return union(schema.allOf, " & ", flags2);
2715
- }
2716
- if (schema.not) return `not ${run(schema.not, flags2)}`;
2717
- if (schema.type === "string" && schema.format === "binary") return "file";
2718
- if (schema.type) {
2719
- return Array.isArray(schema.type) ? schema.type.filter((v) => v !== "null").join(" | ") : schema.type;
2720
- }
2721
- return "unknown";
2722
- }
2723
- return run(value, flags);
2724
- }
2725
- function Textarea({ className, ...props }) {
2726
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
2727
- "textarea",
2728
- {
2729
- "data-slot": "textarea",
2730
- className: cn(
2731
- "field-sizing-content flex min-h-16 w-full resize-none rounded-xl border border-input bg-input/30 px-3 py-3 text-base outline-none transition-colors placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-[3px] aria-invalid:ring-destructive/20 md:text-sm dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
2732
- className
2733
- ),
2734
- ...props
2735
- }
2736
- );
2737
- }
2738
- function FieldLabel(props) {
2739
- return /* @__PURE__ */ jsxRuntimeExports.jsx("label", { ...props, className: cn("w-full inline-flex items-center gap-0.5", props.className), children: props.children });
2740
- }
2741
- function FieldLabelName({
2742
- required = false,
2743
- className,
2744
- children,
2745
- ...props
2746
- }) {
2747
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { ...props, className: cn(labelVariants(), "me-auto", className), children: [
2748
- children,
2749
- required && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-destructive mx-1", children: "*" })
2750
- ] });
2751
- }
2752
- function FieldLabelType(props) {
2753
- return /* @__PURE__ */ jsxRuntimeExports.jsx("code", { ...props, className: cn("text-xs text-muted-foreground", props.className), children: props.children });
2754
- }
2755
- function ObjectInput({
2756
- field: _field,
2757
- fieldName,
2758
- ...props
2759
- }) {
2760
- const field = useResolvedSchema(_field);
2761
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...props, className: cn("flex flex-col gap-4", props.className), children: [
2762
- Object.entries(field.properties ?? {}).map(([key, child]) => /* @__PURE__ */ jsxRuntimeExports.jsx(
2763
- FieldSet,
2764
- {
2765
- name: key,
2766
- field: child,
2767
- fieldName: `${fieldName}.${key}`,
2768
- isRequired: field.required?.includes(key)
2769
- },
2770
- key
2771
- )),
2772
- (field.additionalProperties || field.patternProperties) && /* @__PURE__ */ jsxRuntimeExports.jsx(
2773
- DynamicProperties,
2774
- {
2775
- fieldName,
2776
- filterKey: (v) => !field.properties || !Object.keys(field.properties).includes(v),
2777
- getType: (key) => {
2778
- for (const pattern in field.patternProperties) {
2779
- if (key.match(RegExp(pattern))) {
2780
- return field.patternProperties[pattern];
2781
- }
2782
- }
2783
- if (field.additionalProperties) return field.additionalProperties;
2784
- return anyFields;
2785
- }
2786
- }
2787
- )
2788
- ] });
2789
- }
2790
- function DynamicProperties({
2791
- fieldName,
2792
- filterKey = () => true,
2793
- getType = () => anyFields
2794
- }) {
2795
- const { control, setValue, getValues } = useFormContext();
2796
- const [nextName, setNextName] = reactExports.useState("");
2797
- const [properties, setProperties] = reactExports.useState(() => {
2798
- const value = getValues(fieldName);
2799
- if (value) return Object.keys(value).filter(filterKey);
2800
- return [];
2801
- });
2802
- const onAppend = () => {
2803
- const name = nextName.trim();
2804
- if (name.length === 0) return;
2805
- setProperties((p) => {
2806
- if (p.includes(name) || !filterKey(name)) return p;
2807
- const type = getType(name);
2808
- setValue(`${fieldName}.${name}`, getDefaultValue(type));
2809
- setNextName("");
2810
- return [...p, name];
2811
- });
2812
- };
2813
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
2814
- properties.map((item) => {
2815
- const type = getType(item);
2816
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
2817
- FieldSet,
2818
- {
2819
- name: item,
2820
- field: type,
2821
- fieldName: `${fieldName}.${item}`,
2822
- toolbar: /* @__PURE__ */ jsxRuntimeExports.jsx(
2823
- "button",
2824
- {
2825
- type: "button",
2826
- "aria-label": "Remove Item",
2827
- className: cn(
2828
- buttonVariants({
2829
- variant: "outline",
2830
- size: "icon-xs"
2831
- })
2832
- ),
2833
- onClick: () => {
2834
- setProperties((p) => p.filter((prop) => prop !== item));
2835
- control.unregister(`${fieldName}.${item}`);
2836
- },
2837
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Trash2, {})
2838
- }
2839
- )
2840
- },
2841
- item
2842
- );
2843
- }),
2844
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 col-span-full", children: [
2845
- /* @__PURE__ */ jsxRuntimeExports.jsx(
2846
- Input,
2847
- {
2848
- value: nextName,
2849
- placeholder: "Enter Property Name",
2850
- onChange: (e) => setNextName(e.target.value),
2851
- onKeyDown: (e) => {
2852
- if (e.key === "Enter") {
2853
- onAppend();
2854
- e.preventDefault();
2855
- }
2856
- }
2857
- }
2858
- ),
2859
- /* @__PURE__ */ jsxRuntimeExports.jsx(
2860
- "button",
2861
- {
2862
- type: "button",
2863
- className: cn(buttonVariants({ variant: "secondary", size: "sm" }), "px-4"),
2864
- onClick: onAppend,
2865
- children: "New"
2866
- }
2867
- )
2868
- ] })
2869
- ] });
2870
- }
2871
- function FieldInput({
2872
- field,
2873
- fieldName,
2874
- isRequired,
2875
- ...props
2876
- }) {
2877
- const form = useFormContext();
2878
- const {
2879
- field: { value, onChange, ...restField },
2880
- fieldState
2881
- } = useController({
2882
- control: form.control,
2883
- name: fieldName
2884
- });
2885
- if (field.type === "null") return;
2886
- if (field.enum) {
2887
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
2888
- Select,
2889
- {
2890
- value: field.enum.indexOf(value).toString(),
2891
- onValueChange: (value2) => {
2892
- onChange(value2 === "-1" ? void 0 : value2);
2893
- },
2894
- disabled: restField.disabled,
2895
- children: [
2896
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { id: fieldName, className: props.className, ...restField, children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, {}) }),
2897
- /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
2898
- field.enum.map((item, i) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: i.toString(), children: JSON.stringify(item) }, i)),
2899
- !isRequired && /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "-1", children: "Unset" })
2900
- ] })
2901
- ]
2902
- }
2903
- );
2904
- }
2905
- if (field.type === "boolean") {
2906
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
2907
- Select,
2908
- {
2909
- value: String(value),
2910
- onValueChange: (value2) => onChange(value2 === "undefined" ? void 0 : value2 === "true"),
2911
- disabled: restField.disabled,
2912
- children: [
2913
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { id: fieldName, className: props.className, ...restField, children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, {}) }),
2914
- /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
2915
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "true", children: "True" }),
2916
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "false", children: "False" }),
2917
- !isRequired && /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "undefined", children: "Unset" })
2918
- ] })
2919
- ]
2920
- }
2921
- );
2922
- }
2923
- const resetBn = fieldState.isDirty && /* @__PURE__ */ jsxRuntimeExports.jsx(
2924
- "button",
2925
- {
2926
- type: "button",
2927
- onClick: () => form.resetField(fieldName),
2928
- className: "text-muted-foreground",
2929
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "size-4" })
2930
- }
2931
- );
2932
- if (field.type === "string") {
2933
- if (field.format === "binary") {
2934
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...props, children: [
2935
- /* @__PURE__ */ jsxRuntimeExports.jsx(
2936
- "label",
2937
- {
2938
- htmlFor: fieldName,
2939
- className: cn(
2940
- buttonVariants({
2941
- variant: "secondary",
2942
- className: "w-full h-9 gap-2 truncate"
2943
- })
2944
- ),
2945
- children: value instanceof File ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
2946
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-muted-foreground text-xs", children: "Selected" }),
2947
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate w-0 flex-1 text-end", children: value.name })
2948
- ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-muted-foreground", children: "Upload" })
2949
- }
2950
- ),
2951
- /* @__PURE__ */ jsxRuntimeExports.jsx(
2952
- "input",
2953
- {
2954
- id: fieldName,
2955
- type: "file",
2956
- multiple: false,
2957
- onChange: (e) => {
2958
- if (!e.target.files) return;
2959
- onChange(e.target.files.item(0));
2960
- },
2961
- hidden: true,
2962
- ...restField
2963
- }
2964
- )
2965
- ] });
2966
- }
2967
- if (field.format === "datetime" || field.format === "time" || field.format === "date")
2968
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...props, className: cn("flex flex-row gap-2", props.className), children: [
2969
- /* @__PURE__ */ jsxRuntimeExports.jsx(
2970
- Input,
2971
- {
2972
- id: fieldName,
2973
- type: field.format,
2974
- placeholder: "Enter value",
2975
- value: value ?? "",
2976
- onChange: (e) => onChange(e.target.value),
2977
- ...restField
2978
- }
2979
- ),
2980
- resetBn
2981
- ] });
2982
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...props, className: cn("flex flex-row gap-2", props.className), children: [
2983
- /* @__PURE__ */ jsxRuntimeExports.jsx(
2984
- Textarea,
2985
- {
2986
- id: fieldName,
2987
- placeholder: "Enter value",
2988
- value: value ?? "",
2989
- onChange: (e) => onChange(e.target.value),
2990
- ...restField
2991
- }
2992
- ),
2993
- resetBn
2994
- ] });
2995
- }
2996
- if (field.type === "integer" || field.type === "number") {
2997
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...props, className: cn("flex flex-row gap-2", props.className), children: [
2998
- /* @__PURE__ */ jsxRuntimeExports.jsx(
2999
- Input,
3000
- {
3001
- id: fieldName,
3002
- placeholder: "Enter value",
3003
- type: "number",
3004
- step: field.type === "integer" ? 1 : void 0,
3005
- value: value ?? "",
3006
- onChange: (e) => {
3007
- if (!Number.isNaN(e.target.valueAsNumber)) {
3008
- onChange(e.target.valueAsNumber);
3009
- }
3010
- },
3011
- ...restField
3012
- }
3013
- ),
3014
- resetBn
3015
- ] });
3016
- }
3017
- }
3018
- function FieldSet({
3019
- field: _field,
3020
- fieldName,
3021
- toolbar,
3022
- name,
3023
- isRequired,
3024
- depth = 0,
3025
- slotType,
3026
- collapsible = true,
3027
- ...props
3028
- }) {
3029
- const schemaContext = useSchema();
3030
- const field = useResolvedSchema(_field);
3031
- const [show, setShow] = reactExports.useState(!collapsible);
3032
- const { info, updateInfo } = useFieldInfo(fieldName, field, depth);
3033
- if (_field === false) return;
3034
- if (field.readOnly && !schemaContext.readOnly) return;
3035
- if (field.writeOnly && !schemaContext.writeOnly) return;
3036
- if (info.unionField) {
3037
- const union = field[info.unionField];
3038
- const showSelect = union.length > 1;
3039
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
3040
- FieldSet,
3041
- {
3042
- ...props,
3043
- name,
3044
- fieldName,
3045
- isRequired,
3046
- field: union[info.oneOf],
3047
- depth: depth + 1,
3048
- slotType: showSelect ? false : slotType,
3049
- toolbar: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
3050
- showSelect && /* @__PURE__ */ jsxRuntimeExports.jsx(
3051
- "select",
3052
- {
3053
- className: "text-xs font-mono",
3054
- value: info.oneOf,
3055
- onChange: (e) => {
3056
- updateInfo({
3057
- oneOf: Number(e.target.value)
3058
- });
3059
- },
3060
- children: union.map((item, i) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: i, className: "bg-popover text-popover-foreground", children: schemaToString(item, schemaContext, FormatFlags.UseAlias) }, i))
3061
- }
3062
- ),
3063
- toolbar
3064
- ] })
3065
- }
3066
- );
3067
- }
3068
- if (Array.isArray(field.type)) {
3069
- const showSelect = field.type.length > 1;
3070
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
3071
- FieldSet,
3072
- {
3073
- ...props,
3074
- name,
3075
- fieldName,
3076
- isRequired,
3077
- field: {
3078
- ...field,
3079
- type: info.selectedType
3080
- },
3081
- depth: depth + 1,
3082
- slotType: showSelect ? false : slotType,
3083
- toolbar: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
3084
- showSelect && /* @__PURE__ */ jsxRuntimeExports.jsx(
3085
- "select",
3086
- {
3087
- className: "text-xs font-mono",
3088
- value: info.selectedType,
3089
- onChange: (e) => {
3090
- updateInfo({
3091
- selectedType: e.target.value
3092
- });
3093
- },
3094
- children: field.type.map((item) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: item, className: "bg-popover text-popover-foreground", children: item }, item))
3095
- }
3096
- ),
3097
- toolbar
3098
- ] })
3099
- }
3100
- );
3101
- }
3102
- const showBn = collapsible && /* @__PURE__ */ jsxRuntimeExports.jsx(
3103
- "button",
3104
- {
3105
- type: "button",
3106
- onClick: () => setShow((prev) => !prev),
3107
- className: cn(
3108
- buttonVariants({
3109
- size: "icon-xs",
3110
- variant: "ghost",
3111
- className: "text-muted-foreground -ms-1"
3112
- })
3113
- ),
3114
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDown, { className: cn(show && "rotate-180") })
3115
- }
3116
- );
3117
- if (field.type === "object" || info.intersection) {
3118
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
3119
- "fieldset",
3120
- {
3121
- ...props,
3122
- className: cn("flex flex-col gap-1.5 col-span-full @container", props.className),
3123
- children: [
3124
- /* @__PURE__ */ jsxRuntimeExports.jsxs(FieldLabel, { htmlFor: fieldName, children: [
3125
- showBn,
3126
- /* @__PURE__ */ jsxRuntimeExports.jsx(FieldLabelName, { required: isRequired, children: name }),
3127
- slotType ?? /* @__PURE__ */ jsxRuntimeExports.jsx(FieldLabelType, { children: schemaToString(field, schemaContext) }),
3128
- toolbar
3129
- ] }),
3130
- show && /* @__PURE__ */ jsxRuntimeExports.jsx(
3131
- ObjectInput,
3132
- {
3133
- field: info.intersection?.merged ?? field,
3134
- fieldName,
3135
- ...props,
3136
- className: cn(
3137
- "rounded-lg border bg-card text-card-foreground p-3 shadow-sm",
3138
- props.className
3139
- )
3140
- }
3141
- )
3142
- ]
3143
- }
3144
- );
3145
- }
3146
- if (field.type === "array") {
3147
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("fieldset", { ...props, className: cn("flex flex-col gap-1.5 col-span-full", props.className), children: [
3148
- /* @__PURE__ */ jsxRuntimeExports.jsxs(FieldLabel, { htmlFor: fieldName, children: [
3149
- showBn,
3150
- /* @__PURE__ */ jsxRuntimeExports.jsx(FieldLabelName, { required: isRequired, children: name }),
3151
- slotType ?? /* @__PURE__ */ jsxRuntimeExports.jsx(FieldLabelType, { children: schemaToString(field, schemaContext) }),
3152
- toolbar
3153
- ] }),
3154
- show && /* @__PURE__ */ jsxRuntimeExports.jsx(
3155
- ArrayInput,
3156
- {
3157
- fieldName,
3158
- items: field.items ?? anyFields,
3159
- ...props,
3160
- className: cn(
3161
- "rounded-lg border bg-card text-card-foreground p-3 shadow-sm",
3162
- props.className
3163
- )
3164
- }
3165
- )
3166
- ] });
3167
- }
3168
- if (!field.type) {
3169
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
3170
- FieldSet,
3171
- {
3172
- ...props,
3173
- name,
3174
- fieldName,
3175
- isRequired,
3176
- field: anyFields,
3177
- depth: depth + 1,
3178
- slotType,
3179
- toolbar
3180
- }
3181
- );
3182
- }
3183
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("fieldset", { ...props, className: cn("flex flex-col gap-1.5", props.className), children: [
3184
- /* @__PURE__ */ jsxRuntimeExports.jsxs(FieldLabel, { htmlFor: fieldName, children: [
3185
- /* @__PURE__ */ jsxRuntimeExports.jsx(FieldLabelName, { required: isRequired, children: name }),
3186
- slotType ?? /* @__PURE__ */ jsxRuntimeExports.jsx(FieldLabelType, { children: schemaToString(field, schemaContext) }),
3187
- toolbar
3188
- ] }),
3189
- /* @__PURE__ */ jsxRuntimeExports.jsx(FieldInput, { field, fieldName, isRequired })
3190
- ] });
3191
- }
3192
- function ArrayInput({
3193
- fieldName,
3194
- items,
3195
- ...props
3196
- }) {
3197
- const name = fieldName.split(".").at(-1) ?? "";
3198
- const { fields, append, remove } = useFieldArray({
3199
- name: fieldName
3200
- });
3201
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...props, className: cn("flex flex-col gap-2", props.className), children: [
3202
- fields.map((item, index) => /* @__PURE__ */ jsxRuntimeExports.jsx(
3203
- FieldSet,
3204
- {
3205
- name: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-muted-foreground", children: [
3206
- name,
3207
- "[",
3208
- index,
3209
- "]"
3210
- ] }),
3211
- field: items,
3212
- isRequired: true,
3213
- fieldName: `${fieldName}.${index}`,
3214
- toolbar: /* @__PURE__ */ jsxRuntimeExports.jsx(
3215
- "button",
3216
- {
3217
- type: "button",
3218
- "aria-label": "Remove Item",
3219
- className: cn(
3220
- buttonVariants({
3221
- variant: "outline",
3222
- size: "icon-xs"
3223
- })
3224
- ),
3225
- onClick: () => remove(index),
3226
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Trash2, {})
3227
- }
3228
- )
3229
- },
3230
- item.id
3231
- )),
3232
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
3233
- "button",
3234
- {
3235
- type: "button",
3236
- className: cn(
3237
- buttonVariants({
3238
- variant: "secondary",
3239
- className: "gap-1.5 py-2",
3240
- size: "sm"
3241
- })
3242
- ),
3243
- onClick: () => {
3244
- append(getDefaultValue(items));
3245
- },
3246
- children: [
3247
- /* @__PURE__ */ jsxRuntimeExports.jsx(Plus, { className: "size-4" }),
3248
- "New Item"
3249
- ]
3250
- }
3251
- )
3252
- ] });
3253
- }
3254
- function JSONSchemaEditorProvider({
3255
- children,
3256
- defaultValue,
3257
- onValueChange,
3258
- ...props
3259
- }) {
3260
- const form = useForm({
3261
- defaultValues: { value: defaultValue }
3262
- });
3263
- const onValueChangeRef = reactExports.useRef(onValueChange);
3264
- onValueChangeRef.current = onValueChange;
3265
- reactExports.useEffect(() => {
3266
- return form.subscribe({
3267
- formState: {
3268
- values: true
3269
- },
3270
- callback(data) {
3271
- onValueChangeRef.current(data.values.value);
3272
- }
3273
- });
3274
- }, []);
3275
- return /* @__PURE__ */ jsxRuntimeExports.jsx(FormProvider, { ...form, children: /* @__PURE__ */ jsxRuntimeExports.jsx(SchemaProvider, { ...props, children }) });
3276
- }
3277
- function JSONSchemaEditorContent() {
3278
- const { schema } = useSchema();
3279
- const field = useResolvedSchema(schema);
3280
- const fieldName = "value";
3281
- if (field.format === "binary") return /* @__PURE__ */ jsxRuntimeExports.jsx(FieldSet, { field, fieldName });
3282
- return /* @__PURE__ */ jsxRuntimeExports.jsx(FieldSet, { field, fieldName, collapsible: false });
3283
- }
3284
- function Tabs({
3285
- className,
3286
- orientation = "horizontal",
3287
- ...props
3288
- }) {
3289
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
3290
- Root2,
3291
- {
3292
- "data-slot": "tabs",
3293
- "data-orientation": orientation,
3294
- className: cn("group/tabs flex gap-2 data-horizontal:flex-col", className),
3295
- ...props
3296
- }
3297
- );
3298
- }
3299
- function TabsList({ className, ...props }) {
3300
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
3301
- List,
3302
- {
3303
- "data-slot": "tabs-list",
3304
- className: cn(
3305
- "rounded-4xl bg-muted p-1 group-data-horizontal/tabs:h-9 group-data-vertical/tabs:rounded-2xl group/tabs-list text-muted-foreground inline-flex w-fit items-center justify-center group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col",
3306
- className
3307
- ),
3308
- ...props
3309
- }
3310
- );
3311
- }
3312
- function TabsTrigger({ className, ...props }) {
3313
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
3314
- Trigger,
3315
- {
3316
- "data-slot": "tabs-trigger",
3317
- className: cn(
3318
- "relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 whitespace-nowrap rounded-xl border border-transparent px-2 py-1 font-medium text-foreground/60 text-sm transition-colors hover:text-foreground focus-visible:border-ring focus-visible:outline-1 focus-visible:outline-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start group-data-vertical/tabs:px-2.5 group-data-vertical/tabs:py-1.5 dark:text-muted-foreground dark:hover:text-foreground [&_svg]:size-4 [&_svg]:shrink-0",
3319
- "data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground",
3320
- className
3321
- ),
3322
- ...props
3323
- }
3324
- );
3325
- }
3326
- function TabsContent({ className, ...props }) {
3327
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
3328
- Content,
3329
- {
3330
- "data-slot": "tabs-content",
3331
- className: cn("flex-1 text-sm outline-none", className),
3332
- ...props
3333
- }
3334
- );
3335
- }
3336
- const Editor = reactExports.lazy(() => import("./yaml-BEdFfhvc.js").then((mod) => ({ default: mod.YamlEditor })));
3337
- function YamlEditorLazy(props) {
3338
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
3339
- reactExports.Suspense,
3340
- {
3341
- fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col bg-secondary text-secondary-foreground overflow-hidden border rounded-lg", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-2 h-[240px] text-sm font-mono flex items-center justify-center text-muted-foreground", children: "Loading editor..." }) }),
3342
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Editor, { ...props })
3343
- }
3344
- );
3345
- }
3346
2112
  function StatusBar({ status }) {
3347
2113
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sticky bottom-2 rounded-full bg-popover text-xs text-popover-foreground inline-flex items-center gap-1 px-3 py-1.5 border shadow-lg z-20 mx-auto", children: status === "updating" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
3348
2114
  /* @__PURE__ */ jsxRuntimeExports.jsx(Spinner, { className: "text-primary" }),
@@ -3387,10 +2153,7 @@ function useSync(onSyncCallback) {
3387
2153
  }
3388
2154
  export {
3389
2155
  Controller as C,
3390
- Input as I,
3391
- JSONSchemaEditorProvider as J,
3392
2156
  Label as L,
3393
- Plus as P,
3394
2157
  StatusBar as S,
3395
2158
  Tabs as T,
3396
2159
  YamlEditorLazy as Y,
@@ -3398,7 +2161,5 @@ export {
3398
2161
  TabsList as b,
3399
2162
  TabsTrigger as c,
3400
2163
  TabsContent as d,
3401
- JSONSchemaEditorContent as e,
3402
- Trash2 as f,
3403
2164
  useForm as u
3404
2165
  };