@invana/forms 0.0.32 → 0.0.34

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.cts CHANGED
@@ -60,6 +60,17 @@ type ColorPreset = {
60
60
  * component's variants and defaults to `secondary` (neutral grey). Use
61
61
  * `default` for the solid accent ("on") pill.
62
62
  */
63
+ /**
64
+ * One choice of a `select`, `radio` or multi-select `checkbox` field. A
65
+ * `description` is drawn as a muted line under a radio's label; `disabled`
66
+ * shows the choice but stops it being picked (radio and select).
67
+ */
68
+ type FieldOption = {
69
+ label: string;
70
+ value: string;
71
+ description?: string;
72
+ disabled?: boolean;
73
+ };
63
74
  type FieldBadge = {
64
75
  label: string;
65
76
  variant?: 'default' | 'secondary' | 'destructive' | 'outline' | 'soft';
@@ -70,10 +81,12 @@ type FieldConfig = {
70
81
  label?: string;
71
82
  description?: string;
72
83
  placeholder?: string;
73
- options?: {
74
- label: string;
75
- value: string;
76
- }[];
84
+ options?: FieldOption[];
85
+ /**
86
+ * Shows the field and its value but stops it being changed. The value is
87
+ * still submitted. A `color` or `icon` field dims its label only.
88
+ */
89
+ disabled?: boolean;
77
90
  /**
78
91
  * Bounds of a `number` field. With both, it is a slider beside its number;
79
92
  * without, a typed number input that can carry a `unit` and an `aside`.
@@ -208,10 +221,9 @@ interface BaseFieldProps {
208
221
  placeholder?: string;
209
222
  value?: AnyValue;
210
223
  onChange?: (value: AnyValue) => void;
211
- options?: {
212
- label: string;
213
- value: string;
214
- }[];
224
+ options?: FieldOption[];
225
+ /** Shows the value but stops it being changed. */
226
+ disabled?: boolean;
215
227
  min?: number;
216
228
  max?: number;
217
229
  step?: number;
@@ -310,6 +322,7 @@ interface SliderNumberProps {
310
322
  min?: number;
311
323
  max?: number;
312
324
  step?: number;
325
+ disabled?: boolean;
313
326
  className?: string;
314
327
  }
315
328
  declare const SliderNumber: React$1.FC<SliderNumberProps>;
@@ -471,4 +484,4 @@ declare function InputGroupText({ className, ...props }: React$1.ComponentProps<
471
484
  declare function InputGroupInput({ className, ...props }: React$1.ComponentProps<"input">): React$1.JSX.Element;
472
485
  declare function InputGroupTextarea({ className, ...props }: React$1.ComponentProps<"textarea">): React$1.JSX.Element;
473
486
 
474
- export { type BooleanControl, BooleanField, Checkbox, CheckboxGroupField, ColorField, type ColorPreset, ColorSwatches, Field, type FieldBadge, type FieldConfig, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, type FieldOrientation, FieldSeparator, FieldSet, type FieldSize, FieldTitle, type FieldType, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, type GroupConfig, IconField, IconInput, Input, InputField, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, type InputSize, Label, type LabelPosition, NumberField, ObjectField, type ObjectFieldProps, PARAM_SOURCES, ParamRow, type ParamRowProps, type ParamSource, PasswordField, PasswordInput, type PasswordInputProps, RadioField, RadioGroup, RadioGroupItem, type RowConfig, Select, SelectContent, SelectField, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SettingsPanel, type SettingsPanelProps, Slider, SliderNumber, Switch, Textarea, TextareaField, useFormField };
487
+ export { type BooleanControl, BooleanField, Checkbox, CheckboxGroupField, ColorField, type ColorPreset, ColorSwatches, Field, type FieldBadge, type FieldConfig, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, type FieldOption, type FieldOrientation, FieldSeparator, FieldSet, type FieldSize, FieldTitle, type FieldType, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, type GroupConfig, IconField, IconInput, Input, InputField, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, type InputSize, Label, type LabelPosition, NumberField, ObjectField, type ObjectFieldProps, PARAM_SOURCES, ParamRow, type ParamRowProps, type ParamSource, PasswordField, PasswordInput, type PasswordInputProps, RadioField, RadioGroup, RadioGroupItem, type RowConfig, Select, SelectContent, SelectField, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SettingsPanel, type SettingsPanelProps, Slider, SliderNumber, Switch, Textarea, TextareaField, useFormField };
package/dist/index.d.ts CHANGED
@@ -60,6 +60,17 @@ type ColorPreset = {
60
60
  * component's variants and defaults to `secondary` (neutral grey). Use
61
61
  * `default` for the solid accent ("on") pill.
62
62
  */
63
+ /**
64
+ * One choice of a `select`, `radio` or multi-select `checkbox` field. A
65
+ * `description` is drawn as a muted line under a radio's label; `disabled`
66
+ * shows the choice but stops it being picked (radio and select).
67
+ */
68
+ type FieldOption = {
69
+ label: string;
70
+ value: string;
71
+ description?: string;
72
+ disabled?: boolean;
73
+ };
63
74
  type FieldBadge = {
64
75
  label: string;
65
76
  variant?: 'default' | 'secondary' | 'destructive' | 'outline' | 'soft';
@@ -70,10 +81,12 @@ type FieldConfig = {
70
81
  label?: string;
71
82
  description?: string;
72
83
  placeholder?: string;
73
- options?: {
74
- label: string;
75
- value: string;
76
- }[];
84
+ options?: FieldOption[];
85
+ /**
86
+ * Shows the field and its value but stops it being changed. The value is
87
+ * still submitted. A `color` or `icon` field dims its label only.
88
+ */
89
+ disabled?: boolean;
77
90
  /**
78
91
  * Bounds of a `number` field. With both, it is a slider beside its number;
79
92
  * without, a typed number input that can carry a `unit` and an `aside`.
@@ -208,10 +221,9 @@ interface BaseFieldProps {
208
221
  placeholder?: string;
209
222
  value?: AnyValue;
210
223
  onChange?: (value: AnyValue) => void;
211
- options?: {
212
- label: string;
213
- value: string;
214
- }[];
224
+ options?: FieldOption[];
225
+ /** Shows the value but stops it being changed. */
226
+ disabled?: boolean;
215
227
  min?: number;
216
228
  max?: number;
217
229
  step?: number;
@@ -310,6 +322,7 @@ interface SliderNumberProps {
310
322
  min?: number;
311
323
  max?: number;
312
324
  step?: number;
325
+ disabled?: boolean;
313
326
  className?: string;
314
327
  }
315
328
  declare const SliderNumber: React$1.FC<SliderNumberProps>;
@@ -471,4 +484,4 @@ declare function InputGroupText({ className, ...props }: React$1.ComponentProps<
471
484
  declare function InputGroupInput({ className, ...props }: React$1.ComponentProps<"input">): React$1.JSX.Element;
472
485
  declare function InputGroupTextarea({ className, ...props }: React$1.ComponentProps<"textarea">): React$1.JSX.Element;
473
486
 
474
- export { type BooleanControl, BooleanField, Checkbox, CheckboxGroupField, ColorField, type ColorPreset, ColorSwatches, Field, type FieldBadge, type FieldConfig, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, type FieldOrientation, FieldSeparator, FieldSet, type FieldSize, FieldTitle, type FieldType, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, type GroupConfig, IconField, IconInput, Input, InputField, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, type InputSize, Label, type LabelPosition, NumberField, ObjectField, type ObjectFieldProps, PARAM_SOURCES, ParamRow, type ParamRowProps, type ParamSource, PasswordField, PasswordInput, type PasswordInputProps, RadioField, RadioGroup, RadioGroupItem, type RowConfig, Select, SelectContent, SelectField, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SettingsPanel, type SettingsPanelProps, Slider, SliderNumber, Switch, Textarea, TextareaField, useFormField };
487
+ export { type BooleanControl, BooleanField, Checkbox, CheckboxGroupField, ColorField, type ColorPreset, ColorSwatches, Field, type FieldBadge, type FieldConfig, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, type FieldOption, type FieldOrientation, FieldSeparator, FieldSet, type FieldSize, FieldTitle, type FieldType, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, type GroupConfig, IconField, IconInput, Input, InputField, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, type InputSize, Label, type LabelPosition, NumberField, ObjectField, type ObjectFieldProps, PARAM_SOURCES, ParamRow, type ParamRowProps, type ParamSource, PasswordField, PasswordInput, type PasswordInputProps, RadioField, RadioGroup, RadioGroupItem, type RowConfig, Select, SelectContent, SelectField, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SettingsPanel, type SettingsPanelProps, Slider, SliderNumber, Switch, Textarea, TextareaField, useFormField };
package/dist/index.js CHANGED
@@ -618,6 +618,7 @@ var SliderNumber = ({
618
618
  min = 0,
619
619
  max = 100,
620
620
  step = 1,
621
+ disabled,
621
622
  className
622
623
  }) => {
623
624
  const [local, setLocal] = React2.useState(value);
@@ -639,6 +640,7 @@ var SliderNumber = ({
639
640
  min,
640
641
  max,
641
642
  step,
643
+ disabled,
642
644
  className: "flex-1"
643
645
  }
644
646
  ),
@@ -651,7 +653,8 @@ var SliderNumber = ({
651
653
  className: "h-8 w-16",
652
654
  min,
653
655
  max,
654
- step
656
+ step,
657
+ disabled
655
658
  }
656
659
  )
657
660
  ] });
@@ -753,13 +756,20 @@ function FieldLabel({
753
756
  label,
754
757
  badge,
755
758
  size,
759
+ disabled,
756
760
  className
757
761
  }) {
758
762
  if (!label && !badge) return null;
759
- return /* @__PURE__ */ jsxs(FormLabel, { className: cn(SIZE[size].label, SIZE[size].fieldLabel, className), children: [
760
- label,
761
- badge && /* @__PURE__ */ jsx(StatusPill, { badge })
762
- ] });
763
+ return /* @__PURE__ */ jsxs(
764
+ FormLabel,
765
+ {
766
+ className: cn(SIZE[size].label, SIZE[size].fieldLabel, disabled && "opacity-70", className),
767
+ children: [
768
+ label,
769
+ badge && /* @__PURE__ */ jsx(StatusPill, { badge })
770
+ ]
771
+ }
772
+ );
763
773
  }
764
774
  var AffixedInput = React2.forwardRef(({ unit, aside, className, ...props }, ref) => {
765
775
  if (!unit && !aside) return /* @__PURE__ */ jsx(Input, { ref, className, ...props });
@@ -784,9 +794,10 @@ var InputField = ({
784
794
  size = "sm",
785
795
  labelClassName,
786
796
  badge,
787
- className
797
+ className,
798
+ disabled
788
799
  }) => /* @__PURE__ */ jsxs(FormItem, { className: itemClasses(labelPosition, size, className), children: [
789
- /* @__PURE__ */ jsx(FieldLabel, { label, badge, size, className: labelClassName }),
800
+ /* @__PURE__ */ jsx(FieldLabel, { label, badge, size, disabled, className: labelClassName }),
790
801
  /* @__PURE__ */ jsxs("div", { className: inputWrapper(labelPosition, size), children: [
791
802
  /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
792
803
  AffixedInput,
@@ -795,6 +806,7 @@ var InputField = ({
795
806
  unit,
796
807
  aside,
797
808
  placeholder,
809
+ disabled,
798
810
  value: value ?? "",
799
811
  onChange: (e) => onChange?.(e.target.value)
800
812
  }
@@ -813,15 +825,17 @@ var PasswordField = ({
813
825
  size = "sm",
814
826
  labelClassName,
815
827
  badge,
816
- className
828
+ className,
829
+ disabled
817
830
  }) => /* @__PURE__ */ jsxs(FormItem, { className: itemClasses(labelPosition, size, className), children: [
818
- /* @__PURE__ */ jsx(FieldLabel, { label, badge, size, className: labelClassName }),
831
+ /* @__PURE__ */ jsx(FieldLabel, { label, badge, size, disabled, className: labelClassName }),
819
832
  /* @__PURE__ */ jsxs("div", { className: inputWrapper(labelPosition, size), children: [
820
833
  /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
821
834
  PasswordInput,
822
835
  {
823
836
  className: SIZE[size].input,
824
837
  placeholder,
838
+ disabled,
825
839
  value: value ?? "",
826
840
  onChange: (e) => onChange?.(e.target.value)
827
841
  }
@@ -841,9 +855,10 @@ var TextareaField = ({
841
855
  size = "sm",
842
856
  labelClassName,
843
857
  badge,
844
- className
858
+ className,
859
+ disabled
845
860
  }) => /* @__PURE__ */ jsxs(FormItem, { className: itemClasses(labelPosition, size, className), children: [
846
- /* @__PURE__ */ jsx(FieldLabel, { label, badge, size, className: labelClassName }),
861
+ /* @__PURE__ */ jsx(FieldLabel, { label, badge, size, disabled, className: labelClassName }),
847
862
  /* @__PURE__ */ jsxs("div", { className: inputWrapper(labelPosition, size), children: [
848
863
  /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
849
864
  Textarea,
@@ -851,6 +866,7 @@ var TextareaField = ({
851
866
  className: SIZE[size].textarea || void 0,
852
867
  rows,
853
868
  placeholder,
869
+ disabled,
854
870
  value: value ?? "",
855
871
  onChange: (e) => onChange?.(e.target.value)
856
872
  }
@@ -870,13 +886,14 @@ var SelectField = ({
870
886
  size = "sm",
871
887
  labelClassName,
872
888
  badge,
873
- className
889
+ className,
890
+ disabled
874
891
  }) => /* @__PURE__ */ jsxs(FormItem, { className: itemClasses(labelPosition, size, className), children: [
875
- /* @__PURE__ */ jsx(FieldLabel, { label, badge, size, className: labelClassName }),
892
+ /* @__PURE__ */ jsx(FieldLabel, { label, badge, size, disabled, className: labelClassName }),
876
893
  /* @__PURE__ */ jsxs("div", { className: inputWrapper(labelPosition, size), children: [
877
- /* @__PURE__ */ jsxs(Select, { value: value ?? "", onValueChange: onChange, children: [
894
+ /* @__PURE__ */ jsxs(Select, { value: value ?? "", onValueChange: onChange, disabled, children: [
878
895
  /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(SelectTrigger, { className: SIZE[size].select, children: /* @__PURE__ */ jsx(SelectValue, { placeholder }) }) }),
879
- /* @__PURE__ */ jsx(SelectContent, { children: options.map((o) => /* @__PURE__ */ jsx(SelectItem, { value: o.value, children: o.label }, o.value)) })
896
+ /* @__PURE__ */ jsx(SelectContent, { children: options.map((o) => /* @__PURE__ */ jsx(SelectItem, { value: o.value, disabled: o.disabled, children: o.label }, o.value)) })
880
897
  ] }),
881
898
  description && /* @__PURE__ */ jsx(FormDescription, { className: SIZE[size].desc, children: description }),
882
899
  /* @__PURE__ */ jsx(FormMessage, { className: SIZE[size].desc })
@@ -893,37 +910,53 @@ var BooleanField = ({
893
910
  labelClassName,
894
911
  badge,
895
912
  className,
896
- boxed = false
913
+ boxed = false,
914
+ disabled
897
915
  }) => {
898
916
  const boxClass = boxed ? "rounded-md border p-2" : "";
899
917
  if (control === "checkbox") {
900
- return /* @__PURE__ */ jsxs(FormItem, { className: cn("flex items-center gap-2 space-y-0", className), children: [
901
- /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
902
- Checkbox,
903
- {
904
- className: SIZE[size].check,
905
- checked: !!value,
906
- onCheckedChange: onChange
907
- }
908
- ) }),
909
- /* @__PURE__ */ jsx(
910
- FieldLabel,
911
- {
912
- label,
913
- badge,
914
- size,
915
- className: cn(
916
- "!mt-0 cursor-pointer font-normal leading-none",
917
- labelClassName
918
- )
919
- }
920
- )
921
- ] });
918
+ return /* @__PURE__ */ jsxs(
919
+ FormItem,
920
+ {
921
+ className: cn(
922
+ "flex gap-2 space-y-0",
923
+ description ? "items-start" : "items-center",
924
+ className
925
+ ),
926
+ children: [
927
+ /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
928
+ Checkbox,
929
+ {
930
+ className: SIZE[size].check,
931
+ checked: !!value,
932
+ disabled,
933
+ onCheckedChange: onChange
934
+ }
935
+ ) }),
936
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
937
+ /* @__PURE__ */ jsx(
938
+ FieldLabel,
939
+ {
940
+ label,
941
+ badge,
942
+ size,
943
+ disabled,
944
+ className: cn(
945
+ "!mt-0 cursor-pointer font-normal leading-none",
946
+ labelClassName
947
+ )
948
+ }
949
+ ),
950
+ description && /* @__PURE__ */ jsx(FormDescription, { className: SIZE[size].desc, children: description })
951
+ ] })
952
+ ]
953
+ }
954
+ );
922
955
  }
923
956
  if (labelPosition === "side") {
924
957
  return /* @__PURE__ */ jsxs(FormItem, { className: cn("flex items-center justify-between", boxClass), children: [
925
958
  /* @__PURE__ */ jsxs("div", { children: [
926
- /* @__PURE__ */ jsx(FieldLabel, { label, badge, size, className: labelClassName }),
959
+ /* @__PURE__ */ jsx(FieldLabel, { label, badge, size, disabled, className: labelClassName }),
927
960
  description && /* @__PURE__ */ jsx(FormDescription, { className: SIZE[size].desc, children: description })
928
961
  ] }),
929
962
  /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
@@ -931,19 +964,21 @@ var BooleanField = ({
931
964
  {
932
965
  className: SIZE[size].switch || void 0,
933
966
  checked: !!value,
967
+ disabled,
934
968
  onCheckedChange: onChange
935
969
  }
936
970
  ) })
937
971
  ] });
938
972
  }
939
973
  return /* @__PURE__ */ jsxs(FormItem, { className: SIZE[size].stack, children: [
940
- /* @__PURE__ */ jsx(FieldLabel, { label, badge, size, className: labelClassName }),
974
+ /* @__PURE__ */ jsx(FieldLabel, { label, badge, size, disabled, className: labelClassName }),
941
975
  /* @__PURE__ */ jsxs("div", { className: cn("flex items-center justify-between", boxClass), children: [
942
976
  /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
943
977
  Switch,
944
978
  {
945
979
  className: SIZE[size].switch || void 0,
946
980
  checked: !!value,
981
+ disabled,
947
982
  onCheckedChange: onChange
948
983
  }
949
984
  ) }),
@@ -962,33 +997,46 @@ var RadioField = ({
962
997
  orientation = "vertical",
963
998
  labelClassName,
964
999
  badge,
965
- className
1000
+ className,
1001
+ disabled
966
1002
  }) => /* @__PURE__ */ jsxs(FormItem, { className: itemClasses(labelPosition, size, className), children: [
967
- /* @__PURE__ */ jsx(FieldLabel, { label, badge, size, className: labelClassName }),
1003
+ /* @__PURE__ */ jsx(FieldLabel, { label, badge, size, disabled, className: labelClassName }),
968
1004
  /* @__PURE__ */ jsxs("div", { className: inputWrapper(labelPosition, size), children: [
969
1005
  /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
970
1006
  RadioGroup,
971
1007
  {
972
1008
  value: value ?? "",
973
1009
  onValueChange: onChange,
1010
+ disabled,
974
1011
  className: orientation === "horizontal" ? "flex flex-row items-center gap-x-4" : cn("flex flex-col", SIZE[size].stack),
975
- children: options.map((o) => /* @__PURE__ */ jsxs(
976
- "label",
977
- {
978
- className: "flex cursor-pointer items-center gap-2",
979
- children: [
980
- /* @__PURE__ */ jsx(
981
- RadioGroupItem,
982
- {
983
- value: o.value,
984
- className: cn("shrink-0", SIZE[size].radio)
985
- }
1012
+ children: options.map((o) => {
1013
+ const off = disabled || o.disabled;
1014
+ return /* @__PURE__ */ jsxs(
1015
+ "label",
1016
+ {
1017
+ className: cn(
1018
+ "flex gap-2",
1019
+ o.description ? "items-start" : "items-center",
1020
+ off ? "cursor-not-allowed" : "cursor-pointer"
986
1021
  ),
987
- /* @__PURE__ */ jsx("span", { className: cn("leading-none", SIZE[size].label), children: o.label })
988
- ]
989
- },
990
- o.value
991
- ))
1022
+ children: [
1023
+ /* @__PURE__ */ jsx(
1024
+ RadioGroupItem,
1025
+ {
1026
+ value: o.value,
1027
+ disabled: o.disabled,
1028
+ className: cn("shrink-0", SIZE[size].radio)
1029
+ }
1030
+ ),
1031
+ /* @__PURE__ */ jsxs("span", { className: cn("flex flex-col gap-1", off && "opacity-50"), children: [
1032
+ /* @__PURE__ */ jsx("span", { className: cn(o.description ? "leading-4" : "leading-none", SIZE[size].label), children: o.label }),
1033
+ o.description && /* @__PURE__ */ jsx("span", { className: cn("text-muted-foreground", SIZE[size].desc), children: o.description })
1034
+ ] })
1035
+ ]
1036
+ },
1037
+ o.value
1038
+ );
1039
+ })
992
1040
  }
993
1041
  ) }),
994
1042
  description && /* @__PURE__ */ jsx(FormDescription, { className: SIZE[size].desc, children: description }),
@@ -1006,12 +1054,13 @@ var CheckboxGroupField = ({
1006
1054
  orientation = "vertical",
1007
1055
  labelClassName,
1008
1056
  badge,
1009
- className
1057
+ className,
1058
+ disabled
1010
1059
  }) => {
1011
1060
  const selected = Array.isArray(value) ? value : [];
1012
1061
  const toggle = (v, checked) => onChange?.(checked ? [...selected, v] : selected.filter((x) => x !== v));
1013
1062
  return /* @__PURE__ */ jsxs(FormItem, { className: itemClasses(labelPosition, size, className), children: [
1014
- /* @__PURE__ */ jsx(FieldLabel, { label, badge, size, className: labelClassName }),
1063
+ /* @__PURE__ */ jsx(FieldLabel, { label, badge, size, disabled, className: labelClassName }),
1015
1064
  /* @__PURE__ */ jsxs("div", { className: inputWrapper(labelPosition, size), children: [
1016
1065
  /* @__PURE__ */ jsx(
1017
1066
  "div",
@@ -1027,6 +1076,7 @@ var CheckboxGroupField = ({
1027
1076
  {
1028
1077
  className: cn("shrink-0", SIZE[size].check),
1029
1078
  checked: selected.includes(o.value),
1079
+ disabled: disabled || o.disabled,
1030
1080
  onCheckedChange: (c) => toggle(o.value, c === true)
1031
1081
  }
1032
1082
  ),
@@ -1053,9 +1103,10 @@ var ColorField = ({
1053
1103
  size = "sm",
1054
1104
  labelClassName,
1055
1105
  badge,
1056
- className
1106
+ className,
1107
+ disabled
1057
1108
  }) => /* @__PURE__ */ jsxs(FormItem, { className: itemClasses(labelPosition, size, className), children: [
1058
- /* @__PURE__ */ jsx(FieldLabel, { label, badge, size, className: labelClassName }),
1109
+ /* @__PURE__ */ jsx(FieldLabel, { label, badge, size, disabled, className: labelClassName }),
1059
1110
  /* @__PURE__ */ jsxs("div", { className: inputWrapper(labelPosition, size), children: [
1060
1111
  /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
1061
1112
  ColorSwatches,
@@ -1084,9 +1135,10 @@ var NumberField = ({
1084
1135
  size = "sm",
1085
1136
  labelClassName,
1086
1137
  badge,
1087
- className
1138
+ className,
1139
+ disabled
1088
1140
  }) => /* @__PURE__ */ jsxs(FormItem, { className: itemClasses(labelPosition, size, className), children: [
1089
- /* @__PURE__ */ jsx(FieldLabel, { label, badge, size, className: labelClassName }),
1141
+ /* @__PURE__ */ jsx(FieldLabel, { label, badge, size, disabled, className: labelClassName }),
1090
1142
  /* @__PURE__ */ jsxs("div", { className: inputWrapper(labelPosition, size), children: [
1091
1143
  /* @__PURE__ */ jsx(FormControl, { children: min != null && max != null ? /* @__PURE__ */ jsx(
1092
1144
  SliderNumber,
@@ -1095,7 +1147,8 @@ var NumberField = ({
1095
1147
  onChange,
1096
1148
  min,
1097
1149
  max,
1098
- step
1150
+ step,
1151
+ disabled
1099
1152
  }
1100
1153
  ) : /* @__PURE__ */ jsx(
1101
1154
  AffixedInput,
@@ -1107,6 +1160,7 @@ var NumberField = ({
1107
1160
  min,
1108
1161
  max,
1109
1162
  step,
1163
+ disabled,
1110
1164
  value: typeof value === "number" ? value : "",
1111
1165
  onChange: (e) => onChange?.(e.target.value === "" ? void 0 : Number(e.target.value))
1112
1166
  }
@@ -1124,9 +1178,10 @@ var IconField = ({
1124
1178
  size = "sm",
1125
1179
  labelClassName,
1126
1180
  badge,
1127
- className
1181
+ className,
1182
+ disabled
1128
1183
  }) => /* @__PURE__ */ jsxs(FormItem, { className: itemClasses(labelPosition, size, className), children: [
1129
- /* @__PURE__ */ jsx(FieldLabel, { label, badge, size, className: labelClassName }),
1184
+ /* @__PURE__ */ jsx(FieldLabel, { label, badge, size, disabled, className: labelClassName }),
1130
1185
  /* @__PURE__ */ jsxs("div", { className: inputWrapper(labelPosition, size), children: [
1131
1186
  /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(IconInput, { value, onChange }) }),
1132
1187
  description && /* @__PURE__ */ jsx(FormDescription, { className: SIZE[size].desc, children: description }),
@@ -1149,6 +1204,7 @@ function renderField(field, parentName, control, labelPosition, size) {
1149
1204
  label: field.label ?? humanize(field.name),
1150
1205
  description: field.description,
1151
1206
  options: field.options,
1207
+ disabled: field.disabled,
1152
1208
  min: field.min,
1153
1209
  max: field.max,
1154
1210
  step: field.step,
@@ -1313,66 +1369,70 @@ var ObjectField = ({
1313
1369
  const groupConfigById = new Map(
1314
1370
  (groupConfig ?? []).map((g) => [g.id, g])
1315
1371
  );
1316
- return /* @__PURE__ */ jsxs("div", { className: SIZE[size].outer, children: [
1317
- ungrouped.length > 0 && /* @__PURE__ */ jsx("div", { className: SIZE[size].section, children: renderRows(
1318
- ungrouped,
1319
- rowConfig,
1320
- name,
1321
- control,
1322
- labelPosition,
1323
- size,
1324
- columns,
1325
- fit
1326
- ) }),
1327
- groupedEntries.length > 0 && groupAs === "section" && /* @__PURE__ */ jsx("div", { className: SIZE[size].section, children: groupedEntries.map(([group, gFields]) => /* @__PURE__ */ jsxs("section", { className: SIZE[size].stack, children: [
1328
- /* @__PURE__ */ jsx(Eyebrow, { children: groupConfigById.get(group)?.label ?? humanize(group) }),
1329
- renderRows(gFields, rowConfig, name, control, labelPosition, size, columns, fit)
1330
- ] }, group)) }),
1331
- groupedEntries.length > 0 && groupAs === "accordion" && /* @__PURE__ */ jsx(
1332
- Accordion,
1333
- {
1334
- type: "multiple",
1335
- defaultValue: groupedEntries.map(([k]) => k),
1336
- className: "w-full",
1337
- children: groupedEntries.map(([group, gFields]) => {
1338
- const gc = groupConfigById.get(group);
1339
- return /* @__PURE__ */ jsxs(AccordionItem, { value: group, className: "border-b", children: [
1340
- /* @__PURE__ */ jsx(
1341
- AccordionTrigger,
1342
- {
1343
- className: cn(
1344
- "font-semibold uppercase tracking-wide text-muted-foreground hover:no-underline",
1345
- SIZE[size].trigger
1346
- ),
1347
- children: /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
1348
- gc?.label ?? humanize(group),
1349
- (gc?.showCount ?? true) && /* @__PURE__ */ jsx(
1350
- Badge,
1351
- {
1352
- variant: "secondary",
1353
- className: "px-1.5 py-0 text-base font-normal tabular-nums",
1354
- children: gFields.length
1355
- }
1372
+ return (
1373
+ // A container has no width of its own, so one fitted to it takes its
1374
+ // parent's: in a row beside a button it would otherwise shrink to nothing.
1375
+ /* @__PURE__ */ jsxs("div", { className: cn(SIZE[size].outer, fit === "container" && "w-full min-w-0"), children: [
1376
+ ungrouped.length > 0 && /* @__PURE__ */ jsx("div", { className: SIZE[size].section, children: renderRows(
1377
+ ungrouped,
1378
+ rowConfig,
1379
+ name,
1380
+ control,
1381
+ labelPosition,
1382
+ size,
1383
+ columns,
1384
+ fit
1385
+ ) }),
1386
+ groupedEntries.length > 0 && groupAs === "section" && /* @__PURE__ */ jsx("div", { className: SIZE[size].section, children: groupedEntries.map(([group, gFields]) => /* @__PURE__ */ jsxs("section", { className: SIZE[size].stack, children: [
1387
+ /* @__PURE__ */ jsx(Eyebrow, { children: groupConfigById.get(group)?.label ?? humanize(group) }),
1388
+ renderRows(gFields, rowConfig, name, control, labelPosition, size, columns, fit)
1389
+ ] }, group)) }),
1390
+ groupedEntries.length > 0 && groupAs === "accordion" && /* @__PURE__ */ jsx(
1391
+ Accordion,
1392
+ {
1393
+ type: "multiple",
1394
+ defaultValue: groupedEntries.map(([k]) => k),
1395
+ className: "w-full",
1396
+ children: groupedEntries.map(([group, gFields]) => {
1397
+ const gc = groupConfigById.get(group);
1398
+ return /* @__PURE__ */ jsxs(AccordionItem, { value: group, className: "border-b", children: [
1399
+ /* @__PURE__ */ jsx(
1400
+ AccordionTrigger,
1401
+ {
1402
+ className: cn(
1403
+ "font-semibold uppercase tracking-wide text-muted-foreground hover:no-underline",
1404
+ SIZE[size].trigger
1356
1405
  ),
1357
- gc?.badges?.map((b, i) => /* @__PURE__ */ jsx(StatusPill, { badge: b }, i))
1358
- ] })
1359
- }
1360
- ),
1361
- /* @__PURE__ */ jsx(AccordionContent, { className: "pb-3 pt-1", children: /* @__PURE__ */ jsx("div", { className: SIZE[size].section, children: renderRows(
1362
- gFields,
1363
- rowConfig,
1364
- name,
1365
- control,
1366
- labelPosition,
1367
- size,
1368
- columns,
1369
- fit
1370
- ) }) })
1371
- ] }, group);
1372
- })
1373
- }
1374
- )
1375
- ] });
1406
+ children: /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
1407
+ gc?.label ?? humanize(group),
1408
+ (gc?.showCount ?? true) && /* @__PURE__ */ jsx(
1409
+ Badge,
1410
+ {
1411
+ variant: "secondary",
1412
+ className: "px-1.5 py-0 text-base font-normal tabular-nums",
1413
+ children: gFields.length
1414
+ }
1415
+ ),
1416
+ gc?.badges?.map((b, i) => /* @__PURE__ */ jsx(StatusPill, { badge: b }, i))
1417
+ ] })
1418
+ }
1419
+ ),
1420
+ /* @__PURE__ */ jsx(AccordionContent, { className: "pb-3 pt-1", children: /* @__PURE__ */ jsx("div", { className: SIZE[size].section, children: renderRows(
1421
+ gFields,
1422
+ rowConfig,
1423
+ name,
1424
+ control,
1425
+ labelPosition,
1426
+ size,
1427
+ columns,
1428
+ fit
1429
+ ) }) })
1430
+ ] }, group);
1431
+ })
1432
+ }
1433
+ )
1434
+ ] })
1435
+ );
1376
1436
  };
1377
1437
  var FormField2 = Object.assign(FormField, {
1378
1438
  ObjectField,