@salutejs/plasma-new-hope 0.336.0-canary.2210.17491654160.0 → 0.336.0-canary.2211.17491564625.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 +6 -7
- package/cjs/components/CodeField/CodeField.js +24 -61
- package/cjs/components/CodeField/CodeField.js.map +1 -1
- package/cjs/components/CodeField/CodeField.styles.js +1 -7
- package/cjs/components/CodeField/CodeField.styles.js.map +1 -1
- package/cjs/components/CodeField/{CodeField.styles_7tebk.css → CodeField.styles_ebdpd0.css} +0 -1
- 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 +4 -14
- package/cjs/components/CodeField/utils/handleItemError.js.map +1 -1
- package/cjs/index.css +6 -7
- package/emotion/cjs/components/CodeField/CodeField.js +20 -51
- package/emotion/cjs/components/CodeField/CodeField.styles.js +11 -18
- package/emotion/cjs/components/CodeField/utils/handleCodeError.js +2 -2
- package/emotion/cjs/components/CodeField/utils/handleItemError.js +3 -12
- package/emotion/cjs/components/CodeField/utils/index.js +0 -4
- package/emotion/es/components/CodeField/CodeField.js +22 -53
- package/emotion/es/components/CodeField/CodeField.styles.js +11 -15
- package/emotion/es/components/CodeField/utils/handleCodeError.js +2 -2
- package/emotion/es/components/CodeField/utils/handleItemError.js +3 -12
- package/emotion/es/components/CodeField/utils/index.js +0 -1
- package/es/components/CodeField/CodeField.css +6 -7
- package/es/components/CodeField/CodeField.js +26 -63
- package/es/components/CodeField/CodeField.js.map +1 -1
- package/es/components/CodeField/CodeField.styles.js +2 -7
- package/es/components/CodeField/CodeField.styles.js.map +1 -1
- package/es/components/CodeField/{CodeField.styles_7tebk.css → CodeField.styles_ebdpd0.css} +0 -1
- 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 +4 -14
- package/es/components/CodeField/utils/handleItemError.js.map +1 -1
- package/es/index.css +6 -7
- package/package.json +2 -2
- package/styled-components/cjs/components/CodeField/CodeField.js +20 -51
- package/styled-components/cjs/components/CodeField/CodeField.styles.js +5 -14
- package/styled-components/cjs/components/CodeField/utils/handleCodeError.js +2 -2
- package/styled-components/cjs/components/CodeField/utils/handleItemError.js +3 -12
- package/styled-components/cjs/components/CodeField/utils/index.js +0 -4
- package/styled-components/cjs/examples/components/Combobox/Combobox.js +15 -0
- package/styled-components/es/components/CodeField/CodeField.js +22 -53
- package/styled-components/es/components/CodeField/CodeField.styles.js +5 -11
- package/styled-components/es/components/CodeField/utils/handleCodeError.js +2 -2
- package/styled-components/es/components/CodeField/utils/handleItemError.js +3 -12
- package/styled-components/es/components/CodeField/utils/index.js +0 -1
- package/styled-components/es/examples/components/Combobox/Combobox.js +0 -7
- package/types/components/Autocomplete/Autocomplete.types.d.ts +6 -6
- package/types/components/Autocomplete/Autocomplete.types.d.ts.map +1 -1
- package/types/components/CodeField/CodeField.d.ts.map +1 -1
- package/types/components/CodeField/CodeField.styles.d.ts +0 -1
- package/types/components/CodeField/CodeField.styles.d.ts.map +1 -1
- 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 +2 -3
- package/types/components/CodeField/utils/handleItemError.d.ts.map +1 -1
- package/types/components/CodeField/utils/index.d.ts +0 -1
- package/types/components/CodeField/utils/index.d.ts.map +1 -1
- package/types/examples/components/Autocomplete/Autocomplete.d.ts +40 -40
- package/types/examples/components/Autocomplete/Autocomplete.d.ts.map +1 -1
- package/cjs/components/CodeField/hooks/useWebOTP.js +0 -107
- package/cjs/components/CodeField/hooks/useWebOTP.js.map +0 -1
- package/cjs/components/CodeField/utils/isWebOTPSupported.js +0 -10
- package/cjs/components/CodeField/utils/isWebOTPSupported.js.map +0 -1
- package/emotion/cjs/components/CodeField/hooks/useWebOTP.js +0 -256
- package/emotion/cjs/components/CodeField/utils/isWebOTPSupported.js +0 -13
- package/emotion/es/components/CodeField/hooks/useWebOTP.js +0 -246
- package/emotion/es/components/CodeField/utils/isWebOTPSupported.js +0 -3
- package/es/components/CodeField/hooks/useWebOTP.js +0 -103
- package/es/components/CodeField/hooks/useWebOTP.js.map +0 -1
- package/es/components/CodeField/utils/isWebOTPSupported.js +0 -6
- package/es/components/CodeField/utils/isWebOTPSupported.js.map +0 -1
- package/styled-components/cjs/components/CodeField/hooks/useWebOTP.js +0 -256
- package/styled-components/cjs/components/CodeField/utils/isWebOTPSupported.js +0 -13
- package/styled-components/es/components/CodeField/hooks/useWebOTP.js +0 -246
- package/styled-components/es/components/CodeField/utils/isWebOTPSupported.js +0 -3
- package/types/components/CodeField/hooks/useWebOTP.d.ts +0 -24
- package/types/components/CodeField/hooks/useWebOTP.d.ts.map +0 -1
- package/types/components/CodeField/utils/isWebOTPSupported.d.ts +0 -2
- package/types/components/CodeField/utils/isWebOTPSupported.d.ts.map +0 -1
@@ -1,7 +0,0 @@
|
|
1
|
-
import { component, mergeConfig } from "../../../engines";
|
2
|
-
import { comboboxNewConfig } from "../../..";
|
3
|
-
import { config } from "./Combobox.config";
|
4
|
-
var mergedConfig = mergeConfig(comboboxNewConfig, config);
|
5
|
-
var ComboboxComponent = component(mergedConfig);
|
6
|
-
var Combobox = ComboboxComponent;
|
7
|
-
export { Combobox };
|
@@ -15,7 +15,7 @@ export type SuggestionItemType = {
|
|
15
15
|
*/
|
16
16
|
contentRight?: ReactNode;
|
17
17
|
};
|
18
|
-
export type AutocompleteProps = {
|
18
|
+
export type AutocompleteProps<T extends SuggestionItemType = SuggestionItemType> = {
|
19
19
|
/**
|
20
20
|
* Расположение лейбла.
|
21
21
|
* @default outer
|
@@ -48,7 +48,7 @@ export type AutocompleteProps = {
|
|
48
48
|
/**
|
49
49
|
* Массив подсказок.
|
50
50
|
*/
|
51
|
-
suggestions?:
|
51
|
+
suggestions?: T[];
|
52
52
|
/**
|
53
53
|
* Минимальное число введенных символов, при котором открывается дропдаун.
|
54
54
|
* @default 2
|
@@ -57,11 +57,11 @@ export type AutocompleteProps = {
|
|
57
57
|
/**
|
58
58
|
* Коллбэк фильтра подсказок.
|
59
59
|
*/
|
60
|
-
filter?: (data:
|
60
|
+
filter?: (data: T) => boolean;
|
61
61
|
/**
|
62
62
|
* Коллбэк, который срабатывает при выборе подсказки.
|
63
63
|
*/
|
64
|
-
onSuggestionSelect?: (data:
|
64
|
+
onSuggestionSelect?: (data: T) => void;
|
65
65
|
/**
|
66
66
|
* Коллбэк, срабатывающий при скролле.
|
67
67
|
*/
|
@@ -78,7 +78,7 @@ export type AutocompleteProps = {
|
|
78
78
|
/**
|
79
79
|
* Коллбэк для рендера кастомного списка подсказок.
|
80
80
|
*/
|
81
|
-
renderList?: (data?:
|
81
|
+
renderList?: (data?: T[]) => ReactNode;
|
82
82
|
/**
|
83
83
|
* Коллбэк для рендера элемента в конце выпадающего списка.
|
84
84
|
*/
|
@@ -86,7 +86,7 @@ export type AutocompleteProps = {
|
|
86
86
|
/**
|
87
87
|
* Callback для кастомной настройки элемента в выпадающем списке.
|
88
88
|
*/
|
89
|
-
renderItem?: (item:
|
89
|
+
renderItem?: (item: T) => React.ReactNode;
|
90
90
|
/**
|
91
91
|
* Ячейка для контента в начале выпадающего списка.
|
92
92
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Autocomplete.types.d.ts","sourceRoot":"","sources":["../../../src/components/Autocomplete/Autocomplete.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,mBAAmB,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE,MAAM,MAAM,kBAAkB,GAAG;IAC7B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB;;OAEG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;
|
1
|
+
{"version":3,"file":"Autocomplete.types.d.ts","sourceRoot":"","sources":["../../../src/components/Autocomplete/Autocomplete.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,mBAAmB,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE,MAAM,MAAM,kBAAkB,GAAG;IAC7B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB;;OAEG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,kBAAkB,GAAG,kBAAkB,IAAI;IAC/E;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAC/C;;OAEG;IACH,MAAM,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IACjC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,WAAW,CAAC,EAAE,CAAC,EAAE,CAAC;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;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CAAC,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;IACjG,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IACrC,MAAM,CAAC,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IACrC,SAAS,CAAC,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAC3C,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1B,IAAI,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC"}
|
@@ -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;AAUxD,eAAO,MAAM,aAAa,SAAU,SAAS,CAAC,cAAc,EAAE,cAAc,CAAC;;;;;;;;;;;;;;;;;;;sLAkRxE,CAAC;AAEN,eAAO,MAAM,eAAe;;;mBApRQ,SAAS,CAAC,cAAc,EAAE,cAAc,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6S5E,CAAC"}
|
@@ -7,5 +7,4 @@ 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>>;
|
11
10
|
//# 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"}
|
@@ -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
|
+
setCode: 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, setCode, 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,OAAO,EAAE,QAAQ,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACjD,UAAU,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;CAChD,CAAC;AAEF,eAAO,MAAM,eAAe,mHASzB,mBAAmB,SA8CrB,CAAC"}
|
@@ -6,10 +6,9 @@ type ValidateSymbolsArgs = {
|
|
6
6
|
index: number;
|
7
7
|
newCode: Array<string>;
|
8
8
|
inputRefs: MutableRefObject<Array<HTMLInputElement | null>>;
|
9
|
-
|
9
|
+
setCode: Dispatch<SetStateAction<Array<string>>>;
|
10
10
|
codeSetter: (newCode: Array<string>) => void;
|
11
|
-
onChange?: (value: string) => void;
|
12
11
|
};
|
13
|
-
export declare const handleItemError: ({ currentSymbol, itemErrorBehavior, index, newCode, inputRefs,
|
12
|
+
export declare const handleItemError: ({ currentSymbol, itemErrorBehavior, index, newCode, inputRefs, setCode, codeSetter, }: ValidateSymbolsArgs) => void;
|
14
13
|
export {};
|
15
14
|
//# 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,OAAO,EAAE,QAAQ,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACjD,UAAU,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;CAChD,CAAC;AAEF,eAAO,MAAM,eAAe,0FAQzB,mBAAmB,SA4CrB,CAAC"}
|
@@ -1,5 +1,4 @@
|
|
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';
|
5
4
|
//# 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"}
|
@@ -36,16 +36,16 @@ export declare const Autocomplete: import("react").FunctionComponent<import("../
|
|
36
36
|
zIndex?: import("react").CSSProperties["zIndex"];
|
37
37
|
value?: string;
|
38
38
|
defaultValue?: string;
|
39
|
-
suggestions?: import("../../../components/Autocomplete").SuggestionItemType[];
|
39
|
+
suggestions?: import("../../../components/Autocomplete").SuggestionItemType[] | undefined;
|
40
40
|
threshold?: number;
|
41
|
-
filter?: (data: import("../../../components/Autocomplete").SuggestionItemType) => boolean;
|
42
|
-
onSuggestionSelect?: (data: import("../../../components/Autocomplete").SuggestionItemType) => void;
|
41
|
+
filter?: ((data: import("../../../components/Autocomplete").SuggestionItemType) => boolean) | undefined;
|
42
|
+
onSuggestionSelect?: ((data: import("../../../components/Autocomplete").SuggestionItemType) => void) | undefined;
|
43
43
|
onScroll?: (e: React.UIEvent<HTMLElement>) => void;
|
44
44
|
listMaxHeight?: string;
|
45
45
|
listWidth?: string;
|
46
|
-
renderList?: (data?: import("../../../components/Autocomplete").SuggestionItemType[]) => import("react").ReactNode;
|
46
|
+
renderList?: ((data?: import("../../../components/Autocomplete").SuggestionItemType[] | undefined) => import("react").ReactNode) | undefined;
|
47
47
|
renderListEnd?: () => import("react").ReactNode;
|
48
|
-
renderItem?: (item: import("../../../components/Autocomplete").SuggestionItemType) => React.ReactNode;
|
48
|
+
renderItem?: ((item: import("../../../components/Autocomplete").SuggestionItemType) => React.ReactNode) | undefined;
|
49
49
|
beforeList?: import("react").ReactNode;
|
50
50
|
afterList?: import("react").ReactNode;
|
51
51
|
virtual?: boolean;
|
@@ -91,16 +91,16 @@ export declare const Autocomplete: import("react").FunctionComponent<import("../
|
|
91
91
|
zIndex?: import("react").CSSProperties["zIndex"];
|
92
92
|
value?: string;
|
93
93
|
defaultValue?: string;
|
94
|
-
suggestions?: import("../../../components/Autocomplete").SuggestionItemType[];
|
94
|
+
suggestions?: import("../../../components/Autocomplete").SuggestionItemType[] | undefined;
|
95
95
|
threshold?: number;
|
96
|
-
filter?: (data: import("../../../components/Autocomplete").SuggestionItemType) => boolean;
|
97
|
-
onSuggestionSelect?: (data: import("../../../components/Autocomplete").SuggestionItemType) => void;
|
96
|
+
filter?: ((data: import("../../../components/Autocomplete").SuggestionItemType) => boolean) | undefined;
|
97
|
+
onSuggestionSelect?: ((data: import("../../../components/Autocomplete").SuggestionItemType) => void) | undefined;
|
98
98
|
onScroll?: (e: React.UIEvent<HTMLElement>) => void;
|
99
99
|
listMaxHeight?: string;
|
100
100
|
listWidth?: string;
|
101
|
-
renderList?: (data?: import("../../../components/Autocomplete").SuggestionItemType[]) => import("react").ReactNode;
|
101
|
+
renderList?: ((data?: import("../../../components/Autocomplete").SuggestionItemType[] | undefined) => import("react").ReactNode) | undefined;
|
102
102
|
renderListEnd?: () => import("react").ReactNode;
|
103
|
-
renderItem?: (item: import("../../../components/Autocomplete").SuggestionItemType) => React.ReactNode;
|
103
|
+
renderItem?: ((item: import("../../../components/Autocomplete").SuggestionItemType) => React.ReactNode) | undefined;
|
104
104
|
beforeList?: import("react").ReactNode;
|
105
105
|
afterList?: import("react").ReactNode;
|
106
106
|
virtual?: boolean;
|
@@ -148,16 +148,16 @@ export declare const Autocomplete: import("react").FunctionComponent<import("../
|
|
148
148
|
zIndex?: import("react").CSSProperties["zIndex"];
|
149
149
|
value?: string;
|
150
150
|
defaultValue?: string;
|
151
|
-
suggestions?: import("../../../components/Autocomplete").SuggestionItemType[];
|
151
|
+
suggestions?: import("../../../components/Autocomplete").SuggestionItemType[] | undefined;
|
152
152
|
threshold?: number;
|
153
|
-
filter?: (data: import("../../../components/Autocomplete").SuggestionItemType) => boolean;
|
154
|
-
onSuggestionSelect?: (data: import("../../../components/Autocomplete").SuggestionItemType) => void;
|
153
|
+
filter?: ((data: import("../../../components/Autocomplete").SuggestionItemType) => boolean) | undefined;
|
154
|
+
onSuggestionSelect?: ((data: import("../../../components/Autocomplete").SuggestionItemType) => void) | undefined;
|
155
155
|
onScroll?: (e: React.UIEvent<HTMLElement>) => void;
|
156
156
|
listMaxHeight?: string;
|
157
157
|
listWidth?: string;
|
158
|
-
renderList?: (data?: import("../../../components/Autocomplete").SuggestionItemType[]) => import("react").ReactNode;
|
158
|
+
renderList?: ((data?: import("../../../components/Autocomplete").SuggestionItemType[] | undefined) => import("react").ReactNode) | undefined;
|
159
159
|
renderListEnd?: () => import("react").ReactNode;
|
160
|
-
renderItem?: (item: import("../../../components/Autocomplete").SuggestionItemType) => React.ReactNode;
|
160
|
+
renderItem?: ((item: import("../../../components/Autocomplete").SuggestionItemType) => React.ReactNode) | undefined;
|
161
161
|
beforeList?: import("react").ReactNode;
|
162
162
|
afterList?: import("react").ReactNode;
|
163
163
|
virtual?: boolean;
|
@@ -203,16 +203,16 @@ export declare const Autocomplete: import("react").FunctionComponent<import("../
|
|
203
203
|
zIndex?: import("react").CSSProperties["zIndex"];
|
204
204
|
value?: string;
|
205
205
|
defaultValue?: string;
|
206
|
-
suggestions?: import("../../../components/Autocomplete").SuggestionItemType[];
|
206
|
+
suggestions?: import("../../../components/Autocomplete").SuggestionItemType[] | undefined;
|
207
207
|
threshold?: number;
|
208
|
-
filter?: (data: import("../../../components/Autocomplete").SuggestionItemType) => boolean;
|
209
|
-
onSuggestionSelect?: (data: import("../../../components/Autocomplete").SuggestionItemType) => void;
|
208
|
+
filter?: ((data: import("../../../components/Autocomplete").SuggestionItemType) => boolean) | undefined;
|
209
|
+
onSuggestionSelect?: ((data: import("../../../components/Autocomplete").SuggestionItemType) => void) | undefined;
|
210
210
|
onScroll?: (e: React.UIEvent<HTMLElement>) => void;
|
211
211
|
listMaxHeight?: string;
|
212
212
|
listWidth?: string;
|
213
|
-
renderList?: (data?: import("../../../components/Autocomplete").SuggestionItemType[]) => import("react").ReactNode;
|
213
|
+
renderList?: ((data?: import("../../../components/Autocomplete").SuggestionItemType[] | undefined) => import("react").ReactNode) | undefined;
|
214
214
|
renderListEnd?: () => import("react").ReactNode;
|
215
|
-
renderItem?: (item: import("../../../components/Autocomplete").SuggestionItemType) => React.ReactNode;
|
215
|
+
renderItem?: ((item: import("../../../components/Autocomplete").SuggestionItemType) => React.ReactNode) | undefined;
|
216
216
|
beforeList?: import("react").ReactNode;
|
217
217
|
afterList?: import("react").ReactNode;
|
218
218
|
virtual?: boolean;
|
@@ -260,16 +260,16 @@ export declare const Autocomplete: import("react").FunctionComponent<import("../
|
|
260
260
|
zIndex?: import("react").CSSProperties["zIndex"];
|
261
261
|
value?: string;
|
262
262
|
defaultValue?: string;
|
263
|
-
suggestions?: import("../../../components/Autocomplete").SuggestionItemType[];
|
263
|
+
suggestions?: import("../../../components/Autocomplete").SuggestionItemType[] | undefined;
|
264
264
|
threshold?: number;
|
265
|
-
filter?: (data: import("../../../components/Autocomplete").SuggestionItemType) => boolean;
|
266
|
-
onSuggestionSelect?: (data: import("../../../components/Autocomplete").SuggestionItemType) => void;
|
265
|
+
filter?: ((data: import("../../../components/Autocomplete").SuggestionItemType) => boolean) | undefined;
|
266
|
+
onSuggestionSelect?: ((data: import("../../../components/Autocomplete").SuggestionItemType) => void) | undefined;
|
267
267
|
onScroll?: (e: React.UIEvent<HTMLElement>) => void;
|
268
268
|
listMaxHeight?: string;
|
269
269
|
listWidth?: string;
|
270
|
-
renderList?: (data?: import("../../../components/Autocomplete").SuggestionItemType[]) => import("react").ReactNode;
|
270
|
+
renderList?: ((data?: import("../../../components/Autocomplete").SuggestionItemType[] | undefined) => import("react").ReactNode) | undefined;
|
271
271
|
renderListEnd?: () => import("react").ReactNode;
|
272
|
-
renderItem?: (item: import("../../../components/Autocomplete").SuggestionItemType) => React.ReactNode;
|
272
|
+
renderItem?: ((item: import("../../../components/Autocomplete").SuggestionItemType) => React.ReactNode) | undefined;
|
273
273
|
beforeList?: import("react").ReactNode;
|
274
274
|
afterList?: import("react").ReactNode;
|
275
275
|
virtual?: boolean;
|
@@ -315,16 +315,16 @@ export declare const Autocomplete: import("react").FunctionComponent<import("../
|
|
315
315
|
zIndex?: import("react").CSSProperties["zIndex"];
|
316
316
|
value?: string;
|
317
317
|
defaultValue?: string;
|
318
|
-
suggestions?: import("../../../components/Autocomplete").SuggestionItemType[];
|
318
|
+
suggestions?: import("../../../components/Autocomplete").SuggestionItemType[] | undefined;
|
319
319
|
threshold?: number;
|
320
|
-
filter?: (data: import("../../../components/Autocomplete").SuggestionItemType) => boolean;
|
321
|
-
onSuggestionSelect?: (data: import("../../../components/Autocomplete").SuggestionItemType) => void;
|
320
|
+
filter?: ((data: import("../../../components/Autocomplete").SuggestionItemType) => boolean) | undefined;
|
321
|
+
onSuggestionSelect?: ((data: import("../../../components/Autocomplete").SuggestionItemType) => void) | undefined;
|
322
322
|
onScroll?: (e: React.UIEvent<HTMLElement>) => void;
|
323
323
|
listMaxHeight?: string;
|
324
324
|
listWidth?: string;
|
325
|
-
renderList?: (data?: import("../../../components/Autocomplete").SuggestionItemType[]) => import("react").ReactNode;
|
325
|
+
renderList?: ((data?: import("../../../components/Autocomplete").SuggestionItemType[] | undefined) => import("react").ReactNode) | undefined;
|
326
326
|
renderListEnd?: () => import("react").ReactNode;
|
327
|
-
renderItem?: (item: import("../../../components/Autocomplete").SuggestionItemType) => React.ReactNode;
|
327
|
+
renderItem?: ((item: import("../../../components/Autocomplete").SuggestionItemType) => React.ReactNode) | undefined;
|
328
328
|
beforeList?: import("react").ReactNode;
|
329
329
|
afterList?: import("react").ReactNode;
|
330
330
|
virtual?: boolean;
|
@@ -372,16 +372,16 @@ export declare const Autocomplete: import("react").FunctionComponent<import("../
|
|
372
372
|
zIndex?: import("react").CSSProperties["zIndex"];
|
373
373
|
value?: string;
|
374
374
|
defaultValue?: string;
|
375
|
-
suggestions?: import("../../../components/Autocomplete").SuggestionItemType[];
|
375
|
+
suggestions?: import("../../../components/Autocomplete").SuggestionItemType[] | undefined;
|
376
376
|
threshold?: number;
|
377
|
-
filter?: (data: import("../../../components/Autocomplete").SuggestionItemType) => boolean;
|
378
|
-
onSuggestionSelect?: (data: import("../../../components/Autocomplete").SuggestionItemType) => void;
|
377
|
+
filter?: ((data: import("../../../components/Autocomplete").SuggestionItemType) => boolean) | undefined;
|
378
|
+
onSuggestionSelect?: ((data: import("../../../components/Autocomplete").SuggestionItemType) => void) | undefined;
|
379
379
|
onScroll?: (e: React.UIEvent<HTMLElement>) => void;
|
380
380
|
listMaxHeight?: string;
|
381
381
|
listWidth?: string;
|
382
|
-
renderList?: (data?: import("../../../components/Autocomplete").SuggestionItemType[]) => import("react").ReactNode;
|
382
|
+
renderList?: ((data?: import("../../../components/Autocomplete").SuggestionItemType[] | undefined) => import("react").ReactNode) | undefined;
|
383
383
|
renderListEnd?: () => import("react").ReactNode;
|
384
|
-
renderItem?: (item: import("../../../components/Autocomplete").SuggestionItemType) => React.ReactNode;
|
384
|
+
renderItem?: ((item: import("../../../components/Autocomplete").SuggestionItemType) => React.ReactNode) | undefined;
|
385
385
|
beforeList?: import("react").ReactNode;
|
386
386
|
afterList?: import("react").ReactNode;
|
387
387
|
virtual?: boolean;
|
@@ -427,16 +427,16 @@ export declare const Autocomplete: import("react").FunctionComponent<import("../
|
|
427
427
|
zIndex?: import("react").CSSProperties["zIndex"];
|
428
428
|
value?: string;
|
429
429
|
defaultValue?: string;
|
430
|
-
suggestions?: import("../../../components/Autocomplete").SuggestionItemType[];
|
430
|
+
suggestions?: import("../../../components/Autocomplete").SuggestionItemType[] | undefined;
|
431
431
|
threshold?: number;
|
432
|
-
filter?: (data: import("../../../components/Autocomplete").SuggestionItemType) => boolean;
|
433
|
-
onSuggestionSelect?: (data: import("../../../components/Autocomplete").SuggestionItemType) => void;
|
432
|
+
filter?: ((data: import("../../../components/Autocomplete").SuggestionItemType) => boolean) | undefined;
|
433
|
+
onSuggestionSelect?: ((data: import("../../../components/Autocomplete").SuggestionItemType) => void) | undefined;
|
434
434
|
onScroll?: (e: React.UIEvent<HTMLElement>) => void;
|
435
435
|
listMaxHeight?: string;
|
436
436
|
listWidth?: string;
|
437
|
-
renderList?: (data?: import("../../../components/Autocomplete").SuggestionItemType[]) => import("react").ReactNode;
|
437
|
+
renderList?: ((data?: import("../../../components/Autocomplete").SuggestionItemType[] | undefined) => import("react").ReactNode) | undefined;
|
438
438
|
renderListEnd?: () => import("react").ReactNode;
|
439
|
-
renderItem?: (item: import("../../../components/Autocomplete").SuggestionItemType) => React.ReactNode;
|
439
|
+
renderItem?: ((item: import("../../../components/Autocomplete").SuggestionItemType) => React.ReactNode) | undefined;
|
440
440
|
beforeList?: import("react").ReactNode;
|
441
441
|
afterList?: import("react").ReactNode;
|
442
442
|
virtual?: boolean;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Autocomplete.d.ts","sourceRoot":"","sources":["../../../../src/examples/components/Autocomplete/Autocomplete.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
1
|
+
{"version":3,"file":"Autocomplete.d.ts","sourceRoot":"","sources":["../../../../src/examples/components/Autocomplete/Autocomplete.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAC+jB,MAAO,SAAS;;;;;;;;mBAA8uB,MAAO,OAAO;;;;;2FAAmkB,MAAO,SAAS;;;;;;;;;;kBAAyiH,MAAO,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@@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
4
|
-
|
5
|
-
var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
|
6
|
-
var React = require('react');
|
7
|
-
var isWebOTPSupported = require('../utils/isWebOTPSupported.js');
|
8
|
-
var initialValuesHelper = require('../utils/initialValuesHelper.js');
|
9
|
-
|
10
|
-
// Type guard function to check if credential is OTPCredential
|
11
|
-
var isOTPCredential = function isOTPCredential(credential) {
|
12
|
-
return credential !== null && 'code' in credential;
|
13
|
-
};
|
14
|
-
var useWebOTP = function useWebOTP(_ref) {
|
15
|
-
var codeString = _ref.codeString,
|
16
|
-
enableSMSAutoRead = _ref.enableSMSAutoRead,
|
17
|
-
disabled = _ref.disabled,
|
18
|
-
codeLength = _ref.codeLength,
|
19
|
-
codeSetter = _ref.codeSetter,
|
20
|
-
onFullCodeEnter = _ref.onFullCodeEnter,
|
21
|
-
setOtpVal = _ref.setOtpVal;
|
22
|
-
var abortControllerRef = React.useRef(null);
|
23
|
-
var startWebOTPListener = React.useCallback(/*#__PURE__*/_rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regeneratorRuntime().mark(function _callee() {
|
24
|
-
var otp, otpCode, newCode;
|
25
|
-
return _rollupPluginBabelHelpers.regeneratorRuntime().wrap(function _callee$(_context) {
|
26
|
-
while (1) switch (_context.prev = _context.next) {
|
27
|
-
case 0:
|
28
|
-
if (!(!enableSMSAutoRead || disabled || !isWebOTPSupported.isWebOTPSupported())) {
|
29
|
-
_context.next = 2;
|
30
|
-
break;
|
31
|
-
}
|
32
|
-
return _context.abrupt("return");
|
33
|
-
case 2:
|
34
|
-
if (abortControllerRef.current) {
|
35
|
-
abortControllerRef.current.abort();
|
36
|
-
}
|
37
|
-
abortControllerRef.current = new AbortController();
|
38
|
-
_context.prev = 4;
|
39
|
-
_context.next = 7;
|
40
|
-
return navigator.credentials.get({
|
41
|
-
otp: {
|
42
|
-
transport: ['sms']
|
43
|
-
},
|
44
|
-
signal: abortControllerRef.current.signal
|
45
|
-
});
|
46
|
-
case 7:
|
47
|
-
otp = _context.sent;
|
48
|
-
console.log('otp received', otp);
|
49
|
-
setOtpVal(otp);
|
50
|
-
|
51
|
-
// Type guard to check if it's an OTP credential
|
52
|
-
if (otp && isOTPCredential(otp) && otp.code) {
|
53
|
-
otpCode = otp.code; // Validate the OTP code length matches our expected length
|
54
|
-
if (otpCode.length === codeLength) {
|
55
|
-
newCode = initialValuesHelper.getCodeValue(codeLength, otpCode);
|
56
|
-
codeSetter(newCode);
|
57
|
-
|
58
|
-
// Trigger full code enter callback
|
59
|
-
if (onFullCodeEnter) {
|
60
|
-
onFullCodeEnter(otpCode);
|
61
|
-
}
|
62
|
-
}
|
63
|
-
}
|
64
|
-
_context.next = 16;
|
65
|
-
break;
|
66
|
-
case 13:
|
67
|
-
_context.prev = 13;
|
68
|
-
_context.t0 = _context["catch"](4);
|
69
|
-
if (_context.t0 instanceof DOMException) {
|
70
|
-
if (_context.t0.name !== 'AbortError' && _context.t0.name !== 'NotAllowedError') {
|
71
|
-
console.warn('Web OTP API error:', _context.t0);
|
72
|
-
}
|
73
|
-
} else if (_context.t0 instanceof Error) {
|
74
|
-
console.warn('Web OTP API error:', _context.t0);
|
75
|
-
} else {
|
76
|
-
console.warn('Unknown Web OTP API error:', _context.t0);
|
77
|
-
}
|
78
|
-
case 16:
|
79
|
-
case "end":
|
80
|
-
return _context.stop();
|
81
|
-
}
|
82
|
-
}, _callee, null, [[4, 13]]);
|
83
|
-
})), [enableSMSAutoRead, disabled, codeLength, onFullCodeEnter]);
|
84
|
-
var stopWebOTPListener = React.useCallback(function () {
|
85
|
-
if (abortControllerRef.current) {
|
86
|
-
abortControllerRef.current.abort();
|
87
|
-
abortControllerRef.current = null;
|
88
|
-
}
|
89
|
-
}, []);
|
90
|
-
React.useEffect(function () {
|
91
|
-
if (isWebOTPSupported.isWebOTPSupported() && codeString === '' && enableSMSAutoRead && !disabled) {
|
92
|
-
startWebOTPListener();
|
93
|
-
} else {
|
94
|
-
stopWebOTPListener();
|
95
|
-
}
|
96
|
-
return function () {
|
97
|
-
stopWebOTPListener();
|
98
|
-
};
|
99
|
-
}, [codeString, enableSMSAutoRead, disabled, startWebOTPListener, stopWebOTPListener]);
|
100
|
-
return {
|
101
|
-
startWebOTPListener: startWebOTPListener,
|
102
|
-
stopWebOTPListener: stopWebOTPListener
|
103
|
-
};
|
104
|
-
};
|
105
|
-
|
106
|
-
exports.useWebOTP = useWebOTP;
|
107
|
-
//# sourceMappingURL=useWebOTP.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"useWebOTP.js","sources":["../../../../src/components/CodeField/hooks/useWebOTP.ts"],"sourcesContent":["import { useCallback, useEffect, useRef } from 'react';\n\nimport { getCodeValue, isWebOTPSupported } from '../utils';\n\ntype UseWebOTPProps = {\n codeString: string;\n enableSMSAutoRead: boolean;\n disabled: boolean;\n codeLength: number;\n codeSetter: (newCode: Array<string>) => void;\n onFullCodeEnter?: (code: string) => void;\n setOtpVal: React.Dispatch<React.SetStateAction<Credential | null>>;\n};\n\ntype OTPTransport = 'sms';\n\ninterface OTPCredential extends Credential {\n code: string;\n}\n\ndeclare global {\n interface CredentialRequestOptions {\n otp?: {\n transport: OTPTransport[];\n };\n signal?: AbortSignal;\n }\n}\n\n// Type guard function to check if credential is OTPCredential\nconst isOTPCredential = (credential: Credential | null): credential is OTPCredential => {\n return credential !== null && 'code' in credential;\n};\n\nexport const useWebOTP = ({\n codeString,\n enableSMSAutoRead,\n disabled,\n codeLength,\n codeSetter,\n onFullCodeEnter,\n setOtpVal,\n}: UseWebOTPProps) => {\n const abortControllerRef = useRef<AbortController | null>(null);\n\n const startWebOTPListener = useCallback(async () => {\n if (!enableSMSAutoRead || disabled || !isWebOTPSupported()) {\n return;\n }\n\n if (abortControllerRef.current) {\n abortControllerRef.current.abort();\n }\n\n abortControllerRef.current = new AbortController();\n\n try {\n const otp = await navigator.credentials.get({\n otp: { transport: ['sms'] as OTPTransport[] },\n signal: abortControllerRef.current.signal,\n });\n\n console.log('otp received', otp);\n\n setOtpVal(otp);\n\n // Type guard to check if it's an OTP credential\n if (otp && isOTPCredential(otp) && otp.code) {\n const otpCode = otp.code;\n\n // Validate the OTP code length matches our expected length\n if (otpCode.length === codeLength) {\n const newCode = getCodeValue(codeLength, otpCode);\n codeSetter(newCode);\n\n // Trigger full code enter callback\n if (onFullCodeEnter) {\n onFullCodeEnter(otpCode);\n }\n }\n }\n } catch (err) {\n if (err instanceof DOMException) {\n if (err.name !== 'AbortError' && err.name !== 'NotAllowedError') {\n console.warn('Web OTP API error:', err);\n }\n } else if (err instanceof Error) {\n console.warn('Web OTP API error:', err);\n } else {\n console.warn('Unknown Web OTP API error:', err);\n }\n }\n }, [enableSMSAutoRead, disabled, codeLength, onFullCodeEnter]);\n\n const stopWebOTPListener = useCallback(() => {\n if (abortControllerRef.current) {\n abortControllerRef.current.abort();\n abortControllerRef.current = null;\n }\n }, []);\n\n useEffect(() => {\n if (isWebOTPSupported() && codeString === '' && enableSMSAutoRead && !disabled) {\n startWebOTPListener();\n } else {\n stopWebOTPListener();\n }\n\n return () => {\n stopWebOTPListener();\n };\n }, [codeString, enableSMSAutoRead, disabled, startWebOTPListener, stopWebOTPListener]);\n\n return { startWebOTPListener, stopWebOTPListener };\n};\n"],"names":["isOTPCredential","credential","useWebOTP","_ref","codeString","enableSMSAutoRead","disabled","codeLength","codeSetter","onFullCodeEnter","setOtpVal","abortControllerRef","useRef","startWebOTPListener","useCallback","_asyncToGenerator","_regeneratorRuntime","mark","_callee","otp","otpCode","newCode","wrap","_callee$","_context","prev","next","isWebOTPSupported","abrupt","current","abort","AbortController","navigator","credentials","get","transport","signal","sent","console","log","code","length","getCodeValue","t0","DOMException","name","warn","Error","stop","stopWebOTPListener","useEffect"],"mappings":";;;;;;;;;AA6BA;AACA,IAAMA,eAAe,GAAG,SAA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iB,IAAI,CAACC,QAAQ,EAAE;AAC5EO,MAAAA,mBAAmB,EAAE,CAAA;AACzB,KAAC,MAAM;AACHoC,MAAAA,kBAAkB,EAAE,CAAA;AACxB,KAAA;AAEA,IAAA,OAAO,YAAM;AACTA,MAAAA,kBAAkB,EAAE,CAAA;KACvB,CAAA;AACL,GAAC,EAAE,CAAC7C,UAAU,EAAEC,iBAAiB,EAAEC,QAAQ,EAAEO,mBAAmB,EAAEoC,kBAAkB,CAAC,CAAC,CAAA;EAEtF,OAAO;AAAEpC,IAAAA,mBAAmB,EAAnBA,mBAAmB;AAAEoC,IAAAA,kBAAkB,EAAlBA,kBAAAA;GAAoB,CAAA;AACtD;;;;"}
|
@@ -1,10 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
4
|
-
|
5
|
-
var isWebOTPSupported = function isWebOTPSupported() {
|
6
|
-
return typeof window !== 'undefined' && 'OTPCredential' in window && navigator.credentials && typeof navigator.credentials.get === 'function';
|
7
|
-
};
|
8
|
-
|
9
|
-
exports.isWebOTPSupported = isWebOTPSupported;
|
10
|
-
//# sourceMappingURL=isWebOTPSupported.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"isWebOTPSupported.js","sources":["../../../../src/components/CodeField/utils/isWebOTPSupported.ts"],"sourcesContent":["export const isWebOTPSupported = () => {\n return (\n typeof window !== 'undefined' &&\n 'OTPCredential' in window &&\n navigator.credentials &&\n typeof navigator.credentials.get === 'function'\n );\n};\n"],"names":["isWebOTPSupported","window","navigator","credentials","get"],"mappings":";;;;IAAaA,iBAAiB,GAAG,SAApBA,iBAAiBA,GAAS;EACnC,OACI,OAAOC,MAAM,KAAK,WAAW,IAC7B,eAAe,IAAIA,MAAM,IACzBC,SAAS,CAACC,WAAW,IACrB,OAAOD,SAAS,CAACC,WAAW,CAACC,GAAG,KAAK,UAAU,CAAA;AAEvD;;;;"}
|