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