@zag-js/color-picker 0.48.0 → 0.50.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 +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.js +8 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -13
- package/src/color-picker.connect.ts +3 -3
- package/src/color-picker.dom.ts +0 -8
- package/src/color-picker.machine.ts +3 -2
- package/src/color-picker.types.ts +7 -12
- package/src/index.ts +2 -0
|
@@ -2,13 +2,10 @@ import type { Color, ColorAxes, ColorChannel, ColorFormat, ColorType } from "@za
|
|
|
2
2
|
import type { StateMachine as S } from "@zag-js/core"
|
|
3
3
|
import type { InteractOutsideHandlers } from "@zag-js/dismissable"
|
|
4
4
|
import type { PositioningOptions } from "@zag-js/popper"
|
|
5
|
-
import type { CommonProperties,
|
|
6
|
-
import type { MaybeFunction } from "@zag-js/utils"
|
|
5
|
+
import type { CommonProperties, DirectionProperty, Orientation, PropTypes, RequiredBy } from "@zag-js/types"
|
|
7
6
|
|
|
8
7
|
export type ExtendedColorChannel = ColorChannel | "hex" | "css"
|
|
9
8
|
|
|
10
|
-
// patch the global window object to include the EyeDropper API
|
|
11
|
-
|
|
12
9
|
interface EyeDropper {
|
|
13
10
|
new (): EyeDropper
|
|
14
11
|
open: (options?: { signal?: AbortSignal }) => Promise<{ sRGBHex: string }>
|
|
@@ -57,17 +54,14 @@ export type ElementIds = Partial<{
|
|
|
57
54
|
channelSliderThumb(id: ColorChannel): string
|
|
58
55
|
}>
|
|
59
56
|
|
|
60
|
-
interface PublicContext extends CommonProperties, InteractOutsideHandlers {
|
|
57
|
+
interface PublicContext extends CommonProperties, DirectionProperty, InteractOutsideHandlers {
|
|
61
58
|
/**
|
|
62
59
|
* The ids of the elements in the color picker. Useful for composition.
|
|
63
60
|
*/
|
|
64
61
|
ids?: ElementIds
|
|
65
|
-
/**
|
|
66
|
-
* The direction of the color picker
|
|
67
|
-
*/
|
|
68
|
-
dir: "ltr" | "rtl"
|
|
69
62
|
/**
|
|
70
63
|
* The current color value
|
|
64
|
+
* @default #000000
|
|
71
65
|
*/
|
|
72
66
|
value: Color
|
|
73
67
|
/**
|
|
@@ -98,11 +92,10 @@ interface PublicContext extends CommonProperties, InteractOutsideHandlers {
|
|
|
98
92
|
* The positioning options for the color picker
|
|
99
93
|
*/
|
|
100
94
|
positioning: PositioningOptions
|
|
101
|
-
|
|
102
95
|
/**
|
|
103
96
|
* The initial focus element when the color picker is opened.
|
|
104
97
|
*/
|
|
105
|
-
initialFocusEl?:
|
|
98
|
+
initialFocusEl?: () => HTMLElement | null
|
|
106
99
|
/**
|
|
107
100
|
* Whether the color picker is open
|
|
108
101
|
*/
|
|
@@ -113,6 +106,7 @@ interface PublicContext extends CommonProperties, InteractOutsideHandlers {
|
|
|
113
106
|
"open.controlled"?: boolean
|
|
114
107
|
/**
|
|
115
108
|
* The color format to use
|
|
109
|
+
* @default "rgba"
|
|
116
110
|
*/
|
|
117
111
|
format: ColorFormat
|
|
118
112
|
/**
|
|
@@ -121,6 +115,7 @@ interface PublicContext extends CommonProperties, InteractOutsideHandlers {
|
|
|
121
115
|
onFormatChange?: (details: FormatChangeDetails) => void
|
|
122
116
|
/**
|
|
123
117
|
* Whether to close the color picker when a swatch is selected
|
|
118
|
+
* @default false
|
|
124
119
|
*/
|
|
125
120
|
closeOnSelect?: boolean
|
|
126
121
|
}
|
|
@@ -336,4 +331,4 @@ export interface MachineApi<T extends PropTypes = PropTypes> {
|
|
|
336
331
|
* Re-exported types
|
|
337
332
|
* -----------------------------------------------------------------------------*/
|
|
338
333
|
|
|
339
|
-
export type { Color, ColorAxes, ColorChannel, ColorFormat, ColorType }
|
|
334
|
+
export type { Color, ColorAxes, ColorChannel, ColorFormat, ColorType, PositioningOptions }
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export type { FocusOutsideEvent, InteractOutsideEvent, PointerDownOutsideEvent } from "@zag-js/dismissable"
|
|
1
2
|
export { anatomy } from "./color-picker.anatomy"
|
|
2
3
|
export { connect } from "./color-picker.connect"
|
|
3
4
|
export { machine } from "./color-picker.machine"
|
|
@@ -16,6 +17,7 @@ export type {
|
|
|
16
17
|
ElementIds,
|
|
17
18
|
FormatChangeDetails,
|
|
18
19
|
OpenChangeDetails,
|
|
20
|
+
PositioningOptions,
|
|
19
21
|
SwatchProps,
|
|
20
22
|
SwatchTriggerProps,
|
|
21
23
|
SwatchTriggerState,
|