@timeax/form-palette 0.0.25 → 0.0.27

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
@@ -1916,6 +1916,11 @@ interface RadioItem<TValue> {
1916
1916
  description?: React.ReactNode;
1917
1917
  disabled?: boolean;
1918
1918
  key?: React.Key;
1919
+ /**
1920
+ * Option-level renderer (provided by the normaliser).
1921
+ * If present, it overrides the variant-level `renderOption` for this item.
1922
+ */
1923
+ render?: (ctx: RadioRenderOptionContext<TValue>) => React.ReactNode;
1919
1924
  }
1920
1925
  /**
1921
1926
  * Mapping functions used when TItem is not `RadioItem<TValue>`.
@@ -1975,7 +1980,7 @@ interface ShadcnRadioUiProps<TItem, TValue> {
1975
1980
  * items = [{ id: "free", title: "Free" }]
1976
1981
  * optionValue = "id"
1977
1982
  */
1978
- optionValue?: (keyof TItem) | string;
1983
+ optionValue?: keyof TItem | string;
1979
1984
  /**
1980
1985
  * Property name on TItem that holds the **label**.
1981
1986
  *
@@ -1983,7 +1988,7 @@ interface ShadcnRadioUiProps<TItem, TValue> {
1983
1988
  * items = [{ id: "free", title: "Free" }]
1984
1989
  * optionLabel = "title"
1985
1990
  */
1986
- optionLabel?: (keyof TItem) | string;
1991
+ optionLabel?: keyof TItem | string;
1987
1992
  /**
1988
1993
  * Optional custom renderer for each option.
1989
1994
  *
@@ -2091,6 +2096,11 @@ interface CheckboxItem<TValue> {
2091
2096
  description?: React.ReactNode;
2092
2097
  disabled?: boolean;
2093
2098
  key?: React.Key;
2099
+ /**
2100
+ * Option-level renderer (provided by the normaliser).
2101
+ * If present, it should override the variant-level `renderOption` for this item.
2102
+ */
2103
+ render?: (ctx: CheckboxRenderOptionContext<TValue>) => React.ReactNode;
2094
2104
  /**
2095
2105
  * Override tri-state behaviour for this item.
2096
2106
  * If undefined, variant-level `tristate` is used.
@@ -2287,6 +2297,8 @@ type NormalizedMultiItem = {
2287
2297
  description?: React.ReactNode;
2288
2298
  disabled?: boolean;
2289
2299
  icon?: React.ReactNode;
2300
+ /** Option-level renderer (falls back to global renderOption) */
2301
+ render?: (...args: any[]) => React.ReactNode;
2290
2302
  raw: MultiSelectOption;
2291
2303
  };
2292
2304
  type MultiSelectBaseProps = Pick<VariantBaseProps<SelectPrimitive$1[] | undefined>, "value" | "onValue" | "error" | "disabled" | "readOnly" | "size" | "density"> & {
@@ -2735,22 +2747,22 @@ interface ShadcnCustomVariantProps<TValue = unknown> extends VariantBaseProps<TV
2735
2747
  type TreeKey = string | number;
2736
2748
  type TreeValue = TreeKey | TreeKey[] | undefined;
2737
2749
  type TreeSelectOption = TreeKey | {
2738
- label?: React.ReactNode;
2750
+ label?: React__default.ReactNode;
2739
2751
  value?: TreeKey;
2740
- description?: React.ReactNode;
2752
+ description?: React__default.ReactNode;
2741
2753
  disabled?: boolean;
2742
- icon?: React.ReactNode;
2754
+ icon?: React__default.ReactNode;
2743
2755
  children?: TreeSelectOption[];
2744
2756
  [key: string]: any;
2745
2757
  };
2746
2758
  type NormalizedTreeItem = {
2747
2759
  key: string;
2748
2760
  value: TreeKey;
2749
- labelNode: React.ReactNode;
2761
+ labelNode: React__default.ReactNode;
2750
2762
  labelText: string;
2751
- description?: React.ReactNode;
2763
+ description?: React__default.ReactNode;
2752
2764
  disabled?: boolean;
2753
- icon?: React.ReactNode;
2765
+ icon?: React__default.ReactNode;
2754
2766
  level: number;
2755
2767
  parentValue?: TreeKey;
2756
2768
  path: TreeKey[];
@@ -2758,6 +2770,7 @@ type NormalizedTreeItem = {
2758
2770
  children: NormalizedTreeItem[];
2759
2771
  raw: TreeSelectOption;
2760
2772
  };
2773
+
2761
2774
  type BadgeVariant$1 = "default" | "secondary" | "destructive" | "outline";
2762
2775
  type TreeSelectBaseProps = Pick<VariantBaseProps<TreeValue>, "value" | "onValue" | "error" | "disabled" | "readOnly" | "size" | "density"> & {
2763
2776
  options?: TreeSelectOption[];
@@ -2994,12 +3007,14 @@ type NormalizedSelectItem = {
2994
3007
  description?: React.ReactNode;
2995
3008
  disabled?: boolean;
2996
3009
  icon?: React.ReactNode;
3010
+ /** Option-level renderer (falls back to global renderOption) */
3011
+ render?: (...args: any[]) => React.ReactNode;
2997
3012
  raw: SelectOption;
2998
3013
  };
2999
3014
  /**
3000
3015
  * Shadcn-based Select variant.
3001
3016
  */
3002
- interface ShadcnSelectVariantProps extends Pick<VariantBaseProps<SelectPrimitive | undefined>, "value" | "onValue" | "error" | "disabled" | "readOnly" | "size" | "density"> {
3017
+ interface SelectBaseProps extends Pick<VariantBaseProps<SelectPrimitive | undefined>, "value" | "onValue" | "error" | "disabled" | "readOnly" | "size" | "density"> {
3003
3018
  /**
3004
3019
  * Options for the select.
3005
3020
  *
@@ -3104,13 +3119,6 @@ interface ShadcnSelectVariantProps extends Pick<VariantBaseProps<SelectPrimitive
3104
3119
  selectedItem: NormalizedSelectItem | null;
3105
3120
  placeholder?: React.ReactNode;
3106
3121
  }) => React.ReactNode;
3107
- /**
3108
- * One or more icons displayed inside the trigger, on the left.
3109
- *
3110
- * If not provided and `icon` is set, that single icon
3111
- * is treated as `leadingIcons[0]`.
3112
- */
3113
- leadingIcons?: React.ReactNode[];
3114
3122
  /**
3115
3123
  * Icons displayed on the right side of the trigger,
3116
3124
  * near the clear button / chevron area.
@@ -3177,6 +3185,51 @@ interface ShadcnSelectVariantProps extends Pick<VariantBaseProps<SelectPrimitive
3177
3185
  */
3178
3186
  virtualScrollThreshold?: number;
3179
3187
  }
3188
+ type SelectDefaultModeProps = {
3189
+ mode?: "default";
3190
+ leadingIcons?: React.ReactNode[];
3191
+ trailingIcons?: React.ReactNode[];
3192
+ icon?: React.ReactNode;
3193
+ iconGap?: number;
3194
+ leadingIconSpacing?: number;
3195
+ trailingIconSpacing?: number;
3196
+ leadingControl?: React.ReactNode;
3197
+ trailingControl?: React.ReactNode;
3198
+ leadingControlClassName?: string;
3199
+ trailingControlClassName?: string;
3200
+ joinControls?: boolean;
3201
+ extendBoxToControls?: boolean;
3202
+ button?: never;
3203
+ children?: never;
3204
+ };
3205
+ type SelectButtonModeButton = React.ReactNode | ((ctx: {
3206
+ open: boolean;
3207
+ selectedItem: NormalizedSelectItem | null;
3208
+ selectedValue: SelectPrimitive | undefined;
3209
+ placeholder?: React.ReactNode;
3210
+ }) => React.ReactNode);
3211
+ type SelectButtonModeProps = {
3212
+ mode: "button";
3213
+ /**
3214
+ * Used when mode="button". If provided, this is the trigger.
3215
+ * If not provided, `children` is used.
3216
+ */
3217
+ button?: SelectButtonModeButton;
3218
+ children?: SelectButtonModeButton;
3219
+ leadingIcons?: never;
3220
+ trailingIcons?: never;
3221
+ icon?: never;
3222
+ iconGap?: never;
3223
+ leadingIconSpacing?: never;
3224
+ trailingIconSpacing?: never;
3225
+ leadingControl?: never;
3226
+ trailingControl?: never;
3227
+ leadingControlClassName?: never;
3228
+ trailingControlClassName?: never;
3229
+ joinControls?: never;
3230
+ extendBoxToControls?: never;
3231
+ };
3232
+ type ShadcnSelectVariantProps = SelectBaseProps & (SelectDefaultModeProps | SelectButtonModeProps);
3180
3233
 
3181
3234
  type SelectVariantProps = ShadcnSelectVariantProps;
3182
3235
 
package/dist/index.d.ts CHANGED
@@ -1916,6 +1916,11 @@ interface RadioItem<TValue> {
1916
1916
  description?: React.ReactNode;
1917
1917
  disabled?: boolean;
1918
1918
  key?: React.Key;
1919
+ /**
1920
+ * Option-level renderer (provided by the normaliser).
1921
+ * If present, it overrides the variant-level `renderOption` for this item.
1922
+ */
1923
+ render?: (ctx: RadioRenderOptionContext<TValue>) => React.ReactNode;
1919
1924
  }
1920
1925
  /**
1921
1926
  * Mapping functions used when TItem is not `RadioItem<TValue>`.
@@ -1975,7 +1980,7 @@ interface ShadcnRadioUiProps<TItem, TValue> {
1975
1980
  * items = [{ id: "free", title: "Free" }]
1976
1981
  * optionValue = "id"
1977
1982
  */
1978
- optionValue?: (keyof TItem) | string;
1983
+ optionValue?: keyof TItem | string;
1979
1984
  /**
1980
1985
  * Property name on TItem that holds the **label**.
1981
1986
  *
@@ -1983,7 +1988,7 @@ interface ShadcnRadioUiProps<TItem, TValue> {
1983
1988
  * items = [{ id: "free", title: "Free" }]
1984
1989
  * optionLabel = "title"
1985
1990
  */
1986
- optionLabel?: (keyof TItem) | string;
1991
+ optionLabel?: keyof TItem | string;
1987
1992
  /**
1988
1993
  * Optional custom renderer for each option.
1989
1994
  *
@@ -2091,6 +2096,11 @@ interface CheckboxItem<TValue> {
2091
2096
  description?: React.ReactNode;
2092
2097
  disabled?: boolean;
2093
2098
  key?: React.Key;
2099
+ /**
2100
+ * Option-level renderer (provided by the normaliser).
2101
+ * If present, it should override the variant-level `renderOption` for this item.
2102
+ */
2103
+ render?: (ctx: CheckboxRenderOptionContext<TValue>) => React.ReactNode;
2094
2104
  /**
2095
2105
  * Override tri-state behaviour for this item.
2096
2106
  * If undefined, variant-level `tristate` is used.
@@ -2287,6 +2297,8 @@ type NormalizedMultiItem = {
2287
2297
  description?: React.ReactNode;
2288
2298
  disabled?: boolean;
2289
2299
  icon?: React.ReactNode;
2300
+ /** Option-level renderer (falls back to global renderOption) */
2301
+ render?: (...args: any[]) => React.ReactNode;
2290
2302
  raw: MultiSelectOption;
2291
2303
  };
2292
2304
  type MultiSelectBaseProps = Pick<VariantBaseProps<SelectPrimitive$1[] | undefined>, "value" | "onValue" | "error" | "disabled" | "readOnly" | "size" | "density"> & {
@@ -2735,22 +2747,22 @@ interface ShadcnCustomVariantProps<TValue = unknown> extends VariantBaseProps<TV
2735
2747
  type TreeKey = string | number;
2736
2748
  type TreeValue = TreeKey | TreeKey[] | undefined;
2737
2749
  type TreeSelectOption = TreeKey | {
2738
- label?: React.ReactNode;
2750
+ label?: React__default.ReactNode;
2739
2751
  value?: TreeKey;
2740
- description?: React.ReactNode;
2752
+ description?: React__default.ReactNode;
2741
2753
  disabled?: boolean;
2742
- icon?: React.ReactNode;
2754
+ icon?: React__default.ReactNode;
2743
2755
  children?: TreeSelectOption[];
2744
2756
  [key: string]: any;
2745
2757
  };
2746
2758
  type NormalizedTreeItem = {
2747
2759
  key: string;
2748
2760
  value: TreeKey;
2749
- labelNode: React.ReactNode;
2761
+ labelNode: React__default.ReactNode;
2750
2762
  labelText: string;
2751
- description?: React.ReactNode;
2763
+ description?: React__default.ReactNode;
2752
2764
  disabled?: boolean;
2753
- icon?: React.ReactNode;
2765
+ icon?: React__default.ReactNode;
2754
2766
  level: number;
2755
2767
  parentValue?: TreeKey;
2756
2768
  path: TreeKey[];
@@ -2758,6 +2770,7 @@ type NormalizedTreeItem = {
2758
2770
  children: NormalizedTreeItem[];
2759
2771
  raw: TreeSelectOption;
2760
2772
  };
2773
+
2761
2774
  type BadgeVariant$1 = "default" | "secondary" | "destructive" | "outline";
2762
2775
  type TreeSelectBaseProps = Pick<VariantBaseProps<TreeValue>, "value" | "onValue" | "error" | "disabled" | "readOnly" | "size" | "density"> & {
2763
2776
  options?: TreeSelectOption[];
@@ -2994,12 +3007,14 @@ type NormalizedSelectItem = {
2994
3007
  description?: React.ReactNode;
2995
3008
  disabled?: boolean;
2996
3009
  icon?: React.ReactNode;
3010
+ /** Option-level renderer (falls back to global renderOption) */
3011
+ render?: (...args: any[]) => React.ReactNode;
2997
3012
  raw: SelectOption;
2998
3013
  };
2999
3014
  /**
3000
3015
  * Shadcn-based Select variant.
3001
3016
  */
3002
- interface ShadcnSelectVariantProps extends Pick<VariantBaseProps<SelectPrimitive | undefined>, "value" | "onValue" | "error" | "disabled" | "readOnly" | "size" | "density"> {
3017
+ interface SelectBaseProps extends Pick<VariantBaseProps<SelectPrimitive | undefined>, "value" | "onValue" | "error" | "disabled" | "readOnly" | "size" | "density"> {
3003
3018
  /**
3004
3019
  * Options for the select.
3005
3020
  *
@@ -3104,13 +3119,6 @@ interface ShadcnSelectVariantProps extends Pick<VariantBaseProps<SelectPrimitive
3104
3119
  selectedItem: NormalizedSelectItem | null;
3105
3120
  placeholder?: React.ReactNode;
3106
3121
  }) => React.ReactNode;
3107
- /**
3108
- * One or more icons displayed inside the trigger, on the left.
3109
- *
3110
- * If not provided and `icon` is set, that single icon
3111
- * is treated as `leadingIcons[0]`.
3112
- */
3113
- leadingIcons?: React.ReactNode[];
3114
3122
  /**
3115
3123
  * Icons displayed on the right side of the trigger,
3116
3124
  * near the clear button / chevron area.
@@ -3177,6 +3185,51 @@ interface ShadcnSelectVariantProps extends Pick<VariantBaseProps<SelectPrimitive
3177
3185
  */
3178
3186
  virtualScrollThreshold?: number;
3179
3187
  }
3188
+ type SelectDefaultModeProps = {
3189
+ mode?: "default";
3190
+ leadingIcons?: React.ReactNode[];
3191
+ trailingIcons?: React.ReactNode[];
3192
+ icon?: React.ReactNode;
3193
+ iconGap?: number;
3194
+ leadingIconSpacing?: number;
3195
+ trailingIconSpacing?: number;
3196
+ leadingControl?: React.ReactNode;
3197
+ trailingControl?: React.ReactNode;
3198
+ leadingControlClassName?: string;
3199
+ trailingControlClassName?: string;
3200
+ joinControls?: boolean;
3201
+ extendBoxToControls?: boolean;
3202
+ button?: never;
3203
+ children?: never;
3204
+ };
3205
+ type SelectButtonModeButton = React.ReactNode | ((ctx: {
3206
+ open: boolean;
3207
+ selectedItem: NormalizedSelectItem | null;
3208
+ selectedValue: SelectPrimitive | undefined;
3209
+ placeholder?: React.ReactNode;
3210
+ }) => React.ReactNode);
3211
+ type SelectButtonModeProps = {
3212
+ mode: "button";
3213
+ /**
3214
+ * Used when mode="button". If provided, this is the trigger.
3215
+ * If not provided, `children` is used.
3216
+ */
3217
+ button?: SelectButtonModeButton;
3218
+ children?: SelectButtonModeButton;
3219
+ leadingIcons?: never;
3220
+ trailingIcons?: never;
3221
+ icon?: never;
3222
+ iconGap?: never;
3223
+ leadingIconSpacing?: never;
3224
+ trailingIconSpacing?: never;
3225
+ leadingControl?: never;
3226
+ trailingControl?: never;
3227
+ leadingControlClassName?: never;
3228
+ trailingControlClassName?: never;
3229
+ joinControls?: never;
3230
+ extendBoxToControls?: never;
3231
+ };
3232
+ type ShadcnSelectVariantProps = SelectBaseProps & (SelectDefaultModeProps | SelectButtonModeProps);
3180
3233
 
3181
3234
  type SelectVariantProps = ShadcnSelectVariantProps;
3182
3235