@nestledjs/forms-native 0.1.0
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/index.d.ts +38 -0
- package/index.js +4077 -0
- package/lib/fields/button-field.d.ts +4 -0
- package/lib/fields/button.d.ts +16 -0
- package/lib/fields/checkbox-field.d.ts +12 -0
- package/lib/fields/checkbox-group.d.ts +7 -0
- package/lib/fields/content-field.d.ts +6 -0
- package/lib/fields/custom-checkbox-field.d.ts +8 -0
- package/lib/fields/custom-field.d.ts +12 -0
- package/lib/fields/datepicker-field.d.ts +8 -0
- package/lib/fields/datetimepicker-field.d.ts +8 -0
- package/lib/fields/email-field.d.ts +7 -0
- package/lib/fields/label.d.ts +15 -0
- package/lib/fields/markdown-editor.d.ts +7 -0
- package/lib/fields/money-field.d.ts +7 -0
- package/lib/fields/number-field.d.ts +7 -0
- package/lib/fields/password-field.d.ts +7 -0
- package/lib/fields/phone-field.d.ts +14 -0
- package/lib/fields/radio-field.d.ts +7 -0
- package/lib/fields/select-field-enum.d.ts +7 -0
- package/lib/fields/select-field-multi-search-apollo.d.ts +16 -0
- package/lib/fields/select-field-multi-search.d.ts +7 -0
- package/lib/fields/select-field-multi.d.ts +7 -0
- package/lib/fields/select-field-search-apollo.d.ts +10 -0
- package/lib/fields/select-field-search.d.ts +7 -0
- package/lib/fields/select-field.d.ts +7 -0
- package/lib/fields/switch-field.d.ts +7 -0
- package/lib/fields/text-field.d.ts +7 -0
- package/lib/fields/textarea-field.d.ts +7 -0
- package/lib/fields/timepicker-field.d.ts +11 -0
- package/lib/fields/url-field.d.ts +7 -0
- package/lib/form.d.ts +32 -0
- package/lib/native-theme-context.d.ts +928 -0
- package/lib/render-form-field.d.ts +10 -0
- package/lib/themes/default.d.ts +933 -0
- package/lib/utils/resolve-theme.d.ts +11 -0
- package/package.json +62 -0
package/index.js
ADDED
|
@@ -0,0 +1,4077 @@
|
|
|
1
|
+
import { z as r, ZodError as ce } from "zod";
|
|
2
|
+
import { createContext as Q, useContext as ee, useMemo as W, useState as B, useEffect as E, useRef as Oe } from "react";
|
|
3
|
+
import { zodResolver as Ve } from "@hookform/resolvers/zod";
|
|
4
|
+
import ue from "dayjs";
|
|
5
|
+
import { jsxs as x, Fragment as F, jsx as n } from "react/jsx-runtime";
|
|
6
|
+
import { StyleSheet as w, TextInput as D, Text as u, View as f, Pressable as H, Switch as ie, ActivityIndicator as Fe, Platform as L, ScrollView as Pe } from "react-native";
|
|
7
|
+
import { Controller as z, useWatch as pe, useForm as De } from "react-hook-form";
|
|
8
|
+
var C = /* @__PURE__ */ ((t) => (t.Text = "Text", t.TextArea = "TextArea", t.Email = "Email", t.Password = "Password", t.Url = "Url", t.Phone = "Phone", t.Number = "Number", t.Currency = "Currency", t.Checkbox = "Checkbox", t.Switch = "Switch", t.Button = "Button", t.DatePicker = "DatePicker", t.DateTimePicker = "DateTimePicker", t.TimePicker = "TimePicker", t.Select = "Select", t.EnumSelect = "EnumSelect", t.MultiSelect = "MultiSelect", t.Radio = "Radio", t.CheckboxGroup = "CheckboxGroup", t.SearchSelect = "SearchSelect", t.SearchSelectApollo = "SearchSelectApollo", t.SearchSelectMulti = "SearchSelectMulti", t.SearchSelectMultiApollo = "SearchSelectMultiApollo", t.Content = "Content", t.Custom = "Custom", t.CustomCheckbox = "CustomCheckbox", t.MarkdownEditor = "MarkdownEditor", t))(C || {});
|
|
9
|
+
const he = r.object({
|
|
10
|
+
global: r.object({
|
|
11
|
+
input: r.string().default(""),
|
|
12
|
+
error: r.string().default(""),
|
|
13
|
+
disabled: r.string().default(""),
|
|
14
|
+
readOnly: r.string().default("")
|
|
15
|
+
}).default({}),
|
|
16
|
+
label: r.object({
|
|
17
|
+
base: r.string().default(""),
|
|
18
|
+
requiredIndicator: r.string().default("")
|
|
19
|
+
}).default({}),
|
|
20
|
+
textField: r.object({
|
|
21
|
+
input: r.string().default(""),
|
|
22
|
+
error: r.string().default(""),
|
|
23
|
+
disabled: r.string().default(""),
|
|
24
|
+
readOnly: r.string().default(""),
|
|
25
|
+
helpText: r.string().default("")
|
|
26
|
+
}).default({}),
|
|
27
|
+
checkbox: r.object({
|
|
28
|
+
wrapper: r.string().default(""),
|
|
29
|
+
row: r.string().default(""),
|
|
30
|
+
rowFullWidth: r.string().default(""),
|
|
31
|
+
input: r.string().default(""),
|
|
32
|
+
focus: r.string().default(""),
|
|
33
|
+
checked: r.string().default(""),
|
|
34
|
+
indeterminate: r.string().default(""),
|
|
35
|
+
error: r.string().default(""),
|
|
36
|
+
disabled: r.string().default(""),
|
|
37
|
+
readOnly: r.string().default(""),
|
|
38
|
+
label: r.string().default(""),
|
|
39
|
+
fullWidthLabel: r.string().default(""),
|
|
40
|
+
helpText: r.string().default(""),
|
|
41
|
+
errorText: r.string().default(""),
|
|
42
|
+
readonlyCheckedIcon: r.any().optional(),
|
|
43
|
+
readonlyUncheckedIcon: r.any().optional()
|
|
44
|
+
}).default({}),
|
|
45
|
+
customCheckbox: r.object({
|
|
46
|
+
wrapper: r.string().default(""),
|
|
47
|
+
row: r.string().default(""),
|
|
48
|
+
rowFullWidth: r.string().default(""),
|
|
49
|
+
checkboxContainer: r.string().default(""),
|
|
50
|
+
hiddenInput: r.string().default(""),
|
|
51
|
+
customCheckbox: r.string().default(""),
|
|
52
|
+
focus: r.string().default(""),
|
|
53
|
+
checked: r.string().default(""),
|
|
54
|
+
error: r.string().default(""),
|
|
55
|
+
disabled: r.string().default(""),
|
|
56
|
+
readOnly: r.string().default(""),
|
|
57
|
+
label: r.string().default(""),
|
|
58
|
+
fullWidthLabel: r.string().default(""),
|
|
59
|
+
helpText: r.string().default(""),
|
|
60
|
+
errorText: r.string().default(""),
|
|
61
|
+
checkedIcon: r.any().optional(),
|
|
62
|
+
uncheckedIcon: r.any().optional(),
|
|
63
|
+
readonlyCheckedIcon: r.any().optional(),
|
|
64
|
+
readonlyUncheckedIcon: r.any().optional()
|
|
65
|
+
}).default({}),
|
|
66
|
+
customField: r.object({
|
|
67
|
+
wrapper: r.string().default(""),
|
|
68
|
+
readOnlyInput: r.string().default(""),
|
|
69
|
+
readOnlyValue: r.string().default(""),
|
|
70
|
+
errorContainer: r.string().default(""),
|
|
71
|
+
errorText: r.string().default("")
|
|
72
|
+
}).default({}),
|
|
73
|
+
datePicker: r.object({
|
|
74
|
+
wrapper: r.string().default(""),
|
|
75
|
+
input: r.string().default(""),
|
|
76
|
+
focus: r.string().default(""),
|
|
77
|
+
error: r.string().default(""),
|
|
78
|
+
disabled: r.string().default(""),
|
|
79
|
+
readOnly: r.string().default(""),
|
|
80
|
+
readOnlyInput: r.string().default(""),
|
|
81
|
+
readOnlyValue: r.string().default("")
|
|
82
|
+
}).default({}),
|
|
83
|
+
dateTimePicker: r.object({
|
|
84
|
+
wrapper: r.string().default(""),
|
|
85
|
+
input: r.string().default(""),
|
|
86
|
+
focus: r.string().default(""),
|
|
87
|
+
error: r.string().default(""),
|
|
88
|
+
disabled: r.string().default(""),
|
|
89
|
+
readOnly: r.string().default(""),
|
|
90
|
+
readOnlyInput: r.string().default(""),
|
|
91
|
+
readOnlyValue: r.string().default("")
|
|
92
|
+
}).default({}),
|
|
93
|
+
button: r.object({
|
|
94
|
+
base: r.string().default(""),
|
|
95
|
+
primary: r.string().default(""),
|
|
96
|
+
secondary: r.string().default(""),
|
|
97
|
+
danger: r.string().default(""),
|
|
98
|
+
disabled: r.string().default(""),
|
|
99
|
+
loading: r.string().default(""),
|
|
100
|
+
fullWidth: r.string().default("")
|
|
101
|
+
}).default({}),
|
|
102
|
+
emailField: r.object({
|
|
103
|
+
wrapper: r.string().default(""),
|
|
104
|
+
input: r.string().default(""),
|
|
105
|
+
focus: r.string().default(""),
|
|
106
|
+
error: r.string().default(""),
|
|
107
|
+
disabled: r.string().default(""),
|
|
108
|
+
readOnly: r.string().default(""),
|
|
109
|
+
readOnlyInput: r.string().default(""),
|
|
110
|
+
readOnlyValue: r.string().default("")
|
|
111
|
+
}).default({}),
|
|
112
|
+
moneyField: r.object({
|
|
113
|
+
wrapper: r.string().default(""),
|
|
114
|
+
container: r.string().default(""),
|
|
115
|
+
currencySymbol: r.string().default(""),
|
|
116
|
+
currencySymbolHidden: r.string().default(""),
|
|
117
|
+
input: r.string().default(""),
|
|
118
|
+
inputWithSymbol: r.string().default(""),
|
|
119
|
+
focus: r.string().default(""),
|
|
120
|
+
error: r.string().default(""),
|
|
121
|
+
disabled: r.string().default(""),
|
|
122
|
+
readOnly: r.string().default(""),
|
|
123
|
+
readOnlyInput: r.string().default(""),
|
|
124
|
+
readOnlyValue: r.string().default("")
|
|
125
|
+
}).default({}),
|
|
126
|
+
multiSelect: r.object({
|
|
127
|
+
wrapper: r.string().default(""),
|
|
128
|
+
container: r.string().default(""),
|
|
129
|
+
inputContainer: r.string().default(""),
|
|
130
|
+
selectedItem: r.string().default(""),
|
|
131
|
+
selectedItemLabel: r.string().default(""),
|
|
132
|
+
selectedItemRemoveButton: r.string().default(""),
|
|
133
|
+
selectedItemRemoveIcon: r.string().default(""),
|
|
134
|
+
input: r.string().default(""),
|
|
135
|
+
button: r.string().default(""),
|
|
136
|
+
buttonIcon: r.string().default(""),
|
|
137
|
+
dropdown: r.string().default(""),
|
|
138
|
+
option: r.string().default(""),
|
|
139
|
+
optionActive: r.string().default(""),
|
|
140
|
+
optionSelected: r.string().default(""),
|
|
141
|
+
optionLabel: r.string().default(""),
|
|
142
|
+
optionCheckIcon: r.string().default(""),
|
|
143
|
+
error: r.string().default(""),
|
|
144
|
+
disabled: r.string().default(""),
|
|
145
|
+
readOnly: r.string().default(""),
|
|
146
|
+
readOnlyInput: r.string().default(""),
|
|
147
|
+
readOnlyValue: r.string().default("")
|
|
148
|
+
}).default({}),
|
|
149
|
+
numberField: r.object({
|
|
150
|
+
input: r.string().default(""),
|
|
151
|
+
focus: r.string().default(""),
|
|
152
|
+
error: r.string().default(""),
|
|
153
|
+
disabled: r.string().default(""),
|
|
154
|
+
readOnly: r.string().default(""),
|
|
155
|
+
readOnlyInput: r.string().default(""),
|
|
156
|
+
readOnlyValue: r.string().default("")
|
|
157
|
+
}).default({}),
|
|
158
|
+
passwordField: r.object({
|
|
159
|
+
input: r.string().default(""),
|
|
160
|
+
focus: r.string().default(""),
|
|
161
|
+
error: r.string().default(""),
|
|
162
|
+
disabled: r.string().default(""),
|
|
163
|
+
readOnly: r.string().default(""),
|
|
164
|
+
readOnlyInput: r.string().default(""),
|
|
165
|
+
readOnlyValue: r.string().default("")
|
|
166
|
+
}).default({}),
|
|
167
|
+
phoneField: r.object({
|
|
168
|
+
wrapper: r.string().default(""),
|
|
169
|
+
input: r.string().default(""),
|
|
170
|
+
focus: r.string().default(""),
|
|
171
|
+
error: r.string().default(""),
|
|
172
|
+
disabled: r.string().default(""),
|
|
173
|
+
readOnly: r.string().default(""),
|
|
174
|
+
readOnlyInput: r.string().default(""),
|
|
175
|
+
readOnlyValue: r.string().default(""),
|
|
176
|
+
errorMessage: r.string().default("")
|
|
177
|
+
}).default({}),
|
|
178
|
+
radioField: r.object({
|
|
179
|
+
wrapper: r.string().default(""),
|
|
180
|
+
container: r.string().default(""),
|
|
181
|
+
containerRow: r.string().default(""),
|
|
182
|
+
containerColumn: r.string().default(""),
|
|
183
|
+
optionContainer: r.string().default(""),
|
|
184
|
+
optionContainerFullWidth: r.string().default(""),
|
|
185
|
+
optionContainerFancy: r.string().default(""),
|
|
186
|
+
radioContainer: r.string().default(""),
|
|
187
|
+
input: r.string().default(""),
|
|
188
|
+
inputFullWidth: r.string().default(""),
|
|
189
|
+
inputChecked: r.string().default(""),
|
|
190
|
+
inputFocus: r.string().default(""),
|
|
191
|
+
inputDisabled: r.string().default(""),
|
|
192
|
+
label: r.string().default(""),
|
|
193
|
+
labelFullWidth: r.string().default(""),
|
|
194
|
+
labelRow: r.string().default(""),
|
|
195
|
+
labelColumn: r.string().default(""),
|
|
196
|
+
subOptionInput: r.string().default(""),
|
|
197
|
+
subOptionError: r.string().default(""),
|
|
198
|
+
readOnlyContainer: r.string().default(""),
|
|
199
|
+
readOnlySelected: r.string().default(""),
|
|
200
|
+
readOnlyUnselected: r.string().default(""),
|
|
201
|
+
readOnlyIcon: r.any().optional(),
|
|
202
|
+
readOnlyUnselectedIcon: r.any().optional()
|
|
203
|
+
}).default({}),
|
|
204
|
+
checkboxGroup: r.object({
|
|
205
|
+
wrapper: r.string().default(""),
|
|
206
|
+
container: r.string().default(""),
|
|
207
|
+
containerRow: r.string().default(""),
|
|
208
|
+
containerColumn: r.string().default(""),
|
|
209
|
+
optionContainer: r.string().default(""),
|
|
210
|
+
optionContainerFullWidth: r.string().default(""),
|
|
211
|
+
optionContainerFancy: r.string().default(""),
|
|
212
|
+
checkboxContainer: r.string().default(""),
|
|
213
|
+
input: r.string().default(""),
|
|
214
|
+
inputFullWidth: r.string().default(""),
|
|
215
|
+
inputChecked: r.string().default(""),
|
|
216
|
+
inputFocus: r.string().default(""),
|
|
217
|
+
inputDisabled: r.string().default(""),
|
|
218
|
+
error: r.string().default(""),
|
|
219
|
+
disabled: r.string().default(""),
|
|
220
|
+
label: r.string().default(""),
|
|
221
|
+
labelFullWidth: r.string().default(""),
|
|
222
|
+
labelRow: r.string().default(""),
|
|
223
|
+
labelColumn: r.string().default(""),
|
|
224
|
+
readOnly: r.string().default(""),
|
|
225
|
+
readOnlyInput: r.string().default(""),
|
|
226
|
+
readOnlyValue: r.string().default(""),
|
|
227
|
+
readOnlyContainer: r.string().default(""),
|
|
228
|
+
readOnlySelected: r.string().default(""),
|
|
229
|
+
readOnlyUnselected: r.string().default(""),
|
|
230
|
+
helpText: r.string().default("")
|
|
231
|
+
}).default({}),
|
|
232
|
+
searchSelectField: r.object({
|
|
233
|
+
wrapper: r.string().default(""),
|
|
234
|
+
container: r.string().default(""),
|
|
235
|
+
inputContainer: r.string().default(""),
|
|
236
|
+
input: r.string().default(""),
|
|
237
|
+
inputWithClear: r.string().default(""),
|
|
238
|
+
button: r.string().default(""),
|
|
239
|
+
buttonIcon: r.string().default(""),
|
|
240
|
+
clearButton: r.string().default(""),
|
|
241
|
+
clearIcon: r.string().default(""),
|
|
242
|
+
dropdown: r.string().default(""),
|
|
243
|
+
option: r.string().default(""),
|
|
244
|
+
optionActive: r.string().default(""),
|
|
245
|
+
optionSelected: r.string().default(""),
|
|
246
|
+
optionLabel: r.string().default(""),
|
|
247
|
+
optionCheckIcon: r.string().default(""),
|
|
248
|
+
loadingText: r.string().default(""),
|
|
249
|
+
error: r.string().default(""),
|
|
250
|
+
disabled: r.string().default(""),
|
|
251
|
+
readOnly: r.string().default(""),
|
|
252
|
+
readOnlyInput: r.string().default(""),
|
|
253
|
+
readOnlyValue: r.string().default(""),
|
|
254
|
+
fallback: r.string().default("")
|
|
255
|
+
}).default({}),
|
|
256
|
+
searchSelectMultiField: r.object({
|
|
257
|
+
wrapper: r.string().default(""),
|
|
258
|
+
container: r.string().default(""),
|
|
259
|
+
inputContainer: r.string().default(""),
|
|
260
|
+
selectedItem: r.string().default(""),
|
|
261
|
+
selectedItemLabel: r.string().default(""),
|
|
262
|
+
selectedItemRemoveButton: r.string().default(""),
|
|
263
|
+
selectedItemRemoveIcon: r.string().default(""),
|
|
264
|
+
input: r.string().default(""),
|
|
265
|
+
button: r.string().default(""),
|
|
266
|
+
buttonIcon: r.string().default(""),
|
|
267
|
+
dropdown: r.string().default(""),
|
|
268
|
+
option: r.string().default(""),
|
|
269
|
+
optionActive: r.string().default(""),
|
|
270
|
+
optionSelected: r.string().default(""),
|
|
271
|
+
optionLabel: r.string().default(""),
|
|
272
|
+
optionCheckIcon: r.string().default(""),
|
|
273
|
+
loadingText: r.string().default(""),
|
|
274
|
+
noResultsText: r.string().default(""),
|
|
275
|
+
error: r.string().default(""),
|
|
276
|
+
disabled: r.string().default(""),
|
|
277
|
+
readOnly: r.string().default(""),
|
|
278
|
+
readOnlyInput: r.string().default(""),
|
|
279
|
+
readOnlyValue: r.string().default(""),
|
|
280
|
+
fallback: r.string().default("")
|
|
281
|
+
}).default({}),
|
|
282
|
+
selectField: r.object({
|
|
283
|
+
wrapper: r.string().default(""),
|
|
284
|
+
container: r.string().default(""),
|
|
285
|
+
input: r.string().default(""),
|
|
286
|
+
clearButton: r.string().default(""),
|
|
287
|
+
clearIcon: r.string().default(""),
|
|
288
|
+
arrow: r.string().default(""),
|
|
289
|
+
arrowIcon: r.string().default(""),
|
|
290
|
+
option: r.string().default(""),
|
|
291
|
+
error: r.string().default(""),
|
|
292
|
+
disabled: r.string().default(""),
|
|
293
|
+
readOnly: r.string().default(""),
|
|
294
|
+
readOnlyInput: r.string().default(""),
|
|
295
|
+
readOnlyValue: r.string().default(""),
|
|
296
|
+
helpText: r.string().default(""),
|
|
297
|
+
fallback: r.string().default("")
|
|
298
|
+
}).default({}),
|
|
299
|
+
switchField: r.object({
|
|
300
|
+
wrapper: r.string().default(""),
|
|
301
|
+
container: r.string().default(""),
|
|
302
|
+
label: r.string().default(""),
|
|
303
|
+
switchTrack: r.string().default(""),
|
|
304
|
+
switchTrackOn: r.string().default(""),
|
|
305
|
+
switchTrackOff: r.string().default(""),
|
|
306
|
+
switchThumb: r.string().default(""),
|
|
307
|
+
switchThumbOn: r.string().default(""),
|
|
308
|
+
switchThumbOff: r.string().default(""),
|
|
309
|
+
error: r.string().default(""),
|
|
310
|
+
disabled: r.string().default(""),
|
|
311
|
+
readOnly: r.string().default(""),
|
|
312
|
+
readOnlyValue: r.string().default(""),
|
|
313
|
+
helpText: r.string().default("")
|
|
314
|
+
}).default({}),
|
|
315
|
+
textAreaField: r.object({
|
|
316
|
+
wrapper: r.string().default(""),
|
|
317
|
+
textarea: r.string().default(""),
|
|
318
|
+
error: r.string().default(""),
|
|
319
|
+
disabled: r.string().default(""),
|
|
320
|
+
readOnly: r.string().default(""),
|
|
321
|
+
readOnlyValue: r.string().default(""),
|
|
322
|
+
helpText: r.string().default("")
|
|
323
|
+
}).default({}),
|
|
324
|
+
markdownEditor: r.object({
|
|
325
|
+
wrapper: r.string().default(""),
|
|
326
|
+
editor: r.string().default(""),
|
|
327
|
+
toolbar: r.string().default(""),
|
|
328
|
+
preview: r.string().default(""),
|
|
329
|
+
error: r.string().default(""),
|
|
330
|
+
disabled: r.string().default(""),
|
|
331
|
+
readOnly: r.string().default(""),
|
|
332
|
+
readOnlyValue: r.string().default(""),
|
|
333
|
+
helpText: r.string().default("")
|
|
334
|
+
}).default({}),
|
|
335
|
+
timePickerField: r.object({
|
|
336
|
+
wrapper: r.string().default(""),
|
|
337
|
+
input: r.string().default(""),
|
|
338
|
+
error: r.string().default(""),
|
|
339
|
+
disabled: r.string().default(""),
|
|
340
|
+
readOnly: r.string().default(""),
|
|
341
|
+
readOnlyValue: r.string().default(""),
|
|
342
|
+
helpText: r.string().default("")
|
|
343
|
+
}).default({}),
|
|
344
|
+
urlField: r.object({
|
|
345
|
+
wrapper: r.string().default(""),
|
|
346
|
+
input: r.string().default(""),
|
|
347
|
+
error: r.string().default(""),
|
|
348
|
+
disabled: r.string().default(""),
|
|
349
|
+
readOnly: r.string().default(""),
|
|
350
|
+
readOnlyValue: r.string().default(""),
|
|
351
|
+
helpText: r.string().default("")
|
|
352
|
+
}).default({})
|
|
353
|
+
// Add more fields as needed
|
|
354
|
+
}), X = "This field is required";
|
|
355
|
+
class It {
|
|
356
|
+
/**
|
|
357
|
+
* Creates a generic form field. Usually you'll want to use specific methods like text(), email(), etc.
|
|
358
|
+
*
|
|
359
|
+
* @param type - The field type from FormFieldType enum
|
|
360
|
+
* @param key - Unique identifier for the field (used as form field name)
|
|
361
|
+
* @param options - Configuration options for the field
|
|
362
|
+
* @returns A FormField object that can be used with Form component
|
|
363
|
+
*/
|
|
364
|
+
static field(e, o, i = {}) {
|
|
365
|
+
return { type: e, key: o, options: i };
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Creates a text input field.
|
|
369
|
+
*
|
|
370
|
+
* @param key - Unique identifier for the field
|
|
371
|
+
* @param options - Configuration options including label, placeholder, validation, etc.
|
|
372
|
+
* @returns A text field definition
|
|
373
|
+
*
|
|
374
|
+
* @example
|
|
375
|
+
* ```tsx
|
|
376
|
+
* FormFieldClass.text('firstName', {
|
|
377
|
+
* label: 'First Name',
|
|
378
|
+
* required: true,
|
|
379
|
+
* placeholder: 'Enter your first name'
|
|
380
|
+
* })
|
|
381
|
+
* ```
|
|
382
|
+
*/
|
|
383
|
+
static text(e, o = {}) {
|
|
384
|
+
return this.field(C.Text, e, o);
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Creates a textarea field for multi-line text input.
|
|
388
|
+
*
|
|
389
|
+
* @param key - Unique identifier for the field
|
|
390
|
+
* @param options - Configuration options including label, placeholder, rows, etc.
|
|
391
|
+
* @returns A textarea field definition
|
|
392
|
+
*
|
|
393
|
+
* @example
|
|
394
|
+
* ```tsx
|
|
395
|
+
* FormFieldClass.textArea('description', {
|
|
396
|
+
* label: 'Description',
|
|
397
|
+
* placeholder: 'Enter a detailed description',
|
|
398
|
+
* rows: 4
|
|
399
|
+
* })
|
|
400
|
+
* ```
|
|
401
|
+
*/
|
|
402
|
+
static textArea(e, o = {}) {
|
|
403
|
+
return this.field(C.TextArea, e, o);
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Creates a markdown editor field with rich text editing capabilities.
|
|
407
|
+
*
|
|
408
|
+
* @param key - Unique identifier for the field
|
|
409
|
+
* @param options - Configuration options including label, height, preview, toolbar, etc.
|
|
410
|
+
* @returns A markdown editor field definition
|
|
411
|
+
*
|
|
412
|
+
* @example
|
|
413
|
+
* ```tsx
|
|
414
|
+
* FormFieldClass.markdownEditor('content', {
|
|
415
|
+
* label: 'Content',
|
|
416
|
+
* height: 400,
|
|
417
|
+
* preview: true,
|
|
418
|
+
* toolbar: ['bold', 'italic', 'link', 'quote', 'code']
|
|
419
|
+
* })
|
|
420
|
+
* ```
|
|
421
|
+
*
|
|
422
|
+
* @example Dual format output
|
|
423
|
+
* ```tsx
|
|
424
|
+
* FormFieldClass.markdownEditor('content', {
|
|
425
|
+
* label: 'Content',
|
|
426
|
+
* outputFormat: 'both', // Outputs both markdown and HTML
|
|
427
|
+
* onHtmlChange: (html) => console.log('HTML:', html)
|
|
428
|
+
* })
|
|
429
|
+
* ```
|
|
430
|
+
*
|
|
431
|
+
* @example Modal-on-modal fix
|
|
432
|
+
* ```tsx
|
|
433
|
+
* FormFieldClass.markdownEditor('content', {
|
|
434
|
+
* label: 'Content',
|
|
435
|
+
* // Fix for when MarkdownEditor is inside a modal
|
|
436
|
+
* overlayContainer: document.getElementById('modal-container'),
|
|
437
|
+
* popupZIndex: 10000, // Higher than your modal's z-index
|
|
438
|
+
* })
|
|
439
|
+
* ```
|
|
440
|
+
*/
|
|
441
|
+
static markdownEditor(e, o = {}) {
|
|
442
|
+
return {
|
|
443
|
+
key: e,
|
|
444
|
+
type: C.MarkdownEditor,
|
|
445
|
+
options: {
|
|
446
|
+
label: e,
|
|
447
|
+
outputFormat: "markdown",
|
|
448
|
+
// Default to markdown only
|
|
449
|
+
...o
|
|
450
|
+
}
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* Creates a Markdown editor field with image upload support
|
|
455
|
+
*/
|
|
456
|
+
static markdownEditorWithImages(e, o, i = {}) {
|
|
457
|
+
return {
|
|
458
|
+
key: e,
|
|
459
|
+
type: C.MarkdownEditor,
|
|
460
|
+
options: {
|
|
461
|
+
label: e,
|
|
462
|
+
enableImageUpload: !0,
|
|
463
|
+
imageUploadHandler: o,
|
|
464
|
+
maxImageSize: 5 * 1024 * 1024,
|
|
465
|
+
// 5MB default
|
|
466
|
+
allowedImageTypes: ["image/png", "image/jpeg", "image/gif", "image/webp"],
|
|
467
|
+
imageUploadMode: "custom",
|
|
468
|
+
...i
|
|
469
|
+
}
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* Creates an email input field with built-in email validation.
|
|
474
|
+
*
|
|
475
|
+
* @param key - Unique identifier for the field
|
|
476
|
+
* @param options - Configuration options including label, placeholder, validation, etc.
|
|
477
|
+
* @returns An email field definition
|
|
478
|
+
*
|
|
479
|
+
* @example
|
|
480
|
+
* ```tsx
|
|
481
|
+
* FormFieldClass.email('email', {
|
|
482
|
+
* label: 'Email Address',
|
|
483
|
+
* required: true,
|
|
484
|
+
* placeholder: 'user@example.com'
|
|
485
|
+
* })
|
|
486
|
+
* ```
|
|
487
|
+
*/
|
|
488
|
+
static email(e, o = {}) {
|
|
489
|
+
return this.field(C.Email, e, o);
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* Creates a password input field.
|
|
493
|
+
*
|
|
494
|
+
* @param key - Unique identifier for the field
|
|
495
|
+
* @param options - Configuration options including label, placeholder, validation, etc.
|
|
496
|
+
* @returns A password field definition
|
|
497
|
+
*
|
|
498
|
+
* @example
|
|
499
|
+
* ```tsx
|
|
500
|
+
* FormFieldClass.password('password', {
|
|
501
|
+
* label: 'Password',
|
|
502
|
+
* required: true,
|
|
503
|
+
* validate: (value) => value.length >= 8 || 'Password must be at least 8 characters'
|
|
504
|
+
* })
|
|
505
|
+
* ```
|
|
506
|
+
*/
|
|
507
|
+
static password(e, o = {}) {
|
|
508
|
+
return this.field(C.Password, e, o);
|
|
509
|
+
}
|
|
510
|
+
static url(e, o = {}) {
|
|
511
|
+
return this.field(C.Url, e, o);
|
|
512
|
+
}
|
|
513
|
+
static phone(e, o = {}) {
|
|
514
|
+
return this.field(C.Phone, e, o);
|
|
515
|
+
}
|
|
516
|
+
static number(e, o = {}) {
|
|
517
|
+
return this.field(C.Number, e, o);
|
|
518
|
+
}
|
|
519
|
+
static currency(e, o = {}) {
|
|
520
|
+
return this.field(C.Currency, e, o);
|
|
521
|
+
}
|
|
522
|
+
static checkbox(e, o = {}) {
|
|
523
|
+
return this.field(C.Checkbox, e, o);
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* Creates a checkbox group field with multiple selectable options.
|
|
527
|
+
*
|
|
528
|
+
* @param key - Unique identifier for the field
|
|
529
|
+
* @param options - Configuration options including checkboxOptions array, layout, etc.
|
|
530
|
+
* @returns A checkbox group field definition
|
|
531
|
+
*
|
|
532
|
+
* @example
|
|
533
|
+
* ```tsx
|
|
534
|
+
* FormFieldClass.checkboxGroup('interests', {
|
|
535
|
+
* label: 'Interests',
|
|
536
|
+
* checkboxOptions: [
|
|
537
|
+
* { key: 'sports', value: 'sports', label: 'Sports' },
|
|
538
|
+
* { key: 'music', value: 'music', label: 'Music' },
|
|
539
|
+
* { key: 'travel', value: 'travel', label: 'Travel' }
|
|
540
|
+
* ],
|
|
541
|
+
* checkboxDirection: 'column',
|
|
542
|
+
* defaultValue: 'sports,music' // comma-separated selected values
|
|
543
|
+
* })
|
|
544
|
+
* ```
|
|
545
|
+
*/
|
|
546
|
+
static checkboxGroup(e, o) {
|
|
547
|
+
return this.field(C.CheckboxGroup, e, o);
|
|
548
|
+
}
|
|
549
|
+
static customCheckbox(e, o = {}) {
|
|
550
|
+
return this.field(C.CustomCheckbox, e, o);
|
|
551
|
+
}
|
|
552
|
+
static switch(e, o = {}) {
|
|
553
|
+
return this.field(C.Switch, e, o);
|
|
554
|
+
}
|
|
555
|
+
static button(e, o = {}) {
|
|
556
|
+
const { label: i, ...s } = o;
|
|
557
|
+
return this.field(C.Button, e, s);
|
|
558
|
+
}
|
|
559
|
+
static datePicker(e, o = {}) {
|
|
560
|
+
return this.field(C.DatePicker, e, o);
|
|
561
|
+
}
|
|
562
|
+
static dateTimePicker(e, o = {}) {
|
|
563
|
+
return this.field(C.DateTimePicker, e, o);
|
|
564
|
+
}
|
|
565
|
+
static select(e, o) {
|
|
566
|
+
return this.field(C.Select, e, o);
|
|
567
|
+
}
|
|
568
|
+
static enumSelect(e, o) {
|
|
569
|
+
return this.field(C.EnumSelect, e, o);
|
|
570
|
+
}
|
|
571
|
+
static searchSelect(e, o) {
|
|
572
|
+
return this.field(C.SearchSelect, e, o);
|
|
573
|
+
}
|
|
574
|
+
static searchSelectApollo(e, o) {
|
|
575
|
+
return this.field(C.SearchSelectApollo, e, o);
|
|
576
|
+
}
|
|
577
|
+
static searchSelectMulti(e, o) {
|
|
578
|
+
return this.field(C.SearchSelectMulti, e, o);
|
|
579
|
+
}
|
|
580
|
+
static searchSelectMultiApollo(e, o) {
|
|
581
|
+
return this.field(C.SearchSelectMultiApollo, e, o);
|
|
582
|
+
}
|
|
583
|
+
static content(e, o) {
|
|
584
|
+
return this.field(C.Content, e, o);
|
|
585
|
+
}
|
|
586
|
+
static custom(e, o) {
|
|
587
|
+
return this.field(C.Custom, e, o);
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
const be = Q(null);
|
|
591
|
+
function ze() {
|
|
592
|
+
const t = ee(be);
|
|
593
|
+
if (!t)
|
|
594
|
+
throw new Error("FormField components must be used within a <Form> component.");
|
|
595
|
+
return t;
|
|
596
|
+
}
|
|
597
|
+
const ye = Q({
|
|
598
|
+
labelDisplay: "default"
|
|
599
|
+
// 'default' is the sensible default
|
|
600
|
+
});
|
|
601
|
+
function Ie() {
|
|
602
|
+
const t = ee(ye);
|
|
603
|
+
if (!t)
|
|
604
|
+
throw new Error("useFormConfig must be used within a <Form> component.");
|
|
605
|
+
return t;
|
|
606
|
+
}
|
|
607
|
+
const Re = he.parse({}), fe = Q(Re);
|
|
608
|
+
function Rt() {
|
|
609
|
+
return ee(fe);
|
|
610
|
+
}
|
|
611
|
+
function Be(t, e) {
|
|
612
|
+
return async (o) => {
|
|
613
|
+
try {
|
|
614
|
+
return await t.parseAsync(o), !0;
|
|
615
|
+
} catch (i) {
|
|
616
|
+
if (i instanceof ce) {
|
|
617
|
+
const s = i.errors[0], l = s.code;
|
|
618
|
+
return e?.[l] ?? s.message;
|
|
619
|
+
}
|
|
620
|
+
return "Invalid value";
|
|
621
|
+
}
|
|
622
|
+
};
|
|
623
|
+
}
|
|
624
|
+
function se(t, e) {
|
|
625
|
+
return async (o, i) => {
|
|
626
|
+
const s = await t(o, i);
|
|
627
|
+
return s !== !0 ? s : e(o, i);
|
|
628
|
+
};
|
|
629
|
+
}
|
|
630
|
+
async function He(t, e, o) {
|
|
631
|
+
const { options: i } = t;
|
|
632
|
+
if (i.validateWhen && !i.validateWhen(o))
|
|
633
|
+
return null;
|
|
634
|
+
if ((i.required || i.requiredWhen?.(o)) && !e)
|
|
635
|
+
return {
|
|
636
|
+
type: "required",
|
|
637
|
+
message: i.errorMessages?.required || "This field is required"
|
|
638
|
+
};
|
|
639
|
+
if (i.schema)
|
|
640
|
+
try {
|
|
641
|
+
await i.schema.parseAsync(e);
|
|
642
|
+
} catch (l) {
|
|
643
|
+
if (l instanceof ce) {
|
|
644
|
+
const a = l.errors[0];
|
|
645
|
+
return {
|
|
646
|
+
type: a.code,
|
|
647
|
+
message: i.errorMessages?.[a.code] || a.message
|
|
648
|
+
};
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
if (i.validate) {
|
|
652
|
+
const l = await i.validate(e);
|
|
653
|
+
if (l !== !0)
|
|
654
|
+
return {
|
|
655
|
+
type: "validate",
|
|
656
|
+
message: l
|
|
657
|
+
};
|
|
658
|
+
}
|
|
659
|
+
if (i.validateWithForm) {
|
|
660
|
+
const l = await i.validateWithForm(e, o);
|
|
661
|
+
if (l !== !0)
|
|
662
|
+
return {
|
|
663
|
+
type: "validateWithForm",
|
|
664
|
+
message: l
|
|
665
|
+
};
|
|
666
|
+
}
|
|
667
|
+
return null;
|
|
668
|
+
}
|
|
669
|
+
function We(t, e, o) {
|
|
670
|
+
const i = {};
|
|
671
|
+
if (e && (i.required = t.errorMessages?.required || "This field is required"), t.schema) {
|
|
672
|
+
const s = Be(t.schema, t.errorMessages);
|
|
673
|
+
i.validate && typeof i.validate == "object" ? i.validate.schema = s : i.validate = s;
|
|
674
|
+
}
|
|
675
|
+
if (t.validate)
|
|
676
|
+
if (!i.validate)
|
|
677
|
+
i.validate = t.validate;
|
|
678
|
+
else if (typeof i.validate == "object")
|
|
679
|
+
i.validate.custom = t.validate;
|
|
680
|
+
else {
|
|
681
|
+
const s = t.validate;
|
|
682
|
+
i.validate = se(i.validate, (l) => s(l));
|
|
683
|
+
}
|
|
684
|
+
if (t.validateWithForm && (i.validate ? typeof i.validate == "object" ? i.validate.crossField = t.validateWithForm : i.validate = se(i.validate, t.validateWithForm) : i.validate = t.validateWithForm), i.validate && (t.validateWhen || t.validationGroup)) {
|
|
685
|
+
const s = i.validate;
|
|
686
|
+
i.validate = async (l, a) => {
|
|
687
|
+
if (t.validateWhen && !t.validateWhen(a) || o && t.validationGroup && t.validationGroup !== o)
|
|
688
|
+
return !0;
|
|
689
|
+
if (typeof s == "function")
|
|
690
|
+
return s(l, a);
|
|
691
|
+
if (typeof s == "object") {
|
|
692
|
+
for (const [, p] of Object.entries(s))
|
|
693
|
+
if (typeof p == "function") {
|
|
694
|
+
const h = await p(l, a);
|
|
695
|
+
if (h !== !0) return h;
|
|
696
|
+
}
|
|
697
|
+
return !0;
|
|
698
|
+
}
|
|
699
|
+
return !0;
|
|
700
|
+
};
|
|
701
|
+
}
|
|
702
|
+
return i;
|
|
703
|
+
}
|
|
704
|
+
function Ae(t, e, o) {
|
|
705
|
+
if (t)
|
|
706
|
+
return Ve(t);
|
|
707
|
+
const i = e?.filter(
|
|
708
|
+
(s) => s.options.schema || s.options.validateWithForm || s.options.validate
|
|
709
|
+
);
|
|
710
|
+
if (i?.length)
|
|
711
|
+
return async (s, l, a) => {
|
|
712
|
+
const p = {};
|
|
713
|
+
for (const h of i) {
|
|
714
|
+
const c = s[h.key], b = await He(h, c, s);
|
|
715
|
+
b && (p[h.key] = b);
|
|
716
|
+
}
|
|
717
|
+
return {
|
|
718
|
+
values: Object.keys(p).length ? {} : s,
|
|
719
|
+
errors: p
|
|
720
|
+
};
|
|
721
|
+
};
|
|
722
|
+
}
|
|
723
|
+
async function Bt(t, e, o) {
|
|
724
|
+
const i = o.filter((s) => s.options.validationGroup === e).map((s) => s.key);
|
|
725
|
+
return i.length === 0 ? !0 : await t.trigger(i);
|
|
726
|
+
}
|
|
727
|
+
function Ht(t) {
|
|
728
|
+
const e = /* @__PURE__ */ new Set();
|
|
729
|
+
return t.forEach((o) => {
|
|
730
|
+
o.options.validationGroup && e.add(o.options.validationGroup);
|
|
731
|
+
}), Array.from(e).sort((o, i) => o.localeCompare(i));
|
|
732
|
+
}
|
|
733
|
+
function Wt(t, e) {
|
|
734
|
+
return t.filter((o) => o.options.validationGroup === e);
|
|
735
|
+
}
|
|
736
|
+
function At(t, e, o) {
|
|
737
|
+
return !(t.options.validateWhen && !t.options.validateWhen(e) || o && t.options.validationGroup && t.options.validationGroup !== o);
|
|
738
|
+
}
|
|
739
|
+
function ae(t, e) {
|
|
740
|
+
return W(() => {
|
|
741
|
+
const i = t.options.required || !1;
|
|
742
|
+
return We(
|
|
743
|
+
t.options,
|
|
744
|
+
i,
|
|
745
|
+
void 0
|
|
746
|
+
);
|
|
747
|
+
}, [
|
|
748
|
+
// Use stable references for the field options
|
|
749
|
+
t.key,
|
|
750
|
+
t.options.required,
|
|
751
|
+
t.options.schema
|
|
752
|
+
// Don't use function references as dependencies - they might change on every render
|
|
753
|
+
// The validation functions themselves will be stable inside createFieldValidation
|
|
754
|
+
]);
|
|
755
|
+
}
|
|
756
|
+
function jt(t, e = 500) {
|
|
757
|
+
const [o, i] = B(t);
|
|
758
|
+
return E(() => {
|
|
759
|
+
const s = setTimeout(() => {
|
|
760
|
+
i(t);
|
|
761
|
+
}, e);
|
|
762
|
+
return () => {
|
|
763
|
+
clearTimeout(s);
|
|
764
|
+
};
|
|
765
|
+
}, [t, e]), o;
|
|
766
|
+
}
|
|
767
|
+
const A = {
|
|
768
|
+
USD: {
|
|
769
|
+
code: "USD",
|
|
770
|
+
symbol: "$",
|
|
771
|
+
name: "US Dollar",
|
|
772
|
+
symbolPosition: "before",
|
|
773
|
+
decimalPlaces: 2,
|
|
774
|
+
thousandsSeparator: ",",
|
|
775
|
+
decimalSeparator: "."
|
|
776
|
+
},
|
|
777
|
+
EUR: {
|
|
778
|
+
code: "EUR",
|
|
779
|
+
symbol: "€",
|
|
780
|
+
name: "Euro",
|
|
781
|
+
symbolPosition: "before",
|
|
782
|
+
decimalPlaces: 2,
|
|
783
|
+
thousandsSeparator: ".",
|
|
784
|
+
decimalSeparator: ","
|
|
785
|
+
},
|
|
786
|
+
GBP: {
|
|
787
|
+
code: "GBP",
|
|
788
|
+
symbol: "£",
|
|
789
|
+
name: "British Pound",
|
|
790
|
+
symbolPosition: "before",
|
|
791
|
+
decimalPlaces: 2,
|
|
792
|
+
thousandsSeparator: ",",
|
|
793
|
+
decimalSeparator: "."
|
|
794
|
+
},
|
|
795
|
+
JPY: {
|
|
796
|
+
code: "JPY",
|
|
797
|
+
symbol: "¥",
|
|
798
|
+
name: "Japanese Yen",
|
|
799
|
+
symbolPosition: "before",
|
|
800
|
+
decimalPlaces: 0,
|
|
801
|
+
thousandsSeparator: ",",
|
|
802
|
+
decimalSeparator: "."
|
|
803
|
+
},
|
|
804
|
+
CNY: {
|
|
805
|
+
code: "CNY",
|
|
806
|
+
symbol: "¥",
|
|
807
|
+
name: "Chinese Yuan",
|
|
808
|
+
symbolPosition: "before",
|
|
809
|
+
decimalPlaces: 2,
|
|
810
|
+
thousandsSeparator: ",",
|
|
811
|
+
decimalSeparator: "."
|
|
812
|
+
},
|
|
813
|
+
CAD: {
|
|
814
|
+
code: "CAD",
|
|
815
|
+
symbol: "C$",
|
|
816
|
+
name: "Canadian Dollar",
|
|
817
|
+
symbolPosition: "before",
|
|
818
|
+
decimalPlaces: 2,
|
|
819
|
+
thousandsSeparator: ",",
|
|
820
|
+
decimalSeparator: "."
|
|
821
|
+
},
|
|
822
|
+
AUD: {
|
|
823
|
+
code: "AUD",
|
|
824
|
+
symbol: "A$",
|
|
825
|
+
name: "Australian Dollar",
|
|
826
|
+
symbolPosition: "before",
|
|
827
|
+
decimalPlaces: 2,
|
|
828
|
+
thousandsSeparator: ",",
|
|
829
|
+
decimalSeparator: "."
|
|
830
|
+
},
|
|
831
|
+
CHF: {
|
|
832
|
+
code: "CHF",
|
|
833
|
+
symbol: "CHF",
|
|
834
|
+
name: "Swiss Franc",
|
|
835
|
+
symbolPosition: "before",
|
|
836
|
+
decimalPlaces: 2,
|
|
837
|
+
thousandsSeparator: "'",
|
|
838
|
+
decimalSeparator: "."
|
|
839
|
+
},
|
|
840
|
+
SEK: {
|
|
841
|
+
code: "SEK",
|
|
842
|
+
symbol: "kr",
|
|
843
|
+
name: "Swedish Krona",
|
|
844
|
+
symbolPosition: "after",
|
|
845
|
+
decimalPlaces: 2,
|
|
846
|
+
thousandsSeparator: " ",
|
|
847
|
+
decimalSeparator: ","
|
|
848
|
+
},
|
|
849
|
+
NOK: {
|
|
850
|
+
code: "NOK",
|
|
851
|
+
symbol: "kr",
|
|
852
|
+
name: "Norwegian Krone",
|
|
853
|
+
symbolPosition: "after",
|
|
854
|
+
decimalPlaces: 2,
|
|
855
|
+
thousandsSeparator: " ",
|
|
856
|
+
decimalSeparator: ","
|
|
857
|
+
},
|
|
858
|
+
DKK: {
|
|
859
|
+
code: "DKK",
|
|
860
|
+
symbol: "kr",
|
|
861
|
+
name: "Danish Krone",
|
|
862
|
+
symbolPosition: "after",
|
|
863
|
+
decimalPlaces: 2,
|
|
864
|
+
thousandsSeparator: ".",
|
|
865
|
+
decimalSeparator: ","
|
|
866
|
+
},
|
|
867
|
+
PLN: {
|
|
868
|
+
code: "PLN",
|
|
869
|
+
symbol: "zł",
|
|
870
|
+
name: "Polish Złoty",
|
|
871
|
+
symbolPosition: "after",
|
|
872
|
+
decimalPlaces: 2,
|
|
873
|
+
thousandsSeparator: " ",
|
|
874
|
+
decimalSeparator: ","
|
|
875
|
+
},
|
|
876
|
+
CZK: {
|
|
877
|
+
code: "CZK",
|
|
878
|
+
symbol: "Kč",
|
|
879
|
+
name: "Czech Koruna",
|
|
880
|
+
symbolPosition: "after",
|
|
881
|
+
decimalPlaces: 2,
|
|
882
|
+
thousandsSeparator: " ",
|
|
883
|
+
decimalSeparator: ","
|
|
884
|
+
},
|
|
885
|
+
HUF: {
|
|
886
|
+
code: "HUF",
|
|
887
|
+
symbol: "Ft",
|
|
888
|
+
name: "Hungarian Forint",
|
|
889
|
+
symbolPosition: "after",
|
|
890
|
+
decimalPlaces: 0,
|
|
891
|
+
thousandsSeparator: " ",
|
|
892
|
+
decimalSeparator: ","
|
|
893
|
+
},
|
|
894
|
+
RON: {
|
|
895
|
+
code: "RON",
|
|
896
|
+
symbol: "lei",
|
|
897
|
+
name: "Romanian Leu",
|
|
898
|
+
symbolPosition: "after",
|
|
899
|
+
decimalPlaces: 2,
|
|
900
|
+
thousandsSeparator: ".",
|
|
901
|
+
decimalSeparator: ","
|
|
902
|
+
},
|
|
903
|
+
BGN: {
|
|
904
|
+
code: "BGN",
|
|
905
|
+
symbol: "лв",
|
|
906
|
+
name: "Bulgarian Lev",
|
|
907
|
+
symbolPosition: "after",
|
|
908
|
+
decimalPlaces: 2,
|
|
909
|
+
thousandsSeparator: " ",
|
|
910
|
+
decimalSeparator: ","
|
|
911
|
+
},
|
|
912
|
+
HRK: {
|
|
913
|
+
code: "HRK",
|
|
914
|
+
symbol: "kn",
|
|
915
|
+
name: "Croatian Kuna",
|
|
916
|
+
symbolPosition: "after",
|
|
917
|
+
decimalPlaces: 2,
|
|
918
|
+
thousandsSeparator: ".",
|
|
919
|
+
decimalSeparator: ","
|
|
920
|
+
},
|
|
921
|
+
RUB: {
|
|
922
|
+
code: "RUB",
|
|
923
|
+
symbol: "₽",
|
|
924
|
+
name: "Russian Ruble",
|
|
925
|
+
symbolPosition: "after",
|
|
926
|
+
decimalPlaces: 2,
|
|
927
|
+
thousandsSeparator: " ",
|
|
928
|
+
decimalSeparator: ","
|
|
929
|
+
},
|
|
930
|
+
TRY: {
|
|
931
|
+
code: "TRY",
|
|
932
|
+
symbol: "₺",
|
|
933
|
+
name: "Turkish Lira",
|
|
934
|
+
symbolPosition: "before",
|
|
935
|
+
decimalPlaces: 2,
|
|
936
|
+
thousandsSeparator: ".",
|
|
937
|
+
decimalSeparator: ","
|
|
938
|
+
},
|
|
939
|
+
BRL: {
|
|
940
|
+
code: "BRL",
|
|
941
|
+
symbol: "R$",
|
|
942
|
+
name: "Brazilian Real",
|
|
943
|
+
symbolPosition: "before",
|
|
944
|
+
decimalPlaces: 2,
|
|
945
|
+
thousandsSeparator: ".",
|
|
946
|
+
decimalSeparator: ","
|
|
947
|
+
},
|
|
948
|
+
MXN: {
|
|
949
|
+
code: "MXN",
|
|
950
|
+
symbol: "$",
|
|
951
|
+
name: "Mexican Peso",
|
|
952
|
+
symbolPosition: "before",
|
|
953
|
+
decimalPlaces: 2,
|
|
954
|
+
thousandsSeparator: ",",
|
|
955
|
+
decimalSeparator: "."
|
|
956
|
+
},
|
|
957
|
+
INR: {
|
|
958
|
+
code: "INR",
|
|
959
|
+
symbol: "₹",
|
|
960
|
+
name: "Indian Rupee",
|
|
961
|
+
symbolPosition: "before",
|
|
962
|
+
decimalPlaces: 2,
|
|
963
|
+
thousandsSeparator: ",",
|
|
964
|
+
decimalSeparator: "."
|
|
965
|
+
},
|
|
966
|
+
KRW: {
|
|
967
|
+
code: "KRW",
|
|
968
|
+
symbol: "₩",
|
|
969
|
+
name: "South Korean Won",
|
|
970
|
+
symbolPosition: "before",
|
|
971
|
+
decimalPlaces: 0,
|
|
972
|
+
thousandsSeparator: ",",
|
|
973
|
+
decimalSeparator: "."
|
|
974
|
+
},
|
|
975
|
+
SGD: {
|
|
976
|
+
code: "SGD",
|
|
977
|
+
symbol: "S$",
|
|
978
|
+
name: "Singapore Dollar",
|
|
979
|
+
symbolPosition: "before",
|
|
980
|
+
decimalPlaces: 2,
|
|
981
|
+
thousandsSeparator: ",",
|
|
982
|
+
decimalSeparator: "."
|
|
983
|
+
},
|
|
984
|
+
HKD: {
|
|
985
|
+
code: "HKD",
|
|
986
|
+
symbol: "HK$",
|
|
987
|
+
name: "Hong Kong Dollar",
|
|
988
|
+
symbolPosition: "before",
|
|
989
|
+
decimalPlaces: 2,
|
|
990
|
+
thousandsSeparator: ",",
|
|
991
|
+
decimalSeparator: "."
|
|
992
|
+
},
|
|
993
|
+
NZD: {
|
|
994
|
+
code: "NZD",
|
|
995
|
+
symbol: "NZ$",
|
|
996
|
+
name: "New Zealand Dollar",
|
|
997
|
+
symbolPosition: "before",
|
|
998
|
+
decimalPlaces: 2,
|
|
999
|
+
thousandsSeparator: ",",
|
|
1000
|
+
decimalSeparator: "."
|
|
1001
|
+
},
|
|
1002
|
+
ZAR: {
|
|
1003
|
+
code: "ZAR",
|
|
1004
|
+
symbol: "R",
|
|
1005
|
+
name: "South African Rand",
|
|
1006
|
+
symbolPosition: "before",
|
|
1007
|
+
decimalPlaces: 2,
|
|
1008
|
+
thousandsSeparator: " ",
|
|
1009
|
+
decimalSeparator: ","
|
|
1010
|
+
},
|
|
1011
|
+
THB: {
|
|
1012
|
+
code: "THB",
|
|
1013
|
+
symbol: "฿",
|
|
1014
|
+
name: "Thai Baht",
|
|
1015
|
+
symbolPosition: "before",
|
|
1016
|
+
decimalPlaces: 2,
|
|
1017
|
+
thousandsSeparator: ",",
|
|
1018
|
+
decimalSeparator: "."
|
|
1019
|
+
},
|
|
1020
|
+
MYR: {
|
|
1021
|
+
code: "MYR",
|
|
1022
|
+
symbol: "RM",
|
|
1023
|
+
name: "Malaysian Ringgit",
|
|
1024
|
+
symbolPosition: "before",
|
|
1025
|
+
decimalPlaces: 2,
|
|
1026
|
+
thousandsSeparator: ",",
|
|
1027
|
+
decimalSeparator: "."
|
|
1028
|
+
},
|
|
1029
|
+
IDR: {
|
|
1030
|
+
code: "IDR",
|
|
1031
|
+
symbol: "Rp",
|
|
1032
|
+
name: "Indonesian Rupiah",
|
|
1033
|
+
symbolPosition: "before",
|
|
1034
|
+
decimalPlaces: 0,
|
|
1035
|
+
thousandsSeparator: ".",
|
|
1036
|
+
decimalSeparator: ","
|
|
1037
|
+
},
|
|
1038
|
+
PHP: {
|
|
1039
|
+
code: "PHP",
|
|
1040
|
+
symbol: "₱",
|
|
1041
|
+
name: "Philippine Peso",
|
|
1042
|
+
symbolPosition: "before",
|
|
1043
|
+
decimalPlaces: 2,
|
|
1044
|
+
thousandsSeparator: ",",
|
|
1045
|
+
decimalSeparator: "."
|
|
1046
|
+
},
|
|
1047
|
+
VND: {
|
|
1048
|
+
code: "VND",
|
|
1049
|
+
symbol: "₫",
|
|
1050
|
+
name: "Vietnamese Dong",
|
|
1051
|
+
symbolPosition: "after",
|
|
1052
|
+
decimalPlaces: 0,
|
|
1053
|
+
thousandsSeparator: ".",
|
|
1054
|
+
decimalSeparator: ","
|
|
1055
|
+
}
|
|
1056
|
+
};
|
|
1057
|
+
function je(t) {
|
|
1058
|
+
return A[t];
|
|
1059
|
+
}
|
|
1060
|
+
function Mt() {
|
|
1061
|
+
return Object.values(A).map((t) => ({
|
|
1062
|
+
value: t.code,
|
|
1063
|
+
label: `${t.symbol} ${t.code} - ${t.name}`
|
|
1064
|
+
}));
|
|
1065
|
+
}
|
|
1066
|
+
function qt() {
|
|
1067
|
+
return ["USD", "EUR", "GBP", "JPY", "CAD", "AUD", "CHF", "CNY"].map((e) => ({
|
|
1068
|
+
value: e,
|
|
1069
|
+
label: `${A[e].symbol} ${e} - ${A[e].name}`
|
|
1070
|
+
}));
|
|
1071
|
+
}
|
|
1072
|
+
function Me(t, e) {
|
|
1073
|
+
const o = t.startsWith("-"), i = o ? t.slice(1) : t;
|
|
1074
|
+
if (i.length <= 3 || e === "")
|
|
1075
|
+
return o ? "-" + i : i;
|
|
1076
|
+
let s = "";
|
|
1077
|
+
for (let p = i.length; p > 3; p -= 3)
|
|
1078
|
+
s = e + i.slice(p - 3, p) + s;
|
|
1079
|
+
const l = i.length % 3 || 3, a = i.slice(0, l) + s;
|
|
1080
|
+
return o ? "-" + a : a;
|
|
1081
|
+
}
|
|
1082
|
+
function q(t, e, o = {}) {
|
|
1083
|
+
const { showSymbol: i = !0, showCode: s = !1, includeDecimals: l = !0 } = o;
|
|
1084
|
+
if (t == null || t === "")
|
|
1085
|
+
return "";
|
|
1086
|
+
const a = typeof t == "string" ? parseFloat(t) : t;
|
|
1087
|
+
if (isNaN(a))
|
|
1088
|
+
return "";
|
|
1089
|
+
const p = l ? e.decimalPlaces : 0, h = a.toFixed(p), [c, b] = h.split("."), d = Me(c, e.thousandsSeparator);
|
|
1090
|
+
let S = b ? `${d}${e.decimalSeparator}${b}` : d;
|
|
1091
|
+
return i && (e.symbolPosition === "before" ? S = `${e.symbol}${S}` : S = `${S} ${e.symbol}`), s && (S = `${S} ${e.code}`), S;
|
|
1092
|
+
}
|
|
1093
|
+
function Lt(t, e) {
|
|
1094
|
+
if (!t || typeof t != "string")
|
|
1095
|
+
return null;
|
|
1096
|
+
let o = t.replace(e.symbol, "").replace(e.code, "").trim();
|
|
1097
|
+
o = o.replace(new RegExp(`\\${e.thousandsSeparator}`, "g"), ""), e.decimalSeparator !== "." && (o = o.replace(e.decimalSeparator, "."));
|
|
1098
|
+
const i = parseFloat(o);
|
|
1099
|
+
return isNaN(i) ? null : i;
|
|
1100
|
+
}
|
|
1101
|
+
function Et(t) {
|
|
1102
|
+
return t.decimalPlaces === 0 ? "1" : `0.${"0".repeat(t.decimalPlaces - 1)}1`;
|
|
1103
|
+
}
|
|
1104
|
+
function qe(t = "USD", e) {
|
|
1105
|
+
return t === "custom" && e ? {
|
|
1106
|
+
...A.USD,
|
|
1107
|
+
...e,
|
|
1108
|
+
code: e.code || "USD"
|
|
1109
|
+
} : A[t] || A.USD;
|
|
1110
|
+
}
|
|
1111
|
+
function Nt(t) {
|
|
1112
|
+
return t in A;
|
|
1113
|
+
}
|
|
1114
|
+
function $t(t, e, o, i) {
|
|
1115
|
+
if (e === o)
|
|
1116
|
+
return t;
|
|
1117
|
+
if (!i)
|
|
1118
|
+
throw new Error("Exchange rates required for currency conversion");
|
|
1119
|
+
const s = i[`${e}_${o}`];
|
|
1120
|
+
if (!s)
|
|
1121
|
+
throw new Error(`Exchange rate not found for ${e} to ${o}`);
|
|
1122
|
+
return t * s;
|
|
1123
|
+
}
|
|
1124
|
+
function Ut(t, e, o = "display") {
|
|
1125
|
+
const i = je(e);
|
|
1126
|
+
switch (o) {
|
|
1127
|
+
case "input":
|
|
1128
|
+
return q(t, { ...i, thousandsSeparator: "" }, { showSymbol: !1 });
|
|
1129
|
+
case "compact": {
|
|
1130
|
+
const s = typeof t == "string" ? parseFloat(t) : t;
|
|
1131
|
+
return s && s >= 1e6 ? q(s / 1e6, i, { includeDecimals: !1 }) + "M" : s && s >= 1e3 ? q(s / 1e3, i, { includeDecimals: !1 }) + "K" : q(t, i);
|
|
1132
|
+
}
|
|
1133
|
+
case "display":
|
|
1134
|
+
default:
|
|
1135
|
+
return q(t, i);
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
function ge(t) {
|
|
1139
|
+
return t ? t.split("T")[0] : null;
|
|
1140
|
+
}
|
|
1141
|
+
function re(t, e) {
|
|
1142
|
+
return t ? ue(ge(t)).format(e ? "MM/DD/YYYY" : "MMMM DD, YYYY") : null;
|
|
1143
|
+
}
|
|
1144
|
+
function Le(t) {
|
|
1145
|
+
return t ? t.slice(0, 16) : null;
|
|
1146
|
+
}
|
|
1147
|
+
function le(t, e) {
|
|
1148
|
+
return t ? ue(t).format(e ? "MM/DD/YYYY h:mm A" : "MMMM DD, YYYY h:mm A") : null;
|
|
1149
|
+
}
|
|
1150
|
+
const $ = {
|
|
1151
|
+
// ── Global ──
|
|
1152
|
+
global: w.create({
|
|
1153
|
+
input: {
|
|
1154
|
+
borderWidth: 1,
|
|
1155
|
+
borderColor: "#d1d5db",
|
|
1156
|
+
borderRadius: 8,
|
|
1157
|
+
paddingHorizontal: 12,
|
|
1158
|
+
paddingVertical: 10,
|
|
1159
|
+
fontSize: 16,
|
|
1160
|
+
color: "#111827",
|
|
1161
|
+
backgroundColor: "#ffffff"
|
|
1162
|
+
},
|
|
1163
|
+
inputFocused: {
|
|
1164
|
+
borderColor: "#7dd3fc",
|
|
1165
|
+
borderWidth: 2
|
|
1166
|
+
},
|
|
1167
|
+
error: {
|
|
1168
|
+
borderColor: "#dc2626"
|
|
1169
|
+
},
|
|
1170
|
+
disabled: {
|
|
1171
|
+
opacity: 0.5,
|
|
1172
|
+
backgroundColor: "#f3f4f6"
|
|
1173
|
+
},
|
|
1174
|
+
readOnly: {
|
|
1175
|
+
minHeight: 40,
|
|
1176
|
+
justifyContent: "center",
|
|
1177
|
+
paddingHorizontal: 12
|
|
1178
|
+
},
|
|
1179
|
+
readOnlyText: {
|
|
1180
|
+
fontSize: 16,
|
|
1181
|
+
color: "#374151"
|
|
1182
|
+
},
|
|
1183
|
+
errorText: {
|
|
1184
|
+
color: "#dc2626",
|
|
1185
|
+
fontSize: 13,
|
|
1186
|
+
marginTop: 4
|
|
1187
|
+
},
|
|
1188
|
+
helpText: {
|
|
1189
|
+
color: "#6b7280",
|
|
1190
|
+
fontSize: 13,
|
|
1191
|
+
marginTop: 4
|
|
1192
|
+
},
|
|
1193
|
+
fieldWrapper: {
|
|
1194
|
+
marginBottom: 16
|
|
1195
|
+
}
|
|
1196
|
+
}),
|
|
1197
|
+
// ── Label ──
|
|
1198
|
+
label: w.create({
|
|
1199
|
+
base: {
|
|
1200
|
+
fontSize: 14,
|
|
1201
|
+
fontWeight: "500",
|
|
1202
|
+
color: "#374151",
|
|
1203
|
+
marginBottom: 4
|
|
1204
|
+
},
|
|
1205
|
+
requiredIndicator: {
|
|
1206
|
+
color: "#dc2626",
|
|
1207
|
+
fontSize: 14
|
|
1208
|
+
}
|
|
1209
|
+
}),
|
|
1210
|
+
// ── Text Field ──
|
|
1211
|
+
textField: w.create({
|
|
1212
|
+
input: {
|
|
1213
|
+
borderWidth: 1,
|
|
1214
|
+
borderColor: "#d1d5db",
|
|
1215
|
+
borderRadius: 8,
|
|
1216
|
+
paddingHorizontal: 12,
|
|
1217
|
+
paddingVertical: 10,
|
|
1218
|
+
fontSize: 16,
|
|
1219
|
+
color: "#111827",
|
|
1220
|
+
backgroundColor: "#ffffff"
|
|
1221
|
+
},
|
|
1222
|
+
error: {
|
|
1223
|
+
borderColor: "#dc2626"
|
|
1224
|
+
},
|
|
1225
|
+
disabled: {
|
|
1226
|
+
opacity: 0.5,
|
|
1227
|
+
backgroundColor: "#f3f4f6"
|
|
1228
|
+
},
|
|
1229
|
+
readOnly: {
|
|
1230
|
+
minHeight: 40,
|
|
1231
|
+
justifyContent: "center",
|
|
1232
|
+
paddingHorizontal: 12
|
|
1233
|
+
},
|
|
1234
|
+
readOnlyText: {
|
|
1235
|
+
fontSize: 16,
|
|
1236
|
+
color: "#374151"
|
|
1237
|
+
},
|
|
1238
|
+
helpText: {
|
|
1239
|
+
color: "#6b7280",
|
|
1240
|
+
fontSize: 13,
|
|
1241
|
+
marginTop: 4
|
|
1242
|
+
}
|
|
1243
|
+
}),
|
|
1244
|
+
// ── TextArea Field ──
|
|
1245
|
+
textAreaField: w.create({
|
|
1246
|
+
textarea: {
|
|
1247
|
+
borderWidth: 1,
|
|
1248
|
+
borderColor: "#d1d5db",
|
|
1249
|
+
borderRadius: 8,
|
|
1250
|
+
paddingHorizontal: 12,
|
|
1251
|
+
paddingVertical: 10,
|
|
1252
|
+
fontSize: 16,
|
|
1253
|
+
color: "#111827",
|
|
1254
|
+
backgroundColor: "#ffffff",
|
|
1255
|
+
textAlignVertical: "top"
|
|
1256
|
+
},
|
|
1257
|
+
error: {
|
|
1258
|
+
borderColor: "#dc2626"
|
|
1259
|
+
},
|
|
1260
|
+
disabled: {
|
|
1261
|
+
opacity: 0.5,
|
|
1262
|
+
backgroundColor: "#f3f4f6"
|
|
1263
|
+
},
|
|
1264
|
+
readOnlyValue: {
|
|
1265
|
+
fontSize: 16,
|
|
1266
|
+
color: "#374151",
|
|
1267
|
+
minHeight: 40,
|
|
1268
|
+
paddingHorizontal: 12
|
|
1269
|
+
},
|
|
1270
|
+
helpText: {
|
|
1271
|
+
color: "#6b7280",
|
|
1272
|
+
fontSize: 13,
|
|
1273
|
+
marginTop: 4
|
|
1274
|
+
}
|
|
1275
|
+
}),
|
|
1276
|
+
// ── Email Field ──
|
|
1277
|
+
emailField: w.create({
|
|
1278
|
+
input: {
|
|
1279
|
+
borderWidth: 1,
|
|
1280
|
+
borderColor: "#d1d5db",
|
|
1281
|
+
borderRadius: 8,
|
|
1282
|
+
paddingHorizontal: 12,
|
|
1283
|
+
paddingVertical: 10,
|
|
1284
|
+
fontSize: 16,
|
|
1285
|
+
color: "#111827",
|
|
1286
|
+
backgroundColor: "#ffffff"
|
|
1287
|
+
},
|
|
1288
|
+
error: {
|
|
1289
|
+
borderColor: "#dc2626"
|
|
1290
|
+
},
|
|
1291
|
+
disabled: {
|
|
1292
|
+
opacity: 0.5,
|
|
1293
|
+
backgroundColor: "#f3f4f6"
|
|
1294
|
+
},
|
|
1295
|
+
readOnlyValue: {
|
|
1296
|
+
fontSize: 16,
|
|
1297
|
+
color: "#374151",
|
|
1298
|
+
minHeight: 40,
|
|
1299
|
+
justifyContent: "center",
|
|
1300
|
+
paddingHorizontal: 12
|
|
1301
|
+
}
|
|
1302
|
+
}),
|
|
1303
|
+
// ── Password Field ──
|
|
1304
|
+
passwordField: w.create({
|
|
1305
|
+
container: {
|
|
1306
|
+
position: "relative"
|
|
1307
|
+
},
|
|
1308
|
+
input: {
|
|
1309
|
+
borderWidth: 1,
|
|
1310
|
+
borderColor: "#d1d5db",
|
|
1311
|
+
borderRadius: 8,
|
|
1312
|
+
paddingHorizontal: 12,
|
|
1313
|
+
paddingVertical: 10,
|
|
1314
|
+
paddingRight: 48,
|
|
1315
|
+
fontSize: 16,
|
|
1316
|
+
color: "#111827",
|
|
1317
|
+
backgroundColor: "#ffffff"
|
|
1318
|
+
},
|
|
1319
|
+
error: {
|
|
1320
|
+
borderColor: "#dc2626"
|
|
1321
|
+
},
|
|
1322
|
+
disabled: {
|
|
1323
|
+
opacity: 0.5,
|
|
1324
|
+
backgroundColor: "#f3f4f6"
|
|
1325
|
+
},
|
|
1326
|
+
readOnlyValue: {
|
|
1327
|
+
fontSize: 16,
|
|
1328
|
+
color: "#374151",
|
|
1329
|
+
minHeight: 40,
|
|
1330
|
+
justifyContent: "center",
|
|
1331
|
+
paddingHorizontal: 12
|
|
1332
|
+
},
|
|
1333
|
+
toggleButton: {
|
|
1334
|
+
position: "absolute",
|
|
1335
|
+
right: 12,
|
|
1336
|
+
top: 0,
|
|
1337
|
+
bottom: 0,
|
|
1338
|
+
justifyContent: "center"
|
|
1339
|
+
},
|
|
1340
|
+
toggleText: {
|
|
1341
|
+
fontSize: 14,
|
|
1342
|
+
color: "#6b7280"
|
|
1343
|
+
},
|
|
1344
|
+
helpText: {
|
|
1345
|
+
color: "#6b7280",
|
|
1346
|
+
fontSize: 13,
|
|
1347
|
+
marginTop: 4
|
|
1348
|
+
}
|
|
1349
|
+
}),
|
|
1350
|
+
// ── URL Field ──
|
|
1351
|
+
urlField: w.create({
|
|
1352
|
+
input: {
|
|
1353
|
+
borderWidth: 1,
|
|
1354
|
+
borderColor: "#d1d5db",
|
|
1355
|
+
borderRadius: 8,
|
|
1356
|
+
paddingHorizontal: 12,
|
|
1357
|
+
paddingVertical: 10,
|
|
1358
|
+
fontSize: 16,
|
|
1359
|
+
color: "#111827",
|
|
1360
|
+
backgroundColor: "#ffffff"
|
|
1361
|
+
},
|
|
1362
|
+
error: {
|
|
1363
|
+
borderColor: "#dc2626"
|
|
1364
|
+
},
|
|
1365
|
+
disabled: {
|
|
1366
|
+
opacity: 0.5,
|
|
1367
|
+
backgroundColor: "#f3f4f6"
|
|
1368
|
+
},
|
|
1369
|
+
readOnlyValue: {
|
|
1370
|
+
fontSize: 16,
|
|
1371
|
+
color: "#374151",
|
|
1372
|
+
minHeight: 40,
|
|
1373
|
+
justifyContent: "center",
|
|
1374
|
+
paddingHorizontal: 12
|
|
1375
|
+
},
|
|
1376
|
+
helpText: {
|
|
1377
|
+
color: "#6b7280",
|
|
1378
|
+
fontSize: 13,
|
|
1379
|
+
marginTop: 4
|
|
1380
|
+
}
|
|
1381
|
+
}),
|
|
1382
|
+
// ── Number Field ──
|
|
1383
|
+
numberField: w.create({
|
|
1384
|
+
input: {
|
|
1385
|
+
borderWidth: 1,
|
|
1386
|
+
borderColor: "#d1d5db",
|
|
1387
|
+
borderRadius: 8,
|
|
1388
|
+
paddingHorizontal: 12,
|
|
1389
|
+
paddingVertical: 10,
|
|
1390
|
+
fontSize: 16,
|
|
1391
|
+
color: "#111827",
|
|
1392
|
+
backgroundColor: "#ffffff"
|
|
1393
|
+
},
|
|
1394
|
+
error: {
|
|
1395
|
+
borderColor: "#dc2626"
|
|
1396
|
+
},
|
|
1397
|
+
disabled: {
|
|
1398
|
+
opacity: 0.5,
|
|
1399
|
+
backgroundColor: "#f3f4f6"
|
|
1400
|
+
},
|
|
1401
|
+
readOnlyValue: {
|
|
1402
|
+
fontSize: 16,
|
|
1403
|
+
color: "#374151",
|
|
1404
|
+
minHeight: 40,
|
|
1405
|
+
justifyContent: "center",
|
|
1406
|
+
paddingHorizontal: 12
|
|
1407
|
+
},
|
|
1408
|
+
helpText: {
|
|
1409
|
+
color: "#6b7280",
|
|
1410
|
+
fontSize: 13,
|
|
1411
|
+
marginTop: 4
|
|
1412
|
+
}
|
|
1413
|
+
}),
|
|
1414
|
+
// ── Money Field ──
|
|
1415
|
+
moneyField: w.create({
|
|
1416
|
+
container: {
|
|
1417
|
+
flexDirection: "row",
|
|
1418
|
+
alignItems: "center"
|
|
1419
|
+
},
|
|
1420
|
+
currencySymbol: {
|
|
1421
|
+
fontSize: 16,
|
|
1422
|
+
color: "#6b7280",
|
|
1423
|
+
paddingHorizontal: 8
|
|
1424
|
+
},
|
|
1425
|
+
currencySymbolHidden: {
|
|
1426
|
+
opacity: 0
|
|
1427
|
+
},
|
|
1428
|
+
input: {
|
|
1429
|
+
flex: 1,
|
|
1430
|
+
borderWidth: 1,
|
|
1431
|
+
borderColor: "#d1d5db",
|
|
1432
|
+
borderRadius: 8,
|
|
1433
|
+
paddingHorizontal: 12,
|
|
1434
|
+
paddingVertical: 10,
|
|
1435
|
+
fontSize: 16,
|
|
1436
|
+
color: "#111827",
|
|
1437
|
+
backgroundColor: "#ffffff"
|
|
1438
|
+
},
|
|
1439
|
+
error: {
|
|
1440
|
+
borderColor: "#dc2626"
|
|
1441
|
+
},
|
|
1442
|
+
disabled: {
|
|
1443
|
+
opacity: 0.5,
|
|
1444
|
+
backgroundColor: "#f3f4f6"
|
|
1445
|
+
},
|
|
1446
|
+
readOnlyValue: {
|
|
1447
|
+
fontSize: 16,
|
|
1448
|
+
color: "#374151",
|
|
1449
|
+
minHeight: 40,
|
|
1450
|
+
justifyContent: "center",
|
|
1451
|
+
paddingHorizontal: 12
|
|
1452
|
+
}
|
|
1453
|
+
}),
|
|
1454
|
+
// ── Phone Field ──
|
|
1455
|
+
phoneField: w.create({
|
|
1456
|
+
input: {
|
|
1457
|
+
borderWidth: 1,
|
|
1458
|
+
borderColor: "#d1d5db",
|
|
1459
|
+
borderRadius: 8,
|
|
1460
|
+
paddingHorizontal: 12,
|
|
1461
|
+
paddingVertical: 10,
|
|
1462
|
+
fontSize: 16,
|
|
1463
|
+
color: "#111827",
|
|
1464
|
+
backgroundColor: "#ffffff"
|
|
1465
|
+
},
|
|
1466
|
+
error: {
|
|
1467
|
+
borderColor: "#dc2626"
|
|
1468
|
+
},
|
|
1469
|
+
disabled: {
|
|
1470
|
+
opacity: 0.5,
|
|
1471
|
+
backgroundColor: "#f3f4f6"
|
|
1472
|
+
},
|
|
1473
|
+
readOnlyValue: {
|
|
1474
|
+
fontSize: 16,
|
|
1475
|
+
color: "#374151",
|
|
1476
|
+
minHeight: 40,
|
|
1477
|
+
justifyContent: "center",
|
|
1478
|
+
paddingHorizontal: 12
|
|
1479
|
+
},
|
|
1480
|
+
helpText: {
|
|
1481
|
+
color: "#6b7280",
|
|
1482
|
+
fontSize: 13,
|
|
1483
|
+
marginTop: 4
|
|
1484
|
+
}
|
|
1485
|
+
}),
|
|
1486
|
+
// ── Checkbox ──
|
|
1487
|
+
checkbox: w.create({
|
|
1488
|
+
wrapper: {
|
|
1489
|
+
flexDirection: "column"
|
|
1490
|
+
},
|
|
1491
|
+
row: {
|
|
1492
|
+
flexDirection: "row",
|
|
1493
|
+
alignItems: "center",
|
|
1494
|
+
gap: 8
|
|
1495
|
+
},
|
|
1496
|
+
label: {
|
|
1497
|
+
fontSize: 16,
|
|
1498
|
+
color: "#374151"
|
|
1499
|
+
},
|
|
1500
|
+
helpText: {
|
|
1501
|
+
color: "#6b7280",
|
|
1502
|
+
fontSize: 13,
|
|
1503
|
+
marginTop: 4
|
|
1504
|
+
},
|
|
1505
|
+
errorMessage: {
|
|
1506
|
+
color: "#dc2626",
|
|
1507
|
+
fontSize: 13,
|
|
1508
|
+
marginTop: 4
|
|
1509
|
+
},
|
|
1510
|
+
disabled: {
|
|
1511
|
+
opacity: 0.5
|
|
1512
|
+
},
|
|
1513
|
+
readOnly: {
|
|
1514
|
+
fontSize: 16,
|
|
1515
|
+
color: "#374151"
|
|
1516
|
+
}
|
|
1517
|
+
}),
|
|
1518
|
+
// ── Custom Checkbox ──
|
|
1519
|
+
customCheckbox: w.create({
|
|
1520
|
+
wrapper: {
|
|
1521
|
+
flexDirection: "column"
|
|
1522
|
+
},
|
|
1523
|
+
row: {
|
|
1524
|
+
flexDirection: "row",
|
|
1525
|
+
alignItems: "center",
|
|
1526
|
+
gap: 8
|
|
1527
|
+
},
|
|
1528
|
+
checkboxContainer: {
|
|
1529
|
+
width: 24,
|
|
1530
|
+
height: 24,
|
|
1531
|
+
justifyContent: "center",
|
|
1532
|
+
alignItems: "center"
|
|
1533
|
+
},
|
|
1534
|
+
label: {
|
|
1535
|
+
fontSize: 16,
|
|
1536
|
+
color: "#374151"
|
|
1537
|
+
},
|
|
1538
|
+
helpText: {
|
|
1539
|
+
color: "#6b7280",
|
|
1540
|
+
fontSize: 13,
|
|
1541
|
+
marginTop: 4
|
|
1542
|
+
},
|
|
1543
|
+
disabled: {
|
|
1544
|
+
opacity: 0.5
|
|
1545
|
+
},
|
|
1546
|
+
readOnly: {
|
|
1547
|
+
fontSize: 16,
|
|
1548
|
+
color: "#374151"
|
|
1549
|
+
},
|
|
1550
|
+
checked: {
|
|
1551
|
+
// Styling applied when checked — override in theme
|
|
1552
|
+
},
|
|
1553
|
+
error: {
|
|
1554
|
+
// Styling applied on error — override in theme
|
|
1555
|
+
}
|
|
1556
|
+
}),
|
|
1557
|
+
// ── Switch Field ──
|
|
1558
|
+
switchField: w.create({
|
|
1559
|
+
container: {
|
|
1560
|
+
flexDirection: "row",
|
|
1561
|
+
alignItems: "center",
|
|
1562
|
+
justifyContent: "space-between"
|
|
1563
|
+
},
|
|
1564
|
+
label: {
|
|
1565
|
+
fontSize: 16,
|
|
1566
|
+
color: "#374151",
|
|
1567
|
+
flex: 1
|
|
1568
|
+
},
|
|
1569
|
+
helpText: {
|
|
1570
|
+
color: "#6b7280",
|
|
1571
|
+
fontSize: 13,
|
|
1572
|
+
marginTop: 4
|
|
1573
|
+
},
|
|
1574
|
+
disabled: {
|
|
1575
|
+
opacity: 0.5
|
|
1576
|
+
},
|
|
1577
|
+
readOnlyValue: {
|
|
1578
|
+
fontSize: 16,
|
|
1579
|
+
color: "#374151"
|
|
1580
|
+
},
|
|
1581
|
+
error: {
|
|
1582
|
+
// Applied on error
|
|
1583
|
+
}
|
|
1584
|
+
}),
|
|
1585
|
+
// ── Checkbox Group ──
|
|
1586
|
+
checkboxGroup: w.create({
|
|
1587
|
+
wrapper: {
|
|
1588
|
+
flexDirection: "column"
|
|
1589
|
+
},
|
|
1590
|
+
containerColumn: {
|
|
1591
|
+
flexDirection: "column",
|
|
1592
|
+
gap: 8
|
|
1593
|
+
},
|
|
1594
|
+
containerRow: {
|
|
1595
|
+
flexDirection: "row",
|
|
1596
|
+
flexWrap: "wrap",
|
|
1597
|
+
gap: 16
|
|
1598
|
+
},
|
|
1599
|
+
optionContainer: {
|
|
1600
|
+
flexDirection: "row",
|
|
1601
|
+
alignItems: "center",
|
|
1602
|
+
gap: 8
|
|
1603
|
+
},
|
|
1604
|
+
label: {
|
|
1605
|
+
fontSize: 16,
|
|
1606
|
+
color: "#374151"
|
|
1607
|
+
},
|
|
1608
|
+
readOnlyValue: {
|
|
1609
|
+
fontSize: 16,
|
|
1610
|
+
color: "#374151"
|
|
1611
|
+
},
|
|
1612
|
+
readOnlySelected: {
|
|
1613
|
+
fontSize: 16,
|
|
1614
|
+
color: "#374151"
|
|
1615
|
+
},
|
|
1616
|
+
readOnlyUnselected: {
|
|
1617
|
+
fontSize: 16,
|
|
1618
|
+
color: "#9ca3af"
|
|
1619
|
+
},
|
|
1620
|
+
disabled: {
|
|
1621
|
+
opacity: 0.5
|
|
1622
|
+
}
|
|
1623
|
+
}),
|
|
1624
|
+
// ── Button ──
|
|
1625
|
+
button: w.create({
|
|
1626
|
+
base: {
|
|
1627
|
+
borderRadius: 8,
|
|
1628
|
+
paddingVertical: 12,
|
|
1629
|
+
paddingHorizontal: 16,
|
|
1630
|
+
alignItems: "center",
|
|
1631
|
+
justifyContent: "center"
|
|
1632
|
+
},
|
|
1633
|
+
primary: {
|
|
1634
|
+
backgroundColor: "#0284c7"
|
|
1635
|
+
},
|
|
1636
|
+
secondary: {
|
|
1637
|
+
backgroundColor: "#ffffff",
|
|
1638
|
+
borderWidth: 1,
|
|
1639
|
+
borderColor: "#d1d5db"
|
|
1640
|
+
},
|
|
1641
|
+
danger: {
|
|
1642
|
+
backgroundColor: "#dc2626"
|
|
1643
|
+
},
|
|
1644
|
+
disabled: {
|
|
1645
|
+
opacity: 0.5
|
|
1646
|
+
},
|
|
1647
|
+
loading: {
|
|
1648
|
+
opacity: 0.7
|
|
1649
|
+
},
|
|
1650
|
+
fullWidth: {
|
|
1651
|
+
width: "100%"
|
|
1652
|
+
},
|
|
1653
|
+
text: {
|
|
1654
|
+
fontSize: 16,
|
|
1655
|
+
fontWeight: "600"
|
|
1656
|
+
},
|
|
1657
|
+
primaryText: {
|
|
1658
|
+
color: "#ffffff"
|
|
1659
|
+
},
|
|
1660
|
+
secondaryText: {
|
|
1661
|
+
color: "#374151"
|
|
1662
|
+
},
|
|
1663
|
+
dangerText: {
|
|
1664
|
+
color: "#ffffff"
|
|
1665
|
+
},
|
|
1666
|
+
disabledText: {
|
|
1667
|
+
color: "#9ca3af"
|
|
1668
|
+
}
|
|
1669
|
+
}),
|
|
1670
|
+
// ── Date Picker ──
|
|
1671
|
+
datePicker: w.create({
|
|
1672
|
+
trigger: {
|
|
1673
|
+
borderWidth: 1,
|
|
1674
|
+
borderColor: "#d1d5db",
|
|
1675
|
+
borderRadius: 8,
|
|
1676
|
+
paddingHorizontal: 12,
|
|
1677
|
+
paddingVertical: 10,
|
|
1678
|
+
backgroundColor: "#ffffff",
|
|
1679
|
+
flexDirection: "row",
|
|
1680
|
+
alignItems: "center",
|
|
1681
|
+
justifyContent: "space-between"
|
|
1682
|
+
},
|
|
1683
|
+
triggerText: {
|
|
1684
|
+
fontSize: 16,
|
|
1685
|
+
color: "#111827"
|
|
1686
|
+
},
|
|
1687
|
+
placeholderText: {
|
|
1688
|
+
fontSize: 16,
|
|
1689
|
+
color: "#9ca3af"
|
|
1690
|
+
},
|
|
1691
|
+
error: {
|
|
1692
|
+
borderColor: "#dc2626"
|
|
1693
|
+
},
|
|
1694
|
+
disabled: {
|
|
1695
|
+
opacity: 0.5,
|
|
1696
|
+
backgroundColor: "#f3f4f6"
|
|
1697
|
+
},
|
|
1698
|
+
readOnlyValue: {
|
|
1699
|
+
fontSize: 16,
|
|
1700
|
+
color: "#374151",
|
|
1701
|
+
minHeight: 40,
|
|
1702
|
+
justifyContent: "center",
|
|
1703
|
+
paddingHorizontal: 12
|
|
1704
|
+
},
|
|
1705
|
+
helpText: {
|
|
1706
|
+
color: "#6b7280",
|
|
1707
|
+
fontSize: 13,
|
|
1708
|
+
marginTop: 4
|
|
1709
|
+
}
|
|
1710
|
+
}),
|
|
1711
|
+
// ── DateTime Picker (reuses datePicker styles) ──
|
|
1712
|
+
dateTimePicker: w.create({
|
|
1713
|
+
trigger: {
|
|
1714
|
+
borderWidth: 1,
|
|
1715
|
+
borderColor: "#d1d5db",
|
|
1716
|
+
borderRadius: 8,
|
|
1717
|
+
paddingHorizontal: 12,
|
|
1718
|
+
paddingVertical: 10,
|
|
1719
|
+
backgroundColor: "#ffffff",
|
|
1720
|
+
flexDirection: "row",
|
|
1721
|
+
alignItems: "center",
|
|
1722
|
+
justifyContent: "space-between"
|
|
1723
|
+
},
|
|
1724
|
+
triggerText: {
|
|
1725
|
+
fontSize: 16,
|
|
1726
|
+
color: "#111827"
|
|
1727
|
+
},
|
|
1728
|
+
placeholderText: {
|
|
1729
|
+
fontSize: 16,
|
|
1730
|
+
color: "#9ca3af"
|
|
1731
|
+
},
|
|
1732
|
+
error: {
|
|
1733
|
+
borderColor: "#dc2626"
|
|
1734
|
+
},
|
|
1735
|
+
disabled: {
|
|
1736
|
+
opacity: 0.5,
|
|
1737
|
+
backgroundColor: "#f3f4f6"
|
|
1738
|
+
},
|
|
1739
|
+
readOnlyValue: {
|
|
1740
|
+
fontSize: 16,
|
|
1741
|
+
color: "#374151",
|
|
1742
|
+
minHeight: 40,
|
|
1743
|
+
justifyContent: "center",
|
|
1744
|
+
paddingHorizontal: 12
|
|
1745
|
+
},
|
|
1746
|
+
helpText: {
|
|
1747
|
+
color: "#6b7280",
|
|
1748
|
+
fontSize: 13,
|
|
1749
|
+
marginTop: 4
|
|
1750
|
+
}
|
|
1751
|
+
}),
|
|
1752
|
+
// ── Time Picker ──
|
|
1753
|
+
timePicker: w.create({
|
|
1754
|
+
trigger: {
|
|
1755
|
+
borderWidth: 1,
|
|
1756
|
+
borderColor: "#d1d5db",
|
|
1757
|
+
borderRadius: 8,
|
|
1758
|
+
paddingHorizontal: 12,
|
|
1759
|
+
paddingVertical: 10,
|
|
1760
|
+
backgroundColor: "#ffffff",
|
|
1761
|
+
flexDirection: "row",
|
|
1762
|
+
alignItems: "center",
|
|
1763
|
+
justifyContent: "space-between"
|
|
1764
|
+
},
|
|
1765
|
+
triggerText: {
|
|
1766
|
+
fontSize: 16,
|
|
1767
|
+
color: "#111827"
|
|
1768
|
+
},
|
|
1769
|
+
placeholderText: {
|
|
1770
|
+
fontSize: 16,
|
|
1771
|
+
color: "#9ca3af"
|
|
1772
|
+
},
|
|
1773
|
+
error: {
|
|
1774
|
+
borderColor: "#dc2626"
|
|
1775
|
+
},
|
|
1776
|
+
disabled: {
|
|
1777
|
+
opacity: 0.5,
|
|
1778
|
+
backgroundColor: "#f3f4f6"
|
|
1779
|
+
},
|
|
1780
|
+
readOnlyValue: {
|
|
1781
|
+
fontSize: 16,
|
|
1782
|
+
color: "#374151",
|
|
1783
|
+
minHeight: 40,
|
|
1784
|
+
justifyContent: "center",
|
|
1785
|
+
paddingHorizontal: 12
|
|
1786
|
+
},
|
|
1787
|
+
helpText: {
|
|
1788
|
+
color: "#6b7280",
|
|
1789
|
+
fontSize: 13,
|
|
1790
|
+
marginTop: 4
|
|
1791
|
+
}
|
|
1792
|
+
}),
|
|
1793
|
+
// ── Select Field ──
|
|
1794
|
+
selectField: w.create({
|
|
1795
|
+
wrapper: {
|
|
1796
|
+
flexDirection: "column"
|
|
1797
|
+
},
|
|
1798
|
+
container: {
|
|
1799
|
+
borderWidth: 1,
|
|
1800
|
+
borderColor: "#d1d5db",
|
|
1801
|
+
borderRadius: 8,
|
|
1802
|
+
backgroundColor: "#ffffff"
|
|
1803
|
+
},
|
|
1804
|
+
error: {
|
|
1805
|
+
borderColor: "#dc2626"
|
|
1806
|
+
},
|
|
1807
|
+
disabled: {
|
|
1808
|
+
opacity: 0.5,
|
|
1809
|
+
backgroundColor: "#f3f4f6"
|
|
1810
|
+
},
|
|
1811
|
+
readOnlyValue: {
|
|
1812
|
+
fontSize: 16,
|
|
1813
|
+
color: "#374151",
|
|
1814
|
+
minHeight: 40,
|
|
1815
|
+
justifyContent: "center",
|
|
1816
|
+
paddingHorizontal: 12
|
|
1817
|
+
},
|
|
1818
|
+
helpText: {
|
|
1819
|
+
color: "#6b7280",
|
|
1820
|
+
fontSize: 13,
|
|
1821
|
+
marginTop: 4
|
|
1822
|
+
},
|
|
1823
|
+
placeholder: {
|
|
1824
|
+
fontSize: 16,
|
|
1825
|
+
color: "#9ca3af"
|
|
1826
|
+
},
|
|
1827
|
+
selectedText: {
|
|
1828
|
+
fontSize: 16,
|
|
1829
|
+
color: "#111827"
|
|
1830
|
+
},
|
|
1831
|
+
itemText: {
|
|
1832
|
+
fontSize: 16,
|
|
1833
|
+
color: "#111827"
|
|
1834
|
+
},
|
|
1835
|
+
selectedItem: {
|
|
1836
|
+
backgroundColor: "#eff6ff"
|
|
1837
|
+
}
|
|
1838
|
+
}),
|
|
1839
|
+
// ── Multi Select ──
|
|
1840
|
+
multiSelect: w.create({
|
|
1841
|
+
wrapper: {
|
|
1842
|
+
flexDirection: "column"
|
|
1843
|
+
},
|
|
1844
|
+
container: {
|
|
1845
|
+
borderWidth: 1,
|
|
1846
|
+
borderColor: "#d1d5db",
|
|
1847
|
+
borderRadius: 8,
|
|
1848
|
+
backgroundColor: "#ffffff"
|
|
1849
|
+
},
|
|
1850
|
+
error: {
|
|
1851
|
+
borderColor: "#dc2626"
|
|
1852
|
+
},
|
|
1853
|
+
disabled: {
|
|
1854
|
+
opacity: 0.5,
|
|
1855
|
+
backgroundColor: "#f3f4f6"
|
|
1856
|
+
},
|
|
1857
|
+
readOnlyValue: {
|
|
1858
|
+
fontSize: 16,
|
|
1859
|
+
color: "#374151",
|
|
1860
|
+
minHeight: 40,
|
|
1861
|
+
justifyContent: "center",
|
|
1862
|
+
paddingHorizontal: 12
|
|
1863
|
+
},
|
|
1864
|
+
helpText: {
|
|
1865
|
+
color: "#6b7280",
|
|
1866
|
+
fontSize: 13,
|
|
1867
|
+
marginTop: 4
|
|
1868
|
+
},
|
|
1869
|
+
selectedItem: {
|
|
1870
|
+
backgroundColor: "#eff6ff",
|
|
1871
|
+
borderRadius: 4,
|
|
1872
|
+
paddingHorizontal: 8,
|
|
1873
|
+
paddingVertical: 4,
|
|
1874
|
+
marginRight: 4,
|
|
1875
|
+
marginBottom: 4,
|
|
1876
|
+
flexDirection: "row",
|
|
1877
|
+
alignItems: "center"
|
|
1878
|
+
},
|
|
1879
|
+
selectedItemText: {
|
|
1880
|
+
fontSize: 14,
|
|
1881
|
+
color: "#1e40af"
|
|
1882
|
+
},
|
|
1883
|
+
removeButton: {
|
|
1884
|
+
marginLeft: 4,
|
|
1885
|
+
padding: 2
|
|
1886
|
+
},
|
|
1887
|
+
removeButtonText: {
|
|
1888
|
+
fontSize: 12,
|
|
1889
|
+
color: "#6b7280"
|
|
1890
|
+
},
|
|
1891
|
+
placeholder: {
|
|
1892
|
+
fontSize: 16,
|
|
1893
|
+
color: "#9ca3af"
|
|
1894
|
+
}
|
|
1895
|
+
}),
|
|
1896
|
+
// ── Radio Field ──
|
|
1897
|
+
radioField: w.create({
|
|
1898
|
+
wrapper: {
|
|
1899
|
+
flexDirection: "column"
|
|
1900
|
+
},
|
|
1901
|
+
containerColumn: {
|
|
1902
|
+
flexDirection: "column",
|
|
1903
|
+
gap: 8
|
|
1904
|
+
},
|
|
1905
|
+
containerRow: {
|
|
1906
|
+
flexDirection: "row",
|
|
1907
|
+
flexWrap: "wrap",
|
|
1908
|
+
gap: 16
|
|
1909
|
+
},
|
|
1910
|
+
optionContainer: {
|
|
1911
|
+
flexDirection: "row",
|
|
1912
|
+
alignItems: "center",
|
|
1913
|
+
gap: 8
|
|
1914
|
+
},
|
|
1915
|
+
radio: {
|
|
1916
|
+
width: 22,
|
|
1917
|
+
height: 22,
|
|
1918
|
+
borderRadius: 11,
|
|
1919
|
+
borderWidth: 2,
|
|
1920
|
+
borderColor: "#d1d5db",
|
|
1921
|
+
justifyContent: "center",
|
|
1922
|
+
alignItems: "center"
|
|
1923
|
+
},
|
|
1924
|
+
radioSelected: {
|
|
1925
|
+
borderColor: "#0284c7"
|
|
1926
|
+
},
|
|
1927
|
+
radioInner: {
|
|
1928
|
+
width: 12,
|
|
1929
|
+
height: 12,
|
|
1930
|
+
borderRadius: 6,
|
|
1931
|
+
backgroundColor: "#0284c7"
|
|
1932
|
+
},
|
|
1933
|
+
label: {
|
|
1934
|
+
fontSize: 16,
|
|
1935
|
+
color: "#374151"
|
|
1936
|
+
},
|
|
1937
|
+
disabled: {
|
|
1938
|
+
opacity: 0.5
|
|
1939
|
+
},
|
|
1940
|
+
readOnlySelected: {
|
|
1941
|
+
flexDirection: "row",
|
|
1942
|
+
alignItems: "center",
|
|
1943
|
+
gap: 4
|
|
1944
|
+
},
|
|
1945
|
+
readOnlyUnselected: {
|
|
1946
|
+
fontSize: 16,
|
|
1947
|
+
color: "#9ca3af"
|
|
1948
|
+
},
|
|
1949
|
+
subOptionInput: {
|
|
1950
|
+
borderWidth: 1,
|
|
1951
|
+
borderColor: "#d1d5db",
|
|
1952
|
+
borderRadius: 8,
|
|
1953
|
+
paddingHorizontal: 12,
|
|
1954
|
+
paddingVertical: 8,
|
|
1955
|
+
fontSize: 14,
|
|
1956
|
+
color: "#111827",
|
|
1957
|
+
backgroundColor: "#ffffff",
|
|
1958
|
+
marginTop: 4,
|
|
1959
|
+
marginLeft: 30
|
|
1960
|
+
},
|
|
1961
|
+
helpText: {
|
|
1962
|
+
color: "#6b7280",
|
|
1963
|
+
fontSize: 13,
|
|
1964
|
+
marginTop: 4
|
|
1965
|
+
}
|
|
1966
|
+
}),
|
|
1967
|
+
// ── Search Select ──
|
|
1968
|
+
searchSelect: w.create({
|
|
1969
|
+
wrapper: {
|
|
1970
|
+
flexDirection: "column"
|
|
1971
|
+
},
|
|
1972
|
+
container: {
|
|
1973
|
+
borderWidth: 1,
|
|
1974
|
+
borderColor: "#d1d5db",
|
|
1975
|
+
borderRadius: 8,
|
|
1976
|
+
backgroundColor: "#ffffff"
|
|
1977
|
+
},
|
|
1978
|
+
error: {
|
|
1979
|
+
borderColor: "#dc2626"
|
|
1980
|
+
},
|
|
1981
|
+
disabled: {
|
|
1982
|
+
opacity: 0.5,
|
|
1983
|
+
backgroundColor: "#f3f4f6"
|
|
1984
|
+
},
|
|
1985
|
+
readOnlyValue: {
|
|
1986
|
+
fontSize: 16,
|
|
1987
|
+
color: "#374151",
|
|
1988
|
+
minHeight: 40,
|
|
1989
|
+
justifyContent: "center",
|
|
1990
|
+
paddingHorizontal: 12
|
|
1991
|
+
},
|
|
1992
|
+
helpText: {
|
|
1993
|
+
color: "#6b7280",
|
|
1994
|
+
fontSize: 13,
|
|
1995
|
+
marginTop: 4
|
|
1996
|
+
},
|
|
1997
|
+
placeholder: {
|
|
1998
|
+
fontSize: 16,
|
|
1999
|
+
color: "#9ca3af"
|
|
2000
|
+
},
|
|
2001
|
+
inputSearch: {
|
|
2002
|
+
fontSize: 16,
|
|
2003
|
+
color: "#111827"
|
|
2004
|
+
}
|
|
2005
|
+
}),
|
|
2006
|
+
// ── Custom Field ──
|
|
2007
|
+
customField: w.create({
|
|
2008
|
+
wrapper: {
|
|
2009
|
+
flexDirection: "column"
|
|
2010
|
+
},
|
|
2011
|
+
readOnlyValue: {
|
|
2012
|
+
fontSize: 16,
|
|
2013
|
+
color: "#374151",
|
|
2014
|
+
minHeight: 40,
|
|
2015
|
+
justifyContent: "center",
|
|
2016
|
+
paddingHorizontal: 12
|
|
2017
|
+
},
|
|
2018
|
+
errorText: {
|
|
2019
|
+
color: "#dc2626",
|
|
2020
|
+
fontSize: 13,
|
|
2021
|
+
marginTop: 4
|
|
2022
|
+
}
|
|
2023
|
+
}),
|
|
2024
|
+
// ── Markdown Editor ──
|
|
2025
|
+
markdownEditor: w.create({
|
|
2026
|
+
wrapper: {
|
|
2027
|
+
flexDirection: "column"
|
|
2028
|
+
},
|
|
2029
|
+
editor: {
|
|
2030
|
+
borderWidth: 1,
|
|
2031
|
+
borderColor: "#d1d5db",
|
|
2032
|
+
borderRadius: 8,
|
|
2033
|
+
backgroundColor: "#ffffff",
|
|
2034
|
+
overflow: "hidden"
|
|
2035
|
+
},
|
|
2036
|
+
toolbar: {
|
|
2037
|
+
flexDirection: "row",
|
|
2038
|
+
borderBottomWidth: 1,
|
|
2039
|
+
borderBottomColor: "#e5e7eb",
|
|
2040
|
+
paddingHorizontal: 8,
|
|
2041
|
+
paddingVertical: 4,
|
|
2042
|
+
gap: 4
|
|
2043
|
+
},
|
|
2044
|
+
toolbarButton: {
|
|
2045
|
+
padding: 8,
|
|
2046
|
+
borderRadius: 4
|
|
2047
|
+
},
|
|
2048
|
+
toolbarButtonText: {
|
|
2049
|
+
fontSize: 14,
|
|
2050
|
+
fontWeight: "600",
|
|
2051
|
+
color: "#6b7280"
|
|
2052
|
+
},
|
|
2053
|
+
textInput: {
|
|
2054
|
+
padding: 12,
|
|
2055
|
+
fontSize: 16,
|
|
2056
|
+
color: "#111827",
|
|
2057
|
+
textAlignVertical: "top"
|
|
2058
|
+
},
|
|
2059
|
+
preview: {
|
|
2060
|
+
padding: 12
|
|
2061
|
+
},
|
|
2062
|
+
toggleContainer: {
|
|
2063
|
+
flexDirection: "row",
|
|
2064
|
+
borderBottomWidth: 1,
|
|
2065
|
+
borderBottomColor: "#e5e7eb"
|
|
2066
|
+
},
|
|
2067
|
+
toggleButton: {
|
|
2068
|
+
flex: 1,
|
|
2069
|
+
paddingVertical: 8,
|
|
2070
|
+
alignItems: "center"
|
|
2071
|
+
},
|
|
2072
|
+
toggleButtonActive: {
|
|
2073
|
+
borderBottomWidth: 2,
|
|
2074
|
+
borderBottomColor: "#0284c7"
|
|
2075
|
+
},
|
|
2076
|
+
toggleButtonText: {
|
|
2077
|
+
fontSize: 14,
|
|
2078
|
+
color: "#6b7280"
|
|
2079
|
+
},
|
|
2080
|
+
toggleButtonTextActive: {
|
|
2081
|
+
color: "#0284c7",
|
|
2082
|
+
fontWeight: "600"
|
|
2083
|
+
},
|
|
2084
|
+
error: {
|
|
2085
|
+
borderColor: "#dc2626"
|
|
2086
|
+
},
|
|
2087
|
+
disabled: {
|
|
2088
|
+
opacity: 0.5,
|
|
2089
|
+
backgroundColor: "#f3f4f6"
|
|
2090
|
+
},
|
|
2091
|
+
readOnlyValue: {
|
|
2092
|
+
padding: 12
|
|
2093
|
+
},
|
|
2094
|
+
helpText: {
|
|
2095
|
+
color: "#6b7280",
|
|
2096
|
+
fontSize: 13,
|
|
2097
|
+
marginTop: 4
|
|
2098
|
+
}
|
|
2099
|
+
}),
|
|
2100
|
+
// ── Content Field ──
|
|
2101
|
+
contentField: w.create({
|
|
2102
|
+
wrapper: {
|
|
2103
|
+
flexDirection: "column"
|
|
2104
|
+
}
|
|
2105
|
+
})
|
|
2106
|
+
}, me = Q($);
|
|
2107
|
+
function v() {
|
|
2108
|
+
return ee(me);
|
|
2109
|
+
}
|
|
2110
|
+
function Ee(t = {}) {
|
|
2111
|
+
if (!t || Object.keys(t).length === 0)
|
|
2112
|
+
return $;
|
|
2113
|
+
const e = {};
|
|
2114
|
+
for (const o of Object.keys($)) {
|
|
2115
|
+
const i = $[o], s = t[o];
|
|
2116
|
+
if (!s) {
|
|
2117
|
+
e[o] = i;
|
|
2118
|
+
continue;
|
|
2119
|
+
}
|
|
2120
|
+
const l = {};
|
|
2121
|
+
for (const a of Object.keys(i)) {
|
|
2122
|
+
const p = i[a], h = s[a];
|
|
2123
|
+
h ? l[a] = { ...p, ...h } : l[a] = p;
|
|
2124
|
+
}
|
|
2125
|
+
for (const a of Object.keys(s))
|
|
2126
|
+
a in l || (l[a] = s[a]);
|
|
2127
|
+
e[o] = l;
|
|
2128
|
+
}
|
|
2129
|
+
return e;
|
|
2130
|
+
}
|
|
2131
|
+
function Ne({
|
|
2132
|
+
form: t,
|
|
2133
|
+
field: e,
|
|
2134
|
+
hasError: o,
|
|
2135
|
+
formReadOnly: i = !1,
|
|
2136
|
+
formReadOnlyStyle: s = "value"
|
|
2137
|
+
}) {
|
|
2138
|
+
const l = v(), a = e.options.readOnly ?? i, p = e.options.readOnlyStyle ?? s, h = t.getValues(e.key) ?? "", c = ae(e);
|
|
2139
|
+
if (a)
|
|
2140
|
+
return p === "disabled" ? /* @__PURE__ */ x(F, { children: [
|
|
2141
|
+
/* @__PURE__ */ n(
|
|
2142
|
+
D,
|
|
2143
|
+
{
|
|
2144
|
+
nativeID: e.key,
|
|
2145
|
+
editable: !1,
|
|
2146
|
+
value: h,
|
|
2147
|
+
style: [l.textField.input, o && l.textField.error, l.textField.disabled],
|
|
2148
|
+
accessibilityLabel: e.options.label
|
|
2149
|
+
}
|
|
2150
|
+
),
|
|
2151
|
+
e.options.helpText && /* @__PURE__ */ n(u, { style: l.textField.helpText, children: e.options.helpText })
|
|
2152
|
+
] }) : /* @__PURE__ */ x(F, { children: [
|
|
2153
|
+
/* @__PURE__ */ n(f, { style: l.textField.readOnly, children: /* @__PURE__ */ n(u, { style: l.textField.readOnlyText, children: h || "—" }) }),
|
|
2154
|
+
e.options.helpText && /* @__PURE__ */ n(u, { style: l.textField.helpText, children: e.options.helpText })
|
|
2155
|
+
] });
|
|
2156
|
+
const { onChange: b, onBlur: d, name: y, ref: S } = t.register(e.key, c);
|
|
2157
|
+
return /* @__PURE__ */ x(F, { children: [
|
|
2158
|
+
/* @__PURE__ */ n(
|
|
2159
|
+
D,
|
|
2160
|
+
{
|
|
2161
|
+
nativeID: e.key,
|
|
2162
|
+
editable: !e.options.disabled,
|
|
2163
|
+
placeholder: e.options.placeholder,
|
|
2164
|
+
placeholderTextColor: "#9ca3af",
|
|
2165
|
+
defaultValue: e.options.defaultValue,
|
|
2166
|
+
onChangeText: (m) => t.setValue(e.key, m, { shouldValidate: !0 }),
|
|
2167
|
+
onBlur: () => t.trigger(e.key),
|
|
2168
|
+
style: [
|
|
2169
|
+
l.textField.input,
|
|
2170
|
+
e.options.disabled && l.textField.disabled,
|
|
2171
|
+
o && l.textField.error
|
|
2172
|
+
],
|
|
2173
|
+
accessibilityLabel: e.options.label,
|
|
2174
|
+
keyboardType: "default"
|
|
2175
|
+
}
|
|
2176
|
+
),
|
|
2177
|
+
e.options.helpText && /* @__PURE__ */ n(u, { style: l.textField.helpText, children: e.options.helpText })
|
|
2178
|
+
] });
|
|
2179
|
+
}
|
|
2180
|
+
function $e({
|
|
2181
|
+
form: t,
|
|
2182
|
+
field: e,
|
|
2183
|
+
hasError: o,
|
|
2184
|
+
formReadOnly: i = !1,
|
|
2185
|
+
formReadOnlyStyle: s = "value"
|
|
2186
|
+
}) {
|
|
2187
|
+
const l = v(), a = e.options.readOnly ?? i, p = e.options.readOnlyStyle ?? s, h = t.getValues(e.key) ?? "", c = e.options.rows ?? 4, [b, d] = B(c * 20);
|
|
2188
|
+
return a ? p === "disabled" ? /* @__PURE__ */ x(F, { children: [
|
|
2189
|
+
/* @__PURE__ */ n(
|
|
2190
|
+
D,
|
|
2191
|
+
{
|
|
2192
|
+
nativeID: e.key,
|
|
2193
|
+
multiline: !0,
|
|
2194
|
+
numberOfLines: c,
|
|
2195
|
+
editable: !1,
|
|
2196
|
+
value: h,
|
|
2197
|
+
style: [l.textAreaField.textarea, l.textAreaField.disabled, o && l.textAreaField.error, { minHeight: c * 20 }],
|
|
2198
|
+
accessibilityLabel: e.options.label
|
|
2199
|
+
}
|
|
2200
|
+
),
|
|
2201
|
+
e.options.helpText && /* @__PURE__ */ n(u, { style: l.textAreaField.helpText, children: e.options.helpText })
|
|
2202
|
+
] }) : /* @__PURE__ */ x(F, { children: [
|
|
2203
|
+
/* @__PURE__ */ n(u, { style: l.textAreaField.readOnlyValue, children: h || "—" }),
|
|
2204
|
+
e.options.helpText && /* @__PURE__ */ n(u, { style: l.textAreaField.helpText, children: e.options.helpText })
|
|
2205
|
+
] }) : /* @__PURE__ */ x(F, { children: [
|
|
2206
|
+
/* @__PURE__ */ n(
|
|
2207
|
+
D,
|
|
2208
|
+
{
|
|
2209
|
+
nativeID: e.key,
|
|
2210
|
+
multiline: !0,
|
|
2211
|
+
numberOfLines: c,
|
|
2212
|
+
editable: !e.options.disabled,
|
|
2213
|
+
placeholder: e.options.placeholder,
|
|
2214
|
+
placeholderTextColor: "#9ca3af",
|
|
2215
|
+
defaultValue: e.options.defaultValue,
|
|
2216
|
+
onChangeText: (y) => t.setValue(e.key, y, { shouldValidate: !0 }),
|
|
2217
|
+
onBlur: () => t.trigger(e.key),
|
|
2218
|
+
onContentSizeChange: (y) => {
|
|
2219
|
+
d(Math.max(c * 20, y.nativeEvent.contentSize.height));
|
|
2220
|
+
},
|
|
2221
|
+
style: [
|
|
2222
|
+
l.textAreaField.textarea,
|
|
2223
|
+
{ minHeight: b },
|
|
2224
|
+
e.options.disabled && l.textAreaField.disabled,
|
|
2225
|
+
o && l.textAreaField.error
|
|
2226
|
+
],
|
|
2227
|
+
accessibilityLabel: e.options.label
|
|
2228
|
+
}
|
|
2229
|
+
),
|
|
2230
|
+
e.options.helpText && /* @__PURE__ */ n(u, { style: l.textAreaField.helpText, children: e.options.helpText })
|
|
2231
|
+
] });
|
|
2232
|
+
}
|
|
2233
|
+
function Ue({
|
|
2234
|
+
form: t,
|
|
2235
|
+
field: e,
|
|
2236
|
+
hasError: o,
|
|
2237
|
+
formReadOnly: i = !1,
|
|
2238
|
+
formReadOnlyStyle: s = "value"
|
|
2239
|
+
}) {
|
|
2240
|
+
const l = v(), a = e.options.readOnly ?? i, p = e.options.readOnlyStyle ?? s, h = t.getValues(e.key) ?? "";
|
|
2241
|
+
return ae(e), a ? p === "disabled" ? /* @__PURE__ */ n(
|
|
2242
|
+
D,
|
|
2243
|
+
{
|
|
2244
|
+
nativeID: e.key,
|
|
2245
|
+
editable: !1,
|
|
2246
|
+
value: h,
|
|
2247
|
+
style: [l.emailField.input, l.emailField.disabled, o && l.emailField.error],
|
|
2248
|
+
accessibilityLabel: e.options.label
|
|
2249
|
+
}
|
|
2250
|
+
) : /* @__PURE__ */ n(f, { style: l.emailField.readOnlyValue, children: /* @__PURE__ */ n(u, { style: { fontSize: 16, color: "#374151" }, children: h || "—" }) }) : /* @__PURE__ */ n(
|
|
2251
|
+
D,
|
|
2252
|
+
{
|
|
2253
|
+
nativeID: e.key,
|
|
2254
|
+
editable: !e.options.disabled,
|
|
2255
|
+
placeholder: e.options.placeholder,
|
|
2256
|
+
placeholderTextColor: "#9ca3af",
|
|
2257
|
+
defaultValue: e.options.defaultValue,
|
|
2258
|
+
keyboardType: "email-address",
|
|
2259
|
+
autoCapitalize: "none",
|
|
2260
|
+
autoComplete: "email",
|
|
2261
|
+
onChangeText: (c) => t.setValue(e.key, c, { shouldValidate: !0 }),
|
|
2262
|
+
onBlur: () => t.trigger(e.key),
|
|
2263
|
+
style: [
|
|
2264
|
+
l.emailField.input,
|
|
2265
|
+
e.options.disabled && l.emailField.disabled,
|
|
2266
|
+
o && l.emailField.error
|
|
2267
|
+
],
|
|
2268
|
+
accessibilityLabel: e.options.label
|
|
2269
|
+
}
|
|
2270
|
+
);
|
|
2271
|
+
}
|
|
2272
|
+
function Ke({
|
|
2273
|
+
form: t,
|
|
2274
|
+
field: e,
|
|
2275
|
+
hasError: o,
|
|
2276
|
+
formReadOnly: i = !1,
|
|
2277
|
+
formReadOnlyStyle: s = "value"
|
|
2278
|
+
}) {
|
|
2279
|
+
const l = v(), [a, p] = B(!1), h = e.options.readOnly ?? i, c = e.options.readOnlyStyle ?? s, b = t.getValues(e.key) ?? "";
|
|
2280
|
+
return ae(e), h ? c === "disabled" ? /* @__PURE__ */ n(
|
|
2281
|
+
D,
|
|
2282
|
+
{
|
|
2283
|
+
nativeID: e.key,
|
|
2284
|
+
editable: !1,
|
|
2285
|
+
secureTextEntry: !0,
|
|
2286
|
+
value: b,
|
|
2287
|
+
style: [l.passwordField.input, l.passwordField.disabled, o && l.passwordField.error],
|
|
2288
|
+
accessibilityLabel: e.options.label
|
|
2289
|
+
}
|
|
2290
|
+
) : /* @__PURE__ */ n(f, { style: l.passwordField.readOnlyValue, children: /* @__PURE__ */ n(u, { style: { fontSize: 16, color: "#374151" }, children: "*".repeat(b.length) || "—" }) }) : /* @__PURE__ */ x(f, { style: l.passwordField.container, children: [
|
|
2291
|
+
/* @__PURE__ */ n(
|
|
2292
|
+
D,
|
|
2293
|
+
{
|
|
2294
|
+
nativeID: e.key,
|
|
2295
|
+
editable: !e.options.disabled,
|
|
2296
|
+
placeholder: e.options.placeholder,
|
|
2297
|
+
placeholderTextColor: "#9ca3af",
|
|
2298
|
+
defaultValue: e.options.defaultValue,
|
|
2299
|
+
secureTextEntry: !a,
|
|
2300
|
+
autoCapitalize: "none",
|
|
2301
|
+
autoComplete: "password",
|
|
2302
|
+
onChangeText: (d) => t.setValue(e.key, d, { shouldValidate: !0 }),
|
|
2303
|
+
onBlur: () => t.trigger(e.key),
|
|
2304
|
+
style: [
|
|
2305
|
+
l.passwordField.input,
|
|
2306
|
+
e.options.disabled && l.passwordField.disabled,
|
|
2307
|
+
o && l.passwordField.error
|
|
2308
|
+
],
|
|
2309
|
+
accessibilityLabel: e.options.label
|
|
2310
|
+
}
|
|
2311
|
+
),
|
|
2312
|
+
/* @__PURE__ */ n(
|
|
2313
|
+
H,
|
|
2314
|
+
{
|
|
2315
|
+
onPress: () => p(!a),
|
|
2316
|
+
style: l.passwordField.toggleButton,
|
|
2317
|
+
accessibilityLabel: a ? "Hide password" : "Show password",
|
|
2318
|
+
accessibilityRole: "button",
|
|
2319
|
+
children: /* @__PURE__ */ n(u, { style: l.passwordField.toggleText, children: a ? "Hide" : "Show" })
|
|
2320
|
+
}
|
|
2321
|
+
),
|
|
2322
|
+
e.options.helpText && /* @__PURE__ */ n(u, { style: l.passwordField.helpText, children: e.options.helpText })
|
|
2323
|
+
] });
|
|
2324
|
+
}
|
|
2325
|
+
function Ge({
|
|
2326
|
+
form: t,
|
|
2327
|
+
field: e,
|
|
2328
|
+
hasError: o,
|
|
2329
|
+
formReadOnly: i = !1,
|
|
2330
|
+
formReadOnlyStyle: s = "value"
|
|
2331
|
+
}) {
|
|
2332
|
+
const l = v(), a = e.options.readOnly ?? i, p = e.options.readOnlyStyle ?? s, h = t.getValues(e.key) ?? "";
|
|
2333
|
+
return a ? p === "disabled" ? /* @__PURE__ */ x(F, { children: [
|
|
2334
|
+
/* @__PURE__ */ n(
|
|
2335
|
+
D,
|
|
2336
|
+
{
|
|
2337
|
+
nativeID: e.key,
|
|
2338
|
+
editable: !1,
|
|
2339
|
+
value: h,
|
|
2340
|
+
style: [l.urlField.input, l.urlField.disabled, o && l.urlField.error],
|
|
2341
|
+
accessibilityLabel: e.options.label
|
|
2342
|
+
}
|
|
2343
|
+
),
|
|
2344
|
+
e.options.helpText && /* @__PURE__ */ n(u, { style: l.urlField.helpText, children: e.options.helpText })
|
|
2345
|
+
] }) : /* @__PURE__ */ x(F, { children: [
|
|
2346
|
+
/* @__PURE__ */ n(f, { style: l.urlField.readOnlyValue, children: /* @__PURE__ */ n(u, { style: { fontSize: 16, color: "#374151" }, children: h || "—" }) }),
|
|
2347
|
+
e.options.helpText && /* @__PURE__ */ n(u, { style: l.urlField.helpText, children: e.options.helpText })
|
|
2348
|
+
] }) : /* @__PURE__ */ x(F, { children: [
|
|
2349
|
+
/* @__PURE__ */ n(
|
|
2350
|
+
D,
|
|
2351
|
+
{
|
|
2352
|
+
nativeID: e.key,
|
|
2353
|
+
editable: !e.options.disabled,
|
|
2354
|
+
placeholder: e.options.placeholder,
|
|
2355
|
+
placeholderTextColor: "#9ca3af",
|
|
2356
|
+
defaultValue: e.options.defaultValue,
|
|
2357
|
+
keyboardType: "url",
|
|
2358
|
+
autoCapitalize: "none",
|
|
2359
|
+
onChangeText: (c) => t.setValue(e.key, c, { shouldValidate: !0 }),
|
|
2360
|
+
onBlur: () => t.trigger(e.key),
|
|
2361
|
+
style: [
|
|
2362
|
+
l.urlField.input,
|
|
2363
|
+
e.options.disabled && l.urlField.disabled,
|
|
2364
|
+
o && l.urlField.error
|
|
2365
|
+
],
|
|
2366
|
+
accessibilityLabel: e.options.label
|
|
2367
|
+
}
|
|
2368
|
+
),
|
|
2369
|
+
e.options.helpText && /* @__PURE__ */ n(u, { style: l.urlField.helpText, children: e.options.helpText })
|
|
2370
|
+
] });
|
|
2371
|
+
}
|
|
2372
|
+
function Ye({
|
|
2373
|
+
form: t,
|
|
2374
|
+
field: e,
|
|
2375
|
+
hasError: o,
|
|
2376
|
+
formReadOnly: i = !1,
|
|
2377
|
+
formReadOnlyStyle: s = "value"
|
|
2378
|
+
}) {
|
|
2379
|
+
const l = v(), a = e.options.readOnly ?? i, p = e.options.readOnlyStyle ?? s, h = t.getValues(e.key) ?? "";
|
|
2380
|
+
return a ? p === "disabled" ? /* @__PURE__ */ n(
|
|
2381
|
+
D,
|
|
2382
|
+
{
|
|
2383
|
+
nativeID: e.key,
|
|
2384
|
+
editable: !1,
|
|
2385
|
+
value: h,
|
|
2386
|
+
style: [l.phoneField.input, l.phoneField.disabled, o && l.phoneField.error],
|
|
2387
|
+
accessibilityLabel: e.options.label
|
|
2388
|
+
}
|
|
2389
|
+
) : /* @__PURE__ */ n(f, { style: l.phoneField.readOnlyValue, children: /* @__PURE__ */ n(u, { style: { fontSize: 16, color: "#374151" }, children: h == null || h === "" ? "—" : h }) }) : /* @__PURE__ */ x(F, { children: [
|
|
2390
|
+
/* @__PURE__ */ n(
|
|
2391
|
+
D,
|
|
2392
|
+
{
|
|
2393
|
+
nativeID: e.key,
|
|
2394
|
+
editable: !e.options.disabled,
|
|
2395
|
+
placeholder: e.options.placeholder,
|
|
2396
|
+
placeholderTextColor: "#9ca3af",
|
|
2397
|
+
defaultValue: e.options.defaultValue,
|
|
2398
|
+
keyboardType: "phone-pad",
|
|
2399
|
+
autoComplete: "tel",
|
|
2400
|
+
onChangeText: (c) => t.setValue(e.key, c, { shouldValidate: !0 }),
|
|
2401
|
+
onBlur: () => t.trigger(e.key),
|
|
2402
|
+
style: [
|
|
2403
|
+
l.phoneField.input,
|
|
2404
|
+
e.options.disabled && l.phoneField.disabled,
|
|
2405
|
+
o && l.phoneField.error
|
|
2406
|
+
],
|
|
2407
|
+
accessibilityLabel: e.options.label
|
|
2408
|
+
}
|
|
2409
|
+
),
|
|
2410
|
+
e.options.helpText && /* @__PURE__ */ n(u, { style: l.phoneField.helpText, children: e.options.helpText })
|
|
2411
|
+
] });
|
|
2412
|
+
}
|
|
2413
|
+
function Ze({
|
|
2414
|
+
form: t,
|
|
2415
|
+
field: e,
|
|
2416
|
+
hasError: o,
|
|
2417
|
+
formReadOnly: i = !1,
|
|
2418
|
+
formReadOnlyStyle: s = "value"
|
|
2419
|
+
}) {
|
|
2420
|
+
const l = v(), a = e.options.readOnly ?? i, p = e.options.readOnlyStyle ?? s, h = t.getValues(e.key) ?? "";
|
|
2421
|
+
if (a)
|
|
2422
|
+
return p === "disabled" ? /* @__PURE__ */ n(
|
|
2423
|
+
D,
|
|
2424
|
+
{
|
|
2425
|
+
nativeID: e.key,
|
|
2426
|
+
editable: !1,
|
|
2427
|
+
value: String(h),
|
|
2428
|
+
keyboardType: "decimal-pad",
|
|
2429
|
+
style: [l.numberField.input, l.numberField.disabled, o && l.numberField.error],
|
|
2430
|
+
accessibilityLabel: e.options.label
|
|
2431
|
+
}
|
|
2432
|
+
) : /* @__PURE__ */ n(f, { style: l.numberField.readOnlyValue, children: /* @__PURE__ */ n(u, { style: { fontSize: 16, color: "#374151" }, children: h == null || h === "" ? "—" : String(h) }) });
|
|
2433
|
+
const c = (d) => {
|
|
2434
|
+
const y = d.replace(/[^0-9.-]/g, ""), S = y === "" || y === "-" ? y : parseFloat(y);
|
|
2435
|
+
t.setValue(e.key, S === "" || isNaN(S) ? "" : S, { shouldValidate: !0 });
|
|
2436
|
+
}, b = () => {
|
|
2437
|
+
const d = t.getValues(e.key);
|
|
2438
|
+
if (d !== "" && d !== void 0) {
|
|
2439
|
+
let y = typeof d == "string" ? parseFloat(d) : d;
|
|
2440
|
+
isNaN(y) || (e.options.min !== void 0 && y < e.options.min && (y = e.options.min), e.options.max !== void 0 && y > e.options.max && (y = e.options.max), t.setValue(e.key, y));
|
|
2441
|
+
}
|
|
2442
|
+
t.trigger(e.key);
|
|
2443
|
+
};
|
|
2444
|
+
return /* @__PURE__ */ x(F, { children: [
|
|
2445
|
+
/* @__PURE__ */ n(
|
|
2446
|
+
D,
|
|
2447
|
+
{
|
|
2448
|
+
nativeID: e.key,
|
|
2449
|
+
editable: !e.options.disabled,
|
|
2450
|
+
placeholder: e.options.placeholder,
|
|
2451
|
+
placeholderTextColor: "#9ca3af",
|
|
2452
|
+
defaultValue: e.options.defaultValue !== void 0 ? String(e.options.defaultValue) : void 0,
|
|
2453
|
+
keyboardType: "decimal-pad",
|
|
2454
|
+
onChangeText: c,
|
|
2455
|
+
onBlur: b,
|
|
2456
|
+
style: [
|
|
2457
|
+
l.numberField.input,
|
|
2458
|
+
e.options.disabled && l.numberField.disabled,
|
|
2459
|
+
o && l.numberField.error
|
|
2460
|
+
],
|
|
2461
|
+
accessibilityLabel: e.options.label
|
|
2462
|
+
}
|
|
2463
|
+
),
|
|
2464
|
+
e.options.helpText && /* @__PURE__ */ n(u, { style: l.numberField.helpText, children: e.options.helpText })
|
|
2465
|
+
] });
|
|
2466
|
+
}
|
|
2467
|
+
function _e({
|
|
2468
|
+
form: t,
|
|
2469
|
+
field: e,
|
|
2470
|
+
hasError: o,
|
|
2471
|
+
formReadOnly: i = !1,
|
|
2472
|
+
formReadOnlyStyle: s = "value"
|
|
2473
|
+
}) {
|
|
2474
|
+
const l = v(), a = qe(e.options.currency, e.options.customCurrency), p = e.options.readOnly ?? i, h = e.options.readOnlyStyle ?? s, c = t.getValues(e.key) ?? "", b = e.options.hideSymbolWhenEmpty ?? !0, [d, y] = B(!!c);
|
|
2475
|
+
E(() => {
|
|
2476
|
+
const g = t.getValues(e.key);
|
|
2477
|
+
y(!!g);
|
|
2478
|
+
}, [t, e.key]);
|
|
2479
|
+
const m = !b || d ? /* @__PURE__ */ x(u, { style: l.moneyField.currencySymbol, children: [
|
|
2480
|
+
a.symbol,
|
|
2481
|
+
e.options.showCurrencyCode && /* @__PURE__ */ x(u, { style: { fontSize: 12, opacity: 0.75 }, children: [
|
|
2482
|
+
" ",
|
|
2483
|
+
a.code
|
|
2484
|
+
] })
|
|
2485
|
+
] }) : null;
|
|
2486
|
+
if (p) {
|
|
2487
|
+
if (h === "disabled")
|
|
2488
|
+
return /* @__PURE__ */ x(f, { style: l.moneyField.container, children: [
|
|
2489
|
+
a.symbolPosition === "before" && m,
|
|
2490
|
+
/* @__PURE__ */ n(
|
|
2491
|
+
D,
|
|
2492
|
+
{
|
|
2493
|
+
nativeID: e.key,
|
|
2494
|
+
editable: !1,
|
|
2495
|
+
value: String(c),
|
|
2496
|
+
keyboardType: "decimal-pad",
|
|
2497
|
+
style: [l.moneyField.input, l.moneyField.disabled, o && l.moneyField.error],
|
|
2498
|
+
accessibilityLabel: e.options.label
|
|
2499
|
+
}
|
|
2500
|
+
),
|
|
2501
|
+
a.symbolPosition === "after" && m
|
|
2502
|
+
] });
|
|
2503
|
+
const g = q(c, a, {
|
|
2504
|
+
showSymbol: !0,
|
|
2505
|
+
showCode: e.options.showCurrencyCode
|
|
2506
|
+
});
|
|
2507
|
+
return /* @__PURE__ */ n(f, { style: l.moneyField.readOnlyValue, children: /* @__PURE__ */ n(u, { style: { fontSize: 16, color: "#374151" }, children: g || "—" }) });
|
|
2508
|
+
}
|
|
2509
|
+
return /* @__PURE__ */ x(f, { style: l.moneyField.container, children: [
|
|
2510
|
+
a.symbolPosition === "before" && m,
|
|
2511
|
+
/* @__PURE__ */ n(
|
|
2512
|
+
D,
|
|
2513
|
+
{
|
|
2514
|
+
nativeID: e.key,
|
|
2515
|
+
editable: !e.options.disabled,
|
|
2516
|
+
placeholder: e.options.placeholder,
|
|
2517
|
+
placeholderTextColor: "#9ca3af",
|
|
2518
|
+
defaultValue: e.options.defaultValue !== void 0 ? String(e.options.defaultValue) : void 0,
|
|
2519
|
+
keyboardType: "decimal-pad",
|
|
2520
|
+
onChangeText: (g) => {
|
|
2521
|
+
const k = g.replace(/[^0-9.-]/g, ""), T = k === "" ? "" : parseFloat(k);
|
|
2522
|
+
y(!!k), t.setValue(e.key, T === "" || isNaN(T) ? "" : T, { shouldValidate: !0 });
|
|
2523
|
+
},
|
|
2524
|
+
onBlur: () => t.trigger(e.key),
|
|
2525
|
+
style: [
|
|
2526
|
+
l.moneyField.input,
|
|
2527
|
+
e.options.disabled && l.moneyField.disabled,
|
|
2528
|
+
o && l.moneyField.error
|
|
2529
|
+
],
|
|
2530
|
+
accessibilityLabel: e.options.label
|
|
2531
|
+
}
|
|
2532
|
+
),
|
|
2533
|
+
a.symbolPosition === "after" && m
|
|
2534
|
+
] });
|
|
2535
|
+
}
|
|
2536
|
+
let Se = null;
|
|
2537
|
+
try {
|
|
2538
|
+
Se = require("expo-checkbox").default;
|
|
2539
|
+
} catch {
|
|
2540
|
+
}
|
|
2541
|
+
function Je({ value: t, onValueChange: e, disabled: o, color: i }) {
|
|
2542
|
+
return /* @__PURE__ */ n(
|
|
2543
|
+
H,
|
|
2544
|
+
{
|
|
2545
|
+
onPress: () => !o && e(!t),
|
|
2546
|
+
style: {
|
|
2547
|
+
width: 22,
|
|
2548
|
+
height: 22,
|
|
2549
|
+
borderWidth: 2,
|
|
2550
|
+
borderColor: t ? i || "#0284c7" : "#d1d5db",
|
|
2551
|
+
borderRadius: 4,
|
|
2552
|
+
backgroundColor: t ? i || "#0284c7" : "transparent",
|
|
2553
|
+
justifyContent: "center",
|
|
2554
|
+
alignItems: "center",
|
|
2555
|
+
opacity: o ? 0.5 : 1
|
|
2556
|
+
},
|
|
2557
|
+
accessibilityRole: "checkbox",
|
|
2558
|
+
accessibilityState: { checked: t, disabled: o },
|
|
2559
|
+
children: t && /* @__PURE__ */ n(u, { style: { color: "#ffffff", fontSize: 14, fontWeight: "700" }, children: "✓" })
|
|
2560
|
+
}
|
|
2561
|
+
);
|
|
2562
|
+
}
|
|
2563
|
+
function Xe(t) {
|
|
2564
|
+
const { field: e, form: o, hasError: i, errorMessage: s, formReadOnly: l = !1, formReadOnlyStyle: a = "value" } = t, p = e.options, c = v().checkbox, b = p.readOnly ?? l, d = p.readOnlyStyle ?? a, y = o.getValues(e.key), S = Se || Je;
|
|
2565
|
+
return b ? d === "disabled" ? /* @__PURE__ */ x(f, { style: c.wrapper, children: [
|
|
2566
|
+
/* @__PURE__ */ x(f, { style: c.row, children: [
|
|
2567
|
+
/* @__PURE__ */ n(
|
|
2568
|
+
S,
|
|
2569
|
+
{
|
|
2570
|
+
value: !!y,
|
|
2571
|
+
onValueChange: () => {
|
|
2572
|
+
},
|
|
2573
|
+
disabled: !0
|
|
2574
|
+
}
|
|
2575
|
+
),
|
|
2576
|
+
p.label && /* @__PURE__ */ n(u, { style: [c.label, c.disabled], children: p.label })
|
|
2577
|
+
] }),
|
|
2578
|
+
p.helpText && /* @__PURE__ */ n(u, { style: c.helpText, children: p.helpText })
|
|
2579
|
+
] }) : /* @__PURE__ */ n(f, { style: c.wrapper, children: /* @__PURE__ */ n(u, { style: c.readOnly, children: y ? "Yes" : "No" }) }) : /* @__PURE__ */ n(
|
|
2580
|
+
z,
|
|
2581
|
+
{
|
|
2582
|
+
name: e.key,
|
|
2583
|
+
control: o.control,
|
|
2584
|
+
defaultValue: p.defaultValue,
|
|
2585
|
+
rules: { required: p.required ? X : !1 },
|
|
2586
|
+
render: ({ field: m }) => /* @__PURE__ */ x(f, { style: c.wrapper, children: [
|
|
2587
|
+
/* @__PURE__ */ x(f, { style: c.row, children: [
|
|
2588
|
+
/* @__PURE__ */ n(
|
|
2589
|
+
S,
|
|
2590
|
+
{
|
|
2591
|
+
value: !!m.value,
|
|
2592
|
+
onValueChange: (g) => m.onChange(g),
|
|
2593
|
+
disabled: p.disabled,
|
|
2594
|
+
color: m.value ? "#0284c7" : void 0
|
|
2595
|
+
}
|
|
2596
|
+
),
|
|
2597
|
+
p.label && /* @__PURE__ */ x(u, { style: [c.label, p.disabled && c.disabled], children: [
|
|
2598
|
+
p.label,
|
|
2599
|
+
p.required && /* @__PURE__ */ n(u, { style: { color: "#dc2626" }, children: " *" })
|
|
2600
|
+
] })
|
|
2601
|
+
] }),
|
|
2602
|
+
p.helpText && /* @__PURE__ */ n(u, { style: c.helpText, children: p.helpText }),
|
|
2603
|
+
i && s && /* @__PURE__ */ n(u, { style: c.errorMessage, children: s })
|
|
2604
|
+
] })
|
|
2605
|
+
}
|
|
2606
|
+
);
|
|
2607
|
+
}
|
|
2608
|
+
function Qe({
|
|
2609
|
+
form: t,
|
|
2610
|
+
field: e,
|
|
2611
|
+
hasError: o,
|
|
2612
|
+
formReadOnly: i = !1,
|
|
2613
|
+
formReadOnlyStyle: s = "value"
|
|
2614
|
+
}) {
|
|
2615
|
+
const l = v(), a = e.options.readOnly ?? i, p = e.options.readOnlyStyle ?? s, h = t.getValues(e.key);
|
|
2616
|
+
return a ? p === "disabled" ? /* @__PURE__ */ x(f, { style: l.switchField.container, children: [
|
|
2617
|
+
/* @__PURE__ */ x(u, { style: l.switchField.label, children: [
|
|
2618
|
+
e.options.label,
|
|
2619
|
+
e.options.required && /* @__PURE__ */ n(u, { style: { color: "#dc2626" }, children: " *" })
|
|
2620
|
+
] }),
|
|
2621
|
+
/* @__PURE__ */ n(
|
|
2622
|
+
ie,
|
|
2623
|
+
{
|
|
2624
|
+
value: !!h,
|
|
2625
|
+
disabled: !0,
|
|
2626
|
+
trackColor: { false: "#d1d5db", true: "#7dd3fc" },
|
|
2627
|
+
thumbColor: h ? "#0284c7" : "#f3f4f6"
|
|
2628
|
+
}
|
|
2629
|
+
)
|
|
2630
|
+
] }) : /* @__PURE__ */ n(u, { style: l.switchField.readOnlyValue, children: h ? "On" : "Off" }) : /* @__PURE__ */ n(
|
|
2631
|
+
z,
|
|
2632
|
+
{
|
|
2633
|
+
name: e.key,
|
|
2634
|
+
control: t.control,
|
|
2635
|
+
defaultValue: e.options.defaultValue,
|
|
2636
|
+
render: ({ field: { onChange: c, value: b } }) => /* @__PURE__ */ x(f, { children: [
|
|
2637
|
+
/* @__PURE__ */ x(f, { style: l.switchField.container, children: [
|
|
2638
|
+
/* @__PURE__ */ x(u, { style: [l.switchField.label, e.options.disabled && l.switchField.disabled], children: [
|
|
2639
|
+
e.options.label,
|
|
2640
|
+
e.options.required && /* @__PURE__ */ n(u, { style: { color: "#dc2626" }, children: " *" })
|
|
2641
|
+
] }),
|
|
2642
|
+
/* @__PURE__ */ n(
|
|
2643
|
+
ie,
|
|
2644
|
+
{
|
|
2645
|
+
value: !!b,
|
|
2646
|
+
onValueChange: (d) => {
|
|
2647
|
+
e.options.disabled || c(d);
|
|
2648
|
+
},
|
|
2649
|
+
disabled: e.options.disabled,
|
|
2650
|
+
trackColor: { false: "#d1d5db", true: "#7dd3fc" },
|
|
2651
|
+
thumbColor: b ? "#0284c7" : "#f3f4f6",
|
|
2652
|
+
accessibilityLabel: e.options.label,
|
|
2653
|
+
accessibilityRole: "switch"
|
|
2654
|
+
}
|
|
2655
|
+
)
|
|
2656
|
+
] }),
|
|
2657
|
+
e.options.helpText && /* @__PURE__ */ n(u, { style: l.switchField.helpText, children: e.options.helpText })
|
|
2658
|
+
] })
|
|
2659
|
+
}
|
|
2660
|
+
);
|
|
2661
|
+
}
|
|
2662
|
+
function et({
|
|
2663
|
+
children: t,
|
|
2664
|
+
variant: e = "primary",
|
|
2665
|
+
disabled: o,
|
|
2666
|
+
loading: i = !1,
|
|
2667
|
+
fullWidth: s = !1,
|
|
2668
|
+
onPress: l,
|
|
2669
|
+
style: a,
|
|
2670
|
+
textStyle: p,
|
|
2671
|
+
className: h,
|
|
2672
|
+
accessibilityLabel: c
|
|
2673
|
+
}) {
|
|
2674
|
+
const d = v().button, y = o || i, S = () => {
|
|
2675
|
+
switch (e) {
|
|
2676
|
+
case "danger":
|
|
2677
|
+
return d.dangerText;
|
|
2678
|
+
case "secondary":
|
|
2679
|
+
return d.secondaryText;
|
|
2680
|
+
default:
|
|
2681
|
+
return d.primaryText;
|
|
2682
|
+
}
|
|
2683
|
+
};
|
|
2684
|
+
return /* @__PURE__ */ n(
|
|
2685
|
+
H,
|
|
2686
|
+
{
|
|
2687
|
+
onPress: y ? void 0 : l,
|
|
2688
|
+
disabled: y,
|
|
2689
|
+
style: [
|
|
2690
|
+
d.base,
|
|
2691
|
+
d[e],
|
|
2692
|
+
y && d.disabled,
|
|
2693
|
+
i && d.loading,
|
|
2694
|
+
s && d.fullWidth,
|
|
2695
|
+
a
|
|
2696
|
+
],
|
|
2697
|
+
accessibilityRole: "button",
|
|
2698
|
+
accessibilityState: { disabled: y },
|
|
2699
|
+
accessibilityLabel: c,
|
|
2700
|
+
...h ? { className: h } : {},
|
|
2701
|
+
children: i ? /* @__PURE__ */ n(Fe, { size: "small", color: e === "secondary" ? "#374151" : "#ffffff" }) : typeof t == "string" ? /* @__PURE__ */ n(u, { style: [d.text, S(), y && d.disabledText, p], children: t }) : t
|
|
2702
|
+
}
|
|
2703
|
+
);
|
|
2704
|
+
}
|
|
2705
|
+
function tt({
|
|
2706
|
+
field: t,
|
|
2707
|
+
form: e,
|
|
2708
|
+
hasError: o
|
|
2709
|
+
}) {
|
|
2710
|
+
const i = async () => {
|
|
2711
|
+
t.options.disabled || (t.options.type === "submit" && e.handleSubmit((s) => {
|
|
2712
|
+
})(), t.options.onClick && await t.options.onClick());
|
|
2713
|
+
};
|
|
2714
|
+
return /* @__PURE__ */ n(
|
|
2715
|
+
et,
|
|
2716
|
+
{
|
|
2717
|
+
variant: t.options.variant,
|
|
2718
|
+
loading: t.options.loading,
|
|
2719
|
+
disabled: t.options.disabled,
|
|
2720
|
+
fullWidth: t.options.fullWidth,
|
|
2721
|
+
onPress: i,
|
|
2722
|
+
accessibilityLabel: t.options.text ?? t.options.label ?? "Button",
|
|
2723
|
+
children: t.options.text ?? t.options.label ?? "Button"
|
|
2724
|
+
}
|
|
2725
|
+
);
|
|
2726
|
+
}
|
|
2727
|
+
let ne = null;
|
|
2728
|
+
try {
|
|
2729
|
+
ne = require("@react-native-community/datetimepicker").default;
|
|
2730
|
+
} catch {
|
|
2731
|
+
}
|
|
2732
|
+
function rt({
|
|
2733
|
+
form: t,
|
|
2734
|
+
field: e,
|
|
2735
|
+
hasError: o,
|
|
2736
|
+
formReadOnly: i = !1,
|
|
2737
|
+
formReadOnlyStyle: s = "value"
|
|
2738
|
+
}) {
|
|
2739
|
+
const l = v().datePicker, a = e.options, p = a.readOnly ?? i, h = a.readOnlyStyle ?? s, c = t.getValues(e.key) ?? "", [b, d] = B(!1);
|
|
2740
|
+
return ne ? p ? h === "disabled" ? /* @__PURE__ */ x(F, { children: [
|
|
2741
|
+
/* @__PURE__ */ n(f, { style: [l.trigger, l.disabled], children: /* @__PURE__ */ n(u, { style: l.triggerText, children: c ? re(c) ?? c : "—" }) }),
|
|
2742
|
+
a.helpText && /* @__PURE__ */ n(u, { style: l.helpText, children: a.helpText })
|
|
2743
|
+
] }) : /* @__PURE__ */ x(F, { children: [
|
|
2744
|
+
/* @__PURE__ */ n(f, { style: l.readOnlyValue, children: /* @__PURE__ */ n(u, { style: { fontSize: 16, color: "#374151" }, children: re(c) || "—" }) }),
|
|
2745
|
+
a.helpText && /* @__PURE__ */ n(u, { style: l.helpText, children: a.helpText })
|
|
2746
|
+
] }) : /* @__PURE__ */ n(
|
|
2747
|
+
z,
|
|
2748
|
+
{
|
|
2749
|
+
name: e.key,
|
|
2750
|
+
control: t.control,
|
|
2751
|
+
defaultValue: ge(a.defaultValue ?? ""),
|
|
2752
|
+
rules: { required: a.required },
|
|
2753
|
+
render: ({ field: y }) => {
|
|
2754
|
+
const S = y.value ? new Date(y.value) : /* @__PURE__ */ new Date();
|
|
2755
|
+
return /* @__PURE__ */ x(f, { children: [
|
|
2756
|
+
/* @__PURE__ */ n(
|
|
2757
|
+
H,
|
|
2758
|
+
{
|
|
2759
|
+
onPress: () => !a.disabled && d(!0),
|
|
2760
|
+
style: [
|
|
2761
|
+
l.trigger,
|
|
2762
|
+
a.disabled && l.disabled,
|
|
2763
|
+
o && l.error
|
|
2764
|
+
],
|
|
2765
|
+
accessibilityLabel: a.label ?? "Select date",
|
|
2766
|
+
accessibilityRole: "button",
|
|
2767
|
+
children: /* @__PURE__ */ n(u, { style: y.value ? l.triggerText : l.placeholderText, children: y.value ? re(y.value) ?? y.value : a.placeholder || "Select date..." })
|
|
2768
|
+
}
|
|
2769
|
+
),
|
|
2770
|
+
b && /* @__PURE__ */ n(
|
|
2771
|
+
ne,
|
|
2772
|
+
{
|
|
2773
|
+
value: S,
|
|
2774
|
+
mode: "date",
|
|
2775
|
+
display: L.OS === "ios" ? "spinner" : "default",
|
|
2776
|
+
minimumDate: a.min ? new Date(a.min) : void 0,
|
|
2777
|
+
maximumDate: a.max ? new Date(a.max) : void 0,
|
|
2778
|
+
onChange: (m, g) => {
|
|
2779
|
+
if (d(L.OS === "ios"), g) {
|
|
2780
|
+
const k = g.toISOString().split("T")[0];
|
|
2781
|
+
y.onChange(k);
|
|
2782
|
+
}
|
|
2783
|
+
}
|
|
2784
|
+
}
|
|
2785
|
+
),
|
|
2786
|
+
a.helpText && /* @__PURE__ */ n(u, { style: l.helpText, children: a.helpText })
|
|
2787
|
+
] });
|
|
2788
|
+
}
|
|
2789
|
+
}
|
|
2790
|
+
) : /* @__PURE__ */ n(f, { style: l.trigger, children: /* @__PURE__ */ n(u, { style: l.placeholderText, children: "Install @react-native-community/datetimepicker to use DatePickerField" }) });
|
|
2791
|
+
}
|
|
2792
|
+
let U = null;
|
|
2793
|
+
try {
|
|
2794
|
+
U = require("@react-native-community/datetimepicker").default;
|
|
2795
|
+
} catch {
|
|
2796
|
+
}
|
|
2797
|
+
function lt({
|
|
2798
|
+
form: t,
|
|
2799
|
+
field: e,
|
|
2800
|
+
hasError: o,
|
|
2801
|
+
formReadOnly: i = !1,
|
|
2802
|
+
formReadOnlyStyle: s = "value"
|
|
2803
|
+
}) {
|
|
2804
|
+
const l = v().dateTimePicker, a = e.options, p = a.readOnly ?? i, h = a.readOnlyStyle ?? s, c = t.getValues(e.key) ?? "", [b, d] = B(!1), [y, S] = B(!1), [m, g] = B(null);
|
|
2805
|
+
return U ? p ? h === "disabled" ? /* @__PURE__ */ n(f, { style: [l.trigger, l.disabled], children: /* @__PURE__ */ n(u, { style: l.triggerText, children: c ? le(c) ?? c : "—" }) }) : /* @__PURE__ */ n(f, { style: l.readOnlyValue, children: /* @__PURE__ */ n(u, { style: { fontSize: 16, color: "#374151" }, children: le(c) ?? "—" }) }) : /* @__PURE__ */ n(
|
|
2806
|
+
z,
|
|
2807
|
+
{
|
|
2808
|
+
name: e.key,
|
|
2809
|
+
control: t.control,
|
|
2810
|
+
defaultValue: Le(a.defaultValue ?? ""),
|
|
2811
|
+
rules: { required: a.required },
|
|
2812
|
+
render: ({ field: k }) => {
|
|
2813
|
+
const T = k.value ? new Date(k.value) : /* @__PURE__ */ new Date();
|
|
2814
|
+
return /* @__PURE__ */ x(f, { children: [
|
|
2815
|
+
/* @__PURE__ */ n(
|
|
2816
|
+
H,
|
|
2817
|
+
{
|
|
2818
|
+
onPress: () => !a.disabled && d(!0),
|
|
2819
|
+
style: [
|
|
2820
|
+
l.trigger,
|
|
2821
|
+
a.disabled && l.disabled,
|
|
2822
|
+
o && l.error
|
|
2823
|
+
],
|
|
2824
|
+
accessibilityLabel: a.label ?? "Select date and time",
|
|
2825
|
+
accessibilityRole: "button",
|
|
2826
|
+
children: /* @__PURE__ */ n(u, { style: k.value ? l.triggerText : l.placeholderText, children: k.value ? le(k.value) ?? k.value : a.placeholder || "Select date and time..." })
|
|
2827
|
+
}
|
|
2828
|
+
),
|
|
2829
|
+
b && /* @__PURE__ */ n(
|
|
2830
|
+
U,
|
|
2831
|
+
{
|
|
2832
|
+
value: T,
|
|
2833
|
+
mode: "date",
|
|
2834
|
+
display: L.OS === "ios" ? "spinner" : "default",
|
|
2835
|
+
minimumDate: a.min ? new Date(a.min) : void 0,
|
|
2836
|
+
maximumDate: a.max ? new Date(a.max) : void 0,
|
|
2837
|
+
onChange: (I, O) => {
|
|
2838
|
+
d(!1), O && (g(O), S(!0));
|
|
2839
|
+
}
|
|
2840
|
+
}
|
|
2841
|
+
),
|
|
2842
|
+
y && /* @__PURE__ */ n(
|
|
2843
|
+
U,
|
|
2844
|
+
{
|
|
2845
|
+
value: m || T,
|
|
2846
|
+
mode: "time",
|
|
2847
|
+
display: L.OS === "ios" ? "spinner" : "default",
|
|
2848
|
+
onChange: (I, O) => {
|
|
2849
|
+
if (S(!1), O && m) {
|
|
2850
|
+
const V = new Date(m);
|
|
2851
|
+
V.setHours(O.getHours()), V.setMinutes(O.getMinutes());
|
|
2852
|
+
const R = V.toISOString().slice(0, 16);
|
|
2853
|
+
k.onChange(R);
|
|
2854
|
+
}
|
|
2855
|
+
g(null);
|
|
2856
|
+
}
|
|
2857
|
+
}
|
|
2858
|
+
),
|
|
2859
|
+
a.helpText && /* @__PURE__ */ n(u, { style: l.helpText, children: a.helpText })
|
|
2860
|
+
] });
|
|
2861
|
+
}
|
|
2862
|
+
}
|
|
2863
|
+
) : /* @__PURE__ */ n(f, { style: l.trigger, children: /* @__PURE__ */ n(u, { style: l.placeholderText, children: "Install @react-native-community/datetimepicker to use DateTimePickerField" }) });
|
|
2864
|
+
}
|
|
2865
|
+
let oe = null;
|
|
2866
|
+
try {
|
|
2867
|
+
oe = require("@react-native-community/datetimepicker").default;
|
|
2868
|
+
} catch {
|
|
2869
|
+
}
|
|
2870
|
+
function nt({
|
|
2871
|
+
form: t,
|
|
2872
|
+
field: e,
|
|
2873
|
+
hasError: o,
|
|
2874
|
+
formReadOnly: i = !1,
|
|
2875
|
+
formReadOnlyStyle: s = "value"
|
|
2876
|
+
}) {
|
|
2877
|
+
const l = v().timePicker, a = e.options.readOnly ?? i, p = e.options.readOnlyStyle ?? s, h = t.getValues(e.key) ?? "", [c, b] = B(!1);
|
|
2878
|
+
if (!oe)
|
|
2879
|
+
return /* @__PURE__ */ n(f, { style: l.trigger, children: /* @__PURE__ */ n(u, { style: l.placeholderText, children: "Install @react-native-community/datetimepicker to use TimePickerField" }) });
|
|
2880
|
+
if (a)
|
|
2881
|
+
return p === "disabled" ? /* @__PURE__ */ x(F, { children: [
|
|
2882
|
+
/* @__PURE__ */ n(f, { style: [l.trigger, l.disabled], children: /* @__PURE__ */ n(u, { style: l.triggerText, children: h || "—" }) }),
|
|
2883
|
+
e.options.helpText && /* @__PURE__ */ n(u, { style: l.helpText, children: e.options.helpText })
|
|
2884
|
+
] }) : /* @__PURE__ */ x(F, { children: [
|
|
2885
|
+
/* @__PURE__ */ n(u, { style: { fontSize: 16, color: "#374151" }, children: h || "—" }),
|
|
2886
|
+
e.options.helpText && /* @__PURE__ */ n(u, { style: l.helpText, children: e.options.helpText })
|
|
2887
|
+
] });
|
|
2888
|
+
const d = (y) => {
|
|
2889
|
+
const S = /* @__PURE__ */ new Date();
|
|
2890
|
+
if (y) {
|
|
2891
|
+
const [m, g] = y.split(":").map(Number);
|
|
2892
|
+
S.setHours(m || 0), S.setMinutes(g || 0);
|
|
2893
|
+
}
|
|
2894
|
+
return S;
|
|
2895
|
+
};
|
|
2896
|
+
return /* @__PURE__ */ n(
|
|
2897
|
+
z,
|
|
2898
|
+
{
|
|
2899
|
+
name: e.key,
|
|
2900
|
+
control: t.control,
|
|
2901
|
+
defaultValue: e.options.defaultValue,
|
|
2902
|
+
rules: { required: e.options.required },
|
|
2903
|
+
render: ({ field: y }) => /* @__PURE__ */ x(f, { children: [
|
|
2904
|
+
/* @__PURE__ */ n(
|
|
2905
|
+
H,
|
|
2906
|
+
{
|
|
2907
|
+
onPress: () => !e.options.disabled && b(!0),
|
|
2908
|
+
style: [
|
|
2909
|
+
l.trigger,
|
|
2910
|
+
e.options.disabled && l.disabled,
|
|
2911
|
+
o && l.error
|
|
2912
|
+
],
|
|
2913
|
+
accessibilityLabel: e.options.label ?? "Select time",
|
|
2914
|
+
accessibilityRole: "button",
|
|
2915
|
+
children: /* @__PURE__ */ n(u, { style: y.value ? l.triggerText : l.placeholderText, children: y.value || "Select time..." })
|
|
2916
|
+
}
|
|
2917
|
+
),
|
|
2918
|
+
c && /* @__PURE__ */ n(
|
|
2919
|
+
oe,
|
|
2920
|
+
{
|
|
2921
|
+
value: d(y.value || ""),
|
|
2922
|
+
mode: "time",
|
|
2923
|
+
display: L.OS === "ios" ? "spinner" : "default",
|
|
2924
|
+
onChange: (S, m) => {
|
|
2925
|
+
if (b(L.OS === "ios"), m) {
|
|
2926
|
+
const g = m.getHours().toString().padStart(2, "0"), k = m.getMinutes().toString().padStart(2, "0");
|
|
2927
|
+
y.onChange(`${g}:${k}`);
|
|
2928
|
+
}
|
|
2929
|
+
}
|
|
2930
|
+
}
|
|
2931
|
+
),
|
|
2932
|
+
e.options.helpText && /* @__PURE__ */ n(u, { style: l.helpText, children: e.options.helpText })
|
|
2933
|
+
] })
|
|
2934
|
+
}
|
|
2935
|
+
);
|
|
2936
|
+
}
|
|
2937
|
+
let K = null;
|
|
2938
|
+
try {
|
|
2939
|
+
K = require("react-native-element-dropdown").Dropdown;
|
|
2940
|
+
} catch {
|
|
2941
|
+
}
|
|
2942
|
+
function xe({
|
|
2943
|
+
form: t,
|
|
2944
|
+
field: e,
|
|
2945
|
+
hasError: o,
|
|
2946
|
+
formReadOnly: i = !1,
|
|
2947
|
+
formReadOnlyStyle: s = "value"
|
|
2948
|
+
}) {
|
|
2949
|
+
const l = v().selectField, a = e.options.options || [], p = e.options.readOnly ?? i, h = e.options.readOnlyStyle ?? s, c = t.getValues(e.key);
|
|
2950
|
+
if (!K)
|
|
2951
|
+
return /* @__PURE__ */ n(f, { style: l.container, children: /* @__PURE__ */ n(u, { style: l.placeholder, children: "Install react-native-element-dropdown to use SelectField" }) });
|
|
2952
|
+
if (p) {
|
|
2953
|
+
const b = a.find((d) => d.value === c);
|
|
2954
|
+
return h === "disabled" ? /* @__PURE__ */ x(F, { children: [
|
|
2955
|
+
/* @__PURE__ */ n(
|
|
2956
|
+
K,
|
|
2957
|
+
{
|
|
2958
|
+
data: a.map((d) => ({ label: d.label, value: String(d.value) })),
|
|
2959
|
+
labelField: "label",
|
|
2960
|
+
valueField: "value",
|
|
2961
|
+
value: c ? String(c) : null,
|
|
2962
|
+
disable: !0,
|
|
2963
|
+
placeholder: e.options.placeholder || "Select...",
|
|
2964
|
+
style: [l.container, l.disabled, o && l.error],
|
|
2965
|
+
placeholderStyle: l.placeholder,
|
|
2966
|
+
selectedTextStyle: l.selectedText,
|
|
2967
|
+
onChange: () => {
|
|
2968
|
+
}
|
|
2969
|
+
}
|
|
2970
|
+
),
|
|
2971
|
+
e.options.helpText && /* @__PURE__ */ n(u, { style: l.helpText, children: e.options.helpText })
|
|
2972
|
+
] }) : /* @__PURE__ */ x(F, { children: [
|
|
2973
|
+
/* @__PURE__ */ n(f, { style: l.readOnlyValue, children: /* @__PURE__ */ n(u, { style: { fontSize: 16, color: "#374151" }, children: b?.label || "—" }) }),
|
|
2974
|
+
e.options.helpText && /* @__PURE__ */ n(u, { style: l.helpText, children: e.options.helpText })
|
|
2975
|
+
] });
|
|
2976
|
+
}
|
|
2977
|
+
return /* @__PURE__ */ n(
|
|
2978
|
+
z,
|
|
2979
|
+
{
|
|
2980
|
+
name: e.key,
|
|
2981
|
+
control: t.control,
|
|
2982
|
+
defaultValue: e.options.defaultValue,
|
|
2983
|
+
rules: { required: e.options.required },
|
|
2984
|
+
render: ({ field: b }) => /* @__PURE__ */ x(f, { style: l.wrapper, children: [
|
|
2985
|
+
/* @__PURE__ */ n(
|
|
2986
|
+
K,
|
|
2987
|
+
{
|
|
2988
|
+
data: a.map((d) => ({ label: d.label, value: String(d.value) })),
|
|
2989
|
+
labelField: "label",
|
|
2990
|
+
valueField: "value",
|
|
2991
|
+
value: b.value ? String(b.value) : null,
|
|
2992
|
+
onChange: (d) => {
|
|
2993
|
+
b.onChange(d.value);
|
|
2994
|
+
},
|
|
2995
|
+
onBlur: b.onBlur,
|
|
2996
|
+
disable: e.options.disabled,
|
|
2997
|
+
placeholder: e.options.placeholder || "Select...",
|
|
2998
|
+
style: [l.container, e.options.disabled && l.disabled, o && l.error],
|
|
2999
|
+
placeholderStyle: l.placeholder,
|
|
3000
|
+
selectedTextStyle: l.selectedText,
|
|
3001
|
+
itemTextStyle: l.itemText,
|
|
3002
|
+
activeColor: l.selectedItem?.backgroundColor,
|
|
3003
|
+
accessibilityLabel: e.options.label
|
|
3004
|
+
}
|
|
3005
|
+
),
|
|
3006
|
+
e.options.helpText && /* @__PURE__ */ n(u, { style: l.helpText, children: e.options.helpText })
|
|
3007
|
+
] })
|
|
3008
|
+
}
|
|
3009
|
+
);
|
|
3010
|
+
}
|
|
3011
|
+
function ot({
|
|
3012
|
+
form: t,
|
|
3013
|
+
field: e,
|
|
3014
|
+
hasError: o,
|
|
3015
|
+
formReadOnly: i = !1,
|
|
3016
|
+
formReadOnlyStyle: s = "value"
|
|
3017
|
+
}) {
|
|
3018
|
+
const l = Object.entries(e.options.enum || {}).map(([p, h]) => ({
|
|
3019
|
+
label: p,
|
|
3020
|
+
value: String(h)
|
|
3021
|
+
})), a = {
|
|
3022
|
+
...e,
|
|
3023
|
+
type: C.Select,
|
|
3024
|
+
options: {
|
|
3025
|
+
...e.options,
|
|
3026
|
+
options: l
|
|
3027
|
+
}
|
|
3028
|
+
};
|
|
3029
|
+
return /* @__PURE__ */ n(
|
|
3030
|
+
xe,
|
|
3031
|
+
{
|
|
3032
|
+
form: t,
|
|
3033
|
+
field: a,
|
|
3034
|
+
hasError: o,
|
|
3035
|
+
formReadOnly: i,
|
|
3036
|
+
formReadOnlyStyle: s
|
|
3037
|
+
}
|
|
3038
|
+
);
|
|
3039
|
+
}
|
|
3040
|
+
let G = null;
|
|
3041
|
+
try {
|
|
3042
|
+
G = require("react-native-element-dropdown").MultiSelect;
|
|
3043
|
+
} catch {
|
|
3044
|
+
}
|
|
3045
|
+
function at(t) {
|
|
3046
|
+
return Array.isArray(t) ? t.map((e) => typeof e == "string" ? e : e && typeof e == "object" && "value" in e ? e.value : String(e)) : [];
|
|
3047
|
+
}
|
|
3048
|
+
function it({
|
|
3049
|
+
form: t,
|
|
3050
|
+
field: e,
|
|
3051
|
+
hasError: o,
|
|
3052
|
+
formReadOnly: i = !1,
|
|
3053
|
+
formReadOnlyStyle: s = "value"
|
|
3054
|
+
}) {
|
|
3055
|
+
const l = v().multiSelect, a = (e.options.options || []).map((c) => ({ label: c.label, value: String(c.value) })), p = e.options.readOnly ?? i, h = e.options.readOnlyStyle ?? s;
|
|
3056
|
+
if (e.options.submitTransform ??= at, !G)
|
|
3057
|
+
return /* @__PURE__ */ n(f, { style: l.container, children: /* @__PURE__ */ n(u, { style: l.placeholder, children: "Install react-native-element-dropdown to use SelectFieldMulti" }) });
|
|
3058
|
+
if (p) {
|
|
3059
|
+
const c = t.getValues(e.key) ?? [], b = Array.isArray(c) ? c.map(String) : [], d = a.filter((y) => b.includes(y.value)).map((y) => y.label);
|
|
3060
|
+
return h === "disabled" ? /* @__PURE__ */ n(
|
|
3061
|
+
G,
|
|
3062
|
+
{
|
|
3063
|
+
data: a,
|
|
3064
|
+
labelField: "label",
|
|
3065
|
+
valueField: "value",
|
|
3066
|
+
value: b,
|
|
3067
|
+
disable: !0,
|
|
3068
|
+
placeholder: e.options.placeholder || "Select...",
|
|
3069
|
+
style: [l.container, l.disabled],
|
|
3070
|
+
onChange: () => {
|
|
3071
|
+
}
|
|
3072
|
+
}
|
|
3073
|
+
) : /* @__PURE__ */ n(f, { style: l.readOnlyValue, children: /* @__PURE__ */ n(u, { style: { fontSize: 16, color: "#374151" }, children: d.join(", ") || "—" }) });
|
|
3074
|
+
}
|
|
3075
|
+
return /* @__PURE__ */ n(
|
|
3076
|
+
z,
|
|
3077
|
+
{
|
|
3078
|
+
name: e.key,
|
|
3079
|
+
control: t.control,
|
|
3080
|
+
defaultValue: e.options.defaultValue ?? [],
|
|
3081
|
+
rules: { required: e.options.required },
|
|
3082
|
+
render: ({ field: c }) => {
|
|
3083
|
+
const b = Array.isArray(c.value) ? c.value.map((d) => typeof d == "string" ? d : d?.value ? String(d.value) : String(d)) : [];
|
|
3084
|
+
return /* @__PURE__ */ x(f, { style: l.wrapper, children: [
|
|
3085
|
+
/* @__PURE__ */ n(
|
|
3086
|
+
G,
|
|
3087
|
+
{
|
|
3088
|
+
data: a,
|
|
3089
|
+
labelField: "label",
|
|
3090
|
+
valueField: "value",
|
|
3091
|
+
value: b,
|
|
3092
|
+
onChange: (d) => {
|
|
3093
|
+
c.onChange(d);
|
|
3094
|
+
},
|
|
3095
|
+
disable: e.options.disabled,
|
|
3096
|
+
placeholder: e.options.placeholder || "Select...",
|
|
3097
|
+
style: [l.container, e.options.disabled && l.disabled, o && l.error],
|
|
3098
|
+
placeholderStyle: l.placeholder,
|
|
3099
|
+
selectedTextStyle: l.selectedItemText,
|
|
3100
|
+
accessibilityLabel: e.options.label
|
|
3101
|
+
}
|
|
3102
|
+
),
|
|
3103
|
+
e.options.helpText && /* @__PURE__ */ n(u, { style: l.helpText, children: e.options.helpText })
|
|
3104
|
+
] });
|
|
3105
|
+
}
|
|
3106
|
+
}
|
|
3107
|
+
);
|
|
3108
|
+
}
|
|
3109
|
+
function st(t) {
|
|
3110
|
+
const e = v(), [o, i] = B(), [s, l] = B(""), a = t.field?.options;
|
|
3111
|
+
E(() => {
|
|
3112
|
+
const S = t.form.getValues(t.field.key);
|
|
3113
|
+
if (a?.defaultValue !== void 0 && (S === void 0 || S === "")) {
|
|
3114
|
+
const m = a?.radioOptions?.find((g) => g.value === a?.defaultValue);
|
|
3115
|
+
m?.value && t.form.setValue(t.field.key, m.value), a?.defaultSubValue !== void 0 && m?.checkedSubOption && (i(m.checkedSubOption.key), l(a.defaultSubValue), t.form.setValue(m.checkedSubOption.key, a.defaultSubValue));
|
|
3116
|
+
}
|
|
3117
|
+
}, [a?.defaultValue, a?.defaultSubValue, t.field.key]);
|
|
3118
|
+
const p = a.readOnly ?? t.formReadOnly, h = a.readOnlyStyle ?? t.formReadOnlyStyle, c = t.form.getValues(t.field.key), b = a.radioOptions?.find((S) => S.value === c), d = e.radioField;
|
|
3119
|
+
function y(S, m) {
|
|
3120
|
+
m(S.value), S?.checkedSubOption?.key ? (i(S.checkedSubOption.key), l(""), t.form.setValue(S.checkedSubOption.key, "")) : o && (t.form.setValue(o, ""), i(void 0), l(""));
|
|
3121
|
+
}
|
|
3122
|
+
return p ? h === "disabled" ? /* @__PURE__ */ n(f, { style: a.radioDirection === "row" ? d.containerRow : d.containerColumn, children: a?.radioOptions?.map((S) => /* @__PURE__ */ x(f, { style: d.optionContainer, children: [
|
|
3123
|
+
/* @__PURE__ */ n(f, { style: [d.radio, S.value === c && d.radioSelected, d.disabled], children: S.value === c && /* @__PURE__ */ n(f, { style: d.radioInner }) }),
|
|
3124
|
+
/* @__PURE__ */ n(u, { style: [d.label, d.disabled], children: S.label })
|
|
3125
|
+
] }, S.key)) }) : b ? /* @__PURE__ */ n(f, { style: d.readOnlySelected, children: /* @__PURE__ */ n(u, { style: d.label, children: b.label }) }) : /* @__PURE__ */ n(u, { style: d.readOnlyUnselected, children: "—" }) : /* @__PURE__ */ n(
|
|
3126
|
+
z,
|
|
3127
|
+
{
|
|
3128
|
+
name: t.field.key,
|
|
3129
|
+
control: t.form.control,
|
|
3130
|
+
defaultValue: a?.defaultValue,
|
|
3131
|
+
render: ({ field: { value: S, onChange: m } }) => /* @__PURE__ */ x(f, { children: [
|
|
3132
|
+
a.helpText && /* @__PURE__ */ n(u, { style: d.helpText, children: a.helpText }),
|
|
3133
|
+
/* @__PURE__ */ n(f, { style: a.radioDirection === "row" ? d.containerRow : d.containerColumn, children: a?.radioOptions?.map((g) => {
|
|
3134
|
+
if (g.hidden) return null;
|
|
3135
|
+
const k = g.value === S;
|
|
3136
|
+
return /* @__PURE__ */ x(f, { children: [
|
|
3137
|
+
/* @__PURE__ */ x(
|
|
3138
|
+
H,
|
|
3139
|
+
{
|
|
3140
|
+
onPress: () => !a.disabled && y(g, m),
|
|
3141
|
+
style: d.optionContainer,
|
|
3142
|
+
accessibilityRole: "radio",
|
|
3143
|
+
accessibilityState: { selected: k, disabled: a.disabled },
|
|
3144
|
+
children: [
|
|
3145
|
+
/* @__PURE__ */ n(f, { style: [d.radio, k && d.radioSelected, a.disabled && d.disabled], children: k && /* @__PURE__ */ n(f, { style: d.radioInner }) }),
|
|
3146
|
+
/* @__PURE__ */ n(u, { style: [d.label, a.disabled && d.disabled], children: g.label })
|
|
3147
|
+
]
|
|
3148
|
+
}
|
|
3149
|
+
),
|
|
3150
|
+
k && g.checkedSubOption && /* @__PURE__ */ n(
|
|
3151
|
+
D,
|
|
3152
|
+
{
|
|
3153
|
+
placeholder: g.checkedSubOption.label,
|
|
3154
|
+
placeholderTextColor: "#9ca3af",
|
|
3155
|
+
value: s,
|
|
3156
|
+
onChangeText: (T) => {
|
|
3157
|
+
l(T), g.checkedSubOption?.key && t.form.setValue(g.checkedSubOption.key, T);
|
|
3158
|
+
},
|
|
3159
|
+
editable: !a.disabled,
|
|
3160
|
+
style: d.subOptionInput
|
|
3161
|
+
}
|
|
3162
|
+
)
|
|
3163
|
+
] }, g.key);
|
|
3164
|
+
}) })
|
|
3165
|
+
] })
|
|
3166
|
+
}
|
|
3167
|
+
);
|
|
3168
|
+
}
|
|
3169
|
+
let Ce = null;
|
|
3170
|
+
try {
|
|
3171
|
+
Ce = require("expo-checkbox").default;
|
|
3172
|
+
} catch {
|
|
3173
|
+
}
|
|
3174
|
+
function dt({ value: t, onValueChange: e, disabled: o, color: i }) {
|
|
3175
|
+
return /* @__PURE__ */ n(
|
|
3176
|
+
H,
|
|
3177
|
+
{
|
|
3178
|
+
onPress: () => !o && e(!t),
|
|
3179
|
+
style: {
|
|
3180
|
+
width: 22,
|
|
3181
|
+
height: 22,
|
|
3182
|
+
borderWidth: 2,
|
|
3183
|
+
borderColor: t ? i || "#0284c7" : "#d1d5db",
|
|
3184
|
+
borderRadius: 4,
|
|
3185
|
+
backgroundColor: t ? i || "#0284c7" : "transparent",
|
|
3186
|
+
justifyContent: "center",
|
|
3187
|
+
alignItems: "center",
|
|
3188
|
+
opacity: o ? 0.5 : 1
|
|
3189
|
+
},
|
|
3190
|
+
accessibilityRole: "checkbox",
|
|
3191
|
+
accessibilityState: { checked: t, disabled: o },
|
|
3192
|
+
children: t && /* @__PURE__ */ n(u, { style: { color: "#ffffff", fontSize: 14, fontWeight: "700" }, children: "✓" })
|
|
3193
|
+
}
|
|
3194
|
+
);
|
|
3195
|
+
}
|
|
3196
|
+
const de = (t, e) => !t || t.trim() === "" ? [] : t.split(e).map((o) => o.trim()).filter((o) => o !== ""), ct = (t, e) => t.join(e);
|
|
3197
|
+
function ut({
|
|
3198
|
+
form: t,
|
|
3199
|
+
field: e,
|
|
3200
|
+
hasError: o,
|
|
3201
|
+
formReadOnly: i = !1,
|
|
3202
|
+
formReadOnlyStyle: s = "value"
|
|
3203
|
+
}) {
|
|
3204
|
+
const a = v().checkboxGroup, p = e.options, h = p.readOnly ?? i, c = p.readOnlyStyle ?? s, b = p.valueSeparator ?? ",", d = Ce || dt;
|
|
3205
|
+
if (h) {
|
|
3206
|
+
const y = t.getValues(e.key), S = de(y, b), m = p.checkboxOptions.filter(
|
|
3207
|
+
(g) => S.includes(String(g.value))
|
|
3208
|
+
);
|
|
3209
|
+
return c === "disabled" ? /* @__PURE__ */ n(f, { style: a.wrapper, children: /* @__PURE__ */ n(f, { style: p.checkboxDirection === "row" ? a.containerRow : a.containerColumn, children: p.checkboxOptions.map((g) => {
|
|
3210
|
+
const k = S.includes(String(g.value));
|
|
3211
|
+
return /* @__PURE__ */ x(f, { style: a.optionContainer, children: [
|
|
3212
|
+
/* @__PURE__ */ n(
|
|
3213
|
+
d,
|
|
3214
|
+
{
|
|
3215
|
+
value: k,
|
|
3216
|
+
onValueChange: () => {
|
|
3217
|
+
},
|
|
3218
|
+
disabled: !0,
|
|
3219
|
+
color: k ? "#0284c7" : void 0
|
|
3220
|
+
}
|
|
3221
|
+
),
|
|
3222
|
+
/* @__PURE__ */ n(u, { style: [a.label, a.disabled], children: g.label })
|
|
3223
|
+
] }, g.key);
|
|
3224
|
+
}) }) }) : /* @__PURE__ */ n(f, { children: m.length > 0 ? m.map((g) => /* @__PURE__ */ x(u, { style: a.readOnlySelected, children: [
|
|
3225
|
+
"✓ ",
|
|
3226
|
+
g.label
|
|
3227
|
+
] }, g.key)) : /* @__PURE__ */ n(u, { style: a.readOnlyUnselected, children: "No options selected" }) });
|
|
3228
|
+
}
|
|
3229
|
+
return /* @__PURE__ */ n(
|
|
3230
|
+
z,
|
|
3231
|
+
{
|
|
3232
|
+
control: t.control,
|
|
3233
|
+
name: e.key,
|
|
3234
|
+
defaultValue: p.defaultValue || "",
|
|
3235
|
+
rules: { required: p.required },
|
|
3236
|
+
render: ({ field: { onChange: y, value: S } }) => {
|
|
3237
|
+
const m = de(S, b), g = (k, T) => {
|
|
3238
|
+
const I = String(k);
|
|
3239
|
+
let O;
|
|
3240
|
+
T ? O = m.includes(I) ? m : [...m, I] : O = m.filter((V) => V !== I), y(ct(O, b));
|
|
3241
|
+
};
|
|
3242
|
+
return /* @__PURE__ */ n(f, { style: a.wrapper, children: /* @__PURE__ */ n(f, { style: p.checkboxDirection === "row" ? a.containerRow : a.containerColumn, children: p.checkboxOptions.map((k) => {
|
|
3243
|
+
if (k.hidden) return null;
|
|
3244
|
+
const T = m.includes(String(k.value));
|
|
3245
|
+
return /* @__PURE__ */ x(f, { style: a.optionContainer, children: [
|
|
3246
|
+
/* @__PURE__ */ n(
|
|
3247
|
+
d,
|
|
3248
|
+
{
|
|
3249
|
+
value: T,
|
|
3250
|
+
onValueChange: (I) => g(k.value, I),
|
|
3251
|
+
disabled: !!p.disabled,
|
|
3252
|
+
color: T ? "#0284c7" : void 0
|
|
3253
|
+
}
|
|
3254
|
+
),
|
|
3255
|
+
/* @__PURE__ */ n(u, { style: [a.label, p.disabled && a.disabled], children: k.label })
|
|
3256
|
+
] }, k.key);
|
|
3257
|
+
}) }) });
|
|
3258
|
+
}
|
|
3259
|
+
}
|
|
3260
|
+
);
|
|
3261
|
+
}
|
|
3262
|
+
let Y = null;
|
|
3263
|
+
try {
|
|
3264
|
+
Y = require("react-native-element-dropdown").Dropdown;
|
|
3265
|
+
} catch {
|
|
3266
|
+
}
|
|
3267
|
+
function pt({
|
|
3268
|
+
form: t,
|
|
3269
|
+
field: e,
|
|
3270
|
+
hasError: o,
|
|
3271
|
+
formReadOnly: i = !1,
|
|
3272
|
+
formReadOnlyStyle: s = "value"
|
|
3273
|
+
}) {
|
|
3274
|
+
const l = v().searchSelect, a = e.options.options || [], p = e.options.readOnly ?? i, h = e.options.readOnlyStyle ?? s, c = t.getValues(e.key);
|
|
3275
|
+
if (!Y)
|
|
3276
|
+
return /* @__PURE__ */ n(f, { style: l.container, children: /* @__PURE__ */ n(u, { style: l.placeholder, children: "Install react-native-element-dropdown to use SelectFieldSearch" }) });
|
|
3277
|
+
if (p) {
|
|
3278
|
+
const b = a.find((d) => d.value === c);
|
|
3279
|
+
return h === "disabled" ? /* @__PURE__ */ n(
|
|
3280
|
+
Y,
|
|
3281
|
+
{
|
|
3282
|
+
data: a.map((d) => ({ label: d.label, value: d.value })),
|
|
3283
|
+
labelField: "label",
|
|
3284
|
+
valueField: "value",
|
|
3285
|
+
value: c,
|
|
3286
|
+
disable: !0,
|
|
3287
|
+
search: !0,
|
|
3288
|
+
placeholder: e.options.placeholder || "Search...",
|
|
3289
|
+
style: [l.container, l.disabled],
|
|
3290
|
+
onChange: () => {
|
|
3291
|
+
}
|
|
3292
|
+
}
|
|
3293
|
+
) : /* @__PURE__ */ n(f, { style: l.readOnlyValue, children: /* @__PURE__ */ n(u, { style: { fontSize: 16, color: "#374151" }, children: b?.label || "—" }) });
|
|
3294
|
+
}
|
|
3295
|
+
return /* @__PURE__ */ n(
|
|
3296
|
+
z,
|
|
3297
|
+
{
|
|
3298
|
+
name: e.key,
|
|
3299
|
+
control: t.control,
|
|
3300
|
+
defaultValue: e.options.defaultValue,
|
|
3301
|
+
rules: { required: e.options.required },
|
|
3302
|
+
render: ({ field: b }) => /* @__PURE__ */ x(f, { style: l.wrapper, children: [
|
|
3303
|
+
/* @__PURE__ */ n(
|
|
3304
|
+
Y,
|
|
3305
|
+
{
|
|
3306
|
+
data: a.map((d) => ({ label: d.label, value: d.value })),
|
|
3307
|
+
labelField: "label",
|
|
3308
|
+
valueField: "value",
|
|
3309
|
+
value: b.value,
|
|
3310
|
+
search: !0,
|
|
3311
|
+
searchPlaceholder: "Search...",
|
|
3312
|
+
onChange: (d) => {
|
|
3313
|
+
b.onChange(d.value), t.trigger && t.trigger(e.key);
|
|
3314
|
+
},
|
|
3315
|
+
onBlur: b.onBlur,
|
|
3316
|
+
disable: e.options.disabled,
|
|
3317
|
+
placeholder: e.options.placeholder || "Search...",
|
|
3318
|
+
style: [l.container, e.options.disabled && l.disabled, o && l.error],
|
|
3319
|
+
placeholderStyle: l.placeholder,
|
|
3320
|
+
inputSearchStyle: l.inputSearch,
|
|
3321
|
+
accessibilityLabel: e.options.label
|
|
3322
|
+
}
|
|
3323
|
+
),
|
|
3324
|
+
e.options.helpText && /* @__PURE__ */ n(u, { style: l.helpText, children: e.options.helpText })
|
|
3325
|
+
] })
|
|
3326
|
+
}
|
|
3327
|
+
);
|
|
3328
|
+
}
|
|
3329
|
+
let Z = null;
|
|
3330
|
+
try {
|
|
3331
|
+
Z = require("react-native-element-dropdown").Dropdown;
|
|
3332
|
+
} catch {
|
|
3333
|
+
}
|
|
3334
|
+
function ht(t) {
|
|
3335
|
+
return t ? typeof t == "string" ? t : t && typeof t == "object" && "value" in t ? t.value : String(t) : null;
|
|
3336
|
+
}
|
|
3337
|
+
function bt({
|
|
3338
|
+
form: t,
|
|
3339
|
+
field: e,
|
|
3340
|
+
hasError: o,
|
|
3341
|
+
formReadOnly: i = !1,
|
|
3342
|
+
formReadOnlyStyle: s = "value"
|
|
3343
|
+
}) {
|
|
3344
|
+
const l = v().searchSelect, a = e.options.readOnly ?? i, p = e.options.readOnlyStyle ?? s;
|
|
3345
|
+
e.options.submitTransform ??= ht;
|
|
3346
|
+
let h = [], c = () => {
|
|
3347
|
+
};
|
|
3348
|
+
try {
|
|
3349
|
+
h = e.options.initialOptions ?? [];
|
|
3350
|
+
} catch {
|
|
3351
|
+
}
|
|
3352
|
+
const b = pe({
|
|
3353
|
+
control: t.control,
|
|
3354
|
+
name: e.key
|
|
3355
|
+
}), d = W(() => b ? b && typeof b == "object" && "value" in b && "label" in b ? b : typeof b == "string" ? h.find((S) => S.value === b) || { value: b, label: b } : { value: String(b), label: String(b) } : null, [b, h]);
|
|
3356
|
+
return Z ? a ? p === "disabled" ? /* @__PURE__ */ n(
|
|
3357
|
+
Z,
|
|
3358
|
+
{
|
|
3359
|
+
data: h,
|
|
3360
|
+
labelField: "label",
|
|
3361
|
+
valueField: "value",
|
|
3362
|
+
value: d?.value,
|
|
3363
|
+
disable: !0,
|
|
3364
|
+
search: !0,
|
|
3365
|
+
style: [l.container, l.disabled],
|
|
3366
|
+
onChange: () => {
|
|
3367
|
+
}
|
|
3368
|
+
}
|
|
3369
|
+
) : /* @__PURE__ */ n(f, { style: l.readOnlyValue, children: /* @__PURE__ */ n(u, { style: { fontSize: 16, color: "#374151" }, children: d?.label || "—" }) }) : /* @__PURE__ */ n(
|
|
3370
|
+
z,
|
|
3371
|
+
{
|
|
3372
|
+
name: e.key,
|
|
3373
|
+
control: t.control,
|
|
3374
|
+
defaultValue: e.options.defaultValue,
|
|
3375
|
+
rules: { required: e.options.required },
|
|
3376
|
+
render: ({ field: y }) => /* @__PURE__ */ x(f, { style: l.wrapper, children: [
|
|
3377
|
+
/* @__PURE__ */ n(
|
|
3378
|
+
Z,
|
|
3379
|
+
{
|
|
3380
|
+
data: h,
|
|
3381
|
+
labelField: "label",
|
|
3382
|
+
valueField: "value",
|
|
3383
|
+
value: d?.value,
|
|
3384
|
+
search: !0,
|
|
3385
|
+
searchPlaceholder: "Search...",
|
|
3386
|
+
onChangeText: c,
|
|
3387
|
+
onChange: (S) => {
|
|
3388
|
+
y.onChange(S), t.trigger && t.trigger(e.key);
|
|
3389
|
+
},
|
|
3390
|
+
onBlur: y.onBlur,
|
|
3391
|
+
disable: e.options.disabled,
|
|
3392
|
+
placeholder: e.options.placeholder || "Search...",
|
|
3393
|
+
style: [l.container, e.options.disabled && l.disabled, o && l.error],
|
|
3394
|
+
placeholderStyle: l.placeholder,
|
|
3395
|
+
inputSearchStyle: l.inputSearch,
|
|
3396
|
+
accessibilityLabel: e.options.label
|
|
3397
|
+
}
|
|
3398
|
+
),
|
|
3399
|
+
e.options.helpText && /* @__PURE__ */ n(u, { style: l.helpText, children: e.options.helpText })
|
|
3400
|
+
] })
|
|
3401
|
+
}
|
|
3402
|
+
) : /* @__PURE__ */ n(f, { style: l.container, children: /* @__PURE__ */ n(u, { style: l.placeholder, children: "Install react-native-element-dropdown to use SelectFieldSearchApollo" }) });
|
|
3403
|
+
}
|
|
3404
|
+
let _ = null;
|
|
3405
|
+
try {
|
|
3406
|
+
_ = require("react-native-element-dropdown").MultiSelect;
|
|
3407
|
+
} catch {
|
|
3408
|
+
}
|
|
3409
|
+
function yt(t) {
|
|
3410
|
+
return Array.isArray(t) ? t.map((e) => typeof e == "string" ? e : e && typeof e == "object" && "value" in e ? e.value : String(e)) : [];
|
|
3411
|
+
}
|
|
3412
|
+
function ft({
|
|
3413
|
+
form: t,
|
|
3414
|
+
field: e,
|
|
3415
|
+
hasError: o,
|
|
3416
|
+
formReadOnly: i = !1,
|
|
3417
|
+
formReadOnlyStyle: s = "value"
|
|
3418
|
+
}) {
|
|
3419
|
+
const l = v().multiSelect, a = (e.options.options || []).map((c) => ({ label: c.label, value: c.value })), p = e.options.readOnly ?? i, h = e.options.readOnlyStyle ?? s;
|
|
3420
|
+
if (e.options.submitTransform ??= yt, !_)
|
|
3421
|
+
return /* @__PURE__ */ n(f, { style: l.container, children: /* @__PURE__ */ n(u, { style: l.placeholder, children: "Install react-native-element-dropdown to use SelectFieldMultiSearch" }) });
|
|
3422
|
+
if (p) {
|
|
3423
|
+
const c = t.getValues(e.key) ?? [], b = Array.isArray(c) ? c.map((y) => typeof y == "string" ? y : y?.value || String(y)) : [], d = a.filter((y) => b.includes(y.value)).map((y) => y.label);
|
|
3424
|
+
return h === "disabled" ? /* @__PURE__ */ n(
|
|
3425
|
+
_,
|
|
3426
|
+
{
|
|
3427
|
+
data: a,
|
|
3428
|
+
labelField: "label",
|
|
3429
|
+
valueField: "value",
|
|
3430
|
+
value: b,
|
|
3431
|
+
disable: !0,
|
|
3432
|
+
search: !0,
|
|
3433
|
+
style: [l.container, l.disabled],
|
|
3434
|
+
onChange: () => {
|
|
3435
|
+
}
|
|
3436
|
+
}
|
|
3437
|
+
) : /* @__PURE__ */ n(f, { style: l.readOnlyValue, children: /* @__PURE__ */ n(u, { style: { fontSize: 16, color: "#374151" }, children: d.join(", ") || "—" }) });
|
|
3438
|
+
}
|
|
3439
|
+
return /* @__PURE__ */ n(
|
|
3440
|
+
z,
|
|
3441
|
+
{
|
|
3442
|
+
name: e.key,
|
|
3443
|
+
control: t.control,
|
|
3444
|
+
defaultValue: e.options.defaultValue ?? [],
|
|
3445
|
+
rules: { required: e.options.required },
|
|
3446
|
+
render: ({ field: c }) => {
|
|
3447
|
+
const b = Array.isArray(c.value) ? c.value.map((d) => typeof d == "string" ? d : d?.value ? String(d.value) : String(d)) : [];
|
|
3448
|
+
return /* @__PURE__ */ x(f, { style: l.wrapper, children: [
|
|
3449
|
+
/* @__PURE__ */ n(
|
|
3450
|
+
_,
|
|
3451
|
+
{
|
|
3452
|
+
data: a,
|
|
3453
|
+
labelField: "label",
|
|
3454
|
+
valueField: "value",
|
|
3455
|
+
value: b,
|
|
3456
|
+
search: !0,
|
|
3457
|
+
searchPlaceholder: "Search...",
|
|
3458
|
+
onChange: (d) => {
|
|
3459
|
+
c.onChange(d), t.trigger && t.trigger(e.key);
|
|
3460
|
+
},
|
|
3461
|
+
disable: e.options.disabled,
|
|
3462
|
+
placeholder: e.options.placeholder || "Search...",
|
|
3463
|
+
style: [l.container, e.options.disabled && l.disabled, o && l.error],
|
|
3464
|
+
placeholderStyle: l.placeholder,
|
|
3465
|
+
accessibilityLabel: e.options.label
|
|
3466
|
+
}
|
|
3467
|
+
),
|
|
3468
|
+
e.options.helpText && /* @__PURE__ */ n(u, { style: l.helpText, children: e.options.helpText })
|
|
3469
|
+
] });
|
|
3470
|
+
}
|
|
3471
|
+
}
|
|
3472
|
+
);
|
|
3473
|
+
}
|
|
3474
|
+
let J = null;
|
|
3475
|
+
try {
|
|
3476
|
+
J = require("react-native-element-dropdown").MultiSelect;
|
|
3477
|
+
} catch {
|
|
3478
|
+
}
|
|
3479
|
+
function ke(t) {
|
|
3480
|
+
return Array.isArray(t) ? t.map((e) => typeof e == "string" ? e : e && typeof e == "object" && "value" in e ? e.value : String(e)) : [];
|
|
3481
|
+
}
|
|
3482
|
+
const Kt = ke;
|
|
3483
|
+
function gt({
|
|
3484
|
+
form: t,
|
|
3485
|
+
field: e,
|
|
3486
|
+
hasError: o,
|
|
3487
|
+
formReadOnly: i = !1,
|
|
3488
|
+
formReadOnlyStyle: s = "value"
|
|
3489
|
+
}) {
|
|
3490
|
+
const l = v().multiSelect, a = e.options.readOnly ?? i, p = e.options.readOnlyStyle ?? s;
|
|
3491
|
+
e.options.submitTransform ??= ke;
|
|
3492
|
+
const h = e.options.initialOptions ?? [], [c, b] = B(/* @__PURE__ */ new Map()), d = pe({ control: t.control, name: e.key }), y = W(() => {
|
|
3493
|
+
const m = d ?? [];
|
|
3494
|
+
return Array.isArray(m) ? m.map((g) => typeof g == "string" ? g : g && typeof g == "object" && "value" in g ? String(g.value) : String(g)) : [];
|
|
3495
|
+
}, [d]);
|
|
3496
|
+
E(() => {
|
|
3497
|
+
h.length > 0 && b((m) => {
|
|
3498
|
+
let g = !1;
|
|
3499
|
+
for (const T of h)
|
|
3500
|
+
if (!m.has(T.value)) {
|
|
3501
|
+
g = !0;
|
|
3502
|
+
break;
|
|
3503
|
+
}
|
|
3504
|
+
if (!g) return m;
|
|
3505
|
+
const k = new Map(m);
|
|
3506
|
+
return h.forEach((T) => k.set(T.value, T)), k;
|
|
3507
|
+
});
|
|
3508
|
+
}, [h]);
|
|
3509
|
+
const S = W(() => {
|
|
3510
|
+
const m = /* @__PURE__ */ new Map();
|
|
3511
|
+
return c.forEach((g, k) => m.set(k, g)), h.forEach((g) => m.set(g.value, g)), Array.from(m.values());
|
|
3512
|
+
}, [h, c]);
|
|
3513
|
+
if (!J)
|
|
3514
|
+
return /* @__PURE__ */ n(f, { style: l.container, children: /* @__PURE__ */ n(u, { style: l.placeholder, children: "Install react-native-element-dropdown to use SelectFieldMultiSearchApollo" }) });
|
|
3515
|
+
if (a) {
|
|
3516
|
+
const m = y.map((g) => S.find((k) => k.value === g)?.label ?? g);
|
|
3517
|
+
return p === "disabled" ? /* @__PURE__ */ n(
|
|
3518
|
+
J,
|
|
3519
|
+
{
|
|
3520
|
+
data: S,
|
|
3521
|
+
labelField: "label",
|
|
3522
|
+
valueField: "value",
|
|
3523
|
+
value: y,
|
|
3524
|
+
disable: !0,
|
|
3525
|
+
search: !0,
|
|
3526
|
+
style: [l.container, l.disabled],
|
|
3527
|
+
onChange: () => {
|
|
3528
|
+
}
|
|
3529
|
+
}
|
|
3530
|
+
) : /* @__PURE__ */ n(f, { style: l.readOnlyValue, children: /* @__PURE__ */ n(u, { style: { fontSize: 16, color: "#374151" }, children: m.join(", ") || "—" }) });
|
|
3531
|
+
}
|
|
3532
|
+
return /* @__PURE__ */ n(
|
|
3533
|
+
z,
|
|
3534
|
+
{
|
|
3535
|
+
name: e.key,
|
|
3536
|
+
control: t.control,
|
|
3537
|
+
defaultValue: e.options.defaultValue ?? [],
|
|
3538
|
+
rules: { required: e.options.required },
|
|
3539
|
+
render: ({ field: m }) => /* @__PURE__ */ x(f, { style: l.wrapper, children: [
|
|
3540
|
+
/* @__PURE__ */ n(
|
|
3541
|
+
J,
|
|
3542
|
+
{
|
|
3543
|
+
data: S,
|
|
3544
|
+
labelField: "label",
|
|
3545
|
+
valueField: "value",
|
|
3546
|
+
value: y,
|
|
3547
|
+
search: !0,
|
|
3548
|
+
searchPlaceholder: "Search...",
|
|
3549
|
+
onChange: (g) => {
|
|
3550
|
+
const k = g.map((T) => S.find((O) => O.value === T) || { value: T, label: T });
|
|
3551
|
+
m.onChange(k), t.trigger && t.trigger(e.key);
|
|
3552
|
+
},
|
|
3553
|
+
disable: e.options.disabled,
|
|
3554
|
+
placeholder: e.options.placeholder || "Search...",
|
|
3555
|
+
style: [l.container, e.options.disabled && l.disabled, o && l.error],
|
|
3556
|
+
placeholderStyle: l.placeholder,
|
|
3557
|
+
accessibilityLabel: e.options.label
|
|
3558
|
+
}
|
|
3559
|
+
),
|
|
3560
|
+
e.options.helpText && /* @__PURE__ */ n(u, { style: l.helpText, children: e.options.helpText })
|
|
3561
|
+
] })
|
|
3562
|
+
}
|
|
3563
|
+
);
|
|
3564
|
+
}
|
|
3565
|
+
function ve({
|
|
3566
|
+
form: t,
|
|
3567
|
+
field: e,
|
|
3568
|
+
hasError: o,
|
|
3569
|
+
formReadOnly: i = !1,
|
|
3570
|
+
formReadOnlyStyle: s = "value"
|
|
3571
|
+
}) {
|
|
3572
|
+
const l = v().customField, a = e.options, p = a.readOnly ?? i, h = a.readOnlyStyle ?? s, c = t.getValues(e.key) ?? a.defaultValue;
|
|
3573
|
+
if (p) {
|
|
3574
|
+
let d;
|
|
3575
|
+
if (c == null || c === "")
|
|
3576
|
+
d = "—";
|
|
3577
|
+
else if (typeof c == "string")
|
|
3578
|
+
d = c;
|
|
3579
|
+
else
|
|
3580
|
+
try {
|
|
3581
|
+
d = JSON.stringify(c);
|
|
3582
|
+
} catch {
|
|
3583
|
+
d = String(c);
|
|
3584
|
+
}
|
|
3585
|
+
return h === "disabled" ? /* @__PURE__ */ n(f, { style: l.wrapper, children: /* @__PURE__ */ n(D, { editable: !1, value: d, style: { fontSize: 16, color: "#9ca3af" } }) }) : /* @__PURE__ */ n(f, { style: l.wrapper, children: /* @__PURE__ */ n(f, { style: l.readOnlyValue, children: /* @__PURE__ */ n(u, { style: { fontSize: 16, color: "#374151" }, children: d }) }) });
|
|
3586
|
+
}
|
|
3587
|
+
const b = {
|
|
3588
|
+
value: c,
|
|
3589
|
+
onChange: (d) => {
|
|
3590
|
+
t.setValue(e.key, d), t.trigger(e.key);
|
|
3591
|
+
},
|
|
3592
|
+
field: e
|
|
3593
|
+
};
|
|
3594
|
+
try {
|
|
3595
|
+
const d = a.customField(b);
|
|
3596
|
+
return a.customWrapper ? a.customWrapper(d) : /* @__PURE__ */ n(f, { style: l.wrapper, children: d });
|
|
3597
|
+
} catch (d) {
|
|
3598
|
+
return console.error("Error rendering custom field:", d), /* @__PURE__ */ n(f, { style: l.wrapper, children: /* @__PURE__ */ x(u, { style: l.errorText, children: [
|
|
3599
|
+
"Error rendering custom field: ",
|
|
3600
|
+
e.key
|
|
3601
|
+
] }) });
|
|
3602
|
+
}
|
|
3603
|
+
}
|
|
3604
|
+
ve.displayName = "CustomField";
|
|
3605
|
+
function mt({
|
|
3606
|
+
form: t,
|
|
3607
|
+
field: e,
|
|
3608
|
+
hasError: o,
|
|
3609
|
+
formReadOnly: i = !1,
|
|
3610
|
+
formReadOnlyStyle: s = "value"
|
|
3611
|
+
}) {
|
|
3612
|
+
const l = v().customCheckbox, a = e.options, p = a.readOnly ?? i, h = a.readOnlyStyle ?? s, c = t.getValues(e.key), b = a.checkedIcon ?? /* @__PURE__ */ n(u, { style: { fontSize: 20 }, children: "☑" }), d = a.uncheckedIcon ?? /* @__PURE__ */ n(u, { style: { fontSize: 20 }, children: "☐" }), y = a.label ? /* @__PURE__ */ x(u, { style: l.label, children: [
|
|
3613
|
+
a.label,
|
|
3614
|
+
a.required && /* @__PURE__ */ n(u, { style: { color: "#dc2626" }, children: " *" })
|
|
3615
|
+
] }) : null, S = a.helpText ? /* @__PURE__ */ n(u, { style: l.helpText, children: a.helpText }) : null;
|
|
3616
|
+
return p ? h === "disabled" ? /* @__PURE__ */ x(f, { style: l.wrapper, children: [
|
|
3617
|
+
/* @__PURE__ */ x(f, { style: l.row, children: [
|
|
3618
|
+
/* @__PURE__ */ n(f, { style: [l.checkboxContainer, l.disabled], children: c ? b : d }),
|
|
3619
|
+
y
|
|
3620
|
+
] }),
|
|
3621
|
+
S
|
|
3622
|
+
] }) : /* @__PURE__ */ n(f, { style: l.wrapper, children: /* @__PURE__ */ n(u, { style: l.readOnly, children: c ? "Yes" : "No" }) }) : /* @__PURE__ */ n(
|
|
3623
|
+
z,
|
|
3624
|
+
{
|
|
3625
|
+
name: e.key,
|
|
3626
|
+
control: t.control,
|
|
3627
|
+
defaultValue: a.defaultValue,
|
|
3628
|
+
rules: { required: a.required },
|
|
3629
|
+
render: ({ field: m }) => /* @__PURE__ */ x(f, { style: l.wrapper, children: [
|
|
3630
|
+
/* @__PURE__ */ x(f, { style: l.row, children: [
|
|
3631
|
+
/* @__PURE__ */ n(
|
|
3632
|
+
H,
|
|
3633
|
+
{
|
|
3634
|
+
onPress: () => !a.disabled && m.onChange(!m.value),
|
|
3635
|
+
style: [l.checkboxContainer, a.disabled && l.disabled],
|
|
3636
|
+
accessibilityRole: "checkbox",
|
|
3637
|
+
accessibilityState: { checked: !!m.value, disabled: a.disabled },
|
|
3638
|
+
children: m.value ? b : d
|
|
3639
|
+
}
|
|
3640
|
+
),
|
|
3641
|
+
y
|
|
3642
|
+
] }),
|
|
3643
|
+
S
|
|
3644
|
+
] })
|
|
3645
|
+
}
|
|
3646
|
+
);
|
|
3647
|
+
}
|
|
3648
|
+
let N = null;
|
|
3649
|
+
try {
|
|
3650
|
+
N = require("react-native-markdown-display").default;
|
|
3651
|
+
} catch {
|
|
3652
|
+
}
|
|
3653
|
+
const St = [
|
|
3654
|
+
{ label: "B", syntax: "**", wrap: !0, title: "Bold" },
|
|
3655
|
+
{ label: "I", syntax: "*", wrap: !0, title: "Italic" },
|
|
3656
|
+
{ label: "H", syntax: "# ", wrap: !1, title: "Heading" },
|
|
3657
|
+
{ label: "—", syntax: `
|
|
3658
|
+
---
|
|
3659
|
+
`, wrap: !1, title: "Horizontal rule" },
|
|
3660
|
+
{ label: "•", syntax: "- ", wrap: !1, title: "List item" },
|
|
3661
|
+
{ label: "🔗", syntax: "[text](url)", wrap: !1, title: "Link" }
|
|
3662
|
+
];
|
|
3663
|
+
function xt({
|
|
3664
|
+
form: t,
|
|
3665
|
+
field: e,
|
|
3666
|
+
hasError: o,
|
|
3667
|
+
formReadOnly: i = !1,
|
|
3668
|
+
formReadOnlyStyle: s = "value"
|
|
3669
|
+
}) {
|
|
3670
|
+
const l = v().markdownEditor, [a, p] = B("edit"), h = e.options.readOnly ?? i, c = e.options.readOnlyStyle ?? s;
|
|
3671
|
+
if (h) {
|
|
3672
|
+
const b = t.getValues(e.key) ?? "";
|
|
3673
|
+
return c === "disabled" ? /* @__PURE__ */ x(F, { children: [
|
|
3674
|
+
/* @__PURE__ */ x(f, { style: [l.editor, l.disabled], children: [
|
|
3675
|
+
/* @__PURE__ */ n(f, { style: l.toolbar, children: /* @__PURE__ */ n(u, { style: { fontSize: 13, color: "#9ca3af" }, children: "Markdown Editor (Disabled)" }) }),
|
|
3676
|
+
/* @__PURE__ */ n(f, { style: [l.preview, { opacity: 0.5, minHeight: 200 }], children: /* @__PURE__ */ n(u, { style: { fontFamily: "monospace", fontSize: 14 }, children: b || "—" }) })
|
|
3677
|
+
] }),
|
|
3678
|
+
e.options.helpText && /* @__PURE__ */ n(u, { style: l.helpText, children: e.options.helpText })
|
|
3679
|
+
] }) : /* @__PURE__ */ x(F, { children: [
|
|
3680
|
+
/* @__PURE__ */ n(f, { style: l.readOnlyValue, children: N ? /* @__PURE__ */ n(N, { children: b || "—" }) : /* @__PURE__ */ n(u, { style: { fontSize: 16, color: "#374151" }, children: b || "—" }) }),
|
|
3681
|
+
e.options.helpText && /* @__PURE__ */ n(u, { style: l.helpText, children: e.options.helpText })
|
|
3682
|
+
] });
|
|
3683
|
+
}
|
|
3684
|
+
return /* @__PURE__ */ n(
|
|
3685
|
+
z,
|
|
3686
|
+
{
|
|
3687
|
+
control: t.control,
|
|
3688
|
+
name: e.key,
|
|
3689
|
+
defaultValue: e.options.defaultValue ?? "",
|
|
3690
|
+
rules: {
|
|
3691
|
+
required: e.options.required,
|
|
3692
|
+
maxLength: e.options.maxLength ? { value: e.options.maxLength, message: `Content must be less than ${e.options.maxLength} characters` } : void 0
|
|
3693
|
+
},
|
|
3694
|
+
render: ({ field: { onChange: b, value: d } }) => /* @__PURE__ */ x(f, { style: l.wrapper, children: [
|
|
3695
|
+
/* @__PURE__ */ x(f, { style: [l.editor, o && l.error, e.options.disabled && l.disabled], children: [
|
|
3696
|
+
/* @__PURE__ */ x(f, { style: l.toggleContainer, children: [
|
|
3697
|
+
/* @__PURE__ */ n(
|
|
3698
|
+
H,
|
|
3699
|
+
{
|
|
3700
|
+
onPress: () => p("edit"),
|
|
3701
|
+
style: [l.toggleButton, a === "edit" && l.toggleButtonActive],
|
|
3702
|
+
children: /* @__PURE__ */ n(u, { style: [l.toggleButtonText, a === "edit" && l.toggleButtonTextActive], children: "Edit" })
|
|
3703
|
+
}
|
|
3704
|
+
),
|
|
3705
|
+
/* @__PURE__ */ n(
|
|
3706
|
+
H,
|
|
3707
|
+
{
|
|
3708
|
+
onPress: () => p("preview"),
|
|
3709
|
+
style: [l.toggleButton, a === "preview" && l.toggleButtonActive],
|
|
3710
|
+
children: /* @__PURE__ */ n(u, { style: [l.toggleButtonText, a === "preview" && l.toggleButtonTextActive], children: "Preview" })
|
|
3711
|
+
}
|
|
3712
|
+
)
|
|
3713
|
+
] }),
|
|
3714
|
+
a === "edit" && /* @__PURE__ */ n(f, { style: l.toolbar, children: St.map((y) => /* @__PURE__ */ n(
|
|
3715
|
+
H,
|
|
3716
|
+
{
|
|
3717
|
+
onPress: () => {
|
|
3718
|
+
y.wrap ? b(`${d || ""}${y.syntax}text${y.syntax}`) : b(`${d || ""}${y.syntax}`);
|
|
3719
|
+
},
|
|
3720
|
+
style: l.toolbarButton,
|
|
3721
|
+
accessibilityLabel: y.title,
|
|
3722
|
+
children: /* @__PURE__ */ n(u, { style: l.toolbarButtonText, children: y.label })
|
|
3723
|
+
},
|
|
3724
|
+
y.label
|
|
3725
|
+
)) }),
|
|
3726
|
+
a === "edit" ? /* @__PURE__ */ n(
|
|
3727
|
+
D,
|
|
3728
|
+
{
|
|
3729
|
+
multiline: !0,
|
|
3730
|
+
value: d ?? "",
|
|
3731
|
+
onChangeText: (y) => {
|
|
3732
|
+
e.options.maxLength && y.length > e.options.maxLength || b(y);
|
|
3733
|
+
},
|
|
3734
|
+
placeholder: e.options.placeholder,
|
|
3735
|
+
placeholderTextColor: "#9ca3af",
|
|
3736
|
+
editable: !e.options.disabled,
|
|
3737
|
+
style: [l.textInput, { minHeight: e.options.height ?? 200 }],
|
|
3738
|
+
accessibilityLabel: e.options.label
|
|
3739
|
+
}
|
|
3740
|
+
) : /* @__PURE__ */ n(Pe, { style: [l.preview, { minHeight: e.options.height ?? 200 }], children: N ? /* @__PURE__ */ n(N, { children: d || "" }) : /* @__PURE__ */ n(u, { style: { fontSize: 16, color: "#374151" }, children: d || "Nothing to preview" }) }),
|
|
3741
|
+
e.options.maxLength && /* @__PURE__ */ x(u, { style: { fontSize: 13, color: "#6b7280", textAlign: "right", padding: 8 }, children: [
|
|
3742
|
+
(d ?? "").length,
|
|
3743
|
+
"/",
|
|
3744
|
+
e.options.maxLength
|
|
3745
|
+
] })
|
|
3746
|
+
] }),
|
|
3747
|
+
e.options.helpText && /* @__PURE__ */ n(u, { style: l.helpText, children: e.options.helpText })
|
|
3748
|
+
] })
|
|
3749
|
+
}
|
|
3750
|
+
);
|
|
3751
|
+
}
|
|
3752
|
+
function Ct({
|
|
3753
|
+
field: t
|
|
3754
|
+
}) {
|
|
3755
|
+
const e = v().contentField;
|
|
3756
|
+
return /* @__PURE__ */ n(f, { style: e.wrapper, children: t.options.content });
|
|
3757
|
+
}
|
|
3758
|
+
function kt({
|
|
3759
|
+
fieldKey: t,
|
|
3760
|
+
label: e,
|
|
3761
|
+
required: o,
|
|
3762
|
+
unstyled: i,
|
|
3763
|
+
containerStyle: s,
|
|
3764
|
+
labelStyle: l,
|
|
3765
|
+
requiredIndicatorStyle: a,
|
|
3766
|
+
containerClassName: p,
|
|
3767
|
+
labelClassName: h,
|
|
3768
|
+
requiredIndicatorClassName: c
|
|
3769
|
+
}) {
|
|
3770
|
+
const b = v();
|
|
3771
|
+
return /* @__PURE__ */ x(
|
|
3772
|
+
u,
|
|
3773
|
+
{
|
|
3774
|
+
nativeID: `${t}-label`,
|
|
3775
|
+
style: [!i && b.label.base, l],
|
|
3776
|
+
...h ? { className: h } : {},
|
|
3777
|
+
children: [
|
|
3778
|
+
e,
|
|
3779
|
+
o && /* @__PURE__ */ n(
|
|
3780
|
+
u,
|
|
3781
|
+
{
|
|
3782
|
+
style: [!i && b.label.requiredIndicator, a],
|
|
3783
|
+
...c ? { className: c } : {},
|
|
3784
|
+
children: " *"
|
|
3785
|
+
}
|
|
3786
|
+
)
|
|
3787
|
+
]
|
|
3788
|
+
}
|
|
3789
|
+
);
|
|
3790
|
+
}
|
|
3791
|
+
function vt(t, e, o, i) {
|
|
3792
|
+
const s = !!t.formState.errors[e.key];
|
|
3793
|
+
switch (e.type) {
|
|
3794
|
+
case C.Text:
|
|
3795
|
+
return /* @__PURE__ */ n(Ne, { form: t, field: e, hasError: s, formReadOnly: o, formReadOnlyStyle: i });
|
|
3796
|
+
case C.TextArea:
|
|
3797
|
+
return /* @__PURE__ */ n($e, { form: t, field: e, hasError: s, formReadOnly: o, formReadOnlyStyle: i });
|
|
3798
|
+
case C.MarkdownEditor:
|
|
3799
|
+
return /* @__PURE__ */ n(xt, { form: t, field: e, hasError: s, formReadOnly: o, formReadOnlyStyle: i });
|
|
3800
|
+
case C.Email:
|
|
3801
|
+
return /* @__PURE__ */ n(Ue, { form: t, field: e, hasError: s, formReadOnly: o, formReadOnlyStyle: i });
|
|
3802
|
+
case C.Password:
|
|
3803
|
+
return /* @__PURE__ */ n(Ke, { form: t, field: e, hasError: s, formReadOnly: o, formReadOnlyStyle: i });
|
|
3804
|
+
case C.Url:
|
|
3805
|
+
return /* @__PURE__ */ n(Ge, { form: t, field: e, hasError: s, formReadOnly: o, formReadOnlyStyle: i });
|
|
3806
|
+
case C.Phone:
|
|
3807
|
+
return /* @__PURE__ */ n(Ye, { form: t, field: e, hasError: s, formReadOnly: o, formReadOnlyStyle: i });
|
|
3808
|
+
case C.Number:
|
|
3809
|
+
return /* @__PURE__ */ n(Ze, { form: t, field: e, hasError: s, formReadOnly: o, formReadOnlyStyle: i });
|
|
3810
|
+
case C.Currency:
|
|
3811
|
+
return /* @__PURE__ */ n(_e, { form: t, field: e, hasError: s, formReadOnly: o, formReadOnlyStyle: i });
|
|
3812
|
+
case C.Select:
|
|
3813
|
+
return /* @__PURE__ */ n(xe, { form: t, field: e, hasError: s, formReadOnly: o, formReadOnlyStyle: i });
|
|
3814
|
+
case C.EnumSelect:
|
|
3815
|
+
return /* @__PURE__ */ n(ot, { form: t, field: e, hasError: s, formReadOnly: o, formReadOnlyStyle: i });
|
|
3816
|
+
case C.MultiSelect:
|
|
3817
|
+
return /* @__PURE__ */ n(it, { form: t, field: e, hasError: s, formReadOnly: o, formReadOnlyStyle: i });
|
|
3818
|
+
case C.Checkbox:
|
|
3819
|
+
return /* @__PURE__ */ n(
|
|
3820
|
+
Xe,
|
|
3821
|
+
{
|
|
3822
|
+
form: t,
|
|
3823
|
+
field: e,
|
|
3824
|
+
hasError: s,
|
|
3825
|
+
errorMessage: s ? t.formState.errors[e.key]?.message ?? X : void 0,
|
|
3826
|
+
formReadOnly: o,
|
|
3827
|
+
formReadOnlyStyle: i
|
|
3828
|
+
}
|
|
3829
|
+
);
|
|
3830
|
+
case C.Switch:
|
|
3831
|
+
return /* @__PURE__ */ n(Qe, { form: t, field: e, hasError: s, formReadOnly: o, formReadOnlyStyle: i });
|
|
3832
|
+
case C.Button:
|
|
3833
|
+
return /* @__PURE__ */ n(tt, { field: e, form: t, hasError: s });
|
|
3834
|
+
case C.DatePicker:
|
|
3835
|
+
return /* @__PURE__ */ n(rt, { form: t, field: e, hasError: s, formReadOnly: o, formReadOnlyStyle: i });
|
|
3836
|
+
case C.DateTimePicker:
|
|
3837
|
+
return /* @__PURE__ */ n(lt, { form: t, field: e, hasError: s, formReadOnly: o, formReadOnlyStyle: i });
|
|
3838
|
+
case C.TimePicker:
|
|
3839
|
+
return /* @__PURE__ */ n(nt, { form: t, field: e, hasError: s, formReadOnly: o, formReadOnlyStyle: i });
|
|
3840
|
+
case C.Radio:
|
|
3841
|
+
return /* @__PURE__ */ n(st, { form: t, field: e, hasError: s, formReadOnly: o, formReadOnlyStyle: i });
|
|
3842
|
+
case C.CheckboxGroup:
|
|
3843
|
+
return /* @__PURE__ */ n(ut, { form: t, field: e, hasError: s, formReadOnly: o, formReadOnlyStyle: i });
|
|
3844
|
+
case C.SearchSelect:
|
|
3845
|
+
return /* @__PURE__ */ n(pt, { form: t, field: e, hasError: s, formReadOnly: o, formReadOnlyStyle: i });
|
|
3846
|
+
case C.SearchSelectApollo:
|
|
3847
|
+
return /* @__PURE__ */ n(bt, { form: t, field: e, hasError: s, formReadOnly: o, formReadOnlyStyle: i });
|
|
3848
|
+
case C.SearchSelectMulti:
|
|
3849
|
+
return /* @__PURE__ */ n(ft, { form: t, field: e, hasError: s, formReadOnly: o, formReadOnlyStyle: i });
|
|
3850
|
+
case C.SearchSelectMultiApollo:
|
|
3851
|
+
return /* @__PURE__ */ n(gt, { form: t, field: e, hasError: s, formReadOnly: o, formReadOnlyStyle: i });
|
|
3852
|
+
case C.Content:
|
|
3853
|
+
return /* @__PURE__ */ n(Ct, { field: e });
|
|
3854
|
+
case C.Custom:
|
|
3855
|
+
return /* @__PURE__ */ n(ve, { form: t, field: e, hasError: s, formReadOnly: o, formReadOnlyStyle: i });
|
|
3856
|
+
case C.CustomCheckbox:
|
|
3857
|
+
return /* @__PURE__ */ n(mt, { form: t, field: e, hasError: s, formReadOnly: o, formReadOnlyStyle: i });
|
|
3858
|
+
default:
|
|
3859
|
+
return null;
|
|
3860
|
+
}
|
|
3861
|
+
}
|
|
3862
|
+
function Tt({
|
|
3863
|
+
field: t,
|
|
3864
|
+
formReadOnly: e = !1,
|
|
3865
|
+
formReadOnlyStyle: o = "value",
|
|
3866
|
+
style: i,
|
|
3867
|
+
className: s
|
|
3868
|
+
}) {
|
|
3869
|
+
const l = ze(), { labelDisplay: a } = Ie(), p = v(), h = l.watch(), c = W(() => {
|
|
3870
|
+
const { showWhen: P, requiredWhen: M, disabledWhen: te } = t.options;
|
|
3871
|
+
try {
|
|
3872
|
+
const j = P ? P(h) : !0, Te = M ? M(h) : !1, we = te ? te(h) : !1;
|
|
3873
|
+
return { isVisible: j, isDynamicallyRequired: Te, isDynamicallyDisabled: we };
|
|
3874
|
+
} catch (j) {
|
|
3875
|
+
return console.warn(`Error evaluating conditional logic for field ${t.key}:`, j), { isVisible: !0, isDynamicallyRequired: !1, isDynamicallyDisabled: !1 };
|
|
3876
|
+
}
|
|
3877
|
+
}, [h, t.options, t.key]), b = Oe(void 0);
|
|
3878
|
+
if (E(() => {
|
|
3879
|
+
const P = t.options.required || c.isDynamicallyRequired;
|
|
3880
|
+
if (b.current !== P) {
|
|
3881
|
+
b.current = P;
|
|
3882
|
+
try {
|
|
3883
|
+
l.register(t.key, {
|
|
3884
|
+
required: P ? X : !1
|
|
3885
|
+
});
|
|
3886
|
+
} catch (M) {
|
|
3887
|
+
console.warn(`Error updating field registration for ${t.key}:`, M);
|
|
3888
|
+
}
|
|
3889
|
+
}
|
|
3890
|
+
}, [c.isDynamicallyRequired, t.options.required, t.key, l]), !c.isVisible)
|
|
3891
|
+
return null;
|
|
3892
|
+
const d = l.formState.errors[t.key], y = d?.message ?? (d ? X : null), S = !!t.options.label;
|
|
3893
|
+
let m = !1;
|
|
3894
|
+
if (S)
|
|
3895
|
+
switch (a) {
|
|
3896
|
+
case "all":
|
|
3897
|
+
m = !0;
|
|
3898
|
+
break;
|
|
3899
|
+
case "none":
|
|
3900
|
+
m = !1;
|
|
3901
|
+
break;
|
|
3902
|
+
case "default":
|
|
3903
|
+
default:
|
|
3904
|
+
m = t.type !== C.Checkbox;
|
|
3905
|
+
break;
|
|
3906
|
+
}
|
|
3907
|
+
const g = t.options.required || c.isDynamicallyRequired, k = t.options.disabled || c.isDynamicallyDisabled, T = {
|
|
3908
|
+
...t,
|
|
3909
|
+
options: {
|
|
3910
|
+
...t.options,
|
|
3911
|
+
disabled: k,
|
|
3912
|
+
required: g
|
|
3913
|
+
}
|
|
3914
|
+
}, I = vt(l, T, e, o), O = m && /* @__PURE__ */ n(kt, { fieldKey: t.key, label: t.options.label ?? "", required: g }), R = (t.options.layout || "vertical") === "horizontal" ? /* @__PURE__ */ x(f, { style: { flexDirection: "row", alignItems: "center", gap: 12 }, children: [
|
|
3915
|
+
O,
|
|
3916
|
+
/* @__PURE__ */ x(f, { style: { flex: 1 }, children: [
|
|
3917
|
+
I,
|
|
3918
|
+
d && t.type !== C.Checkbox && /* @__PURE__ */ n(u, { style: p.global.errorText, children: y })
|
|
3919
|
+
] })
|
|
3920
|
+
] }) : /* @__PURE__ */ x(F, { children: [
|
|
3921
|
+
O,
|
|
3922
|
+
I,
|
|
3923
|
+
d && t.type !== C.Checkbox && /* @__PURE__ */ n(u, { style: p.global.errorText, children: y })
|
|
3924
|
+
] });
|
|
3925
|
+
return t.options.customWrapper ? t.options.customWrapper(R) : /* @__PURE__ */ n(
|
|
3926
|
+
f,
|
|
3927
|
+
{
|
|
3928
|
+
style: [{ gap: 4 }, i],
|
|
3929
|
+
...s ? { className: s } : {},
|
|
3930
|
+
children: R
|
|
3931
|
+
}
|
|
3932
|
+
);
|
|
3933
|
+
}
|
|
3934
|
+
function Gt({
|
|
3935
|
+
id: t,
|
|
3936
|
+
fields: e,
|
|
3937
|
+
children: o,
|
|
3938
|
+
submit: i,
|
|
3939
|
+
defaultValues: s,
|
|
3940
|
+
style: l,
|
|
3941
|
+
className: a,
|
|
3942
|
+
readOnly: p = !1,
|
|
3943
|
+
readOnlyStyle: h = "value",
|
|
3944
|
+
nativeTheme: c = {},
|
|
3945
|
+
labelDisplay: b = "default",
|
|
3946
|
+
schema: d,
|
|
3947
|
+
validationGroup: y,
|
|
3948
|
+
validationGroups: S
|
|
3949
|
+
}) {
|
|
3950
|
+
const m = W(() => {
|
|
3951
|
+
if (d || e?.some((V) => {
|
|
3952
|
+
if (V?.type === C.Button) return !1;
|
|
3953
|
+
const R = V?.options;
|
|
3954
|
+
return R?.schema || R?.validateWithForm || R?.validate;
|
|
3955
|
+
}))
|
|
3956
|
+
return Ae(
|
|
3957
|
+
d,
|
|
3958
|
+
e?.filter((V) => V !== null).filter((V) => V.type !== C.Button).map((V) => ({
|
|
3959
|
+
key: V.key,
|
|
3960
|
+
options: V.options
|
|
3961
|
+
}))
|
|
3962
|
+
);
|
|
3963
|
+
}, [d, e, y, S]), g = De({
|
|
3964
|
+
defaultValues: s,
|
|
3965
|
+
resolver: m,
|
|
3966
|
+
mode: "onBlur",
|
|
3967
|
+
reValidateMode: "onChange"
|
|
3968
|
+
});
|
|
3969
|
+
E(() => {
|
|
3970
|
+
s && typeof s != "function" && g.reset(s);
|
|
3971
|
+
}, [s, g]);
|
|
3972
|
+
const k = W(() => he.parse({}), []), T = W(() => Ee(c), [c]), I = { labelDisplay: b };
|
|
3973
|
+
return W(() => (O) => {
|
|
3974
|
+
const V = {};
|
|
3975
|
+
for (const [P, M] of Object.entries(O))
|
|
3976
|
+
e?.some(
|
|
3977
|
+
(j) => j && j.key === P && j.type === C.Button
|
|
3978
|
+
) || (V[P] = M);
|
|
3979
|
+
if (!e)
|
|
3980
|
+
return i(V);
|
|
3981
|
+
const R = { ...V };
|
|
3982
|
+
return e.filter((P) => P !== null).filter((P) => P.type !== C.Button).forEach((P) => {
|
|
3983
|
+
P.options.submitTransform && P.key in R && (R[P.key] = P.options.submitTransform(R[P.key]));
|
|
3984
|
+
}), i(R);
|
|
3985
|
+
}, [e, i]), /* @__PURE__ */ n(ye.Provider, { value: I, children: /* @__PURE__ */ n(fe.Provider, { value: k, children: /* @__PURE__ */ n(me.Provider, { value: T, children: /* @__PURE__ */ n(be.Provider, { value: g, children: /* @__PURE__ */ x(
|
|
3986
|
+
f,
|
|
3987
|
+
{
|
|
3988
|
+
nativeID: t,
|
|
3989
|
+
style: [{ gap: 16 }, l],
|
|
3990
|
+
...a ? { className: a } : {},
|
|
3991
|
+
children: [
|
|
3992
|
+
e?.filter((O) => O !== null).map((O) => /* @__PURE__ */ n(
|
|
3993
|
+
Tt,
|
|
3994
|
+
{
|
|
3995
|
+
field: O,
|
|
3996
|
+
formReadOnly: p,
|
|
3997
|
+
formReadOnlyStyle: h
|
|
3998
|
+
},
|
|
3999
|
+
O.key
|
|
4000
|
+
)),
|
|
4001
|
+
o
|
|
4002
|
+
]
|
|
4003
|
+
}
|
|
4004
|
+
) }) }) }) });
|
|
4005
|
+
}
|
|
4006
|
+
export {
|
|
4007
|
+
et as Button,
|
|
4008
|
+
tt as ButtonField,
|
|
4009
|
+
A as CURRENCY_CONFIGS,
|
|
4010
|
+
Xe as CheckboxField,
|
|
4011
|
+
ut as CheckboxGroupField,
|
|
4012
|
+
Ct as ContentField,
|
|
4013
|
+
mt as CustomCheckboxField,
|
|
4014
|
+
ve as CustomField,
|
|
4015
|
+
X as DEFAULT_REQUIRED_ERROR_MESSAGE,
|
|
4016
|
+
rt as DatePickerField,
|
|
4017
|
+
lt as DateTimePickerField,
|
|
4018
|
+
Ue as EmailField,
|
|
4019
|
+
ye as FormConfigContext,
|
|
4020
|
+
be as FormContext,
|
|
4021
|
+
It as FormFieldClass,
|
|
4022
|
+
C as FormFieldType,
|
|
4023
|
+
kt as FormLabel,
|
|
4024
|
+
he as FormThemeSchema,
|
|
4025
|
+
xt as MarkdownEditor,
|
|
4026
|
+
_e as MoneyField,
|
|
4027
|
+
Gt as NativeForm,
|
|
4028
|
+
me as NativeThemeContext,
|
|
4029
|
+
Ze as NumberField,
|
|
4030
|
+
Ke as PasswordField,
|
|
4031
|
+
Ye as PhoneField,
|
|
4032
|
+
st as RadioField,
|
|
4033
|
+
Tt as RenderFormField,
|
|
4034
|
+
xe as SelectField,
|
|
4035
|
+
ot as SelectFieldEnum,
|
|
4036
|
+
it as SelectFieldMulti,
|
|
4037
|
+
ft as SelectFieldMultiSearch,
|
|
4038
|
+
gt as SelectFieldMultiSearchApollo,
|
|
4039
|
+
pt as SelectFieldSearch,
|
|
4040
|
+
bt as SelectFieldSearchApollo,
|
|
4041
|
+
Qe as SwitchField,
|
|
4042
|
+
$e as TextAreaField,
|
|
4043
|
+
Ne as TextField,
|
|
4044
|
+
fe as ThemeContext,
|
|
4045
|
+
nt as TimePickerField,
|
|
4046
|
+
Ge as UrlField,
|
|
4047
|
+
Kt as apolloMultiSelectSubmitTransform,
|
|
4048
|
+
$t as convertCurrency,
|
|
4049
|
+
We as createFieldValidation,
|
|
4050
|
+
Ee as createFinalNativeTheme,
|
|
4051
|
+
Ae as createFormResolver,
|
|
4052
|
+
$ as defaultNativeTheme,
|
|
4053
|
+
q as formatCurrency,
|
|
4054
|
+
Ut as formatCurrencyForDisplay,
|
|
4055
|
+
re as formatDateFromDateTime,
|
|
4056
|
+
le as formatDateTimeFromValue,
|
|
4057
|
+
je as getCurrencyConfig,
|
|
4058
|
+
Mt as getCurrencyOptions,
|
|
4059
|
+
Et as getCurrencyStep,
|
|
4060
|
+
ge as getDateFromDateTime,
|
|
4061
|
+
Le as getDateTimeFromValue,
|
|
4062
|
+
Wt as getFieldsInGroup,
|
|
4063
|
+
qt as getPopularCurrencyOptions,
|
|
4064
|
+
Ht as getValidationGroups,
|
|
4065
|
+
Nt as isSupportedCurrency,
|
|
4066
|
+
ke as multiSelectSubmitTransform,
|
|
4067
|
+
Lt as parseCurrency,
|
|
4068
|
+
qe as resolveCurrencyConfig,
|
|
4069
|
+
At as shouldValidateField,
|
|
4070
|
+
jt as useDebounce,
|
|
4071
|
+
ae as useFieldValidation,
|
|
4072
|
+
Ie as useFormConfig,
|
|
4073
|
+
ze as useFormContext,
|
|
4074
|
+
Rt as useFormTheme,
|
|
4075
|
+
v as useNativeTheme,
|
|
4076
|
+
Bt as validateGroup
|
|
4077
|
+
};
|