@radix-ui/react-one-time-password-field 0.1.0-rc.1744661316162
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/LICENSE +21 -0
- package/README.md +13 -0
- package/dist/index.d.mts +45 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.js +612 -0
- package/dist/index.js.map +7 -0
- package/dist/index.mjs +580 -0
- package/dist/index.mjs.map +7 -0
- package/package.json +80 -0
- package/src/index.ts +16 -0
- package/src/one-time-password-field.test.tsx +50 -0
- package/src/one-time-password-field.tsx +823 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 WorkOS
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Primitive } from '@radix-ui/react-primitive';
|
|
2
|
+
import * as RovingFocusGroup from '@radix-ui/react-roving-focus';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
type InputType = 'password' | 'text';
|
|
6
|
+
type AutoComplete = 'off' | 'one-time-code';
|
|
7
|
+
type InputValidationType = 'alpha' | 'numeric' | 'alphanumeric' | 'none';
|
|
8
|
+
type RovingFocusGroupProps = React.ComponentPropsWithoutRef<typeof RovingFocusGroup.Root>;
|
|
9
|
+
interface OneTimePasswordFieldOwnProps {
|
|
10
|
+
onValueChange?: (value: string) => void;
|
|
11
|
+
id?: string;
|
|
12
|
+
value?: string;
|
|
13
|
+
defaultValue?: string;
|
|
14
|
+
autoSubmit?: boolean;
|
|
15
|
+
onAutoSubmit?: (value: string) => void;
|
|
16
|
+
validationType?: InputValidationType;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
readOnly?: boolean;
|
|
19
|
+
autoComplete?: AutoComplete;
|
|
20
|
+
autoFocus?: boolean;
|
|
21
|
+
form?: string | undefined;
|
|
22
|
+
name?: string | undefined;
|
|
23
|
+
placeholder?: string | undefined;
|
|
24
|
+
required?: boolean;
|
|
25
|
+
type?: InputType;
|
|
26
|
+
dir?: RovingFocusGroupProps['dir'];
|
|
27
|
+
orientation?: RovingFocusGroupProps['orientation'];
|
|
28
|
+
}
|
|
29
|
+
interface OneTimePasswordFieldProps extends OneTimePasswordFieldOwnProps, Omit<React.ComponentPropsWithoutRef<typeof Primitive.div>, keyof OneTimePasswordFieldOwnProps> {
|
|
30
|
+
}
|
|
31
|
+
declare const OneTimePasswordField: React.ForwardRefExoticComponent<OneTimePasswordFieldProps & React.RefAttributes<HTMLDivElement>>;
|
|
32
|
+
interface OneTimePasswordFieldHiddenInputProps extends Omit<React.ComponentProps<'input'>, keyof 'value' | 'defaultValue' | 'type' | 'onChange' | 'readOnly' | 'disabled' | 'autoComplete' | 'autoFocus'> {
|
|
33
|
+
}
|
|
34
|
+
declare const OneTimePasswordFieldHiddenInput: React.ForwardRefExoticComponent<Omit<OneTimePasswordFieldHiddenInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
35
|
+
interface OneTimePasswordFieldInputOwnProps {
|
|
36
|
+
autoComplete?: 'one-time-code' | 'off';
|
|
37
|
+
}
|
|
38
|
+
interface OneTimePasswordFieldInputProps extends OneTimePasswordFieldInputOwnProps, Omit<React.ComponentProps<typeof Primitive.input>, keyof OneTimePasswordFieldInputOwnProps> {
|
|
39
|
+
}
|
|
40
|
+
declare const OneTimePasswordFieldInput: React.ForwardRefExoticComponent<Omit<OneTimePasswordFieldInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
41
|
+
declare const Root: React.ForwardRefExoticComponent<OneTimePasswordFieldProps & React.RefAttributes<HTMLDivElement>>;
|
|
42
|
+
declare const Input: React.ForwardRefExoticComponent<Omit<OneTimePasswordFieldInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
43
|
+
declare const HiddenInput: React.ForwardRefExoticComponent<Omit<OneTimePasswordFieldHiddenInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
44
|
+
|
|
45
|
+
export { HiddenInput, Input, type InputValidationType, OneTimePasswordField, OneTimePasswordFieldHiddenInput, type OneTimePasswordFieldHiddenInputProps, OneTimePasswordFieldInput, type OneTimePasswordFieldInputProps, type OneTimePasswordFieldProps, Root };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Primitive } from '@radix-ui/react-primitive';
|
|
2
|
+
import * as RovingFocusGroup from '@radix-ui/react-roving-focus';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
type InputType = 'password' | 'text';
|
|
6
|
+
type AutoComplete = 'off' | 'one-time-code';
|
|
7
|
+
type InputValidationType = 'alpha' | 'numeric' | 'alphanumeric' | 'none';
|
|
8
|
+
type RovingFocusGroupProps = React.ComponentPropsWithoutRef<typeof RovingFocusGroup.Root>;
|
|
9
|
+
interface OneTimePasswordFieldOwnProps {
|
|
10
|
+
onValueChange?: (value: string) => void;
|
|
11
|
+
id?: string;
|
|
12
|
+
value?: string;
|
|
13
|
+
defaultValue?: string;
|
|
14
|
+
autoSubmit?: boolean;
|
|
15
|
+
onAutoSubmit?: (value: string) => void;
|
|
16
|
+
validationType?: InputValidationType;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
readOnly?: boolean;
|
|
19
|
+
autoComplete?: AutoComplete;
|
|
20
|
+
autoFocus?: boolean;
|
|
21
|
+
form?: string | undefined;
|
|
22
|
+
name?: string | undefined;
|
|
23
|
+
placeholder?: string | undefined;
|
|
24
|
+
required?: boolean;
|
|
25
|
+
type?: InputType;
|
|
26
|
+
dir?: RovingFocusGroupProps['dir'];
|
|
27
|
+
orientation?: RovingFocusGroupProps['orientation'];
|
|
28
|
+
}
|
|
29
|
+
interface OneTimePasswordFieldProps extends OneTimePasswordFieldOwnProps, Omit<React.ComponentPropsWithoutRef<typeof Primitive.div>, keyof OneTimePasswordFieldOwnProps> {
|
|
30
|
+
}
|
|
31
|
+
declare const OneTimePasswordField: React.ForwardRefExoticComponent<OneTimePasswordFieldProps & React.RefAttributes<HTMLDivElement>>;
|
|
32
|
+
interface OneTimePasswordFieldHiddenInputProps extends Omit<React.ComponentProps<'input'>, keyof 'value' | 'defaultValue' | 'type' | 'onChange' | 'readOnly' | 'disabled' | 'autoComplete' | 'autoFocus'> {
|
|
33
|
+
}
|
|
34
|
+
declare const OneTimePasswordFieldHiddenInput: React.ForwardRefExoticComponent<Omit<OneTimePasswordFieldHiddenInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
35
|
+
interface OneTimePasswordFieldInputOwnProps {
|
|
36
|
+
autoComplete?: 'one-time-code' | 'off';
|
|
37
|
+
}
|
|
38
|
+
interface OneTimePasswordFieldInputProps extends OneTimePasswordFieldInputOwnProps, Omit<React.ComponentProps<typeof Primitive.input>, keyof OneTimePasswordFieldInputOwnProps> {
|
|
39
|
+
}
|
|
40
|
+
declare const OneTimePasswordFieldInput: React.ForwardRefExoticComponent<Omit<OneTimePasswordFieldInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
41
|
+
declare const Root: React.ForwardRefExoticComponent<OneTimePasswordFieldProps & React.RefAttributes<HTMLDivElement>>;
|
|
42
|
+
declare const Input: React.ForwardRefExoticComponent<Omit<OneTimePasswordFieldInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
43
|
+
declare const HiddenInput: React.ForwardRefExoticComponent<Omit<OneTimePasswordFieldHiddenInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
44
|
+
|
|
45
|
+
export { HiddenInput, Input, type InputValidationType, OneTimePasswordField, OneTimePasswordFieldHiddenInput, type OneTimePasswordFieldHiddenInputProps, OneTimePasswordFieldInput, type OneTimePasswordFieldInputProps, type OneTimePasswordFieldProps, Root };
|