@cloudscape-design/components 3.0.310 → 3.0.312

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 (205) hide show
  1. package/button/internal.d.ts +6 -0
  2. package/button/internal.d.ts.map +1 -1
  3. package/button/internal.js +6 -8
  4. package/button/internal.js.map +1 -1
  5. package/code-editor/resizable-box/styles.css.js +3 -3
  6. package/code-editor/resizable-box/styles.scoped.css +10 -8
  7. package/code-editor/resizable-box/styles.selectors.js +3 -3
  8. package/code-editor/styles.css.js +32 -32
  9. package/code-editor/styles.scoped.css +189 -157
  10. package/code-editor/styles.selectors.js +32 -32
  11. package/collection-preferences/content-display/index.js +1 -1
  12. package/collection-preferences/content-display/index.js.map +1 -1
  13. package/container/interfaces.d.ts +50 -0
  14. package/container/interfaces.d.ts.map +1 -1
  15. package/container/interfaces.js.map +1 -1
  16. package/container/internal.d.ts +1 -1
  17. package/container/internal.d.ts.map +1 -1
  18. package/container/internal.js +24 -18
  19. package/container/internal.js.map +1 -1
  20. package/container/styles.css.js +28 -18
  21. package/container/styles.scoped.css +93 -36
  22. package/container/styles.selectors.js +28 -18
  23. package/date-range-picker/calendar/header/index.d.ts.map +1 -1
  24. package/date-range-picker/calendar/header/index.js +4 -2
  25. package/date-range-picker/calendar/header/index.js.map +1 -1
  26. package/date-range-picker/calendar/index.js +1 -1
  27. package/date-range-picker/calendar/index.js.map +1 -1
  28. package/expandable-section/expandable-section-header.d.ts +2 -1
  29. package/expandable-section/expandable-section-header.d.ts.map +1 -1
  30. package/expandable-section/expandable-section-header.js +6 -16
  31. package/expandable-section/expandable-section-header.js.map +1 -1
  32. package/expandable-section/internal.d.ts.map +1 -1
  33. package/expandable-section/internal.js +3 -2
  34. package/expandable-section/internal.js.map +1 -1
  35. package/form/index.d.ts.map +1 -1
  36. package/form/index.js +14 -1
  37. package/form/index.js.map +1 -1
  38. package/form/internal.d.ts.map +1 -1
  39. package/form/internal.js +3 -4
  40. package/form/internal.js.map +1 -1
  41. package/form-field/internal.js +2 -3
  42. package/form-field/internal.js.map +1 -1
  43. package/help-panel/styles.css.js +4 -4
  44. package/help-panel/styles.scoped.css +135 -95
  45. package/help-panel/styles.selectors.js +4 -4
  46. package/i18n/context.d.ts +14 -7
  47. package/i18n/context.d.ts.map +1 -1
  48. package/i18n/context.js.map +1 -1
  49. package/i18n/messages/all.all.js +3692 -538
  50. package/i18n/messages/all.all.json +3756 -577
  51. package/i18n/messages/all.de.js +317 -22
  52. package/i18n/messages/all.de.json +324 -27
  53. package/i18n/messages/all.en-GB.js +306 -21
  54. package/i18n/messages/all.en-GB.json +309 -24
  55. package/i18n/messages/all.en.js +11 -11
  56. package/i18n/messages/all.en.json +11 -11
  57. package/i18n/messages/all.es.js +311 -22
  58. package/i18n/messages/all.es.json +318 -25
  59. package/i18n/messages/all.fr.js +335 -27
  60. package/i18n/messages/all.fr.json +343 -30
  61. package/i18n/messages/all.id.js +319 -28
  62. package/i18n/messages/all.id.json +322 -31
  63. package/i18n/messages/all.it.js +320 -27
  64. package/i18n/messages/all.it.json +326 -30
  65. package/i18n/messages/all.ja.js +312 -28
  66. package/i18n/messages/all.ja.json +315 -30
  67. package/i18n/messages/all.ko.js +304 -24
  68. package/i18n/messages/all.ko.json +312 -25
  69. package/i18n/messages/all.pt-BR.js +313 -28
  70. package/i18n/messages/all.pt-BR.json +325 -31
  71. package/i18n/messages/all.zh-CN.js +301 -29
  72. package/i18n/messages/all.zh-CN.json +300 -31
  73. package/i18n/messages/all.zh-TW.js +295 -23
  74. package/i18n/messages/all.zh-TW.json +294 -25
  75. package/i18n/messages-types.d.ts +435 -0
  76. package/i18n/messages-types.d.ts.map +1 -0
  77. package/i18n/messages-types.js +5 -0
  78. package/i18n/messages-types.js.map +1 -0
  79. package/i18n/provider.d.ts.map +1 -1
  80. package/i18n/provider.js +2 -0
  81. package/i18n/provider.js.map +1 -1
  82. package/internal/analytics/components/analytics-funnel.d.ts +2 -1
  83. package/internal/analytics/components/analytics-funnel.d.ts.map +1 -1
  84. package/internal/analytics/components/analytics-funnel.js +6 -4
  85. package/internal/analytics/components/analytics-funnel.js.map +1 -1
  86. package/internal/analytics/context/analytics-context.d.ts +2 -0
  87. package/internal/analytics/context/analytics-context.d.ts.map +1 -1
  88. package/internal/analytics/context/analytics-context.js +2 -0
  89. package/internal/analytics/context/analytics-context.js.map +1 -1
  90. package/internal/analytics/hooks/use-funnel.d.ts +3 -7
  91. package/internal/analytics/hooks/use-funnel.d.ts.map +1 -1
  92. package/internal/analytics/hooks/use-funnel.js +2 -7
  93. package/internal/analytics/hooks/use-funnel.js.map +1 -1
  94. package/internal/base-component/styles.scoped.css +382 -379
  95. package/internal/components/cartesian-chart/bottom-labels.js +1 -1
  96. package/internal/components/cartesian-chart/bottom-labels.js.map +1 -1
  97. package/internal/components/cartesian-chart/left-labels.js +1 -1
  98. package/internal/components/cartesian-chart/left-labels.js.map +1 -1
  99. package/internal/components/focus-lock/index.js +20 -19
  100. package/internal/components/focus-lock/index.js.map +1 -1
  101. package/internal/context/button-context.d.ts +10 -0
  102. package/internal/context/button-context.d.ts.map +1 -0
  103. package/internal/context/button-context.js +10 -0
  104. package/internal/context/button-context.js.map +1 -0
  105. package/internal/environment.js +1 -1
  106. package/internal/generated/theming/index.cjs +2 -1
  107. package/internal/generated/theming/index.js +2 -1
  108. package/internal/hooks/use-visual-mode/index.d.ts.map +1 -1
  109. package/internal/hooks/use-visual-mode/index.js +3 -0
  110. package/internal/hooks/use-visual-mode/index.js.map +1 -1
  111. package/internal/i18n/messages/all.all.js +3692 -538
  112. package/internal/i18n/messages/all.all.json +3756 -577
  113. package/internal/i18n/messages/all.de.js +317 -22
  114. package/internal/i18n/messages/all.de.json +324 -27
  115. package/internal/i18n/messages/all.en-GB.js +306 -21
  116. package/internal/i18n/messages/all.en-GB.json +309 -24
  117. package/internal/i18n/messages/all.en.js +11 -11
  118. package/internal/i18n/messages/all.en.json +11 -11
  119. package/internal/i18n/messages/all.es.js +311 -22
  120. package/internal/i18n/messages/all.es.json +318 -25
  121. package/internal/i18n/messages/all.fr.js +335 -27
  122. package/internal/i18n/messages/all.fr.json +343 -30
  123. package/internal/i18n/messages/all.id.js +319 -28
  124. package/internal/i18n/messages/all.id.json +322 -31
  125. package/internal/i18n/messages/all.it.js +320 -27
  126. package/internal/i18n/messages/all.it.json +326 -30
  127. package/internal/i18n/messages/all.ja.js +312 -28
  128. package/internal/i18n/messages/all.ja.json +315 -30
  129. package/internal/i18n/messages/all.ko.js +304 -24
  130. package/internal/i18n/messages/all.ko.json +312 -25
  131. package/internal/i18n/messages/all.pt-BR.js +313 -28
  132. package/internal/i18n/messages/all.pt-BR.json +325 -31
  133. package/internal/i18n/messages/all.zh-CN.js +301 -29
  134. package/internal/i18n/messages/all.zh-CN.json +300 -31
  135. package/internal/i18n/messages/all.zh-TW.js +295 -23
  136. package/internal/i18n/messages/all.zh-TW.json +294 -25
  137. package/internal/manifest.json +1 -1
  138. package/package.json +1 -2
  139. package/pagination/internal.d.ts.map +1 -1
  140. package/pagination/internal.js +4 -4
  141. package/pagination/internal.js.map +1 -1
  142. package/pie-chart/utils.d.ts +1 -1
  143. package/pie-chart/utils.d.ts.map +1 -1
  144. package/pie-chart/utils.js.map +1 -1
  145. package/property-filter/index.d.ts.map +1 -1
  146. package/property-filter/index.js +1 -1
  147. package/property-filter/index.js.map +1 -1
  148. package/s3-resource-selector/interfaces.d.ts +3 -0
  149. package/s3-resource-selector/interfaces.d.ts.map +1 -1
  150. package/s3-resource-selector/interfaces.js.map +1 -1
  151. package/s3-resource-selector/s3-in-context/index.js +1 -1
  152. package/s3-resource-selector/s3-in-context/index.js.map +1 -1
  153. package/s3-resource-selector/s3-in-context/validation.d.ts +1 -1
  154. package/s3-resource-selector/s3-in-context/validation.d.ts.map +1 -1
  155. package/s3-resource-selector/s3-in-context/validation.js.map +1 -1
  156. package/s3-resource-selector/s3-modal/basic-table.d.ts +3 -1
  157. package/s3-resource-selector/s3-modal/basic-table.d.ts.map +1 -1
  158. package/s3-resource-selector/s3-modal/basic-table.js +2 -1
  159. package/s3-resource-selector/s3-modal/basic-table.js.map +1 -1
  160. package/s3-resource-selector/s3-modal/index.js +1 -1
  161. package/s3-resource-selector/s3-modal/index.js.map +1 -1
  162. package/s3-resource-selector/s3-modal/table-utils.d.ts +1 -1
  163. package/s3-resource-selector/s3-modal/table-utils.d.ts.map +1 -1
  164. package/s3-resource-selector/s3-modal/table-utils.js.map +1 -1
  165. package/select/parts/filter.d.ts +1 -1
  166. package/space-between/interfaces.d.ts +5 -0
  167. package/space-between/interfaces.d.ts.map +1 -1
  168. package/space-between/interfaces.js.map +1 -1
  169. package/space-between/internal.d.ts +1 -1
  170. package/space-between/internal.d.ts.map +1 -1
  171. package/space-between/internal.js +2 -2
  172. package/space-between/internal.js.map +1 -1
  173. package/space-between/styles.css.js +21 -20
  174. package/space-between/styles.scoped.css +25 -21
  175. package/space-between/styles.selectors.js +21 -20
  176. package/tag-editor/interfaces.d.ts +1 -0
  177. package/tag-editor/interfaces.d.ts.map +1 -1
  178. package/tag-editor/interfaces.js.map +1 -1
  179. package/tag-editor/validation.d.ts +1 -1
  180. package/tag-editor/validation.d.ts.map +1 -1
  181. package/tag-editor/validation.js.map +1 -1
  182. package/test-utils/dom/container/index.d.ts +1 -0
  183. package/test-utils/dom/container/index.js +3 -0
  184. package/test-utils/dom/container/index.js.map +1 -1
  185. package/test-utils/dom/expandable-section/index.js +1 -1
  186. package/test-utils/dom/expandable-section/index.js.map +1 -1
  187. package/test-utils/selectors/container/index.d.ts +1 -0
  188. package/test-utils/selectors/container/index.js +3 -0
  189. package/test-utils/selectors/container/index.js.map +1 -1
  190. package/test-utils/selectors/expandable-section/index.js +1 -1
  191. package/test-utils/selectors/expandable-section/index.js.map +1 -1
  192. package/test-utils/tsconfig.tsbuildinfo +1 -1
  193. package/text-content/styles.css.js +1 -1
  194. package/text-content/styles.scoped.css +65 -64
  195. package/text-content/styles.selectors.js +1 -1
  196. package/top-navigation/parts/overflow-menu/views/submenu.js +2 -2
  197. package/top-navigation/parts/overflow-menu/views/submenu.js.map +1 -1
  198. package/top-navigation/parts/overflow-menu/views/utilities.js +2 -2
  199. package/top-navigation/parts/overflow-menu/views/utilities.js.map +1 -1
  200. package/wizard/internal.d.ts.map +1 -1
  201. package/wizard/internal.js +4 -2
  202. package/wizard/internal.js.map +1 -1
  203. package/wizard/wizard-form.d.ts.map +1 -1
  204. package/wizard/wizard-form.js +1 -2
  205. package/wizard/wizard-form.js.map +1 -1
@@ -2,37 +2,37 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "code-editor": "awsui_code-editor_1gl9c_1pa9a_98",
6
- "code-editor-refresh": "awsui_code-editor-refresh_1gl9c_1pa9a_342",
7
- "pane": "awsui_pane_1gl9c_1pa9a_354",
8
- "pane__close-container": "awsui_pane__close-container_1gl9c_1pa9a_365",
9
- "pane__list": "awsui_pane__list_1gl9c_1pa9a_370",
10
- "pane__table": "awsui_pane__table_1gl9c_1pa9a_377",
11
- "pane__item": "awsui_pane__item_1gl9c_1pa9a_382",
12
- "pane__cell": "awsui_pane__cell_1gl9c_1pa9a_382",
13
- "pane__item--highlighted": "awsui_pane__item--highlighted_1gl9c_1pa9a_396",
14
- "pane__location": "awsui_pane__location_1gl9c_1pa9a_417",
15
- "pane__description": "awsui_pane__description_1gl9c_1pa9a_417",
16
- "focus-lock": "awsui_focus-lock_1gl9c_1pa9a_432",
17
- "editor": "awsui_editor_1gl9c_1pa9a_457",
18
- "editor-refresh": "awsui_editor-refresh_1gl9c_1pa9a_485",
19
- "status-bar": "awsui_status-bar_1gl9c_1pa9a_490",
20
- "status-bar-with-hidden-pane": "awsui_status-bar-with-hidden-pane_1gl9c_1pa9a_499",
21
- "status-bar__left": "awsui_status-bar__left_1gl9c_1pa9a_503",
22
- "status-bar__left-virtual": "awsui_status-bar__left-virtual_1gl9c_1pa9a_510",
23
- "status-bar__right": "awsui_status-bar__right_1gl9c_1pa9a_514",
24
- "status-bar__language-mode": "awsui_status-bar__language-mode_1gl9c_1pa9a_518",
25
- "status-bar__cursor-position": "awsui_status-bar__cursor-position_1gl9c_1pa9a_518",
26
- "status-bar__cog-button": "awsui_status-bar__cog-button_1gl9c_1pa9a_523",
27
- "status-bar-virtual": "awsui_status-bar-virtual_1gl9c_1pa9a_527",
28
- "tab-button": "awsui_tab-button_1gl9c_1pa9a_533",
29
- "tab-button--refresh": "awsui_tab-button--refresh_1gl9c_1pa9a_546",
30
- "tab-button--active": "awsui_tab-button--active_1gl9c_1pa9a_560",
31
- "tab-button--disabled": "awsui_tab-button--disabled_1gl9c_1pa9a_580",
32
- "tab-button--divider": "awsui_tab-button--divider_1gl9c_1pa9a_610",
33
- "tab-button--errors": "awsui_tab-button--errors_1gl9c_1pa9a_617",
34
- "tab-button--warnings": "awsui_tab-button--warnings_1gl9c_1pa9a_617",
35
- "loading-screen": "awsui_loading-screen_1gl9c_1pa9a_621",
36
- "error-screen": "awsui_error-screen_1gl9c_1pa9a_622"
5
+ "code-editor": "awsui_code-editor_1gl9c_f74y9_98",
6
+ "code-editor-refresh": "awsui_code-editor-refresh_1gl9c_f74y9_374",
7
+ "pane": "awsui_pane_1gl9c_f74y9_386",
8
+ "pane__close-container": "awsui_pane__close-container_1gl9c_f74y9_397",
9
+ "pane__list": "awsui_pane__list_1gl9c_f74y9_402",
10
+ "pane__table": "awsui_pane__table_1gl9c_f74y9_409",
11
+ "pane__item": "awsui_pane__item_1gl9c_f74y9_414",
12
+ "pane__cell": "awsui_pane__cell_1gl9c_f74y9_414",
13
+ "pane__item--highlighted": "awsui_pane__item--highlighted_1gl9c_f74y9_428",
14
+ "pane__location": "awsui_pane__location_1gl9c_f74y9_449",
15
+ "pane__description": "awsui_pane__description_1gl9c_f74y9_449",
16
+ "focus-lock": "awsui_focus-lock_1gl9c_f74y9_464",
17
+ "editor": "awsui_editor_1gl9c_f74y9_489",
18
+ "editor-refresh": "awsui_editor-refresh_1gl9c_f74y9_517",
19
+ "status-bar": "awsui_status-bar_1gl9c_f74y9_522",
20
+ "status-bar-with-hidden-pane": "awsui_status-bar-with-hidden-pane_1gl9c_f74y9_531",
21
+ "status-bar__left": "awsui_status-bar__left_1gl9c_f74y9_535",
22
+ "status-bar__left-virtual": "awsui_status-bar__left-virtual_1gl9c_f74y9_542",
23
+ "status-bar__right": "awsui_status-bar__right_1gl9c_f74y9_546",
24
+ "status-bar__language-mode": "awsui_status-bar__language-mode_1gl9c_f74y9_550",
25
+ "status-bar__cursor-position": "awsui_status-bar__cursor-position_1gl9c_f74y9_550",
26
+ "status-bar__cog-button": "awsui_status-bar__cog-button_1gl9c_f74y9_555",
27
+ "status-bar-virtual": "awsui_status-bar-virtual_1gl9c_f74y9_559",
28
+ "tab-button": "awsui_tab-button_1gl9c_f74y9_565",
29
+ "tab-button--refresh": "awsui_tab-button--refresh_1gl9c_f74y9_578",
30
+ "tab-button--active": "awsui_tab-button--active_1gl9c_f74y9_592",
31
+ "tab-button--disabled": "awsui_tab-button--disabled_1gl9c_f74y9_612",
32
+ "tab-button--divider": "awsui_tab-button--divider_1gl9c_f74y9_642",
33
+ "tab-button--errors": "awsui_tab-button--errors_1gl9c_f74y9_649",
34
+ "tab-button--warnings": "awsui_tab-button--warnings_1gl9c_f74y9_649",
35
+ "loading-screen": "awsui_loading-screen_1gl9c_f74y9_653",
36
+ "error-screen": "awsui_error-screen_1gl9c_f74y9_654"
37
37
  };
38
38
 
@@ -33,7 +33,7 @@ export default function ContentDisplayPreference({ title, description, options,
33
33
  const announcements = useLiveAnnouncements({
34
34
  isDragging: activeItem !== null,
35
35
  liveAnnouncementDndStarted: i18n('contentDisplayPreference.liveAnnouncementDndStarted', liveAnnouncementDndStarted, format => (position, total) => format({ position, total })),
36
- liveAnnouncementDndItemReordered: i18n('contentDisplayPreference.liveAnnouncementDndItemReordered', liveAnnouncementDndItemReordered, format => (initialPosition, currentPosition, total) => format({ initialPosition, currentPosition, total, isInitialPosition: `${initialPosition === currentPosition}` })),
36
+ liveAnnouncementDndItemReordered: i18n('contentDisplayPreference.liveAnnouncementDndItemReordered', liveAnnouncementDndItemReordered, format => (initialPosition, currentPosition, total) => format({ currentPosition, total, isInitialPosition: `${initialPosition === currentPosition}` })),
37
37
  liveAnnouncementDndItemCommitted: i18n('contentDisplayPreference.liveAnnouncementDndItemCommitted', liveAnnouncementDndItemCommitted, format => (initialPosition, finalPosition, total) => format({ initialPosition, finalPosition, total, isInitialPosition: `${initialPosition === finalPosition}` })),
38
38
  liveAnnouncementDndDiscarded: i18n('contentDisplayPreference.liveAnnouncementDndDiscarded', liveAnnouncementDndDiscarded),
39
39
  sortedOptions: value,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["collection-preferences/content-display/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAGjE,OAAO,MAAM,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAwB,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAC5F,OAAO,eAAe,MAAM,oBAAoB,CAAC;AACjD,OAAO,qBAAqB,MAAM,6BAA6B,CAAC;AAChE,OAAO,oBAAoB,MAAM,0BAA0B,CAAC;AAC5D,OAAO,MAAM,MAAM,kCAAkC,CAAC;AACtD,OAAO,oBAAoB,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAE1C,MAAM,YAAY,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC,MAA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G,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,2BAA2B,IAC7F,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;oBAC1B,OAAO,CACL,oBAAC,eAAe,IACd,mBAAmB,EAAE,IAAI,CAAC,8CAA8C,EAAE,mBAAmB,CAAC,EAC9F,GAAG,EAAE,MAAM,CAAC,EAAE,EACd,SAAS,EAAE,aAAa,EACxB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,GACd,CACH,CAAC;gBACJ,CAAC,CAAC,CACc,CACf;YACL,oBAAC,MAAM;gBAOL,oBAAC,WAAW,IAAC,SAAS,EAAE,MAAM,CAAC,cAAc,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,IACzF,YAAY,IAAI,CACf,oBAAC,oBAAoB,IACnB,SAAS,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,EACvC,mBAAmB,EAAE,IAAI,CAAC,8CAA8C,EAAE,mBAAmB,CAAC,EAC9F,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,YAAY,GACpB,CACH,CACW,CACP,CACE,CACT,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { useUniqueId } from '../../internal/hooks/use-unique-id';\n\nimport { CollectionPreferencesProps } from '../interfaces';\nimport styles from '../styles.css.js';\nimport { getSortedOptions, OptionWithVisibility } from './utils';\nimport { DndContext, DragOverlay } from '@dnd-kit/core';\nimport { arrayMove, SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable';\nimport DraggableOption from './draggable-option';\nimport useDragAndDropReorder from './use-drag-and-drop-reorder';\nimport useLiveAnnouncements from './use-live-announcements';\nimport Portal from '../../internal/components/portal';\nimport ContentDisplayOption from './content-display-option';\nimport { useInternalI18n } from '../../internal/i18n/context';\n\nconst componentPrefix = 'content-display';\n\nconst getClassName = (suffix: string) => styles[`${componentPrefix}-${suffix}`];\n\ninterface ContentDisplayPreferenceProps extends CollectionPreferencesProps.ContentDisplayPreference {\n onChange: (value: ReadonlyArray<CollectionPreferencesProps.ContentDisplayItem>) => void;\n value?: ReadonlyArray<CollectionPreferencesProps.ContentDisplayItem>;\n}\n\nexport default function ContentDisplayPreference({\n title,\n description,\n options,\n value = options.map(({ id }) => ({\n id,\n visible: true,\n })),\n onChange,\n liveAnnouncementDndStarted,\n liveAnnouncementDndItemReordered,\n liveAnnouncementDndItemCommitted,\n liveAnnouncementDndDiscarded,\n dragHandleAriaDescription,\n dragHandleAriaLabel,\n}: ContentDisplayPreferenceProps) {\n const idPrefix = useUniqueId(componentPrefix);\n const i18n = useInternalI18n('collection-preferences');\n\n const onToggle = (option: OptionWithVisibility) => {\n onChange(value.map(item => (item.id === option.id ? { ...item, visible: !option.visible } : item)));\n };\n\n const titleId = `${idPrefix}-title`;\n const descriptionId = `${idPrefix}-description`;\n\n const sortedOptions = getSortedOptions({ options, contentDisplay: value });\n\n const { activeItem, collisionDetection, handleKeyDown, sensors, setActiveItem } = useDragAndDropReorder({\n sortedOptions,\n });\n\n const activeOption = activeItem ? sortedOptions.find(({ id }) => id === activeItem) : null;\n\n const announcements = useLiveAnnouncements({\n isDragging: activeItem !== null,\n liveAnnouncementDndStarted: i18n(\n 'contentDisplayPreference.liveAnnouncementDndStarted',\n liveAnnouncementDndStarted,\n format => (position, total) => format({ position, total })\n ),\n liveAnnouncementDndItemReordered: i18n(\n 'contentDisplayPreference.liveAnnouncementDndItemReordered',\n liveAnnouncementDndItemReordered,\n format => (initialPosition, currentPosition, total) =>\n format({ initialPosition, currentPosition, total, isInitialPosition: `${initialPosition === currentPosition}` })\n ),\n liveAnnouncementDndItemCommitted: i18n(\n 'contentDisplayPreference.liveAnnouncementDndItemCommitted',\n liveAnnouncementDndItemCommitted,\n format => (initialPosition, finalPosition, total) =>\n format({ initialPosition, finalPosition, total, isInitialPosition: `${initialPosition === finalPosition}` })\n ),\n liveAnnouncementDndDiscarded: i18n(\n 'contentDisplayPreference.liveAnnouncementDndDiscarded',\n liveAnnouncementDndDiscarded\n ),\n sortedOptions: value,\n });\n\n const renderedDragHandleAriaDescription = i18n(\n 'contentDisplayPreference.dragHandleAriaDescription',\n dragHandleAriaDescription\n );\n\n return (\n <div className={styles[componentPrefix]}>\n <h3 className={getClassName('title')} id={titleId}>\n {i18n('contentDisplayPreference.title', title)}\n </h3>\n <p className={getClassName('description')} id={descriptionId}>\n {i18n('contentDisplayPreference.description', description)}\n </p>\n <DndContext\n sensors={sensors}\n collisionDetection={collisionDetection}\n accessibility={{\n announcements,\n restoreFocus: false,\n screenReaderInstructions: renderedDragHandleAriaDescription\n ? { draggable: renderedDragHandleAriaDescription }\n : undefined,\n }}\n onDragStart={({ active }) => setActiveItem(active.id)}\n onDragEnd={event => {\n setActiveItem(null);\n const { active, over } = event;\n\n if (over && active.id !== over.id) {\n const oldIndex = value.findIndex(({ id }) => id === active.id);\n const newIndex = value.findIndex(({ id }) => id === over.id);\n onChange(arrayMove([...value], oldIndex, newIndex));\n }\n }}\n onDragCancel={() => setActiveItem(null)}\n >\n {/* Use explicit list role to work around Safari not announcing lists as such when list-style is set to none.\n See https://bugs.webkit.org/show_bug.cgi?id=170179 */}\n <ul\n className={getClassName('option-list')}\n aria-describedby={descriptionId}\n aria-labelledby={titleId}\n role=\"list\"\n >\n <SortableContext items={sortedOptions.map(({ id }) => id)} strategy={verticalListSortingStrategy}>\n {sortedOptions.map(option => {\n return (\n <DraggableOption\n dragHandleAriaLabel={i18n('contentDisplayPreference.dragHandleAriaLabel', dragHandleAriaLabel)}\n key={option.id}\n onKeyDown={handleKeyDown}\n onToggle={onToggle}\n option={option}\n />\n );\n })}\n </SortableContext>\n </ul>\n <Portal>\n {/* Make sure that the drag overlay is above the modal\n by assigning the z-index as inline style\n so that it prevails over dnd-kit's inline z-index of 999 */}\n {/* className is a documented prop of the DragOverlay component:\n https://docs.dndkit.com/api-documentation/draggable/drag-overlay#class-name-and-inline-styles */\n /* eslint-disable-next-line react/forbid-component-props */}\n <DragOverlay className={styles['drag-overlay']} dropAnimation={null} style={{ zIndex: 5000 }}>\n {activeOption && (\n <ContentDisplayOption\n listeners={{ onKeyDown: handleKeyDown }}\n dragHandleAriaLabel={i18n('contentDisplayPreference.dragHandleAriaLabel', dragHandleAriaLabel)}\n onToggle={onToggle}\n option={activeOption}\n />\n )}\n </DragOverlay>\n </Portal>\n </DndContext>\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["collection-preferences/content-display/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAGjE,OAAO,MAAM,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAwB,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAC5F,OAAO,eAAe,MAAM,oBAAoB,CAAC;AACjD,OAAO,qBAAqB,MAAM,6BAA6B,CAAC;AAChE,OAAO,oBAAoB,MAAM,0BAA0B,CAAC;AAC5D,OAAO,MAAM,MAAM,kCAAkC,CAAC;AACtD,OAAO,oBAAoB,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAE1C,MAAM,YAAY,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,eAAe,IAAI,MAAM,EAAE,CAAC,CAAC;AAOhF,MAAM,CAAC,OAAO,UA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IAC7F,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;oBAC1B,OAAO,CACL,oBAAC,eAAe,IACd,mBAAmB,EAAE,IAAI,CAAC,8CAA8C,EAAE,mBAAmB,CAAC,EAC9F,GAAG,EAAE,MAAM,CAAC,EAAE,EACd,SAAS,EAAE,aAAa,EACxB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,GACd,CACH,CAAC;gBACJ,CAAC,CAAC,CACc,CACf;YACL,oBAAC,MAAM;gBAOL,oBAAC,WAAW,IAAC,SAAS,EAAE,MAAM,CAAC,cAAc,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,IACzF,YAAY,IAAI,CACf,oBAAC,oBAAoB,IACnB,SAAS,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,EACvC,mBAAmB,EAAE,IAAI,CAAC,8CAA8C,EAAE,mBAAmB,CAAC,EAC9F,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,YAAY,GACpB,CACH,CACW,CACP,CACE,CACT,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { useUniqueId } from '../../internal/hooks/use-unique-id';\n\nimport { CollectionPreferencesProps } from '../interfaces';\nimport styles from '../styles.css.js';\nimport { getSortedOptions, OptionWithVisibility } from './utils';\nimport { DndContext, DragOverlay } from '@dnd-kit/core';\nimport { arrayMove, SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable';\nimport DraggableOption from './draggable-option';\nimport useDragAndDropReorder from './use-drag-and-drop-reorder';\nimport useLiveAnnouncements from './use-live-announcements';\nimport Portal from '../../internal/components/portal';\nimport ContentDisplayOption from './content-display-option';\nimport { useInternalI18n } from '../../internal/i18n/context';\n\nconst componentPrefix = 'content-display';\n\nconst getClassName = (suffix: string) => styles[`${componentPrefix}-${suffix}`];\n\ninterface ContentDisplayPreferenceProps extends CollectionPreferencesProps.ContentDisplayPreference {\n onChange: (value: ReadonlyArray<CollectionPreferencesProps.ContentDisplayItem>) => void;\n value?: ReadonlyArray<CollectionPreferencesProps.ContentDisplayItem>;\n}\n\nexport default function ContentDisplayPreference({\n title,\n description,\n options,\n value = options.map(({ id }) => ({\n id,\n visible: true,\n })),\n onChange,\n liveAnnouncementDndStarted,\n liveAnnouncementDndItemReordered,\n liveAnnouncementDndItemCommitted,\n liveAnnouncementDndDiscarded,\n dragHandleAriaDescription,\n dragHandleAriaLabel,\n}: ContentDisplayPreferenceProps) {\n const idPrefix = useUniqueId(componentPrefix);\n const i18n = useInternalI18n('collection-preferences');\n\n const onToggle = (option: OptionWithVisibility) => {\n onChange(value.map(item => (item.id === option.id ? { ...item, visible: !option.visible } : item)));\n };\n\n const titleId = `${idPrefix}-title`;\n const descriptionId = `${idPrefix}-description`;\n\n const sortedOptions = getSortedOptions({ options, contentDisplay: value });\n\n const { activeItem, collisionDetection, handleKeyDown, sensors, setActiveItem } = useDragAndDropReorder({\n sortedOptions,\n });\n\n const activeOption = activeItem ? sortedOptions.find(({ id }) => id === activeItem) : null;\n\n const announcements = useLiveAnnouncements({\n isDragging: activeItem !== null,\n liveAnnouncementDndStarted: i18n(\n 'contentDisplayPreference.liveAnnouncementDndStarted',\n liveAnnouncementDndStarted,\n format => (position, total) => format({ position, total })\n ),\n liveAnnouncementDndItemReordered: i18n(\n 'contentDisplayPreference.liveAnnouncementDndItemReordered',\n liveAnnouncementDndItemReordered,\n format => (initialPosition, currentPosition, total) =>\n format({ currentPosition, total, isInitialPosition: `${initialPosition === currentPosition}` })\n ),\n liveAnnouncementDndItemCommitted: i18n(\n 'contentDisplayPreference.liveAnnouncementDndItemCommitted',\n liveAnnouncementDndItemCommitted,\n format => (initialPosition, finalPosition, total) =>\n format({ initialPosition, finalPosition, total, isInitialPosition: `${initialPosition === finalPosition}` })\n ),\n liveAnnouncementDndDiscarded: i18n(\n 'contentDisplayPreference.liveAnnouncementDndDiscarded',\n liveAnnouncementDndDiscarded\n ),\n sortedOptions: value,\n });\n\n const renderedDragHandleAriaDescription = i18n(\n 'contentDisplayPreference.dragHandleAriaDescription',\n dragHandleAriaDescription\n );\n\n return (\n <div className={styles[componentPrefix]}>\n <h3 className={getClassName('title')} id={titleId}>\n {i18n('contentDisplayPreference.title', title)}\n </h3>\n <p className={getClassName('description')} id={descriptionId}>\n {i18n('contentDisplayPreference.description', description)}\n </p>\n <DndContext\n sensors={sensors}\n collisionDetection={collisionDetection}\n accessibility={{\n announcements,\n restoreFocus: false,\n screenReaderInstructions: renderedDragHandleAriaDescription\n ? { draggable: renderedDragHandleAriaDescription }\n : undefined,\n }}\n onDragStart={({ active }) => setActiveItem(active.id)}\n onDragEnd={event => {\n setActiveItem(null);\n const { active, over } = event;\n\n if (over && active.id !== over.id) {\n const oldIndex = value.findIndex(({ id }) => id === active.id);\n const newIndex = value.findIndex(({ id }) => id === over.id);\n onChange(arrayMove([...value], oldIndex, newIndex));\n }\n }}\n onDragCancel={() => setActiveItem(null)}\n >\n {/* Use explicit list role to work around Safari not announcing lists as such when list-style is set to none.\n See https://bugs.webkit.org/show_bug.cgi?id=170179 */}\n <ul\n className={getClassName('option-list')}\n aria-describedby={descriptionId}\n aria-labelledby={titleId}\n role=\"list\"\n >\n <SortableContext items={sortedOptions.map(({ id }) => id)} strategy={verticalListSortingStrategy}>\n {sortedOptions.map(option => {\n return (\n <DraggableOption\n dragHandleAriaLabel={i18n('contentDisplayPreference.dragHandleAriaLabel', dragHandleAriaLabel)}\n key={option.id}\n onKeyDown={handleKeyDown}\n onToggle={onToggle}\n option={option}\n />\n );\n })}\n </SortableContext>\n </ul>\n <Portal>\n {/* Make sure that the drag overlay is above the modal\n by assigning the z-index as inline style\n so that it prevails over dnd-kit's inline z-index of 999 */}\n {/* className is a documented prop of the DragOverlay component:\n https://docs.dndkit.com/api-documentation/draggable/drag-overlay#class-name-and-inline-styles */\n /* eslint-disable-next-line react/forbid-component-props */}\n <DragOverlay className={styles['drag-overlay']} dropAnimation={null} style={{ zIndex: 5000 }}>\n {activeOption && (\n <ContentDisplayOption\n listeners={{ onKeyDown: handleKeyDown }}\n dragHandleAriaLabel={i18n('contentDisplayPreference.dragHandleAriaLabel', dragHandleAriaLabel)}\n onToggle={onToggle}\n option={activeOption}\n />\n )}\n </DragOverlay>\n </Portal>\n </DndContext>\n </div>\n );\n}\n"]}
@@ -9,6 +9,26 @@ export interface ContainerProps extends BaseComponentProps {
9
9
  * Determines whether the container header has padding. If `true`, removes the default padding from the header.
10
10
  */
11
11
  disableHeaderPaddings?: boolean;
12
+ /**
13
+ *
14
+ * Use this slot to render a media element. Supported element types are 'img', 'video', and 'picture'.
15
+ * You can define different positions and sizes for the media element within the container.
16
+ *
17
+ * * `content` - Use this slot to render your media element. We support `img`, `video` and `picture` elements.
18
+ *
19
+ * * `position` - Defines the media slot's position within the container. Defaults to `top`.
20
+ *
21
+ * * `width` - Defines the width of the media slot when positioned on the side. Corresponds to the `width` CSS-property.
22
+ * When this value is set, media elements larger than the defined width may be cropped, with 'object-fit: cover' centering it.
23
+ * Note: This value is considered only when `position` is set to `side`.
24
+ * If no width is provided, the media slot will take a maximum of 66% of the container's width.
25
+ *
26
+ * * `height` - Defines the height of the media slot when position on the top. Corresponds to the `height` CSS-property.
27
+ * When this value is set, media elements larger than the defined width may be cropped, with 'object-fit: cover' centering it. * Note: This value is only considered if `position` is set to `top`.
28
+ * If no height is provided, the media slot will be displayed at its full height.
29
+ *
30
+ */
31
+ media?: ContainerProps.Media;
12
32
  /**
13
33
  * Main content of the container.
14
34
  */
@@ -38,4 +58,34 @@ export interface ContainerProps extends BaseComponentProps {
38
58
  */
39
59
  variant?: 'default' | 'stacked';
40
60
  }
61
+ export declare namespace ContainerProps {
62
+ interface Media {
63
+ /**
64
+ *
65
+ * Use this slot to render your media element. We support `img`, `video` and `picture` elements.
66
+ *
67
+ */
68
+ content: React.ReactNode;
69
+ /**
70
+ * Defines the media slot's position within the container. Defaults to `top`.
71
+ */
72
+ position?: 'top' | 'side';
73
+ /**
74
+ * Defines the width of the media slot when positioned on the side. Corresponds to the `width` CSS-property.
75
+ * When this value is set, the media element may be cropped, with `object-fit: cover` centering it.
76
+ *
77
+ * Note: This value is considered only when `position` is set to `side`.
78
+ * If no width is provided, the media slot will take a maximum of 66% of the container's width.
79
+ */
80
+ width?: string | number;
81
+ /**
82
+ * Defines the height of the media slot when position on the top. Corresponds to the `height` CSS-property.
83
+ * When this value is set, the media element may be cropped, with `object-fit: cover` centering it.
84
+ *
85
+ * Note: This value is only considered if `position` is set to `top`.
86
+ * If no height is provided, the media slot will be displayed at its full height.
87
+ */
88
+ height?: string | number;
89
+ }
90
+ }
41
91
  //# sourceMappingURL=interfaces.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"lib/default/","sources":["container/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,cAAe,SAAQ,kBAAkB;IACxD;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEzB;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B;;OAEG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAEjC;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEzB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CACjC"}
1
+ {"version":3,"file":"interfaces.d.ts","sourceRoot":"lib/default/","sources":["container/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,cAAe,SAAQ,kBAAkB;IACxD;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEzB;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAK,CAAC,EAAE,cAAc,CAAC,KAAK,CAAC;IAE7B;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B;;OAEG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAEjC;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEzB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CACjC;AAED,yBAAiB,cAAc,CAAC;IAC9B,UAAiB,KAAK;QACpB;;;;WAIG;QACH,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;QAEzB;;WAEG;QACH,QAAQ,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;QAE1B;;;;;;WAMG;QACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QAExB;;;;;;WAMG;QACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;KAC1B;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["container/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\nimport React from 'react';\n\nexport interface ContainerProps extends BaseComponentProps {\n /**\n * Heading element of the container. Use the [header component](/components/header/).\n */\n header?: React.ReactNode;\n\n /**\n * Determines whether the container header has padding. If `true`, removes the default padding from the header.\n */\n disableHeaderPaddings?: boolean;\n\n /**\n * Main content of the container.\n */\n children?: React.ReactNode;\n\n /**\n * Determines whether the container content has padding. If `true`, removes the default padding from the content area.\n */\n disableContentPaddings?: boolean;\n\n /**\n * Enabling this property will make the container to fit into available height. If content is too short, the container\n * will stretch, if too long, the container will shrink and show vertical scrollbar.\n *\n * Use this property to align heights of multiple containers displayed in a single row. It is recommended to stretch\n * all containers to the height of the longest one, to avoid extra vertical scroll areas.\n */\n fitHeight?: boolean;\n\n /**\n * Footer of the container.\n */\n footer?: React.ReactNode;\n\n /**\n * Specify a container variant with one of the following:\n * * `default` - Use this variant in standalone context.\n * * `stacked` - Use this variant adjacent to other stacked containers (such as a container,\n * table).\n * @visualrefresh `stacked` variant\n */\n variant?: 'default' | 'stacked';\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["container/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\nimport React from 'react';\n\nexport interface ContainerProps extends BaseComponentProps {\n /**\n * Heading element of the container. Use the [header component](/components/header/).\n */\n header?: React.ReactNode;\n\n /**\n * Determines whether the container header has padding. If `true`, removes the default padding from the header.\n */\n disableHeaderPaddings?: boolean;\n\n /**\n *\n * Use this slot to render a media element. Supported element types are 'img', 'video', and 'picture'.\n * You can define different positions and sizes for the media element within the container.\n *\n * * `content` - Use this slot to render your media element. We support `img`, `video` and `picture` elements.\n *\n * * `position` - Defines the media slot's position within the container. Defaults to `top`.\n *\n * * `width` - Defines the width of the media slot when positioned on the side. Corresponds to the `width` CSS-property.\n * When this value is set, media elements larger than the defined width may be cropped, with 'object-fit: cover' centering it.\n * Note: This value is considered only when `position` is set to `side`.\n * If no width is provided, the media slot will take a maximum of 66% of the container's width.\n *\n * * `height` - Defines the height of the media slot when position on the top. Corresponds to the `height` CSS-property.\n * When this value is set, media elements larger than the defined width may be cropped, with 'object-fit: cover' centering it. * Note: This value is only considered if `position` is set to `top`.\n * If no height is provided, the media slot will be displayed at its full height.\n *\n */\n media?: ContainerProps.Media;\n\n /**\n * Main content of the container.\n */\n children?: React.ReactNode;\n\n /**\n * Determines whether the container content has padding. If `true`, removes the default padding from the content area.\n */\n disableContentPaddings?: boolean;\n\n /**\n * Enabling this property will make the container to fit into available height. If content is too short, the container\n * will stretch, if too long, the container will shrink and show vertical scrollbar.\n *\n * Use this property to align heights of multiple containers displayed in a single row. It is recommended to stretch\n * all containers to the height of the longest one, to avoid extra vertical scroll areas.\n */\n fitHeight?: boolean;\n\n /**\n * Footer of the container.\n */\n footer?: React.ReactNode;\n\n /**\n * Specify a container variant with one of the following:\n * * `default` - Use this variant in standalone context.\n * * `stacked` - Use this variant adjacent to other stacked containers (such as a container,\n * table).\n * @visualrefresh `stacked` variant\n */\n variant?: 'default' | 'stacked';\n}\n\nexport namespace ContainerProps {\n export interface Media {\n /**\n *\n * Use this slot to render your media element. We support `img`, `video` and `picture` elements.\n *\n */\n content: React.ReactNode;\n\n /**\n * Defines the media slot's position within the container. Defaults to `top`.\n */\n position?: 'top' | 'side';\n\n /**\n * Defines the width of the media slot when positioned on the side. Corresponds to the `width` CSS-property.\n * When this value is set, the media element may be cropped, with `object-fit: cover` centering it.\n *\n * Note: This value is considered only when `position` is set to `side`.\n * If no width is provided, the media slot will take a maximum of 66% of the container's width.\n */\n width?: string | number;\n\n /**\n * Defines the height of the media slot when position on the top. Corresponds to the `height` CSS-property.\n * When this value is set, the media element may be cropped, with `object-fit: cover` centering it.\n *\n * Note: This value is only considered if `position` is set to `top`.\n * If no height is provided, the media slot will be displayed at its full height.\n */\n height?: string | number;\n }\n}\n"]}
@@ -20,5 +20,5 @@ export interface InternalContainerProps extends Omit<ContainerProps, 'variant'>,
20
20
  */
21
21
  variant?: ContainerProps['variant'] | 'embedded' | 'full-page' | 'cards';
22
22
  }
23
- export default function InternalContainer({ header, footer, children, variant, disableHeaderPaddings, disableContentPaddings, fitHeight, __stickyOffset, __mobileStickyOffset, __stickyHeader, __internalRootRef, __disableFooterDivider, __disableFooterPaddings, __hiddenContent, __headerRef, __headerId, __darkHeader, __disableStickyMobile, ...restProps }: InternalContainerProps): JSX.Element;
23
+ export default function InternalContainer({ header, footer, children, variant, disableHeaderPaddings, disableContentPaddings, fitHeight, media, __stickyOffset, __mobileStickyOffset, __stickyHeader, __internalRootRef, __disableFooterDivider, __disableFooterPaddings, __hiddenContent, __headerRef, __headerId, __darkHeader, __disableStickyMobile, ...restProps }: InternalContainerProps): JSX.Element;
24
24
  //# sourceMappingURL=internal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["container/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA4B,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AASlF,MAAM,WAAW,sBAAuB,SAAQ,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC,EAAE,0BAA0B;IACzG,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,GAAG,UAAU,GAAG,WAAW,GAAG,OA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AAQ,EACR,OAAmB,EACnB,qBAA6B,EAC7B,sBAA8B,EAC9B,SAAS,EACT,KAAK,EACL,cAAc,EACd,oBAAoB,EACpB,cAAsB,EACtB,iBAAwB,EACxB,sBAA8B,EAC9B,uBAA+B,EAC/B,eAAuB,EACvB,WAAW,EACX,UAAU,EACV,YAAoB,EACpB,qBAA4B,EAC5B,GAAG,SAAS,EACb,EAAE,sBAAsB,eAoHxB"}
@@ -13,7 +13,8 @@ import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
13
13
  import styles from './styles.css.js';
14
14
  import { useFunnelSubStep } from '../internal/analytics/hooks/use-funnel';
15
15
  export default function InternalContainer(_a) {
16
- var { header, footer, children, variant = 'default', disableHeaderPaddings = false, disableContentPaddings = false, fitHeight, __stickyOffset, __mobileStickyOffset, __stickyHeader = false, __internalRootRef = null, __disableFooterDivider = false, __disableFooterPaddings = false, __hiddenContent = false, __headerRef, __headerId, __darkHeader = false, __disableStickyMobile = true } = _a, restProps = __rest(_a, ["header", "footer", "children", "variant", "disableHeaderPaddings", "disableContentPaddings", "fitHeight", "__stickyOffset", "__mobileStickyOffset", "__stickyHeader", "__internalRootRef", "__disableFooterDivider", "__disableFooterPaddings", "__hiddenContent", "__headerRef", "__headerId", "__darkHeader", "__disableStickyMobile"]);
16
+ var _b;
17
+ var { header, footer, children, variant = 'default', disableHeaderPaddings = false, disableContentPaddings = false, fitHeight, media, __stickyOffset, __mobileStickyOffset, __stickyHeader = false, __internalRootRef = null, __disableFooterDivider = false, __disableFooterPaddings = false, __hiddenContent = false, __headerRef, __headerId, __darkHeader = false, __disableStickyMobile = true } = _a, restProps = __rest(_a, ["header", "footer", "children", "variant", "disableHeaderPaddings", "disableContentPaddings", "fitHeight", "media", "__stickyOffset", "__mobileStickyOffset", "__stickyHeader", "__internalRootRef", "__disableFooterDivider", "__disableFooterPaddings", "__hiddenContent", "__headerRef", "__headerId", "__darkHeader", "__disableStickyMobile"]);
17
18
  const isMobile = useMobile();
18
19
  const baseProps = getBaseProps(restProps);
19
20
  const rootRef = useRef(null);
@@ -46,22 +47,27 @@ export default function InternalContainer(_a) {
46
47
  // The container is only sticky on mobile if it is the header for the table.
47
48
  // In this case we don't want the container to have sticky styles, as only the table header row will show as stuck on scroll.
48
49
  const shouldHaveStickyStyles = isSticky && !isMobile;
49
- return (React.createElement("div", Object.assign({}, baseProps, funnelSubStepProps, { className: clsx(baseProps.className, styles.root, styles[`variant-${variant}`], fitHeight && styles['fit-height'], shouldHaveStickyStyles && [styles['sticky-enabled']]), ref: mergedRef }),
50
- header && (React.createElement(StickyHeaderContext.Provider, { value: { isStuck } },
51
- React.createElement("div", Object.assign({ className: clsx(styles.header, styles[`header-variant-${variant}`], {
52
- [styles['header-sticky-disabled']]: __stickyHeader && !isSticky,
53
- [styles['header-sticky-enabled']]: isSticky,
54
- [styles['header-dynamic-height']]: hasDynamicHeight,
55
- [styles['header-stuck']]: isStuck,
56
- [styles['with-paddings']]: !disableHeaderPaddings,
57
- [styles['with-hidden-content']]: !children || __hiddenContent,
58
- }) }, headerIdProp, stickyStyles, { ref: headerMergedRef }), __darkHeader ? (React.createElement("div", { className: clsx(styles['dark-header'], 'awsui-context-content-header') }, header)) : (header)))),
59
- React.createElement("div", { className: clsx(styles.content, {
60
- [styles['with-paddings']]: !disableContentPaddings,
61
- }) }, children),
62
- footer && (React.createElement("div", { className: clsx(styles.footer, {
63
- [styles['with-divider']]: !__disableFooterDivider,
64
- [styles['with-paddings']]: !__disableFooterPaddings,
65
- }) }, footer))));
50
+ const hasMedia = !!(media === null || media === void 0 ? void 0 : media.content);
51
+ const mediaPosition = (_b = media === null || media === void 0 ? void 0 : media.position) !== null && _b !== void 0 ? _b : 'top';
52
+ return (React.createElement("div", Object.assign({}, baseProps, funnelSubStepProps, { className: clsx(baseProps.className, styles.root, styles[`variant-${variant}`], fitHeight && styles['fit-height'], hasMedia && (mediaPosition === 'side' ? styles['with-side-media'] : styles['with-top-media']), shouldHaveStickyStyles && [styles['sticky-enabled']]), ref: mergedRef }),
53
+ hasMedia && (React.createElement("div", { className: clsx(styles[`media-${mediaPosition === 'side' ? 'side' : 'top'}`], styles.media), style: mediaPosition === 'top' ? { height: (media === null || media === void 0 ? void 0 : media.height) || '' } : { width: (media === null || media === void 0 ? void 0 : media.width) || '' } }, media.content)),
54
+ React.createElement("div", { className: clsx(styles['content-wrapper'], fitHeight && styles['content-wrapper-fit-height']) },
55
+ header && (React.createElement(StickyHeaderContext.Provider, { value: { isStuck } },
56
+ React.createElement("div", Object.assign({ className: clsx(styles.header, styles[`header-variant-${variant}`], {
57
+ [styles['header-sticky-disabled']]: __stickyHeader && !isSticky,
58
+ [styles['header-sticky-enabled']]: isSticky,
59
+ [styles['header-dynamic-height']]: hasDynamicHeight,
60
+ [styles['header-stuck']]: isStuck,
61
+ [styles['with-paddings']]: !disableHeaderPaddings,
62
+ [styles['with-hidden-content']]: !children || __hiddenContent,
63
+ [styles['header-with-media']]: hasMedia,
64
+ }) }, headerIdProp, stickyStyles, { ref: headerMergedRef }), __darkHeader ? (React.createElement("div", { className: clsx(styles['dark-header'], 'awsui-context-content-header') }, header)) : (header)))),
65
+ React.createElement("div", { className: clsx(styles.content, fitHeight && styles['content-fit-height'], {
66
+ [styles['with-paddings']]: !disableContentPaddings,
67
+ }) }, children),
68
+ footer && (React.createElement("div", { className: clsx(styles.footer, {
69
+ [styles['with-divider']]: !__disableFooterDivider,
70
+ [styles['with-paddings']]: !__disableFooterPaddings,
71
+ }) }, footer)))));
66
72
  }
67
73
  //# sourceMappingURL=internal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["container/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;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,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,sBAAsB;gBACjD,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,uBAAuB;aACpD,CAAC,IAED,MAAM,CACH,CACP,CACG,CACP,CAAC;AACJ,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, { useEffect, useRef } from 'react';\nimport { ContainerProps } from './interfaces';\nimport { getBaseProps } from '../internal/base-component';\nimport { useAppLayoutContext } from '../internal/context/app-layout-context';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { StickyHeaderContext, useStickyHeader } from './use-sticky-header';\nimport { useDynamicOverlap } from '../internal/hooks/use-dynamic-overlap';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport styles from './styles.css.js';\nimport { useFunnelSubStep } from '../internal/analytics/hooks/use-funnel';\n\nexport interface InternalContainerProps extends Omit<ContainerProps, 'variant'>, InternalBaseComponentProps {\n __stickyHeader?: boolean;\n __stickyOffset?: number;\n __mobileStickyOffset?: number;\n __disableFooterDivider?: boolean;\n __disableFooterPaddings?: boolean;\n __hiddenContent?: boolean;\n __headerRef?: React.RefObject<HTMLDivElement>;\n __headerId?: string;\n __darkHeader?: boolean;\n __disableStickyMobile?: boolean;\n /**\n * Additional internal variant:\n * * `embedded` - Use this variant within a parent container (such as a modal,\n * expandable section, container or split panel).\n * * `full-page` – Only for internal use in table, cards and other components\n */\n variant?: ContainerProps['variant'] | 'embedded' | 'full-page' | 'cards';\n}\n\nexport default function InternalContainer({\n header,\n footer,\n children,\n variant = 'default',\n disableHeaderPaddings = false,\n disableContentPaddings = false,\n fitHeight,\n __stickyOffset,\n __mobileStickyOffset,\n __stickyHeader = false,\n __internalRootRef = null,\n __disableFooterDivider = false,\n __disableFooterPaddings = false,\n __hiddenContent = false,\n __headerRef,\n __headerId,\n __darkHeader = false,\n __disableStickyMobile = true,\n ...restProps\n}: InternalContainerProps) {\n const isMobile = useMobile();\n const baseProps = getBaseProps(restProps);\n const rootRef = useRef<HTMLDivElement>(null);\n const headerRef = useRef<HTMLDivElement>(null);\n const { isSticky, isStuck, stickyStyles } = useStickyHeader(\n rootRef,\n headerRef,\n __stickyHeader,\n __stickyOffset,\n __mobileStickyOffset,\n __disableStickyMobile\n );\n const { setHasStickyBackground } = useAppLayoutContext();\n const isRefresh = useVisualRefresh();\n const { subStepRef, funnelSubStepProps } = useFunnelSubStep();\n\n const hasDynamicHeight = isRefresh && variant === 'full-page';\n const overlapElement = useDynamicOverlap({ disabled: !hasDynamicHeight || !__darkHeader });\n\n const mergedRef = useMergeRefs(rootRef, subStepRef, __internalRootRef);\n const headerMergedRef = useMergeRefs(headerRef, overlapElement, __headerRef);\n const headerIdProp = __headerId ? { id: __headerId } : {};\n\n /**\n * The visual refresh AppLayout component needs to know if a child component\n * has a high contrast sticky header. This is to make sure the background element\n * stays in the same vertical position as the header content.\n */\n useEffect(() => {\n const shouldUpdateStickyBackground = isSticky && variant === 'full-page' && setHasStickyBackground;\n if (shouldUpdateStickyBackground) {\n setHasStickyBackground(true);\n }\n\n return () => {\n if (shouldUpdateStickyBackground) {\n setHasStickyBackground(false);\n }\n };\n }, [isSticky, setHasStickyBackground, variant]);\n\n // The container is only sticky on mobile if it is the header for the table.\n // In this case we don't want the container to have sticky styles, as only the table header row will show as stuck on scroll.\n const shouldHaveStickyStyles = isSticky && !isMobile;\n\n return (\n <div\n {...baseProps}\n {...funnelSubStepProps}\n className={clsx(\n baseProps.className,\n styles.root,\n styles[`variant-${variant}`],\n fitHeight && styles['fit-height'],\n shouldHaveStickyStyles && [styles['sticky-enabled']]\n )}\n ref={mergedRef}\n >\n {header && (\n <StickyHeaderContext.Provider value={{ isStuck }}>\n <div\n className={clsx(styles.header, styles[`header-variant-${variant}`], {\n [styles['header-sticky-disabled']]: __stickyHeader && !isSticky,\n [styles['header-sticky-enabled']]: isSticky,\n [styles['header-dynamic-height']]: hasDynamicHeight,\n [styles['header-stuck']]: isStuck,\n [styles['with-paddings']]: !disableHeaderPaddings,\n [styles['with-hidden-content']]: !children || __hiddenContent,\n })}\n {...headerIdProp}\n {...stickyStyles}\n ref={headerMergedRef}\n >\n {__darkHeader ? (\n <div className={clsx(styles['dark-header'], 'awsui-context-content-header')}>{header}</div>\n ) : (\n header\n )}\n </div>\n </StickyHeaderContext.Provider>\n )}\n <div\n className={clsx(styles.content, {\n [styles['with-paddings']]: !disableContentPaddings,\n })}\n >\n {children}\n </div>\n {footer && (\n <div\n className={clsx(styles.footer, {\n [styles['with-divider']]: !__disableFooterDivider,\n [styles['with-paddings']]: !__disableFooterPaddings,\n })}\n >\n {footer}\n </div>\n )}\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["container/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAE7E,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAA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AI,eAAe;wBAC7D,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,EAAE,QAAQ;qBACxC,CAAC,IACE,YAAY,EACZ,YAAY,IAChB,GAAG,EAAE,eAAe,KAEnB,YAAY,CAAC,CAAC,CAAC,CACd,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,8BAA8B,CAAC,IAAG,MAAM,CAAO,CAC5F,CAAC,CAAC,CAAC,CACF,MAAM,CACP,CACG,CACuB,CAChC;YACD,6BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,IAAI,MAAM,CAAC,oBAAoB,CAAC,EAAE;oBACzE,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,sBAAsB;iBACnD,CAAC,IAED,QAAQ,CACL;YACL,MAAM,IAAI,CACT,6BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;oBAC7B,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,sBAAsB;oBACjD,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,uBAAuB;iBACpD,CAAC,IAED,MAAM,CACH,CACP,CACG,CACF,CACP,CAAC;AACJ,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, { useEffect, useRef } from 'react';\nimport { ContainerProps } from './interfaces';\nimport { getBaseProps } from '../internal/base-component';\nimport { useAppLayoutContext } from '../internal/context/app-layout-context';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { StickyHeaderContext, useStickyHeader } from './use-sticky-header';\nimport { useDynamicOverlap } from '../internal/hooks/use-dynamic-overlap';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport styles from './styles.css.js';\nimport { useFunnelSubStep } from '../internal/analytics/hooks/use-funnel';\n\nexport interface InternalContainerProps extends Omit<ContainerProps, 'variant'>, InternalBaseComponentProps {\n __stickyHeader?: boolean;\n __stickyOffset?: number;\n __mobileStickyOffset?: number;\n __disableFooterDivider?: boolean;\n __disableFooterPaddings?: boolean;\n __hiddenContent?: boolean;\n __headerRef?: React.RefObject<HTMLDivElement>;\n __headerId?: string;\n __darkHeader?: boolean;\n __disableStickyMobile?: boolean;\n /**\n * Additional internal variant:\n * * `embedded` - Use this variant within a parent container (such as a modal,\n * expandable section, container or split panel).\n * * `full-page` – Only for internal use in table, cards and other components\n */\n variant?: ContainerProps['variant'] | 'embedded' | 'full-page' | 'cards';\n}\n\nexport default function InternalContainer({\n header,\n footer,\n children,\n variant = 'default',\n disableHeaderPaddings = false,\n disableContentPaddings = false,\n fitHeight,\n media,\n __stickyOffset,\n __mobileStickyOffset,\n __stickyHeader = false,\n __internalRootRef = null,\n __disableFooterDivider = false,\n __disableFooterPaddings = false,\n __hiddenContent = false,\n __headerRef,\n __headerId,\n __darkHeader = false,\n __disableStickyMobile = true,\n ...restProps\n}: InternalContainerProps) {\n const isMobile = useMobile();\n const baseProps = getBaseProps(restProps);\n const rootRef = useRef<HTMLDivElement>(null);\n const headerRef = useRef<HTMLDivElement>(null);\n const { isSticky, isStuck, stickyStyles } = useStickyHeader(\n rootRef,\n headerRef,\n __stickyHeader,\n __stickyOffset,\n __mobileStickyOffset,\n __disableStickyMobile\n );\n const { setHasStickyBackground } = useAppLayoutContext();\n const isRefresh = useVisualRefresh();\n const { subStepRef, funnelSubStepProps } = useFunnelSubStep();\n\n const hasDynamicHeight = isRefresh && variant === 'full-page';\n const overlapElement = useDynamicOverlap({ disabled: !hasDynamicHeight || !__darkHeader });\n\n const mergedRef = useMergeRefs(rootRef, subStepRef, __internalRootRef);\n const headerMergedRef = useMergeRefs(headerRef, overlapElement, __headerRef);\n const headerIdProp = __headerId ? { id: __headerId } : {};\n\n /**\n * The visual refresh AppLayout component needs to know if a child component\n * has a high contrast sticky header. This is to make sure the background element\n * stays in the same vertical position as the header content.\n */\n useEffect(() => {\n const shouldUpdateStickyBackground = isSticky && variant === 'full-page' && setHasStickyBackground;\n if (shouldUpdateStickyBackground) {\n setHasStickyBackground(true);\n }\n\n return () => {\n if (shouldUpdateStickyBackground) {\n setHasStickyBackground(false);\n }\n };\n }, [isSticky, setHasStickyBackground, variant]);\n\n // The container is only sticky on mobile if it is the header for the table.\n // In this case we don't want the container to have sticky styles, as only the table header row will show as stuck on scroll.\n const shouldHaveStickyStyles = isSticky && !isMobile;\n\n const hasMedia = !!media?.content;\n const mediaPosition = media?.position ?? 'top';\n\n return (\n <div\n {...baseProps}\n {...funnelSubStepProps}\n className={clsx(\n baseProps.className,\n styles.root,\n styles[`variant-${variant}`],\n fitHeight && styles['fit-height'],\n hasMedia && (mediaPosition === 'side' ? styles['with-side-media'] : styles['with-top-media']),\n shouldHaveStickyStyles && [styles['sticky-enabled']]\n )}\n ref={mergedRef}\n >\n {hasMedia && (\n <div\n className={clsx(styles[`media-${mediaPosition === 'side' ? 'side' : 'top'}`], styles.media)}\n style={mediaPosition === 'top' ? { height: media?.height || '' } : { width: media?.width || '' }}\n >\n {media.content}\n </div>\n )}\n <div className={clsx(styles['content-wrapper'], fitHeight && styles['content-wrapper-fit-height'])}>\n {header && (\n <StickyHeaderContext.Provider value={{ isStuck }}>\n <div\n className={clsx(styles.header, styles[`header-variant-${variant}`], {\n [styles['header-sticky-disabled']]: __stickyHeader && !isSticky,\n [styles['header-sticky-enabled']]: isSticky,\n [styles['header-dynamic-height']]: hasDynamicHeight,\n [styles['header-stuck']]: isStuck,\n [styles['with-paddings']]: !disableHeaderPaddings,\n [styles['with-hidden-content']]: !children || __hiddenContent,\n [styles['header-with-media']]: hasMedia,\n })}\n {...headerIdProp}\n {...stickyStyles}\n ref={headerMergedRef}\n >\n {__darkHeader ? (\n <div className={clsx(styles['dark-header'], 'awsui-context-content-header')}>{header}</div>\n ) : (\n header\n )}\n </div>\n </StickyHeaderContext.Provider>\n )}\n <div\n className={clsx(styles.content, fitHeight && styles['content-fit-height'], {\n [styles['with-paddings']]: !disableContentPaddings,\n })}\n >\n {children}\n </div>\n {footer && (\n <div\n className={clsx(styles.footer, {\n [styles['with-divider']]: !__disableFooterDivider,\n [styles['with-paddings']]: !__disableFooterPaddings,\n })}\n >\n {footer}\n </div>\n )}\n </div>\n </div>\n );\n}\n"]}
@@ -1,23 +1,33 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "root": "awsui_root_14iqq_1rij9_97",
5
- "fit-height": "awsui_fit-height_14iqq_1rij9_111",
6
- "variant-default": "awsui_variant-default_14iqq_1rij9_116",
7
- "variant-stacked": "awsui_variant-stacked_14iqq_1rij9_116",
8
- "sticky-enabled": "awsui_sticky-enabled_14iqq_1rij9_169",
9
- "header": "awsui_header_14iqq_1rij9_176",
10
- "header-sticky-disabled": "awsui_header-sticky-disabled_14iqq_1rij9_181",
11
- "header-sticky-enabled": "awsui_header-sticky-enabled_14iqq_1rij9_185",
12
- "header-stuck": "awsui_header-stuck_14iqq_1rij9_191",
13
- "header-variant-cards": "awsui_header-variant-cards_14iqq_1rij9_197",
14
- "header-dynamic-height": "awsui_header-dynamic-height_14iqq_1rij9_200",
15
- "with-paddings": "awsui_with-paddings_14iqq_1rij9_206",
16
- "with-hidden-content": "awsui_with-hidden-content_14iqq_1rij9_209",
17
- "header-variant-full-page": "awsui_header-variant-full-page_14iqq_1rij9_259",
18
- "dark-header": "awsui_dark-header_14iqq_1rij9_277",
19
- "content": "awsui_content_14iqq_1rij9_282",
20
- "footer": "awsui_footer_14iqq_1rij9_293",
21
- "with-divider": "awsui_with-divider_14iqq_1rij9_296"
4
+ "root": "awsui_root_14iqq_y5ati_97",
5
+ "fit-height": "awsui_fit-height_14iqq_y5ati_111",
6
+ "with-side-media": "awsui_with-side-media_14iqq_y5ati_116",
7
+ "variant-default": "awsui_variant-default_14iqq_y5ati_119",
8
+ "variant-stacked": "awsui_variant-stacked_14iqq_y5ati_119",
9
+ "sticky-enabled": "awsui_sticky-enabled_14iqq_y5ati_172",
10
+ "with-top-media": "awsui_with-top-media_14iqq_y5ati_184",
11
+ "content-wrapper": "awsui_content-wrapper_14iqq_y5ati_189",
12
+ "content-wrapper-fit-height": "awsui_content-wrapper-fit-height_14iqq_y5ati_194",
13
+ "media": "awsui_media_14iqq_y5ati_199",
14
+ "media-top": "awsui_media-top_14iqq_y5ati_211",
15
+ "media-side": "awsui_media-side_14iqq_y5ati_216",
16
+ "header": "awsui_header_14iqq_y5ati_222",
17
+ "header-with-media": "awsui_header-with-media_14iqq_y5ati_227",
18
+ "header-sticky-disabled": "awsui_header-sticky-disabled_14iqq_y5ati_233",
19
+ "header-sticky-enabled": "awsui_header-sticky-enabled_14iqq_y5ati_237",
20
+ "header-stuck": "awsui_header-stuck_14iqq_y5ati_243",
21
+ "header-variant-cards": "awsui_header-variant-cards_14iqq_y5ati_249",
22
+ "header-dynamic-height": "awsui_header-dynamic-height_14iqq_y5ati_252",
23
+ "with-paddings": "awsui_with-paddings_14iqq_y5ati_258",
24
+ "with-hidden-content": "awsui_with-hidden-content_14iqq_y5ati_261",
25
+ "header-variant-full-page": "awsui_header-variant-full-page_14iqq_y5ati_311",
26
+ "dark-header": "awsui_dark-header_14iqq_y5ati_329",
27
+ "content": "awsui_content_14iqq_y5ati_189",
28
+ "content-fit-height": "awsui_content-fit-height_14iqq_y5ati_337",
29
+ "content-with-media": "awsui_content-with-media_14iqq_y5ati_346",
30
+ "footer": "awsui_footer_14iqq_y5ati_350",
31
+ "with-divider": "awsui_with-divider_14iqq_y5ati_353"
22
32
  };
23
33