@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.
@@ -685,27 +685,24 @@ const TextField = react_1.default.forwardRef((props_, ref) => {
685
685
  const iconProps = {
686
686
  size
687
687
  };
688
- const end = react_1.default.useMemo(() => {
689
- const endItems = (Array.isArray(end_) ? end_ : [end_]).filter(Boolean);
690
- const password = type === 'password';
691
- if (value && clear) {
692
- const exists = endItems === null || endItems === void 0 ? void 0 : endItems.find(item => item.key === refs.ids.clear);
693
- if (!exists) {
694
- if (props.endVerticalAlign === undefined)
695
- endVerticalAlign = 'center';
696
- endItems.push((0, jsx_runtime_1.jsx)(IconClear, Object.assign({ color: 'inherit', onClick: onClear }, IconProps, { className: (0, style_react_1.classNames)([
697
- IconProps === null || IconProps === void 0 ? void 0 : IconProps.className,
698
- classes.clear
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
- return endItems;
708
- }, [value, version, multiline, visible, onClear, type, end_]);
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 end = React.useMemo(() => {
807
- const endItems = (Array.isArray(end_) ? end_ : [end_]).filter(Boolean);
808
- const password = type === 'password';
809
- if (value && clear) {
810
- const exists = endItems?.find(item => item.key === refs.ids.clear);
811
- if (!exists) {
812
- if (props.endVerticalAlign === undefined) endVerticalAlign = 'center';
813
- endItems.push(/*#__PURE__*/React.createElement(IconClear, _extends({
814
- key: refs.ids.clear,
815
- color: "inherit",
816
- onClick: onClear
817
- }, IconProps, {
818
- className: classNames([IconProps?.className, classes.clear])
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
- return endItems;
834
- }, [value, version, multiline, visible, onClear, type, end_]);
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
@@ -1,4 +1,4 @@
1
- /** @license UiReact v1.0.124
1
+ /** @license UiReact v1.0.125
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onesy/ui-react",
3
- "version": "1.0.125",
3
+ "version": "1.0.126",
4
4
  "description": "UI for React",
5
5
  "repository": "https://github.com/onesy-me/onesy.git",
6
6
  "author": "Lazar Erić <lazareric1@proton.me>",