@devopness/ui-react 2.161.1 → 2.162.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.
|
@@ -14,6 +14,8 @@ type SharedProps = React.InputHTMLAttributes<HTMLInputElement> & {
|
|
|
14
14
|
/** Font style applied to placeholder */
|
|
15
15
|
fontStylePlaceholder?: string;
|
|
16
16
|
};
|
|
17
|
+
/** Whether to automatically focus the input when an error occurs */
|
|
18
|
+
autoFocusOnError?: boolean;
|
|
17
19
|
/**
|
|
18
20
|
* Props passed directly to input HTML element
|
|
19
21
|
*
|
|
@@ -37,12 +39,10 @@ type InputProps = (SharedProps & {
|
|
|
37
39
|
*
|
|
38
40
|
* A flexible input component that supports:
|
|
39
41
|
* - Various input types (text, number, etc.)
|
|
40
|
-
* - Error states with automatic focus
|
|
42
|
+
* - Error states with optional automatic focus
|
|
41
43
|
* - Custom styling
|
|
42
44
|
* - Label and help text
|
|
43
45
|
*
|
|
44
|
-
* When an error state is applied, the input will automatically receive focus to draw the user's attention.
|
|
45
|
-
*
|
|
46
46
|
* @example
|
|
47
47
|
* ```
|
|
48
48
|
* <Input
|
|
@@ -71,6 +71,8 @@ declare const Input: import('react').ForwardRefExoticComponent<(Omit<import('rea
|
|
|
71
71
|
/** Font style applied to placeholder */
|
|
72
72
|
fontStylePlaceholder?: string;
|
|
73
73
|
};
|
|
74
|
+
/** Whether to automatically focus the input when an error occurs */
|
|
75
|
+
autoFocusOnError?: boolean;
|
|
74
76
|
/**
|
|
75
77
|
* Props passed directly to input HTML element
|
|
76
78
|
*
|
|
@@ -96,6 +98,8 @@ declare const Input: import('react').ForwardRefExoticComponent<(Omit<import('rea
|
|
|
96
98
|
/** Font style applied to placeholder */
|
|
97
99
|
fontStylePlaceholder?: string;
|
|
98
100
|
};
|
|
101
|
+
/** Whether to automatically focus the input when an error occurs */
|
|
102
|
+
autoFocusOnError?: boolean;
|
|
99
103
|
/**
|
|
100
104
|
* Props passed directly to input HTML element
|
|
101
105
|
*
|
package/dist/ui-react.cjs
CHANGED
|
@@ -737,4 +737,4 @@ To suppress this warning, you need to explicitly provide the \`palette.${t}Chann
|
|
|
737
737
|
}
|
|
738
738
|
|
|
739
739
|
${e=>{if(e.type==="number")return e.removeArrows?Nb:Ab}}
|
|
740
|
-
`,Lf=ie.forwardRef((e,t)=>{const r=ie.useRef(null),n=t??r;return ie.useEffect(()=>{
|
|
740
|
+
`,Lf=ie.forwardRef((e,t)=>{const r=ie.useRef(null),n=t??r,{autoFocusOnError:o,error:i}=e;return ie.useEffect(()=>{o&&i&&n.current&&n.current.focus()},[o,i,n]),R.jsxs(kb,{children:[e.labelProps&&R.jsx(Mf,{...e.labelProps}),R.jsx(Ib,{className:"translate",ref:n,hasError:!!i,...e,...e.inputProps}),!!i&&R.jsx(Pf,{error:i})]})});Lf.displayName="Input";exports.Alert=Pb;exports.ArrowHead=Ty;exports.Button=ir;exports.Card=Ny;exports.Dropdown=dy;exports.ErrorMessage=Pf;exports.IconComponent=ar;exports.Input=Lf;exports.Label=Mf;exports.Link=So;exports.Pagination=by;exports.Tabs=yb;exports.Tooltip=_r;exports.getColor=ne;exports.getFont=xt;exports.getImageAssetUrl=Se;exports.getOpacity=ru;exports.iconLoader=jo;
|
package/dist/ui-react.js
CHANGED
|
@@ -15300,11 +15300,12 @@ const xb = le(Bf)`
|
|
|
15300
15300
|
return e.removeArrows ? Lb : jb;
|
|
15301
15301
|
}}
|
|
15302
15302
|
`, Bb = Yf((e, t) => {
|
|
15303
|
-
const r = Po(null), n = t ?? r;
|
|
15303
|
+
const r = Po(null), n = t ?? r, { autoFocusOnError: o, error: i } = e;
|
|
15304
15304
|
return Mo(() => {
|
|
15305
|
-
|
|
15305
|
+
o && i && n.current && n.current.focus();
|
|
15306
15306
|
}, [
|
|
15307
|
-
|
|
15307
|
+
o,
|
|
15308
|
+
i,
|
|
15308
15309
|
n
|
|
15309
15310
|
]), /* @__PURE__ */ R.jsxs(Ib, { children: [
|
|
15310
15311
|
e.labelProps && /* @__PURE__ */ R.jsx(Py, { ...e.labelProps }),
|
|
@@ -15313,12 +15314,12 @@ const xb = le(Bf)`
|
|
|
15313
15314
|
{
|
|
15314
15315
|
className: "translate",
|
|
15315
15316
|
ref: n,
|
|
15316
|
-
hasError: !!
|
|
15317
|
+
hasError: !!i,
|
|
15317
15318
|
...e,
|
|
15318
15319
|
...e.inputProps
|
|
15319
15320
|
}
|
|
15320
15321
|
),
|
|
15321
|
-
!!
|
|
15322
|
+
!!i && /* @__PURE__ */ R.jsx(wy, { error: i })
|
|
15322
15323
|
] });
|
|
15323
15324
|
});
|
|
15324
15325
|
Bb.displayName = "Input";
|