@zag-js/pin-input 0.1.8 → 0.1.9
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 +21 -31
- package/dist/index.mjs +21 -32
- package/dist/pin-input.connect.d.ts +3 -3
- package/dist/pin-input.dom.d.ts +1 -1
- package/dist/pin-input.machine.d.ts +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -49,29 +49,11 @@ var dataAttr = (guard) => {
|
|
|
49
49
|
var ariaAttr = (guard) => {
|
|
50
50
|
return guard ? "true" : void 0;
|
|
51
51
|
};
|
|
52
|
-
function nextTick(fn) {
|
|
53
|
-
const set = /* @__PURE__ */ new Set();
|
|
54
|
-
function raf2(fn2) {
|
|
55
|
-
const id = globalThis.requestAnimationFrame(fn2);
|
|
56
|
-
set.add(() => globalThis.cancelAnimationFrame(id));
|
|
57
|
-
}
|
|
58
|
-
raf2(() => raf2(fn));
|
|
59
|
-
return function cleanup() {
|
|
60
|
-
set.forEach(function(fn2) {
|
|
61
|
-
fn2();
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
function raf(fn) {
|
|
66
|
-
const id = globalThis.requestAnimationFrame(fn);
|
|
67
|
-
return function cleanup() {
|
|
68
|
-
globalThis.cancelAnimationFrame(id);
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
52
|
function getNativeEvent(e) {
|
|
72
53
|
var _a;
|
|
73
54
|
return (_a = e.nativeEvent) != null ? _a : e;
|
|
74
55
|
}
|
|
56
|
+
var isModifiedEvent = (v) => v.ctrlKey || v.altKey || v.metaKey;
|
|
75
57
|
var rtlKeyMap = {
|
|
76
58
|
ArrowLeft: "ArrowRight",
|
|
77
59
|
ArrowRight: "ArrowLeft",
|
|
@@ -98,24 +80,32 @@ function getEventKey(event, options = {}) {
|
|
|
98
80
|
}
|
|
99
81
|
return key;
|
|
100
82
|
}
|
|
83
|
+
function nextTick(fn) {
|
|
84
|
+
const set = /* @__PURE__ */ new Set();
|
|
85
|
+
function raf2(fn2) {
|
|
86
|
+
const id = globalThis.requestAnimationFrame(fn2);
|
|
87
|
+
set.add(() => globalThis.cancelAnimationFrame(id));
|
|
88
|
+
}
|
|
89
|
+
raf2(() => raf2(fn));
|
|
90
|
+
return function cleanup() {
|
|
91
|
+
set.forEach(function(fn2) {
|
|
92
|
+
fn2();
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function raf(fn) {
|
|
97
|
+
const id = globalThis.requestAnimationFrame(fn);
|
|
98
|
+
return function cleanup() {
|
|
99
|
+
globalThis.cancelAnimationFrame(id);
|
|
100
|
+
};
|
|
101
|
+
}
|
|
101
102
|
function queryAll(root, selector) {
|
|
102
103
|
var _a;
|
|
103
104
|
return Array.from((_a = root == null ? void 0 : root.querySelectorAll(selector)) != null ? _a : []);
|
|
104
105
|
}
|
|
105
106
|
|
|
106
|
-
// ../../types/dist/index.mjs
|
|
107
|
-
function createNormalizer(fn) {
|
|
108
|
-
return new Proxy({}, {
|
|
109
|
-
get() {
|
|
110
|
-
return fn;
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
var normalizeProp = createNormalizer((v) => v);
|
|
115
|
-
|
|
116
107
|
// ../../utilities/core/dist/index.mjs
|
|
117
108
|
var fromLength = (length) => Array.from(Array(length).keys());
|
|
118
|
-
var isModifiedEvent = (v) => v.ctrlKey || v.altKey || v.metaKey;
|
|
119
109
|
function invariant(...a) {
|
|
120
110
|
const m = a.length === 1 ? a[0] : a[1];
|
|
121
111
|
const c = a.length === 2 ? a[0] : true;
|
|
@@ -153,7 +143,7 @@ var dom = {
|
|
|
153
143
|
};
|
|
154
144
|
|
|
155
145
|
// src/pin-input.connect.ts
|
|
156
|
-
function connect(state, send, normalize
|
|
146
|
+
function connect(state, send, normalize) {
|
|
157
147
|
const isValueComplete = state.context.isValueComplete;
|
|
158
148
|
const isInvalid = state.context.invalid;
|
|
159
149
|
const focusedIndex = state.context.focusedIndex;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __defProps = Object.defineProperties;
|
|
4
3
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
@@ -26,29 +25,11 @@ var dataAttr = (guard) => {
|
|
|
26
25
|
var ariaAttr = (guard) => {
|
|
27
26
|
return guard ? "true" : void 0;
|
|
28
27
|
};
|
|
29
|
-
function nextTick(fn) {
|
|
30
|
-
const set = /* @__PURE__ */ new Set();
|
|
31
|
-
function raf2(fn2) {
|
|
32
|
-
const id = globalThis.requestAnimationFrame(fn2);
|
|
33
|
-
set.add(() => globalThis.cancelAnimationFrame(id));
|
|
34
|
-
}
|
|
35
|
-
raf2(() => raf2(fn));
|
|
36
|
-
return function cleanup() {
|
|
37
|
-
set.forEach(function(fn2) {
|
|
38
|
-
fn2();
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
function raf(fn) {
|
|
43
|
-
const id = globalThis.requestAnimationFrame(fn);
|
|
44
|
-
return function cleanup() {
|
|
45
|
-
globalThis.cancelAnimationFrame(id);
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
28
|
function getNativeEvent(e) {
|
|
49
29
|
var _a;
|
|
50
30
|
return (_a = e.nativeEvent) != null ? _a : e;
|
|
51
31
|
}
|
|
32
|
+
var isModifiedEvent = (v) => v.ctrlKey || v.altKey || v.metaKey;
|
|
52
33
|
var rtlKeyMap = {
|
|
53
34
|
ArrowLeft: "ArrowRight",
|
|
54
35
|
ArrowRight: "ArrowLeft",
|
|
@@ -75,24 +56,32 @@ function getEventKey(event, options = {}) {
|
|
|
75
56
|
}
|
|
76
57
|
return key;
|
|
77
58
|
}
|
|
59
|
+
function nextTick(fn) {
|
|
60
|
+
const set = /* @__PURE__ */ new Set();
|
|
61
|
+
function raf2(fn2) {
|
|
62
|
+
const id = globalThis.requestAnimationFrame(fn2);
|
|
63
|
+
set.add(() => globalThis.cancelAnimationFrame(id));
|
|
64
|
+
}
|
|
65
|
+
raf2(() => raf2(fn));
|
|
66
|
+
return function cleanup() {
|
|
67
|
+
set.forEach(function(fn2) {
|
|
68
|
+
fn2();
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function raf(fn) {
|
|
73
|
+
const id = globalThis.requestAnimationFrame(fn);
|
|
74
|
+
return function cleanup() {
|
|
75
|
+
globalThis.cancelAnimationFrame(id);
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
78
|
function queryAll(root, selector) {
|
|
79
79
|
var _a;
|
|
80
80
|
return Array.from((_a = root == null ? void 0 : root.querySelectorAll(selector)) != null ? _a : []);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
// ../../types/dist/index.mjs
|
|
84
|
-
function createNormalizer(fn) {
|
|
85
|
-
return new Proxy({}, {
|
|
86
|
-
get() {
|
|
87
|
-
return fn;
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
var normalizeProp = createNormalizer((v) => v);
|
|
92
|
-
|
|
93
83
|
// ../../utilities/core/dist/index.mjs
|
|
94
84
|
var fromLength = (length) => Array.from(Array(length).keys());
|
|
95
|
-
var isModifiedEvent = (v) => v.ctrlKey || v.altKey || v.metaKey;
|
|
96
85
|
function invariant(...a) {
|
|
97
86
|
const m = a.length === 1 ? a[0] : a[1];
|
|
98
87
|
const c = a.length === 2 ? a[0] : true;
|
|
@@ -130,7 +119,7 @@ var dom = {
|
|
|
130
119
|
};
|
|
131
120
|
|
|
132
121
|
// src/pin-input.connect.ts
|
|
133
|
-
function connect(state, send, normalize
|
|
122
|
+
function connect(state, send, normalize) {
|
|
134
123
|
const isValueComplete = state.context.isValueComplete;
|
|
135
124
|
const isInvalid = state.context.invalid;
|
|
136
125
|
const focusedIndex = state.context.focusedIndex;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Send, State } from "./pin-input.types";
|
|
3
|
-
export declare function connect<T extends PropTypes
|
|
1
|
+
import type { NormalizeProps, PropTypes } from "@zag-js/types";
|
|
2
|
+
import type { Send, State } from "./pin-input.types";
|
|
3
|
+
export declare function connect<T extends PropTypes>(state: State, send: Send, normalize: NormalizeProps<T>): {
|
|
4
4
|
value: string[];
|
|
5
5
|
valueAsString: string;
|
|
6
6
|
isValueComplete: boolean;
|
package/dist/pin-input.dom.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { MachineContext, MachineState, UserDefinedContext } from "./pin-input.types";
|
|
1
|
+
import type { MachineContext, MachineState, UserDefinedContext } from "./pin-input.types";
|
|
2
2
|
export declare function machine(ctx?: UserDefinedContext): import("@zag-js/core").Machine<MachineContext, MachineState, import("@zag-js/core").StateMachine.AnyEventObject>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/pin-input",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "Core logic for the pin-input widget implemented as a state machine",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"url": "https://github.com/chakra-ui/zag/issues"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@zag-js/core": "0.1.
|
|
33
|
-
"@zag-js/dom-utils": "0.1.
|
|
34
|
-
"@zag-js/types": "0.2.
|
|
32
|
+
"@zag-js/core": "0.1.7",
|
|
33
|
+
"@zag-js/dom-utils": "0.1.6",
|
|
34
|
+
"@zag-js/types": "0.2.1",
|
|
35
35
|
"@zag-js/utils": "0.1.2"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|