@razorpay/blade 11.2.0 → 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.
Files changed (49) hide show
  1. package/build/lib/native/components/Dropdown/Dropdown.js +1 -1
  2. package/build/lib/native/components/Dropdown/Dropdown.js.map +1 -1
  3. package/build/lib/native/components/Toast/Toast.native.js +7 -0
  4. package/build/lib/native/components/Toast/Toast.native.js.map +1 -0
  5. package/build/lib/native/components/Toast/ToastContainer.native.js +7 -0
  6. package/build/lib/native/components/Toast/ToastContainer.native.js.map +1 -0
  7. package/build/lib/native/components/Toast/useToast.js +9 -0
  8. package/build/lib/native/components/Toast/useToast.js.map +1 -0
  9. package/build/lib/native/components/index.js +2 -0
  10. package/build/lib/native/components/index.js.map +1 -1
  11. package/build/lib/web/development/components/Dropdown/Dropdown.js +1 -1
  12. package/build/lib/web/development/components/Dropdown/Dropdown.js.map +1 -1
  13. package/build/lib/web/development/components/Input/BaseInput/BaseInputTagSlot.web.js +15 -1
  14. package/build/lib/web/development/components/Input/BaseInput/BaseInputTagSlot.web.js.map +1 -1
  15. package/build/lib/web/development/components/Toast/Toast.web.js +144 -0
  16. package/build/lib/web/development/components/Toast/Toast.web.js.map +1 -0
  17. package/build/lib/web/development/components/Toast/ToastContainer.web.js +305 -0
  18. package/build/lib/web/development/components/Toast/ToastContainer.web.js.map +1 -0
  19. package/build/lib/web/development/components/Toast/constants.js +26 -0
  20. package/build/lib/web/development/components/Toast/constants.js.map +1 -0
  21. package/build/lib/web/development/components/Toast/index.js +4 -0
  22. package/build/lib/web/development/components/Toast/index.js.map +1 -0
  23. package/build/lib/web/development/components/Toast/types.js +2 -0
  24. package/build/lib/web/development/components/Toast/types.js.map +1 -0
  25. package/build/lib/web/development/components/Toast/useToast.js +66 -0
  26. package/build/lib/web/development/components/Toast/useToast.js.map +1 -0
  27. package/build/lib/web/development/components/index.js +3 -0
  28. package/build/lib/web/development/components/index.js.map +1 -1
  29. package/build/lib/web/production/components/Dropdown/Dropdown.js +1 -1
  30. package/build/lib/web/production/components/Dropdown/Dropdown.js.map +1 -1
  31. package/build/lib/web/production/components/Input/BaseInput/BaseInputTagSlot.web.js +15 -1
  32. package/build/lib/web/production/components/Input/BaseInput/BaseInputTagSlot.web.js.map +1 -1
  33. package/build/lib/web/production/components/Toast/Toast.web.js +144 -0
  34. package/build/lib/web/production/components/Toast/Toast.web.js.map +1 -0
  35. package/build/lib/web/production/components/Toast/ToastContainer.web.js +305 -0
  36. package/build/lib/web/production/components/Toast/ToastContainer.web.js.map +1 -0
  37. package/build/lib/web/production/components/Toast/constants.js +26 -0
  38. package/build/lib/web/production/components/Toast/constants.js.map +1 -0
  39. package/build/lib/web/production/components/Toast/index.js +4 -0
  40. package/build/lib/web/production/components/Toast/index.js.map +1 -0
  41. package/build/lib/web/production/components/Toast/types.js +2 -0
  42. package/build/lib/web/production/components/Toast/types.js.map +1 -0
  43. package/build/lib/web/production/components/Toast/useToast.js +66 -0
  44. package/build/lib/web/production/components/Toast/useToast.js.map +1 -0
  45. package/build/lib/web/production/components/index.js +3 -0
  46. package/build/lib/web/production/components/index.js.map +1 -1
  47. package/build/types/components/index.d.ts +71 -1
  48. package/build/types/components/index.native.d.ts +71 -1
  49. package/package.json +3 -1
@@ -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,k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C,aAAA;AAAa,GAAE,CAAC,CAAA;AAC3C;;;;"}
@@ -0,0 +1,26 @@
1
+ import '../../tokens/global/index.js';
2
+ import { size } from '../../tokens/global/size.js';
3
+
4
+ var TOAST_MAX_WIDTH = size['360'];
5
+ // higher than modal
6
+ var TOAST_Z_INDEX = 2000;
7
+
8
+ // Space between the toasts
9
+ var GUTTER = 12;
10
+ // Space between the collapsed toast's peek
11
+ var PEEK_GUTTER = 12;
12
+ // Gap between the toast container and the page body
13
+ var CONTAINER_GUTTER_MOBILE = 16;
14
+ var CONTAINER_GUTTER_DESKTOP = 24;
15
+ // How much to scale down the peeking toasts
16
+ var SCALE_FACTOR = 0.05;
17
+ // While collapsed, how many toasts to show
18
+ var MAX_TOASTS = 1;
19
+ // Minimum toasts to show on mobile and desktop
20
+ var MIN_TOAST_MOBILE = 1;
21
+ var MIN_TOAST_DESKTOP = 3;
22
+ // While collapsed, how many toasts should be peeking
23
+ var PEEKS = 3;
24
+
25
+ export { CONTAINER_GUTTER_DESKTOP, CONTAINER_GUTTER_MOBILE, GUTTER, MAX_TOASTS, MIN_TOAST_DESKTOP, MIN_TOAST_MOBILE, PEEKS, PEEK_GUTTER, SCALE_FACTOR, TOAST_MAX_WIDTH, TOAST_Z_INDEX };
26
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sources":["../../../../../../src/components/Toast/constants.ts"],"sourcesContent":["import { size } from '~tokens/global';\n\nexport const TOAST_MAX_WIDTH = size['360'];\n// higher than modal\nexport const TOAST_Z_INDEX = 2000;\n\n// Space between the toasts\nexport const GUTTER = 12;\n// Space between the collapsed toast's peek\nexport const PEEK_GUTTER = 12;\n// Gap between the toast container and the page body\nexport const CONTAINER_GUTTER_MOBILE = 16;\nexport const CONTAINER_GUTTER_DESKTOP = 24;\n// How much to scale down the peeking toasts\nexport const SCALE_FACTOR = 0.05;\n// While collapsed, how many toasts to show\nexport const MAX_TOASTS = 1;\n// Minimum toasts to show on mobile and desktop\nexport const MIN_TOAST_MOBILE = 1;\nexport const MIN_TOAST_DESKTOP = 3;\n// While collapsed, how many toasts should be peeking\nexport const PEEKS = 3;\n"],"names":["TOAST_MAX_WIDTH","size","TOAST_Z_INDEX","GUTTER","PEEK_GUTTER","CONTAINER_GUTTER_MOBILE","CONTAINER_GUTTER_DESKTOP","SCALE_FACTOR","MAX_TOASTS","MIN_TOAST_MOBILE","MIN_TOAST_DESKTOP","PEEKS"],"mappings":";;;IAEaA,eAAe,GAAGC,IAAI,CAAC,KAAK,EAAC;AAC1C;AACO,IAAMC,aAAa,GAAG,KAAI;;AAEjC;AACO,IAAMC,MAAM,GAAG,GAAE;AACxB;AACO,IAAMC,WAAW,GAAG,GAAE;AAC7B;AACO,IAAMC,uBAAuB,GAAG,GAAE;AAClC,IAAMC,wBAAwB,GAAG,GAAE;AAC1C;AACO,IAAMC,YAAY,GAAG,KAAI;AAChC;AACO,IAAMC,UAAU,GAAG,EAAC;AAC3B;AACO,IAAMC,gBAAgB,GAAG,EAAC;AAC1B,IAAMC,iBAAiB,GAAG,EAAC;AAClC;AACO,IAAMC,KAAK,GAAG;;;;"}
@@ -0,0 +1,4 @@
1
+ export { ToastContainer } from './ToastContainer.web.js';
2
+ export { useToast } from './useToast.js';
3
+ import './types.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=types.js.map
@@ -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 (false) {
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":";;;;;;;;;AAaA,IAAMA,QAAQ,GAAG,SAAXA,QAAQA,GAAyB;AACrC,EAAA,IAAAC,gBAAA,GAAmBC,eAAe,EAAE;IAA5BC,MAAM,GAAAF,gBAAA,CAANE,MAAM,CAAA;AACd,EAAA,IAAMC,IAAI,GAAG,SAAPA,IAAIA,CAAIC,KAAiB,EAAa;AAAA,IAAA,IAAAC,WAAA,CAAA;AAC1CD,IAAAA,KAAK,CAACE,IAAI,GAAAD,CAAAA,WAAA,GAAGD,KAAK,CAACE,IAAI,MAAAD,IAAAA,IAAAA,WAAA,KAAAA,KAAAA,CAAAA,GAAAA,WAAA,GAAI,eAAe,CAAA;;AAE1C;AACA,IAAA,IACEH,MAAM,CAACK,IAAI,CAAC,UAACC,CAAC,EAAK;AACjB;AACA,MAAA,OAAOA,CAAC,CAACF,IAAI,KAAK,aAAa,CAAA;AACjC,KAAC,CAAC,IACFF,KAAK,CAACE,IAAI,KAAK,aAAa,EAC5B;AACA,MAAA,IAAI,KAAO,EAAE;AACXG,QAAAA,MAAM,CAAC;AACLC,UAAAA,OAAO,EAAE,mDAAmD;AAC5DJ,UAAAA,IAAI,EAAE,MAAM;AACZK,UAAAA,UAAU,EAAE,OAAA;AACd,SAAC,CAAC,CAAA;AACJ,OAAA;AACA,MAAA,OAAO,EAAE,CAAA;AACX,KAAA;AAEA,IAAA,IAAMC,YAAY,GAAGR,KAAK,CAACE,IAAI,KAAK,aAAa,CAAA;AACjD,IAAA,IAAIF,KAAK,CAACS,WAAW,KAAKC,SAAS,EAAE;AACnC;AACAV,MAAAA,KAAK,CAACS,WAAW,GAAG,CAACD,YAAY,CAAA;AACnC,KAAA;AAEA,IAAA,IAAIR,KAAK,CAACW,QAAQ,KAAKD,SAAS,EAAE;AAChC;AACA,MAAA,IAAIF,YAAY,EAAE;QAChBR,KAAK,CAACW,QAAQ,GAAG,IAAI,CAAA;AACvB,OAAC,MAAM;QACLX,KAAK,CAACW,QAAQ,GAAG,IAAI,CAAA;AACvB,OAAA;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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -8,6 +8,7 @@ import { CurrencyCodeType } from '@razorpay/i18nify-js/currency';
8
8
  import { ReactDOMAttributes } from '@use-gesture/react/dist/declarations/src/types';
9
9
  import * as csstype from 'csstype';
10
10
  import { UseFloatingOptions } from '@floating-ui/react';
11
+ import { Toast } from 'react-hot-toast';
11
12
 
12
13
  type BorderRadius = Readonly<{
13
14
  /** none: 0(px/rem/pt) */
@@ -8601,6 +8602,75 @@ declare const TooltipInteractiveWrapper: styled_components.StyledComponent<"div"
8601
8602
  tabIndex: -1;
8602
8603
  }, "tabIndex" | "data-testid" | "data-blade-component">;
8603
8604
 
8605
+ declare const ToastContainer: () => React__default.ReactElement;
8606
+
8607
+ type ToastProps = {
8608
+ /**
8609
+ * @default `informational`
8610
+ */
8611
+ type?: 'informational' | 'promotional';
8612
+ /**
8613
+ * Content of the toast
8614
+ */
8615
+ content: React__default.ReactNode;
8616
+ /**
8617
+ * @default `neutral`
8618
+ */
8619
+ color?: FeedbackColors;
8620
+ /**
8621
+ * Can be used to render an icon
8622
+ */
8623
+ leading?: React__default.ComponentType<any>;
8624
+ /**
8625
+ * If true, the toast will be dismissed after few seconds
8626
+ *
8627
+ * Duration for promotional toast is 8s
8628
+ * Duration for informational toast is 4s
8629
+ *
8630
+ * @default false
8631
+ */
8632
+ autoDismiss?: boolean;
8633
+ /**
8634
+ * Duration in milliseconds for which the toast will be visible
8635
+ *
8636
+ * @default 4000 for informational toast
8637
+ * @default 8000 for promotional toast
8638
+ */
8639
+ duration?: number;
8640
+ /**
8641
+ * Called when the toast is dismissed or duration runs out
8642
+ */
8643
+ onDismissButtonClick?: ({ event, toastId, }: {
8644
+ event: React__default.MouseEvent<HTMLButtonElement>;
8645
+ toastId: string;
8646
+ }) => void;
8647
+ /**
8648
+ * Primary action of toast
8649
+ */
8650
+ action?: {
8651
+ text: string;
8652
+ onClick?: ({ event, toastId }: {
8653
+ event: ButtonProps['onClick'];
8654
+ toastId: string;
8655
+ }) => void;
8656
+ isLoading?: boolean;
8657
+ };
8658
+ /**
8659
+ * Forwarded to react-hot-toast
8660
+ *
8661
+ * This can be used to programatically update toasts by providing an id
8662
+ */
8663
+ id?: string;
8664
+ };
8665
+
8666
+ type BladeToast = Omit<Toast, 'type'> & ToastProps;
8667
+ type UseToastReturn = {
8668
+ toasts: BladeToast[];
8669
+ show: (props: ToastProps) => string;
8670
+ dismiss: (id?: string) => void;
8671
+ };
8672
+ declare const useToast: () => UseToastReturn;
8673
+
8604
8674
  type VisuallyHiddenProps = {
8605
8675
  children: React.ReactNode;
8606
8676
  } & TestID;
@@ -8613,4 +8683,4 @@ declare const VisuallyHidden: ({ children, testID }: VisuallyHiddenProps) => Rea
8613
8683
  */
8614
8684
  declare const screenReaderStyles: CSSObject;
8615
8685
 
8616
- export { Accordion, AccordionItem, AccordionItemProps, AccordionProps, ActionList, ActionListItem, ActionListItemAsset, ActionListItemAssetProps, ActionListItemBadge, ActionListItemBadgeGroup, ActionListItemIcon, ActionListItemProps, ActionListItemText, ActionListProps, ActionListSection, ActionListSectionProps, ActivityIcon, AirplayIcon, Alert, AlertCircleIcon, AlertTriangleIcon as AlertOctagonIcon, AlertOnlyIcon, AlertProps, AlertTriangleIcon$1 as AlertTriangleIcon, AlignCenterIcon, AlignJustifyIcon, AlignLeftIcon, AlignRightIcon, Amount, AmountProps, AnchorIcon, AnnouncementIcon, ApertureIcon, AppStoreIcon, ArrowDownIcon, ArrowDownLeftIcon, ArrowDownRightIcon, ArrowLeftIcon, ArrowRightIcon, ArrowUpIcon, ArrowUpLeftIcon, ArrowUpRightIcon, AtSignIcon, Attachment as AttachmentIcon, AutoComplete, AutoCompleteProps, AwardIcon, Badge, BadgeProps, BankIcon, BarChartAltIcon, BarChartIcon, BatteryChargingIcon, BatteryIcon, BellIcon, BellOffIcon, BillIcon, BladeCommonEvents, BladeProvider, BladeProviderProps, BluetoothIcon, BoldIcon, BookIcon, BookmarkIcon, BottomSheet, BottomSheetBody, BottomSheetBodyProps, BottomSheetFooter, BottomSheetFooterProps, BottomSheetHeader, BottomSheetHeaderProps, BottomSheetProps, Box, BoxIcon, BoxProps, BoxRefType, BriefcaseIcon, BulkPayoutsIcon, Button, ButtonProps, CalendarIcon, CameraIcon, CameraOffIcon, Card, CardBody, CardFooter, CardFooterAction, CardFooterLeading, CardFooterTrailing, CardHeader, CardHeaderAmount, CardHeaderBadge, CardHeaderCounter, CardHeaderIcon, CardHeaderIconButton, CardHeaderLeading, CardHeaderLink, CardHeaderText, CardHeaderTrailing, CardProps, Carousel, CarouselItem, CarouselProps, CastIcon, CheckCircleIcon, CheckIcon, CheckSquareIcon, Checkbox, CheckboxGroup, CheckboxGroupProps, CheckboxProps, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, ChevronsDownIcon, ChevronsLeftIcon, ChevronsRightIcon, ChevronsUpIcon, Chip, ChipGroup, ChipGroupProps, ChipProps, ChromeIcon, CircleIcon, ClipboardIcon, ClockIcon, CloseIcon, CloudDrizzleIcon, CloudIcon, CloudLightningIcon, CloudOffIcon, CloudRainIcon, CloudSnowIcon, Code, CodeProps, CodepenIcon, CoinsIcon, Collapsible, CollapsibleBody, CollapsibleBodyProps, CollapsibleButton, CollapsibleButtonProps, CollapsibleLink, CollapsibleLinkProps, CollapsibleProps, CommandIcon, CompassIcon, ComponentIds, CopyIcon, CornerDownLeftIcon, CornerDownRightIcon, CornerLeftDownIcon, CornerLeftUpIcon, CornerRightDownIcon, CornerRightUpIcon, CornerUpLeftIcon, CornerUpRightIcon, Counter, CounterProps, CpuIcon, CreditCardIcon, CropIcon, CrosshairIcon, CustomersIcon, CutIcon, DashboardIcon, DeleteIcon, DiscIcon, Display, DisplayProps, Divider, DividerProps, DollarIcon, DollarsIcon, DownloadCloudIcon, DownloadIcon, Dropdown, DropdownButton, DropdownFooter, DropdownHeader, DropdownLink, DropdownOverlay, DropdownOverlayProps, DropdownProps, DropletIcon, EditComposeIcon, EditIcon, EditInlineIcon, ExportIcon, ExternalLinkIcon, EyeIcon, EyeOffIcon, FacebookIcon, FastForwardIcon, FeatherIcon, FileIcon, FileMinusIcon, FilePlusIcon, FileTextIcon, FileZipIcon, FilmIcon, FilterIcon, FlagIcon, FolderIcon, FullScreenEnterIcon, FullScreenExitIcon, GithubIcon, GitlabIcon, GlobeIcon, GridIcon, HashIcon, Heading, HeadingProps, HeadphonesIcon, HeartIcon, HelpCircleIcon, HistoryIcon, HomeIcon, IconButton, IconButtonProps, IconColors, IconComponent, IconProps, IconSize, Identifier, ImageIcon, InboxIcon, Indicator, IndicatorProps, InfoIcon, InstagramIcon, InvoicesIcon, ItalicIcon, LayersIcon, LayoutIcon, LifeBuoyIcon, Link, LinkButtonVariantProps, LinkIcon, LinkProps, List, ListIcon, ListItem, ListItemCode, ListItemCodeProps, ListItemLink, ListItemLinkProps, ListItemProps, ListItemText, ListItemTextProps, ListProps, LoaderIcon, LockIcon, LogInIcon, LogOutIcon, MailIcon, MailOpenIcon, MapIcon, MapPinIcon, MaximizeIcon, MenuDotsIcon, MenuIcon, MessageCircleIcon, MessageSquareIcon, MicIcon, MicOffIcon, MinimizeIcon, MinusCircleIcon, MinusIcon, MinusSquareIcon, Modal, ModalBody, ModalBodyProps, ModalFooter, ModalFooterProps, ModalHeader, ModalHeaderProps, ModalProps, MonitorIcon, MoonIcon, MoreHorizontalIcon, MoreVerticalIcon, MoveIcon, MusicIcon, MyAccountIcon, NavigationIcon, OTPInput, OTPInputCommonProps, OTPInputProps, OctagonIcon, OffersIcon, PackageIcon, PaperclipIcon, PasswordInput, PasswordInputProps, PauseCircleIcon, PauseIcon, PaymentButtonsIcon, PaymentLinksIcon, PaymentPagesIcon, PercentIcon, PhoneCallIcon, PhoneForwardedIcon, PhoneIcon, PhoneIncomingIcon, PhoneMissedIcon, PhoneOffIcon, PhoneOutgoingIcon, PieChartIcon, PlayCircleIcon, PlayIcon, PlusCircleIcon, PlusIcon, PlusSquareIcon, PocketIcon, Popover, PopoverInteractiveWrapper, PopoverProps, PopoverTriggerProps, PowerIcon, PrinterIcon, ProgressBar, ProgressBarProps, ProgressBarVariant, QRCodeIcon, Radio, RadioGroup, RadioGroupProps, RadioIcon, RadioProps, RazorpayIcon, RazorpayXIcon, RefreshIcon, RepeatIcon, ReportsIcon, RewindIcon, RotateClockWiseIcon, RotateCounterClockWiseIcon, RoutesIcon, RupeeIcon, RupeesIcon, SaveIcon, ScissorsIcon, SearchIcon, SelectInput, SelectInputProps, SendIcon, ServerIcon, SettingsIcon, SettlementsIcon, ShareIcon, ShieldIcon, ShoppingCartIcon, ShuffleIcon, SidebarIcon, Skeleton, SkeletonProps, SkipBackIcon, SkipForwardIcon, SkipNavContent, SkipNavLink, SlackIcon, SlashIcon, SlidersIcon, SmartCollectIcon, SmartphoneIcon, SpeakerIcon, Spinner, SpinnerProps, SpotlightPopoverStepRenderProps, SpotlightPopoverTour, SpotlightPopoverTourFooter, SpotlightPopoverTourProps, SpotlightPopoverTourStep, SpotlightPopoverTourSteps, SquareIcon, StampIcon, StarIcon, StopCircleIcon, SubscriptionsIcon, SunIcon, SunriseIcon, SunsetIcon, Switch, SwitchProps, TabItem, TabItemProps, TabList, TabPanel, TabPanelProps, Table, TableBackgroundColors, TableBody, TableBodyProps, TableCell, TableCellProps, TableData, TableFooter, TableFooterCell, TableFooterCellProps, TableFooterProps, TableFooterRow, TableFooterRowProps, TableHeader, TableHeaderCell, TableHeaderCellProps, TableHeaderProps, TableHeaderRow, TableHeaderRowProps, TableNode, TablePagination, TablePaginationCommonProps, TablePaginationProps, TablePaginationType, TableProps, TableRow, TableRowProps, TableToolbar, TableToolbarActions, TableToolbarActionsProps, TableToolbarProps, TabletIcon, Tabs, TabsProps, Tag, TagIcon, TagProps, TargetIcon, Text, TextArea, TextAreaProps, TextInput, TextInputProps, TextProps, TextVariant, Theme, ThermometerIcon, ThumbsDownIcon, ThumbsUpIcon, ToggleLeftIcon, ToggleRightIcon, Tooltip, TooltipInteractiveWrapper, TooltipProps, TransactionsIcon, TrashIcon, TrendingDownIcon, TrendingUpIcon, TriangleIcon, TvIcon, TwitterIcon, TypeIcon, UmbrellaIcon, UnderlineIcon, UnlockIcon, UploadCloudIcon, UploadIcon, UserCheckIcon, UserIcon, UserMinusIcon, UserPlusIcon, UserXIcon, UsersIcon, VideoIcon, VideoOffIcon, VisuallyHidden, VisuallyHiddenProps, VoicemailIcon, VolumeHighIcon, VolumeIcon, VolumeLowIcon, VolumeMuteIcon, WatchIcon, WifiIcon, WifiOffIcon, WindIcon, XCircleIcon, XSquareIcon, ZapIcon, ZoomInIcon, ZoomOutIcon, announce, clearAnnouncer, destroyAnnouncer, getTextProps, screenReaderStyles, useTheme };
8686
+ export { Accordion, AccordionItem, AccordionItemProps, AccordionProps, ActionList, ActionListItem, ActionListItemAsset, ActionListItemAssetProps, ActionListItemBadge, ActionListItemBadgeGroup, ActionListItemIcon, ActionListItemProps, ActionListItemText, ActionListProps, ActionListSection, ActionListSectionProps, ActivityIcon, AirplayIcon, Alert, AlertCircleIcon, AlertTriangleIcon as AlertOctagonIcon, AlertOnlyIcon, AlertProps, AlertTriangleIcon$1 as AlertTriangleIcon, AlignCenterIcon, AlignJustifyIcon, AlignLeftIcon, AlignRightIcon, Amount, AmountProps, AnchorIcon, AnnouncementIcon, ApertureIcon, AppStoreIcon, ArrowDownIcon, ArrowDownLeftIcon, ArrowDownRightIcon, ArrowLeftIcon, ArrowRightIcon, ArrowUpIcon, ArrowUpLeftIcon, ArrowUpRightIcon, AtSignIcon, Attachment as AttachmentIcon, AutoComplete, AutoCompleteProps, AwardIcon, Badge, BadgeProps, BankIcon, BarChartAltIcon, BarChartIcon, BatteryChargingIcon, BatteryIcon, BellIcon, BellOffIcon, BillIcon, BladeCommonEvents, BladeProvider, BladeProviderProps, BluetoothIcon, BoldIcon, BookIcon, BookmarkIcon, BottomSheet, BottomSheetBody, BottomSheetBodyProps, BottomSheetFooter, BottomSheetFooterProps, BottomSheetHeader, BottomSheetHeaderProps, BottomSheetProps, Box, BoxIcon, BoxProps, BoxRefType, BriefcaseIcon, BulkPayoutsIcon, Button, ButtonProps, CalendarIcon, CameraIcon, CameraOffIcon, Card, CardBody, CardFooter, CardFooterAction, CardFooterLeading, CardFooterTrailing, CardHeader, CardHeaderAmount, CardHeaderBadge, CardHeaderCounter, CardHeaderIcon, CardHeaderIconButton, CardHeaderLeading, CardHeaderLink, CardHeaderText, CardHeaderTrailing, CardProps, Carousel, CarouselItem, CarouselProps, CastIcon, CheckCircleIcon, CheckIcon, CheckSquareIcon, Checkbox, CheckboxGroup, CheckboxGroupProps, CheckboxProps, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, ChevronsDownIcon, ChevronsLeftIcon, ChevronsRightIcon, ChevronsUpIcon, Chip, ChipGroup, ChipGroupProps, ChipProps, ChromeIcon, CircleIcon, ClipboardIcon, ClockIcon, CloseIcon, CloudDrizzleIcon, CloudIcon, CloudLightningIcon, CloudOffIcon, CloudRainIcon, CloudSnowIcon, Code, CodeProps, CodepenIcon, CoinsIcon, Collapsible, CollapsibleBody, CollapsibleBodyProps, CollapsibleButton, CollapsibleButtonProps, CollapsibleLink, CollapsibleLinkProps, CollapsibleProps, CommandIcon, CompassIcon, ComponentIds, CopyIcon, CornerDownLeftIcon, CornerDownRightIcon, CornerLeftDownIcon, CornerLeftUpIcon, CornerRightDownIcon, CornerRightUpIcon, CornerUpLeftIcon, CornerUpRightIcon, Counter, CounterProps, CpuIcon, CreditCardIcon, CropIcon, CrosshairIcon, CustomersIcon, CutIcon, DashboardIcon, DeleteIcon, DiscIcon, Display, DisplayProps, Divider, DividerProps, DollarIcon, DollarsIcon, DownloadCloudIcon, DownloadIcon, Dropdown, DropdownButton, DropdownFooter, DropdownHeader, DropdownLink, DropdownOverlay, DropdownOverlayProps, DropdownProps, DropletIcon, EditComposeIcon, EditIcon, EditInlineIcon, ExportIcon, ExternalLinkIcon, EyeIcon, EyeOffIcon, FacebookIcon, FastForwardIcon, FeatherIcon, FileIcon, FileMinusIcon, FilePlusIcon, FileTextIcon, FileZipIcon, FilmIcon, FilterIcon, FlagIcon, FolderIcon, FullScreenEnterIcon, FullScreenExitIcon, GithubIcon, GitlabIcon, GlobeIcon, GridIcon, HashIcon, Heading, HeadingProps, HeadphonesIcon, HeartIcon, HelpCircleIcon, HistoryIcon, HomeIcon, IconButton, IconButtonProps, IconColors, IconComponent, IconProps, IconSize, Identifier, ImageIcon, InboxIcon, Indicator, IndicatorProps, InfoIcon, InstagramIcon, InvoicesIcon, ItalicIcon, LayersIcon, LayoutIcon, LifeBuoyIcon, Link, LinkButtonVariantProps, LinkIcon, LinkProps, List, ListIcon, ListItem, ListItemCode, ListItemCodeProps, ListItemLink, ListItemLinkProps, ListItemProps, ListItemText, ListItemTextProps, ListProps, LoaderIcon, LockIcon, LogInIcon, LogOutIcon, MailIcon, MailOpenIcon, MapIcon, MapPinIcon, MaximizeIcon, MenuDotsIcon, MenuIcon, MessageCircleIcon, MessageSquareIcon, MicIcon, MicOffIcon, MinimizeIcon, MinusCircleIcon, MinusIcon, MinusSquareIcon, Modal, ModalBody, ModalBodyProps, ModalFooter, ModalFooterProps, ModalHeader, ModalHeaderProps, ModalProps, MonitorIcon, MoonIcon, MoreHorizontalIcon, MoreVerticalIcon, MoveIcon, MusicIcon, MyAccountIcon, NavigationIcon, OTPInput, OTPInputCommonProps, OTPInputProps, OctagonIcon, OffersIcon, PackageIcon, PaperclipIcon, PasswordInput, PasswordInputProps, PauseCircleIcon, PauseIcon, PaymentButtonsIcon, PaymentLinksIcon, PaymentPagesIcon, PercentIcon, PhoneCallIcon, PhoneForwardedIcon, PhoneIcon, PhoneIncomingIcon, PhoneMissedIcon, PhoneOffIcon, PhoneOutgoingIcon, PieChartIcon, PlayCircleIcon, PlayIcon, PlusCircleIcon, PlusIcon, PlusSquareIcon, PocketIcon, Popover, PopoverInteractiveWrapper, PopoverProps, PopoverTriggerProps, PowerIcon, PrinterIcon, ProgressBar, ProgressBarProps, ProgressBarVariant, QRCodeIcon, Radio, RadioGroup, RadioGroupProps, RadioIcon, RadioProps, RazorpayIcon, RazorpayXIcon, RefreshIcon, RepeatIcon, ReportsIcon, RewindIcon, RotateClockWiseIcon, RotateCounterClockWiseIcon, RoutesIcon, RupeeIcon, RupeesIcon, SaveIcon, ScissorsIcon, SearchIcon, SelectInput, SelectInputProps, SendIcon, ServerIcon, SettingsIcon, SettlementsIcon, ShareIcon, ShieldIcon, ShoppingCartIcon, ShuffleIcon, SidebarIcon, Skeleton, SkeletonProps, SkipBackIcon, SkipForwardIcon, SkipNavContent, SkipNavLink, SlackIcon, SlashIcon, SlidersIcon, SmartCollectIcon, SmartphoneIcon, SpeakerIcon, Spinner, SpinnerProps, SpotlightPopoverStepRenderProps, SpotlightPopoverTour, SpotlightPopoverTourFooter, SpotlightPopoverTourProps, SpotlightPopoverTourStep, SpotlightPopoverTourSteps, SquareIcon, StampIcon, StarIcon, StopCircleIcon, SubscriptionsIcon, SunIcon, SunriseIcon, SunsetIcon, Switch, SwitchProps, TabItem, TabItemProps, TabList, TabPanel, TabPanelProps, Table, TableBackgroundColors, TableBody, TableBodyProps, TableCell, TableCellProps, TableData, TableFooter, TableFooterCell, TableFooterCellProps, TableFooterProps, TableFooterRow, TableFooterRowProps, TableHeader, TableHeaderCell, TableHeaderCellProps, TableHeaderProps, TableHeaderRow, TableHeaderRowProps, TableNode, TablePagination, TablePaginationCommonProps, TablePaginationProps, TablePaginationType, TableProps, TableRow, TableRowProps, TableToolbar, TableToolbarActions, TableToolbarActionsProps, TableToolbarProps, TabletIcon, Tabs, TabsProps, Tag, TagIcon, TagProps, TargetIcon, Text, TextArea, TextAreaProps, TextInput, TextInputProps, TextProps, TextVariant, Theme, ThermometerIcon, ThumbsDownIcon, ThumbsUpIcon, ToastContainer, ToastProps, ToggleLeftIcon, ToggleRightIcon, Tooltip, TooltipInteractiveWrapper, TooltipProps, TransactionsIcon, TrashIcon, TrendingDownIcon, TrendingUpIcon, TriangleIcon, TvIcon, TwitterIcon, TypeIcon, UmbrellaIcon, UnderlineIcon, UnlockIcon, UploadCloudIcon, UploadIcon, UseToastReturn, UserCheckIcon, UserIcon, UserMinusIcon, UserPlusIcon, UserXIcon, UsersIcon, VideoIcon, VideoOffIcon, VisuallyHidden, VisuallyHiddenProps, VoicemailIcon, VolumeHighIcon, VolumeIcon, VolumeLowIcon, VolumeMuteIcon, WatchIcon, WifiIcon, WifiOffIcon, WindIcon, XCircleIcon, XSquareIcon, ZapIcon, ZoomInIcon, ZoomOutIcon, announce, clearAnnouncer, destroyAnnouncer, getTextProps, screenReaderStyles, useTheme, useToast };