@salutejs/plasma-new-hope 0.336.0-canary.2208.17465207747.0 → 0.336.0-canary.2210.17487143389.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/cjs/components/CodeField/CodeField.css +7 -6
- package/cjs/components/CodeField/CodeField.js +54 -23
- package/cjs/components/CodeField/CodeField.js.map +1 -1
- package/cjs/components/CodeField/CodeField.styles.js +7 -1
- package/cjs/components/CodeField/CodeField.styles.js.map +1 -1
- package/cjs/components/CodeField/{CodeField.styles_ebdpd0.css → CodeField.styles_14p25hi.css} +1 -0
- package/cjs/components/CodeField/hooks/useWebOTP.js +103 -0
- package/cjs/components/CodeField/hooks/useWebOTP.js.map +1 -0
- package/cjs/components/CodeField/utils/handleCodeError.js +2 -2
- package/cjs/components/CodeField/utils/handleCodeError.js.map +1 -1
- package/cjs/components/CodeField/utils/handleItemError.js +14 -4
- package/cjs/components/CodeField/utils/handleItemError.js.map +1 -1
- package/cjs/components/CodeField/utils/isWebOTPSupported.js +10 -0
- package/cjs/components/CodeField/utils/isWebOTPSupported.js.map +1 -0
- package/cjs/components/Drawer/hooks/useDrawer.js +0 -12
- package/cjs/components/Drawer/hooks/useDrawer.js.map +1 -1
- package/cjs/index.css +7 -6
- package/emotion/cjs/components/CodeField/CodeField.js +47 -19
- package/emotion/cjs/components/CodeField/CodeField.styles.js +18 -11
- package/emotion/cjs/components/CodeField/hooks/useWebOTP.js +254 -0
- package/emotion/cjs/components/CodeField/utils/handleCodeError.js +2 -2
- package/emotion/cjs/components/CodeField/utils/handleItemError.js +12 -3
- package/emotion/cjs/components/CodeField/utils/index.js +4 -0
- package/emotion/cjs/components/CodeField/utils/isWebOTPSupported.js +13 -0
- package/emotion/cjs/components/Drawer/hooks/useDrawer.js +0 -11
- package/emotion/es/components/CodeField/CodeField.js +49 -21
- package/emotion/es/components/CodeField/CodeField.styles.js +15 -11
- package/emotion/es/components/CodeField/hooks/useWebOTP.js +244 -0
- package/emotion/es/components/CodeField/utils/handleCodeError.js +2 -2
- package/emotion/es/components/CodeField/utils/handleItemError.js +12 -3
- package/emotion/es/components/CodeField/utils/index.js +1 -0
- package/emotion/es/components/CodeField/utils/isWebOTPSupported.js +3 -0
- package/emotion/es/components/Drawer/hooks/useDrawer.js +0 -11
- package/es/components/CodeField/CodeField.css +7 -6
- package/es/components/CodeField/CodeField.js +56 -25
- package/es/components/CodeField/CodeField.js.map +1 -1
- package/es/components/CodeField/CodeField.styles.js +7 -2
- package/es/components/CodeField/CodeField.styles.js.map +1 -1
- package/es/components/CodeField/{CodeField.styles_ebdpd0.css → CodeField.styles_14p25hi.css} +1 -0
- package/es/components/CodeField/hooks/useWebOTP.js +99 -0
- package/es/components/CodeField/hooks/useWebOTP.js.map +1 -0
- package/es/components/CodeField/utils/handleCodeError.js +2 -2
- package/es/components/CodeField/utils/handleCodeError.js.map +1 -1
- package/es/components/CodeField/utils/handleItemError.js +14 -4
- package/es/components/CodeField/utils/handleItemError.js.map +1 -1
- package/es/components/CodeField/utils/isWebOTPSupported.js +6 -0
- package/es/components/CodeField/utils/isWebOTPSupported.js.map +1 -0
- package/es/components/Drawer/hooks/useDrawer.js +0 -12
- package/es/components/Drawer/hooks/useDrawer.js.map +1 -1
- package/es/index.css +7 -6
- package/package.json +2 -2
- package/styled-components/cjs/components/CodeField/CodeField.js +47 -19
- package/styled-components/cjs/components/CodeField/CodeField.styles.js +14 -5
- package/styled-components/cjs/components/CodeField/hooks/useWebOTP.js +254 -0
- package/styled-components/cjs/components/CodeField/utils/handleCodeError.js +2 -2
- package/styled-components/cjs/components/CodeField/utils/handleItemError.js +12 -3
- package/styled-components/cjs/components/CodeField/utils/index.js +4 -0
- package/styled-components/cjs/components/CodeField/utils/isWebOTPSupported.js +13 -0
- package/styled-components/cjs/components/Drawer/hooks/useDrawer.js +0 -11
- package/styled-components/es/components/CodeField/CodeField.js +49 -21
- package/styled-components/es/components/CodeField/CodeField.styles.js +11 -5
- package/styled-components/es/components/CodeField/hooks/useWebOTP.js +244 -0
- package/styled-components/es/components/CodeField/utils/handleCodeError.js +2 -2
- package/styled-components/es/components/CodeField/utils/handleItemError.js +12 -3
- package/styled-components/es/components/CodeField/utils/index.js +1 -0
- package/styled-components/es/components/CodeField/utils/isWebOTPSupported.js +3 -0
- package/styled-components/es/components/Drawer/hooks/useDrawer.js +0 -11
- package/types/components/CodeField/CodeField.d.ts.map +1 -1
- package/types/components/CodeField/CodeField.styles.d.ts +1 -0
- package/types/components/CodeField/CodeField.styles.d.ts.map +1 -1
- package/types/components/CodeField/hooks/useWebOTP.d.ts +23 -0
- package/types/components/CodeField/hooks/useWebOTP.d.ts.map +1 -0
- package/types/components/CodeField/utils/handleCodeError.d.ts +2 -2
- package/types/components/CodeField/utils/handleCodeError.d.ts.map +1 -1
- package/types/components/CodeField/utils/handleItemError.d.ts +3 -2
- package/types/components/CodeField/utils/handleItemError.d.ts.map +1 -1
- package/types/components/CodeField/utils/index.d.ts +1 -0
- package/types/components/CodeField/utils/index.d.ts.map +1 -1
- package/types/components/CodeField/utils/isWebOTPSupported.d.ts +2 -0
- package/types/components/CodeField/utils/isWebOTPSupported.d.ts.map +1 -0
- package/types/components/Drawer/hooks/useDrawer.d.ts.map +1 -1
@@ -0,0 +1,244 @@
|
|
1
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
2
|
+
try {
|
3
|
+
var info = gen[key](arg);
|
4
|
+
var value = info.value;
|
5
|
+
} catch (error) {
|
6
|
+
reject(error);
|
7
|
+
return;
|
8
|
+
}
|
9
|
+
if (info.done) {
|
10
|
+
resolve(value);
|
11
|
+
} else {
|
12
|
+
Promise.resolve(value).then(_next, _throw);
|
13
|
+
}
|
14
|
+
}
|
15
|
+
function _async_to_generator(fn) {
|
16
|
+
return function() {
|
17
|
+
var self = this, args = arguments;
|
18
|
+
return new Promise(function(resolve, reject) {
|
19
|
+
var gen = fn.apply(self, args);
|
20
|
+
function _next(value) {
|
21
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
22
|
+
}
|
23
|
+
function _throw(err) {
|
24
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
25
|
+
}
|
26
|
+
_next(undefined);
|
27
|
+
});
|
28
|
+
};
|
29
|
+
}
|
30
|
+
function _instanceof(left, right) {
|
31
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
32
|
+
return !!right[Symbol.hasInstance](left);
|
33
|
+
} else {
|
34
|
+
return left instanceof right;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
function _ts_generator(thisArg, body) {
|
38
|
+
var f, y, t, _ = {
|
39
|
+
label: 0,
|
40
|
+
sent: function() {
|
41
|
+
if (t[0] & 1) throw t[1];
|
42
|
+
return t[1];
|
43
|
+
},
|
44
|
+
trys: [],
|
45
|
+
ops: []
|
46
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
47
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
48
|
+
return this;
|
49
|
+
}), g;
|
50
|
+
function verb(n) {
|
51
|
+
return function(v) {
|
52
|
+
return step([
|
53
|
+
n,
|
54
|
+
v
|
55
|
+
]);
|
56
|
+
};
|
57
|
+
}
|
58
|
+
function step(op) {
|
59
|
+
if (f) throw new TypeError("Generator is already executing.");
|
60
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
61
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
62
|
+
if (y = 0, t) op = [
|
63
|
+
op[0] & 2,
|
64
|
+
t.value
|
65
|
+
];
|
66
|
+
switch(op[0]){
|
67
|
+
case 0:
|
68
|
+
case 1:
|
69
|
+
t = op;
|
70
|
+
break;
|
71
|
+
case 4:
|
72
|
+
_.label++;
|
73
|
+
return {
|
74
|
+
value: op[1],
|
75
|
+
done: false
|
76
|
+
};
|
77
|
+
case 5:
|
78
|
+
_.label++;
|
79
|
+
y = op[1];
|
80
|
+
op = [
|
81
|
+
0
|
82
|
+
];
|
83
|
+
continue;
|
84
|
+
case 7:
|
85
|
+
op = _.ops.pop();
|
86
|
+
_.trys.pop();
|
87
|
+
continue;
|
88
|
+
default:
|
89
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
90
|
+
_ = 0;
|
91
|
+
continue;
|
92
|
+
}
|
93
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
94
|
+
_.label = op[1];
|
95
|
+
break;
|
96
|
+
}
|
97
|
+
if (op[0] === 6 && _.label < t[1]) {
|
98
|
+
_.label = t[1];
|
99
|
+
t = op;
|
100
|
+
break;
|
101
|
+
}
|
102
|
+
if (t && _.label < t[2]) {
|
103
|
+
_.label = t[2];
|
104
|
+
_.ops.push(op);
|
105
|
+
break;
|
106
|
+
}
|
107
|
+
if (t[2]) _.ops.pop();
|
108
|
+
_.trys.pop();
|
109
|
+
continue;
|
110
|
+
}
|
111
|
+
op = body.call(thisArg, _);
|
112
|
+
} catch (e) {
|
113
|
+
op = [
|
114
|
+
6,
|
115
|
+
e
|
116
|
+
];
|
117
|
+
y = 0;
|
118
|
+
} finally{
|
119
|
+
f = t = 0;
|
120
|
+
}
|
121
|
+
if (op[0] & 5) throw op[1];
|
122
|
+
return {
|
123
|
+
value: op[0] ? op[1] : void 0,
|
124
|
+
done: true
|
125
|
+
};
|
126
|
+
}
|
127
|
+
}
|
128
|
+
import { useCallback, useEffect, useRef } from "react";
|
129
|
+
import { getCodeValue, isWebOTPSupported } from "../utils";
|
130
|
+
// Type guard function to check if credential is OTPCredential
|
131
|
+
var isOTPCredential = function(credential) {
|
132
|
+
return credential !== null && 'code' in credential;
|
133
|
+
};
|
134
|
+
export var useWebOTP = function(param) {
|
135
|
+
var codeString = param.codeString, enableSMSAutoRead = param.enableSMSAutoRead, disabled = param.disabled, codeLength = param.codeLength, codeSetter = param.codeSetter, onFullCodeEnter = param.onFullCodeEnter;
|
136
|
+
var abortControllerRef = useRef(null);
|
137
|
+
var startWebOTPListener = useCallback(function() {
|
138
|
+
return _async_to_generator(function() {
|
139
|
+
var otp, otpCode, newCode, err;
|
140
|
+
return _ts_generator(this, function(_state) {
|
141
|
+
switch(_state.label){
|
142
|
+
case 0:
|
143
|
+
if (!enableSMSAutoRead || disabled || !isWebOTPSupported()) {
|
144
|
+
return [
|
145
|
+
2
|
146
|
+
];
|
147
|
+
}
|
148
|
+
if (abortControllerRef.current) {
|
149
|
+
abortControllerRef.current.abort();
|
150
|
+
}
|
151
|
+
abortControllerRef.current = new AbortController();
|
152
|
+
_state.label = 1;
|
153
|
+
case 1:
|
154
|
+
_state.trys.push([
|
155
|
+
1,
|
156
|
+
3,
|
157
|
+
,
|
158
|
+
4
|
159
|
+
]);
|
160
|
+
return [
|
161
|
+
4,
|
162
|
+
navigator.credentials.get({
|
163
|
+
otp: {
|
164
|
+
transport: [
|
165
|
+
'sms'
|
166
|
+
]
|
167
|
+
},
|
168
|
+
signal: abortControllerRef.current.signal
|
169
|
+
})
|
170
|
+
];
|
171
|
+
case 2:
|
172
|
+
otp = _state.sent();
|
173
|
+
// Type guard to check if it's an OTP credential
|
174
|
+
if (otp && isOTPCredential(otp) && otp.code) {
|
175
|
+
otpCode = otp.code;
|
176
|
+
// Validate the OTP code length matches our expected length
|
177
|
+
if (otpCode.length === codeLength) {
|
178
|
+
newCode = getCodeValue(codeLength, otpCode);
|
179
|
+
codeSetter(newCode);
|
180
|
+
// Trigger full code enter callback
|
181
|
+
if (onFullCodeEnter) {
|
182
|
+
onFullCodeEnter(otpCode);
|
183
|
+
}
|
184
|
+
}
|
185
|
+
}
|
186
|
+
return [
|
187
|
+
3,
|
188
|
+
4
|
189
|
+
];
|
190
|
+
case 3:
|
191
|
+
err = _state.sent();
|
192
|
+
if (_instanceof(err, DOMException)) {
|
193
|
+
if (err.name !== 'AbortError' && err.name !== 'NotAllowedError') {
|
194
|
+
console.warn('Web OTP API error:', err);
|
195
|
+
}
|
196
|
+
} else if (_instanceof(err, Error)) {
|
197
|
+
console.warn('Web OTP API error:', err);
|
198
|
+
} else {
|
199
|
+
console.warn('Unknown Web OTP API error:', err);
|
200
|
+
}
|
201
|
+
return [
|
202
|
+
3,
|
203
|
+
4
|
204
|
+
];
|
205
|
+
case 4:
|
206
|
+
return [
|
207
|
+
2
|
208
|
+
];
|
209
|
+
}
|
210
|
+
});
|
211
|
+
})();
|
212
|
+
}, [
|
213
|
+
enableSMSAutoRead,
|
214
|
+
disabled,
|
215
|
+
codeLength,
|
216
|
+
onFullCodeEnter
|
217
|
+
]);
|
218
|
+
var stopWebOTPListener = useCallback(function() {
|
219
|
+
if (abortControllerRef.current) {
|
220
|
+
abortControllerRef.current.abort();
|
221
|
+
abortControllerRef.current = null;
|
222
|
+
}
|
223
|
+
}, []);
|
224
|
+
useEffect(function() {
|
225
|
+
if (isWebOTPSupported() && codeString === '' && enableSMSAutoRead && !disabled) {
|
226
|
+
startWebOTPListener();
|
227
|
+
} else {
|
228
|
+
stopWebOTPListener();
|
229
|
+
}
|
230
|
+
return function() {
|
231
|
+
stopWebOTPListener();
|
232
|
+
};
|
233
|
+
}, [
|
234
|
+
codeString,
|
235
|
+
enableSMSAutoRead,
|
236
|
+
disabled,
|
237
|
+
startWebOTPListener,
|
238
|
+
stopWebOTPListener
|
239
|
+
]);
|
240
|
+
return {
|
241
|
+
startWebOTPListener: startWebOTPListener,
|
242
|
+
stopWebOTPListener: stopWebOTPListener
|
243
|
+
};
|
244
|
+
};
|
@@ -27,7 +27,7 @@ import { classes } from "../CodeField.tokens";
|
|
27
27
|
import { ANIMATION_TIMEOUT } from "./constants";
|
28
28
|
import { getCodeValue } from "./initialValuesHelper";
|
29
29
|
export var handleCodeError = function(param) {
|
30
|
-
var codeLength = param.codeLength, codeErrorBehavior = param.codeErrorBehavior, currentCode = param.currentCode, inputRefs = param.inputRefs, inputContainerRef = param.inputContainerRef, captionRef = param.captionRef,
|
30
|
+
var codeLength = param.codeLength, codeErrorBehavior = param.codeErrorBehavior, currentCode = param.currentCode, inputRefs = param.inputRefs, inputContainerRef = param.inputContainerRef, captionRef = param.captionRef, setInnerValue = param.setInnerValue, codeSetter = param.codeSetter;
|
31
31
|
if (!inputContainerRef.current) {
|
32
32
|
return;
|
33
33
|
}
|
@@ -41,7 +41,7 @@ export var handleCodeError = function(param) {
|
|
41
41
|
var newCode = _to_consumable_array(currentCode);
|
42
42
|
newCode.pop();
|
43
43
|
codeSetter(newCode);
|
44
|
-
|
44
|
+
setInnerValue(currentCode);
|
45
45
|
(_inputContainerRef_current = inputContainerRef.current) === null || _inputContainerRef_current === void 0 ? void 0 : _inputContainerRef_current.classList.remove(classes.codeErrorAnimation);
|
46
46
|
setTimeout(function() {
|
47
47
|
var _inputRefs_current_, _inputRefs_current_1;
|
@@ -26,14 +26,17 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
26
26
|
import { classes } from "../CodeField.tokens";
|
27
27
|
import { ANIMATION_TIMEOUT } from "./constants";
|
28
28
|
export var handleItemError = function(param) {
|
29
|
-
var currentSymbol = param.currentSymbol, itemErrorBehavior = param.itemErrorBehavior, index = param.index, newCode = param.newCode, inputRefs = param.inputRefs,
|
29
|
+
var currentSymbol = param.currentSymbol, itemErrorBehavior = param.itemErrorBehavior, index = param.index, newCode = param.newCode, inputRefs = param.inputRefs, setInnerValue = param.setInnerValue, codeSetter = param.codeSetter, onChange = param.onChange;
|
30
30
|
if (!inputRefs.current[index] || currentSymbol === ' ') {
|
31
31
|
return;
|
32
32
|
}
|
33
33
|
switch(itemErrorBehavior){
|
34
34
|
case 'keep':
|
35
35
|
var _inputRefs_current_index;
|
36
|
-
|
36
|
+
setInnerValue(newCode);
|
37
|
+
if (onChange) {
|
38
|
+
onChange(newCode.join(''));
|
39
|
+
}
|
37
40
|
(_inputRefs_current_index = inputRefs.current[index]) === null || _inputRefs_current_index === void 0 ? void 0 : _inputRefs_current_index.classList.add(classes.itemError, classes.itemErrorAnimation);
|
38
41
|
setTimeout(function() {
|
39
42
|
var _inputRefs_current_index;
|
@@ -47,11 +50,17 @@ export var handleItemError = function(param) {
|
|
47
50
|
case 'forbid-enter':
|
48
51
|
newCode[index] = '';
|
49
52
|
codeSetter(newCode);
|
53
|
+
if (onChange) {
|
54
|
+
onChange(newCode.join(''));
|
55
|
+
}
|
50
56
|
break;
|
51
57
|
case 'remove-symbol':
|
52
58
|
default:
|
53
59
|
var _inputRefs_current_index1;
|
54
|
-
|
60
|
+
setInnerValue(newCode);
|
61
|
+
if (onChange) {
|
62
|
+
onChange(newCode.join(''));
|
63
|
+
}
|
55
64
|
(_inputRefs_current_index1 = inputRefs.current[index]) === null || _inputRefs_current_index1 === void 0 ? void 0 : _inputRefs_current_index1.classList.add(classes.itemError, classes.itemErrorFade, classes.itemErrorAnimation);
|
56
65
|
setTimeout(function() {
|
57
66
|
var _inputRefs_current_index;
|
@@ -87,17 +87,6 @@ export var useDrawer = function(param) {
|
|
87
87
|
isOpen,
|
88
88
|
popupController.items
|
89
89
|
]);
|
90
|
-
// При анмаунте компонента нужно обновлять overflow у body.
|
91
|
-
useEffect(function() {
|
92
|
-
return function() {
|
93
|
-
if (!canUseDOM) {
|
94
|
-
return;
|
95
|
-
}
|
96
|
-
if (!hasDrawers(Array.from(popupController.items.values()))) {
|
97
|
-
document.body.style.overflow = overflow.current;
|
98
|
-
}
|
99
|
-
};
|
100
|
-
}, []);
|
101
90
|
var drawerInfo = _object_spread({
|
102
91
|
id: id,
|
103
92
|
info: {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"CodeField.d.ts","sourceRoot":"","sources":["../../../src/components/CodeField/CodeField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8D,MAAM,OAAO,CAAC;AAGnF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAM7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;
|
1
|
+
{"version":3,"file":"CodeField.d.ts","sourceRoot":"","sources":["../../../src/components/CodeField/CodeField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8D,MAAM,OAAO,CAAC;AAGnF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAM7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAkBxD,eAAO,MAAM,aAAa,SAAU,SAAS,CAAC,cAAc,EAAE,cAAc,CAAC;;;;;;;;;;;;;;;;;;;sLAoTxE,CAAC;AAEN,eAAO,MAAM,eAAe;;;mBAtTQ,SAAS,CAAC,cAAc,EAAE,cAAc,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+U5E,CAAC"}
|
@@ -7,4 +7,5 @@ export declare const CaptionWrapper: import("@linaria/react").StyledComponent<im
|
|
7
7
|
captionAlign: "left" | "center";
|
8
8
|
widthValue?: string;
|
9
9
|
}>;
|
10
|
+
export declare const HiddenInput: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLInputElement> & import("react").InputHTMLAttributes<HTMLInputElement> & Record<never, unknown>>;
|
10
11
|
//# sourceMappingURL=CodeField.styles.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"CodeField.styles.d.ts","sourceRoot":"","sources":["../../../src/components/CodeField/CodeField.styles.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,IAAI,0CAUhB,CAAC;AAEF,eAAO,MAAM,WAAW,qKAGvB,CAAC;AAEF,eAAO,MAAM,SAAS,qKAGrB,CAAC;AAEF,eAAO,MAAM,SAAS,qKAErB,CAAC;AAEF,eAAO,MAAM,SAAS,8KAQrB,CAAC;AAEF,eAAO,MAAM,cAAc;kBAA8B,MAAM,GAAG,QAAQ;iBAAe,MAAM;EAK9F,CAAC"}
|
1
|
+
{"version":3,"file":"CodeField.styles.d.ts","sourceRoot":"","sources":["../../../src/components/CodeField/CodeField.styles.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,IAAI,0CAUhB,CAAC;AAEF,eAAO,MAAM,WAAW,qKAGvB,CAAC;AAEF,eAAO,MAAM,SAAS,qKAGrB,CAAC;AAEF,eAAO,MAAM,SAAS,qKAErB,CAAC;AAEF,eAAO,MAAM,SAAS,8KAQrB,CAAC;AAEF,eAAO,MAAM,cAAc;kBAA8B,MAAM,GAAG,QAAQ;iBAAe,MAAM;EAK9F,CAAC;AAEF,eAAO,MAAM,WAAW,8KAEvB,CAAC"}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
type UseWebOTPProps = {
|
2
|
+
codeString: string;
|
3
|
+
enableSMSAutoRead: boolean;
|
4
|
+
disabled: boolean;
|
5
|
+
codeLength: number;
|
6
|
+
codeSetter: (newCode: Array<string>) => void;
|
7
|
+
onFullCodeEnter?: (code: string) => void;
|
8
|
+
};
|
9
|
+
type OTPTransport = 'sms';
|
10
|
+
declare global {
|
11
|
+
interface CredentialRequestOptions {
|
12
|
+
otp?: {
|
13
|
+
transport: OTPTransport[];
|
14
|
+
};
|
15
|
+
signal?: AbortSignal;
|
16
|
+
}
|
17
|
+
}
|
18
|
+
export declare const useWebOTP: ({ codeString, enableSMSAutoRead, disabled, codeLength, codeSetter, onFullCodeEnter, }: UseWebOTPProps) => {
|
19
|
+
startWebOTPListener: () => Promise<void>;
|
20
|
+
stopWebOTPListener: () => void;
|
21
|
+
};
|
22
|
+
export {};
|
23
|
+
//# sourceMappingURL=useWebOTP.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useWebOTP.d.ts","sourceRoot":"","sources":["../../../../src/components/CodeField/hooks/useWebOTP.ts"],"names":[],"mappings":"AAIA,KAAK,cAAc,GAAG;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;IAC7C,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C,CAAC;AAEF,KAAK,YAAY,GAAG,KAAK,CAAC;AAM1B,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,wBAAwB;QAC9B,GAAG,CAAC,EAAE;YACF,SAAS,EAAE,YAAY,EAAE,CAAC;SAC7B,CAAC;QACF,MAAM,CAAC,EAAE,WAAW,CAAC;KACxB;CACJ;AAOD,eAAO,MAAM,SAAS,0FAOnB,cAAc;;;CAoEhB,CAAC"}
|
@@ -7,9 +7,9 @@ type ValidateSymbolsArgs = {
|
|
7
7
|
inputContainerRef: MutableRefObject<HTMLDivElement | null>;
|
8
8
|
inputRefs: MutableRefObject<Array<HTMLInputElement | null>>;
|
9
9
|
captionRef: MutableRefObject<HTMLDivElement | null>;
|
10
|
-
|
10
|
+
setInnerValue: Dispatch<SetStateAction<Array<string>>>;
|
11
11
|
codeSetter: (newCode: Array<string>) => void;
|
12
12
|
};
|
13
|
-
export declare const handleCodeError: ({ codeLength, codeErrorBehavior, currentCode, inputRefs, inputContainerRef, captionRef,
|
13
|
+
export declare const handleCodeError: ({ codeLength, codeErrorBehavior, currentCode, inputRefs, inputContainerRef, captionRef, setInnerValue, codeSetter, }: ValidateSymbolsArgs) => void;
|
14
14
|
export {};
|
15
15
|
//# sourceMappingURL=handleCodeError.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"handleCodeError.d.ts","sourceRoot":"","sources":["../../../../src/components/CodeField/utils/handleCodeError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAM5D,KAAK,mBAAmB,GAAG;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3B,iBAAiB,EAAE,gBAAgB,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC3D,SAAS,EAAE,gBAAgB,CAAC,KAAK,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC,CAAC;IAC5D,UAAU,EAAE,gBAAgB,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACpD,
|
1
|
+
{"version":3,"file":"handleCodeError.d.ts","sourceRoot":"","sources":["../../../../src/components/CodeField/utils/handleCodeError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAM5D,KAAK,mBAAmB,GAAG;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3B,iBAAiB,EAAE,gBAAgB,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC3D,SAAS,EAAE,gBAAgB,CAAC,KAAK,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC,CAAC;IAC5D,UAAU,EAAE,gBAAgB,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACpD,aAAa,EAAE,QAAQ,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACvD,UAAU,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;CAChD,CAAC;AAEF,eAAO,MAAM,eAAe,yHASzB,mBAAmB,SA8CrB,CAAC"}
|
@@ -6,9 +6,10 @@ type ValidateSymbolsArgs = {
|
|
6
6
|
index: number;
|
7
7
|
newCode: Array<string>;
|
8
8
|
inputRefs: MutableRefObject<Array<HTMLInputElement | null>>;
|
9
|
-
|
9
|
+
setInnerValue: Dispatch<SetStateAction<Array<string>>>;
|
10
10
|
codeSetter: (newCode: Array<string>) => void;
|
11
|
+
onChange?: (value: string) => void;
|
11
12
|
};
|
12
|
-
export declare const handleItemError: ({ currentSymbol, itemErrorBehavior, index, newCode, inputRefs,
|
13
|
+
export declare const handleItemError: ({ currentSymbol, itemErrorBehavior, index, newCode, inputRefs, setInnerValue, codeSetter, onChange, }: ValidateSymbolsArgs) => void;
|
13
14
|
export {};
|
14
15
|
//# sourceMappingURL=handleItemError.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"handleItemError.d.ts","sourceRoot":"","sources":["../../../../src/components/CodeField/utils/handleItemError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAK5D,KAAK,mBAAmB,GAAG;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACvB,SAAS,EAAE,gBAAgB,CAAC,KAAK,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC,CAAC;IAC5D,
|
1
|
+
{"version":3,"file":"handleItemError.d.ts","sourceRoot":"","sources":["../../../../src/components/CodeField/utils/handleItemError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAK5D,KAAK,mBAAmB,GAAG;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACvB,SAAS,EAAE,gBAAgB,CAAC,KAAK,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC,CAAC;IAC5D,aAAa,EAAE,QAAQ,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACvD,UAAU,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;IAC7C,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACtC,CAAC;AAEF,eAAO,MAAM,eAAe,0GASzB,mBAAmB,SAuDrB,CAAC"}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
export { getFieldPattern, getPlaceholderValue, getCodeValue } from './initialValuesHelper';
|
2
2
|
export { handleItemError } from './handleItemError';
|
3
3
|
export { handleCodeError } from './handleCodeError';
|
4
|
+
export { isWebOTPSupported } from './isWebOTPSupported';
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/CodeField/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC3F,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/CodeField/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC3F,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"isWebOTPSupported.d.ts","sourceRoot":"","sources":["../../../../src/components/CodeField/utils/isWebOTPSupported.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,eAO7B,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useDrawer.d.ts","sourceRoot":"","sources":["../../../../src/components/Drawer/hooks/useDrawer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAA+B,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAMjD,eAAO,MAAM,SAAS,iFAQnB,cAAc;;
|
1
|
+
{"version":3,"file":"useDrawer.d.ts","sourceRoot":"","sources":["../../../../src/components/Drawer/hooks/useDrawer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAA+B,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAMjD,eAAO,MAAM,SAAS,iFAQnB,cAAc;;CAkEhB,CAAC"}
|