@cloudscape-design/components 3.0.1382 → 3.0.1384

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 (290) hide show
  1. package/app-layout/visual-refresh-toolbar/contexts.d.ts +5 -3
  2. package/app-layout/visual-refresh-toolbar/contexts.d.ts.map +1 -1
  3. package/app-layout/visual-refresh-toolbar/contexts.js.map +1 -1
  4. package/app-layout/visual-refresh-toolbar/interfaces.d.ts +3 -0
  5. package/app-layout/visual-refresh-toolbar/interfaces.d.ts.map +1 -1
  6. package/app-layout/visual-refresh-toolbar/interfaces.js.map +1 -1
  7. package/app-layout/visual-refresh-toolbar/skeleton/slots.d.ts +4 -1
  8. package/app-layout/visual-refresh-toolbar/skeleton/slots.d.ts.map +1 -1
  9. package/app-layout/visual-refresh-toolbar/skeleton/slots.js +8 -5
  10. package/app-layout/visual-refresh-toolbar/skeleton/slots.js.map +1 -1
  11. package/app-layout/visual-refresh-toolbar/skeleton/toolbar-container.d.ts +5 -0
  12. package/app-layout/visual-refresh-toolbar/skeleton/toolbar-container.d.ts.map +1 -1
  13. package/app-layout/visual-refresh-toolbar/skeleton/toolbar-container.js +3 -3
  14. package/app-layout/visual-refresh-toolbar/skeleton/toolbar-container.js.map +1 -1
  15. package/app-layout/visual-refresh-toolbar/state/use-app-layout.d.ts.map +1 -1
  16. package/app-layout/visual-refresh-toolbar/state/use-app-layout.js +27 -3
  17. package/app-layout/visual-refresh-toolbar/state/use-app-layout.js.map +1 -1
  18. package/app-layout/visual-refresh-toolbar/state/use-own-breadcrumbs-props.d.ts +6 -0
  19. package/app-layout/visual-refresh-toolbar/state/use-own-breadcrumbs-props.d.ts.map +1 -0
  20. package/app-layout/visual-refresh-toolbar/state/use-own-breadcrumbs-props.js +16 -0
  21. package/app-layout/visual-refresh-toolbar/state/use-own-breadcrumbs-props.js.map +1 -0
  22. package/app-layout/visual-refresh-toolbar/toolbar/index.d.ts +5 -1
  23. package/app-layout/visual-refresh-toolbar/toolbar/index.d.ts.map +1 -1
  24. package/app-layout/visual-refresh-toolbar/toolbar/index.js +2 -2
  25. package/app-layout/visual-refresh-toolbar/toolbar/index.js.map +1 -1
  26. package/app-layout/visual-refresh-toolbar/toolbar/styles.css.js +15 -14
  27. package/app-layout/visual-refresh-toolbar/toolbar/styles.scoped.css +35 -31
  28. package/app-layout/visual-refresh-toolbar/toolbar/styles.selectors.js +15 -14
  29. package/app-layout/visual-refresh-toolbar/widget-areas/before-main-slot.d.ts.map +1 -1
  30. package/app-layout/visual-refresh-toolbar/widget-areas/before-main-slot.js +2 -2
  31. package/app-layout/visual-refresh-toolbar/widget-areas/before-main-slot.js.map +1 -1
  32. package/breadcrumb-group/implementation.d.ts.map +1 -1
  33. package/breadcrumb-group/implementation.js +30 -1
  34. package/breadcrumb-group/implementation.js.map +1 -1
  35. package/button-dropdown/interfaces.d.ts +5 -0
  36. package/button-dropdown/interfaces.d.ts.map +1 -1
  37. package/button-dropdown/interfaces.js.map +1 -1
  38. package/button-dropdown/internal-interfaces.d.ts +1 -1
  39. package/button-dropdown/internal-interfaces.d.ts.map +1 -1
  40. package/button-dropdown/internal-interfaces.js.map +1 -1
  41. package/button-dropdown/internal.js +2 -2
  42. package/button-dropdown/internal.js.map +1 -1
  43. package/button-dropdown/items-list.d.ts +1 -1
  44. package/button-dropdown/items-list.d.ts.map +1 -1
  45. package/button-dropdown/items-list.js +2 -2
  46. package/button-dropdown/items-list.js.map +1 -1
  47. package/button-dropdown/utils/move-highlight.d.ts +4 -2
  48. package/button-dropdown/utils/move-highlight.d.ts.map +1 -1
  49. package/button-dropdown/utils/move-highlight.js +13 -21
  50. package/button-dropdown/utils/move-highlight.js.map +1 -1
  51. package/button-dropdown/utils/use-button-dropdown.d.ts +1 -1
  52. package/button-dropdown/utils/use-button-dropdown.d.ts.map +1 -1
  53. package/button-dropdown/utils/use-button-dropdown.js +8 -6
  54. package/button-dropdown/utils/use-button-dropdown.js.map +1 -1
  55. package/button-dropdown/utils/use-highlighted-menu.d.ts +2 -2
  56. package/button-dropdown/utils/use-highlighted-menu.d.ts.map +1 -1
  57. package/button-dropdown/utils/use-highlighted-menu.js +14 -4
  58. package/button-dropdown/utils/use-highlighted-menu.js.map +1 -1
  59. package/button-dropdown/utils/utils.d.ts +1 -0
  60. package/button-dropdown/utils/utils.d.ts.map +1 -1
  61. package/button-dropdown/utils/utils.js +1 -0
  62. package/button-dropdown/utils/utils.js.map +1 -1
  63. package/calendar/interfaces.d.ts +2 -1
  64. package/calendar/interfaces.d.ts.map +1 -1
  65. package/calendar/interfaces.js.map +1 -1
  66. package/calendar/internal.d.ts.map +1 -1
  67. package/calendar/internal.js +3 -1
  68. package/calendar/internal.js.map +1 -1
  69. package/checkbox/internal.d.ts +6 -0
  70. package/checkbox/internal.d.ts.map +1 -1
  71. package/checkbox/internal.js +2 -2
  72. package/checkbox/internal.js.map +1 -1
  73. package/checkbox/styles.css.js +7 -3
  74. package/checkbox/styles.scoped.css +72 -16
  75. package/checkbox/styles.selectors.js +7 -3
  76. package/container/index.d.ts +3 -7
  77. package/container/index.d.ts.map +1 -1
  78. package/container/index.js +4 -3
  79. package/container/index.js.map +1 -1
  80. package/container/interfaces.d.ts +7 -0
  81. package/container/interfaces.d.ts.map +1 -1
  82. package/container/interfaces.js.map +1 -1
  83. package/container/internal.d.ts +3 -26
  84. package/container/internal.d.ts.map +1 -1
  85. package/container/internal.js +37 -8
  86. package/container/internal.js.map +1 -1
  87. package/container/styles.css.js +34 -33
  88. package/container/styles.scoped.css +77 -56
  89. package/container/styles.selectors.js +34 -33
  90. package/copy-to-clipboard/internal.d.ts.map +1 -1
  91. package/copy-to-clipboard/internal.js +3 -1
  92. package/copy-to-clipboard/internal.js.map +1 -1
  93. package/date-range-picker/index.d.ts.map +1 -1
  94. package/date-range-picker/index.js +3 -2
  95. package/date-range-picker/index.js.map +1 -1
  96. package/date-range-picker/interfaces.d.ts +2 -1
  97. package/date-range-picker/interfaces.d.ts.map +1 -1
  98. package/date-range-picker/interfaces.js.map +1 -1
  99. package/dialog/index.d.ts +3 -0
  100. package/dialog/index.d.ts.map +1 -0
  101. package/dialog/index.js +21 -0
  102. package/dialog/index.js.map +1 -0
  103. package/dialog/interfaces.d.ts +40 -0
  104. package/dialog/interfaces.d.ts.map +1 -0
  105. package/dialog/interfaces.js +2 -0
  106. package/dialog/interfaces.js.map +1 -0
  107. package/dialog/internal.d.ts +13 -0
  108. package/dialog/internal.d.ts.map +1 -0
  109. package/dialog/internal.js +39 -0
  110. package/dialog/internal.js.map +1 -0
  111. package/dialog/styles.css.js +13 -0
  112. package/dialog/styles.scoped.css +126 -0
  113. package/dialog/styles.selectors.js +14 -0
  114. package/dialog/test-classes/styles.css.js +11 -0
  115. package/dialog/test-classes/styles.scoped.css +12 -0
  116. package/dialog/test-classes/styles.selectors.js +12 -0
  117. package/dialog/use-focus-restore.d.ts +5 -0
  118. package/dialog/use-focus-restore.d.ts.map +1 -0
  119. package/dialog/use-focus-restore.js +34 -0
  120. package/dialog/use-focus-restore.js.map +1 -0
  121. package/expandable-section/expandable-section-header.d.ts.map +1 -1
  122. package/expandable-section/expandable-section-header.js +9 -2
  123. package/expandable-section/expandable-section-header.js.map +1 -1
  124. package/expandable-section/styles.css.js +44 -43
  125. package/expandable-section/styles.scoped.css +92 -88
  126. package/expandable-section/styles.selectors.js +44 -43
  127. package/flashbar/styles.css.js +50 -50
  128. package/flashbar/styles.scoped.css +160 -200
  129. package/flashbar/styles.selectors.js +50 -50
  130. package/i18n/messages/all.all.js +1 -1
  131. package/i18n/messages/all.all.json +1 -1
  132. package/i18n/messages/all.de.js +1 -1
  133. package/i18n/messages/all.de.json +1 -1
  134. package/i18n/messages/all.en-GB.js +1 -1
  135. package/i18n/messages/all.en-GB.json +1 -1
  136. package/i18n/messages/all.en.js +1 -1
  137. package/i18n/messages/all.en.json +1 -1
  138. package/i18n/messages/all.es.js +1 -1
  139. package/i18n/messages/all.es.json +1 -1
  140. package/i18n/messages/all.fr.js +1 -1
  141. package/i18n/messages/all.fr.json +1 -1
  142. package/i18n/messages/all.id.js +1 -1
  143. package/i18n/messages/all.id.json +1 -1
  144. package/i18n/messages/all.it.js +1 -1
  145. package/i18n/messages/all.it.json +1 -1
  146. package/i18n/messages/all.ja.js +1 -1
  147. package/i18n/messages/all.ja.json +1 -1
  148. package/i18n/messages/all.ko.js +1 -1
  149. package/i18n/messages/all.ko.json +1 -1
  150. package/i18n/messages/all.pt-BR.js +1 -1
  151. package/i18n/messages/all.pt-BR.json +1 -1
  152. package/i18n/messages/all.tr.js +1 -1
  153. package/i18n/messages/all.tr.json +1 -1
  154. package/i18n/messages/all.zh-CN.js +1 -1
  155. package/i18n/messages/all.zh-CN.json +1 -1
  156. package/i18n/messages/all.zh-TW.js +1 -1
  157. package/i18n/messages/all.zh-TW.json +1 -1
  158. package/i18n/messages-types.d.ts +3 -0
  159. package/i18n/messages-types.d.ts.map +1 -1
  160. package/i18n/messages-types.js.map +1 -1
  161. package/icon/generated/icons.d.ts +1 -0
  162. package/icon/generated/icons.d.ts.map +1 -1
  163. package/icon/generated/icons.js +3 -0
  164. package/icon/generated/icons.js.map +1 -1
  165. package/icon/internal.d.ts +3 -0
  166. package/icon/internal.d.ts.map +1 -1
  167. package/icon/internal.js +10 -2
  168. package/icon/internal.js.map +1 -1
  169. package/icon/styles.css.js +43 -42
  170. package/icon/styles.scoped.css +126 -98
  171. package/icon/styles.selectors.js +43 -42
  172. package/icon-provider/context.d.ts +3 -1
  173. package/icon-provider/context.d.ts.map +1 -1
  174. package/icon-provider/context.js +2 -0
  175. package/icon-provider/context.js.map +1 -1
  176. package/icon-provider/interfaces.d.ts +40 -2
  177. package/icon-provider/interfaces.d.ts.map +1 -1
  178. package/icon-provider/interfaces.js.map +1 -1
  179. package/icon-provider/internal.d.ts +2 -1
  180. package/icon-provider/internal.d.ts.map +1 -1
  181. package/icon-provider/internal.js +17 -3
  182. package/icon-provider/internal.js.map +1 -1
  183. package/icon-provider/use-component-icons.d.ts +3 -0
  184. package/icon-provider/use-component-icons.d.ts.map +1 -0
  185. package/icon-provider/use-component-icons.js +9 -0
  186. package/icon-provider/use-component-icons.js.map +1 -0
  187. package/index.d.ts +1 -0
  188. package/index.d.ts.map +1 -1
  189. package/index.js +1 -0
  190. package/index.js.map +1 -1
  191. package/internal/base-component/styles.scoped.css +1 -1
  192. package/internal/base-theme/styles.scoped.css +27 -0
  193. package/internal/components/abstract-switch/index.d.ts +4 -0
  194. package/internal/components/abstract-switch/index.d.ts.map +1 -1
  195. package/internal/components/abstract-switch/index.js +5 -3
  196. package/internal/components/abstract-switch/index.js.map +1 -1
  197. package/internal/components/checkbox-icon/styles.css.js +9 -9
  198. package/internal/components/checkbox-icon/styles.scoped.css +18 -18
  199. package/internal/components/checkbox-icon/styles.selectors.js +9 -9
  200. package/internal/components/customizable-icon/index.d.ts +22 -0
  201. package/internal/components/customizable-icon/index.d.ts.map +1 -0
  202. package/internal/components/customizable-icon/index.js +12 -0
  203. package/internal/components/customizable-icon/index.js.map +1 -0
  204. package/internal/components/expand-toggle-button/index.d.ts +4 -0
  205. package/internal/components/expand-toggle-button/index.d.ts.map +1 -1
  206. package/internal/components/expand-toggle-button/index.js +6 -3
  207. package/internal/components/expand-toggle-button/index.js.map +1 -1
  208. package/internal/environment.js +2 -2
  209. package/internal/environment.json +2 -2
  210. package/internal/generated/styles/tokens.d.ts +14 -0
  211. package/internal/generated/styles/tokens.js +14 -0
  212. package/internal/generated/theming/index.cjs +222 -1
  213. package/internal/generated/theming/{index.cjs.d.ts → index.d.cts} +113 -13
  214. package/internal/generated/theming/index.d.ts +99 -0
  215. package/internal/generated/theming/index.js +222 -1
  216. package/internal/manifest.json +1 -1
  217. package/internal/plugins/widget/index.d.ts +5 -1
  218. package/internal/plugins/widget/index.d.ts.map +1 -1
  219. package/internal/plugins/widget/index.js +26 -1
  220. package/internal/plugins/widget/index.js.map +1 -1
  221. package/internal/plugins/widget/interfaces.d.ts +12 -2
  222. package/internal/plugins/widget/interfaces.d.ts.map +1 -1
  223. package/internal/plugins/widget/interfaces.js.map +1 -1
  224. package/internal/plugins/widget.d.ts +1 -1
  225. package/internal/plugins/widget.d.ts.map +1 -1
  226. package/internal/plugins/widget.js +1 -1
  227. package/internal/plugins/widget.js.map +1 -1
  228. package/internal/utils/locale/normalize-locale.js +8 -5
  229. package/internal/utils/locale/normalize-locale.js.map +1 -1
  230. package/manifest.json +2 -2
  231. package/package.json +4 -1
  232. package/plugins/index.d.ts +2 -1
  233. package/plugins/index.d.ts.map +1 -1
  234. package/plugins/index.js +2 -1
  235. package/plugins/index.js.map +1 -1
  236. package/split-panel/bottom.d.ts +2 -1
  237. package/split-panel/bottom.d.ts.map +1 -1
  238. package/split-panel/bottom.js.map +1 -1
  239. package/split-panel/content-props.d.ts +16 -0
  240. package/split-panel/content-props.d.ts.map +1 -0
  241. package/split-panel/content-props.js +2 -0
  242. package/split-panel/content-props.js.map +1 -0
  243. package/split-panel/interfaces.d.ts +0 -13
  244. package/split-panel/interfaces.d.ts.map +1 -1
  245. package/split-panel/interfaces.js.map +1 -1
  246. package/split-panel/side.d.ts +2 -1
  247. package/split-panel/side.d.ts.map +1 -1
  248. package/split-panel/side.js.map +1 -1
  249. package/table/body-cell/td-element.d.ts.map +1 -1
  250. package/table/body-cell/td-element.js +3 -1
  251. package/table/body-cell/td-element.js.map +1 -1
  252. package/table/header-cell/index.d.ts.map +1 -1
  253. package/table/header-cell/index.js +8 -2
  254. package/table/header-cell/index.js.map +1 -1
  255. package/table/header-cell/styles.css.js +38 -38
  256. package/table/header-cell/styles.scoped.css +80 -81
  257. package/table/header-cell/styles.selectors.js +38 -38
  258. package/table/internal.js +1 -1
  259. package/table/internal.js.map +1 -1
  260. package/table/sticky-columns/interfaces.d.ts +2 -0
  261. package/table/sticky-columns/interfaces.d.ts.map +1 -1
  262. package/table/sticky-columns/interfaces.js.map +1 -1
  263. package/table/sticky-columns/use-sticky-columns.d.ts.map +1 -1
  264. package/table/sticky-columns/use-sticky-columns.js +11 -5
  265. package/table/sticky-columns/use-sticky-columns.js.map +1 -1
  266. package/table/sticky-columns/utils.d.ts.map +1 -1
  267. package/table/sticky-columns/utils.js +2 -0
  268. package/table/sticky-columns/utils.js.map +1 -1
  269. package/table/utils.d.ts +1 -3
  270. package/table/utils.d.ts.map +1 -1
  271. package/table/utils.js +12 -5
  272. package/table/utils.js.map +1 -1
  273. package/test-utils/dom/dialog/index.d.ts +25 -0
  274. package/test-utils/dom/dialog/index.js +43 -0
  275. package/test-utils/dom/dialog/index.js.map +1 -0
  276. package/test-utils/dom/index.d.ts +28 -0
  277. package/test-utils/dom/index.js +21 -2
  278. package/test-utils/dom/index.js.map +1 -1
  279. package/test-utils/selectors/dialog/index.d.ts +25 -0
  280. package/test-utils/selectors/dialog/index.js +43 -0
  281. package/test-utils/selectors/dialog/index.js.map +1 -0
  282. package/test-utils/selectors/index.d.ts +18 -0
  283. package/test-utils/selectors/index.js +16 -2
  284. package/test-utils/selectors/index.js.map +1 -1
  285. package/tree-view/interfaces.d.ts +3 -0
  286. package/tree-view/interfaces.d.ts.map +1 -1
  287. package/tree-view/interfaces.js.map +1 -1
  288. package/tree-view/tree-item/index.d.ts.map +1 -1
  289. package/tree-view/tree-item/index.js +3 -1
  290. package/tree-view/tree-item/index.js.map +1 -1
@@ -13,7 +13,7 @@ import useForwardFocus from '../internal/hooks/forward-focus';
13
13
  import WithNativeAttributes from '../internal/utils/with-native-attributes';
14
14
  import { getAbstractSwitchStyles, getCheckboxIconStyles } from './style';
15
15
  import styles from './styles.css.js';
16
- const InternalCheckbox = React.forwardRef(({ controlId, name, checked, disabled, readOnly, ariaRequired, indeterminate, children, description, ariaLabel, onFocus, onBlur, onChange, tabIndex: explicitTabIndex, showOutline, ariaControls, style, nativeInputAttributes, __internalRootRef, __injectAnalyticsComponentMetadata = false, ...rest }, ref) => {
16
+ const InternalCheckbox = React.forwardRef(({ controlId, name, checked, disabled, readOnly, ariaRequired, indeterminate, children, description, ariaLabel, onFocus, onBlur, onChange, tabIndex: explicitTabIndex, showOutline, ariaControls, style, styleClassNames, nativeInputAttributes, __internalRootRef, __injectAnalyticsComponentMetadata = false, ...rest }, ref) => {
17
17
  const { ariaDescribedby, ariaLabelledby } = useFormFieldContext(rest);
18
18
  const baseProps = getBaseProps(rest);
19
19
  const checkboxRef = useRef(null);
@@ -38,7 +38,7 @@ const InternalCheckbox = React.forwardRef(({ controlId, name, checked, disabled,
38
38
  if (!disabled && !readOnly) {
39
39
  analyticsMetadata.action = !checked ? 'select' : 'deselect';
40
40
  }
41
- return (React.createElement(AbstractSwitch, { ...baseProps, className: clsx(styles.root, baseProps.className), controlClassName: styles['checkbox-control'], outlineClassName: styles.outline, controlId: controlId, disabled: disabled, readOnly: readOnly, label: children, description: description, descriptionBottomPadding: true, ariaLabel: ariaLabel, ariaLabelledby: ariaLabelledby, ariaDescribedby: ariaDescribedby, ariaControls: ariaControls, showOutline: showOutline, nativeControl: nativeControlProps => (React.createElement(WithNativeAttributes, { ...nativeControlProps, tag: "input", componentName: "Checkbox", nativeAttributes: nativeInputAttributes, ref: checkboxRef, type: "checkbox", checked: checked, name: name, "aria-required": ariaRequired ? 'true' : undefined, "aria-disabled": readOnly && !disabled ? 'true' : undefined, tabIndex: tabIndex, onFocus: () => fireNonCancelableEvent(onFocus), onBlur: () => fireNonCancelableEvent(onBlur),
41
+ return (React.createElement(AbstractSwitch, { ...baseProps, className: clsx(styles.root, baseProps.className), controlClassName: clsx(styleClassNames === null || styleClassNames === void 0 ? void 0 : styleClassNames.control, styles['checkbox-control']), outlineClassName: styles.outline, controlId: controlId, disabled: disabled, readOnly: readOnly, label: children, labelClassName: clsx(styleClassNames === null || styleClassNames === void 0 ? void 0 : styleClassNames.label, styles.label, disabled && styles['label-disabled']), description: description, descriptionClassName: clsx(styleClassNames === null || styleClassNames === void 0 ? void 0 : styleClassNames.description, styles.description, disabled && styles['description-disabled']), descriptionBottomPadding: true, ariaLabel: ariaLabel, ariaLabelledby: ariaLabelledby, ariaDescribedby: ariaDescribedby, ariaControls: ariaControls, showOutline: showOutline, nativeControl: nativeControlProps => (React.createElement(WithNativeAttributes, { ...nativeControlProps, tag: "input", componentName: "Checkbox", nativeAttributes: nativeInputAttributes, ref: checkboxRef, type: "checkbox", checked: checked, name: name, "aria-required": ariaRequired ? 'true' : undefined, "aria-disabled": readOnly && !disabled ? 'true' : undefined, tabIndex: tabIndex, onFocus: () => fireNonCancelableEvent(onFocus), onBlur: () => fireNonCancelableEvent(onBlur),
42
42
  // empty handler to suppress React controllability warning
43
43
  onChange: () => { } })), onClick: () => {
44
44
  var _a;
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/checkbox/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAC3F,OAAO,EAEL,6BAA6B,GAC9B,MAAM,kEAAkE,CAAC;AAE1E,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,cAAc,MAAM,wCAAwC,CAAC;AACpE,OAAO,YAAY,MAAM,sCAAsC,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAE9D,OAAO,oBAAoB,MAAM,0CAA0C,CAAC;AAG5E,OAAO,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAEzE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAQrC,MAAM,gBAAgB,GAAG,KAAK,CAAC,UAAU,CACvC,CACE,EACE,SAAS,EACT,IAAI,EACJ,OAAO,EACP,QAA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C7B,sBAAsB,CACpB,QAAQ;YACR,4EAA4E;YAC5E,aAAa,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CACtG,CAAC;QACJ,CAAC,EACD,aAAa,EACX,oBAAC,YAAY,IACX,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,qBAAqB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,CAAC,GAC/E,EAEJ,KAAK,EAAE,uBAAuB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,CAAC,EACjF,iBAAiB,EAAE,iBAAiB,KAChC,6BAA6B,CAAC,iBAAiB,CAAC,GACpD,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useSingleTabStopNavigation } from '@cloudscape-design/component-toolkit/internal';\nimport {\n GeneratedAnalyticsMetadataFragment,\n getAnalyticsMetadataAttribute,\n} from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { getBaseProps } from '../internal/base-component';\nimport AbstractSwitch from '../internal/components/abstract-switch';\nimport CheckboxIcon from '../internal/components/checkbox-icon';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport WithNativeAttributes from '../internal/utils/with-native-attributes';\nimport { GeneratedAnalyticsMetadataCheckboxComponent } from './analytics-metadata/interfaces';\nimport { CheckboxProps } from './interfaces';\nimport { getAbstractSwitchStyles, getCheckboxIconStyles } from './style';\n\nimport styles from './styles.css.js';\n\ninterface InternalProps extends CheckboxProps, InternalBaseComponentProps {\n tabIndex?: -1;\n showOutline?: boolean;\n __injectAnalyticsComponentMetadata?: boolean;\n}\n\nconst InternalCheckbox = React.forwardRef<CheckboxProps.Ref, InternalProps>(\n (\n {\n controlId,\n name,\n checked,\n disabled,\n readOnly,\n ariaRequired,\n indeterminate,\n children,\n description,\n ariaLabel,\n onFocus,\n onBlur,\n onChange,\n tabIndex: explicitTabIndex,\n showOutline,\n ariaControls,\n style,\n nativeInputAttributes,\n __internalRootRef,\n __injectAnalyticsComponentMetadata = false,\n ...rest\n },\n ref\n ) => {\n const { ariaDescribedby, ariaLabelledby } = useFormFieldContext(rest);\n const baseProps = getBaseProps(rest);\n const checkboxRef = useRef<HTMLInputElement>(null);\n useForwardFocus(ref, checkboxRef);\n useEffect(() => {\n if (checkboxRef.current) {\n checkboxRef.current.indeterminate = Boolean(indeterminate);\n }\n });\n\n const { tabIndex } = useSingleTabStopNavigation(checkboxRef, { tabIndex: explicitTabIndex });\n\n const analyticsMetadata: GeneratedAnalyticsMetadataFragment = {};\n const analyticsComponentMetadata: GeneratedAnalyticsMetadataCheckboxComponent = {\n name: 'awsui.Checkbox',\n label: { root: 'self' },\n properties: {\n checked: `${!!checked}`,\n },\n };\n if (__injectAnalyticsComponentMetadata) {\n analyticsMetadata.component = analyticsComponentMetadata;\n }\n if (!disabled && !readOnly) {\n analyticsMetadata.action = !checked ? 'select' : 'deselect';\n }\n\n return (\n <AbstractSwitch\n {...baseProps}\n className={clsx(styles.root, baseProps.className)}\n controlClassName={styles['checkbox-control']}\n outlineClassName={styles.outline}\n controlId={controlId}\n disabled={disabled}\n readOnly={readOnly}\n label={children}\n description={description}\n descriptionBottomPadding={true}\n ariaLabel={ariaLabel}\n ariaLabelledby={ariaLabelledby}\n ariaDescribedby={ariaDescribedby}\n ariaControls={ariaControls}\n showOutline={showOutline}\n nativeControl={nativeControlProps => (\n <WithNativeAttributes<HTMLInputElement, React.InputHTMLAttributes<HTMLInputElement>>\n {...nativeControlProps}\n tag=\"input\"\n componentName=\"Checkbox\"\n nativeAttributes={nativeInputAttributes}\n ref={checkboxRef}\n type=\"checkbox\"\n checked={checked}\n name={name}\n aria-required={ariaRequired ? 'true' : undefined}\n aria-disabled={readOnly && !disabled ? 'true' : undefined}\n tabIndex={tabIndex}\n onFocus={() => fireNonCancelableEvent(onFocus)}\n onBlur={() => fireNonCancelableEvent(onBlur)}\n // empty handler to suppress React controllability warning\n onChange={() => {}}\n />\n )}\n onClick={() => {\n checkboxRef.current?.focus();\n fireNonCancelableEvent(\n onChange,\n // for deterministic transitions \"indeterminate\" -> \"checked\" -> \"unchecked\"\n indeterminate ? { checked: true, indeterminate: false } : { checked: !checked, indeterminate: false }\n );\n }}\n styledControl={\n <CheckboxIcon\n checked={checked}\n indeterminate={indeterminate}\n disabled={disabled}\n readOnly={readOnly}\n style={getCheckboxIconStyles(style, checked, disabled, readOnly, indeterminate)}\n />\n }\n style={getAbstractSwitchStyles(style, checked, disabled, readOnly, indeterminate)}\n __internalRootRef={__internalRootRef}\n {...getAnalyticsMetadataAttribute(analyticsMetadata)}\n />\n );\n }\n);\n\nexport default InternalCheckbox;\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/checkbox/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAC3F,OAAO,EAEL,6BAA6B,GAC9B,MAAM,kEAAkE,CAAC;AAE1E,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OA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,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,CAAC,GAC/E,EAEJ,KAAK,EAAE,uBAAuB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,CAAC,EACjF,iBAAiB,EAAE,iBAAiB,KAChC,6BAA6B,CAAC,iBAAiB,CAAC,GACpD,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useSingleTabStopNavigation } from '@cloudscape-design/component-toolkit/internal';\nimport {\n GeneratedAnalyticsMetadataFragment,\n getAnalyticsMetadataAttribute,\n} from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { getBaseProps } from '../internal/base-component';\nimport AbstractSwitch from '../internal/components/abstract-switch';\nimport CheckboxIcon from '../internal/components/checkbox-icon';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport WithNativeAttributes from '../internal/utils/with-native-attributes';\nimport { GeneratedAnalyticsMetadataCheckboxComponent } from './analytics-metadata/interfaces';\nimport { CheckboxProps } from './interfaces';\nimport { getAbstractSwitchStyles, getCheckboxIconStyles } from './style';\n\nimport styles from './styles.css.js';\n\ninterface InternalProps extends CheckboxProps, InternalBaseComponentProps {\n tabIndex?: -1;\n showOutline?: boolean;\n styleClassNames?: StyleClassNames;\n __injectAnalyticsComponentMetadata?: boolean;\n}\n\n// Style API v2\ninterface StyleClassNames {\n control?: string;\n label?: string;\n description?: string;\n}\n\nconst InternalCheckbox = React.forwardRef<CheckboxProps.Ref, InternalProps>(\n (\n {\n controlId,\n name,\n checked,\n disabled,\n readOnly,\n ariaRequired,\n indeterminate,\n children,\n description,\n ariaLabel,\n onFocus,\n onBlur,\n onChange,\n tabIndex: explicitTabIndex,\n showOutline,\n ariaControls,\n style,\n styleClassNames,\n nativeInputAttributes,\n __internalRootRef,\n __injectAnalyticsComponentMetadata = false,\n ...rest\n },\n ref\n ) => {\n const { ariaDescribedby, ariaLabelledby } = useFormFieldContext(rest);\n const baseProps = getBaseProps(rest);\n const checkboxRef = useRef<HTMLInputElement>(null);\n useForwardFocus(ref, checkboxRef);\n useEffect(() => {\n if (checkboxRef.current) {\n checkboxRef.current.indeterminate = Boolean(indeterminate);\n }\n });\n\n const { tabIndex } = useSingleTabStopNavigation(checkboxRef, { tabIndex: explicitTabIndex });\n\n const analyticsMetadata: GeneratedAnalyticsMetadataFragment = {};\n const analyticsComponentMetadata: GeneratedAnalyticsMetadataCheckboxComponent = {\n name: 'awsui.Checkbox',\n label: { root: 'self' },\n properties: {\n checked: `${!!checked}`,\n },\n };\n if (__injectAnalyticsComponentMetadata) {\n analyticsMetadata.component = analyticsComponentMetadata;\n }\n if (!disabled && !readOnly) {\n analyticsMetadata.action = !checked ? 'select' : 'deselect';\n }\n\n return (\n <AbstractSwitch\n {...baseProps}\n className={clsx(styles.root, baseProps.className)}\n controlClassName={clsx(styleClassNames?.control, styles['checkbox-control'])}\n outlineClassName={styles.outline}\n controlId={controlId}\n disabled={disabled}\n readOnly={readOnly}\n label={children}\n labelClassName={clsx(styleClassNames?.label, styles.label, disabled && styles['label-disabled'])}\n description={description}\n descriptionClassName={clsx(\n styleClassNames?.description,\n styles.description,\n disabled && styles['description-disabled']\n )}\n descriptionBottomPadding={true}\n ariaLabel={ariaLabel}\n ariaLabelledby={ariaLabelledby}\n ariaDescribedby={ariaDescribedby}\n ariaControls={ariaControls}\n showOutline={showOutline}\n nativeControl={nativeControlProps => (\n <WithNativeAttributes<HTMLInputElement, React.InputHTMLAttributes<HTMLInputElement>>\n {...nativeControlProps}\n tag=\"input\"\n componentName=\"Checkbox\"\n nativeAttributes={nativeInputAttributes}\n ref={checkboxRef}\n type=\"checkbox\"\n checked={checked}\n name={name}\n aria-required={ariaRequired ? 'true' : undefined}\n aria-disabled={readOnly && !disabled ? 'true' : undefined}\n tabIndex={tabIndex}\n onFocus={() => fireNonCancelableEvent(onFocus)}\n onBlur={() => fireNonCancelableEvent(onBlur)}\n // empty handler to suppress React controllability warning\n onChange={() => {}}\n />\n )}\n onClick={() => {\n checkboxRef.current?.focus();\n fireNonCancelableEvent(\n onChange,\n // for deterministic transitions \"indeterminate\" -> \"checked\" -> \"unchecked\"\n indeterminate ? { checked: true, indeterminate: false } : { checked: !checked, indeterminate: false }\n );\n }}\n styledControl={\n <CheckboxIcon\n checked={checked}\n indeterminate={indeterminate}\n disabled={disabled}\n readOnly={readOnly}\n style={getCheckboxIconStyles(style, checked, disabled, readOnly, indeterminate)}\n />\n }\n style={getAbstractSwitchStyles(style, checked, disabled, readOnly, indeterminate)}\n __internalRootRef={__internalRootRef}\n {...getAnalyticsMetadataAttribute(analyticsMetadata)}\n />\n );\n }\n);\n\nexport default InternalCheckbox;\n"]}
@@ -1,8 +1,12 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "root": "awsui_root_k2y2q_10z3g_9",
5
- "checkbox-control": "awsui_checkbox-control_k2y2q_10z3g_42",
6
- "outline": "awsui_outline_k2y2q_10z3g_50"
4
+ "root": "awsui_root_k2y2q_vvlo6_44",
5
+ "checkbox-control": "awsui_checkbox-control_k2y2q_vvlo6_77",
6
+ "outline": "awsui_outline_k2y2q_vvlo6_93",
7
+ "label": "awsui_label_k2y2q_vvlo6_115",
8
+ "label-disabled": "awsui_label-disabled_k2y2q_vvlo6_118",
9
+ "description": "awsui_description_k2y2q_vvlo6_122",
10
+ "description-disabled": "awsui_description-disabled_k2y2q_vvlo6_125"
7
11
  };
8
12
 
@@ -6,7 +6,42 @@
6
6
  /* stylelint-enable @cloudscape-design/no-motion-outside-of-mixin, selector-combinator-disallowed-list, selector-pseudo-class-no-unknown, selector-class-pattern */
7
7
  /* Style used for links in slots/components that are text heavy, to help links stand out among
8
8
  surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F73#description */
9
- .awsui_root_k2y2q_10z3g_9.awsui_root_k2y2q_10z3g_9:not(#\9) {
9
+ @property --awsui-style-color {
10
+ syntax: "*";
11
+ inherits: false;
12
+ }
13
+ @property --awsui-style-background-color {
14
+ syntax: "*";
15
+ inherits: false;
16
+ }
17
+ @property --awsui-style-border-color {
18
+ syntax: "*";
19
+ inherits: false;
20
+ }
21
+ @property --awsui-style-focus-ring-color {
22
+ syntax: "*";
23
+ inherits: false;
24
+ }
25
+ @property --awsui-style-focus-ring-width {
26
+ syntax: "*";
27
+ inherits: false;
28
+ }
29
+ @property --awsui-style-focus-ring-radius {
30
+ syntax: "*";
31
+ inherits: false;
32
+ }
33
+ @property --awsui-style-focus-ring-gutter-block {
34
+ syntax: "*";
35
+ inherits: false;
36
+ }
37
+ @property --awsui-style-focus-ring-gutter-inline {
38
+ syntax: "*";
39
+ inherits: false;
40
+ }
41
+ /* awsui:style-api-slot name=control tokens=color, background-color, border-color, focus-ring-color, focus-ring-width, focus-ring-radius, focus-ring-gutter-block, focus-ring-gutter-inline */
42
+ /* awsui:style-api-slot name=label tokens=color */
43
+ /* awsui:style-api-slot name=description tokens=color */
44
+ .awsui_root_k2y2q_vvlo6_44.awsui_root_k2y2q_vvlo6_44:not(#\9) {
10
45
  border-collapse: separate;
11
46
  border-spacing: 0;
12
47
  box-sizing: border-box;
@@ -39,7 +74,15 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
39
74
  display: flex;
40
75
  }
41
76
 
42
- .awsui_checkbox-control_k2y2q_10z3g_42:not(#\9) {
77
+ .awsui_checkbox-control_k2y2q_vvlo6_77:not(#\9) {
78
+ --awsui-internal-style-color: var(--awsui-style-color);
79
+ --awsui-internal-style-background-color: var(--awsui-style-background-color);
80
+ --awsui-internal-style-border-color: var(--awsui-style-border-color);
81
+ --awsui-internal-style-focus-ring-color: var(--awsui-style-focus-ring-color);
82
+ --awsui-internal-style-focus-ring-width: var(--awsui-style-focus-ring-width);
83
+ --awsui-internal-style-focus-ring-radius: var(--awsui-style-focus-ring-radius);
84
+ --awsui-internal-style-focus-ring-gutter-block: var(--awsui-style-focus-ring-gutter-block);
85
+ --awsui-internal-style-focus-ring-gutter-inline: var(--awsui-style-focus-ring-gutter-inline);
43
86
  margin-block-start: calc((var(--line-height-body-m-5xw6xo, 20px) - var(--size-control-jpgj8e, 16px)) / 2);
44
87
  min-block-size: var(--size-control-jpgj8e, 16px);
45
88
  min-inline-size: var(--size-control-jpgj8e, 16px);
@@ -47,25 +90,38 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
47
90
  inline-size: var(--size-control-jpgj8e, 16px);
48
91
  }
49
92
 
50
- .awsui_outline_k2y2q_10z3g_50:not(#\9) {
51
- --awsui-style-focus-ring-box-shadow-66120l: 0 0 0 var(--awsui-style-focus-ring-border-width-66120l, 2px) var(--awsui-style-focus-ring-border-color-66120l, var(--color-border-item-focused-sewkzn, #006ce0));
93
+ .awsui_outline_k2y2q_vvlo6_93:not(#\9) {
52
94
  position: relative;
53
95
  }
54
- .awsui_outline_k2y2q_10z3g_50:not(#\9) {
96
+ .awsui_outline_k2y2q_vvlo6_93:not(#\9) {
55
97
  outline: 2px dotted transparent;
56
- outline-offset: calc(2px - 1px);
98
+ outline-offset: calc(var(--awsui-internal-style-focus-ring-gutter-inline, 2px) - 1px);
57
99
  }
58
- .awsui_outline_k2y2q_10z3g_50:not(#\9)::before {
100
+ .awsui_outline_k2y2q_vvlo6_93:not(#\9)::before {
59
101
  content: " ";
60
102
  display: block;
61
103
  position: absolute;
62
- inset-inline-start: calc(-1 * 2px);
63
- inset-block-start: calc(-1 * 2px);
64
- inline-size: calc(100% + 2px + 2px);
65
- block-size: calc(100% + 2px + 2px);
66
- border-start-start-radius: var(--awsui-style-focus-ring-border-radius-66120l, var(--border-radius-control-default-focus-ring-akwhsf, 4px));
67
- border-start-end-radius: var(--awsui-style-focus-ring-border-radius-66120l, var(--border-radius-control-default-focus-ring-akwhsf, 4px));
68
- border-end-start-radius: var(--awsui-style-focus-ring-border-radius-66120l, var(--border-radius-control-default-focus-ring-akwhsf, 4px));
69
- border-end-end-radius: var(--awsui-style-focus-ring-border-radius-66120l, var(--border-radius-control-default-focus-ring-akwhsf, 4px));
70
- box-shadow: var(--awsui-style-focus-ring-box-shadow-66120l);
104
+ inset-inline-start: calc(-1 * var(--awsui-internal-style-focus-ring-gutter-inline, 2px));
105
+ inset-block-start: calc(-1 * var(--awsui-internal-style-focus-ring-gutter-block, 2px));
106
+ inline-size: calc(100% + var(--awsui-internal-style-focus-ring-gutter-inline, 2px) + var(--awsui-internal-style-focus-ring-gutter-inline, 2px));
107
+ block-size: calc(100% + var(--awsui-internal-style-focus-ring-gutter-block, 2px) + var(--awsui-internal-style-focus-ring-gutter-block, 2px));
108
+ border-start-start-radius: var(--awsui-internal-style-focus-ring-radius, var(--awsui-style-focus-ring-border-radius-66120l, var(--border-radius-control-default-focus-ring-akwhsf, 4px)));
109
+ border-start-end-radius: var(--awsui-internal-style-focus-ring-radius, var(--awsui-style-focus-ring-border-radius-66120l, var(--border-radius-control-default-focus-ring-akwhsf, 4px)));
110
+ border-end-start-radius: var(--awsui-internal-style-focus-ring-radius, var(--awsui-style-focus-ring-border-radius-66120l, var(--border-radius-control-default-focus-ring-akwhsf, 4px)));
111
+ border-end-end-radius: var(--awsui-internal-style-focus-ring-radius, var(--awsui-style-focus-ring-border-radius-66120l, var(--border-radius-control-default-focus-ring-akwhsf, 4px)));
112
+ box-shadow: 0 0 0 var(--awsui-internal-style-focus-ring-width, var(--awsui-style-focus-ring-border-width-66120l, 2px)) var(--awsui-internal-style-focus-ring-color, var(--awsui-style-focus-ring-border-color-66120l, var(--color-border-item-focused-sewkzn, #006ce0)));
113
+ }
114
+
115
+ .awsui_label_k2y2q_vvlo6_115.awsui_label_k2y2q_vvlo6_115:not(#\9) {
116
+ color: var(--awsui-style-color, var(--color-text-form-default-8bb22s, #0f141a));
117
+ }
118
+ .awsui_label_k2y2q_vvlo6_115.awsui_label_k2y2q_vvlo6_115.awsui_label-disabled_k2y2q_vvlo6_118:not(#\9) {
119
+ color: var(--awsui-style-color, var(--color-text-control-disabled-54tz75, #b4b4bb));
120
+ }
121
+
122
+ .awsui_description_k2y2q_vvlo6_122.awsui_description_k2y2q_vvlo6_122:not(#\9) {
123
+ color: var(--awsui-style-color, var(--color-text-form-secondary-wt0md2, #656871));
124
+ }
125
+ .awsui_description_k2y2q_vvlo6_122.awsui_description_k2y2q_vvlo6_122.awsui_description-disabled_k2y2q_vvlo6_125:not(#\9) {
126
+ color: var(--awsui-style-color, var(--color-text-control-disabled-54tz75, #b4b4bb));
71
127
  }
@@ -2,8 +2,12 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "root": "awsui_root_k2y2q_10z3g_9",
6
- "checkbox-control": "awsui_checkbox-control_k2y2q_10z3g_42",
7
- "outline": "awsui_outline_k2y2q_10z3g_50"
5
+ "root": "awsui_root_k2y2q_vvlo6_44",
6
+ "checkbox-control": "awsui_checkbox-control_k2y2q_vvlo6_77",
7
+ "outline": "awsui_outline_k2y2q_vvlo6_93",
8
+ "label": "awsui_label_k2y2q_vvlo6_115",
9
+ "label-disabled": "awsui_label-disabled_k2y2q_vvlo6_118",
10
+ "description": "awsui_description_k2y2q_vvlo6_122",
11
+ "description-disabled": "awsui_description-disabled_k2y2q_vvlo6_125"
8
12
  };
9
13
 
@@ -1,9 +1,5 @@
1
+ import React from 'react';
1
2
  import { ContainerProps } from './interfaces';
2
3
  export { ContainerProps };
3
- export default function Container({
4
- variant,
5
- disableHeaderPaddings,
6
- disableContentPaddings,
7
- fitHeight,
8
- ...props
9
- }: ContainerProps): JSX.Element;
4
+ declare const Container: React.ForwardRefExoticComponent<ContainerProps & React.RefAttributes<ContainerProps.Ref>>;
5
+ export default Container;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/container/index.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9C,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAChC,OAAmB,EACnB,qBAA6B,EAC7B,sBAA8B,EAC9B,SAAiB,EACjB,GAAG,KAAK,EACT,EAAE,cAAc,eAyChB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/container/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9C,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B,QAAA,MAAM,SAAS,2FAqDd,CAAC;AAGF,eAAe,SAAS,CAAC"}
@@ -9,7 +9,7 @@ import useBaseComponent from '../internal/hooks/use-base-component';
9
9
  import { applyDisplayName } from '../internal/utils/apply-display-name';
10
10
  import { getExternalProps } from '../internal/utils/external-props';
11
11
  import { InternalContainerAsSubstep } from './internal';
12
- export default function Container({ variant = 'default', disableHeaderPaddings = false, disableContentPaddings = false, fitHeight = false, ...props }) {
12
+ const Container = React.forwardRef(({ variant = 'default', disableHeaderPaddings = false, disableContentPaddings = false, fitHeight = false, ...props }, ref) => {
13
13
  const analyticsMetadata = getAnalyticsMetadataProps(props);
14
14
  const baseComponentProps = useBaseComponent('Container', {
15
15
  props: {
@@ -28,7 +28,8 @@ export default function Container({ variant = 'default', disableHeaderPaddings =
28
28
  label: { root: 'self' },
29
29
  };
30
30
  return (React.createElement(AnalyticsFunnelSubStep, { subStepIdentifier: analyticsMetadata === null || analyticsMetadata === void 0 ? void 0 : analyticsMetadata.instanceIdentifier, subStepErrorContext: analyticsMetadata === null || analyticsMetadata === void 0 ? void 0 : analyticsMetadata.errorContext },
31
- React.createElement(InternalContainerAsSubstep, { variant: variant, disableContentPaddings: disableContentPaddings, disableHeaderPaddings: disableHeaderPaddings, fitHeight: fitHeight, ...props, ...externalProps, ...baseComponentProps, ...getAnalyticsMetadataAttribute({ component: analyticsComponentMetadata }) })));
32
- }
31
+ React.createElement(InternalContainerAsSubstep, { ref: ref, variant: variant, disableContentPaddings: disableContentPaddings, disableHeaderPaddings: disableHeaderPaddings, fitHeight: fitHeight, ...props, ...externalProps, ...baseComponentProps, ...getAnalyticsMetadataAttribute({ component: analyticsComponentMetadata }) })));
32
+ });
33
33
  applyDisplayName(Container, 'Container');
34
+ export default Container;
34
35
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/container/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,YAAY,CAAC;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,EAAE,sBAAsB,EAAE,MAAM,mDAAmD,CAAC;AAC3F,OAAO,EAAkC,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvG,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAGpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAIxD,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAChC,OAAO,GAAG,SAAS,EACnB,qBAAqB,GAAG,KAAK,EAC7B,sBAAsB,GAAG,KAAK,EAC9B,SAAS,GAAG,KAAK,EACjB,GAAG,KAAK,EACO;IACf,MAAM,iBAAiB,GAAG,yBAAyB,CAAC,KAAuC,CAAC,CAAC;IAC7F,MAAM,kBAAkB,GAAG,gBAAgB,CACzC,WAAW,EACX;QACE,KAAK,EAAE;YACL,sBAAsB;YACtB,qBAAqB;YACrB,SAAS;YACT,OAAO;SACR;QACD,QAAQ,EAAE;YACR,qBAAqB,EAAE,OAAO,CAAC,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,kBAAkB,CAAC;SACtE;KACF,EACD,iBAAiB,CAClB,CAAC;IACF,MAAM,aAAa,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAE9C,MAAM,0BAA0B,GAAiD;QAC/E,IAAI,EAAE,iBAAiB;QACvB,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;KACxB,CAAC;IAEF,OAAO,CACL,oBAAC,sBAAsB,IACrB,iBAAiB,EAAE,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,kBAAkB,EACxD,mBAAmB,EAAE,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,YAAY;QAEpD,oBAAC,0BAA0B,IACzB,OAAO,EAAE,OAAO,EAChB,sBAAsB,EAAE,sBAAsB,EAC9C,qBAAqB,EAAE,qBAAqB,EAC5C,SAAS,EAAE,SAAS,KAChB,KAAK,KACL,aAAa,KACb,kBAAkB,KAClB,6BAA6B,CAAC,EAAE,SAAS,EAAE,0BAA0B,EAAE,CAAC,GAC5E,CACqB,CAC1B,CAAC;AACJ,CAAC;AAED,gBAAgB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n'use client';\nimport React from 'react';\n\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { AnalyticsFunnelSubStep } from '../internal/analytics/components/analytics-funnel';\nimport { BasePropsWithAnalyticsMetadata, getAnalyticsMetadataProps } from '../internal/base-component';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { getExternalProps } from '../internal/utils/external-props';\nimport { GeneratedAnalyticsMetadataContainerComponent } from './analytics-metadata/interfaces';\nimport { ContainerProps } from './interfaces';\nimport { InternalContainerAsSubstep } from './internal';\n\nexport { ContainerProps };\n\nexport default function Container({\n variant = 'default',\n disableHeaderPaddings = false,\n disableContentPaddings = false,\n fitHeight = false,\n ...props\n}: ContainerProps) {\n const analyticsMetadata = getAnalyticsMetadataProps(props as BasePropsWithAnalyticsMetadata);\n const baseComponentProps = useBaseComponent(\n 'Container',\n {\n props: {\n disableContentPaddings,\n disableHeaderPaddings,\n fitHeight,\n variant,\n },\n metadata: {\n hasInstanceIdentifier: Boolean(analyticsMetadata?.instanceIdentifier),\n },\n },\n analyticsMetadata\n );\n const externalProps = getExternalProps(props);\n\n const analyticsComponentMetadata: GeneratedAnalyticsMetadataContainerComponent = {\n name: 'awsui.Container',\n label: { root: 'self' },\n };\n\n return (\n <AnalyticsFunnelSubStep\n subStepIdentifier={analyticsMetadata?.instanceIdentifier}\n subStepErrorContext={analyticsMetadata?.errorContext}\n >\n <InternalContainerAsSubstep\n variant={variant}\n disableContentPaddings={disableContentPaddings}\n disableHeaderPaddings={disableHeaderPaddings}\n fitHeight={fitHeight}\n {...props}\n {...externalProps}\n {...baseComponentProps}\n {...getAnalyticsMetadataAttribute({ component: analyticsComponentMetadata })}\n />\n </AnalyticsFunnelSubStep>\n );\n}\n\napplyDisplayName(Container, 'Container');\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/container/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,YAAY,CAAC;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,EAAE,sBAAsB,EAAE,MAAM,mDAAmD,CAAC;AAC3F,OAAO,EAAkC,yBAAyB,EAAE,MAAM,4BAA4B,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AS,EAAE,SAAS,KAChB,KAAK,KACL,aAAa,KACb,kBAAkB,KAClB,6BAA6B,CAAC,EAAE,SAAS,EAAE,0BAA0B,EAAE,CAAC,GAC5E,CACqB,CAC1B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AACzC,eAAe,SAAS,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n'use client';\nimport React from 'react';\n\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { AnalyticsFunnelSubStep } from '../internal/analytics/components/analytics-funnel';\nimport { BasePropsWithAnalyticsMetadata, getAnalyticsMetadataProps } from '../internal/base-component';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { getExternalProps } from '../internal/utils/external-props';\nimport { GeneratedAnalyticsMetadataContainerComponent } from './analytics-metadata/interfaces';\nimport { ContainerProps } from './interfaces';\nimport { InternalContainerAsSubstep } from './internal';\n\nexport { ContainerProps };\n\nconst Container = React.forwardRef(\n (\n {\n variant = 'default',\n disableHeaderPaddings = false,\n disableContentPaddings = false,\n fitHeight = false,\n ...props\n }: ContainerProps,\n ref: React.Ref<ContainerProps.Ref>\n ) => {\n const analyticsMetadata = getAnalyticsMetadataProps(props as BasePropsWithAnalyticsMetadata);\n const baseComponentProps = useBaseComponent(\n 'Container',\n {\n props: {\n disableContentPaddings,\n disableHeaderPaddings,\n fitHeight,\n variant,\n },\n metadata: {\n hasInstanceIdentifier: Boolean(analyticsMetadata?.instanceIdentifier),\n },\n },\n analyticsMetadata\n );\n const externalProps = getExternalProps(props);\n\n const analyticsComponentMetadata: GeneratedAnalyticsMetadataContainerComponent = {\n name: 'awsui.Container',\n label: { root: 'self' },\n };\n\n return (\n <AnalyticsFunnelSubStep\n subStepIdentifier={analyticsMetadata?.instanceIdentifier}\n subStepErrorContext={analyticsMetadata?.errorContext}\n >\n <InternalContainerAsSubstep\n ref={ref}\n variant={variant}\n disableContentPaddings={disableContentPaddings}\n disableHeaderPaddings={disableHeaderPaddings}\n fitHeight={fitHeight}\n {...props}\n {...externalProps}\n {...baseComponentProps}\n {...getAnalyticsMetadataAttribute({ component: analyticsComponentMetadata })}\n />\n </AnalyticsFunnelSubStep>\n );\n }\n);\n\napplyDisplayName(Container, 'Container');\nexport default Container;\n"]}
@@ -75,6 +75,13 @@ export interface ContainerProps extends BaseComponentProps {
75
75
  style?: ContainerProps.Style;
76
76
  }
77
77
  export declare namespace ContainerProps {
78
+ interface Ref {
79
+ /**
80
+ * Sets focus on the container and scrolls it into view. Use this to move the user's focus to a
81
+ * container programmatically, for example in "jump to item" or deep-linking patterns.
82
+ */
83
+ focus(): void;
84
+ }
78
85
  interface AnalyticsMetadata {
79
86
  instanceIdentifier?: string;
80
87
  }
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/container/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,MAAM,WAAW,cAAe,SAAQ,kBAAkB;IACxD;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,cAAc,CAAC,iBAAiB,CAAC;IAErD;;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;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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;IAED,UAAiB,KAAK;QACpB,IAAI,CAAC,EAAE;YACL,UAAU,CAAC,EAAE,MAAM,CAAC;YACpB,WAAW,CAAC,EAAE,MAAM,CAAC;YACrB,YAAY,CAAC,EAAE,MAAM,CAAC;YACtB,WAAW,CAAC,EAAE,MAAM,CAAC;YACrB,SAAS,CAAC,EAAE,MAAM,CAAC;YACnB,KAAK,CAAC,EAAE,MAAM,CAAC;SAChB,CAAC;QACF,OAAO,CAAC,EAAE;YACR,YAAY,CAAC,EAAE,MAAM,CAAC;YACtB,aAAa,CAAC,EAAE,MAAM,CAAC;SACxB,CAAC;QACF,MAAM,CAAC,EAAE;YACP,YAAY,CAAC,EAAE,MAAM,CAAC;YACtB,aAAa,CAAC,EAAE,MAAM,CAAC;SACxB,CAAC;QACF,MAAM,CAAC,EAAE;YACP,IAAI,EAAE;gBACJ,YAAY,CAAC,EAAE,MAAM,CAAC;gBACtB,aAAa,CAAC,EAAE,MAAM,CAAC;aACxB,CAAC;YACF,OAAO,EAAE;gBACP,WAAW,CAAC,EAAE,MAAM,CAAC;gBACrB,WAAW,CAAC,EAAE,MAAM,CAAC;aACtB,CAAC;SACH,CAAC;KACH;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/container/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { BaseComponentProps } from '../types/base-component';\n\nexport interface ContainerProps extends BaseComponentProps {\n /**\n * Specifies additional analytics-related metadata.\n * * `instanceIdentifier` - A unique string that identifies this component instance in your application.\n * @analytics\n */\n analyticsMetadata?: ContainerProps.AnalyticsMetadata;\n\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`, `picture`, and `iframe` 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 * Determines whether the container footer has padding. If `true`, removes the default padding from the footer.\n */\n disableFooterPaddings?: boolean;\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 /**\n * An object containing CSS properties to customize the container's visual appearance.\n * Refer to the [style](/components/container/?tabId=style) tab for more details.\n * @awsuiSystem core\n */\n style?: ContainerProps.Style;\n}\n\nexport namespace ContainerProps {\n export interface AnalyticsMetadata {\n instanceIdentifier?: string;\n }\n export interface Media {\n /**\n * Use this slot to render your media element. We support `img`, `video`, `picture`, and `iframe` elements.\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 export interface Style {\n root?: {\n background?: string;\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n boxShadow?: string;\n color?: string;\n };\n content?: {\n paddingBlock?: string;\n paddingInline?: string;\n };\n header?: {\n paddingBlock?: string;\n paddingInline?: string;\n };\n footer?: {\n root: {\n paddingBlock?: string;\n paddingInline?: string;\n };\n divider: {\n borderColor?: string;\n borderWidth?: string;\n };\n };\n }\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/container/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { BaseComponentProps } from '../types/base-component';\n\nexport interface ContainerProps extends BaseComponentProps {\n /**\n * Specifies additional analytics-related metadata.\n * * `instanceIdentifier` - A unique string that identifies this component instance in your application.\n * @analytics\n */\n analyticsMetadata?: ContainerProps.AnalyticsMetadata;\n\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`, `picture`, and `iframe` 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 * Determines whether the container footer has padding. If `true`, removes the default padding from the footer.\n */\n disableFooterPaddings?: boolean;\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 /**\n * An object containing CSS properties to customize the container's visual appearance.\n * Refer to the [style](/components/container/?tabId=style) tab for more details.\n * @awsuiSystem core\n */\n style?: ContainerProps.Style;\n}\n\nexport namespace ContainerProps {\n export interface Ref {\n /**\n * Sets focus on the container and scrolls it into view. Use this to move the user's focus to a\n * container programmatically, for example in \"jump to item\" or deep-linking patterns.\n */\n focus(): void;\n }\n\n export interface AnalyticsMetadata {\n instanceIdentifier?: string;\n }\n export interface Media {\n /**\n * Use this slot to render your media element. We support `img`, `video`, `picture`, and `iframe` elements.\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 export interface Style {\n root?: {\n background?: string;\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n boxShadow?: string;\n color?: string;\n };\n content?: {\n paddingBlock?: string;\n paddingInline?: string;\n };\n header?: {\n paddingBlock?: string;\n paddingInline?: string;\n };\n footer?: {\n root: {\n paddingBlock?: string;\n paddingInline?: string;\n };\n divider: {\n borderColor?: string;\n borderWidth?: string;\n };\n };\n }\n}\n"]}
@@ -27,29 +27,6 @@ export interface InternalContainerProps extends Omit<ContainerProps, 'variant'>,
27
27
  */
28
28
  __contentKey?: string;
29
29
  }
30
- export declare function InternalContainerAsSubstep(props: InternalContainerProps): JSX.Element;
31
- export default function InternalContainer({
32
- header,
33
- footer,
34
- children,
35
- variant,
36
- disableHeaderPaddings,
37
- disableContentPaddings,
38
- disableFooterPaddings,
39
- fitHeight,
40
- media,
41
- style,
42
- __stickyOffset,
43
- __mobileStickyOffset,
44
- __stickyHeader,
45
- __internalRootRef,
46
- __disableFooterDivider,
47
- __hiddenContent,
48
- __headerRef,
49
- __fullPage,
50
- __disableStickyMobile,
51
- __funnelSubStepProps,
52
- __subStepRef,
53
- __contentKey,
54
- ...restProps
55
- }: InternalContainerProps): JSX.Element;
30
+ export declare const InternalContainerAsSubstep: React.ForwardRefExoticComponent<InternalContainerProps & React.RefAttributes<ContainerProps.Ref>>;
31
+ declare const InternalContainer: React.ForwardRefExoticComponent<InternalContainerProps & React.RefAttributes<ContainerProps.Ref>>;
32
+ export default InternalContainer;
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/container/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAQtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAI1E,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAGlF,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAQ9C,MAAM,WAAW,sBAAuB,SAAQ,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC,EAAE,0BAA0B;IACzG,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC9C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,GAAG,UAAU,GAAG,WAAW,GAAG,OAAO,CAAC;IA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C;IAC1B,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC9C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,GAAG,UAAU,GAAG,WAAW,GAAG,OAAO,CAAC;IAEzE,oBAAoB,CAAC,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC,oBAAoB,CAAC,CAAC;IACjF,YAAY,CAAC,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC,YAAY,CAAC,CAAC;IAEjE;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,0BAA0B,mGActC,CAAC;AAEF,QAAA,MAAM,iBAAiB,mGAkMrB,CAAC;AAEH,eAAe,iBAAiB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
- import React, { useRef } from 'react';
3
+ import React, { useImperativeHandle, useRef, useState } from 'react';
4
4
  import clsx from 'clsx';
5
5
  import { useMergeRefs, useUniqueId } from '@cloudscape-design/component-toolkit/internal';
6
6
  import { getAnalyticsLabelAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';
@@ -12,25 +12,53 @@ import { ContainerHeaderContextProvider } from '../internal/context/container-he
12
12
  import { useModalContext } from '../internal/context/modal-context';
13
13
  import { useMobile } from '../internal/hooks/use-mobile';
14
14
  import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
15
+ import { scrollElementIntoView } from '../internal/utils/scrollable-containers';
15
16
  import { getContentStyles, getFooterStyles, getHeaderStyles, getMediaStyles, getRootStyles } from './style';
16
17
  import { StickyHeaderContext, useStickyHeader } from './use-sticky-header';
17
18
  import analyticsSelectors from './analytics-metadata/styles.css.js';
18
19
  import styles from './styles.css.js';
19
20
  import testStyles from './test-classes/styles.css.js';
20
- export function InternalContainerAsSubstep(props) {
21
+ export const InternalContainerAsSubstep = React.forwardRef((props, ref) => {
21
22
  const { subStepRef, funnelSubStepProps } = useFunnelSubStep();
22
23
  const modalContext = useModalContext();
23
- return (React.createElement(InternalContainer, { ...props, __subStepRef: (modalContext === null || modalContext === void 0 ? void 0 : modalContext.isInModal) ? { current: null } : subStepRef, __funnelSubStepProps: (modalContext === null || modalContext === void 0 ? void 0 : modalContext.isInModal) ? {} : funnelSubStepProps }));
24
- }
25
- export default function InternalContainer({ header, footer, children, variant = 'default', disableHeaderPaddings = false, disableContentPaddings = false, disableFooterPaddings = false, fitHeight, media, style, __stickyOffset, __mobileStickyOffset, __stickyHeader = false, __internalRootRef, __disableFooterDivider = false, __hiddenContent = false, __headerRef, __fullPage = false, __disableStickyMobile = true, __funnelSubStepProps, __subStepRef, __contentKey, ...restProps }) {
24
+ return (React.createElement(InternalContainer, { ...props, ref: ref, __subStepRef: (modalContext === null || modalContext === void 0 ? void 0 : modalContext.isInModal) ? { current: null } : subStepRef, __funnelSubStepProps: (modalContext === null || modalContext === void 0 ? void 0 : modalContext.isInModal) ? {} : funnelSubStepProps }));
25
+ });
26
+ const InternalContainer = React.forwardRef(function InternalContainer({ header, footer, children, variant = 'default', disableHeaderPaddings = false, disableContentPaddings = false, disableFooterPaddings = false, fitHeight, media, style, __stickyOffset, __mobileStickyOffset, __stickyHeader = false, __internalRootRef, __disableFooterDivider = false, __hiddenContent = false, __headerRef, __fullPage = false, __disableStickyMobile = true, __funnelSubStepProps, __subStepRef, __contentKey, ...restProps }, ref) {
26
27
  var _a;
27
28
  const isMobile = useMobile();
28
29
  const isRefresh = useVisualRefresh();
29
30
  const baseProps = getBaseProps(restProps);
30
31
  const rootRef = useRef(null);
31
32
  const headerRef = useRef(null);
33
+ const [showFocusRing, setShowFocusRing] = useState(false);
34
+ useImperativeHandle(ref, () => ({
35
+ focus: () => {
36
+ if (rootRef.current) {
37
+ rootRef.current.tabIndex = -1;
38
+ rootRef.current.setAttribute('role', 'group');
39
+ if (header) {
40
+ rootRef.current.setAttribute('aria-labelledby', headerId);
41
+ }
42
+ setShowFocusRing(true);
43
+ // focus()'s implicit scroll is a no-op when the container is already focused (repeated jump).
44
+ rootRef.current.focus({ preventScroll: true });
45
+ scrollElementIntoView(rootRef.current);
46
+ }
47
+ },
48
+ }));
49
+ const onRootBlur = (event) => {
50
+ const funnelOnBlur = __funnelSubStepProps === null || __funnelSubStepProps === void 0 ? void 0 : __funnelSubStepProps.onBlur;
51
+ funnelOnBlur === null || funnelOnBlur === void 0 ? void 0 : funnelOnBlur(event);
52
+ if (event.target === rootRef.current) {
53
+ rootRef.current.removeAttribute('tabindex');
54
+ rootRef.current.removeAttribute('role');
55
+ rootRef.current.removeAttribute('aria-labelledby');
56
+ setShowFocusRing(false);
57
+ }
58
+ };
32
59
  const { isSticky, isStuck, isStuckAtBottom, stickyStyles } = useStickyHeader(rootRef, headerRef, __stickyHeader, __stickyOffset, __mobileStickyOffset, __disableStickyMobile, __fullPage && isRefresh && !isMobile);
33
60
  const contentId = useUniqueId();
61
+ const headerId = useUniqueId('container-header-');
34
62
  const hasDynamicHeight = isRefresh && variant === 'full-page';
35
63
  const mergedRef = useMergeRefs(rootRef, __internalRootRef);
36
64
  const headerMergedRef = useMergeRefs(headerRef, __headerRef);
@@ -39,7 +67,7 @@ export default function InternalContainer({ header, footer, children, variant =
39
67
  const shouldHaveStickyStyles = isSticky && !isMobile;
40
68
  const hasMedia = !!(media === null || media === void 0 ? void 0 : media.content);
41
69
  const mediaPosition = (_a = media === null || media === void 0 ? void 0 : media.position) !== null && _a !== void 0 ? _a : 'top';
42
- return (React.createElement("div", { ...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']], shouldHaveStickyStyles && isStuck && isStuckAtBottom && [styles['with-stuck-sticky-header-at-bottom']], isRefresh && styles.refresh), ref: mergedRef, ...getAnalyticsLabelAttribute(`.${analyticsSelectors.header} h1, .${analyticsSelectors.header} h2, .${analyticsSelectors.header} h3`), style: getRootStyles(style) },
70
+ return (React.createElement("div", { ...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']], shouldHaveStickyStyles && isStuck && isStuckAtBottom && [styles['with-stuck-sticky-header-at-bottom']], showFocusRing && styles['focus-ring'], isRefresh && styles.refresh), ref: mergedRef, onBlur: onRootBlur, ...getAnalyticsLabelAttribute(`.${analyticsSelectors.header} h1, .${analyticsSelectors.header} h2, .${analyticsSelectors.header} h3`), style: getRootStyles(style) },
43
71
  hasMedia && (React.createElement("div", { className: clsx(styles[`media-${mediaPosition === 'side' ? 'side' : 'top'}`], styles.media), style: mediaPosition === 'top'
44
72
  ? { ...getMediaStyles(mediaPosition, style), height: (media === null || media === void 0 ? void 0 : media.height) || '' }
45
73
  : { ...getMediaStyles(mediaPosition, style), width: (media === null || media === void 0 ? void 0 : media.width) || '' } }, media.content)),
@@ -47,7 +75,7 @@ export default function InternalContainer({ header, footer, children, variant =
47
75
  React.createElement(BuiltInErrorBoundary, { wrapper: content => React.createElement(InternalBox, { padding: "m" }, content) },
48
76
  header && (React.createElement(ContainerHeaderContextProvider, null,
49
77
  React.createElement(StickyHeaderContext.Provider, { value: { isStuck, isStuckAtBottom } },
50
- React.createElement("div", { className: clsx(isRefresh && styles.refresh, styles.header, analyticsSelectors.header, styles[`header-variant-${variant}`], {
78
+ React.createElement("div", { id: headerId, className: clsx(isRefresh && styles.refresh, styles.header, analyticsSelectors.header, styles[`header-variant-${variant}`], {
51
79
  [styles['header-sticky-disabled']]: __stickyHeader && !isSticky,
52
80
  [styles['header-sticky-enabled']]: isSticky,
53
81
  [styles['header-dynamic-height']]: hasDynamicHeight,
@@ -72,5 +100,6 @@ export default function InternalContainer({ header, footer, children, variant =
72
100
  [styles['with-divider']]: !__disableFooterDivider,
73
101
  [styles['with-paddings']]: !disableFooterPaddings,
74
102
  }), style: getFooterStyles(style) }, footer))))));
75
- }
103
+ });
104
+ export default InternalContainer;
76
105
  //# sourceMappingURL=internal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/container/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAC1F,OAAO,EAAE,0BAA0B,EAAE,MAAM,kEAAkE,CAAC;AAE9G,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AACtF,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEpE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,eAAe,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC5G,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3E,OAAO,kBAAkB,MAAM,oCAAoC,CAAC;AACpE,OAAO,MAAM,MAA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,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM;yBAClC,CAAC,EACF,KAAK,EAAE,gBAAgB,CAAC,KAAK,CAAC;wBAK9B,oBAAC,oBAAoB,IACnB,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC,CAClB,oBAAC,WAAW,IAAC,OAAO,EAAE,sBAAsB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,IAAG,OAAO,CAAe,CACxF,IAEA,QAAQ,CACY,CACnB,CACF;gBACL,MAAM,IAAI,CACT,6BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;wBAC7B,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,sBAAsB;wBACjD,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,qBAAqB;qBAClD,CAAC,EACF,KAAK,EAAE,eAAe,CAAC,KAAK,CAAC,IAE5B,MAAM,CACH,CACP,CACoB,CACnB,CACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs, useUniqueId } from '@cloudscape-design/component-toolkit/internal';\nimport { getAnalyticsLabelAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport InternalBox from '../box/internal';\nimport { BuiltInErrorBoundary } from '../error-boundary/internal';\nimport { useFunnelSubStep } from '../internal/analytics/hooks/use-funnel';\nimport { getBaseProps } from '../internal/base-component';\nimport { ContainerHeaderContextProvider } from '../internal/context/container-header';\nimport { useModalContext } from '../internal/context/modal-context';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { ContainerProps } from './interfaces';\nimport { getContentStyles, getFooterStyles, getHeaderStyles, getMediaStyles, getRootStyles } from './style';\nimport { StickyHeaderContext, useStickyHeader } from './use-sticky-header';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\nimport testStyles from './test-classes/styles.css.js';\n\nexport interface InternalContainerProps extends Omit<ContainerProps, 'variant'>, InternalBaseComponentProps {\n disableFooterPaddings?: boolean;\n __stickyHeader?: boolean;\n __stickyOffset?: number;\n __mobileStickyOffset?: number;\n __disableFooterDivider?: boolean;\n __hiddenContent?: boolean;\n __headerRef?: React.RefObject<HTMLDivElement>;\n __fullPage?: 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 __funnelSubStepProps?: ReturnType<typeof useFunnelSubStep>['funnelSubStepProps'];\n __subStepRef?: ReturnType<typeof useFunnelSubStep>['subStepRef'];\n\n /**\n * React key attached to the content wrapper. It is used to force content re-mount but not container re-mount, which\n * is necessary for components that use container as a root node internally so that their test-utils wrapper is not detached.\n */\n __contentKey?: string;\n}\n\nexport function InternalContainerAsSubstep(props: InternalContainerProps) {\n const { subStepRef, funnelSubStepProps } = useFunnelSubStep();\n const modalContext = useModalContext();\n\n return (\n <InternalContainer\n {...props}\n __subStepRef={modalContext?.isInModal ? { current: null } : subStepRef}\n __funnelSubStepProps={modalContext?.isInModal ? {} : funnelSubStepProps}\n />\n );\n}\n\nexport default function InternalContainer({\n header,\n footer,\n children,\n variant = 'default',\n disableHeaderPaddings = false,\n disableContentPaddings = false,\n disableFooterPaddings = false,\n fitHeight,\n media,\n style,\n __stickyOffset,\n __mobileStickyOffset,\n __stickyHeader = false,\n __internalRootRef,\n __disableFooterDivider = false,\n __hiddenContent = false,\n __headerRef,\n __fullPage = false,\n __disableStickyMobile = true,\n __funnelSubStepProps,\n __subStepRef,\n __contentKey,\n ...restProps\n}: InternalContainerProps) {\n const isMobile = useMobile();\n const isRefresh = useVisualRefresh();\n const baseProps = getBaseProps(restProps);\n const rootRef = useRef<HTMLDivElement>(null);\n const headerRef = useRef<HTMLDivElement>(null);\n const { isSticky, isStuck, isStuckAtBottom, stickyStyles } = useStickyHeader(\n rootRef,\n headerRef,\n __stickyHeader,\n __stickyOffset,\n __mobileStickyOffset,\n __disableStickyMobile,\n __fullPage && isRefresh && !isMobile\n );\n const contentId = useUniqueId();\n\n const hasDynamicHeight = isRefresh && variant === 'full-page';\n\n const mergedRef = useMergeRefs(rootRef, __internalRootRef);\n const headerMergedRef = useMergeRefs(headerRef, __headerRef);\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 shouldHaveStickyStyles && isStuck && isStuckAtBottom && [styles['with-stuck-sticky-header-at-bottom']],\n isRefresh && styles.refresh\n )}\n ref={mergedRef}\n {...getAnalyticsLabelAttribute(\n `.${analyticsSelectors.header} h1, .${analyticsSelectors.header} h2, .${analyticsSelectors.header} h3`\n )}\n style={getRootStyles(style)}\n >\n {hasMedia && (\n <div\n className={clsx(styles[`media-${mediaPosition === 'side' ? 'side' : 'top'}`], styles.media)}\n style={\n mediaPosition === 'top'\n ? { ...getMediaStyles(mediaPosition, style), height: media?.height || '' }\n : { ...getMediaStyles(mediaPosition, style), width: media?.width || '' }\n }\n >\n {media.content}\n </div>\n )}\n <div\n id={contentId}\n ref={__subStepRef}\n key={__contentKey}\n className={clsx(styles['content-wrapper'], fitHeight && styles['content-wrapper-fit-height'])}\n >\n {/* We use a wrapper around the boundary to preserve container's paddings. */}\n <BuiltInErrorBoundary wrapper={content => <InternalBox padding=\"m\">{content}</InternalBox>}>\n {header && (\n <ContainerHeaderContextProvider>\n <StickyHeaderContext.Provider value={{ isStuck, isStuckAtBottom }}>\n <div\n className={clsx(\n isRefresh && styles.refresh,\n styles.header,\n analyticsSelectors.header,\n styles[`header-variant-${variant}`],\n {\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 [styles['header-full-page']]: __fullPage && isRefresh,\n }\n )}\n ref={headerMergedRef}\n style={{\n ...stickyStyles.style,\n ...getHeaderStyles(style),\n }}\n >\n {isStuck && !isMobile && isRefresh && __fullPage && <div className={styles['header-cover']}></div>}\n {header}\n </div>\n </StickyHeaderContext.Provider>\n </ContainerHeaderContextProvider>\n )}\n <div className={clsx(styles.content, fitHeight && styles['content-fit-height'])}>\n <div\n className={clsx(styles['content-inner'], testStyles['content-inner'], {\n [styles['with-paddings']]: !disableContentPaddings,\n [styles['with-header']]: !!header,\n })}\n style={getContentStyles(style)}\n >\n {/* We use a wrapper around the boundary to preserve paddings in case they were disabled by the consumer.\n That is needed because the consumer-defined paddings that normally come with the content can no longer\n apply since the content failed to render. */}\n <BuiltInErrorBoundary\n wrapper={content => (\n <InternalBox padding={disableContentPaddings ? 'm' : undefined}>{content}</InternalBox>\n )}\n >\n {children}\n </BuiltInErrorBoundary>\n </div>\n </div>\n {footer && (\n <div\n className={clsx(styles.footer, {\n [styles['with-divider']]: !__disableFooterDivider,\n [styles['with-paddings']]: !disableFooterPaddings,\n })}\n style={getFooterStyles(style)}\n >\n {footer}\n </div>\n )}\n </BuiltInErrorBoundary>\n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AU,CAAC,eAAe,CAAC,EAAE;4BACpE,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,sBAAsB;4BAClD,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM;yBAClC,CAAC,EACF,KAAK,EAAE,gBAAgB,CAAC,KAAK,CAAC;wBAK9B,oBAAC,oBAAoB,IACnB,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC,CAClB,oBAAC,WAAW,IAAC,OAAO,EAAE,sBAAsB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,IAAG,OAAO,CAAe,CACxF,IAEA,QAAQ,CACY,CACnB,CACF;gBACL,MAAM,IAAI,CACT,6BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;wBAC7B,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,sBAAsB;wBACjD,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,qBAAqB;qBAClD,CAAC,EACF,KAAK,EAAE,eAAe,CAAC,KAAK,CAAC,IAE5B,MAAM,CACH,CACP,CACoB,CACnB,CACF,CACP,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,iBAAiB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useImperativeHandle, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs, useUniqueId } from '@cloudscape-design/component-toolkit/internal';\nimport { getAnalyticsLabelAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport InternalBox from '../box/internal';\nimport { BuiltInErrorBoundary } from '../error-boundary/internal';\nimport { useFunnelSubStep } from '../internal/analytics/hooks/use-funnel';\nimport { getBaseProps } from '../internal/base-component';\nimport { ContainerHeaderContextProvider } from '../internal/context/container-header';\nimport { useModalContext } from '../internal/context/modal-context';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { scrollElementIntoView } from '../internal/utils/scrollable-containers';\nimport { ContainerProps } from './interfaces';\nimport { getContentStyles, getFooterStyles, getHeaderStyles, getMediaStyles, getRootStyles } from './style';\nimport { StickyHeaderContext, useStickyHeader } from './use-sticky-header';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\nimport testStyles from './test-classes/styles.css.js';\n\nexport interface InternalContainerProps extends Omit<ContainerProps, 'variant'>, InternalBaseComponentProps {\n disableFooterPaddings?: boolean;\n __stickyHeader?: boolean;\n __stickyOffset?: number;\n __mobileStickyOffset?: number;\n __disableFooterDivider?: boolean;\n __hiddenContent?: boolean;\n __headerRef?: React.RefObject<HTMLDivElement>;\n __fullPage?: 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 __funnelSubStepProps?: ReturnType<typeof useFunnelSubStep>['funnelSubStepProps'];\n __subStepRef?: ReturnType<typeof useFunnelSubStep>['subStepRef'];\n\n /**\n * React key attached to the content wrapper. It is used to force content re-mount but not container re-mount, which\n * is necessary for components that use container as a root node internally so that their test-utils wrapper is not detached.\n */\n __contentKey?: string;\n}\n\nexport const InternalContainerAsSubstep = React.forwardRef(\n (props: InternalContainerProps, ref: React.Ref<ContainerProps.Ref>) => {\n const { subStepRef, funnelSubStepProps } = useFunnelSubStep();\n const modalContext = useModalContext();\n\n return (\n <InternalContainer\n {...props}\n ref={ref}\n __subStepRef={modalContext?.isInModal ? { current: null } : subStepRef}\n __funnelSubStepProps={modalContext?.isInModal ? {} : funnelSubStepProps}\n />\n );\n }\n);\n\nconst InternalContainer = React.forwardRef(function InternalContainer(\n {\n header,\n footer,\n children,\n variant = 'default',\n disableHeaderPaddings = false,\n disableContentPaddings = false,\n disableFooterPaddings = false,\n fitHeight,\n media,\n style,\n __stickyOffset,\n __mobileStickyOffset,\n __stickyHeader = false,\n __internalRootRef,\n __disableFooterDivider = false,\n __hiddenContent = false,\n __headerRef,\n __fullPage = false,\n __disableStickyMobile = true,\n __funnelSubStepProps,\n __subStepRef,\n __contentKey,\n ...restProps\n }: InternalContainerProps,\n ref: React.Ref<ContainerProps.Ref>\n) {\n const isMobile = useMobile();\n const isRefresh = useVisualRefresh();\n const baseProps = getBaseProps(restProps);\n const rootRef = useRef<HTMLDivElement>(null);\n const headerRef = useRef<HTMLDivElement>(null);\n\n const [showFocusRing, setShowFocusRing] = useState(false);\n useImperativeHandle(ref, () => ({\n focus: () => {\n if (rootRef.current) {\n rootRef.current.tabIndex = -1;\n rootRef.current.setAttribute('role', 'group');\n if (header) {\n rootRef.current.setAttribute('aria-labelledby', headerId);\n }\n setShowFocusRing(true);\n // focus()'s implicit scroll is a no-op when the container is already focused (repeated jump).\n rootRef.current.focus({ preventScroll: true });\n scrollElementIntoView(rootRef.current);\n }\n },\n }));\n const onRootBlur = (event: React.FocusEvent<HTMLDivElement>) => {\n const funnelOnBlur = __funnelSubStepProps?.onBlur as React.FocusEventHandler<HTMLDivElement> | undefined;\n funnelOnBlur?.(event);\n if (event.target === rootRef.current) {\n rootRef.current.removeAttribute('tabindex');\n rootRef.current.removeAttribute('role');\n rootRef.current.removeAttribute('aria-labelledby');\n setShowFocusRing(false);\n }\n };\n const { isSticky, isStuck, isStuckAtBottom, stickyStyles } = useStickyHeader(\n rootRef,\n headerRef,\n __stickyHeader,\n __stickyOffset,\n __mobileStickyOffset,\n __disableStickyMobile,\n __fullPage && isRefresh && !isMobile\n );\n const contentId = useUniqueId();\n const headerId = useUniqueId('container-header-');\n\n const hasDynamicHeight = isRefresh && variant === 'full-page';\n\n const mergedRef = useMergeRefs(rootRef, __internalRootRef);\n const headerMergedRef = useMergeRefs(headerRef, __headerRef);\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 shouldHaveStickyStyles && isStuck && isStuckAtBottom && [styles['with-stuck-sticky-header-at-bottom']],\n showFocusRing && styles['focus-ring'],\n isRefresh && styles.refresh\n )}\n ref={mergedRef}\n onBlur={onRootBlur}\n {...getAnalyticsLabelAttribute(\n `.${analyticsSelectors.header} h1, .${analyticsSelectors.header} h2, .${analyticsSelectors.header} h3`\n )}\n style={getRootStyles(style)}\n >\n {hasMedia && (\n <div\n className={clsx(styles[`media-${mediaPosition === 'side' ? 'side' : 'top'}`], styles.media)}\n style={\n mediaPosition === 'top'\n ? { ...getMediaStyles(mediaPosition, style), height: media?.height || '' }\n : { ...getMediaStyles(mediaPosition, style), width: media?.width || '' }\n }\n >\n {media.content}\n </div>\n )}\n <div\n id={contentId}\n ref={__subStepRef}\n key={__contentKey}\n className={clsx(styles['content-wrapper'], fitHeight && styles['content-wrapper-fit-height'])}\n >\n {/* We use a wrapper around the boundary to preserve container's paddings. */}\n <BuiltInErrorBoundary wrapper={content => <InternalBox padding=\"m\">{content}</InternalBox>}>\n {header && (\n <ContainerHeaderContextProvider>\n <StickyHeaderContext.Provider value={{ isStuck, isStuckAtBottom }}>\n <div\n id={headerId}\n className={clsx(\n isRefresh && styles.refresh,\n styles.header,\n analyticsSelectors.header,\n styles[`header-variant-${variant}`],\n {\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 [styles['header-full-page']]: __fullPage && isRefresh,\n }\n )}\n ref={headerMergedRef}\n style={{\n ...stickyStyles.style,\n ...getHeaderStyles(style),\n }}\n >\n {isStuck && !isMobile && isRefresh && __fullPage && <div className={styles['header-cover']}></div>}\n {header}\n </div>\n </StickyHeaderContext.Provider>\n </ContainerHeaderContextProvider>\n )}\n <div className={clsx(styles.content, fitHeight && styles['content-fit-height'])}>\n <div\n className={clsx(styles['content-inner'], testStyles['content-inner'], {\n [styles['with-paddings']]: !disableContentPaddings,\n [styles['with-header']]: !!header,\n })}\n style={getContentStyles(style)}\n >\n {/* We use a wrapper around the boundary to preserve paddings in case they were disabled by the consumer.\n That is needed because the consumer-defined paddings that normally come with the content can no longer\n apply since the content failed to render. */}\n <BuiltInErrorBoundary\n wrapper={content => (\n <InternalBox padding={disableContentPaddings ? 'm' : undefined}>{content}</InternalBox>\n )}\n >\n {children}\n </BuiltInErrorBoundary>\n </div>\n </div>\n {footer && (\n <div\n className={clsx(styles.footer, {\n [styles['with-divider']]: !__disableFooterDivider,\n [styles['with-paddings']]: !disableFooterPaddings,\n })}\n style={getFooterStyles(style)}\n >\n {footer}\n </div>\n )}\n </BuiltInErrorBoundary>\n </div>\n </div>\n );\n});\n\nexport default InternalContainer;\n"]}