@tracktor/design-system 4.8.2 → 4.9.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.
@@ -29,7 +29,7 @@ interface ChipFilterBaseProps<T = OptionValue> {
29
29
  disabled?: ChipProps["disabled"];
30
30
  /**
31
31
  * The options available for selection in the chip filter.
32
- * If "options" is not an array, it is considered a single option (toggle behavior).
32
+ * If "options" is not provided, it acts as a simple toggle.
33
33
  */
34
34
  options?: Option<T> | Option<T>[];
35
35
  /**
@@ -42,6 +42,29 @@ interface ChipFilterBaseProps<T = OptionValue> {
42
42
  */
43
43
  labelOnlyAfterSelection?: boolean;
44
44
  }
45
+ export interface ChipFilterToggleProps extends ChipFilterBaseProps<boolean> {
46
+ /**
47
+ * The checked state of the toggle. When provided, the component acts as a toggle.
48
+ */
49
+ checked?: boolean;
50
+ /**
51
+ * Callback function triggered when the checked state changes.
52
+ * @param checked
53
+ */
54
+ onCheckedChange?: (checked: boolean) => void;
55
+ /**
56
+ * Exclude these props for toggle mode
57
+ */
58
+ multiple?: never;
59
+ /**
60
+ * Exclude these props for toggle mode
61
+ */
62
+ value?: never;
63
+ /**
64
+ * Exclude these props for toggle mode
65
+ */
66
+ onChange?: never;
67
+ }
45
68
  export interface ChipFilterSingleProps<T = OptionValue> extends ChipFilterBaseProps<T> {
46
69
  /**
47
70
  * Indicates if the chip filter allows multiple selections.
@@ -56,6 +79,14 @@ export interface ChipFilterSingleProps<T = OptionValue> extends ChipFilterBasePr
56
79
  * @param value
57
80
  */
58
81
  onChange?: (value?: T) => void;
82
+ /**
83
+ * Exclude these props for toggle mode
84
+ */
85
+ checked?: never;
86
+ /**
87
+ * Exclude these props for toggle mode
88
+ */
89
+ onCheckedChange?: never;
59
90
  }
60
91
  export interface ChipFilterMultipleProps<T = OptionValue> extends ChipFilterBaseProps<T> {
61
92
  /**
@@ -71,8 +102,17 @@ export interface ChipFilterMultipleProps<T = OptionValue> extends ChipFilterBase
71
102
  * @param value
72
103
  */
73
104
  onChange?: (value: T[]) => void;
105
+ /**
106
+ * Exclude these props for toggle mode
107
+ */
108
+ checked?: never;
109
+ /**
110
+ * Exclude these props for toggle mode
111
+ */
112
+ onCheckedChange?: never;
74
113
  }
75
- export type ChipFilterProps<T = OptionValue> = ChipFilterSingleProps<T> | ChipFilterMultipleProps<T>;
114
+ export type ChipFilterProps<T = OptionValue> = ChipFilterToggleProps | ChipFilterSingleProps<T> | ChipFilterMultipleProps<T>;
115
+ declare function ChipFilter(props: ChipFilterToggleProps): ReactNode;
76
116
  declare function ChipFilter<T = OptionValue>(props: ChipFilterSingleProps<T>): ReactNode;
77
117
  declare function ChipFilter<T = OptionValue>(props: ChipFilterMultipleProps<T>): ReactNode;
78
118
  export default ChipFilter;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@tracktor/design-system",
3
3
  "description": "Tracktor Design System",
4
4
  "sideEffects": false,
5
- "version": "4.8.2",
5
+ "version": "4.9.0",
6
6
  "license": "ISC",
7
7
  "type": "module",
8
8
  "types": "./dist/src/main.d.ts",