@cloudscape-design/components 3.0.208 → 3.0.209

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 (59) hide show
  1. package/annotation-context/annotation/styles.css.js +24 -24
  2. package/annotation-context/annotation/styles.scoped.css +30 -30
  3. package/annotation-context/annotation/styles.selectors.js +24 -24
  4. package/app-layout/index.d.ts.map +1 -1
  5. package/app-layout/index.js +1 -1
  6. package/app-layout/index.js.map +1 -1
  7. package/app-layout/notifications/index.d.ts +0 -1
  8. package/app-layout/notifications/index.d.ts.map +1 -1
  9. package/app-layout/notifications/index.js +2 -2
  10. package/app-layout/notifications/index.js.map +1 -1
  11. package/app-layout/notifications/styles.css.js +2 -3
  12. package/app-layout/notifications/styles.scoped.css +5 -13
  13. package/app-layout/notifications/styles.selectors.js +2 -3
  14. package/app-layout/visual-refresh/notifications.d.ts.map +1 -1
  15. package/app-layout/visual-refresh/notifications.js +1 -6
  16. package/app-layout/visual-refresh/notifications.js.map +1 -1
  17. package/app-layout/visual-refresh/styles.css.js +60 -60
  18. package/app-layout/visual-refresh/styles.scoped.css +223 -223
  19. package/app-layout/visual-refresh/styles.selectors.js +60 -60
  20. package/cards/interfaces.d.ts +2 -1
  21. package/cards/interfaces.d.ts.map +1 -1
  22. package/cards/interfaces.js.map +1 -1
  23. package/content-layout/index.d.ts +1 -1
  24. package/content-layout/index.d.ts.map +1 -1
  25. package/content-layout/index.js +6 -32
  26. package/content-layout/index.js.map +1 -1
  27. package/content-layout/internal.d.ts +6 -0
  28. package/content-layout/internal.d.ts.map +1 -0
  29. package/content-layout/internal.js +35 -0
  30. package/content-layout/internal.js.map +1 -0
  31. package/flashbar/collapsible-flashbar.d.ts.map +1 -1
  32. package/flashbar/collapsible-flashbar.js +4 -4
  33. package/flashbar/collapsible-flashbar.js.map +1 -1
  34. package/flashbar/styles.css.js +43 -45
  35. package/flashbar/styles.scoped.css +166 -271
  36. package/flashbar/styles.selectors.js +43 -45
  37. package/form/index.d.ts +1 -1
  38. package/form/index.d.ts.map +1 -1
  39. package/form/index.js +4 -3
  40. package/form/index.js.map +1 -1
  41. package/form/interfaces.d.ts +12 -0
  42. package/form/interfaces.d.ts.map +1 -1
  43. package/form/interfaces.js.map +1 -1
  44. package/form/internal.d.ts +1 -1
  45. package/form/internal.d.ts.map +1 -1
  46. package/form/internal.js +21 -14
  47. package/form/internal.js.map +1 -1
  48. package/form/styles.css.js +9 -8
  49. package/form/styles.scoped.css +8 -8
  50. package/form/styles.selectors.js +9 -8
  51. package/internal/environment.js +1 -1
  52. package/internal/generated/custom-css-properties/index.d.ts.map +1 -1
  53. package/internal/generated/custom-css-properties/index.js +28 -29
  54. package/internal/generated/custom-css-properties/index.js.map +1 -1
  55. package/internal/manifest.json +1 -1
  56. package/package.json +1 -1
  57. package/table/interfaces.d.ts +2 -1
  58. package/table/interfaces.d.ts.map +1 -1
  59. package/table/interfaces.js.map +1 -1
@@ -2,65 +2,65 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "appbar": "awsui_appbar_hyvsj_vwhok_93",
6
- "appbar-nav": "awsui_appbar-nav_hyvsj_vwhok_117",
7
- "breadcrumbs": "awsui_breadcrumbs_hyvsj_vwhok_121",
8
- "appbar-tools": "awsui_appbar-tools_hyvsj_vwhok_125",
9
- "has-breadcrumbs": "awsui_has-breadcrumbs_hyvsj_vwhok_166",
10
- "has-notifications-content": "awsui_has-notifications-content_hyvsj_vwhok_173",
11
- "has-header": "awsui_has-header_hyvsj_vwhok_179",
12
- "has-dynamic-overlap-height": "awsui_has-dynamic-overlap-height_hyvsj_vwhok_179",
13
- "content-type-wizard": "awsui_content-type-wizard_hyvsj_vwhok_180",
14
- "content-type-cards": "awsui_content-type-cards_hyvsj_vwhok_183",
15
- "content-type-table": "awsui_content-type-table_hyvsj_vwhok_184",
16
- "has-sticky-background": "awsui_has-sticky-background_hyvsj_vwhok_187",
17
- "background": "awsui_background_hyvsj_vwhok_221",
18
- "notifications-appbar-header": "awsui_notifications-appbar-header_hyvsj_vwhok_224",
19
- "sticky-notifications": "awsui_sticky-notifications_hyvsj_vwhok_236",
20
- "overlap": "awsui_overlap_hyvsj_vwhok_242",
21
- "content": "awsui_content_hyvsj_vwhok_180",
22
- "layout": "awsui_layout_hyvsj_vwhok_333",
23
- "has-max-content-width": "awsui_has-max-content-width_hyvsj_vwhok_415",
24
- "is-overlap-disabled": "awsui_is-overlap-disabled_hyvsj_vwhok_442",
25
- "disable-body-scroll": "awsui_disable-body-scroll_hyvsj_vwhok_445",
26
- "has-sticky-notifications": "awsui_has-sticky-notifications_hyvsj_vwhok_449",
27
- "has-split-panel": "awsui_has-split-panel_hyvsj_vwhok_463",
28
- "split-panel-position-bottom": "awsui_split-panel-position-bottom_hyvsj_vwhok_463",
29
- "has-content-gap-left": "awsui_has-content-gap-left_hyvsj_vwhok_475",
30
- "has-content-gap-right": "awsui_has-content-gap-right_hyvsj_vwhok_478",
31
- "block-body-scroll": "awsui_block-body-scroll_hyvsj_vwhok_493",
32
- "container": "awsui_container_hyvsj_vwhok_501",
33
- "disable-content-paddings": "awsui_disable-content-paddings_hyvsj_vwhok_527",
34
- "is-navigation-open": "awsui_is-navigation-open_hyvsj_vwhok_532",
35
- "is-tools-open": "awsui_is-tools-open_hyvsj_vwhok_535",
36
- "is-split-panel-open": "awsui_is-split-panel-open_hyvsj_vwhok_535",
37
- "split-panel-position-side": "awsui_split-panel-position-side_hyvsj_vwhok_535",
38
- "content-type-default": "awsui_content-type-default_hyvsj_vwhok_555",
39
- "content-type-form": "awsui_content-type-form_hyvsj_vwhok_555",
40
- "unfocusable": "awsui_unfocusable_hyvsj_vwhok_596",
41
- "navigation-container": "awsui_navigation-container_hyvsj_vwhok_606",
42
- "show-navigation": "awsui_show-navigation_hyvsj_vwhok_641",
43
- "animating": "awsui_animating_hyvsj_vwhok_663",
44
- "showButtons": "awsui_showButtons_hyvsj_vwhok_1",
45
- "navigation": "awsui_navigation_hyvsj_vwhok_606",
46
- "openNavigation": "awsui_openNavigation_hyvsj_vwhok_1",
47
- "animated-content": "awsui_animated-content_hyvsj_vwhok_724",
48
- "hide-navigation": "awsui_hide-navigation_hyvsj_vwhok_733",
49
- "notifications": "awsui_notifications_hyvsj_vwhok_224",
50
- "split-panel-bottom": "awsui_split-panel-bottom_hyvsj_vwhok_799",
51
- "position-bottom": "awsui_position-bottom_hyvsj_vwhok_845",
52
- "openSplitPanelBottom": "awsui_openSplitPanelBottom_hyvsj_vwhok_1",
53
- "split-panel-side": "awsui_split-panel-side_hyvsj_vwhok_874",
54
- "position-side": "awsui_position-side_hyvsj_vwhok_902",
55
- "openSplitPanelSide": "awsui_openSplitPanelSide_hyvsj_vwhok_1",
56
- "tools-container": "awsui_tools-container_hyvsj_vwhok_939",
57
- "tools": "awsui_tools_hyvsj_vwhok_939",
58
- "openTools": "awsui_openTools_hyvsj_vwhok_1",
59
- "has-tools-form-persistence": "awsui_has-tools-form-persistence_hyvsj_vwhok_1024",
60
- "hide-tools": "awsui_hide-tools_hyvsj_vwhok_1034",
61
- "show-tools": "awsui_show-tools_hyvsj_vwhok_1046",
62
- "has-tools-form": "awsui_has-tools-form_hyvsj_vwhok_1024",
63
- "trigger": "awsui_trigger_hyvsj_vwhok_1103",
64
- "selected": "awsui_selected_hyvsj_vwhok_1142"
5
+ "appbar": "awsui_appbar_hyvsj_ive4w_93",
6
+ "appbar-nav": "awsui_appbar-nav_hyvsj_ive4w_117",
7
+ "breadcrumbs": "awsui_breadcrumbs_hyvsj_ive4w_121",
8
+ "appbar-tools": "awsui_appbar-tools_hyvsj_ive4w_125",
9
+ "has-breadcrumbs": "awsui_has-breadcrumbs_hyvsj_ive4w_166",
10
+ "has-notifications-content": "awsui_has-notifications-content_hyvsj_ive4w_173",
11
+ "has-header": "awsui_has-header_hyvsj_ive4w_179",
12
+ "has-dynamic-overlap-height": "awsui_has-dynamic-overlap-height_hyvsj_ive4w_179",
13
+ "content-type-wizard": "awsui_content-type-wizard_hyvsj_ive4w_180",
14
+ "content-type-cards": "awsui_content-type-cards_hyvsj_ive4w_183",
15
+ "content-type-table": "awsui_content-type-table_hyvsj_ive4w_184",
16
+ "has-sticky-background": "awsui_has-sticky-background_hyvsj_ive4w_187",
17
+ "background": "awsui_background_hyvsj_ive4w_221",
18
+ "notifications-appbar-header": "awsui_notifications-appbar-header_hyvsj_ive4w_224",
19
+ "sticky-notifications": "awsui_sticky-notifications_hyvsj_ive4w_236",
20
+ "overlap": "awsui_overlap_hyvsj_ive4w_242",
21
+ "content": "awsui_content_hyvsj_ive4w_180",
22
+ "layout": "awsui_layout_hyvsj_ive4w_333",
23
+ "has-max-content-width": "awsui_has-max-content-width_hyvsj_ive4w_415",
24
+ "is-overlap-disabled": "awsui_is-overlap-disabled_hyvsj_ive4w_442",
25
+ "disable-body-scroll": "awsui_disable-body-scroll_hyvsj_ive4w_445",
26
+ "has-sticky-notifications": "awsui_has-sticky-notifications_hyvsj_ive4w_449",
27
+ "has-split-panel": "awsui_has-split-panel_hyvsj_ive4w_463",
28
+ "split-panel-position-bottom": "awsui_split-panel-position-bottom_hyvsj_ive4w_463",
29
+ "has-content-gap-left": "awsui_has-content-gap-left_hyvsj_ive4w_475",
30
+ "has-content-gap-right": "awsui_has-content-gap-right_hyvsj_ive4w_478",
31
+ "block-body-scroll": "awsui_block-body-scroll_hyvsj_ive4w_493",
32
+ "container": "awsui_container_hyvsj_ive4w_501",
33
+ "disable-content-paddings": "awsui_disable-content-paddings_hyvsj_ive4w_527",
34
+ "is-navigation-open": "awsui_is-navigation-open_hyvsj_ive4w_532",
35
+ "is-tools-open": "awsui_is-tools-open_hyvsj_ive4w_535",
36
+ "is-split-panel-open": "awsui_is-split-panel-open_hyvsj_ive4w_535",
37
+ "split-panel-position-side": "awsui_split-panel-position-side_hyvsj_ive4w_535",
38
+ "content-type-default": "awsui_content-type-default_hyvsj_ive4w_555",
39
+ "content-type-form": "awsui_content-type-form_hyvsj_ive4w_555",
40
+ "unfocusable": "awsui_unfocusable_hyvsj_ive4w_596",
41
+ "navigation-container": "awsui_navigation-container_hyvsj_ive4w_606",
42
+ "show-navigation": "awsui_show-navigation_hyvsj_ive4w_641",
43
+ "animating": "awsui_animating_hyvsj_ive4w_663",
44
+ "showButtons": "awsui_showButtons_hyvsj_ive4w_1",
45
+ "navigation": "awsui_navigation_hyvsj_ive4w_606",
46
+ "openNavigation": "awsui_openNavigation_hyvsj_ive4w_1",
47
+ "animated-content": "awsui_animated-content_hyvsj_ive4w_724",
48
+ "hide-navigation": "awsui_hide-navigation_hyvsj_ive4w_733",
49
+ "notifications": "awsui_notifications_hyvsj_ive4w_224",
50
+ "split-panel-bottom": "awsui_split-panel-bottom_hyvsj_ive4w_799",
51
+ "position-bottom": "awsui_position-bottom_hyvsj_ive4w_845",
52
+ "openSplitPanelBottom": "awsui_openSplitPanelBottom_hyvsj_ive4w_1",
53
+ "split-panel-side": "awsui_split-panel-side_hyvsj_ive4w_874",
54
+ "position-side": "awsui_position-side_hyvsj_ive4w_902",
55
+ "openSplitPanelSide": "awsui_openSplitPanelSide_hyvsj_ive4w_1",
56
+ "tools-container": "awsui_tools-container_hyvsj_ive4w_939",
57
+ "tools": "awsui_tools_hyvsj_ive4w_939",
58
+ "openTools": "awsui_openTools_hyvsj_ive4w_1",
59
+ "has-tools-form-persistence": "awsui_has-tools-form-persistence_hyvsj_ive4w_1024",
60
+ "hide-tools": "awsui_hide-tools_hyvsj_ive4w_1034",
61
+ "show-tools": "awsui_show-tools_hyvsj_ive4w_1046",
62
+ "has-tools-form": "awsui_has-tools-form_hyvsj_ive4w_1024",
63
+ "trigger": "awsui_trigger_hyvsj_ive4w_1103",
64
+ "selected": "awsui_selected_hyvsj_ive4w_1142"
65
65
  };
66
66
 
@@ -162,7 +162,8 @@ export interface CardsProps<T = any> extends BaseComponentProps {
162
162
  /**
163
163
  * Specify a cards variant with one of the following:
164
164
  * * `container` - Use this variant to have the cards displayed as a container.
165
- * * `full-page` – Use this variant when cards is the primary element on the page.
165
+ * * `full-page` – Use this variant when cards are the entire content of a page. Full page variants
166
+ * implement the high contrast header and content behavior automatically.
166
167
  * @visualrefresh `full-page` variant
167
168
  */
168
169
  variant?: 'container' | 'full-page';
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/cards/interfaces.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAY/D,MAAM,WAAW,mBAAmB;IAClC,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG;QAAE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;KAAE,GAAG,GAAG,CAAC,OAAO,CAAC;CAC9E;AAED,MAAM,WAAW,UAAU,CAAC,CAAC,GAAG,GAAG,CAAE,SAAQ,kBAAkB;IAC7D;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAExB;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEzB;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEzB;;OAEG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE7B;;OAEG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE9B;;;;OAIG;IACH,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IAExB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;;;;;;;;;;OAcG;IACH,cAAc,EAAE,UAAU,CAAC,cAAc,CAAC,CAAC,CA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AC3B,kBAAkB,EAAE,CAAC,IAAI,EAAE,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,MAAM,CAAC;QAC3E,mBAAmB,EAAE,MAAM,CAAC;KAC7B;IACD,UAAiB,GAAG;QAClB;;;WAGG;QACH,WAAW,IAAI,IAAI,CAAC;KACrB;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/cards/interfaces.tsx"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\n/*\n * HACK: Cast the component to a named parametrized interface.\n *\n * This lets us use React.forwardRef and still let the component have type\n * parameters, and the naming convention lets the documenter know that this is\n * a forwardRef-wrapped component.\n *\n * We don't need to expose this type to customers because it's just a simple\n * function type.\n */\nexport interface CardsForwardRefType {\n <T>(props: CardsProps<T> & { ref?: React.Ref<CardsProps.Ref> }): JSX.Element;\n}\n\nexport interface CardsProps<T = any> extends BaseComponentProps {\n /**\n * Displayed only when the list of items is empty.\n */\n empty?: React.ReactNode;\n\n /**\n * Heading element of the table container. Use the [header component](/components/header/).\n */\n header?: React.ReactNode;\n\n /**\n * Use this slot to add filtering controls to the component.\n */\n filter?: React.ReactNode;\n\n /**\n * Use this slot to add the [pagination component](/components/pagination/) to the component.\n */\n pagination?: React.ReactNode;\n\n /**\n * Use this slot to add [collection preferences](/components/collection-preferences/) to the component.\n */\n preferences?: React.ReactNode;\n\n /**\n * Specifies the items that serve as data source for a card.\n *\n * The `cardDefinition` property handles the display of this data.\n */\n items: ReadonlyArray<T>;\n\n /**\n * Renders the cards in a loading state. We recommend that you also set a `loadingText`.\n */\n loading?: boolean;\n\n /**\n * Specifies the text to display when in loading state.\n */\n loadingText?: string;\n\n /**\n * Defines what to display in each card. It has the following properties:\n * * `header` ((item) => ReactNode) - Responsible for displaying the card header. You receive the current item as an argument.\n * Use `fontSize=\"heading-m\"` on [link](/components/link/) components inside card header.\n * * `sections` (array) - Responsible for displaying the card content. Cards can have many sections in their\n * body. Each entry in the array is responsible for displaying a section. An entry has the following properties:\n * * `id`: (string) - A unique identifier for the section. The property is used as a [keys](https://reactjs.org/docs/lists-and-keys.html#keys)\n * source for React rendering, and to match entries in the `visibleSections` property (if it's defined).\n * * `header`: (ReactNode) - Responsible for displaying the section header.\n * * `content`: ((item) => ReactNode) - Responsible for displaying the section content. You receive the current item as an argument.\n * * `width`: (number) - Specifies the width of the card section in percent. Use this to display multiple sections in\n * the same row. The default value is 100%.\n *\n * All of the above properties are optional.\n */\n cardDefinition: CardsProps.CardDefinition<T>;\n /**\n * Determines the number of cards per row for any interval of container width.\n * It's an array whose entries are objects containing the following:\n * - `cards` (number) - Specifies the number of cards per row.\n * - `minWidth` (number) - Specifies the minimum container width (in pixels) for which this configuration object should apply.\n *\n * For example, with this configuration:\n * ```\n * [{\n * cards: 1\n * }, {\n * minWidth: 500,\n * cards: 2\n * }, {\n * minWidth: 800,\n * cards: 3\n * }]\n * ```\n *\n * the cards component displays:\n * * 1 card per row when the container width is below 500px.\n * * 2 cards per row when the container width is between 500px and 799px.\n * * 3 cards per row when the container width is 800px or wider.\n *\n * The number of cards per row can't be greater than 20.\n *\n * Default value:\n * ```\n * [{\n * cards: 1\n * }, {\n * minWidth: 768,\n * cards: 2\n * }, {\n * minWidth: 992,\n * cards: 3\n * }, {\n * minWidth: 1200,\n * cards: 4\n * }, {\n * minWidth: 1400,\n * cards: 5\n * }, {\n * minWidth: 1920,\n * cards: 6\n * }]\n * ```\n */\n cardsPerRow?: ReadonlyArray<CardsProps.CardsLayout>;\n /**\n * Specifies the property inside items that uniquely identifies them.\n * When it's set, it's used to provide [keys for React](https://reactjs.org/docs/lists-and-keys.html#keys)\n * for performance optimizations.\n *\n * It's also used for connecting `items` and `selectedItems` values when they don't reference the same object.\n */\n trackBy?: CardsProps.TrackBy<T>;\n /**\n * Specifies the selection mode. It can be either `single` or `multi`.\n */\n selectionType?: CardsProps.SelectionType;\n /**\n * Specifies the list of selected items.\n */\n selectedItems?: ReadonlyArray<T>;\n /**\n * Determines which items are disabled. If an item is disabled, users can't select it.\n */\n isItemDisabled?: CardsProps.IsItemDisabled<T>;\n /**\n * Adds labels to the selection components (checkboxes and radio buttons) as follows:\n * * `itemSelectionLabel` ((SelectionState, Item) => string) - Determines the label for an item.\n * * `selectionGroupLabel` (string) - Specifies the label for the group selection control.\n *\n * You can use the first arguments of type `SelectionState` to access the current selection\n * state of the component (for example, the `selectedItems` list). The label function for individual\n * items also receives the corresponding `Item` object. You can use the group label to\n * add a meaningful description to the whole selection.\n */\n ariaLabels?: CardsProps.AriaLabels<T>;\n /**\n * Specifies an array containing the `id` of each visible section. If not set, all sections are displayed.\n *\n * Use it in conjunction with the visible content preference of the [collection preferences](/components/collection-preferences/) component.\n *\n * The order of `id`s doesn't influence the order of display of sections, which is controlled by the `cardDefinition` property.\n */\n visibleSections?: ReadonlyArray<string>;\n /**\n * Called when a user interaction causes a change in the list of selected items.\n * The event `detail` contains the current list of `selectedItems`.\n */\n onSelectionChange?: NonCancelableEventHandler<CardsProps.SelectionChangeDetail<T>>;\n /**\n * If set to true, the cards header remains visible when the user scrolls down.\n */\n stickyHeader?: boolean;\n /**\n * Optionally provide a vertical offset (in pixels) for the sticky header, for example if you\n * need to position the sticky header below other fixed position elements on the page.\n */\n stickyHeaderVerticalOffset?: number;\n\n /**\n * Specify a cards variant with one of the following:\n * * `container` - Use this variant to have the cards displayed as a container.\n * * `full-page` – Use this variant when cards is the primary element on the page.\n * @visualrefresh `full-page` variant\n */\n variant?: 'container' | 'full-page';\n}\n\nexport namespace CardsProps {\n export interface CardDefinition<T> {\n header?(item: T): React.ReactNode;\n sections?: ReadonlyArray<SectionDefinition<T>>;\n }\n\n export interface SectionDefinition<T> {\n id?: string;\n header?: React.ReactNode;\n content?(item: T): React.ReactNode;\n width?: number;\n }\n\n export interface CardsLayout {\n cards: number;\n minWidth?: number;\n }\n\n export type TrackBy<T> = string | ((item: T) => string);\n\n export type SelectionType = 'single' | 'multi';\n\n export interface SelectionState<T> {\n selectedItems: ReadonlyArray<T>;\n }\n\n export interface SelectionChangeDetail<T> {\n selectedItems: T[];\n }\n\n export type IsItemDisabled<T> = (item: T) => boolean;\n\n export interface AriaLabels<T> {\n itemSelectionLabel: (data: CardsProps.SelectionState<T>, row: T) => string;\n selectionGroupLabel: string;\n }\n export interface Ref {\n /**\n * When the sticky header is enabled, calling this function scrolls cards's\n * scroll parent up to reveal the first card or row of cards.\n */\n scrollToTop(): void;\n }\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/cards/interfaces.tsx"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\n/*\n * HACK: Cast the component to a named parametrized interface.\n *\n * This lets us use React.forwardRef and still let the component have type\n * parameters, and the naming convention lets the documenter know that this is\n * a forwardRef-wrapped component.\n *\n * We don't need to expose this type to customers because it's just a simple\n * function type.\n */\nexport interface CardsForwardRefType {\n <T>(props: CardsProps<T> & { ref?: React.Ref<CardsProps.Ref> }): JSX.Element;\n}\n\nexport interface CardsProps<T = any> extends BaseComponentProps {\n /**\n * Displayed only when the list of items is empty.\n */\n empty?: React.ReactNode;\n\n /**\n * Heading element of the table container. Use the [header component](/components/header/).\n */\n header?: React.ReactNode;\n\n /**\n * Use this slot to add filtering controls to the component.\n */\n filter?: React.ReactNode;\n\n /**\n * Use this slot to add the [pagination component](/components/pagination/) to the component.\n */\n pagination?: React.ReactNode;\n\n /**\n * Use this slot to add [collection preferences](/components/collection-preferences/) to the component.\n */\n preferences?: React.ReactNode;\n\n /**\n * Specifies the items that serve as data source for a card.\n *\n * The `cardDefinition` property handles the display of this data.\n */\n items: ReadonlyArray<T>;\n\n /**\n * Renders the cards in a loading state. We recommend that you also set a `loadingText`.\n */\n loading?: boolean;\n\n /**\n * Specifies the text to display when in loading state.\n */\n loadingText?: string;\n\n /**\n * Defines what to display in each card. It has the following properties:\n * * `header` ((item) => ReactNode) - Responsible for displaying the card header. You receive the current item as an argument.\n * Use `fontSize=\"heading-m\"` on [link](/components/link/) components inside card header.\n * * `sections` (array) - Responsible for displaying the card content. Cards can have many sections in their\n * body. Each entry in the array is responsible for displaying a section. An entry has the following properties:\n * * `id`: (string) - A unique identifier for the section. The property is used as a [keys](https://reactjs.org/docs/lists-and-keys.html#keys)\n * source for React rendering, and to match entries in the `visibleSections` property (if it's defined).\n * * `header`: (ReactNode) - Responsible for displaying the section header.\n * * `content`: ((item) => ReactNode) - Responsible for displaying the section content. You receive the current item as an argument.\n * * `width`: (number) - Specifies the width of the card section in percent. Use this to display multiple sections in\n * the same row. The default value is 100%.\n *\n * All of the above properties are optional.\n */\n cardDefinition: CardsProps.CardDefinition<T>;\n /**\n * Determines the number of cards per row for any interval of container width.\n * It's an array whose entries are objects containing the following:\n * - `cards` (number) - Specifies the number of cards per row.\n * - `minWidth` (number) - Specifies the minimum container width (in pixels) for which this configuration object should apply.\n *\n * For example, with this configuration:\n * ```\n * [{\n * cards: 1\n * }, {\n * minWidth: 500,\n * cards: 2\n * }, {\n * minWidth: 800,\n * cards: 3\n * }]\n * ```\n *\n * the cards component displays:\n * * 1 card per row when the container width is below 500px.\n * * 2 cards per row when the container width is between 500px and 799px.\n * * 3 cards per row when the container width is 800px or wider.\n *\n * The number of cards per row can't be greater than 20.\n *\n * Default value:\n * ```\n * [{\n * cards: 1\n * }, {\n * minWidth: 768,\n * cards: 2\n * }, {\n * minWidth: 992,\n * cards: 3\n * }, {\n * minWidth: 1200,\n * cards: 4\n * }, {\n * minWidth: 1400,\n * cards: 5\n * }, {\n * minWidth: 1920,\n * cards: 6\n * }]\n * ```\n */\n cardsPerRow?: ReadonlyArray<CardsProps.CardsLayout>;\n /**\n * Specifies the property inside items that uniquely identifies them.\n * When it's set, it's used to provide [keys for React](https://reactjs.org/docs/lists-and-keys.html#keys)\n * for performance optimizations.\n *\n * It's also used for connecting `items` and `selectedItems` values when they don't reference the same object.\n */\n trackBy?: CardsProps.TrackBy<T>;\n /**\n * Specifies the selection mode. It can be either `single` or `multi`.\n */\n selectionType?: CardsProps.SelectionType;\n /**\n * Specifies the list of selected items.\n */\n selectedItems?: ReadonlyArray<T>;\n /**\n * Determines which items are disabled. If an item is disabled, users can't select it.\n */\n isItemDisabled?: CardsProps.IsItemDisabled<T>;\n /**\n * Adds labels to the selection components (checkboxes and radio buttons) as follows:\n * * `itemSelectionLabel` ((SelectionState, Item) => string) - Determines the label for an item.\n * * `selectionGroupLabel` (string) - Specifies the label for the group selection control.\n *\n * You can use the first arguments of type `SelectionState` to access the current selection\n * state of the component (for example, the `selectedItems` list). The label function for individual\n * items also receives the corresponding `Item` object. You can use the group label to\n * add a meaningful description to the whole selection.\n */\n ariaLabels?: CardsProps.AriaLabels<T>;\n /**\n * Specifies an array containing the `id` of each visible section. If not set, all sections are displayed.\n *\n * Use it in conjunction with the visible content preference of the [collection preferences](/components/collection-preferences/) component.\n *\n * The order of `id`s doesn't influence the order of display of sections, which is controlled by the `cardDefinition` property.\n */\n visibleSections?: ReadonlyArray<string>;\n /**\n * Called when a user interaction causes a change in the list of selected items.\n * The event `detail` contains the current list of `selectedItems`.\n */\n onSelectionChange?: NonCancelableEventHandler<CardsProps.SelectionChangeDetail<T>>;\n /**\n * If set to true, the cards header remains visible when the user scrolls down.\n */\n stickyHeader?: boolean;\n /**\n * Optionally provide a vertical offset (in pixels) for the sticky header, for example if you\n * need to position the sticky header below other fixed position elements on the page.\n */\n stickyHeaderVerticalOffset?: number;\n\n /**\n * Specify a cards variant with one of the following:\n * * `container` - Use this variant to have the cards displayed as a container.\n * * `full-page` – Use this variant when cards are the entire content of a page. Full page variants\n * implement the high contrast header and content behavior automatically.\n * @visualrefresh `full-page` variant\n */\n variant?: 'container' | 'full-page';\n}\n\nexport namespace CardsProps {\n export interface CardDefinition<T> {\n header?(item: T): React.ReactNode;\n sections?: ReadonlyArray<SectionDefinition<T>>;\n }\n\n export interface SectionDefinition<T> {\n id?: string;\n header?: React.ReactNode;\n content?(item: T): React.ReactNode;\n width?: number;\n }\n\n export interface CardsLayout {\n cards: number;\n minWidth?: number;\n }\n\n export type TrackBy<T> = string | ((item: T) => string);\n\n export type SelectionType = 'single' | 'multi';\n\n export interface SelectionState<T> {\n selectedItems: ReadonlyArray<T>;\n }\n\n export interface SelectionChangeDetail<T> {\n selectedItems: T[];\n }\n\n export type IsItemDisabled<T> = (item: T) => boolean;\n\n export interface AriaLabels<T> {\n itemSelectionLabel: (data: CardsProps.SelectionState<T>, row: T) => string;\n selectionGroupLabel: string;\n }\n export interface Ref {\n /**\n * When the sticky header is enabled, calling this function scrolls cards's\n * scroll parent up to reveal the first card or row of cards.\n */\n scrollToTop(): void;\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
1
  import { ContentLayoutProps } from './interfaces';
2
2
  export { ContentLayoutProps };
3
- export default function ContentLayout({ children, disableOverlap, header, ...rest }: ContentLayoutProps): JSX.Element;
3
+ export default function ContentLayout(props: ContentLayoutProps): JSX.Element;
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/content-layout/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AASlD,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAE9B,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,EAAE,kBAAkB,eAkDtG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/content-layout/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAIlD,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAE9B,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,KAAK,EAAE,kBAAkB,eAG9D"}
@@ -1,39 +1,13 @@
1
- import { __assign, __rest } from "tslib";
1
+ import { __assign } from "tslib";
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
- import React, { useRef } from 'react';
5
- import clsx from 'clsx';
4
+ import React from 'react';
6
5
  import { applyDisplayName } from '../internal/utils/apply-display-name';
7
- import { getBaseProps } from '../internal/base-component';
8
- import { useAppLayoutContext } from '../internal/context/app-layout-context';
6
+ import InternalContentLayout from './internal';
9
7
  import useBaseComponent from '../internal/hooks/use-base-component';
10
- import { useDynamicOverlap } from '../internal/hooks/use-dynamic-overlap';
11
- import { useMergeRefs } from '../internal/hooks/use-merge-refs';
12
- import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
13
- import styles from './styles.css.js';
14
- export default function ContentLayout(_a) {
15
- var _b, _c, _d;
16
- var children = _a.children, disableOverlap = _a.disableOverlap, header = _a.header, rest = __rest(_a, ["children", "disableOverlap", "header"]);
17
- var baseProps = getBaseProps(rest);
18
- var hasBreadcrumbs = useAppLayoutContext().hasBreadcrumbs;
19
- var rootElement = useRef(null);
20
- var __internalRootRef = useBaseComponent('ContentLayout').__internalRootRef;
21
- var mergedRef = useMergeRefs(rootElement, __internalRootRef);
22
- var overlapElement = useDynamicOverlap();
23
- var isVisualRefresh = useVisualRefresh();
24
- /**
25
- * Disable the overlap if the component is missing either a header or child
26
- * content. If the component is not using visual refresh then the overlap
27
- * will not be displayed at all. This is handled in the CSS not the JavaScript.
28
- */
29
- var isOverlapDisabled = !children || !header || disableOverlap;
30
- return (React.createElement("div", __assign({}, baseProps, { className: clsx(baseProps.className, styles.layout, (_b = {},
31
- _b[styles['is-overlap-disabled']] = isOverlapDisabled,
32
- _b[styles['is-visual-refresh']] = isVisualRefresh,
33
- _b)), ref: mergedRef }),
34
- React.createElement("div", { className: clsx(styles.background, (_c = {}, _c[styles['is-overlap-disabled']] = isOverlapDisabled, _c), 'awsui-context-content-header'), ref: overlapElement }),
35
- header && (React.createElement("div", { className: clsx(styles.header, (_d = {}, _d[styles['has-breadcrumbs']] = isVisualRefresh && hasBreadcrumbs, _d), 'awsui-context-content-header') }, header)),
36
- React.createElement("div", { className: styles.content }, children)));
8
+ export default function ContentLayout(props) {
9
+ var baseComponentProps = useBaseComponent('ContentLayout');
10
+ return React.createElement(InternalContentLayout, __assign({}, props, baseComponentProps));
37
11
  }
38
12
  applyDisplayName(ContentLayout, 'ContentLayout');
39
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/content-layout/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAIrC,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAiE;;IAA/D,IAAA,QAAQ,cAAA,EAAE,cAAc,oBAAA,EAAE,MAAM,YAAA,EAAK,IAAI,c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.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport clsx from 'clsx';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { ContentLayoutProps } from './interfaces';\nimport { getBaseProps } from '../internal/base-component';\nimport { useAppLayoutContext } from '../internal/context/app-layout-context';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useDynamicOverlap } from '../internal/hooks/use-dynamic-overlap';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport styles from './styles.css.js';\n\nexport { ContentLayoutProps };\n\nexport default function ContentLayout({ children, disableOverlap, header, ...rest }: ContentLayoutProps) {\n const baseProps = getBaseProps(rest);\n const { hasBreadcrumbs } = useAppLayoutContext();\n\n const rootElement = useRef<HTMLDivElement>(null);\n const { __internalRootRef } = useBaseComponent('ContentLayout');\n const mergedRef = useMergeRefs(rootElement, __internalRootRef);\n const overlapElement = useDynamicOverlap();\n const isVisualRefresh = useVisualRefresh();\n\n /**\n * Disable the overlap if the component is missing either a header or child\n * content. If the component is not using visual refresh then the overlap\n * will not be displayed at all. This is handled in the CSS not the JavaScript.\n */\n const isOverlapDisabled = !children || !header || disableOverlap;\n\n return (\n <div\n {...baseProps}\n className={clsx(baseProps.className, styles.layout, {\n [styles['is-overlap-disabled']]: isOverlapDisabled,\n [styles['is-visual-refresh']]: isVisualRefresh,\n })}\n ref={mergedRef}\n >\n <div\n className={clsx(\n styles.background,\n { [styles['is-overlap-disabled']]: isOverlapDisabled },\n 'awsui-context-content-header'\n )}\n ref={overlapElement}\n />\n\n {header && (\n <div\n className={clsx(\n styles.header,\n { [styles['has-breadcrumbs']]: isVisualRefresh && hasBreadcrumbs },\n 'awsui-context-content-header'\n )}\n >\n {header}\n </div>\n )}\n\n <div className={styles.content}>{children}</div>\n </div>\n );\n}\n\napplyDisplayName(ContentLayout, 'ContentLayout');\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/content-layout/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,qBAAqB,MAAM,YAAY,CAAC;AAC/C,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AAIpE,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,KAAyB;IAC7D,IAAM,kBAAkB,GAAG,gBAAgB,CAAC,eAAe,CAAC,CAAC;IAC7D,OAAO,oBAAC,qBAAqB,eAAK,KAAK,EAAM,kBAAkB,EAAI,CAAC;AACtE,CAAC;AAED,gBAAgB,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { ContentLayoutProps } from './interfaces';\nimport InternalContentLayout from './internal';\nimport useBaseComponent from '../internal/hooks/use-base-component';\n\nexport { ContentLayoutProps };\n\nexport default function ContentLayout(props: ContentLayoutProps) {\n const baseComponentProps = useBaseComponent('ContentLayout');\n return <InternalContentLayout {...props} {...baseComponentProps} />;\n}\n\napplyDisplayName(ContentLayout, 'ContentLayout');\n"]}
@@ -0,0 +1,6 @@
1
+ import { ContentLayoutProps } from './interfaces';
2
+ import { InternalBaseComponentProps } from '../internal/hooks/use-base-component';
3
+ type InternalContentLayoutProps = ContentLayoutProps & InternalBaseComponentProps;
4
+ export default function InternalContentLayout({ children, disableOverlap, header, __internalRootRef, ...rest }: InternalContentLayoutProps): JSX.Element;
5
+ export {};
6
+ //# sourceMappingURL=internal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/content-layout/internal.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAOlF,KAAK,0BAA0B,GAAG,kBAAkB,GAAG,0BAA0B,CAAC;AAElF,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAC5C,QAAQ,EACR,cAAc,EACd,MAAM,EACN,iBAAiB,EACjB,GAAG,IAAI,EACR,EAAE,0BAA0B,eAiD5B"}
@@ -0,0 +1,35 @@
1
+ import { __assign, __rest } from "tslib";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ import React, { useRef } from 'react';
5
+ import clsx from 'clsx';
6
+ import { getBaseProps } from '../internal/base-component';
7
+ import { useAppLayoutContext } from '../internal/context/app-layout-context';
8
+ import { useDynamicOverlap } from '../internal/hooks/use-dynamic-overlap';
9
+ import { useMergeRefs } from '../internal/hooks/use-merge-refs';
10
+ import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
11
+ import styles from './styles.css.js';
12
+ export default function InternalContentLayout(_a) {
13
+ var _b, _c, _d;
14
+ var children = _a.children, disableOverlap = _a.disableOverlap, header = _a.header, __internalRootRef = _a.__internalRootRef, rest = __rest(_a, ["children", "disableOverlap", "header", "__internalRootRef"]);
15
+ var baseProps = getBaseProps(rest);
16
+ var rootElement = useRef(null);
17
+ var mergedRef = useMergeRefs(rootElement, __internalRootRef);
18
+ var isVisualRefresh = useVisualRefresh();
19
+ var hasBreadcrumbs = useAppLayoutContext().hasBreadcrumbs;
20
+ var overlapElement = useDynamicOverlap();
21
+ /**
22
+ * Disable the overlap if the component is missing either a header or child
23
+ * content. If the component is not using visual refresh then the overlap
24
+ * will not be displayed at all. This is handled in the CSS not the JavaScript.
25
+ */
26
+ var isOverlapDisabled = !children || !header || disableOverlap;
27
+ return (React.createElement("div", __assign({}, baseProps, { className: clsx(baseProps.className, styles.layout, (_b = {},
28
+ _b[styles['is-overlap-disabled']] = isOverlapDisabled,
29
+ _b[styles['is-visual-refresh']] = isVisualRefresh,
30
+ _b)), ref: mergedRef }),
31
+ React.createElement("div", { className: clsx(styles.background, (_c = {}, _c[styles['is-overlap-disabled']] = isOverlapDisabled, _c), 'awsui-context-content-header'), ref: overlapElement }),
32
+ header && (React.createElement("div", { className: clsx(styles.header, (_d = {}, _d[styles['has-breadcrumbs']] = isVisualRefresh && hasBreadcrumbs, _d), 'awsui-context-content-header') }, header)),
33
+ React.createElement("div", { className: styles.content }, children)));
34
+ }
35
+ //# sourceMappingURL=internal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/content-layout/internal.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,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAIrC,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAMjB;;IAL3B,IAAA,QAAQ,cAAA,EACR,cAAc,oBAAA,EACd,MAAM,YAAA,EACN,iBAAiB,uBAAA,EACd,IAAI,cALqC,6DAM7C,CADQ;IAEP,IAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACrC,IAAM,WAAW,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IACjD,IAAM,SAAS,GAAG,YAAY,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC;IAE/D,IAAM,eAAe,GAAG,gBAAgB,EAAE,CAAC;IACnC,IAAA,cAAc,GAAK,mBAAmB,EAAE,eAA1B,CAA2B;IACjD,IAAM,cAAc,GAAG,iBAAiB,EAAE,CAAC;IAE3C;;;;OAIG;IACH,IAAM,iBAAiB,GAAG,CAAC,QAAQ,IAAI,CAAC,MAAM,IAAI,cAAc,CAAC;IAEjE,OAAO,CACL,wCACM,SAAS,IACb,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM;YAChD,GAAC,MAAM,CAAC,qBAAqB,CAAC,IAAG,iBAAiB;YAClD,GAAC,MAAM,CAAC,mBAAmB,CAAC,IAAG,eAAe;gBAC9C,EACF,GAAG,EAAE,SAAS;QAEd,6BACE,SAAS,EAAE,IAAI,CACb,MAAM,CAAC,UAAU,YACf,GAAC,MAAM,CAAC,qBAAqB,CAAC,IAAG,iBAAiB,OACpD,8BAA8B,CAC/B,EACD,GAAG,EAAE,cAAc,GACnB;QAED,MAAM,IAAI,CACT,6BACE,SAAS,EAAE,IAAI,CACb,MAAM,CAAC,MAAM,YACX,GAAC,MAAM,CAAC,iBAAiB,CAAC,IAAG,eAAe,IAAI,cAAc,OAChE,8BAA8B,CAC/B,IAEA,MAAM,CACH,CACP;QAED,6BAAK,SAAS,EAAE,MAAM,CAAC,OAAO,IAAG,QAAQ,CAAO,CAC5C,CACP,CAAC;AACJ,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';\nimport { ContentLayoutProps } from './interfaces';\nimport { getBaseProps } from '../internal/base-component';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useAppLayoutContext } from '../internal/context/app-layout-context';\nimport { useDynamicOverlap } from '../internal/hooks/use-dynamic-overlap';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport styles from './styles.css.js';\n\ntype InternalContentLayoutProps = ContentLayoutProps & InternalBaseComponentProps;\n\nexport default function InternalContentLayout({\n children,\n disableOverlap,\n header,\n __internalRootRef,\n ...rest\n}: InternalContentLayoutProps) {\n const baseProps = getBaseProps(rest);\n const rootElement = useRef<HTMLDivElement>(null);\n const mergedRef = useMergeRefs(rootElement, __internalRootRef);\n\n const isVisualRefresh = useVisualRefresh();\n const { hasBreadcrumbs } = useAppLayoutContext();\n const overlapElement = useDynamicOverlap();\n\n /**\n * Disable the overlap if the component is missing either a header or child\n * content. If the component is not using visual refresh then the overlap\n * will not be displayed at all. This is handled in the CSS not the JavaScript.\n */\n const isOverlapDisabled = !children || !header || disableOverlap;\n\n return (\n <div\n {...baseProps}\n className={clsx(baseProps.className, styles.layout, {\n [styles['is-overlap-disabled']]: isOverlapDisabled,\n [styles['is-visual-refresh']]: isVisualRefresh,\n })}\n ref={mergedRef}\n >\n <div\n className={clsx(\n styles.background,\n { [styles['is-overlap-disabled']]: isOverlapDisabled },\n 'awsui-context-content-header'\n )}\n ref={overlapElement}\n />\n\n {header && (\n <div\n className={clsx(\n styles.header,\n { [styles['has-breadcrumbs']]: isVisualRefresh && hasBreadcrumbs },\n 'awsui-context-content-header'\n )}\n >\n {header}\n </div>\n )}\n\n <div className={styles.content}>{children}</div>\n </div>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"collapsible-flashbar.d.ts","sourceRoot":"","sources":["../../../src/flashbar/collapsible-flashbar.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAkB7C,OAAO,EAAE,aAAa,EAAE,CAAC;AAQzB,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,EAAE,KAAK,EAAE,GAAG,SAAS,EAAE,EAAE,aAAa,eAmTjF"}
1
+ {"version":3,"file":"collapsible-flashbar.d.ts","sourceRoot":"","sources":["../../../src/flashbar/collapsible-flashbar.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAiB7C,OAAO,EAAE,aAAa,EAAE,CAAC;AAQzB,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,EAAE,KAAK,EAAE,GAAG,SAAS,EAAE,EAAE,aAAa,eA+SjF"}
@@ -18,7 +18,6 @@ import { sendToggleMetric } from './internal/analytics';
18
18
  import { useFlashbar } from './common';
19
19
  import { throttle } from '../internal/utils/throttle';
20
20
  import { scrollElementIntoView } from '../internal/utils/scrollable-containers';
21
- import { findUpUntil } from '../internal/utils/dom';
22
21
  // If the number of items is equal or less than this value,
23
22
  // the toggle element will not be displayed and the Flashbar will look like a regular single-item Flashbar.
24
23
  var maxNonCollapsibleItems = 1;
@@ -80,6 +79,7 @@ export default function CollapsibleFlashbar(_a) {
80
79
  }, [isFlashbarStackExpanded]);
81
80
  var updateBottomSpacing = useMemo(function () {
82
81
  return throttle(function () {
82
+ var _a;
83
83
  // Allow vertical space between Flashbar and page bottom only when the Flashbar is reaching the end of the page,
84
84
  // otherwise avoid spacing with eventual sticky elements below.
85
85
  var listElement = listElementRef === null || listElementRef === void 0 ? void 0 : listElementRef.current;
@@ -91,7 +91,7 @@ export default function CollapsibleFlashbar(_a) {
91
91
  var windowHeight = window.innerHeight;
92
92
  // Take the parent region into account if using the App Layout, because it might have additional margins.
93
93
  // Otherwise we use the Flashbar component for this calculation.
94
- var outerElement = findUpUntil(flashbar, function (element) { return element.getAttribute('role') === 'region'; }) || flashbar;
94
+ var outerElement = ((_a = flashbar.parentElement) === null || _a === void 0 ? void 0 : _a.parentElement) || flashbar;
95
95
  var applySpacing = isFlashbarStackExpanded && Math.ceil(outerElement.getBoundingClientRect().bottom) >= windowHeight;
96
96
  if (!applySpacing) {
97
97
  flashbar.classList.add(styles.floating);
@@ -188,10 +188,10 @@ export default function CollapsibleFlashbar(_a) {
188
188
  className: clsx(animateFlash && styles['flash-with-motion'], isVisualRefresh && styles['flash-refresh']), key: getItemId(item), ref: shouldUseStandardAnimation(item, index) ? transitionRootElement : undefined, transitionState: shouldUseStandardAnimation(item, index) ? state : undefined }, item)))));
189
189
  })); }))));
190
190
  };
191
- return (React.createElement("div", __assign({}, baseProps, { className: clsx(baseProps.className, styles.flashbar, styles["breakpoint-".concat(breakpoint)], styles.stack, isCollapsible && styles.collapsible, items.length === 2 && styles['short-list'], isFlashbarStackExpanded && styles.expanded, isVisualRefresh && styles['visual-refresh'], getVisualContextClassname('flashbar')), ref: mergedRef }),
191
+ return (React.createElement("div", __assign({}, baseProps, { className: clsx(baseProps.className, styles.flashbar, styles["breakpoint-".concat(breakpoint)], styles.stack, isFlashbarStackExpanded && styles.expanded, getVisualContextClassname('flashbar')), ref: mergedRef }),
192
192
  React.createElement(React.Fragment, null,
193
193
  isFlashbarStackExpanded && renderList(),
194
- isCollapsible && (React.createElement("div", { className: clsx(styles['notification-bar'], isVisualRefresh && styles['visual-refresh'], isFlashbarStackExpanded ? styles.expanded : styles.collapsed, transitioning && styles['animation-running'], items.length === 2 && styles['short-list']), onClick: toggleCollapseExpand, ref: notificationBarRef },
194
+ isCollapsible && (React.createElement("div", { className: clsx(styles['notification-bar'], isVisualRefresh && styles['visual-refresh'], isFlashbarStackExpanded ? styles.expanded : styles.collapsed, transitioning && styles['animation-running']), onClick: toggleCollapseExpand, ref: notificationBarRef },
195
195
  React.createElement("span", { "aria-live": "polite", className: styles.status, role: "status", id: itemCountElementId },
196
196
  notificationBarText && React.createElement("h2", { className: styles.header }, notificationBarText),
197
197
  React.createElement("span", { className: styles['item-count'] }, counterTypes.map(function (_a) {
@@ -1 +1 @@
1
- {"version":3,"file":"collapsible-flashbar.js","sourceRoot":"","sources":["../../../src/flashbar/collapsible-flashbar.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ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AM,CAAC,cAAc,CAAC,IAAG,KAAK,CAAQ,CAClD,CACR,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';\nimport customCssProps from '../internal/generated/custom-css-properties';\nimport { Flash, focusFlashById } from './flash';\nimport { FlashbarProps } from './interfaces';\nimport InternalIcon from '../icon/internal';\nimport { TransitionGroup } from 'react-transition-group';\nimport { Transition } from '../internal/components/transition';\nimport useFocusVisible from '../internal/hooks/focus-visible';\nimport { getVisualContextClassname } from '../internal/components/visual-context';\n\nimport styles from './styles.css.js';\nimport { counterTypes, getFlashTypeCount, getVisibleCollapsedItems, StackableItem } from './utils';\nimport { animate, getDOMRects } from '../internal/animate';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { IconProps } from '../icon/interfaces';\nimport { sendToggleMetric } from './internal/analytics';\nimport { useFlashbar } from './common';\nimport { throttle } from '../internal/utils/throttle';\nimport { scrollElementIntoView } from '../internal/utils/scrollable-containers';\nimport { findUpUntil } from '../internal/utils/dom';\n\nexport { FlashbarProps };\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, ...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 { ariaLabel, baseProps, breakpoint, isReducedMotion, isVisualRefresh, mergedRef, ref } = 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 const isFocusVisible = useFocusVisible();\n const collapsedItemRefs = useRef<Record<string | number, HTMLElement | null>>({});\n const expandedItemRefs = useRef<Record<string | number, HTMLElement | null>>({});\n const [initialAnimationState, setInitialAnimationState] = useState<Record<string | number, 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 if (items.length <= maxNonCollapsibleItems && isFlashbarStackExpanded) {\n setIsFlashbarStackExpanded(false);\n }\n\n const animateFlash = !isReducedMotion;\n\n function toggleCollapseExpand() {\n sendToggleMetric(items.length, !isFlashbarStackExpanded);\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 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 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 // When collapsing, scroll up if necessary to avoid losing track of the focused button\n if (!isFlashbarStackExpanded && notificationBarRef.current) {\n scrollElementIntoView(notificationBarRef.current);\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 stackDepth = Math.min(3, 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 notificationBarText = i18nStrings?.notificationBarText;\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 <TransitionGroup component={null}>\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 !isFlashbarStackExpanded || transitioning\n ? {\n [customCssProps.flashbarStackIndex]:\n (item as StackableItem).collapsedIndex ?? (item as StackableItem).expandedIndex ?? index,\n }\n : undefined\n }\n key={getItemId(item)}\n >\n {showInnerContent(item) && (\n <Flash\n // eslint-disable-next-line react/forbid-component-props\n className={clsx(\n animateFlash && styles['flash-with-motion'],\n isVisualRefresh && styles['flash-refresh']\n )}\n key={getItemId(item)}\n ref={shouldUseStandardAnimation(item, index) ? transitionRootElement : undefined}\n transitionState={shouldUseStandardAnimation(item, index) ? state : undefined}\n {...item}\n />\n )}\n </li>\n )}\n </Transition>\n ))}\n </TransitionGroup>\n </ul>\n );\n\n return (\n <div\n {...baseProps}\n className={clsx(\n baseProps.className,\n styles.flashbar,\n styles[`breakpoint-${breakpoint}`],\n styles.stack,\n isCollapsible && styles.collapsible,\n items.length === 2 && styles['short-list'],\n isFlashbarStackExpanded && styles.expanded,\n isVisualRefresh && styles['visual-refresh'],\n getVisualContextClassname('flashbar')\n )}\n ref={mergedRef}\n >\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 )}\n onClick={toggleCollapseExpand}\n ref={notificationBarRef}\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={i18nStrings ? i18nStrings[labelName] : undefined}\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={i18nStrings?.notificationBarAriaLabel}\n className={clsx(styles.button, isFlashbarStackExpanded && styles.expanded)}\n {...isFocusVisible}\n >\n <InternalIcon className={styles.icon} size=\"normal\" name=\"angle-down\" />\n </button>\n </div>\n )}\n {!isFlashbarStackExpanded && renderList()}\n </>\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 aria-label={label} role=\"img\">\n <span title={label} aria-hidden=\"true\">\n <InternalIcon name={iconName} />\n </span>\n </span>\n <span className={styles['count-number']}>{count}</span>\n </span>\n );\n};\n"]}
1
+ {"version":3,"file":"collapsible-flashbar.js","sourceRoot":"","sources":["../../../src/flashbar/collapsible-flashbar.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACvF,OAAO,cAAc,MAAM,6CAA6C,CAAC;AACzE,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEhD,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,C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AAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,uBAAuB,IAAI,MAAM,CAAC,QAAQ,CAAC,IACtE,cAAc;oBAElB,oBAAC,YAAY,IAAC,SAAS,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,EAAC,QAAQ,EAAC,IAAI,EAAC,YAAY,GAAG,CACjE,CACL,CACP;YACA,CAAC,uBAAuB,IAAI,UAAU,EAAE,CACxC,CACC,CACP,CAAC;AACJ,CAAC;AAED,IAAM,qBAAqB,GAAG,UAAC,EAQ9B;QAPC,QAAQ,cAAA,EACR,KAAK,WAAA,EACL,KAAK,WAAA;IAML,OAAO,CACL,8BAAM,SAAS,EAAE,MAAM,CAAC,YAAY,CAAC;QACnC,4CAAkB,KAAK,EAAE,IAAI,EAAC,KAAK;YACjC,8BAAM,KAAK,EAAE,KAAK,iBAAc,MAAM;gBACpC,oBAAC,YAAY,IAAC,IAAI,EAAE,QAAQ,GAAI,CAC3B,CACF;QACP,8BAAM,SAAS,EAAE,MAAM,CAAC,cAAc,CAAC,IAAG,KAAK,CAAQ,CAClD,CACR,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';\nimport customCssProps from '../internal/generated/custom-css-properties';\nimport { Flash, focusFlashById } from './flash';\nimport { FlashbarProps } from './interfaces';\nimport InternalIcon from '../icon/internal';\nimport { TransitionGroup } from 'react-transition-group';\nimport { Transition } from '../internal/components/transition';\nimport useFocusVisible from '../internal/hooks/focus-visible';\nimport { getVisualContextClassname } from '../internal/components/visual-context';\n\nimport styles from './styles.css.js';\nimport { counterTypes, getFlashTypeCount, getVisibleCollapsedItems, StackableItem } from './utils';\nimport { animate, getDOMRects } from '../internal/animate';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { IconProps } from '../icon/interfaces';\nimport { sendToggleMetric } from './internal/analytics';\nimport { useFlashbar } from './common';\nimport { throttle } from '../internal/utils/throttle';\nimport { scrollElementIntoView } from '../internal/utils/scrollable-containers';\n\nexport { FlashbarProps };\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, ...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 { ariaLabel, baseProps, breakpoint, isReducedMotion, isVisualRefresh, mergedRef, ref } = 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 const isFocusVisible = useFocusVisible();\n const collapsedItemRefs = useRef<Record<string | number, HTMLElement | null>>({});\n const expandedItemRefs = useRef<Record<string | number, HTMLElement | null>>({});\n const [initialAnimationState, setInitialAnimationState] = useState<Record<string | number, 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 if (items.length <= maxNonCollapsibleItems && isFlashbarStackExpanded) {\n setIsFlashbarStackExpanded(false);\n }\n\n const animateFlash = !isReducedMotion;\n\n function toggleCollapseExpand() {\n sendToggleMetric(items.length, !isFlashbarStackExpanded);\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 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 = flashbar.parentElement?.parentElement || 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 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 // When collapsing, scroll up if necessary to avoid losing track of the focused button\n if (!isFlashbarStackExpanded && notificationBarRef.current) {\n scrollElementIntoView(notificationBarRef.current);\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 stackDepth = Math.min(3, 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 notificationBarText = i18nStrings?.notificationBarText;\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 <TransitionGroup component={null}>\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 !isFlashbarStackExpanded || transitioning\n ? {\n [customCssProps.flashbarStackIndex]:\n (item as StackableItem).collapsedIndex ?? (item as StackableItem).expandedIndex ?? index,\n }\n : undefined\n }\n key={getItemId(item)}\n >\n {showInnerContent(item) && (\n <Flash\n // eslint-disable-next-line react/forbid-component-props\n className={clsx(\n animateFlash && styles['flash-with-motion'],\n isVisualRefresh && styles['flash-refresh']\n )}\n key={getItemId(item)}\n ref={shouldUseStandardAnimation(item, index) ? transitionRootElement : undefined}\n transitionState={shouldUseStandardAnimation(item, index) ? state : undefined}\n {...item}\n />\n )}\n </li>\n )}\n </Transition>\n ))}\n </TransitionGroup>\n </ul>\n );\n\n return (\n <div\n {...baseProps}\n className={clsx(\n baseProps.className,\n styles.flashbar,\n styles[`breakpoint-${breakpoint}`],\n styles.stack,\n isFlashbarStackExpanded && styles.expanded,\n getVisualContextClassname('flashbar')\n )}\n ref={mergedRef}\n >\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 )}\n onClick={toggleCollapseExpand}\n ref={notificationBarRef}\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={i18nStrings ? i18nStrings[labelName] : undefined}\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={i18nStrings?.notificationBarAriaLabel}\n className={clsx(styles.button, isFlashbarStackExpanded && styles.expanded)}\n {...isFocusVisible}\n >\n <InternalIcon className={styles.icon} size=\"normal\" name=\"angle-down\" />\n </button>\n </div>\n )}\n {!isFlashbarStackExpanded && renderList()}\n </>\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 aria-label={label} role=\"img\">\n <span title={label} aria-hidden=\"true\">\n <InternalIcon name={iconName} />\n </span>\n </span>\n <span className={styles['count-number']}>{count}</span>\n </span>\n );\n};\n"]}