@zag-js/color-picker 0.16.0 → 0.17.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.
@@ -78,32 +78,48 @@ type PublicContext = CommonProperties & {
78
78
 
79
79
  type PrivateContext = Context<{
80
80
  /**
81
+ * @internal
81
82
  * The id of the thumb that is currently being dragged
82
83
  */
83
84
  activeId: string | null
84
85
  /**
86
+ * @internal
85
87
  * The channel that is currently being interacted with
86
88
  */
87
89
  activeChannel: Partial<ColorAxes> | null
88
90
  /**
91
+ * @internal
89
92
  * The orientation of the channel that is currently being interacted with
90
93
  */
91
94
  activeOrientation: Orientation | null
95
+ /**
96
+ * @internal
97
+ * Whether the checkbox's fieldset is disabled
98
+ */
99
+ fieldsetDisabled: boolean
92
100
  }>
93
101
 
94
102
  type ComputedContext = Readonly<{
95
103
  /**
104
+ * @computed
96
105
  * Whether the color picker is in RTL mode
97
106
  */
98
107
  isRtl: boolean
99
108
  /**
109
+ * @computed
100
110
  * Whether the color picker is interactive
101
111
  */
102
112
  isInteractive: boolean
103
113
  /**
114
+ * @computed
104
115
  * The color value as a Color object
105
116
  */
106
117
  valueAsColor: Color
118
+ /**
119
+ * @computed
120
+ * Whether the color picker is disabled
121
+ */
122
+ isDisabled: boolean
107
123
  }>
108
124
 
109
125
  export type UserDefinedContext = RequiredBy<PublicContext, "id">
@@ -118,7 +134,7 @@ export type State = S.State<MachineContext, MachineState>
118
134
 
119
135
  export type Send = S.Send<S.AnyEventObject>
120
136
 
121
- export type PublicApi<T extends PropTypes = PropTypes> = {
137
+ export type MachineApi<T extends PropTypes = PropTypes> = {
122
138
  /**
123
139
  * Whether the color picker is being dragged
124
140
  */
package/src/index.ts CHANGED
@@ -12,5 +12,5 @@ export type {
12
12
  ColorSwatchProps,
13
13
  ColorType,
14
14
  UserDefinedContext as Context,
15
- PublicApi,
15
+ MachineApi as Api,
16
16
  } from "./color-picker.types"
@@ -1,7 +1,9 @@
1
1
  import type { Color } from "@zag-js/color-utils"
2
2
  import type { ExtendedColorChannel } from "../color-picker.types"
3
3
 
4
- export function getChannelInputValue(color: Color, channel: ExtendedColorChannel) {
4
+ export function getChannelInputValue(color: Color, channel: ExtendedColorChannel | null | undefined) {
5
+ if (channel == null) return
6
+
5
7
  switch (channel) {
6
8
  case "hex":
7
9
  return color.toString("hex")