@udixio/ui-react 2.9.19 → 2.9.21
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/CHANGELOG.md +20 -0
- package/dist/index.cjs +3 -3
- package/dist/index.js +3334 -3328
- package/dist/lib/components/TextField.d.ts +1 -1
- package/dist/lib/components/TextField.d.ts.map +1 -1
- package/dist/lib/interfaces/text-field.interface.d.ts +3 -0
- package/dist/lib/interfaces/text-field.interface.d.ts.map +1 -1
- package/dist/lib/styles/text-field.style.d.ts +9 -0
- package/dist/lib/styles/text-field.style.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/lib/components/TextField.tsx +16 -6
- package/src/lib/interfaces/text-field.interface.ts +3 -0
|
@@ -10,5 +10,5 @@ import { TextFieldInterface } from '../interfaces';
|
|
|
10
10
|
* @a11y
|
|
11
11
|
* - `aria-describedby` links supporting text/error to input.
|
|
12
12
|
*/
|
|
13
|
-
export declare const TextField: ({ variant, disabled, errorText, placeholder, suffix, name, label, className, supportingText, trailingIcon, leadingIcon, type, multiline, autoComplete, onChange, value: valueProp, defaultValue, showSupportingText, id: idProp, style, ref, ...restProps }: ReactProps<TextFieldInterface>) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const TextField: ({ variant, autoFocus, disabled, errorText, placeholder, suffix, name, label, className, supportingText, trailingIcon, leadingIcon, type, multiline, autoComplete, onChange, value: valueProp, defaultValue, showSupportingText, id: idProp, style, ref, onFocus, onBlur, ...restProps }: ReactProps<TextFieldInterface>) => import("react/jsx-runtime").JSX.Element;
|
|
14
14
|
//# sourceMappingURL=TextField.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../src/lib/components/TextField.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD;;;;;;;;;GASG;AACH,eAAO,MAAM,SAAS,GAAI,
|
|
1
|
+
{"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../src/lib/components/TextField.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD;;;;;;;;;GASG;AACH,eAAO,MAAM,SAAS,GAAI,yRA0BvB,UAAU,CAAC,kBAAkB,CAAC,4CA+VhC,CAAC"}
|
|
@@ -21,7 +21,10 @@ type Props = {
|
|
|
21
21
|
variant?: TextFieldVariant;
|
|
22
22
|
type?: 'text' | 'password' | 'number' | 'date';
|
|
23
23
|
autoComplete?: 'on' | 'off' | string;
|
|
24
|
+
autoFocus?: boolean;
|
|
24
25
|
multiline?: boolean;
|
|
26
|
+
onFocus?: () => void;
|
|
27
|
+
onBlur?: () => void;
|
|
25
28
|
};
|
|
26
29
|
export type TextFieldStates = {
|
|
27
30
|
isFocused: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-field.interface.d.ts","sourceRoot":"","sources":["../../../src/lib/interfaces/text-field.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,UAAU,CAAC;AAErD,KAAK,KAAK,GAAG;IACX,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,KAAK,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F,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,OAAO,CAAC;IACvB,kBAAkB,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,KAAK,CAAC;IACZ,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,eAAe,CAAC;IACxB,QAAQ,EAAE;QACR,WAAW;QACX,SAAS;QACT,OAAO;QACP,OAAO;QACP,iBAAiB;QACjB,gBAAgB;QAChB,aAAa;QACb,cAAc;QACd,QAAQ;QACR,YAAY;KACb,CAAC;CACH"}
|
|
@@ -20,7 +20,10 @@ export declare const textFieldStyle: (states: {
|
|
|
20
20
|
variant: any;
|
|
21
21
|
type: any;
|
|
22
22
|
autoComplete: any;
|
|
23
|
+
autoFocus: any;
|
|
23
24
|
multiline: any;
|
|
25
|
+
onFocus: any;
|
|
26
|
+
onBlur: any;
|
|
24
27
|
} & {
|
|
25
28
|
placeholder?: string;
|
|
26
29
|
name?: string;
|
|
@@ -40,7 +43,10 @@ export declare const textFieldStyle: (states: {
|
|
|
40
43
|
variant?: import('..').TextFieldVariant;
|
|
41
44
|
type?: "text" | "password" | "number" | "date";
|
|
42
45
|
autoComplete?: "on" | "off" | string;
|
|
46
|
+
autoFocus?: boolean;
|
|
43
47
|
multiline?: boolean;
|
|
48
|
+
onFocus?: () => void;
|
|
49
|
+
onBlur?: () => void;
|
|
44
50
|
} & import('..').TextFieldStates & {
|
|
45
51
|
className: string | ClassNameComponent<TextFieldInterface> | undefined;
|
|
46
52
|
}) => Record<"input" | "label" | "content" | "stateLayer" | "leadingIcon" | "trailingIcon" | "activeIndicator" | "supportingText" | "textField" | "suffix", string>;
|
|
@@ -63,7 +69,10 @@ export declare const useTextFieldStyle: (states: import('..').TextFieldStates &
|
|
|
63
69
|
variant?: import('..').TextFieldVariant;
|
|
64
70
|
type?: "text" | "password" | "number" | "date";
|
|
65
71
|
autoComplete?: "on" | "off" | string;
|
|
72
|
+
autoFocus?: boolean;
|
|
66
73
|
multiline?: boolean;
|
|
74
|
+
onFocus?: () => void;
|
|
75
|
+
onBlur?: () => void;
|
|
67
76
|
} & {
|
|
68
77
|
className?: string | ClassNameComponent<TextFieldInterface> | undefined;
|
|
69
78
|
}) => Record<"input" | "label" | "content" | "stateLayer" | "leadingIcon" | "trailingIcon" | "activeIndicator" | "supportingText" | "textField" | "suffix", string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-field.style.d.ts","sourceRoot":"","sources":["../../../src/lib/styles/text-field.style.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,KAAK,kBAAkB,EAIxB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAmGnD,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"text-field.style.d.ts","sourceRoot":"","sources":["../../../src/lib/styles/text-field.style.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,KAAK,kBAAkB,EAIxB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAmGnD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mKAG1B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;mKAG7B,CAAC"}
|
package/package.json
CHANGED
|
@@ -27,6 +27,7 @@ import { TextFieldInterface } from '../interfaces';
|
|
|
27
27
|
*/
|
|
28
28
|
export const TextField = ({
|
|
29
29
|
variant = 'filled',
|
|
30
|
+
autoFocus,
|
|
30
31
|
disabled = false,
|
|
31
32
|
errorText,
|
|
32
33
|
placeholder,
|
|
@@ -47,6 +48,8 @@ export const TextField = ({
|
|
|
47
48
|
id: idProp,
|
|
48
49
|
style,
|
|
49
50
|
ref,
|
|
51
|
+
onFocus,
|
|
52
|
+
onBlur,
|
|
50
53
|
...restProps
|
|
51
54
|
}: ReactProps<TextFieldInterface>) => {
|
|
52
55
|
const generatedId = useId();
|
|
@@ -80,15 +83,25 @@ export const TextField = ({
|
|
|
80
83
|
}
|
|
81
84
|
};
|
|
82
85
|
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
if (!autoFocus || disabled) return;
|
|
88
|
+
|
|
89
|
+
const rafId = window.requestAnimationFrame(() => {
|
|
90
|
+
focusInput();
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
return () => window.cancelAnimationFrame(rafId);
|
|
94
|
+
}, [autoFocus, disabled, inputRef]);
|
|
95
|
+
|
|
83
96
|
useEffect(() => {
|
|
84
97
|
if (isFocused) {
|
|
85
98
|
setShowErrorIcon(false);
|
|
86
|
-
|
|
99
|
+
onFocus?.();
|
|
87
100
|
} else {
|
|
88
101
|
if (errorText?.length) {
|
|
89
102
|
setShowErrorIcon(true);
|
|
90
103
|
}
|
|
91
|
-
|
|
104
|
+
onBlur?.();
|
|
92
105
|
}
|
|
93
106
|
}, [isFocused]);
|
|
94
107
|
|
|
@@ -281,6 +294,7 @@ export const TextField = ({
|
|
|
281
294
|
autoComplete={autoComplete}
|
|
282
295
|
aria-invalid={!!errorText?.length}
|
|
283
296
|
aria-describedby={hasSupportingText ? helperTextId : undefined}
|
|
297
|
+
autoFocus={autoFocus}
|
|
284
298
|
{...textComponentProps}
|
|
285
299
|
/>
|
|
286
300
|
</div>
|
|
@@ -347,10 +361,6 @@ export const TextField = ({
|
|
|
347
361
|
<>
|
|
348
362
|
<AnchorPositioner
|
|
349
363
|
onBlur={(e) => {
|
|
350
|
-
console.log(
|
|
351
|
-
datePickerRef.current,
|
|
352
|
-
!datePickerRef.current?.contains(e.relatedTarget),
|
|
353
|
-
);
|
|
354
364
|
if (
|
|
355
365
|
datePickerRef.current &&
|
|
356
366
|
!datePickerRef.current?.contains(e.relatedTarget)
|
|
@@ -24,7 +24,10 @@ type Props = {
|
|
|
24
24
|
variant?: TextFieldVariant;
|
|
25
25
|
type?: 'text' | 'password' | 'number' | 'date';
|
|
26
26
|
autoComplete?: 'on' | 'off' | string;
|
|
27
|
+
autoFocus?: boolean;
|
|
27
28
|
multiline?: boolean;
|
|
29
|
+
onFocus?: () => void;
|
|
30
|
+
onBlur?: () => void;
|
|
28
31
|
};
|
|
29
32
|
export type TextFieldStates = {
|
|
30
33
|
isFocused: boolean;
|