ywana-core8 0.0.237 → 0.0.241

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
@@ -885,7 +885,7 @@ var TextField = function TextField(props) {
885
885
  }
886
886
 
887
887
  function focus() {
888
- if (site) {
888
+ if (site && site.changeFocus) {
889
889
  site.changeFocus({
890
890
  lose: function lose() {// DO NOTHING
891
891
  }
@@ -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,79 @@ 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
+ console.log(value);
959
+ if (onChange) onChange(id, value);
960
+ }
961
+
962
+ function focus() {
963
+ if (site && site.changeFocus) {
964
+ site.changeFocus({
965
+ lose: function lose() {// DO NOTHING
966
+ }
967
+ });
968
+ }
969
+ }
970
+
971
+ function clear() {
972
+ if (onChange) onChange(id, "");
973
+ }
974
+
975
+ var labelStyle = label ? "" : "no-label";
976
+ var style = "textarea " + labelStyle + " textarea-" + type;
977
+ var labelTxt = /*#__PURE__*/React__default["default"].createElement(Text$1, null, label);
978
+ return /*#__PURE__*/React__default["default"].createElement("div", {
979
+ className: "" + style,
980
+ onClick: onClick
981
+ }, /*#__PURE__*/React__default["default"].createElement("textarea", {
982
+ id: id,
983
+ placeholder: placeholder,
984
+ value: value,
985
+ required: true,
986
+ onChange: change,
987
+ onKeyDown: onKeyPress,
988
+ onFocus: focus,
989
+ readOnly: readOnly
990
+ }), !readOnly && canClear && value && value.length > 0 ? /*#__PURE__*/React__default["default"].createElement(Icon, {
991
+ icon: "close",
992
+ clickable: true,
993
+ size: "small",
994
+ action: clear
995
+ }) : null, /*#__PURE__*/React__default["default"].createElement("span", {
996
+ className: "bar"
997
+ }), label ? /*#__PURE__*/React__default["default"].createElement("label", null, labelTxt) : null);
998
+ };
926
999
  /**
927
1000
  * Dropdown
928
1001
  */
@@ -936,8 +1009,8 @@ var DropDown = function DropDown(props) {
936
1009
  onChange = props.onChange,
937
1010
  _props$canFilter = props.canFilter,
938
1011
  canFilter = _props$canFilter === void 0 ? false : _props$canFilter,
939
- _props$readOnly2 = props.readOnly,
940
- readOnly = _props$readOnly2 === void 0 ? false : _props$readOnly2;
1012
+ _props$readOnly3 = props.readOnly,
1013
+ readOnly = _props$readOnly3 === void 0 ? false : _props$readOnly3;
941
1014
 
942
1015
  var _useState = React.useState(false),
943
1016
  open = _useState[0],
@@ -968,7 +1041,7 @@ var DropDown = function DropDown(props) {
968
1041
  }
969
1042
 
970
1043
  function toggle() {
971
- if (site) {
1044
+ if (site && site.changeFocus) {
972
1045
  site.changeFocus({
973
1046
  lose: function lose() {
974
1047
  setOpen(false);
@@ -4833,7 +4906,7 @@ var TableEditor = function TableEditor(props) {
4833
4906
 
4834
4907
  function renderGroupLabel(groupName) {
4835
4908
  var grouper = schema[groupBy];
4836
- if (!groupName) return "...";
4909
+ if (!groupName || !grouper) return "";
4837
4910
 
4838
4911
  if (grouper.options) {
4839
4912
  var options = CHECK['isFunction'](grouper.options) ? grouper.options() : grouper.options;
@@ -4916,8 +4989,8 @@ var TableEditor = function TableEditor(props) {
4916
4989
  return /*#__PURE__*/React__default["default"].createElement(React.Fragment, {
4917
4990
  key: groupName
4918
4991
  }, /*#__PURE__*/React__default["default"].createElement(Header, {
4919
- title: groupName
4920
- }, renderGroupLabel(groupName), /*#__PURE__*/React__default["default"].createElement("span", {
4992
+ title: renderGroupLabel(groupName)
4993
+ }, /*#__PURE__*/React__default["default"].createElement("span", {
4921
4994
  className: "size"
4922
4995
  }, groupSize)), /*#__PURE__*/React__default["default"].createElement(DataTable, _extends({}, table, {
4923
4996
  onRowSelection: select,
@@ -5488,6 +5561,7 @@ exports.TabbedContentEditor = TabbedContentEditor;
5488
5561
  exports.TablePage = TablePage;
5489
5562
  exports.Tabs = Tabs;
5490
5563
  exports.Text = Text$1;
5564
+ exports.TextArea = TextArea;
5491
5565
  exports.TextField = TextField;
5492
5566
  exports.Thumbnail = Thumbnail;
5493
5567
  exports.TokenField = TokenField;