@zag-js/pin-input 0.80.0 → 0.81.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.js +3 -4
- package/dist/index.mjs +1 -2
- package/package.json +7 -8
package/dist/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var anatomy$1 = require('@zag-js/anatomy');
|
|
4
|
-
var domEvent = require('@zag-js/dom-event');
|
|
5
4
|
var domQuery = require('@zag-js/dom-query');
|
|
6
5
|
var utils = require('@zag-js/utils');
|
|
7
6
|
var core = require('@zag-js/core');
|
|
@@ -156,7 +155,7 @@ function connect(state, send, normalize) {
|
|
|
156
155
|
}
|
|
157
156
|
},
|
|
158
157
|
onChange(event) {
|
|
159
|
-
const evt =
|
|
158
|
+
const evt = domQuery.getNativeEvent(event);
|
|
160
159
|
const { value } = event.currentTarget;
|
|
161
160
|
if (evt.inputType === "insertFromPaste" || value.length > 2) {
|
|
162
161
|
send({ type: "INPUT.PASTE", value });
|
|
@@ -173,7 +172,7 @@ function connect(state, send, normalize) {
|
|
|
173
172
|
onKeyDown(event) {
|
|
174
173
|
if (event.defaultPrevented) return;
|
|
175
174
|
if (domQuery.isComposingEvent(event)) return;
|
|
176
|
-
if (
|
|
175
|
+
if (domQuery.isModifierKey(event)) return;
|
|
177
176
|
const keyMap = {
|
|
178
177
|
Backspace() {
|
|
179
178
|
send("INPUT.BACKSPACE");
|
|
@@ -191,7 +190,7 @@ function connect(state, send, normalize) {
|
|
|
191
190
|
send("INPUT.ENTER");
|
|
192
191
|
}
|
|
193
192
|
};
|
|
194
|
-
const exec = keyMap[
|
|
193
|
+
const exec = keyMap[domQuery.getEventKey(event, state.context)];
|
|
195
194
|
if (exec) {
|
|
196
195
|
exec(event);
|
|
197
196
|
event.preventDefault();
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createAnatomy } from '@zag-js/anatomy';
|
|
2
|
-
import { getNativeEvent, isModifierKey, getEventKey } from '@zag-js/dom-
|
|
3
|
-
import { createScope, queryAll, dataAttr, visuallyHiddenStyle, ariaAttr, getBeforeInputValue, isComposingEvent, raf } from '@zag-js/dom-query';
|
|
2
|
+
import { createScope, queryAll, dataAttr, visuallyHiddenStyle, ariaAttr, getBeforeInputValue, getNativeEvent, isComposingEvent, isModifierKey, getEventKey, raf } from '@zag-js/dom-query';
|
|
4
3
|
import { invariant, compact, isEqual } from '@zag-js/utils';
|
|
5
4
|
import { createMachine, choose } from '@zag-js/core';
|
|
6
5
|
import { dispatchInputValueEvent } from '@zag-js/form-utils';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/pin-input",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.81.1",
|
|
4
4
|
"description": "Core logic for the pin-input widget implemented as a state machine",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -26,13 +26,12 @@
|
|
|
26
26
|
"url": "https://github.com/chakra-ui/zag/issues"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@zag-js/anatomy": "0.
|
|
30
|
-
"@zag-js/dom-query": "0.
|
|
31
|
-
"@zag-js/
|
|
32
|
-
"@zag-js/
|
|
33
|
-
"@zag-js/
|
|
34
|
-
"@zag-js/
|
|
35
|
-
"@zag-js/types": "0.80.0"
|
|
29
|
+
"@zag-js/anatomy": "0.81.1",
|
|
30
|
+
"@zag-js/dom-query": "0.81.1",
|
|
31
|
+
"@zag-js/form-utils": "0.81.1",
|
|
32
|
+
"@zag-js/utils": "0.81.1",
|
|
33
|
+
"@zag-js/core": "0.81.1",
|
|
34
|
+
"@zag-js/types": "0.81.1"
|
|
36
35
|
},
|
|
37
36
|
"devDependencies": {
|
|
38
37
|
"clean-package": "2.2.0"
|