@onesy/ui-react 1.0.125 → 1.0.126
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/TextField/TextField.js +17 -20
- package/esm/TextField/TextField.js +25 -28
- package/esm/index.js +1 -1
- package/package.json +1 -1
package/TextField/TextField.js
CHANGED
|
@@ -685,27 +685,24 @@ const TextField = react_1.default.forwardRef((props_, ref) => {
|
|
|
685
685
|
const iconProps = {
|
|
686
686
|
size
|
|
687
687
|
};
|
|
688
|
-
const
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
if (
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
]) }), refs.ids.clear));
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
if (value && password) {
|
|
703
|
-
if (!multiline && props.endVerticalAlign === undefined)
|
|
704
|
-
endVerticalAlign = version === 'text' ? 'end' : 'center';
|
|
705
|
-
endItems.unshift((0, jsx_runtime_1.jsx)(Tooltip, Object.assign({ name: visible ? l('Hide password') : l('View password'), color: 'inverted' }, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ onClick: onToggleVisible, color: 'default', size: size === 'large' ? 'regular' : 'small' }, { children: visible ? (0, jsx_runtime_1.jsx)(IconMaterialPassword2OffW100_1.default, Object.assign({}, iconProps)) : (0, jsx_runtime_1.jsx)(IconMaterialPassword2W100_1.default, Object.assign({}, iconProps)) })) })));
|
|
688
|
+
const isTypePassword = type === 'password';
|
|
689
|
+
const end = (Array.isArray(end_) ? end_ : [end_]).filter(Boolean);
|
|
690
|
+
if (value && clear) {
|
|
691
|
+
const exists = end === null || end === void 0 ? void 0 : end.find(item => item.key === refs.ids.clear);
|
|
692
|
+
if (!exists) {
|
|
693
|
+
if (props.endVerticalAlign === undefined)
|
|
694
|
+
endVerticalAlign = 'center';
|
|
695
|
+
end.push((0, jsx_runtime_1.jsx)(IconClear, Object.assign({ color: 'inherit', onClick: onClear }, IconProps, { className: (0, style_react_1.classNames)([
|
|
696
|
+
IconProps === null || IconProps === void 0 ? void 0 : IconProps.className,
|
|
697
|
+
classes.clear
|
|
698
|
+
]) }), refs.ids.clear));
|
|
706
699
|
}
|
|
707
|
-
|
|
708
|
-
|
|
700
|
+
}
|
|
701
|
+
if (value && isTypePassword) {
|
|
702
|
+
if (!multiline && props.endVerticalAlign === undefined)
|
|
703
|
+
endVerticalAlign = version === 'text' ? 'end' : 'center';
|
|
704
|
+
end.unshift((0, jsx_runtime_1.jsx)(Tooltip, Object.assign({ name: visible ? l('Hide password') : l('View password'), color: 'inverted' }, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ onClick: onToggleVisible, color: 'default', size: size === 'large' ? 'regular' : 'small' }, { children: visible ? (0, jsx_runtime_1.jsx)(IconMaterialPassword2OffW100_1.default, Object.assign({}, iconProps)) : (0, jsx_runtime_1.jsx)(IconMaterialPassword2W100_1.default, Object.assign({}, iconProps)) })) })));
|
|
705
|
+
}
|
|
709
706
|
const valueWithData = value !== undefined && String(value);
|
|
710
707
|
return ((0, jsx_runtime_1.jsxs)(Wrapper, Object.assign({}, WrapperProps, { children: [(0, jsx_runtime_1.jsxs)(Component, Object.assign({ onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onTouchStart: onMouseEnter, onTouchEnd: onMouseLeave, role: 'textbox', "aria-multiline": multiline, "aria-labelledby": refs.ids.label }, ComponentProps, { className: (0, style_react_1.classNames)([
|
|
711
708
|
(0, utils_2.staticClassName)('TextField', theme) && [
|
|
@@ -803,35 +803,32 @@ const TextField = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
803
803
|
const iconProps = {
|
|
804
804
|
size
|
|
805
805
|
};
|
|
806
|
-
const
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
if (
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
})));
|
|
820
|
-
}
|
|
821
|
-
}
|
|
822
|
-
if (value && password) {
|
|
823
|
-
if (!multiline && props.endVerticalAlign === undefined) endVerticalAlign = version === 'text' ? 'end' : 'center';
|
|
824
|
-
endItems.unshift(/*#__PURE__*/React.createElement(Tooltip, {
|
|
825
|
-
name: visible ? l('Hide password') : l('View password'),
|
|
826
|
-
color: "inverted"
|
|
827
|
-
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
828
|
-
onClick: onToggleVisible,
|
|
829
|
-
color: "default",
|
|
830
|
-
size: size === 'large' ? 'regular' : 'small'
|
|
831
|
-
}, visible ? /*#__PURE__*/React.createElement(IconMaterialPassword2Off, iconProps) : /*#__PURE__*/React.createElement(IconMaterialPassword2, iconProps))));
|
|
806
|
+
const isTypePassword = type === 'password';
|
|
807
|
+
const end = (Array.isArray(end_) ? end_ : [end_]).filter(Boolean);
|
|
808
|
+
if (value && clear) {
|
|
809
|
+
const exists = end?.find(item => item.key === refs.ids.clear);
|
|
810
|
+
if (!exists) {
|
|
811
|
+
if (props.endVerticalAlign === undefined) endVerticalAlign = 'center';
|
|
812
|
+
end.push(/*#__PURE__*/React.createElement(IconClear, _extends({
|
|
813
|
+
key: refs.ids.clear,
|
|
814
|
+
color: "inherit",
|
|
815
|
+
onClick: onClear
|
|
816
|
+
}, IconProps, {
|
|
817
|
+
className: classNames([IconProps?.className, classes.clear])
|
|
818
|
+
})));
|
|
832
819
|
}
|
|
833
|
-
|
|
834
|
-
|
|
820
|
+
}
|
|
821
|
+
if (value && isTypePassword) {
|
|
822
|
+
if (!multiline && props.endVerticalAlign === undefined) endVerticalAlign = version === 'text' ? 'end' : 'center';
|
|
823
|
+
end.unshift(/*#__PURE__*/React.createElement(Tooltip, {
|
|
824
|
+
name: visible ? l('Hide password') : l('View password'),
|
|
825
|
+
color: "inverted"
|
|
826
|
+
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
827
|
+
onClick: onToggleVisible,
|
|
828
|
+
color: "default",
|
|
829
|
+
size: size === 'large' ? 'regular' : 'small'
|
|
830
|
+
}, visible ? /*#__PURE__*/React.createElement(IconMaterialPassword2Off, iconProps) : /*#__PURE__*/React.createElement(IconMaterialPassword2, iconProps))));
|
|
831
|
+
}
|
|
835
832
|
const valueWithData = value !== undefined && String(value);
|
|
836
833
|
return /*#__PURE__*/React.createElement(Wrapper, WrapperProps, /*#__PURE__*/React.createElement(Component, _extends({
|
|
837
834
|
onMouseEnter: onMouseEnter,
|
package/esm/index.js
CHANGED