@cdx-ui/primitives 0.0.1-alpha.35 → 0.0.1-alpha.37
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/lib/commonjs/{form-control/createFormError.js → field/createFieldError.js} +4 -4
- package/lib/commonjs/field/createFieldError.js.map +1 -0
- package/lib/commonjs/{form-control/createFormErrorIcon.js → field/createFieldErrorIcon.js} +4 -4
- package/lib/commonjs/field/createFieldErrorIcon.js.map +1 -0
- package/lib/commonjs/{form-control/createFormErrorText.js → field/createFieldErrorText.js} +4 -4
- package/lib/commonjs/field/createFieldErrorText.js.map +1 -0
- package/lib/commonjs/{form-control/createFormHelper.js → field/createFieldHelper.js} +4 -4
- package/lib/commonjs/field/createFieldHelper.js.map +1 -0
- package/lib/commonjs/{form-control/createFormHelperText.js → field/createFieldHelperText.js} +4 -4
- package/lib/commonjs/field/createFieldHelperText.js.map +1 -0
- package/lib/commonjs/{form-control/createFormLabel.js → field/createFieldLabel.js} +4 -6
- package/lib/commonjs/field/createFieldLabel.js.map +1 -0
- package/lib/commonjs/{form-control/createFormField.js → field/createFieldRoot.js} +4 -4
- package/lib/commonjs/field/createFieldRoot.js.map +1 -0
- package/lib/commonjs/field/index.js +46 -0
- package/lib/commonjs/field/index.js.map +1 -0
- package/lib/commonjs/{form-control → field}/types.js.map +1 -1
- package/lib/commonjs/form/createFormRoot.js.map +1 -0
- package/lib/commonjs/form/index.js +15 -0
- package/lib/commonjs/form/index.js.map +1 -0
- package/lib/commonjs/form/types.js +6 -0
- package/lib/{module/form-control → commonjs/form}/types.js.map +1 -1
- package/lib/commonjs/index.js +28 -4
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/otp-input/context.js +14 -0
- package/lib/commonjs/otp-input/context.js.map +1 -0
- package/lib/commonjs/otp-input/createOtpInputCell.js +29 -0
- package/lib/commonjs/otp-input/createOtpInputCell.js.map +1 -0
- package/lib/commonjs/otp-input/createOtpInputField.js +104 -0
- package/lib/commonjs/otp-input/createOtpInputField.js.map +1 -0
- package/lib/commonjs/otp-input/createOtpInputRoot.js +136 -0
- package/lib/commonjs/otp-input/createOtpInputRoot.js.map +1 -0
- package/lib/commonjs/otp-input/index.js +48 -0
- package/lib/commonjs/otp-input/index.js.map +1 -0
- package/lib/commonjs/otp-input/types.js +6 -0
- package/lib/commonjs/otp-input/types.js.map +1 -0
- package/lib/commonjs/otp-input/utils/applyValueChange.js +73 -0
- package/lib/commonjs/otp-input/utils/applyValueChange.js.map +1 -0
- package/lib/commonjs/otp-input/utils/filterValue.js +46 -0
- package/lib/commonjs/otp-input/utils/filterValue.js.map +1 -0
- package/lib/module/{form-control/createFormError.js → field/createFieldError.js} +2 -2
- package/lib/module/field/createFieldError.js.map +1 -0
- package/lib/module/{form-control/createFormErrorIcon.js → field/createFieldErrorIcon.js} +2 -2
- package/lib/module/field/createFieldErrorIcon.js.map +1 -0
- package/lib/module/{form-control/createFormErrorText.js → field/createFieldErrorText.js} +2 -2
- package/lib/module/field/createFieldErrorText.js.map +1 -0
- package/lib/module/{form-control/createFormHelper.js → field/createFieldHelper.js} +2 -2
- package/lib/module/field/createFieldHelper.js.map +1 -0
- package/lib/module/{form-control/createFormHelperText.js → field/createFieldHelperText.js} +2 -2
- package/lib/module/field/createFieldHelperText.js.map +1 -0
- package/lib/module/{form-control/createFormLabel.js → field/createFieldLabel.js} +2 -4
- package/lib/module/field/createFieldLabel.js.map +1 -0
- package/lib/module/{form-control/createFormField.js → field/createFieldRoot.js} +2 -2
- package/lib/module/field/createFieldRoot.js.map +1 -0
- package/lib/module/field/index.js +42 -0
- package/lib/module/field/index.js.map +1 -0
- package/lib/module/field/types.js.map +1 -0
- package/lib/module/form/createFormRoot.js.map +1 -0
- package/lib/module/form/index.js +11 -0
- package/lib/module/form/index.js.map +1 -0
- package/lib/module/form/types.js +4 -0
- package/lib/module/form/types.js.map +1 -0
- package/lib/module/index.js +3 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/otp-input/context.js +6 -0
- package/lib/module/otp-input/context.js.map +1 -0
- package/lib/module/otp-input/createOtpInputCell.js +24 -0
- package/lib/module/otp-input/createOtpInputCell.js.map +1 -0
- package/lib/module/otp-input/createOtpInputField.js +99 -0
- package/lib/module/otp-input/createOtpInputField.js.map +1 -0
- package/lib/module/otp-input/createOtpInputRoot.js +131 -0
- package/lib/module/otp-input/createOtpInputRoot.js.map +1 -0
- package/lib/module/otp-input/index.js +20 -0
- package/lib/module/otp-input/index.js.map +1 -0
- package/lib/module/otp-input/types.js +4 -0
- package/lib/module/otp-input/types.js.map +1 -0
- package/lib/module/otp-input/utils/applyValueChange.js +69 -0
- package/lib/module/otp-input/utils/applyValueChange.js.map +1 -0
- package/lib/module/otp-input/utils/filterValue.js +40 -0
- package/lib/module/otp-input/utils/filterValue.js.map +1 -0
- package/lib/typescript/field/createFieldError.d.ts +5 -0
- package/lib/typescript/field/createFieldError.d.ts.map +1 -0
- package/lib/typescript/field/createFieldErrorIcon.d.ts +5 -0
- package/lib/typescript/field/createFieldErrorIcon.d.ts.map +1 -0
- package/lib/typescript/field/createFieldErrorText.d.ts +5 -0
- package/lib/typescript/field/createFieldErrorText.d.ts.map +1 -0
- package/lib/typescript/field/createFieldHelper.d.ts +5 -0
- package/lib/typescript/field/createFieldHelper.d.ts.map +1 -0
- package/lib/typescript/field/createFieldHelperText.d.ts +5 -0
- package/lib/typescript/field/createFieldHelperText.d.ts.map +1 -0
- package/lib/typescript/field/createFieldLabel.d.ts +6 -0
- package/lib/typescript/field/createFieldLabel.d.ts.map +1 -0
- package/lib/typescript/field/createFieldRoot.d.ts +6 -0
- package/lib/typescript/field/createFieldRoot.d.ts.map +1 -0
- package/lib/typescript/field/index.d.ts +13 -0
- package/lib/typescript/field/index.d.ts.map +1 -0
- package/lib/typescript/{form-control → field}/types.d.ts +14 -24
- package/lib/typescript/field/types.d.ts.map +1 -0
- package/lib/typescript/form/createFormRoot.d.ts +4 -0
- package/lib/typescript/form/createFormRoot.d.ts.map +1 -0
- package/lib/typescript/form/index.d.ts +6 -0
- package/lib/typescript/form/index.d.ts.map +1 -0
- package/lib/typescript/form/types.d.ts +14 -0
- package/lib/typescript/form/types.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +3 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/otp-input/context.d.ts +10 -0
- package/lib/typescript/otp-input/context.d.ts.map +1 -0
- package/lib/typescript/otp-input/createOtpInputCell.d.ts +4 -0
- package/lib/typescript/otp-input/createOtpInputCell.d.ts.map +1 -0
- package/lib/typescript/otp-input/createOtpInputField.d.ts +4 -0
- package/lib/typescript/otp-input/createOtpInputField.d.ts.map +1 -0
- package/lib/typescript/otp-input/createOtpInputRoot.d.ts +4 -0
- package/lib/typescript/otp-input/createOtpInputRoot.d.ts.map +1 -0
- package/lib/typescript/otp-input/index.d.ts +11 -0
- package/lib/typescript/otp-input/index.d.ts.map +1 -0
- package/lib/typescript/otp-input/types.d.ts +75 -0
- package/lib/typescript/otp-input/types.d.ts.map +1 -0
- package/lib/typescript/otp-input/utils/applyValueChange.d.ts +10 -0
- package/lib/typescript/otp-input/utils/applyValueChange.d.ts.map +1 -0
- package/lib/typescript/otp-input/utils/filterValue.d.ts +7 -0
- package/lib/typescript/otp-input/utils/filterValue.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/{form-control/createFormError.tsx → field/createFieldError.tsx} +1 -1
- package/src/{form-control/createFormErrorIcon.tsx → field/createFieldErrorIcon.tsx} +1 -1
- package/src/{form-control/createFormErrorText.tsx → field/createFieldErrorText.tsx} +1 -1
- package/src/{form-control/createFormHelper.tsx → field/createFieldHelper.tsx} +1 -1
- package/src/{form-control/createFormHelperText.tsx → field/createFieldHelperText.tsx} +1 -1
- package/src/{form-control/createFormLabel.tsx → field/createFieldLabel.tsx} +3 -3
- package/src/{form-control/createFormField.tsx → field/createFieldRoot.tsx} +3 -3
- package/src/field/index.tsx +68 -0
- package/src/{form-control → field}/types.tsx +28 -42
- package/src/{form-control → form}/createFormRoot.tsx +3 -3
- package/src/form/index.tsx +12 -0
- package/src/form/types.tsx +16 -0
- package/src/index.ts +3 -1
- package/src/otp-input/context.tsx +8 -0
- package/src/otp-input/createOtpInputCell.tsx +22 -0
- package/src/otp-input/createOtpInputField.tsx +98 -0
- package/src/otp-input/createOtpInputRoot.tsx +179 -0
- package/src/otp-input/index.tsx +34 -0
- package/src/otp-input/types.ts +92 -0
- package/src/otp-input/utils/applyValueChange.ts +56 -0
- package/src/otp-input/utils/filterValue.ts +37 -0
- package/lib/commonjs/form-control/createFormError.js.map +0 -1
- package/lib/commonjs/form-control/createFormErrorIcon.js.map +0 -1
- package/lib/commonjs/form-control/createFormErrorText.js.map +0 -1
- package/lib/commonjs/form-control/createFormField.js.map +0 -1
- package/lib/commonjs/form-control/createFormHelper.js.map +0 -1
- package/lib/commonjs/form-control/createFormHelperText.js.map +0 -1
- package/lib/commonjs/form-control/createFormLabel.js.map +0 -1
- package/lib/commonjs/form-control/createFormRoot.js.map +0 -1
- package/lib/commonjs/form-control/index.js +0 -53
- package/lib/commonjs/form-control/index.js.map +0 -1
- package/lib/module/form-control/createFormError.js.map +0 -1
- package/lib/module/form-control/createFormErrorIcon.js.map +0 -1
- package/lib/module/form-control/createFormErrorText.js.map +0 -1
- package/lib/module/form-control/createFormField.js.map +0 -1
- package/lib/module/form-control/createFormHelper.js.map +0 -1
- package/lib/module/form-control/createFormHelperText.js.map +0 -1
- package/lib/module/form-control/createFormLabel.js.map +0 -1
- package/lib/module/form-control/createFormRoot.js.map +0 -1
- package/lib/module/form-control/index.js +0 -49
- package/lib/module/form-control/index.js.map +0 -1
- package/lib/typescript/form-control/createFormError.d.ts +0 -5
- package/lib/typescript/form-control/createFormError.d.ts.map +0 -1
- package/lib/typescript/form-control/createFormErrorIcon.d.ts +0 -5
- package/lib/typescript/form-control/createFormErrorIcon.d.ts.map +0 -1
- package/lib/typescript/form-control/createFormErrorText.d.ts +0 -5
- package/lib/typescript/form-control/createFormErrorText.d.ts.map +0 -1
- package/lib/typescript/form-control/createFormField.d.ts +0 -6
- package/lib/typescript/form-control/createFormField.d.ts.map +0 -1
- package/lib/typescript/form-control/createFormHelper.d.ts +0 -5
- package/lib/typescript/form-control/createFormHelper.d.ts.map +0 -1
- package/lib/typescript/form-control/createFormHelperText.d.ts +0 -5
- package/lib/typescript/form-control/createFormHelperText.d.ts.map +0 -1
- package/lib/typescript/form-control/createFormLabel.d.ts +0 -8
- package/lib/typescript/form-control/createFormLabel.d.ts.map +0 -1
- package/lib/typescript/form-control/createFormRoot.d.ts +0 -6
- package/lib/typescript/form-control/createFormRoot.d.ts.map +0 -1
- package/lib/typescript/form-control/index.d.ts +0 -14
- package/lib/typescript/form-control/index.d.ts.map +0 -1
- package/lib/typescript/form-control/types.d.ts.map +0 -1
- package/src/form-control/index.tsx +0 -71
- /package/lib/commonjs/{form-control → field}/types.js +0 -0
- /package/lib/commonjs/{form-control → form}/createFormRoot.js +0 -0
- /package/lib/module/{form-control → field}/types.js +0 -0
- /package/lib/module/{form-control → form}/createFormRoot.js +0 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { forwardRef, useMemo } from 'react';
|
|
3
|
+
import { Platform, type TextInput, type TextInputKeyPressEvent } from 'react-native';
|
|
4
|
+
import { mergeRefs } from '@cdx-ui/utils';
|
|
5
|
+
import { useOtpCellIndexContext, useOtpInputContext } from './context';
|
|
6
|
+
import type { IOtpInputFieldProps } from './types';
|
|
7
|
+
|
|
8
|
+
export const createOtpInputField = <T,>(BaseField: React.ComponentType<T>) =>
|
|
9
|
+
forwardRef<TextInput, IOtpInputFieldProps & Omit<T, keyof IOtpInputFieldProps>>((props, ref) => {
|
|
10
|
+
const { cellIndex } = useOtpCellIndexContext();
|
|
11
|
+
const {
|
|
12
|
+
value,
|
|
13
|
+
cellCount,
|
|
14
|
+
isDisabled,
|
|
15
|
+
isReadOnly,
|
|
16
|
+
smsOtpAutofill,
|
|
17
|
+
getCellProps,
|
|
18
|
+
cellTestIdPrefix,
|
|
19
|
+
rootAccessibilityLabel,
|
|
20
|
+
setFieldRef,
|
|
21
|
+
handleFieldChange,
|
|
22
|
+
handleFieldKeyPress,
|
|
23
|
+
} = useOtpInputContext();
|
|
24
|
+
|
|
25
|
+
const char = cellIndex < value.length ? (value[cellIndex] ?? '') : '';
|
|
26
|
+
const extra = getCellProps?.(cellIndex) ?? {};
|
|
27
|
+
|
|
28
|
+
const accessibilityLabel = useMemo(() => {
|
|
29
|
+
const fromExtra = extra.accessibilityLabel;
|
|
30
|
+
if (typeof fromExtra === 'string' && fromExtra !== '') {
|
|
31
|
+
return fromExtra;
|
|
32
|
+
}
|
|
33
|
+
if (rootAccessibilityLabel) {
|
|
34
|
+
return `${rootAccessibilityLabel}, ${String(cellIndex + 1)} of ${String(cellCount)}`;
|
|
35
|
+
}
|
|
36
|
+
return `OTP digit ${String(cellIndex + 1)} of ${String(cellCount)}`;
|
|
37
|
+
}, [cellCount, cellIndex, extra.accessibilityLabel, rootAccessibilityLabel]);
|
|
38
|
+
|
|
39
|
+
const autofillProps = useMemo(() => {
|
|
40
|
+
if (!smsOtpAutofill || cellIndex !== 0) {
|
|
41
|
+
return {};
|
|
42
|
+
}
|
|
43
|
+
return Platform.select<Record<string, unknown>>({
|
|
44
|
+
web: { autoComplete: 'one-time-code' },
|
|
45
|
+
ios: { textContentType: 'oneTimeCode' },
|
|
46
|
+
android: { autoComplete: 'sms-otp' },
|
|
47
|
+
default: {},
|
|
48
|
+
});
|
|
49
|
+
}, [cellIndex, smsOtpAutofill]);
|
|
50
|
+
|
|
51
|
+
const editable = !(isDisabled || isReadOnly);
|
|
52
|
+
|
|
53
|
+
const { style: extraStyle, accessibilityLabel: _omitExtraA11y, ...extraRest } = extra;
|
|
54
|
+
void _omitExtraA11y;
|
|
55
|
+
const {
|
|
56
|
+
style: incomingStyle,
|
|
57
|
+
value: _omitValue,
|
|
58
|
+
defaultValue: _omitDefault,
|
|
59
|
+
onChangeText: _omitOnChange,
|
|
60
|
+
...incomingRest
|
|
61
|
+
} = props as IOtpInputFieldProps;
|
|
62
|
+
void _omitValue;
|
|
63
|
+
void _omitDefault;
|
|
64
|
+
void _omitOnChange;
|
|
65
|
+
|
|
66
|
+
// Default digit OTP (`number-pad`). Root `getCellProps` is spread after and may override `keyboardType`.
|
|
67
|
+
return (
|
|
68
|
+
<BaseField
|
|
69
|
+
ref={mergeRefs(ref, (el: TextInput | null) => {
|
|
70
|
+
setFieldRef(cellIndex, el);
|
|
71
|
+
})}
|
|
72
|
+
accessibilityLabel={accessibilityLabel}
|
|
73
|
+
aria-label={accessibilityLabel}
|
|
74
|
+
accessible
|
|
75
|
+
autoFocus={cellIndex === 0 && editable && value.length === 0}
|
|
76
|
+
editable={editable}
|
|
77
|
+
keyboardType="number-pad"
|
|
78
|
+
returnKeyType="done"
|
|
79
|
+
selectTextOnFocus
|
|
80
|
+
testID={
|
|
81
|
+
cellTestIdPrefix
|
|
82
|
+
? `${cellTestIdPrefix}:${String(cellIndex)}:textField:changeText`
|
|
83
|
+
: undefined
|
|
84
|
+
}
|
|
85
|
+
value={char}
|
|
86
|
+
onChangeText={(text: string) => {
|
|
87
|
+
handleFieldChange(cellIndex, text);
|
|
88
|
+
}}
|
|
89
|
+
onKeyPress={(e: TextInputKeyPressEvent) => {
|
|
90
|
+
handleFieldKeyPress(cellIndex, e.nativeEvent.key);
|
|
91
|
+
}}
|
|
92
|
+
{...autofillProps}
|
|
93
|
+
{...(extraRest as object)}
|
|
94
|
+
{...(incomingRest as T)}
|
|
95
|
+
style={[extraStyle, incomingStyle]}
|
|
96
|
+
/>
|
|
97
|
+
);
|
|
98
|
+
});
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { forwardRef, useCallback, useEffect, useLayoutEffect, useMemo, useRef } from 'react';
|
|
3
|
+
import type { TextInput } from 'react-native';
|
|
4
|
+
import { useFormControlContext } from '@cdx-ui/utils';
|
|
5
|
+
import { applyOtpInputChange } from './utils/applyValueChange';
|
|
6
|
+
import { OtpCellIndexProvider, OtpInputProvider } from './context';
|
|
7
|
+
import { filterAllowedCharacters, filterByRegExp, filterDigits } from './utils/filterValue';
|
|
8
|
+
import type { IOtpInputRootProps } from './types';
|
|
9
|
+
|
|
10
|
+
export const createOtpInputRoot = <RootProps,>(
|
|
11
|
+
BaseRoot: React.ComponentType<RootProps>,
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- slot components are generic across design systems
|
|
13
|
+
OtpCell: React.ComponentType<any>,
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
|
+
OtpField: React.ComponentType<any>,
|
|
16
|
+
) =>
|
|
17
|
+
forwardRef<unknown, IOtpInputRootProps & RootProps>(
|
|
18
|
+
(
|
|
19
|
+
{
|
|
20
|
+
cellCount,
|
|
21
|
+
value,
|
|
22
|
+
onChangeText,
|
|
23
|
+
onComplete,
|
|
24
|
+
isDisabled: isDisabledProp,
|
|
25
|
+
isInvalid: isInvalidProp,
|
|
26
|
+
isReadOnly: isReadOnlyProp,
|
|
27
|
+
smsOtpAutofill = true,
|
|
28
|
+
filterInput,
|
|
29
|
+
allowedCharacters,
|
|
30
|
+
characterPattern,
|
|
31
|
+
getCellProps,
|
|
32
|
+
cellTestIdPrefix,
|
|
33
|
+
accessibilityLabel: rootAccessibilityLabel,
|
|
34
|
+
...rest
|
|
35
|
+
},
|
|
36
|
+
ref,
|
|
37
|
+
) => {
|
|
38
|
+
const form = useFormControlContext();
|
|
39
|
+
const isDisabled = isDisabledProp ?? form.isDisabled ?? false;
|
|
40
|
+
const isInvalid = isInvalidProp ?? form.isInvalid ?? false;
|
|
41
|
+
const isReadOnly = isReadOnlyProp ?? form.isReadOnly ?? false;
|
|
42
|
+
|
|
43
|
+
const fieldRefs = useRef<(TextInput | null)[]>([]);
|
|
44
|
+
const focusAfterApply = useRef<number | null>(null);
|
|
45
|
+
const prevLenRef = useRef(value.length);
|
|
46
|
+
const prevValueRef = useRef(value);
|
|
47
|
+
|
|
48
|
+
const filter = useMemo(() => {
|
|
49
|
+
if (filterInput) {
|
|
50
|
+
return filterInput;
|
|
51
|
+
}
|
|
52
|
+
if (allowedCharacters !== undefined) {
|
|
53
|
+
return filterAllowedCharacters(allowedCharacters);
|
|
54
|
+
}
|
|
55
|
+
if (characterPattern !== undefined) {
|
|
56
|
+
return filterByRegExp(characterPattern);
|
|
57
|
+
}
|
|
58
|
+
return filterDigits;
|
|
59
|
+
}, [filterInput, allowedCharacters, characterPattern]);
|
|
60
|
+
|
|
61
|
+
const setFieldRef = useCallback((index: number, el: TextInput | null) => {
|
|
62
|
+
fieldRefs.current[index] = el;
|
|
63
|
+
}, []);
|
|
64
|
+
|
|
65
|
+
const focusCell = useCallback(
|
|
66
|
+
(index: number) => {
|
|
67
|
+
const safe = Math.max(0, Math.min(index, cellCount - 1));
|
|
68
|
+
fieldRefs.current[safe]?.focus();
|
|
69
|
+
},
|
|
70
|
+
[cellCount],
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
const handleFieldChange = useCallback(
|
|
74
|
+
(index: number, text: string) => {
|
|
75
|
+
const { nextValue, focusIndex } = applyOtpInputChange(
|
|
76
|
+
value,
|
|
77
|
+
index,
|
|
78
|
+
text,
|
|
79
|
+
cellCount,
|
|
80
|
+
filter,
|
|
81
|
+
);
|
|
82
|
+
if (nextValue !== value) {
|
|
83
|
+
onChangeText(nextValue);
|
|
84
|
+
}
|
|
85
|
+
focusAfterApply.current = focusIndex;
|
|
86
|
+
},
|
|
87
|
+
[cellCount, filter, onChangeText, value],
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
const handleFieldKeyPress = useCallback(
|
|
91
|
+
(index: number, key: string) => {
|
|
92
|
+
if (key !== 'Backspace') {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const char = index < value.length ? value[index] : '';
|
|
96
|
+
if (!char && index > 0) {
|
|
97
|
+
focusCell(index - 1);
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
[focusCell, value],
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
useLayoutEffect(() => {
|
|
104
|
+
if (focusAfterApply.current !== null) {
|
|
105
|
+
const i = focusAfterApply.current;
|
|
106
|
+
focusAfterApply.current = null;
|
|
107
|
+
fieldRefs.current[i]?.focus();
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
useEffect(() => {
|
|
112
|
+
const prevLen = prevLenRef.current;
|
|
113
|
+
const prevVal = prevValueRef.current;
|
|
114
|
+
const isFull = value.length === cellCount;
|
|
115
|
+
const becameFullByLength = isFull && prevLen < cellCount;
|
|
116
|
+
const correctedWhileFull = isFull && prevLen === cellCount && prevVal !== value;
|
|
117
|
+
|
|
118
|
+
if (becameFullByLength || correctedWhileFull) {
|
|
119
|
+
onComplete?.();
|
|
120
|
+
}
|
|
121
|
+
prevLenRef.current = value.length;
|
|
122
|
+
prevValueRef.current = value;
|
|
123
|
+
}, [cellCount, onComplete, value]);
|
|
124
|
+
|
|
125
|
+
const contextValue = useMemo(
|
|
126
|
+
() => ({
|
|
127
|
+
cellCount,
|
|
128
|
+
value,
|
|
129
|
+
isDisabled,
|
|
130
|
+
isInvalid,
|
|
131
|
+
isReadOnly,
|
|
132
|
+
smsOtpAutofill,
|
|
133
|
+
filter,
|
|
134
|
+
getCellProps,
|
|
135
|
+
cellTestIdPrefix,
|
|
136
|
+
rootAccessibilityLabel,
|
|
137
|
+
setFieldRef,
|
|
138
|
+
handleFieldChange,
|
|
139
|
+
handleFieldKeyPress,
|
|
140
|
+
}),
|
|
141
|
+
[
|
|
142
|
+
cellCount,
|
|
143
|
+
value,
|
|
144
|
+
isDisabled,
|
|
145
|
+
isInvalid,
|
|
146
|
+
isReadOnly,
|
|
147
|
+
smsOtpAutofill,
|
|
148
|
+
filter,
|
|
149
|
+
getCellProps,
|
|
150
|
+
cellTestIdPrefix,
|
|
151
|
+
rootAccessibilityLabel,
|
|
152
|
+
setFieldRef,
|
|
153
|
+
handleFieldChange,
|
|
154
|
+
handleFieldKeyPress,
|
|
155
|
+
],
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
// Hermes drops outer-scope closure vars from its environment record when
|
|
159
|
+
// they are only referenced inside a nested callback (Array.from). Using a
|
|
160
|
+
// for-loop keeps OtpCell/OtpField references in the render function's own
|
|
161
|
+
// scope, avoiding the Hermes closure-capture bug.
|
|
162
|
+
const cells: React.ReactElement[] = [];
|
|
163
|
+
for (let i = 0; i < cellCount; i++) {
|
|
164
|
+
cells.push(
|
|
165
|
+
<OtpCellIndexProvider key={i} value={{ cellIndex: i }}>
|
|
166
|
+
<OtpCell>
|
|
167
|
+
<OtpField />
|
|
168
|
+
</OtpCell>
|
|
169
|
+
</OtpCellIndexProvider>,
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return (
|
|
174
|
+
<BaseRoot ref={ref as React.Ref<unknown>} {...(rest as RootProps)}>
|
|
175
|
+
<OtpInputProvider value={contextValue}>{cells}</OtpInputProvider>
|
|
176
|
+
</BaseRoot>
|
|
177
|
+
);
|
|
178
|
+
},
|
|
179
|
+
);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { createOtpInputCell } from './createOtpInputCell';
|
|
3
|
+
import { createOtpInputField } from './createOtpInputField';
|
|
4
|
+
import { createOtpInputRoot } from './createOtpInputRoot';
|
|
5
|
+
import type { IOtpInputComponentType } from './types';
|
|
6
|
+
|
|
7
|
+
export { applyOtpInputChange } from './utils/applyValueChange';
|
|
8
|
+
export { filterAllowedCharacters, filterByRegExp, filterDigits } from './utils/filterValue';
|
|
9
|
+
export type * from './types';
|
|
10
|
+
|
|
11
|
+
export function createOtpInput<
|
|
12
|
+
RootProps,
|
|
13
|
+
CellProps,
|
|
14
|
+
FieldProps,
|
|
15
|
+
RootRef = unknown,
|
|
16
|
+
FieldRef = unknown,
|
|
17
|
+
>(BaseComponents: {
|
|
18
|
+
Root: React.ComponentType<RootProps>;
|
|
19
|
+
Cell: React.ComponentType<CellProps>;
|
|
20
|
+
Field: React.ComponentType<FieldProps>;
|
|
21
|
+
}) {
|
|
22
|
+
const Cell = createOtpInputCell(BaseComponents.Cell);
|
|
23
|
+
const Field = createOtpInputField(BaseComponents.Field);
|
|
24
|
+
const Root = createOtpInputRoot(BaseComponents.Root, Cell, Field);
|
|
25
|
+
|
|
26
|
+
Root.displayName = 'OtpInputPrimitive';
|
|
27
|
+
Cell.displayName = 'OtpInputPrimitive.Cell';
|
|
28
|
+
Field.displayName = 'OtpInputPrimitive.Field';
|
|
29
|
+
|
|
30
|
+
return Object.assign(Root, {
|
|
31
|
+
Cell,
|
|
32
|
+
Field,
|
|
33
|
+
}) as IOtpInputComponentType<RootProps, CellProps, FieldProps, RootRef, FieldRef>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import type { TextInputProps, ViewProps } from 'react-native';
|
|
4
|
+
|
|
5
|
+
export interface IOtpInputRootProps extends ViewProps {
|
|
6
|
+
/** Number of OTP cells (fixed). */
|
|
7
|
+
cellCount: number;
|
|
8
|
+
/** Controlled value: characters in order, length 0..`cellCount` (prefix fill). */
|
|
9
|
+
value: string;
|
|
10
|
+
onChangeText: (value: string) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Called when the code is ready to verify again:
|
|
13
|
+
* - `value` becomes full (`length === cellCount`) after being shorter, or
|
|
14
|
+
* - `value` stays full but the string changes (user corrected a digit without dropping below full length).
|
|
15
|
+
* Does not fire on mount when `value` is already full and unchanged, nor on re-renders with the same full `value`.
|
|
16
|
+
*/
|
|
17
|
+
onComplete?: () => void;
|
|
18
|
+
isDisabled?: boolean;
|
|
19
|
+
isInvalid?: boolean;
|
|
20
|
+
isReadOnly?: boolean;
|
|
21
|
+
/** When false, no SMS / Web OTP autofill hints on the first cell. @default true */
|
|
22
|
+
smsOtpAutofill?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Override default digit-only filtering.
|
|
25
|
+
* Takes priority over `allowedCharacters` and `characterPattern` when truthy.
|
|
26
|
+
* Does not change the default `keyboardType` (`number-pad`); use `getCellProps` if the allowed
|
|
27
|
+
* character set needs a different keyboard.
|
|
28
|
+
*/
|
|
29
|
+
filterInput?: (input: string) => string;
|
|
30
|
+
/**
|
|
31
|
+
* Keep only characters present in this string (treated as a set of code units).
|
|
32
|
+
* Used when `filterInput` is not provided. Takes priority over `characterPattern`.
|
|
33
|
+
* Default keyboard remains numeric; use `getCellProps` to set `keyboardType` when allowing letters/symbols.
|
|
34
|
+
*/
|
|
35
|
+
allowedCharacters?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Keep only characters matching this pattern (tested per code unit).
|
|
38
|
+
* Used when neither `filterInput` nor `allowedCharacters` is provided.
|
|
39
|
+
* Default keyboard remains numeric; use `getCellProps` to set `keyboardType` for non-digit input.
|
|
40
|
+
*/
|
|
41
|
+
characterPattern?: RegExp;
|
|
42
|
+
/**
|
|
43
|
+
* Spread onto each cell after built-in field props (including `keyboardType="number-pad"`),
|
|
44
|
+
* so consumers can override `keyboardType`, `autoCapitalize`, etc. for non-digit OTPs.
|
|
45
|
+
*/
|
|
46
|
+
getCellProps?: (index: number) => Partial<TextInputProps>;
|
|
47
|
+
/** Optional prefix for `testID` on each field: `${cellTestIdPrefix}:${index}:...` */
|
|
48
|
+
cellTestIdPrefix?: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface IOtpInputCellProps extends ViewProps {
|
|
52
|
+
children?: ReactNode;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export type IOtpInputFieldProps = TextInputProps;
|
|
56
|
+
|
|
57
|
+
export interface OtpInputCellIndexContextValue {
|
|
58
|
+
cellIndex: number;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface OtpInputContextValue {
|
|
62
|
+
cellCount: number;
|
|
63
|
+
value: string;
|
|
64
|
+
isDisabled: boolean;
|
|
65
|
+
isInvalid: boolean;
|
|
66
|
+
isReadOnly: boolean;
|
|
67
|
+
smsOtpAutofill: boolean;
|
|
68
|
+
filter: (input: string) => string;
|
|
69
|
+
getCellProps?: (index: number) => Partial<TextInputProps>;
|
|
70
|
+
cellTestIdPrefix?: string;
|
|
71
|
+
rootAccessibilityLabel?: string;
|
|
72
|
+
setFieldRef: (index: number, el: import('react-native').TextInput | null) => void;
|
|
73
|
+
handleFieldChange: (index: number, text: string) => void;
|
|
74
|
+
handleFieldKeyPress: (index: number, key: string) => void;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export type IOtpInputComponentType<
|
|
78
|
+
RootProps,
|
|
79
|
+
CellProps,
|
|
80
|
+
FieldProps,
|
|
81
|
+
RootRef = unknown,
|
|
82
|
+
FieldRef = unknown,
|
|
83
|
+
> = React.ForwardRefExoticComponent<
|
|
84
|
+
React.PropsWithoutRef<RootProps & IOtpInputRootProps> & React.RefAttributes<RootRef>
|
|
85
|
+
> & {
|
|
86
|
+
Cell: React.ForwardRefExoticComponent<
|
|
87
|
+
React.PropsWithoutRef<CellProps & IOtpInputCellProps> & React.RefAttributes<unknown>
|
|
88
|
+
>;
|
|
89
|
+
Field: React.ForwardRefExoticComponent<
|
|
90
|
+
React.PropsWithoutRef<FieldProps & IOtpInputFieldProps> & React.RefAttributes<FieldRef>
|
|
91
|
+
>;
|
|
92
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure OTP value transition for a controlled prefix string (no explicit empty slots).
|
|
3
|
+
* - Single-character edits use index-based replace/append (no reorder).
|
|
4
|
+
* - Multi-character input (paste/autofill) writes at `index` forward, then packs left.
|
|
5
|
+
*/
|
|
6
|
+
export function applyOtpInputChange(
|
|
7
|
+
value: string,
|
|
8
|
+
index: number,
|
|
9
|
+
rawText: string,
|
|
10
|
+
cellCount: number,
|
|
11
|
+
filter: (input: string) => string,
|
|
12
|
+
): { nextValue: string; focusIndex: number } {
|
|
13
|
+
const text = filter(rawText);
|
|
14
|
+
|
|
15
|
+
if (text.length === 0) {
|
|
16
|
+
if (index < value.length) {
|
|
17
|
+
const next = (value.slice(0, index) + value.slice(index + 1)).slice(0, cellCount);
|
|
18
|
+
return { nextValue: next, focusIndex: Math.max(0, index - 1) };
|
|
19
|
+
}
|
|
20
|
+
return { nextValue: value, focusIndex: index };
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (text.length === 1) {
|
|
24
|
+
if (index < value.length) {
|
|
25
|
+
const next = (value.slice(0, index) + text + value.slice(index + 1)).slice(0, cellCount);
|
|
26
|
+
return { nextValue: next, focusIndex: Math.min(index + 1, cellCount - 1) };
|
|
27
|
+
}
|
|
28
|
+
if (value.length < cellCount) {
|
|
29
|
+
if (index === value.length) {
|
|
30
|
+
const next = (value + text).slice(0, cellCount);
|
|
31
|
+
return { nextValue: next, focusIndex: Math.min(next.length, cellCount - 1) };
|
|
32
|
+
}
|
|
33
|
+
const arr = Array.from({ length: cellCount }, (_, i) => (i < value.length ? value[i] : ''));
|
|
34
|
+
arr[index] = text;
|
|
35
|
+
const next = arr
|
|
36
|
+
.filter((c) => c)
|
|
37
|
+
.join('')
|
|
38
|
+
.slice(0, cellCount);
|
|
39
|
+
return { nextValue: next, focusIndex: Math.min(index + 1, cellCount - 1) };
|
|
40
|
+
}
|
|
41
|
+
const next = (value.slice(0, index) + text + value.slice(index + 1)).slice(0, cellCount);
|
|
42
|
+
return { nextValue: next, focusIndex: Math.min(index + 1, cellCount - 1) };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const arr = Array.from({ length: cellCount }, (_, i) => (i < value.length ? value[i] : ''));
|
|
46
|
+
for (let k = 0; k < text.length && index + k < cellCount; k++) {
|
|
47
|
+
arr[index + k] = text.charAt(k);
|
|
48
|
+
}
|
|
49
|
+
const next = arr
|
|
50
|
+
.filter((c) => c)
|
|
51
|
+
.join('')
|
|
52
|
+
.slice(0, cellCount);
|
|
53
|
+
const lastWritten = Math.min(index + text.length - 1, cellCount - 1);
|
|
54
|
+
const focusIndex = Math.min(Math.max(lastWritten, next.length - 1), cellCount - 1);
|
|
55
|
+
return { nextValue: next, focusIndex: Math.max(0, focusIndex) };
|
|
56
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** Strip to digits (default OTP behavior). */
|
|
2
|
+
export function filterDigits(input: string): string {
|
|
3
|
+
return input.replace(/\D/g, '');
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
/** Keep only characters present in `allowed` (treat as a set of UTF-16 code units). */
|
|
7
|
+
export function filterAllowedCharacters(allowed: string) {
|
|
8
|
+
const allowedSet = new Set<string>();
|
|
9
|
+
for (let i = 0; i < allowed.length; i++) {
|
|
10
|
+
allowedSet.add(allowed.charAt(i));
|
|
11
|
+
}
|
|
12
|
+
return (input: string) => {
|
|
13
|
+
let out = '';
|
|
14
|
+
for (let i = 0; i < input.length; i++) {
|
|
15
|
+
const ch = input.charAt(i);
|
|
16
|
+
if (allowedSet.has(ch)) {
|
|
17
|
+
out += ch;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return out;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Keep only characters matching `re` (tested per UTF-16 code unit). */
|
|
25
|
+
export function filterByRegExp(re: RegExp) {
|
|
26
|
+
return (input: string) => {
|
|
27
|
+
let out = '';
|
|
28
|
+
for (let i = 0; i < input.length; i++) {
|
|
29
|
+
const ch = input.charAt(i);
|
|
30
|
+
re.lastIndex = 0;
|
|
31
|
+
if (re.test(ch)) {
|
|
32
|
+
out += ch;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return out;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_utils","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","createFormError","BaseFormError","forwardRef","children","props","ref","isInvalid","feedbackId","setHasFeedbackText","useFormControlContext","visible","Boolean","React","useEffect","undefined","jsx","id","accessibilityRole","accessibilityLiveRegion","exports"],"sourceRoot":"../../../src","sources":["form-control/createFormError.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAAsD,IAAAE,WAAA,GAAAF,OAAA;AAAA,SAAAD,wBAAAI,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAN,uBAAA,YAAAA,CAAAI,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AAE/C,MAAMkB,eAAe,GAAQC,aAAqC,iBACvE,IAAAC,iBAAU,EAA0C,CAAC;EAAEC,QAAQ;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,KAAK;EACnF,MAAM;IAAEC,SAAS;IAAEC,UAAU;IAAEC;EAAmB,CAAC,GAAG,IAAAC,4BAAqB,EAAC,CAAC;EAE7E,MAAMC,OAAO,GAAGC,OAAO,CAACL,SAAS,IAAIH,QAAQ,CAAC;EAE9CS,cAAK,CAACC,SAAS,CAAC,MAAM;IACpB,IAAI,CAACH,OAAO,EAAE;MACZF,kBAAkB,GAAG,KAAK,CAAC;MAC3B,OAAOM,SAAS;IAClB;IACAN,kBAAkB,GAAG,IAAI,CAAC;IAC1B,OAAO,MAAM;MACXA,kBAAkB,GAAG,KAAK,CAAC;IAC7B,CAAC;EACH,CAAC,EAAE,CAACA,kBAAkB,EAAEE,OAAO,CAAC,CAAC;EAEjC,OAAOA,OAAO,gBACZ,IAAA9B,WAAA,CAAAmC,GAAA,EAACd,aAAa;IACZI,GAAG,EAAEA,GAAI;IAAA,GACJD,KAAK;IACVY,EAAE,EAAET,UAAW;IACfU,iBAAiB,EAAC,OAAO;IACzBC,uBAAuB,EAAC,WAAW;IAAAf,QAAA,EAElCA;EAAQ,CACI,CAAC,GACd,IAAI;AACV,CAAC,CAAC;AAACgB,OAAA,CAAAnB,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_jsxRuntime","createFormErrorIcon","BaseFormErrorIcon","forwardRef","children","props","ref","jsx","exports"],"sourceRoot":"../../../src","sources":["form-control/createFormErrorIcon.tsx"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAAmC,IAAAC,WAAA,GAAAD,OAAA;AAE5B,MAAME,mBAAmB,GAAQC,iBAAyC,iBAC/E,IAAAC,iBAAU,EAA0C,CAAC;EAAEC,QAAQ;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,kBAC9E,IAAAN,WAAA,CAAAO,GAAA,EAACL,iBAAiB;EAACI,GAAG,EAAEA,GAAI;EAAA,GAAMD,KAAK;EAAAD,QAAA,EACpCA;AAAQ,CACQ,CACpB,CAAC;AAACI,OAAA,CAAAP,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_jsxRuntime","createFormErrorText","BaseFormErrorText","forwardRef","children","props","ref","jsx","exports"],"sourceRoot":"../../../src","sources":["form-control/createFormErrorText.tsx"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAAmC,IAAAC,WAAA,GAAAD,OAAA;AAE5B,MAAME,mBAAmB,GAAQC,iBAAyC,iBAC/E,IAAAC,iBAAU,EAA0C,CAAC;EAAEC,QAAQ;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,kBAC9E,IAAAN,WAAA,CAAAO,GAAA,EAACL,iBAAiB;EAACI,GAAG,EAAEA,GAAI;EAAA,GAAMD,KAAK;EAAAD,QAAA,EACpCA;AAAQ,CACQ,CACpB,CAAC;AAACI,OAAA,CAAAP,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_utils","_dataAttributes","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","createFormField","BaseFormField","forwardRef","children","props","ref","htmlProps","context","useFormControlRoot","jsx","FormControlContext","Provider","value","dataAttributes","disabled","isDisabled","invalid","isInvalid","required","isRequired","exports"],"sourceRoot":"../../../src","sources":["form-control/createFormField.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AAAyD,IAAAG,WAAA,GAAAH,OAAA;AAAA,SAAAD,wBAAAK,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAP,uBAAA,YAAAA,CAAAK,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AAGlD,MAAMkB,eAAe,GAAQC,aAAqC,iBACvE,IAAAC,iBAAU,EACR,CAAC;EAAEC,QAAQ;EAAE,GAAGC;AAAwD,CAAC,EAAEC,GAAa,KAAK;EAC3F,MAAM;IAAEC,SAAS;IAAE,GAAGC;EAAQ,CAAC,GAAG,IAAAC,yBAAkB,EAACJ,KAAK,CAAC;EAE3D,oBACE,IAAAxB,WAAA,CAAA6B,GAAA,EAAC/B,MAAA,CAAAgC,kBAAkB,CAACC,QAAQ;IAACC,KAAK,EAAEL,OAAQ;IAAAJ,QAAA,eAC1C,IAAAvB,WAAA,CAAA6B,GAAA,EAACR,aAAa;MACZI,GAAG,EAAEA,GAAI;MAAA,GACJC,SAAS;MAAA,GACV,IAAAO,8BAAc,EAAC;QACjBC,QAAQ,EAAEP,OAAO,CAACQ,UAAU;QAC5BC,OAAO,EAAET,OAAO,CAACU,SAAS;QAC1BC,QAAQ,EAAEX,OAAO,CAACY;MACpB,CAAC,CAAC;MAAAhB,QAAA,EAEDA;IAAQ,CACI;EAAC,CACW,CAAC;AAElC,CACF,CAAC;AAACiB,OAAA,CAAApB,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_utils","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","createFormHelper","BaseFormHelper","forwardRef","children","props","ref","helpTextId","setHasHelpText","isInvalid","useFormControlContext","React","useEffect","undefined","jsx","id","exports"],"sourceRoot":"../../../src","sources":["form-control/createFormHelper.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAAsD,IAAAE,WAAA,GAAAF,OAAA;AAAA,SAAAD,wBAAAI,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAN,uBAAA,YAAAA,CAAAI,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AAE/C,MAAMkB,gBAAgB,GAAQC,cAAsC,iBACzE,IAAAC,iBAAU,EAA0C,CAAC;EAAEC,QAAQ;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,KAAK;EACnF,MAAM;IAAEC,UAAU;IAAEC,cAAc;IAAEC;EAAU,CAAC,GAAG,IAAAC,4BAAqB,EAAC,CAAC;EAEzEC,cAAK,CAACC,SAAS,CAAC,MAAM;IACpB,IAAIH,SAAS,EAAE;MACbD,cAAc,GAAG,KAAK,CAAC;MACvB,OAAOK,SAAS;IAClB;IACAL,cAAc,GAAG,IAAI,CAAC;IACtB,OAAO,MAAM;MACXA,cAAc,GAAG,KAAK,CAAC;IACzB,CAAC;EACH,CAAC,EAAE,CAACA,cAAc,EAAEC,SAAS,CAAC,CAAC;EAE/B,IAAIA,SAAS,EAAE;IACb,OAAO,IAAI;EACb;EAEA,oBACE,IAAA5B,WAAA,CAAAiC,GAAA,EAACZ,cAAc;IAACI,GAAG,EAAEA,GAAI;IAAA,GAAMD,KAAK;IAAQU,EAAE,EAAER,UAAW;IAAAH,QAAA,EACxDA;EAAQ,CACK,CAAC;AAErB,CAAC,CAAC;AAACY,OAAA,CAAAf,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_jsxRuntime","createFormHelperText","BaseFormHelperText","forwardRef","children","props","ref","jsx","exports"],"sourceRoot":"../../../src","sources":["form-control/createFormHelperText.tsx"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAAmC,IAAAC,WAAA,GAAAD,OAAA;AAE5B,MAAME,oBAAoB,GAAQC,kBAA0C,iBACjF,IAAAC,iBAAU,EAA0C,CAAC;EAAEC,QAAQ;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,kBAC9E,IAAAN,WAAA,CAAAO,GAAA,EAACL,kBAAkB;EAACI,GAAG,EAAEA,GAAI;EAAA,GAAMD,KAAK;EAAAD,QAAA,EACrCA;AAAQ,CACS,CACrB,CAAC;AAACI,OAAA,CAAAP,oBAAA,GAAAA,oBAAA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_utils","_dataAttributes","_jsxRuntime","createFormLabel","Label","BaseFormLabel","forwardRef","children","htmlFor","htmlForProp","requiredIndicator","props","ref","field","useFormControlContext","fieldId","id","labelId","undefined","jsxs","dataAttributes","invalid","isInvalid","required","isRequired","exports"],"sourceRoot":"../../../src","sources":["form-control/createFormLabel.tsx"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AAAyD,IAAAG,WAAA,GAAAH,OAAA;AAGlD,MAAMI,eAAe,GAAGA,CAAK;EAAEC,KAAK,EAAEC;AAAiD,CAAC,kBAC7F,IAAAC,iBAAU,EACR,CAAC;EAAEC,QAAQ;EAAEC,OAAO,EAAEC,WAAW;EAAEC,iBAAiB;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,KAAK;EACxE,MAAMC,KAAK,GAAG,IAAAC,4BAAqB,EAAC,CAAC;EACrC,MAAMC,OAAO,GAAGF,KAAK,CAACG,EAAE;EACxB,MAAMC,OAAO,GAAGJ,KAAK,CAACI,OAAO;;EAE7B;EACA,MAAMT,OAAO,GAAGC,WAAW,KAAKM,OAAO,GAAG,GAAGA,OAAO,QAAQ,GAAGG,SAAS,CAAC;EAEzE,oBACE,IAAAhB,WAAA,CAAAiB,IAAA,EAACd,aAAa;IACZO,GAAG,EAAEA,GAAI;IAAA,GACJD,KAAK;IACVK,EAAE,EAAEC,OAAQ;IACZT,OAAO,EAAEA,OAAQ;IAAA,GACb,IAAAY,8BAAc,EAAC;MAAEC,OAAO,EAAER,KAAK,CAACS,SAAS;MAAEC,QAAQ,EAAEV,KAAK,CAACW;IAAW,CAAC,CAAC;IAAAjB,QAAA,GAE3EA,QAAQ,EACRM,KAAK,CAACW,UAAU,GAAGd,iBAAiB,GAAG,IAAI;EAAA,CAC/B,CAAC;AAEpB,CACF,CAAC;AAACe,OAAA,CAAAtB,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","createFormRoot","BaseFormRoot","forwardRef","children","props","ref","jsx","exports"],"sourceRoot":"../../../src","sources":["form-control/createFormRoot.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA0C,IAAAC,WAAA,GAAAD,OAAA;AAAA,SAAAD,wBAAAG,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAL,uBAAA,YAAAA,CAAAG,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AAG1C;;AAEO,MAAMkB,cAAc,GAAQC,YAAoC,iBACrE,IAAAC,iBAAU,EACR,CAAC;EAAEC,QAAQ;EAAE,GAAGC;AAAmD,CAAC,EAAEC,GAAa,kBACjF,IAAAzB,WAAA,CAAA0B,GAAA,EAACL,YAAY;EAACI,GAAG,EAAEA,GAAI;EAAA,GAAMD,KAAK;EAAAD,QAAA,EAC/BA;AAAQ,CACG,CAElB,CAAC;AAACI,OAAA,CAAAP,cAAA,GAAAA,cAAA","ignoreList":[]}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createForm = createForm;
|
|
7
|
-
var _createFormError = require("./createFormError");
|
|
8
|
-
var _createFormErrorText = require("./createFormErrorText");
|
|
9
|
-
var _createFormErrorIcon = require("./createFormErrorIcon");
|
|
10
|
-
var _createFormField = require("./createFormField");
|
|
11
|
-
var _createFormHelper = require("./createFormHelper");
|
|
12
|
-
var _createFormHelperText = require("./createFormHelperText");
|
|
13
|
-
var _createFormLabel = require("./createFormLabel");
|
|
14
|
-
var _createFormRoot = require("./createFormRoot");
|
|
15
|
-
function createForm({
|
|
16
|
-
Root,
|
|
17
|
-
Field,
|
|
18
|
-
Error,
|
|
19
|
-
ErrorText,
|
|
20
|
-
ErrorIcon,
|
|
21
|
-
Label,
|
|
22
|
-
Helper,
|
|
23
|
-
HelperText
|
|
24
|
-
}) {
|
|
25
|
-
const FormRoot = (0, _createFormRoot.createFormRoot)(Root);
|
|
26
|
-
FormRoot.displayName = 'FormPrimitive';
|
|
27
|
-
const FormField = (0, _createFormField.createFormField)(Field);
|
|
28
|
-
FormField.displayName = 'FormPrimitive.Field';
|
|
29
|
-
const FormLabel = (0, _createFormLabel.createFormLabel)({
|
|
30
|
-
Label
|
|
31
|
-
});
|
|
32
|
-
const FormHelper = (0, _createFormHelper.createFormHelper)(Helper);
|
|
33
|
-
const FormHelperText = (0, _createFormHelperText.createFormHelperText)(HelperText);
|
|
34
|
-
const FormError = (0, _createFormError.createFormError)(Error);
|
|
35
|
-
const FormErrorText = (0, _createFormErrorText.createFormErrorText)(ErrorText);
|
|
36
|
-
const FormErrorIcon = (0, _createFormErrorIcon.createFormErrorIcon)(ErrorIcon);
|
|
37
|
-
FormLabel.displayName = 'FormPrimitive.Label';
|
|
38
|
-
FormHelper.displayName = 'FormPrimitive.Helper';
|
|
39
|
-
FormHelperText.displayName = 'FormPrimitive.HelperText';
|
|
40
|
-
FormError.displayName = 'FormPrimitive.Error';
|
|
41
|
-
FormErrorText.displayName = 'FormPrimitive.ErrorText';
|
|
42
|
-
FormErrorIcon.displayName = 'FormPrimitive.ErrorIcon';
|
|
43
|
-
return Object.assign(FormRoot, {
|
|
44
|
-
Field: FormField,
|
|
45
|
-
Label: FormLabel,
|
|
46
|
-
Helper: FormHelper,
|
|
47
|
-
HelperText: FormHelperText,
|
|
48
|
-
Error: FormError,
|
|
49
|
-
ErrorText: FormErrorText,
|
|
50
|
-
ErrorIcon: FormErrorIcon
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_createFormError","require","_createFormErrorText","_createFormErrorIcon","_createFormField","_createFormHelper","_createFormHelperText","_createFormLabel","_createFormRoot","createForm","Root","Field","Error","ErrorText","ErrorIcon","Label","Helper","HelperText","FormRoot","createFormRoot","displayName","FormField","createFormField","FormLabel","createFormLabel","FormHelper","createFormHelper","FormHelperText","createFormHelperText","FormError","createFormError","FormErrorText","createFormErrorText","FormErrorIcon","createFormErrorIcon","Object","assign"],"sourceRoot":"../../../src","sources":["form-control/index.tsx"],"mappings":";;;;;;AACA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAD,OAAA;AACA,IAAAE,oBAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AACA,IAAAK,qBAAA,GAAAL,OAAA;AACA,IAAAM,gBAAA,GAAAN,OAAA;AACA,IAAAO,eAAA,GAAAP,OAAA;AAeO,SAASQ,UAAUA,CAAsE;EAC9FC,IAAI;EACJC,KAAK;EACLC,KAAK;EACLC,SAAS;EACTC,SAAS;EACTC,KAAK;EACLC,MAAM;EACNC;AAUF,CAAC,EAAE;EACD,MAAMC,QAAQ,GAAG,IAAAC,8BAAc,EAACT,IAAI,CAAC;EACrCQ,QAAQ,CAACE,WAAW,GAAG,eAAe;EAEtC,MAAMC,SAAS,GAAG,IAAAC,gCAAe,EAACX,KAAK,CAAC;EACxCU,SAAS,CAACD,WAAW,GAAG,qBAAqB;EAC7C,MAAMG,SAAS,GAAG,IAAAC,gCAAe,EAAC;IAAET;EAAM,CAAC,CAAC;EAC5C,MAAMU,UAAU,GAAG,IAAAC,kCAAgB,EAACV,MAAM,CAAC;EAC3C,MAAMW,cAAc,GAAG,IAAAC,0CAAoB,EAACX,UAAU,CAAC;EACvD,MAAMY,SAAS,GAAG,IAAAC,gCAAe,EAAClB,KAAK,CAAC;EACxC,MAAMmB,aAAa,GAAG,IAAAC,wCAAmB,EAACnB,SAAS,CAAC;EACpD,MAAMoB,aAAa,GAAG,IAAAC,wCAAmB,EAACpB,SAAS,CAAC;EAEpDS,SAAS,CAACH,WAAW,GAAG,qBAAqB;EAC7CK,UAAU,CAACL,WAAW,GAAG,sBAAsB;EAC/CO,cAAc,CAACP,WAAW,GAAG,0BAA0B;EACvDS,SAAS,CAACT,WAAW,GAAG,qBAAqB;EAC7CW,aAAa,CAACX,WAAW,GAAG,yBAAyB;EACrDa,aAAa,CAACb,WAAW,GAAG,yBAAyB;EAErD,OAAOe,MAAM,CAACC,MAAM,CAAClB,QAAQ,EAAE;IAC7BP,KAAK,EAAEU,SAAS;IAChBN,KAAK,EAAEQ,SAAS;IAChBP,MAAM,EAAES,UAAU;IAClBR,UAAU,EAAEU,cAAc;IAC1Bf,KAAK,EAAEiB,SAAS;IAChBhB,SAAS,EAAEkB,aAAa;IACxBjB,SAAS,EAAEmB;EACb,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","forwardRef","useFormControlContext","jsx","_jsx","createFormError","BaseFormError","children","props","ref","isInvalid","feedbackId","setHasFeedbackText","visible","Boolean","useEffect","undefined","id","accessibilityRole","accessibilityLiveRegion"],"sourceRoot":"../../../src","sources":["form-control/createFormError.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,SAASC,qBAAqB,QAAQ,eAAe;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEtD,OAAO,MAAMC,eAAe,GAAQC,aAAqC,iBACvEL,UAAU,CAA0C,CAAC;EAAEM,QAAQ;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,KAAK;EACnF,MAAM;IAAEC,SAAS;IAAEC,UAAU;IAAEC;EAAmB,CAAC,GAAGV,qBAAqB,CAAC,CAAC;EAE7E,MAAMW,OAAO,GAAGC,OAAO,CAACJ,SAAS,IAAIH,QAAQ,CAAC;EAE9CP,KAAK,CAACe,SAAS,CAAC,MAAM;IACpB,IAAI,CAACF,OAAO,EAAE;MACZD,kBAAkB,GAAG,KAAK,CAAC;MAC3B,OAAOI,SAAS;IAClB;IACAJ,kBAAkB,GAAG,IAAI,CAAC;IAC1B,OAAO,MAAM;MACXA,kBAAkB,GAAG,KAAK,CAAC;IAC7B,CAAC;EACH,CAAC,EAAE,CAACA,kBAAkB,EAAEC,OAAO,CAAC,CAAC;EAEjC,OAAOA,OAAO,gBACZT,IAAA,CAACE,aAAa;IACZG,GAAG,EAAEA,GAAI;IAAA,GACJD,KAAK;IACVS,EAAE,EAAEN,UAAW;IACfO,iBAAiB,EAAC,OAAO;IACzBC,uBAAuB,EAAC,WAAW;IAAAZ,QAAA,EAElCA;EAAQ,CACI,CAAC,GACd,IAAI;AACV,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","jsx","_jsx","createFormErrorIcon","BaseFormErrorIcon","children","props","ref"],"sourceRoot":"../../../src","sources":["form-control/createFormErrorIcon.tsx"],"mappings":";;AACA,SAASA,UAAU,QAAQ,OAAO;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEnC,OAAO,MAAMC,mBAAmB,GAAQC,iBAAyC,iBAC/EJ,UAAU,CAA0C,CAAC;EAAEK,QAAQ;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,kBAC9EL,IAAA,CAACE,iBAAiB;EAACG,GAAG,EAAEA,GAAI;EAAA,GAAMD,KAAK;EAAAD,QAAA,EACpCA;AAAQ,CACQ,CACpB,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","jsx","_jsx","createFormErrorText","BaseFormErrorText","children","props","ref"],"sourceRoot":"../../../src","sources":["form-control/createFormErrorText.tsx"],"mappings":";;AACA,SAASA,UAAU,QAAQ,OAAO;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEnC,OAAO,MAAMC,mBAAmB,GAAQC,iBAAyC,iBAC/EJ,UAAU,CAA0C,CAAC;EAAEK,QAAQ;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,kBAC9EL,IAAA,CAACE,iBAAiB;EAACG,GAAG,EAAEA,GAAI;EAAA,GAAMD,KAAK;EAAAD,QAAA,EACpCA;AAAQ,CACQ,CACpB,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","forwardRef","useFormControlRoot","FormControlContext","dataAttributes","jsx","_jsx","createFormField","BaseFormField","children","props","ref","htmlProps","context","Provider","value","disabled","isDisabled","invalid","isInvalid","required","isRequired"],"sourceRoot":"../../../src","sources":["form-control/createFormField.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,SAASC,kBAAkB,EAAEC,kBAAkB,QAAQ,eAAe;AACtE,SAASC,cAAc,QAAQ,yBAAyB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAGzD,OAAO,MAAMC,eAAe,GAAQC,aAAqC,iBACvEP,UAAU,CACR,CAAC;EAAEQ,QAAQ;EAAE,GAAGC;AAAwD,CAAC,EAAEC,GAAa,KAAK;EAC3F,MAAM;IAAEC,SAAS;IAAE,GAAGC;EAAQ,CAAC,GAAGX,kBAAkB,CAACQ,KAAK,CAAC;EAE3D,oBACEJ,IAAA,CAACH,kBAAkB,CAACW,QAAQ;IAACC,KAAK,EAAEF,OAAQ;IAAAJ,QAAA,eAC1CH,IAAA,CAACE,aAAa;MACZG,GAAG,EAAEA,GAAI;MAAA,GACJC,SAAS;MAAA,GACVR,cAAc,CAAC;QACjBY,QAAQ,EAAEH,OAAO,CAACI,UAAU;QAC5BC,OAAO,EAAEL,OAAO,CAACM,SAAS;QAC1BC,QAAQ,EAAEP,OAAO,CAACQ;MACpB,CAAC,CAAC;MAAAZ,QAAA,EAEDA;IAAQ,CACI;EAAC,CACW,CAAC;AAElC,CACF,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","forwardRef","useFormControlContext","jsx","_jsx","createFormHelper","BaseFormHelper","children","props","ref","helpTextId","setHasHelpText","isInvalid","useEffect","undefined","id"],"sourceRoot":"../../../src","sources":["form-control/createFormHelper.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,SAASC,qBAAqB,QAAQ,eAAe;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEtD,OAAO,MAAMC,gBAAgB,GAAQC,cAAsC,iBACzEL,UAAU,CAA0C,CAAC;EAAEM,QAAQ;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,KAAK;EACnF,MAAM;IAAEC,UAAU;IAAEC,cAAc;IAAEC;EAAU,CAAC,GAAGV,qBAAqB,CAAC,CAAC;EAEzEF,KAAK,CAACa,SAAS,CAAC,MAAM;IACpB,IAAID,SAAS,EAAE;MACbD,cAAc,GAAG,KAAK,CAAC;MACvB,OAAOG,SAAS;IAClB;IACAH,cAAc,GAAG,IAAI,CAAC;IACtB,OAAO,MAAM;MACXA,cAAc,GAAG,KAAK,CAAC;IACzB,CAAC;EACH,CAAC,EAAE,CAACA,cAAc,EAAEC,SAAS,CAAC,CAAC;EAE/B,IAAIA,SAAS,EAAE;IACb,OAAO,IAAI;EACb;EAEA,oBACER,IAAA,CAACE,cAAc;IAACG,GAAG,EAAEA,GAAI;IAAA,GAAMD,KAAK;IAAQO,EAAE,EAAEL,UAAW;IAAAH,QAAA,EACxDA;EAAQ,CACK,CAAC;AAErB,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","jsx","_jsx","createFormHelperText","BaseFormHelperText","children","props","ref"],"sourceRoot":"../../../src","sources":["form-control/createFormHelperText.tsx"],"mappings":";;AACA,SAASA,UAAU,QAAQ,OAAO;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEnC,OAAO,MAAMC,oBAAoB,GAAQC,kBAA0C,iBACjFJ,UAAU,CAA0C,CAAC;EAAEK,QAAQ;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,kBAC9EL,IAAA,CAACE,kBAAkB;EAACG,GAAG,EAAEA,GAAI;EAAA,GAAMD,KAAK;EAAAD,QAAA,EACrCA;AAAQ,CACS,CACrB,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","useFormControlContext","dataAttributes","jsxs","_jsxs","createFormLabel","Label","BaseFormLabel","children","htmlFor","htmlForProp","requiredIndicator","props","ref","field","fieldId","id","labelId","undefined","invalid","isInvalid","required","isRequired"],"sourceRoot":"../../../src","sources":["form-control/createFormLabel.tsx"],"mappings":";;AACA,SAASA,UAAU,QAAQ,OAAO;AAClC,SAASC,qBAAqB,QAAQ,eAAe;AACrD,SAASC,cAAc,QAAQ,yBAAyB;AAAC,SAAAC,IAAA,IAAAC,KAAA;AAGzD,OAAO,MAAMC,eAAe,GAAGA,CAAK;EAAEC,KAAK,EAAEC;AAAiD,CAAC,kBAC7FP,UAAU,CACR,CAAC;EAAEQ,QAAQ;EAAEC,OAAO,EAAEC,WAAW;EAAEC,iBAAiB;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,KAAK;EACxE,MAAMC,KAAK,GAAGb,qBAAqB,CAAC,CAAC;EACrC,MAAMc,OAAO,GAAGD,KAAK,CAACE,EAAE;EACxB,MAAMC,OAAO,GAAGH,KAAK,CAACG,OAAO;;EAE7B;EACA,MAAMR,OAAO,GAAGC,WAAW,KAAKK,OAAO,GAAG,GAAGA,OAAO,QAAQ,GAAGG,SAAS,CAAC;EAEzE,oBACEd,KAAA,CAACG,aAAa;IACZM,GAAG,EAAEA,GAAI;IAAA,GACJD,KAAK;IACVI,EAAE,EAAEC,OAAQ;IACZR,OAAO,EAAEA,OAAQ;IAAA,GACbP,cAAc,CAAC;MAAEiB,OAAO,EAAEL,KAAK,CAACM,SAAS;MAAEC,QAAQ,EAAEP,KAAK,CAACQ;IAAW,CAAC,CAAC;IAAAd,QAAA,GAE3EA,QAAQ,EACRM,KAAK,CAACQ,UAAU,GAAGX,iBAAiB,GAAG,IAAI;EAAA,CAC/B,CAAC;AAEpB,CACF,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","forwardRef","jsx","_jsx","createFormRoot","BaseFormRoot","children","props","ref"],"sourceRoot":"../../../src","sources":["form-control/createFormRoot.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAG1C;;AAEA,OAAO,MAAMC,cAAc,GAAQC,YAAoC,iBACrEJ,UAAU,CACR,CAAC;EAAEK,QAAQ;EAAE,GAAGC;AAAmD,CAAC,EAAEC,GAAa,kBACjFL,IAAA,CAACE,YAAY;EAACG,GAAG,EAAEA,GAAI;EAAA,GAAMD,KAAK;EAAAD,QAAA,EAC/BA;AAAQ,CACG,CAElB,CAAC","ignoreList":[]}
|