@eleventheye/asui 2.1.4 → 2.1.5
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/dist/astextfield/ASTextField.d.ts.map +1 -1
- package/dist/astextfield/ASTextField.js +11 -2
- package/dist/astextfield/ASTextField.types.d.ts +1 -0
- package/dist/astextfield/ASTextField.types.d.ts.map +1 -1
- package/dist/astextfield/styles.js +1 -1
- package/dist/icons/ASIcon.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ASTextField.d.ts","sourceRoot":"","sources":["../../src/astextfield/ASTextField.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ASTextField.d.ts","sourceRoot":"","sources":["../../src/astextfield/ASTextField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAK9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAUvD,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAqI3C,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -7,7 +7,8 @@ const ASUI_types_1 = require("../apptypes/ASUI.types");
|
|
|
7
7
|
const astheme_1 = tslib_1.__importDefault(require("../astheme"));
|
|
8
8
|
const icons_1 = require("../icons");
|
|
9
9
|
const styles_1 = require("./styles");
|
|
10
|
-
const ASTextField = ({ className = '', theme = astheme_1.default, value = '', onChange = () => undefined, size = ASUI_types_1.ASComponentSize.Medium, type = 'text', showClearButton = false, showSearchIcon = false, ...props }) => {
|
|
10
|
+
const ASTextField = ({ className = '', theme = astheme_1.default, value = '', onChange = () => undefined, size = ASUI_types_1.ASComponentSize.Medium, type = 'text', showClearButton = false, showSearchIcon = false, disableAutofill = false, ...props }) => {
|
|
11
|
+
const passwordTypeRef = (0, react_1.useRef)(false);
|
|
11
12
|
const genericId = (0, react_1.useId)();
|
|
12
13
|
const textFieldId = props.id || genericId;
|
|
13
14
|
const [valueString, setValueString] = (0, react_1.useState)(value);
|
|
@@ -18,9 +19,16 @@ const ASTextField = ({ className = '', theme = astheme_1.default, value = '', on
|
|
|
18
19
|
const [leftIconCls, setLeftIconCls] = (0, react_1.useState)('LeftIconOff');
|
|
19
20
|
const [passwordCls, setPasswordCls] = (0, react_1.useState)('');
|
|
20
21
|
const [showType, setShowType] = (0, react_1.useState)(type);
|
|
22
|
+
(0, react_1.useEffect)(() => {
|
|
23
|
+
setShowType(type);
|
|
24
|
+
}, [type]);
|
|
21
25
|
(0, react_1.useEffect)(() => {
|
|
22
26
|
let searchIcon = showSearchIcon;
|
|
23
27
|
let clearIcon = showClearButton;
|
|
28
|
+
if (passwordTypeRef.current && type !== 'text' && type !== 'password') {
|
|
29
|
+
passwordTypeRef.current = false;
|
|
30
|
+
setPasswordIconVisible(false);
|
|
31
|
+
}
|
|
24
32
|
if (type === 'search') {
|
|
25
33
|
searchIcon = true;
|
|
26
34
|
clearIcon = true;
|
|
@@ -29,6 +37,7 @@ const ASTextField = ({ className = '', theme = astheme_1.default, value = '', on
|
|
|
29
37
|
clearIcon = true;
|
|
30
38
|
}
|
|
31
39
|
if (type === 'password') {
|
|
40
|
+
passwordTypeRef.current = true;
|
|
32
41
|
setPasswordIconVisible(true);
|
|
33
42
|
}
|
|
34
43
|
setSearchIconVisible(searchIcon);
|
|
@@ -63,6 +72,6 @@ const ASTextField = ({ className = '', theme = astheme_1.default, value = '', on
|
|
|
63
72
|
setShowType(showType === 'password' ? 'text' : 'password');
|
|
64
73
|
};
|
|
65
74
|
const baseCls = `"ASTextFieldInputContainer" ${size} ${leftIconCls} ${rightIconCls} ${passwordCls} ${className}`;
|
|
66
|
-
return ((0, jsx_runtime_1.jsxs)(styles_1.ASTextFieldInputContainer, { theme: theme, className: baseCls, style: props.style, children: [searchIconVisible && ((0, jsx_runtime_1.jsx)(styles_1.ASTextFieldSearchIcon, { theme: theme, className: "ASTextFieldSearchIcon", children: (0, jsx_runtime_1.jsx)(icons_1.SearchIcon, { color: "#333333", fillColor: "#333333", size: 20 }) })), (0, jsx_runtime_1.jsx)(styles_1.ASTextFieldInput, { theme: theme, id: textFieldId, className: "ASTextFieldInput", type: showType, value: valueString, onChange: onValueChange, onFocus: onInputFieldFocus, ...props }), clearIconVisible && ((0, jsx_runtime_1.jsx)(styles_1.ASTextFieldClickIcon, { theme: theme, className: "ASTextFieldClearIcon", onClick: clearValue, children: (0, jsx_runtime_1.jsx)(icons_1.CloseIcon, { color: "transparent", fillColor: "#333333", circleStrokeColor: "#666666", circleStrokeWidth: 0.5, size: 20 }) })), passwordIconVisible && ((0, jsx_runtime_1.jsxs)(styles_1.ASTextFieldClickIcon, { theme: theme, className: "ASTextFieldPasswordIcon", onClick: onPasswordShowHide, children: [showType === 'password' && (0, jsx_runtime_1.jsx)(styles_1.ScaledEyeIcon, { color: "#333333", fillColor: "#333333", size: 20 }), showType === 'text' && (0, jsx_runtime_1.jsx)(styles_1.ScaledSlashedEyeIcon, { color: "#333333", fillColor: "#333333", size: 20 })] }))] }));
|
|
75
|
+
return ((0, jsx_runtime_1.jsxs)(styles_1.ASTextFieldInputContainer, { theme: theme, className: baseCls, style: props.style, children: [searchIconVisible && ((0, jsx_runtime_1.jsx)(styles_1.ASTextFieldSearchIcon, { theme: theme, className: "ASTextFieldSearchIcon", children: (0, jsx_runtime_1.jsx)(icons_1.SearchIcon, { color: "#333333", fillColor: "#333333", size: 20 }) })), (0, jsx_runtime_1.jsx)(styles_1.ASTextFieldInput, { theme: theme, autoComplete: passwordIconVisible ? 'new-password' : disableAutofill ? 'off' : 'on', "aria-autocomplete": passwordIconVisible ? 'none' : 'list', autoCorrect: passwordIconVisible ? 'off' : 'on', autoCapitalize: 'none', spellCheck: passwordIconVisible ? 'false' : 'true', autoFocus: true, id: textFieldId, className: "ASTextFieldInput", type: showType, value: valueString, onChange: onValueChange, onFocus: onInputFieldFocus, ...props }), clearIconVisible && ((0, jsx_runtime_1.jsx)(styles_1.ASTextFieldClickIcon, { theme: theme, className: "ASTextFieldClearIcon", onClick: clearValue, children: (0, jsx_runtime_1.jsx)(icons_1.CloseIcon, { color: "transparent", fillColor: "#333333", circleStrokeColor: "#666666", circleStrokeWidth: 0.5, size: 20 }) })), passwordIconVisible && ((0, jsx_runtime_1.jsxs)(styles_1.ASTextFieldClickIcon, { theme: theme, className: "ASTextFieldPasswordIcon", onClick: onPasswordShowHide, children: [showType === 'password' && (0, jsx_runtime_1.jsx)(styles_1.ScaledEyeIcon, { color: "#333333", fillColor: "#333333", size: 20 }), showType === 'text' && (0, jsx_runtime_1.jsx)(styles_1.ScaledSlashedEyeIcon, { color: "#333333", fillColor: "#333333", size: 20 })] }))] }));
|
|
67
76
|
};
|
|
68
77
|
exports.default = ASTextField;
|
|
@@ -7,6 +7,7 @@ export type ASTextFieldProps = {
|
|
|
7
7
|
onChange?: (value: string) => void;
|
|
8
8
|
size?: ASComponentSize;
|
|
9
9
|
showClearButton?: boolean;
|
|
10
|
+
disableAutofill?: boolean;
|
|
10
11
|
showSearchIcon?: boolean;
|
|
11
12
|
} & Pick<React.HTMLProps<HTMLInputElement>, 'style' | 'type' | 'placeholder' | 'id' | 'onBlur' | 'onFocus'>;
|
|
12
13
|
//# sourceMappingURL=ASTextField.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ASTextField.types.d.ts","sourceRoot":"","sources":["../../src/astextfield/ASTextField.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,cAAc,MAAM,YAAY,CAAC;AAExC,MAAM,MAAM,gBAAgB,GAAG;IAK7B,SAAS,CAAC,EAAE,MAAM,CAAC;IAMnB,KAAK,CAAC,EAAE,OAAO,cAAc,CAAC;IAM9B,KAAK,CAAC,EAAE,MAAM,CAAC;IAMf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IASnC,IAAI,CAAC,EAAE,eAAe,CAAC;IAOvB,eAAe,CAAC,EAAE,OAAO,CAAC;IAQ1B,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,aAAa,GAAG,IAAI,GAAG,QAAQ,GAAG,SAAS,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"ASTextField.types.d.ts","sourceRoot":"","sources":["../../src/astextfield/ASTextField.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,cAAc,MAAM,YAAY,CAAC;AAExC,MAAM,MAAM,gBAAgB,GAAG;IAK7B,SAAS,CAAC,EAAE,MAAM,CAAC;IAMnB,KAAK,CAAC,EAAE,OAAO,cAAc,CAAC;IAM9B,KAAK,CAAC,EAAE,MAAM,CAAC;IAMf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IASnC,IAAI,CAAC,EAAE,eAAe,CAAC;IAOvB,eAAe,CAAC,EAAE,OAAO,CAAC;IAO1B,eAAe,CAAC,EAAE,OAAO,CAAC;IAQ1B,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,aAAa,GAAG,IAAI,GAAG,QAAQ,GAAG,SAAS,CAAC,CAAC"}
|
|
@@ -98,7 +98,7 @@ exports.ASTextFieldInputContainer = styled_components_1.default.div `
|
|
|
98
98
|
|
|
99
99
|
// Chrome autofill update
|
|
100
100
|
// input:-webkit-autofill,
|
|
101
|
-
input:-webkit-autofill:hover,
|
|
101
|
+
* input:-webkit-autofill:hover,
|
|
102
102
|
input:-webkit-autofill:focus,
|
|
103
103
|
textarea:-webkit-autofill,
|
|
104
104
|
textarea:-webkit-autofill:hover,
|
package/dist/icons/ASIcon.js
CHANGED
|
@@ -6,7 +6,7 @@ const react_1 = tslib_1.__importDefault(require("react"));
|
|
|
6
6
|
const styles_1 = require("./styles");
|
|
7
7
|
const CircleSvg = ({ size = 24, circleStrokeWidth = 1.5, circleFillColor = 'transparent', circleStrokeColor = '#fffff0', circleFillOpacity = 1, withCircle = false, }) => ((0, jsx_runtime_1.jsx)(styles_1.IconCircle, { width: size, height: size, viewBox: "0 0 24 24", fill: "transparent", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("circle", { fill: withCircle ? circleFillColor : 'none', fillOpacity: circleFillOpacity, cx: "12", cy: "12", r: "10.5", stroke: withCircle ? circleStrokeColor : 'transparent', strokeWidth: `${circleStrokeWidth}px` }) }));
|
|
8
8
|
const ASIcon = ({ className = '', size = 24, color = '#fffff0', fillColor = 'transparent', fillOpacity = 1, circleStrokeColor = '#fffff0', withCircle = false, children, ...props }) => {
|
|
9
|
-
return ((0, jsx_runtime_1.jsxs)(styles_1.IconWrapper, { className: className, children: [(0, jsx_runtime_1.jsx)(CircleSvg, { size: size, circleStrokeColor, withCircle, ...props }), react_1.default.Children.map(children, (child) => react_1.default.isValidElement(child)
|
|
9
|
+
return ((0, jsx_runtime_1.jsxs)(styles_1.IconWrapper, { className: className, style: props.style, children: [(0, jsx_runtime_1.jsx)(CircleSvg, { size: size, circleStrokeColor, withCircle, ...props }), react_1.default.Children.map(children, (child) => react_1.default.isValidElement(child)
|
|
10
10
|
? react_1.default.cloneElement(child, { size, color, fillColor, withCircle, fillOpacity, ...props })
|
|
11
11
|
: child)] }));
|
|
12
12
|
};
|