ywana-core8 0.0.393 → 0.0.396

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
@@ -1087,7 +1087,10 @@ var DropDown = function DropDown(props) {
1087
1087
  _props$predictive = props.predictive,
1088
1088
  predictive = _props$predictive === void 0 ? false : _props$predictive,
1089
1089
  _props$readOnly3 = props.readOnly,
1090
- readOnly = _props$readOnly3 === void 0 ? false : _props$readOnly3;
1090
+ readOnly = _props$readOnly3 === void 0 ? false : _props$readOnly3,
1091
+ _props$verbose = props.verbose,
1092
+ verbose = _props$verbose === void 0 ? true : _props$verbose,
1093
+ onBlur = props.onBlur;
1091
1094
 
1092
1095
  var _useState = React.useState(false),
1093
1096
  open = _useState[0],
@@ -1098,6 +1101,8 @@ var DropDown = function DropDown(props) {
1098
1101
  setLabel = _useState2[1];
1099
1102
 
1100
1103
  React.useEffect(function () {
1104
+ console.log('DD change value', label);
1105
+
1101
1106
  if (Array.isArray(options)) {
1102
1107
  var option = options.find(function (option) {
1103
1108
  return option.value === value;
@@ -1134,14 +1139,14 @@ var DropDown = function DropDown(props) {
1134
1139
  var option = options.find(function (option) {
1135
1140
  return option.value === next;
1136
1141
  });
1137
- if (onChange) onChange(id, next);
1138
- setLabel(option.label);
1139
1142
  setOpen(false);
1143
+ var label = verbose ? option.label : "";
1144
+ setLabel(label);
1145
+ if (onChange) onChange(id, next);
1140
1146
  }
1141
1147
 
1142
1148
  function blur() {
1143
- console.log("BLUR DD");
1144
- site.clearFocus();
1149
+ if (onBlur) onBlur();
1145
1150
  }
1146
1151
 
1147
1152
  function renderOptions() {
@@ -1205,7 +1210,8 @@ var FORMATS = {
1205
1210
  HTML: 'HTML',
1206
1211
  URL: 'URL',
1207
1212
  IMG: 'IMG',
1208
- COLOR: 'COLOR'
1213
+ COLOR: 'COLOR',
1214
+ TOKENS: 'TOKENS'
1209
1215
  };
1210
1216
  /**
1211
1217
  * CHECK
@@ -1888,6 +1894,7 @@ var TokenField = function TokenField(_ref) {
1888
1894
  _ref$init = _ref.init,
1889
1895
  init = _ref$init === void 0 ? [] : _ref$init,
1890
1896
  readOnly = _ref.readOnly,
1897
+ options = _ref.options,
1891
1898
  onChange = _ref.onChange;
1892
1899
  var mounted = React.useRef(false);
1893
1900
 
@@ -1899,6 +1906,8 @@ var TokenField = function TokenField(_ref) {
1899
1906
  tokens = _useState2[0],
1900
1907
  setTokens = _useState2[1];
1901
1908
 
1909
+ React.useState(false);
1910
+
1902
1911
  React.useEffect(function () {
1903
1912
  if (mounted.current) {
1904
1913
  if (onChange) {
@@ -1920,6 +1929,12 @@ var TokenField = function TokenField(_ref) {
1920
1929
  setValue(value);
1921
1930
  }
1922
1931
 
1932
+ function changeDropDown(id, value) {
1933
+ var next = tokens.concat(value);
1934
+ setTokens(next);
1935
+ setValue('xxx');
1936
+ }
1937
+
1923
1938
  function onEnter(event) {
1924
1939
  if (event.key === 'Enter') {
1925
1940
  event.preventDefault();
@@ -1946,7 +1961,12 @@ var TokenField = function TokenField(_ref) {
1946
1961
  return remove(index);
1947
1962
  }
1948
1963
  });
1949
- }), /*#__PURE__*/React__default["default"].createElement("input", {
1964
+ }), options ? /*#__PURE__*/React__default["default"].createElement(DropDown, {
1965
+ onChange: changeDropDown,
1966
+ options: options,
1967
+ predictive: true,
1968
+ verbose: false
1969
+ }) : /*#__PURE__*/React__default["default"].createElement("input", {
1950
1970
  type: "text",
1951
1971
  value: value,
1952
1972
  onChange: change,
@@ -4104,7 +4124,8 @@ var StringEditor = function StringEditor(_ref6) {
4104
4124
  case FORMATS.COLOR:
4105
4125
  return /*#__PURE__*/React__default["default"].createElement(ColorField, {
4106
4126
  id: id,
4107
- onChange: change
4127
+ onChange: change,
4128
+ value: value
4108
4129
  });
4109
4130
 
4110
4131
  case FORMATS.HTML:
@@ -4126,6 +4147,15 @@ var StringEditor = function StringEditor(_ref6) {
4126
4147
  readOnly: !editable
4127
4148
  });
4128
4149
 
4150
+ case FORMATS.TOKENS:
4151
+ return /*#__PURE__*/React__default["default"].createElement(TokenField, {
4152
+ id: id,
4153
+ label: label,
4154
+ onChange: change,
4155
+ readOnly: !editable,
4156
+ options: options
4157
+ });
4158
+
4129
4159
  default:
4130
4160
  return options ? /*#__PURE__*/React__default["default"].createElement(DropDown, {
4131
4161
  outlined: outlined,