@luminati-io/uikit 3.7.5 → 3.7.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -39018,6 +39018,7 @@ __webpack_require__.r(__webpack_exports__);
39018
39018
  /* harmony export */ ModalButton: () => (/* binding */ ModalButton),
39019
39019
  /* harmony export */ ModalFooter: () => (/* binding */ ModalFooter),
39020
39020
  /* harmony export */ ModalHeader: () => (/* binding */ ModalHeader),
39021
+ /* harmony export */ ModalSubtitle: () => (/* binding */ ModalSubtitle),
39021
39022
  /* harmony export */ ModalTitle: () => (/* binding */ ModalTitle)
39022
39023
  /* harmony export */ });
39023
39024
  /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! prop-types */ "prop-types");
@@ -39044,12 +39045,17 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
39044
39045
 
39045
39046
 
39046
39047
 
39047
- var ModalTitle = function ModalTitle(props) {
39048
- var text = props.text;
39048
+ var ModalTitle = function ModalTitle(_ref) {
39049
+ var text = _ref.text,
39050
+ children = _ref.children;
39049
39051
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_typography__WEBPACK_IMPORTED_MODULE_7__.Header, {
39050
39052
  color: "gray_11_75"
39051
- }, text);
39053
+ }, children !== null && children !== void 0 ? children : text);
39052
39054
  };
39055
+ var ModalSubtitle = styled_components__WEBPACK_IMPORTED_MODULE_2___default()(_typography__WEBPACK_IMPORTED_MODULE_7__.Label).withConfig({
39056
+ displayName: "ModalSubtitle",
39057
+ componentId: "sc-1p9nv3u-0"
39058
+ })(["padding-right:", ";"], _theme__WEBPACK_IMPORTED_MODULE_6__["default"].spacing['04']);
39053
39059
  var CloseButton = function CloseButton(props) {
39054
39060
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_icon_button__WEBPACK_IMPORTED_MODULE_4__.IconButton, _extends({
39055
39061
  icon: "CloseSmall",
@@ -39061,46 +39067,41 @@ var ButtonsGroup = styled_components__WEBPACK_IMPORTED_MODULE_2___default()(_lay
39061
39067
  align_items: 'center'
39062
39068
  }).withConfig({
39063
39069
  displayName: "ButtonsGroup",
39064
- componentId: "sc-1p9nv3u-0"
39070
+ componentId: "sc-1p9nv3u-1"
39065
39071
  })([""]);
39066
39072
  var ModalButton = styled_components__WEBPACK_IMPORTED_MODULE_2___default()(_button__WEBPACK_IMPORTED_MODULE_3__.Button).attrs({
39067
39073
  size: 'sm'
39068
39074
  }).withConfig({
39069
39075
  displayName: "ModalButton",
39070
- componentId: "sc-1p9nv3u-1"
39076
+ componentId: "sc-1p9nv3u-2"
39071
39077
  })([""]);
39072
- var ModalHeader = function ModalHeader(props) {
39073
- var title = props.title,
39074
- subtitle = props.subtitle,
39075
- onCancel = props.onCancel,
39076
- cancelDisabled = props.cancelDisabled;
39078
+ var ModalHeader = function ModalHeader(_ref2) {
39079
+ var title = _ref2.title,
39080
+ subtitle = _ref2.subtitle,
39081
+ onCancel = _ref2.onCancel,
39082
+ cancelDisabled = _ref2.cancelDisabled;
39077
39083
  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, {
39078
39084
  align_items: "center",
39079
39085
  justify_content: "space-between",
39080
39086
  width: "100%"
39081
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(ModalTitle, {
39082
- text: title
39083
- }), !cancelDisabled && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(CloseButton, {
39087
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(ModalTitle, null, title), !cancelDisabled ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(CloseButton, {
39084
39088
  onClick: onCancel,
39085
39089
  "data-testid": "modal_header_close_button"
39086
- })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(Subtitle, null, subtitle));
39090
+ }) : null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(ModalSubtitle, null, subtitle));
39087
39091
  };
39088
39092
  ModalHeader.propTypes = {
39089
39093
  title: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().node),
39090
39094
  subtitle: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().node),
39091
- onCancel: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().func)
39095
+ onCancel: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().func),
39096
+ cancelDisabled: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().bool)
39092
39097
  };
39093
- var Subtitle = styled_components__WEBPACK_IMPORTED_MODULE_2___default()(_typography__WEBPACK_IMPORTED_MODULE_7__.Label).withConfig({
39094
- displayName: "Subtitle",
39095
- componentId: "sc-1p9nv3u-2"
39096
- })(["padding-right:", ";"], _theme__WEBPACK_IMPORTED_MODULE_6__["default"].spacing['04']);
39097
- var ModalFooter = function ModalFooter(props) {
39098
- var okLabel = props.okLabel,
39099
- cancelLabel = props.cancelLabel,
39100
- onOk = props.onOk,
39101
- onCancel = props.onCancel,
39102
- okDisabled = props.okDisabled,
39103
- cancelDisabled = props.cancelDisabled;
39098
+ var ModalFooter = function ModalFooter(_ref3) {
39099
+ var okLabel = _ref3.okLabel,
39100
+ cancelLabel = _ref3.cancelLabel,
39101
+ onOk = _ref3.onOk,
39102
+ onCancel = _ref3.onCancel,
39103
+ okDisabled = _ref3.okDisabled,
39104
+ cancelDisabled = _ref3.cancelDisabled;
39104
39105
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_layout__WEBPACK_IMPORTED_MODULE_5__.Flex, {
39105
39106
  width: "100%",
39106
39107
  justify_content: "flex-end"
@@ -43915,7 +43916,7 @@ var enterAnimation = function enterAnimation(factor) {
43915
43916
  var exitAnimation = function exitAnimation(factor) {
43916
43917
  return (0,styled_components__WEBPACK_IMPORTED_MODULE_4__.keyframes)(["0%{transform:translate3d(0,0,-1px) scale(1);opacity:1;}100%{transform:translate3d(0,", "%,-1px) scale(.6);opacity:0;}"], factor * -150);
43917
43918
  };
43918
- var ToastAnimatedComp = styled_components__WEBPACK_IMPORTED_MODULE_4___default().div.withConfig({
43919
+ var ToastAnimatedComp = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().memo(styled_components__WEBPACK_IMPORTED_MODULE_4___default().div.withConfig({
43919
43920
  displayName: "ToastAnimatedComp",
43920
43921
  componentId: "sc-1whlqk5-0"
43921
43922
  })(["display:flex;align-items:center;will-change:transform;max-width:350px;", ";"], function (props) {
@@ -43924,7 +43925,7 @@ var ToastAnimatedComp = styled_components__WEBPACK_IMPORTED_MODULE_4___default()
43924
43925
  var top = $position.includes('top');
43925
43926
  var factor = top ? 1 : -1;
43926
43927
  return $visible ? (0,styled_components__WEBPACK_IMPORTED_MODULE_4__.css)(["animation:", " 0.35s cubic-bezier(.21,1.02,.73,1) forwards;"], enterAnimation(factor)) : (0,styled_components__WEBPACK_IMPORTED_MODULE_4__.css)(["animation:", " 0.4s forwards cubic-bezier(.06,.71,.55,1)"], exitAnimation(factor));
43927
- });
43928
+ }));
43928
43929
  ToastAnimatedComp.defaultProps = {
43929
43930
  $position: 'bottom-left'
43930
43931
  };
@@ -43940,16 +43941,26 @@ var ToastComp = function ToastComp(props) {
43940
43941
  dismissToast = toast.dismissToast,
43941
43942
  message = toast.message,
43942
43943
  dismissible = toast.dismissible,
43943
- notDismissible = toast.notDismissible;
43944
+ notDismissible = toast.notDismissible,
43945
+ onShow = toast.onShow,
43946
+ onDismiss = toast.onDismiss,
43947
+ visible = toast.visible;
43944
43948
  var _useContext = (0,react__WEBPACK_IMPORTED_MODULE_2__.useContext)(_context__WEBPACK_IMPORTED_MODULE_7__.ToastContext),
43945
43949
  position = _useContext.position;
43946
43950
  var onCloseHandler = react__WEBPACK_IMPORTED_MODULE_2___default().useCallback(function () {
43947
43951
  dismissToast(id);
43948
- if (lodash_isFunction__WEBPACK_IMPORTED_MODULE_0___default()(onClose)) onClose(id);
43952
+ if (lodash_isFunction__WEBPACK_IMPORTED_MODULE_0___default()(onClose)) onClose(toast);
43949
43953
  }, [id]);
43954
+ (0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(function () {
43955
+ if (!visible) return;
43956
+ if (lodash_isFunction__WEBPACK_IMPORTED_MODULE_0___default()(onShow)) onShow(toast);
43957
+ return function () {
43958
+ if (lodash_isFunction__WEBPACK_IMPORTED_MODULE_0___default()(onDismiss)) onDismiss(toast);
43959
+ };
43960
+ }, [visible]);
43950
43961
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(ToastAnimatedComp, {
43951
43962
  $position: toast.position || position || 'bottom-left',
43952
- $visible: toast.visible
43963
+ $visible: visible
43953
43964
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_toast__WEBPACK_IMPORTED_MODULE_6__.Toast, {
43954
43965
  onClose: onCloseHandler,
43955
43966
  type: type,
@@ -44083,7 +44094,7 @@ var dismissToast = function dismissToast(id) {
44083
44094
  if (!id) queue.length = 0;
44084
44095
  return react_hot_toast__WEBPACK_IMPORTED_MODULE_1__["default"].dismiss(id);
44085
44096
  };
44086
- var _useToaster = function _useToaster() {
44097
+ var useToaster = function useToaster() {
44087
44098
  var _useHotToaster = (0,react_hot_toast__WEBPACK_IMPORTED_MODULE_1__.useToaster)(),
44088
44099
  toasts = _useHotToaster.toasts;
44089
44100
  var context = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(_context__WEBPACK_IMPORTED_MODULE_2__.ToastContext);
@@ -44115,6 +44126,23 @@ var _useToaster = function _useToaster() {
44115
44126
  processQueueRef.current();
44116
44127
  return opt.id || id;
44117
44128
  }, []);
44129
+ var getToast = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function (id) {
44130
+ var foundToast = toasts.find(function (t) {
44131
+ return t.id == id;
44132
+ });
44133
+ if (foundToast) return {
44134
+ id: id,
44135
+ active: true
44136
+ };
44137
+ foundToast = queue.find(function (t) {
44138
+ return t[1].id == id;
44139
+ });
44140
+ if (foundToast) return {
44141
+ id: id,
44142
+ active: false
44143
+ };
44144
+ return null;
44145
+ }, [toasts]);
44118
44146
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
44119
44147
  processQueue();
44120
44148
  }, [processQueue]);
@@ -44150,16 +44178,10 @@ var _useToaster = function _useToaster() {
44150
44178
  return {
44151
44179
  enqueueToast: enqueueToast,
44152
44180
  dismissToast: dismissToast,
44153
- toast: _toast
44181
+ toast: _toast,
44182
+ getToast: getToast
44154
44183
  };
44155
44184
  };
44156
- var useToaster = function useToaster() {
44157
- var toasterHook = _useToaster();
44158
- var memoizedHook = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(function () {
44159
- return toasterHook;
44160
- }, []);
44161
- return memoizedHook;
44162
- };
44163
44185
 
44164
44186
  /***/ }),
44165
44187