@zag-js/pin-input 1.2.1 → 1.3.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as _zag_js_anatomy from '@zag-js/anatomy';
2
2
  import * as _zag_js_core from '@zag-js/core';
3
- import { Service, Machine, EventObject } from '@zag-js/core';
4
- import { DirectionProperty, CommonProperties, PropTypes, RequiredBy, NormalizeProps } from '@zag-js/types';
3
+ import { EventObject, Service, Machine } from '@zag-js/core';
4
+ import { RequiredBy, DirectionProperty, CommonProperties, PropTypes, NormalizeProps } from '@zag-js/types';
5
5
 
6
6
  declare const anatomy: _zag_js_anatomy.AnatomyInstance<"root" | "label" | "input" | "control">;
7
7
 
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as _zag_js_anatomy from '@zag-js/anatomy';
2
2
  import * as _zag_js_core from '@zag-js/core';
3
- import { Service, Machine, EventObject } from '@zag-js/core';
4
- import { DirectionProperty, CommonProperties, PropTypes, RequiredBy, NormalizeProps } from '@zag-js/types';
3
+ import { EventObject, Service, Machine } from '@zag-js/core';
4
+ import { RequiredBy, DirectionProperty, CommonProperties, PropTypes, NormalizeProps } from '@zag-js/types';
5
5
 
6
6
  declare const anatomy: _zag_js_anatomy.AnatomyInstance<"root" | "label" | "input" | "control">;
7
7
 
package/dist/index.js CHANGED
@@ -133,6 +133,7 @@ function connect(service, normalize) {
133
133
  "data-disabled": domQuery.dataAttr(prop("disabled")),
134
134
  "data-complete": domQuery.dataAttr(complete),
135
135
  id: getInputId(scope, index.toString()),
136
+ "data-index": index,
136
137
  "data-ownedby": getRootId(scope),
137
138
  "aria-label": translations?.inputLabel?.(index, computed("valueLength")),
138
139
  inputMode: prop("otp") || prop("type") === "numeric" ? "numeric" : "text",
@@ -238,6 +239,7 @@ var machine = createMachine({
238
239
  value: bindable(() => ({
239
240
  value: prop("value"),
240
241
  defaultValue: prop("defaultValue"),
242
+ isEqual: utils.isEqual,
241
243
  onChange(value) {
242
244
  prop("onValueChange")?.({ value, valueAsString: value.join("") });
243
245
  }
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { createAnatomy } from '@zag-js/anatomy';
2
- import { dispatchInputValueEvent, raf, queryAll, dataAttr, visuallyHiddenStyle, ariaAttr, getBeforeInputValue, getNativeEvent, isComposingEvent, isModifierKey, getEventKey, isHTMLElement } from '@zag-js/dom-query';
3
- import { setValueAtIndex, createSplitProps, invariant } from '@zag-js/utils';
2
+ import { raf, dispatchInputValueEvent, queryAll, dataAttr, ariaAttr, isHTMLElement, isComposingEvent, isModifierKey, getEventKey, getNativeEvent, getBeforeInputValue, visuallyHiddenStyle } from '@zag-js/dom-query';
3
+ import { setValueAtIndex, isEqual, createSplitProps, invariant } from '@zag-js/utils';
4
4
  import { setup } from '@zag-js/core';
5
5
  import { createProps } from '@zag-js/types';
6
6
 
@@ -131,6 +131,7 @@ function connect(service, normalize) {
131
131
  "data-disabled": dataAttr(prop("disabled")),
132
132
  "data-complete": dataAttr(complete),
133
133
  id: getInputId(scope, index.toString()),
134
+ "data-index": index,
134
135
  "data-ownedby": getRootId(scope),
135
136
  "aria-label": translations?.inputLabel?.(index, computed("valueLength")),
136
137
  inputMode: prop("otp") || prop("type") === "numeric" ? "numeric" : "text",
@@ -236,6 +237,7 @@ var machine = createMachine({
236
237
  value: bindable(() => ({
237
238
  value: prop("value"),
238
239
  defaultValue: prop("defaultValue"),
240
+ isEqual,
239
241
  onChange(value) {
240
242
  prop("onValueChange")?.({ value, valueAsString: value.join("") });
241
243
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/pin-input",
3
- "version": "1.2.1",
3
+ "version": "1.3.1",
4
4
  "description": "Core logic for the pin-input widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -26,11 +26,11 @@
26
26
  "url": "https://github.com/chakra-ui/zag/issues"
27
27
  },
28
28
  "dependencies": {
29
- "@zag-js/anatomy": "1.2.1",
30
- "@zag-js/dom-query": "1.2.1",
31
- "@zag-js/utils": "1.2.1",
32
- "@zag-js/core": "1.2.1",
33
- "@zag-js/types": "1.2.1"
29
+ "@zag-js/anatomy": "1.3.1",
30
+ "@zag-js/dom-query": "1.3.1",
31
+ "@zag-js/utils": "1.3.1",
32
+ "@zag-js/core": "1.3.1",
33
+ "@zag-js/types": "1.3.1"
34
34
  },
35
35
  "devDependencies": {
36
36
  "clean-package": "2.2.0"