@zag-js/steps 1.22.1 → 1.24.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.js CHANGED
@@ -222,7 +222,10 @@ var machine = core.createMachine({
222
222
  };
223
223
  },
224
224
  computed: {
225
- percent: ({ context, prop }) => context.get("step") / prop("count") * 100,
225
+ percent: core.memo(
226
+ ({ context, prop }) => [context.get("step"), prop("count")],
227
+ ([step, count]) => step / count * 100
228
+ ),
226
229
  hasNextStep: ({ context, prop }) => context.get("step") < prop("count"),
227
230
  hasPrevStep: ({ context }) => context.get("step") > 0,
228
231
  completed: ({ context, prop }) => context.get("step") === prop("count")
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { createAnatomy } from '@zag-js/anatomy';
2
2
  import { dataAttr } from '@zag-js/dom-query';
3
3
  import { isValueWithinRange, createSplitProps, fromLength } from '@zag-js/utils';
4
- import { createMachine } from '@zag-js/core';
4
+ import { createMachine, memo } from '@zag-js/core';
5
5
  import { createProps } from '@zag-js/types';
6
6
 
7
7
  // src/steps.anatomy.ts
@@ -220,7 +220,10 @@ var machine = createMachine({
220
220
  };
221
221
  },
222
222
  computed: {
223
- percent: ({ context, prop }) => context.get("step") / prop("count") * 100,
223
+ percent: memo(
224
+ ({ context, prop }) => [context.get("step"), prop("count")],
225
+ ([step, count]) => step / count * 100
226
+ ),
224
227
  hasNextStep: ({ context, prop }) => context.get("step") < prop("count"),
225
228
  hasPrevStep: ({ context }) => context.get("step") > 0,
226
229
  completed: ({ context, prop }) => context.get("step") === prop("count")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/steps",
3
- "version": "1.22.1",
3
+ "version": "1.24.0",
4
4
  "description": "Core logic for the steps widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -27,11 +27,11 @@
27
27
  "url": "https://github.com/chakra-ui/zag/issues"
28
28
  },
29
29
  "dependencies": {
30
- "@zag-js/anatomy": "1.22.1",
31
- "@zag-js/core": "1.22.1",
32
- "@zag-js/dom-query": "1.22.1",
33
- "@zag-js/utils": "1.22.1",
34
- "@zag-js/types": "1.22.1"
30
+ "@zag-js/anatomy": "1.24.0",
31
+ "@zag-js/core": "1.24.0",
32
+ "@zag-js/dom-query": "1.24.0",
33
+ "@zag-js/utils": "1.24.0",
34
+ "@zag-js/types": "1.24.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "clean-package": "2.2.0"