shadcn-zod-formkit 1.19.0 → 1.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -81,6 +81,7 @@ declare const inputFieldComp: InputTypes[];
81
81
  interface FieldProps<T = Record<string, any>> {
82
82
  name: keyof T;
83
83
  label: string;
84
+ onChange?: (...event: any[]) => void;
84
85
  tabLabelField?: string;
85
86
  childrenPosition?: 'up' | 'down';
86
87
  children?: ReactNode | ((item: any, index: number) => ReactNode);
package/dist/index.d.ts CHANGED
@@ -81,6 +81,7 @@ declare const inputFieldComp: InputTypes[];
81
81
  interface FieldProps<T = Record<string, any>> {
82
82
  name: keyof T;
83
83
  label: string;
84
+ onChange?: (...event: any[]) => void;
84
85
  tabLabelField?: string;
85
86
  childrenPosition?: 'up' | 'down';
86
87
  children?: ReactNode | ((item: any, index: number) => ReactNode);
package/dist/index.mjs CHANGED
@@ -1768,19 +1768,22 @@ function ButtonGroup({
1768
1768
  var ButtonGroupInput = class extends BaseInput {
1769
1769
  render() {
1770
1770
  const { input, form, isSubmitting } = this;
1771
- return /* @__PURE__ */ jsx(FieldButtonGroup, { input, form, isSubmitting });
1771
+ const className = input.className;
1772
+ return /* @__PURE__ */ jsx(FieldButtonGroup, { input, form, isSubmitting, className });
1772
1773
  }
1773
1774
  };
1774
- var FieldButtonGroup = ({ input, form, isSubmitting }) => {
1775
+ var FieldButtonGroup = ({ input, form, isSubmitting, className = "w-full flex-1" }) => {
1775
1776
  const options = (input.listConfig?.list ?? []).filter((option) => "name" in option);
1776
1777
  const handleSelect = (value) => {
1777
1778
  form.setValue(input.name, value, { shouldValidate: true });
1779
+ if (input.listConfig?.onOptionChange) input.listConfig.onOptionChange(value);
1778
1780
  };
1779
1781
  const selectedValue = form.watch(input.name);
1780
- return /* @__PURE__ */ jsx(ButtonGroup, { children: options.map((option) => /* @__PURE__ */ jsx(
1782
+ return /* @__PURE__ */ jsx(ButtonGroup, { className: "flex flex-row w-full", children: options.map((option) => /* @__PURE__ */ jsx(
1781
1783
  Button,
1782
1784
  {
1783
1785
  type: "button",
1786
+ className,
1784
1787
  variant: selectedValue === option.value ? "default" : "outline",
1785
1788
  onClick: () => handleSelect(option.value),
1786
1789
  disabled: isSubmitting,
@@ -3977,7 +3980,6 @@ var FieldFile = ({ form, input, isSubmitting }) => {
3977
3980
  if (file) {
3978
3981
  const objectUrl = URL.createObjectURL(file);
3979
3982
  setPreview(objectUrl);
3980
- console.log("\u{1F680} ~ handleFileChange ~ objectUrl:", objectUrl);
3981
3983
  } else {
3982
3984
  setPreview(null);
3983
3985
  }