shadcn-zod-formkit 1.27.2 → 1.27.4

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.cjs CHANGED
@@ -233,10 +233,14 @@ var entitiesToGroupedOption = (data, optionValue = "name") => {
233
233
  return entities;
234
234
  };
235
235
  var handleOnChage = (event, input, field) => {
236
- if (event) field?.onChange(event);
236
+ let value = event;
237
+ if (event && typeof event === "object" && "target" in event) {
238
+ value = event.target.value;
239
+ }
240
+ field?.onChange(value);
237
241
  const data = input.form?.getValues();
238
- input.onChange?.(event, data);
239
- if (input.onAnyFieldChange) input.onAnyFieldChange?.(data);
242
+ input.onChange?.(value, data);
243
+ input.onAnyFieldChange?.(data);
240
244
  };
241
245
  var isValidField = (input, form, defaultValue) => {
242
246
  const value = defaultValue ?? form.getValues(input.name);
@@ -5559,6 +5563,7 @@ var StringValueListInput = class extends BaseInput {
5559
5563
  };
5560
5564
  var FieldStringValueList = ({ form, input, isSubmitting }) => {
5561
5565
  const fieldName = input.name;
5566
+ const withAddBtn = input.withAddBtn ?? false;
5562
5567
  React3.useEffect(() => {
5563
5568
  const current = form.getValues(fieldName);
5564
5569
  if (!Array.isArray(current)) {
@@ -5622,7 +5627,7 @@ var FieldStringValueList = ({ form, input, isSubmitting }) => {
5622
5627
  },
5623
5628
  index
5624
5629
  )),
5625
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end mt-2", children: /* @__PURE__ */ jsxRuntime.jsx(
5630
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end mt-2", children: withAddBtn && /* @__PURE__ */ jsxRuntime.jsx(
5626
5631
  Button,
5627
5632
  {
5628
5633
  type: "button",
@@ -5663,9 +5668,10 @@ var FieldSwitch = ({ input, form, isSubmitting }) => {
5663
5668
  Switch,
5664
5669
  {
5665
5670
  checked: field.value,
5666
- onCheckedChange: (event) => handleOnChage(event, input, field),
5667
- "aria-disabled": true,
5668
- disabled: input.disabled || isSubmitting
5671
+ onCheckedChange: (event) => {
5672
+ handleOnChage(event, input, field);
5673
+ },
5674
+ disabled: false
5669
5675
  }
5670
5676
  ) })
5671
5677
  ] }) })