@mulmochat-plugin/form 0.1.0 → 0.1.1
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/README.md +13 -60
- package/dist/common/types.d.ts +2 -0
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +2 -6
- package/dist/index.js +302 -302
- package/dist/plugin/index.d.ts +18 -0
- package/dist/plugin/samples.d.ts +5 -0
- package/dist/plugin/types.d.ts +207 -0
- package/dist/style.css +1 -0
- package/package.json +2 -2
- package/dist/form.css +0 -1
- package/dist/plugin.d.ts +0 -105
- package/dist/types.d.ts +0 -5
- /package/dist/{previews/FormPreview.vue.d.ts → plugin/Preview.vue.d.ts} +0 -0
- /package/dist/{views/FormView.vue.d.ts → plugin/View.vue.d.ts} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,26 +1,273 @@
|
|
|
1
1
|
import { defineComponent as j, ref as D, watch as N, computed as E, createElementBlock as l, openBlock as u, createCommentVNode as f, createElementVNode as c, toDisplayString as p, createTextVNode as L, Fragment as C, renderList as q, withModifiers as O, normalizeClass as y, withDirectives as V, vModelText as A, vModelRadio as G, vModelSelect as K, vModelCheckbox as Q, normalizeStyle as X } from "vue";
|
|
2
|
-
const Z =
|
|
2
|
+
const Z = "presentForm", ee = {
|
|
3
|
+
type: "function",
|
|
4
|
+
name: Z,
|
|
5
|
+
description: "Create a structured form to collect information from the user. Supports various field types including text input, textarea, multiple choice (radio), dropdown menus, checkboxes, date/time pickers, and number inputs. Each field can have validation rules and help text.",
|
|
6
|
+
parameters: {
|
|
7
|
+
type: "object",
|
|
8
|
+
properties: {
|
|
9
|
+
title: {
|
|
10
|
+
type: "string",
|
|
11
|
+
description: "Optional title for the form (e.g., 'User Registration')"
|
|
12
|
+
},
|
|
13
|
+
description: {
|
|
14
|
+
type: "string",
|
|
15
|
+
description: "Optional description explaining the purpose of the form"
|
|
16
|
+
},
|
|
17
|
+
fields: {
|
|
18
|
+
type: "array",
|
|
19
|
+
description: "Array of form fields with various types and configurations",
|
|
20
|
+
items: {
|
|
21
|
+
type: "object",
|
|
22
|
+
properties: {
|
|
23
|
+
id: {
|
|
24
|
+
type: "string",
|
|
25
|
+
description: "Unique identifier for the field (e.g., 'email', 'birthdate'). This will be the key in the JSON response. Use descriptive camelCase or snake_case names."
|
|
26
|
+
},
|
|
27
|
+
type: {
|
|
28
|
+
type: "string",
|
|
29
|
+
enum: [
|
|
30
|
+
"text",
|
|
31
|
+
"textarea",
|
|
32
|
+
"radio",
|
|
33
|
+
"dropdown",
|
|
34
|
+
"checkbox",
|
|
35
|
+
"date",
|
|
36
|
+
"time",
|
|
37
|
+
"number"
|
|
38
|
+
],
|
|
39
|
+
description: "Field type: 'text' for short text, 'textarea' for long text, 'radio' for 2-6 choices, 'dropdown' for many choices, 'checkbox' for multiple selections, 'date' for date picker, 'time' for time picker, 'number' for numeric input"
|
|
40
|
+
},
|
|
41
|
+
label: {
|
|
42
|
+
type: "string",
|
|
43
|
+
description: "Field label shown to the user"
|
|
44
|
+
},
|
|
45
|
+
description: {
|
|
46
|
+
type: "string",
|
|
47
|
+
description: "Optional help text explaining the field"
|
|
48
|
+
},
|
|
49
|
+
required: {
|
|
50
|
+
type: "boolean",
|
|
51
|
+
description: "Whether the field is required (default: false)"
|
|
52
|
+
},
|
|
53
|
+
placeholder: {
|
|
54
|
+
type: "string",
|
|
55
|
+
description: "Placeholder text for text/textarea fields"
|
|
56
|
+
},
|
|
57
|
+
validation: {
|
|
58
|
+
type: "string",
|
|
59
|
+
description: "For text fields: 'email', 'url', 'phone', or a regex pattern"
|
|
60
|
+
},
|
|
61
|
+
minLength: {
|
|
62
|
+
type: "number",
|
|
63
|
+
description: "Minimum character length for textarea fields"
|
|
64
|
+
},
|
|
65
|
+
maxLength: {
|
|
66
|
+
type: "number",
|
|
67
|
+
description: "Maximum character length for textarea fields"
|
|
68
|
+
},
|
|
69
|
+
rows: {
|
|
70
|
+
type: "number",
|
|
71
|
+
description: "Number of visible rows for textarea (default: 4)"
|
|
72
|
+
},
|
|
73
|
+
choices: {
|
|
74
|
+
type: "array",
|
|
75
|
+
items: { type: "string" },
|
|
76
|
+
description: "Array of choices for radio/dropdown/checkbox fields. Radio should have 2-6 choices, dropdown for 7+ choices."
|
|
77
|
+
},
|
|
78
|
+
searchable: {
|
|
79
|
+
type: "boolean",
|
|
80
|
+
description: "Make dropdown searchable (for large lists)"
|
|
81
|
+
},
|
|
82
|
+
minSelections: {
|
|
83
|
+
type: "number",
|
|
84
|
+
description: "Minimum number of selections for checkbox fields"
|
|
85
|
+
},
|
|
86
|
+
maxSelections: {
|
|
87
|
+
type: "number",
|
|
88
|
+
description: "Maximum number of selections for checkbox fields"
|
|
89
|
+
},
|
|
90
|
+
minDate: {
|
|
91
|
+
type: "string",
|
|
92
|
+
description: "Minimum date (ISO format: YYYY-MM-DD)"
|
|
93
|
+
},
|
|
94
|
+
maxDate: {
|
|
95
|
+
type: "string",
|
|
96
|
+
description: "Maximum date (ISO format: YYYY-MM-DD)"
|
|
97
|
+
},
|
|
98
|
+
format: {
|
|
99
|
+
type: "string",
|
|
100
|
+
description: "Format for time fields: '12hr' or '24hr'"
|
|
101
|
+
},
|
|
102
|
+
min: {
|
|
103
|
+
type: "number",
|
|
104
|
+
description: "Minimum value for number fields"
|
|
105
|
+
},
|
|
106
|
+
max: {
|
|
107
|
+
type: "number",
|
|
108
|
+
description: "Maximum value for number fields"
|
|
109
|
+
},
|
|
110
|
+
step: {
|
|
111
|
+
type: "number",
|
|
112
|
+
description: "Step increment for number fields"
|
|
113
|
+
},
|
|
114
|
+
defaultValue: {
|
|
115
|
+
description: "Optional default/pre-filled value for the field. Type varies by field: string for text/textarea/radio/dropdown/date/time, number for number fields, array of strings for checkbox fields. For radio/dropdown, must be one of the choices. For checkbox, must be a subset of choices."
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
required: ["id", "type", "label"]
|
|
119
|
+
},
|
|
120
|
+
minItems: 1
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
required: ["fields"]
|
|
124
|
+
}
|
|
125
|
+
}, te = [
|
|
126
|
+
{
|
|
127
|
+
name: "Contact Form",
|
|
128
|
+
args: {
|
|
129
|
+
title: "Contact Us",
|
|
130
|
+
description: "Please fill out the form below to get in touch.",
|
|
131
|
+
fields: [
|
|
132
|
+
{
|
|
133
|
+
id: "name",
|
|
134
|
+
type: "text",
|
|
135
|
+
label: "Full Name",
|
|
136
|
+
required: !0,
|
|
137
|
+
placeholder: "John Doe"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
id: "email",
|
|
141
|
+
type: "text",
|
|
142
|
+
label: "Email Address",
|
|
143
|
+
required: !0,
|
|
144
|
+
placeholder: "john@example.com",
|
|
145
|
+
validation: "email"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
id: "subject",
|
|
149
|
+
type: "dropdown",
|
|
150
|
+
label: "Subject",
|
|
151
|
+
choices: [
|
|
152
|
+
"General Inquiry",
|
|
153
|
+
"Technical Support",
|
|
154
|
+
"Sales",
|
|
155
|
+
"Feedback"
|
|
156
|
+
],
|
|
157
|
+
required: !0
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
id: "message",
|
|
161
|
+
type: "textarea",
|
|
162
|
+
label: "Message",
|
|
163
|
+
required: !0,
|
|
164
|
+
minLength: 10,
|
|
165
|
+
maxLength: 500,
|
|
166
|
+
rows: 5
|
|
167
|
+
}
|
|
168
|
+
]
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
name: "Survey Form",
|
|
173
|
+
args: {
|
|
174
|
+
title: "Customer Satisfaction Survey",
|
|
175
|
+
fields: [
|
|
176
|
+
{
|
|
177
|
+
id: "satisfaction",
|
|
178
|
+
type: "radio",
|
|
179
|
+
label: "How satisfied are you with our service?",
|
|
180
|
+
choices: [
|
|
181
|
+
"Very Satisfied",
|
|
182
|
+
"Satisfied",
|
|
183
|
+
"Neutral",
|
|
184
|
+
"Dissatisfied",
|
|
185
|
+
"Very Dissatisfied"
|
|
186
|
+
],
|
|
187
|
+
required: !0
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
id: "features",
|
|
191
|
+
type: "checkbox",
|
|
192
|
+
label: "Which features do you use most?",
|
|
193
|
+
choices: [
|
|
194
|
+
"Dashboard",
|
|
195
|
+
"Reports",
|
|
196
|
+
"Analytics",
|
|
197
|
+
"API",
|
|
198
|
+
"Integrations"
|
|
199
|
+
],
|
|
200
|
+
minSelections: 1,
|
|
201
|
+
maxSelections: 3
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
id: "recommendation",
|
|
205
|
+
type: "number",
|
|
206
|
+
label: "How likely are you to recommend us? (0-10)",
|
|
207
|
+
min: 0,
|
|
208
|
+
max: 10,
|
|
209
|
+
step: 1
|
|
210
|
+
}
|
|
211
|
+
]
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
name: "Event Registration",
|
|
216
|
+
args: {
|
|
217
|
+
title: "Event Registration",
|
|
218
|
+
description: "Register for our upcoming conference.",
|
|
219
|
+
fields: [
|
|
220
|
+
{
|
|
221
|
+
id: "attendeeName",
|
|
222
|
+
type: "text",
|
|
223
|
+
label: "Attendee Name",
|
|
224
|
+
required: !0
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
id: "eventDate",
|
|
228
|
+
type: "date",
|
|
229
|
+
label: "Preferred Date",
|
|
230
|
+
required: !0,
|
|
231
|
+
minDate: "2025-01-01",
|
|
232
|
+
maxDate: "2025-12-31"
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
id: "sessionTime",
|
|
236
|
+
type: "time",
|
|
237
|
+
label: "Session Time",
|
|
238
|
+
format: "12hr"
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
id: "dietaryRestrictions",
|
|
242
|
+
type: "checkbox",
|
|
243
|
+
label: "Dietary Restrictions",
|
|
244
|
+
choices: ["Vegetarian", "Vegan", "Gluten-Free", "Halal", "Kosher"]
|
|
245
|
+
}
|
|
246
|
+
]
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
], re = { class: "w-full h-full overflow-y-auto p-8" }, ae = {
|
|
3
250
|
key: 0,
|
|
4
251
|
class: "max-w-3xl w-full mx-auto"
|
|
5
|
-
},
|
|
252
|
+
}, ie = {
|
|
6
253
|
key: 0,
|
|
7
254
|
class: "text-gray-900 text-3xl font-bold mb-4 text-center"
|
|
8
|
-
},
|
|
255
|
+
}, oe = {
|
|
9
256
|
key: 1,
|
|
10
257
|
class: "text-gray-600 text-center mb-8 text-lg"
|
|
11
|
-
},
|
|
258
|
+
}, ne = {
|
|
12
259
|
key: 2,
|
|
13
260
|
class: "bg-red-50 border-2 border-red-500 rounded-lg p-4 mb-6",
|
|
14
261
|
role: "alert"
|
|
15
|
-
},
|
|
262
|
+
}, se = { class: "text-red-700 space-y-1" }, le = ["href", "onClick"], ue = ["id"], de = ["for"], ce = {
|
|
16
263
|
key: 0,
|
|
17
264
|
class: "text-red-500 ml-1",
|
|
18
265
|
"aria-label": "required"
|
|
19
|
-
},
|
|
266
|
+
}, me = {
|
|
20
267
|
key: 0,
|
|
21
268
|
class: "text-gray-600 text-sm mb-2"
|
|
22
|
-
},
|
|
23
|
-
__name: "
|
|
269
|
+
}, he = ["id", "onUpdate:modelValue", "placeholder", "aria-invalid", "aria-describedby", "onBlur", "onInput"], pe = ["id", "onUpdate:modelValue", "placeholder", "rows", "aria-invalid", "aria-describedby", "onBlur", "onInput"], ve = ["id", "onUpdate:modelValue", "min", "max", "step", "aria-invalid", "aria-describedby", "onBlur", "onInput"], be = ["id", "onUpdate:modelValue", "min", "max", "aria-invalid", "aria-describedby", "onBlur", "onChange"], ge = ["id", "onUpdate:modelValue", "aria-invalid", "aria-describedby", "onBlur", "onChange"], ye = ["aria-invalid", "aria-describedby"], fe = ["name", "value", "onUpdate:modelValue", "onChange", "onBlur"], xe = { class: "text-gray-800" }, we = ["id", "onUpdate:modelValue", "aria-invalid", "aria-describedby", "onBlur", "onChange"], $e = ["value"], ke = ["aria-invalid", "aria-describedby"], _e = ["value", "onUpdate:modelValue", "onChange", "onBlur"], Ve = { class: "text-gray-800" }, Se = ["id"], Fe = { key: 0 }, De = { class: "mt-8 flex justify-center" }, Ee = ["disabled"], Le = { class: "mt-4 text-center text-gray-600 text-sm" }, Me = /* @__PURE__ */ j({
|
|
270
|
+
__name: "View",
|
|
24
271
|
props: {
|
|
25
272
|
selectedResult: {},
|
|
26
273
|
sendTextMessage: { type: Function }
|
|
@@ -231,11 +478,11 @@ const Z = { class: "w-full h-full overflow-y-auto p-8" }, ee = {
|
|
|
231
478
|
);
|
|
232
479
|
v.value = !0, m.sendTextMessage(i);
|
|
233
480
|
}
|
|
234
|
-
return (r, i) => (u(), l("div",
|
|
235
|
-
d.value ? (u(), l("div",
|
|
236
|
-
d.value.title ? (u(), l("h2",
|
|
237
|
-
d.value.description ? (u(), l("p",
|
|
238
|
-
M.value && b.value.size > 0 ? (u(), l("div",
|
|
481
|
+
return (r, i) => (u(), l("div", re, [
|
|
482
|
+
d.value ? (u(), l("div", ae, [
|
|
483
|
+
d.value.title ? (u(), l("h2", ie, p(d.value.title), 1)) : f("", !0),
|
|
484
|
+
d.value.description ? (u(), l("p", oe, p(d.value.description), 1)) : f("", !0),
|
|
485
|
+
M.value && b.value.size > 0 ? (u(), l("div", ne, [
|
|
239
486
|
i[0] || (i[0] = c("h3", { class: "text-red-800 font-semibold mb-2 flex items-center gap-2" }, [
|
|
240
487
|
c("svg", {
|
|
241
488
|
class: "w-5 h-5",
|
|
@@ -251,13 +498,13 @@ const Z = { class: "w-full h-full overflow-y-auto p-8" }, ee = {
|
|
|
251
498
|
]),
|
|
252
499
|
L(" Please fix the following errors: ")
|
|
253
500
|
], -1)),
|
|
254
|
-
c("ul",
|
|
501
|
+
c("ul", se, [
|
|
255
502
|
(u(!0), l(C, null, q(b.value, ([e, a]) => (u(), l("li", { key: e }, [
|
|
256
503
|
c("a", {
|
|
257
504
|
href: `#${e}`,
|
|
258
505
|
onClick: O((h) => B(e), ["prevent"]),
|
|
259
506
|
class: "hover:underline cursor-pointer"
|
|
260
|
-
}, p(a.message), 9,
|
|
507
|
+
}, p(a.message), 9, le)
|
|
261
508
|
]))), 128))
|
|
262
509
|
])
|
|
263
510
|
])) : f("", !0),
|
|
@@ -277,9 +524,9 @@ const Z = { class: "w-full h-full overflow-y-auto p-8" }, ee = {
|
|
|
277
524
|
}])
|
|
278
525
|
}, [
|
|
279
526
|
L(p(e.label) + " ", 1),
|
|
280
|
-
e.required ? (u(), l("span",
|
|
281
|
-
], 10,
|
|
282
|
-
e.description ? (u(), l("p",
|
|
527
|
+
e.required ? (u(), l("span", ce, "*")) : f("", !0)
|
|
528
|
+
], 10, de),
|
|
529
|
+
e.description ? (u(), l("p", me, p(e.description), 1)) : f("", !0),
|
|
283
530
|
e.type === "text" ? V((u(), l("input", {
|
|
284
531
|
key: 1,
|
|
285
532
|
id: `input-${e.id}`,
|
|
@@ -294,7 +541,7 @@ const Z = { class: "w-full h-full overflow-y-auto p-8" }, ee = {
|
|
|
294
541
|
"border-red-500 focus:ring-red-500": s(e.id) && o.value.has(e.id),
|
|
295
542
|
"border-gray-300": !s(e.id) || !o.value.has(e.id)
|
|
296
543
|
}])
|
|
297
|
-
}, null, 42,
|
|
544
|
+
}, null, 42, he)), [
|
|
298
545
|
[A, n.value[e.id]]
|
|
299
546
|
]) : e.type === "textarea" ? V((u(), l("textarea", {
|
|
300
547
|
key: 2,
|
|
@@ -310,7 +557,7 @@ const Z = { class: "w-full h-full overflow-y-auto p-8" }, ee = {
|
|
|
310
557
|
"border-red-500 focus:ring-red-500": s(e.id) && o.value.has(e.id),
|
|
311
558
|
"border-gray-300": !s(e.id) || !o.value.has(e.id)
|
|
312
559
|
}])
|
|
313
|
-
}, null, 42,
|
|
560
|
+
}, null, 42, pe)), [
|
|
314
561
|
[A, n.value[e.id]]
|
|
315
562
|
]) : e.type === "number" ? V((u(), l("input", {
|
|
316
563
|
key: 3,
|
|
@@ -328,7 +575,7 @@ const Z = { class: "w-full h-full overflow-y-auto p-8" }, ee = {
|
|
|
328
575
|
"border-red-500 focus:ring-red-500": s(e.id) && o.value.has(e.id),
|
|
329
576
|
"border-gray-300": !s(e.id) || !o.value.has(e.id)
|
|
330
577
|
}])
|
|
331
|
-
}, null, 42,
|
|
578
|
+
}, null, 42, ve)), [
|
|
332
579
|
[
|
|
333
580
|
A,
|
|
334
581
|
n.value[e.id],
|
|
@@ -350,7 +597,7 @@ const Z = { class: "w-full h-full overflow-y-auto p-8" }, ee = {
|
|
|
350
597
|
"border-red-500 focus:ring-red-500": s(e.id) && o.value.has(e.id),
|
|
351
598
|
"border-gray-300": !s(e.id) || !o.value.has(e.id)
|
|
352
599
|
}])
|
|
353
|
-
}, null, 42,
|
|
600
|
+
}, null, 42, be)), [
|
|
354
601
|
[A, n.value[e.id]]
|
|
355
602
|
]) : e.type === "time" ? V((u(), l("input", {
|
|
356
603
|
key: 5,
|
|
@@ -365,7 +612,7 @@ const Z = { class: "w-full h-full overflow-y-auto p-8" }, ee = {
|
|
|
365
612
|
"border-red-500 focus:ring-red-500": s(e.id) && o.value.has(e.id),
|
|
366
613
|
"border-gray-300": !s(e.id) || !o.value.has(e.id)
|
|
367
614
|
}])
|
|
368
|
-
}, null, 42,
|
|
615
|
+
}, null, 42, ge)), [
|
|
369
616
|
[A, n.value[e.id]]
|
|
370
617
|
]) : e.type === "radio" ? (u(), l("div", {
|
|
371
618
|
key: 6,
|
|
@@ -389,12 +636,12 @@ const Z = { class: "w-full h-full overflow-y-auto p-8" }, ee = {
|
|
|
389
636
|
onChange: (F) => _(e.id),
|
|
390
637
|
onBlur: (F) => k(e.id),
|
|
391
638
|
class: "mr-3 h-4 w-4 flex-shrink-0"
|
|
392
|
-
}, null, 40,
|
|
639
|
+
}, null, 40, fe), [
|
|
393
640
|
[G, n.value[e.id]]
|
|
394
641
|
]),
|
|
395
|
-
c("span",
|
|
642
|
+
c("span", xe, p(a), 1)
|
|
396
643
|
], 2))), 128))
|
|
397
|
-
], 8,
|
|
644
|
+
], 8, ye)) : e.type === "dropdown" ? V((u(), l("select", {
|
|
398
645
|
key: 7,
|
|
399
646
|
id: `input-${e.id}`,
|
|
400
647
|
"onUpdate:modelValue": (a) => n.value[e.id] = a,
|
|
@@ -414,8 +661,8 @@ const Z = { class: "w-full h-full overflow-y-auto p-8" }, ee = {
|
|
|
414
661
|
(u(!0), l(C, null, q(e.choices, (a, h) => (u(), l("option", {
|
|
415
662
|
key: h,
|
|
416
663
|
value: h
|
|
417
|
-
}, p(a), 9,
|
|
418
|
-
], 42,
|
|
664
|
+
}, p(a), 9, $e))), 128))
|
|
665
|
+
], 42, we)), [
|
|
419
666
|
[K, n.value[e.id]]
|
|
420
667
|
]) : e.type === "checkbox" ? (u(), l("div", {
|
|
421
668
|
key: 8,
|
|
@@ -440,12 +687,12 @@ const Z = { class: "w-full h-full overflow-y-auto p-8" }, ee = {
|
|
|
440
687
|
onChange: (F) => _(e.id),
|
|
441
688
|
onBlur: (F) => k(e.id),
|
|
442
689
|
class: "mr-3 h-4 w-4 flex-shrink-0"
|
|
443
|
-
}, null, 40,
|
|
690
|
+
}, null, 40, _e), [
|
|
444
691
|
[Q, n.value[e.id]]
|
|
445
692
|
]),
|
|
446
|
-
c("span",
|
|
693
|
+
c("span", Ve, p(a), 1)
|
|
447
694
|
], 2))), 128))
|
|
448
|
-
], 8,
|
|
695
|
+
], 8, ke)) : f("", !0),
|
|
449
696
|
s(e.id) && o.value.has(e.id) ? (u(), l("div", {
|
|
450
697
|
key: 9,
|
|
451
698
|
id: `${e.id}-error`,
|
|
@@ -465,7 +712,7 @@ const Z = { class: "w-full h-full overflow-y-auto p-8" }, ee = {
|
|
|
465
712
|
})
|
|
466
713
|
], -1)),
|
|
467
714
|
L(" " + p(b.value.get(e.id)?.message), 1)
|
|
468
|
-
], 8,
|
|
715
|
+
], 8, Se)) : f("", !0),
|
|
469
716
|
Y(e) ? (u(), l("div", {
|
|
470
717
|
key: 10,
|
|
471
718
|
class: y(["text-sm mt-2", {
|
|
@@ -474,11 +721,11 @@ const Z = { class: "w-full h-full overflow-y-auto p-8" }, ee = {
|
|
|
474
721
|
}])
|
|
475
722
|
}, [
|
|
476
723
|
L(p((n.value[e.id] || "").length) + " ", 1),
|
|
477
|
-
e.maxLength ? (u(), l("span",
|
|
724
|
+
e.maxLength ? (u(), l("span", Fe, " / " + p(e.maxLength), 1)) : f("", !0),
|
|
478
725
|
i[3] || (i[3] = L(" characters ", -1))
|
|
479
726
|
], 2)) : f("", !0)
|
|
480
|
-
], 10,
|
|
481
|
-
c("div",
|
|
727
|
+
], 10, ue))), 128)),
|
|
728
|
+
c("div", De, [
|
|
482
729
|
c("button", {
|
|
483
730
|
type: "submit",
|
|
484
731
|
disabled: v.value,
|
|
@@ -486,26 +733,26 @@ const Z = { class: "w-full h-full overflow-y-auto p-8" }, ee = {
|
|
|
486
733
|
v.value ? "bg-green-600 cursor-default" : "bg-blue-600 hover:bg-blue-700",
|
|
487
734
|
"px-8 py-3 rounded-lg text-white font-semibold text-lg transition-colors"
|
|
488
735
|
])
|
|
489
|
-
}, p(v.value ? "Submitted" : "Submit Form"), 11,
|
|
736
|
+
}, p(v.value ? "Submitted" : "Submit Form"), 11, Ee)
|
|
490
737
|
]),
|
|
491
|
-
c("div",
|
|
738
|
+
c("div", Le, p(J.value) + " / " + p(H.value) + " required fields completed ", 1)
|
|
492
739
|
], 32)
|
|
493
740
|
])) : f("", !0)
|
|
494
741
|
]));
|
|
495
742
|
}
|
|
496
|
-
}),
|
|
743
|
+
}), Ce = (S, x) => {
|
|
497
744
|
const m = S.__vccOpts || S;
|
|
498
745
|
for (const [$, d] of x)
|
|
499
746
|
m[$] = d;
|
|
500
747
|
return m;
|
|
501
|
-
},
|
|
748
|
+
}, qe = /* @__PURE__ */ Ce(Me, [["__scopeId", "data-v-b79fe71c"]]), Ae = { class: "w-full h-full flex flex-col items-center justify-center p-4 bg-gradient-to-br from-blue-50 to-indigo-50 rounded-lg border-2 border-gray-200" }, Re = { class: "text-center" }, Be = { class: "text-gray-900 font-bold text-lg mb-1 line-clamp-2" }, Ue = { class: "text-gray-600 text-sm mb-2" }, Ne = {
|
|
502
749
|
key: 0,
|
|
503
750
|
class: "flex items-center justify-center gap-2"
|
|
504
|
-
},
|
|
751
|
+
}, Oe = { class: "w-32 h-2 bg-gray-200 rounded-full overflow-hidden" }, je = { class: "text-xs text-gray-500" }, Ie = {
|
|
505
752
|
key: 1,
|
|
506
753
|
class: "inline-flex items-center gap-1 px-3 py-1 bg-green-100 text-green-700 rounded-full text-xs font-semibold"
|
|
507
|
-
},
|
|
508
|
-
__name: "
|
|
754
|
+
}, Pe = /* @__PURE__ */ j({
|
|
755
|
+
__name: "Preview",
|
|
509
756
|
props: {
|
|
510
757
|
result: {}
|
|
511
758
|
},
|
|
@@ -520,8 +767,8 @@ const Z = { class: "w-full h-full overflow-y-auto p-8" }, ee = {
|
|
|
520
767
|
}).length;
|
|
521
768
|
return Math.round(M / b.length * 100);
|
|
522
769
|
});
|
|
523
|
-
return (b, v) => (u(), l("div",
|
|
524
|
-
c("div",
|
|
770
|
+
return (b, v) => (u(), l("div", Ae, [
|
|
771
|
+
c("div", Re, [
|
|
525
772
|
v[1] || (v[1] = c("svg", {
|
|
526
773
|
class: "w-12 h-12 mx-auto mb-3 text-blue-600",
|
|
527
774
|
fill: "none",
|
|
@@ -535,9 +782,9 @@ const Z = { class: "w-full h-full overflow-y-auto p-8" }, ee = {
|
|
|
535
782
|
d: "M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"
|
|
536
783
|
})
|
|
537
784
|
], -1)),
|
|
538
|
-
c("h3",
|
|
539
|
-
c("p",
|
|
540
|
-
n.value ? (u(), l("div",
|
|
785
|
+
c("h3", Be, p(m.value?.title || "Form"), 1),
|
|
786
|
+
c("p", Ue, p(d.value) + " field" + p(d.value !== 1 ? "s" : ""), 1),
|
|
787
|
+
n.value ? (u(), l("div", Ie, [...v[0] || (v[0] = [
|
|
541
788
|
c("svg", {
|
|
542
789
|
class: "w-3 h-3",
|
|
543
790
|
fill: "currentColor",
|
|
@@ -550,266 +797,19 @@ const Z = { class: "w-full h-full overflow-y-auto p-8" }, ee = {
|
|
|
550
797
|
})
|
|
551
798
|
], -1),
|
|
552
799
|
L(" Submitted ", -1)
|
|
553
|
-
])])) : (u(), l("div",
|
|
554
|
-
c("div",
|
|
800
|
+
])])) : (u(), l("div", Ne, [
|
|
801
|
+
c("div", Oe, [
|
|
555
802
|
c("div", {
|
|
556
803
|
class: "h-full bg-blue-600 transition-all duration-300",
|
|
557
804
|
style: X({ width: `${o.value}%` })
|
|
558
805
|
}, null, 4)
|
|
559
806
|
]),
|
|
560
|
-
c("span",
|
|
807
|
+
c("span", je, p(o.value) + "%", 1)
|
|
561
808
|
]))
|
|
562
809
|
])
|
|
563
810
|
]));
|
|
564
811
|
}
|
|
565
|
-
}),
|
|
566
|
-
{
|
|
567
|
-
name: "Contact Form",
|
|
568
|
-
args: {
|
|
569
|
-
title: "Contact Us",
|
|
570
|
-
description: "Please fill out the form below to get in touch.",
|
|
571
|
-
fields: [
|
|
572
|
-
{
|
|
573
|
-
id: "name",
|
|
574
|
-
type: "text",
|
|
575
|
-
label: "Full Name",
|
|
576
|
-
required: !0,
|
|
577
|
-
placeholder: "John Doe"
|
|
578
|
-
},
|
|
579
|
-
{
|
|
580
|
-
id: "email",
|
|
581
|
-
type: "text",
|
|
582
|
-
label: "Email Address",
|
|
583
|
-
required: !0,
|
|
584
|
-
placeholder: "john@example.com",
|
|
585
|
-
validation: "email"
|
|
586
|
-
},
|
|
587
|
-
{
|
|
588
|
-
id: "subject",
|
|
589
|
-
type: "dropdown",
|
|
590
|
-
label: "Subject",
|
|
591
|
-
choices: [
|
|
592
|
-
"General Inquiry",
|
|
593
|
-
"Technical Support",
|
|
594
|
-
"Sales",
|
|
595
|
-
"Feedback"
|
|
596
|
-
],
|
|
597
|
-
required: !0
|
|
598
|
-
},
|
|
599
|
-
{
|
|
600
|
-
id: "message",
|
|
601
|
-
type: "textarea",
|
|
602
|
-
label: "Message",
|
|
603
|
-
required: !0,
|
|
604
|
-
minLength: 10,
|
|
605
|
-
maxLength: 500,
|
|
606
|
-
rows: 5
|
|
607
|
-
}
|
|
608
|
-
]
|
|
609
|
-
}
|
|
610
|
-
},
|
|
611
|
-
{
|
|
612
|
-
name: "Survey Form",
|
|
613
|
-
args: {
|
|
614
|
-
title: "Customer Satisfaction Survey",
|
|
615
|
-
fields: [
|
|
616
|
-
{
|
|
617
|
-
id: "satisfaction",
|
|
618
|
-
type: "radio",
|
|
619
|
-
label: "How satisfied are you with our service?",
|
|
620
|
-
choices: [
|
|
621
|
-
"Very Satisfied",
|
|
622
|
-
"Satisfied",
|
|
623
|
-
"Neutral",
|
|
624
|
-
"Dissatisfied",
|
|
625
|
-
"Very Dissatisfied"
|
|
626
|
-
],
|
|
627
|
-
required: !0
|
|
628
|
-
},
|
|
629
|
-
{
|
|
630
|
-
id: "features",
|
|
631
|
-
type: "checkbox",
|
|
632
|
-
label: "Which features do you use most?",
|
|
633
|
-
choices: [
|
|
634
|
-
"Dashboard",
|
|
635
|
-
"Reports",
|
|
636
|
-
"Analytics",
|
|
637
|
-
"API",
|
|
638
|
-
"Integrations"
|
|
639
|
-
],
|
|
640
|
-
minSelections: 1,
|
|
641
|
-
maxSelections: 3
|
|
642
|
-
},
|
|
643
|
-
{
|
|
644
|
-
id: "recommendation",
|
|
645
|
-
type: "number",
|
|
646
|
-
label: "How likely are you to recommend us? (0-10)",
|
|
647
|
-
min: 0,
|
|
648
|
-
max: 10,
|
|
649
|
-
step: 1
|
|
650
|
-
}
|
|
651
|
-
]
|
|
652
|
-
}
|
|
653
|
-
},
|
|
654
|
-
{
|
|
655
|
-
name: "Event Registration",
|
|
656
|
-
args: {
|
|
657
|
-
title: "Event Registration",
|
|
658
|
-
description: "Register for our upcoming conference.",
|
|
659
|
-
fields: [
|
|
660
|
-
{
|
|
661
|
-
id: "attendeeName",
|
|
662
|
-
type: "text",
|
|
663
|
-
label: "Attendee Name",
|
|
664
|
-
required: !0
|
|
665
|
-
},
|
|
666
|
-
{
|
|
667
|
-
id: "eventDate",
|
|
668
|
-
type: "date",
|
|
669
|
-
label: "Preferred Date",
|
|
670
|
-
required: !0,
|
|
671
|
-
minDate: "2025-01-01",
|
|
672
|
-
maxDate: "2025-12-31"
|
|
673
|
-
},
|
|
674
|
-
{
|
|
675
|
-
id: "sessionTime",
|
|
676
|
-
type: "time",
|
|
677
|
-
label: "Session Time",
|
|
678
|
-
format: "12hr"
|
|
679
|
-
},
|
|
680
|
-
{
|
|
681
|
-
id: "dietaryRestrictions",
|
|
682
|
-
type: "checkbox",
|
|
683
|
-
label: "Dietary Restrictions",
|
|
684
|
-
choices: ["Vegetarian", "Vegan", "Gluten-Free", "Halal", "Kosher"]
|
|
685
|
-
}
|
|
686
|
-
]
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
], Pe = {
|
|
690
|
-
type: "function",
|
|
691
|
-
name: je,
|
|
692
|
-
description: "Create a structured form to collect information from the user. Supports various field types including text input, textarea, multiple choice (radio), dropdown menus, checkboxes, date/time pickers, and number inputs. Each field can have validation rules and help text.",
|
|
693
|
-
parameters: {
|
|
694
|
-
type: "object",
|
|
695
|
-
properties: {
|
|
696
|
-
title: {
|
|
697
|
-
type: "string",
|
|
698
|
-
description: "Optional title for the form (e.g., 'User Registration')"
|
|
699
|
-
},
|
|
700
|
-
description: {
|
|
701
|
-
type: "string",
|
|
702
|
-
description: "Optional description explaining the purpose of the form"
|
|
703
|
-
},
|
|
704
|
-
fields: {
|
|
705
|
-
type: "array",
|
|
706
|
-
description: "Array of form fields with various types and configurations",
|
|
707
|
-
items: {
|
|
708
|
-
type: "object",
|
|
709
|
-
properties: {
|
|
710
|
-
id: {
|
|
711
|
-
type: "string",
|
|
712
|
-
description: "Unique identifier for the field (e.g., 'email', 'birthdate'). This will be the key in the JSON response. Use descriptive camelCase or snake_case names."
|
|
713
|
-
},
|
|
714
|
-
type: {
|
|
715
|
-
type: "string",
|
|
716
|
-
enum: [
|
|
717
|
-
"text",
|
|
718
|
-
"textarea",
|
|
719
|
-
"radio",
|
|
720
|
-
"dropdown",
|
|
721
|
-
"checkbox",
|
|
722
|
-
"date",
|
|
723
|
-
"time",
|
|
724
|
-
"number"
|
|
725
|
-
],
|
|
726
|
-
description: "Field type: 'text' for short text, 'textarea' for long text, 'radio' for 2-6 choices, 'dropdown' for many choices, 'checkbox' for multiple selections, 'date' for date picker, 'time' for time picker, 'number' for numeric input"
|
|
727
|
-
},
|
|
728
|
-
label: {
|
|
729
|
-
type: "string",
|
|
730
|
-
description: "Field label shown to the user"
|
|
731
|
-
},
|
|
732
|
-
description: {
|
|
733
|
-
type: "string",
|
|
734
|
-
description: "Optional help text explaining the field"
|
|
735
|
-
},
|
|
736
|
-
required: {
|
|
737
|
-
type: "boolean",
|
|
738
|
-
description: "Whether the field is required (default: false)"
|
|
739
|
-
},
|
|
740
|
-
placeholder: {
|
|
741
|
-
type: "string",
|
|
742
|
-
description: "Placeholder text for text/textarea fields"
|
|
743
|
-
},
|
|
744
|
-
validation: {
|
|
745
|
-
type: "string",
|
|
746
|
-
description: "For text fields: 'email', 'url', 'phone', or a regex pattern"
|
|
747
|
-
},
|
|
748
|
-
minLength: {
|
|
749
|
-
type: "number",
|
|
750
|
-
description: "Minimum character length for textarea fields"
|
|
751
|
-
},
|
|
752
|
-
maxLength: {
|
|
753
|
-
type: "number",
|
|
754
|
-
description: "Maximum character length for textarea fields"
|
|
755
|
-
},
|
|
756
|
-
rows: {
|
|
757
|
-
type: "number",
|
|
758
|
-
description: "Number of visible rows for textarea (default: 4)"
|
|
759
|
-
},
|
|
760
|
-
choices: {
|
|
761
|
-
type: "array",
|
|
762
|
-
items: { type: "string" },
|
|
763
|
-
description: "Array of choices for radio/dropdown/checkbox fields. Radio should have 2-6 choices, dropdown for 7+ choices."
|
|
764
|
-
},
|
|
765
|
-
searchable: {
|
|
766
|
-
type: "boolean",
|
|
767
|
-
description: "Make dropdown searchable (for large lists)"
|
|
768
|
-
},
|
|
769
|
-
minSelections: {
|
|
770
|
-
type: "number",
|
|
771
|
-
description: "Minimum number of selections for checkbox fields"
|
|
772
|
-
},
|
|
773
|
-
maxSelections: {
|
|
774
|
-
type: "number",
|
|
775
|
-
description: "Maximum number of selections for checkbox fields"
|
|
776
|
-
},
|
|
777
|
-
minDate: {
|
|
778
|
-
type: "string",
|
|
779
|
-
description: "Minimum date (ISO format: YYYY-MM-DD)"
|
|
780
|
-
},
|
|
781
|
-
maxDate: {
|
|
782
|
-
type: "string",
|
|
783
|
-
description: "Maximum date (ISO format: YYYY-MM-DD)"
|
|
784
|
-
},
|
|
785
|
-
format: {
|
|
786
|
-
type: "string",
|
|
787
|
-
description: "Format for time fields: '12hr' or '24hr'"
|
|
788
|
-
},
|
|
789
|
-
min: {
|
|
790
|
-
type: "number",
|
|
791
|
-
description: "Minimum value for number fields"
|
|
792
|
-
},
|
|
793
|
-
max: {
|
|
794
|
-
type: "number",
|
|
795
|
-
description: "Maximum value for number fields"
|
|
796
|
-
},
|
|
797
|
-
step: {
|
|
798
|
-
type: "number",
|
|
799
|
-
description: "Step increment for number fields"
|
|
800
|
-
},
|
|
801
|
-
defaultValue: {
|
|
802
|
-
description: "Optional default/pre-filled value for the field. Type varies by field: string for text/textarea/radio/dropdown/date/time, number for number fields, array of strings for checkbox fields. For radio/dropdown, must be one of the choices. For checkbox, must be a subset of choices."
|
|
803
|
-
}
|
|
804
|
-
},
|
|
805
|
-
required: ["id", "type", "label"]
|
|
806
|
-
},
|
|
807
|
-
minItems: 1
|
|
808
|
-
}
|
|
809
|
-
},
|
|
810
|
-
required: ["fields"]
|
|
811
|
-
}
|
|
812
|
-
}, Te = async (S, x) => {
|
|
812
|
+
}), Te = async (S, x) => {
|
|
813
813
|
try {
|
|
814
814
|
const { title: m, description: $, fields: d } = x;
|
|
815
815
|
if (!d || !Array.isArray(d) || d.length === 0)
|
|
@@ -981,13 +981,13 @@ const Z = { class: "w-full h-full overflow-y-auto p-8" }, ee = {
|
|
|
981
981
|
};
|
|
982
982
|
}
|
|
983
983
|
}, ze = {
|
|
984
|
-
toolDefinition:
|
|
984
|
+
toolDefinition: ee,
|
|
985
985
|
execute: Te,
|
|
986
986
|
generatingMessage: "Preparing form...",
|
|
987
987
|
isEnabled: () => !0,
|
|
988
|
-
viewComponent:
|
|
989
|
-
previewComponent:
|
|
990
|
-
samples:
|
|
988
|
+
viewComponent: qe,
|
|
989
|
+
previewComponent: Pe,
|
|
990
|
+
samples: te
|
|
991
991
|
}, He = { plugin: ze };
|
|
992
992
|
export {
|
|
993
993
|
He as default
|