@cloudscape-design/components-themeable 3.0.1079 → 3.0.1081

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 (130) hide show
  1. package/lib/internal/manifest.json +1 -1
  2. package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +84 -80
  3. package/lib/internal/scss/popover/body.scss +4 -0
  4. package/lib/internal/template/alert/styles.css.js +27 -27
  5. package/lib/internal/template/alert/styles.scoped.css +46 -46
  6. package/lib/internal/template/alert/styles.selectors.js +27 -27
  7. package/lib/internal/template/annotation-context/annotation/styles.css.js +24 -24
  8. package/lib/internal/template/annotation-context/annotation/styles.scoped.css +32 -32
  9. package/lib/internal/template/annotation-context/annotation/styles.selectors.js +24 -24
  10. package/lib/internal/template/app-layout/notifications/styles.css.js +3 -3
  11. package/lib/internal/template/app-layout/notifications/styles.scoped.css +7 -7
  12. package/lib/internal/template/app-layout/notifications/styles.selectors.js +3 -3
  13. package/lib/internal/template/app-layout/visual-refresh/styles.css.js +86 -86
  14. package/lib/internal/template/app-layout/visual-refresh/styles.scoped.css +258 -258
  15. package/lib/internal/template/app-layout/visual-refresh/styles.selectors.js +86 -86
  16. package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/styles.css.js +17 -17
  17. package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/styles.scoped.css +39 -39
  18. package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/styles.selectors.js +17 -17
  19. package/lib/internal/template/app-layout/visual-refresh-toolbar/navigation/styles.css.js +4 -4
  20. package/lib/internal/template/app-layout/visual-refresh-toolbar/navigation/styles.scoped.css +7 -7
  21. package/lib/internal/template/app-layout/visual-refresh-toolbar/navigation/styles.selectors.js +4 -4
  22. package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/styles.css.js +23 -23
  23. package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/styles.scoped.css +46 -46
  24. package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/styles.selectors.js +23 -23
  25. package/lib/internal/template/attribute-editor/styles.css.js +15 -15
  26. package/lib/internal/template/attribute-editor/styles.scoped.css +28 -28
  27. package/lib/internal/template/attribute-editor/styles.selectors.js +15 -15
  28. package/lib/internal/template/breadcrumb-group/item/styles.css.js +7 -7
  29. package/lib/internal/template/breadcrumb-group/item/styles.scoped.css +28 -28
  30. package/lib/internal/template/breadcrumb-group/item/styles.selectors.js +7 -7
  31. package/lib/internal/template/button/styles.css.js +22 -22
  32. package/lib/internal/template/button/styles.scoped.css +212 -212
  33. package/lib/internal/template/button/styles.selectors.js +22 -22
  34. package/lib/internal/template/button-dropdown/item-element/styles.css.js +16 -16
  35. package/lib/internal/template/button-dropdown/item-element/styles.scoped.css +27 -27
  36. package/lib/internal/template/button-dropdown/item-element/styles.selectors.js +16 -16
  37. package/lib/internal/template/button-group/index.d.ts.map +1 -1
  38. package/lib/internal/template/button-group/index.js +2 -2
  39. package/lib/internal/template/button-group/index.js.map +1 -1
  40. package/lib/internal/template/button-group/interfaces.d.ts +40 -0
  41. package/lib/internal/template/button-group/interfaces.d.ts.map +1 -1
  42. package/lib/internal/template/button-group/interfaces.js.map +1 -1
  43. package/lib/internal/template/button-group/internal.d.ts.map +1 -1
  44. package/lib/internal/template/button-group/internal.js +5 -3
  45. package/lib/internal/template/button-group/internal.js.map +1 -1
  46. package/lib/internal/template/button-group/item-element.d.ts +1 -0
  47. package/lib/internal/template/button-group/item-element.d.ts.map +1 -1
  48. package/lib/internal/template/button-group/item-element.js +4 -2
  49. package/lib/internal/template/button-group/item-element.js.map +1 -1
  50. package/lib/internal/template/button-group/style.d.ts +13 -0
  51. package/lib/internal/template/button-group/style.d.ts.map +1 -0
  52. package/lib/internal/template/button-group/style.js +37 -0
  53. package/lib/internal/template/button-group/style.js.map +1 -0
  54. package/lib/internal/template/checkbox/styles.css.js +3 -3
  55. package/lib/internal/template/checkbox/styles.scoped.css +11 -11
  56. package/lib/internal/template/checkbox/styles.selectors.js +3 -3
  57. package/lib/internal/template/content-layout/styles.css.js +14 -14
  58. package/lib/internal/template/content-layout/styles.scoped.css +27 -27
  59. package/lib/internal/template/content-layout/styles.selectors.js +14 -14
  60. package/lib/internal/template/date-range-picker/time-offset.d.ts +1 -1
  61. package/lib/internal/template/date-range-picker/time-offset.d.ts.map +1 -1
  62. package/lib/internal/template/date-range-picker/time-offset.js +7 -3
  63. package/lib/internal/template/date-range-picker/time-offset.js.map +1 -1
  64. package/lib/internal/template/flashbar/collapsible-flashbar.d.ts.map +1 -1
  65. package/lib/internal/template/flashbar/collapsible-flashbar.js +3 -5
  66. package/lib/internal/template/flashbar/collapsible-flashbar.js.map +1 -1
  67. package/lib/internal/template/flashbar/common.d.ts.map +1 -1
  68. package/lib/internal/template/flashbar/common.js +2 -5
  69. package/lib/internal/template/flashbar/common.js.map +1 -1
  70. package/lib/internal/template/flashbar/flash.d.ts +1 -1
  71. package/lib/internal/template/flashbar/flash.d.ts.map +1 -1
  72. package/lib/internal/template/flashbar/flash.js +4 -2
  73. package/lib/internal/template/flashbar/flash.js.map +1 -1
  74. package/lib/internal/template/flashbar/style.d.ts.map +1 -1
  75. package/lib/internal/template/flashbar/style.js +16 -31
  76. package/lib/internal/template/flashbar/style.js.map +1 -1
  77. package/lib/internal/template/flashbar/styles.css.js +50 -50
  78. package/lib/internal/template/flashbar/styles.scoped.css +187 -187
  79. package/lib/internal/template/flashbar/styles.selectors.js +50 -50
  80. package/lib/internal/template/flashbar/utils.d.ts +2 -1
  81. package/lib/internal/template/flashbar/utils.d.ts.map +1 -1
  82. package/lib/internal/template/flashbar/utils.js +4 -1
  83. package/lib/internal/template/flashbar/utils.js.map +1 -1
  84. package/lib/internal/template/help-panel/styles.css.js +6 -6
  85. package/lib/internal/template/help-panel/styles.scoped.css +73 -73
  86. package/lib/internal/template/help-panel/styles.selectors.js +6 -6
  87. package/lib/internal/template/internal/base-component/styles.scoped.css +1 -1
  88. package/lib/internal/template/internal/components/drag-handle-wrapper/styles.css.js +21 -21
  89. package/lib/internal/template/internal/components/drag-handle-wrapper/styles.scoped.css +44 -44
  90. package/lib/internal/template/internal/components/drag-handle-wrapper/styles.selectors.js +21 -21
  91. package/lib/internal/template/internal/components/dropdown/styles.css.js +20 -20
  92. package/lib/internal/template/internal/components/dropdown/styles.scoped.css +38 -38
  93. package/lib/internal/template/internal/components/dropdown/styles.selectors.js +20 -20
  94. package/lib/internal/template/internal/components/token-list/styles.css.js +10 -10
  95. package/lib/internal/template/internal/components/token-list/styles.scoped.css +25 -25
  96. package/lib/internal/template/internal/components/token-list/styles.selectors.js +10 -10
  97. package/lib/internal/template/internal/environment.js +2 -2
  98. package/lib/internal/template/internal/environment.json +2 -2
  99. package/lib/internal/template/internal/generated/custom-css-properties/index.d.ts +4 -0
  100. package/lib/internal/template/internal/generated/custom-css-properties/index.d.ts.map +1 -1
  101. package/lib/internal/template/internal/generated/custom-css-properties/index.js +83 -79
  102. package/lib/internal/template/internal/generated/custom-css-properties/index.js.map +1 -1
  103. package/lib/internal/template/internal/utils/date-time/format-time-offset.d.ts.map +1 -1
  104. package/lib/internal/template/internal/utils/date-time/format-time-offset.js +3 -0
  105. package/lib/internal/template/internal/utils/date-time/format-time-offset.js.map +1 -1
  106. package/lib/internal/template/link/styles.css.js +20 -20
  107. package/lib/internal/template/link/styles.scoped.css +103 -103
  108. package/lib/internal/template/link/styles.selectors.js +20 -20
  109. package/lib/internal/template/popover/styles.css.js +56 -56
  110. package/lib/internal/template/popover/styles.scoped.css +85 -84
  111. package/lib/internal/template/popover/styles.selectors.js +56 -56
  112. package/lib/internal/template/radio-group/styles.css.js +10 -10
  113. package/lib/internal/template/radio-group/styles.scoped.css +22 -22
  114. package/lib/internal/template/radio-group/styles.selectors.js +10 -10
  115. package/lib/internal/template/slider/styles.css.js +26 -26
  116. package/lib/internal/template/slider/styles.scoped.css +86 -86
  117. package/lib/internal/template/slider/styles.selectors.js +26 -26
  118. package/lib/internal/template/spinner/styles.css.js +13 -13
  119. package/lib/internal/template/spinner/styles.scoped.css +39 -39
  120. package/lib/internal/template/spinner/styles.selectors.js +13 -13
  121. package/lib/internal/template/tag-editor/styles.css.js +3 -3
  122. package/lib/internal/template/tag-editor/styles.scoped.css +13 -13
  123. package/lib/internal/template/tag-editor/styles.selectors.js +3 -3
  124. package/lib/internal/template/text-content/styles.css.js +1 -1
  125. package/lib/internal/template/text-content/styles.scoped.css +66 -66
  126. package/lib/internal/template/text-content/styles.selectors.js +1 -1
  127. package/lib/internal/template/toggle/styles.css.js +10 -10
  128. package/lib/internal/template/toggle/styles.scoped.css +23 -23
  129. package/lib/internal/template/toggle/styles.selectors.js +10 -10
  130. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"collapsible-flashbar.js","sourceRoot":"","sources":["../../../src/flashbar/collapsible-flashbar.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAa,WAAW,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAClG,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAC5E,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AAClF,OAAO,cAAc,MAAM,6CAA6C,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAA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AAQ,EACR,KAAK,EACL,KAAK,GAKN,EAAE,EAAE;IACH,OAAO,CACL,8BAAM,SAAS,EAAE,MAAM,CAAC,YAAY,CAAC;QACnC,8BAAM,KAAK,EAAE,KAAK;YAChB,oBAAC,YAAY,IAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,GAAI,CAC7C;QACP,8BAAM,SAAS,EAAE,MAAM,CAAC,cAAc,CAAC,IAAG,KAAK,CAAQ,CAClD,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAgD,EAAE,EAAE,CAC7F,UAAU,CAAC,CAAC,CAAC,oBAAC,eAAe,IAAC,SAAS,EAAE,IAAI,IAAG,QAAQ,CAAmB,CAAC,CAAC,CAAC,0CAAG,QAAQ,CAAI,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { ReactNode, useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';\nimport { TransitionGroup } from 'react-transition-group';\nimport clsx from 'clsx';\n\nimport { findUpUntil } from '@cloudscape-design/component-toolkit/dom';\nimport { useUniqueId } from '@cloudscape-design/component-toolkit/internal';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { useInternalI18n } from '../i18n/context';\nimport { IconProps } from '../icon/interfaces';\nimport InternalIcon from '../icon/internal';\nimport { animate, getDOMRects } from '../internal/animate';\nimport { Transition } from '../internal/components/transition';\nimport { getVisualContextClassname } from '../internal/components/visual-context';\nimport customCssProps from '../internal/generated/custom-css-properties';\nimport { useDebounceCallback } from '../internal/hooks/use-debounce-callback';\nimport { useEffectOnUpdate } from '../internal/hooks/use-effect-on-update';\nimport { scrollElementIntoView } from '../internal/utils/scrollable-containers';\nimport { throttle } from '../internal/utils/throttle';\nimport {\n GeneratedAnalyticsMetadataFlashbarCollapse,\n GeneratedAnalyticsMetadataFlashbarExpand,\n} from './analytics-metadata/interfaces';\nimport { getComponentsAnalyticsMetadata, getItemAnalyticsMetadata } from './analytics-metadata/utils';\nimport { useFlashbar } from './common';\nimport { Flash, focusFlashById } from './flash';\nimport { FlashbarProps } from './interfaces';\nimport { getCollapsibleFlashStyles, getNotificationBarStyles } from './style';\nimport {\n counterTypes,\n FOCUS_DEBOUNCE_DELAY,\n getFlashTypeCount,\n getItemColor,\n getVisibleCollapsedItems,\n StackableItem,\n} from './utils';\n\nimport styles from './styles.css.js';\n\n// If the number of items is equal or less than this value,\n// the toggle element will not be displayed and the Flashbar will look like a regular single-item Flashbar.\nconst maxNonCollapsibleItems = 1;\n\nconst resizeListenerThrottleDelay = 100;\n\nexport default function CollapsibleFlashbar({ items, style, ...restProps }: FlashbarProps) {\n const [enteringItems, setEnteringItems] = useState<ReadonlyArray<FlashbarProps.MessageDefinition>>([]);\n const [exitingItems, setExitingItems] = useState<ReadonlyArray<FlashbarProps.MessageDefinition>>([]);\n const [isFlashbarStackExpanded, setIsFlashbarStackExpanded] = useState(false);\n\n const getElementsToAnimate = useCallback(() => {\n const flashElements = isFlashbarStackExpanded ? expandedItemRefs.current : collapsedItemRefs.current;\n return { ...flashElements, notificationBar: notificationBarRef.current };\n }, [isFlashbarStackExpanded]);\n\n const prepareAnimations = useCallback(() => {\n const rects = getDOMRects(getElementsToAnimate());\n setInitialAnimationState(rects);\n }, [getElementsToAnimate]);\n\n const collapsedItemRefs = useRef<Record<string, HTMLElement | null>>({});\n const expandedItemRefs = useRef<Record<string, HTMLElement | null>>({});\n const [initialAnimationState, setInitialAnimationState] = useState<Record<string, DOMRect> | null>(null);\n const listElementRef = useRef<HTMLUListElement | null>(null);\n const notificationBarRef = useRef<HTMLDivElement | null>(null);\n const [transitioning, setTransitioning] = useState(false);\n const flashbarElementId = useUniqueId('flashbar');\n const itemCountElementId = useUniqueId('item-count');\n\n const { baseProps, isReducedMotion, isVisualRefresh, mergedRef, ref, flashRefs, handleFlashDismissed } = useFlashbar({\n items,\n ...restProps,\n onItemsAdded: newItems => {\n setEnteringItems([...enteringItems, ...newItems]);\n },\n onItemsChanged: options => {\n // If not all items have ID, we can still animate collapse/expand transitions\n // because we can rely on each item's index in the original array,\n // but we can't do that when elements are added or removed, since the index changes.\n if (options?.allItemsHaveId && !options?.isReducedMotion) {\n prepareAnimations();\n }\n },\n onItemsRemoved: removedItems => {\n setExitingItems([...exitingItems, ...removedItems]);\n },\n });\n\n if (items.length <= maxNonCollapsibleItems && isFlashbarStackExpanded) {\n setIsFlashbarStackExpanded(false);\n }\n\n const animateFlash = !isReducedMotion;\n\n function toggleCollapseExpand() {\n if (!isReducedMotion) {\n prepareAnimations();\n }\n setIsFlashbarStackExpanded(prev => !prev);\n }\n\n const debouncedFocus = useDebounceCallback(focusFlashById, FOCUS_DEBOUNCE_DELAY);\n useLayoutEffect(() => {\n if (isFlashbarStackExpanded && items?.length) {\n const mostRecentItem = items[0];\n if (mostRecentItem.id !== undefined) {\n debouncedFocus(ref.current, mostRecentItem.id);\n }\n }\n // Run this after expanding, but not every time the items change.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [debouncedFocus, isFlashbarStackExpanded]);\n\n // When collapsing, scroll up if necessary to avoid losing track of the focused button\n useEffectOnUpdate(() => {\n if (!isFlashbarStackExpanded && notificationBarRef.current) {\n scrollElementIntoView(notificationBarRef.current);\n }\n }, [isFlashbarStackExpanded]);\n\n const updateBottomSpacing = useMemo(\n () =>\n throttle(() => {\n // Allow vertical space between Flashbar and page bottom only when the Flashbar is reaching the end of the page,\n // otherwise avoid spacing with eventual sticky elements below.\n const listElement = listElementRef?.current;\n const flashbar = listElement?.parentElement;\n if (listElement && flashbar) {\n // Make sure the bottom padding is present when we make the calculations,\n // then we might decide to remove it or not.\n flashbar.classList.remove(styles.floating);\n const windowHeight = window.innerHeight;\n // Take the parent region into account if using the App Layout, because it might have additional margins.\n // Otherwise we use the Flashbar component for this calculation.\n const outerElement = findUpUntil(flashbar, element => element.getAttribute('role') === 'region') || flashbar;\n const applySpacing =\n isFlashbarStackExpanded && Math.ceil(outerElement.getBoundingClientRect().bottom) >= windowHeight;\n if (!applySpacing) {\n flashbar.classList.add(styles.floating);\n }\n }\n }, resizeListenerThrottleDelay),\n [isFlashbarStackExpanded]\n );\n\n useLayoutEffect(() => {\n window.addEventListener('resize', updateBottomSpacing);\n return () => {\n window.removeEventListener('resize', updateBottomSpacing);\n updateBottomSpacing.cancel();\n };\n }, [updateBottomSpacing]);\n\n const { i18nStrings } = restProps;\n\n const i18n = useInternalI18n('flashbar');\n const ariaLabel = i18n('i18nStrings.ariaLabel', i18nStrings?.ariaLabel);\n const notificationBarText = i18n('i18nStrings.notificationBarText', i18nStrings?.notificationBarText);\n const notificationBarAriaLabel = i18n('i18nStrings.notificationBarAriaLabel', i18nStrings?.notificationBarAriaLabel);\n const iconAriaLabels = {\n errorIconAriaLabel: i18n('i18nStrings.errorIconAriaLabel', i18nStrings?.errorIconAriaLabel),\n inProgressIconAriaLabel: i18n('i18nStrings.inProgressIconAriaLabel', i18nStrings?.inProgressIconAriaLabel),\n infoIconAriaLabel: i18n('i18nStrings.infoIconAriaLabel', i18nStrings?.infoIconAriaLabel),\n successIconAriaLabel: i18n('i18nStrings.successIconAriaLabel', i18nStrings?.successIconAriaLabel),\n warningIconAriaLabel: i18n('i18nStrings.warningIconAriaLabel', i18nStrings?.warningIconAriaLabel),\n };\n\n useLayoutEffect(() => {\n // When `useLayoutEffect` is called, the DOM is updated but has not been painted yet,\n // so it's a good moment to trigger animations that will make calculations based on old and new DOM state.\n // The old state is kept in `initialAnimationState`\n // and the new state can be retrieved from the current DOM elements.\n\n if (initialAnimationState) {\n updateBottomSpacing();\n\n animate({\n elements: getElementsToAnimate(),\n oldState: initialAnimationState,\n newElementInitialState: ({ top }) => ({ scale: 0.9, y: -0.2 * top }),\n onTransitionsEnd: () => setTransitioning(false),\n });\n\n setTransitioning(true);\n setInitialAnimationState(null);\n }\n }, [updateBottomSpacing, getElementsToAnimate, initialAnimationState, isFlashbarStackExpanded]);\n\n const isCollapsible = items.length > maxNonCollapsibleItems;\n\n const countByType = getFlashTypeCount(items);\n\n const numberOfColorsInStack = new Set(items.map(getItemColor)).size;\n const maxSlots = Math.max(numberOfColorsInStack, 3);\n const stackDepth = Math.min(maxSlots, items.length);\n\n const itemsToShow = isFlashbarStackExpanded\n ? items.map((item, index) => ({ ...item, expandedIndex: index }))\n : getVisibleCollapsedItems(items, stackDepth).map((item: StackableItem, index: number) => ({\n ...item,\n collapsedIndex: index,\n }));\n\n const getItemId = (item: StackableItem | FlashbarProps.MessageDefinition) =>\n item.id ?? (item as StackableItem).expandedIndex ?? 0;\n\n // This check allows us to use the standard \"enter\" Transition only when the notification was not existing before.\n // If instead it was moved to the top of the stack but was already present in the array\n // (e.g, after dismissing another notification),\n // we need to use different, more custom and more controlled animations.\n const hasEntered = (item: StackableItem | FlashbarProps.MessageDefinition) =>\n enteringItems.some(_item => _item.id && _item.id === item.id);\n const hasLeft = (item: StackableItem | FlashbarProps.MessageDefinition) => !('expandedIndex' in item);\n const hasEnteredOrLeft = (item: StackableItem | FlashbarProps.MessageDefinition) => hasEntered(item) || hasLeft(item);\n\n const showInnerContent = (item: StackableItem | FlashbarProps.MessageDefinition) =>\n isFlashbarStackExpanded || hasLeft(item) || ('expandedIndex' in item && item.expandedIndex === 0);\n\n const shouldUseStandardAnimation = (item: StackableItem, index: number) => index === 0 && hasEnteredOrLeft(item);\n\n const getAnimationElementId = (item: StackableItem) => `flash-${getItemId(item)}`;\n\n const renderList = () => (\n <ul\n ref={listElementRef}\n className={clsx(\n styles['flash-list'],\n isFlashbarStackExpanded ? styles.expanded : styles.collapsed,\n transitioning && styles['animation-running'],\n initialAnimationState && styles['animation-ready'],\n isVisualRefresh && styles['visual-refresh']\n )}\n id={flashbarElementId}\n aria-label={ariaLabel}\n aria-describedby={isCollapsible ? itemCountElementId : undefined}\n style={\n !isFlashbarStackExpanded || transitioning\n ? {\n [customCssProps.flashbarStackDepth]: stackDepth,\n }\n : undefined\n }\n >\n <ListWrapper withMotion={!isReducedMotion}>\n {itemsToShow.map((item: StackableItem, index: number) => (\n <Transition\n key={getItemId(item)}\n in={!hasLeft(item)}\n onStatusChange={status => {\n if (status === 'entered') {\n setEnteringItems([]);\n } else if (status === 'exited') {\n setExitingItems([]);\n }\n }}\n >\n {(state: string, transitionRootElement: React.Ref<HTMLDivElement> | undefined) => (\n <li\n aria-hidden={!showInnerContent(item)}\n className={\n showInnerContent(item)\n ? clsx(\n styles['flash-list-item'],\n !isFlashbarStackExpanded && styles.item,\n !collapsedItemRefs.current[getAnimationElementId(item)] && styles['expanded-only']\n )\n : clsx(styles.flash, styles[`flash-type-${item.type ?? 'info'}`], styles.item)\n }\n ref={element => {\n if (isFlashbarStackExpanded) {\n expandedItemRefs.current[getAnimationElementId(item)] = element;\n } else {\n collapsedItemRefs.current[getAnimationElementId(item)] = element;\n }\n }}\n style={{\n ...(index > 0 && !isFlashbarStackExpanded && getCollapsibleFlashStyles(style, item.type)),\n ...((!isFlashbarStackExpanded || transitioning) && {\n [customCssProps.flashbarStackIndex]:\n (item as StackableItem).collapsedIndex ?? (item as StackableItem).expandedIndex ?? index,\n }),\n }}\n key={getItemId(item)}\n {...getAnalyticsMetadataAttribute(getItemAnalyticsMetadata(index + 1, item.type || 'info', item.id))}\n >\n {showInnerContent(item) && (\n <Flash\n className={clsx(\n animateFlash && styles['flash-with-motion'],\n isVisualRefresh && styles['flash-refresh']\n )}\n key={getItemId(item)}\n ref={(el: HTMLDivElement | null) => {\n // Store the Flash element reference for focus management\n flashRefs.current[getItemId(item)] = el;\n\n if (shouldUseStandardAnimation(item, index) && transitionRootElement) {\n if (typeof transitionRootElement === 'function') {\n transitionRootElement(el);\n } else if (\n transitionRootElement &&\n typeof transitionRootElement === 'object' &&\n 'current' in transitionRootElement\n ) {\n (transitionRootElement as React.MutableRefObject<HTMLDivElement | null>).current = el;\n }\n }\n }}\n transitionState={shouldUseStandardAnimation(item, index) ? state : undefined}\n i18nStrings={iconAriaLabels}\n style={style}\n onDismissed={handleFlashDismissed}\n {...item}\n />\n )}\n </li>\n )}\n </Transition>\n ))}\n </ListWrapper>\n </ul>\n );\n\n return (\n <div\n {...baseProps}\n className={clsx(\n baseProps.className,\n styles.flashbar,\n styles.stack,\n isCollapsible && styles.collapsible,\n items.length === 2 && styles['short-list'],\n isFlashbarStackExpanded && styles.expanded,\n isVisualRefresh && styles['visual-refresh']\n )}\n ref={mergedRef}\n {...getAnalyticsMetadataAttribute(getComponentsAnalyticsMetadata(items.length, true, isFlashbarStackExpanded))}\n >\n {isFlashbarStackExpanded && renderList()}\n {isCollapsible && (\n <div\n className={clsx(\n styles['notification-bar'],\n isVisualRefresh && styles['visual-refresh'],\n isFlashbarStackExpanded ? styles.expanded : styles.collapsed,\n transitioning && styles['animation-running'],\n items.length === 2 && styles['short-list'],\n getVisualContextClassname('flashbar') // Visual context is needed for focus ring to be white\n )}\n onClick={toggleCollapseExpand}\n ref={notificationBarRef}\n style={getNotificationBarStyles(style)}\n {...getAnalyticsMetadataAttribute({\n action: !isFlashbarStackExpanded ? 'expand' : 'collapse',\n detail: {\n label: 'h2',\n },\n } as GeneratedAnalyticsMetadataFlashbarExpand | GeneratedAnalyticsMetadataFlashbarCollapse)}\n >\n <span aria-live=\"polite\" className={styles.status} role=\"status\" id={itemCountElementId}>\n {notificationBarText && <h2 className={styles.header}>{notificationBarText}</h2>}\n <span className={styles['item-count']}>\n {counterTypes.map(({ type, labelName, iconName }) => (\n <NotificationTypeCount\n key={type}\n iconName={iconName}\n label={iconAriaLabels[labelName]}\n count={countByType[type]}\n />\n ))}\n </span>\n </span>\n <button\n aria-controls={flashbarElementId}\n aria-describedby={itemCountElementId}\n aria-expanded={isFlashbarStackExpanded}\n aria-label={notificationBarAriaLabel}\n className={clsx(styles.button, isFlashbarStackExpanded && styles.expanded)}\n >\n <InternalIcon className={styles.icon} size=\"normal\" name=\"angle-down\" />\n </button>\n </div>\n )}\n {!isFlashbarStackExpanded && renderList()}\n </div>\n );\n}\n\nconst NotificationTypeCount = ({\n iconName,\n label,\n count,\n}: {\n iconName: IconProps.Name;\n label?: string;\n count: number;\n}) => {\n return (\n <span className={styles['type-count']}>\n <span title={label}>\n <InternalIcon name={iconName} ariaLabel={label} />\n </span>\n <span className={styles['count-number']}>{count}</span>\n </span>\n );\n};\n\nconst ListWrapper = ({ children, withMotion }: { children: ReactNode; withMotion: boolean }) =>\n withMotion ? <TransitionGroup component={null}>{children}</TransitionGroup> : <>{children}</>;\n"]}
1
+ {"version":3,"file":"collapsible-flashbar.js","sourceRoot":"","sources":["../../../src/flashbar/collapsible-flashbar.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAa,WAAW,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAClG,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAC5E,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AAClF,OAAO,cAAc,MAAM,6CAA6C,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;A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,SAAS,EAAE,MAAM,CAAC,cAAc,CAAC,IAAG,KAAK,CAAQ,CAClD,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAgD,EAAE,EAAE,CAC7F,UAAU,CAAC,CAAC,CAAC,oBAAC,eAAe,IAAC,SAAS,EAAE,IAAI,IAAG,QAAQ,CAAmB,CAAC,CAAC,CAAC,0CAAG,QAAQ,CAAI,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { ReactNode, useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';\nimport { TransitionGroup } from 'react-transition-group';\nimport clsx from 'clsx';\n\nimport { findUpUntil } from '@cloudscape-design/component-toolkit/dom';\nimport { useUniqueId } from '@cloudscape-design/component-toolkit/internal';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { useInternalI18n } from '../i18n/context';\nimport { IconProps } from '../icon/interfaces';\nimport InternalIcon from '../icon/internal';\nimport { animate, getDOMRects } from '../internal/animate';\nimport { Transition } from '../internal/components/transition';\nimport { getVisualContextClassname } from '../internal/components/visual-context';\nimport customCssProps from '../internal/generated/custom-css-properties';\nimport { useEffectOnUpdate } from '../internal/hooks/use-effect-on-update';\nimport { scrollElementIntoView } from '../internal/utils/scrollable-containers';\nimport { throttle } from '../internal/utils/throttle';\nimport {\n GeneratedAnalyticsMetadataFlashbarCollapse,\n GeneratedAnalyticsMetadataFlashbarExpand,\n} from './analytics-metadata/interfaces';\nimport { getComponentsAnalyticsMetadata, getItemAnalyticsMetadata } from './analytics-metadata/utils';\nimport { useFlashbar } from './common';\nimport { Flash, focusFlashById } from './flash';\nimport { FlashbarProps } from './interfaces';\nimport { getCollapsibleFlashStyles, getNotificationBarStyles } from './style';\nimport { counterTypes, getFlashTypeCount, getItemColor, getVisibleCollapsedItems, StackableItem } from './utils';\n\nimport styles from './styles.css.js';\n\n// If the number of items is equal or less than this value,\n// the toggle element will not be displayed and the Flashbar will look like a regular single-item Flashbar.\nconst maxNonCollapsibleItems = 1;\n\nconst resizeListenerThrottleDelay = 100;\n\nexport default function CollapsibleFlashbar({ items, style, ...restProps }: FlashbarProps) {\n const [enteringItems, setEnteringItems] = useState<ReadonlyArray<FlashbarProps.MessageDefinition>>([]);\n const [exitingItems, setExitingItems] = useState<ReadonlyArray<FlashbarProps.MessageDefinition>>([]);\n const [isFlashbarStackExpanded, setIsFlashbarStackExpanded] = useState(false);\n\n const getElementsToAnimate = useCallback(() => {\n const flashElements = isFlashbarStackExpanded ? expandedItemRefs.current : collapsedItemRefs.current;\n return { ...flashElements, notificationBar: notificationBarRef.current };\n }, [isFlashbarStackExpanded]);\n\n const prepareAnimations = useCallback(() => {\n const rects = getDOMRects(getElementsToAnimate());\n setInitialAnimationState(rects);\n }, [getElementsToAnimate]);\n\n const collapsedItemRefs = useRef<Record<string, HTMLElement | null>>({});\n const expandedItemRefs = useRef<Record<string, HTMLElement | null>>({});\n const [initialAnimationState, setInitialAnimationState] = useState<Record<string, DOMRect> | null>(null);\n const listElementRef = useRef<HTMLUListElement | null>(null);\n const notificationBarRef = useRef<HTMLDivElement | null>(null);\n const [transitioning, setTransitioning] = useState(false);\n const flashbarElementId = useUniqueId('flashbar');\n const itemCountElementId = useUniqueId('item-count');\n\n const { baseProps, isReducedMotion, isVisualRefresh, mergedRef, ref, flashRefs, handleFlashDismissed } = useFlashbar({\n items,\n ...restProps,\n onItemsAdded: newItems => {\n setEnteringItems([...enteringItems, ...newItems]);\n },\n onItemsChanged: options => {\n // If not all items have ID, we can still animate collapse/expand transitions\n // because we can rely on each item's index in the original array,\n // but we can't do that when elements are added or removed, since the index changes.\n if (options?.allItemsHaveId && !options?.isReducedMotion) {\n prepareAnimations();\n }\n },\n onItemsRemoved: removedItems => {\n setExitingItems([...exitingItems, ...removedItems]);\n },\n });\n\n if (items.length <= maxNonCollapsibleItems && isFlashbarStackExpanded) {\n setIsFlashbarStackExpanded(false);\n }\n\n const animateFlash = !isReducedMotion;\n\n function toggleCollapseExpand() {\n if (!isReducedMotion) {\n prepareAnimations();\n }\n setIsFlashbarStackExpanded(prev => !prev);\n }\n\n useLayoutEffect(() => {\n if (isFlashbarStackExpanded && items?.length) {\n const mostRecentItem = items[0];\n if (mostRecentItem.id !== undefined) {\n focusFlashById(ref.current, mostRecentItem.id);\n }\n }\n // Run this after expanding, but not every time the items change.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isFlashbarStackExpanded]);\n\n // When collapsing, scroll up if necessary to avoid losing track of the focused button\n useEffectOnUpdate(() => {\n if (!isFlashbarStackExpanded && notificationBarRef.current) {\n scrollElementIntoView(notificationBarRef.current);\n }\n }, [isFlashbarStackExpanded]);\n\n const updateBottomSpacing = useMemo(\n () =>\n throttle(() => {\n // Allow vertical space between Flashbar and page bottom only when the Flashbar is reaching the end of the page,\n // otherwise avoid spacing with eventual sticky elements below.\n const listElement = listElementRef?.current;\n const flashbar = listElement?.parentElement;\n if (listElement && flashbar) {\n // Make sure the bottom padding is present when we make the calculations,\n // then we might decide to remove it or not.\n flashbar.classList.remove(styles.floating);\n const windowHeight = window.innerHeight;\n // Take the parent region into account if using the App Layout, because it might have additional margins.\n // Otherwise we use the Flashbar component for this calculation.\n const outerElement = findUpUntil(flashbar, element => element.getAttribute('role') === 'region') || flashbar;\n const applySpacing =\n isFlashbarStackExpanded && Math.ceil(outerElement.getBoundingClientRect().bottom) >= windowHeight;\n if (!applySpacing) {\n flashbar.classList.add(styles.floating);\n }\n }\n }, resizeListenerThrottleDelay),\n [isFlashbarStackExpanded]\n );\n\n useLayoutEffect(() => {\n window.addEventListener('resize', updateBottomSpacing);\n return () => {\n window.removeEventListener('resize', updateBottomSpacing);\n updateBottomSpacing.cancel();\n };\n }, [updateBottomSpacing]);\n\n const { i18nStrings } = restProps;\n\n const i18n = useInternalI18n('flashbar');\n const ariaLabel = i18n('i18nStrings.ariaLabel', i18nStrings?.ariaLabel);\n const notificationBarText = i18n('i18nStrings.notificationBarText', i18nStrings?.notificationBarText);\n const notificationBarAriaLabel = i18n('i18nStrings.notificationBarAriaLabel', i18nStrings?.notificationBarAriaLabel);\n const iconAriaLabels = {\n errorIconAriaLabel: i18n('i18nStrings.errorIconAriaLabel', i18nStrings?.errorIconAriaLabel),\n inProgressIconAriaLabel: i18n('i18nStrings.inProgressIconAriaLabel', i18nStrings?.inProgressIconAriaLabel),\n infoIconAriaLabel: i18n('i18nStrings.infoIconAriaLabel', i18nStrings?.infoIconAriaLabel),\n successIconAriaLabel: i18n('i18nStrings.successIconAriaLabel', i18nStrings?.successIconAriaLabel),\n warningIconAriaLabel: i18n('i18nStrings.warningIconAriaLabel', i18nStrings?.warningIconAriaLabel),\n };\n\n useLayoutEffect(() => {\n // When `useLayoutEffect` is called, the DOM is updated but has not been painted yet,\n // so it's a good moment to trigger animations that will make calculations based on old and new DOM state.\n // The old state is kept in `initialAnimationState`\n // and the new state can be retrieved from the current DOM elements.\n\n if (initialAnimationState) {\n updateBottomSpacing();\n\n animate({\n elements: getElementsToAnimate(),\n oldState: initialAnimationState,\n newElementInitialState: ({ top }) => ({ scale: 0.9, y: -0.2 * top }),\n onTransitionsEnd: () => setTransitioning(false),\n });\n\n setTransitioning(true);\n setInitialAnimationState(null);\n }\n }, [updateBottomSpacing, getElementsToAnimate, initialAnimationState, isFlashbarStackExpanded]);\n\n const isCollapsible = items.length > maxNonCollapsibleItems;\n\n const countByType = getFlashTypeCount(items);\n\n const numberOfColorsInStack = new Set(items.map(getItemColor)).size;\n const maxSlots = Math.max(numberOfColorsInStack, 3);\n const stackDepth = Math.min(maxSlots, items.length);\n\n const itemsToShow = isFlashbarStackExpanded\n ? items.map((item, index) => ({ ...item, expandedIndex: index }))\n : getVisibleCollapsedItems(items, stackDepth).map((item: StackableItem, index: number) => ({\n ...item,\n collapsedIndex: index,\n }));\n\n const getItemId = (item: StackableItem | FlashbarProps.MessageDefinition) =>\n item.id ?? (item as StackableItem).expandedIndex ?? 0;\n\n // This check allows us to use the standard \"enter\" Transition only when the notification was not existing before.\n // If instead it was moved to the top of the stack but was already present in the array\n // (e.g, after dismissing another notification),\n // we need to use different, more custom and more controlled animations.\n const hasEntered = (item: StackableItem | FlashbarProps.MessageDefinition) =>\n enteringItems.some(_item => _item.id && _item.id === item.id);\n const hasLeft = (item: StackableItem | FlashbarProps.MessageDefinition) => !('expandedIndex' in item);\n const hasEnteredOrLeft = (item: StackableItem | FlashbarProps.MessageDefinition) => hasEntered(item) || hasLeft(item);\n\n const showInnerContent = (item: StackableItem | FlashbarProps.MessageDefinition) =>\n isFlashbarStackExpanded || hasLeft(item) || ('expandedIndex' in item && item.expandedIndex === 0);\n\n const shouldUseStandardAnimation = (item: StackableItem, index: number) => index === 0 && hasEnteredOrLeft(item);\n\n const getAnimationElementId = (item: StackableItem) => `flash-${getItemId(item)}`;\n\n const renderList = () => (\n <ul\n ref={listElementRef}\n className={clsx(\n styles['flash-list'],\n isFlashbarStackExpanded ? styles.expanded : styles.collapsed,\n transitioning && styles['animation-running'],\n initialAnimationState && styles['animation-ready'],\n isVisualRefresh && styles['visual-refresh']\n )}\n id={flashbarElementId}\n aria-label={ariaLabel}\n aria-describedby={isCollapsible ? itemCountElementId : undefined}\n style={\n !isFlashbarStackExpanded || transitioning\n ? {\n [customCssProps.flashbarStackDepth]: stackDepth,\n }\n : undefined\n }\n >\n <ListWrapper withMotion={!isReducedMotion}>\n {itemsToShow.map((item: StackableItem, index: number) => (\n <Transition\n key={getItemId(item)}\n in={!hasLeft(item)}\n onStatusChange={status => {\n if (status === 'entered') {\n setEnteringItems([]);\n } else if (status === 'exited') {\n setExitingItems([]);\n }\n }}\n >\n {(state: string, transitionRootElement: React.Ref<HTMLDivElement> | undefined) => (\n <li\n aria-hidden={!showInnerContent(item)}\n className={\n showInnerContent(item)\n ? clsx(\n styles['flash-list-item'],\n !isFlashbarStackExpanded && styles.item,\n !collapsedItemRefs.current[getAnimationElementId(item)] && styles['expanded-only']\n )\n : clsx(styles.flash, styles[`flash-type-${item.type ?? 'info'}`], styles.item)\n }\n ref={element => {\n if (isFlashbarStackExpanded) {\n expandedItemRefs.current[getAnimationElementId(item)] = element;\n } else {\n collapsedItemRefs.current[getAnimationElementId(item)] = element;\n }\n }}\n style={{\n ...(index > 0 && !isFlashbarStackExpanded && getCollapsibleFlashStyles(style, item.type)),\n ...((!isFlashbarStackExpanded || transitioning) && {\n [customCssProps.flashbarStackIndex]:\n (item as StackableItem).collapsedIndex ?? (item as StackableItem).expandedIndex ?? index,\n }),\n }}\n key={getItemId(item)}\n {...getAnalyticsMetadataAttribute(getItemAnalyticsMetadata(index + 1, item.type || 'info', item.id))}\n >\n {showInnerContent(item) && (\n <Flash\n className={clsx(\n animateFlash && styles['flash-with-motion'],\n isVisualRefresh && styles['flash-refresh']\n )}\n key={getItemId(item)}\n ref={(el: HTMLDivElement | null) => {\n // Store the Flash element reference for focus management\n flashRefs.current[getItemId(item)] = el;\n\n if (shouldUseStandardAnimation(item, index) && transitionRootElement) {\n if (typeof transitionRootElement === 'function') {\n transitionRootElement(el);\n } else if (\n transitionRootElement &&\n typeof transitionRootElement === 'object' &&\n 'current' in transitionRootElement\n ) {\n (transitionRootElement as React.MutableRefObject<HTMLDivElement | null>).current = el;\n }\n }\n }}\n transitionState={shouldUseStandardAnimation(item, index) ? state : undefined}\n i18nStrings={iconAriaLabels}\n style={style}\n onDismissed={handleFlashDismissed}\n {...item}\n />\n )}\n </li>\n )}\n </Transition>\n ))}\n </ListWrapper>\n </ul>\n );\n\n return (\n <div\n {...baseProps}\n className={clsx(\n baseProps.className,\n styles.flashbar,\n styles.stack,\n isCollapsible && styles.collapsible,\n items.length === 2 && styles['short-list'],\n isFlashbarStackExpanded && styles.expanded,\n isVisualRefresh && styles['visual-refresh']\n )}\n ref={mergedRef}\n {...getAnalyticsMetadataAttribute(getComponentsAnalyticsMetadata(items.length, true, isFlashbarStackExpanded))}\n >\n {isFlashbarStackExpanded && renderList()}\n {isCollapsible && (\n <div\n className={clsx(\n styles['notification-bar'],\n isVisualRefresh && styles['visual-refresh'],\n isFlashbarStackExpanded ? styles.expanded : styles.collapsed,\n transitioning && styles['animation-running'],\n items.length === 2 && styles['short-list'],\n getVisualContextClassname('flashbar') // Visual context is needed for focus ring to be white\n )}\n onClick={toggleCollapseExpand}\n ref={notificationBarRef}\n style={getNotificationBarStyles(style)}\n {...getAnalyticsMetadataAttribute({\n action: !isFlashbarStackExpanded ? 'expand' : 'collapse',\n detail: {\n label: 'h2',\n },\n } as GeneratedAnalyticsMetadataFlashbarExpand | GeneratedAnalyticsMetadataFlashbarCollapse)}\n >\n <span aria-live=\"polite\" className={styles.status} role=\"status\" id={itemCountElementId}>\n {notificationBarText && <h2 className={styles.header}>{notificationBarText}</h2>}\n <span className={styles['item-count']}>\n {counterTypes.map(({ type, labelName, iconName }) => (\n <NotificationTypeCount\n key={type}\n iconName={iconName}\n label={iconAriaLabels[labelName]}\n count={countByType[type]}\n />\n ))}\n </span>\n </span>\n <button\n aria-controls={flashbarElementId}\n aria-describedby={itemCountElementId}\n aria-expanded={isFlashbarStackExpanded}\n aria-label={notificationBarAriaLabel}\n className={clsx(styles.button, isFlashbarStackExpanded && styles.expanded)}\n >\n <InternalIcon className={styles.icon} size=\"normal\" name=\"angle-down\" />\n </button>\n </div>\n )}\n {!isFlashbarStackExpanded && renderList()}\n </div>\n );\n}\n\nconst NotificationTypeCount = ({\n iconName,\n label,\n count,\n}: {\n iconName: IconProps.Name;\n label?: string;\n count: number;\n}) => {\n return (\n <span className={styles['type-count']}>\n <span title={label}>\n <InternalIcon name={iconName} ariaLabel={label} />\n </span>\n <span className={styles['count-number']}>{count}</span>\n </span>\n );\n};\n\nconst ListWrapper = ({ children, withMotion }: { children: ReactNode; withMotion: boolean }) =>\n withMotion ? <TransitionGroup component={null}>{children}</TransitionGroup> : <>{children}</>;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/flashbar/common.tsx"],"names":[],"mappings":";AAYA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAM7C,eAAO,MAAM,4BAA4B,gBAC1B,MAAM,GAAG,SAAS,SACxB,cAAc,cAAc,iBAAiB,CAAC,GAAG,SAAS,cACrD,cAAc,GAAG,IAAI,oBACf,OAAO,MAAM,GAAG,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC,SA8CjE,CAAC;AAGF,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,YAAY,EACZ,cAAc,EACd,cAAc,EACd,GAAG,SAAS,EACb,EAAE,aAAa,GAAG;IACjB,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,iBAAiB,EAAE,KAAK,IAAI,CAAC;IAClE,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,iBAAiB,EAAE,KAAK,IAAI,CAAC;IACpE,cAAc,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,OAAO,CAAC;QAAC,eAAe,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;CAC9F;;;;;;;;yCAiD6C,MAAM;EAcnD"}
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/flashbar/common.tsx"],"names":[],"mappings":";AAWA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAK7C,eAAO,MAAM,4BAA4B,gBAC1B,MAAM,GAAG,SAAS,SACxB,cAAc,cAAc,iBAAiB,CAAC,GAAG,SAAS,cACrD,cAAc,GAAG,IAAI,oBACf,OAAO,MAAM,GAAG,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC,SA8CjE,CAAC;AAGF,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,YAAY,EACZ,cAAc,EACd,cAAc,EACd,GAAG,SAAS,EACb,EAAE,aAAa,GAAG;IACjB,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,iBAAiB,EAAE,KAAK,IAAI,CAAC;IAClE,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,iBAAiB,EAAE,KAAK,IAAI,CAAC;IACpE,cAAc,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,OAAO,CAAC;QAAC,eAAe,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;CAC9F;;;;;;;;yCA+C6C,MAAM;EAcnD"}
@@ -5,11 +5,9 @@ import { useEffect, useMemo, useRef, useState } from 'react';
5
5
  import { useMergeRefs, useReducedMotion, warnOnce } from '@cloudscape-design/component-toolkit/internal';
6
6
  import { getBaseProps } from '../internal/base-component';
7
7
  import useBaseComponent from '../internal/hooks/use-base-component';
8
- import { useDebounceCallback } from '../internal/hooks/use-debounce-callback';
9
8
  import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
10
9
  import { isDevelopment } from '../internal/is-development';
11
10
  import { focusFlashById, focusFlashFocusableArea } from './flash';
12
- import { FOCUS_DEBOUNCE_DELAY } from './utils';
13
11
  import styles from './styles.css.js';
14
12
  // Exported for testing
15
13
  export const handleFlashDismissedInternal = (dismissedId, items, refCurrent, flashRefsCurrent) => {
@@ -89,12 +87,11 @@ export function useFlashbar(_a) {
89
87
  }
90
88
  }
91
89
  }
92
- const debouncedFocus = useDebounceCallback(focusFlashById, FOCUS_DEBOUNCE_DELAY);
93
90
  useEffect(() => {
94
91
  if (nextFocusId) {
95
- debouncedFocus(ref.current, nextFocusId);
92
+ focusFlashById(ref.current, nextFocusId);
96
93
  }
97
- }, [debouncedFocus, nextFocusId, ref]);
94
+ }, [nextFocusId, ref]);
98
95
  const handleFlashDismissed = (dismissedId) => {
99
96
  handleFlashDismissedInternal(dismissedId, items, ref.current, flashRefs.current);
100
97
  };
@@ -1 +1 @@
1
- {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/flashbar/common.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CAAC,CAAC;IACnF,CAAC,CAAC;IAEF,OAAO;QACL,cAAc;QACd,SAAS;QACT,eAAe;QACf,eAAe;QACf,SAAS;QACT,GAAG;QACH,SAAS;QACT,oBAAoB;KACrB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { useEffect, useMemo, useRef, useState } from 'react';\n\nimport { useMergeRefs, useReducedMotion, warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { getBaseProps } from '../internal/base-component';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useDebounceCallback } from '../internal/hooks/use-debounce-callback';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { isDevelopment } from '../internal/is-development';\nimport { focusFlashById, focusFlashFocusableArea } from './flash';\nimport { FlashbarProps } from './interfaces';\nimport { FOCUS_DEBOUNCE_DELAY } from './utils';\n\nimport styles from './styles.css.js';\n\n// Exported for testing\nexport const handleFlashDismissedInternal = (\n dismissedId: string | undefined,\n items: ReadonlyArray<FlashbarProps.MessageDefinition> | undefined,\n refCurrent: HTMLDivElement | null,\n flashRefsCurrent: Record<string | number, HTMLDivElement | null>\n) => {\n if (!items || !dismissedId || !refCurrent) {\n return;\n }\n\n const dismissedIndex = items.findIndex(item => (item.id ?? '') === dismissedId);\n if (dismissedIndex === -1) {\n return;\n }\n\n let nextItemIndex = dismissedIndex + 1;\n if (nextItemIndex >= items.length) {\n nextItemIndex = dismissedIndex - 1;\n }\n\n // If there's no next item, focus the first instance of the main element (or element with role=main)\n if (nextItemIndex < 0 || nextItemIndex >= items.length) {\n const mainElement = document.querySelector('main') ?? document.querySelector('[role=\"main\"]');\n mainElement?.focus();\n return;\n }\n\n const nextItemId = items[nextItemIndex].id ?? nextItemIndex;\n\n // Try to focus on the next item, but with a small delay to ensure the DOM is updated\n // This is especially important for collapsible flashbars where the next item might become visible\n const attemptFocus = () => {\n const nextFlashElement = flashRefsCurrent[nextItemId];\n if (!nextFlashElement) {\n // If the next flash element is not available, it might be because the flashbar is collapsed\n // In that case, try to focus on the notification bar button or the main element\n const notificationBarButton = refCurrent?.querySelector(`.${styles.button}`);\n if (notificationBarButton) {\n (notificationBarButton as HTMLElement).focus();\n return;\n }\n\n const mainElement = document.querySelector('main') ?? document.querySelector('[role=\"main\"]');\n mainElement?.focus();\n return;\n }\n focusFlashFocusableArea(nextFlashElement);\n };\n\n setTimeout(attemptFocus, 0);\n};\n\n// Common logic for collapsible and non-collapsible Flashbar\nexport function useFlashbar({\n items,\n onItemsAdded,\n onItemsChanged,\n onItemsRemoved,\n ...restProps\n}: FlashbarProps & {\n onItemsAdded?: (items: FlashbarProps.MessageDefinition[]) => void;\n onItemsRemoved?: (items: FlashbarProps.MessageDefinition[]) => void;\n onItemsChanged?: (options?: { allItemsHaveId?: boolean; isReducedMotion?: boolean }) => void;\n}) {\n const { __internalRootRef } = useBaseComponent('Flashbar', {\n props: { stackItems: restProps.stackItems },\n });\n const allItemsHaveId = useMemo(() => items.every(item => 'id' in item), [items]);\n const baseProps = getBaseProps(restProps);\n const ref = useRef<HTMLDivElement | null>(null);\n const flashRefs = useRef<Record<string | number, HTMLDivElement | null>>({});\n const mergedRef = useMergeRefs(ref, __internalRootRef);\n const isReducedMotion = useReducedMotion(ref);\n const isVisualRefresh = useVisualRefresh();\n const [previousItems, setPreviousItems] = useState<ReadonlyArray<FlashbarProps.MessageDefinition>>(items);\n const [nextFocusId, setNextFocusId] = useState<string | null>(null);\n\n if (isDevelopment) {\n if (items?.some(item => item.ariaRole === 'alert' && !item.id)) {\n warnOnce(\n 'Flashbar',\n `You provided \\`ariaRole=\"alert\"\\` for a flashbar item without providing an \\`id\\`. Focus will not be moved to the newly added flash message.`\n );\n }\n }\n\n // Track new or removed item IDs in state to only trigger focus changes for newly added items.\n // https://reactjs.org/docs/hooks-faq.html#how-do-i-implement-getderivedstatefromprops\n if (items) {\n const newItems = items.filter(({ id }) => id && !previousItems.some(item => item.id === id));\n const removedItems = previousItems.filter(({ id }) => id && !items.some(item => item.id === id));\n if (newItems.length > 0 || removedItems.length > 0) {\n setPreviousItems(items);\n onItemsAdded?.(newItems);\n onItemsRemoved?.(removedItems);\n onItemsChanged?.({ allItemsHaveId, isReducedMotion });\n\n const newFocusItems = newItems.filter(({ ariaRole }) => ariaRole === 'alert');\n if (newFocusItems.length > 0) {\n setNextFocusId(newFocusItems[0].id!);\n }\n }\n }\n\n const debouncedFocus = useDebounceCallback(focusFlashById, FOCUS_DEBOUNCE_DELAY);\n\n useEffect(() => {\n if (nextFocusId) {\n debouncedFocus(ref.current, nextFocusId);\n }\n }, [debouncedFocus, nextFocusId, ref]);\n\n const handleFlashDismissed = (dismissedId?: string) => {\n handleFlashDismissedInternal(dismissedId, items, ref.current, flashRefs.current);\n };\n\n return {\n allItemsHaveId,\n baseProps,\n isReducedMotion,\n isVisualRefresh,\n mergedRef,\n ref,\n flashRefs,\n handleFlashDismissed,\n };\n}\n"]}
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/flashbar/common.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE7D,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzG,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAGlE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,uBAAuB;AACvB,MAAM,CAAC,MAAM,4BAA4B,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,QAAQ,KAAK,OAAO,CAAC,CAAC;YAC9E,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC5B,cAAc,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAG,CAAC,CAAC;aACtC;SACF;KACF;IAED,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,WAAW,EAAE;YACf,cAAc,CAAC,GAAG,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;SAC1C;IACH,CAAC,EAAE,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,CAAC;IAEvB,MAAM,oBAAoB,GAAG,CAAC,WAAoB,EAAE,EAAE;QACpD,4BAA4B,CAAC,WAAW,EAAE,KAAK,EAAE,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IACnF,CAAC,CAAC;IAEF,OAAO;QACL,cAAc;QACd,SAAS;QACT,eAAe;QACf,eAAe;QACf,SAAS;QACT,GAAG;QACH,SAAS;QACT,oBAAoB;KACrB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { useEffect, useMemo, useRef, useState } from 'react';\n\nimport { useMergeRefs, useReducedMotion, warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { getBaseProps } from '../internal/base-component';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { isDevelopment } from '../internal/is-development';\nimport { focusFlashById, focusFlashFocusableArea } from './flash';\nimport { FlashbarProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\n// Exported for testing\nexport const handleFlashDismissedInternal = (\n dismissedId: string | undefined,\n items: ReadonlyArray<FlashbarProps.MessageDefinition> | undefined,\n refCurrent: HTMLDivElement | null,\n flashRefsCurrent: Record<string | number, HTMLDivElement | null>\n) => {\n if (!items || !dismissedId || !refCurrent) {\n return;\n }\n\n const dismissedIndex = items.findIndex(item => (item.id ?? '') === dismissedId);\n if (dismissedIndex === -1) {\n return;\n }\n\n let nextItemIndex = dismissedIndex + 1;\n if (nextItemIndex >= items.length) {\n nextItemIndex = dismissedIndex - 1;\n }\n\n // If there's no next item, focus the first instance of the main element (or element with role=main)\n if (nextItemIndex < 0 || nextItemIndex >= items.length) {\n const mainElement = document.querySelector('main') ?? document.querySelector('[role=\"main\"]');\n mainElement?.focus();\n return;\n }\n\n const nextItemId = items[nextItemIndex].id ?? nextItemIndex;\n\n // Try to focus on the next item, but with a small delay to ensure the DOM is updated\n // This is especially important for collapsible flashbars where the next item might become visible\n const attemptFocus = () => {\n const nextFlashElement = flashRefsCurrent[nextItemId];\n if (!nextFlashElement) {\n // If the next flash element is not available, it might be because the flashbar is collapsed\n // In that case, try to focus on the notification bar button or the main element\n const notificationBarButton = refCurrent?.querySelector(`.${styles.button}`);\n if (notificationBarButton) {\n (notificationBarButton as HTMLElement).focus();\n return;\n }\n\n const mainElement = document.querySelector('main') ?? document.querySelector('[role=\"main\"]');\n mainElement?.focus();\n return;\n }\n focusFlashFocusableArea(nextFlashElement);\n };\n\n setTimeout(attemptFocus, 0);\n};\n\n// Common logic for collapsible and non-collapsible Flashbar\nexport function useFlashbar({\n items,\n onItemsAdded,\n onItemsChanged,\n onItemsRemoved,\n ...restProps\n}: FlashbarProps & {\n onItemsAdded?: (items: FlashbarProps.MessageDefinition[]) => void;\n onItemsRemoved?: (items: FlashbarProps.MessageDefinition[]) => void;\n onItemsChanged?: (options?: { allItemsHaveId?: boolean; isReducedMotion?: boolean }) => void;\n}) {\n const { __internalRootRef } = useBaseComponent('Flashbar', {\n props: { stackItems: restProps.stackItems },\n });\n const allItemsHaveId = useMemo(() => items.every(item => 'id' in item), [items]);\n const baseProps = getBaseProps(restProps);\n const ref = useRef<HTMLDivElement | null>(null);\n const flashRefs = useRef<Record<string | number, HTMLDivElement | null>>({});\n const mergedRef = useMergeRefs(ref, __internalRootRef);\n const isReducedMotion = useReducedMotion(ref);\n const isVisualRefresh = useVisualRefresh();\n const [previousItems, setPreviousItems] = useState<ReadonlyArray<FlashbarProps.MessageDefinition>>(items);\n const [nextFocusId, setNextFocusId] = useState<string | null>(null);\n\n if (isDevelopment) {\n if (items?.some(item => item.ariaRole === 'alert' && !item.id)) {\n warnOnce(\n 'Flashbar',\n `You provided \\`ariaRole=\"alert\"\\` for a flashbar item without providing an \\`id\\`. Focus will not be moved to the newly added flash message.`\n );\n }\n }\n\n // Track new or removed item IDs in state to only trigger focus changes for newly added items.\n // https://reactjs.org/docs/hooks-faq.html#how-do-i-implement-getderivedstatefromprops\n if (items) {\n const newItems = items.filter(({ id }) => id && !previousItems.some(item => item.id === id));\n const removedItems = previousItems.filter(({ id }) => id && !items.some(item => item.id === id));\n if (newItems.length > 0 || removedItems.length > 0) {\n setPreviousItems(items);\n onItemsAdded?.(newItems);\n onItemsRemoved?.(removedItems);\n onItemsChanged?.({ allItemsHaveId, isReducedMotion });\n\n const newFocusItems = newItems.filter(({ ariaRole }) => ariaRole === 'alert');\n if (newFocusItems.length > 0) {\n setNextFocusId(newFocusItems[0].id!);\n }\n }\n }\n\n useEffect(() => {\n if (nextFocusId) {\n focusFlashById(ref.current, nextFocusId);\n }\n }, [nextFocusId, ref]);\n\n const handleFlashDismissed = (dismissedId?: string) => {\n handleFlashDismissedInternal(dismissedId, items, ref.current, flashRefs.current);\n };\n\n return {\n allItemsHaveId,\n baseProps,\n isReducedMotion,\n isVisualRefresh,\n mergedRef,\n ref,\n flashRefs,\n handleFlashDismissed,\n };\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { FlashbarProps } from './interfaces';
3
3
  export declare const focusFlashFocusableArea: (flash: HTMLElement | null) => void;
4
- export declare function focusFlashById(element: HTMLElement | null, itemId: string): void;
4
+ export declare const focusFlashById: import("../internal/utils/throttle").ThrottledFunction<(element: HTMLElement | null, itemId: string) => void>;
5
5
  interface FlashProps extends FlashbarProps.MessageDefinition {
6
6
  className: string;
7
7
  transitionState?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"flash.d.ts","sourceRoot":"","sources":["../../../src/flashbar/flash.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiB,MAAM,OAAO,CAAC;AA6BtC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAmD7C,eAAO,MAAM,uBAAuB,UAAW,WAAW,GAAG,IAAI,SAYhE,CAAC;AAEF,wBAAgB,cAAc,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,QAYzE;AAED,UAAU,UAAW,SAAQ,aAAa,CAAC,iBAAiB;IAC1D,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC;IACxC,KAAK,CAAC,EAAE,aAAa,CAAC,KAAK,CAAC;IAC5B,OAAO,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACpC,WAAW,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC;AAED,eAAO,MAAM,KAAK,mFA6KjB,CAAC"}
1
+ {"version":3,"file":"flash.d.ts","sourceRoot":"","sources":["../../../src/flashbar/flash.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiB,MAAM,OAAO,CAAC;AA8BtC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAoD7C,eAAO,MAAM,uBAAuB,UAAW,WAAW,GAAG,IAAI,SAYhE,CAAC;AAEF,eAAO,MAAM,cAAc,mEACf,WAAW,GAAG,IAAI,UAAU,MAAM,UAgB7C,CAAC;AAEF,UAAU,UAAW,SAAQ,aAAa,CAAC,iBAAiB;IAC1D,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC;IACxC,KAAK,CAAC,EAAE,aAAa,CAAC,KAAK,CAAC;IAC5B,OAAO,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACpC,WAAW,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC;AAED,eAAO,MAAM,KAAK,mFA6KjB,CAAC"}
@@ -14,10 +14,12 @@ import { PACKAGE_VERSION } from '../internal/environment';
14
14
  import { isDevelopment } from '../internal/is-development';
15
15
  import { awsuiPluginsInternal } from '../internal/plugins/api';
16
16
  import { createUseDiscoveredAction, createUseDiscoveredContent } from '../internal/plugins/helpers';
17
+ import { throttle } from '../internal/utils/throttle';
17
18
  import useContainerWidth from '../internal/utils/use-container-width';
18
19
  import InternalLiveRegion from '../live-region/internal';
19
20
  import InternalSpinner from '../spinner/internal';
20
21
  import { getDismissButtonStyles, getFlashStyles } from './style';
22
+ import { FOCUS_THROTTLE_DELAY } from './utils';
21
23
  import analyticsSelectors from './analytics-metadata/styles.css.js';
22
24
  import styles from './styles.css.js';
23
25
  const ICON_TYPES = {
@@ -53,7 +55,7 @@ export const focusFlashFocusableArea = (flash) => {
53
55
  focusContainer.focus();
54
56
  }
55
57
  };
56
- export function focusFlashById(element, itemId) {
58
+ export const focusFlashById = throttle((element, itemId) => {
57
59
  if (!element) {
58
60
  return;
59
61
  }
@@ -63,7 +65,7 @@ export function focusFlashById(element, itemId) {
63
65
  }
64
66
  const focusContainer = flashElement.querySelector(`.${styles['flash-focus-container']}`);
65
67
  focusContainer === null || focusContainer === void 0 ? void 0 : focusContainer.focus();
66
- }
68
+ }, FOCUS_THROTTLE_DELAY, { trailing: false });
67
69
  export const Flash = React.forwardRef((_a, ref) => {
68
70
  var { id, header, content, dismissible, dismissLabel, loading, action, buttonText, onButtonClick, onDismiss, className, transitionState, ariaRole, i18nStrings, type = 'info', analyticsMetadata, style, rootRef, onDismissed } = _a, props = __rest(_a, ["id", "header", "content", "dismissible", "dismissLabel", "loading", "action", "buttonText", "onButtonClick", "onDismiss", "className", "transitionState", "ariaRole", "i18nStrings", "type", "analyticsMetadata", "style", "rootRef", "onDismissed"]);
69
71
  if (isDevelopment) {
@@ -1 +1 @@
1
- {"version":3,"file":"flash.js","sourceRoot":"","sources":["../../../src/flashbar/flash.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,WAAW,EACX,QAAQ,GACT,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAGjH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EACL,4BAA4B,EAC5B,wCAAwC,GACzC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACpG,OAAO,iBAAiB,MAAM,uCAAuC,CAAC;AACtE,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AACzD,OAAO,eAAe,MAAM,qBAAqB,CAAC;AAGlD,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEjE,OAAO,kBAAkB,MAAM,oCAAoC,CAAC;AACpE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,UAAU,GAAG;IACjB,O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AAC,CAAC,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAC3F,EACD,GAAG,EAAE,UAAU,IAEd,OAAO,CACJ;oBACN,6BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,qBAAqB,CAAC,EAAE,sBAAsB,KAAK,UAAU,IAAI,MAAM,CAAC,MAAM,CAAC,EACtG,GAAG,EAAE,qBAAqB,GACrB,CACH,CACF;YACN,oBAAC,cAAc,IACb,SAAS,EAAE,MAAM,CAAC,uBAAuB,CAAC,EAC1C,eAAe,EAAE,EAAE,UAAU,EAAE,MAAM,CAAC,aAAa,CAAC,EAAE,YAAY,EAAE,MAAM,CAAC,eAAe,CAAC,EAAE,EAC7F,MAAM,EAAE,MAAM,EACd,iBAAiB,EAAE,iBAAiB,EACpC,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,cAAc,EAC9B,YAAY,EAAE,MAAM,CAAC,gBAAgB,CAAC,GACtC,CACE;QACL,WAAW;YACV,aAAa,CAAC,YAAY,EAAE,SAAS,EAAE,KAAK,EAAE,aAAa,EAAE,sBAAsB,EAAE,EAAE,EAAE,WAAW,CAAC;QACtG,QAAQ,KAAK,QAAQ,IAAI,CACxB,oBAAC,kBAAkB,IAAC,OAAO,EAAE,CAAC,mBAAmB,EAAE,eAAe,EAAE,gBAAgB,CAAC,GAAI,CAC1F,CACG,CACP,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport clsx from 'clsx';\n\nimport {\n useComponentMetadata,\n useMergeRefs,\n useUniqueId,\n warnOnce,\n} from '@cloudscape-design/component-toolkit/internal';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\nimport { AnalyticsMetadata } from '@cloudscape-design/component-toolkit/internal/base-component/metrics/interfaces';\n\nimport { ActionsWrapper } from '../alert/actions-wrapper';\nimport { ButtonProps } from '../button/interfaces';\nimport { InternalButton } from '../button/internal';\nimport InternalIcon from '../icon/internal';\nimport {\n DATA_ATTR_ANALYTICS_FLASHBAR,\n DATA_ATTR_ANALYTICS_SUPPRESS_FLOW_EVENTS,\n} from '../internal/analytics/selectors';\nimport { getVisualContextClassname } from '../internal/components/visual-context';\nimport { PACKAGE_VERSION } from '../internal/environment';\nimport { isDevelopment } from '../internal/is-development';\nimport { awsuiPluginsInternal } from '../internal/plugins/api';\nimport { createUseDiscoveredAction, createUseDiscoveredContent } from '../internal/plugins/helpers';\nimport useContainerWidth from '../internal/utils/use-container-width';\nimport InternalLiveRegion from '../live-region/internal';\nimport InternalSpinner from '../spinner/internal';\nimport { GeneratedAnalyticsMetadataFlashbarDismiss } from './analytics-metadata/interfaces';\nimport { FlashbarProps } from './interfaces';\nimport { getDismissButtonStyles, getFlashStyles } from './style';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\nconst ICON_TYPES = {\n success: 'status-positive',\n warning: 'status-warning',\n info: 'status-info',\n error: 'status-negative',\n 'in-progress': 'status-in-progress',\n} as const;\n\nconst useDiscoveredAction = createUseDiscoveredAction(awsuiPluginsInternal.flashbar.onActionRegistered);\nconst useDiscoveredContent = createUseDiscoveredContent('flash', awsuiPluginsInternal.flashContent);\n\nfunction dismissButton(\n dismissLabel: FlashbarProps.MessageDefinition['dismissLabel'],\n onDismiss: FlashbarProps.MessageDefinition['onDismiss'],\n style?: FlashbarProps.Style,\n type?: string,\n ref?: React.Ref<ButtonProps.Ref>,\n id?: string,\n onDismissed?: (id?: string) => void\n) {\n return (\n <div\n className={styles['dismiss-button-wrapper']}\n {...getAnalyticsMetadataAttribute({ action: 'dismiss' } as Partial<GeneratedAnalyticsMetadataFlashbarDismiss>)}\n >\n <InternalButton\n ref={ref}\n onClick={event => {\n if (onDismiss) {\n onDismiss(event);\n }\n if (onDismissed) {\n onDismissed(id);\n }\n }}\n className={styles['dismiss-button']}\n variant=\"flashbar-icon\"\n iconName=\"close\"\n formAction=\"none\"\n ariaLabel={dismissLabel}\n style={getDismissButtonStyles(style, type)}\n />\n </div>\n );\n}\nexport const focusFlashFocusableArea = (flash: HTMLElement | null) => {\n if (!flash) {\n return;\n }\n const dismissButton = flash.querySelector(`.${styles['dismiss-button']}`);\n const focusContainer = flash.querySelector(`.${styles['flash-focus-container']}`);\n\n if (dismissButton) {\n (dismissButton as HTMLElement).focus();\n } else if (focusContainer) {\n (focusContainer as HTMLElement).focus();\n }\n};\n\nexport function focusFlashById(element: HTMLElement | null, itemId: string) {\n if (!element) {\n return;\n }\n\n const flashElement = element.querySelector<HTMLElement>(`[data-itemid=\"${CSS.escape(itemId)}\"]`);\n if (!flashElement) {\n return;\n }\n\n const focusContainer = flashElement.querySelector<HTMLElement>(`.${styles['flash-focus-container']}`);\n focusContainer?.focus();\n}\n\ninterface FlashProps extends FlashbarProps.MessageDefinition {\n className: string;\n transitionState?: string;\n i18nStrings?: FlashbarProps.I18nStrings;\n style?: FlashbarProps.Style;\n rootRef?: React.Ref<HTMLDivElement>;\n onDismissed?: (id?: string) => void;\n}\n\nexport const Flash = React.forwardRef(\n (\n {\n id,\n header,\n content,\n dismissible,\n dismissLabel,\n loading,\n action,\n buttonText,\n onButtonClick,\n onDismiss,\n className,\n transitionState,\n ariaRole,\n i18nStrings,\n type = 'info',\n analyticsMetadata,\n style,\n rootRef,\n onDismissed,\n ...props\n }: FlashProps,\n ref: React.Ref<HTMLDivElement>\n ) => {\n if (isDevelopment) {\n if (buttonText && !onButtonClick) {\n warnOnce(\n 'Flashbar',\n `You provided a \\`buttonText\\` prop without an \\`onButtonClick\\` handler. This will render a non-interactive action button.`\n );\n }\n\n if (dismissible && !onDismiss) {\n warnOnce(\n 'Flashbar',\n `You have set the \\`dismissible\\` prop without an \\`onDismiss\\` handler. This will render a non-interactive dismiss button.`\n );\n }\n }\n\n const [containerWidth, containerMeasureRef] = useContainerWidth();\n\n const elementRef = useComponentMetadata('Flash', PACKAGE_VERSION, analyticsMetadata as AnalyticsMetadata);\n\n // Merge all refs including the rootRef if provided\n const mergedRef = useMergeRefs(ref, rootRef, elementRef, containerMeasureRef);\n const flashIconId = useUniqueId('flash-icon');\n const flashMessageId = useUniqueId('flash-message');\n\n const headerRefObject = useRef<HTMLDivElement>(null);\n const contentRefObject = useRef<HTMLDivElement>(null);\n const dismissButtonRefObject = useRef<ButtonProps.Ref>(null);\n const { discoveredActions, headerRef: headerRefAction, contentRef: contentRefAction } = useDiscoveredAction(type);\n const {\n initialHidden,\n headerReplacementType,\n contentReplacementType,\n headerRef: headerRefContent,\n contentRef: contentRefContent,\n replacementHeaderRef,\n replacementContentRef,\n } = useDiscoveredContent({ type, header, children: content });\n\n const headerRef = useMergeRefs(headerRefAction, headerRefContent, headerRefObject);\n const contentRef = useMergeRefs(contentRefAction, contentRefContent, contentRefObject);\n\n const statusIconAriaLabel =\n props.statusIconAriaLabel ||\n i18nStrings?.[`${loading || type === 'in-progress' ? 'inProgress' : type}IconAriaLabel`];\n\n const iconType = ICON_TYPES[type];\n const icon = loading ? (\n <span role=\"img\" aria-label={statusIconAriaLabel}>\n <InternalSpinner />\n </span>\n ) : (\n <InternalIcon name={iconType} ariaLabel={statusIconAriaLabel} />\n );\n\n const effectiveType = loading ? 'info' : type;\n\n const analyticsAttributes: Record<string, string> = { [DATA_ATTR_ANALYTICS_FLASHBAR]: effectiveType };\n\n if (analyticsMetadata?.suppressFlowMetricEvents) {\n analyticsAttributes[DATA_ATTR_ANALYTICS_SUPPRESS_FLOW_EVENTS] = 'true';\n }\n\n return (\n // We're not using \"polite\" or \"assertive\" here, just turning default behavior off.\n // eslint-disable-next-line @cloudscape-design/components/prefer-live-region\n <div\n ref={mergedRef}\n role={ariaRole}\n aria-live={ariaRole ? 'off' : undefined}\n data-itemid={id}\n className={clsx(\n styles.flash,\n styles[`flash-type-${effectiveType}`],\n className,\n transitionState && {\n [styles.enter]: transitionState === 'enter',\n [styles.entering]: transitionState === 'entering',\n [styles.entered]: transitionState === 'entered',\n [styles.exit]: transitionState === 'exit',\n [styles.exiting]: transitionState === 'exiting',\n [styles.exited]: transitionState === 'exited',\n },\n getVisualContextClassname(type === 'warning' && !loading ? 'flashbar-warning' : 'flashbar'),\n initialHidden && styles['initial-hidden']\n )}\n style={getFlashStyles(style, effectiveType)}\n {...analyticsAttributes}\n >\n <div className={styles['flash-body']}>\n <div\n className={styles['flash-focus-container']}\n tabIndex={-1}\n role=\"group\"\n aria-labelledby={`${flashIconId} ${flashMessageId}`}\n >\n <div className={clsx(styles['flash-icon'], styles['flash-text'])} id={flashIconId}>\n {icon}\n </div>\n <div className={clsx(styles['flash-message'], styles['flash-text'])} id={flashMessageId}>\n <div\n className={clsx(\n styles['flash-header'],\n headerReplacementType !== 'original' ? styles.hidden : analyticsSelectors['flash-header']\n )}\n ref={headerRef}\n >\n {header}\n </div>\n <div\n className={clsx(styles['header-replacement'], headerReplacementType !== 'replaced' && styles.hidden)}\n ref={replacementHeaderRef}\n ></div>\n <div\n className={clsx(\n styles['flash-content'],\n contentReplacementType !== 'original' ? styles.hidden : analyticsSelectors['flash-header']\n )}\n ref={contentRef}\n >\n {content}\n </div>\n <div\n className={clsx(styles['content-replacement'], contentReplacementType !== 'replaced' && styles.hidden)}\n ref={replacementContentRef}\n ></div>\n </div>\n </div>\n <ActionsWrapper\n className={styles['action-button-wrapper']}\n testUtilClasses={{ actionSlot: styles['action-slot'], actionButton: styles['action-button'] }}\n action={action}\n discoveredActions={discoveredActions}\n buttonText={buttonText}\n onButtonClick={onButtonClick}\n containerWidth={containerWidth}\n wrappedClass={styles['action-wrapped']}\n />\n </div>\n {dismissible &&\n dismissButton(dismissLabel, onDismiss, style, effectiveType, dismissButtonRefObject, id, onDismissed)}\n {ariaRole === 'status' && (\n <InternalLiveRegion sources={[statusIconAriaLabel, headerRefObject, contentRefObject]} />\n )}\n </div>\n );\n }\n);\n"]}
1
+ {"version":3,"file":"flash.js","sourceR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AC,EACvB,sBAAsB,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAC3F,EACD,GAAG,EAAE,UAAU,IAEd,OAAO,CACJ;oBACN,6BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,qBAAqB,CAAC,EAAE,sBAAsB,KAAK,UAAU,IAAI,MAAM,CAAC,MAAM,CAAC,EACtG,GAAG,EAAE,qBAAqB,GACrB,CACH,CACF;YACN,oBAAC,cAAc,IACb,SAAS,EAAE,MAAM,CAAC,uBAAuB,CAAC,EAC1C,eAAe,EAAE,EAAE,UAAU,EAAE,MAAM,CAAC,aAAa,CAAC,EAAE,YAAY,EAAE,MAAM,CAAC,eAAe,CAAC,EAAE,EAC7F,MAAM,EAAE,MAAM,EACd,iBAAiB,EAAE,iBAAiB,EACpC,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,cAAc,EAC9B,YAAY,EAAE,MAAM,CAAC,gBAAgB,CAAC,GACtC,CACE;QACL,WAAW;YACV,aAAa,CAAC,YAAY,EAAE,SAAS,EAAE,KAAK,EAAE,aAAa,EAAE,sBAAsB,EAAE,EAAE,EAAE,WAAW,CAAC;QACtG,QAAQ,KAAK,QAAQ,IAAI,CACxB,oBAAC,kBAAkB,IAAC,OAAO,EAAE,CAAC,mBAAmB,EAAE,eAAe,EAAE,gBAAgB,CAAC,GAAI,CAC1F,CACG,CACP,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport clsx from 'clsx';\n\nimport {\n useComponentMetadata,\n useMergeRefs,\n useUniqueId,\n warnOnce,\n} from '@cloudscape-design/component-toolkit/internal';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\nimport { AnalyticsMetadata } from '@cloudscape-design/component-toolkit/internal/base-component/metrics/interfaces';\n\nimport { ActionsWrapper } from '../alert/actions-wrapper';\nimport { ButtonProps } from '../button/interfaces';\nimport { InternalButton } from '../button/internal';\nimport InternalIcon from '../icon/internal';\nimport {\n DATA_ATTR_ANALYTICS_FLASHBAR,\n DATA_ATTR_ANALYTICS_SUPPRESS_FLOW_EVENTS,\n} from '../internal/analytics/selectors';\nimport { getVisualContextClassname } from '../internal/components/visual-context';\nimport { PACKAGE_VERSION } from '../internal/environment';\nimport { isDevelopment } from '../internal/is-development';\nimport { awsuiPluginsInternal } from '../internal/plugins/api';\nimport { createUseDiscoveredAction, createUseDiscoveredContent } from '../internal/plugins/helpers';\nimport { throttle } from '../internal/utils/throttle';\nimport useContainerWidth from '../internal/utils/use-container-width';\nimport InternalLiveRegion from '../live-region/internal';\nimport InternalSpinner from '../spinner/internal';\nimport { GeneratedAnalyticsMetadataFlashbarDismiss } from './analytics-metadata/interfaces';\nimport { FlashbarProps } from './interfaces';\nimport { getDismissButtonStyles, getFlashStyles } from './style';\nimport { FOCUS_THROTTLE_DELAY } from './utils';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\nconst ICON_TYPES = {\n success: 'status-positive',\n warning: 'status-warning',\n info: 'status-info',\n error: 'status-negative',\n 'in-progress': 'status-in-progress',\n} as const;\n\nconst useDiscoveredAction = createUseDiscoveredAction(awsuiPluginsInternal.flashbar.onActionRegistered);\nconst useDiscoveredContent = createUseDiscoveredContent('flash', awsuiPluginsInternal.flashContent);\n\nfunction dismissButton(\n dismissLabel: FlashbarProps.MessageDefinition['dismissLabel'],\n onDismiss: FlashbarProps.MessageDefinition['onDismiss'],\n style?: FlashbarProps.Style,\n type?: string,\n ref?: React.Ref<ButtonProps.Ref>,\n id?: string,\n onDismissed?: (id?: string) => void\n) {\n return (\n <div\n className={styles['dismiss-button-wrapper']}\n {...getAnalyticsMetadataAttribute({ action: 'dismiss' } as Partial<GeneratedAnalyticsMetadataFlashbarDismiss>)}\n >\n <InternalButton\n ref={ref}\n onClick={event => {\n if (onDismiss) {\n onDismiss(event);\n }\n if (onDismissed) {\n onDismissed(id);\n }\n }}\n className={styles['dismiss-button']}\n variant=\"flashbar-icon\"\n iconName=\"close\"\n formAction=\"none\"\n ariaLabel={dismissLabel}\n style={getDismissButtonStyles(style, type)}\n />\n </div>\n );\n}\nexport const focusFlashFocusableArea = (flash: HTMLElement | null) => {\n if (!flash) {\n return;\n }\n const dismissButton = flash.querySelector(`.${styles['dismiss-button']}`);\n const focusContainer = flash.querySelector(`.${styles['flash-focus-container']}`);\n\n if (dismissButton) {\n (dismissButton as HTMLElement).focus();\n } else if (focusContainer) {\n (focusContainer as HTMLElement).focus();\n }\n};\n\nexport const focusFlashById = throttle(\n (element: HTMLElement | null, itemId: string) => {\n if (!element) {\n return;\n }\n\n const flashElement = element.querySelector<HTMLElement>(`[data-itemid=\"${CSS.escape(itemId)}\"]`);\n if (!flashElement) {\n return;\n }\n\n const focusContainer = flashElement.querySelector<HTMLElement>(`.${styles['flash-focus-container']}`);\n\n focusContainer?.focus();\n },\n FOCUS_THROTTLE_DELAY,\n { trailing: false }\n);\n\ninterface FlashProps extends FlashbarProps.MessageDefinition {\n className: string;\n transitionState?: string;\n i18nStrings?: FlashbarProps.I18nStrings;\n style?: FlashbarProps.Style;\n rootRef?: React.Ref<HTMLDivElement>;\n onDismissed?: (id?: string) => void;\n}\n\nexport const Flash = React.forwardRef(\n (\n {\n id,\n header,\n content,\n dismissible,\n dismissLabel,\n loading,\n action,\n buttonText,\n onButtonClick,\n onDismiss,\n className,\n transitionState,\n ariaRole,\n i18nStrings,\n type = 'info',\n analyticsMetadata,\n style,\n rootRef,\n onDismissed,\n ...props\n }: FlashProps,\n ref: React.Ref<HTMLDivElement>\n ) => {\n if (isDevelopment) {\n if (buttonText && !onButtonClick) {\n warnOnce(\n 'Flashbar',\n `You provided a \\`buttonText\\` prop without an \\`onButtonClick\\` handler. This will render a non-interactive action button.`\n );\n }\n\n if (dismissible && !onDismiss) {\n warnOnce(\n 'Flashbar',\n `You have set the \\`dismissible\\` prop without an \\`onDismiss\\` handler. This will render a non-interactive dismiss button.`\n );\n }\n }\n\n const [containerWidth, containerMeasureRef] = useContainerWidth();\n\n const elementRef = useComponentMetadata('Flash', PACKAGE_VERSION, analyticsMetadata as AnalyticsMetadata);\n\n // Merge all refs including the rootRef if provided\n const mergedRef = useMergeRefs(ref, rootRef, elementRef, containerMeasureRef);\n const flashIconId = useUniqueId('flash-icon');\n const flashMessageId = useUniqueId('flash-message');\n\n const headerRefObject = useRef<HTMLDivElement>(null);\n const contentRefObject = useRef<HTMLDivElement>(null);\n const dismissButtonRefObject = useRef<ButtonProps.Ref>(null);\n const { discoveredActions, headerRef: headerRefAction, contentRef: contentRefAction } = useDiscoveredAction(type);\n const {\n initialHidden,\n headerReplacementType,\n contentReplacementType,\n headerRef: headerRefContent,\n contentRef: contentRefContent,\n replacementHeaderRef,\n replacementContentRef,\n } = useDiscoveredContent({ type, header, children: content });\n\n const headerRef = useMergeRefs(headerRefAction, headerRefContent, headerRefObject);\n const contentRef = useMergeRefs(contentRefAction, contentRefContent, contentRefObject);\n\n const statusIconAriaLabel =\n props.statusIconAriaLabel ||\n i18nStrings?.[`${loading || type === 'in-progress' ? 'inProgress' : type}IconAriaLabel`];\n\n const iconType = ICON_TYPES[type];\n const icon = loading ? (\n <span role=\"img\" aria-label={statusIconAriaLabel}>\n <InternalSpinner />\n </span>\n ) : (\n <InternalIcon name={iconType} ariaLabel={statusIconAriaLabel} />\n );\n\n const effectiveType = loading ? 'info' : type;\n\n const analyticsAttributes: Record<string, string> = { [DATA_ATTR_ANALYTICS_FLASHBAR]: effectiveType };\n\n if (analyticsMetadata?.suppressFlowMetricEvents) {\n analyticsAttributes[DATA_ATTR_ANALYTICS_SUPPRESS_FLOW_EVENTS] = 'true';\n }\n\n return (\n // We're not using \"polite\" or \"assertive\" here, just turning default behavior off.\n // eslint-disable-next-line @cloudscape-design/components/prefer-live-region\n <div\n ref={mergedRef}\n role={ariaRole}\n aria-live={ariaRole ? 'off' : undefined}\n data-itemid={id}\n className={clsx(\n styles.flash,\n styles[`flash-type-${effectiveType}`],\n className,\n transitionState && {\n [styles.enter]: transitionState === 'enter',\n [styles.entering]: transitionState === 'entering',\n [styles.entered]: transitionState === 'entered',\n [styles.exit]: transitionState === 'exit',\n [styles.exiting]: transitionState === 'exiting',\n [styles.exited]: transitionState === 'exited',\n },\n getVisualContextClassname(type === 'warning' && !loading ? 'flashbar-warning' : 'flashbar'),\n initialHidden && styles['initial-hidden']\n )}\n style={getFlashStyles(style, effectiveType)}\n {...analyticsAttributes}\n >\n <div className={styles['flash-body']}>\n <div\n className={styles['flash-focus-container']}\n tabIndex={-1}\n role=\"group\"\n aria-labelledby={`${flashIconId} ${flashMessageId}`}\n >\n <div className={clsx(styles['flash-icon'], styles['flash-text'])} id={flashIconId}>\n {icon}\n </div>\n <div className={clsx(styles['flash-message'], styles['flash-text'])} id={flashMessageId}>\n <div\n className={clsx(\n styles['flash-header'],\n headerReplacementType !== 'original' ? styles.hidden : analyticsSelectors['flash-header']\n )}\n ref={headerRef}\n >\n {header}\n </div>\n <div\n className={clsx(styles['header-replacement'], headerReplacementType !== 'replaced' && styles.hidden)}\n ref={replacementHeaderRef}\n ></div>\n <div\n className={clsx(\n styles['flash-content'],\n contentReplacementType !== 'original' ? styles.hidden : analyticsSelectors['flash-header']\n )}\n ref={contentRef}\n >\n {content}\n </div>\n <div\n className={clsx(styles['content-replacement'], contentReplacementType !== 'replaced' && styles.hidden)}\n ref={replacementContentRef}\n ></div>\n </div>\n </div>\n <ActionsWrapper\n className={styles['action-button-wrapper']}\n testUtilClasses={{ actionSlot: styles['action-slot'], actionButton: styles['action-button'] }}\n action={action}\n discoveredActions={discoveredActions}\n buttonText={buttonText}\n onButtonClick={onButtonClick}\n containerWidth={containerWidth}\n wrappedClass={styles['action-wrapped']}\n />\n </div>\n {dismissible &&\n dismissButton(dismissLabel, onDismiss, style, effectiveType, dismissButtonRefObject, id, onDismissed)}\n {ariaRole === 'status' && (\n <InternalLiveRegion sources={[statusIconAriaLabel, headerRefObject, contentRefObject]} />\n )}\n </div>\n );\n }\n);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../src/flashbar/style.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,EAAE,IAAI,GAAE,MAAe;;;;;;;cAoC7F;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,GAAG,SAAS,EAAE,IAAI,GAAE,MAAe;;;;;;;cAqB9F;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,EAAE,IAAI,GAAE,MAAe;;;;;;;;;;;;;cA4C1F;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC;;;cA2CrE"}
1
+ {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../src/flashbar/style.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7C,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,EAAE,IAAI,GAAE,MAAe;;;;;;;cA4B7F;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,GAAG,SAAS,EAAE,IAAI,GAAE,MAAe;;;;;;;cAqB9F;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,EAAE,IAAI,GAAE,MAAe;;;;;;;;;;;;;cAqC1F;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC;;;cA2CrE"}
@@ -2,26 +2,20 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { SYSTEM } from '../internal/environment';
4
4
  import customCssProps from '../internal/generated/custom-css-properties';
5
+ import { getStylePropertyKey } from './utils';
5
6
  export function getCollapsibleFlashStyles(style, type = 'info') {
6
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
7
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
7
8
  if (SYSTEM !== 'core' || !style) {
8
9
  return undefined;
9
10
  }
10
- const background = ((_b = (_a = style === null || style === void 0 ? void 0 : style.item) === null || _a === void 0 ? void 0 : _a.root) === null || _b === void 0 ? void 0 : _b.background) &&
11
- (type === 'in-progress'
12
- ? (_d = (_c = style === null || style === void 0 ? void 0 : style.item) === null || _c === void 0 ? void 0 : _c.root) === null || _d === void 0 ? void 0 : _d.background.inProgress
13
- : (_f = (_e = style === null || style === void 0 ? void 0 : style.item) === null || _e === void 0 ? void 0 : _e.root) === null || _f === void 0 ? void 0 : _f.background[type]);
14
- const borderColor = ((_h = (_g = style === null || style === void 0 ? void 0 : style.item) === null || _g === void 0 ? void 0 : _g.root) === null || _h === void 0 ? void 0 : _h.borderColor) &&
15
- (type === 'in-progress'
16
- ? (_k = (_j = style === null || style === void 0 ? void 0 : style.item) === null || _j === void 0 ? void 0 : _j.root) === null || _k === void 0 ? void 0 : _k.borderColor.inProgress
17
- : (_m = (_l = style === null || style === void 0 ? void 0 : style.item) === null || _l === void 0 ? void 0 : _l.root) === null || _m === void 0 ? void 0 : _m.borderColor[type]);
18
- const borderRadius = (_p = (_o = style === null || style === void 0 ? void 0 : style.item) === null || _o === void 0 ? void 0 : _o.root) === null || _p === void 0 ? void 0 : _p.borderRadius;
19
- const borderWidth = (_r = (_q = style === null || style === void 0 ? void 0 : style.item) === null || _q === void 0 ? void 0 : _q.root) === null || _r === void 0 ? void 0 : _r.borderWidth;
20
- const borderStyle = ((_t = (_s = style === null || style === void 0 ? void 0 : style.item) === null || _s === void 0 ? void 0 : _s.root) === null || _t === void 0 ? void 0 : _t.borderWidth) && 'solid';
21
- const color = ((_v = (_u = style === null || style === void 0 ? void 0 : style.item) === null || _u === void 0 ? void 0 : _u.root) === null || _v === void 0 ? void 0 : _v.color) &&
22
- (type === 'in-progress'
23
- ? (_x = (_w = style === null || style === void 0 ? void 0 : style.item) === null || _w === void 0 ? void 0 : _w.root) === null || _x === void 0 ? void 0 : _x.color.inProgress
24
- : (_z = (_y = style === null || style === void 0 ? void 0 : style.item) === null || _y === void 0 ? void 0 : _y.root) === null || _z === void 0 ? void 0 : _z.color[type]);
11
+ const styleKey = getStylePropertyKey(type);
12
+ const background = ((_b = (_a = style === null || style === void 0 ? void 0 : style.item) === null || _a === void 0 ? void 0 : _a.root) === null || _b === void 0 ? void 0 : _b.background) && ((_d = (_c = style === null || style === void 0 ? void 0 : style.item) === null || _c === void 0 ? void 0 : _c.root) === null || _d === void 0 ? void 0 : _d.background[styleKey]);
13
+ const borderColor = ((_f = (_e = style === null || style === void 0 ? void 0 : style.item) === null || _e === void 0 ? void 0 : _e.root) === null || _f === void 0 ? void 0 : _f.borderColor) &&
14
+ ((_h = (_g = style === null || style === void 0 ? void 0 : style.item) === null || _g === void 0 ? void 0 : _g.root) === null || _h === void 0 ? void 0 : _h.borderColor[styleKey]);
15
+ const borderRadius = (_k = (_j = style === null || style === void 0 ? void 0 : style.item) === null || _j === void 0 ? void 0 : _j.root) === null || _k === void 0 ? void 0 : _k.borderRadius;
16
+ const borderWidth = (_m = (_l = style === null || style === void 0 ? void 0 : style.item) === null || _l === void 0 ? void 0 : _l.root) === null || _m === void 0 ? void 0 : _m.borderWidth;
17
+ const borderStyle = ((_p = (_o = style === null || style === void 0 ? void 0 : style.item) === null || _o === void 0 ? void 0 : _o.root) === null || _p === void 0 ? void 0 : _p.borderWidth) && 'solid';
18
+ const color = ((_r = (_q = style === null || style === void 0 ? void 0 : style.item) === null || _q === void 0 ? void 0 : _q.root) === null || _r === void 0 ? void 0 : _r.color) && ((_t = (_s = style === null || style === void 0 ? void 0 : style.item) === null || _s === void 0 ? void 0 : _s.root) === null || _t === void 0 ? void 0 : _t.color[styleKey]);
25
19
  return {
26
20
  background,
27
21
  borderColor,
@@ -37,9 +31,7 @@ export function getFlashStyles(style, type = 'info') {
37
31
  return undefined;
38
32
  }
39
33
  const focusRingBorderColor = ((_c = (_b = (_a = style === null || style === void 0 ? void 0 : style.item) === null || _a === void 0 ? void 0 : _a.root) === null || _b === void 0 ? void 0 : _b.focusRing) === null || _c === void 0 ? void 0 : _c.borderColor) &&
40
- (type === 'in-progress'
41
- ? style.item.root.focusRing.borderColor.inProgress
42
- : style.item.root.focusRing.borderColor[type]);
34
+ style.item.root.focusRing.borderColor[getStylePropertyKey(type)];
43
35
  return Object.assign(Object.assign(Object.assign({}, getCollapsibleFlashStyles(style, type)), (((_e = (_d = style === null || style === void 0 ? void 0 : style.item) === null || _d === void 0 ? void 0 : _d.root) === null || _e === void 0 ? void 0 : _e.focusRing) && {
44
36
  [customCssProps.styleFocusRingBorderColor]: focusRingBorderColor,
45
37
  [customCssProps.styleFocusRingBorderRadius]: (_f = style.item.root.focusRing) === null || _f === void 0 ? void 0 : _f.borderRadius,
@@ -53,22 +45,15 @@ export function getDismissButtonStyles(style, type = 'info') {
53
45
  if (SYSTEM !== 'core' || !style) {
54
46
  return undefined;
55
47
  }
48
+ const styleKey = getStylePropertyKey(type);
56
49
  const activeColor = ((_c = (_b = (_a = style === null || style === void 0 ? void 0 : style.item) === null || _a === void 0 ? void 0 : _a.dismissButton) === null || _b === void 0 ? void 0 : _b.color) === null || _c === void 0 ? void 0 : _c.active) &&
57
- (type === 'in-progress'
58
- ? style.item.dismissButton.color.active.inProgress
59
- : style.item.dismissButton.color.active[type]);
50
+ style.item.dismissButton.color.active[styleKey];
60
51
  const defaultColor = ((_f = (_e = (_d = style === null || style === void 0 ? void 0 : style.item) === null || _d === void 0 ? void 0 : _d.dismissButton) === null || _e === void 0 ? void 0 : _e.color) === null || _f === void 0 ? void 0 : _f.default) &&
61
- (type === 'in-progress'
62
- ? style.item.dismissButton.color.default.inProgress
63
- : style.item.dismissButton.color.default[type]);
52
+ style.item.dismissButton.color.default[styleKey];
64
53
  const hoverColor = ((_j = (_h = (_g = style === null || style === void 0 ? void 0 : style.item) === null || _g === void 0 ? void 0 : _g.dismissButton) === null || _h === void 0 ? void 0 : _h.color) === null || _j === void 0 ? void 0 : _j.hover) &&
65
- (type === 'in-progress'
66
- ? style.item.dismissButton.color.hover.inProgress
67
- : style.item.dismissButton.color.hover[type]);
54
+ style.item.dismissButton.color.hover[styleKey];
68
55
  const focusRingBorderColor = ((_m = (_l = (_k = style === null || style === void 0 ? void 0 : style.item) === null || _k === void 0 ? void 0 : _k.dismissButton) === null || _l === void 0 ? void 0 : _l.focusRing) === null || _m === void 0 ? void 0 : _m.borderColor) &&
69
- (type === 'in-progress'
70
- ? style.item.dismissButton.focusRing.borderColor.inProgress
71
- : style.item.dismissButton.focusRing.borderColor[type]);
56
+ style.item.dismissButton.focusRing.borderColor[styleKey];
72
57
  return {
73
58
  root: {
74
59
  color: {
@@ -1 +1 @@
1
- {"version":3,"file":"style.js","sourceRoot":"","sources":["../../../src/flashbar/style.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,cAAc,MAAM,6CAA6C,CAAC;AAGzE,MAAM,UAAU,yBAAyB,CAAC,KAA6B,EAAE,OAAe,MAAM;;IAC5F,IAAI,MAAM,KAAK,MAAM,IAAI,CAAC,KAAK,EAAE;QAC/B,OAAO,SAAS,CAAC;KAClB;IACD,MAAM,UAAU,GACd,CAAA,MAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,0CAAE,IAAI,0CAAE,UAAU;QAC7B,CAAC,IAAI,KAA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OAAA,OAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,eAAe,4CAAE,YAAY,4CAAE,SAAS,4CAAE,YAAY;QAC1G,CAAC,cAAc,CAAC,yBAAyB,CAAC,EAAE,OAAA,OAAA,OAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,eAAe,4CAAE,YAAY,4CAAE,SAAS,4CAAE,WAAW;KACzG,CAAC,GACC,CAAC,CAAA,OAAA,OAAA,OAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,eAAe,4CAAE,YAAY,4CAAE,SAAS,4CAAE,YAAY,KAAI;QACnE,CAAC,cAAc,CAAC,0BAA0B,CAAC,EAAE,KAAK,CAAC,eAAe,CAAC,YAAY,CAAC,SAAS,CAAC,YAAY;KACvG,CAAC,EACF;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { SYSTEM } from '../internal/environment';\nimport customCssProps from '../internal/generated/custom-css-properties';\nimport { FlashbarProps } from './interfaces';\n\nexport function getCollapsibleFlashStyles(style: FlashbarProps['style'], type: string = 'info') {\n if (SYSTEM !== 'core' || !style) {\n return undefined;\n }\n const background =\n style?.item?.root?.background &&\n (type === 'in-progress'\n ? style?.item?.root?.background.inProgress\n : style?.item?.root?.background[type as keyof typeof style.item.root.background]);\n\n const borderColor =\n style?.item?.root?.borderColor &&\n (type === 'in-progress'\n ? style?.item?.root?.borderColor.inProgress\n : style?.item?.root?.borderColor[type as keyof typeof style.item.root.borderColor]);\n\n const borderRadius = style?.item?.root?.borderRadius;\n\n const borderWidth = style?.item?.root?.borderWidth;\n\n const borderStyle = style?.item?.root?.borderWidth && 'solid';\n\n const color =\n style?.item?.root?.color &&\n (type === 'in-progress'\n ? style?.item?.root?.color.inProgress\n : style?.item?.root?.color[type as keyof typeof style.item.root.color]);\n\n return {\n background,\n borderColor,\n borderRadius,\n borderStyle,\n borderWidth,\n color,\n };\n}\n\nexport function getFlashStyles(style: FlashbarProps['style'] | undefined, type: string = 'info') {\n if (SYSTEM !== 'core' || !style) {\n return undefined;\n }\n const focusRingBorderColor =\n style?.item?.root?.focusRing?.borderColor &&\n (type === 'in-progress'\n ? style.item.root.focusRing.borderColor.inProgress\n : style.item.root.focusRing.borderColor[type as keyof typeof style.item.root.focusRing.borderColor]);\n\n return {\n ...getCollapsibleFlashStyles(style, type),\n ...(style?.item?.root?.focusRing && {\n [customCssProps.styleFocusRingBorderColor]: focusRingBorderColor,\n [customCssProps.styleFocusRingBorderRadius]: style.item.root.focusRing?.borderRadius,\n [customCssProps.styleFocusRingBorderWidth]: style.item.root.focusRing?.borderWidth,\n }),\n ...(style?.item?.root?.focusRing?.borderRadius && {\n [customCssProps.styleFocusRingBorderRadius]: style.item.root.focusRing.borderRadius,\n }),\n };\n}\n\nexport function getDismissButtonStyles(style: FlashbarProps['style'], type: string = 'info') {\n if (SYSTEM !== 'core' || !style) {\n return undefined;\n }\n const activeColor =\n style?.item?.dismissButton?.color?.active &&\n (type === 'in-progress'\n ? style.item.dismissButton.color.active.inProgress\n : style.item.dismissButton.color.active[type as keyof typeof style.item.dismissButton.color.active]);\n\n const defaultColor =\n style?.item?.dismissButton?.color?.default &&\n (type === 'in-progress'\n ? style.item.dismissButton.color.default.inProgress\n : style.item.dismissButton.color.default[type as keyof typeof style.item.dismissButton.color.default]);\n\n const hoverColor =\n style?.item?.dismissButton?.color?.hover &&\n (type === 'in-progress'\n ? style.item.dismissButton.color.hover.inProgress\n : style.item.dismissButton.color.hover[type as keyof typeof style.item.dismissButton.color.hover]);\n\n const focusRingBorderColor =\n style?.item?.dismissButton?.focusRing?.borderColor &&\n (type === 'in-progress'\n ? style.item.dismissButton.focusRing.borderColor.inProgress\n : style.item.dismissButton.focusRing.borderColor[\n type as keyof typeof style.item.dismissButton.focusRing.borderColor\n ]);\n\n return {\n root: {\n color: {\n active: activeColor,\n default: defaultColor,\n hover: hoverColor,\n },\n focusRing: {\n borderColor: focusRingBorderColor,\n borderRadius: style?.item?.dismissButton?.focusRing?.borderRadius,\n borderWidth: style?.item?.dismissButton?.focusRing?.borderWidth,\n },\n },\n };\n}\n\nexport function getNotificationBarStyles(style: FlashbarProps['style']) {\n if (SYSTEM !== 'core' || !style) {\n return undefined;\n }\n return {\n borderRadius: style?.notificationBar?.root?.borderRadius,\n borderWidth: style?.notificationBar?.root?.borderWidth,\n ...(style?.notificationBar?.root?.background?.active && {\n [customCssProps.styleBackgroundActive]: style.notificationBar.root.background.active,\n }),\n ...(style?.notificationBar?.root?.background?.default && {\n [customCssProps.styleBackgroundDefault]: style.notificationBar.root.background.default,\n }),\n ...(style?.notificationBar?.root?.background?.hover && {\n [customCssProps.styleBackgroundHover]: style.notificationBar.root.background.hover,\n }),\n ...(style?.notificationBar?.root?.borderColor?.active && {\n [customCssProps.styleBorderColorActive]: style.notificationBar.root.borderColor.active,\n }),\n ...(style?.notificationBar?.root?.borderColor?.default && {\n [customCssProps.styleBorderColorDefault]: style.notificationBar.root.borderColor.default,\n }),\n ...(style?.notificationBar?.root?.borderColor?.hover && {\n [customCssProps.styleBorderColorHover]: style.notificationBar.root.borderColor.hover,\n }),\n ...(style?.notificationBar?.root?.color?.active && {\n [customCssProps.styleColorActive]: style.notificationBar.root.color.active,\n }),\n ...(style?.notificationBar?.root?.color?.default && {\n [customCssProps.styleColorDefault]: style.notificationBar.root.color.default,\n }),\n ...(style?.notificationBar?.root?.color?.hover && {\n [customCssProps.styleColorHover]: style.notificationBar.root.color.hover,\n }),\n ...(style?.notificationBar?.expandButton?.focusRing && {\n [customCssProps.styleFocusRingBorderColor]: style?.notificationBar?.expandButton?.focusRing?.borderColor,\n [customCssProps.styleFocusRingBorderRadius]: style?.notificationBar?.expandButton?.focusRing?.borderRadius,\n [customCssProps.styleFocusRingBorderWidth]: style?.notificationBar?.expandButton?.focusRing?.borderWidth,\n }),\n ...(style?.notificationBar?.expandButton?.focusRing?.borderRadius && {\n [customCssProps.styleFocusRingBorderRadius]: style.notificationBar.expandButton.focusRing.borderRadius,\n }),\n };\n}\n"]}
1
+ {"version":3,"file":"style.js","sourceRoot":"","sources":["../../../src/flashbar/style.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,cAAc,MAAM,6CAA6C,CAAC;AAEzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE9C,MAAM,UAAU,yBAAyB,CAAC,KAA6B,EAAE,OAAe,MAAM;;IAC5F,IAAI,MAAM,KAAK,MAAM,IAAI,CAAC,KAAK,EAAE;QAC/B,OAAO,SAAS,CAAC;KAClB;IACD,MAAM,QAAQ,GAAG,mBAAmB,CAAC,IAA0B,CAAC,CAAC;IACjE,MAAM,UAAU,GACd,CAAA,MAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,0CAAE,IAAI,0CAAE,UAAU,MAAI,MAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,0CAAE,IAAI,0CAAE,UAAU,CAAC,QAAmD,CAAC,CAAA,CAAC;IAEtH,MAAM,WAAW,GACf,CAAA,MAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,0CAAE,IAAI,0CAAE,WAAW;SAC9B,MAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,0CAAE,IAAI,0CAAE,WAAW,CAAC,QAAoD,CAAC,CAAA,CAAC;IAEvF,MAAM,YAAY,GAAG,MAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,0CAAE,IAAI,0CAAE,YAAY,CAAC;IAErD,MAAM,WAAW,GAAG,MAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,0CAAE,IAAI,0CAAE,WAAW,CAAC;IAEnD,MAAM,WAAW,GAAG,CAAA,MAAA,MAAA,KAA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AC,EAAE,KAAK,CAAC,eAAe,CAAC,YAAY,CAAC,SAAS,CAAC,YAAY;KACvG,CAAC,EACF;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { SYSTEM } from '../internal/environment';\nimport customCssProps from '../internal/generated/custom-css-properties';\nimport { FlashbarProps } from './interfaces';\nimport { getStylePropertyKey } from './utils';\n\nexport function getCollapsibleFlashStyles(style: FlashbarProps['style'], type: string = 'info') {\n if (SYSTEM !== 'core' || !style) {\n return undefined;\n }\n const styleKey = getStylePropertyKey(type as FlashbarProps.Type);\n const background =\n style?.item?.root?.background && style?.item?.root?.background[styleKey as keyof typeof style.item.root.background];\n\n const borderColor =\n style?.item?.root?.borderColor &&\n style?.item?.root?.borderColor[styleKey as keyof typeof style.item.root.borderColor];\n\n const borderRadius = style?.item?.root?.borderRadius;\n\n const borderWidth = style?.item?.root?.borderWidth;\n\n const borderStyle = style?.item?.root?.borderWidth && 'solid';\n\n const color = style?.item?.root?.color && style?.item?.root?.color[styleKey as keyof typeof style.item.root.color];\n\n return {\n background,\n borderColor,\n borderRadius,\n borderStyle,\n borderWidth,\n color,\n };\n}\n\nexport function getFlashStyles(style: FlashbarProps['style'] | undefined, type: string = 'info') {\n if (SYSTEM !== 'core' || !style) {\n return undefined;\n }\n const focusRingBorderColor =\n style?.item?.root?.focusRing?.borderColor &&\n style.item.root.focusRing.borderColor[\n getStylePropertyKey(type as FlashbarProps.Type) as keyof typeof style.item.root.focusRing.borderColor\n ];\n\n return {\n ...getCollapsibleFlashStyles(style, type),\n ...(style?.item?.root?.focusRing && {\n [customCssProps.styleFocusRingBorderColor]: focusRingBorderColor,\n [customCssProps.styleFocusRingBorderRadius]: style.item.root.focusRing?.borderRadius,\n [customCssProps.styleFocusRingBorderWidth]: style.item.root.focusRing?.borderWidth,\n }),\n ...(style?.item?.root?.focusRing?.borderRadius && {\n [customCssProps.styleFocusRingBorderRadius]: style.item.root.focusRing.borderRadius,\n }),\n };\n}\n\nexport function getDismissButtonStyles(style: FlashbarProps['style'], type: string = 'info') {\n if (SYSTEM !== 'core' || !style) {\n return undefined;\n }\n const styleKey = getStylePropertyKey(type as FlashbarProps.Type);\n const activeColor =\n style?.item?.dismissButton?.color?.active &&\n style.item.dismissButton.color.active[styleKey as keyof typeof style.item.dismissButton.color.active];\n\n const defaultColor =\n style?.item?.dismissButton?.color?.default &&\n style.item.dismissButton.color.default[styleKey as keyof typeof style.item.dismissButton.color.default];\n\n const hoverColor =\n style?.item?.dismissButton?.color?.hover &&\n style.item.dismissButton.color.hover[styleKey as keyof typeof style.item.dismissButton.color.hover];\n\n const focusRingBorderColor =\n style?.item?.dismissButton?.focusRing?.borderColor &&\n style.item.dismissButton.focusRing.borderColor[\n styleKey as keyof typeof style.item.dismissButton.focusRing.borderColor\n ];\n\n return {\n root: {\n color: {\n active: activeColor,\n default: defaultColor,\n hover: hoverColor,\n },\n focusRing: {\n borderColor: focusRingBorderColor,\n borderRadius: style?.item?.dismissButton?.focusRing?.borderRadius,\n borderWidth: style?.item?.dismissButton?.focusRing?.borderWidth,\n },\n },\n };\n}\n\nexport function getNotificationBarStyles(style: FlashbarProps['style']) {\n if (SYSTEM !== 'core' || !style) {\n return undefined;\n }\n return {\n borderRadius: style?.notificationBar?.root?.borderRadius,\n borderWidth: style?.notificationBar?.root?.borderWidth,\n ...(style?.notificationBar?.root?.background?.active && {\n [customCssProps.styleBackgroundActive]: style.notificationBar.root.background.active,\n }),\n ...(style?.notificationBar?.root?.background?.default && {\n [customCssProps.styleBackgroundDefault]: style.notificationBar.root.background.default,\n }),\n ...(style?.notificationBar?.root?.background?.hover && {\n [customCssProps.styleBackgroundHover]: style.notificationBar.root.background.hover,\n }),\n ...(style?.notificationBar?.root?.borderColor?.active && {\n [customCssProps.styleBorderColorActive]: style.notificationBar.root.borderColor.active,\n }),\n ...(style?.notificationBar?.root?.borderColor?.default && {\n [customCssProps.styleBorderColorDefault]: style.notificationBar.root.borderColor.default,\n }),\n ...(style?.notificationBar?.root?.borderColor?.hover && {\n [customCssProps.styleBorderColorHover]: style.notificationBar.root.borderColor.hover,\n }),\n ...(style?.notificationBar?.root?.color?.active && {\n [customCssProps.styleColorActive]: style.notificationBar.root.color.active,\n }),\n ...(style?.notificationBar?.root?.color?.default && {\n [customCssProps.styleColorDefault]: style.notificationBar.root.color.default,\n }),\n ...(style?.notificationBar?.root?.color?.hover && {\n [customCssProps.styleColorHover]: style.notificationBar.root.color.hover,\n }),\n ...(style?.notificationBar?.expandButton?.focusRing && {\n [customCssProps.styleFocusRingBorderColor]: style?.notificationBar?.expandButton?.focusRing?.borderColor,\n [customCssProps.styleFocusRingBorderRadius]: style?.notificationBar?.expandButton?.focusRing?.borderRadius,\n [customCssProps.styleFocusRingBorderWidth]: style?.notificationBar?.expandButton?.focusRing?.borderWidth,\n }),\n ...(style?.notificationBar?.expandButton?.focusRing?.borderRadius && {\n [customCssProps.styleFocusRingBorderRadius]: style.notificationBar.expandButton.focusRing.borderRadius,\n }),\n };\n}\n"]}