ywana-core8 0.0.236 → 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.
@@ -1,14 +1,23 @@
1
1
  import React from "react";
2
2
 
3
3
  // You can import global CSS files here.
4
- import '../src/css/html.css'
5
- import '../src/css/theme.css'
6
- import 'material-design-icons-iconfont/dist/material-design-icons.css'
7
-
4
+ import "../src/css/html.css";
5
+ import "../src/css/theme.css";
6
+ import "material-design-icons-iconfont/dist/material-design-icons.css";
8
7
 
9
8
  // No-op wrapper.
10
9
  export const Wrapper: React.FC = ({ children }) => {
11
-
12
-
13
- return <div style={{ padding: "2rem" }}>{children}</div>;
10
+ return (
11
+ <div
12
+ style={{
13
+ width: "100vw",
14
+ height: "100vh",
15
+ padding: "2rem",
16
+ display: "flex",
17
+ flexDirection: "column",
18
+ }}
19
+ >
20
+ {children}
21
+ </div>
22
+ );
14
23
  };
package/dist/index.cjs CHANGED
@@ -899,7 +899,7 @@ var TextField = function TextField(props) {
899
899
 
900
900
  var borderStyle = outlined ? "textfield-outlined" : "textfield";
901
901
  var labelStyle = label ? "" : "no-label";
902
- var style = labelStyle + " " + borderStyle;
902
+ var style = labelStyle + " " + borderStyle + " textfield-" + type;
903
903
  var labelTxt = /*#__PURE__*/React__default["default"].createElement(Text$1, null, label);
904
904
  return /*#__PURE__*/React__default["default"].createElement("div", {
905
905
  className: "" + style,
@@ -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],
@@ -968,7 +1040,7 @@ var DropDown = function DropDown(props) {
968
1040
  }
969
1041
 
970
1042
  function toggle() {
971
- if (site) {
1043
+ if (site && site.changeFocus) {
972
1044
  site.changeFocus({
973
1045
  lose: function lose() {
974
1046
  setOpen(false);
@@ -4833,6 +4905,7 @@ var TableEditor = function TableEditor(props) {
4833
4905
 
4834
4906
  function renderGroupLabel(groupName) {
4835
4907
  var grouper = schema[groupBy];
4908
+ if (!groupName || !grouper) return "";
4836
4909
 
4837
4910
  if (grouper.options) {
4838
4911
  var options = CHECK['isFunction'](grouper.options) ? grouper.options() : grouper.options;
@@ -4840,7 +4913,7 @@ var TableEditor = function TableEditor(props) {
4840
4913
  return option.value === groupName;
4841
4914
  });
4842
4915
  console.log(groupName, options, option);
4843
- return option.label ? option.label : groupName + "LABEL NOT FOUND ";
4916
+ return option ? option.label : groupName;
4844
4917
  } else {
4845
4918
  return groupName;
4846
4919
  }
@@ -4915,8 +4988,8 @@ var TableEditor = function TableEditor(props) {
4915
4988
  return /*#__PURE__*/React__default["default"].createElement(React.Fragment, {
4916
4989
  key: groupName
4917
4990
  }, /*#__PURE__*/React__default["default"].createElement(Header, {
4918
- title: groupName
4919
- }, renderGroupLabel(groupName), /*#__PURE__*/React__default["default"].createElement("span", {
4991
+ title: renderGroupLabel(groupName)
4992
+ }, /*#__PURE__*/React__default["default"].createElement("span", {
4920
4993
  className: "size"
4921
4994
  }, groupSize)), /*#__PURE__*/React__default["default"].createElement(DataTable, _extends({}, table, {
4922
4995
  onRowSelection: select,
@@ -5487,6 +5560,7 @@ exports.TabbedContentEditor = TabbedContentEditor;
5487
5560
  exports.TablePage = TablePage;
5488
5561
  exports.Tabs = Tabs;
5489
5562
  exports.Text = Text$1;
5563
+ exports.TextArea = TextArea;
5490
5564
  exports.TextField = TextField;
5491
5565
  exports.Thumbnail = Thumbnail;
5492
5566
  exports.TokenField = TokenField;