ywana-core8 0.0.169 → 0.0.170

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/index.cjs CHANGED
@@ -863,6 +863,8 @@ var TextField = function TextField(props) {
863
863
  outlined = props.outlined,
864
864
  _props$readOnly = props.readOnly,
865
865
  readOnly = _props$readOnly === void 0 ? false : _props$readOnly,
866
+ _props$canClear = props.canClear,
867
+ canClear = _props$canClear === void 0 ? true : _props$canClear,
866
868
  onChange = props.onChange,
867
869
  onEnter = props.onEnter,
868
870
  onClick = props.onClick;
@@ -891,6 +893,10 @@ var TextField = function TextField(props) {
891
893
  }
892
894
  }
893
895
 
896
+ function clear() {
897
+ if (onChange) onChange(id, "");
898
+ }
899
+
894
900
  var borderStyle = outlined ? "textfield-outlined" : "textfield";
895
901
  var labelStyle = label ? "" : "no-label";
896
902
  var style = labelStyle + " " + borderStyle;
@@ -908,7 +914,12 @@ var TextField = function TextField(props) {
908
914
  onKeyDown: onKeyPress,
909
915
  onFocus: focus,
910
916
  readOnly: readOnly
911
- }), /*#__PURE__*/React__default["default"].createElement("span", {
917
+ }), canClear ? /*#__PURE__*/React__default["default"].createElement(Icon, {
918
+ icon: "close",
919
+ clickable: true,
920
+ size: "small",
921
+ action: clear
922
+ }) : null, /*#__PURE__*/React__default["default"].createElement("span", {
912
923
  className: "bar"
913
924
  }), label ? /*#__PURE__*/React__default["default"].createElement("label", null, labelTxt) : null);
914
925
  };