@soft-stech/bootsman-ui-shadcn 1.3.8 → 1.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,294 +0,0 @@
1
- import { defineComponent as y, computed as g, provide as D, openBlock as m, createBlock as p, unref as e, withCtx as t, renderSlot as N, normalizeProps as F, guardReactiveProps as O, createVNode as o, createTextVNode as b, toDisplayString as j, createElementBlock as _, Fragment as S, renderList as E, createElementVNode as J, createCommentVNode as P, resolveDynamicComponent as Q, mergeProps as W } from "vue";
2
- import * as v from "zod";
3
- import { useField as T, FieldContextKey as I, FieldArray as X } from "vee-validate";
4
- import { getBaseType as V, beautifyObjectName as z, getBaseSchema as Z, getDefaultValueInZodStack as Y } from "./components/ui/auto-form/utils.js";
5
- import x from "./components/ui/auto-form/dependencies.js";
6
- import { _ as L } from "./BuiAutoFormLabel.vue_vue_type_script_setup_true_lang-DzpWjTLE.js";
7
- import { _ as w } from "./BuiAccordion.vue_vue_type_script_setup_true_lang-nxe3iIoM.js";
8
- import { _ as M } from "./BuiAccordionContent.vue_vue_type_script_setup_true_lang-pCTYRg2Z.js";
9
- import { _ as R } from "./BuiAccordionItem.vue_vue_type_script_setup_true_lang-Dp-3E0FN.js";
10
- import { _ as H } from "./BuiAccordionTrigger.vue_vue_type_script_setup_true_lang-CtFZfwMC.js";
11
- import { d as ee, _ as k } from "./utils-DPuEjrVV.js";
12
- import { _ as ae } from "./BuiSeparator.vue_vue_type_script_setup_true_lang-DbN8eyHh.js";
13
- import { _ as U } from "./BuiFormItem.vue_vue_type_script_setup_true_lang-COw7Rwow.js";
14
- import { _ as se } from "./BuiFormMessage.vue_vue_type_script_setup_true_lang-DTdflpS8.js";
15
- import { T as oe, _ as ie } from "./BuiAutoFormFieldFile.vue_vue_type_script_setup_true_lang-DrJwn66q.js";
16
- import { _ as A } from "./BuiAutoFormFieldBoolean.vue_vue_type_script_setup_true_lang-tuxavlOe.js";
17
- import { _ as te } from "./BuiAutoFormFieldDate.vue_vue_type_script_setup_true_lang-Bzg1m-ii.js";
18
- import { _ as q } from "./BuiAutoFormFieldEnum.vue_vue_type_script_setup_true_lang-Bqe8Rt85.js";
19
- import { _ as B } from "./BuiAutoFormFieldInput.vue_vue_type_script_setup_true_lang-DtBFfiOK.js";
20
- import { _ as ne } from "./BuiAutoFormFieldNumber.vue_vue_type_script_setup_true_lang-ClLqHM1Y.js";
21
- /**
22
- * @license lucide-vue-next v0.441.0 - ISC
23
- *
24
- * This source code is licensed under the ISC license.
25
- * See the LICENSE file in the root directory of this source tree.
26
- */
27
- const re = ee("PlusIcon", [
28
- ["path", { d: "M5 12h14", key: "1ays0h" }],
29
- ["path", { d: "M12 5v14", key: "s699le" }]
30
- ]), le = { class: "!my-4 flex justify-end" }, de = /* @__PURE__ */ y({
31
- __name: "BuiAutoFormFieldArray",
32
- props: {
33
- fieldName: {},
34
- required: { type: Boolean },
35
- config: {},
36
- schema: {},
37
- disabled: { type: Boolean }
38
- },
39
- setup(f) {
40
- const i = f;
41
- function c(a) {
42
- return a instanceof v.ZodArray;
43
- }
44
- function u(a) {
45
- return a instanceof v.ZodDefault;
46
- }
47
- const n = g(() => {
48
- if (!i.schema) return;
49
- const a = c(i.schema) ? i.schema._def.type : u(i.schema) ? (
50
- // @ts-expect-error missing schema
51
- i.schema._def.innerType._def.type
52
- ) : null;
53
- return {
54
- type: V(a),
55
- schema: a
56
- };
57
- }), l = T(i.fieldName);
58
- return D(I, l), (a, r) => (m(), p(e(X), {
59
- as: "section",
60
- name: a.fieldName
61
- }, {
62
- default: t(({ fields: s, remove: d, push: G }) => [
63
- N(a.$slots, "default", F(O(i)), () => [
64
- o(e(w), {
65
- type: "multiple",
66
- class: "w-full",
67
- collapsible: "",
68
- disabled: a.disabled,
69
- "as-child": ""
70
- }, {
71
- default: t(() => [
72
- o(e(U), null, {
73
- default: t(() => [
74
- o(e(R), {
75
- value: a.fieldName,
76
- class: "border-none"
77
- }, {
78
- default: t(() => [
79
- o(e(H), null, {
80
- default: t(() => [
81
- o(L, {
82
- class: "text-base",
83
- required: a.required
84
- }, {
85
- default: t(() => [
86
- b(j(a.schema?.description || e(z)(a.fieldName)), 1)
87
- ]),
88
- _: 1
89
- }, 8, ["required"])
90
- ]),
91
- _: 1
92
- }),
93
- o(e(M), null, {
94
- default: t(() => [
95
- (m(!0), _(S, null, E(s, (h, $) => (m(), _("div", {
96
- key: h.key,
97
- class: "mb-4 p-1"
98
- }, [
99
- o(K, {
100
- "field-name": `${a.fieldName}[${$}]`,
101
- label: a.fieldName,
102
- shape: n.value,
103
- config: a.config
104
- }, null, 8, ["field-name", "label", "shape", "config"]),
105
- J("div", le, [
106
- o(e(k), {
107
- type: "button",
108
- size: "icon",
109
- variant: "secondary",
110
- onClick: (ce) => d($)
111
- }, {
112
- default: t(() => [
113
- o(e(oe), { size: 16 })
114
- ]),
115
- _: 2
116
- }, 1032, ["onClick"])
117
- ]),
118
- h.isLast ? P("", !0) : (m(), p(e(ae), { key: 0 }))
119
- ]))), 128)),
120
- o(e(k), {
121
- type: "button",
122
- variant: "secondary",
123
- class: "mt-4 flex items-center",
124
- onClick: (h) => G(null)
125
- }, {
126
- default: t(() => [
127
- o(e(re), {
128
- class: "mr-2",
129
- size: 16
130
- }),
131
- r[0] || (r[0] = b(" Add "))
132
- ]),
133
- _: 2
134
- }, 1032, ["onClick"])
135
- ]),
136
- _: 2
137
- }, 1024),
138
- o(e(se))
139
- ]),
140
- _: 2
141
- }, 1032, ["value"])
142
- ]),
143
- _: 2
144
- }, 1024)
145
- ]),
146
- _: 2
147
- }, 1032, ["disabled"])
148
- ])
149
- ]),
150
- _: 3
151
- }, 8, ["name"]));
152
- }
153
- }), me = /* @__PURE__ */ y({
154
- __name: "BuiAutoFormFieldObject",
155
- props: {
156
- fieldName: {},
157
- required: { type: Boolean },
158
- config: {},
159
- schema: {},
160
- disabled: { type: Boolean }
161
- },
162
- setup(f) {
163
- const i = f, c = g(() => {
164
- const n = {};
165
- if (!i.schema) return;
166
- const l = Z(i.schema)?.shape;
167
- if (l)
168
- return Object.keys(l).forEach((a) => {
169
- const r = l[a], s = Z(r);
170
- let d = s && "values" in s._def ? s._def.values : void 0;
171
- !Array.isArray(d) && typeof d == "object" && (d = Object.values(d)), n[a] = {
172
- type: V(r),
173
- default: Y(r),
174
- options: d,
175
- required: !["ZodOptional", "ZodNullable"].includes(r._def.typeName),
176
- schema: r
177
- };
178
- }), n;
179
- }), u = T(i.fieldName);
180
- return D(I, u), (n, l) => (m(), _("section", null, [
181
- N(n.$slots, "default", F(O(i)), () => [
182
- o(e(w), {
183
- type: "single",
184
- "as-child": "",
185
- class: "w-full",
186
- collapsible: "",
187
- disabled: n.disabled
188
- }, {
189
- default: t(() => [
190
- o(e(U), null, {
191
- default: t(() => [
192
- o(e(R), {
193
- value: n.fieldName,
194
- class: "border-none"
195
- }, {
196
- default: t(() => [
197
- o(e(H), null, {
198
- default: t(() => [
199
- o(L, {
200
- class: "text-base",
201
- required: n.required
202
- }, {
203
- default: t(() => [
204
- b(j(n.schema?.description || e(z)(n.fieldName)), 1)
205
- ]),
206
- _: 1
207
- }, 8, ["required"])
208
- ]),
209
- _: 1
210
- }),
211
- o(e(M), { class: "space-y-5 p-1" }, {
212
- default: t(() => [
213
- (m(!0), _(S, null, E(c.value, (a, r) => (m(), p(K, {
214
- key: r,
215
- config: n.config?.[r],
216
- "field-name": `${n.fieldName}.${r.toString()}`,
217
- label: r.toString(),
218
- shape: a
219
- }, null, 8, ["config", "field-name", "label", "shape"]))), 128))
220
- ]),
221
- _: 1
222
- })
223
- ]),
224
- _: 1
225
- }, 8, ["value"])
226
- ]),
227
- _: 1
228
- })
229
- ]),
230
- _: 1
231
- }, 8, ["disabled"])
232
- ])
233
- ]));
234
- }
235
- }), C = {
236
- date: te,
237
- select: q,
238
- radio: q,
239
- checkbox: A,
240
- switch: A,
241
- textarea: B,
242
- number: ne,
243
- string: B,
244
- file: ie,
245
- array: de,
246
- object: me
247
- }, fe = {
248
- ZodString: "string",
249
- ZodBoolean: "checkbox",
250
- ZodDate: "date",
251
- ZodEnum: "select",
252
- ZodNativeEnum: "select",
253
- ZodNumber: "number",
254
- ZodArray: "array",
255
- ZodObject: "object"
256
- }, K = /* @__PURE__ */ y({
257
- __name: "BuiAutoFormField",
258
- props: {
259
- fieldName: {},
260
- shape: {},
261
- config: {}
262
- },
263
- setup(f) {
264
- const i = f;
265
- function c(s) {
266
- return !!s?.component;
267
- }
268
- const u = g(() => {
269
- if (["ZodObject", "ZodArray"].includes(i.shape?.type))
270
- return { schema: i.shape?.schema };
271
- }), { isDisabled: n, isHidden: l, isRequired: a, overrideOptions: r } = x(i.fieldName);
272
- return (s, d) => e(l) ? P("", !0) : (m(), p(Q(c(s.config) ? typeof s.config.component == "string" ? e(C)[s.config.component] : s.config.component : e(C)[e(fe)[s.shape.type]]), W({
273
- key: 0,
274
- "field-name": s.fieldName,
275
- label: s.shape.schema?.description,
276
- required: e(a) || s.shape.required,
277
- options: e(r) || s.shape.options,
278
- disabled: e(n),
279
- config: s.config
280
- }, u.value), {
281
- default: t(() => [
282
- N(s.$slots, "default")
283
- ]),
284
- _: 3
285
- }, 16, ["field-name", "label", "required", "options", "disabled", "config"]));
286
- }
287
- });
288
- export {
289
- fe as D,
290
- C as I,
291
- K as _,
292
- de as a,
293
- me as b
294
- };