@razorpay/blade 11.2.1 → 11.3.0
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/build/lib/native/components/Toast/Toast.native.js +7 -0
- package/build/lib/native/components/Toast/Toast.native.js.map +1 -0
- package/build/lib/native/components/Toast/ToastContainer.native.js +7 -0
- package/build/lib/native/components/Toast/ToastContainer.native.js.map +1 -0
- package/build/lib/native/components/Toast/useToast.js +9 -0
- package/build/lib/native/components/Toast/useToast.js.map +1 -0
- package/build/lib/native/components/index.js +2 -0
- package/build/lib/native/components/index.js.map +1 -1
- package/build/lib/web/development/components/Toast/Toast.web.js +144 -0
- package/build/lib/web/development/components/Toast/Toast.web.js.map +1 -0
- package/build/lib/web/development/components/Toast/ToastContainer.web.js +305 -0
- package/build/lib/web/development/components/Toast/ToastContainer.web.js.map +1 -0
- package/build/lib/web/development/components/Toast/constants.js +26 -0
- package/build/lib/web/development/components/Toast/constants.js.map +1 -0
- package/build/lib/web/development/components/Toast/index.js +4 -0
- package/build/lib/web/development/components/Toast/index.js.map +1 -0
- package/build/lib/web/development/components/Toast/types.js +2 -0
- package/build/lib/web/development/components/Toast/types.js.map +1 -0
- package/build/lib/web/development/components/Toast/useToast.js +66 -0
- package/build/lib/web/development/components/Toast/useToast.js.map +1 -0
- package/build/lib/web/development/components/index.js +3 -0
- package/build/lib/web/development/components/index.js.map +1 -1
- package/build/lib/web/production/components/Toast/Toast.web.js +144 -0
- package/build/lib/web/production/components/Toast/Toast.web.js.map +1 -0
- package/build/lib/web/production/components/Toast/ToastContainer.web.js +305 -0
- package/build/lib/web/production/components/Toast/ToastContainer.web.js.map +1 -0
- package/build/lib/web/production/components/Toast/constants.js +26 -0
- package/build/lib/web/production/components/Toast/constants.js.map +1 -0
- package/build/lib/web/production/components/Toast/index.js +4 -0
- package/build/lib/web/production/components/Toast/index.js.map +1 -0
- package/build/lib/web/production/components/Toast/types.js +2 -0
- package/build/lib/web/production/components/Toast/types.js.map +1 -0
- package/build/lib/web/production/components/Toast/useToast.js +66 -0
- package/build/lib/web/production/components/Toast/useToast.js.map +1 -0
- package/build/lib/web/production/components/index.js +3 -0
- package/build/lib/web/production/components/index.js.map +1 -1
- package/build/types/components/index.d.ts +71 -1
- package/build/types/components/index.native.d.ts +71 -1
- package/package.json +3 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import toast, { useToasterStore } from 'react-hot-toast';
|
|
3
|
+
import { Toast } from './Toast.web.js';
|
|
4
|
+
import '../../utils/logger/index.js';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
import { logger } from '../../utils/logger/logger.js';
|
|
7
|
+
|
|
8
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
9
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
|
+
var useToast = function useToast() {
|
|
11
|
+
var _useToasterStore = useToasterStore(),
|
|
12
|
+
toasts = _useToasterStore.toasts;
|
|
13
|
+
var show = function show(props) {
|
|
14
|
+
var _props$type;
|
|
15
|
+
props.type = (_props$type = props.type) !== null && _props$type !== void 0 ? _props$type : 'informational';
|
|
16
|
+
|
|
17
|
+
// Do not show promotional toasts if there is already one
|
|
18
|
+
if (toasts.find(function (t) {
|
|
19
|
+
// @ts-expect-error - react-hot-toast doesn't recognize our promotional type
|
|
20
|
+
return t.type === 'promotional';
|
|
21
|
+
}) && props.type === 'promotional') {
|
|
22
|
+
if (true) {
|
|
23
|
+
logger({
|
|
24
|
+
message: 'There can only be one promotional toast at a time',
|
|
25
|
+
type: 'warn',
|
|
26
|
+
moduleName: 'Toast'
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return '';
|
|
30
|
+
}
|
|
31
|
+
var isPromoToast = props.type === 'promotional';
|
|
32
|
+
if (props.autoDismiss === undefined) {
|
|
33
|
+
// Promotional toasts should not auto dismiss
|
|
34
|
+
props.autoDismiss = !isPromoToast;
|
|
35
|
+
}
|
|
36
|
+
if (props.duration === undefined) {
|
|
37
|
+
// Set default durations
|
|
38
|
+
if (isPromoToast) {
|
|
39
|
+
props.duration = 8000;
|
|
40
|
+
} else {
|
|
41
|
+
props.duration = 4000;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// If autoDismiss is false, set duration to infinity
|
|
46
|
+
if (!props.autoDismiss) {
|
|
47
|
+
props.duration = Infinity;
|
|
48
|
+
}
|
|
49
|
+
return toast.custom(function (_ref) {
|
|
50
|
+
var visible = _ref.visible,
|
|
51
|
+
id = _ref.id;
|
|
52
|
+
return /*#__PURE__*/jsx(Toast, _objectSpread(_objectSpread({}, props), {}, {
|
|
53
|
+
id: id,
|
|
54
|
+
isVisible: visible
|
|
55
|
+
}));
|
|
56
|
+
}, props);
|
|
57
|
+
};
|
|
58
|
+
return {
|
|
59
|
+
toasts: toasts,
|
|
60
|
+
show: show,
|
|
61
|
+
dismiss: toast.dismiss
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export { useToast };
|
|
66
|
+
//# sourceMappingURL=useToast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useToast.js","sources":["../../../../../../src/components/Toast/useToast.tsx"],"sourcesContent":["import type { Toast } from 'react-hot-toast';\nimport toast, { useToasterStore } from 'react-hot-toast';\nimport type { ToastProps } from './types';\nimport { Toast as ToastComponent } from './Toast';\nimport { logger } from '~utils/logger';\n\ntype BladeToast = Omit<Toast, 'type'> & ToastProps;\ntype UseToastReturn = {\n toasts: BladeToast[];\n show: (props: ToastProps) => string;\n dismiss: (id?: string) => void;\n};\n\nconst useToast = (): UseToastReturn => {\n const { toasts } = useToasterStore();\n const show = (props: ToastProps): string => {\n props.type = props.type ?? 'informational';\n\n // Do not show promotional toasts if there is already one\n if (\n toasts.find((t) => {\n // @ts-expect-error - react-hot-toast doesn't recognize our promotional type\n return t.type === 'promotional';\n }) &&\n props.type === 'promotional'\n ) {\n if (__DEV__) {\n logger({\n message: 'There can only be one promotional toast at a time',\n type: 'warn',\n moduleName: 'Toast',\n });\n }\n return '';\n }\n\n const isPromoToast = props.type === 'promotional';\n if (props.autoDismiss === undefined) {\n // Promotional toasts should not auto dismiss\n props.autoDismiss = !isPromoToast;\n }\n\n if (props.duration === undefined) {\n // Set default durations\n if (isPromoToast) {\n props.duration = 8000;\n } else {\n props.duration = 4000;\n }\n }\n\n // If autoDismiss is false, set duration to infinity\n if (!props.autoDismiss) {\n props.duration = Infinity;\n }\n\n return toast.custom(({ visible, id }) => {\n return <ToastComponent {...props} id={id} isVisible={visible} />;\n }, props);\n };\n\n return {\n toasts: (toasts as unknown) as BladeToast[],\n show,\n dismiss: toast.dismiss,\n };\n};\n\nexport type { UseToastReturn };\nexport { useToast };\n"],"names":["useToast","_useToasterStore","useToasterStore","toasts","show","props","_props$type","type","find","t","logger","message","moduleName","isPromoToast","autoDismiss","undefined","duration","Infinity","toast","custom","_ref","visible","id","_jsx","ToastComponent","_objectSpread","isVisible","dismiss"],"mappings":";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AA;AACF,KAAA;;AAEA;AACA,IAAA,IAAI,CAACX,KAAK,CAACS,WAAW,EAAE;MACtBT,KAAK,CAACW,QAAQ,GAAGC,QAAQ,CAAA;AAC3B,KAAA;AAEA,IAAA,OAAOC,KAAK,CAACC,MAAM,CAAC,UAAAC,IAAA,EAAqB;AAAA,MAAA,IAAlBC,OAAO,GAAAD,IAAA,CAAPC,OAAO;QAAEC,EAAE,GAAAF,IAAA,CAAFE,EAAE,CAAA;MAChC,oBAAOC,GAAA,CAACC,KAAc,EAAAC,aAAA,CAAAA,aAAA,KAAKpB,KAAK,CAAA,EAAA,EAAA,EAAA;AAAEiB,QAAAA,EAAE,EAAEA,EAAG;AAACI,QAAAA,SAAS,EAAEL,OAAAA;AAAQ,OAAA,CAAE,CAAC,CAAA;KACjE,EAAEhB,KAAK,CAAC,CAAA;GACV,CAAA;EAED,OAAO;AACLF,IAAAA,MAAM,EAAGA,MAAkC;AAC3CC,IAAAA,IAAI,EAAJA,IAAI;IACJuB,OAAO,EAAET,KAAK,CAACS,OAAAA;GAChB,CAAA;AACH;;;;"}
|
|
@@ -39,6 +39,7 @@ import './Table/index.js';
|
|
|
39
39
|
import './Tabs/index.js';
|
|
40
40
|
import './Tag/index.js';
|
|
41
41
|
import './Tooltip/index.js';
|
|
42
|
+
import './Toast/index.js';
|
|
42
43
|
import './types.js';
|
|
43
44
|
import './Typography/index.js';
|
|
44
45
|
import './VisuallyHidden/index.web.js';
|
|
@@ -394,6 +395,8 @@ export { TabPanel } from './Tabs/TabPanel.web.js';
|
|
|
394
395
|
export { Tag } from './Tag/Tag.js';
|
|
395
396
|
export { Tooltip } from './Tooltip/Tooltip.web.js';
|
|
396
397
|
export { TooltipInteractiveWrapper } from './Tooltip/TooltipInteractiveWrapper.web.js';
|
|
398
|
+
export { ToastContainer } from './Toast/ToastContainer.web.js';
|
|
399
|
+
export { useToast } from './Toast/useToast.js';
|
|
397
400
|
export { Heading } from './Typography/Heading/Heading.js';
|
|
398
401
|
export { Text, getTextProps } from './Typography/Text/Text.js';
|
|
399
402
|
export { Code } from './Typography/Code/Code.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import 'react';
|
|
3
|
+
import toast from 'react-hot-toast';
|
|
4
|
+
import styled, { keyframes, css } from 'styled-components';
|
|
5
|
+
import '../Box/index.js';
|
|
6
|
+
import '../Button/index.js';
|
|
7
|
+
import '../Button/IconButton/index.js';
|
|
8
|
+
import '../Icons/index.js';
|
|
9
|
+
import '../Box/BaseBox/index.js';
|
|
10
|
+
import '../Typography/index.js';
|
|
11
|
+
import '../../utils/index.js';
|
|
12
|
+
import getIn from '../../utils/lodashButBetter/get.js';
|
|
13
|
+
import '../../utils/makeAccessible/index.js';
|
|
14
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
15
|
+
import CheckCircleIcon from '../Icons/CheckCircleIcon/CheckCircleIcon.js';
|
|
16
|
+
import AlertTriangleIcon from '../Icons/AlertOctagonIcon/AlertOctagonIcon.js';
|
|
17
|
+
import InfoIcon from '../Icons/InfoIcon/InfoIcon.js';
|
|
18
|
+
import AlertTriangleIcon$1 from '../Icons/AlertTriangleIcon/AlertTriangleIcon.js';
|
|
19
|
+
import { BaseBox } from '../Box/BaseBox/BaseBox.web.js';
|
|
20
|
+
import useTheme from '../BladeProvider/useTheme.js';
|
|
21
|
+
import { Box } from '../Box/Box.js';
|
|
22
|
+
import Button from '../Button/Button/Button.js';
|
|
23
|
+
import { makeMotionTime } from '../../utils/makeMotionTime/makeMotionTime.web.js';
|
|
24
|
+
import { castWebType } from '../../utils/platform/castUtils.js';
|
|
25
|
+
import { makeAccessible } from '../../utils/makeAccessible/makeAccessible.web.js';
|
|
26
|
+
import { Text } from '../Typography/Text/Text.js';
|
|
27
|
+
import { IconButton } from '../Button/IconButton/IconButton.js';
|
|
28
|
+
import CloseIcon from '../Icons/CloseIcon/CloseIcon.js';
|
|
29
|
+
|
|
30
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
31
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
32
|
+
var iconMap = {
|
|
33
|
+
positive: CheckCircleIcon,
|
|
34
|
+
negative: AlertTriangleIcon,
|
|
35
|
+
information: InfoIcon,
|
|
36
|
+
neutral: InfoIcon,
|
|
37
|
+
notice: AlertTriangleIcon$1
|
|
38
|
+
};
|
|
39
|
+
var borderColorMap = {
|
|
40
|
+
positive: 'feedback.border.positive.intense',
|
|
41
|
+
negative: 'feedback.border.negative.intense',
|
|
42
|
+
notice: 'feedback.border.notice.intense',
|
|
43
|
+
information: 'feedback.border.information.intense',
|
|
44
|
+
neutral: 'feedback.border.neutral.intense'
|
|
45
|
+
};
|
|
46
|
+
var slideIn = /*#__PURE__*/keyframes(["from{opacity:0;transform:translateY(100%);}to{opacity:1;transform:translateY(0);}"]);
|
|
47
|
+
var slideOut = /*#__PURE__*/keyframes(["from{opacity:1;transform:translateY(0);}to{opacity:0;transform:translateY(100%);}"]);
|
|
48
|
+
var AnimatedFade = /*#__PURE__*/styled(BaseBox).withConfig({
|
|
49
|
+
displayName: "Toastweb__AnimatedFade",
|
|
50
|
+
componentId: "lbyqty-0"
|
|
51
|
+
})(function (_ref) {
|
|
52
|
+
var animationType = _ref.animationType,
|
|
53
|
+
toastBorderColor = _ref.toastBorderColor;
|
|
54
|
+
return css(["overflow:hidden;border:1px solid ", ";", ""], toastBorderColor, animationType);
|
|
55
|
+
});
|
|
56
|
+
var Toast = function Toast(_ref2) {
|
|
57
|
+
var type = _ref2.type,
|
|
58
|
+
_ref2$color = _ref2.color,
|
|
59
|
+
color = _ref2$color === void 0 ? 'neutral' : _ref2$color,
|
|
60
|
+
leading = _ref2.leading,
|
|
61
|
+
action = _ref2.action,
|
|
62
|
+
content = _ref2.content,
|
|
63
|
+
onDismissButtonClick = _ref2.onDismissButtonClick,
|
|
64
|
+
isVisible = _ref2.isVisible,
|
|
65
|
+
id = _ref2.id;
|
|
66
|
+
var _useTheme = useTheme(),
|
|
67
|
+
theme = _useTheme.theme;
|
|
68
|
+
var Icon = leading || iconMap[color];
|
|
69
|
+
var isPromotional = type === 'promotional';
|
|
70
|
+
var actionButton = action ? /*#__PURE__*/jsx(Box, {
|
|
71
|
+
children: /*#__PURE__*/jsx(Button, {
|
|
72
|
+
size: "xsmall",
|
|
73
|
+
variant: isPromotional ? 'secondary' : 'tertiary',
|
|
74
|
+
color: isPromotional ? 'primary' : 'white',
|
|
75
|
+
onClick: function onClick(event) {
|
|
76
|
+
var _action$onClick;
|
|
77
|
+
event.stopPropagation();
|
|
78
|
+
action === null || action === void 0 ? void 0 : (_action$onClick = action.onClick) === null || _action$onClick === void 0 ? void 0 : _action$onClick.call(action, {
|
|
79
|
+
event: event,
|
|
80
|
+
toastId: id
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
isLoading: action === null || action === void 0 ? void 0 : action.isLoading,
|
|
84
|
+
children: action === null || action === void 0 ? void 0 : action.text
|
|
85
|
+
})
|
|
86
|
+
}) : null;
|
|
87
|
+
var enter = /*#__PURE__*/css(["opacity:0;animation:", " ", " ", " forwards;"], slideIn, makeMotionTime(theme.motion.duration.gentle), castWebType(theme.motion.easing.entrance.effective));
|
|
88
|
+
var exit = /*#__PURE__*/css(["opacity:1;animation:", " ", " ", " forwards;"], slideOut, makeMotionTime(theme.motion.duration.moderate), castWebType(theme.motion.easing.exit.effective));
|
|
89
|
+
return /*#__PURE__*/jsxs(AnimatedFade, _objectSpread(_objectSpread({}, makeAccessible({
|
|
90
|
+
role: 'status',
|
|
91
|
+
liveRegion: 'polite'
|
|
92
|
+
})), {}, {
|
|
93
|
+
toastBorderColor: getIn(theme.colors, isPromotional ? 'surface.border.gray.muted' : borderColorMap[color]),
|
|
94
|
+
animationType: isVisible ? enter : exit,
|
|
95
|
+
width: "100%",
|
|
96
|
+
display: "flex",
|
|
97
|
+
gap: "spacing.3",
|
|
98
|
+
paddingX: "spacing.4",
|
|
99
|
+
paddingY: isPromotional ? 'spacing.4' : 'spacing.3',
|
|
100
|
+
borderRadius: "medium",
|
|
101
|
+
alignItems: "center",
|
|
102
|
+
backgroundColor: isPromotional ? 'surface.background.gray.intense' : "feedback.background.".concat(color, ".intense"),
|
|
103
|
+
children: [Icon ? /*#__PURE__*/jsx(Box, {
|
|
104
|
+
flexShrink: 0,
|
|
105
|
+
display: "flex",
|
|
106
|
+
alignItems: "center",
|
|
107
|
+
alignSelf: isPromotional ? 'start' : 'center',
|
|
108
|
+
children: /*#__PURE__*/jsx(Icon, {
|
|
109
|
+
color: isPromotional ? 'surface.icon.gray.normal' : 'surface.icon.staticWhite.normal'
|
|
110
|
+
})
|
|
111
|
+
}) : null, /*#__PURE__*/jsxs(Box, {
|
|
112
|
+
display: "flex",
|
|
113
|
+
flexDirection: "column",
|
|
114
|
+
gap: "spacing.3",
|
|
115
|
+
children: [isPromotional ? content : /*#__PURE__*/jsx(Text, {
|
|
116
|
+
as: "span",
|
|
117
|
+
size: "small",
|
|
118
|
+
color: "surface.text.staticWhite.normal",
|
|
119
|
+
children: content
|
|
120
|
+
}), isPromotional && actionButton]
|
|
121
|
+
}), /*#__PURE__*/jsxs(Box, {
|
|
122
|
+
alignSelf: "start",
|
|
123
|
+
marginLeft: "auto",
|
|
124
|
+
display: "flex",
|
|
125
|
+
gap: "spacing.4",
|
|
126
|
+
children: [!isPromotional && actionButton, /*#__PURE__*/jsx(IconButton, {
|
|
127
|
+
emphasis: isPromotional ? 'intense' : 'subtle',
|
|
128
|
+
accessibilityLabel: "Dismiss toast",
|
|
129
|
+
onClick: function onClick(event) {
|
|
130
|
+
event.stopPropagation();
|
|
131
|
+
onDismissButtonClick === null || onDismissButtonClick === void 0 ? void 0 : onDismissButtonClick({
|
|
132
|
+
event: event,
|
|
133
|
+
toastId: id
|
|
134
|
+
});
|
|
135
|
+
toast.dismiss(id);
|
|
136
|
+
},
|
|
137
|
+
icon: CloseIcon
|
|
138
|
+
})]
|
|
139
|
+
})]
|
|
140
|
+
}));
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export { Toast };
|
|
144
|
+
//# sourceMappingURL=Toast.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.web.js","sources":["../../../../../../src/components/Toast/Toast.web.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React from 'react';\nimport toast from 'react-hot-toast';\nimport type { FlattenSimpleInterpolation } from 'styled-components';\nimport styled, { css, keyframes } from 'styled-components';\nimport type { ToastProps } from './types';\nimport { Box } from '~components/Box';\nimport { Button } from '~components/Button';\nimport { IconButton } from '~components/Button/IconButton';\nimport {\n AlertOctagonIcon,\n AlertTriangleIcon,\n CheckCircleIcon,\n CloseIcon,\n InfoIcon,\n} from '~components/Icons';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Text } from '~components/Typography';\nimport { castWebType, makeMotionTime, useTheme } from '~utils';\nimport getIn from '~utils/lodashButBetter/get';\nimport { makeAccessible } from '~utils/makeAccessible';\n\nconst iconMap = {\n positive: CheckCircleIcon,\n negative: AlertOctagonIcon,\n information: InfoIcon,\n neutral: InfoIcon,\n notice: AlertTriangleIcon,\n};\n\nconst borderColorMap = {\n positive: 'feedback.border.positive.intense',\n negative: 'feedback.border.negative.intense',\n notice: 'feedback.border.notice.intense',\n information: 'feedback.border.information.intense',\n neutral: 'feedback.border.neutral.intense',\n} as const;\n\nconst slideIn = keyframes`\n from {\n opacity: 0;\n transform: translateY(100%);\n }\n\n to {\n opacity: 1;\n transform: translateY(0);\n }\n`;\n\nconst slideOut = keyframes`\n from {\n opacity: 1;\n transform: translateY(0);\n }\n\n to {\n opacity: 0;\n transform: translateY(100%);\n }\n`;\n\nconst AnimatedFade = styled(BaseBox)<{\n animationType: FlattenSimpleInterpolation | null;\n toastBorderColor: string;\n}>(({ animationType, toastBorderColor }) => {\n return css`\n overflow: hidden;\n border: 1px solid ${toastBorderColor};\n ${animationType}\n `;\n});\n\nconst Toast = ({\n type,\n color = 'neutral',\n leading,\n action,\n content,\n onDismissButtonClick,\n isVisible,\n id,\n}: ToastProps & {\n isVisible?: boolean;\n}): React.ReactElement => {\n const { theme } = useTheme();\n const Icon = leading || iconMap[color];\n const isPromotional = type === 'promotional';\n const actionButton = action ? (\n <Box>\n <Button\n size=\"xsmall\"\n variant={isPromotional ? 'secondary' : 'tertiary'}\n color={isPromotional ? 'primary' : 'white'}\n onClick={(event) => {\n event.stopPropagation();\n action?.onClick?.({ event: event as never, toastId: id! });\n }}\n isLoading={action?.isLoading}\n >\n {action?.text}\n </Button>\n </Box>\n ) : null;\n\n const enter = css`\n opacity: 0;\n animation: ${slideIn} ${makeMotionTime(theme.motion.duration.gentle)}\n ${castWebType(theme.motion.easing.entrance.effective)} forwards;\n `;\n\n const exit = css`\n opacity: 1;\n animation: ${slideOut} ${makeMotionTime(theme.motion.duration.moderate)}\n ${castWebType(theme.motion.easing.exit.effective)} forwards;\n `;\n\n return (\n <AnimatedFade\n {...makeAccessible({ role: 'status', liveRegion: 'polite' })}\n toastBorderColor={getIn(\n theme.colors,\n isPromotional ? 'surface.border.gray.muted' : borderColorMap[color],\n )}\n animationType={isVisible ? enter : exit}\n width=\"100%\"\n display=\"flex\"\n gap=\"spacing.3\"\n paddingX=\"spacing.4\"\n paddingY={isPromotional ? 'spacing.4' : 'spacing.3'}\n borderRadius=\"medium\"\n alignItems=\"center\"\n backgroundColor={\n isPromotional ? 'surface.background.gray.intense' : `feedback.background.${color}.intense`\n }\n >\n {Icon ? (\n <Box\n flexShrink={0}\n display=\"flex\"\n alignItems=\"center\"\n alignSelf={isPromotional ? 'start' : 'center'}\n >\n <Icon\n color={isPromotional ? 'surface.icon.gray.normal' : 'surface.icon.staticWhite.normal'}\n />\n </Box>\n ) : null}\n <Box display=\"flex\" flexDirection=\"column\" gap=\"spacing.3\">\n {isPromotional ? (\n content\n ) : (\n <Text as=\"span\" size=\"small\" color=\"surface.text.staticWhite.normal\">\n {content}\n </Text>\n )}\n {isPromotional && actionButton}\n </Box>\n <Box alignSelf=\"start\" marginLeft=\"auto\" display=\"flex\" gap=\"spacing.4\">\n {!isPromotional && actionButton}\n <IconButton\n emphasis={isPromotional ? 'intense' : 'subtle'}\n accessibilityLabel=\"Dismiss toast\"\n onClick={(event: React.MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation();\n onDismissButtonClick?.({ event, toastId: id! });\n toast.dismiss(id);\n }}\n icon={CloseIcon}\n />\n </Box>\n </AnimatedFade>\n );\n};\n\nexport { Toast };\n"],"names":["iconMap","positive","CheckCircleIcon","negative","AlertOctagonIcon","information","InfoIcon","neutral","notice","AlertTriangleIcon","borderColorMap","slideIn","keyframes","slideOut","AnimatedFade","styled","BaseBox","withConfig","displayName","componentId","_ref","animationType","toastBorderColor","css","Toast","_ref2","type","_ref2$color","color","leading","action","content","onDismissButtonClick","isVisible","id","_useTheme","useTheme","theme","Icon","isPromotional","actionButton","_jsx","Box","children","Button","size","variant","onClick","event","_action$onClick","stopPropagation","call","toastId","isLoading","text","enter","makeMotionTime","motion","duration","gentle","castWebType","easing","entrance","effective","exit","moderate","_jsxs","_objectSpread","makeAccessible","role","liveRegion","getIn","colors","width","display","gap","paddingX","paddingY","borderRadius","alignItems","backgroundColor","concat","flexShrink","alignSelf","flexDirection","Text","as","marginLeft","IconButton","emphasis","accessibilityLabel","toast","dismiss","icon","CloseIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,IAAMA,OAAO,GAAG;AACdC,EAAAA,QAAQ,EAAEC,eAAe;AACzBC,EAAAA,QAAQ,EAAEC,iBAAgB;AAC1BC,EAAAA,WAAW,EAAEC,QAAQ;AACrBC,EAAAA,OAAO,EAAED,QAAQ;AACjBE,EAAAA,MAAM,EAAEC,mBAAAA;AACV,CAAC,CAAA;AAED,IAAMC,cAAc,GAAG;AACrBT,EAAAA,QAAQ,EAAE,kCAAkC;AAC5CE,EAAAA,QAAQ,EAAE,kCAAkC;AAC5CK,EAAAA,MAAM,EAAE,gCAAgC;AACxCH,EAAAA,WAAW,EAAE,qCAAqC;AAClDE,EAAAA,OAAO,EAAE,iCAAA;AACX,CAAU,CAAA;AAEV,IAAMI,OAAO,gBAAGC,SAAS,CAUxB,CAAA,mFAAA,CAAA,CAAA,CA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AAK,CAACC,OAAO,CAAC1D,EAAE,CAAC,CAAA;SACjB;AACF2D,QAAAA,IAAI,EAAEC,SAAAA;AAAU,OACjB,CAAC,CAAA;AAAA,KACC,CAAC,CAAA;AAAA,GAAA,CACM,CAAC,CAAA;AAEnB;;;;"}
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
2
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
3
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
|
+
import { useToaster, resolveValue } from 'react-hot-toast';
|
|
5
|
+
import React__default from 'react';
|
|
6
|
+
import styled from 'styled-components';
|
|
7
|
+
import { PEEKS, MAX_TOASTS, MIN_TOAST_MOBILE, MIN_TOAST_DESKTOP, CONTAINER_GUTTER_MOBILE, CONTAINER_GUTTER_DESKTOP, GUTTER, SCALE_FACTOR, PEEK_GUTTER, TOAST_Z_INDEX, TOAST_MAX_WIDTH } from './constants.js';
|
|
8
|
+
import '../../utils/index.js';
|
|
9
|
+
import '../Box/BaseBox/index.js';
|
|
10
|
+
import { useIsMobile } from '../../utils/useIsMobile.js';
|
|
11
|
+
import '../../utils/metaAttribute/index.js';
|
|
12
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
13
|
+
import { BaseBox } from '../Box/BaseBox/BaseBox.web.js';
|
|
14
|
+
import { makeMotionTime } from '../../utils/makeMotionTime/makeMotionTime.web.js';
|
|
15
|
+
import useTheme from '../BladeProvider/useTheme.js';
|
|
16
|
+
import { makeSize } from '../../utils/makeSize/makeSize.js';
|
|
17
|
+
import { metaAttribute } from '../../utils/metaAttribute/metaAttribute.web.js';
|
|
18
|
+
|
|
19
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
20
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
|
+
var StyledToastWrapper = /*#__PURE__*/styled(BaseBox).withConfig({
|
|
22
|
+
displayName: "ToastContainerweb__StyledToastWrapper",
|
|
23
|
+
componentId: "mv9fjf-0"
|
|
24
|
+
})(function (_ref) {
|
|
25
|
+
var isVisible = _ref.isVisible,
|
|
26
|
+
index = _ref.index,
|
|
27
|
+
isExpanded = _ref.isExpanded,
|
|
28
|
+
isPromotional = _ref.isPromotional;
|
|
29
|
+
var opacity = isVisible ? 1 : 0;
|
|
30
|
+
// Only make the PEEKING and MAX_TOASTS toasts visible,
|
|
31
|
+
// Every other toasts should be hidden
|
|
32
|
+
if (index < PEEKS + MAX_TOASTS) {
|
|
33
|
+
opacity = 1;
|
|
34
|
+
} else if (isPromotional || isExpanded) {
|
|
35
|
+
opacity = 1;
|
|
36
|
+
} else {
|
|
37
|
+
opacity = 0;
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
'& > *': {
|
|
41
|
+
pointerEvents: opacity === 1 ? 'auto' : 'none'
|
|
42
|
+
},
|
|
43
|
+
opacity: opacity
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
var getPositionStyle = function getPositionStyle(position, offset, scale, theme) {
|
|
47
|
+
var top = position.includes('top');
|
|
48
|
+
var verticalStyle = top ? {
|
|
49
|
+
top: 0
|
|
50
|
+
} : {
|
|
51
|
+
bottom: 0
|
|
52
|
+
};
|
|
53
|
+
var horizontalStyle = position.includes('center') ? {
|
|
54
|
+
justifyContent: 'center'
|
|
55
|
+
} : position.includes('right') ? {
|
|
56
|
+
justifyContent: 'flex-end'
|
|
57
|
+
} : {};
|
|
58
|
+
return _objectSpread(_objectSpread({
|
|
59
|
+
left: 0,
|
|
60
|
+
right: 0,
|
|
61
|
+
display: 'flex',
|
|
62
|
+
position: 'absolute',
|
|
63
|
+
transformOrigin: 'center',
|
|
64
|
+
transition: "".concat(makeMotionTime(theme.motion.duration.gentle), " ").concat(theme.motion.easing.standard.effective),
|
|
65
|
+
transitionProperty: 'transform, opacity, height',
|
|
66
|
+
transform: "translateY(".concat(offset * (top ? 1 : -1), "px) scale(").concat(scale, ")")
|
|
67
|
+
}, verticalStyle), horizontalStyle);
|
|
68
|
+
};
|
|
69
|
+
function isPromotionalToast(toast) {
|
|
70
|
+
// @ts-expect-error
|
|
71
|
+
return toast.type == 'promotional';
|
|
72
|
+
}
|
|
73
|
+
var Toaster = function Toaster(_ref2) {
|
|
74
|
+
var _promoToasts$, _promoToasts$0$height, _promoToasts$2;
|
|
75
|
+
var reverseOrder = _ref2.reverseOrder,
|
|
76
|
+
_ref2$position = _ref2.position,
|
|
77
|
+
position = _ref2$position === void 0 ? 'top-center' : _ref2$position,
|
|
78
|
+
toastOptions = _ref2.toastOptions,
|
|
79
|
+
containerClassName = _ref2.containerClassName;
|
|
80
|
+
var _useToaster = useToaster(toastOptions),
|
|
81
|
+
toasts = _useToaster.toasts,
|
|
82
|
+
handlers = _useToaster.handlers;
|
|
83
|
+
var _useTheme = useTheme(),
|
|
84
|
+
theme = _useTheme.theme;
|
|
85
|
+
var _React$useState = React__default.useState(0),
|
|
86
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
87
|
+
frontToastHeight = _React$useState2[0],
|
|
88
|
+
setFrontToastHeight = _React$useState2[1];
|
|
89
|
+
var _React$useState3 = React__default.useState(false),
|
|
90
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
91
|
+
hasManuallyExpanded = _React$useState4[0],
|
|
92
|
+
setHasManuallyExpanded = _React$useState4[1];
|
|
93
|
+
var isMobile = useIsMobile();
|
|
94
|
+
var minToasts = isMobile ? MIN_TOAST_MOBILE : MIN_TOAST_DESKTOP;
|
|
95
|
+
var containerGutter = isMobile ? CONTAINER_GUTTER_MOBILE : CONTAINER_GUTTER_DESKTOP;
|
|
96
|
+
var infoToasts = React__default.useMemo(function () {
|
|
97
|
+
return toasts.filter(function (toast) {
|
|
98
|
+
return !isPromotionalToast(toast);
|
|
99
|
+
});
|
|
100
|
+
}, [toasts]);
|
|
101
|
+
var promoToasts = React__default.useMemo(function () {
|
|
102
|
+
return toasts.filter(function (toast) {
|
|
103
|
+
return isPromotionalToast(toast);
|
|
104
|
+
});
|
|
105
|
+
}, [toasts]);
|
|
106
|
+
|
|
107
|
+
// always keep promo toasts at the bottom of the stack
|
|
108
|
+
var recomputedToasts = React__default.useMemo(function () {
|
|
109
|
+
return [].concat(_toConsumableArray(infoToasts), _toConsumableArray(promoToasts));
|
|
110
|
+
}, [infoToasts, promoToasts]);
|
|
111
|
+
var hasPromoToast = promoToasts.length > 0 && ((_promoToasts$ = promoToasts[0]) === null || _promoToasts$ === void 0 ? void 0 : _promoToasts$.visible);
|
|
112
|
+
var promoToastHeight = (_promoToasts$0$height = (_promoToasts$2 = promoToasts[0]) === null || _promoToasts$2 === void 0 ? void 0 : _promoToasts$2.height) !== null && _promoToasts$0$height !== void 0 ? _promoToasts$0$height : 0;
|
|
113
|
+
var isExpanded = hasManuallyExpanded || recomputedToasts.length <= minToasts;
|
|
114
|
+
React__default.useLayoutEffect(function () {
|
|
115
|
+
// find the first toast which is visible
|
|
116
|
+
var firstToast = infoToasts.find(function (t, index) {
|
|
117
|
+
return t.visible && index === 0;
|
|
118
|
+
});
|
|
119
|
+
if (firstToast) {
|
|
120
|
+
var _firstToast$height;
|
|
121
|
+
setFrontToastHeight((_firstToast$height = firstToast.height) !== null && _firstToast$height !== void 0 ? _firstToast$height : 0);
|
|
122
|
+
}
|
|
123
|
+
}, [infoToasts]);
|
|
124
|
+
|
|
125
|
+
// calculate total height of all toasts
|
|
126
|
+
var totalHeight = React__default.useMemo(function () {
|
|
127
|
+
return recomputedToasts
|
|
128
|
+
// only consider visible recomputedToasts
|
|
129
|
+
.filter(function (toast) {
|
|
130
|
+
return toast.visible;
|
|
131
|
+
}).reduce(function (prevHeight, toast) {
|
|
132
|
+
var _toast$height;
|
|
133
|
+
return prevHeight + ((_toast$height = toast.height) !== null && _toast$height !== void 0 ? _toast$height : 0);
|
|
134
|
+
}, 0) + recomputedToasts.length * GUTTER;
|
|
135
|
+
}, [recomputedToasts]);
|
|
136
|
+
|
|
137
|
+
// Stacking logic explained in detail:
|
|
138
|
+
// https://www.loom.com/share/522d9a445e2f41e1886cce4decb9ab9d?sid=4287acf6-8d44-431b-93e1-c1a0d40a0aba
|
|
139
|
+
//
|
|
140
|
+
// 1. 3 toasts can be stacked on top of each other
|
|
141
|
+
// 2. After 3 toasts, the toasts will be scaled down and peek from behind
|
|
142
|
+
// 3. There can be maximum of 3 toasts peeking from behind
|
|
143
|
+
// 4. After 3 peeking toasts, the toasts will be hidden
|
|
144
|
+
// 5. If there is a promo toast, all toasts will be lifted up
|
|
145
|
+
// 6. Promo toasts will always be on the bottom
|
|
146
|
+
var calculateYPosition = React__default.useCallback(function (_ref3) {
|
|
147
|
+
var toast = _ref3.toast,
|
|
148
|
+
index = _ref3.index;
|
|
149
|
+
// find the current toast index
|
|
150
|
+
var toastIndex = infoToasts.findIndex(function (t) {
|
|
151
|
+
return t.id === toast.id;
|
|
152
|
+
});
|
|
153
|
+
// number of toasts before this toast
|
|
154
|
+
var toastsBefore = infoToasts.filter(function (toast, i) {
|
|
155
|
+
return i < toastIndex && toast.visible;
|
|
156
|
+
}).length;
|
|
157
|
+
var scale = Math.max(0.7, 1 - toastsBefore * SCALE_FACTOR);
|
|
158
|
+
// first toast should always have a scale of 1
|
|
159
|
+
if (index < MAX_TOASTS) {
|
|
160
|
+
scale = 1;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// y position of toast,
|
|
164
|
+
var offset = infoToasts.filter(function (toast) {
|
|
165
|
+
return toast.visible;
|
|
166
|
+
}).slice(0, toastsBefore).reduce(function (y, toast) {
|
|
167
|
+
// if the toast is expanded, add the height of the toast + gutter
|
|
168
|
+
if (isExpanded) {
|
|
169
|
+
var _toast$height2;
|
|
170
|
+
return y + ((_toast$height2 = toast.height) !== null && _toast$height2 !== void 0 ? _toast$height2 : 0) + GUTTER;
|
|
171
|
+
}
|
|
172
|
+
// if the toast is not expanded, add only the peek gutter
|
|
173
|
+
return y + PEEK_GUTTER;
|
|
174
|
+
}, 0);
|
|
175
|
+
|
|
176
|
+
// lift all info toasts up if there is a promo toast
|
|
177
|
+
if (hasPromoToast) {
|
|
178
|
+
offset += GUTTER + promoToastHeight;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// if this is a promo toast, then put it at the bottom and force the scale to 1
|
|
182
|
+
if (isPromotionalToast(toast)) {
|
|
183
|
+
offset = 0;
|
|
184
|
+
scale = 1;
|
|
185
|
+
}
|
|
186
|
+
return {
|
|
187
|
+
offset: offset,
|
|
188
|
+
scale: isExpanded ? 1 : scale
|
|
189
|
+
};
|
|
190
|
+
}, [hasPromoToast, infoToasts, isExpanded, promoToastHeight]);
|
|
191
|
+
var handleMouseEnter = function handleMouseEnter() {
|
|
192
|
+
if (isMobile) return;
|
|
193
|
+
setHasManuallyExpanded(true);
|
|
194
|
+
handlers.startPause();
|
|
195
|
+
};
|
|
196
|
+
var handleMouseLeave = function handleMouseLeave() {
|
|
197
|
+
if (isMobile) return;
|
|
198
|
+
setHasManuallyExpanded(false);
|
|
199
|
+
handlers.endPause();
|
|
200
|
+
};
|
|
201
|
+
var handleToastClick = function handleToastClick() {
|
|
202
|
+
if (!isMobile) return;
|
|
203
|
+
setHasManuallyExpanded(function (prev) {
|
|
204
|
+
var next = !prev;
|
|
205
|
+
if (next) {
|
|
206
|
+
handlers.startPause();
|
|
207
|
+
} else {
|
|
208
|
+
handlers.endPause();
|
|
209
|
+
}
|
|
210
|
+
return next;
|
|
211
|
+
});
|
|
212
|
+
};
|
|
213
|
+
return /*#__PURE__*/jsxs(BaseBox, {
|
|
214
|
+
position: "fixed",
|
|
215
|
+
zIndex: TOAST_Z_INDEX,
|
|
216
|
+
top: makeSize(containerGutter),
|
|
217
|
+
left: makeSize(containerGutter),
|
|
218
|
+
right: makeSize(containerGutter),
|
|
219
|
+
bottom: makeSize(containerGutter),
|
|
220
|
+
width: "calc(100% - ".concat(containerGutter * 2, "px)"),
|
|
221
|
+
maxWidth: makeSize(TOAST_MAX_WIDTH),
|
|
222
|
+
pointerEvents: "none",
|
|
223
|
+
className: containerClassName,
|
|
224
|
+
children: [/*#__PURE__*/jsx(BaseBox, _objectSpread({
|
|
225
|
+
position: "absolute",
|
|
226
|
+
bottom: "".concat(promoToastHeight, "px"),
|
|
227
|
+
left: "0px",
|
|
228
|
+
width: "100%",
|
|
229
|
+
pointerEvents: isExpanded ? 'all' : 'none',
|
|
230
|
+
height: makeSize(isExpanded ? totalHeight - promoToastHeight : frontToastHeight),
|
|
231
|
+
zIndex: -100,
|
|
232
|
+
onMouseEnter: handleMouseEnter,
|
|
233
|
+
onMouseLeave: handleMouseLeave,
|
|
234
|
+
onClick: handleToastClick
|
|
235
|
+
}, metaAttribute({
|
|
236
|
+
testID: 'toast-mouseover-container'
|
|
237
|
+
}))), recomputedToasts.map(function (toast, index) {
|
|
238
|
+
var _toast$position;
|
|
239
|
+
var toastPosition = (_toast$position = toast.position) !== null && _toast$position !== void 0 ? _toast$position : position;
|
|
240
|
+
var isPromotional = isPromotionalToast(toast);
|
|
241
|
+
var _calculateYPosition = calculateYPosition({
|
|
242
|
+
toast: toast,
|
|
243
|
+
isExpanded: isExpanded,
|
|
244
|
+
reverseOrder: reverseOrder,
|
|
245
|
+
index: index
|
|
246
|
+
}),
|
|
247
|
+
offset = _calculateYPosition.offset,
|
|
248
|
+
scale = _calculateYPosition.scale;
|
|
249
|
+
var positionStyle = getPositionStyle(toastPosition, offset, scale, theme);
|
|
250
|
+
// recalculate height of toast
|
|
251
|
+
var ref = function ref(el) {
|
|
252
|
+
if (el && typeof toast.height !== 'number') {
|
|
253
|
+
var height = el.getBoundingClientRect().height;
|
|
254
|
+
handlers.updateHeight(toast.id, height);
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
var toastHeight = toast.height;
|
|
258
|
+
if (index > MAX_TOASTS - 1 && !isPromotional) {
|
|
259
|
+
toastHeight = frontToastHeight;
|
|
260
|
+
}
|
|
261
|
+
if (isExpanded) {
|
|
262
|
+
toastHeight = toast.height;
|
|
263
|
+
}
|
|
264
|
+
return /*#__PURE__*/jsx(StyledToastWrapper, {
|
|
265
|
+
index: index,
|
|
266
|
+
ref: ref,
|
|
267
|
+
isExpanded: isExpanded,
|
|
268
|
+
isVisible: toast.visible,
|
|
269
|
+
isPromotional: isPromotional,
|
|
270
|
+
style: _objectSpread(_objectSpread({}, positionStyle), {}, {
|
|
271
|
+
zIndex: -1 * index,
|
|
272
|
+
height: toastHeight,
|
|
273
|
+
overflow: 'hidden'
|
|
274
|
+
}),
|
|
275
|
+
onMouseEnter: function onMouseEnter() {
|
|
276
|
+
if (isPromotional) return;
|
|
277
|
+
handleMouseEnter();
|
|
278
|
+
},
|
|
279
|
+
onMouseLeave: function onMouseLeave() {
|
|
280
|
+
if (isPromotional) return;
|
|
281
|
+
handleMouseLeave();
|
|
282
|
+
},
|
|
283
|
+
onClick: function onClick() {
|
|
284
|
+
if (isPromotional) return;
|
|
285
|
+
handleToastClick();
|
|
286
|
+
},
|
|
287
|
+
children: /*#__PURE__*/jsx(BaseBox, {
|
|
288
|
+
height: "fit-content",
|
|
289
|
+
width: "100%",
|
|
290
|
+
children: resolveValue(toast.message, _objectSpread(_objectSpread({}, toast), {}, {
|
|
291
|
+
index: index
|
|
292
|
+
}))
|
|
293
|
+
})
|
|
294
|
+
}, toast.id);
|
|
295
|
+
})]
|
|
296
|
+
});
|
|
297
|
+
};
|
|
298
|
+
var ToastContainer = function ToastContainer() {
|
|
299
|
+
return /*#__PURE__*/jsx(Toaster, {
|
|
300
|
+
position: "bottom-left"
|
|
301
|
+
});
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
export { ToastContainer };
|
|
305
|
+
//# sourceMappingURL=ToastContainer.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastContainer.web.js","sources":["../../../../../../src/components/Toast/ToastContainer.web.tsx"],"sourcesContent":["import type { ToastPosition, ToasterProps, Toast } from 'react-hot-toast';\nimport { resolveValue, useToaster } from 'react-hot-toast';\nimport React from 'react';\nimport styled from 'styled-components';\nimport {\n PEEKS,\n MAX_TOASTS,\n SCALE_FACTOR,\n GUTTER,\n PEEK_GUTTER,\n TOAST_MAX_WIDTH,\n TOAST_Z_INDEX,\n MIN_TOAST_MOBILE,\n MIN_TOAST_DESKTOP,\n CONTAINER_GUTTER_MOBILE,\n CONTAINER_GUTTER_DESKTOP,\n} from './constants';\nimport { makeMotionTime, makeSize, useTheme } from '~utils';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { Theme } from '~components/BladeProvider';\nimport { useIsMobile } from '~utils/useIsMobile';\nimport { metaAttribute } from '~utils/metaAttribute';\n\ntype CalculateYPositionProps = {\n toast: Toast;\n index: number;\n isExpanded: boolean;\n reverseOrder?: boolean;\n};\n\nconst StyledToastWrapper = styled(BaseBox)<{\n isVisible: boolean;\n index: number;\n isExpanded: boolean;\n isPromotional: boolean;\n}>(({ isVisible, index, isExpanded, isPromotional }) => {\n let opacity = isVisible ? 1 : 0;\n // Only make the PEEKING and MAX_TOASTS toasts visible,\n // Every other toasts should be hidden\n if (index < PEEKS + MAX_TOASTS) {\n opacity = 1;\n } else if (isPromotional || isExpanded) {\n opacity = 1;\n } else {\n opacity = 0;\n }\n\n return {\n '& > *': {\n pointerEvents: opacity === 1 ? 'auto' : 'none',\n },\n opacity,\n };\n});\n\nconst getPositionStyle = (\n position: ToastPosition,\n offset: number,\n scale: number,\n theme: Theme,\n): React.CSSProperties => {\n const top = position.includes('top');\n const verticalStyle: React.CSSProperties = top ? { top: 0 } : { bottom: 0 };\n const horizontalStyle: React.CSSProperties = position.includes('center')\n ? {\n justifyContent: 'center',\n }\n : position.includes('right')\n ? {\n justifyContent: 'flex-end',\n }\n : {};\n\n return {\n left: 0,\n right: 0,\n display: 'flex',\n position: 'absolute',\n transformOrigin: 'center',\n transition: `${makeMotionTime(theme.motion.duration.gentle)} ${\n theme.motion.easing.standard.effective\n }`,\n transitionProperty: 'transform, opacity, height',\n transform: `translateY(${offset * (top ? 1 : -1)}px) scale(${scale})`,\n ...verticalStyle,\n ...horizontalStyle,\n };\n};\n\nfunction isPromotionalToast(toast: Toast): boolean {\n // @ts-expect-error\n return toast.type == 'promotional';\n}\n\nconst Toaster: React.FC<ToasterProps> = ({\n reverseOrder,\n position = 'top-center',\n toastOptions,\n containerClassName,\n}) => {\n const { toasts, handlers } = useToaster(toastOptions);\n const { theme } = useTheme();\n const [frontToastHeight, setFrontToastHeight] = React.useState(0);\n const [hasManuallyExpanded, setHasManuallyExpanded] = React.useState(false);\n const isMobile = useIsMobile();\n const minToasts = isMobile ? MIN_TOAST_MOBILE : MIN_TOAST_DESKTOP;\n const containerGutter = isMobile ? CONTAINER_GUTTER_MOBILE : CONTAINER_GUTTER_DESKTOP;\n\n const infoToasts = React.useMemo(() => toasts.filter((toast) => !isPromotionalToast(toast)), [\n toasts,\n ]);\n const promoToasts = React.useMemo(() => toasts.filter((toast) => isPromotionalToast(toast)), [\n toasts,\n ]);\n\n // always keep promo toasts at the bottom of the stack\n const recomputedToasts = React.useMemo(() => [...infoToasts, ...promoToasts], [\n infoToasts,\n promoToasts,\n ]);\n\n const hasPromoToast = promoToasts.length > 0 && promoToasts[0]?.visible;\n const promoToastHeight = promoToasts[0]?.height ?? 0;\n const isExpanded = hasManuallyExpanded || recomputedToasts.length <= minToasts;\n\n React.useLayoutEffect(() => {\n // find the first toast which is visible\n const firstToast = infoToasts.find((t, index) => t.visible && index === 0);\n if (firstToast) {\n setFrontToastHeight(firstToast.height ?? 0);\n }\n }, [infoToasts]);\n\n // calculate total height of all toasts\n const totalHeight = React.useMemo(() => {\n return (\n recomputedToasts\n // only consider visible recomputedToasts\n .filter((toast) => toast.visible)\n .reduce((prevHeight, toast) => prevHeight + (toast.height ?? 0), 0) +\n recomputedToasts.length * GUTTER\n );\n }, [recomputedToasts]);\n\n // Stacking logic explained in detail:\n // https://www.loom.com/share/522d9a445e2f41e1886cce4decb9ab9d?sid=4287acf6-8d44-431b-93e1-c1a0d40a0aba\n //\n // 1. 3 toasts can be stacked on top of each other\n // 2. After 3 toasts, the toasts will be scaled down and peek from behind\n // 3. There can be maximum of 3 toasts peeking from behind\n // 4. After 3 peeking toasts, the toasts will be hidden\n // 5. If there is a promo toast, all toasts will be lifted up\n // 6. Promo toasts will always be on the bottom\n const calculateYPosition = React.useCallback(\n ({ toast, index }: CalculateYPositionProps) => {\n // find the current toast index\n const toastIndex = infoToasts.findIndex((t) => t.id === toast.id);\n // number of toasts before this toast\n const toastsBefore = infoToasts.filter((toast, i) => i < toastIndex && toast.visible).length;\n\n let scale = Math.max(0.7, 1 - toastsBefore * SCALE_FACTOR);\n // first toast should always have a scale of 1\n if (index < MAX_TOASTS) {\n scale = 1;\n }\n\n // y position of toast,\n let offset = infoToasts\n .filter((toast) => toast.visible)\n .slice(0, toastsBefore)\n .reduce((y, toast) => {\n // if the toast is expanded, add the height of the toast + gutter\n if (isExpanded) {\n return y + (toast.height ?? 0) + GUTTER;\n }\n // if the toast is not expanded, add only the peek gutter\n return y + PEEK_GUTTER;\n }, 0);\n\n // lift all info toasts up if there is a promo toast\n if (hasPromoToast) {\n offset += GUTTER + promoToastHeight;\n }\n\n // if this is a promo toast, then put it at the bottom and force the scale to 1\n if (isPromotionalToast(toast)) {\n offset = 0;\n scale = 1;\n }\n\n return { offset, scale: isExpanded ? 1 : scale };\n },\n [hasPromoToast, infoToasts, isExpanded, promoToastHeight],\n );\n\n const handleMouseEnter = (): void => {\n if (isMobile) return;\n setHasManuallyExpanded(true);\n handlers.startPause();\n };\n\n const handleMouseLeave = (): void => {\n if (isMobile) return;\n setHasManuallyExpanded(false);\n handlers.endPause();\n };\n\n const handleToastClick = (): void => {\n if (!isMobile) return;\n setHasManuallyExpanded((prev) => {\n const next = !prev;\n if (next) {\n handlers.startPause();\n } else {\n handlers.endPause();\n }\n return next;\n });\n };\n\n return (\n <BaseBox\n position=\"fixed\"\n zIndex={TOAST_Z_INDEX}\n top={makeSize(containerGutter)}\n left={makeSize(containerGutter)}\n right={makeSize(containerGutter)}\n bottom={makeSize(containerGutter)}\n width={`calc(100% - ${containerGutter * 2}px)`}\n maxWidth={makeSize(TOAST_MAX_WIDTH)}\n pointerEvents=\"none\"\n className={containerClassName}\n >\n {/*\n * Mouseover container,\n * fills in the gap between toasts so that mouseleave doesn't trigger in the gaps\n */}\n <BaseBox\n position=\"absolute\"\n bottom={`${promoToastHeight}px`}\n left=\"0px\"\n width=\"100%\"\n pointerEvents={isExpanded ? 'all' : 'none'}\n height={makeSize(isExpanded ? totalHeight - promoToastHeight : frontToastHeight)}\n zIndex={-100}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n onClick={handleToastClick}\n {...metaAttribute({ testID: 'toast-mouseover-container' })}\n />\n {recomputedToasts.map((toast, index) => {\n const toastPosition = toast.position ?? position;\n const isPromotional = isPromotionalToast(toast);\n const { offset, scale } = calculateYPosition({\n toast,\n isExpanded,\n reverseOrder,\n index,\n });\n const positionStyle = getPositionStyle(toastPosition, offset, scale, theme);\n // recalculate height of toast\n const ref = (el: HTMLDivElement): void => {\n if (el && typeof toast.height !== 'number') {\n const height = el.getBoundingClientRect().height;\n handlers.updateHeight(toast.id, height);\n }\n };\n\n let toastHeight = toast.height;\n if (index > MAX_TOASTS - 1 && !isPromotional) {\n toastHeight = frontToastHeight;\n }\n if (isExpanded) {\n toastHeight = toast.height;\n }\n\n return (\n <StyledToastWrapper\n key={toast.id}\n index={index}\n ref={ref}\n isExpanded={isExpanded}\n isVisible={toast.visible}\n isPromotional={isPromotional}\n style={{\n ...positionStyle,\n zIndex: -1 * index,\n height: toastHeight,\n overflow: 'hidden',\n }}\n onMouseEnter={() => {\n if (isPromotional) return;\n handleMouseEnter();\n }}\n onMouseLeave={() => {\n if (isPromotional) return;\n handleMouseLeave();\n }}\n onClick={() => {\n if (isPromotional) return;\n handleToastClick();\n }}\n >\n <BaseBox height=\"fit-content\" width=\"100%\">\n {resolveValue(toast.message, { ...toast, index })}\n </BaseBox>\n </StyledToastWrapper>\n );\n })}\n </BaseBox>\n );\n};\n\nconst ToastContainer = (): React.ReactElement => {\n return <Toaster position=\"bottom-left\" />;\n};\n\nexport { ToastContainer };\n"],"names":["StyledToastWrapper","styled","BaseBox","withConfig","displayName","componentId","_ref","isVisible","index","isExpanded","isPromotional","opacity","PEEKS","MAX_TOASTS","pointerEvents","getPositionStyle","position","offset","scale","theme","top","includes","verticalStyle","bottom","horizontalStyle","justifyContent","_objectSpread","left","right","display","transformOrigin","transition","concat","makeMotionTime","motion","duration","gentle","easing","standard","effective","transitionProperty","transform","isPromotionalToast","toast","type","Toaster","_ref2","_promoToasts$","_promoToasts$0$height","_promoToasts$2","reverseOrder","_ref2$position","toastOptions","containerClassName","_useToaster","useToaster","toasts","handlers","_useTheme","useTheme","_React$useState","React","useState","_React$useState2","_slicedToArray","frontToastHeight","setFrontToastHeight","_React$useState3","_React$useState4","hasManuallyExpanded","setHasManuallyExpanded","isMobile","useIsMobile","minToasts","MIN_TOAST_MOBILE","MIN_TOAST_DESKTOP","containerGutter","CONTAINER_GUTTER_MOBILE","CONTAINER_GUTTER_DESKTOP","infoToasts","useMemo","filter","promoToasts","recomputedToasts","_toConsumableArray","hasPromoToast","length","visible","promoToastHeight","height","useLayoutEffect","firstToast","find","t","_firstToast$height","totalHeight","reduce","prevHeight","_toast$height","GUTTER","calculateYPosition","useCallback","_ref3","toastIndex","findIndex","id","toastsBefore","i","Math","max","SCALE_FACTOR","slice","y","_toast$height2","PEEK_GUTTER","handleMouseEnter","startPause","handleMouseLeave","endPause","handleToastClick","prev","next","_jsxs","zIndex","TOAST_Z_INDEX","makeSize","width","maxWidth","TOAST_MAX_WIDTH","className","children","_jsx","onMouseEnter","onMouseLeave","onClick","metaAttribute","testID","map","_toast$position","toastPosition","_calculateYPosition","positionStyle","ref","el","getBoundingClientRect","updateHeight","toastHeight","style","overflow","resolveValue","message","ToastContainer"],"mappings":";;;;;;;;;;;;;;;;;;;;AA8BA,IAAMA,kBAAkB,gBAAGC,MAAM,CAACC,OAAO,CAAC,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,uCAAA;EAAAC,WAAA,EAAA,UAAA;AAAA,CAKvC,CAAA,CAAA,UAAAC,IAAA,EAAqD;AAAA,EAAA,IAAlDC,SAAS,GAAAD,IAAA,CAATC,SAAS;IAAEC,KAAK,GAAAF,IAAA,CAALE,KAAK;IAAEC,UAAU,GAAAH,IAAA,CAAVG,UAAU;IAAEC,aAAa,GAAAJ,IAAA,CAAbI,aAAa,CAAA;AAC/C,EAAA,IAAIC,OAAO,GAAGJ,SAAS,GAAG,CAAC,GAAG,CAAC,CAAA;AAC/B;AACA;AACA,EAAA,IAAIC,KAAK,GAAGI,KAAK,GAAGC,UAAU,EAAE;AAC9BF,IAAAA,OAAO,GAAG,CAAC,CAAA;AACb,GAAC,MAAM,IAAID,aAAa,IAAID,UAAU,EAAE;AACtCE,IAAAA,OAAO,GAAG,CAAC,CAAA;AACb,GAAC,MAAM;AACLA,IAAAA,OAAO,GAAG,CAAC,CAAA;AACb,GAAA;EAEA,OAAO;AACL,IAAA,OAAO,EAAE;AACPG,MAAAA,aAAa,EAAEH,OAAO,KAAK,CAAC,GAAG,MAAM,GAAG,MAAA;KACzC;AACDA,IAAAA,OAAO,EAAPA,OAAAA;GACD,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,IAAMI,gBAAg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