@tamagui/field 0.0.0-bootstrap.0 → 3.0.0-beta.643.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cjs/Field.cjs +857 -0
  3. package/dist/cjs/Field.native.cjs +1018 -0
  4. package/dist/cjs/Field.native.js +1020 -0
  5. package/dist/cjs/Field.native.js.map +1 -0
  6. package/dist/cjs/FieldContext.cjs +86 -0
  7. package/dist/cjs/FieldContext.native.cjs +90 -0
  8. package/dist/cjs/FieldContext.native.js +92 -0
  9. package/dist/cjs/FieldContext.native.js.map +1 -0
  10. package/dist/cjs/index.cjs +21 -0
  11. package/dist/cjs/index.native.cjs +23 -0
  12. package/dist/cjs/index.native.js +25 -0
  13. package/dist/cjs/index.native.js.map +1 -0
  14. package/dist/cjs/types.cjs +17 -0
  15. package/dist/cjs/types.native.cjs +19 -0
  16. package/dist/cjs/types.native.js +21 -0
  17. package/dist/cjs/types.native.js.map +1 -0
  18. package/dist/cjs/validation.cjs +114 -0
  19. package/dist/cjs/validation.native.cjs +126 -0
  20. package/dist/cjs/validation.native.js +128 -0
  21. package/dist/cjs/validation.native.js.map +1 -0
  22. package/dist/esm/Field.mjs +824 -0
  23. package/dist/esm/Field.mjs.map +1 -0
  24. package/dist/esm/Field.native.js +983 -0
  25. package/dist/esm/Field.native.js.map +1 -0
  26. package/dist/esm/FieldContext.mjs +51 -0
  27. package/dist/esm/FieldContext.mjs.map +1 -0
  28. package/dist/esm/FieldContext.native.js +53 -0
  29. package/dist/esm/FieldContext.native.js.map +1 -0
  30. package/dist/esm/index.js +5 -0
  31. package/dist/esm/index.mjs +5 -0
  32. package/dist/esm/index.native.js +5 -0
  33. package/dist/esm/types.mjs +0 -0
  34. package/dist/esm/types.native.js +0 -0
  35. package/dist/esm/validation.mjs +86 -0
  36. package/dist/esm/validation.mjs.map +1 -0
  37. package/dist/esm/validation.native.js +96 -0
  38. package/dist/esm/validation.native.js.map +1 -0
  39. package/dist/jsx/Field.mjs +824 -0
  40. package/dist/jsx/Field.mjs.map +1 -0
  41. package/dist/jsx/Field.native.cjs +1018 -0
  42. package/dist/jsx/Field.native.js +1020 -0
  43. package/dist/jsx/Field.native.js.map +1 -0
  44. package/dist/jsx/FieldContext.mjs +51 -0
  45. package/dist/jsx/FieldContext.mjs.map +1 -0
  46. package/dist/jsx/FieldContext.native.cjs +90 -0
  47. package/dist/jsx/FieldContext.native.js +92 -0
  48. package/dist/jsx/FieldContext.native.js.map +1 -0
  49. package/dist/jsx/index.js +5 -0
  50. package/dist/jsx/index.mjs +5 -0
  51. package/dist/jsx/index.native.cjs +23 -0
  52. package/dist/jsx/index.native.js +25 -0
  53. package/dist/jsx/index.native.js.map +1 -0
  54. package/dist/jsx/types.mjs +0 -0
  55. package/dist/jsx/types.native.cjs +19 -0
  56. package/dist/jsx/types.native.js +21 -0
  57. package/dist/jsx/types.native.js.map +1 -0
  58. package/dist/jsx/validation.mjs +86 -0
  59. package/dist/jsx/validation.mjs.map +1 -0
  60. package/dist/jsx/validation.native.cjs +126 -0
  61. package/dist/jsx/validation.native.js +128 -0
  62. package/dist/jsx/validation.native.js.map +1 -0
  63. package/package.json +50 -5
  64. package/src/Field.tsx +1129 -0
  65. package/src/FieldContext.tsx +61 -0
  66. package/src/index.ts +3 -0
  67. package/src/types.ts +125 -0
  68. package/src/validation.ts +136 -0
  69. package/types/Field.d.ts +401 -0
  70. package/types/Field.d.ts.map +1 -0
  71. package/types/FieldContext.d.ts +11 -0
  72. package/types/FieldContext.d.ts.map +1 -0
  73. package/types/index.d.ts +4 -0
  74. package/types/index.d.ts.map +1 -0
  75. package/types/types.d.ts +112 -0
  76. package/types/types.d.ts.map +1 -0
  77. package/types/validation.d.ts +24 -0
  78. package/types/validation.d.ts.map +1 -0
  79. package/README.md +0 -1
@@ -0,0 +1,1018 @@
1
+ "use strict";
2
+
3
+
4
+ var __create = Object.create;
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __export = (target, all) => {
11
+ for (var name in all) __defProp(target, name, {
12
+ get: all[name],
13
+ enumerable: true
14
+ });
15
+ };
16
+ var __copyProps = (to, from, except, desc) => {
17
+ if (from && typeof from === "object" || typeof from === "function") {
18
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
19
+ get: () => from[key],
20
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
21
+ });
22
+ }
23
+ return to;
24
+ };
25
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
+ value: mod,
27
+ enumerable: true
28
+ }) : target, mod));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var Field_exports = {};
31
+ __export(Field_exports, {
32
+ Field: () => Field2,
33
+ FieldDescriptionFrame: () => FieldDescriptionFrame,
34
+ FieldErrorFrame: () => FieldErrorFrame,
35
+ FieldFrame: () => FieldFrame,
36
+ FieldItemFrame: () => FieldItemFrame,
37
+ FieldLabelFrame: () => FieldLabelFrame
38
+ });
39
+ module.exports = __toCommonJS(Field_exports);
40
+ var import_jsx_runtime = require("react/jsx-runtime");
41
+ var import_core = require("@tamagui/core");
42
+ var import_form = require("@tamagui/form");
43
+ var import_focusable = require("@tamagui/focusable");
44
+ var React = __toESM(require("react"), 1);
45
+ var import_FieldContext = require("./FieldContext.native.js");
46
+ var import_validation = require("./validation.native.js");
47
+ function _instanceof(left, right) {
48
+ if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
49
+ return !!right[Symbol.hasInstance](left);
50
+ } else {
51
+ return left instanceof right;
52
+ }
53
+ }
54
+ var fieldStateVariants = {
55
+ valid: { true: {} },
56
+ invalid: { true: {} },
57
+ touched: { true: {} },
58
+ dirty: { true: {} },
59
+ filled: { true: {} },
60
+ focused: { true: {} },
61
+ disabled: { true: {} }
62
+ };
63
+ var FieldFrame = (0, import_core.styled)(import_core.View, {
64
+ displayName: "Field",
65
+ context: import_FieldContext.FieldStyledContext,
66
+ variants: fieldStateVariants
67
+ });
68
+ var FieldLabelFrame = (0, import_core.styled)(import_core.Text, {
69
+ displayName: "FieldLabel",
70
+ render: "label",
71
+ context: import_FieldContext.FieldStyledContext,
72
+ variants: fieldStateVariants
73
+ });
74
+ var FieldDescriptionFrame = (0, import_core.styled)(import_core.Text, {
75
+ displayName: "FieldDescription",
76
+ render: "p",
77
+ context: import_FieldContext.FieldStyledContext,
78
+ variants: fieldStateVariants
79
+ });
80
+ var FieldErrorFrame = (0, import_core.styled)(import_core.Text, {
81
+ displayName: "FieldError",
82
+ render: "span",
83
+ context: import_FieldContext.FieldStyledContext,
84
+ variants: fieldStateVariants
85
+ });
86
+ var FieldItemFrame = (0, import_core.styled)(import_core.View, {
87
+ displayName: "FieldItem",
88
+ context: import_FieldContext.FieldStyledContext,
89
+ variants: fieldStateVariants
90
+ });
91
+ var validityKeys = [
92
+ "badInput",
93
+ "customError",
94
+ "patternMismatch",
95
+ "rangeOverflow",
96
+ "rangeUnderflow",
97
+ "stepMismatch",
98
+ "tooLong",
99
+ "tooShort",
100
+ "typeMismatch",
101
+ "valueMissing"
102
+ ];
103
+ var AssociationContext = /* @__PURE__ */ React.createContext(null);
104
+ var FieldRootContext = /* @__PURE__ */ React.createContext(null);
105
+ var FieldItemContext = /* @__PURE__ */ React.createContext(false);
106
+ function getText(children) {
107
+ var text = [];
108
+ React.Children.forEach(children, function(child) {
109
+ if (typeof child === "string" || typeof child === "number") {
110
+ text.push(String(child));
111
+ return;
112
+ }
113
+ if (/* @__PURE__ */ React.isValidElement(child)) {
114
+ var nested = getText(child.props.children);
115
+ if (nested) {
116
+ text.push(nested);
117
+ }
118
+ }
119
+ });
120
+ return text.join(" ").trim() || void 0;
121
+ }
122
+ function useAssociation(prefix, parent) {
123
+ var defaultControlId = `${prefix}-control`;
124
+ var controlIdsRef = React.useRef(/* @__PURE__ */ new Map());
125
+ var labelsRef = React.useRef(/* @__PURE__ */ new Map());
126
+ var messagesRef = React.useRef(/* @__PURE__ */ new Map());
127
+ var [, update] = React.useReducer(function(value) {
128
+ return value + 1;
129
+ }, 0);
130
+ var registerControlId = React.useCallback(function(id) {
131
+ var source = /* @__PURE__ */ Symbol();
132
+ controlIdsRef.current.set(source, id);
133
+ update();
134
+ return function() {
135
+ controlIdsRef.current.delete(source);
136
+ update();
137
+ };
138
+ }, []);
139
+ var registerLabel = React.useCallback(function(id, text) {
140
+ var source = /* @__PURE__ */ Symbol();
141
+ labelsRef.current.set(source, {
142
+ id,
143
+ text
144
+ });
145
+ update();
146
+ return function() {
147
+ labelsRef.current.delete(source);
148
+ update();
149
+ };
150
+ }, []);
151
+ var registerMessage = React.useCallback(function(id, text) {
152
+ var source = /* @__PURE__ */ Symbol();
153
+ messagesRef.current.set(source, {
154
+ id,
155
+ text
156
+ });
157
+ update();
158
+ return function() {
159
+ messagesRef.current.delete(source);
160
+ update();
161
+ };
162
+ }, []);
163
+ var _Array_from_at;
164
+ var controlId = (_Array_from_at = Array.from(controlIdsRef.current.values()).at(-1)) !== null && _Array_from_at !== void 0 ? _Array_from_at : defaultControlId;
165
+ var label = Array.from(labelsRef.current.values()).at(-1);
166
+ var messages = Array.from(messagesRef.current.values());
167
+ return React.useMemo(function() {
168
+ var _parent_messageIds, _parent_messageTexts;
169
+ return {
170
+ controlId,
171
+ labelId: [parent === null || parent === void 0 ? void 0 : parent.labelId, label === null || label === void 0 ? void 0 : label.id].filter(Boolean).join(" ") || void 0,
172
+ labelText: [parent === null || parent === void 0 ? void 0 : parent.labelText, label === null || label === void 0 ? void 0 : label.text].filter(Boolean).join(" ") || void 0,
173
+ messageIds: Array.from(/* @__PURE__ */ new Set([...(_parent_messageIds = parent === null || parent === void 0 ? void 0 : parent.messageIds) !== null && _parent_messageIds !== void 0 ? _parent_messageIds : [], ...messages.map(function(message) {
174
+ return message.id;
175
+ })])),
176
+ messageTexts: [...(_parent_messageTexts = parent === null || parent === void 0 ? void 0 : parent.messageTexts) !== null && _parent_messageTexts !== void 0 ? _parent_messageTexts : [], ...messages.flatMap(function(message) {
177
+ return message.text ? [message.text] : [];
178
+ })],
179
+ registerControlId,
180
+ registerLabel,
181
+ registerMessage
182
+ };
183
+ }, [
184
+ controlId,
185
+ label === null || label === void 0 ? void 0 : label.id,
186
+ label === null || label === void 0 ? void 0 : label.text,
187
+ messages,
188
+ parent === null || parent === void 0 ? void 0 : parent.labelId,
189
+ parent === null || parent === void 0 ? void 0 : parent.labelText,
190
+ parent === null || parent === void 0 ? void 0 : parent.messageIds,
191
+ parent === null || parent === void 0 ? void 0 : parent.messageTexts,
192
+ registerControlId,
193
+ registerLabel,
194
+ registerMessage
195
+ ]);
196
+ }
197
+ function getStyleState(state) {
198
+ var disabled = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : state.disabled;
199
+ return {
200
+ valid: state.valid === true,
201
+ invalid: state.valid === false,
202
+ touched: state.touched,
203
+ dirty: state.dirty,
204
+ filled: state.filled,
205
+ focused: state.focused,
206
+ disabled
207
+ };
208
+ }
209
+ function getDataProps(state) {
210
+ var disabled = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : state.disabled;
211
+ if (!import_core.isWeb) {
212
+ return {};
213
+ }
214
+ return {
215
+ "data-valid": state.valid === true ? "" : void 0,
216
+ "data-invalid": state.valid === false ? "" : void 0,
217
+ "data-touched": state.touched ? "" : void 0,
218
+ "data-dirty": state.dirty ? "" : void 0,
219
+ "data-filled": state.filled ? "" : void 0,
220
+ "data-focused": state.focused ? "" : void 0,
221
+ "data-disabled": disabled ? "" : void 0
222
+ };
223
+ }
224
+ function useControlContext(root, association) {
225
+ var itemDisabled = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false, isItem = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false;
226
+ var disabled = root.state.disabled || itemDisabled;
227
+ var controlIdRef = React.useRef(association.controlId);
228
+ var registrationDisabledRef = React.useRef(root.rootDisabled || itemDisabled);
229
+ controlIdRef.current = association.controlId;
230
+ registrationDisabledRef.current = root.rootDisabled || itemDisabled;
231
+ var registerControl = React.useCallback(function(registration) {
232
+ var _registration_id;
233
+ var id = (_registration_id = registration.id) !== null && _registration_id !== void 0 ? _registration_id : controlIdRef.current;
234
+ var unregisterId = association.registerControlId(id);
235
+ var nextRegistration = {
236
+ ...registration,
237
+ id,
238
+ get disabled() {
239
+ return registrationDisabledRef.current || registration.disabled;
240
+ }
241
+ };
242
+ var unregisterControl = root.registerControl(nextRegistration, !isItem);
243
+ return function() {
244
+ unregisterControl();
245
+ unregisterId();
246
+ };
247
+ }, [
248
+ association.registerControlId,
249
+ isItem,
250
+ root.registerControl
251
+ ]);
252
+ return React.useMemo(function() {
253
+ return {
254
+ name: root.name,
255
+ disabled,
256
+ ariaProps: {
257
+ id: association.controlId,
258
+ ...import_core.isWeb ? {
259
+ "aria-labelledby": association.labelId,
260
+ "aria-describedby": association.messageIds.join(" ") || void 0,
261
+ "aria-invalid": root.state.valid === false ? true : void 0
262
+ } : {
263
+ accessibilityLabel: association.labelText,
264
+ accessibilityHint: association.messageTexts.join(" ") || void 0,
265
+ accessibilityState: disabled ? { disabled: true } : void 0
266
+ }
267
+ },
268
+ dataProps: getDataProps(root.state, disabled),
269
+ onFocus: root.onFocus,
270
+ onBlur: root.onBlur,
271
+ onChange: root.onChange,
272
+ onDisabledChange: isItem ? function() {} : root.onDisabledChange,
273
+ registerControl
274
+ };
275
+ }, [
276
+ association.controlId,
277
+ association.labelId,
278
+ association.labelText,
279
+ association.messageIds,
280
+ association.messageTexts,
281
+ disabled,
282
+ isItem,
283
+ registerControl,
284
+ root.name,
285
+ root.onBlur,
286
+ root.onChange,
287
+ root.onDisabledChange,
288
+ root.onFocus,
289
+ root.state
290
+ ]);
291
+ }
292
+ function getRegistrationValue(registration) {
293
+ return (registration === null || registration === void 0 ? void 0 : registration.getValue) ? registration.getValue() : registration === null || registration === void 0 ? void 0 : registration.value;
294
+ }
295
+ function getInput(registration) {
296
+ var _registration_inputRef;
297
+ return (_registration_inputRef = registration.inputRef) === null || _registration_inputRef === void 0 ? void 0 : _registration_inputRef.current;
298
+ }
299
+ function canValidateInput(input) {
300
+ return Boolean(input && input.validity && typeof input.setCustomValidity === "function" && !input.disabled);
301
+ }
302
+ function isEligibleInput(input, formElement) {
303
+ var _input_matches, _input_hasAttribute;
304
+ if ((_input_matches = input.matches) === null || _input_matches === void 0 ? void 0 : _input_matches.call(input, ":disabled")) {
305
+ return false;
306
+ }
307
+ if (!formElement || input.form === formElement) {
308
+ return true;
309
+ }
310
+ return input.form === null && !((_input_hasAttribute = input.hasAttribute) === null || _input_hasAttribute === void 0 ? void 0 : _input_hasAttribute.call(input, "form"));
311
+ }
312
+ function isEligibleRegistration(registration, formElement) {
313
+ if (registration.disabled) {
314
+ return false;
315
+ }
316
+ var input = getInput(registration);
317
+ return !canValidateInput(input) || isEligibleInput(input, formElement);
318
+ }
319
+ function getNativeValidity(input, showValueMissing) {
320
+ var state = (0, import_validation.createDefaultValidityState)(true);
321
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
322
+ try {
323
+ for (var _iterator = validityKeys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
324
+ var key = _step.value;
325
+ state[key] = Boolean(input.validity[key]);
326
+ }
327
+ } catch (err) {
328
+ _didIteratorError = true;
329
+ _iteratorError = err;
330
+ } finally {
331
+ try {
332
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
333
+ _iterator.return();
334
+ }
335
+ } finally {
336
+ if (_didIteratorError) {
337
+ throw _iteratorError;
338
+ }
339
+ }
340
+ }
341
+ state.valid = Boolean(input.validity.valid);
342
+ return (0, import_validation.normalizeNativeValidity)(state, showValueMissing);
343
+ }
344
+ function hasValidityError(state) {
345
+ return state.valid === false;
346
+ }
347
+ function hasError(errors) {
348
+ return Array.isArray(errors) ? errors.length > 0 : Boolean(errors);
349
+ }
350
+ var FieldComponent = (0, import_core.createStyledHOC)(FieldFrame, function Field(param, forwardedRef) {
351
+ var { name: nameProp, disabled: disabledProp = false, invalid = false, validate, validationMode: validationModeProp, validationDebounceTime = 0, children, ...fieldProps } = param;
352
+ var form = (0, import_form.useFormRegistryContext)();
353
+ var { clearErrors: clearFormErrors, errors: formErrors, formElementRef, getValues: getFormValues, registerField: registerFormField, submitAttemptedRef, validationMode: formValidationMode } = form;
354
+ var reactId = React.useId().replace(/:/g, "");
355
+ var association = useAssociation(`field-${reactId}`);
356
+ var fieldId = `field-${reactId}`;
357
+ var controlsRef = React.useRef(/* @__PURE__ */ new Map());
358
+ var reportsDisabledRef = React.useRef(/* @__PURE__ */ new WeakMap());
359
+ var activeControlRef = React.useRef(void 0);
360
+ var activeValidationControlRef = React.useRef(void 0);
361
+ var formControlRef = React.useRef(null);
362
+ var formValidityDataRef = React.useRef({ state: { valid: null } });
363
+ var initialValueRef = React.useRef(void 0);
364
+ var hasInitialValueRef = React.useRef(false);
365
+ var valueRef = React.useRef(void 0);
366
+ var dirtyRef = React.useRef(false);
367
+ var debounceRef = React.useRef(void 0);
368
+ var [registeredName, setRegisteredName] = React.useState();
369
+ var [controlDisabled, setControlDisabled] = React.useState(false);
370
+ var [touched, setTouched] = React.useState(false);
371
+ var [dirty, setDirty] = React.useState(false);
372
+ var [filled, setFilled] = React.useState(false);
373
+ var [focused, setFocused] = React.useState(false);
374
+ var [currentValue, setCurrentValue] = React.useState(void 0);
375
+ var [validityData, setValidityData] = React.useState({
376
+ state: (0, import_validation.createDefaultValidityState)(),
377
+ error: "",
378
+ errors: [],
379
+ value: void 0,
380
+ initialValue: void 0
381
+ });
382
+ var validityDataRef = React.useRef(validityData);
383
+ validityDataRef.current = validityData;
384
+ var effectiveName = nameProp !== null && nameProp !== void 0 ? nameProp : registeredName;
385
+ var effectiveNameRef = React.useRef(effectiveName);
386
+ effectiveNameRef.current = effectiveName;
387
+ var disabled = disabledProp || controlDisabled;
388
+ var disabledRef = React.useRef(disabled);
389
+ disabledRef.current = disabled;
390
+ var validationMode = validationModeProp !== null && validationModeProp !== void 0 ? validationModeProp : formValidationMode;
391
+ var externalError = effectiveName && Object.hasOwn(formErrors, effectiveName) ? formErrors[effectiveName] : void 0;
392
+ var externalErrors = Array.isArray(externalError) ? externalError : externalError ? [externalError] : [];
393
+ var externallyInvalid = invalid || hasError(externalError);
394
+ var externallyInvalidRef = React.useRef(externallyInvalid);
395
+ externallyInvalidRef.current = externallyInvalid;
396
+ var valid = externallyInvalid ? false : disabled ? null : validityData.state.valid;
397
+ formValidityDataRef.current.state.valid = disabled ? null : externallyInvalid ? false : validityData.state.valid;
398
+ var errors = externalErrors.length ? externalErrors : validityData.errors;
399
+ var _errors_;
400
+ var error = (_errors_ = errors[0]) !== null && _errors_ !== void 0 ? _errors_ : "";
401
+ var state = React.useMemo(function() {
402
+ return {
403
+ name: effectiveName,
404
+ value: currentValue,
405
+ error,
406
+ errors,
407
+ validity: validityData.state,
408
+ valid,
409
+ touched,
410
+ dirty,
411
+ filled,
412
+ focused,
413
+ disabled
414
+ };
415
+ }, [
416
+ dirty,
417
+ disabled,
418
+ currentValue,
419
+ effectiveName,
420
+ error,
421
+ errors,
422
+ filled,
423
+ focused,
424
+ touched,
425
+ valid,
426
+ validityData.state
427
+ ]);
428
+ var stateRef = React.useRef(state);
429
+ stateRef.current = state;
430
+ var publishValidityRef = React.useRef(function() {});
431
+ var validationCommitterRef = React.useRef(void 0);
432
+ if (!validationCommitterRef.current) {
433
+ validationCommitterRef.current = (0, import_validation.createValidationCommitter)(function(data) {
434
+ publishValidityRef.current(data);
435
+ });
436
+ }
437
+ var getActiveControl = React.useCallback(function() {
438
+ var active;
439
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
440
+ try {
441
+ for (var _iterator = controlsRef.current.values()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
442
+ var registration = _step.value;
443
+ if (!isEligibleRegistration(registration, formElementRef.current)) {
444
+ continue;
445
+ }
446
+ active = registration;
447
+ }
448
+ } catch (err) {
449
+ _didIteratorError = true;
450
+ _iteratorError = err;
451
+ } finally {
452
+ try {
453
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
454
+ _iterator.return();
455
+ }
456
+ } finally {
457
+ if (_didIteratorError) {
458
+ throw _iteratorError;
459
+ }
460
+ }
461
+ }
462
+ return active;
463
+ }, [formElementRef]);
464
+ var syncControlDisabled = React.useCallback(function() {
465
+ var nextDisabled = false;
466
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
467
+ try {
468
+ for (var _iterator = controlsRef.current.values()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
469
+ var registration = _step.value;
470
+ if (reportsDisabledRef.current.get(registration)) {
471
+ nextDisabled = Boolean(registration.disabled);
472
+ }
473
+ }
474
+ } catch (err) {
475
+ _didIteratorError = true;
476
+ _iteratorError = err;
477
+ } finally {
478
+ try {
479
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
480
+ _iterator.return();
481
+ }
482
+ } finally {
483
+ if (_didIteratorError) {
484
+ throw _iteratorError;
485
+ }
486
+ }
487
+ }
488
+ setControlDisabled(nextDisabled);
489
+ }, []);
490
+ var getRepresentativeControl = React.useCallback(function() {
491
+ var fallback;
492
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
493
+ try {
494
+ for (var _iterator = controlsRef.current.values()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
495
+ var registration = _step.value;
496
+ var input = getInput(registration);
497
+ if (!isEligibleRegistration(registration, formElementRef.current)) {
498
+ continue;
499
+ }
500
+ fallback !== null && fallback !== void 0 ? fallback : fallback = registration;
501
+ if (canValidateInput(input) && !input.validity.valid) {
502
+ return registration;
503
+ }
504
+ }
505
+ } catch (err) {
506
+ _didIteratorError = true;
507
+ _iteratorError = err;
508
+ } finally {
509
+ try {
510
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
511
+ _iterator.return();
512
+ }
513
+ } finally {
514
+ if (_didIteratorError) {
515
+ throw _iteratorError;
516
+ }
517
+ }
518
+ }
519
+ return fallback !== null && fallback !== void 0 ? fallback : getActiveControl();
520
+ }, [formElementRef, getActiveControl]);
521
+ var clearCustomValidity = React.useCallback(function() {
522
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
523
+ try {
524
+ for (var _iterator = controlsRef.current.values()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
525
+ var registration = _step.value;
526
+ var input = getInput(registration);
527
+ if (canValidateInput(input)) {
528
+ input.setCustomValidity("");
529
+ }
530
+ }
531
+ } catch (err) {
532
+ _didIteratorError = true;
533
+ _iteratorError = err;
534
+ } finally {
535
+ try {
536
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
537
+ _iterator.return();
538
+ }
539
+ } finally {
540
+ if (_didIteratorError) {
541
+ throw _iteratorError;
542
+ }
543
+ }
544
+ }
545
+ }, []);
546
+ var setCustomValidity = React.useCallback(function(message) {
547
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
548
+ try {
549
+ for (var _iterator = controlsRef.current.values()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
550
+ var registration = _step.value;
551
+ if (!isEligibleRegistration(registration, formElementRef.current)) {
552
+ continue;
553
+ }
554
+ var input = getInput(registration);
555
+ if (canValidateInput(input)) {
556
+ input.setCustomValidity(message);
557
+ }
558
+ }
559
+ } catch (err) {
560
+ _didIteratorError = true;
561
+ _iteratorError = err;
562
+ } finally {
563
+ try {
564
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
565
+ _iterator.return();
566
+ }
567
+ } finally {
568
+ if (_didIteratorError) {
569
+ throw _iteratorError;
570
+ }
571
+ }
572
+ }
573
+ }, [formElementRef]);
574
+ var publishValidity = React.useCallback(function(data) {
575
+ if (data.state.customError) {
576
+ setCustomValidity(data.errors.join("\n"));
577
+ } else {
578
+ clearCustomValidity();
579
+ }
580
+ formValidityDataRef.current.state.valid = disabledRef.current ? null : externallyInvalidRef.current ? false : data.state.valid;
581
+ validityDataRef.current = data;
582
+ setCurrentValue(data.value);
583
+ setValidityData(data);
584
+ }, [clearCustomValidity, setCustomValidity]);
585
+ publishValidityRef.current = publishValidity;
586
+ var validateValue = React.useCallback(function(value) {
587
+ var submit = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false, fromChange = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
588
+ if (debounceRef.current) {
589
+ clearTimeout(debounceRef.current);
590
+ debounceRef.current = void 0;
591
+ }
592
+ var showValueMissing = dirtyRef.current || submit || submitAttemptedRef.current;
593
+ if (fromChange) {
594
+ clearCustomValidity();
595
+ }
596
+ var representative = getRepresentativeControl();
597
+ activeValidationControlRef.current = representative;
598
+ var _representative_controlRef_current;
599
+ formControlRef.current = (_representative_controlRef_current = representative === null || representative === void 0 ? void 0 : representative.controlRef.current) !== null && _representative_controlRef_current !== void 0 ? _representative_controlRef_current : null;
600
+ var input = representative && getInput(representative);
601
+ var nativeState = (0, import_validation.createDefaultValidityState)(true);
602
+ var nativeMessage = "";
603
+ if (canValidateInput(input)) {
604
+ nativeState = getNativeValidity(input, showValueMissing);
605
+ nativeMessage = nativeState.valid === false ? input.validationMessage : "";
606
+ } else {
607
+ var required = Array.from(controlsRef.current.values()).some(function(registration) {
608
+ return registration.required && isEligibleRegistration(registration, formElementRef.current);
609
+ });
610
+ if (required && !(0, import_validation.isFilled)(value) && showValueMissing) {
611
+ nativeState = {
612
+ ...(0, import_validation.createDefaultValidityState)(false),
613
+ valueMissing: true
614
+ };
615
+ nativeMessage = "Please fill out this field.";
616
+ }
617
+ }
618
+ var initialValue = initialValueRef.current;
619
+ var makeValidityData = function(customErrors) {
620
+ if (customErrors.length) {
621
+ var _customErrors_;
622
+ return {
623
+ state: {
624
+ ...nativeState,
625
+ valid: false,
626
+ customError: true
627
+ },
628
+ error: (_customErrors_ = customErrors[0]) !== null && _customErrors_ !== void 0 ? _customErrors_ : "",
629
+ errors: customErrors,
630
+ value,
631
+ initialValue
632
+ };
633
+ }
634
+ if (hasValidityError(nativeState)) {
635
+ return {
636
+ state: nativeState,
637
+ error: nativeMessage,
638
+ errors: nativeMessage ? [nativeMessage] : [],
639
+ value,
640
+ initialValue
641
+ };
642
+ }
643
+ return {
644
+ state: (0, import_validation.createDefaultValidityState)(true),
645
+ error: "",
646
+ errors: [],
647
+ value,
648
+ initialValue
649
+ };
650
+ };
651
+ if (nativeMessage && !fromChange) {
652
+ validationCommitterRef.current.run(makeValidityData([]));
653
+ return;
654
+ }
655
+ var result = validate ? (0, import_validation.getValidationResult)(validate, value, getFormValues()) : [];
656
+ if (_instanceof(result, Promise)) {
657
+ void validationCommitterRef.current.run(result.then(function(customErrors) {
658
+ return makeValidityData(customErrors);
659
+ }));
660
+ } else {
661
+ validationCommitterRef.current.run(makeValidityData(result));
662
+ }
663
+ }, [
664
+ clearCustomValidity,
665
+ formElementRef,
666
+ getFormValues,
667
+ getRepresentativeControl,
668
+ submitAttemptedRef,
669
+ validate
670
+ ]);
671
+ var registerControl = React.useCallback(function(registration) {
672
+ var reportDisabled = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
673
+ var _activeControlRef_current;
674
+ var source = /* @__PURE__ */ Symbol();
675
+ controlsRef.current.set(source, registration);
676
+ reportsDisabledRef.current.set(registration, reportDisabled);
677
+ activeControlRef.current = getActiveControl();
678
+ var _activeControlRef_current_controlRef_current;
679
+ formControlRef.current = (_activeControlRef_current_controlRef_current = (_activeControlRef_current = activeControlRef.current) === null || _activeControlRef_current === void 0 ? void 0 : _activeControlRef_current.controlRef.current) !== null && _activeControlRef_current_controlRef_current !== void 0 ? _activeControlRef_current_controlRef_current : null;
680
+ var value = getRegistrationValue(registration);
681
+ valueRef.current = value;
682
+ setCurrentValue(value);
683
+ if (!hasInitialValueRef.current) {
684
+ hasInitialValueRef.current = true;
685
+ initialValueRef.current = value;
686
+ validityDataRef.current = {
687
+ ...validityDataRef.current,
688
+ initialValue: value
689
+ };
690
+ setValidityData(validityDataRef.current);
691
+ }
692
+ if (!nameProp && registration.name) {
693
+ setRegisteredName(registration.name);
694
+ }
695
+ setFilled((0, import_validation.isFilled)(value));
696
+ syncControlDisabled();
697
+ return function() {
698
+ var _activeControlRef_current2;
699
+ controlsRef.current.delete(source);
700
+ activeControlRef.current = getActiveControl();
701
+ activeValidationControlRef.current = void 0;
702
+ var _activeControlRef_current_controlRef_current2;
703
+ formControlRef.current = (_activeControlRef_current_controlRef_current2 = (_activeControlRef_current2 = activeControlRef.current) === null || _activeControlRef_current2 === void 0 ? void 0 : _activeControlRef_current2.controlRef.current) !== null && _activeControlRef_current_controlRef_current2 !== void 0 ? _activeControlRef_current_controlRef_current2 : null;
704
+ var next = activeControlRef.current;
705
+ var nextValue = getRegistrationValue(next);
706
+ valueRef.current = nextValue;
707
+ setCurrentValue(nextValue);
708
+ setFilled((0, import_validation.isFilled)(nextValue));
709
+ if (!nameProp) {
710
+ setRegisteredName(next === null || next === void 0 ? void 0 : next.name);
711
+ }
712
+ syncControlDisabled();
713
+ };
714
+ }, [
715
+ getActiveControl,
716
+ nameProp,
717
+ syncControlDisabled
718
+ ]);
719
+ var onFocus = React.useCallback(function() {
720
+ setFocused(true);
721
+ }, []);
722
+ var onBlur = React.useCallback(function() {
723
+ var value = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : valueRef.current;
724
+ valueRef.current = value;
725
+ setCurrentValue(value);
726
+ setTouched(true);
727
+ setFocused(false);
728
+ if (validationMode === "onBlur") {
729
+ validateValue(value);
730
+ }
731
+ }, [validateValue, validationMode]);
732
+ var onChange = React.useCallback(function(value) {
733
+ valueRef.current = value;
734
+ setCurrentValue(value);
735
+ validationCommitterRef.current.invalidate();
736
+ if (debounceRef.current) {
737
+ clearTimeout(debounceRef.current);
738
+ debounceRef.current = void 0;
739
+ }
740
+ var nextDirty = !Object.is(value, initialValueRef.current);
741
+ dirtyRef.current = nextDirty;
742
+ setDirty(nextDirty);
743
+ setFilled((0, import_validation.isFilled)(value));
744
+ clearFormErrors(effectiveNameRef.current);
745
+ var validateOnChange = (0, import_validation.shouldValidateOnChange)(validationMode, submitAttemptedRef.current);
746
+ if (validateOnChange) {
747
+ if (validationMode === "onChange" && validationDebounceTime > 0 && value !== "") {
748
+ debounceRef.current = setTimeout(function() {
749
+ validateValue(value, false, true);
750
+ }, validationDebounceTime);
751
+ } else {
752
+ validateValue(value, false, true);
753
+ }
754
+ return;
755
+ }
756
+ if (stateRef.current.valid === false) {
757
+ var required = Array.from(controlsRef.current.values()).some(function(registration) {
758
+ return registration.required && isEligibleRegistration(registration, formElementRef.current);
759
+ });
760
+ if (required && !(0, import_validation.isFilled)(value) && dirtyRef.current) {
761
+ validateValue(value);
762
+ return;
763
+ }
764
+ clearCustomValidity();
765
+ publishValidity({
766
+ state: (0, import_validation.createDefaultValidityState)(true),
767
+ error: "",
768
+ errors: [],
769
+ value,
770
+ initialValue: initialValueRef.current
771
+ });
772
+ }
773
+ }, [
774
+ clearFormErrors,
775
+ clearCustomValidity,
776
+ formElementRef,
777
+ publishValidity,
778
+ submitAttemptedRef,
779
+ validateValue,
780
+ validationDebounceTime,
781
+ validationMode
782
+ ]);
783
+ var onDisabledChange = React.useCallback(function(nextDisabled) {
784
+ setControlDisabled(nextDisabled);
785
+ }, []);
786
+ React.useEffect(function() {
787
+ return function() {
788
+ var _validationCommitterRef_current;
789
+ (_validationCommitterRef_current = validationCommitterRef.current) === null || _validationCommitterRef_current === void 0 ? void 0 : _validationCommitterRef_current.invalidate();
790
+ if (debounceRef.current) {
791
+ clearTimeout(debounceRef.current);
792
+ }
793
+ };
794
+ }, []);
795
+ var formRegistration = React.useMemo(function() {
796
+ return {
797
+ controlRef: formControlRef,
798
+ validityData: formValidityDataRef.current,
799
+ get name() {
800
+ return stateRef.current.disabled ? void 0 : effectiveNameRef.current;
801
+ },
802
+ get controlId() {
803
+ var _activeValidationControlRef_current, _getRepresentativeControl;
804
+ var _activeValidationControlRef_current_id, _ref;
805
+ return (_ref = (_activeValidationControlRef_current_id = (_activeValidationControlRef_current = activeValidationControlRef.current) === null || _activeValidationControlRef_current === void 0 ? void 0 : _activeValidationControlRef_current.id) !== null && _activeValidationControlRef_current_id !== void 0 ? _activeValidationControlRef_current_id : (_getRepresentativeControl = getRepresentativeControl()) === null || _getRepresentativeControl === void 0 ? void 0 : _getRepresentativeControl.id) !== null && _ref !== void 0 ? _ref : association.controlId;
806
+ },
807
+ getValue() {
808
+ var _getRegistrationValue;
809
+ return (_getRegistrationValue = getRegistrationValue(getActiveControl())) !== null && _getRegistrationValue !== void 0 ? _getRegistrationValue : valueRef.current;
810
+ },
811
+ validate() {
812
+ var _getRegistrationValue;
813
+ validateValue((_getRegistrationValue = getRegistrationValue(getActiveControl())) !== null && _getRegistrationValue !== void 0 ? _getRegistrationValue : valueRef.current, true);
814
+ }
815
+ };
816
+ }, [
817
+ association.controlId,
818
+ getActiveControl,
819
+ getRepresentativeControl,
820
+ validateValue
821
+ ]);
822
+ React.useEffect(function() {
823
+ return registerFormField(fieldId, formRegistration);
824
+ }, [
825
+ fieldId,
826
+ formRegistration,
827
+ registerFormField
828
+ ]);
829
+ var rootContext = React.useMemo(function() {
830
+ return {
831
+ state,
832
+ validityData,
833
+ name: effectiveName,
834
+ rootDisabled: disabledProp,
835
+ registerControl,
836
+ onFocus,
837
+ onBlur,
838
+ onChange,
839
+ onDisabledChange
840
+ };
841
+ }, [
842
+ disabledProp,
843
+ effectiveName,
844
+ onBlur,
845
+ onChange,
846
+ onDisabledChange,
847
+ onFocus,
848
+ registerControl,
849
+ state,
850
+ validityData
851
+ ]);
852
+ var controlContext = useControlContext(rootContext, association);
853
+ var styleState = getStyleState(state);
854
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_FieldContext.FieldStateContext.Provider, {
855
+ value: state,
856
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldRootContext.Provider, {
857
+ value: rootContext,
858
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AssociationContext.Provider, {
859
+ value: association,
860
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_FieldContext.FieldControlContext.Provider, {
861
+ value: controlContext,
862
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_FieldContext.FieldStyledContext.Provider, {
863
+ ...styleState,
864
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldFrame, {
865
+ ...fieldProps,
866
+ ...getDataProps(state),
867
+ disabled,
868
+ ref: forwardedRef,
869
+ children
870
+ })
871
+ })
872
+ })
873
+ })
874
+ })
875
+ });
876
+ });
877
+ function usePartContexts() {
878
+ var root = React.useContext(FieldRootContext);
879
+ var association = React.useContext(AssociationContext);
880
+ var itemDisabled = React.useContext(FieldItemContext);
881
+ if (!root || !association) {
882
+ throw new Error("Field parts must be rendered inside <Field>.");
883
+ }
884
+ return {
885
+ root,
886
+ association,
887
+ itemDisabled
888
+ };
889
+ }
890
+ var FieldLabel = (0, import_core.createStyledHOC)(FieldLabelFrame, function FieldLabel2(param, forwardedRef) {
891
+ var { id: idProp, children, onPress, onMouseDown, ...labelProps } = param;
892
+ var { root, association, itemDisabled } = usePartContexts();
893
+ var generatedId = React.useId().replace(/:/g, "");
894
+ var id = idProp !== null && idProp !== void 0 ? idProp : `field-label-${generatedId}`;
895
+ var text = getText(children);
896
+ var disabled = root.state.disabled || itemDisabled;
897
+ (0, import_core.useIsomorphicLayoutEffect)(function() {
898
+ return association.registerLabel(id, text);
899
+ }, [
900
+ association.registerLabel,
901
+ id,
902
+ text
903
+ ]);
904
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldLabelFrame, {
905
+ ...labelProps,
906
+ ...getDataProps(root.state, disabled),
907
+ id,
908
+ ref: forwardedRef,
909
+ ...import_core.isWeb ? { htmlFor: association.controlId } : void 0,
910
+ ...!import_core.isWeb && disabled ? { accessibilityState: { disabled: true } } : void 0,
911
+ onMouseDown: function(event) {
912
+ onMouseDown === null || onMouseDown === void 0 ? void 0 : onMouseDown(event);
913
+ if (!event.defaultPrevented && event.detail > 1) {
914
+ event.preventDefault();
915
+ }
916
+ },
917
+ onPress: function(event) {
918
+ onPress === null || onPress === void 0 ? void 0 : onPress(event);
919
+ if (!import_core.isWeb && !(event === null || event === void 0 ? void 0 : event.defaultPrevented)) {
920
+ (0, import_focusable.focusFocusable)(association.controlId);
921
+ }
922
+ },
923
+ children
924
+ });
925
+ });
926
+ var FieldDescription = (0, import_core.createStyledHOC)(FieldDescriptionFrame, function FieldDescription2(param, forwardedRef) {
927
+ var { id: idProp, children, ...descriptionProps } = param;
928
+ var { root, association, itemDisabled } = usePartContexts();
929
+ var generatedId = React.useId().replace(/:/g, "");
930
+ var id = idProp !== null && idProp !== void 0 ? idProp : `field-description-${generatedId}`;
931
+ var text = getText(children);
932
+ var disabled = root.state.disabled || itemDisabled;
933
+ (0, import_core.useIsomorphicLayoutEffect)(function() {
934
+ return association.registerMessage(id, text);
935
+ }, [
936
+ association.registerMessage,
937
+ id,
938
+ text
939
+ ]);
940
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldDescriptionFrame, {
941
+ ...descriptionProps,
942
+ ...getDataProps(root.state, disabled),
943
+ id,
944
+ ref: forwardedRef,
945
+ children
946
+ });
947
+ });
948
+ var FieldError = (0, import_core.createStyledHOC)(FieldErrorFrame, function FieldError2(param, forwardedRef) {
949
+ var { id: idProp, children, match, ...errorProps } = param;
950
+ var { root, association, itemDisabled } = usePartContexts();
951
+ var generatedId = React.useId().replace(/:/g, "");
952
+ var id = idProp !== null && idProp !== void 0 ? idProp : `field-error-${generatedId}`;
953
+ var disabled = root.state.disabled || itemDisabled;
954
+ var rendered = match === true || !disabled && (typeof match === "string" ? Boolean(root.validityData.state[match]) : root.state.valid === false);
955
+ var message = children !== null && children !== void 0 ? children : root.state.errors.join("\n");
956
+ var text = getText(message);
957
+ (0, import_core.useIsomorphicLayoutEffect)(function() {
958
+ if (!rendered) {
959
+ return;
960
+ }
961
+ return association.registerMessage(id, text);
962
+ }, [
963
+ association.registerMessage,
964
+ id,
965
+ rendered,
966
+ text
967
+ ]);
968
+ if (!rendered) {
969
+ return null;
970
+ }
971
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldErrorFrame, {
972
+ ...errorProps,
973
+ ...getDataProps(root.state, disabled),
974
+ id,
975
+ ref: forwardedRef,
976
+ children: message
977
+ });
978
+ });
979
+ var FieldItem = (0, import_core.createStyledHOC)(FieldItemFrame, function FieldItem2(param, forwardedRef) {
980
+ var { disabled: disabledProp = false, children, ...itemProps } = param;
981
+ var root = React.useContext(FieldRootContext);
982
+ var parentAssociation = React.useContext(AssociationContext);
983
+ var reactId = React.useId().replace(/:/g, "");
984
+ var association = useAssociation(`field-item-${reactId}`, parentAssociation);
985
+ if (!root || !parentAssociation) {
986
+ throw new Error("Field.Item must be rendered inside <Field>.");
987
+ }
988
+ var disabled = root.state.disabled || disabledProp;
989
+ var controlContext = useControlContext(root, association, disabledProp, true);
990
+ var styleState = getStyleState(root.state, disabled);
991
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldItemContext.Provider, {
992
+ value: disabledProp,
993
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AssociationContext.Provider, {
994
+ value: association,
995
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_FieldContext.FieldControlContext.Provider, {
996
+ value: controlContext,
997
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_FieldContext.FieldStyledContext.Provider, {
998
+ ...styleState,
999
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldItemFrame, {
1000
+ ...itemProps,
1001
+ ...getDataProps(root.state, disabled),
1002
+ disabled,
1003
+ ref: forwardedRef,
1004
+ children
1005
+ })
1006
+ })
1007
+ })
1008
+ })
1009
+ });
1010
+ });
1011
+ var Field2 = (0, import_core.withStaticProperties)(FieldComponent, {
1012
+ Label: FieldLabel,
1013
+ Description: FieldDescription,
1014
+ Error: FieldError,
1015
+ Item: FieldItem,
1016
+ useFieldState: import_FieldContext.useFieldState,
1017
+ useFieldControl: import_FieldContext.useFieldControl
1018
+ });