@tachui/forms 0.7.0-alpha1 → 0.8.0-alpha
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 +136 -0
- package/dist/DatePicker-D5nRFTUm.js +475 -0
- package/dist/DatePicker-D5nRFTUm.js.map +1 -0
- package/dist/Select-yZyKooXk.js +945 -0
- package/dist/Select-yZyKooXk.js.map +1 -0
- package/dist/Slider-0-oal5YR.js +644 -0
- package/dist/Slider-0-oal5YR.js.map +1 -0
- package/dist/TextField-hX15dY3U.js +509 -0
- package/dist/TextField-hX15dY3U.js.map +1 -0
- package/dist/components/advanced/Slider.d.ts +190 -0
- package/dist/components/advanced/Slider.d.ts.map +1 -0
- package/dist/components/advanced/Stepper.d.ts +161 -0
- package/dist/components/advanced/Stepper.d.ts.map +1 -0
- package/dist/components/advanced/index.d.ts +15 -0
- package/dist/components/advanced/index.d.ts.map +1 -0
- package/dist/components/advanced/index.js +6 -0
- package/dist/{state → components/advanced}/index.js.map +1 -1
- package/dist/components/date-picker/DatePicker.d.ts +126 -0
- package/dist/components/date-picker/DatePicker.d.ts.map +1 -0
- package/dist/components/date-picker/index.d.ts +14 -0
- package/dist/components/date-picker/index.d.ts.map +1 -0
- package/dist/components/date-picker/index.js +5 -0
- package/dist/components/{index.js.map → date-picker/index.js.map} +1 -1
- package/dist/components/form-container/index.d.ts +58 -0
- package/dist/components/form-container/index.d.ts.map +1 -0
- package/dist/components/selection/Checkbox.d.ts.map +1 -0
- package/dist/components/selection/Radio.d.ts.map +1 -0
- package/dist/components/selection/Select.d.ts.map +1 -0
- package/dist/components/selection/index.d.ts +68 -0
- package/dist/components/selection/index.d.ts.map +1 -0
- package/dist/components/selection/index.js +12 -0
- package/dist/components/selection/index.js.map +1 -0
- package/dist/components/text-input/TextField.d.ts.map +1 -0
- package/dist/components/text-input/index.d.ts +8 -0
- package/dist/components/text-input/index.d.ts.map +1 -0
- package/dist/components/text-input/index.js +18 -0
- package/dist/components/text-input/index.js.map +1 -0
- package/dist/index-D3WfkqVv.js +249 -0
- package/dist/index-D3WfkqVv.js.map +1 -0
- package/dist/index.d.ts +10 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +196 -376
- package/dist/index.js.map +1 -1
- package/dist/state/index.d.ts.map +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/index.d.ts +19 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/validation/component-validation.d.ts +11 -2
- package/dist/validation/component-validation.d.ts.map +1 -1
- package/dist/validation/index.d.ts.map +1 -1
- package/dist/validation/index.js +687 -17
- package/dist/validation/index.js.map +1 -1
- package/package.json +54 -41
- package/src/components/advanced/Slider.ts +722 -0
- package/src/components/advanced/Stepper.ts +715 -0
- package/src/components/advanced/index.ts +20 -0
- package/src/components/date-picker/DatePicker.ts +925 -0
- package/src/components/date-picker/index.ts +20 -0
- package/src/components/form-container/index.ts +266 -0
- package/src/components/selection/Checkbox.ts +478 -0
- package/src/components/selection/Radio.ts +470 -0
- package/src/components/selection/Select.ts +620 -0
- package/src/components/selection/index.ts +81 -0
- package/src/components/text-input/TextField.ts +728 -0
- package/src/components/text-input/index.ts +35 -0
- package/src/index.ts +48 -0
- package/src/state/index.ts +544 -0
- package/src/types/index.ts +579 -0
- package/src/utils/formatters.ts +184 -0
- package/src/utils/index.ts +57 -0
- package/src/validation/component-validation.ts +429 -0
- package/src/validation/index.ts +641 -0
- package/dist/Form-ueYEcSg1.cjs +0 -2
- package/dist/Form-ueYEcSg1.cjs.map +0 -1
- package/dist/Form-ylAr3o_e.js +0 -376
- package/dist/Form-ylAr3o_e.js.map +0 -1
- package/dist/components/Form.d.ts +0 -76
- package/dist/components/Form.d.ts.map +0 -1
- package/dist/components/index.cjs +0 -2
- package/dist/components/index.cjs.map +0 -1
- package/dist/components/index.d.ts +0 -9
- package/dist/components/index.d.ts.map +0 -1
- package/dist/components/index.js +0 -31
- package/dist/components/input/Checkbox.d.ts.map +0 -1
- package/dist/components/input/Radio.d.ts.map +0 -1
- package/dist/components/input/Select.d.ts.map +0 -1
- package/dist/components/input/TextField.d.ts.map +0 -1
- package/dist/components/input/index.d.ts +0 -11
- package/dist/components/input/index.d.ts.map +0 -1
- package/dist/forms-complex-BiQsZZlT.js +0 -361
- package/dist/forms-complex-BiQsZZlT.js.map +0 -1
- package/dist/forms-complex-DLEnXXJ5.cjs +0 -2
- package/dist/forms-complex-DLEnXXJ5.cjs.map +0 -1
- package/dist/forms-core-B1bx1drO.js +0 -839
- package/dist/forms-core-B1bx1drO.js.map +0 -1
- package/dist/forms-core-W_JGVLAI.cjs +0 -9
- package/dist/forms-core-W_JGVLAI.cjs.map +0 -1
- package/dist/forms-inputs-6QdeMWFk.js +0 -1075
- package/dist/forms-inputs-6QdeMWFk.js.map +0 -1
- package/dist/forms-inputs-DQ5QI_SU.cjs +0 -2
- package/dist/forms-inputs-DQ5QI_SU.cjs.map +0 -1
- package/dist/index.cjs +0 -2
- package/dist/index.cjs.map +0 -1
- package/dist/state/index.cjs +0 -2
- package/dist/state/index.cjs.map +0 -1
- package/dist/state/index.js +0 -9
- package/dist/utils/validators.d.ts +0 -101
- package/dist/utils/validators.d.ts.map +0 -1
- package/dist/validation/index.cjs +0 -2
- package/dist/validation/index.cjs.map +0 -1
- /package/dist/components/{input → selection}/Checkbox.d.ts +0 -0
- /package/dist/components/{input → selection}/Radio.d.ts +0 -0
- /package/dist/components/{input → selection}/Select.d.ts +0 -0
- /package/dist/components/{input → text-input}/TextField.d.ts +0 -0
package/dist/index.js
CHANGED
|
@@ -1,383 +1,203 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
};
|
|
92
|
-
},
|
|
93
|
-
/**
|
|
94
|
-
* Integer validation
|
|
95
|
-
*/
|
|
96
|
-
integer: (e) => {
|
|
97
|
-
if (!e) return { valid: !0 };
|
|
98
|
-
const t = Number(e), r = Number.isInteger(t);
|
|
99
|
-
return {
|
|
100
|
-
valid: r,
|
|
101
|
-
...r ? {} : { message: "Please enter a whole number", code: "INVALID_INTEGER" }
|
|
102
|
-
};
|
|
103
|
-
},
|
|
104
|
-
/**
|
|
105
|
-
* Minimum value validation
|
|
106
|
-
*/
|
|
107
|
-
min: (e) => (t) => {
|
|
108
|
-
if (!t) return { valid: !0 };
|
|
109
|
-
const r = Number(t), a = !Number.isNaN(r) && r >= e;
|
|
110
|
-
return {
|
|
111
|
-
valid: a,
|
|
112
|
-
...a ? {} : { message: `Value must be at least ${e}`, code: "MIN_VALUE" }
|
|
113
|
-
};
|
|
114
|
-
},
|
|
115
|
-
/**
|
|
116
|
-
* Maximum value validation
|
|
117
|
-
*/
|
|
118
|
-
max: (e) => (t) => {
|
|
119
|
-
if (!t) return { valid: !0 };
|
|
120
|
-
const r = Number(t), a = !Number.isNaN(r) && r <= e;
|
|
121
|
-
return {
|
|
122
|
-
valid: a,
|
|
123
|
-
...a ? {} : { message: `Value must be at most ${e}`, code: "MAX_VALUE" }
|
|
124
|
-
};
|
|
125
|
-
},
|
|
126
|
-
/**
|
|
127
|
-
* Range validation
|
|
128
|
-
*/
|
|
129
|
-
range: (e, t) => (r) => {
|
|
130
|
-
if (!r) return { valid: !0 };
|
|
131
|
-
const a = Number(r), o = !Number.isNaN(a) && a >= e && a <= t;
|
|
132
|
-
return {
|
|
133
|
-
valid: o,
|
|
134
|
-
...o ? {} : { message: `Value must be between ${e} and ${t}`, code: "OUT_OF_RANGE" }
|
|
135
|
-
};
|
|
136
|
-
},
|
|
137
|
-
/**
|
|
138
|
-
* Credit card validation (Luhn algorithm)
|
|
139
|
-
*/
|
|
140
|
-
creditCard: (e) => {
|
|
141
|
-
if (!e) return { valid: !0 };
|
|
142
|
-
const t = e.replace(/\D/g, "");
|
|
143
|
-
if (t.length < 13 || t.length > 19)
|
|
144
|
-
return {
|
|
145
|
-
valid: !1,
|
|
146
|
-
message: "Credit card number must be 13-19 digits",
|
|
147
|
-
code: "INVALID_CREDIT_CARD"
|
|
148
|
-
};
|
|
149
|
-
let r = 0, a = !1;
|
|
150
|
-
for (let i = t.length - 1; i >= 0; i--) {
|
|
151
|
-
let s = parseInt(t[i]);
|
|
152
|
-
a && (s *= 2, s > 9 && (s -= 9)), r += s, a = !a;
|
|
153
|
-
}
|
|
154
|
-
const o = r % 10 === 0;
|
|
155
|
-
return {
|
|
156
|
-
valid: o,
|
|
157
|
-
...o ? {} : { message: "Please enter a valid credit card number", code: "INVALID_CREDIT_CARD" }
|
|
158
|
-
};
|
|
159
|
-
},
|
|
160
|
-
/**
|
|
161
|
-
* Social Security Number validation
|
|
162
|
-
*/
|
|
163
|
-
ssn: (e) => {
|
|
164
|
-
if (!e) return { valid: !0 };
|
|
165
|
-
const t = e.replace(/\D/g, ""), a = /^(?!666|000|9\d{2})\d{3}(?!00)\d{2}(?!0{4})\d{4}$/.test(t);
|
|
166
|
-
return {
|
|
167
|
-
valid: a,
|
|
168
|
-
...a ? {} : { message: "Please enter a valid Social Security Number", code: "INVALID_SSN" }
|
|
169
|
-
};
|
|
170
|
-
},
|
|
171
|
-
/**
|
|
172
|
-
* US ZIP code validation
|
|
173
|
-
*/
|
|
174
|
-
zipCode: (e) => {
|
|
175
|
-
if (!e) return { valid: !0 };
|
|
176
|
-
const r = /^\d{5}(-\d{4})?$/.test(e);
|
|
177
|
-
return {
|
|
178
|
-
valid: r,
|
|
179
|
-
...r ? {} : { message: "Please enter a valid ZIP code", code: "INVALID_ZIP" }
|
|
180
|
-
};
|
|
181
|
-
},
|
|
182
|
-
/**
|
|
183
|
-
* Strong password validation
|
|
184
|
-
*/
|
|
185
|
-
strongPassword: (e) => {
|
|
186
|
-
if (!e) return { valid: !0 };
|
|
187
|
-
const t = /[a-z]/.test(e), r = /[A-Z]/.test(e), a = /\d/.test(e), o = /[!@#$%^&*(),.?":{}|<>]/.test(e), i = e.length >= 8, s = [];
|
|
188
|
-
i || s.push("at least 8 characters"), t || s.push("lowercase letter"), r || s.push("uppercase letter"), a || s.push("number"), o || s.push("special character");
|
|
189
|
-
const l = s.length === 0;
|
|
190
|
-
return {
|
|
191
|
-
valid: l,
|
|
192
|
-
...l ? {} : {
|
|
193
|
-
message: `Password must contain ${s.join(", ")}`,
|
|
194
|
-
code: "WEAK_PASSWORD"
|
|
1
|
+
import { createSignal as n, createComputed as a } from "@tachui/core";
|
|
2
|
+
import { c as o } from "./index-D3WfkqVv.js";
|
|
3
|
+
import { a as N, b as T } from "./index-D3WfkqVv.js";
|
|
4
|
+
import { f as D, C as M, D as w, E as A, N as L, P, a as R, c as $, b as k, S as O, d as U, T as H, e as I, U as z } from "./TextField-hX15dY3U.js";
|
|
5
|
+
import { C as _, a as j, c as Z, M as q, R as B, b as J, d as K, S as Q } from "./Select-yZyKooXk.js";
|
|
6
|
+
import { a as X, S as Y } from "./Slider-0-oal5YR.js";
|
|
7
|
+
import { D as te } from "./DatePicker-D5nRFTUm.js";
|
|
8
|
+
import { CrossFieldValidators as ie, FormsComponentValidation as se, FormsValidationError as ae, VALIDATION_RULES as ne, ValidationMessageFormatter as oe, ValidationPresets as de, ValidationUtils as pe, createDebouncedValidator as le, createFormsValidators as ce, defaultMessageFormatter as fe, getValidationRules as me, registerFormsValidators as he, registerValidationRule as ue, unregisterValidationRule as Se, validateField as xe, validateValue as ge, validateValueAsync as Ce } from "./validation/index.js";
|
|
9
|
+
class d {
|
|
10
|
+
constructor(e) {
|
|
11
|
+
this.properties = e, this.formState = o(e.initialValues || {}), e.validation && Object.entries(e.validation).forEach(
|
|
12
|
+
([t, r]) => {
|
|
13
|
+
this.formState.register(t, r);
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
type = "form-container";
|
|
18
|
+
formState;
|
|
19
|
+
get state() {
|
|
20
|
+
return this.formState.state;
|
|
21
|
+
}
|
|
22
|
+
async handleSubmit() {
|
|
23
|
+
this.properties.validateOnSubmit !== !1 && !await this.formState.validateForm() || (this.properties.onSubmit && await this.properties.onSubmit(
|
|
24
|
+
this.formState.watch(),
|
|
25
|
+
this.formState.state
|
|
26
|
+
), this.properties.resetOnSubmit && this.formState.resetForm());
|
|
27
|
+
}
|
|
28
|
+
register(e, t) {
|
|
29
|
+
this.formState.register(e, t);
|
|
30
|
+
}
|
|
31
|
+
setValue(e, t) {
|
|
32
|
+
this.formState.setValue(e, t);
|
|
33
|
+
}
|
|
34
|
+
getValue(e) {
|
|
35
|
+
return this.formState.getValue(e);
|
|
36
|
+
}
|
|
37
|
+
getError(e) {
|
|
38
|
+
return this.formState.getError(e);
|
|
39
|
+
}
|
|
40
|
+
async validateField(e) {
|
|
41
|
+
return this.formState.validateField(e);
|
|
42
|
+
}
|
|
43
|
+
async validateForm() {
|
|
44
|
+
return this.formState.validateForm();
|
|
45
|
+
}
|
|
46
|
+
resetForm() {
|
|
47
|
+
this.formState.resetForm();
|
|
48
|
+
}
|
|
49
|
+
render() {
|
|
50
|
+
const e = document.createElement("form");
|
|
51
|
+
return this.properties.className && (e.className = this.properties.className), this.properties.id && (e.id = this.properties.id), e.addEventListener("submit", (t) => {
|
|
52
|
+
t.preventDefault(), this.handleSubmit();
|
|
53
|
+
}), this.properties.children && (Array.isArray(this.properties.children) ? this.properties.children.forEach((t) => {
|
|
54
|
+
typeof t == "string" ? e.appendChild(document.createTextNode(t)) : t && typeof t.render == "function" ? e.appendChild(t.render()) : t instanceof HTMLElement && e.appendChild(t);
|
|
55
|
+
}) : typeof this.properties.children == "string" ? e.appendChild(document.createTextNode(this.properties.children)) : this.properties.children && typeof this.properties.children.render == "function" ? e.appendChild(this.properties.children.render()) : this.properties.children instanceof HTMLElement && e.appendChild(this.properties.children)), e;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
class p {
|
|
59
|
+
constructor(e) {
|
|
60
|
+
this.properties = e;
|
|
61
|
+
const [t, r] = n(
|
|
62
|
+
e.defaultExpanded ?? !0
|
|
63
|
+
);
|
|
64
|
+
this.expanded = t, this.setExpanded = r;
|
|
65
|
+
}
|
|
66
|
+
type = "form-section";
|
|
67
|
+
expanded;
|
|
68
|
+
setExpanded;
|
|
69
|
+
get isExpanded() {
|
|
70
|
+
return this.expanded();
|
|
71
|
+
}
|
|
72
|
+
toggle() {
|
|
73
|
+
this.properties.collapsible && this.setExpanded(!this.expanded());
|
|
74
|
+
}
|
|
75
|
+
expand() {
|
|
76
|
+
this.setExpanded(!0);
|
|
77
|
+
}
|
|
78
|
+
collapse() {
|
|
79
|
+
this.properties.collapsible && this.setExpanded(!1);
|
|
80
|
+
}
|
|
81
|
+
render() {
|
|
82
|
+
const e = document.createElement("section");
|
|
83
|
+
if (this.properties.className && (e.className = this.properties.className), this.properties.title) {
|
|
84
|
+
const r = document.createElement("h3");
|
|
85
|
+
if (r.textContent = this.properties.title, r.style.cssText = "margin: 0 0 1rem 0; font-weight: 600;", this.properties.collapsible) {
|
|
86
|
+
r.style.cursor = "pointer", r.addEventListener("click", () => this.toggle());
|
|
87
|
+
const s = document.createElement("span");
|
|
88
|
+
s.textContent = this.expanded() ? " ▼" : " ▶", s.style.cssText = "font-size: 0.8em; margin-left: 0.5rem;", r.appendChild(s), a(() => {
|
|
89
|
+
s.textContent = this.expanded() ? " ▼" : " ▶";
|
|
90
|
+
});
|
|
195
91
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
date: (e) => {
|
|
202
|
-
if (!e) return { valid: !0 };
|
|
203
|
-
const t = new Date(e), r = !Number.isNaN(t.getTime());
|
|
204
|
-
return {
|
|
205
|
-
valid: r,
|
|
206
|
-
...r ? {} : { message: "Please enter a valid date", code: "INVALID_DATE" }
|
|
207
|
-
};
|
|
208
|
-
},
|
|
209
|
-
/**
|
|
210
|
-
* Time validation (HH:MM format)
|
|
211
|
-
*/
|
|
212
|
-
time: (e) => {
|
|
213
|
-
if (!e) return { valid: !0 };
|
|
214
|
-
const r = /^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$/.test(e);
|
|
215
|
-
return {
|
|
216
|
-
valid: r,
|
|
217
|
-
...r ? {} : { message: "Please enter a valid time (HH:MM)", code: "INVALID_TIME" }
|
|
218
|
-
};
|
|
219
|
-
},
|
|
220
|
-
/**
|
|
221
|
-
* Composite validator - combines multiple validators with AND logic
|
|
222
|
-
*/
|
|
223
|
-
and: (...e) => (t) => {
|
|
224
|
-
for (const r of e) {
|
|
225
|
-
const a = r(t);
|
|
226
|
-
if (!a.valid)
|
|
227
|
-
return a;
|
|
92
|
+
e.appendChild(r);
|
|
93
|
+
}
|
|
94
|
+
if (this.properties.description) {
|
|
95
|
+
const r = document.createElement("p");
|
|
96
|
+
r.textContent = this.properties.description, r.style.cssText = "margin: 0 0 1rem 0; color: #666; font-size: 0.9em;", e.appendChild(r);
|
|
228
97
|
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
const r = e.map((i) => i(t));
|
|
236
|
-
return r.some((i) => i.valid) ? { valid: !0 } : r.find((i) => !i.valid) || { valid: !1, message: "Validation failed", code: "VALIDATION_FAILED" };
|
|
237
|
-
},
|
|
238
|
-
/**
|
|
239
|
-
* Custom validator factory
|
|
240
|
-
*/
|
|
241
|
-
custom: (e) => e
|
|
242
|
-
}, z = {
|
|
243
|
-
name: "@tachui/forms",
|
|
244
|
-
version: "0.1.0",
|
|
245
|
-
async install(e) {
|
|
246
|
-
const t = (r, a, o) => {
|
|
247
|
-
e.registerComponent(r, a, o);
|
|
248
|
-
};
|
|
249
|
-
t("Form", n, {
|
|
250
|
-
category: "forms",
|
|
251
|
-
tags: ["form", "container", "validation"]
|
|
252
|
-
}), t("FormSection", d, {
|
|
253
|
-
category: "forms",
|
|
254
|
-
tags: ["form", "section", "fieldset"]
|
|
255
|
-
}), t("TextField", b, {
|
|
256
|
-
category: "forms",
|
|
257
|
-
tags: ["input", "text", "validation"]
|
|
258
|
-
}), t("EmailField", I, {
|
|
259
|
-
category: "forms",
|
|
260
|
-
tags: ["input", "email", "validation"]
|
|
261
|
-
}), t("PasswordField", S, {
|
|
262
|
-
category: "forms",
|
|
263
|
-
tags: ["input", "password", "validation"]
|
|
264
|
-
}), t("SearchField", V, {
|
|
265
|
-
category: "forms",
|
|
266
|
-
tags: ["input", "search"]
|
|
267
|
-
}), t("URLField", x, {
|
|
268
|
-
category: "forms",
|
|
269
|
-
tags: ["input", "url", "validation"]
|
|
270
|
-
}), t("PhoneField", y, {
|
|
271
|
-
category: "forms",
|
|
272
|
-
tags: ["input", "phone", "validation"]
|
|
273
|
-
}), t("NumberField", C, {
|
|
274
|
-
category: "forms",
|
|
275
|
-
tags: ["input", "number", "numeric", "validation"]
|
|
276
|
-
}), t("CreditCardField", R, {
|
|
277
|
-
category: "forms",
|
|
278
|
-
tags: ["input", "credit-card", "payment", "validation"]
|
|
279
|
-
}), t("SSNField", A, {
|
|
280
|
-
category: "forms",
|
|
281
|
-
tags: ["input", "ssn", "social-security", "validation"]
|
|
282
|
-
}), t("PostalCodeField", T, {
|
|
283
|
-
category: "forms",
|
|
284
|
-
tags: ["input", "postal-code", "zip", "validation"]
|
|
285
|
-
}), t("TextArea", P, {
|
|
286
|
-
category: "forms",
|
|
287
|
-
tags: ["input", "textarea", "multiline"]
|
|
288
|
-
}), t("DateField", L, {
|
|
289
|
-
category: "forms",
|
|
290
|
-
tags: ["input", "date", "calendar", "validation"]
|
|
291
|
-
}), t("TimeField", D, {
|
|
292
|
-
category: "forms",
|
|
293
|
-
tags: ["input", "time", "clock", "validation"]
|
|
294
|
-
}), t("ColorField", E, {
|
|
295
|
-
category: "forms",
|
|
296
|
-
tags: ["input", "color", "picker"]
|
|
297
|
-
}), t("Checkbox", _, {
|
|
298
|
-
category: "forms",
|
|
299
|
-
tags: ["input", "checkbox", "boolean"]
|
|
300
|
-
}), t("Switch", M, {
|
|
301
|
-
category: "forms",
|
|
302
|
-
tags: ["input", "switch", "toggle", "boolean"]
|
|
303
|
-
}), t("CheckboxGroup", U, {
|
|
304
|
-
category: "forms",
|
|
305
|
-
tags: ["input", "checkbox", "group", "multiple"]
|
|
306
|
-
}), t("Radio", w, {
|
|
307
|
-
category: "forms",
|
|
308
|
-
tags: ["input", "radio", "choice"]
|
|
309
|
-
}), t("RadioGroup", $, {
|
|
310
|
-
category: "forms",
|
|
311
|
-
tags: ["input", "radio", "group", "choice"]
|
|
312
|
-
}), t("Select", k, {
|
|
313
|
-
category: "forms",
|
|
314
|
-
tags: ["input", "select", "dropdown", "choice"]
|
|
315
|
-
}), t("MultiSelect", G, {
|
|
316
|
-
category: "forms",
|
|
317
|
-
tags: ["input", "select", "multiple", "choice"]
|
|
318
|
-
}), t("Combobox", H, {
|
|
319
|
-
category: "forms",
|
|
320
|
-
tags: ["input", "combobox", "search", "choice"]
|
|
321
|
-
}), e.registerService("formsConfig", {
|
|
322
|
-
theme: "default",
|
|
323
|
-
validation: {},
|
|
324
|
-
accessibility: {}
|
|
325
|
-
}), e.registerService("validationMessageFormatter", c), e.registerService("createFormState", m), e.registerService("createField", u), e.registerService("createMultiStepFormState", g), e.registerService("ValidationPresets", f), e.registerService("CrossFieldValidators", p), e.registerService("TextFieldFormatters", v), e.registerService("TextFieldParsers", N), e.registerService("TextFieldValidators", O), await F(), console.log("📝 TachUI Forms plugin installed successfully"), console.log(" • 24 form components (including enhanced TextField variants)"), console.log(` • ${h().length} validation rules`), console.log(" • TextField formatters and validators included");
|
|
326
|
-
},
|
|
327
|
-
async uninstall() {
|
|
328
|
-
console.log("📝 TachUI Forms plugin uninstalled");
|
|
98
|
+
const t = document.createElement("div");
|
|
99
|
+
return a(() => {
|
|
100
|
+
t.style.display = this.expanded() ? "block" : "none";
|
|
101
|
+
}), this.properties.children && (Array.isArray(this.properties.children) ? this.properties.children.forEach((r) => {
|
|
102
|
+
typeof r == "string" ? t.appendChild(document.createTextNode(r)) : r && typeof r.render == "function" ? t.appendChild(r.render()) : r instanceof HTMLElement && t.appendChild(r);
|
|
103
|
+
}) : typeof this.properties.children == "string" ? t.appendChild(document.createTextNode(this.properties.children)) : this.properties.children && typeof this.properties.children.render == "function" ? t.appendChild(this.properties.children.render()) : this.properties.children instanceof HTMLElement && t.appendChild(this.properties.children)), e.appendChild(t), e;
|
|
329
104
|
}
|
|
330
|
-
}
|
|
105
|
+
}
|
|
106
|
+
function f(i) {
|
|
107
|
+
return new d(i);
|
|
108
|
+
}
|
|
109
|
+
function m(i) {
|
|
110
|
+
return new p(i);
|
|
111
|
+
}
|
|
112
|
+
function h() {
|
|
113
|
+
return {
|
|
114
|
+
/* TODO: Implement form state hook */
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function u() {
|
|
118
|
+
return {
|
|
119
|
+
/* TODO: Implement form validation hook */
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
function S(i) {
|
|
123
|
+
return i.replace(/\D/g, "").replace(/(\d{4})(?=\d)/g, "$1 ");
|
|
124
|
+
}
|
|
125
|
+
function x(i) {
|
|
126
|
+
return i.replace(/\D/g, "").replace(/(\d{3})(\d{3})(\d{4})/, "($1) $2-$3");
|
|
127
|
+
}
|
|
128
|
+
function g(i) {
|
|
129
|
+
return i.replace(/\D/g, "").replace(/(\d{3})(\d{2})(\d{4})/, "$1-$2-$3");
|
|
130
|
+
}
|
|
131
|
+
function C(i) {
|
|
132
|
+
return i.toUpperCase().replace(/[^A-Z0-9]/g, "");
|
|
133
|
+
}
|
|
134
|
+
function F(i, e = "yyyy-MM-dd") {
|
|
135
|
+
return i.toISOString().split("T")[0];
|
|
136
|
+
}
|
|
137
|
+
function E(i) {
|
|
138
|
+
return new Date(i);
|
|
139
|
+
}
|
|
140
|
+
function y(i) {
|
|
141
|
+
return i instanceof Date && !isNaN(i.getTime());
|
|
142
|
+
}
|
|
331
143
|
export {
|
|
332
144
|
_ as Checkbox,
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
d as
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
145
|
+
j as CheckboxGroup,
|
|
146
|
+
D as ColorField,
|
|
147
|
+
Z as Combobox,
|
|
148
|
+
M as CreditCardField,
|
|
149
|
+
ie as CrossFieldValidators,
|
|
150
|
+
w as DateField,
|
|
151
|
+
te as DatePicker,
|
|
152
|
+
A as EmailField,
|
|
153
|
+
d as Form,
|
|
154
|
+
p as FormSection,
|
|
155
|
+
se as FormsComponentValidation,
|
|
156
|
+
ae as FormsValidationError,
|
|
157
|
+
q as MultiSelect,
|
|
158
|
+
L as NumberField,
|
|
159
|
+
P as PasswordField,
|
|
160
|
+
R as PhoneField,
|
|
161
|
+
$ as PostalCodeField,
|
|
162
|
+
B as Radio,
|
|
163
|
+
J as RadioGroup,
|
|
164
|
+
k as SSNField,
|
|
165
|
+
O as SearchField,
|
|
166
|
+
K as Select,
|
|
167
|
+
X as Slider,
|
|
168
|
+
Y as Stepper,
|
|
169
|
+
Q as Switch,
|
|
170
|
+
U as TextArea,
|
|
171
|
+
H as TextField,
|
|
172
|
+
I as TimeField,
|
|
173
|
+
z as URLField,
|
|
174
|
+
ne as VALIDATION_RULES,
|
|
175
|
+
oe as ValidationMessageFormatter,
|
|
176
|
+
de as ValidationPresets,
|
|
177
|
+
pe as ValidationUtils,
|
|
178
|
+
le as createDebouncedValidator,
|
|
179
|
+
N as createField,
|
|
180
|
+
o as createFormState,
|
|
181
|
+
ce as createFormsValidators,
|
|
182
|
+
T as createMultiStepFormState,
|
|
183
|
+
fe as defaultMessageFormatter,
|
|
184
|
+
f as form,
|
|
185
|
+
m as formSection,
|
|
186
|
+
S as formatCreditCard,
|
|
187
|
+
F as formatDate,
|
|
188
|
+
x as formatPhoneNumber,
|
|
189
|
+
C as formatPostalCode,
|
|
190
|
+
g as formatSSN,
|
|
191
|
+
me as getValidationRules,
|
|
192
|
+
y as isValidDate,
|
|
193
|
+
E as parseDate,
|
|
194
|
+
he as registerFormsValidators,
|
|
195
|
+
ue as registerValidationRule,
|
|
196
|
+
Se as unregisterValidationRule,
|
|
197
|
+
h as useFormState,
|
|
198
|
+
u as useFormValidation,
|
|
199
|
+
xe as validateField,
|
|
200
|
+
ge as validateValue,
|
|
201
|
+
Ce as validateValueAsync
|
|
382
202
|
};
|
|
383
203
|
//# sourceMappingURL=index.js.map
|