@razorpay/blade 12.66.0 → 12.67.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 (30) hide show
  1. package/build/lib/native/components/Popover/Popover.native.js +1 -1
  2. package/build/lib/native/components/Popover/Popover.native.js.map +1 -1
  3. package/build/lib/native/components/Popover/PopoverContent.js +1 -1
  4. package/build/lib/native/components/Popover/PopoverContent.js.map +1 -1
  5. package/build/lib/native/components/Popover/PopoverContext.js.map +1 -1
  6. package/build/lib/web/development/components/Popover/Popover.web.js +13 -7
  7. package/build/lib/web/development/components/Popover/Popover.web.js.map +1 -1
  8. package/build/lib/web/development/components/Popover/PopoverContent.js +8 -3
  9. package/build/lib/web/development/components/Popover/PopoverContent.js.map +1 -1
  10. package/build/lib/web/development/components/Popover/PopoverContext.js.map +1 -1
  11. package/build/lib/web/development/components/SpotlightPopoverTour/TourPopover.web.js +2 -1
  12. package/build/lib/web/development/components/SpotlightPopoverTour/TourPopover.web.js.map +1 -1
  13. package/build/lib/web/development/components/Toast/ToastContainer.web.js +15 -5
  14. package/build/lib/web/development/components/Toast/ToastContainer.web.js.map +1 -1
  15. package/build/lib/web/development/components/Toast/constants.js +1 -1
  16. package/build/lib/web/development/components/Toast/constants.js.map +1 -1
  17. package/build/lib/web/production/components/Popover/Popover.web.js +13 -7
  18. package/build/lib/web/production/components/Popover/Popover.web.js.map +1 -1
  19. package/build/lib/web/production/components/Popover/PopoverContent.js +8 -3
  20. package/build/lib/web/production/components/Popover/PopoverContent.js.map +1 -1
  21. package/build/lib/web/production/components/Popover/PopoverContext.js.map +1 -1
  22. package/build/lib/web/production/components/SpotlightPopoverTour/TourPopover.web.js +2 -1
  23. package/build/lib/web/production/components/SpotlightPopoverTour/TourPopover.web.js.map +1 -1
  24. package/build/lib/web/production/components/Toast/ToastContainer.web.js +15 -5
  25. package/build/lib/web/production/components/Toast/ToastContainer.web.js.map +1 -1
  26. package/build/lib/web/production/components/Toast/constants.js +1 -1
  27. package/build/lib/web/production/components/Toast/constants.js.map +1 -1
  28. package/build/types/components/index.d.ts +15 -2
  29. package/build/types/components/index.native.d.ts +6 -0
  30. package/package.json +2 -2
@@ -1 +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, MetaConstants } from '~utils/metaAttribute';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\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: number = 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)} ${theme.motion.easing.standard}`,\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 & { offsetBottom?: number }> = ({\n reverseOrder,\n position = 'top-center',\n offsetBottom,\n toastOptions,\n containerClassName,\n ...rest\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 defaultGutter = isMobile ? CONTAINER_GUTTER_MOBILE : CONTAINER_GUTTER_DESKTOP;\n const bottomGutter = offsetBottom ?? defaultGutter;\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(defaultGutter)}\n left={makeSize(defaultGutter)}\n right={makeSize(defaultGutter)}\n bottom={makeSize(bottomGutter)}\n width={`calc(100% - ${defaultGutter * 2}px)`}\n maxWidth={makeSize(TOAST_MAX_WIDTH)}\n pointerEvents=\"none\"\n className={containerClassName}\n {...metaAttribute({ name: MetaConstants.ToastContainer })}\n {...makeAnalyticsAttribute(rest)}\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\ntype ToastContainerProps = {\n /**\n * The offset from the bottom of the screen to the toast container.\n * This is useful when you want to position the toast container at a different\n * position from the bottom of the screen.\n *\n * @default isMobile ? 16px : 24px\n */\n offsetBottom?: number;\n};\n\nconst ToastContainer = ({ offsetBottom }: ToastContainerProps): React.ReactElement => {\n return <Toaster offsetBottom={offsetBottom} 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","transitionProperty","transform","isPromotionalToast","toast","type","Toaster","_ref2","_promoToasts$","_promoToasts$0$height","_promoToasts$2","reverseOrder","_ref2$position","offsetBottom","toastOptions","containerClassName","rest","_objectWithoutProperties","_excluded","_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","defaultGutter","CONTAINER_GUTTER_MOBILE","CONTAINER_GUTTER_DESKTOP","bottomGutter","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","metaAttribute","name","MetaConstants","ToastContainer","makeAnalyticsAttribute","children","_jsx","onMouseEnter","onMouseLeave","onClick","testID","map","_toast$position","toastPosition","_calculateYPosition","positionStyle","ref","el","getBoundingClientRect","updateHeight","toastHeight","style","overflow","resolveValue","message","_ref4"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,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,OAAe,GAAGJ,SAAS,GAAG,CAAC,GAAG,CAAC,CAAA;AACvC;AACA;AACA,EAAA,IAAIC,KAAK,GAAGI,KAAK,GAAGC,UAAU,EAAE;AAC9BF,IAAAA,OAAO,GAAG,CAAC,CAAA;AACb,GAAC,MAAM,IAAID,aA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Q,EAAC,aAAA;AAAa,GAAE,CAAC,CAAA;AACvE;;;;"}
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, MetaConstants } from '~utils/metaAttribute';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\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: number = 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)} ${theme.motion.easing.standard}`,\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 & { offsetBottom?: number; zIndex?: number }> = ({\n reverseOrder,\n position = 'top-center',\n offsetBottom,\n zIndex,\n toastOptions,\n containerClassName,\n ...rest\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 defaultGutter = isMobile ? CONTAINER_GUTTER_MOBILE : CONTAINER_GUTTER_DESKTOP;\n const bottomGutter = offsetBottom ?? defaultGutter;\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 // Use container zIndex if provided, otherwise use default\n const containerZIndex = zIndex ?? TOAST_Z_INDEX;\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={containerZIndex}\n top={makeSize(defaultGutter)}\n left={makeSize(defaultGutter)}\n right={makeSize(defaultGutter)}\n bottom={makeSize(bottomGutter)}\n width={`calc(100% - ${defaultGutter * 2}px)`}\n maxWidth={makeSize(TOAST_MAX_WIDTH)}\n pointerEvents=\"none\"\n className={containerClassName}\n {...metaAttribute({ name: MetaConstants.ToastContainer })}\n {...makeAnalyticsAttribute(rest)}\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 // Maintain relative stacking order (newer toasts in front)\n // Use -1 * index so newer toasts (lower index) have higher z-index values\n const wrapperZIndex = -1 * index;\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: wrapperZIndex,\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\ntype ToastContainerProps = {\n /**\n * The offset from the bottom of the screen to the toast container.\n * This is useful when you want to position the toast container at a different\n * position from the bottom of the screen.\n *\n * @default isMobile ? 16px : 24px\n */\n offsetBottom?: number;\n /**\n * Custom z-index value for the toast container.\n * This is useful when you want to position toasts above other elements like modals.\n *\n * @default 2001\n */\n zIndex?: number;\n};\n\nconst ToastContainer = ({ offsetBottom, zIndex }: ToastContainerProps): React.ReactElement => {\n return <Toaster offsetBottom={offsetBottom} zIndex={zIndex} 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","transitionProperty","transform","isPromotionalToast","toast","type","Toaster","_ref2","_promoToasts$","_promoToasts$0$height","_promoToasts$2","reverseOrder","_ref2$position","offsetBottom","zIndex","toastOptions","containerClassName","rest","_objectWithoutProperties","_excluded","_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","defaultGutter","CONTAINER_GUTTER_MOBILE","CONTAINER_GUTTER_DESKTOP","bottomGutter","infoToasts","useMemo","filter","promoToasts","recomputedToasts","_toConsumableArray","hasPromoToast","length","visible","promoToastHeight","height","containerZIndex","TOAST_Z_INDEX","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","makeSize","width","maxWidth","TOAST_MAX_WIDTH","className","metaAttribute","name","MetaConstants","ToastContainer","makeAnalyticsAttribute","children","_jsx","onMouseEnter","onMouseLeave","onClick","testID","map","_toast$position","toastPosition","_calculateYPosition","positionStyle","ref","el","getBoundingClientRect","updateHeight","toastHeight","wrapperZIndex","style","overflow","resolveValue","message","_ref4"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,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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AAA,EAAA,EAAA;AAAElC,YAAAA,KAAK,EAALA,KAAAA;WAAO,CAAA,CAAA;SACzC,CAAA;OA3BJkC,EAAAA,KAAK,CAACsE,EA4BO,CAAC,CAAA;AAEzB,KAAC,CAAC,CAAA;AAAA,GAAA,CACK,CAAC,CAAA;AAEd,CAAC,CAAA;AAoBD,IAAM0B,cAAc,GAAG,SAAjBA,cAAcA,CAAAuB,KAAA,EAA0E;AAAA,EAAA,IAApE9G,YAAY,GAAA8G,KAAA,CAAZ9G,YAAY;IAAEC,MAAM,GAAA6G,KAAA,CAAN7G,MAAM,CAAA;EAC5C,oBAAOyF,GAAA,CAACjG,OAAO,EAAA;AAACO,IAAAA,YAAY,EAAEA,YAAa;AAACC,IAAAA,MAAM,EAAEA,MAAO;AAACpC,IAAAA,QAAQ,EAAC,aAAA;AAAa,GAAE,CAAC,CAAA;AACvF;;;;"}
@@ -3,7 +3,7 @@ import { size } from '../../tokens/global/size.js';
3
3
 
4
4
  var TOAST_MAX_WIDTH = size['360'];
5
5
  // higher than modal
6
- var TOAST_Z_INDEX = 2000;
6
+ var TOAST_Z_INDEX = 2001;
7
7
 
8
8
  // Space between the toasts
9
9
  var GUTTER = 12;
@@ -1 +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;;;;"}
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 = 2001;\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;;;;"}
@@ -20489,6 +20489,12 @@ type PopoverProps = {
20489
20489
  * @default PopoverCloseButton
20490
20490
  */
20491
20491
  initialFocusRef?: React__default.RefObject<any>;
20492
+ /**
20493
+ * Should popover open on click or hover
20494
+ *
20495
+ * @default 'click'
20496
+ */
20497
+ openInteraction?: 'hover' | 'click';
20492
20498
  } & DataAnalyticsAttribute;
20493
20499
  /**
20494
20500
  * PopoverTriggerProps
@@ -20522,7 +20528,7 @@ type PopoverTriggerProps = {
20522
20528
  }>;
20523
20529
  };
20524
20530
 
20525
- declare const Popover: ({ content, title, titleLeading, footer, children, placement, onOpenChange, zIndex, isOpen, defaultIsOpen, initialFocusRef, ...rest }: PopoverProps) => React__default.ReactElement;
20531
+ declare const Popover: ({ content, title, titleLeading, footer, children, placement, onOpenChange, zIndex, isOpen, defaultIsOpen, initialFocusRef, openInteraction, ...rest }: PopoverProps) => React__default.ReactElement;
20526
20532
 
20527
20533
  type PopoverInteractiveWrapper = {
20528
20534
  /**
@@ -26163,8 +26169,15 @@ type ToastContainerProps = {
26163
26169
  * @default isMobile ? 16px : 24px
26164
26170
  */
26165
26171
  offsetBottom?: number;
26172
+ /**
26173
+ * Custom z-index value for the toast container.
26174
+ * This is useful when you want to position toasts above other elements like modals.
26175
+ *
26176
+ * @default 2001
26177
+ */
26178
+ zIndex?: number;
26166
26179
  };
26167
- declare const ToastContainer: ({ offsetBottom }: ToastContainerProps) => React__default.ReactElement;
26180
+ declare const ToastContainer: ({ offsetBottom, zIndex }: ToastContainerProps) => React__default.ReactElement;
26168
26181
 
26169
26182
  type ToastProps = {
26170
26183
  /**
@@ -13345,6 +13345,12 @@ type PopoverProps = {
13345
13345
  * @default PopoverCloseButton
13346
13346
  */
13347
13347
  initialFocusRef?: react__default.RefObject<any>;
13348
+ /**
13349
+ * Should popover open on click or hover
13350
+ *
13351
+ * @default 'click'
13352
+ */
13353
+ openInteraction?: 'hover' | 'click';
13348
13354
  } & DataAnalyticsAttribute;
13349
13355
  /**
13350
13356
  * PopoverTriggerProps
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@razorpay/blade",
3
3
  "description": "The Design System that powers Razorpay",
4
- "version": "12.66.0",
4
+ "version": "12.67.0",
5
5
  "license": "MIT",
6
6
  "engines": {
7
7
  "node": ">=18.12.1"
@@ -111,7 +111,7 @@
111
111
  "react-native:storybook:start": "yarn react-native:get-stories && cross-env NODE_OPTIONS=--openssl-legacy-provider FRAMEWORK=REACT_NATIVE react-native start --reset-cache",
112
112
  "react": "yarn run react:storybook",
113
113
  "react:storybook": "cross-env FRAMEWORK=REACT storybook dev -c ./.storybook/react -p 9009",
114
- "react:storybook:build": "yarn generate-docs-lockfile && cross-env FRAMEWORK=REACT storybook build -c ./.storybook/react -o storybook-site --quiet",
114
+ "react:storybook:build": "bash ./scripts/buildStorybook.sh",
115
115
  "react:storybook:serve": "http-server storybook-site --port 9009 --silent",
116
116
  "react:storybook:serve:test": "wait-on http://127.0.0.1:9009/ && yarn test:react:interaction",
117
117
  "test:react:interaction": "cross-env FRAMEWORK=REACT test-storybook -c ./.storybook/react --url http://127.0.0.1:9009/",