@luminati-io/uikit 6.1.3 → 6.1.4-beta.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -40120,6 +40120,9 @@ __webpack_require__.r(__webpack_exports__);
40120
40120
 
40121
40121
 
40122
40122
  /*jslint react:true*/
40123
+ var _excluded = ["onClick", "hotKey"];
40124
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
40125
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
40123
40126
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
40124
40127
 
40125
40128
 
@@ -40158,17 +40161,35 @@ var ButtonsGroup = styled_components__WEBPACK_IMPORTED_MODULE_2___default()(_lay
40158
40161
  displayName: "ButtonsGroup",
40159
40162
  componentId: "sc-1p9nv3u-1"
40160
40163
  })([""]);
40161
- var ModalButton = styled_components__WEBPACK_IMPORTED_MODULE_2___default()(_button__WEBPACK_IMPORTED_MODULE_3__.Button).attrs({
40162
- size: 'sm'
40163
- }).withConfig({
40164
- displayName: "ModalButton",
40165
- componentId: "sc-1p9nv3u-2"
40166
- })([""]);
40167
- var ModalHeader = function ModalHeader(_ref4) {
40168
- var title = _ref4.title,
40169
- subtitle = _ref4.subtitle,
40170
- onCancel = _ref4.onCancel,
40171
- cancelDisabled = _ref4.cancelDisabled;
40164
+ var ModalButton = function ModalButton(_ref4) {
40165
+ var onClick = _ref4.onClick,
40166
+ hotKey = _ref4.hotKey,
40167
+ rest = _objectWithoutProperties(_ref4, _excluded);
40168
+ var icon = hotKey == 'enter' ? 'Check' : 'Close';
40169
+ (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(function () {
40170
+ var _document$activeEleme;
40171
+ (_document$activeEleme = document.activeElement) === null || _document$activeEleme === void 0 || _document$activeEleme.blur();
40172
+ if (!hotKey) return;
40173
+ var handle_key_press = function handle_key_press(e) {
40174
+ if (e.key.toLowerCase() == hotKey.toLowerCase()) onClick();
40175
+ };
40176
+ window.addEventListener('keydown', handle_key_press);
40177
+ return function () {
40178
+ return window.removeEventListener('keydown', handle_key_press);
40179
+ };
40180
+ }, []);
40181
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_button__WEBPACK_IMPORTED_MODULE_3__.Button, _extends({
40182
+ size: "sm",
40183
+ onClick: onClick,
40184
+ iconPlacement: "right",
40185
+ icon: hotKey && icon
40186
+ }, rest));
40187
+ };
40188
+ var ModalHeader = function ModalHeader(_ref5) {
40189
+ var title = _ref5.title,
40190
+ subtitle = _ref5.subtitle,
40191
+ onCancel = _ref5.onCancel,
40192
+ cancelDisabled = _ref5.cancelDisabled;
40172
40193
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement((react__WEBPACK_IMPORTED_MODULE_1___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_layout__WEBPACK_IMPORTED_MODULE_5__.Flex, {
40173
40194
  align_items: "center",
40174
40195
  justify_content: "space-between",
@@ -40184,15 +40205,15 @@ ModalHeader.propTypes = {
40184
40205
  onCancel: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().func),
40185
40206
  cancelDisabled: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().bool)
40186
40207
  };
40187
- var ModalFooter = function ModalFooter(_ref5) {
40188
- var _ref5$okLabel = _ref5.okLabel,
40189
- okLabel = _ref5$okLabel === void 0 ? 'OK' : _ref5$okLabel,
40190
- _ref5$cancelLabel = _ref5.cancelLabel,
40191
- cancelLabel = _ref5$cancelLabel === void 0 ? 'Cancel' : _ref5$cancelLabel,
40192
- onOk = _ref5.onOk,
40193
- onCancel = _ref5.onCancel,
40194
- okDisabled = _ref5.okDisabled,
40195
- cancelDisabled = _ref5.cancelDisabled;
40208
+ var ModalFooter = function ModalFooter(_ref6) {
40209
+ var _ref6$okLabel = _ref6.okLabel,
40210
+ okLabel = _ref6$okLabel === void 0 ? 'OK' : _ref6$okLabel,
40211
+ _ref6$cancelLabel = _ref6.cancelLabel,
40212
+ cancelLabel = _ref6$cancelLabel === void 0 ? 'Cancel' : _ref6$cancelLabel,
40213
+ onOk = _ref6.onOk,
40214
+ onCancel = _ref6.onCancel,
40215
+ okDisabled = _ref6.okDisabled,
40216
+ cancelDisabled = _ref6.cancelDisabled;
40196
40217
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_layout__WEBPACK_IMPORTED_MODULE_5__.Flex, {
40197
40218
  width: "100%",
40198
40219
  justify_content: "flex-end"
@@ -40201,12 +40222,14 @@ var ModalFooter = function ModalFooter(_ref5) {
40201
40222
  variant: "secondary",
40202
40223
  onClick: onCancel,
40203
40224
  disabled: cancelDisabled,
40225
+ hotKey: "escape",
40204
40226
  "data-testid": "modal_footer_cancel_button"
40205
40227
  }), onOk && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(ModalButton, {
40206
40228
  text: okLabel,
40207
40229
  variant: "primary",
40208
40230
  onClick: onOk,
40209
40231
  disabled: okDisabled,
40232
+ hotKey: "enter",
40210
40233
  "data-testid": "modal_footer_ok_button"
40211
40234
  })));
40212
40235
  };
@@ -40216,7 +40239,8 @@ ModalFooter.propTypes = {
40216
40239
  onOk: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().func),
40217
40240
  onCancel: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().func),
40218
40241
  okDisabled: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().bool),
40219
- cancelDisabled: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().bool)
40242
+ cancelDisabled: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().bool),
40243
+ hotKey: prop_types__WEBPACK_IMPORTED_MODULE_0___default().oneOf(['enter', 'escape'])
40220
40244
  };
40221
40245
 
40222
40246
  /***/ }),
@@ -46114,7 +46138,6 @@ var _Tooltip = function Tooltip(_ref) {
46114
46138
  var tooltipRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)();
46115
46139
  if (visible && tooltip != tooltipRef.current && typeof update == 'function') update();
46116
46140
  tooltipRef.current = tooltip;
46117
- if (!tooltip) return children;
46118
46141
  var triggerProps = {};
46119
46142
  if (trigger == 'hover') {
46120
46143
  triggerProps.onPointerEnter = show;
@@ -46123,7 +46146,7 @@ var _Tooltip = function Tooltip(_ref) {
46123
46146
  triggerProps.onFocus = show;
46124
46147
  triggerProps.onBlur = hide;
46125
46148
  }
46126
- var tooltipNode = visible ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(StyledTooltipBody, _extends({
46149
+ var tooltipNode = tooltip && visible ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(StyledTooltipBody, _extends({
46127
46150
  ref: setPopperElement,
46128
46151
  role: "tooltip",
46129
46152
  $variant: variant,