@cloudscape-design/components 3.0.364 → 3.0.366

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 (81) hide show
  1. package/app-layout/defaults.d.ts +1 -2
  2. package/app-layout/defaults.d.ts.map +1 -1
  3. package/app-layout/defaults.js.map +1 -1
  4. package/app-layout/drawer/index.d.ts.map +1 -1
  5. package/app-layout/drawer/index.js +3 -9
  6. package/app-layout/drawer/index.js.map +1 -1
  7. package/app-layout/drawer/interfaces.d.ts +5 -1
  8. package/app-layout/drawer/interfaces.d.ts.map +1 -1
  9. package/app-layout/drawer/interfaces.js.map +1 -1
  10. package/app-layout/drawer/resizable-drawer.d.ts.map +1 -1
  11. package/app-layout/drawer/resizable-drawer.js +6 -2
  12. package/app-layout/drawer/resizable-drawer.js.map +1 -1
  13. package/app-layout/index.d.ts.map +1 -1
  14. package/app-layout/index.js +43 -123
  15. package/app-layout/index.js.map +1 -1
  16. package/app-layout/utils/use-drawers.d.ts +28 -0
  17. package/app-layout/utils/use-drawers.d.ts.map +1 -0
  18. package/app-layout/utils/use-drawers.js +86 -0
  19. package/app-layout/utils/use-drawers.js.map +1 -0
  20. package/app-layout/utils/use-resize.d.ts +8 -4
  21. package/app-layout/utils/use-resize.d.ts.map +1 -1
  22. package/app-layout/utils/use-resize.js +5 -37
  23. package/app-layout/utils/use-resize.js.map +1 -1
  24. package/app-layout/visual-refresh/context.d.ts +5 -4
  25. package/app-layout/visual-refresh/context.d.ts.map +1 -1
  26. package/app-layout/visual-refresh/context.js +20 -38
  27. package/app-layout/visual-refresh/context.js.map +1 -1
  28. package/app-layout/visual-refresh/drawers.d.ts.map +1 -1
  29. package/app-layout/visual-refresh/drawers.js +11 -18
  30. package/app-layout/visual-refresh/drawers.js.map +1 -1
  31. package/app-layout/visual-refresh/mobile-toolbar.js +2 -2
  32. package/app-layout/visual-refresh/mobile-toolbar.js.map +1 -1
  33. package/app-layout/visual-refresh/split-panel.js +1 -1
  34. package/app-layout/visual-refresh/split-panel.js.map +1 -1
  35. package/app-layout/visual-refresh/styles.css.js +69 -69
  36. package/app-layout/visual-refresh/styles.scoped.css +167 -166
  37. package/app-layout/visual-refresh/styles.selectors.js +69 -69
  38. package/app-layout/visual-refresh/tools.js +1 -1
  39. package/app-layout/visual-refresh/tools.js.map +1 -1
  40. package/button/icon-helper.d.ts +1 -0
  41. package/button/icon-helper.d.ts.map +1 -1
  42. package/button/icon-helper.js +2 -2
  43. package/button/icon-helper.js.map +1 -1
  44. package/button/internal.d.ts +2 -0
  45. package/button/internal.d.ts.map +1 -1
  46. package/button/internal.js +2 -1
  47. package/button/internal.js.map +1 -1
  48. package/button-dropdown/interfaces.d.ts +10 -1
  49. package/button-dropdown/interfaces.d.ts.map +1 -1
  50. package/button-dropdown/interfaces.js.map +1 -1
  51. package/button-dropdown/internal.d.ts.map +1 -1
  52. package/button-dropdown/internal.js +15 -1
  53. package/button-dropdown/internal.js.map +1 -1
  54. package/button-dropdown/item-element/index.d.ts +4 -0
  55. package/button-dropdown/item-element/index.d.ts.map +1 -1
  56. package/button-dropdown/item-element/index.js +1 -1
  57. package/button-dropdown/item-element/index.js.map +1 -1
  58. package/icon/styles.css.js +21 -21
  59. package/icon/styles.scoped.css +54 -54
  60. package/icon/styles.selectors.js +21 -21
  61. package/internal/base-component/styles.scoped.css +5 -0
  62. package/internal/environment.js +1 -1
  63. package/internal/environment.json +1 -1
  64. package/internal/generated/theming/index.cjs +31 -0
  65. package/internal/generated/theming/index.js +31 -0
  66. package/internal/manifest.json +1 -1
  67. package/package.json +1 -1
  68. package/property-filter/index.d.ts.map +1 -1
  69. package/property-filter/index.js +2 -1
  70. package/property-filter/index.js.map +1 -1
  71. package/property-filter/styles.css.js +30 -29
  72. package/property-filter/styles.scoped.css +38 -32
  73. package/property-filter/styles.selectors.js +30 -29
  74. package/table/internal.js +1 -1
  75. package/table/internal.js.map +1 -1
  76. package/table/table-role/interfaces.d.ts +1 -1
  77. package/table/table-role/interfaces.d.ts.map +1 -1
  78. package/table/table-role/interfaces.js.map +1 -1
  79. package/table/table-role/table-role-helper.d.ts.map +1 -1
  80. package/table/table-role/table-role-helper.js +4 -5
  81. package/table/table-role/table-role-helper.js.map +1 -1
@@ -20,6 +20,7 @@ import useResize from '../utils/use-resize';
20
20
  import styles from './styles.css.js';
21
21
  import { useContainerQuery } from '@cloudscape-design/component-toolkit';
22
22
  import useBackgroundOverlap from './use-background-overlap';
23
+ import { useDrawers } from '../utils/use-drawers';
23
24
  /**
24
25
  * The default values are destructured in the context instantiation to
25
26
  * prevent downstream Typescript errors. This could likely be replaced
@@ -34,7 +35,7 @@ export function useAppLayoutInternals() {
34
35
  return ctx;
35
36
  }
36
37
  export const AppLayoutInternalsProvider = React.forwardRef((_a, forwardRef) => {
37
- var _b, _c, _d, _e;
38
+ var _b, _c, _d;
38
39
  var { toolsHide, toolsOpen: controlledToolsOpen, navigationHide, navigationOpen: controlledNavigationOpen, contentType = 'default', headerSelector = '#b #h', footerSelector = '#b #h', children, splitPanel } = _a, props = __rest(_a, ["toolsHide", "toolsOpen", "navigationHide", "navigationOpen", "contentType", "headerSelector", "footerSelector", "children", "splitPanel"]);
39
40
  const isMobile = useMobile();
40
41
  if (isDevelopment) {
@@ -225,50 +226,32 @@ export const AppLayoutInternalsProvider = React.forwardRef((_a, forwardRef) => {
225
226
  setSplitPanelLastInteraction({ type: 'position' });
226
227
  fireNonCancelableEvent(props.onSplitPanelPreferencesChange, detail);
227
228
  }, [props.onSplitPanelPreferencesChange, setSplitPanelPreferences, setSplitPanelLastInteraction]);
228
- /**
229
- * The activeDrawerWidth is required in JavaScript to acccurately calculate whether a SplitPanel
230
- * in the side position should be forced to the bottom based on available horiziontal space.
231
- *
232
- * The handleDrawersClick will either open a new drawer or close the currently open drawer by setting
233
- * the activeDrawerId value. The active drawer can also be closed if a user clicks the Tools trigger
234
- * button. This will skip the focus handling because the focus should be going to the Tools close
235
- * button and not one of the drawers trigger buttons.
236
- *
237
- * The drawersTriggerCount is computed in order to determine whether the triggers should be persistent
238
- * in the UI when a drawer is open. The trigger button container is suppressed when a drawer is open
239
- * and their is only one trigger button.
240
- *
241
- * The hasDrawerViewportOverlay property is used to determine if any drawer is obscuring the entire
242
- * viewport. This currently applies to Navigation, Tools, and Drawers in mobile viewports.
243
- */
244
- const drawers = props.drawers;
245
- const [activeDrawerId, setActiveDrawerId] = useControllable(drawers === null || drawers === void 0 ? void 0 : drawers.activeDrawerId, drawers === null || drawers === void 0 ? void 0 : drawers.onChange, null, {
246
- componentName: 'AppLayout',
247
- controlledProp: 'drawers.activeDrawerId',
248
- changeHandler: 'onChange',
249
- });
229
+ const _e = useDrawers(props, {
230
+ ariaLabels: props.ariaLabels,
231
+ toolsHide,
232
+ toolsOpen: isToolsOpen,
233
+ tools: props.tools,
234
+ toolsWidth,
235
+ }, contentTypeDefaults), { drawers, activeDrawer, activeDrawerId, onActiveDrawerChange, onActiveDrawerResize, activeDrawerSize } = _e, drawersProps = __rest(_e, ["drawers", "activeDrawer", "activeDrawerId", "onActiveDrawerChange", "onActiveDrawerResize", "activeDrawerSize"]);
250
236
  const [drawersMaxWidth, setDrawersMaxWidth] = useState(toolsWidth);
251
- const activeDrawer = drawers === null || drawers === void 0 ? void 0 : drawers.items.find(drawer => drawer.id === activeDrawerId);
252
- const { refs: drawersRefs, setFocus: focusDrawersButtons, loseFocus: loseDrawersFocus, setLastInteraction: setDrawerLastInteraction, } = useDrawerFocusControl([activeDrawerId, activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.resizable], activeDrawerId !== undefined, true);
237
+ const { refs: drawersRefs, setFocus: focusDrawersButtons, loseFocus: loseDrawersFocus, setLastInteraction: setDrawerLastInteraction, } = useDrawerFocusControl([activeDrawerId, activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.resizable], true, true);
253
238
  const drawerRef = useRef(null);
254
239
  const { resizeHandle, drawerSize } = useResize(drawerRef, {
255
- activeDrawerId,
256
- drawers,
240
+ onActiveDrawerResize,
241
+ activeDrawerSize,
242
+ activeDrawer,
257
243
  drawersRefs,
258
244
  isToolsOpen,
259
245
  drawersMaxWidth,
260
246
  });
261
- const handleDrawersClick = useCallback(function handleDrawersChange(id, skipFocusControl) {
262
- const newActiveDrawerId = id !== activeDrawerId ? id : null;
263
- setActiveDrawerId(newActiveDrawerId);
247
+ const handleDrawersClick = (id, skipFocusControl) => {
248
+ const newActiveDrawerId = id !== activeDrawerId ? id : undefined;
249
+ onActiveDrawerChange(newActiveDrawerId);
264
250
  !skipFocusControl && focusDrawersButtons();
265
- fireNonCancelableEvent(drawers === null || drawers === void 0 ? void 0 : drawers.onChange, newActiveDrawerId);
266
251
  setDrawerLastInteraction({ type: activeDrawerId ? 'close' : 'open' });
267
- }, [activeDrawerId, drawers === null || drawers === void 0 ? void 0 : drawers.onChange, focusDrawersButtons, setActiveDrawerId, setDrawerLastInteraction]);
268
- const drawersTriggerCount = ((_e = drawers === null || drawers === void 0 ? void 0 : drawers.items.length) !== null && _e !== void 0 ? _e : 0) +
269
- (splitPanelDisplayed && splitPanelPosition === 'side' ? 1 : 0) +
270
- (!toolsHide ? 1 : 0);
271
- const hasOpenDrawer = activeDrawerId !== null ||
252
+ };
253
+ const drawersTriggerCount = drawers.length + (splitPanelDisplayed && splitPanelPosition === 'side' ? 1 : 0) + (!toolsHide ? 1 : 0);
254
+ const hasOpenDrawer = activeDrawerId !== undefined ||
272
255
  isToolsOpen ||
273
256
  (splitPanelDisplayed && splitPanelPosition === 'side' && isSplitPanelOpen);
274
257
  const hasDrawerViewportOverlay = isMobile && (!!activeDrawerId || (!navigationHide && isNavigationOpen) || (!toolsHide && isToolsOpen));
@@ -381,8 +364,7 @@ export const AppLayoutInternalsProvider = React.forwardRef((_a, forwardRef) => {
381
364
  ]);
382
365
  return (React.createElement(AppLayoutInternalsContext.Provider, { value: Object.assign(Object.assign({}, props), { activeDrawerId,
383
366
  contentType,
384
- drawers,
385
- drawersRefs,
367
+ drawers, drawersAriaLabel: drawersProps.ariaLabel, drawersRefs,
386
368
  drawersMaxWidth,
387
369
  drawerSize,
388
370
  drawerRef,
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"lib/default/","sources":["app-layout/visual-refresh/context.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EACZ,aAAa,EACb,WAAW,EACX,SAAS,EACT,eAAe,EACf,mBAAmB,EACnB,MAAM,EACN,QAAQ,EACR,UAAU,GACX,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,gDAAgD,CAAC;AAEvF,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAoB,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC/E,OAAO,EAA0B,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAClG,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAA8B,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AAE/G,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAE5D,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AACzE,OAAO,SAAS,MAAM,qBAAqB,CAAC;AAC5C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,oBAAoB,M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cAAc;YACd,SAAS,EACT,SAAS,EAAE,WAAW,EACtB,UAAU;YACV,SAAS;QAGX,oBAAC,gBAAgB,CAAC,QAAQ,IACxB,KAAK,EAAE;gBACL,kBAAkB,EAAE,YAAY;gBAChC,eAAe,EAAE,CAAC;gBAClB,sBAAsB;aACvB;YAED,oBAAC,qBAAqB,CAAC,QAAQ,IAAC,KAAK,EAAE,6BAA6B,IACjE,QAAQ,CACsB,CACP,CACO,CACtC,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, {\n createContext,\n useCallback,\n useEffect,\n useLayoutEffect,\n useImperativeHandle,\n useRef,\n useState,\n useContext,\n} from 'react';\nimport { applyDefaults } from '../defaults';\nimport { AppLayoutContext } from '../../internal/context/app-layout-context';\nimport { DynamicOverlapContext } from '../../internal/context/dynamic-overlap-context';\nimport { AppLayoutProps } from '../interfaces';\nimport { fireNonCancelableEvent } from '../../internal/events';\nimport { FocusControlRefs, useFocusControl } from '../utils/use-focus-control';\nimport { DrawerFocusControlRefs, useDrawerFocusControl } from '../utils/use-drawer-focus-control';\nimport { getSplitPanelDefaultSize } from '../../split-panel/utils/size-utils';\nimport { isDevelopment } from '../../internal/is-development';\nimport { getSplitPanelPosition } from './split-panel';\nimport { useControllable } from '../../internal/hooks/use-controllable';\nimport { SplitPanelFocusControlRefs, useSplitPanelFocusControl } from '../utils/use-split-panel-focus-control';\nimport { SplitPanelSideToggleProps } from '../../internal/context/split-panel-context';\nimport { useObservedElement } from '../utils/use-observed-element';\nimport { useMobile } from '../../internal/hooks/use-mobile';\nimport { InternalDrawerProps } from '../drawer/interfaces';\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\nimport useResize from '../utils/use-resize';\nimport styles from './styles.css.js';\nimport { useContainerQuery } from '@cloudscape-design/component-toolkit';\nimport useBackgroundOverlap from './use-background-overlap';\n\ninterface AppLayoutInternals extends AppLayoutProps {\n activeDrawerId?: string | null;\n drawers?: InternalDrawerProps['drawers'];\n drawersRefs: DrawerFocusControlRefs;\n drawerSize: number;\n drawersMaxWidth: number;\n drawerRef: React.Ref<HTMLElement>;\n resizeHandle: React.ReactElement;\n drawersTriggerCount: number;\n handleDrawersClick: (activeDrawerId: string | null, skipFocusControl?: boolean) => void;\n handleSplitPanelClick: () => void;\n handleNavigationClick: (isOpen: boolean) => void;\n handleSplitPanelPreferencesChange: (detail: AppLayoutProps.SplitPanelPreferences) => void;\n handleSplitPanelResize: (detail: { size: number }) => void;\n handleToolsClick: (value: boolean, skipFocusControl?: boolean) => void;\n hasBackgroundOverlap: boolean;\n hasDefaultToolsWidth: boolean;\n hasDrawerViewportOverlay: boolean;\n hasNotificationsContent: boolean;\n hasOpenDrawer?: boolean;\n hasStickyBackground: boolean;\n isBackgroundOverlapDisabled: boolean;\n isMobile: boolean;\n isNavigationOpen: boolean;\n isSplitPanelForcedPosition: boolean;\n isSplitPanelOpen?: boolean;\n isToolsOpen: boolean;\n layoutElement: React.Ref<HTMLElement>;\n layoutWidth: number;\n loseToolsFocus: () => void;\n loseDrawersFocus: () => void;\n mainElement: React.Ref<HTMLDivElement>;\n mainOffsetLeft: number;\n navigationRefs: FocusControlRefs;\n notificationsElement: React.Ref<HTMLDivElement>;\n notificationsHeight: number;\n offsetBottom: number;\n setHasStickyBackground: (value: boolean) => void;\n setSplitPanelReportedSize: (value: number) => void;\n setSplitPanelReportedHeaderHeight: (value: number) => void;\n headerHeight: number;\n footerHeight: number;\n splitPanelMaxWidth: number;\n splitPanelMinWidth: number;\n splitPanelPosition: AppLayoutProps.SplitPanelPosition;\n splitPanelReportedSize: number;\n splitPanelReportedHeaderHeight: number;\n splitPanelToggle: SplitPanelSideToggleProps;\n setSplitPanelToggle: (toggle: SplitPanelSideToggleProps) => void;\n splitPanelDisplayed: boolean;\n splitPanelRefs: SplitPanelFocusControlRefs;\n toolsRefs: FocusControlRefs;\n}\n\n/**\n * The default values are destructured in the context instantiation to\n * prevent downstream Typescript errors. This could likely be replaced\n * by a context interface definition that extends the AppLayout interface.\n */\nconst AppLayoutInternalsContext = createContext<AppLayoutInternals | null>(null);\n\ninterface AppLayoutProviderInternalsProps extends AppLayoutProps {\n children: React.ReactNode;\n}\n\nexport function useAppLayoutInternals() {\n const ctx = useContext(AppLayoutInternalsContext);\n if (!ctx) {\n throw new Error('Invariant violation: this context is only available inside app layout');\n }\n return ctx;\n}\n\nexport const AppLayoutInternalsProvider = React.forwardRef(\n (\n {\n toolsHide,\n toolsOpen: controlledToolsOpen,\n navigationHide,\n navigationOpen: controlledNavigationOpen,\n contentType = 'default',\n headerSelector = '#b #h',\n footerSelector = '#b #h',\n children,\n splitPanel,\n ...props\n }: AppLayoutProviderInternalsProps,\n forwardRef: React.Ref<AppLayoutProps.Ref>\n ) => {\n const isMobile = useMobile();\n\n if (isDevelopment) {\n if (controlledToolsOpen && toolsHide) {\n warnOnce(\n 'AppLayout',\n `You have enabled both the \\`toolsOpen\\` prop and the \\`toolsHide\\` prop. This is not supported. Set \\`toolsOpen\\` to \\`false\\` when you set \\`toolsHide\\` to \\`true\\`.`\n );\n }\n }\n\n const [hasStickyBackground, setHasStickyBackground] = useState(false);\n\n /**\n * Set the default values for minimum and maximum content width.\n */\n const geckoMaxCssLength = ((1 << 30) - 1) / 60;\n const halfGeckoMaxCssLength = geckoMaxCssLength / 2;\n // CSS lengths in Gecko are limited to at most (1<<30)-1 app units (Gecko uses 60 as app unit).\n // Limit the maxContentWidth to the half of the upper boundary (≈4230^2) to be on the safe side.\n const maxContentWidth =\n props.maxContentWidth && props.maxContentWidth > halfGeckoMaxCssLength\n ? halfGeckoMaxCssLength\n : props.maxContentWidth ?? 0;\n const minContentWidth = props.minContentWidth ?? 280;\n\n /**\n * Determine the default state of the Navigation and Tools drawers.\n * Mobile viewports should be closed by default under all circumstances.\n * If the navigationOpen prop has been set then that should take precedence\n * over the contentType prop. Desktop viewports that do not have the\n * navigationOpen or contentType props set will use the default contentType.\n */\n const contentTypeDefaults = applyDefaults(contentType, { maxContentWidth, minContentWidth }, true);\n\n /**\n * The useControllable hook will set the default value and manage either\n * the controlled or uncontrolled state of the Navigation drawer. The logic\n * for determining the default state is colocated with the Navigation component.\n *\n * The callback that will be passed to the Navigation and MobileToolbar\n * components to handle the click events that will change the state\n * of the Navigation drawer. It will set the Navigation state with the\n * useControllable hook and also fire the onNavigationChange function to\n * emit the state change.\n */\n const [isNavigationOpen = false, setIsNavigationOpen] = useControllable(\n controlledNavigationOpen,\n props.onNavigationChange,\n isMobile ? false : contentTypeDefaults.navigationOpen,\n { componentName: 'AppLayout', controlledProp: 'navigationOpen', changeHandler: 'onNavigationChange' }\n );\n\n const { refs: navigationRefs, setFocus: focusNavButtons } = useFocusControl(isNavigationOpen);\n\n const handleNavigationClick = useCallback(\n function handleNavigationChange(isOpen: boolean) {\n setIsNavigationOpen(isOpen);\n focusNavButtons();\n fireNonCancelableEvent(props.onNavigationChange, { open: isOpen });\n },\n [props.onNavigationChange, setIsNavigationOpen, focusNavButtons]\n );\n\n /**\n * The useControllable hook will set the default value and manage either\n * the controlled or uncontrolled state of the Tools drawer. The logic\n * for determining the default state is colocated with the Tools component.\n *\n * The callback that will be passed to the Navigation and MobileToolbar\n * components to handle the click events that will change the state\n * of the Tools drawer. It will set the Tools state with the\n * useControllable hook and also fire the onToolsChange function to\n * emit the state change.\n */\n const toolsWidth = props.toolsWidth ?? 290;\n const hasDefaultToolsWidth = props.toolsWidth === undefined;\n\n const [isToolsOpen = false, setIsToolsOpen] = useControllable(\n controlledToolsOpen,\n props.onToolsChange,\n isMobile ? false : contentTypeDefaults.toolsOpen,\n { componentName: 'AppLayout', controlledProp: 'toolsOpen', changeHandler: 'onToolsChange' }\n );\n\n const {\n refs: toolsRefs,\n setFocus: focusToolsButtons,\n loseFocus: loseToolsFocus,\n } = useFocusControl(isToolsOpen, true);\n\n const handleToolsClick = useCallback(\n function handleToolsChange(isOpen: boolean, skipFocusControl?: boolean) {\n setIsToolsOpen(isOpen);\n !skipFocusControl && focusToolsButtons();\n fireNonCancelableEvent(props.onToolsChange, { open: isOpen });\n },\n [props.onToolsChange, setIsToolsOpen, focusToolsButtons]\n );\n\n /**\n * On mobile viewports the navigation and tools drawers are adjusted to a fixed position\n * that consumes 100% of the viewport height and width. The body content could potentially\n * be scrollable underneath the drawer. In order to prevent this a CSS class needs to be\n * added to the document body that sets overflow to hidden.\n */\n useEffect(\n function handleBodyScroll() {\n if (isMobile && (isNavigationOpen || isToolsOpen)) {\n document.body.classList.add(styles['block-body-scroll']);\n } else {\n document.body.classList.remove(styles['block-body-scroll']);\n }\n\n // Ensure the CSS class is removed from the body on side effect cleanup\n return function cleanup() {\n document.body.classList.remove(styles['block-body-scroll']);\n };\n },\n [isMobile, isNavigationOpen, isToolsOpen]\n );\n\n /**\n * The useImperativeHandle hook in conjunction with the forwardRef function\n * in the AppLayout component definition expose the following callable\n * functions to component consumers when they put a ref as a property on\n * their component implementation.\n */\n useImperativeHandle(\n forwardRef,\n function createImperativeHandle() {\n return {\n closeNavigationIfNecessary: function () {\n isMobile && handleNavigationClick(false);\n },\n openTools: function () {\n handleToolsClick(true);\n },\n focusToolsClose: () => focusToolsButtons(true),\n };\n },\n [isMobile, handleNavigationClick, handleToolsClick, focusToolsButtons]\n );\n\n /**\n * Query the DOM for the header and footer elements based on the selectors provided\n * by the properties and pass the heights to the custom property definitions.\n */\n const headerHeight = useObservedElement(headerSelector);\n const footerHeight = useObservedElement(footerSelector);\n\n /**\n * Set the default values for the minimum and maximum Split Panel width when it is\n * in the side position. The useLayoutEffect will compute the available space in the\n * DOM for the Split Panel given the current state. The minimum and maximum\n * widths will potentially trigger a side effect that will put the Split Panel into\n * a forced position on the bottom.\n */\n const splitPanelMinWidth = 280;\n const [splitPanelMaxWidth, setSplitPanelMaxWidth] = useState(splitPanelMinWidth);\n\n /**\n * The useControllable hook will set the default value and manage either\n * the controlled or uncontrolled state of the Split Panel. By default\n * the Split Panel should always be closed on page load.\n *\n * The callback that will be passed to the SplitPanel component\n * to handle the click events that will change the state of the SplitPanel\n * to open or closed given the current state. It will set the isSplitPanelOpen\n * controlled state and fire the onSplitPanelToggle event.\n */\n const [isSplitPanelOpen, setIsSplitPanelOpen] = useControllable(\n props.splitPanelOpen,\n props.onSplitPanelToggle,\n false,\n { componentName: 'AppLayout', controlledProp: 'splitPanelOpen', changeHandler: 'onSplitPanelToggle' }\n );\n\n /**\n * The useControllable hook will manage the controlled or uncontrolled\n * state of the splitPanelPreferences. By default the splitPanelPreferences\n * is undefined. When set the object shape should have a single key to indicate\n * either bottom or side position.\n *\n * The callback that will handle changes to the splitPanelPreferences\n * object that will determine if the SplitPanel is rendered either on the\n * bottom of the viewport or within the Tools container.\n */\n const [splitPanelPreferences, setSplitPanelPreferences] = useControllable(\n props.splitPanelPreferences,\n props.onSplitPanelPreferencesChange,\n undefined,\n {\n componentName: 'AppLayout',\n controlledProp: 'splitPanelPreferences',\n changeHandler: 'onSplitPanelPreferencesChange',\n }\n );\n\n const { refs: splitPanelRefs, setLastInteraction: setSplitPanelLastInteraction } = useSplitPanelFocusControl([\n splitPanelPreferences,\n isSplitPanelOpen,\n ]);\n\n const handleSplitPanelClick = useCallback(\n function handleSplitPanelChange() {\n setIsSplitPanelOpen(!isSplitPanelOpen);\n setSplitPanelLastInteraction({ type: isSplitPanelOpen ? 'close' : 'open' });\n fireNonCancelableEvent(props.onSplitPanelToggle, { open: !isSplitPanelOpen });\n },\n [props.onSplitPanelToggle, isSplitPanelOpen, setIsSplitPanelOpen, setSplitPanelLastInteraction]\n );\n\n /**\n * The Split Panel will be in forced (bottom) position if the defined minimum width is\n * greater than the maximum width. In other words, the maximum width is the currently\n * available horizontal space based on all other components that are rendered. If the\n * minimum width exceeds this value then there is not enough horizontal space and we must\n * force it to the bottom position.\n */\n const [isSplitPanelForcedPosition, setSplitPanelForcedPosition] = useState(false);\n const splitPanelPosition = getSplitPanelPosition(isSplitPanelForcedPosition, splitPanelPreferences);\n\n useLayoutEffect(\n function handleSplitPanelForcePosition() {\n setSplitPanelForcedPosition(splitPanelMinWidth > splitPanelMaxWidth);\n },\n [splitPanelMaxWidth, splitPanelMinWidth]\n );\n\n /**\n * The useControllable hook will set the default size of the SplitPanel based\n * on the default position set in the splitPanelPreferences. The logic for the\n * default size is contained in the SplitPanel component. The splitPanelControlledSize\n * will be bound to the size property in the SplitPanel context for rendering.\n *\n * The callback that will be passed to the SplitPanel component\n * to handle the resize events that will change the size of the SplitPanel.\n * It will set the splitPanelControlledSize controlled state and fire the\n * onSplitPanelResize event.\n */\n const [splitPanelReportedSize, setSplitPanelReportedSize] = useState(0);\n const [splitPanelReportedHeaderHeight, setSplitPanelReportedHeaderHeight] = useState(0);\n const [splitPanelToggle, setSplitPanelToggle] = useState<SplitPanelSideToggleProps>({\n displayed: false,\n ariaLabel: undefined,\n });\n const splitPanelDisplayed = !!(splitPanelToggle.displayed || isSplitPanelOpen);\n\n const [splitPanelSize, setSplitPanelSize] = useControllable(\n props.splitPanelSize,\n props.onSplitPanelResize,\n getSplitPanelDefaultSize(splitPanelPosition),\n { componentName: 'AppLayout', controlledProp: 'splitPanelSize', changeHandler: 'onSplitPanelResize' }\n );\n\n const handleSplitPanelResize = useCallback(\n function handleSplitPanelChange(detail: { size: number }) {\n setSplitPanelSize(detail.size);\n fireNonCancelableEvent(props.onSplitPanelResize, detail);\n },\n [props.onSplitPanelResize, setSplitPanelSize]\n );\n\n const handleSplitPanelPreferencesChange = useCallback(\n function handleSplitPanelChange(detail: AppLayoutProps.SplitPanelPreferences) {\n setSplitPanelPreferences(detail);\n setSplitPanelLastInteraction({ type: 'position' });\n fireNonCancelableEvent(props.onSplitPanelPreferencesChange, detail);\n },\n [props.onSplitPanelPreferencesChange, setSplitPanelPreferences, setSplitPanelLastInteraction]\n );\n\n /**\n * The activeDrawerWidth is required in JavaScript to acccurately calculate whether a SplitPanel\n * in the side position should be forced to the bottom based on available horiziontal space.\n *\n * The handleDrawersClick will either open a new drawer or close the currently open drawer by setting\n * the activeDrawerId value. The active drawer can also be closed if a user clicks the Tools trigger\n * button. This will skip the focus handling because the focus should be going to the Tools close\n * button and not one of the drawers trigger buttons.\n *\n * The drawersTriggerCount is computed in order to determine whether the triggers should be persistent\n * in the UI when a drawer is open. The trigger button container is suppressed when a drawer is open\n * and their is only one trigger button.\n *\n * The hasDrawerViewportOverlay property is used to determine if any drawer is obscuring the entire\n * viewport. This currently applies to Navigation, Tools, and Drawers in mobile viewports.\n */\n const drawers = (props as InternalDrawerProps).drawers;\n\n const [activeDrawerId, setActiveDrawerId] = useControllable(drawers?.activeDrawerId, drawers?.onChange, null, {\n componentName: 'AppLayout',\n controlledProp: 'drawers.activeDrawerId',\n changeHandler: 'onChange',\n });\n\n const [drawersMaxWidth, setDrawersMaxWidth] = useState(toolsWidth);\n\n const activeDrawer = drawers?.items.find(drawer => drawer.id === activeDrawerId);\n\n const {\n refs: drawersRefs,\n setFocus: focusDrawersButtons,\n loseFocus: loseDrawersFocus,\n setLastInteraction: setDrawerLastInteraction,\n } = useDrawerFocusControl([activeDrawerId, activeDrawer?.resizable], activeDrawerId !== undefined, true);\n\n const drawerRef = useRef<HTMLDivElement>(null);\n const { resizeHandle, drawerSize } = useResize(drawerRef, {\n activeDrawerId,\n drawers,\n drawersRefs,\n isToolsOpen,\n drawersMaxWidth,\n });\n\n const handleDrawersClick = useCallback(\n function handleDrawersChange(id: string | null, skipFocusControl?: boolean) {\n const newActiveDrawerId = id !== activeDrawerId ? id : null;\n\n setActiveDrawerId(newActiveDrawerId);\n !skipFocusControl && focusDrawersButtons();\n fireNonCancelableEvent(drawers?.onChange, newActiveDrawerId!);\n setDrawerLastInteraction({ type: activeDrawerId ? 'close' : 'open' });\n },\n [activeDrawerId, drawers?.onChange, focusDrawersButtons, setActiveDrawerId, setDrawerLastInteraction]\n );\n\n const drawersTriggerCount =\n (drawers?.items.length ?? 0) +\n (splitPanelDisplayed && splitPanelPosition === 'side' ? 1 : 0) +\n (!toolsHide ? 1 : 0);\n const hasOpenDrawer =\n activeDrawerId !== null ||\n isToolsOpen ||\n (splitPanelDisplayed && splitPanelPosition === 'side' && isSplitPanelOpen);\n const hasDrawerViewportOverlay =\n isMobile && (!!activeDrawerId || (!navigationHide && isNavigationOpen) || (!toolsHide && isToolsOpen));\n\n /**\n * The Layout element is not necessarily synonymous with the client\n * viewport width. There can be content in the horizontal viewport\n * that exists on either side of the AppLayout. This resize observer\n * will set the custom property of the Layout element width that\n * is used for various horizontal constraints such as the maximum\n * allowed width of the Tools container.\n *\n * The offsetLeft of the Main will return the distance that the\n * Main element has from the left edge of the Layout component.\n * The offsetLeft value can vary based on the presence and state\n * of the Navigation as well as content gaps in the grid definition.\n * This value is used to determine the max width constraint calculation\n * for the Tools container.\n */\n const [layoutContainerQuery, layoutElement] = useContainerQuery(rect => rect.contentBoxWidth);\n const layoutWidth = layoutContainerQuery ?? 0;\n\n const mainElement = useRef<HTMLDivElement>(null);\n const [mainOffsetLeft, setMainOffsetLeft] = useState(0);\n\n const { hasBackgroundOverlap, updateBackgroundOverlapHeight } = useBackgroundOverlap({\n contentHeader: props.contentHeader,\n disableContentHeaderOverlap: props.disableContentHeaderOverlap,\n layoutElement,\n });\n\n useLayoutEffect(\n function handleMainOffsetLeft() {\n setMainOffsetLeft(mainElement?.current?.offsetLeft ?? 0);\n },\n [layoutWidth, isNavigationOpen, isToolsOpen, splitPanelReportedSize]\n );\n\n /**\n * Because the notifications slot does not give us any direction insight into\n * what the state of the child content is we need to have a mechanism for\n * tracking the height of the notifications and whether or not it has content.\n * The height of the notifications is an integer that will be used as a custom\n * property on the Layout component to determine what the sticky offset should\n * be if there are sticky notifications. This could be any number including\n * zero based on how the child content renders. The hasNotificationsContent boolean\n * is simply centralizing the logic of the notifications height being > 0 such\n * that it is not repeated in various components (such as MobileToolbar) that need to\n * know if the notifications slot is empty.\n */\n const [notificationsContainerQuery, notificationsElement] = useContainerQuery(rect => rect.contentBoxHeight);\n const [notificationsHeight, setNotificationsHeight] = useState(0);\n const [hasNotificationsContent, setHasNotificationsContent] = useState(false);\n\n useEffect(\n function handleNotificationsContent() {\n setNotificationsHeight(notificationsContainerQuery ?? 0);\n setHasNotificationsContent(notificationsContainerQuery && notificationsContainerQuery > 0 ? true : false);\n },\n [notificationsContainerQuery]\n );\n\n /**\n * Determine the offsetBottom value based on the presence of a footer element and\n * the SplitPanel component. Ignore the SplitPanel if it is not in the bottom\n * position. Use the size property if it is open and the header height if it is closed.\n */\n let offsetBottom = footerHeight;\n\n if (splitPanelDisplayed && splitPanelPosition === 'bottom') {\n if (isSplitPanelOpen) {\n offsetBottom += splitPanelReportedSize;\n } else {\n offsetBottom += splitPanelReportedHeaderHeight;\n }\n }\n\n /**\n * Warning! This is a hack! In order to accurately calculate if there is adequate\n * horizontal space for the Split Panel to be in the side position we need two values\n * that are not available in JavaScript.\n *\n * The first is the the content gap on the right which is stored in a design token\n * and applied in the Layout CSS:\n *\n * $contentGapRight: #{awsui.$space-scaled-2x-xxxl};\n *\n * The second is the width of the element that has the circular buttons for the\n * Tools and Split Panel. This could be suppressed given the state of the Tools\n * drawer returning a zero value. It would, however, be rendered if the Split Panel\n * were to move into the side position. This is calculated in the Tools CSS and\n * the Trigger button CSS with design tokens:\n *\n * padding: awsui.$space-scaled-s awsui.$space-layout-toggle-padding;\n * width: awsui.$space-layout-toggle-diameter;\n *\n * These values will be defined below as static integers that are rough approximations\n * of their computed width when rendered in the DOM, but doubled to ensure adequate\n * spacing for the Split Panel to be in side position.\n */\n useLayoutEffect(\n function handleSplitPanelMaxWidth() {\n const contentGapRight = 80; // Approximately 40px when rendered but doubled for safety\n const toolsFormOffsetWidth = 160; // Approximately 80px when rendered but doubled for safety\n const toolsOffsetWidth = isToolsOpen ? toolsWidth : 0;\n const activeDrawerOffsetWidth = activeDrawerId ? drawerSize : 0;\n\n setSplitPanelMaxWidth(\n layoutWidth -\n mainOffsetLeft -\n minContentWidth -\n contentGapRight -\n toolsOffsetWidth -\n toolsFormOffsetWidth -\n activeDrawerOffsetWidth\n );\n\n setDrawersMaxWidth(layoutWidth - mainOffsetLeft - minContentWidth - contentGapRight - toolsFormOffsetWidth);\n },\n [\n activeDrawerId,\n drawerSize,\n isNavigationOpen,\n isToolsOpen,\n layoutWidth,\n mainOffsetLeft,\n minContentWidth,\n toolsWidth,\n ]\n );\n\n return (\n <AppLayoutInternalsContext.Provider\n value={{\n ...props,\n activeDrawerId,\n contentType,\n drawers,\n drawersRefs,\n drawersMaxWidth,\n drawerSize,\n drawerRef,\n resizeHandle,\n drawersTriggerCount,\n headerHeight,\n footerHeight,\n hasDefaultToolsWidth,\n hasDrawerViewportOverlay,\n handleDrawersClick,\n handleNavigationClick,\n handleSplitPanelClick,\n handleSplitPanelPreferencesChange,\n handleSplitPanelResize,\n handleToolsClick,\n hasBackgroundOverlap,\n hasNotificationsContent,\n hasOpenDrawer,\n hasStickyBackground,\n isBackgroundOverlapDisabled: props.disableContentHeaderOverlap || !hasBackgroundOverlap,\n isMobile,\n isNavigationOpen: isNavigationOpen ?? false,\n isSplitPanelForcedPosition,\n isSplitPanelOpen,\n isToolsOpen,\n layoutElement,\n layoutWidth,\n loseToolsFocus,\n loseDrawersFocus,\n mainElement,\n mainOffsetLeft,\n maxContentWidth,\n minContentWidth,\n navigationHide,\n navigationRefs,\n notificationsElement,\n notificationsHeight,\n offsetBottom,\n setHasStickyBackground,\n setSplitPanelReportedSize,\n setSplitPanelReportedHeaderHeight,\n splitPanel,\n splitPanelDisplayed,\n splitPanelMaxWidth,\n splitPanelMinWidth,\n splitPanelPosition,\n splitPanelPreferences,\n splitPanelReportedSize,\n splitPanelReportedHeaderHeight,\n splitPanelSize,\n splitPanelToggle,\n setSplitPanelToggle,\n splitPanelRefs,\n toolsHide,\n toolsOpen: isToolsOpen,\n toolsWidth,\n toolsRefs,\n }}\n >\n <AppLayoutContext.Provider\n value={{\n stickyOffsetBottom: offsetBottom,\n stickyOffsetTop: 0, // not used in this design. Sticky headers read a CSS-var instead\n setHasStickyBackground,\n }}\n >\n <DynamicOverlapContext.Provider value={updateBackgroundOverlapHeight}>\n {children}\n </DynamicOverlapContext.Provider>\n </AppLayoutContext.Provider>\n </AppLayoutInternalsContext.Provider>\n );\n }\n);\n"]}
1
+ {"version":3,"file":"context.js","sourceRoot":"lib/default/","sources":["app-layout/visual-refresh/context.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EACZ,aAAa,EACb,WAAW,EACX,SAAS,EACT,eAAe,EACf,mBAAmB,EACnB,MAAM,EACN,QAAQ,EACR,UAAU,GACX,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,gDAAgD,CAAC;AAEvF,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAoB,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC/E,OAAO,EAA0B,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAClG,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAA8B,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AAE/G,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAE5D,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AACzE,OAAO,SAAS,MAAM,qBAAqB,CAAC;AAC5C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,E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yright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, {\n createContext,\n useCallback,\n useEffect,\n useLayoutEffect,\n useImperativeHandle,\n useRef,\n useState,\n useContext,\n} from 'react';\nimport { applyDefaults } from '../defaults';\nimport { AppLayoutContext } from '../../internal/context/app-layout-context';\nimport { DynamicOverlapContext } from '../../internal/context/dynamic-overlap-context';\nimport { AppLayoutProps } from '../interfaces';\nimport { fireNonCancelableEvent } from '../../internal/events';\nimport { FocusControlRefs, useFocusControl } from '../utils/use-focus-control';\nimport { DrawerFocusControlRefs, useDrawerFocusControl } from '../utils/use-drawer-focus-control';\nimport { getSplitPanelDefaultSize } from '../../split-panel/utils/size-utils';\nimport { isDevelopment } from '../../internal/is-development';\nimport { getSplitPanelPosition } from './split-panel';\nimport { useControllable } from '../../internal/hooks/use-controllable';\nimport { SplitPanelFocusControlRefs, useSplitPanelFocusControl } from '../utils/use-split-panel-focus-control';\nimport { SplitPanelSideToggleProps } from '../../internal/context/split-panel-context';\nimport { useObservedElement } from '../utils/use-observed-element';\nimport { useMobile } from '../../internal/hooks/use-mobile';\nimport { DrawerItem, InternalDrawerProps } from '../drawer/interfaces';\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\nimport useResize from '../utils/use-resize';\nimport styles from './styles.css.js';\nimport { useContainerQuery } from '@cloudscape-design/component-toolkit';\nimport useBackgroundOverlap from './use-background-overlap';\nimport { useDrawers } from '../utils/use-drawers';\n\ninterface AppLayoutInternals extends AppLayoutProps {\n activeDrawerId: string | undefined;\n drawers: Array<DrawerItem>;\n drawersAriaLabel: string | undefined;\n drawersRefs: DrawerFocusControlRefs;\n drawerSize: number;\n drawersMaxWidth: number;\n drawerRef: React.Ref<HTMLElement>;\n resizeHandle: React.ReactElement;\n drawersTriggerCount: number;\n handleDrawersClick: (activeDrawerId: string | undefined, skipFocusControl?: boolean) => void;\n handleSplitPanelClick: () => void;\n handleNavigationClick: (isOpen: boolean) => void;\n handleSplitPanelPreferencesChange: (detail: AppLayoutProps.SplitPanelPreferences) => void;\n handleSplitPanelResize: (detail: { size: number }) => void;\n handleToolsClick: (value: boolean, skipFocusControl?: boolean) => void;\n hasBackgroundOverlap: boolean;\n hasDefaultToolsWidth: boolean;\n hasDrawerViewportOverlay: boolean;\n hasNotificationsContent: boolean;\n hasOpenDrawer?: boolean;\n hasStickyBackground: boolean;\n isBackgroundOverlapDisabled: boolean;\n isMobile: boolean;\n isNavigationOpen: boolean;\n isSplitPanelForcedPosition: boolean;\n isSplitPanelOpen?: boolean;\n isToolsOpen: boolean;\n layoutElement: React.Ref<HTMLElement>;\n layoutWidth: number;\n loseToolsFocus: () => void;\n loseDrawersFocus: () => void;\n mainElement: React.Ref<HTMLDivElement>;\n mainOffsetLeft: number;\n navigationRefs: FocusControlRefs;\n notificationsElement: React.Ref<HTMLDivElement>;\n notificationsHeight: number;\n offsetBottom: number;\n setHasStickyBackground: (value: boolean) => void;\n setSplitPanelReportedSize: (value: number) => void;\n setSplitPanelReportedHeaderHeight: (value: number) => void;\n headerHeight: number;\n footerHeight: number;\n splitPanelMaxWidth: number;\n splitPanelMinWidth: number;\n splitPanelPosition: AppLayoutProps.SplitPanelPosition;\n splitPanelReportedSize: number;\n splitPanelReportedHeaderHeight: number;\n splitPanelToggle: SplitPanelSideToggleProps;\n setSplitPanelToggle: (toggle: SplitPanelSideToggleProps) => void;\n splitPanelDisplayed: boolean;\n splitPanelRefs: SplitPanelFocusControlRefs;\n toolsRefs: FocusControlRefs;\n}\n\n/**\n * The default values are destructured in the context instantiation to\n * prevent downstream Typescript errors. This could likely be replaced\n * by a context interface definition that extends the AppLayout interface.\n */\nconst AppLayoutInternalsContext = createContext<AppLayoutInternals | null>(null);\n\ninterface AppLayoutProviderInternalsProps extends AppLayoutProps {\n children: React.ReactNode;\n}\n\nexport function useAppLayoutInternals() {\n const ctx = useContext(AppLayoutInternalsContext);\n if (!ctx) {\n throw new Error('Invariant violation: this context is only available inside app layout');\n }\n return ctx;\n}\n\nexport const AppLayoutInternalsProvider = React.forwardRef(\n (\n {\n toolsHide,\n toolsOpen: controlledToolsOpen,\n navigationHide,\n navigationOpen: controlledNavigationOpen,\n contentType = 'default',\n headerSelector = '#b #h',\n footerSelector = '#b #h',\n children,\n splitPanel,\n ...props\n }: AppLayoutProviderInternalsProps,\n forwardRef: React.Ref<AppLayoutProps.Ref>\n ) => {\n const isMobile = useMobile();\n\n if (isDevelopment) {\n if (controlledToolsOpen && toolsHide) {\n warnOnce(\n 'AppLayout',\n `You have enabled both the \\`toolsOpen\\` prop and the \\`toolsHide\\` prop. This is not supported. Set \\`toolsOpen\\` to \\`false\\` when you set \\`toolsHide\\` to \\`true\\`.`\n );\n }\n }\n\n const [hasStickyBackground, setHasStickyBackground] = useState(false);\n\n /**\n * Set the default values for minimum and maximum content width.\n */\n const geckoMaxCssLength = ((1 << 30) - 1) / 60;\n const halfGeckoMaxCssLength = geckoMaxCssLength / 2;\n // CSS lengths in Gecko are limited to at most (1<<30)-1 app units (Gecko uses 60 as app unit).\n // Limit the maxContentWidth to the half of the upper boundary (≈4230^2) to be on the safe side.\n const maxContentWidth =\n props.maxContentWidth && props.maxContentWidth > halfGeckoMaxCssLength\n ? halfGeckoMaxCssLength\n : props.maxContentWidth ?? 0;\n const minContentWidth = props.minContentWidth ?? 280;\n\n /**\n * Determine the default state of the Navigation and Tools drawers.\n * Mobile viewports should be closed by default under all circumstances.\n * If the navigationOpen prop has been set then that should take precedence\n * over the contentType prop. Desktop viewports that do not have the\n * navigationOpen or contentType props set will use the default contentType.\n */\n const contentTypeDefaults = applyDefaults(contentType, { maxContentWidth, minContentWidth }, true);\n\n /**\n * The useControllable hook will set the default value and manage either\n * the controlled or uncontrolled state of the Navigation drawer. The logic\n * for determining the default state is colocated with the Navigation component.\n *\n * The callback that will be passed to the Navigation and MobileToolbar\n * components to handle the click events that will change the state\n * of the Navigation drawer. It will set the Navigation state with the\n * useControllable hook and also fire the onNavigationChange function to\n * emit the state change.\n */\n const [isNavigationOpen = false, setIsNavigationOpen] = useControllable(\n controlledNavigationOpen,\n props.onNavigationChange,\n isMobile ? false : contentTypeDefaults.navigationOpen,\n { componentName: 'AppLayout', controlledProp: 'navigationOpen', changeHandler: 'onNavigationChange' }\n );\n\n const { refs: navigationRefs, setFocus: focusNavButtons } = useFocusControl(isNavigationOpen);\n\n const handleNavigationClick = useCallback(\n function handleNavigationChange(isOpen: boolean) {\n setIsNavigationOpen(isOpen);\n focusNavButtons();\n fireNonCancelableEvent(props.onNavigationChange, { open: isOpen });\n },\n [props.onNavigationChange, setIsNavigationOpen, focusNavButtons]\n );\n\n /**\n * The useControllable hook will set the default value and manage either\n * the controlled or uncontrolled state of the Tools drawer. The logic\n * for determining the default state is colocated with the Tools component.\n *\n * The callback that will be passed to the Navigation and MobileToolbar\n * components to handle the click events that will change the state\n * of the Tools drawer. It will set the Tools state with the\n * useControllable hook and also fire the onToolsChange function to\n * emit the state change.\n */\n const toolsWidth = props.toolsWidth ?? 290;\n const hasDefaultToolsWidth = props.toolsWidth === undefined;\n\n const [isToolsOpen = false, setIsToolsOpen] = useControllable(\n controlledToolsOpen,\n props.onToolsChange,\n isMobile ? false : contentTypeDefaults.toolsOpen,\n { componentName: 'AppLayout', controlledProp: 'toolsOpen', changeHandler: 'onToolsChange' }\n );\n\n const {\n refs: toolsRefs,\n setFocus: focusToolsButtons,\n loseFocus: loseToolsFocus,\n } = useFocusControl(isToolsOpen, true);\n\n const handleToolsClick = useCallback(\n function handleToolsChange(isOpen: boolean, skipFocusControl?: boolean) {\n setIsToolsOpen(isOpen);\n !skipFocusControl && focusToolsButtons();\n fireNonCancelableEvent(props.onToolsChange, { open: isOpen });\n },\n [props.onToolsChange, setIsToolsOpen, focusToolsButtons]\n );\n\n /**\n * On mobile viewports the navigation and tools drawers are adjusted to a fixed position\n * that consumes 100% of the viewport height and width. The body content could potentially\n * be scrollable underneath the drawer. In order to prevent this a CSS class needs to be\n * added to the document body that sets overflow to hidden.\n */\n useEffect(\n function handleBodyScroll() {\n if (isMobile && (isNavigationOpen || isToolsOpen)) {\n document.body.classList.add(styles['block-body-scroll']);\n } else {\n document.body.classList.remove(styles['block-body-scroll']);\n }\n\n // Ensure the CSS class is removed from the body on side effect cleanup\n return function cleanup() {\n document.body.classList.remove(styles['block-body-scroll']);\n };\n },\n [isMobile, isNavigationOpen, isToolsOpen]\n );\n\n /**\n * The useImperativeHandle hook in conjunction with the forwardRef function\n * in the AppLayout component definition expose the following callable\n * functions to component consumers when they put a ref as a property on\n * their component implementation.\n */\n useImperativeHandle(\n forwardRef,\n function createImperativeHandle() {\n return {\n closeNavigationIfNecessary: function () {\n isMobile && handleNavigationClick(false);\n },\n openTools: function () {\n handleToolsClick(true);\n },\n focusToolsClose: () => focusToolsButtons(true),\n };\n },\n [isMobile, handleNavigationClick, handleToolsClick, focusToolsButtons]\n );\n\n /**\n * Query the DOM for the header and footer elements based on the selectors provided\n * by the properties and pass the heights to the custom property definitions.\n */\n const headerHeight = useObservedElement(headerSelector);\n const footerHeight = useObservedElement(footerSelector);\n\n /**\n * Set the default values for the minimum and maximum Split Panel width when it is\n * in the side position. The useLayoutEffect will compute the available space in the\n * DOM for the Split Panel given the current state. The minimum and maximum\n * widths will potentially trigger a side effect that will put the Split Panel into\n * a forced position on the bottom.\n */\n const splitPanelMinWidth = 280;\n const [splitPanelMaxWidth, setSplitPanelMaxWidth] = useState(splitPanelMinWidth);\n\n /**\n * The useControllable hook will set the default value and manage either\n * the controlled or uncontrolled state of the Split Panel. By default\n * the Split Panel should always be closed on page load.\n *\n * The callback that will be passed to the SplitPanel component\n * to handle the click events that will change the state of the SplitPanel\n * to open or closed given the current state. It will set the isSplitPanelOpen\n * controlled state and fire the onSplitPanelToggle event.\n */\n const [isSplitPanelOpen, setIsSplitPanelOpen] = useControllable(\n props.splitPanelOpen,\n props.onSplitPanelToggle,\n false,\n { componentName: 'AppLayout', controlledProp: 'splitPanelOpen', changeHandler: 'onSplitPanelToggle' }\n );\n\n /**\n * The useControllable hook will manage the controlled or uncontrolled\n * state of the splitPanelPreferences. By default the splitPanelPreferences\n * is undefined. When set the object shape should have a single key to indicate\n * either bottom or side position.\n *\n * The callback that will handle changes to the splitPanelPreferences\n * object that will determine if the SplitPanel is rendered either on the\n * bottom of the viewport or within the Tools container.\n */\n const [splitPanelPreferences, setSplitPanelPreferences] = useControllable(\n props.splitPanelPreferences,\n props.onSplitPanelPreferencesChange,\n undefined,\n {\n componentName: 'AppLayout',\n controlledProp: 'splitPanelPreferences',\n changeHandler: 'onSplitPanelPreferencesChange',\n }\n );\n\n const { refs: splitPanelRefs, setLastInteraction: setSplitPanelLastInteraction } = useSplitPanelFocusControl([\n splitPanelPreferences,\n isSplitPanelOpen,\n ]);\n\n const handleSplitPanelClick = useCallback(\n function handleSplitPanelChange() {\n setIsSplitPanelOpen(!isSplitPanelOpen);\n setSplitPanelLastInteraction({ type: isSplitPanelOpen ? 'close' : 'open' });\n fireNonCancelableEvent(props.onSplitPanelToggle, { open: !isSplitPanelOpen });\n },\n [props.onSplitPanelToggle, isSplitPanelOpen, setIsSplitPanelOpen, setSplitPanelLastInteraction]\n );\n\n /**\n * The Split Panel will be in forced (bottom) position if the defined minimum width is\n * greater than the maximum width. In other words, the maximum width is the currently\n * available horizontal space based on all other components that are rendered. If the\n * minimum width exceeds this value then there is not enough horizontal space and we must\n * force it to the bottom position.\n */\n const [isSplitPanelForcedPosition, setSplitPanelForcedPosition] = useState(false);\n const splitPanelPosition = getSplitPanelPosition(isSplitPanelForcedPosition, splitPanelPreferences);\n\n useLayoutEffect(\n function handleSplitPanelForcePosition() {\n setSplitPanelForcedPosition(splitPanelMinWidth > splitPanelMaxWidth);\n },\n [splitPanelMaxWidth, splitPanelMinWidth]\n );\n\n /**\n * The useControllable hook will set the default size of the SplitPanel based\n * on the default position set in the splitPanelPreferences. The logic for the\n * default size is contained in the SplitPanel component. The splitPanelControlledSize\n * will be bound to the size property in the SplitPanel context for rendering.\n *\n * The callback that will be passed to the SplitPanel component\n * to handle the resize events that will change the size of the SplitPanel.\n * It will set the splitPanelControlledSize controlled state and fire the\n * onSplitPanelResize event.\n */\n const [splitPanelReportedSize, setSplitPanelReportedSize] = useState(0);\n const [splitPanelReportedHeaderHeight, setSplitPanelReportedHeaderHeight] = useState(0);\n const [splitPanelToggle, setSplitPanelToggle] = useState<SplitPanelSideToggleProps>({\n displayed: false,\n ariaLabel: undefined,\n });\n const splitPanelDisplayed = !!(splitPanelToggle.displayed || isSplitPanelOpen);\n\n const [splitPanelSize, setSplitPanelSize] = useControllable(\n props.splitPanelSize,\n props.onSplitPanelResize,\n getSplitPanelDefaultSize(splitPanelPosition),\n { componentName: 'AppLayout', controlledProp: 'splitPanelSize', changeHandler: 'onSplitPanelResize' }\n );\n\n const handleSplitPanelResize = useCallback(\n function handleSplitPanelChange(detail: { size: number }) {\n setSplitPanelSize(detail.size);\n fireNonCancelableEvent(props.onSplitPanelResize, detail);\n },\n [props.onSplitPanelResize, setSplitPanelSize]\n );\n\n const handleSplitPanelPreferencesChange = useCallback(\n function handleSplitPanelChange(detail: AppLayoutProps.SplitPanelPreferences) {\n setSplitPanelPreferences(detail);\n setSplitPanelLastInteraction({ type: 'position' });\n fireNonCancelableEvent(props.onSplitPanelPreferencesChange, detail);\n },\n [props.onSplitPanelPreferencesChange, setSplitPanelPreferences, setSplitPanelLastInteraction]\n );\n\n const {\n drawers,\n activeDrawer,\n activeDrawerId,\n onActiveDrawerChange,\n onActiveDrawerResize,\n activeDrawerSize,\n ...drawersProps\n } = useDrawers(\n props as InternalDrawerProps,\n {\n ariaLabels: props.ariaLabels,\n toolsHide,\n toolsOpen: isToolsOpen,\n tools: props.tools,\n toolsWidth,\n },\n contentTypeDefaults\n );\n\n const [drawersMaxWidth, setDrawersMaxWidth] = useState(toolsWidth);\n\n const {\n refs: drawersRefs,\n setFocus: focusDrawersButtons,\n loseFocus: loseDrawersFocus,\n setLastInteraction: setDrawerLastInteraction,\n } = useDrawerFocusControl([activeDrawerId, activeDrawer?.resizable], true, true);\n\n const drawerRef = useRef<HTMLDivElement>(null);\n const { resizeHandle, drawerSize } = useResize(drawerRef, {\n onActiveDrawerResize,\n activeDrawerSize,\n activeDrawer,\n drawersRefs,\n isToolsOpen,\n drawersMaxWidth,\n });\n\n const handleDrawersClick = (id: string | undefined, skipFocusControl?: boolean) => {\n const newActiveDrawerId = id !== activeDrawerId ? id : undefined;\n\n onActiveDrawerChange(newActiveDrawerId);\n\n !skipFocusControl && focusDrawersButtons();\n setDrawerLastInteraction({ type: activeDrawerId ? 'close' : 'open' });\n };\n\n const drawersTriggerCount =\n drawers.length + (splitPanelDisplayed && splitPanelPosition === 'side' ? 1 : 0) + (!toolsHide ? 1 : 0);\n const hasOpenDrawer =\n activeDrawerId !== undefined ||\n isToolsOpen ||\n (splitPanelDisplayed && splitPanelPosition === 'side' && isSplitPanelOpen);\n const hasDrawerViewportOverlay =\n isMobile && (!!activeDrawerId || (!navigationHide && isNavigationOpen) || (!toolsHide && isToolsOpen));\n\n /**\n * The Layout element is not necessarily synonymous with the client\n * viewport width. There can be content in the horizontal viewport\n * that exists on either side of the AppLayout. This resize observer\n * will set the custom property of the Layout element width that\n * is used for various horizontal constraints such as the maximum\n * allowed width of the Tools container.\n *\n * The offsetLeft of the Main will return the distance that the\n * Main element has from the left edge of the Layout component.\n * The offsetLeft value can vary based on the presence and state\n * of the Navigation as well as content gaps in the grid definition.\n * This value is used to determine the max width constraint calculation\n * for the Tools container.\n */\n const [layoutContainerQuery, layoutElement] = useContainerQuery(rect => rect.contentBoxWidth);\n const layoutWidth = layoutContainerQuery ?? 0;\n\n const mainElement = useRef<HTMLDivElement>(null);\n const [mainOffsetLeft, setMainOffsetLeft] = useState(0);\n\n const { hasBackgroundOverlap, updateBackgroundOverlapHeight } = useBackgroundOverlap({\n contentHeader: props.contentHeader,\n disableContentHeaderOverlap: props.disableContentHeaderOverlap,\n layoutElement,\n });\n\n useLayoutEffect(\n function handleMainOffsetLeft() {\n setMainOffsetLeft(mainElement?.current?.offsetLeft ?? 0);\n },\n [layoutWidth, isNavigationOpen, isToolsOpen, splitPanelReportedSize]\n );\n\n /**\n * Because the notifications slot does not give us any direction insight into\n * what the state of the child content is we need to have a mechanism for\n * tracking the height of the notifications and whether or not it has content.\n * The height of the notifications is an integer that will be used as a custom\n * property on the Layout component to determine what the sticky offset should\n * be if there are sticky notifications. This could be any number including\n * zero based on how the child content renders. The hasNotificationsContent boolean\n * is simply centralizing the logic of the notifications height being > 0 such\n * that it is not repeated in various components (such as MobileToolbar) that need to\n * know if the notifications slot is empty.\n */\n const [notificationsContainerQuery, notificationsElement] = useContainerQuery(rect => rect.contentBoxHeight);\n const [notificationsHeight, setNotificationsHeight] = useState(0);\n const [hasNotificationsContent, setHasNotificationsContent] = useState(false);\n\n useEffect(\n function handleNotificationsContent() {\n setNotificationsHeight(notificationsContainerQuery ?? 0);\n setHasNotificationsContent(notificationsContainerQuery && notificationsContainerQuery > 0 ? true : false);\n },\n [notificationsContainerQuery]\n );\n\n /**\n * Determine the offsetBottom value based on the presence of a footer element and\n * the SplitPanel component. Ignore the SplitPanel if it is not in the bottom\n * position. Use the size property if it is open and the header height if it is closed.\n */\n let offsetBottom = footerHeight;\n\n if (splitPanelDisplayed && splitPanelPosition === 'bottom') {\n if (isSplitPanelOpen) {\n offsetBottom += splitPanelReportedSize;\n } else {\n offsetBottom += splitPanelReportedHeaderHeight;\n }\n }\n\n /**\n * Warning! This is a hack! In order to accurately calculate if there is adequate\n * horizontal space for the Split Panel to be in the side position we need two values\n * that are not available in JavaScript.\n *\n * The first is the the content gap on the right which is stored in a design token\n * and applied in the Layout CSS:\n *\n * $contentGapRight: #{awsui.$space-scaled-2x-xxxl};\n *\n * The second is the width of the element that has the circular buttons for the\n * Tools and Split Panel. This could be suppressed given the state of the Tools\n * drawer returning a zero value. It would, however, be rendered if the Split Panel\n * were to move into the side position. This is calculated in the Tools CSS and\n * the Trigger button CSS with design tokens:\n *\n * padding: awsui.$space-scaled-s awsui.$space-layout-toggle-padding;\n * width: awsui.$space-layout-toggle-diameter;\n *\n * These values will be defined below as static integers that are rough approximations\n * of their computed width when rendered in the DOM, but doubled to ensure adequate\n * spacing for the Split Panel to be in side position.\n */\n useLayoutEffect(\n function handleSplitPanelMaxWidth() {\n const contentGapRight = 80; // Approximately 40px when rendered but doubled for safety\n const toolsFormOffsetWidth = 160; // Approximately 80px when rendered but doubled for safety\n const toolsOffsetWidth = isToolsOpen ? toolsWidth : 0;\n const activeDrawerOffsetWidth = activeDrawerId ? drawerSize : 0;\n\n setSplitPanelMaxWidth(\n layoutWidth -\n mainOffsetLeft -\n minContentWidth -\n contentGapRight -\n toolsOffsetWidth -\n toolsFormOffsetWidth -\n activeDrawerOffsetWidth\n );\n\n setDrawersMaxWidth(layoutWidth - mainOffsetLeft - minContentWidth - contentGapRight - toolsFormOffsetWidth);\n },\n [\n activeDrawerId,\n drawerSize,\n isNavigationOpen,\n isToolsOpen,\n layoutWidth,\n mainOffsetLeft,\n minContentWidth,\n toolsWidth,\n ]\n );\n\n return (\n <AppLayoutInternalsContext.Provider\n value={{\n ...props,\n activeDrawerId,\n contentType,\n drawers,\n drawersAriaLabel: drawersProps.ariaLabel,\n drawersRefs,\n drawersMaxWidth,\n drawerSize,\n drawerRef,\n resizeHandle,\n drawersTriggerCount,\n headerHeight,\n footerHeight,\n hasDefaultToolsWidth,\n hasDrawerViewportOverlay,\n handleDrawersClick,\n handleNavigationClick,\n handleSplitPanelClick,\n handleSplitPanelPreferencesChange,\n handleSplitPanelResize,\n handleToolsClick,\n hasBackgroundOverlap,\n hasNotificationsContent,\n hasOpenDrawer,\n hasStickyBackground,\n isBackgroundOverlapDisabled: props.disableContentHeaderOverlap || !hasBackgroundOverlap,\n isMobile,\n isNavigationOpen: isNavigationOpen ?? false,\n isSplitPanelForcedPosition,\n isSplitPanelOpen,\n isToolsOpen,\n layoutElement,\n layoutWidth,\n loseToolsFocus,\n loseDrawersFocus,\n mainElement,\n mainOffsetLeft,\n maxContentWidth,\n minContentWidth,\n navigationHide,\n navigationRefs,\n notificationsElement,\n notificationsHeight,\n offsetBottom,\n setHasStickyBackground,\n setSplitPanelReportedSize,\n setSplitPanelReportedHeaderHeight,\n splitPanel,\n splitPanelDisplayed,\n splitPanelMaxWidth,\n splitPanelMinWidth,\n splitPanelPosition,\n splitPanelPreferences,\n splitPanelReportedSize,\n splitPanelReportedHeaderHeight,\n splitPanelSize,\n splitPanelToggle,\n setSplitPanelToggle,\n splitPanelRefs,\n toolsHide,\n toolsOpen: isToolsOpen,\n toolsWidth,\n toolsRefs,\n }}\n >\n <AppLayoutContext.Provider\n value={{\n stickyOffsetBottom: offsetBottom,\n stickyOffsetTop: 0, // not used in this design. Sticky headers read a CSS-var instead\n setHasStickyBackground,\n }}\n >\n <DynamicOverlapContext.Provider value={updateBackgroundOverlapHeight}>\n {children}\n </DynamicOverlapContext.Provider>\n </AppLayoutContext.Provider>\n </AppLayoutInternalsContext.Provider>\n );\n }\n);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"drawers.d.ts","sourceRoot":"lib/default/","sources":["app-layout/visual-refresh/drawers.tsx"],"names":[],"mappings":";AAcA;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,uBAuB9B;AAgMD;;;;;GAKG;AACH,wBAAgB,cAAc,uBAuE7B"}
1
+ {"version":3,"file":"drawers.d.ts","sourceRoot":"lib/default/","sources":["app-layout/visual-refresh/drawers.tsx"],"names":[],"mappings":";AAcA;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,uBAuB9B;AA+KD;;;;;GAKG;AACH,wBAAgB,cAAc,uBAmD7B"}
@@ -20,7 +20,7 @@ import testutilStyles from '../test-classes/styles.css.js';
20
20
  export default function Drawers() {
21
21
  const { disableBodyScroll, drawers, hasDrawerViewportOverlay, hasOpenDrawer, isNavigationOpen, navigationHide } = useAppLayoutInternals();
22
22
  const isUnfocusable = hasDrawerViewportOverlay && isNavigationOpen && !navigationHide;
23
- if (!drawers) {
23
+ if (drawers.length === 0) {
24
24
  return null;
25
25
  }
26
26
  return (React.createElement("div", { className: clsx(styles['drawers-container'], {
@@ -41,7 +41,7 @@ export default function Drawers() {
41
41
  function ActiveDrawer() {
42
42
  var _a, _b, _c;
43
43
  const { activeDrawerId, ariaLabels, drawers, drawersRefs, handleDrawersClick, handleToolsClick, hasDrawerViewportOverlay, isMobile, isNavigationOpen, isToolsOpen, navigationHide, tools, toolsRefs, loseDrawersFocus, resizeHandle, drawerSize, drawersMaxWidth, drawerRef, } = useAppLayoutInternals();
44
- const activeDrawer = (_a = drawers === null || drawers === void 0 ? void 0 : drawers.items.find((item) => item.id === activeDrawerId)) !== null && _a !== void 0 ? _a : null;
44
+ const activeDrawer = (_a = drawers.find(item => item.id === activeDrawerId)) !== null && _a !== void 0 ? _a : null;
45
45
  const computedAriaLabels = {
46
46
  closeButton: activeDrawerId ? (_b = activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.ariaLabels) === null || _b === void 0 ? void 0 : _b.closeButton : ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.toolsClose,
47
47
  content: activeDrawerId ? (_c = activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.ariaLabels) === null || _c === void 0 ? void 0 : _c.content : ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.tools,
@@ -76,7 +76,7 @@ function ActiveDrawer() {
76
76
  * the ref required to manage focus control.
77
77
  */
78
78
  function DesktopTriggers() {
79
- const { activeDrawerId, ariaLabels, drawers, drawersRefs, drawersTriggerCount, handleDrawersClick, handleSplitPanelClick, handleToolsClick, hasOpenDrawer, isMobile, isSplitPanelOpen, isToolsOpen, splitPanel, splitPanelDisplayed, splitPanelPosition, splitPanelRefs, splitPanelToggle, tools, toolsHide, toolsRefs, } = useAppLayoutInternals();
79
+ const { activeDrawerId, drawers, drawersAriaLabel, drawersRefs, drawersTriggerCount, handleDrawersClick, handleSplitPanelClick, handleToolsClick, hasOpenDrawer, isMobile, isSplitPanelOpen, isToolsOpen, splitPanel, splitPanelDisplayed, splitPanelPosition, splitPanelRefs, splitPanelToggle, } = useAppLayoutInternals();
80
80
  const hasMultipleTriggers = drawersTriggerCount > 1;
81
81
  const hasSplitPanel = splitPanel && splitPanelDisplayed && splitPanelPosition === 'side' ? true : false;
82
82
  const previousActiveDrawerId = useRef(activeDrawerId);
@@ -89,16 +89,12 @@ function DesktopTriggers() {
89
89
  return (React.createElement("aside", { className: clsx(styles['drawers-desktop-triggers-container'], testutilStyles['drawers-desktop-triggers-container'], {
90
90
  [styles['has-multiple-triggers']]: hasMultipleTriggers,
91
91
  [styles['has-open-drawer']]: hasOpenDrawer,
92
- }), "aria-label": drawers === null || drawers === void 0 ? void 0 : drawers.ariaLabel },
92
+ }), "aria-label": drawersAriaLabel },
93
93
  React.createElement("div", { className: clsx(styles['drawers-trigger-content'], {
94
94
  [styles['has-multiple-triggers']]: hasMultipleTriggers,
95
95
  [styles['has-open-drawer']]: hasOpenDrawer,
96
96
  }) },
97
- !toolsHide && tools && (React.createElement(TriggerButton, { ariaLabel: ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.toolsToggle, className: clsx(styles['drawers-trigger'], testutilStyles['tools-toggle']), iconName: "status-info", onClick: () => {
98
- activeDrawerId && handleDrawersClick(null, true);
99
- handleToolsClick(!isToolsOpen);
100
- }, ref: toolsRefs.toggle, selected: isToolsOpen })), drawers === null || drawers === void 0 ? void 0 :
101
- drawers.items.map(item => {
97
+ drawers.map(item => {
102
98
  var _a;
103
99
  return (React.createElement(TriggerButton, { ariaLabel: (_a = item.ariaLabels) === null || _a === void 0 ? void 0 : _a.triggerButton, className: clsx(styles['drawers-trigger'], testutilStyles['drawers-trigger']), iconName: item.trigger.iconName, iconSvg: item.trigger.iconSvg, key: item.id, onClick: () => {
104
100
  isToolsOpen && handleToolsClick(!isToolsOpen, true);
@@ -114,22 +110,19 @@ function DesktopTriggers() {
114
110
  * trigger button for the Tools drawer.
115
111
  */
116
112
  export function MobileTriggers() {
117
- var _a;
118
- const { activeDrawerId, ariaLabels, drawers, drawersRefs, handleDrawersClick, handleToolsClick, hasDrawerViewportOverlay, isMobile, isToolsOpen, tools, toolsHide, toolsRefs, } = useAppLayoutInternals();
113
+ const { activeDrawerId, drawers, drawersAriaLabel, drawersRefs, handleDrawersClick, hasDrawerViewportOverlay, isMobile, } = useAppLayoutInternals();
119
114
  const previousActiveDrawerId = useRef(activeDrawerId);
120
115
  if (activeDrawerId) {
121
116
  previousActiveDrawerId.current = activeDrawerId;
122
117
  }
123
- if (!isMobile || !drawers) {
118
+ if (!isMobile || drawers.length === 0) {
124
119
  return null;
125
120
  }
126
121
  return (React.createElement("aside", { "aria-hidden": hasDrawerViewportOverlay, className: clsx(styles['drawers-mobile-triggers-container'], testutilStyles['drawers-mobile-triggers-container'], {
127
122
  [styles.unfocusable]: hasDrawerViewportOverlay,
128
- }), "aria-label": drawers.ariaLabel },
129
- !toolsHide && tools && (React.createElement(InternalButton, { ariaLabel: (_a = ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.toolsToggle) !== null && _a !== void 0 ? _a : undefined, ariaExpanded: isToolsOpen, className: testutilStyles['tools-toggle'], disabled: hasDrawerViewportOverlay, formAction: "none", iconName: "status-info", onClick: () => handleToolsClick(true), ref: toolsRefs.toggle, variant: "icon", __nativeAttributes: { 'aria-haspopup': true } })),
130
- drawers.items.map(item => {
131
- var _a;
132
- return (React.createElement(InternalButton, { ariaExpanded: item.id === activeDrawerId, ariaLabel: (_a = item.ariaLabels) === null || _a === void 0 ? void 0 : _a.triggerButton, className: clsx(styles['drawers-trigger'], testutilStyles['drawers-trigger']), disabled: hasDrawerViewportOverlay, formAction: "none", iconName: item.trigger.iconName, iconSvg: item.trigger.iconSvg, key: item.id, onClick: () => handleDrawersClick(item.id), ref: item.id === previousActiveDrawerId.current ? drawersRefs.toggle : undefined, variant: "icon", __nativeAttributes: { 'aria-haspopup': true, 'data-testid': `awsui-app-layout-trigger-${item.id}` } }));
133
- })));
123
+ }), "aria-label": drawersAriaLabel }, drawers.map(item => {
124
+ var _a;
125
+ return (React.createElement(InternalButton, { ariaExpanded: item.id === activeDrawerId, ariaLabel: (_a = item.ariaLabels) === null || _a === void 0 ? void 0 : _a.triggerButton, className: clsx(styles['drawers-trigger'], testutilStyles['drawers-trigger']), disabled: hasDrawerViewportOverlay, formAction: "none", iconName: item.trigger.iconName, iconSvg: item.trigger.iconSvg, key: item.id, onClick: () => handleDrawersClick(item.id), ref: item.id === previousActiveDrawerId.current ? drawersRefs.toggle : undefined, variant: "icon", __nativeAttributes: { 'aria-haspopup': true, 'data-testid': `awsui-app-layout-trigger-${item.id}` } }));
126
+ })));
134
127
  }
135
128
  //# sourceMappingURL=drawers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"drawers.js","sourceRoot":"lib/default/","sources":["app-layout/visual-refresh/drawers.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,cAAc,MAAM,gDAAgD,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,gBAAgB,MAAM,iCAAiC,CAAC;AAC/D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,cAAc,MAAM,+BAA+B,CAAC;AAE3D;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO;IAC7B,MAAM,EAAE,iBAAiB,EAAE,OAAO,EAAE,wBAAwB,EAAE,aAAa,EAAE,gBAAgB,EAAE,cAAc,EA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AAE,KAAK,cAAc,EACxC,SAAS,EAAE,MAAA,IAAI,CAAC,UAAU,0CAAE,aAAa,EACzC,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAC,EAC7E,QAAQ,EAAE,wBAAwB,EAClC,UAAU,EAAC,MAAM,EACjB,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,EAC/B,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,EAC7B,GAAG,EAAE,IAAI,CAAC,EAAE,EACZ,OAAO,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC,EAC1C,GAAG,EAAE,IAAI,CAAC,EAAE,KAAK,sBAAsB,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EAChF,OAAO,EAAC,MAAM,EACd,kBAAkB,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,aAAa,EAAE,4BAA4B,IAAI,CAAC,EAAE,EAAE,EAAE,GACnG,CACH,CAAA;SAAA,CAAC,CACI,CACT,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport clsx from 'clsx';\nimport customCssProps from '../../internal/generated/custom-css-properties';\nimport { InternalButton } from '../../button/internal';\nimport SplitPanel from './split-panel';\nimport TriggerButton from './trigger-button';\nimport { useAppLayoutInternals } from './context';\nimport splitPanelStyles from '../../split-panel/styles.css.js';\nimport styles from './styles.css.js';\nimport sharedStyles from '../styles.css.js';\nimport testutilStyles from '../test-classes/styles.css.js';\n\n/**\n * The Drawers root component is mounted in the AppLayout index file. It will only\n * render if the drawers are defined, and it will take over the mounting of and\n * rendering of the Tools and SplitPanel (side position) if they exist. If drawers\n * do not exist then the Tools and SplitPanel will be handled by the Tools component.\n */\nexport default function Drawers() {\n const { disableBodyScroll, drawers, hasDrawerViewportOverlay, hasOpenDrawer, isNavigationOpen, navigationHide } =\n useAppLayoutInternals();\n\n const isUnfocusable = hasDrawerViewportOverlay && isNavigationOpen && !navigationHide;\n\n if (!drawers) {\n return null;\n }\n\n return (\n <div\n className={clsx(styles['drawers-container'], {\n [styles['disable-body-scroll']]: disableBodyScroll,\n [styles['has-open-drawer']]: hasOpenDrawer,\n [styles.unfocusable]: isUnfocusable,\n })}\n >\n <SplitPanel.Side />\n <ActiveDrawer />\n <DesktopTriggers />\n </div>\n );\n}\n\n/**\n * The ActiveDrawer component will render either the drawer content that corresponds\n * to the activeDrawerId or the Tools content if it exists and isToolsOpen is true.\n * The aria labels, click handling, and focus handling will be updated dynamically\n * based on the active drawer or tools content.\n */\nfunction ActiveDrawer() {\n const {\n activeDrawerId,\n ariaLabels,\n drawers,\n drawersRefs,\n handleDrawersClick,\n handleToolsClick,\n hasDrawerViewportOverlay,\n isMobile,\n isNavigationOpen,\n isToolsOpen,\n navigationHide,\n tools,\n toolsRefs,\n loseDrawersFocus,\n resizeHandle,\n drawerSize,\n drawersMaxWidth,\n drawerRef,\n } = useAppLayoutInternals();\n\n const activeDrawer = drawers?.items.find((item: any) => item.id === activeDrawerId) ?? null;\n\n const computedAriaLabels = {\n closeButton: activeDrawerId ? activeDrawer?.ariaLabels?.closeButton : ariaLabels?.toolsClose,\n content: activeDrawerId ? activeDrawer?.ariaLabels?.content : ariaLabels?.tools,\n };\n\n const isHidden = !activeDrawerId && !isToolsOpen;\n const isUnfocusable = isHidden || (hasDrawerViewportOverlay && isNavigationOpen && !navigationHide);\n\n const size = Math.min(drawersMaxWidth, drawerSize);\n\n return (\n <aside\n aria-hidden={isHidden}\n aria-label={computedAriaLabels.content}\n className={clsx(styles.drawer, sharedStyles['with-motion'], {\n [styles['is-drawer-open']]: activeDrawerId || isToolsOpen,\n [styles.unfocusable]: isUnfocusable,\n [testutilStyles['active-drawer']]: activeDrawerId,\n [testutilStyles.tools]: isToolsOpen,\n })}\n style={{\n ...(!isMobile && drawerSize && { [customCssProps.drawerSize]: `${size}px` }),\n }}\n ref={drawerRef}\n onBlur={e => {\n if (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget)) {\n loseDrawersFocus();\n }\n }}\n >\n {!isMobile && activeDrawer?.resizable && resizeHandle}\n <div className={clsx(styles['drawer-close-button'])}>\n <InternalButton\n ariaLabel={computedAriaLabels.closeButton}\n className={clsx({\n [testutilStyles['active-drawer-close-button']]: activeDrawerId,\n [testutilStyles['tools-close']]: isToolsOpen,\n })}\n formAction=\"none\"\n iconName={isMobile ? 'close' : 'angle-right'}\n onClick={() => (activeDrawerId ? handleDrawersClick(activeDrawerId ?? null) : handleToolsClick(false))}\n ref={isToolsOpen ? toolsRefs.close : drawersRefs.close}\n variant=\"icon\"\n />\n </div>\n\n <div className={styles['drawer-content']}>\n {activeDrawerId && activeDrawer?.content}\n {isToolsOpen && tools}\n </div>\n </aside>\n );\n}\n\n/**\n * The DesktopTriggers will render the trigger buttons for Tools, Drawers, and the\n * SplitPanel in non mobile viewports. Changes to the activeDrawerId need to be\n * tracked by the previousActiveDrawerId property in order to appropriately apply\n * the ref required to manage focus control.\n */\nfunction DesktopTriggers() {\n const {\n activeDrawerId,\n ariaLabels,\n drawers,\n drawersRefs,\n drawersTriggerCount,\n handleDrawersClick,\n handleSplitPanelClick,\n handleToolsClick,\n hasOpenDrawer,\n isMobile,\n isSplitPanelOpen,\n isToolsOpen,\n splitPanel,\n splitPanelDisplayed,\n splitPanelPosition,\n splitPanelRefs,\n splitPanelToggle,\n tools,\n toolsHide,\n toolsRefs,\n } = useAppLayoutInternals();\n\n const hasMultipleTriggers = drawersTriggerCount > 1;\n const hasSplitPanel = splitPanel && splitPanelDisplayed && splitPanelPosition === 'side' ? true : false;\n const previousActiveDrawerId = useRef(activeDrawerId);\n\n if (activeDrawerId) {\n previousActiveDrawerId.current = activeDrawerId;\n }\n\n if (isMobile) {\n return null;\n }\n\n return (\n <aside\n className={clsx(\n styles['drawers-desktop-triggers-container'],\n testutilStyles['drawers-desktop-triggers-container'],\n {\n [styles['has-multiple-triggers']]: hasMultipleTriggers,\n [styles['has-open-drawer']]: hasOpenDrawer,\n }\n )}\n aria-label={drawers?.ariaLabel}\n >\n <div\n className={clsx(styles['drawers-trigger-content'], {\n [styles['has-multiple-triggers']]: hasMultipleTriggers,\n [styles['has-open-drawer']]: hasOpenDrawer,\n })}\n >\n {!toolsHide && tools && (\n <TriggerButton\n ariaLabel={ariaLabels?.toolsToggle}\n className={clsx(styles['drawers-trigger'], testutilStyles['tools-toggle'])}\n iconName=\"status-info\"\n onClick={() => {\n activeDrawerId && handleDrawersClick(null, true);\n handleToolsClick(!isToolsOpen);\n }}\n ref={toolsRefs.toggle}\n selected={isToolsOpen}\n />\n )}\n\n {drawers?.items.map(item => (\n <TriggerButton\n ariaLabel={item.ariaLabels?.triggerButton}\n className={clsx(styles['drawers-trigger'], testutilStyles['drawers-trigger'])}\n iconName={item.trigger.iconName}\n iconSvg={item.trigger.iconSvg}\n key={item.id}\n onClick={() => {\n isToolsOpen && handleToolsClick(!isToolsOpen, true);\n handleDrawersClick(item.id);\n }}\n ref={item.id === previousActiveDrawerId.current ? drawersRefs.toggle : undefined}\n selected={item.id === activeDrawerId}\n testId={`awsui-app-layout-trigger-${item.id}`}\n />\n ))}\n\n {hasSplitPanel && splitPanelToggle.displayed && (\n <TriggerButton\n ariaLabel={splitPanelToggle.ariaLabel}\n className={clsx(styles['drawers-trigger'], splitPanelStyles['open-button'])}\n iconName=\"view-vertical\"\n onClick={() => handleSplitPanelClick()}\n selected={hasSplitPanel && isSplitPanelOpen}\n ref={splitPanelRefs.toggle}\n />\n )}\n </div>\n </aside>\n );\n}\n\n/**\n * The MobileTriggers will be mounted inside of the AppBar component and\n * only rendered when Drawers are defined in mobile viewports. The same logic\n * will in the AppBar component will suppress the rendering of the legacy\n * trigger button for the Tools drawer.\n */\nexport function MobileTriggers() {\n const {\n activeDrawerId,\n ariaLabels,\n drawers,\n drawersRefs,\n handleDrawersClick,\n handleToolsClick,\n hasDrawerViewportOverlay,\n isMobile,\n isToolsOpen,\n tools,\n toolsHide,\n toolsRefs,\n } = useAppLayoutInternals();\n\n const previousActiveDrawerId = useRef(activeDrawerId);\n\n if (activeDrawerId) {\n previousActiveDrawerId.current = activeDrawerId;\n }\n\n if (!isMobile || !drawers) {\n return null;\n }\n\n return (\n <aside\n aria-hidden={hasDrawerViewportOverlay}\n className={clsx(\n styles['drawers-mobile-triggers-container'],\n testutilStyles['drawers-mobile-triggers-container'],\n {\n [styles.unfocusable]: hasDrawerViewportOverlay,\n }\n )}\n aria-label={drawers.ariaLabel}\n >\n {!toolsHide && tools && (\n <InternalButton\n ariaLabel={ariaLabels?.toolsToggle ?? undefined}\n ariaExpanded={isToolsOpen}\n className={testutilStyles['tools-toggle']}\n disabled={hasDrawerViewportOverlay}\n formAction=\"none\"\n iconName=\"status-info\"\n onClick={() => handleToolsClick(true)}\n ref={toolsRefs.toggle}\n variant=\"icon\"\n __nativeAttributes={{ 'aria-haspopup': true }}\n />\n )}\n\n {drawers.items.map(item => (\n <InternalButton\n ariaExpanded={item.id === activeDrawerId}\n ariaLabel={item.ariaLabels?.triggerButton}\n className={clsx(styles['drawers-trigger'], testutilStyles['drawers-trigger'])}\n disabled={hasDrawerViewportOverlay}\n formAction=\"none\"\n iconName={item.trigger.iconName}\n iconSvg={item.trigger.iconSvg}\n key={item.id}\n onClick={() => handleDrawersClick(item.id)}\n ref={item.id === previousActiveDrawerId.current ? drawersRefs.toggle : undefined}\n variant=\"icon\"\n __nativeAttributes={{ 'aria-haspopup': true, 'data-testid': `awsui-app-layout-trigger-${item.id}` }}\n />\n ))}\n </aside>\n );\n}\n"]}
1
+ {"version":3,"file":"drawers.js","sourceRoot":"lib/default/","sources":["app-layout/visual-refresh/drawers.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAA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AC,MAAM,CAAC,CAAC,CAAC,SAAS,EAChF,OAAO,EAAC,MAAM,EACd,kBAAkB,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,aAAa,EAAE,4BAA4B,IAAI,CAAC,EAAE,EAAE,EAAE,GACnG,CACH,CAAA;KAAA,CAAC,CACI,CACT,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport clsx from 'clsx';\nimport customCssProps from '../../internal/generated/custom-css-properties';\nimport { InternalButton } from '../../button/internal';\nimport SplitPanel from './split-panel';\nimport TriggerButton from './trigger-button';\nimport { useAppLayoutInternals } from './context';\nimport splitPanelStyles from '../../split-panel/styles.css.js';\nimport styles from './styles.css.js';\nimport sharedStyles from '../styles.css.js';\nimport testutilStyles from '../test-classes/styles.css.js';\n\n/**\n * The Drawers root component is mounted in the AppLayout index file. It will only\n * render if the drawers are defined, and it will take over the mounting of and\n * rendering of the Tools and SplitPanel (side position) if they exist. If drawers\n * do not exist then the Tools and SplitPanel will be handled by the Tools component.\n */\nexport default function Drawers() {\n const { disableBodyScroll, drawers, hasDrawerViewportOverlay, hasOpenDrawer, isNavigationOpen, navigationHide } =\n useAppLayoutInternals();\n\n const isUnfocusable = hasDrawerViewportOverlay && isNavigationOpen && !navigationHide;\n\n if (drawers.length === 0) {\n return null;\n }\n\n return (\n <div\n className={clsx(styles['drawers-container'], {\n [styles['disable-body-scroll']]: disableBodyScroll,\n [styles['has-open-drawer']]: hasOpenDrawer,\n [styles.unfocusable]: isUnfocusable,\n })}\n >\n <SplitPanel.Side />\n <ActiveDrawer />\n <DesktopTriggers />\n </div>\n );\n}\n\n/**\n * The ActiveDrawer component will render either the drawer content that corresponds\n * to the activeDrawerId or the Tools content if it exists and isToolsOpen is true.\n * The aria labels, click handling, and focus handling will be updated dynamically\n * based on the active drawer or tools content.\n */\nfunction ActiveDrawer() {\n const {\n activeDrawerId,\n ariaLabels,\n drawers,\n drawersRefs,\n handleDrawersClick,\n handleToolsClick,\n hasDrawerViewportOverlay,\n isMobile,\n isNavigationOpen,\n isToolsOpen,\n navigationHide,\n tools,\n toolsRefs,\n loseDrawersFocus,\n resizeHandle,\n drawerSize,\n drawersMaxWidth,\n drawerRef,\n } = useAppLayoutInternals();\n\n const activeDrawer = drawers.find(item => item.id === activeDrawerId) ?? null;\n\n const computedAriaLabels = {\n closeButton: activeDrawerId ? activeDrawer?.ariaLabels?.closeButton : ariaLabels?.toolsClose,\n content: activeDrawerId ? activeDrawer?.ariaLabels?.content : ariaLabels?.tools,\n };\n\n const isHidden = !activeDrawerId && !isToolsOpen;\n const isUnfocusable = isHidden || (hasDrawerViewportOverlay && isNavigationOpen && !navigationHide);\n\n const size = Math.min(drawersMaxWidth, drawerSize);\n\n return (\n <aside\n aria-hidden={isHidden}\n aria-label={computedAriaLabels.content}\n className={clsx(styles.drawer, sharedStyles['with-motion'], {\n [styles['is-drawer-open']]: activeDrawerId || isToolsOpen,\n [styles.unfocusable]: isUnfocusable,\n [testutilStyles['active-drawer']]: activeDrawerId,\n [testutilStyles.tools]: isToolsOpen,\n })}\n style={{\n ...(!isMobile && drawerSize && { [customCssProps.drawerSize]: `${size}px` }),\n }}\n ref={drawerRef}\n onBlur={e => {\n if (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget)) {\n loseDrawersFocus();\n }\n }}\n >\n {!isMobile && activeDrawer?.resizable && resizeHandle}\n <div className={clsx(styles['drawer-close-button'])}>\n <InternalButton\n ariaLabel={computedAriaLabels.closeButton}\n className={clsx({\n [testutilStyles['active-drawer-close-button']]: activeDrawerId,\n [testutilStyles['tools-close']]: isToolsOpen,\n })}\n formAction=\"none\"\n iconName={isMobile ? 'close' : 'angle-right'}\n onClick={() => (activeDrawerId ? handleDrawersClick(activeDrawerId ?? null) : handleToolsClick(false))}\n ref={isToolsOpen ? toolsRefs.close : drawersRefs.close}\n variant=\"icon\"\n />\n </div>\n\n <div className={styles['drawer-content']}>\n {activeDrawerId && activeDrawer?.content}\n {isToolsOpen && tools}\n </div>\n </aside>\n );\n}\n\n/**\n * The DesktopTriggers will render the trigger buttons for Tools, Drawers, and the\n * SplitPanel in non mobile viewports. Changes to the activeDrawerId need to be\n * tracked by the previousActiveDrawerId property in order to appropriately apply\n * the ref required to manage focus control.\n */\nfunction DesktopTriggers() {\n const {\n activeDrawerId,\n drawers,\n drawersAriaLabel,\n drawersRefs,\n drawersTriggerCount,\n handleDrawersClick,\n handleSplitPanelClick,\n handleToolsClick,\n hasOpenDrawer,\n isMobile,\n isSplitPanelOpen,\n isToolsOpen,\n splitPanel,\n splitPanelDisplayed,\n splitPanelPosition,\n splitPanelRefs,\n splitPanelToggle,\n } = useAppLayoutInternals();\n\n const hasMultipleTriggers = drawersTriggerCount > 1;\n const hasSplitPanel = splitPanel && splitPanelDisplayed && splitPanelPosition === 'side' ? true : false;\n const previousActiveDrawerId = useRef(activeDrawerId);\n\n if (activeDrawerId) {\n previousActiveDrawerId.current = activeDrawerId;\n }\n\n if (isMobile) {\n return null;\n }\n\n return (\n <aside\n className={clsx(\n styles['drawers-desktop-triggers-container'],\n testutilStyles['drawers-desktop-triggers-container'],\n {\n [styles['has-multiple-triggers']]: hasMultipleTriggers,\n [styles['has-open-drawer']]: hasOpenDrawer,\n }\n )}\n aria-label={drawersAriaLabel}\n >\n <div\n className={clsx(styles['drawers-trigger-content'], {\n [styles['has-multiple-triggers']]: hasMultipleTriggers,\n [styles['has-open-drawer']]: hasOpenDrawer,\n })}\n >\n {drawers.map(item => (\n <TriggerButton\n ariaLabel={item.ariaLabels?.triggerButton}\n className={clsx(styles['drawers-trigger'], testutilStyles['drawers-trigger'])}\n iconName={item.trigger.iconName}\n iconSvg={item.trigger.iconSvg}\n key={item.id}\n onClick={() => {\n isToolsOpen && handleToolsClick(!isToolsOpen, true);\n handleDrawersClick(item.id);\n }}\n ref={item.id === previousActiveDrawerId.current ? drawersRefs.toggle : undefined}\n selected={item.id === activeDrawerId}\n testId={`awsui-app-layout-trigger-${item.id}`}\n />\n ))}\n\n {hasSplitPanel && splitPanelToggle.displayed && (\n <TriggerButton\n ariaLabel={splitPanelToggle.ariaLabel}\n className={clsx(styles['drawers-trigger'], splitPanelStyles['open-button'])}\n iconName=\"view-vertical\"\n onClick={() => handleSplitPanelClick()}\n selected={hasSplitPanel && isSplitPanelOpen}\n ref={splitPanelRefs.toggle}\n />\n )}\n </div>\n </aside>\n );\n}\n\n/**\n * The MobileTriggers will be mounted inside of the AppBar component and\n * only rendered when Drawers are defined in mobile viewports. The same logic\n * will in the AppBar component will suppress the rendering of the legacy\n * trigger button for the Tools drawer.\n */\nexport function MobileTriggers() {\n const {\n activeDrawerId,\n drawers,\n drawersAriaLabel,\n drawersRefs,\n handleDrawersClick,\n hasDrawerViewportOverlay,\n isMobile,\n } = useAppLayoutInternals();\n\n const previousActiveDrawerId = useRef(activeDrawerId);\n\n if (activeDrawerId) {\n previousActiveDrawerId.current = activeDrawerId;\n }\n\n if (!isMobile || drawers.length === 0) {\n return null;\n }\n\n return (\n <aside\n aria-hidden={hasDrawerViewportOverlay}\n className={clsx(\n styles['drawers-mobile-triggers-container'],\n testutilStyles['drawers-mobile-triggers-container'],\n {\n [styles.unfocusable]: hasDrawerViewportOverlay,\n }\n )}\n aria-label={drawersAriaLabel}\n >\n {drawers.map(item => (\n <InternalButton\n ariaExpanded={item.id === activeDrawerId}\n ariaLabel={item.ariaLabels?.triggerButton}\n className={clsx(styles['drawers-trigger'], testutilStyles['drawers-trigger'])}\n disabled={hasDrawerViewportOverlay}\n formAction=\"none\"\n iconName={item.trigger.iconName}\n iconSvg={item.trigger.iconSvg}\n key={item.id}\n onClick={() => handleDrawersClick(item.id)}\n ref={item.id === previousActiveDrawerId.current ? drawersRefs.toggle : undefined}\n variant=\"icon\"\n __nativeAttributes={{ 'aria-haspopup': true, 'data-testid': `awsui-app-layout-trigger-${item.id}` }}\n />\n ))}\n </aside>\n );\n}\n"]}
@@ -10,7 +10,7 @@ import testutilStyles from '../test-classes/styles.css.js';
10
10
  export default function MobileToolbar() {
11
11
  var _a, _b, _c;
12
12
  const { ariaLabels, breadcrumbs, drawers, handleNavigationClick, handleToolsClick, hasDrawerViewportOverlay, isMobile, isNavigationOpen, isToolsOpen, navigationHide, navigationRefs, toolsHide, toolsRefs, } = useAppLayoutInternals();
13
- if (!isMobile || (navigationHide && !breadcrumbs && toolsHide && !drawers)) {
13
+ if (!isMobile || (navigationHide && !breadcrumbs && toolsHide && drawers.length === 0)) {
14
14
  return null;
15
15
  }
16
16
  return (React.createElement("section", { className: clsx(styles['mobile-toolbar'], {
@@ -21,7 +21,7 @@ export default function MobileToolbar() {
21
21
  !navigationHide && (React.createElement("nav", { "aria-hidden": isNavigationOpen, className: clsx(styles['mobile-toolbar-nav'], { [testutilStyles['drawer-closed']]: !isNavigationOpen }) },
22
22
  React.createElement(InternalButton, { ariaLabel: (_a = ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.navigationToggle) !== null && _a !== void 0 ? _a : undefined, ariaExpanded: isNavigationOpen ? undefined : false, iconName: "menu", formAction: "none", onClick: () => handleNavigationClick(true), variant: "icon", className: testutilStyles['navigation-toggle'], ref: navigationRefs.toggle, disabled: hasDrawerViewportOverlay, __nativeAttributes: { 'aria-haspopup': isNavigationOpen ? undefined : true } }))),
23
23
  breadcrumbs && (React.createElement("div", { className: clsx(styles['mobile-toolbar-breadcrumbs'], testutilStyles.breadcrumbs) }, breadcrumbs)),
24
- isMobile && !toolsHide && !drawers && (React.createElement("aside", { "aria-hidden": isToolsOpen, "aria-label": (_b = ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.tools) !== null && _b !== void 0 ? _b : undefined, className: clsx(styles['mobile-toolbar-tools'], { [testutilStyles['drawer-closed']]: !isToolsOpen }) },
24
+ isMobile && !toolsHide && drawers.length === 0 && (React.createElement("aside", { "aria-hidden": isToolsOpen, "aria-label": (_b = ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.tools) !== null && _b !== void 0 ? _b : undefined, className: clsx(styles['mobile-toolbar-tools'], { [testutilStyles['drawer-closed']]: !isToolsOpen }) },
25
25
  React.createElement(InternalButton, { className: testutilStyles['tools-toggle'], ariaExpanded: isToolsOpen, disabled: hasDrawerViewportOverlay, ariaLabel: (_c = ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.toolsToggle) !== null && _c !== void 0 ? _c : undefined, iconName: "status-info", formAction: "none", onClick: () => handleToolsClick(true), variant: "icon", ref: toolsRefs.toggle, __nativeAttributes: { 'aria-haspopup': true } }))),
26
26
  React.createElement(DrawersMobileTriggers, null)));
27
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"mobile-toolbar.js","sourceRoot":"lib/default/","sources":["app-layout/visual-refresh/mobile-toolbar.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,cAAc,IAAI,qBAAqB,EAAE,MAAM,WAAW,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,cAAc,MAAM,+BAA+B,CAAC;AAE3D,MAAM,CAAC,OAAO,UAAU,aAAa;;IACnC,MAAM,EACJ,UAAU,EACV,WAAW,EACX,OAAO,EACP,qBAAqB,EACrB,gBAAgB,EAChB,wBAAwB,EACxB,QAAQ,EACR,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,cAAc,EACd,SAAS,EACT,SAAS,GACV,GAAG,qBAAqB,EAAE,CAAC;IAE5B,IAAI,CAAC,QAAQ,IAAI,CAAC,cAAc,IAAI,CAAC,WAAW,IAAI,SAAS,IAAI,CAAC,OAAO,CAAC,EAAE;QAC1E,OAAO,IAAI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ACe,WAAW,gBACZ,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,mCAAI,SAAS,EAC1C,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,sBAAsB,CAAC,EAAE,EAAE,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC;YAEpG,oBAAC,cAAc,IACb,SAAS,EAAE,cAAc,CAAC,cAAc,CAAC,EACzC,YAAY,EAAE,WAAW,EACzB,QAAQ,EAAE,wBAAwB,EAClC,SAAS,EAAE,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,WAAW,mCAAI,SAAS,EAC/C,QAAQ,EAAC,aAAa,EACtB,UAAU,EAAC,MAAM,EACjB,OAAO,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,EACrC,OAAO,EAAC,MAAM,EACd,GAAG,EAAE,SAAS,CAAC,MAAM,EACrB,kBAAkB,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,GAC7C,CACI,CACT;QAED,oBAAC,qBAAqB,OAAG,CACjB,CACX,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\nimport { InternalButton } from '../../button/internal';\nimport { MobileTriggers as DrawersMobileTriggers } from './drawers';\nimport { useAppLayoutInternals } from './context';\nimport styles from './styles.css.js';\nimport testutilStyles from '../test-classes/styles.css.js';\n\nexport default function MobileToolbar() {\n const {\n ariaLabels,\n breadcrumbs,\n drawers,\n handleNavigationClick,\n handleToolsClick,\n hasDrawerViewportOverlay,\n isMobile,\n isNavigationOpen,\n isToolsOpen,\n navigationHide,\n navigationRefs,\n toolsHide,\n toolsRefs,\n } = useAppLayoutInternals();\n\n if (!isMobile || (navigationHide && !breadcrumbs && toolsHide && !drawers)) {\n return null;\n }\n\n return (\n <section\n className={clsx(\n styles['mobile-toolbar'],\n {\n [styles['has-breadcrumbs']]: breadcrumbs,\n [styles.unfocusable]: hasDrawerViewportOverlay,\n [testutilStyles['mobile-bar']]: isMobile,\n },\n testutilStyles['mobile-bar'],\n 'awsui-context-content-header'\n )}\n >\n {!navigationHide && (\n <nav\n aria-hidden={isNavigationOpen}\n className={clsx(styles['mobile-toolbar-nav'], { [testutilStyles['drawer-closed']]: !isNavigationOpen })}\n >\n <InternalButton\n ariaLabel={ariaLabels?.navigationToggle ?? undefined}\n ariaExpanded={isNavigationOpen ? undefined : false}\n iconName=\"menu\"\n formAction=\"none\"\n onClick={() => handleNavigationClick(true)}\n variant=\"icon\"\n className={testutilStyles['navigation-toggle']}\n ref={navigationRefs.toggle}\n disabled={hasDrawerViewportOverlay}\n __nativeAttributes={{ 'aria-haspopup': isNavigationOpen ? undefined : true }}\n />\n </nav>\n )}\n\n {breadcrumbs && (\n <div className={clsx(styles['mobile-toolbar-breadcrumbs'], testutilStyles.breadcrumbs)}>{breadcrumbs}</div>\n )}\n\n {isMobile && !toolsHide && !drawers && (\n <aside\n aria-hidden={isToolsOpen}\n aria-label={ariaLabels?.tools ?? undefined}\n className={clsx(styles['mobile-toolbar-tools'], { [testutilStyles['drawer-closed']]: !isToolsOpen })}\n >\n <InternalButton\n className={testutilStyles['tools-toggle']}\n ariaExpanded={isToolsOpen}\n disabled={hasDrawerViewportOverlay}\n ariaLabel={ariaLabels?.toolsToggle ?? undefined}\n iconName=\"status-info\"\n formAction=\"none\"\n onClick={() => handleToolsClick(true)}\n variant=\"icon\"\n ref={toolsRefs.toggle}\n __nativeAttributes={{ 'aria-haspopup': true }}\n />\n </aside>\n )}\n\n <DrawersMobileTriggers />\n </section>\n );\n}\n"]}
1
+ {"version":3,"file":"mobile-toolbar.js","sourceRoot":"lib/default/","sources":["app-layout/visual-refresh/mobile-toolbar.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,I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AC,MAAM,EACrB,kBAAkB,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,GAC7C,CACI,CACT;QAED,oBAAC,qBAAqB,OAAG,CACjB,CACX,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\nimport { InternalButton } from '../../button/internal';\nimport { MobileTriggers as DrawersMobileTriggers } from './drawers';\nimport { useAppLayoutInternals } from './context';\nimport styles from './styles.css.js';\nimport testutilStyles from '../test-classes/styles.css.js';\n\nexport default function MobileToolbar() {\n const {\n ariaLabels,\n breadcrumbs,\n drawers,\n handleNavigationClick,\n handleToolsClick,\n hasDrawerViewportOverlay,\n isMobile,\n isNavigationOpen,\n isToolsOpen,\n navigationHide,\n navigationRefs,\n toolsHide,\n toolsRefs,\n } = useAppLayoutInternals();\n\n if (!isMobile || (navigationHide && !breadcrumbs && toolsHide && drawers.length === 0)) {\n return null;\n }\n\n return (\n <section\n className={clsx(\n styles['mobile-toolbar'],\n {\n [styles['has-breadcrumbs']]: breadcrumbs,\n [styles.unfocusable]: hasDrawerViewportOverlay,\n [testutilStyles['mobile-bar']]: isMobile,\n },\n testutilStyles['mobile-bar'],\n 'awsui-context-content-header'\n )}\n >\n {!navigationHide && (\n <nav\n aria-hidden={isNavigationOpen}\n className={clsx(styles['mobile-toolbar-nav'], { [testutilStyles['drawer-closed']]: !isNavigationOpen })}\n >\n <InternalButton\n ariaLabel={ariaLabels?.navigationToggle ?? undefined}\n ariaExpanded={isNavigationOpen ? undefined : false}\n iconName=\"menu\"\n formAction=\"none\"\n onClick={() => handleNavigationClick(true)}\n variant=\"icon\"\n className={testutilStyles['navigation-toggle']}\n ref={navigationRefs.toggle}\n disabled={hasDrawerViewportOverlay}\n __nativeAttributes={{ 'aria-haspopup': isNavigationOpen ? undefined : true }}\n />\n </nav>\n )}\n\n {breadcrumbs && (\n <div className={clsx(styles['mobile-toolbar-breadcrumbs'], testutilStyles.breadcrumbs)}>{breadcrumbs}</div>\n )}\n\n {isMobile && !toolsHide && drawers.length === 0 && (\n <aside\n aria-hidden={isToolsOpen}\n aria-label={ariaLabels?.tools ?? undefined}\n className={clsx(styles['mobile-toolbar-tools'], { [testutilStyles['drawer-closed']]: !isToolsOpen })}\n >\n <InternalButton\n className={testutilStyles['tools-toggle']}\n ariaExpanded={isToolsOpen}\n disabled={hasDrawerViewportOverlay}\n ariaLabel={ariaLabels?.toolsToggle ?? undefined}\n iconName=\"status-info\"\n formAction=\"none\"\n onClick={() => handleToolsClick(true)}\n variant=\"icon\"\n ref={toolsRefs.toggle}\n __nativeAttributes={{ 'aria-haspopup': true }}\n />\n </aside>\n )}\n\n <DrawersMobileTriggers />\n </section>\n );\n}\n"]}
@@ -80,7 +80,7 @@ function SplitPanelSide() {
80
80
  }), ref: transitionEventsRef, style: {
81
81
  [customCssProps.splitPanelMaxWidth]: `${splitPanelMaxWidth}px`,
82
82
  [customCssProps.splitPanelMinWidth]: `${splitPanelMinWidth}px`,
83
- [customCssProps.splitPanelReportedHeaderSize]: `${splitPanelReportedSize}px`,
83
+ [customCssProps.splitPanelReportedSize]: `${splitPanelReportedSize}px`,
84
84
  } },
85
85
  React.createElement("div", { className: clsx(styles['animated-content']) }, splitPanelPosition === 'side' && splitPanel)))));
86
86
  }
@@ -1 +1 @@
1
- {"version":3,"file":"split-panel.js","sourceRoot":"lib/default/","sources":["app-layout/visual-refresh/split-panel.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,yBAAyB,EAA0B,MAAM,4CAA4C,CAAC;AAC/G,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,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AC;KAC7B;IAED,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AACD,UAAU,CAAC,MAAM,GAAG,gBAAgB,CAAC;AACrC,UAAU,CAAC,IAAI,GAAG,cAAc,CAAC;AAEjC,eAAe,UAAU,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\nimport { useAppLayoutInternals } from './context';\nimport { SplitPanelContextProvider, SplitPanelContextProps } from '../../internal/context/split-panel-context';\nimport styles from './styles.css.js';\nimport { AppLayoutProps } from '../interfaces';\nimport { Transition } from '../../internal/components/transition';\nimport customCssProps from '../../internal/generated/custom-css-properties';\n\n/**\n * If there is no Split Panel in the AppLayout context then the SplitPanel\n * will pass through the AppLayout children without the context.\n */\nfunction SplitPanel({ children }: React.PropsWithChildren<unknown>) {\n const {\n footerHeight,\n handleSplitPanelClick,\n handleSplitPanelPreferencesChange,\n handleSplitPanelResize,\n headerHeight,\n isMobile,\n isSplitPanelForcedPosition,\n isSplitPanelOpen,\n setSplitPanelReportedSize,\n setSplitPanelReportedHeaderHeight,\n setSplitPanelToggle,\n splitPanelPosition,\n splitPanelRefs,\n splitPanelSize,\n } = useAppLayoutInternals();\n\n const context: SplitPanelContextProps = {\n bottomOffset: 0,\n getMaxHeight: () => {\n const availableHeight = document.documentElement.clientHeight - headerHeight - footerHeight;\n // If the page is likely zoomed in at 200%, allow the split panel to fill the content area.\n return availableHeight < 400 ? availableHeight - 40 : availableHeight - 250;\n },\n getMaxWidth: () => document.documentElement.clientWidth,\n isForcedPosition: isSplitPanelForcedPosition,\n isMobile,\n isOpen: isSplitPanelOpen,\n leftOffset: 0,\n onPreferencesChange: handleSplitPanelPreferencesChange,\n onResize: handleSplitPanelResize,\n onToggle: handleSplitPanelClick,\n position: splitPanelPosition,\n reportSize: setSplitPanelReportedSize,\n reportHeaderHeight: setSplitPanelReportedHeaderHeight,\n rightOffset: 0,\n size: splitPanelSize || 0,\n topOffset: 0,\n setSplitPanelToggle,\n refs: splitPanelRefs,\n };\n\n return <SplitPanelContextProvider value={context}>{children}</SplitPanelContextProvider>;\n}\n\n/**\n * This is the render function for the SplitPanel when it is in bottom position.\n * The Split Panel container will be another row entry in the grid definition in\n * the Layout component. The start and finish columns will be variable based\n * on the presence and state of the Navigation and Tools components.\n */\nfunction SplitPanelBottom() {\n const {\n disableBodyScroll,\n hasOpenDrawer,\n isNavigationOpen,\n isSplitPanelOpen,\n splitPanel,\n splitPanelPosition,\n splitPanelReportedSize,\n splitPanelReportedHeaderHeight,\n } = useAppLayoutInternals();\n\n if (!splitPanel) {\n return null;\n }\n\n return (\n <Transition in={isSplitPanelOpen ?? false} exit={false}>\n {(state, transitionEventsRef) => (\n <section\n className={clsx(styles['split-panel-bottom'], styles[`position-${splitPanelPosition}`], {\n [styles.animating]: state === 'entering',\n [styles['disable-body-scroll']]: disableBodyScroll,\n [styles['has-open-drawer']]: hasOpenDrawer,\n [styles['is-navigation-open']]: isNavigationOpen,\n [styles['is-split-panel-open']]: isSplitPanelOpen,\n })}\n ref={transitionEventsRef}\n style={{\n [customCssProps.splitPanelReportedSize]: `${splitPanelReportedSize}px`,\n [customCssProps.splitPanelReportedHeaderSize]: `${splitPanelReportedHeaderHeight}px`,\n }}\n >\n <SplitPanel></SplitPanel>\n {splitPanelPosition === 'bottom' && splitPanel}\n </section>\n )}\n </Transition>\n );\n}\n\n/**\n * This is the render function for the SplitPanel when it is side position.\n * The Split Panel will not be within the grid defined in the Layout component\n * but instead a direct child of the Tools component. The width constraints\n * for this position are computed in the Tools component.\n */\nfunction SplitPanelSide() {\n const {\n isSplitPanelOpen,\n splitPanel,\n splitPanelPosition,\n splitPanelMaxWidth,\n splitPanelMinWidth,\n splitPanelReportedSize,\n } = useAppLayoutInternals();\n\n if (!splitPanel) {\n return null;\n }\n\n return (\n <Transition in={isSplitPanelOpen ?? false} exit={false}>\n {(state, transitionEventsRef) => (\n <section\n aria-hidden={!isSplitPanelOpen || splitPanelPosition === 'bottom' ? true : false}\n className={clsx(styles['split-panel-side'], styles[`position-${splitPanelPosition}`], {\n [styles.animating]: state === 'entering',\n [styles['is-split-panel-open']]: isSplitPanelOpen,\n })}\n ref={transitionEventsRef}\n style={{\n [customCssProps.splitPanelMaxWidth]: `${splitPanelMaxWidth}px`,\n [customCssProps.splitPanelMinWidth]: `${splitPanelMinWidth}px`,\n [customCssProps.splitPanelReportedHeaderSize]: `${splitPanelReportedSize}px`,\n }}\n >\n <div className={clsx(styles['animated-content'])}>{splitPanelPosition === 'side' && splitPanel}</div>\n </section>\n )}\n </Transition>\n );\n}\n\n/**\n * This logic will determine what the Split Panel position should be. It reconciles the possibility\n * of being in forced position with the current selected position in the settings.\n */\nexport function getSplitPanelPosition(\n isSplitPanelForcedPosition: boolean,\n splitPanelPreferences: AppLayoutProps.SplitPanelPreferences | undefined\n) {\n let splitPanelPosition: AppLayoutProps.SplitPanelPosition = 'bottom';\n\n if (!isSplitPanelForcedPosition && splitPanelPreferences?.position === 'side') {\n splitPanelPosition = 'side';\n }\n\n return splitPanelPosition;\n}\nSplitPanel.Bottom = SplitPanelBottom;\nSplitPanel.Side = SplitPanelSide;\n\nexport default SplitPanel;\n"]}
1
+ {"version":3,"file":"split-panel.js","sourceRoot":"lib/default/","sources":["app-layout/visual-refresh/split-panel.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,yBAAyB,EAA0B,MAAM,4CAA4C,CAAC;AAC/G,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAClE,OAAO,cAAc,MAAM,gDAAgD,CAAC;AAE5E;;;GAGG;AACH,SAAS,UAAU,CAAC,E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,CAAC;AACrC,UAAU,CAAC,IAAI,GAAG,cAAc,CAAC;AAEjC,eAAe,UAAU,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\nimport { useAppLayoutInternals } from './context';\nimport { SplitPanelContextProvider, SplitPanelContextProps } from '../../internal/context/split-panel-context';\nimport styles from './styles.css.js';\nimport { AppLayoutProps } from '../interfaces';\nimport { Transition } from '../../internal/components/transition';\nimport customCssProps from '../../internal/generated/custom-css-properties';\n\n/**\n * If there is no Split Panel in the AppLayout context then the SplitPanel\n * will pass through the AppLayout children without the context.\n */\nfunction SplitPanel({ children }: React.PropsWithChildren<unknown>) {\n const {\n footerHeight,\n handleSplitPanelClick,\n handleSplitPanelPreferencesChange,\n handleSplitPanelResize,\n headerHeight,\n isMobile,\n isSplitPanelForcedPosition,\n isSplitPanelOpen,\n setSplitPanelReportedSize,\n setSplitPanelReportedHeaderHeight,\n setSplitPanelToggle,\n splitPanelPosition,\n splitPanelRefs,\n splitPanelSize,\n } = useAppLayoutInternals();\n\n const context: SplitPanelContextProps = {\n bottomOffset: 0,\n getMaxHeight: () => {\n const availableHeight = document.documentElement.clientHeight - headerHeight - footerHeight;\n // If the page is likely zoomed in at 200%, allow the split panel to fill the content area.\n return availableHeight < 400 ? availableHeight - 40 : availableHeight - 250;\n },\n getMaxWidth: () => document.documentElement.clientWidth,\n isForcedPosition: isSplitPanelForcedPosition,\n isMobile,\n isOpen: isSplitPanelOpen,\n leftOffset: 0,\n onPreferencesChange: handleSplitPanelPreferencesChange,\n onResize: handleSplitPanelResize,\n onToggle: handleSplitPanelClick,\n position: splitPanelPosition,\n reportSize: setSplitPanelReportedSize,\n reportHeaderHeight: setSplitPanelReportedHeaderHeight,\n rightOffset: 0,\n size: splitPanelSize || 0,\n topOffset: 0,\n setSplitPanelToggle,\n refs: splitPanelRefs,\n };\n\n return <SplitPanelContextProvider value={context}>{children}</SplitPanelContextProvider>;\n}\n\n/**\n * This is the render function for the SplitPanel when it is in bottom position.\n * The Split Panel container will be another row entry in the grid definition in\n * the Layout component. The start and finish columns will be variable based\n * on the presence and state of the Navigation and Tools components.\n */\nfunction SplitPanelBottom() {\n const {\n disableBodyScroll,\n hasOpenDrawer,\n isNavigationOpen,\n isSplitPanelOpen,\n splitPanel,\n splitPanelPosition,\n splitPanelReportedSize,\n splitPanelReportedHeaderHeight,\n } = useAppLayoutInternals();\n\n if (!splitPanel) {\n return null;\n }\n\n return (\n <Transition in={isSplitPanelOpen ?? false} exit={false}>\n {(state, transitionEventsRef) => (\n <section\n className={clsx(styles['split-panel-bottom'], styles[`position-${splitPanelPosition}`], {\n [styles.animating]: state === 'entering',\n [styles['disable-body-scroll']]: disableBodyScroll,\n [styles['has-open-drawer']]: hasOpenDrawer,\n [styles['is-navigation-open']]: isNavigationOpen,\n [styles['is-split-panel-open']]: isSplitPanelOpen,\n })}\n ref={transitionEventsRef}\n style={{\n [customCssProps.splitPanelReportedSize]: `${splitPanelReportedSize}px`,\n [customCssProps.splitPanelReportedHeaderSize]: `${splitPanelReportedHeaderHeight}px`,\n }}\n >\n <SplitPanel></SplitPanel>\n {splitPanelPosition === 'bottom' && splitPanel}\n </section>\n )}\n </Transition>\n );\n}\n\n/**\n * This is the render function for the SplitPanel when it is side position.\n * The Split Panel will not be within the grid defined in the Layout component\n * but instead a direct child of the Tools component. The width constraints\n * for this position are computed in the Tools component.\n */\nfunction SplitPanelSide() {\n const {\n isSplitPanelOpen,\n splitPanel,\n splitPanelPosition,\n splitPanelMaxWidth,\n splitPanelMinWidth,\n splitPanelReportedSize,\n } = useAppLayoutInternals();\n\n if (!splitPanel) {\n return null;\n }\n\n return (\n <Transition in={isSplitPanelOpen ?? false} exit={false}>\n {(state, transitionEventsRef) => (\n <section\n aria-hidden={!isSplitPanelOpen || splitPanelPosition === 'bottom' ? true : false}\n className={clsx(styles['split-panel-side'], styles[`position-${splitPanelPosition}`], {\n [styles.animating]: state === 'entering',\n [styles['is-split-panel-open']]: isSplitPanelOpen,\n })}\n ref={transitionEventsRef}\n style={{\n [customCssProps.splitPanelMaxWidth]: `${splitPanelMaxWidth}px`,\n [customCssProps.splitPanelMinWidth]: `${splitPanelMinWidth}px`,\n [customCssProps.splitPanelReportedSize]: `${splitPanelReportedSize}px`,\n }}\n >\n <div className={clsx(styles['animated-content'])}>{splitPanelPosition === 'side' && splitPanel}</div>\n </section>\n )}\n </Transition>\n );\n}\n\n/**\n * This logic will determine what the Split Panel position should be. It reconciles the possibility\n * of being in forced position with the current selected position in the settings.\n */\nexport function getSplitPanelPosition(\n isSplitPanelForcedPosition: boolean,\n splitPanelPreferences: AppLayoutProps.SplitPanelPreferences | undefined\n) {\n let splitPanelPosition: AppLayoutProps.SplitPanelPosition = 'bottom';\n\n if (!isSplitPanelForcedPosition && splitPanelPreferences?.position === 'side') {\n splitPanelPosition = 'side';\n }\n\n return splitPanelPosition;\n}\nSplitPanel.Bottom = SplitPanelBottom;\nSplitPanel.Side = SplitPanelSide;\n\nexport default SplitPanel;\n"]}