@zag-js/color-picker 1.39.0 → 1.40.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.
@@ -72,8 +72,8 @@ var machine = (0, import_core.createMachine)({
72
72
  context({ prop, bindable, getContext }) {
73
73
  return {
74
74
  value: bindable(() => ({
75
- defaultValue: prop("defaultValue"),
76
- value: prop("value"),
75
+ defaultValue: prop("defaultValue").toFormat(prop("format") ?? prop("defaultFormat")),
76
+ value: prop("value")?.toFormat(prop("format") ?? prop("defaultFormat")),
77
77
  isEqual(a, b) {
78
78
  return b != null && a.isEqual(b);
79
79
  },
@@ -484,7 +484,8 @@ var machine = (0, import_core.createMachine)({
484
484
  context.set("value", color);
485
485
  },
486
486
  setValue({ context, event }) {
487
- context.set("value", event.value);
487
+ const format = context.get("format");
488
+ context.set("value", event.value.toFormat(format));
488
489
  },
489
490
  setFormat({ context, event }) {
490
491
  context.set("format", event.format);
@@ -46,8 +46,8 @@ var machine = createMachine({
46
46
  context({ prop, bindable, getContext }) {
47
47
  return {
48
48
  value: bindable(() => ({
49
- defaultValue: prop("defaultValue"),
50
- value: prop("value"),
49
+ defaultValue: prop("defaultValue").toFormat(prop("format") ?? prop("defaultFormat")),
50
+ value: prop("value")?.toFormat(prop("format") ?? prop("defaultFormat")),
51
51
  isEqual(a, b) {
52
52
  return b != null && a.isEqual(b);
53
53
  },
@@ -458,7 +458,8 @@ var machine = createMachine({
458
458
  context.set("value", color);
459
459
  },
460
460
  setValue({ context, event }) {
461
- context.set("value", event.value);
461
+ const format = context.get("format");
462
+ context.set("value", event.value.toFormat(format));
462
463
  },
463
464
  setFormat({ context, event }) {
464
465
  context.set("format", event.format);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/color-picker",
3
- "version": "1.39.0",
3
+ "version": "1.40.0",
4
4
  "description": "Core logic for the color-picker widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -27,14 +27,14 @@
27
27
  "url": "https://github.com/chakra-ui/zag/issues"
28
28
  },
29
29
  "dependencies": {
30
- "@zag-js/core": "1.39.0",
31
- "@zag-js/anatomy": "1.39.0",
32
- "@zag-js/dom-query": "1.39.0",
33
- "@zag-js/dismissable": "1.39.0",
34
- "@zag-js/utils": "1.39.0",
35
- "@zag-js/color-utils": "1.39.0",
36
- "@zag-js/popper": "1.39.0",
37
- "@zag-js/types": "1.39.0"
30
+ "@zag-js/core": "1.40.0",
31
+ "@zag-js/anatomy": "1.40.0",
32
+ "@zag-js/dom-query": "1.40.0",
33
+ "@zag-js/dismissable": "1.40.0",
34
+ "@zag-js/utils": "1.40.0",
35
+ "@zag-js/color-utils": "1.40.0",
36
+ "@zag-js/popper": "1.40.0",
37
+ "@zag-js/types": "1.40.0"
38
38
  },
39
39
  "devDependencies": {
40
40
  "clean-package": "2.2.0"