@timeax/form-palette 0.0.16 → 0.0.18

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
@@ -8,7 +8,6 @@ import { DayPicker } from 'react-day-picker';
8
8
  import * as class_variance_authority_types from 'class-variance-authority/types';
9
9
  import { VariantProps } from 'class-variance-authority';
10
10
  import * as SwitchPrimitive from '@radix-ui/react-switch';
11
- import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
12
11
  import { $ZodError } from 'zod/v4/core';
13
12
  import './../../../../node_modules/@inertiajs/core/types/types.d';
14
13
  import 'axios';
@@ -1868,9 +1867,7 @@ interface ShadcnToggleUiProps extends Omit<React.ComponentProps<typeof Switch>,
1868
1867
  * We only pick value/onValue/error from the variant base props;
1869
1868
  * everything else (id, disabled, aria-*) flows via Switch props.
1870
1869
  */
1871
- type ShadcnToggleVariantProps = ShadcnToggleUiProps & Pick<BaseProps, "value" | "onValue" | "error">;
1872
-
1873
- declare function RadioGroup({ className, ...props }: React.ComponentProps<typeof RadioGroupPrimitive.Root>): react_jsx_runtime.JSX.Element;
1870
+ type ShadcnToggleVariantProps$1 = ShadcnToggleUiProps & Pick<BaseProps, "value" | "onValue" | "error">;
1874
1871
 
1875
1872
  /**
1876
1873
  * Visual size of the radio UI.
@@ -1919,6 +1916,7 @@ interface RadioRenderOptionContext<TValue> {
1919
1916
  disabled: boolean;
1920
1917
  size: RadioSize;
1921
1918
  density: RadioDensity;
1919
+ click(): void;
1922
1920
  /**
1923
1921
  * DOM id of this option (tied to the underlying RadioGroupItem).
1924
1922
  */
@@ -1956,7 +1954,7 @@ interface ShadcnRadioUiProps<TItem, TValue> {
1956
1954
  * items = [{ id: "free", title: "Free" }]
1957
1955
  * optionValue = "id"
1958
1956
  */
1959
- optionValue?: keyof TItem;
1957
+ optionValue?: (keyof TItem) | string;
1960
1958
  /**
1961
1959
  * Property name on TItem that holds the **label**.
1962
1960
  *
@@ -1964,7 +1962,7 @@ interface ShadcnRadioUiProps<TItem, TValue> {
1964
1962
  * items = [{ id: "free", title: "Free" }]
1965
1963
  * optionLabel = "title"
1966
1964
  */
1967
- optionLabel?: keyof TItem;
1965
+ optionLabel?: (keyof TItem) | string;
1968
1966
  /**
1969
1967
  * Optional custom renderer for each option.
1970
1968
  *
@@ -2027,8 +2025,9 @@ interface ShadcnRadioUiProps<TItem, TValue> {
2027
2025
  /**
2028
2026
  * Full props for the Shadcn-based radio variant.
2029
2027
  */
2030
- type ShadcnRadioVariantProps<TValue, TItem = RadioItem<TValue>> = ShadcnRadioUiProps<TItem, TValue> & Pick<VariantBaseProps<TValue | undefined>, "value" | "onValue" | "error" | "disabled" | "required"> & Pick<React.ComponentProps<typeof RadioGroup>, "name"> & {
2028
+ type ShadcnRadioVariantProps<TValue, TItem = RadioItem<TValue>> = ShadcnRadioUiProps<TItem, TValue> & Pick<VariantBaseProps<TValue | undefined>, "value" | "onValue" | "error" | "disabled" | "required"> & {
2031
2029
  id?: string;
2030
+ name?: string;
2032
2031
  className?: string;
2033
2032
  "aria-describedby"?: string;
2034
2033
  };
@@ -2094,6 +2093,7 @@ interface CheckboxRenderOptionContext<TValue> {
2094
2093
  size: CheckboxSize;
2095
2094
  density: CheckboxDensity;
2096
2095
  checkboxId?: string;
2096
+ click(): void;
2097
2097
  /**
2098
2098
  * Prebuilt Shadcn checkbox node.
2099
2099
  */
@@ -2354,6 +2354,7 @@ interface ShadcnMultiSelectVariantProps extends Pick<VariantBaseProps<SelectPrim
2354
2354
  selected: boolean;
2355
2355
  index: number;
2356
2356
  option: React.ReactNode;
2357
+ click(): void;
2357
2358
  }) => React.ReactNode;
2358
2359
  /**
2359
2360
  * Custom renderer for the trigger summary.
@@ -2760,6 +2761,7 @@ interface ShadcnTreeSelectVariantProps extends Pick<VariantBaseProps<TreeValue>,
2760
2761
  selected: boolean;
2761
2762
  index: number;
2762
2763
  option: React.ReactNode;
2764
+ click(): void;
2763
2765
  }) => React.ReactNode;
2764
2766
  renderValue?: (ctx: {
2765
2767
  selectedItems: NormalizedTreeItem[];
@@ -2974,6 +2976,7 @@ interface ShadcnSelectVariantProps extends Pick<VariantBaseProps<SelectPrimitive
2974
2976
  selected: boolean;
2975
2977
  index: number;
2976
2978
  option: React.ReactNode;
2979
+ click(): void;
2977
2980
  }) => React.ReactNode;
2978
2981
  /**
2979
2982
  * Custom renderer for the trigger value.
@@ -3058,6 +3061,103 @@ interface ShadcnSelectVariantProps extends Pick<VariantBaseProps<SelectPrimitive
3058
3061
 
3059
3062
  type SelectVariantProps = ShadcnSelectVariantProps;
3060
3063
 
3064
+ interface ToggleOption {
3065
+ label: React.ReactNode;
3066
+ value: string;
3067
+ icon?: React.ReactNode;
3068
+ disabled?: boolean;
3069
+ tooltip?: React.ReactNode;
3070
+ meta?: any;
3071
+ }
3072
+ /**
3073
+ * Allow primitive options as shorthand:
3074
+ * - "free" → { value: "free", label: "free" }
3075
+ */
3076
+ type ToggleOptionInput = ToggleOption | string | number | boolean;
3077
+ interface ShadcnToggleVariantProps extends Pick<VariantBaseProps<string | string[]>, "value" | "onValue" | "error" | "disabled" | "readOnly" | "size" | "density"> {
3078
+ /**
3079
+ * Options for the toggle group.
3080
+ *
3081
+ * Can be:
3082
+ * - ToggleOption objects
3083
+ * - Primitive strings/numbers/booleans (shorthand)
3084
+ * - Objects using option* keys (optionValue, optionLabel, etc.)
3085
+ */
3086
+ options: ToggleOptionInput[];
3087
+ multiple?: boolean;
3088
+ variant?: "default" | "outline";
3089
+ layout?: "horizontal" | "vertical" | "grid";
3090
+ gridCols?: number;
3091
+ fillWidth?: boolean;
3092
+ /**
3093
+ * Property name to read the option value from, when using
3094
+ * custom option objects.
3095
+ *
3096
+ * If omitted, falls back to:
3097
+ * - obj.value
3098
+ * - or the primitive itself (for primitive options)
3099
+ */
3100
+ optionValue?: string;
3101
+ /**
3102
+ * Property name to read the option label from, when using
3103
+ * custom option objects.
3104
+ *
3105
+ * If omitted, falls back to:
3106
+ * - obj.label
3107
+ * - or String(value)
3108
+ */
3109
+ optionLabel?: string;
3110
+ /**
3111
+ * Property name to read an icon node from, when using
3112
+ * custom option objects.
3113
+ *
3114
+ * If omitted, falls back to obj.icon.
3115
+ */
3116
+ optionIcon?: string;
3117
+ /**
3118
+ * Property name to read disabled flag from, when using
3119
+ * custom option objects.
3120
+ *
3121
+ * If omitted, falls back to obj.disabled.
3122
+ */
3123
+ optionDisabled?: string;
3124
+ /**
3125
+ * Property name to read tooltip content from, when using
3126
+ * custom option objects.
3127
+ *
3128
+ * If omitted, falls back to obj.tooltip.
3129
+ */
3130
+ optionTooltip?: string;
3131
+ /**
3132
+ * Property name to read meta from, when using custom option objects.
3133
+ *
3134
+ * If omitted, falls back to obj.meta.
3135
+ */
3136
+ optionMeta?: string;
3137
+ /**
3138
+ * Optional custom renderer for each option.
3139
+ * Receives the normalized ToggleOption and selected state.
3140
+ */
3141
+ renderOption?: (option: ToggleOption, isSelected: boolean) => React.ReactNode;
3142
+ className?: string;
3143
+ /** Base class for all items */
3144
+ itemClassName?: string;
3145
+ /** Class applied ONLY to selected items (overrides/merges with default active styles) */
3146
+ activeClassName?: string;
3147
+ /**
3148
+ * When true, capitalizes the first letter of the label
3149
+ * (only applied when the label is a string).
3150
+ */
3151
+ autoCap?: boolean;
3152
+ /**
3153
+ * Gap between buttons in pixels.
3154
+ *
3155
+ * - Applies to both flex (horizontal/vertical) and grid layouts.
3156
+ * - If omitted, falls back to Tailwind gap classes.
3157
+ */
3158
+ gap?: number;
3159
+ }
3160
+
3061
3161
  /**
3062
3162
  * Helper type for a single variant registry entry.
3063
3163
  *
@@ -3101,8 +3201,9 @@ interface Variants<H = unknown> {
3101
3201
  date: VariantEntry<string | undefined, ShadcnDateVariantProps>;
3102
3202
  chips: VariantEntry<string[] | undefined, ShadcnChipsVariantProps>;
3103
3203
  textarea: VariantEntry<string | undefined, ShadcnTextareaVariantProps>;
3104
- toggle: VariantEntry<boolean | undefined, ShadcnToggleVariantProps>;
3105
- radio: VariantEntry<unknown | undefined, ShadcnRadioVariantProps<unknown, RadioItem<unknown>>>;
3204
+ toggle: VariantEntry<boolean | undefined, ShadcnToggleVariantProps$1>;
3205
+ 'toggle-group': VariantEntry<any | undefined, ShadcnToggleVariantProps>;
3206
+ radio: VariantEntry<unknown | undefined, ShadcnRadioVariantProps<unknown, H>>;
3106
3207
  checkbox: VariantEntry<CheckboxVariantPublicValue, ShadcnCheckboxVariantPublicProps>;
3107
3208
  select: VariantEntry<string | number | undefined, SelectVariantProps>;
3108
3209
  'multi-select': VariantEntry<Array<string | number> | undefined, ShadcnMultiSelectVariantProps>;
package/dist/index.d.ts CHANGED
@@ -8,7 +8,6 @@ import { DayPicker } from 'react-day-picker';
8
8
  import * as class_variance_authority_types from 'class-variance-authority/types';
9
9
  import { VariantProps } from 'class-variance-authority';
10
10
  import * as SwitchPrimitive from '@radix-ui/react-switch';
11
- import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
12
11
  import { $ZodError } from 'zod/v4/core';
13
12
  import './../../../../node_modules/@inertiajs/core/types/types.d';
14
13
  import 'axios';
@@ -1868,9 +1867,7 @@ interface ShadcnToggleUiProps extends Omit<React.ComponentProps<typeof Switch>,
1868
1867
  * We only pick value/onValue/error from the variant base props;
1869
1868
  * everything else (id, disabled, aria-*) flows via Switch props.
1870
1869
  */
1871
- type ShadcnToggleVariantProps = ShadcnToggleUiProps & Pick<BaseProps, "value" | "onValue" | "error">;
1872
-
1873
- declare function RadioGroup({ className, ...props }: React.ComponentProps<typeof RadioGroupPrimitive.Root>): react_jsx_runtime.JSX.Element;
1870
+ type ShadcnToggleVariantProps$1 = ShadcnToggleUiProps & Pick<BaseProps, "value" | "onValue" | "error">;
1874
1871
 
1875
1872
  /**
1876
1873
  * Visual size of the radio UI.
@@ -1919,6 +1916,7 @@ interface RadioRenderOptionContext<TValue> {
1919
1916
  disabled: boolean;
1920
1917
  size: RadioSize;
1921
1918
  density: RadioDensity;
1919
+ click(): void;
1922
1920
  /**
1923
1921
  * DOM id of this option (tied to the underlying RadioGroupItem).
1924
1922
  */
@@ -1956,7 +1954,7 @@ interface ShadcnRadioUiProps<TItem, TValue> {
1956
1954
  * items = [{ id: "free", title: "Free" }]
1957
1955
  * optionValue = "id"
1958
1956
  */
1959
- optionValue?: keyof TItem;
1957
+ optionValue?: (keyof TItem) | string;
1960
1958
  /**
1961
1959
  * Property name on TItem that holds the **label**.
1962
1960
  *
@@ -1964,7 +1962,7 @@ interface ShadcnRadioUiProps<TItem, TValue> {
1964
1962
  * items = [{ id: "free", title: "Free" }]
1965
1963
  * optionLabel = "title"
1966
1964
  */
1967
- optionLabel?: keyof TItem;
1965
+ optionLabel?: (keyof TItem) | string;
1968
1966
  /**
1969
1967
  * Optional custom renderer for each option.
1970
1968
  *
@@ -2027,8 +2025,9 @@ interface ShadcnRadioUiProps<TItem, TValue> {
2027
2025
  /**
2028
2026
  * Full props for the Shadcn-based radio variant.
2029
2027
  */
2030
- type ShadcnRadioVariantProps<TValue, TItem = RadioItem<TValue>> = ShadcnRadioUiProps<TItem, TValue> & Pick<VariantBaseProps<TValue | undefined>, "value" | "onValue" | "error" | "disabled" | "required"> & Pick<React.ComponentProps<typeof RadioGroup>, "name"> & {
2028
+ type ShadcnRadioVariantProps<TValue, TItem = RadioItem<TValue>> = ShadcnRadioUiProps<TItem, TValue> & Pick<VariantBaseProps<TValue | undefined>, "value" | "onValue" | "error" | "disabled" | "required"> & {
2031
2029
  id?: string;
2030
+ name?: string;
2032
2031
  className?: string;
2033
2032
  "aria-describedby"?: string;
2034
2033
  };
@@ -2094,6 +2093,7 @@ interface CheckboxRenderOptionContext<TValue> {
2094
2093
  size: CheckboxSize;
2095
2094
  density: CheckboxDensity;
2096
2095
  checkboxId?: string;
2096
+ click(): void;
2097
2097
  /**
2098
2098
  * Prebuilt Shadcn checkbox node.
2099
2099
  */
@@ -2354,6 +2354,7 @@ interface ShadcnMultiSelectVariantProps extends Pick<VariantBaseProps<SelectPrim
2354
2354
  selected: boolean;
2355
2355
  index: number;
2356
2356
  option: React.ReactNode;
2357
+ click(): void;
2357
2358
  }) => React.ReactNode;
2358
2359
  /**
2359
2360
  * Custom renderer for the trigger summary.
@@ -2760,6 +2761,7 @@ interface ShadcnTreeSelectVariantProps extends Pick<VariantBaseProps<TreeValue>,
2760
2761
  selected: boolean;
2761
2762
  index: number;
2762
2763
  option: React.ReactNode;
2764
+ click(): void;
2763
2765
  }) => React.ReactNode;
2764
2766
  renderValue?: (ctx: {
2765
2767
  selectedItems: NormalizedTreeItem[];
@@ -2974,6 +2976,7 @@ interface ShadcnSelectVariantProps extends Pick<VariantBaseProps<SelectPrimitive
2974
2976
  selected: boolean;
2975
2977
  index: number;
2976
2978
  option: React.ReactNode;
2979
+ click(): void;
2977
2980
  }) => React.ReactNode;
2978
2981
  /**
2979
2982
  * Custom renderer for the trigger value.
@@ -3058,6 +3061,103 @@ interface ShadcnSelectVariantProps extends Pick<VariantBaseProps<SelectPrimitive
3058
3061
 
3059
3062
  type SelectVariantProps = ShadcnSelectVariantProps;
3060
3063
 
3064
+ interface ToggleOption {
3065
+ label: React.ReactNode;
3066
+ value: string;
3067
+ icon?: React.ReactNode;
3068
+ disabled?: boolean;
3069
+ tooltip?: React.ReactNode;
3070
+ meta?: any;
3071
+ }
3072
+ /**
3073
+ * Allow primitive options as shorthand:
3074
+ * - "free" → { value: "free", label: "free" }
3075
+ */
3076
+ type ToggleOptionInput = ToggleOption | string | number | boolean;
3077
+ interface ShadcnToggleVariantProps extends Pick<VariantBaseProps<string | string[]>, "value" | "onValue" | "error" | "disabled" | "readOnly" | "size" | "density"> {
3078
+ /**
3079
+ * Options for the toggle group.
3080
+ *
3081
+ * Can be:
3082
+ * - ToggleOption objects
3083
+ * - Primitive strings/numbers/booleans (shorthand)
3084
+ * - Objects using option* keys (optionValue, optionLabel, etc.)
3085
+ */
3086
+ options: ToggleOptionInput[];
3087
+ multiple?: boolean;
3088
+ variant?: "default" | "outline";
3089
+ layout?: "horizontal" | "vertical" | "grid";
3090
+ gridCols?: number;
3091
+ fillWidth?: boolean;
3092
+ /**
3093
+ * Property name to read the option value from, when using
3094
+ * custom option objects.
3095
+ *
3096
+ * If omitted, falls back to:
3097
+ * - obj.value
3098
+ * - or the primitive itself (for primitive options)
3099
+ */
3100
+ optionValue?: string;
3101
+ /**
3102
+ * Property name to read the option label from, when using
3103
+ * custom option objects.
3104
+ *
3105
+ * If omitted, falls back to:
3106
+ * - obj.label
3107
+ * - or String(value)
3108
+ */
3109
+ optionLabel?: string;
3110
+ /**
3111
+ * Property name to read an icon node from, when using
3112
+ * custom option objects.
3113
+ *
3114
+ * If omitted, falls back to obj.icon.
3115
+ */
3116
+ optionIcon?: string;
3117
+ /**
3118
+ * Property name to read disabled flag from, when using
3119
+ * custom option objects.
3120
+ *
3121
+ * If omitted, falls back to obj.disabled.
3122
+ */
3123
+ optionDisabled?: string;
3124
+ /**
3125
+ * Property name to read tooltip content from, when using
3126
+ * custom option objects.
3127
+ *
3128
+ * If omitted, falls back to obj.tooltip.
3129
+ */
3130
+ optionTooltip?: string;
3131
+ /**
3132
+ * Property name to read meta from, when using custom option objects.
3133
+ *
3134
+ * If omitted, falls back to obj.meta.
3135
+ */
3136
+ optionMeta?: string;
3137
+ /**
3138
+ * Optional custom renderer for each option.
3139
+ * Receives the normalized ToggleOption and selected state.
3140
+ */
3141
+ renderOption?: (option: ToggleOption, isSelected: boolean) => React.ReactNode;
3142
+ className?: string;
3143
+ /** Base class for all items */
3144
+ itemClassName?: string;
3145
+ /** Class applied ONLY to selected items (overrides/merges with default active styles) */
3146
+ activeClassName?: string;
3147
+ /**
3148
+ * When true, capitalizes the first letter of the label
3149
+ * (only applied when the label is a string).
3150
+ */
3151
+ autoCap?: boolean;
3152
+ /**
3153
+ * Gap between buttons in pixels.
3154
+ *
3155
+ * - Applies to both flex (horizontal/vertical) and grid layouts.
3156
+ * - If omitted, falls back to Tailwind gap classes.
3157
+ */
3158
+ gap?: number;
3159
+ }
3160
+
3061
3161
  /**
3062
3162
  * Helper type for a single variant registry entry.
3063
3163
  *
@@ -3101,8 +3201,9 @@ interface Variants<H = unknown> {
3101
3201
  date: VariantEntry<string | undefined, ShadcnDateVariantProps>;
3102
3202
  chips: VariantEntry<string[] | undefined, ShadcnChipsVariantProps>;
3103
3203
  textarea: VariantEntry<string | undefined, ShadcnTextareaVariantProps>;
3104
- toggle: VariantEntry<boolean | undefined, ShadcnToggleVariantProps>;
3105
- radio: VariantEntry<unknown | undefined, ShadcnRadioVariantProps<unknown, RadioItem<unknown>>>;
3204
+ toggle: VariantEntry<boolean | undefined, ShadcnToggleVariantProps$1>;
3205
+ 'toggle-group': VariantEntry<any | undefined, ShadcnToggleVariantProps>;
3206
+ radio: VariantEntry<unknown | undefined, ShadcnRadioVariantProps<unknown, H>>;
3106
3207
  checkbox: VariantEntry<CheckboxVariantPublicValue, ShadcnCheckboxVariantPublicProps>;
3107
3208
  select: VariantEntry<string | number | undefined, SelectVariantProps>;
3108
3209
  'multi-select': VariantEntry<Array<string | number> | undefined, ShadcnMultiSelectVariantProps>;