@timeax/form-palette 0.0.16 → 0.0.17

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
@@ -1868,7 +1868,7 @@ interface ShadcnToggleUiProps extends Omit<React.ComponentProps<typeof Switch>,
1868
1868
  * We only pick value/onValue/error from the variant base props;
1869
1869
  * everything else (id, disabled, aria-*) flows via Switch props.
1870
1870
  */
1871
- type ShadcnToggleVariantProps = ShadcnToggleUiProps & Pick<BaseProps, "value" | "onValue" | "error">;
1871
+ type ShadcnToggleVariantProps$1 = ShadcnToggleUiProps & Pick<BaseProps, "value" | "onValue" | "error">;
1872
1872
 
1873
1873
  declare function RadioGroup({ className, ...props }: React.ComponentProps<typeof RadioGroupPrimitive.Root>): react_jsx_runtime.JSX.Element;
1874
1874
 
@@ -3058,6 +3058,103 @@ interface ShadcnSelectVariantProps extends Pick<VariantBaseProps<SelectPrimitive
3058
3058
 
3059
3059
  type SelectVariantProps = ShadcnSelectVariantProps;
3060
3060
 
3061
+ interface ToggleOption {
3062
+ label: React.ReactNode;
3063
+ value: string;
3064
+ icon?: React.ReactNode;
3065
+ disabled?: boolean;
3066
+ tooltip?: React.ReactNode;
3067
+ meta?: any;
3068
+ }
3069
+ /**
3070
+ * Allow primitive options as shorthand:
3071
+ * - "free" → { value: "free", label: "free" }
3072
+ */
3073
+ type ToggleOptionInput = ToggleOption | string | number | boolean;
3074
+ interface ShadcnToggleVariantProps extends Pick<VariantBaseProps<string | string[]>, "value" | "onValue" | "error" | "disabled" | "readOnly" | "size" | "density"> {
3075
+ /**
3076
+ * Options for the toggle group.
3077
+ *
3078
+ * Can be:
3079
+ * - ToggleOption objects
3080
+ * - Primitive strings/numbers/booleans (shorthand)
3081
+ * - Objects using option* keys (optionValue, optionLabel, etc.)
3082
+ */
3083
+ options: ToggleOptionInput[];
3084
+ multiple?: boolean;
3085
+ variant?: "default" | "outline";
3086
+ layout?: "horizontal" | "vertical" | "grid";
3087
+ gridCols?: number;
3088
+ fillWidth?: boolean;
3089
+ /**
3090
+ * Property name to read the option value from, when using
3091
+ * custom option objects.
3092
+ *
3093
+ * If omitted, falls back to:
3094
+ * - obj.value
3095
+ * - or the primitive itself (for primitive options)
3096
+ */
3097
+ optionValue?: string;
3098
+ /**
3099
+ * Property name to read the option label from, when using
3100
+ * custom option objects.
3101
+ *
3102
+ * If omitted, falls back to:
3103
+ * - obj.label
3104
+ * - or String(value)
3105
+ */
3106
+ optionLabel?: string;
3107
+ /**
3108
+ * Property name to read an icon node from, when using
3109
+ * custom option objects.
3110
+ *
3111
+ * If omitted, falls back to obj.icon.
3112
+ */
3113
+ optionIcon?: string;
3114
+ /**
3115
+ * Property name to read disabled flag from, when using
3116
+ * custom option objects.
3117
+ *
3118
+ * If omitted, falls back to obj.disabled.
3119
+ */
3120
+ optionDisabled?: string;
3121
+ /**
3122
+ * Property name to read tooltip content from, when using
3123
+ * custom option objects.
3124
+ *
3125
+ * If omitted, falls back to obj.tooltip.
3126
+ */
3127
+ optionTooltip?: string;
3128
+ /**
3129
+ * Property name to read meta from, when using custom option objects.
3130
+ *
3131
+ * If omitted, falls back to obj.meta.
3132
+ */
3133
+ optionMeta?: string;
3134
+ /**
3135
+ * Optional custom renderer for each option.
3136
+ * Receives the normalized ToggleOption and selected state.
3137
+ */
3138
+ renderOption?: (option: ToggleOption, isSelected: boolean) => React.ReactNode;
3139
+ className?: string;
3140
+ /** Base class for all items */
3141
+ itemClassName?: string;
3142
+ /** Class applied ONLY to selected items (overrides/merges with default active styles) */
3143
+ activeClassName?: string;
3144
+ /**
3145
+ * When true, capitalizes the first letter of the label
3146
+ * (only applied when the label is a string).
3147
+ */
3148
+ autoCap?: boolean;
3149
+ /**
3150
+ * Gap between buttons in pixels.
3151
+ *
3152
+ * - Applies to both flex (horizontal/vertical) and grid layouts.
3153
+ * - If omitted, falls back to Tailwind gap classes.
3154
+ */
3155
+ gap?: number;
3156
+ }
3157
+
3061
3158
  /**
3062
3159
  * Helper type for a single variant registry entry.
3063
3160
  *
@@ -3101,8 +3198,9 @@ interface Variants<H = unknown> {
3101
3198
  date: VariantEntry<string | undefined, ShadcnDateVariantProps>;
3102
3199
  chips: VariantEntry<string[] | undefined, ShadcnChipsVariantProps>;
3103
3200
  textarea: VariantEntry<string | undefined, ShadcnTextareaVariantProps>;
3104
- toggle: VariantEntry<boolean | undefined, ShadcnToggleVariantProps>;
3105
- radio: VariantEntry<unknown | undefined, ShadcnRadioVariantProps<unknown, RadioItem<unknown>>>;
3201
+ toggle: VariantEntry<boolean | undefined, ShadcnToggleVariantProps$1>;
3202
+ 'toggle-group': VariantEntry<any | undefined, ShadcnToggleVariantProps>;
3203
+ radio: VariantEntry<unknown | undefined, ShadcnRadioVariantProps<unknown, H>>;
3106
3204
  checkbox: VariantEntry<CheckboxVariantPublicValue, ShadcnCheckboxVariantPublicProps>;
3107
3205
  select: VariantEntry<string | number | undefined, SelectVariantProps>;
3108
3206
  'multi-select': VariantEntry<Array<string | number> | undefined, ShadcnMultiSelectVariantProps>;
package/dist/index.d.ts CHANGED
@@ -1868,7 +1868,7 @@ interface ShadcnToggleUiProps extends Omit<React.ComponentProps<typeof Switch>,
1868
1868
  * We only pick value/onValue/error from the variant base props;
1869
1869
  * everything else (id, disabled, aria-*) flows via Switch props.
1870
1870
  */
1871
- type ShadcnToggleVariantProps = ShadcnToggleUiProps & Pick<BaseProps, "value" | "onValue" | "error">;
1871
+ type ShadcnToggleVariantProps$1 = ShadcnToggleUiProps & Pick<BaseProps, "value" | "onValue" | "error">;
1872
1872
 
1873
1873
  declare function RadioGroup({ className, ...props }: React.ComponentProps<typeof RadioGroupPrimitive.Root>): react_jsx_runtime.JSX.Element;
1874
1874
 
@@ -3058,6 +3058,103 @@ interface ShadcnSelectVariantProps extends Pick<VariantBaseProps<SelectPrimitive
3058
3058
 
3059
3059
  type SelectVariantProps = ShadcnSelectVariantProps;
3060
3060
 
3061
+ interface ToggleOption {
3062
+ label: React.ReactNode;
3063
+ value: string;
3064
+ icon?: React.ReactNode;
3065
+ disabled?: boolean;
3066
+ tooltip?: React.ReactNode;
3067
+ meta?: any;
3068
+ }
3069
+ /**
3070
+ * Allow primitive options as shorthand:
3071
+ * - "free" → { value: "free", label: "free" }
3072
+ */
3073
+ type ToggleOptionInput = ToggleOption | string | number | boolean;
3074
+ interface ShadcnToggleVariantProps extends Pick<VariantBaseProps<string | string[]>, "value" | "onValue" | "error" | "disabled" | "readOnly" | "size" | "density"> {
3075
+ /**
3076
+ * Options for the toggle group.
3077
+ *
3078
+ * Can be:
3079
+ * - ToggleOption objects
3080
+ * - Primitive strings/numbers/booleans (shorthand)
3081
+ * - Objects using option* keys (optionValue, optionLabel, etc.)
3082
+ */
3083
+ options: ToggleOptionInput[];
3084
+ multiple?: boolean;
3085
+ variant?: "default" | "outline";
3086
+ layout?: "horizontal" | "vertical" | "grid";
3087
+ gridCols?: number;
3088
+ fillWidth?: boolean;
3089
+ /**
3090
+ * Property name to read the option value from, when using
3091
+ * custom option objects.
3092
+ *
3093
+ * If omitted, falls back to:
3094
+ * - obj.value
3095
+ * - or the primitive itself (for primitive options)
3096
+ */
3097
+ optionValue?: string;
3098
+ /**
3099
+ * Property name to read the option label from, when using
3100
+ * custom option objects.
3101
+ *
3102
+ * If omitted, falls back to:
3103
+ * - obj.label
3104
+ * - or String(value)
3105
+ */
3106
+ optionLabel?: string;
3107
+ /**
3108
+ * Property name to read an icon node from, when using
3109
+ * custom option objects.
3110
+ *
3111
+ * If omitted, falls back to obj.icon.
3112
+ */
3113
+ optionIcon?: string;
3114
+ /**
3115
+ * Property name to read disabled flag from, when using
3116
+ * custom option objects.
3117
+ *
3118
+ * If omitted, falls back to obj.disabled.
3119
+ */
3120
+ optionDisabled?: string;
3121
+ /**
3122
+ * Property name to read tooltip content from, when using
3123
+ * custom option objects.
3124
+ *
3125
+ * If omitted, falls back to obj.tooltip.
3126
+ */
3127
+ optionTooltip?: string;
3128
+ /**
3129
+ * Property name to read meta from, when using custom option objects.
3130
+ *
3131
+ * If omitted, falls back to obj.meta.
3132
+ */
3133
+ optionMeta?: string;
3134
+ /**
3135
+ * Optional custom renderer for each option.
3136
+ * Receives the normalized ToggleOption and selected state.
3137
+ */
3138
+ renderOption?: (option: ToggleOption, isSelected: boolean) => React.ReactNode;
3139
+ className?: string;
3140
+ /** Base class for all items */
3141
+ itemClassName?: string;
3142
+ /** Class applied ONLY to selected items (overrides/merges with default active styles) */
3143
+ activeClassName?: string;
3144
+ /**
3145
+ * When true, capitalizes the first letter of the label
3146
+ * (only applied when the label is a string).
3147
+ */
3148
+ autoCap?: boolean;
3149
+ /**
3150
+ * Gap between buttons in pixels.
3151
+ *
3152
+ * - Applies to both flex (horizontal/vertical) and grid layouts.
3153
+ * - If omitted, falls back to Tailwind gap classes.
3154
+ */
3155
+ gap?: number;
3156
+ }
3157
+
3061
3158
  /**
3062
3159
  * Helper type for a single variant registry entry.
3063
3160
  *
@@ -3101,8 +3198,9 @@ interface Variants<H = unknown> {
3101
3198
  date: VariantEntry<string | undefined, ShadcnDateVariantProps>;
3102
3199
  chips: VariantEntry<string[] | undefined, ShadcnChipsVariantProps>;
3103
3200
  textarea: VariantEntry<string | undefined, ShadcnTextareaVariantProps>;
3104
- toggle: VariantEntry<boolean | undefined, ShadcnToggleVariantProps>;
3105
- radio: VariantEntry<unknown | undefined, ShadcnRadioVariantProps<unknown, RadioItem<unknown>>>;
3201
+ toggle: VariantEntry<boolean | undefined, ShadcnToggleVariantProps$1>;
3202
+ 'toggle-group': VariantEntry<any | undefined, ShadcnToggleVariantProps>;
3203
+ radio: VariantEntry<unknown | undefined, ShadcnRadioVariantProps<unknown, H>>;
3106
3204
  checkbox: VariantEntry<CheckboxVariantPublicValue, ShadcnCheckboxVariantPublicProps>;
3107
3205
  select: VariantEntry<string | number | undefined, SelectVariantProps>;
3108
3206
  'multi-select': VariantEntry<Array<string | number> | undefined, ShadcnMultiSelectVariantProps>;