@saas-ui/forms 2.5.1 → 2.5.2

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/dist/index.js CHANGED
@@ -156,23 +156,36 @@ FormValue.displayName = "FormValue";
156
156
  var React6 = __toESM(require("react"));
157
157
 
158
158
  // src/fields-context.tsx
159
- var import_react14 = __toESM(require("react"));
159
+ var import_react2 = __toESM(require("react"));
160
+ var import_jsx_runtime3 = require("react/jsx-runtime");
161
+ var FieldsContext = import_react2.default.createContext(null);
162
+ var FieldsProvider = (props) => {
163
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FieldsContext.Provider, { value: props.value, children: props.children });
164
+ };
165
+ var useFieldsContext = () => {
166
+ return import_react2.default.useContext(FieldsContext);
167
+ };
168
+ var useField = (type, fallback) => {
169
+ var _a;
170
+ const context = import_react2.default.useContext(FieldsContext);
171
+ return ((_a = context == null ? void 0 : context.fields) == null ? void 0 : _a[type]) || fallback;
172
+ };
160
173
 
161
174
  // src/default-fields.tsx
162
- var import_react13 = require("@chakra-ui/react");
175
+ var import_react14 = require("@chakra-ui/react");
163
176
 
164
177
  // src/number-input/number-input.tsx
165
- var import_react2 = require("@chakra-ui/react");
178
+ var import_react3 = require("@chakra-ui/react");
166
179
  var import_core = require("@saas-ui/core");
167
- var import_jsx_runtime3 = require("react/jsx-runtime");
168
- var Input = (0, import_react2.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react2.NumberInputField, { ref, ...props }));
180
+ var import_jsx_runtime4 = require("react/jsx-runtime");
181
+ var Input = (0, import_react3.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react3.NumberInputField, { ref, ...props }));
169
182
  Input.displayName = "NumberInputField";
170
183
  Input.id = "Input";
171
- var NumberInput = (0, import_react2.forwardRef)((props, ref) => {
184
+ var NumberInput = (0, import_react3.forwardRef)((props, ref) => {
172
185
  const {
173
186
  hideStepper = false,
174
- incrementIcon = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core.ChevronUpIcon, {}),
175
- decrementIcon = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core.ChevronDownIcon, {}),
187
+ incrementIcon = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_core.ChevronUpIcon, {}),
188
+ decrementIcon = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_core.ChevronDownIcon, {}),
176
189
  leftAddon,
177
190
  rightAddon,
178
191
  placeholder,
@@ -180,39 +193,39 @@ var NumberInput = (0, import_react2.forwardRef)((props, ref) => {
180
193
  ...rest
181
194
  } = props;
182
195
  const fieldProps = { placeholder, ..._fieldProps };
183
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react2.NumberInput, { ...rest, ref, children: [
184
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react2.InputGroup, { children: [
196
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react3.NumberInput, { ...rest, ref, children: [
197
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react3.InputGroup, { children: [
185
198
  leftAddon,
186
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Input, { ...fieldProps }),
199
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Input, { ...fieldProps }),
187
200
  rightAddon
188
201
  ] }),
189
- !hideStepper && !rightAddon ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react2.NumberInputStepper, { children: [
190
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react2.NumberIncrementStepper, { children: incrementIcon }),
191
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react2.NumberDecrementStepper, { children: decrementIcon })
202
+ !hideStepper && !rightAddon ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react3.NumberInputStepper, { children: [
203
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react3.NumberIncrementStepper, { children: incrementIcon }),
204
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react3.NumberDecrementStepper, { children: decrementIcon })
192
205
  ] }) : null
193
206
  ] });
194
207
  });
195
208
  NumberInput.displayName = "NumberInput";
196
209
 
197
210
  // src/password-input/password-input.tsx
198
- var import_react4 = require("react");
199
- var import_react5 = require("@chakra-ui/react");
211
+ var import_react5 = require("react");
212
+ var import_react6 = require("@chakra-ui/react");
200
213
  var import_icons = require("@saas-ui/core/icons");
201
214
 
202
215
  // src/input-right-button/input-right-button.tsx
203
- var import_react3 = require("@chakra-ui/react");
204
- var import_jsx_runtime4 = require("react/jsx-runtime");
205
- var InputRightButton = (0, import_react3.forwardRef)(
216
+ var import_react4 = require("@chakra-ui/react");
217
+ var import_jsx_runtime5 = require("react/jsx-runtime");
218
+ var InputRightButton = (0, import_react4.forwardRef)(
206
219
  (props, ref) => {
207
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react3.InputRightElement, { w: "auto", px: "1", py: "1", alignItems: "stretch", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react3.Button, { ref, height: "auto", ...props }) });
220
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react4.InputRightElement, { w: "auto", px: "1", py: "1", alignItems: "stretch", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react4.Button, { ref, height: "auto", ...props }) });
208
221
  }
209
222
  );
210
223
  InputRightButton.id = "InputRightElement";
211
224
  InputRightButton.displayName = "InputRightButton";
212
225
 
213
226
  // src/password-input/password-input.tsx
214
- var import_jsx_runtime5 = require("react/jsx-runtime");
215
- var PasswordInput = (0, import_react5.forwardRef)(
227
+ var import_jsx_runtime6 = require("react/jsx-runtime");
228
+ var PasswordInput = (0, import_react6.forwardRef)(
216
229
  (props, ref) => {
217
230
  const {
218
231
  viewIcon,
@@ -225,24 +238,24 @@ var PasswordInput = (0, import_react5.forwardRef)(
225
238
  leftAddon,
226
239
  ...inputProps
227
240
  } = props;
228
- const [show, setShow] = (0, import_react4.useState)(false);
241
+ const [show, setShow] = (0, import_react5.useState)(false);
229
242
  const handleClick = () => setShow(!show);
230
243
  const label = show ? "Hide password" : "Show password";
231
244
  let icon;
232
245
  if (show) {
233
- icon = viewIcon || /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_icons.ViewIcon, {});
246
+ icon = viewIcon || /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons.ViewIcon, {});
234
247
  } else {
235
- icon = viewOffIcon || /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_icons.ViewOffIcon, {});
248
+ icon = viewOffIcon || /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons.ViewOffIcon, {});
236
249
  }
237
250
  const groupProps = {
238
251
  width: w || width,
239
252
  size,
240
253
  variant
241
254
  };
242
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react5.InputGroup, { ...groupProps, children: [
255
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react6.InputGroup, { ...groupProps, children: [
243
256
  leftAddon,
244
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
245
- import_react5.Input,
257
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
258
+ import_react6.Input,
246
259
  {
247
260
  ...inputProps,
248
261
  ref,
@@ -250,7 +263,7 @@ var PasswordInput = (0, import_react5.forwardRef)(
250
263
  autoComplete: show ? "off" : autoComplete
251
264
  }
252
265
  ),
253
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
266
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
254
267
  InputRightButton,
255
268
  {
256
269
  onClick: handleClick,
@@ -265,20 +278,20 @@ var PasswordInput = (0, import_react5.forwardRef)(
265
278
  PasswordInput.displayName = "PasswordInput";
266
279
 
267
280
  // src/radio/radio-input.tsx
268
- var import_react6 = require("@chakra-ui/react");
281
+ var import_react7 = require("@chakra-ui/react");
269
282
 
270
283
  // src/utils.ts
271
- var React3 = __toESM(require("react"));
284
+ var React4 = __toESM(require("react"));
272
285
  var mapNestedFields = (name, children) => {
273
- return React3.Children.map(children, (child) => {
274
- if (React3.isValidElement(child) && child.props.name) {
286
+ return React4.Children.map(children, (child) => {
287
+ if (React4.isValidElement(child) && child.props.name) {
275
288
  let childName = child.props.name;
276
289
  if (childName.includes(".")) {
277
290
  childName = childName.replace(/^.*\.(.*)/, "$1");
278
291
  } else if (childName.includes(".$")) {
279
292
  childName = childName.replace(/^.*\.\$(.*)/, "$1");
280
293
  }
281
- return React3.cloneElement(child, {
294
+ return React4.cloneElement(child, {
282
295
  ...child.props,
283
296
  name: `${name}.${childName}`
284
297
  });
@@ -299,14 +312,14 @@ var mapOptions = (options) => {
299
312
  };
300
313
 
301
314
  // src/radio/radio-input.tsx
302
- var import_jsx_runtime6 = require("react/jsx-runtime");
303
- var RadioInput = (0, import_react6.forwardRef)(
315
+ var import_jsx_runtime7 = require("react/jsx-runtime");
316
+ var RadioInput = (0, import_react7.forwardRef)(
304
317
  ({ options: optionsProp, spacing, direction, ...props }, ref) => {
305
318
  const { onBlur, onChange, ...groupProps } = props;
306
319
  const options = mapOptions(optionsProp);
307
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react6.RadioGroup, { onChange, ...groupProps, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react6.Stack, { spacing, direction, children: options.map(({ value, label, ...radioProps }, i) => {
308
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
309
- import_react6.Radio,
320
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react7.RadioGroup, { onChange, ...groupProps, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react7.Stack, { spacing, direction, children: options.map(({ value, label, ...radioProps }, i) => {
321
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
322
+ import_react7.Radio,
310
323
  {
311
324
  onBlur,
312
325
  value,
@@ -322,15 +335,15 @@ var RadioInput = (0, import_react6.forwardRef)(
322
335
  RadioInput.displayName = "RadioInput";
323
336
 
324
337
  // src/select/select.tsx
325
- var import_react9 = require("@chakra-ui/react");
338
+ var import_react10 = require("@chakra-ui/react");
326
339
  var import_utils3 = require("@chakra-ui/utils");
327
340
  var import_core2 = require("@saas-ui/core");
328
341
 
329
342
  // src/select/select-context.tsx
330
- var import_react7 = require("@chakra-ui/react");
343
+ var import_react8 = require("@chakra-ui/react");
331
344
  var import_react_utils = require("@chakra-ui/react-utils");
332
- var import_react8 = __toESM(require("react"));
333
- var [SelectStylesProvider, useSelectStyles] = (0, import_react7.createStylesContext)("SuiSelect");
345
+ var import_react9 = __toESM(require("react"));
346
+ var [SelectStylesProvider, useSelectStyles] = (0, import_react8.createStylesContext)("SuiSelect");
334
347
  var [SelectProvider, useSelectContext] = (0, import_react_utils.createContext)({
335
348
  strict: true
336
349
  });
@@ -346,20 +359,20 @@ var useSelect = (props) => {
346
359
  isDisabled,
347
360
  renderValue = (value2) => typeof value2 === "string" ? value2 : value2 == null ? void 0 : value2.join(", ")
348
361
  } = props;
349
- const [currentValue, setCurrentValue] = (0, import_react7.useControllableState)({
362
+ const [currentValue, setCurrentValue] = (0, import_react8.useControllableState)({
350
363
  value,
351
364
  defaultValue,
352
365
  onChange
353
366
  });
354
- const controlProps = (0, import_react7.useFormControl)({ name });
355
- const options = import_react8.default.useMemo(
367
+ const controlProps = (0, import_react8.useFormControl)({ name });
368
+ const options = import_react9.default.useMemo(
356
369
  () => optionsProp && mapOptions(optionsProp),
357
370
  [optionsProp]
358
371
  );
359
372
  const handleChange = (value2) => {
360
373
  setCurrentValue(value2);
361
374
  };
362
- const getDisplayValue = import_react8.default.useCallback(
375
+ const getDisplayValue = import_react9.default.useCallback(
363
376
  (value2) => {
364
377
  if (!options) {
365
378
  return value2;
@@ -373,7 +386,7 @@ var useSelect = (props) => {
373
386
  },
374
387
  [options]
375
388
  );
376
- const displayValue = import_react8.default.useMemo(
389
+ const displayValue = import_react9.default.useMemo(
377
390
  () => currentValue ? (Array.isArray(currentValue) ? currentValue : [currentValue]).map(
378
391
  getDisplayValue
379
392
  ) : [],
@@ -394,8 +407,8 @@ var useSelect = (props) => {
394
407
  };
395
408
 
396
409
  // src/select/select.tsx
397
- var import_jsx_runtime7 = require("react/jsx-runtime");
398
- var SelectButton = (0, import_react9.forwardRef)(
410
+ var import_jsx_runtime8 = require("react/jsx-runtime");
411
+ var SelectButton = (0, import_react10.forwardRef)(
399
412
  (props, ref) => {
400
413
  var _a, _b, _c, _d, _e;
401
414
  const {
@@ -404,7 +417,7 @@ var SelectButton = (0, import_react9.forwardRef)(
404
417
  placeholder,
405
418
  isDisabled: isSelectDisabled
406
419
  } = useSelectContext();
407
- const context = (0, import_react9.useFormControlContext)();
420
+ const context = (0, import_react10.useFormControlContext)();
408
421
  const styles = useSelectStyles();
409
422
  const {
410
423
  isInvalid,
@@ -416,7 +429,7 @@ var SelectButton = (0, import_react9.forwardRef)(
416
429
  onBlur,
417
430
  onFocus
418
431
  } = context || {};
419
- const { rightIcon = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_core2.ChevronDownIcon, {}), ...rest } = props;
432
+ const { rightIcon = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_core2.ChevronDownIcon, {}), ...rest } = props;
420
433
  const focusStyles = (_a = styles.field) == null ? void 0 : _a._focusVisible;
421
434
  const readOnlyStyles = (_b = styles.field) == null ? void 0 : _b._readOnly;
422
435
  const invalid = (_c = styles.field) == null ? void 0 : _c._invalid;
@@ -438,9 +451,9 @@ var SelectButton = (0, import_react9.forwardRef)(
438
451
  h: "auto",
439
452
  ...props.sx
440
453
  };
441
- const buttonProps = (0, import_react9.useMenuButton)(rest, ref);
442
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
443
- import_react9.Button,
454
+ const buttonProps = (0, import_react10.useMenuButton)(rest, ref);
455
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
456
+ import_react10.Button,
444
457
  {
445
458
  ...buttonProps,
446
459
  sx: buttonStyles,
@@ -453,8 +466,8 @@ var SelectButton = (0, import_react9.forwardRef)(
453
466
  "data-focus": (0, import_utils3.dataAttr)(isFocused),
454
467
  "data-required": (0, import_utils3.dataAttr)(isRequired),
455
468
  rightIcon,
456
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
457
- import_react9.chakra.span,
469
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
470
+ import_react10.chakra.span,
458
471
  {
459
472
  __css: {
460
473
  display: "block",
@@ -472,16 +485,16 @@ var SelectButton = (0, import_react9.forwardRef)(
472
485
  }
473
486
  );
474
487
  SelectButton.displayName = "SelectButton";
475
- var Select = (0, import_react9.forwardRef)((props, ref) => {
488
+ var Select = (0, import_react10.forwardRef)((props, ref) => {
476
489
  const { name, children, isDisabled, multiple, ...rest } = props;
477
- const styles = (0, import_react9.useMultiStyleConfig)("SuiSelect", props);
478
- const menuProps = (0, import_react9.omitThemingProps)(rest);
490
+ const styles = (0, import_react10.useMultiStyleConfig)("SuiSelect", props);
491
+ const menuProps = (0, import_react10.omitThemingProps)(rest);
479
492
  const context = useSelect(props);
480
493
  const { value, controlProps } = context;
481
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SelectProvider, { value: context, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SelectStylesProvider, { value: styles, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react9.Menu, { ...menuProps, closeOnSelect: !multiple, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react9.chakra.div, { className: (0, import_utils3.cx)("sui-select"), children: [
494
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SelectProvider, { value: context, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SelectStylesProvider, { value: styles, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react10.Menu, { ...menuProps, closeOnSelect: !multiple, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react10.chakra.div, { className: (0, import_utils3.cx)("sui-select"), children: [
482
495
  children,
483
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
484
- import_react9.chakra.input,
496
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
497
+ import_react10.chakra.input,
485
498
  {
486
499
  ...controlProps,
487
500
  ref,
@@ -495,33 +508,33 @@ var Select = (0, import_react9.forwardRef)((props, ref) => {
495
508
  });
496
509
  var SelectList = (props) => {
497
510
  const { defaultValue, value, options, multiple, onChange } = useSelectContext();
498
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react9.MenuList, { maxH: "100vh", overflowY: "auto", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
499
- import_react9.MenuOptionGroup,
511
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react10.MenuList, { maxH: "100vh", overflowY: "auto", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
512
+ import_react10.MenuOptionGroup,
500
513
  {
501
514
  defaultValue: defaultValue || value,
502
515
  value,
503
516
  onChange,
504
517
  type: multiple ? "checkbox" : "radio",
505
- children: options ? options.map(({ value: value2, label, ...rest }, i) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SelectOption, { value: value2, ...rest, children: label || value2 }, i)) : props.children
518
+ children: options ? options.map(({ value: value2, label, ...rest }, i) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SelectOption, { value: value2, ...rest, children: label || value2 }, i)) : props.children
506
519
  }
507
520
  ) });
508
521
  };
509
522
  Select.displayName = "Select";
510
- var SelectOption = (0, import_react9.forwardRef)(
523
+ var SelectOption = (0, import_react10.forwardRef)(
511
524
  (props, ref) => {
512
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react9.MenuItemOption, { ref, ...props });
525
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react10.MenuItemOption, { ref, ...props });
513
526
  }
514
527
  );
515
528
  SelectOption.id = "MenuItemOption";
516
529
  SelectOption.displayName = "SelectOption";
517
530
 
518
531
  // src/select/native-select.tsx
519
- var import_react10 = require("@chakra-ui/react");
520
- var import_jsx_runtime8 = require("react/jsx-runtime");
521
- var NativeSelect = (0, import_react10.forwardRef)(
532
+ var import_react11 = require("@chakra-ui/react");
533
+ var import_jsx_runtime9 = require("react/jsx-runtime");
534
+ var NativeSelect = (0, import_react11.forwardRef)(
522
535
  ({ options, children, ...props }, ref) => {
523
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react10.Select, { ref, ...props, children: children || (options == null ? void 0 : options.map(({ value, label }) => {
524
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value, children: label || value }, value);
536
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react11.Select, { ref, ...props, children: children || (options == null ? void 0 : options.map(({ value, label }) => {
537
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value, children: label || value }, value);
525
538
  })) });
526
539
  }
527
540
  );
@@ -529,15 +542,15 @@ NativeSelect.displayName = "NativeSelect";
529
542
 
530
543
  // src/create-field.tsx
531
544
  var import_react_hook_form3 = require("react-hook-form");
532
- var import_react12 = require("@chakra-ui/react");
545
+ var import_react13 = require("@chakra-ui/react");
533
546
  var import_utils4 = require("@chakra-ui/utils");
534
- var import_utils5 = require("@saas-ui/core/utils");
547
+ var import_core4 = require("@saas-ui/core");
535
548
 
536
549
  // src/base-field.tsx
537
550
  var import_react_hook_form2 = require("react-hook-form");
538
- var import_react11 = require("@chakra-ui/react");
551
+ var import_react12 = require("@chakra-ui/react");
539
552
  var import_core3 = require("@saas-ui/core");
540
- var import_jsx_runtime9 = require("react/jsx-runtime");
553
+ var import_jsx_runtime10 = require("react/jsx-runtime");
541
554
  var getError = (name, formState) => {
542
555
  return (0, import_react_hook_form2.get)(formState.errors, name);
543
556
  };
@@ -565,21 +578,21 @@ var useBaseField = (props) => {
565
578
  };
566
579
  var BaseField = (props) => {
567
580
  const { controlProps, label, help, hideLabel, error } = useBaseField(props);
568
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react11.FormControl, { ...controlProps, isInvalid: !!error, children: [
569
- label && !hideLabel ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react11.FormLabel, { children: label }) : null,
570
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react11.Box, { children: [
581
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react12.FormControl, { ...controlProps, isInvalid: !!error, children: [
582
+ label && !hideLabel ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react12.FormLabel, { children: label }) : null,
583
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react12.Box, { children: [
571
584
  props.children,
572
- help && !(error == null ? void 0 : error.message) ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react11.FormHelperText, { children: help }) : null,
573
- (error == null ? void 0 : error.message) && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react11.FormErrorMessage, { children: error == null ? void 0 : error.message })
585
+ help && !(error == null ? void 0 : error.message) ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react12.FormHelperText, { children: help }) : null,
586
+ (error == null ? void 0 : error.message) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react12.FormErrorMessage, { children: error == null ? void 0 : error.message })
574
587
  ] })
575
588
  ] });
576
589
  };
577
590
  BaseField.displayName = "BaseField";
578
591
 
579
592
  // src/create-field.tsx
580
- var import_jsx_runtime10 = require("react/jsx-runtime");
593
+ var import_jsx_runtime11 = require("react/jsx-runtime");
581
594
  var _createField = (InputComponent, { displayName, hideLabel, getBaseField: getBaseFieldProp }) => {
582
- const Field2 = (0, import_react12.forwardRef)((props, ref) => {
595
+ const Field2 = (0, import_react13.forwardRef)((props, ref) => {
583
596
  var _a;
584
597
  const { id, name, label, isRequired, rules } = props;
585
598
  const inputRules = {
@@ -589,7 +602,7 @@ var _createField = (InputComponent, { displayName, hideLabel, getBaseField: getB
589
602
  const fieldContext = useFieldsContext();
590
603
  const getBaseField = (_a = fieldContext == null ? void 0 : fieldContext.getBaseField) != null ? _a : getBaseFieldProp;
591
604
  const { extraProps, BaseField: BaseField2 } = getBaseField();
592
- const [, inputProps] = (0, import_utils5.splitProps)(
605
+ const [, inputProps] = (0, import_core4.splitProps)(
593
606
  props,
594
607
  [
595
608
  "children",
@@ -602,7 +615,7 @@ var _createField = (InputComponent, { displayName, hideLabel, getBaseField: getB
602
615
  "help"
603
616
  ].concat(extraProps)
604
617
  );
605
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(BaseField2, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
618
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(BaseField2, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
606
619
  InputComponent,
607
620
  {
608
621
  ref,
@@ -618,24 +631,24 @@ var _createField = (InputComponent, { displayName, hideLabel, getBaseField: getB
618
631
  return Field2;
619
632
  };
620
633
  var withControlledInput = (InputComponent) => {
621
- return (0, import_react12.forwardRef)(
634
+ return (0, import_react13.forwardRef)(
622
635
  ({ name, rules, ...inputProps }, ref) => {
623
636
  const { control } = useFormContext();
624
637
  const onChange = inputProps.onChange;
625
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
638
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
626
639
  import_react_hook_form3.Controller,
627
640
  {
628
641
  name,
629
642
  control,
630
643
  rules,
631
- render: ({ field: { ref: _ref, ...field } }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
644
+ render: ({ field: { ref: _ref, ...field } }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
632
645
  InputComponent,
633
646
  {
634
647
  ...field,
635
648
  ...inputProps,
636
649
  onChange: (0, import_utils4.callAllHandlers)(onChange, field.onChange),
637
650
  onBlur: (0, import_utils4.callAllHandlers)(inputProps.onBlur, field.onBlur),
638
- ref: (0, import_react12.useMergeRefs)(ref, _ref)
651
+ ref: (0, import_react13.useMergeRefs)(ref, _ref)
639
652
  }
640
653
  )
641
654
  }
@@ -644,19 +657,19 @@ var withControlledInput = (InputComponent) => {
644
657
  );
645
658
  };
646
659
  var withUncontrolledInput = (InputComponent) => {
647
- return (0, import_react12.forwardRef)(
660
+ return (0, import_react13.forwardRef)(
648
661
  ({ name, rules, ...inputProps }, ref) => {
649
662
  const { register } = useFormContext();
650
663
  const { ref: _ref, ...field } = register(name, rules);
651
664
  const onChange = inputProps.onChange;
652
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
665
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
653
666
  InputComponent,
654
667
  {
655
668
  ...field,
656
669
  ...inputProps,
657
670
  onChange: (0, import_utils4.callAllHandlers)(onChange, field.onChange),
658
671
  onBlur: (0, import_utils4.callAllHandlers)(inputProps.onBlur, field.onBlur),
659
- ref: (0, import_react12.useMergeRefs)(ref, _ref)
672
+ ref: (0, import_react13.useMergeRefs)(ref, _ref)
660
673
  }
661
674
  );
662
675
  }
@@ -682,12 +695,12 @@ var createField = (component, options) => {
682
695
  };
683
696
 
684
697
  // src/default-fields.tsx
685
- var import_jsx_runtime11 = require("react/jsx-runtime");
698
+ var import_jsx_runtime12 = require("react/jsx-runtime");
686
699
  var InputField = createField(
687
- (0, import_react13.forwardRef)(({ type = "text", leftAddon, rightAddon, size, ...rest }, ref) => {
688
- const input = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react13.Input, { type, size, ...rest, ref });
700
+ (0, import_react14.forwardRef)(({ type = "text", leftAddon, rightAddon, size, ...rest }, ref) => {
701
+ const input = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react14.Input, { type, size, ...rest, ref });
689
702
  if (leftAddon || rightAddon) {
690
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react13.InputGroup, { size, children: [
703
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react14.InputGroup, { size, children: [
691
704
  leftAddon,
692
705
  input,
693
706
  rightAddon
@@ -703,23 +716,23 @@ var NumberInputField2 = createField(
703
716
  }
704
717
  );
705
718
  var PasswordInputField = createField(
706
- (0, import_react13.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PasswordInput, { ref, ...props }))
719
+ (0, import_react14.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PasswordInput, { ref, ...props }))
707
720
  );
708
- var TextareaField = createField(import_react13.Textarea);
721
+ var TextareaField = createField(import_react14.Textarea);
709
722
  var SwitchField = createField(
710
- (0, import_react13.forwardRef)(({ type, value, ...rest }, ref) => {
711
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react13.Switch, { isChecked: !!value, ...rest, ref });
723
+ (0, import_react14.forwardRef)(({ type, value, ...rest }, ref) => {
724
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react14.Switch, { isChecked: !!value, ...rest, ref });
712
725
  }),
713
726
  {
714
727
  isControlled: true
715
728
  }
716
729
  );
717
730
  var SelectField = createField(
718
- (0, import_react13.forwardRef)((props, ref) => {
731
+ (0, import_react14.forwardRef)((props, ref) => {
719
732
  const { buttonProps, listProps, ...rest } = props;
720
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Select, { ref, ...rest, children: [
721
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SelectButton, { ...buttonProps }),
722
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SelectList, { ...listProps })
733
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Select, { ref, ...rest, children: [
734
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SelectButton, { ...buttonProps }),
735
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SelectList, { ...listProps })
723
736
  ] });
724
737
  }),
725
738
  {
@@ -727,8 +740,8 @@ var SelectField = createField(
727
740
  }
728
741
  );
729
742
  var CheckboxField = createField(
730
- (0, import_react13.forwardRef)(({ label, type, ...props }, ref) => {
731
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react13.Checkbox, { ref, ...props, children: label });
743
+ (0, import_react14.forwardRef)(({ label, type, ...props }, ref) => {
744
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react14.Checkbox, { ref, ...props, children: label });
732
745
  }),
733
746
  {
734
747
  hideLabel: true
@@ -744,13 +757,13 @@ var NativeSelectField = createField(
744
757
  }
745
758
  );
746
759
  var PinField = createField(
747
- (0, import_react13.forwardRef)((props, ref) => {
760
+ (0, import_react14.forwardRef)((props, ref) => {
748
761
  const { pinLength = 4, pinType, spacing, ...inputProps } = props;
749
762
  const inputs = [];
750
763
  for (let i = 0; i < pinLength; i++) {
751
- inputs.push(/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react13.PinInputField, { ref }, i));
764
+ inputs.push(/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react14.PinInputField, { ref }, i));
752
765
  }
753
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react13.HStack, { spacing, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react13.PinInput, { ...inputProps, type: pinType, children: inputs }) });
766
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react14.HStack, { spacing, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react14.PinInput, { ...inputProps, type: pinType, children: inputs }) });
754
767
  }),
755
768
  {
756
769
  isControlled: true
@@ -772,28 +785,6 @@ var defaultFieldTypes = {
772
785
  "native-select": NativeSelectField
773
786
  };
774
787
 
775
- // src/fields-context.tsx
776
- var import_jsx_runtime12 = require("react/jsx-runtime");
777
- var FieldsContext = import_react14.default.createContext(null);
778
- var FieldsProvider = (props) => {
779
- const fields = { ...defaultFieldTypes, ...props.value.fields };
780
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
781
- FieldsContext.Provider,
782
- {
783
- value: { fields, getBaseField: props.value.getBaseField },
784
- children: props.children
785
- }
786
- );
787
- };
788
- var useFieldsContext = () => {
789
- return import_react14.default.useContext(FieldsContext);
790
- };
791
- var useField = (type) => {
792
- var _a;
793
- const context = import_react14.default.useContext(FieldsContext);
794
- return ((_a = context == null ? void 0 : context.fields) == null ? void 0 : _a[type]) || InputField;
795
- };
796
-
797
788
  // src/field.tsx
798
789
  var import_jsx_runtime13 = require("react/jsx-runtime");
799
790
  var defaultInputType = "text";
@@ -801,7 +792,7 @@ var Field = React6.forwardRef(
801
792
  (props, ref) => {
802
793
  const { type = defaultInputType, name } = props;
803
794
  const overrides = useFieldProps(name);
804
- const InputComponent = useField((overrides == null ? void 0 : overrides.type) || type);
795
+ const InputComponent = useField((overrides == null ? void 0 : overrides.type) || type, InputField);
805
796
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(InputComponent, { ref, ...props, ...overrides });
806
797
  }
807
798
  );
@@ -811,7 +802,7 @@ var React9 = __toESM(require("react"));
811
802
 
812
803
  // src/layout.tsx
813
804
  var import_react15 = require("@chakra-ui/react");
814
- var import_utils6 = require("@chakra-ui/utils");
805
+ var import_utils5 = require("@chakra-ui/utils");
815
806
  var import_jsx_runtime14 = require("react/jsx-runtime");
816
807
  var FormLayoutItem = ({ children }) => {
817
808
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react15.chakra.div, { children });
@@ -831,7 +822,7 @@ var FormLayout = ({ children, ...props }) => {
831
822
  import_react15.SimpleGrid,
832
823
  {
833
824
  ...gridProps,
834
- className: (0, import_utils6.cx)("sui-form__layout", props.className),
825
+ className: (0, import_utils5.cx)("sui-form__layout", props.className),
835
826
  children
836
827
  }
837
828
  );
@@ -913,7 +904,7 @@ var useArrayFieldAddButton = () => {
913
904
  };
914
905
 
915
906
  // src/array-field.tsx
916
- var import_utils8 = require("@chakra-ui/utils");
907
+ var import_utils7 = require("@chakra-ui/utils");
917
908
  var import_jsx_runtime15 = require("react/jsx-runtime");
918
909
  var ArrayFieldRow = ({
919
910
  children,
@@ -970,7 +961,7 @@ ArrayFieldAddButton.displayName = "ArrayFieldAddButton";
970
961
  var ArrayField = (0, import_react16.forwardRef)(
971
962
  (props, ref) => {
972
963
  const { children, ...containerProps } = props;
973
- const rowFn = (0, import_utils8.isFunction)(children) ? children : (fields) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jsx_runtime15.Fragment, { children: fields.map(({ id }, index) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ArrayFieldRow, { index, children }, id)) || null });
964
+ const rowFn = (0, import_utils7.isFunction)(children) ? children : (fields) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jsx_runtime15.Fragment, { children: fields.map(({ id }, index) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ArrayFieldRow, { index, children }, id)) || null });
974
965
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(ArrayFieldContainer, { ref, ...containerProps, children: [
975
966
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ArrayFieldRows, { children: rowFn }),
976
967
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ArrayFieldAddButton, {})
@@ -1188,13 +1179,13 @@ DisplayIf.displayName = "DisplayIf";
1188
1179
  // src/step-form.tsx
1189
1180
  var React12 = __toESM(require("react"));
1190
1181
  var import_react19 = require("@chakra-ui/react");
1191
- var import_utils10 = require("@chakra-ui/utils");
1192
- var import_core5 = require("@saas-ui/core");
1182
+ var import_utils9 = require("@chakra-ui/utils");
1183
+ var import_core6 = require("@saas-ui/core");
1193
1184
 
1194
1185
  // src/use-step-form.tsx
1195
1186
  var React11 = __toESM(require("react"));
1196
1187
  var import_react_utils3 = require("@chakra-ui/react-utils");
1197
- var import_core4 = require("@saas-ui/core");
1188
+ var import_core5 = require("@saas-ui/core");
1198
1189
  var [StepFormProvider, useStepFormContext] = (0, import_react_utils3.createContext)({
1199
1190
  name: "StepFormContext",
1200
1191
  errorMessage: "useStepFormContext: `context` is undefined. Seems you forgot to wrap step form components in `<StepForm />`"
@@ -1207,7 +1198,7 @@ function useStepForm(props) {
1207
1198
  fieldResolver,
1208
1199
  ...rest
1209
1200
  } = props;
1210
- const stepper = (0, import_core4.useStepper)(rest);
1201
+ const stepper = (0, import_core5.useStepper)(rest);
1211
1202
  const [options, setOptions] = React11.useState(stepsOptions);
1212
1203
  const { activeStep, isLastStep, nextStep } = stepper;
1213
1204
  const [steps, updateSteps] = React11.useState({});
@@ -1273,7 +1264,7 @@ function useStepForm(props) {
1273
1264
  }
1274
1265
  function useFormStep(props) {
1275
1266
  const { name, schema, resolver, onSubmit } = props;
1276
- const step = (0, import_core4.useStep)({ name });
1267
+ const step = (0, import_core5.useStep)({ name });
1277
1268
  const { steps, updateStep } = useStepFormContext();
1278
1269
  React11.useEffect(() => {
1279
1270
  updateStep({ name, schema, resolver, onSubmit });
@@ -1287,7 +1278,7 @@ function useFormStep(props) {
1287
1278
  // src/step-form.tsx
1288
1279
  var import_jsx_runtime19 = require("react/jsx-runtime");
1289
1280
  var FormStepper = (props) => {
1290
- const { activeIndex, setIndex } = (0, import_core5.useStepperContext)();
1281
+ const { activeIndex, setIndex } = (0, import_core6.useStepperContext)();
1291
1282
  const {
1292
1283
  children,
1293
1284
  orientation,
@@ -1302,7 +1293,7 @@ var FormStepper = (props) => {
1302
1293
  if (React12.isValidElement(child) && (child == null ? void 0 : child.type) === FormStep) {
1303
1294
  const { isCompleted } = useFormStep(child.props);
1304
1295
  return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1305
- import_core5.StepsItem,
1296
+ import_core6.StepsItem,
1306
1297
  {
1307
1298
  render,
1308
1299
  name: child.props.name,
@@ -1320,7 +1311,7 @@ var FormStepper = (props) => {
1320
1311
  onChangeProp == null ? void 0 : onChangeProp(i);
1321
1312
  }, []);
1322
1313
  return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1323
- import_core5.Steps,
1314
+ import_core6.Steps,
1324
1315
  {
1325
1316
  orientation,
1326
1317
  step: activeIndex,
@@ -1336,32 +1327,32 @@ var FormStep = (props) => {
1336
1327
  const { name, children, className, onSubmit, ...rest } = props;
1337
1328
  const step = useFormStep({ name, onSubmit });
1338
1329
  const { isActive } = step;
1339
- return isActive ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react19.chakra.div, { ...rest, className: (0, import_utils10.cx)("sui-form__step", className), children }) : null;
1330
+ return isActive ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react19.chakra.div, { ...rest, className: (0, import_utils9.cx)("sui-form__step", className), children }) : null;
1340
1331
  };
1341
1332
  FormStep.displayName = "FormStep";
1342
1333
  var PrevButton = (props) => {
1343
- const { isFirstStep, isCompleted, prevStep } = (0, import_core5.useStepperContext)();
1334
+ const { isFirstStep, isCompleted, prevStep } = (0, import_core6.useStepperContext)();
1344
1335
  return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1345
1336
  import_react19.Button,
1346
1337
  {
1347
1338
  isDisabled: isFirstStep || isCompleted,
1348
1339
  children: "Back",
1349
1340
  ...props,
1350
- className: (0, import_utils10.cx)("sui-form__prev-button", props.className),
1351
- onClick: (0, import_utils10.callAllHandlers)(props.onClick, prevStep)
1341
+ className: (0, import_utils9.cx)("sui-form__prev-button", props.className),
1342
+ onClick: (0, import_utils9.callAllHandlers)(props.onClick, prevStep)
1352
1343
  }
1353
1344
  );
1354
1345
  };
1355
1346
  PrevButton.displayName = "PrevButton";
1356
1347
  var NextButton = (props) => {
1357
1348
  const { label = "Next", submitLabel = "Complete", ...rest } = props;
1358
- const { isLastStep, isCompleted } = (0, import_core5.useStepperContext)();
1349
+ const { isLastStep, isCompleted } = (0, import_core6.useStepperContext)();
1359
1350
  return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1360
1351
  SubmitButton,
1361
1352
  {
1362
1353
  ...rest,
1363
1354
  isDisabled: isCompleted,
1364
- className: (0, import_utils10.cx)("sui-form__next-button", props.className),
1355
+ className: (0, import_utils9.cx)("sui-form__next-button", props.className),
1365
1356
  children: isLastStep || isCompleted ? submitLabel : label
1366
1357
  }
1367
1358
  );
@@ -1369,7 +1360,7 @@ var NextButton = (props) => {
1369
1360
  NextButton.displayName = "NextButton";
1370
1361
 
1371
1362
  // src/field-resolver.ts
1372
- var import_utils11 = require("@chakra-ui/utils");
1363
+ var import_utils10 = require("@chakra-ui/utils");
1373
1364
  var mapFields = (schema) => schema && Object.entries(schema).map(([name, props]) => {
1374
1365
  const { items, label, title, ...field } = props;
1375
1366
  return {
@@ -1385,7 +1376,7 @@ var objectFieldResolver = (schema) => {
1385
1376
  };
1386
1377
  const getNestedFields = (name) => {
1387
1378
  var _a;
1388
- const field = (0, import_utils11.get)(schema, name);
1379
+ const field = (0, import_utils10.get)(schema, name);
1389
1380
  if (!field)
1390
1381
  return [];
1391
1382
  if (((_a = field.items) == null ? void 0 : _a.type) === "object") {
@@ -1418,7 +1409,7 @@ var import_react21 = require("@chakra-ui/react");
1418
1409
  // src/form.tsx
1419
1410
  var React13 = __toESM(require("react"));
1420
1411
  var import_react20 = require("@chakra-ui/react");
1421
- var import_utils12 = require("@chakra-ui/utils");
1412
+ var import_utils11 = require("@chakra-ui/utils");
1422
1413
  var import_react_hook_form8 = require("react-hook-form");
1423
1414
  var import_jsx_runtime20 = require("react/jsx-runtime");
1424
1415
  var Form = (0, import_react20.forwardRef)(
@@ -1490,8 +1481,8 @@ var Form = (0, import_react20.forwardRef)(
1490
1481
  ref,
1491
1482
  onSubmit: handleSubmit(onSubmit, onError),
1492
1483
  ...rest,
1493
- className: (0, import_utils12.cx)("sui-form", props.className),
1494
- children: (0, import_utils12.runIfFn)(_children, {
1484
+ className: (0, import_utils11.cx)("sui-form", props.className),
1485
+ children: (0, import_utils11.runIfFn)(_children, {
1495
1486
  Field,
1496
1487
  DisplayIf,
1497
1488
  ArrayField,
@@ -1522,7 +1513,11 @@ function createForm({
1522
1513
  fieldResolver: fieldResolverProp,
1523
1514
  ...rest
1524
1515
  } = props;
1525
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(FieldsProvider, { value: { fields, getBaseField }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1516
+ const fieldsContext = {
1517
+ fields: { ...defaultFieldTypes, ...fields },
1518
+ getBaseField
1519
+ };
1520
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(FieldsProvider, { value: fieldsContext, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1526
1521
  Form,
1527
1522
  {
1528
1523
  ref,
@@ -1541,8 +1536,8 @@ function createForm({
1541
1536
  // src/create-step-form.tsx
1542
1537
  var import_react22 = require("react");
1543
1538
  var import_react23 = require("@chakra-ui/react");
1544
- var import_core6 = require("@saas-ui/core");
1545
- var import_utils13 = require("@chakra-ui/utils");
1539
+ var import_core7 = require("@saas-ui/core");
1540
+ var import_utils12 = require("@chakra-ui/utils");
1546
1541
  var import_jsx_runtime22 = require("react/jsx-runtime");
1547
1542
  function createStepForm({
1548
1543
  fields,
@@ -1559,7 +1554,14 @@ function createStepForm({
1559
1554
  });
1560
1555
  const { getFormProps, ...ctx } = stepper;
1561
1556
  const context = (0, import_react22.useMemo)(() => ctx, [ctx]);
1562
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_core6.StepperProvider, { value: context, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StepFormProvider, { value: context, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FieldsProvider, { value: { fields, getBaseField }, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Form, { ref, ...rest, ...getFormProps(), children: (0, import_utils13.runIfFn)(children, {
1557
+ const fieldsContext = {
1558
+ fields: {
1559
+ ...defaultFieldTypes,
1560
+ ...fields
1561
+ },
1562
+ getBaseField
1563
+ };
1564
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_core7.StepperProvider, { value: context, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StepFormProvider, { value: context, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FieldsProvider, { value: fieldsContext, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Form, { ref, ...rest, ...getFormProps(), children: (0, import_utils12.runIfFn)(children, {
1563
1565
  ...stepper,
1564
1566
  Field,
1565
1567
  FormStep,