ywana-core8 0.0.391 → 0.0.394

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
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('material-design-icons-iconfont/dist/material-design-icons.css'), require('react'), require('react-switch'), require('moment'), require('moment-range'), require('resumablejs'), require('react-notifications-component'), require('react-notifications-component/dist/theme.css'), require('react-color'), require('deep-equal')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'material-design-icons-iconfont/dist/material-design-icons.css', 'react', 'react-switch', 'moment', 'moment-range', 'resumablejs', 'react-notifications-component', 'react-notifications-component/dist/theme.css', 'react-color', 'deep-equal'], factory) :
4
- (global = global || self, factory(global.ywanaCore8 = {}, null, global.react, global.reactSwitch, global.moment, global.momentRange, global.resumablejs, global.reactNotificationsComponent, null, global.reactColor, global.deepEqual));
5
- })(this, (function (exports, materialDesignIcons_css, React, RSwitch, moment, momentRange, ResumableJS, reactNotificationsComponent, theme_css, reactColor, equal) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('material-design-icons-iconfont/dist/material-design-icons.css'), require('react'), require('react-switch'), require('moment'), require('moment-range'), require('resumablejs'), require('react-notifications-component'), require('react-notifications-component/dist/theme.css'), require('deep-equal')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'material-design-icons-iconfont/dist/material-design-icons.css', 'react', 'react-switch', 'moment', 'moment-range', 'resumablejs', 'react-notifications-component', 'react-notifications-component/dist/theme.css', 'deep-equal'], factory) :
4
+ (global = global || self, factory(global.ywanaCore8 = {}, null, global.react, global.reactSwitch, global.moment, global.momentRange, global.resumablejs, global.reactNotificationsComponent, null, global.deepEqual));
5
+ })(this, (function (exports, materialDesignIcons_css, React, RSwitch, moment, momentRange, ResumableJS, reactNotificationsComponent, theme_css, equal) {
6
6
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
7
7
 
8
8
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
@@ -1082,7 +1082,10 @@
1082
1082
  _props$predictive = props.predictive,
1083
1083
  predictive = _props$predictive === void 0 ? false : _props$predictive,
1084
1084
  _props$readOnly3 = props.readOnly,
1085
- readOnly = _props$readOnly3 === void 0 ? false : _props$readOnly3;
1085
+ readOnly = _props$readOnly3 === void 0 ? false : _props$readOnly3,
1086
+ _props$verbose = props.verbose,
1087
+ verbose = _props$verbose === void 0 ? true : _props$verbose,
1088
+ onBlur = props.onBlur;
1086
1089
 
1087
1090
  var _useState = React.useState(false),
1088
1091
  open = _useState[0],
@@ -1093,6 +1096,8 @@
1093
1096
  setLabel = _useState2[1];
1094
1097
 
1095
1098
  React.useEffect(function () {
1099
+ console.log('DD change value', label);
1100
+
1096
1101
  if (Array.isArray(options)) {
1097
1102
  var option = options.find(function (option) {
1098
1103
  return option.value === value;
@@ -1129,14 +1134,14 @@
1129
1134
  var option = options.find(function (option) {
1130
1135
  return option.value === next;
1131
1136
  });
1132
- if (onChange) onChange(id, next);
1133
- setLabel(option.label);
1134
1137
  setOpen(false);
1138
+ var label = verbose ? option.label : "";
1139
+ setLabel(label);
1140
+ if (onChange) onChange(id, next);
1135
1141
  }
1136
1142
 
1137
1143
  function blur() {
1138
- console.log("BLUR DD");
1139
- site.clearFocus();
1144
+ if (onBlur) onBlur();
1140
1145
  }
1141
1146
 
1142
1147
  function renderOptions() {
@@ -1883,6 +1888,7 @@
1883
1888
  _ref$init = _ref.init,
1884
1889
  init = _ref$init === void 0 ? [] : _ref$init,
1885
1890
  readOnly = _ref.readOnly,
1891
+ options = _ref.options,
1886
1892
  onChange = _ref.onChange;
1887
1893
  var mounted = React.useRef(false);
1888
1894
 
@@ -1894,6 +1900,8 @@
1894
1900
  tokens = _useState2[0],
1895
1901
  setTokens = _useState2[1];
1896
1902
 
1903
+ React.useState(false);
1904
+
1897
1905
  React.useEffect(function () {
1898
1906
  if (mounted.current) {
1899
1907
  if (onChange) {
@@ -1915,6 +1923,12 @@
1915
1923
  setValue(value);
1916
1924
  }
1917
1925
 
1926
+ function changeDropDown(id, value) {
1927
+ var next = tokens.concat(value);
1928
+ setTokens(next);
1929
+ setValue('xxx');
1930
+ }
1931
+
1918
1932
  function onEnter(event) {
1919
1933
  if (event.key === 'Enter') {
1920
1934
  event.preventDefault();
@@ -1941,7 +1955,12 @@
1941
1955
  return remove(index);
1942
1956
  }
1943
1957
  });
1944
- }), /*#__PURE__*/React__default["default"].createElement("input", {
1958
+ }), options ? /*#__PURE__*/React__default["default"].createElement(DropDown, {
1959
+ onChange: changeDropDown,
1960
+ options: options,
1961
+ predictive: true,
1962
+ verbose: false
1963
+ }) : /*#__PURE__*/React__default["default"].createElement("input", {
1945
1964
  type: "text",
1946
1965
  value: value,
1947
1966
  onChange: change,
@@ -3718,17 +3737,25 @@
3718
3737
 
3719
3738
  var ColorField = function ColorField(props) {
3720
3739
  var id = props.id,
3740
+ _props$label = props.label,
3741
+ label = _props$label === void 0 ? "Color" : _props$label,
3742
+ value = props.value,
3721
3743
  onChange = props.onChange;
3722
3744
 
3723
- function change(color) {
3724
- if (onChange) onChange(id, color.hex);
3745
+ function change(event) {
3746
+ var color = event.target.value;
3747
+ if (onChange) onChange(id, color);
3725
3748
  }
3726
3749
 
3727
3750
  return /*#__PURE__*/React__default["default"].createElement("div", {
3728
3751
  className: "color-field"
3729
- }, /*#__PURE__*/React__default["default"].createElement(reactColor.CirclePicker, {
3730
- onChangeComplete: change,
3731
- width: ""
3752
+ }, /*#__PURE__*/React__default["default"].createElement("label", {
3753
+ "for": id
3754
+ }, label), /*#__PURE__*/React__default["default"].createElement("input", {
3755
+ id: id,
3756
+ type: "color",
3757
+ onChange: change,
3758
+ value: value
3732
3759
  }));
3733
3760
  };
3734
3761
 
@@ -4091,7 +4118,8 @@
4091
4118
  case FORMATS.COLOR:
4092
4119
  return /*#__PURE__*/React__default["default"].createElement(ColorField, {
4093
4120
  id: id,
4094
- onChange: change
4121
+ onChange: change,
4122
+ value: value
4095
4123
  });
4096
4124
 
4097
4125
  case FORMATS.HTML: