ywana-core8 0.0.239 → 0.0.240

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.umd.js CHANGED
@@ -920,6 +920,78 @@
920
920
  className: "bar"
921
921
  }), label ? /*#__PURE__*/React__default["default"].createElement("label", null, labelTxt) : null);
922
922
  };
923
+ /**
924
+ * Text Area
925
+ */
926
+
927
+ var TextArea = function TextArea(props) {
928
+ var site = React.useContext(SiteContext);
929
+ var id = props.id,
930
+ _props$type2 = props.type,
931
+ type = _props$type2 === void 0 ? 'text' : _props$type2,
932
+ label = props.label,
933
+ placeholder = props.placeholder,
934
+ value = props.value,
935
+ _props$readOnly2 = props.readOnly,
936
+ readOnly = _props$readOnly2 === void 0 ? false : _props$readOnly2,
937
+ _props$canClear2 = props.canClear,
938
+ canClear = _props$canClear2 === void 0 ? true : _props$canClear2,
939
+ onChange = props.onChange,
940
+ onEnter = props.onEnter,
941
+ onClick = props.onClick;
942
+
943
+ function onKeyPress(event) {
944
+ var key = event.charCode ? event.charCode : event.keyCode ? event.keyCode : 0;
945
+
946
+ if (key == 13) {
947
+ if (onEnter) onEnter();
948
+ }
949
+ }
950
+
951
+ function change(event) {
952
+ event.stopPropagation();
953
+ event.preventDefault();
954
+ var value = event.target.value;
955
+ if (onChange) onChange(id, value);
956
+ }
957
+
958
+ function focus() {
959
+ if (site) {
960
+ site.changeFocus({
961
+ lose: function lose() {// DO NOTHING
962
+ }
963
+ });
964
+ }
965
+ }
966
+
967
+ function clear() {
968
+ if (onChange) onChange(id, "");
969
+ }
970
+
971
+ var labelStyle = label ? "" : "no-label";
972
+ var style = "textarea " + labelStyle + " textarea-" + type;
973
+ var labelTxt = /*#__PURE__*/React__default["default"].createElement(Text$1, null, label);
974
+ return /*#__PURE__*/React__default["default"].createElement("div", {
975
+ className: "" + style,
976
+ onClick: onClick
977
+ }, /*#__PURE__*/React__default["default"].createElement("textarea", {
978
+ id: id,
979
+ placeholder: placeholder,
980
+ value: value,
981
+ required: true,
982
+ onChange: change,
983
+ onKeyDown: onKeyPress,
984
+ onFocus: focus,
985
+ readOnly: readOnly
986
+ }), !readOnly && canClear && value && value.length > 0 ? /*#__PURE__*/React__default["default"].createElement(Icon, {
987
+ icon: "close",
988
+ clickable: true,
989
+ size: "small",
990
+ action: clear
991
+ }) : null, /*#__PURE__*/React__default["default"].createElement("span", {
992
+ className: "bar"
993
+ }), label ? /*#__PURE__*/React__default["default"].createElement("label", null, labelTxt) : null);
994
+ };
923
995
  /**
924
996
  * Dropdown
925
997
  */
@@ -933,8 +1005,8 @@
933
1005
  onChange = props.onChange,
934
1006
  _props$canFilter = props.canFilter,
935
1007
  canFilter = _props$canFilter === void 0 ? false : _props$canFilter,
936
- _props$readOnly2 = props.readOnly,
937
- readOnly = _props$readOnly2 === void 0 ? false : _props$readOnly2;
1008
+ _props$readOnly3 = props.readOnly,
1009
+ readOnly = _props$readOnly3 === void 0 ? false : _props$readOnly3;
938
1010
 
939
1011
  var _useState = React.useState(false),
940
1012
  open = _useState[0],
@@ -5485,6 +5557,7 @@
5485
5557
  exports.TablePage = TablePage;
5486
5558
  exports.Tabs = Tabs;
5487
5559
  exports.Text = Text$1;
5560
+ exports.TextArea = TextArea;
5488
5561
  exports.TextField = TextField;
5489
5562
  exports.Thumbnail = Thumbnail;
5490
5563
  exports.TokenField = TokenField;