ywana-core8 0.0.370 → 0.0.373

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
@@ -30,7 +30,7 @@ function _catch$2(body, recover) {
30
30
  return result;
31
31
  }
32
32
 
33
- var fetchAsync = function fetchAsync(method, URL, body, token) {
33
+ var fetchAsync = function fetchAsync(method, URL, body, token, headers) {
34
34
  if (body === void 0) {
35
35
  body = null;
36
36
  }
@@ -40,11 +40,11 @@ var fetchAsync = function fetchAsync(method, URL, body, token) {
40
40
  var request = {
41
41
  method: method,
42
42
  mode: 'cors',
43
- headers: {
43
+ headers: Object.assign({
44
44
  "Accept": "application/json",
45
45
  "Content-Type": "application/json",
46
46
  "x-access-token": token
47
- },
47
+ }, headers),
48
48
  body: body
49
49
  };
50
50
  return Promise.resolve(_catch$2(function () {
@@ -92,9 +92,9 @@ var HTTPClient = function HTTPClient(domain, securityCtx) {
92
92
  var token = securityCtx ? securityCtx.token() : null;
93
93
  return fetchAsync('GET', domain + URL, undefined, token);
94
94
  },
95
- POST: function POST(URL, body) {
95
+ POST: function POST(URL, body, headers) {
96
96
  var token = securityCtx ? securityCtx.token() : null;
97
- return fetchAsync('POST', domain + URL, body, token);
97
+ return fetchAsync('POST', domain + URL, body, token, headers);
98
98
  },
99
99
  PUT: function PUT(URL, body) {
100
100
  var token = securityCtx ? securityCtx.token() : null;
@@ -936,7 +936,8 @@ var TextField = function TextField(props) {
936
936
  canClear = _props$canClear === void 0 ? true : _props$canClear,
937
937
  onChange = props.onChange,
938
938
  onEnter = props.onEnter,
939
- onClick = props.onClick;
939
+ onClick = props.onClick,
940
+ onBlur = props.onBlur;
940
941
 
941
942
  function onKeyPress(event) {
942
943
  var key = event.charCode ? event.charCode : event.keyCode ? event.keyCode : 0;
@@ -962,13 +963,8 @@ var TextField = function TextField(props) {
962
963
  }
963
964
  }
964
965
 
965
- function focusOut() {
966
- if (site && site.changeFocus) {
967
- site.changeFocus({
968
- lose: function lose() {// DO NOTHING
969
- }
970
- });
971
- }
966
+ function blur() {
967
+ if (onBlur) onBlur();
972
968
  }
973
969
 
974
970
  function clear() {
@@ -991,7 +987,7 @@ var TextField = function TextField(props) {
991
987
  onChange: change,
992
988
  onKeyDown: onKeyPress,
993
989
  onFocus: focus,
994
- onBlur: focusOut,
990
+ onBlur: blur,
995
991
  readOnly: readOnly
996
992
  }), canClear && value && value.length > 0 ? /*#__PURE__*/React__default["default"].createElement(Icon, {
997
993
  icon: "close",
@@ -1034,7 +1030,6 @@ var TextArea = function TextArea(props) {
1034
1030
  event.stopPropagation();
1035
1031
  event.preventDefault();
1036
1032
  var value = event.target.value;
1037
- console.log(value);
1038
1033
  if (onChange) onChange(id, value);
1039
1034
  }
1040
1035
 
@@ -1066,7 +1061,7 @@ var TextArea = function TextArea(props) {
1066
1061
  onKeyDown: onKeyPress,
1067
1062
  onFocus: focus,
1068
1063
  readOnly: readOnly
1069
- }), !readOnly && canClear && value && value.length > 0 ? /*#__PURE__*/React__default["default"].createElement(Icon, {
1064
+ }), canClear && value && value.length > 0 ? /*#__PURE__*/React__default["default"].createElement(Icon, {
1070
1065
  icon: "close",
1071
1066
  clickable: true,
1072
1067
  size: "small",
@@ -1141,6 +1136,11 @@ var DropDown = function DropDown(props) {
1141
1136
  setOpen(false);
1142
1137
  }
1143
1138
 
1139
+ function blur() {
1140
+ console.log("BLUR DD");
1141
+ site.clearFocus();
1142
+ }
1143
+
1144
1144
  function renderOptions() {
1145
1145
  var canShow = open == true && Array.isArray(options);
1146
1146
 
@@ -1156,7 +1156,7 @@ var DropDown = function DropDown(props) {
1156
1156
  }, option.label);
1157
1157
  });
1158
1158
  return /*#__PURE__*/React__default["default"].createElement("menu", null, /*#__PURE__*/React__default["default"].createElement("ul", {
1159
- onClick: select
1159
+ onMouseDown: select
1160
1160
  }, lis));
1161
1161
  } else {
1162
1162
  return null;
@@ -1169,6 +1169,7 @@ var DropDown = function DropDown(props) {
1169
1169
  onClick: toggle,
1170
1170
  value: label,
1171
1171
  onChange: change,
1172
+ onBlur: blur,
1172
1173
  readOnly: !predictive
1173
1174
  })), !readOnly ? /*#__PURE__*/React__default["default"].createElement(Icon, {
1174
1175
  icon: "expand_more",
@@ -3040,6 +3041,10 @@ var SiteProvider = function SiteProvider(_ref) {
3040
3041
  if (focused) focused.lose();
3041
3042
  setFocused(next);
3042
3043
  },
3044
+ clearFocus: function clearFocus() {
3045
+ if (focused) focused.lose();
3046
+ setFocused(null);
3047
+ },
3043
3048
  sideNav: sideNav,
3044
3049
  setSideNav: setSideNav,
3045
3050
  showNav: showNav,