@cloudscape-design/components 3.0.1298 → 3.0.1300

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 (123) hide show
  1. package/attribute-editor/styles.css.js +15 -15
  2. package/attribute-editor/styles.scoped.css +29 -28
  3. package/attribute-editor/styles.selectors.js +15 -15
  4. package/autosuggest/interfaces.d.ts +0 -2
  5. package/autosuggest/interfaces.d.ts.map +1 -1
  6. package/autosuggest/interfaces.js.map +1 -1
  7. package/breadcrumb-group/item/styles.css.js +7 -7
  8. package/breadcrumb-group/item/styles.scoped.css +30 -29
  9. package/breadcrumb-group/item/styles.selectors.js +7 -7
  10. package/breadcrumb-group/styles.css.js +14 -14
  11. package/breadcrumb-group/styles.scoped.css +25 -25
  12. package/breadcrumb-group/styles.selectors.js +14 -14
  13. package/button-dropdown/category-elements/category-element.js +1 -1
  14. package/button-dropdown/category-elements/category-element.js.map +1 -1
  15. package/button-dropdown/category-elements/expandable-category-element.js +1 -1
  16. package/button-dropdown/category-elements/expandable-category-element.js.map +1 -1
  17. package/button-dropdown/category-elements/mobile-expandable-category-element.js +1 -1
  18. package/button-dropdown/category-elements/mobile-expandable-category-element.js.map +1 -1
  19. package/button-dropdown/item-element/index.js +1 -1
  20. package/button-dropdown/item-element/index.js.map +1 -1
  21. package/button-dropdown/item-element/styles.css.js +21 -21
  22. package/button-dropdown/item-element/styles.scoped.css +38 -37
  23. package/button-dropdown/item-element/styles.selectors.js +21 -21
  24. package/copy-to-clipboard/index.d.ts +1 -0
  25. package/copy-to-clipboard/index.d.ts.map +1 -1
  26. package/copy-to-clipboard/index.js +2 -2
  27. package/copy-to-clipboard/index.js.map +1 -1
  28. package/copy-to-clipboard/interfaces.d.ts +5 -0
  29. package/copy-to-clipboard/interfaces.d.ts.map +1 -1
  30. package/copy-to-clipboard/interfaces.js.map +1 -1
  31. package/copy-to-clipboard/internal.d.ts +1 -0
  32. package/copy-to-clipboard/internal.d.ts.map +1 -1
  33. package/copy-to-clipboard/internal.js +3 -3
  34. package/copy-to-clipboard/internal.js.map +1 -1
  35. package/copy-to-clipboard/styles.css.js +5 -3
  36. package/copy-to-clipboard/styles.scoped.css +18 -3
  37. package/copy-to-clipboard/styles.selectors.js +5 -3
  38. package/drawer/implementation.d.ts +3 -3
  39. package/drawer/implementation.d.ts.map +1 -1
  40. package/drawer/implementation.js +3 -2
  41. package/drawer/implementation.js.map +1 -1
  42. package/drawer/index.d.ts +2 -10
  43. package/drawer/index.d.ts.map +1 -1
  44. package/drawer/index.js +21 -9
  45. package/drawer/index.js.map +1 -1
  46. package/drawer/interfaces.d.ts +45 -18
  47. package/drawer/interfaces.d.ts.map +1 -1
  48. package/drawer/interfaces.js.map +1 -1
  49. package/drawer/styles.css.js +29 -25
  50. package/drawer/styles.scoped.css +43 -34
  51. package/drawer/styles.selectors.js +29 -25
  52. package/drawer/utils.d.ts +2 -2
  53. package/drawer/utils.d.ts.map +1 -1
  54. package/drawer/utils.js +6 -5
  55. package/drawer/utils.js.map +1 -1
  56. package/form-field/styles.css.js +24 -24
  57. package/form-field/styles.scoped.css +41 -41
  58. package/form-field/styles.selectors.js +24 -24
  59. package/help-panel/styles.css.js +6 -6
  60. package/help-panel/styles.scoped.css +73 -71
  61. package/help-panel/styles.selectors.js +6 -6
  62. package/internal/base-component/styles.scoped.css +31 -13
  63. package/internal/components/token-list/styles.css.js +10 -10
  64. package/internal/components/token-list/styles.scoped.css +24 -23
  65. package/internal/components/token-list/styles.selectors.js +10 -10
  66. package/internal/environment.js +2 -2
  67. package/internal/environment.json +2 -2
  68. package/internal/generated/styles/tokens.d.ts +25 -12
  69. package/internal/generated/styles/tokens.js +25 -12
  70. package/internal/generated/theming/index.cjs +196 -58
  71. package/internal/generated/theming/index.cjs.d.ts +234 -99
  72. package/internal/generated/theming/index.d.ts +234 -99
  73. package/internal/generated/theming/index.js +196 -58
  74. package/internal/manifest.json +1 -1
  75. package/key-value-pairs/styles.css.js +8 -8
  76. package/key-value-pairs/styles.scoped.css +13 -12
  77. package/key-value-pairs/styles.selectors.js +8 -8
  78. package/link/internal.js +1 -1
  79. package/link/internal.js.map +1 -1
  80. package/link/styles.css.js +21 -21
  81. package/link/styles.scoped.css +94 -84
  82. package/link/styles.selectors.js +21 -21
  83. package/manifest.json +5 -0
  84. package/multiselect/interfaces.d.ts +0 -2
  85. package/multiselect/interfaces.d.ts.map +1 -1
  86. package/multiselect/interfaces.js.map +1 -1
  87. package/package.json +1 -1
  88. package/pagination/index.d.ts.map +1 -1
  89. package/pagination/index.js +4 -1
  90. package/pagination/index.js.map +1 -1
  91. package/prompt-input/interfaces.d.ts +0 -2
  92. package/prompt-input/interfaces.d.ts.map +1 -1
  93. package/prompt-input/interfaces.js.map +1 -1
  94. package/select/interfaces.d.ts +0 -2
  95. package/select/interfaces.d.ts.map +1 -1
  96. package/select/interfaces.js.map +1 -1
  97. package/status-indicator/internal.js +1 -1
  98. package/status-indicator/internal.js.map +1 -1
  99. package/table/body-cell/td-element.js +1 -1
  100. package/table/body-cell/td-element.js.map +1 -1
  101. package/tag-editor/styles.css.js +3 -3
  102. package/tag-editor/styles.scoped.css +12 -11
  103. package/tag-editor/styles.selectors.js +3 -3
  104. package/test-utils/dom/drawer/index.d.ts +2 -0
  105. package/test-utils/dom/drawer/index.js +6 -0
  106. package/test-utils/dom/drawer/index.js.map +1 -1
  107. package/test-utils/selectors/drawer/index.d.ts +2 -0
  108. package/test-utils/selectors/drawer/index.js +6 -0
  109. package/test-utils/selectors/drawer/index.js.map +1 -1
  110. package/text-content/styles.css.js +1 -1
  111. package/text-content/styles.scoped.css +68 -66
  112. package/text-content/styles.selectors.js +1 -1
  113. package/tooltip/index.d.ts +0 -3
  114. package/tooltip/index.d.ts.map +1 -1
  115. package/tooltip/index.js +0 -3
  116. package/tooltip/index.js.map +1 -1
  117. package/wizard/interfaces.d.ts +0 -2
  118. package/wizard/interfaces.d.ts.map +1 -1
  119. package/wizard/interfaces.js.map +1 -1
  120. package/drawer/next.d.ts +0 -5
  121. package/drawer/next.d.ts.map +0 -1
  122. package/drawer/next.js +0 -38
  123. package/drawer/next.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"implementation.js","sourceRoot":"","sources":["../../../src/drawer/implementation.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAa,SAAS,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjF,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAE/F,OAAO,EAAE,uBAAuB,EAAE,MAAM,yDAAyD,CAAC;AAClG,OAAO,EAAE,gCAAgC,EAAE,MAAM,mCAAmC,CAAC;AACrF,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,SAAS,MAAM,mCAAmC,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AACxF,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AACzD,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AAEnE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,WAAW,MAAM,8BAA8B,CAAC;AAOvD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BACE,GAAG,EAAE,SAAS,EACd,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;wBAC7B,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,cAAc;qBACtC,CAAC,IAED,MAAM,CACH,CACP,CACA,CACJ,CACG,CACI,CACR,CACP,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG,yBAAyB,CAAC,oBAAoB,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { RefObject, useEffect, useImperativeHandle, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useStableCallback, useUniqueId } from '@cloudscape-design/component-toolkit/internal';\n\nimport { useRuntimeDrawerContext } from '../app-layout/runtime-drawer/use-runtime-drawer-context';\nimport { useAppLayoutToolbarDesignEnabled } from '../app-layout/utils/feature-flags';\nimport InternalButton from '../button/internal';\nimport { BuiltInErrorBoundary } from '../error-boundary/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport { getBaseProps } from '../internal/base-component';\nimport FocusLock from '../internal/components/focus-lock';\nimport { getAllFocusables, isFocusable } from '../internal/components/focus-lock/utils';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useEffectOnUpdate } from '../internal/hooks/use-effect-on-update';\nimport { createWidgetizedComponent } from '../internal/widgets';\nimport InternalLiveRegion from '../live-region/internal';\nimport InternalStatusIndicator from '../status-indicator/internal';\nimport { NextDrawerProps } from './interfaces';\nimport { useStickyFooter } from './use-sticky-footer';\nimport { getPositionStyles } from './utils';\n\nimport styles from './styles.css.js';\nimport testClasses from './test-classes/styles.css.js';\n\ntype DrawerInternalProps = NextDrawerProps &\n InternalBaseComponentProps & {\n __ref?: React.Ref<NextDrawerProps.Ref>;\n };\n\nexport function DrawerImplementation({\n header,\n footer,\n children,\n loading,\n i18nStrings,\n disableContentPaddings,\n __internalRootRef,\n __ref,\n headerActions,\n position = 'static',\n placement = 'end',\n offset,\n stickyOffset,\n zIndex,\n closeAction,\n hideCloseAction = false,\n backdrop = false,\n open,\n onClose,\n ariaLabel,\n ariaLabelledby,\n focusBehavior,\n role,\n ...restProps\n}: DrawerInternalProps) {\n const containerRef = useRef<HTMLDivElement>(null);\n const footerRef = useRef<HTMLDivElement>(null);\n const returnFocusTargetRef = useRef<HTMLElement | null>(null);\n\n const baseProps = getBaseProps(restProps);\n const isToolbar = useAppLayoutToolbarDesignEnabled();\n const i18n = useInternalI18n('drawer');\n const positionStyles = getPositionStyles({ position, placement, offset, stickyOffset, zIndex });\n const headerId = useUniqueId('drawer-header');\n const defaultRegionLabelledBy = header ? headerId : undefined;\n ariaLabelledby = ariaLabelledby ?? (ariaLabel ? undefined : defaultRegionLabelledBy);\n role = role ?? (position === 'static' ? 'presentation' : 'region');\n const roleProps =\n role === 'region'\n ? { role: 'region', tabIndex: -1, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby }\n : {};\n const containerProps = {\n ref: containerRef,\n ...roleProps,\n style: positionStyles.style,\n className: clsx(\n styles.drawer,\n loading && styles['content-with-paddings'],\n isToolbar && styles['with-toolbar'],\n !!footer && styles['with-footer'],\n closeAction && !hideCloseAction && styles['has-close-action'],\n positionStyles.className\n ),\n };\n\n const focusIn = useStableCallback(() => {\n returnFocusTargetRef.current = document.activeElement as HTMLElement;\n if (containerRef.current && isFocusable(containerRef.current)) {\n containerRef.current.focus();\n } else if (containerRef.current) {\n getAllFocusables(containerRef.current)[0]?.focus();\n }\n });\n\n const focusOut = useStableCallback(() => {\n if (focusBehavior?.returnFocus) {\n focusBehavior.returnFocus();\n } else if (returnFocusTargetRef.current && returnFocusTargetRef.current.isConnected) {\n returnFocusTargetRef.current.focus();\n }\n returnFocusTargetRef.current = null;\n });\n\n const autoFocusRef = useRef(false);\n autoFocusRef.current = focusBehavior?.autoFocus ?? true;\n\n // The use-effect-on-update ensures no focus transition on component's initial render.\n // If focus transition is needed - the drawerRef.current.focus() should be used instead.\n useEffectOnUpdate(() => {\n if (open === undefined) {\n return;\n }\n if (open && autoFocusRef.current) {\n focusIn();\n }\n if (!open) {\n focusOut();\n }\n }, [open, focusIn, focusOut]);\n\n const handleClose = useStableCallback((method: 'close-action' | 'backdrop-click' | 'escape') =>\n fireNonCancelableEvent(onClose, { method })\n );\n\n useImperativeHandle(__ref, () => ({ focus: () => containerRef.current?.focus() }), []);\n\n const runtimeDrawerContext = useRuntimeDrawerContext({ rootRef: __internalRootRef as RefObject<HTMLElement> });\n const hasAdditionalDrawerAction = !!runtimeDrawerContext?.isExpandable;\n const { isSticky: isFooterSticky } = useStickyFooter({\n rootRef: __internalRootRef as RefObject<HTMLElement>,\n drawerRef: containerRef,\n footerRef,\n });\n\n const showBackdrop = backdrop && (position === 'fixed' || position === 'absolute');\n const trapFocus = focusBehavior?.trapFocus ?? showBackdrop;\n\n useEffect(() => {\n if (!showBackdrop) {\n return;\n }\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n handleClose('escape');\n }\n };\n document.addEventListener('keydown', onKeyDown);\n return () => document.removeEventListener('keydown', onKeyDown);\n }, [showBackdrop, handleClose]);\n\n return (\n <div\n {...baseProps}\n className={clsx(baseProps.className, styles.root, testClasses.root, open === false && styles.hidden)}\n ref={__internalRootRef}\n >\n {showBackdrop && (\n <div\n className={clsx(styles.backdrop, testClasses.backdrop, styles[`backdrop-${position}`])}\n style={{ zIndex }}\n onClick={() => handleClose('backdrop-click')}\n />\n )}\n <FocusLock disabled={!trapFocus} className={styles['focus-trap']}>\n <div {...containerProps}>\n {loading ? (\n <InternalStatusIndicator type=\"loading\">\n <InternalLiveRegion tagName=\"span\">\n {i18n('i18nStrings.loadingText', i18nStrings?.loadingText)}\n </InternalLiveRegion>\n </InternalStatusIndicator>\n ) : (\n <>\n {header && (\n <div\n className={clsx(\n styles.header,\n runtimeDrawerContext && styles['with-runtime-context'],\n hasAdditionalDrawerAction && styles['with-additional-action'],\n hideCloseAction && styles['hide-close-action']\n )}\n >\n <span id={headerId}>{header}</span>\n {headerActions && <div className={styles['header-actions']}>{headerActions}</div>}\n </div>\n )}\n {closeAction && !hideCloseAction && (\n <div className={styles['close-action']}>\n <InternalButton\n variant=\"icon\"\n iconName=\"close\"\n {...closeAction}\n className={testClasses['close-action']}\n onClick={() => handleClose('close-action')}\n />\n </div>\n )}\n <div\n className={clsx(\n styles['test-utils-drawer-content'],\n styles.content,\n !disableContentPaddings && styles['content-with-paddings']\n )}\n >\n <BuiltInErrorBoundary>{children}</BuiltInErrorBoundary>\n </div>\n {footer && (\n <div\n ref={footerRef}\n className={clsx(styles.footer, {\n [styles['is-sticky']]: isFooterSticky,\n })}\n >\n {footer}\n </div>\n )}\n </>\n )}\n </div>\n </FocusLock>\n </div>\n );\n}\n\nexport const createWidgetizedDrawer = createWidgetizedComponent(DrawerImplementation);\n"]}
1
+ {"version":3,"file":"implementation.js","sourceRoot":"","sources":["../../../src/drawer/implementation.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAa,SAAS,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjF,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAEvG,OAAO,EAAE,uBAAuB,EAAE,MAAM,yDAAyD,CAAC;AAClG,OAAO,EAAE,gCAAgC,EAAE,MAAM,mCAAmC,CAAC;AACrF,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,SAAS,MAAM,mCAAmC,CAAC;AAC1D,OA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BACA,WAAW,IAAI,CAAC,eAAe,IAAI,CAClC,6BAAK,SAAS,EAAE,MAAM,CAAC,cAAc,CAAC;oBACpC,oBAAC,cAAc,IACb,OAAO,EAAC,MAAM,EACd,QAAQ,EAAC,OAAO,KACZ,WAAW,EACf,SAAS,EAAE,WAAW,CAAC,cAAc,CAAC,EACtC,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,cAAc,CAAC,GAC1C,CACE,CACP;gBACD,6BACE,SAAS,EAAE,IAAI,CACb,MAAM,CAAC,2BAA2B,CAAC,EACnC,MAAM,CAAC,OAAO,EACd,CAAC,sBAAsB,IAAI,MAAM,CAAC,uBAAuB,CAAC,CAC3D;oBAED,oBAAC,oBAAoB,QAAE,QAAQ,CAAwB,CACnD;gBACL,MAAM,IAAI,CACT,6BACE,GAAG,EAAE,SAAS,EACd,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;wBAC7B,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,cAAc;qBACtC,CAAC,IAED,MAAM,CACH,CACP,CACA,CACJ,CACG,CACI,CACR,CACP,CAAC;IAEF,OAAO,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,oBAAC,MAAM,QAAE,MAAM,CAAU,CAAC,CAAC,CAAC,MAAM,CAAC;AACnE,CAAC;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG,yBAAyB,CAAC,oBAAoB,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { RefObject, useEffect, useImperativeHandle, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { Portal, useStableCallback, useUniqueId } from '@cloudscape-design/component-toolkit/internal';\n\nimport { useRuntimeDrawerContext } from '../app-layout/runtime-drawer/use-runtime-drawer-context';\nimport { useAppLayoutToolbarDesignEnabled } from '../app-layout/utils/feature-flags';\nimport InternalButton from '../button/internal';\nimport { BuiltInErrorBoundary } from '../error-boundary/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport { getBaseProps } from '../internal/base-component';\nimport FocusLock from '../internal/components/focus-lock';\nimport { getAllFocusables, isFocusable } from '../internal/components/focus-lock/utils';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useEffectOnUpdate } from '../internal/hooks/use-effect-on-update';\nimport { createWidgetizedComponent } from '../internal/widgets';\nimport InternalLiveRegion from '../live-region/internal';\nimport InternalStatusIndicator from '../status-indicator/internal';\nimport { DrawerProps } from './interfaces';\nimport { useStickyFooter } from './use-sticky-footer';\nimport { getPositionStyles } from './utils';\n\nimport styles from './styles.css.js';\nimport testClasses from './test-classes/styles.css.js';\n\ntype DrawerInternalProps = DrawerProps &\n InternalBaseComponentProps & {\n __ref?: React.Ref<DrawerProps.Ref>;\n };\n\nexport function DrawerImplementation({\n header,\n footer,\n children,\n loading,\n i18nStrings,\n disableContentPaddings,\n __internalRootRef,\n __ref,\n headerActions,\n position = 'static',\n placement = 'end',\n offset,\n stickyOffset,\n zIndex,\n closeAction,\n hideCloseAction = false,\n backdrop = false,\n open,\n onClose,\n ariaLabel,\n ariaLabelledby,\n focusBehavior,\n role,\n ...restProps\n}: DrawerInternalProps) {\n const containerRef = useRef<HTMLDivElement>(null);\n const footerRef = useRef<HTMLDivElement>(null);\n const returnFocusTargetRef = useRef<HTMLElement | null>(null);\n\n const baseProps = getBaseProps(restProps);\n const isToolbar = useAppLayoutToolbarDesignEnabled();\n const i18n = useInternalI18n('drawer');\n const positionStyles = getPositionStyles({ position, placement, offset, stickyOffset, zIndex });\n const headerId = useUniqueId('drawer-header');\n const defaultRegionLabelledBy = header ? headerId : undefined;\n ariaLabelledby = ariaLabelledby ?? (ariaLabel ? undefined : defaultRegionLabelledBy);\n role = role ?? (position === 'static' ? 'presentation' : 'region');\n const roleProps =\n role === 'region'\n ? { role: 'region', tabIndex: -1, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby }\n : {};\n const containerProps = {\n ref: containerRef,\n ...roleProps,\n style: positionStyles.style,\n className: clsx(\n styles.drawer,\n loading && styles['content-with-paddings'],\n isToolbar && styles['with-toolbar'],\n !!footer && styles['with-footer'],\n closeAction && !hideCloseAction && styles['has-close-action'],\n positionStyles.className\n ),\n };\n\n const focusIn = useStableCallback(() => {\n returnFocusTargetRef.current = document.activeElement as HTMLElement;\n if (containerRef.current && isFocusable(containerRef.current)) {\n containerRef.current.focus();\n } else if (containerRef.current) {\n getAllFocusables(containerRef.current)[0]?.focus();\n }\n });\n\n const focusOut = useStableCallback(() => {\n if (focusBehavior?.returnFocus) {\n focusBehavior.returnFocus();\n } else if (returnFocusTargetRef.current && returnFocusTargetRef.current.isConnected) {\n returnFocusTargetRef.current.focus();\n }\n returnFocusTargetRef.current = null;\n });\n\n const autoFocusRef = useRef(false);\n autoFocusRef.current = focusBehavior?.autoFocus ?? true;\n\n // The use-effect-on-update ensures no focus transition on component's initial render.\n // If focus transition is needed - the drawerRef.current.focus() should be used instead.\n useEffectOnUpdate(() => {\n if (open === undefined) {\n return;\n }\n if (open && autoFocusRef.current) {\n focusIn();\n }\n if (!open) {\n focusOut();\n }\n }, [open, focusIn, focusOut]);\n\n const handleClose = useStableCallback((method: 'close-action' | 'backdrop-click' | 'escape') =>\n fireNonCancelableEvent(onClose, { method })\n );\n\n useImperativeHandle(__ref, () => ({ focus: () => containerRef.current?.focus() }), []);\n\n const runtimeDrawerContext = useRuntimeDrawerContext({ rootRef: __internalRootRef as RefObject<HTMLElement> });\n const hasAdditionalDrawerAction = !!runtimeDrawerContext?.isExpandable;\n const { isSticky: isFooterSticky } = useStickyFooter({\n rootRef: __internalRootRef as RefObject<HTMLElement>,\n drawerRef: containerRef,\n footerRef,\n });\n\n const showBackdrop = backdrop && (position === 'fixed' || position === 'absolute');\n const trapFocus = focusBehavior?.trapFocus ?? showBackdrop;\n\n useEffect(() => {\n if (!showBackdrop) {\n return;\n }\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n handleClose('escape');\n }\n };\n document.addEventListener('keydown', onKeyDown);\n return () => document.removeEventListener('keydown', onKeyDown);\n }, [showBackdrop, handleClose]);\n\n const drawer = (\n <div\n {...baseProps}\n className={clsx(baseProps.className, styles.root, testClasses.root, open === false && styles.hidden)}\n ref={__internalRootRef}\n >\n {showBackdrop && (\n <div\n className={clsx(styles.backdrop, testClasses.backdrop, styles[`backdrop-${position}`])}\n style={{ zIndex }}\n onClick={() => handleClose('backdrop-click')}\n />\n )}\n <FocusLock disabled={!trapFocus} className={styles['focus-trap']}>\n <div {...containerProps}>\n {loading ? (\n <InternalStatusIndicator type=\"loading\">\n <InternalLiveRegion tagName=\"span\">\n {i18n('i18nStrings.loadingText', i18nStrings?.loadingText)}\n </InternalLiveRegion>\n </InternalStatusIndicator>\n ) : (\n <>\n {header && (\n <div\n className={clsx(\n styles.header,\n runtimeDrawerContext && styles['with-runtime-context'],\n hasAdditionalDrawerAction && styles['with-additional-action'],\n hideCloseAction && styles['hide-close-action']\n )}\n >\n <span id={headerId}>{header}</span>\n {headerActions && <div className={styles['header-actions']}>{headerActions}</div>}\n </div>\n )}\n {closeAction && !hideCloseAction && (\n <div className={styles['close-action']}>\n <InternalButton\n variant=\"icon\"\n iconName=\"close\"\n {...closeAction}\n className={testClasses['close-action']}\n onClick={() => handleClose('close-action')}\n />\n </div>\n )}\n <div\n className={clsx(\n styles['test-utils-drawer-content'],\n styles.content,\n !disableContentPaddings && styles['content-with-paddings']\n )}\n >\n <BuiltInErrorBoundary>{children}</BuiltInErrorBoundary>\n </div>\n {footer && (\n <div\n ref={footerRef}\n className={clsx(styles.footer, {\n [styles['is-sticky']]: isFooterSticky,\n })}\n >\n {footer}\n </div>\n )}\n </>\n )}\n </div>\n </FocusLock>\n </div>\n );\n\n return position === 'fixed' ? <Portal>{drawer}</Portal> : drawer;\n}\n\nexport const createWidgetizedDrawer = createWidgetizedComponent(DrawerImplementation);\n"]}
package/drawer/index.d.ts CHANGED
@@ -1,13 +1,5 @@
1
+ import React from 'react';
1
2
  import { DrawerProps } from './interfaces';
2
3
  export { DrawerProps };
3
- declare const Drawer: ({
4
- header,
5
- headerActions,
6
- footer,
7
- disableContentPaddings,
8
- loading,
9
- children,
10
- i18nStrings,
11
- ...props
12
- }: DrawerProps) => JSX.Element;
4
+ declare const Drawer: React.ForwardRefExoticComponent<DrawerProps & React.RefAttributes<DrawerProps.Ref>>;
13
5
  export default Drawer;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/drawer/index.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG3C,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,QAAA,MAAM,MAAM,GAAmB,qGAS5B,WAAW,gBA0Bb,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/drawer/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAO1C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG3C,OAAO,EAAE,WAAW,EAAE,CAAC;AAKvB,QAAA,MAAM,MAAM,qFAwEV,CAAC;AAEH,eAAe,MAAM,CAAC"}
package/drawer/index.js CHANGED
@@ -1,25 +1,37 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  'use client';
4
- import React from 'react';
5
- import { getBaseProps } from '../internal/base-component';
4
+ import React, { forwardRef } from 'react';
5
+ import { warnOnce } from '@cloudscape-design/component-toolkit/internal';
6
6
  import useBaseComponent from '../internal/hooks/use-base-component';
7
7
  import { applyDisplayName } from '../internal/utils/apply-display-name';
8
+ import { getExternalProps } from '../internal/utils/external-props';
8
9
  import { InternalDrawer } from './internal';
9
- const Drawer = function Drawer({ header, headerActions, footer, disableContentPaddings = false, loading = false, children, i18nStrings, ...props }) {
10
+ // Matches App Layout drawers z-index.
11
+ const DEFAULT_Z_INDEX = 830;
12
+ const Drawer = forwardRef(function Drawer({ header, headerActions, footer, disableContentPaddings = false, loading = false, position = 'static', placement = 'end', offset, stickyOffset, zIndex = DEFAULT_Z_INDEX, closeAction, hideCloseAction = false, open, backdrop = false, onClose, focusBehavior, role, ...props }, ref) {
13
+ if (backdrop && position !== 'fixed' && position !== 'absolute') {
14
+ warnOnce('Drawer', `\`backdrop\` is not supported with position="${position}" and will be ignored.`);
15
+ }
16
+ if (open !== undefined && !onClose) {
17
+ warnOnce('Drawer', 'You provided `open` without an `onClose` handler. The drawer will not respond to close actions.');
18
+ }
10
19
  const baseComponentProps = useBaseComponent('Drawer', {
11
- props: {
12
- disableContentPaddings,
13
- loading,
14
- },
20
+ props: { disableContentPaddings, loading, placement, position, zIndex, hideCloseAction, backdrop, role },
15
21
  metadata: {
16
22
  hasHeader: !!header,
17
23
  hasHeaderActions: !!headerActions,
18
24
  hasFooter: !!footer,
25
+ hasOffset: !!offset,
26
+ hasStickyOffset: !!stickyOffset,
27
+ hasCloseAction: !!closeAction,
28
+ autoFocus: !!(focusBehavior === null || focusBehavior === void 0 ? void 0 : focusBehavior.autoFocus),
29
+ trapFocus: !!(focusBehavior === null || focusBehavior === void 0 ? void 0 : focusBehavior.trapFocus),
30
+ returnFocus: !!(focusBehavior === null || focusBehavior === void 0 ? void 0 : focusBehavior.returnFocus),
19
31
  },
20
32
  });
21
- return (React.createElement(InternalDrawer, { ...getBaseProps(props), ...baseComponentProps, header: header, headerActions: headerActions, footer: footer, disableContentPaddings: disableContentPaddings, loading: loading, i18nStrings: i18nStrings }, children));
22
- };
33
+ return (React.createElement(InternalDrawer, { ...getExternalProps(props), ...baseComponentProps, __ref: ref, header: header, headerActions: headerActions, footer: footer, disableContentPaddings: disableContentPaddings, loading: loading, placement: placement, position: position, offset: offset, stickyOffset: stickyOffset, zIndex: zIndex, closeAction: closeAction, hideCloseAction: hideCloseAction, open: open, backdrop: backdrop, onClose: onClose, focusBehavior: focusBehavior, role: role }));
34
+ });
23
35
  export default Drawer;
24
36
  applyDisplayName(Drawer, 'Drawer');
25
37
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/drawer/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,YAAY,CAAC;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAI5C,MAAM,MAAM,GAAG,SAAS,MAAM,CAAC,EAC7B,MAAM,EACN,aAAa,EACb,MAAM,EACN,sBAAsB,GAAG,KAAK,EAC9B,OAAO,GAAG,KAAK,EACf,QAAQ,EACR,WAAW,EACX,GAAG,KAAK,EACI;IACZ,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,QAAQ,EAAE;QACpD,KAAK,EAAE;YACL,sBAAsB;YACtB,OAAO;SACR;QACD,QAAQ,EAAE;YACR,SAAS,EAAE,CAAC,CAAC,MAAM;YACnB,gBAAgB,EAAE,CAAC,CAAC,aAAa;YACjC,SAAS,EAAE,CAAC,CAAC,MAAM;SACpB;KACF,CAAC,CAAC;IACH,OAAO,CACL,oBAAC,cAAc,OACT,YAAY,CAAC,KAAK,CAAC,KACnB,kBAAkB,EACtB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,MAAM,EACd,sBAAsB,EAAE,sBAAsB,EAC9C,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,IAEvB,QAAQ,CACM,CAClB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC;AAEtB,gBAAgB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\n'use client';\nimport React from 'react';\n\nimport { getBaseProps } from '../internal/base-component';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { DrawerProps } from './interfaces';\nimport { InternalDrawer } from './internal';\n\nexport { DrawerProps };\n\nconst Drawer = function Drawer({\n header,\n headerActions,\n footer,\n disableContentPaddings = false,\n loading = false,\n children,\n i18nStrings,\n ...props\n}: DrawerProps) {\n const baseComponentProps = useBaseComponent('Drawer', {\n props: {\n disableContentPaddings,\n loading,\n },\n metadata: {\n hasHeader: !!header,\n hasHeaderActions: !!headerActions,\n hasFooter: !!footer,\n },\n });\n return (\n <InternalDrawer\n {...getBaseProps(props)}\n {...baseComponentProps}\n header={header}\n headerActions={headerActions}\n footer={footer}\n disableContentPaddings={disableContentPaddings}\n loading={loading}\n i18nStrings={i18nStrings}\n >\n {children}\n </InternalDrawer>\n );\n};\n\nexport default Drawer;\n\napplyDisplayName(Drawer, 'Drawer');\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/drawer/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,YAAY,CAAC;AACb,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAI5C,sCAAsC;AACtC,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B,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AS,CAAA;YACrC,WAAW,EAAE,CAAC,CAAC,CAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,WAAW,CAAA;SAC1C;KACF,CAAC,CAAC;IAEH,OAAO,CACL,oBAAC,cAAc,OACT,gBAAgB,CAAC,KAAK,CAAC,KACvB,kBAAkB,EACtB,KAAK,EAAE,GAAG,EACV,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,MAAM,EACd,sBAAsB,EAAE,sBAAsB,EAC9C,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,eAAe,EAAE,eAAe,EAChC,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,aAAa,EAC5B,IAAI,EAAE,IAAI,GACV,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,MAAM,CAAC;AAEtB,gBAAgB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\n'use client';\nimport React, { forwardRef } from 'react';\n\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { getExternalProps } from '../internal/utils/external-props';\nimport { DrawerProps } from './interfaces';\nimport { InternalDrawer } from './internal';\n\nexport { DrawerProps };\n\n// Matches App Layout drawers z-index.\nconst DEFAULT_Z_INDEX = 830;\n\nconst Drawer = forwardRef(function Drawer(\n {\n header,\n headerActions,\n footer,\n disableContentPaddings = false,\n loading = false,\n position = 'static',\n placement = 'end',\n offset,\n stickyOffset,\n zIndex = DEFAULT_Z_INDEX,\n closeAction,\n hideCloseAction = false,\n open,\n backdrop = false,\n onClose,\n focusBehavior,\n role,\n ...props\n }: DrawerProps,\n ref: React.Ref<DrawerProps.Ref>\n) {\n if (backdrop && position !== 'fixed' && position !== 'absolute') {\n warnOnce('Drawer', `\\`backdrop\\` is not supported with position=\"${position}\" and will be ignored.`);\n }\n if (open !== undefined && !onClose) {\n warnOnce(\n 'Drawer',\n 'You provided `open` without an `onClose` handler. The drawer will not respond to close actions.'\n );\n }\n\n const baseComponentProps = useBaseComponent('Drawer', {\n props: { disableContentPaddings, loading, placement, position, zIndex, hideCloseAction, backdrop, role },\n metadata: {\n hasHeader: !!header,\n hasHeaderActions: !!headerActions,\n hasFooter: !!footer,\n hasOffset: !!offset,\n hasStickyOffset: !!stickyOffset,\n hasCloseAction: !!closeAction,\n autoFocus: !!focusBehavior?.autoFocus,\n trapFocus: !!focusBehavior?.trapFocus,\n returnFocus: !!focusBehavior?.returnFocus,\n },\n });\n\n return (\n <InternalDrawer\n {...getExternalProps(props)}\n {...baseComponentProps}\n __ref={ref}\n header={header}\n headerActions={headerActions}\n footer={footer}\n disableContentPaddings={disableContentPaddings}\n loading={loading}\n placement={placement}\n position={position}\n offset={offset}\n stickyOffset={stickyOffset}\n zIndex={zIndex}\n closeAction={closeAction}\n hideCloseAction={hideCloseAction}\n open={open}\n backdrop={backdrop}\n onClose={onClose}\n focusBehavior={focusBehavior}\n role={role}\n />\n );\n});\n\nexport default Drawer;\n\napplyDisplayName(Drawer, 'Drawer');\n"]}
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { ButtonProps } from '../button/interfaces';
2
+ import { IconProps } from '../icon/interfaces';
3
3
  import { BaseComponentProps } from '../internal/base-component';
4
4
  import { NonCancelableEventHandler } from '../internal/events';
5
5
  export interface DrawerProps extends BaseComponentProps {
@@ -38,13 +38,6 @@ export interface DrawerProps extends BaseComponentProps {
38
38
  * to ensure content remains accessible (not covered by the footer).
39
39
  */
40
40
  footer?: React.ReactNode;
41
- }
42
- export declare namespace DrawerProps {
43
- interface I18nStrings {
44
- loadingText?: string;
45
- }
46
- }
47
- export interface NextDrawerProps extends DrawerProps {
48
41
  /**
49
42
  * Sets the ARIA role of the drawer.
50
43
  * - `"region"` (default for non-`static` positions) — exposes the drawer as a
@@ -76,16 +69,20 @@ export interface NextDrawerProps extends DrawerProps {
76
69
  * Using `sticky` with `placement="start"` or `placement="end"` falls back to `static`.
77
70
  * * `absolute` - The drawer is positioned relative to its nearest positioned ancestor.
78
71
  * * `fixed` - The drawer is positioned relative to the viewport.
72
+ *
73
+ * Do not use this property when using drawers inside app layout.
79
74
  */
80
- position?: NextDrawerProps.Position;
75
+ position?: DrawerProps.Position;
81
76
  /**
82
77
  * Specifies which edge of its container the drawer is anchored to, and supports these options:
83
78
  * * `start` - Anchored to the inline-start edge.
84
79
  * * `end` - (default) Anchored to the inline-end edge.
85
80
  * * `top` - Anchored to the top edge.
86
81
  * * `bottom` - Anchored to the bottom edge.
82
+ *
83
+ * Do not use this property when using drawers inside app layout.
87
84
  */
88
- placement?: NextDrawerProps.Placement;
85
+ placement?: DrawerProps.Placement;
89
86
  /**
90
87
  * Specifies the distance in pixels between the drawer and the edges of its container.
91
88
  * Applicable when using `position="absolute"` or `position="fixed"`.
@@ -94,33 +91,43 @@ export interface NextDrawerProps extends DrawerProps {
94
91
  * * `end` - Distance from the inline-end edge. Not applicable when `placement` is `"start"`.
95
92
  * * `top` - Distance from the top edge. Not applicable when `placement` is `"bottom"`.
96
93
  * * `bottom` - Distance from the bottom edge. Not applicable when `placement` is `"top"`.
94
+ *
95
+ * Do not use this property when using drawers inside app layout.
97
96
  */
98
- offset?: NextDrawerProps.Offset;
97
+ offset?: DrawerProps.Offset;
99
98
  /**
100
99
  * Specifies the distance in pixels from the top or bottom edge of the scrolling container
101
100
  * at which the drawer sticks. Applicable only when using `position="sticky"` with `placement="top"` or `placement="bottom"`.
102
101
  * * Supported properties:
103
102
  * * `top` - Distance from the top of the scrolling container.
104
103
  * * `bottom` - Distance from the bottom of the scrolling container.
104
+ *
105
+ * Do not use this property when using drawers inside app layout.
105
106
  */
106
- stickyOffset?: NextDrawerProps.StickyOffset;
107
+ stickyOffset?: DrawerProps.StickyOffset;
107
108
  /**
108
109
  * Sets the CSS `z-index` of the drawer. Use this to control stacking order when the drawer
109
110
  * overlaps other positioned elements on the page.
110
111
  *
111
- * Applicable when using `position="sticky"`, `position="absolute"`, or `position="fixed"`.
112
+ * Applicable when using `position="sticky"`, `position="absolute"`, or `position="fixed"`. Defaults to 830.
113
+ *
114
+ * Do not use this property when using drawers inside app layout.
112
115
  */
113
116
  zIndex?: number;
114
117
  /**
115
118
  * When defined, renders a close button in the header with the provided configuration.
116
119
  * The close button fires the `onClose` event with method `'close-action'` when
117
120
  * clicked.
121
+ *
122
+ * Do not use this property when using drawers inside app layout.
118
123
  */
119
- closeAction?: Pick<ButtonProps, 'ariaLabel' | 'disabled' | 'disabledReason' | 'iconName' | 'iconSvg' | 'iconUrl' | 'iconAlt'>;
124
+ closeAction?: DrawerProps.CloseActionProps;
120
125
  /**
121
126
  * Hides the close action slot next to the header actions, which is present even
122
127
  * when close action is not set. Use it when a close action is not needed, or a
123
128
  * custom close action implementation is used.
129
+ *
130
+ * Do not use this property when using drawers inside app layout.
124
131
  */
125
132
  hideCloseAction?: boolean;
126
133
  /**
@@ -128,13 +135,17 @@ export interface NextDrawerProps extends DrawerProps {
128
135
  * * `'close-action'` - The close button was clicked.
129
136
  * * `'backdrop-click'` - The backdrop was clicked (only when `backdrop=true`).
130
137
  * * `'escape'` - The Escape key was pressed (only when `backdrop=true`).
138
+ *
139
+ * Do not use this property when using drawers inside app layout.
131
140
  */
132
- onClose?: NonCancelableEventHandler<NextDrawerProps.CloseDetail>;
141
+ onClose?: NonCancelableEventHandler<DrawerProps.CloseDetail>;
133
142
  /**
134
143
  * Drawer open state. Set to `true` to show the drawer, `false` to hide it.
135
144
  * Handle the `onClose` event to update this value when the user requests to close the drawer.
136
145
  *
137
146
  * When the property is unset - the drawer is always visible, and the built-in focus in/out behaviors are disabled.
147
+ *
148
+ * Do not use this property when using drawers inside app layout.
138
149
  */
139
150
  open?: boolean;
140
151
  /**
@@ -144,6 +155,8 @@ export interface NextDrawerProps extends DrawerProps {
144
155
  * When a backdrop is set, the keyboard focus is trapped inside the drawer by default
145
156
  * to prevent it from moving to elements covered by the backdrop. This can be overridden
146
157
  * with `focusBehavior.trapFocus`.
158
+ *
159
+ * Do not use this property when using drawers inside app layout.
147
160
  */
148
161
  backdrop?: boolean;
149
162
  /**
@@ -160,10 +173,15 @@ export interface NextDrawerProps extends DrawerProps {
160
173
  * Use this to override where focus lands on close (e.g. a specific trigger element).
161
174
  * If omitted, focus returns to the element that was focused when the drawer opened.
162
175
  * If that element is no longer in the DOM, the behavior silently no-ops.
176
+ *
177
+ * Do not use this property when using drawers inside app layout.
163
178
  */
164
- focusBehavior?: NextDrawerProps.FocusBehavior;
179
+ focusBehavior?: DrawerProps.FocusBehavior;
165
180
  }
166
- export declare namespace NextDrawerProps {
181
+ export declare namespace DrawerProps {
182
+ interface I18nStrings {
183
+ loadingText?: string;
184
+ }
167
185
  type Position = 'static' | 'sticky' | 'absolute' | 'fixed';
168
186
  type Placement = 'start' | 'end' | 'top' | 'bottom';
169
187
  interface Offset {
@@ -176,6 +194,15 @@ export declare namespace NextDrawerProps {
176
194
  top?: number;
177
195
  bottom?: number;
178
196
  }
197
+ interface CloseActionProps {
198
+ ariaLabel?: string;
199
+ disabled?: boolean;
200
+ disabledReason?: string;
201
+ iconName?: IconProps.Name;
202
+ iconUrl?: string;
203
+ iconSvg?: React.ReactNode;
204
+ iconAlt?: string;
205
+ }
179
206
  interface CloseDetail {
180
207
  method: 'close-action' | 'backdrop-click' | 'escape';
181
208
  }
@@ -186,7 +213,7 @@ export declare namespace NextDrawerProps {
186
213
  }
187
214
  interface Ref {
188
215
  /**
189
- * Moves focus to the drawer element. Use in controlled mode when `focusBehavior.autoFocus`
216
+ * Moves focus to the drawer element. Use when `focusBehavior.autoFocus`
190
217
  * is disabled and you need to manage focus manually, or to focus a drawer, initially rendered
191
218
  * with `open=true`. The drawer with `role="presentation"` cannot be focused.
192
219
  */
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/drawer/interfaces.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,MAAM,WAAW,WAAY,SAAQ,kBAAkB;IACrD;;;;OAIG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEzB;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAEjC;;;;OAIG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC;IAEtC;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEhC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC1B;AAED,yBAAiB,WAAW,CAAC;IAC3B,UAAiB,WAAW;QAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB;CACF;AAGD,MAAM,WAAW,eAAgB,SAAQ,WAAW;IAClD;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,cAAc,CAAC;IAEjC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,eAA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AAC;QACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC;QAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;QAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB;IAED,UAAiB,WAAW;QAC1B,MAAM,EAAE,cAAc,GAAG,gBAAgB,GAAG,QAAQ,CAAC;KACtD;IAED,UAAiB,aAAa;QAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;KAC1B;IAED,UAAiB,GAAG;QAClB;;;;WAIG;QACH,KAAK,IAAI,IAAI,CAAC;KACf;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/drawer/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React from 'react';\n\nimport { ButtonProps } from '../button/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface DrawerProps extends BaseComponentProps {\n /**\n * Header of the drawer.\n *\n * It should contain the only `h2` used in the drawer.\n */\n header?: React.ReactNode;\n\n /**\n * Main content of the drawer.\n */\n children?: React.ReactNode;\n\n /**\n * Renders the drawer in a loading state. We recommend that you also set a `i18nStrings.loadingText`.\n */\n loading?: boolean;\n\n /**\n * Determines whether the drawer content has padding. If `true`, removes the default padding from the content area.\n */\n disableContentPaddings?: boolean;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n * - `loadingText` - The text that's displayed when the drawer is in a loading state.\n * @i18n\n */\n i18nStrings?: DrawerProps.I18nStrings;\n\n /**\n * Actions for the header. Available only if you specify the `header` property.\n */\n headerActions?: React.ReactNode;\n\n /**\n * Sticky footer content that remains visible at the bottom during scroll.\n *\n * Automatically becomes non-sticky when scrollable content area is too small\n * to ensure content remains accessible (not covered by the footer).\n */\n footer?: React.ReactNode;\n}\n\nexport namespace DrawerProps {\n export interface I18nStrings {\n loadingText?: string;\n }\n}\n\n// Props for a future release\nexport interface NextDrawerProps extends DrawerProps {\n /**\n * Sets the ARIA role of the drawer.\n * - `\"region\"` (default for non-`static` positions) — exposes the drawer as a\n * landmark region. The drawer receives focus when opened.\n * - `\"presentation\"` (default for `position=\"static\"`) — removes landmark semantics\n * from the drawer body. Use this when the containing element already provides the\n * appropriate semantic role (e.g. a wrapping `<nav>` or `<aside>`). The drawer does not\n * receive focus when opened.\n */\n role?: 'region' | 'presentation';\n\n /**\n * Sets the `aria-label` on the drawer body.\n * By default the body is labelled by the drawer's `header` content. Use this when you need a different\n * or more specific label (e.g. to include additional context or exclude parts of the header).\n * Does not apply when `role=\"presentation\"`. Don't use `ariaLabel` and `ariaLabelledby` at the same time.\n */\n ariaLabel?: string;\n\n /**\n * Sets the `aria-labelledby` on the drawer body.\n * By default the body is labelled by the drawer's `header` content. Use this when you need a different\n * or more specific label (e.g. to include additional context or exclude parts of the header).\n * Does not apply when `role=\"presentation\"`. Don't use `ariaLabel` and `ariaLabelledby` at the same time.\n */\n ariaLabelledby?: string;\n\n /**\n * Specifies the CSS positioning mode of the drawer, and supports the following options:\n * * `static` (default) - The drawer is positioned in the normal document flow.\n * * `sticky` - The drawer sticks to its nearest scrolling ancestor. Only meaningful with `placement=\"top\"` or `placement=\"bottom\"`.\n * Using `sticky` with `placement=\"start\"` or `placement=\"end\"` falls back to `static`.\n * * `absolute` - The drawer is positioned relative to its nearest positioned ancestor.\n * * `fixed` - The drawer is positioned relative to the viewport.\n */\n position?: NextDrawerProps.Position;\n\n /**\n * Specifies which edge of its container the drawer is anchored to, and supports these options:\n * * `start` - Anchored to the inline-start edge.\n * * `end` - (default) Anchored to the inline-end edge.\n * * `top` - Anchored to the top edge.\n * * `bottom` - Anchored to the bottom edge.\n */\n placement?: NextDrawerProps.Placement;\n\n /**\n * Specifies the distance in pixels between the drawer and the edges of its container.\n * Applicable when using `position=\"absolute\"` or `position=\"fixed\"`.\n * Supported properties:\n * * `start` - Distance from the inline-start edge. Not applicable when `placement` is `\"end\"`.\n * * `end` - Distance from the inline-end edge. Not applicable when `placement` is `\"start\"`.\n * * `top` - Distance from the top edge. Not applicable when `placement` is `\"bottom\"`.\n * * `bottom` - Distance from the bottom edge. Not applicable when `placement` is `\"top\"`.\n */\n offset?: NextDrawerProps.Offset;\n\n /**\n * Specifies the distance in pixels from the top or bottom edge of the scrolling container\n * at which the drawer sticks. Applicable only when using `position=\"sticky\"` with `placement=\"top\"` or `placement=\"bottom\"`.\n * * Supported properties:\n * * `top` - Distance from the top of the scrolling container.\n * * `bottom` - Distance from the bottom of the scrolling container.\n */\n stickyOffset?: NextDrawerProps.StickyOffset;\n\n /**\n * Sets the CSS `z-index` of the drawer. Use this to control stacking order when the drawer\n * overlaps other positioned elements on the page.\n *\n * Applicable when using `position=\"sticky\"`, `position=\"absolute\"`, or `position=\"fixed\"`.\n */\n zIndex?: number;\n\n /**\n * When defined, renders a close button in the header with the provided configuration.\n * The close button fires the `onClose` event with method `'close-action'` when\n * clicked.\n */\n closeAction?: Pick<\n ButtonProps,\n 'ariaLabel' | 'disabled' | 'disabledReason' | 'iconName' | 'iconSvg' | 'iconUrl' | 'iconAlt'\n >;\n\n /**\n * Hides the close action slot next to the header actions, which is present even\n * when close action is not set. Use it when a close action is not needed, or a\n * custom close action implementation is used.\n */\n hideCloseAction?: boolean;\n\n /**\n * Called when the user performs a close action. The `event.detail.method` indicates the trigger:\n * * `'close-action'` - The close button was clicked.\n * * `'backdrop-click'` - The backdrop was clicked (only when `backdrop=true`).\n * * `'escape'` - The Escape key was pressed (only when `backdrop=true`).\n */\n onClose?: NonCancelableEventHandler<NextDrawerProps.CloseDetail>;\n\n /**\n * Drawer open state. Set to `true` to show the drawer, `false` to hide it.\n * Handle the `onClose` event to update this value when the user requests to close the drawer.\n *\n * When the property is unset - the drawer is always visible, and the built-in focus in/out behaviors are disabled.\n */\n open?: boolean;\n\n /**\n * Shows a semi-transparent backdrop behind the drawer when open. Used with `absolute`\n * and `fixed` positions.\n *\n * When a backdrop is set, the keyboard focus is trapped inside the drawer by default\n * to prevent it from moving to elements covered by the backdrop. This can be overridden\n * with `focusBehavior.trapFocus`.\n */\n backdrop?: boolean;\n\n /**\n * Customizes focus-related behavior:\n *\n * - `autoFocus` - Whether focus moves into the drawer when `open` changes from `false` to `true`,\n * and captures the previously focused element for default return-focus on close.\n * Defaults to `true`. Set to `false` to manage focus-in manually via `ref.current.focus()`.\n *\n * - `trapFocus` - Whether keyboard focus is constrained to elements inside the drawer.\n * Defaults to `true` when `backdrop` is set, `false` otherwise.\n *\n * - `returnFocus` - Called instead of the default return-focus behavior when the drawer closes.\n * Use this to override where focus lands on close (e.g. a specific trigger element).\n * If omitted, focus returns to the element that was focused when the drawer opened.\n * If that element is no longer in the DOM, the behavior silently no-ops.\n */\n focusBehavior?: NextDrawerProps.FocusBehavior;\n}\n\nexport namespace NextDrawerProps {\n export type Position = 'static' | 'sticky' | 'absolute' | 'fixed';\n\n export type Placement = 'start' | 'end' | 'top' | 'bottom';\n\n export interface Offset {\n start?: number;\n end?: number;\n top?: number;\n bottom?: number;\n }\n\n export interface StickyOffset {\n top?: number;\n bottom?: number;\n }\n\n export interface CloseDetail {\n method: 'close-action' | 'backdrop-click' | 'escape';\n }\n\n export interface FocusBehavior {\n autoFocus?: boolean;\n trapFocus?: boolean;\n returnFocus?: () => void;\n }\n\n export interface Ref {\n /**\n * Moves focus to the drawer element. Use in controlled mode when `focusBehavior.autoFocus`\n * is disabled and you need to manage focus manually, or to focus a drawer, initially rendered\n * with `open=true`. The drawer with `role=\"presentation\"` cannot be focused.\n */\n focus(): void;\n }\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/drawer/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React from 'react';\n\nimport { IconProps } from '../icon/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface DrawerProps extends BaseComponentProps {\n /**\n * Header of the drawer.\n *\n * It should contain the only `h2` used in the drawer.\n */\n header?: React.ReactNode;\n\n /**\n * Main content of the drawer.\n */\n children?: React.ReactNode;\n\n /**\n * Renders the drawer in a loading state. We recommend that you also set a `i18nStrings.loadingText`.\n */\n loading?: boolean;\n\n /**\n * Determines whether the drawer content has padding. If `true`, removes the default padding from the content area.\n */\n disableContentPaddings?: boolean;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n * - `loadingText` - The text that's displayed when the drawer is in a loading state.\n * @i18n\n */\n i18nStrings?: DrawerProps.I18nStrings;\n\n /**\n * Actions for the header. Available only if you specify the `header` property.\n */\n headerActions?: React.ReactNode;\n\n /**\n * Sticky footer content that remains visible at the bottom during scroll.\n *\n * Automatically becomes non-sticky when scrollable content area is too small\n * to ensure content remains accessible (not covered by the footer).\n */\n footer?: React.ReactNode;\n\n /**\n * Sets the ARIA role of the drawer.\n * - `\"region\"` (default for non-`static` positions) — exposes the drawer as a\n * landmark region. The drawer receives focus when opened.\n * - `\"presentation\"` (default for `position=\"static\"`) — removes landmark semantics\n * from the drawer body. Use this when the containing element already provides the\n * appropriate semantic role (e.g. a wrapping `<nav>` or `<aside>`). The drawer does not\n * receive focus when opened.\n */\n role?: 'region' | 'presentation';\n\n /**\n * Sets the `aria-label` on the drawer body.\n * By default the body is labelled by the drawer's `header` content. Use this when you need a different\n * or more specific label (e.g. to include additional context or exclude parts of the header).\n * Does not apply when `role=\"presentation\"`. Don't use `ariaLabel` and `ariaLabelledby` at the same time.\n */\n ariaLabel?: string;\n\n /**\n * Sets the `aria-labelledby` on the drawer body.\n * By default the body is labelled by the drawer's `header` content. Use this when you need a different\n * or more specific label (e.g. to include additional context or exclude parts of the header).\n * Does not apply when `role=\"presentation\"`. Don't use `ariaLabel` and `ariaLabelledby` at the same time.\n */\n ariaLabelledby?: string;\n\n /**\n * Specifies the CSS positioning mode of the drawer, and supports the following options:\n * * `static` (default) - The drawer is positioned in the normal document flow.\n * * `sticky` - The drawer sticks to its nearest scrolling ancestor. Only meaningful with `placement=\"top\"` or `placement=\"bottom\"`.\n * Using `sticky` with `placement=\"start\"` or `placement=\"end\"` falls back to `static`.\n * * `absolute` - The drawer is positioned relative to its nearest positioned ancestor.\n * * `fixed` - The drawer is positioned relative to the viewport.\n *\n * Do not use this property when using drawers inside app layout.\n */\n position?: DrawerProps.Position;\n\n /**\n * Specifies which edge of its container the drawer is anchored to, and supports these options:\n * * `start` - Anchored to the inline-start edge.\n * * `end` - (default) Anchored to the inline-end edge.\n * * `top` - Anchored to the top edge.\n * * `bottom` - Anchored to the bottom edge.\n *\n * Do not use this property when using drawers inside app layout.\n */\n placement?: DrawerProps.Placement;\n\n /**\n * Specifies the distance in pixels between the drawer and the edges of its container.\n * Applicable when using `position=\"absolute\"` or `position=\"fixed\"`.\n * Supported properties:\n * * `start` - Distance from the inline-start edge. Not applicable when `placement` is `\"end\"`.\n * * `end` - Distance from the inline-end edge. Not applicable when `placement` is `\"start\"`.\n * * `top` - Distance from the top edge. Not applicable when `placement` is `\"bottom\"`.\n * * `bottom` - Distance from the bottom edge. Not applicable when `placement` is `\"top\"`.\n *\n * Do not use this property when using drawers inside app layout.\n */\n offset?: DrawerProps.Offset;\n\n /**\n * Specifies the distance in pixels from the top or bottom edge of the scrolling container\n * at which the drawer sticks. Applicable only when using `position=\"sticky\"` with `placement=\"top\"` or `placement=\"bottom\"`.\n * * Supported properties:\n * * `top` - Distance from the top of the scrolling container.\n * * `bottom` - Distance from the bottom of the scrolling container.\n *\n * Do not use this property when using drawers inside app layout.\n */\n stickyOffset?: DrawerProps.StickyOffset;\n\n /**\n * Sets the CSS `z-index` of the drawer. Use this to control stacking order when the drawer\n * overlaps other positioned elements on the page.\n *\n * Applicable when using `position=\"sticky\"`, `position=\"absolute\"`, or `position=\"fixed\"`. Defaults to 830.\n *\n * Do not use this property when using drawers inside app layout.\n */\n zIndex?: number;\n\n /**\n * When defined, renders a close button in the header with the provided configuration.\n * The close button fires the `onClose` event with method `'close-action'` when\n * clicked.\n *\n * Do not use this property when using drawers inside app layout.\n */\n closeAction?: DrawerProps.CloseActionProps;\n\n /**\n * Hides the close action slot next to the header actions, which is present even\n * when close action is not set. Use it when a close action is not needed, or a\n * custom close action implementation is used.\n *\n * Do not use this property when using drawers inside app layout.\n */\n hideCloseAction?: boolean;\n\n /**\n * Called when the user performs a close action. The `event.detail.method` indicates the trigger:\n * * `'close-action'` - The close button was clicked.\n * * `'backdrop-click'` - The backdrop was clicked (only when `backdrop=true`).\n * * `'escape'` - The Escape key was pressed (only when `backdrop=true`).\n *\n * Do not use this property when using drawers inside app layout.\n */\n onClose?: NonCancelableEventHandler<DrawerProps.CloseDetail>;\n\n /**\n * Drawer open state. Set to `true` to show the drawer, `false` to hide it.\n * Handle the `onClose` event to update this value when the user requests to close the drawer.\n *\n * When the property is unset - the drawer is always visible, and the built-in focus in/out behaviors are disabled.\n *\n * Do not use this property when using drawers inside app layout.\n */\n open?: boolean;\n\n /**\n * Shows a semi-transparent backdrop behind the drawer when open. Used with `absolute`\n * and `fixed` positions.\n *\n * When a backdrop is set, the keyboard focus is trapped inside the drawer by default\n * to prevent it from moving to elements covered by the backdrop. This can be overridden\n * with `focusBehavior.trapFocus`.\n *\n * Do not use this property when using drawers inside app layout.\n */\n backdrop?: boolean;\n\n /**\n * Customizes focus-related behavior:\n *\n * - `autoFocus` - Whether focus moves into the drawer when `open` changes from `false` to `true`,\n * and captures the previously focused element for default return-focus on close.\n * Defaults to `true`. Set to `false` to manage focus-in manually via `ref.current.focus()`.\n *\n * - `trapFocus` - Whether keyboard focus is constrained to elements inside the drawer.\n * Defaults to `true` when `backdrop` is set, `false` otherwise.\n *\n * - `returnFocus` - Called instead of the default return-focus behavior when the drawer closes.\n * Use this to override where focus lands on close (e.g. a specific trigger element).\n * If omitted, focus returns to the element that was focused when the drawer opened.\n * If that element is no longer in the DOM, the behavior silently no-ops.\n *\n * Do not use this property when using drawers inside app layout.\n */\n focusBehavior?: DrawerProps.FocusBehavior;\n}\n\nexport namespace DrawerProps {\n export interface I18nStrings {\n loadingText?: string;\n }\n\n export type Position = 'static' | 'sticky' | 'absolute' | 'fixed';\n\n export type Placement = 'start' | 'end' | 'top' | 'bottom';\n\n export interface Offset {\n start?: number;\n end?: number;\n top?: number;\n bottom?: number;\n }\n\n export interface StickyOffset {\n top?: number;\n bottom?: number;\n }\n\n export interface CloseActionProps {\n ariaLabel?: string;\n disabled?: boolean;\n disabledReason?: string;\n iconName?: IconProps.Name;\n iconUrl?: string;\n iconSvg?: React.ReactNode;\n iconAlt?: string;\n }\n\n export interface CloseDetail {\n method: 'close-action' | 'backdrop-click' | 'escape';\n }\n\n export interface FocusBehavior {\n autoFocus?: boolean;\n trapFocus?: boolean;\n returnFocus?: () => void;\n }\n\n export interface Ref {\n /**\n * Moves focus to the drawer element. Use when `focusBehavior.autoFocus`\n * is disabled and you need to manage focus manually, or to focus a drawer, initially rendered\n * with `open=true`. The drawer with `role=\"presentation\"` cannot be focused.\n */\n focus(): void;\n }\n}\n"]}
@@ -1,30 +1,34 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "root": "awsui_root_1sxt8_1cneo_193",
5
- "drawer": "awsui_drawer_1sxt8_1cneo_197",
6
- "has-close-action": "awsui_has-close-action_1sxt8_1cneo_230",
7
- "position-absolute": "awsui_position-absolute_1sxt8_1cneo_233",
8
- "position-sticky": "awsui_position-sticky_1sxt8_1cneo_233",
9
- "position-fixed": "awsui_position-fixed_1sxt8_1cneo_233",
10
- "with-footer": "awsui_with-footer_1sxt8_1cneo_236",
11
- "position-static": "awsui_position-static_1sxt8_1cneo_240",
12
- "content": "awsui_content_1sxt8_1cneo_243",
13
- "header": "awsui_header_1sxt8_1cneo_271",
14
- "hide-close-action": "awsui_hide-close-action_1sxt8_1cneo_287",
15
- "with-additional-action": "awsui_with-additional-action_1sxt8_1cneo_291",
16
- "with-runtime-context": "awsui_with-runtime-context_1sxt8_1cneo_299",
17
- "with-toolbar": "awsui_with-toolbar_1sxt8_1cneo_302",
18
- "header-actions": "awsui_header-actions_1sxt8_1cneo_321",
19
- "close-action": "awsui_close-action_1sxt8_1cneo_327",
20
- "content-with-paddings": "awsui_content-with-paddings_1sxt8_1cneo_333",
21
- "footer": "awsui_footer_1sxt8_1cneo_340",
22
- "is-sticky": "awsui_is-sticky_1sxt8_1cneo_346",
23
- "test-utils-drawer-content": "awsui_test-utils-drawer-content_1sxt8_1cneo_354",
24
- "hidden": "awsui_hidden_1sxt8_1cneo_358",
25
- "focus-trap": "awsui_focus-trap_1sxt8_1cneo_362",
26
- "backdrop": "awsui_backdrop_1sxt8_1cneo_366",
27
- "backdrop-fixed": "awsui_backdrop-fixed_1sxt8_1cneo_370",
28
- "backdrop-absolute": "awsui_backdrop-absolute_1sxt8_1cneo_373"
4
+ "root": "awsui_root_1sxt8_ygv0p_193",
5
+ "drawer": "awsui_drawer_1sxt8_ygv0p_197",
6
+ "has-close-action": "awsui_has-close-action_1sxt8_ygv0p_230",
7
+ "position-absolute": "awsui_position-absolute_1sxt8_ygv0p_233",
8
+ "placement-end": "awsui_placement-end_1sxt8_ygv0p_233",
9
+ "position-sticky": "awsui_position-sticky_1sxt8_ygv0p_233",
10
+ "position-fixed": "awsui_position-fixed_1sxt8_ygv0p_233",
11
+ "placement-start": "awsui_placement-start_1sxt8_ygv0p_236",
12
+ "placement-top": "awsui_placement-top_1sxt8_ygv0p_239",
13
+ "placement-bottom": "awsui_placement-bottom_1sxt8_ygv0p_242",
14
+ "with-footer": "awsui_with-footer_1sxt8_ygv0p_245",
15
+ "position-static": "awsui_position-static_1sxt8_ygv0p_249",
16
+ "content": "awsui_content_1sxt8_ygv0p_252",
17
+ "header": "awsui_header_1sxt8_ygv0p_280",
18
+ "hide-close-action": "awsui_hide-close-action_1sxt8_ygv0p_296",
19
+ "with-additional-action": "awsui_with-additional-action_1sxt8_ygv0p_300",
20
+ "with-runtime-context": "awsui_with-runtime-context_1sxt8_ygv0p_308",
21
+ "with-toolbar": "awsui_with-toolbar_1sxt8_ygv0p_311",
22
+ "header-actions": "awsui_header-actions_1sxt8_ygv0p_330",
23
+ "close-action": "awsui_close-action_1sxt8_ygv0p_336",
24
+ "content-with-paddings": "awsui_content-with-paddings_1sxt8_ygv0p_342",
25
+ "footer": "awsui_footer_1sxt8_ygv0p_349",
26
+ "is-sticky": "awsui_is-sticky_1sxt8_ygv0p_355",
27
+ "test-utils-drawer-content": "awsui_test-utils-drawer-content_1sxt8_ygv0p_363",
28
+ "hidden": "awsui_hidden_1sxt8_ygv0p_367",
29
+ "focus-trap": "awsui_focus-trap_1sxt8_ygv0p_371",
30
+ "backdrop": "awsui_backdrop_1sxt8_ygv0p_375",
31
+ "backdrop-fixed": "awsui_backdrop-fixed_1sxt8_ygv0p_379",
32
+ "backdrop-absolute": "awsui_backdrop-absolute_1sxt8_ygv0p_382"
29
33
  };
30
34