@zag-js/color-picker 0.74.2 → 0.76.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.
package/dist/index.d.mts CHANGED
@@ -57,7 +57,7 @@ interface PublicContext extends CommonProperties, DirectionProperty, InteractOut
57
57
  /**
58
58
  * The ids of the elements in the color picker. Useful for composition.
59
59
  */
60
- ids?: ElementIds;
60
+ ids?: ElementIds | undefined;
61
61
  /**
62
62
  * The current color value
63
63
  * @default #000000
@@ -66,31 +66,31 @@ interface PublicContext extends CommonProperties, DirectionProperty, InteractOut
66
66
  /**
67
67
  * Whether the color picker is disabled
68
68
  */
69
- disabled?: boolean;
69
+ disabled?: boolean | undefined;
70
70
  /**
71
71
  * Whether the color picker is read-only
72
72
  */
73
- readOnly?: boolean;
73
+ readOnly?: boolean | undefined;
74
74
  /**
75
75
  * Whether the color picker is required
76
76
  */
77
- required?: boolean;
77
+ required?: boolean | undefined;
78
78
  /**
79
79
  * Handler that is called when the value changes, as the user drags.
80
80
  */
81
- onValueChange?: (details: ValueChangeDetails) => void;
81
+ onValueChange?: ((details: ValueChangeDetails) => void) | undefined;
82
82
  /**
83
83
  * Handler that is called when the user stops dragging.
84
84
  */
85
- onValueChangeEnd?: (details: ValueChangeDetails) => void;
85
+ onValueChangeEnd?: ((details: ValueChangeDetails) => void) | undefined;
86
86
  /**
87
87
  * Handler that is called when the user opens or closes the color picker.
88
88
  */
89
- onOpenChange?: (details: OpenChangeDetails) => void;
89
+ onOpenChange?: ((details: OpenChangeDetails) => void) | undefined;
90
90
  /**
91
91
  * The name for the form input
92
92
  */
93
- name?: string;
93
+ name?: string | undefined;
94
94
  /**
95
95
  * The positioning options for the color picker
96
96
  */
@@ -98,15 +98,15 @@ interface PublicContext extends CommonProperties, DirectionProperty, InteractOut
98
98
  /**
99
99
  * The initial focus element when the color picker is opened.
100
100
  */
101
- initialFocusEl?: () => HTMLElement | null;
101
+ initialFocusEl?: (() => HTMLElement | null) | undefined;
102
102
  /**
103
103
  * Whether the color picker is open
104
104
  */
105
- open?: boolean;
105
+ open?: boolean | undefined;
106
106
  /**
107
107
  * Whether the color picker open state is controlled by the user
108
108
  */
109
- "open.controlled"?: boolean;
109
+ "open.controlled"?: boolean | undefined;
110
110
  /**
111
111
  * The color format to use
112
112
  * @default "rgba"
@@ -115,12 +115,12 @@ interface PublicContext extends CommonProperties, DirectionProperty, InteractOut
115
115
  /**
116
116
  * Function called when the color format changes
117
117
  */
118
- onFormatChange?: (details: FormatChangeDetails) => void;
118
+ onFormatChange?: ((details: FormatChangeDetails) => void) | undefined;
119
119
  /**
120
120
  * Whether to close the color picker when a swatch is selected
121
121
  * @default false
122
122
  */
123
- closeOnSelect?: boolean;
123
+ closeOnSelect?: boolean | undefined;
124
124
  }
125
125
  interface PrivateContext {
126
126
  }
@@ -163,18 +163,18 @@ type Send = StateMachine.Send<StateMachine.AnyEventObject>;
163
163
  type Service = Machine<MachineContext, MachineState, StateMachine.AnyEventObject>;
164
164
  interface ChannelProps {
165
165
  channel: ColorChannel;
166
- orientation?: Orientation;
166
+ orientation?: Orientation | undefined;
167
167
  }
168
168
  interface ChannelSliderProps extends ChannelProps {
169
- format?: ColorFormat;
169
+ format?: ColorFormat | undefined;
170
170
  }
171
171
  interface ChannelInputProps {
172
172
  channel: ExtendedColorChannel;
173
- orientation?: Orientation;
173
+ orientation?: Orientation | undefined;
174
174
  }
175
175
  interface AreaProps {
176
- xChannel?: ColorChannel;
177
- yChannel?: ColorChannel;
176
+ xChannel?: ColorChannel | undefined;
177
+ yChannel?: ColorChannel | undefined;
178
178
  }
179
179
  interface SwatchTriggerProps {
180
180
  /**
@@ -184,7 +184,7 @@ interface SwatchTriggerProps {
184
184
  /**
185
185
  * Whether the swatch trigger is disabled
186
186
  */
187
- disabled?: boolean;
187
+ disabled?: boolean | undefined;
188
188
  }
189
189
  interface SwatchTriggerState {
190
190
  value: Color;
@@ -200,10 +200,10 @@ interface SwatchProps {
200
200
  /**
201
201
  * Whether to include the alpha channel in the color
202
202
  */
203
- respectAlpha?: boolean;
203
+ respectAlpha?: boolean | undefined;
204
204
  }
205
205
  interface TransparencyGridProps {
206
- size?: string;
206
+ size?: string | undefined;
207
207
  }
208
208
  interface MachineApi<T extends PropTypes = PropTypes> {
209
209
  /**
package/dist/index.d.ts CHANGED
@@ -57,7 +57,7 @@ interface PublicContext extends CommonProperties, DirectionProperty, InteractOut
57
57
  /**
58
58
  * The ids of the elements in the color picker. Useful for composition.
59
59
  */
60
- ids?: ElementIds;
60
+ ids?: ElementIds | undefined;
61
61
  /**
62
62
  * The current color value
63
63
  * @default #000000
@@ -66,31 +66,31 @@ interface PublicContext extends CommonProperties, DirectionProperty, InteractOut
66
66
  /**
67
67
  * Whether the color picker is disabled
68
68
  */
69
- disabled?: boolean;
69
+ disabled?: boolean | undefined;
70
70
  /**
71
71
  * Whether the color picker is read-only
72
72
  */
73
- readOnly?: boolean;
73
+ readOnly?: boolean | undefined;
74
74
  /**
75
75
  * Whether the color picker is required
76
76
  */
77
- required?: boolean;
77
+ required?: boolean | undefined;
78
78
  /**
79
79
  * Handler that is called when the value changes, as the user drags.
80
80
  */
81
- onValueChange?: (details: ValueChangeDetails) => void;
81
+ onValueChange?: ((details: ValueChangeDetails) => void) | undefined;
82
82
  /**
83
83
  * Handler that is called when the user stops dragging.
84
84
  */
85
- onValueChangeEnd?: (details: ValueChangeDetails) => void;
85
+ onValueChangeEnd?: ((details: ValueChangeDetails) => void) | undefined;
86
86
  /**
87
87
  * Handler that is called when the user opens or closes the color picker.
88
88
  */
89
- onOpenChange?: (details: OpenChangeDetails) => void;
89
+ onOpenChange?: ((details: OpenChangeDetails) => void) | undefined;
90
90
  /**
91
91
  * The name for the form input
92
92
  */
93
- name?: string;
93
+ name?: string | undefined;
94
94
  /**
95
95
  * The positioning options for the color picker
96
96
  */
@@ -98,15 +98,15 @@ interface PublicContext extends CommonProperties, DirectionProperty, InteractOut
98
98
  /**
99
99
  * The initial focus element when the color picker is opened.
100
100
  */
101
- initialFocusEl?: () => HTMLElement | null;
101
+ initialFocusEl?: (() => HTMLElement | null) | undefined;
102
102
  /**
103
103
  * Whether the color picker is open
104
104
  */
105
- open?: boolean;
105
+ open?: boolean | undefined;
106
106
  /**
107
107
  * Whether the color picker open state is controlled by the user
108
108
  */
109
- "open.controlled"?: boolean;
109
+ "open.controlled"?: boolean | undefined;
110
110
  /**
111
111
  * The color format to use
112
112
  * @default "rgba"
@@ -115,12 +115,12 @@ interface PublicContext extends CommonProperties, DirectionProperty, InteractOut
115
115
  /**
116
116
  * Function called when the color format changes
117
117
  */
118
- onFormatChange?: (details: FormatChangeDetails) => void;
118
+ onFormatChange?: ((details: FormatChangeDetails) => void) | undefined;
119
119
  /**
120
120
  * Whether to close the color picker when a swatch is selected
121
121
  * @default false
122
122
  */
123
- closeOnSelect?: boolean;
123
+ closeOnSelect?: boolean | undefined;
124
124
  }
125
125
  interface PrivateContext {
126
126
  }
@@ -163,18 +163,18 @@ type Send = StateMachine.Send<StateMachine.AnyEventObject>;
163
163
  type Service = Machine<MachineContext, MachineState, StateMachine.AnyEventObject>;
164
164
  interface ChannelProps {
165
165
  channel: ColorChannel;
166
- orientation?: Orientation;
166
+ orientation?: Orientation | undefined;
167
167
  }
168
168
  interface ChannelSliderProps extends ChannelProps {
169
- format?: ColorFormat;
169
+ format?: ColorFormat | undefined;
170
170
  }
171
171
  interface ChannelInputProps {
172
172
  channel: ExtendedColorChannel;
173
- orientation?: Orientation;
173
+ orientation?: Orientation | undefined;
174
174
  }
175
175
  interface AreaProps {
176
- xChannel?: ColorChannel;
177
- yChannel?: ColorChannel;
176
+ xChannel?: ColorChannel | undefined;
177
+ yChannel?: ColorChannel | undefined;
178
178
  }
179
179
  interface SwatchTriggerProps {
180
180
  /**
@@ -184,7 +184,7 @@ interface SwatchTriggerProps {
184
184
  /**
185
185
  * Whether the swatch trigger is disabled
186
186
  */
187
- disabled?: boolean;
187
+ disabled?: boolean | undefined;
188
188
  }
189
189
  interface SwatchTriggerState {
190
190
  value: Color;
@@ -200,10 +200,10 @@ interface SwatchProps {
200
200
  /**
201
201
  * Whether to include the alpha channel in the color
202
202
  */
203
- respectAlpha?: boolean;
203
+ respectAlpha?: boolean | undefined;
204
204
  }
205
205
  interface TransparencyGridProps {
206
- size?: string;
206
+ size?: string | undefined;
207
207
  }
208
208
  interface MachineApi<T extends PropTypes = PropTypes> {
209
209
  /**
package/dist/index.js CHANGED
@@ -177,8 +177,8 @@ function getSliderBackgroundDirection(orientation, dir) {
177
177
  }
178
178
  }
179
179
  var getSliderBackground = (props) => {
180
- const { channel, value, dir } = props;
181
- const bgDirection = getSliderBackgroundDirection(props.orientation, dir);
180
+ const { channel, value, dir, orientation } = props;
181
+ const bgDirection = getSliderBackgroundDirection(orientation, dir);
182
182
  const { minValue, maxValue } = value.getChannelRange(channel);
183
183
  switch (channel) {
184
184
  case "hue":
package/dist/index.mjs CHANGED
@@ -175,8 +175,8 @@ function getSliderBackgroundDirection(orientation, dir) {
175
175
  }
176
176
  }
177
177
  var getSliderBackground = (props) => {
178
- const { channel, value, dir } = props;
179
- const bgDirection = getSliderBackgroundDirection(props.orientation, dir);
178
+ const { channel, value, dir, orientation } = props;
179
+ const bgDirection = getSliderBackgroundDirection(orientation, dir);
180
180
  const { minValue, maxValue } = value.getChannelRange(channel);
181
181
  switch (channel) {
182
182
  case "hue":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/color-picker",
3
- "version": "0.74.2",
3
+ "version": "0.76.0",
4
4
  "description": "Core logic for the color-picker widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -27,17 +27,17 @@
27
27
  "url": "https://github.com/chakra-ui/zag/issues"
28
28
  },
29
29
  "dependencies": {
30
- "@zag-js/core": "0.74.2",
31
- "@zag-js/anatomy": "0.74.2",
32
- "@zag-js/dom-query": "0.74.2",
33
- "@zag-js/dismissable": "0.74.2",
34
- "@zag-js/dom-event": "0.74.2",
35
- "@zag-js/utils": "0.74.2",
36
- "@zag-js/form-utils": "0.74.2",
37
- "@zag-js/color-utils": "0.74.2",
38
- "@zag-js/popper": "0.74.2",
39
- "@zag-js/text-selection": "0.74.2",
40
- "@zag-js/types": "0.74.2"
30
+ "@zag-js/core": "0.76.0",
31
+ "@zag-js/anatomy": "0.76.0",
32
+ "@zag-js/dom-query": "0.76.0",
33
+ "@zag-js/dismissable": "0.76.0",
34
+ "@zag-js/dom-event": "0.76.0",
35
+ "@zag-js/utils": "0.76.0",
36
+ "@zag-js/form-utils": "0.76.0",
37
+ "@zag-js/color-utils": "0.76.0",
38
+ "@zag-js/popper": "0.76.0",
39
+ "@zag-js/text-selection": "0.76.0",
40
+ "@zag-js/types": "0.76.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "clean-package": "2.2.0"