@zag-js/color-picker 0.13.0 → 0.14.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 +51 -37
- package/dist/index.d.ts +51 -37
- package/dist/index.js +90 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +90 -36
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -10
- package/src/color-picker.anatomy.ts +4 -3
- package/src/color-picker.connect.ts +31 -5
- package/src/color-picker.dom.ts +14 -8
- package/src/color-picker.machine.ts +27 -4
- package/src/color-picker.types.ts +54 -41
|
@@ -39,6 +39,8 @@ type ElementIds = Partial<{
|
|
|
39
39
|
channelSliderThumb(id: ColorChannel): string
|
|
40
40
|
}>
|
|
41
41
|
|
|
42
|
+
export type { Color, ColorAxes, ColorChannel, ColorFormat, ColorType }
|
|
43
|
+
|
|
42
44
|
type PublicContext = CommonProperties & {
|
|
43
45
|
/**
|
|
44
46
|
* The ids of the elements in the color picker. Useful for composition.
|
|
@@ -68,48 +70,10 @@ type PublicContext = CommonProperties & {
|
|
|
68
70
|
* Handler that is called when the user stops dragging.
|
|
69
71
|
*/
|
|
70
72
|
onChangeEnd?: (details: ChangeDetails) => void
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export type PublicApi<T extends PropTypes = PropTypes> = {
|
|
74
|
-
/**
|
|
75
|
-
* Whether the color picker is being dragged
|
|
76
|
-
*/
|
|
77
|
-
isDragging: boolean
|
|
78
|
-
/**
|
|
79
|
-
* The current color value (as a string)
|
|
80
|
-
*/
|
|
81
|
-
value: string
|
|
82
|
-
/**
|
|
83
|
-
* The current color value (as a Color object)
|
|
84
|
-
*/
|
|
85
|
-
valueAsColor: Color
|
|
86
|
-
/**
|
|
87
|
-
* The current color channels of the color
|
|
88
|
-
*/
|
|
89
|
-
channels: [ColorChannel, ColorChannel, ColorChannel]
|
|
90
|
-
/**
|
|
91
|
-
* Function to set the color value
|
|
92
|
-
*/
|
|
93
|
-
setColor(value: string | Color): void
|
|
94
73
|
/**
|
|
95
|
-
*
|
|
74
|
+
* The name for the form input
|
|
96
75
|
*/
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Function to set the color format
|
|
100
|
-
*/
|
|
101
|
-
setFormat(format: ColorFormat): void
|
|
102
|
-
contentProps: T["element"]
|
|
103
|
-
getAreaProps(props: ColorAreaProps): T["element"]
|
|
104
|
-
getAreaGradientProps(props: ColorAreaProps): T["element"]
|
|
105
|
-
getAreaThumbProps(props: ColorAreaProps): T["element"]
|
|
106
|
-
getChannelSliderTrackProps(props: ColorChannelProps): T["element"]
|
|
107
|
-
getChannelSliderBackgroundProps(props: ColorChannelProps): T["element"]
|
|
108
|
-
getChannelSliderThumbProps(props: ColorChannelProps): T["element"]
|
|
109
|
-
getChannelInputProps(props: ColorChannelInputProps): T["input"]
|
|
110
|
-
eyeDropperTriggerProps: T["button"]
|
|
111
|
-
getSwatchBackgroundProps(props: ColorSwatchProps): T["element"]
|
|
112
|
-
getSwatchProps(props: ColorSwatchProps): T["element"]
|
|
76
|
+
name?: string
|
|
113
77
|
}
|
|
114
78
|
|
|
115
79
|
type PrivateContext = Context<{
|
|
@@ -154,4 +118,53 @@ export type State = S.State<MachineContext, MachineState>
|
|
|
154
118
|
|
|
155
119
|
export type Send = S.Send<S.AnyEventObject>
|
|
156
120
|
|
|
157
|
-
export type
|
|
121
|
+
export type PublicApi<T extends PropTypes = PropTypes> = {
|
|
122
|
+
/**
|
|
123
|
+
* Whether the color picker is being dragged
|
|
124
|
+
*/
|
|
125
|
+
isDragging: boolean
|
|
126
|
+
/**
|
|
127
|
+
* The current color value (as a string)
|
|
128
|
+
*/
|
|
129
|
+
value: string
|
|
130
|
+
/**
|
|
131
|
+
* The current color value (as a Color object)
|
|
132
|
+
*/
|
|
133
|
+
valueAsColor: Color
|
|
134
|
+
/**
|
|
135
|
+
* The alpha value of the color
|
|
136
|
+
*/
|
|
137
|
+
alpha: number
|
|
138
|
+
/**
|
|
139
|
+
* The current color channels of the color
|
|
140
|
+
*/
|
|
141
|
+
channels: [ColorChannel, ColorChannel, ColorChannel]
|
|
142
|
+
/**
|
|
143
|
+
* Function to set the color value
|
|
144
|
+
*/
|
|
145
|
+
setColor(value: string | Color): void
|
|
146
|
+
/**
|
|
147
|
+
* Function to set the color value of a specific channel
|
|
148
|
+
*/
|
|
149
|
+
setChannelValue(channel: ColorChannel, value: number): void
|
|
150
|
+
/**
|
|
151
|
+
* Function to set the color format
|
|
152
|
+
*/
|
|
153
|
+
setFormat(format: ColorFormat): void
|
|
154
|
+
/**
|
|
155
|
+
* Function to set the color alpha
|
|
156
|
+
*/
|
|
157
|
+
setAlpha(value: number): void
|
|
158
|
+
contentProps: T["element"]
|
|
159
|
+
hiddenInputProps: T["input"]
|
|
160
|
+
getAreaProps(props: ColorAreaProps): T["element"]
|
|
161
|
+
getAreaGradientProps(props: ColorAreaProps): T["element"]
|
|
162
|
+
getAreaThumbProps(props: ColorAreaProps): T["element"]
|
|
163
|
+
getChannelSliderTrackProps(props: ColorChannelProps): T["element"]
|
|
164
|
+
getChannelSliderBackgroundProps(props: ColorChannelProps): T["element"]
|
|
165
|
+
getChannelSliderThumbProps(props: ColorChannelProps): T["element"]
|
|
166
|
+
getChannelInputProps(props: ColorChannelInputProps): T["input"]
|
|
167
|
+
eyeDropperTriggerProps: T["button"]
|
|
168
|
+
getSwatchBackgroundProps(props: ColorSwatchProps): T["element"]
|
|
169
|
+
getSwatchProps(props: ColorSwatchProps): T["element"]
|
|
170
|
+
}
|