@zag-js/color-picker 1.44.0 → 1.46.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.
@@ -103,8 +103,7 @@ function connect(service, normalize) {
103
103
  },
104
104
  format: context.get("format"),
105
105
  setFormat(format2) {
106
- const formatValue = value.toFormat(format2);
107
- send({ type: "VALUE.SET", value: formatValue, src: "set-format" });
106
+ send({ type: "FORMAT.SET", format: format2, src: "set-format" });
108
107
  },
109
108
  alpha: value.getChannelValue("alpha"),
110
109
  setAlpha(alphaValue) {
@@ -76,8 +76,7 @@ function connect(service, normalize) {
76
76
  },
77
77
  format: context.get("format"),
78
78
  setFormat(format2) {
79
- const formatValue = value.toFormat(format2);
80
- send({ type: "VALUE.SET", value: formatValue, src: "set-format" });
79
+ send({ type: "FORMAT.SET", format: format2, src: "set-format" });
81
80
  },
82
81
  alpha: value.getChannelValue("alpha"),
83
82
  setAlpha(alphaValue) {
@@ -398,6 +398,7 @@ var machine = (0, import_core.createMachine)({
398
398
  type: "popover",
399
399
  exclude: dom.getTriggerEl(scope),
400
400
  defer: true,
401
+ layerStyleTargets: [() => dom.getPositionerEl(scope)],
401
402
  onInteractOutside(event) {
402
403
  prop("onInteractOutside")?.(event);
403
404
  if (event.defaultPrevented) return;
@@ -593,7 +594,8 @@ var machine = (0, import_core.createMachine)({
593
594
  root: dom.getContentEl(scope),
594
595
  getInitialEl: prop("initialFocusEl")
595
596
  });
596
- element?.focus({ preventScroll: true });
597
+ if (!element) return;
598
+ element.focus({ preventScroll: true });
597
599
  });
598
600
  },
599
601
  setReturnFocus({ scope }) {
@@ -372,6 +372,7 @@ var machine = createMachine({
372
372
  type: "popover",
373
373
  exclude: dom.getTriggerEl(scope),
374
374
  defer: true,
375
+ layerStyleTargets: [() => dom.getPositionerEl(scope)],
375
376
  onInteractOutside(event) {
376
377
  prop("onInteractOutside")?.(event);
377
378
  if (event.defaultPrevented) return;
@@ -567,7 +568,8 @@ var machine = createMachine({
567
568
  root: dom.getContentEl(scope),
568
569
  getInitialEl: prop("initialFocusEl")
569
570
  });
570
- element?.focus({ preventScroll: true });
571
+ if (!element) return;
572
+ element.focus({ preventScroll: true });
571
573
  });
572
574
  },
573
575
  setReturnFocus({ scope }) {
@@ -102,8 +102,9 @@ interface ColorPickerProps extends CommonProperties, DirectionProperty, Interact
102
102
  positioning?: PositioningOptions | undefined;
103
103
  /**
104
104
  * The initial focus element when the color picker is opened.
105
+ * Return `false` to skip moving focus, or `null` to use the default.
105
106
  */
106
- initialFocusEl?: (() => HTMLElement | null) | undefined;
107
+ initialFocusEl?: (() => HTMLElement | null | false) | undefined;
107
108
  /**
108
109
  * The controlled open state of the color picker
109
110
  */
@@ -102,8 +102,9 @@ interface ColorPickerProps extends CommonProperties, DirectionProperty, Interact
102
102
  positioning?: PositioningOptions | undefined;
103
103
  /**
104
104
  * The initial focus element when the color picker is opened.
105
+ * Return `false` to skip moving focus, or `null` to use the default.
105
106
  */
106
- initialFocusEl?: (() => HTMLElement | null) | undefined;
107
+ initialFocusEl?: (() => HTMLElement | null | false) | undefined;
107
108
  /**
108
109
  * The controlled open state of the color picker
109
110
  */
@@ -1,6 +1,5 @@
1
- import * as _zag_js_color_utils from '@zag-js/color-utils';
2
1
  import { Color, ColorChannel } from '@zag-js/color-utils';
3
2
 
4
- declare function getChannelDisplayColor(color: Color, channel: ColorChannel): _zag_js_color_utils.ColorType;
3
+ declare function getChannelDisplayColor(color: Color, channel: ColorChannel): Color;
5
4
 
6
5
  export { getChannelDisplayColor };
@@ -1,6 +1,5 @@
1
- import * as _zag_js_color_utils from '@zag-js/color-utils';
2
1
  import { Color, ColorChannel } from '@zag-js/color-utils';
3
2
 
4
- declare function getChannelDisplayColor(color: Color, channel: ColorChannel): _zag_js_color_utils.ColorType;
3
+ declare function getChannelDisplayColor(color: Color, channel: ColorChannel): Color;
5
4
 
6
5
  export { getChannelDisplayColor };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/color-picker",
3
- "version": "1.44.0",
3
+ "version": "1.46.0",
4
4
  "description": "Core logic for the color-picker widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -30,14 +30,14 @@
30
30
  "url": "https://github.com/chakra-ui/zag/issues"
31
31
  },
32
32
  "dependencies": {
33
- "@zag-js/core": "1.44.0",
34
- "@zag-js/anatomy": "1.44.0",
35
- "@zag-js/dom-query": "1.44.0",
36
- "@zag-js/dismissable": "1.44.0",
37
- "@zag-js/utils": "1.44.0",
38
- "@zag-js/color-utils": "1.44.0",
39
- "@zag-js/popper": "1.44.0",
40
- "@zag-js/types": "1.44.0"
33
+ "@zag-js/core": "1.46.0",
34
+ "@zag-js/anatomy": "1.46.0",
35
+ "@zag-js/dom-query": "1.46.0",
36
+ "@zag-js/dismissable": "1.46.0",
37
+ "@zag-js/utils": "1.46.0",
38
+ "@zag-js/color-utils": "1.46.0",
39
+ "@zag-js/popper": "1.46.0",
40
+ "@zag-js/types": "1.46.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "clean-package": "2.2.0"