@luminati-io/uikit 3.7.6 → 3.7.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -43776,7 +43776,7 @@ __webpack_require__.r(__webpack_exports__);
43776
43776
 
43777
43777
 
43778
43778
  /*jslint react:true*/
43779
- var _excluded = ["type", "children", "onClose", "dismissible", "notDismissible"];
43779
+ var _excluded = ["type", "children", "onClose", "dismissible", "notDismissible", "classNamePrefix"];
43780
43780
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
43781
43781
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
43782
43782
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
@@ -43795,29 +43795,38 @@ var Toast = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().forwardRef
43795
43795
  onClose = props.onClose,
43796
43796
  dismissible = props.dismissible,
43797
43797
  notDismissible = props.notDismissible,
43798
+ classNamePrefix = props.classNamePrefix,
43798
43799
  rest = _objectWithoutProperties(props, _excluded);
43799
43800
  var _dismissible = dismissible || type == 'error' || type == 'warning';
43800
43801
  var _notDismissible = notDismissible;
43801
43802
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(Wrapper, _extends({
43802
43803
  ref: ref,
43803
43804
  $type: type
43804
- }, (0,_util__WEBPACK_IMPORTED_MODULE_3__.getCommonProps)(rest)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(ToastIcon, {
43805
- type: type
43805
+ }, (0,_util__WEBPACK_IMPORTED_MODULE_3__.getCommonProps)(rest), {
43806
+ className: classNamePrefix + 'wrapper'
43807
+ }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(ToastIcon, {
43808
+ type: type,
43809
+ classNamePrefix: classNamePrefix
43806
43810
  }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_typography__WEBPACK_IMPORTED_MODULE_6__.Paragraph, {
43807
43811
  variant: "sm",
43808
- color: "gray_11_50"
43812
+ color: "gray_11_50",
43813
+ className: classNamePrefix + 'body'
43809
43814
  }, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(RemoveButton, {
43810
43815
  onClick: onClose,
43816
+ classNamePrefix: classNamePrefix,
43811
43817
  dismissible: _dismissible && !_notDismissible
43812
43818
  }));
43813
43819
  });
43814
43820
  Toast.displayName = 'Toast';
43815
- Toast.defaultProps = {};
43821
+ Toast.defaultProps = {
43822
+ classNamePrefix: ''
43823
+ };
43816
43824
  Toast.propTypes = {
43817
43825
  type: prop_types__WEBPACK_IMPORTED_MODULE_0___default().oneOf(['success', 'error', 'warning', 'info', 'generic']),
43818
43826
  onClose: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().func),
43819
43827
  dismissible: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().bool),
43820
- notDismissible: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().bool)
43828
+ notDismissible: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().bool),
43829
+ classNamePrefix: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string)
43821
43830
  };
43822
43831
  var Wrapper = styled_components__WEBPACK_IMPORTED_MODULE_2___default().div.withConfig({
43823
43832
  displayName: "Wrapper",
@@ -43832,7 +43841,8 @@ var Wrapper = styled_components__WEBPACK_IMPORTED_MODULE_2___default().div.withC
43832
43841
  }[props.$type] || color.gray_4;
43833
43842
  });
43834
43843
  var ToastIcon = function ToastIcon(props) {
43835
- var type = props.type;
43844
+ var type = props.type,
43845
+ classNamePrefix = props.classNamePrefix;
43836
43846
  var name = {
43837
43847
  success: 'CheckCircle',
43838
43848
  error: 'Warning',
@@ -43850,21 +43860,25 @@ var ToastIcon = function ToastIcon(props) {
43850
43860
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_icon__WEBPACK_IMPORTED_MODULE_4__.Icon, {
43851
43861
  name: name,
43852
43862
  color: _color,
43863
+ className: classNamePrefix + 'icon',
43853
43864
  size: "xs"
43854
43865
  });
43855
43866
  };
43856
43867
  var RemoveButton = function RemoveButton(props) {
43857
43868
  var onClick = props.onClick,
43858
- dismissible = props.dismissible;
43869
+ dismissible = props.dismissible,
43870
+ classNamePrefix = props.classNamePrefix;
43859
43871
  if (!dismissible) return null;
43860
43872
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(StyledRemoveButton, {
43861
43873
  variant: "icon",
43862
43874
  icon: "CloseSmall",
43863
- onClick: onClick
43875
+ onClick: onClick,
43876
+ className: classNamePrefix + 'dismissButton'
43864
43877
  });
43865
43878
  };
43866
43879
  RemoveButton.defaultProps = {};
43867
43880
  RemoveButton.propTypes = {
43881
+ classNamePrefix: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string),
43868
43882
  onClick: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().func),
43869
43883
  dismissible: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().bool)
43870
43884
  };
@@ -43916,7 +43930,7 @@ var enterAnimation = function enterAnimation(factor) {
43916
43930
  var exitAnimation = function exitAnimation(factor) {
43917
43931
  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);
43918
43932
  };
43919
- var ToastAnimatedComp = styled_components__WEBPACK_IMPORTED_MODULE_4___default().div.withConfig({
43933
+ var ToastAnimatedComp = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().memo(styled_components__WEBPACK_IMPORTED_MODULE_4___default().div.withConfig({
43920
43934
  displayName: "ToastAnimatedComp",
43921
43935
  componentId: "sc-1whlqk5-0"
43922
43936
  })(["display:flex;align-items:center;will-change:transform;max-width:350px;", ";"], function (props) {
@@ -43925,7 +43939,7 @@ var ToastAnimatedComp = styled_components__WEBPACK_IMPORTED_MODULE_4___default()
43925
43939
  var top = $position.includes('top');
43926
43940
  var factor = top ? 1 : -1;
43927
43941
  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));
43928
- });
43942
+ }));
43929
43943
  ToastAnimatedComp.defaultProps = {
43930
43944
  $position: 'bottom-left'
43931
43945
  };
@@ -43946,7 +43960,11 @@ var ToastComp = function ToastComp(props) {
43946
43960
  onDismiss = toast.onDismiss,
43947
43961
  visible = toast.visible;
43948
43962
  var _useContext = (0,react__WEBPACK_IMPORTED_MODULE_2__.useContext)(_context__WEBPACK_IMPORTED_MODULE_7__.ToastContext),
43949
- position = _useContext.position;
43963
+ position = _useContext.position,
43964
+ idPrefix = _useContext.idPrefix,
43965
+ classNamePrefix = _useContext.classNamePrefix;
43966
+ var classPref = toast.classNamePrefix || classNamePrefix;
43967
+ var idPref = toast.idPrefix || idPrefix;
43950
43968
  var onCloseHandler = react__WEBPACK_IMPORTED_MODULE_2___default().useCallback(function () {
43951
43969
  dismissToast(id);
43952
43970
  if (lodash_isFunction__WEBPACK_IMPORTED_MODULE_0___default()(onClose)) onClose(toast);
@@ -43960,12 +43978,15 @@ var ToastComp = function ToastComp(props) {
43960
43978
  }, [visible]);
43961
43979
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(ToastAnimatedComp, {
43962
43980
  $position: toast.position || position || 'bottom-left',
43963
- $visible: visible
43981
+ $visible: visible,
43982
+ id: idPref + id,
43983
+ className: classPref + 'toast'
43964
43984
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_toast__WEBPACK_IMPORTED_MODULE_6__.Toast, {
43965
43985
  onClose: onCloseHandler,
43966
43986
  type: type,
43967
43987
  dismissible: dismissible,
43968
- notDismissible: notDismissible
43988
+ notDismissible: notDismissible,
43989
+ classNamePrefix: classPref
43969
43990
  }, (0,react_hot_toast__WEBPACK_IMPORTED_MODULE_3__.resolveValue)(message, toast)));
43970
43991
  };
43971
43992
  var ToastItem = function ToastItem() {
@@ -44012,12 +44033,16 @@ var defaultContainerStyle = {
44012
44033
  var Toaster = function Toaster(props) {
44013
44034
  var position = props.position,
44014
44035
  maxToasts = props.maxToasts,
44036
+ idPrefix = props.idPrefix,
44037
+ classNamePrefix = props.classNamePrefix,
44015
44038
  containerStyle = props.containerStyle,
44016
44039
  children = props.children;
44017
44040
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_context__WEBPACK_IMPORTED_MODULE_4__.ToastContext.Provider, {
44018
44041
  value: {
44019
44042
  maxToasts: maxToasts,
44020
- position: position
44043
+ position: position,
44044
+ idPrefix: idPrefix,
44045
+ classNamePrefix: classNamePrefix
44021
44046
  }
44022
44047
  }, children, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(react_hot_toast__WEBPACK_IMPORTED_MODULE_2__.Toaster, {
44023
44048
  position: position,
@@ -44029,7 +44054,9 @@ var Toaster = function Toaster(props) {
44029
44054
  };
44030
44055
  Toaster.defaultProps = {
44031
44056
  position: 'bottom-left',
44032
- maxToasts: 2
44057
+ maxToasts: 2,
44058
+ idPrefix: 'toast',
44059
+ classNamePrefix: 'toast'
44033
44060
  };
44034
44061
  Toaster.propTypes = {
44035
44062
  position: prop_types__WEBPACK_IMPORTED_MODULE_0___default().oneOf(_utils__WEBPACK_IMPORTED_MODULE_3__.toastPositions),
@@ -44094,7 +44121,7 @@ var dismissToast = function dismissToast(id) {
44094
44121
  if (!id) queue.length = 0;
44095
44122
  return react_hot_toast__WEBPACK_IMPORTED_MODULE_1__["default"].dismiss(id);
44096
44123
  };
44097
- var _useToaster = function _useToaster() {
44124
+ var useToaster = function useToaster() {
44098
44125
  var _useHotToaster = (0,react_hot_toast__WEBPACK_IMPORTED_MODULE_1__.useToaster)(),
44099
44126
  toasts = _useHotToaster.toasts;
44100
44127
  var context = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(_context__WEBPACK_IMPORTED_MODULE_2__.ToastContext);
@@ -44126,6 +44153,23 @@ var _useToaster = function _useToaster() {
44126
44153
  processQueueRef.current();
44127
44154
  return opt.id || id;
44128
44155
  }, []);
44156
+ var getToast = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function (id) {
44157
+ var foundToast = toasts.find(function (t) {
44158
+ return t.id == id;
44159
+ });
44160
+ if (foundToast) return {
44161
+ id: id,
44162
+ active: true
44163
+ };
44164
+ foundToast = queue.find(function (t) {
44165
+ return t[1].id == id;
44166
+ });
44167
+ if (foundToast) return {
44168
+ id: id,
44169
+ active: false
44170
+ };
44171
+ return null;
44172
+ }, [toasts]);
44129
44173
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
44130
44174
  processQueue();
44131
44175
  }, [processQueue]);
@@ -44162,16 +44206,9 @@ var _useToaster = function _useToaster() {
44162
44206
  enqueueToast: enqueueToast,
44163
44207
  dismissToast: dismissToast,
44164
44208
  toast: _toast,
44165
- toasts: toasts
44209
+ getToast: getToast
44166
44210
  };
44167
44211
  };
44168
- var useToaster = function useToaster() {
44169
- var toasterHook = _useToaster();
44170
- var memoizedHook = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(function () {
44171
- return toasterHook;
44172
- }, []);
44173
- return memoizedHook;
44174
- };
44175
44212
 
44176
44213
  /***/ }),
44177
44214