@cloudscape-design/components-themeable 3.0.617 → 3.0.618

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 (54) hide show
  1. package/lib/internal/manifest.json +1 -1
  2. package/lib/internal/scss/app-layout/visual-refresh/navigation.scss +0 -5
  3. package/lib/internal/scss/app-layout/visual-refresh/tools.scss +0 -5
  4. package/lib/internal/template/app-layout/classic.d.ts +5 -0
  5. package/lib/internal/template/app-layout/classic.d.ts.map +1 -1
  6. package/lib/internal/template/app-layout/classic.js +10 -18
  7. package/lib/internal/template/app-layout/classic.js.map +1 -1
  8. package/lib/internal/template/app-layout/defaults.d.ts +0 -1
  9. package/lib/internal/template/app-layout/defaults.d.ts.map +1 -1
  10. package/lib/internal/template/app-layout/defaults.js +1 -2
  11. package/lib/internal/template/app-layout/defaults.js.map +1 -1
  12. package/lib/internal/template/app-layout/implementation.d.ts +5 -0
  13. package/lib/internal/template/app-layout/implementation.d.ts.map +1 -1
  14. package/lib/internal/template/app-layout/index.d.ts.map +1 -1
  15. package/lib/internal/template/app-layout/index.js +31 -6
  16. package/lib/internal/template/app-layout/index.js.map +1 -1
  17. package/lib/internal/template/app-layout/interfaces.d.ts +1 -1
  18. package/lib/internal/template/app-layout/interfaces.d.ts.map +1 -1
  19. package/lib/internal/template/app-layout/interfaces.js.map +1 -1
  20. package/lib/internal/template/app-layout/internal.d.ts +5 -0
  21. package/lib/internal/template/app-layout/internal.d.ts.map +1 -1
  22. package/lib/internal/template/app-layout/utils/use-resize.d.ts +2 -1
  23. package/lib/internal/template/app-layout/utils/use-resize.d.ts.map +1 -1
  24. package/lib/internal/template/app-layout/utils/use-resize.js +7 -9
  25. package/lib/internal/template/app-layout/utils/use-resize.js.map +1 -1
  26. package/lib/internal/template/app-layout/visual-refresh/context.d.ts +1 -4
  27. package/lib/internal/template/app-layout/visual-refresh/context.d.ts.map +1 -1
  28. package/lib/internal/template/app-layout/visual-refresh/context.js +28 -64
  29. package/lib/internal/template/app-layout/visual-refresh/context.js.map +1 -1
  30. package/lib/internal/template/app-layout/visual-refresh/drawers.js +4 -4
  31. package/lib/internal/template/app-layout/visual-refresh/drawers.js.map +1 -1
  32. package/lib/internal/template/app-layout/visual-refresh/index.d.ts +5 -0
  33. package/lib/internal/template/app-layout/visual-refresh/index.d.ts.map +1 -1
  34. package/lib/internal/template/app-layout/visual-refresh/layout.js +2 -2
  35. package/lib/internal/template/app-layout/visual-refresh/layout.js.map +1 -1
  36. package/lib/internal/template/app-layout/visual-refresh/main.js +2 -2
  37. package/lib/internal/template/app-layout/visual-refresh/main.js.map +1 -1
  38. package/lib/internal/template/app-layout/visual-refresh/mobile-toolbar.js +3 -3
  39. package/lib/internal/template/app-layout/visual-refresh/mobile-toolbar.js.map +1 -1
  40. package/lib/internal/template/app-layout/visual-refresh/navigation.d.ts.map +1 -1
  41. package/lib/internal/template/app-layout/visual-refresh/navigation.js +10 -12
  42. package/lib/internal/template/app-layout/visual-refresh/navigation.js.map +1 -1
  43. package/lib/internal/template/app-layout/visual-refresh/split-panel.d.ts.map +1 -1
  44. package/lib/internal/template/app-layout/visual-refresh/split-panel.js +5 -5
  45. package/lib/internal/template/app-layout/visual-refresh/split-panel.js.map +1 -1
  46. package/lib/internal/template/app-layout/visual-refresh/styles.css.js +81 -81
  47. package/lib/internal/template/app-layout/visual-refresh/styles.scoped.css +169 -181
  48. package/lib/internal/template/app-layout/visual-refresh/styles.selectors.js +81 -81
  49. package/lib/internal/template/app-layout/visual-refresh/tools.d.ts.map +1 -1
  50. package/lib/internal/template/app-layout/visual-refresh/tools.js +2 -3
  51. package/lib/internal/template/app-layout/visual-refresh/tools.js.map +1 -1
  52. package/lib/internal/template/internal/environment.js +1 -1
  53. package/lib/internal/template/internal/environment.json +1 -1
  54. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/app-layout/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { IconProps } from '../icon/interfaces';\nimport { SomeRequired } from '../internal/types';\n\nexport interface AppLayoutProps extends BaseComponentProps {\n /**\n * Determines the default behavior of the component based on some predefined page layouts.\n * Individual properties will always take precedence over the default coming from the content type.\n */\n contentType?: AppLayoutProps.ContentType;\n\n /**\n * Drawers property. If you set both `drawers` and `tools`, `drawers` will take precedence.\n \n * Each Drawer is an item in the drawers wrapper with the following properties:\n * * id (string) - the id of the drawer.\n * * content (React.ReactNode) - the content in the drawer.\n * * trigger (DrawerTrigger) - the button that opens and closes the active drawer. \n * * ariaLabels (DrawerAriaLabels) - the labels for the interactive elements of the drawer.\n * * badge (boolean) - Adds a badge to the corner of the icon to indicate a state change. For example: Unread notifications.\n * * resizable (boolean) - if the drawer is resizable or not.\n * * defaultSize (number) - starting size of the drawer. if not set, defaults to 290.\n * * onResize (({ size: number }) => void) - Fired when the active drawer is resized.\n * \n * #### DrawerTrigger\n * - `iconName` (IconProps.Name) - (Optional) Specifies the icon to be displayed.\n * - `iconSvg` (React.ReactNode) - (Optional) Specifies the SVG of a custom icon. For more information, see [SVG icon guidelines](/components/icon/?tabId=api#slots)\n *\n * #### DrawerAriaLabels\n * - `drawerName` (string) - Label for the drawer itself.\n * - `closeButton` (string) - (Optional) Label for the close button.\n * - `triggerButton` (string) - (Optional) Label for the trigger button.\n * - `resizeHandle` (string) - (Optional) Label for the resize handle.\n */\n drawers?: Array<AppLayoutProps.Drawer>;\n\n /**\n * The active drawer id. If you want to clear the active drawer, use `null`.\n */\n activeDrawerId?: string | null;\n\n /**\n * Fired when the active drawer is toggled.\n */\n onDrawerChange?: NonCancelableEventHandler<AppLayoutProps.DrawerChangeDetail>;\n\n /**\n * If `true`, disables outer paddings for the content slot.\n */\n disableContentPaddings?: boolean;\n\n /**\n * Activates a backwards-compatibility mode for applications with non-fixed headers and footers.\n * @deprecated This layout is being phased out and may miss some features.\n */\n disableBodyScroll?: boolean;\n\n /**\n * State of the navigation drawer.\n */\n navigationOpen?: boolean;\n\n /**\n * Navigation drawer width in pixels.\n */\n navigationWidth?: number;\n\n /**\n * If `true`, the navigation drawer is not displayed at all.\n */\n navigationHide?: boolean;\n\n /**\n * State of the tools drawer.\n */\n toolsOpen?: boolean;\n\n /**\n * If `true`, the tools drawer is not displayed at all.\n */\n toolsHide?: boolean;\n\n /**\n * Tools drawer width in pixels.\n */\n toolsWidth?: number;\n\n /**\n * Maximum main content panel width in pixels.\n *\n * If set to `Number.MAX_VALUE`, the main content panel will occupy the full available width.\n */\n maxContentWidth?: number;\n\n /**\n * Minimum main content panel width in pixels.\n */\n minContentWidth?: number;\n\n /**\n * If true, the notification slot is rendered above the scrollable\n * content area so it is always visible.\n */\n stickyNotifications?: boolean;\n\n /**\n * CSS selector for the application header.\n */\n headerSelector?: string;\n\n /**\n * CSS selector for the application footer.\n */\n footerSelector?: string;\n\n /**\n * Aria labels for the drawer operating buttons. Use this property to ensure accessibility.\n *\n * * `navigation` (string) - Label for the landmark that wraps the navigation drawer.\n * * `navigationClose` (string) - Label for the button that closes the navigation drawer.\n * * `navigationToggle` (string) - Label for the button that opens the navigation drawer.\n * * `notification` (string) - Label for the region that contains notification messages.\n * * `tools` (string) - Label for the landmark that wraps the tools drawer.\n * * `toolsClose` (string) - Label for the button that closes the tools drawer.\n * * `toolsToggle` (string) - Label for the button that opens the tools drawer.\n * * `drawers` (string) - Label for the landmark that wraps the active drawer.\n * * `drawersOverflow` (string) - Label for the ellipsis button with any overflow drawers.\n * * `drawersOverflowWithBadge` (string) - Label for the ellipsis button with any overflow drawers, with a badge.\n *\n * Example:\n * ```\n * {\n * navigation: \"Navigation drawer\",\n * navigationClose: \"Close navigation drawer\",\n * navigationToggle: \"Open navigation drawer\",\n * notifications: \"Notifications\",\n * tools: \"Help panel\",\n * toolsClose: \"Close help panel\",\n * toolsToggle: \"Open help panel\",\n * drawers: \"Drawers\",\n * drawersOverflow: \"Overflow drawers\",\n * drawersOverflowWithBadge: \"Overflow drawers (Unread notifications)\"\n * }\n * ```\n * @i18n\n */\n ariaLabels?: AppLayoutProps.Labels;\n\n /**\n * Navigation drawer.\n */\n navigation?: React.ReactNode;\n\n /**\n * Top area of the page content.\n * @deprecated Replaced by the `header` slot of the [content layout](/components/content-layout/) component.\n * @visualrefresh\n */\n contentHeader?: React.ReactNode;\n\n /**\n * Disables overlap between `contentHeader` and `content` slots.\n * @deprecated Replaced by the `disableOverlap` property of the [content layout](/components/content-layout/) component.\n * @visualrefresh\n */\n disableContentHeaderOverlap?: boolean;\n\n /**\n * Main content.\n */\n content?: React.ReactNode;\n\n /**\n * Tools drawer.\n */\n tools?: React.ReactNode;\n\n /**\n * Displayed on top of the main content in the scrollable area.\n *\n * Conceived to contain notifications (flash messages).\n */\n notifications?: React.ReactNode;\n\n /**\n * Use this slot to add the [breadcrumb group component](/components/breadcrumb-group/) to the app layout.\n */\n breadcrumbs?: React.ReactNode;\n\n /**\n * Fired when the navigation drawer is toggled.\n */\n onNavigationChange?: NonCancelableEventHandler<AppLayoutProps.ChangeDetail>;\n\n /**\n * Fired when the tools drawer is toggled.\n */\n onToolsChange?: NonCancelableEventHandler<AppLayoutProps.ChangeDetail>;\n\n /**\n * Use this slot to add the [split panel component](/components/split-panel/) to the app layout.\n *\n * Note: If provided, this property should be set to `null` or `undefined` if a split panel should not be rendered.\n */\n splitPanel?: React.ReactNode;\n\n /**\n * The size of the split panel in pixels.\n */\n splitPanelSize?: number;\n\n /**\n * State of the split panel.\n */\n splitPanelOpen?: boolean;\n /**\n * Controls the split panel preferences.\n *\n * By default, the preference is `{ position: 'bottom' }`\n */\n splitPanelPreferences?: AppLayoutProps.SplitPanelPreferences;\n /**\n * Fired when the split panel is resized.\n */\n onSplitPanelResize?: NonCancelableEventHandler<AppLayoutProps.SplitPanelResizeDetail>;\n /**\n * Fired when the split panel is toggled.\n */\n onSplitPanelToggle?: NonCancelableEventHandler<AppLayoutProps.ChangeDetail>;\n /**\n * Fired when the split panel preferences change.\n */\n onSplitPanelPreferencesChange?: NonCancelableEventHandler<AppLayoutProps.SplitPanelPreferences>;\n}\n\nexport namespace AppLayoutProps {\n export type ContentType = 'default' | 'form' | 'table' | 'cards' | 'wizard' | 'dashboard';\n\n export interface Ref {\n /**\n * Manually closes the navigation drawer if it is necessary for the current\n * viewport size.\n */\n closeNavigationIfNecessary(): void;\n\n /**\n * Opens the tools panel if it is not already open. Note that it is preferable\n * to control the state by listening to `toolsChange` and providing `toolsOpen`.\n */\n openTools(): void;\n\n /**\n * Focuses the tools panel if it is open. Use this to focus the tools panel\n * after changing the content, for example when clicking on an 'info' link while\n * the panel is already open.\n */\n focusToolsClose(): void;\n\n /**\n * Focuses the active drawer. Use this to focus the active drawer after opening it programmatically.\n */\n focusActiveDrawer(): void;\n\n /**\n * Focuses the split panel if it is open.\n */\n focusSplitPanel(): void;\n }\n\n export interface Drawer {\n id: string;\n content: React.ReactNode;\n trigger: {\n iconName?: IconProps.Name;\n iconSvg?: React.ReactNode;\n };\n ariaLabels: DrawerAriaLabels;\n badge?: boolean;\n resizable?: boolean;\n defaultSize?: number;\n onResize?: NonCancelableEventHandler<{ size: number }>;\n }\n\n export interface DrawerAriaLabels {\n drawerName: string;\n closeButton?: string;\n triggerButton?: string;\n resizeHandle?: string;\n }\n\n export interface Labels {\n notifications?: string;\n\n navigation?: string;\n navigationToggle?: string;\n navigationClose?: string;\n\n tools?: string;\n toolsToggle?: string;\n toolsClose?: string;\n\n drawers?: string;\n drawersOverflow?: string;\n drawersOverflowWithBadge?: string;\n }\n\n export interface ChangeDetail {\n open: boolean;\n }\n\n export interface SplitPanelResizeDetail {\n size: number;\n }\n\n export interface SplitPanelPreferences {\n position: 'side' | 'bottom';\n }\n // Duplicated the positions because using this definition in SplitPanelPreferences would display\n // 'AppLayoutProps.SplitPanelPosition' on the API docs instead of the string values.\n export type SplitPanelPosition = 'side' | 'bottom';\n\n export interface DrawerChangeDetail {\n activeDrawerId: string | null;\n }\n}\n\nexport type AppLayoutPropsWithDefaults = SomeRequired<\n AppLayoutProps,\n 'headerSelector' | 'footerSelector' | 'contentType'\n>;\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/app-layout/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { IconProps } from '../icon/interfaces';\nimport { SomeRequired } from '../internal/types';\n\nexport interface AppLayoutProps extends BaseComponentProps {\n /**\n * Determines the default behavior of the component based on some predefined page layouts.\n * Individual properties will always take precedence over the default coming from the content type.\n */\n contentType?: AppLayoutProps.ContentType;\n\n /**\n * Drawers property. If you set both `drawers` and `tools`, `drawers` will take precedence.\n \n * Each Drawer is an item in the drawers wrapper with the following properties:\n * * id (string) - the id of the drawer.\n * * content (React.ReactNode) - the content in the drawer.\n * * trigger (DrawerTrigger) - the button that opens and closes the active drawer. \n * * ariaLabels (DrawerAriaLabels) - the labels for the interactive elements of the drawer.\n * * badge (boolean) - Adds a badge to the corner of the icon to indicate a state change. For example: Unread notifications.\n * * resizable (boolean) - if the drawer is resizable or not.\n * * defaultSize (number) - starting size of the drawer. if not set, defaults to 290.\n * * onResize (({ size: number }) => void) - Fired when the active drawer is resized.\n * \n * #### DrawerTrigger\n * - `iconName` (IconProps.Name) - (Optional) Specifies the icon to be displayed.\n * - `iconSvg` (React.ReactNode) - (Optional) Specifies the SVG of a custom icon. For more information, see [SVG icon guidelines](/components/icon/?tabId=api#slots)\n *\n * #### DrawerAriaLabels\n * - `drawerName` (string) - Label for the drawer itself.\n * - `closeButton` (string) - (Optional) Label for the close button.\n * - `triggerButton` (string) - (Optional) Label for the trigger button.\n * - `resizeHandle` (string) - (Optional) Label for the resize handle.\n */\n drawers?: Array<AppLayoutProps.Drawer>;\n\n /**\n * The active drawer id. If you want to clear the active drawer, use `null`.\n */\n activeDrawerId?: string | null;\n\n /**\n * Fired when the active drawer is toggled.\n */\n onDrawerChange?: NonCancelableEventHandler<AppLayoutProps.DrawerChangeDetail>;\n\n /**\n * If `true`, disables outer paddings for the content slot.\n */\n disableContentPaddings?: boolean;\n\n /**\n * Activates a backwards-compatibility mode for applications with non-fixed headers and footers.\n * @deprecated This layout is being phased out and may miss some features.\n */\n disableBodyScroll?: boolean;\n\n /**\n * State of the navigation drawer.\n */\n navigationOpen?: boolean;\n\n /**\n * Navigation drawer width in pixels.\n */\n navigationWidth?: number;\n\n /**\n * If `true`, the navigation drawer is not displayed at all.\n */\n navigationHide?: boolean;\n\n /**\n * State of the tools drawer.\n */\n toolsOpen?: boolean;\n\n /**\n * If `true`, the tools drawer is not displayed at all.\n */\n toolsHide?: boolean;\n\n /**\n * Tools drawer width in pixels.\n */\n toolsWidth?: number;\n\n /**\n * Maximum main content panel width in pixels.\n *\n * If set to `Number.MAX_VALUE`, the main content panel will occupy the full available width.\n */\n maxContentWidth?: number;\n\n /**\n * Minimum main content panel width in pixels.\n */\n minContentWidth?: number;\n\n /**\n * If true, the notification slot is rendered above the scrollable\n * content area so it is always visible.\n */\n stickyNotifications?: boolean;\n\n /**\n * CSS selector for the application header.\n */\n headerSelector?: string;\n\n /**\n * CSS selector for the application footer.\n */\n footerSelector?: string;\n\n /**\n * Aria labels for the drawer operating buttons. Use this property to ensure accessibility.\n *\n * * `navigation` (string) - Label for the landmark that wraps the navigation drawer.\n * * `navigationClose` (string) - Label for the button that closes the navigation drawer.\n * * `navigationToggle` (string) - Label for the button that opens the navigation drawer.\n * * `notification` (string) - Label for the region that contains notification messages.\n * * `tools` (string) - Label for the landmark that wraps the tools drawer.\n * * `toolsClose` (string) - Label for the button that closes the tools drawer.\n * * `toolsToggle` (string) - Label for the button that opens the tools drawer.\n * * `drawers` (string) - Label for the landmark that wraps the active drawer.\n * * `drawersOverflow` (string) - Label for the ellipsis button with any overflow drawers.\n * * `drawersOverflowWithBadge` (string) - Label for the ellipsis button with any overflow drawers, with a badge.\n *\n * Example:\n * ```\n * {\n * navigation: \"Navigation drawer\",\n * navigationClose: \"Close navigation drawer\",\n * navigationToggle: \"Open navigation drawer\",\n * notifications: \"Notifications\",\n * tools: \"Help panel\",\n * toolsClose: \"Close help panel\",\n * toolsToggle: \"Open help panel\",\n * drawers: \"Drawers\",\n * drawersOverflow: \"Overflow drawers\",\n * drawersOverflowWithBadge: \"Overflow drawers (Unread notifications)\"\n * }\n * ```\n * @i18n\n */\n ariaLabels?: AppLayoutProps.Labels;\n\n /**\n * Navigation drawer.\n */\n navigation?: React.ReactNode;\n\n /**\n * Top area of the page content.\n * @deprecated Replaced by the `header` slot of the [content layout](/components/content-layout/) component.\n * @visualrefresh\n */\n contentHeader?: React.ReactNode;\n\n /**\n * Disables overlap between `contentHeader` and `content` slots.\n * @deprecated Replaced by the `disableOverlap` property of the [content layout](/components/content-layout/) component.\n * @visualrefresh\n */\n disableContentHeaderOverlap?: boolean;\n\n /**\n * Main content.\n */\n content?: React.ReactNode;\n\n /**\n * Tools drawer.\n */\n tools?: React.ReactNode;\n\n /**\n * Displayed on top of the main content in the scrollable area.\n *\n * Conceived to contain notifications (flash messages).\n */\n notifications?: React.ReactNode;\n\n /**\n * Use this slot to add the [breadcrumb group component](/components/breadcrumb-group/) to the app layout.\n */\n breadcrumbs?: React.ReactNode;\n\n /**\n * Fired when the navigation drawer is toggled.\n */\n onNavigationChange?: NonCancelableEventHandler<AppLayoutProps.ChangeDetail>;\n\n /**\n * Fired when the tools drawer is toggled.\n */\n onToolsChange?: NonCancelableEventHandler<AppLayoutProps.ChangeDetail>;\n\n /**\n * Use this slot to add the [split panel component](/components/split-panel/) to the app layout.\n *\n * Note: If provided, this property should be set to `null` or `undefined` if a split panel should not be rendered.\n */\n splitPanel?: React.ReactNode;\n\n /**\n * The size of the split panel in pixels.\n */\n splitPanelSize?: number;\n\n /**\n * State of the split panel.\n */\n splitPanelOpen?: boolean;\n /**\n * Controls the split panel preferences.\n *\n * By default, the preference is `{ position: 'bottom' }`\n */\n splitPanelPreferences?: AppLayoutProps.SplitPanelPreferences;\n /**\n * Fired when the split panel is resized.\n */\n onSplitPanelResize?: NonCancelableEventHandler<AppLayoutProps.SplitPanelResizeDetail>;\n /**\n * Fired when the split panel is toggled.\n */\n onSplitPanelToggle?: NonCancelableEventHandler<AppLayoutProps.ChangeDetail>;\n /**\n * Fired when the split panel preferences change.\n */\n onSplitPanelPreferencesChange?: NonCancelableEventHandler<AppLayoutProps.SplitPanelPreferences>;\n}\n\nexport namespace AppLayoutProps {\n export type ContentType = 'default' | 'form' | 'table' | 'cards' | 'wizard' | 'dashboard';\n\n export interface Ref {\n /**\n * Manually closes the navigation drawer if it is necessary for the current\n * viewport size.\n */\n closeNavigationIfNecessary(): void;\n\n /**\n * Opens the tools panel if it is not already open. Note that it is preferable\n * to control the state by listening to `toolsChange` and providing `toolsOpen`.\n */\n openTools(): void;\n\n /**\n * Focuses the tools panel if it is open. Use this to focus the tools panel\n * after changing the content, for example when clicking on an 'info' link while\n * the panel is already open.\n */\n focusToolsClose(): void;\n\n /**\n * Focuses the active drawer. Use this to focus the active drawer after opening it programmatically.\n */\n focusActiveDrawer(): void;\n\n /**\n * Focuses the split panel if it is open.\n */\n focusSplitPanel(): void;\n }\n\n export interface Drawer {\n id: string;\n content: React.ReactNode;\n trigger: {\n iconName?: IconProps.Name;\n iconSvg?: React.ReactNode;\n };\n ariaLabels: DrawerAriaLabels;\n badge?: boolean;\n resizable?: boolean;\n defaultSize?: number;\n onResize?: NonCancelableEventHandler<{ size: number }>;\n }\n\n export interface DrawerAriaLabels {\n drawerName: string;\n closeButton?: string;\n triggerButton?: string;\n resizeHandle?: string;\n }\n\n export interface Labels {\n notifications?: string;\n\n navigation?: string;\n navigationToggle?: string;\n navigationClose?: string;\n\n tools?: string;\n toolsToggle?: string;\n toolsClose?: string;\n\n drawers?: string;\n drawersOverflow?: string;\n drawersOverflowWithBadge?: string;\n }\n\n export interface ChangeDetail {\n open: boolean;\n }\n\n export interface SplitPanelResizeDetail {\n size: number;\n }\n\n export interface SplitPanelPreferences {\n position: 'side' | 'bottom';\n }\n // Duplicated the positions because using this definition in SplitPanelPreferences would display\n // 'AppLayoutProps.SplitPanelPosition' on the API docs instead of the string values.\n export type SplitPanelPosition = 'side' | 'bottom';\n\n export interface DrawerChangeDetail {\n activeDrawerId: string | null;\n }\n}\n\nexport type AppLayoutPropsWithDefaults = SomeRequired<\n AppLayoutProps,\n | 'headerSelector'\n | 'footerSelector'\n | 'contentType'\n | 'navigationWidth'\n | 'toolsWidth'\n | 'minContentWidth'\n | 'navigationOpen'\n | 'onNavigationChange'\n>;\n"]}
@@ -1,7 +1,12 @@
1
1
  /// <reference types="react" />
2
2
  export declare const AppLayoutInternal: import("react").ForwardRefExoticComponent<import("./interfaces").AppLayoutProps & {
3
3
  contentType: import("./interfaces").AppLayoutProps.ContentType;
4
+ navigationOpen: boolean;
5
+ navigationWidth: number;
6
+ toolsWidth: number;
7
+ minContentWidth: number;
4
8
  headerSelector: string;
5
9
  footerSelector: string;
10
+ onNavigationChange: import("../internal/events").NonCancelableEventHandler<import("./interfaces").AppLayoutProps.ChangeDetail>;
6
11
  } & import("react").RefAttributes<import("./interfaces").AppLayoutProps.Ref>>;
7
12
  //# sourceMappingURL=internal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/app-layout/internal.tsx"],"names":[],"mappings":";AAIA,eAAO,MAAM,iBAAiB;;;;6EAA8B,CAAC"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/app-layout/internal.tsx"],"names":[],"mappings":";AAIA,eAAO,MAAM,iBAAiB;;;;;;;;;6EAA8B,CAAC"}
@@ -11,8 +11,9 @@ export interface DrawerResizeProps {
11
11
  drawersRefs: FocusControlRefs;
12
12
  isToolsOpen: boolean;
13
13
  drawersMaxWidth: number;
14
+ drawersMinWidth: number;
14
15
  }
15
- declare function useResize(drawerRefObject: React.RefObject<HTMLDivElement>, { activeDrawer, activeDrawerSize, onActiveDrawerResize, drawersRefs, isToolsOpen, drawersMaxWidth }: DrawerResizeProps): {
16
+ declare function useResize(drawerRefObject: React.RefObject<HTMLDivElement>, { activeDrawer, activeDrawerSize, onActiveDrawerResize, drawersRefs, isToolsOpen, drawersMinWidth, drawersMaxWidth, }: DrawerResizeProps): {
16
17
  resizeHandle: JSX.Element;
17
18
  drawerSize: number;
18
19
  };
@@ -1 +1 @@
1
- {"version":3,"file":"use-resize.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/utils/use-resize.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAQnD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAK/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAGvD,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,cAAc,CAAC,MAAM,GAAG,SAAS,CAAC;IAChD,gBAAgB,EAAE,MAAM,CAAC;IACzB,oBAAoB,EAAE,CAAC,MAAM,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACrE,WAAW,EAAE,gBAAgB,CAAC;IAC9B,WAAW,EAAE,OAAO,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,iBAAS,SAAS,CAChB,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,EAChD,EAAE,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,EAAE,iBAAiB;;;EAyDvH;AAED,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"use-resize.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/utils/use-resize.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAQnD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAK/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAGvD,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,cAAc,CAAC,MAAM,GAAG,SAAS,CAAC;IAChD,gBAAgB,EAAE,MAAM,CAAC;IACzB,oBAAoB,EAAE,CAAC,MAAM,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACrE,WAAW,EAAE,gBAAgB,CAAC;IAC9B,WAAW,EAAE,OAAO,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,iBAAS,SAAS,CAChB,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,EAChD,EACE,YAAY,EACZ,gBAAgB,EAChB,oBAAoB,EACpB,WAAW,EACX,WAAW,EACX,eAAe,EACf,eAAe,GAChB,EAAE,iBAAiB;;;EAuDrB;AAED,eAAe,SAAS,CAAC"}
@@ -9,10 +9,8 @@ import { useKeyboardEvents } from './use-keyboard-events';
9
9
  import splitPanelStyles from '../../split-panel/styles.css.js';
10
10
  import testutilStyles from '../test-classes/styles.css.js';
11
11
  import styles from '../visual-refresh/styles.css.js';
12
- function useResize(drawerRefObject, { activeDrawer, activeDrawerSize, onActiveDrawerResize, drawersRefs, isToolsOpen, drawersMaxWidth }) {
13
- var _a, _b;
14
- const toolsWidth = 290;
15
- const MIN_WIDTH = Math.min((_a = activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.defaultSize) !== null && _a !== void 0 ? _a : Number.POSITIVE_INFINITY, toolsWidth);
12
+ function useResize(drawerRefObject, { activeDrawer, activeDrawerSize, onActiveDrawerResize, drawersRefs, isToolsOpen, drawersMinWidth, drawersMaxWidth, }) {
13
+ var _a;
16
14
  const [relativeSize, setRelativeSize] = useState(0);
17
15
  const drawerSize = !activeDrawer && !isToolsOpen ? 0 : activeDrawerSize;
18
16
  useEffect(() => {
@@ -20,15 +18,15 @@ function useResize(drawerRefObject, { activeDrawer, activeDrawerSize, onActiveDr
20
18
  // wait one frame to allow app-layout to complete its calculations
21
19
  const handle = requestAnimationFrame(() => {
22
20
  const maxSize = drawersMaxWidth;
23
- setRelativeSize(((drawerSize - MIN_WIDTH) / (maxSize - MIN_WIDTH)) * 100);
21
+ setRelativeSize(((drawerSize - drawersMinWidth) / (maxSize - drawersMinWidth)) * 100);
24
22
  });
25
23
  return () => cancelAnimationFrame(handle);
26
- }, [drawerSize, drawersMaxWidth, MIN_WIDTH]);
24
+ }, [drawerSize, drawersMaxWidth, drawersMinWidth]);
27
25
  const setSidePanelWidth = (width) => {
28
26
  const maxWidth = drawersMaxWidth;
29
- const size = getLimitedValue(MIN_WIDTH, width, maxWidth);
27
+ const size = getLimitedValue(drawersMinWidth, width, maxWidth);
30
28
  const id = activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.id;
31
- if (id && maxWidth >= MIN_WIDTH) {
29
+ if (id && maxWidth >= drawersMinWidth) {
32
30
  onActiveDrawerResize({ size, id });
33
31
  }
34
32
  };
@@ -41,7 +39,7 @@ function useResize(drawerRefObject, { activeDrawer, activeDrawerSize, onActiveDr
41
39
  };
42
40
  const onSliderPointerDown = usePointerEvents(sizeControlProps);
43
41
  const onKeyDown = useKeyboardEvents(sizeControlProps);
44
- const resizeHandle = (React.createElement("div", { ref: drawersRefs.slider, role: "slider", tabIndex: 0, "aria-label": (_b = activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.ariaLabels) === null || _b === void 0 ? void 0 : _b.resizeHandle, "aria-valuemax": 100, "aria-valuemin": 0, "aria-valuenow": relativeSize, className: clsx(splitPanelStyles.slider, splitPanelStyles[`slider-side`], testutilStyles['drawers-slider']), onKeyDown: onKeyDown, onPointerDown: onSliderPointerDown },
42
+ const resizeHandle = (React.createElement("div", { ref: drawersRefs.slider, role: "slider", tabIndex: 0, "aria-label": (_a = activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.ariaLabels) === null || _a === void 0 ? void 0 : _a.resizeHandle, "aria-valuemax": 100, "aria-valuemin": 0, "aria-valuenow": relativeSize, className: clsx(splitPanelStyles.slider, splitPanelStyles[`slider-side`], testutilStyles['drawers-slider']), onKeyDown: onKeyDown, onPointerDown: onSliderPointerDown },
45
43
  React.createElement(ResizeHandler, { className: clsx(splitPanelStyles['slider-icon'], splitPanelStyles[`slider-icon-side`]) })));
46
44
  return { resizeHandle: React.createElement("div", { className: styles['drawer-slider'] }, resizeHandle), drawerSize };
47
45
  }
@@ -1 +1 @@
1
- {"version":3,"file":"use-resize.js","sourceRoot":"","sources":["../../../../src/app-layout/utils/use-resize.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,aAAa,MAAM,wCAAwC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG1D,OAAO,gBAAgB,MAAM,iCAAiC,CAAC;AAC/D,OAAO,cAAc,MAAM,+BAA+B,CAAC;AAC3D,OAAO,MAAM,MAAM,iCAAiC,CAAC;AAarD,SAAS,SAAS,CAChB,eAAgD,EAChD,EAAE,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,WAAW,EAAE,WAAW,EAAE,eAAe,EAAqB;;IAEtH,MAAM,UAAU,GAAG,GAAG,CAAC;IACvB,MAAM,SAAS,GAAG,IAAI,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AM;QAC7B,QAAQ,EAAE,iBAAiB;QAC3B,cAAc,EAAE,IAAI;KACrB,CAAC;IAEF,MAAM,mBAAmB,GAAG,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IAC/D,MAAM,SAAS,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;IAEtD,MAAM,YAAY,GAAG,CACnB,6BACE,GAAG,EAAE,WAAW,CAAC,MAAM,EACvB,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,CAAC,gBACC,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,UAAU,0CAAE,YAAY,mBACnC,GAAG,mBACH,CAAC,mBACD,YAAY,EAC3B,SAAS,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,CAAC,aAAa,CAAC,EAAE,cAAc,CAAC,gBAAgB,CAAC,CAAC,EAC3G,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,mBAAmB;QAElC,oBAAC,aAAa,IAAC,SAAS,EAAE,IAAI,CAAC,gBAAgB,CAAC,aAAa,CAAC,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAC,GAAI,CACrG,CACP,CAAC;IAEF,OAAO,EAAE,YAAY,EAAE,6BAAK,SAAS,EAAE,MAAM,CAAC,eAAe,CAAC,IAAG,YAAY,CAAO,EAAE,UAAU,EAAE,CAAC;AACrG,CAAC;AAED,eAAe,SAAS,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useState, useEffect } from 'react';\n\nimport clsx from 'clsx';\n\nimport ResizeHandler from '../../split-panel/icons/resize-handler';\nimport { getLimitedValue } from '../../split-panel/utils/size-utils';\nimport { usePointerEvents } from './use-pointer-events';\nimport { useKeyboardEvents } from './use-keyboard-events';\nimport { AppLayoutProps } from '../interfaces';\n\nimport splitPanelStyles from '../../split-panel/styles.css.js';\nimport testutilStyles from '../test-classes/styles.css.js';\nimport styles from '../visual-refresh/styles.css.js';\nimport { FocusControlRefs } from './use-focus-control';\nimport { SizeControlProps } from './interfaces';\n\nexport interface DrawerResizeProps {\n activeDrawer: AppLayoutProps.Drawer | undefined;\n activeDrawerSize: number;\n onActiveDrawerResize: (detail: { id: string; size: number }) => void;\n drawersRefs: FocusControlRefs;\n isToolsOpen: boolean;\n drawersMaxWidth: number;\n}\n\nfunction useResize(\n drawerRefObject: React.RefObject<HTMLDivElement>,\n { activeDrawer, activeDrawerSize, onActiveDrawerResize, drawersRefs, isToolsOpen, drawersMaxWidth }: DrawerResizeProps\n) {\n const toolsWidth = 290;\n const MIN_WIDTH = Math.min(activeDrawer?.defaultSize ?? Number.POSITIVE_INFINITY, toolsWidth);\n const [relativeSize, setRelativeSize] = useState(0);\n\n const drawerSize = !activeDrawer && !isToolsOpen ? 0 : activeDrawerSize;\n\n useEffect(() => {\n // effects are called inside out in the components tree\n // wait one frame to allow app-layout to complete its calculations\n const handle = requestAnimationFrame(() => {\n const maxSize = drawersMaxWidth;\n setRelativeSize(((drawerSize - MIN_WIDTH) / (maxSize - MIN_WIDTH)) * 100);\n });\n return () => cancelAnimationFrame(handle);\n }, [drawerSize, drawersMaxWidth, MIN_WIDTH]);\n\n const setSidePanelWidth = (width: number) => {\n const maxWidth = drawersMaxWidth;\n const size = getLimitedValue(MIN_WIDTH, width, maxWidth);\n const id = activeDrawer?.id;\n\n if (id && maxWidth >= MIN_WIDTH) {\n onActiveDrawerResize({ size, id });\n }\n };\n\n const sizeControlProps: SizeControlProps = {\n position: 'side',\n panelRef: drawerRefObject,\n handleRef: drawersRefs.slider,\n onResize: setSidePanelWidth,\n hasTransitions: true,\n };\n\n const onSliderPointerDown = usePointerEvents(sizeControlProps);\n const onKeyDown = useKeyboardEvents(sizeControlProps);\n\n const resizeHandle = (\n <div\n ref={drawersRefs.slider}\n role=\"slider\"\n tabIndex={0}\n aria-label={activeDrawer?.ariaLabels?.resizeHandle}\n aria-valuemax={100}\n aria-valuemin={0}\n aria-valuenow={relativeSize}\n className={clsx(splitPanelStyles.slider, splitPanelStyles[`slider-side`], testutilStyles['drawers-slider'])}\n onKeyDown={onKeyDown}\n onPointerDown={onSliderPointerDown}\n >\n <ResizeHandler className={clsx(splitPanelStyles['slider-icon'], splitPanelStyles[`slider-icon-side`])} />\n </div>\n );\n\n return { resizeHandle: <div className={styles['drawer-slider']}>{resizeHandle}</div>, drawerSize };\n}\n\nexport default useResize;\n"]}
1
+ {"version":3,"file":"use-resize.js","sourceRoot":"","sources":["../../../../src/app-layout/utils/use-resize.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,aAAa,MAAM,wCAAwC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG1D,OAAO,gBAAgB,MAAM,iCAAiC,CAAC;AAC/D,OAAO,cAAc,MAAM,+BAA+B,CAAC;AAC3D,OAAO,MAAM,MAAM,iCAAiC,CAAC;AAcrD,SAAS,SAAS,CAChB,eAAgD,EAChD,EACE,YAAY,EACZ,gBAAgB,EAChB,oBAAoB,EACpB,WAAW,EACX,WAAW,EACX,eAAe,EACf,eAAe,GACG;;IAEpB,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAEpD,MAAM,UAAU,GAAG,CAAC,YAAY,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC;IAExE,SAAS,CAAC,GAAG,EAAE;QACb,uDAAuD;QACvD,kEAAkE;QAClE,MAAM,MAAM,GAAG,qBAAqB,CA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D,YAAY,EAC3B,SAAS,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,CAAC,aAAa,CAAC,EAAE,cAAc,CAAC,gBAAgB,CAAC,CAAC,EAC3G,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,mBAAmB;QAElC,oBAAC,aAAa,IAAC,SAAS,EAAE,IAAI,CAAC,gBAAgB,CAAC,aAAa,CAAC,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAC,GAAI,CACrG,CACP,CAAC;IAEF,OAAO,EAAE,YAAY,EAAE,6BAAK,SAAS,EAAE,MAAM,CAAC,eAAe,CAAC,IAAG,YAAY,CAAO,EAAE,UAAU,EAAE,CAAC;AACrG,CAAC;AAED,eAAe,SAAS,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useState, useEffect } from 'react';\n\nimport clsx from 'clsx';\n\nimport ResizeHandler from '../../split-panel/icons/resize-handler';\nimport { getLimitedValue } from '../../split-panel/utils/size-utils';\nimport { usePointerEvents } from './use-pointer-events';\nimport { useKeyboardEvents } from './use-keyboard-events';\nimport { AppLayoutProps } from '../interfaces';\n\nimport splitPanelStyles from '../../split-panel/styles.css.js';\nimport testutilStyles from '../test-classes/styles.css.js';\nimport styles from '../visual-refresh/styles.css.js';\nimport { FocusControlRefs } from './use-focus-control';\nimport { SizeControlProps } from './interfaces';\n\nexport interface DrawerResizeProps {\n activeDrawer: AppLayoutProps.Drawer | undefined;\n activeDrawerSize: number;\n onActiveDrawerResize: (detail: { id: string; size: number }) => void;\n drawersRefs: FocusControlRefs;\n isToolsOpen: boolean;\n drawersMaxWidth: number;\n drawersMinWidth: number;\n}\n\nfunction useResize(\n drawerRefObject: React.RefObject<HTMLDivElement>,\n {\n activeDrawer,\n activeDrawerSize,\n onActiveDrawerResize,\n drawersRefs,\n isToolsOpen,\n drawersMinWidth,\n drawersMaxWidth,\n }: DrawerResizeProps\n) {\n const [relativeSize, setRelativeSize] = useState(0);\n\n const drawerSize = !activeDrawer && !isToolsOpen ? 0 : activeDrawerSize;\n\n useEffect(() => {\n // effects are called inside out in the components tree\n // wait one frame to allow app-layout to complete its calculations\n const handle = requestAnimationFrame(() => {\n const maxSize = drawersMaxWidth;\n setRelativeSize(((drawerSize - drawersMinWidth) / (maxSize - drawersMinWidth)) * 100);\n });\n return () => cancelAnimationFrame(handle);\n }, [drawerSize, drawersMaxWidth, drawersMinWidth]);\n\n const setSidePanelWidth = (width: number) => {\n const maxWidth = drawersMaxWidth;\n const size = getLimitedValue(drawersMinWidth, width, maxWidth);\n const id = activeDrawer?.id;\n\n if (id && maxWidth >= drawersMinWidth) {\n onActiveDrawerResize({ size, id });\n }\n };\n\n const sizeControlProps: SizeControlProps = {\n position: 'side',\n panelRef: drawerRefObject,\n handleRef: drawersRefs.slider,\n onResize: setSidePanelWidth,\n hasTransitions: true,\n };\n\n const onSliderPointerDown = usePointerEvents(sizeControlProps);\n const onKeyDown = useKeyboardEvents(sizeControlProps);\n\n const resizeHandle = (\n <div\n ref={drawersRefs.slider}\n role=\"slider\"\n tabIndex={0}\n aria-label={activeDrawer?.ariaLabels?.resizeHandle}\n aria-valuemax={100}\n aria-valuemin={0}\n aria-valuenow={relativeSize}\n className={clsx(splitPanelStyles.slider, splitPanelStyles[`slider-side`], testutilStyles['drawers-slider'])}\n onKeyDown={onKeyDown}\n onPointerDown={onSliderPointerDown}\n >\n <ResizeHandler className={clsx(splitPanelStyles['slider-icon'], splitPanelStyles[`slider-icon-side`])} />\n </div>\n );\n\n return { resizeHandle: <div className={styles['drawer-slider']}>{resizeHandle}</div>, drawerSize };\n}\n\nexport default useResize;\n"]}
@@ -3,7 +3,7 @@ import { AppLayoutProps, AppLayoutPropsWithDefaults } from '../interfaces';
3
3
  import { FocusControlRefs } from '../utils/use-focus-control';
4
4
  import { SplitPanelFocusControlRefs } from '../utils/use-split-panel-focus-control';
5
5
  import { SplitPanelSideToggleProps } from '../../internal/context/split-panel-context';
6
- interface AppLayoutInternals extends AppLayoutProps {
6
+ interface AppLayoutInternals extends AppLayoutPropsWithDefaults {
7
7
  activeDrawerId: string | null;
8
8
  drawers: Array<AppLayoutProps.Drawer> | undefined;
9
9
  drawersAriaLabel: string | undefined;
@@ -22,7 +22,6 @@ interface AppLayoutInternals extends AppLayoutProps {
22
22
  handleSplitPanelPreferencesChange: (detail: AppLayoutProps.SplitPanelPreferences) => void;
23
23
  handleSplitPanelResize: (newSize: number) => void;
24
24
  handleToolsClick: (value: boolean, skipFocusControl?: boolean) => void;
25
- hasDefaultToolsWidth: boolean;
26
25
  hasBackgroundOverlap: boolean;
27
26
  hasDrawerViewportOverlay: boolean;
28
27
  hasNotificationsContent: boolean;
@@ -30,7 +29,6 @@ interface AppLayoutInternals extends AppLayoutProps {
30
29
  hasStickyBackground: boolean;
31
30
  isBackgroundOverlapDisabled: boolean;
32
31
  isMobile: boolean;
33
- isNavigationOpen: boolean;
34
32
  isSplitPanelForcedPosition: boolean;
35
33
  isSplitPanelOpen?: boolean;
36
34
  isToolsOpen: boolean;
@@ -51,7 +49,6 @@ interface AppLayoutInternals extends AppLayoutProps {
51
49
  footerHeight: number;
52
50
  splitPanelControlId: string;
53
51
  splitPanelMaxWidth: number;
54
- splitPanelMinWidth: number;
55
52
  splitPanelPosition: AppLayoutProps.SplitPanelPosition;
56
53
  splitPanelReportedSize: number;
57
54
  splitPanelReportedHeaderHeight: number;
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/context.tsx"],"names":[],"mappings":"AAEA,OAAO,KASN,MAAM,OAAO,CAAC;AAIf,OAAO,EAAE,cAAc,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAE3E,OAAO,EAAE,gBAAgB,EAAmB,MAAM,4BAA4B,CAAC;AAK/E,OAAO,EAAE,0BAA0B,EAA6B,MAAM,wCAAwC,CAAC;AAC/G,OAAO,EAAE,yB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AAE,MAAM,KAAK,IAAI,CAAC;IACnD,iCAAiC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3D,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,kBAAkB,EAAE,cAAc,CAAC,kBAAkB,CAAC;IACtD,sBAAsB,EAAE,MAAM,CAAC;IAC/B,8BAA8B,EAAE,MAAM,CAAC;IACvC,gBAAgB,EAAE,yBAAyB,CAAC;IAC5C,mBAAmB,EAAE,CAAC,MAAM,EAAE,yBAAyB,KAAK,IAAI,CAAC;IACjE,mBAAmB,EAAE,OAAO,CAAC;IAC7B,cAAc,EAAE,0BAA0B,CAAC;IAC3C,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,gBAAgB,CAAC;IAC5B,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AASD,UAAU,+BAAgC,SAAQ,0BAA0B;IAC1E,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,wBAAgB,qBAAqB,uBAMpC;AAED,eAAO,MAAM,0BAA0B,4GA4gBtC,CAAC"}
@@ -2,25 +2,24 @@ import { __rest } from "tslib";
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  import React, { createContext, useCallback, useEffect, useLayoutEffect, useImperativeHandle, useRef, useState, useContext, } from 'react';
5
- import { applyDefaults } from '../defaults';
6
5
  import { AppLayoutContext } from '../../internal/context/app-layout-context';
7
6
  import { DynamicOverlapContext } from '../../internal/context/dynamic-overlap-context';
8
7
  import { fireNonCancelableEvent } from '../../internal/events';
9
8
  import { useFocusControl } from '../utils/use-focus-control';
10
9
  import { getSplitPanelDefaultSize } from '../../split-panel/utils/size-utils';
11
- import { isDevelopment } from '../../internal/is-development';
12
10
  import { getSplitPanelPosition } from './split-panel';
13
11
  import { useControllable } from '../../internal/hooks/use-controllable';
14
12
  import { useSplitPanelFocusControl } from '../utils/use-split-panel-focus-control';
15
13
  import { useObservedElement } from '../utils/use-observed-element';
16
14
  import { useMobile } from '../../internal/hooks/use-mobile';
17
- import { useStableCallback, warnOnce } from '@cloudscape-design/component-toolkit/internal';
15
+ import { useStableCallback } from '@cloudscape-design/component-toolkit/internal';
18
16
  import useResize from '../utils/use-resize';
19
17
  import styles from './styles.css.js';
20
18
  import { useContainerQuery } from '@cloudscape-design/component-toolkit';
21
19
  import useBackgroundOverlap from './use-background-overlap';
22
20
  import { useDrawers } from '../utils/use-drawers';
23
21
  import { useUniqueId } from '../../internal/hooks/use-unique-id';
22
+ import { SPLIT_PANEL_MIN_WIDTH } from '../split-panel';
24
23
  /**
25
24
  * The default values are destructured in the context instantiation to
26
25
  * prevent downstream Typescript errors. This could likely be replaced
@@ -34,17 +33,12 @@ export function useAppLayoutInternals() {
34
33
  }
35
34
  return ctx;
36
35
  }
37
- export const AppLayoutInternalsProvider = React.forwardRef((_a, forwardRef) => {
38
- var _b, _c, _d, _e, _f, _g;
39
- var { toolsHide, toolsOpen: controlledToolsOpen, navigationHide, navigationOpen: controlledNavigationOpen, contentType, headerSelector, footerSelector, children, splitPanel } = _a, props = __rest(_a, ["toolsHide", "toolsOpen", "navigationHide", "navigationOpen", "contentType", "headerSelector", "footerSelector", "children", "splitPanel"]);
36
+ export const AppLayoutInternalsProvider = React.forwardRef((props, forwardRef) => {
37
+ var _a, _b, _c, _d, _e;
38
+ const { toolsHide, toolsOpen: controlledToolsOpen, navigationHide, navigationOpen, contentType, headerSelector, footerSelector, children, splitPanel, } = props;
40
39
  const isMobile = useMobile();
41
40
  // Private API for embedded view mode
42
41
  const __embeddedViewMode = Boolean(props.__embeddedViewMode);
43
- if (isDevelopment) {
44
- if (controlledToolsOpen && toolsHide) {
45
- warnOnce('AppLayout', `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\`.`);
46
- }
47
- }
48
42
  const [hasStickyBackground, setHasStickyBackground] = useState(false);
49
43
  /**
50
44
  * Set the default values for minimum and maximum content width.
@@ -55,31 +49,10 @@ export const AppLayoutInternalsProvider = React.forwardRef((_a, forwardRef) => {
55
49
  // Limit the maxContentWidth to the half of the upper boundary (≈4230^2) to be on the safe side.
56
50
  const maxContentWidth = props.maxContentWidth && props.maxContentWidth > halfGeckoMaxCssLength
57
51
  ? halfGeckoMaxCssLength
58
- : (_b = props.maxContentWidth) !== null && _b !== void 0 ? _b : 0;
59
- const minContentWidth = (_c = props.minContentWidth) !== null && _c !== void 0 ? _c : 280;
60
- /**
61
- * Determine the default state of the Navigation and Tools drawers.
62
- * Mobile viewports should be closed by default under all circumstances.
63
- * If the navigationOpen prop has been set then that should take precedence
64
- * over the contentType prop. Desktop viewports that do not have the
65
- * navigationOpen or contentType props set will use the default contentType.
66
- */
67
- const contentTypeDefaults = applyDefaults(contentType, { maxContentWidth, minContentWidth }, true);
68
- /**
69
- * The useControllable hook will set the default value and manage either
70
- * the controlled or uncontrolled state of the Navigation drawer. The logic
71
- * for determining the default state is colocated with the Navigation component.
72
- *
73
- * The callback that will be passed to the Navigation and MobileToolbar
74
- * components to handle the click events that will change the state
75
- * of the Navigation drawer. It will set the Navigation state with the
76
- * useControllable hook and also fire the onNavigationChange function to
77
- * emit the state change.
78
- */
79
- const [isNavigationOpen = false, setIsNavigationOpen] = useControllable(controlledNavigationOpen, props.onNavigationChange, isMobile ? false : contentTypeDefaults.navigationOpen, { componentName: 'AppLayout', controlledProp: 'navigationOpen', changeHandler: 'onNavigationChange' });
80
- const { refs: navigationRefs, setFocus: focusNavButtons } = useFocusControl(isNavigationOpen);
52
+ : (_a = props.maxContentWidth) !== null && _a !== void 0 ? _a : 0;
53
+ const minContentWidth = (_b = props.minContentWidth) !== null && _b !== void 0 ? _b : 280;
54
+ const { refs: navigationRefs, setFocus: focusNavButtons } = useFocusControl(navigationOpen);
81
55
  const handleNavigationClick = useStableCallback(function handleNavigationChange(isOpen) {
82
- setIsNavigationOpen(isOpen);
83
56
  focusNavButtons();
84
57
  fireNonCancelableEvent(props.onNavigationChange, { open: isOpen });
85
58
  });
@@ -89,20 +62,12 @@ export const AppLayoutInternalsProvider = React.forwardRef((_a, forwardRef) => {
89
62
  handleNavigationClick(false);
90
63
  }
91
64
  }, [isMobile, handleNavigationClick]);
92
- /**
93
- * The useControllable hook will set the default value and manage either
94
- * the controlled or uncontrolled state of the Tools drawer. The logic
95
- * for determining the default state is colocated with the Tools component.
96
- *
97
- * The callback that will be passed to the Navigation and MobileToolbar
98
- * components to handle the click events that will change the state
99
- * of the Tools drawer. It will set the Tools state with the
100
- * useControllable hook and also fire the onToolsChange function to
101
- * emit the state change.
102
- */
103
- const toolsWidth = (_d = props.toolsWidth) !== null && _d !== void 0 ? _d : 290;
104
- const hasDefaultToolsWidth = props.toolsWidth === undefined;
105
- const [isToolsOpen = false, setIsToolsOpen] = useControllable(controlledToolsOpen, props.onToolsChange, isMobile ? false : contentTypeDefaults.toolsOpen, { componentName: 'AppLayout', controlledProp: 'toolsOpen', changeHandler: 'onToolsChange' });
65
+ const toolsWidth = props.toolsWidth;
66
+ const [isToolsOpen = false, setIsToolsOpen] = useControllable(controlledToolsOpen, props.onToolsChange, false, {
67
+ componentName: 'AppLayout',
68
+ controlledProp: 'toolsOpen',
69
+ changeHandler: 'onToolsChange',
70
+ });
106
71
  const { refs: toolsRefs, setFocus: focusToolsButtons, loseFocus: loseToolsFocus, } = useFocusControl(isToolsOpen, true);
107
72
  const handleToolsClick = useCallback(function handleToolsChange(isOpen, skipFocusControl) {
108
73
  setIsToolsOpen(isOpen);
@@ -122,8 +87,7 @@ export const AppLayoutInternalsProvider = React.forwardRef((_a, forwardRef) => {
122
87
  * widths will potentially trigger a side effect that will put the Split Panel into
123
88
  * a forced position on the bottom.
124
89
  */
125
- const splitPanelMinWidth = 280;
126
- const [splitPanelMaxWidth, setSplitPanelMaxWidth] = useState(splitPanelMinWidth);
90
+ const [splitPanelMaxWidth, setSplitPanelMaxWidth] = useState(SPLIT_PANEL_MIN_WIDTH);
127
91
  /**
128
92
  * The useControllable hook will set the default value and manage either
129
93
  * the controlled or uncontrolled state of the Split Panel. By default
@@ -169,8 +133,8 @@ export const AppLayoutInternalsProvider = React.forwardRef((_a, forwardRef) => {
169
133
  const [isSplitPanelForcedPosition, setSplitPanelForcedPosition] = useState(false);
170
134
  const splitPanelPosition = getSplitPanelPosition(isSplitPanelForcedPosition, splitPanelPreferences);
171
135
  useLayoutEffect(function handleSplitPanelForcePosition() {
172
- setSplitPanelForcedPosition(splitPanelMinWidth > splitPanelMaxWidth);
173
- }, [splitPanelMaxWidth, splitPanelMinWidth]);
136
+ setSplitPanelForcedPosition(SPLIT_PANEL_MIN_WIDTH > splitPanelMaxWidth);
137
+ }, [splitPanelMaxWidth]);
174
138
  /**
175
139
  * The useControllable hook will set the default size of the SplitPanel based
176
140
  * on the default position set in the splitPanelPreferences. The logic for the
@@ -201,14 +165,14 @@ export const AppLayoutInternalsProvider = React.forwardRef((_a, forwardRef) => {
201
165
  setSplitPanelLastInteraction({ type: 'position' });
202
166
  fireNonCancelableEvent(props.onSplitPanelPreferencesChange, detail);
203
167
  }, [props.onSplitPanelPreferencesChange, setSplitPanelPreferences, setSplitPanelLastInteraction]);
204
- const _h = useDrawers(props, props.ariaLabels, {
168
+ const _f = useDrawers(props, props.ariaLabels, {
205
169
  ariaLabels: props.ariaLabels,
206
170
  toolsHide,
207
171
  toolsOpen: isToolsOpen,
208
172
  tools: props.tools,
209
173
  toolsWidth,
210
174
  onToolsToggle: handleToolsClick,
211
- }), { drawers, activeDrawer, activeDrawerId, minDrawerSize: drawersMinWidth, onActiveDrawerChange, onActiveDrawerResize, activeDrawerSize } = _h, drawersProps = __rest(_h, ["drawers", "activeDrawer", "activeDrawerId", "minDrawerSize", "onActiveDrawerChange", "onActiveDrawerResize", "activeDrawerSize"]);
175
+ }), { drawers, activeDrawer, activeDrawerId, minDrawerSize: drawersMinWidth, onActiveDrawerChange, onActiveDrawerResize, activeDrawerSize } = _f, drawersProps = __rest(_f, ["drawers", "activeDrawer", "activeDrawerId", "minDrawerSize", "onActiveDrawerChange", "onActiveDrawerResize", "activeDrawerSize"]);
212
176
  const [drawersMaxWidth, setDrawersMaxWidth] = useState(toolsWidth);
213
177
  const hasDrawers = !!drawers && drawers.length > 0;
214
178
  const { refs: drawersRefs, setFocus: focusDrawersButtons, loseFocus: loseDrawersFocus, } = useFocusControl(!!activeDrawerId, true, activeDrawerId);
@@ -220,6 +184,7 @@ export const AppLayoutInternalsProvider = React.forwardRef((_a, forwardRef) => {
220
184
  drawersRefs,
221
185
  isToolsOpen,
222
186
  drawersMaxWidth,
187
+ drawersMinWidth,
223
188
  });
224
189
  const handleDrawersClick = (id, skipFocusControl) => {
225
190
  const newActiveDrawerId = id !== activeDrawerId ? id : null;
@@ -233,7 +198,7 @@ export const AppLayoutInternalsProvider = React.forwardRef((_a, forwardRef) => {
233
198
  const hasOpenDrawer = !!activeDrawerId ||
234
199
  (!toolsHide && isToolsOpen) ||
235
200
  (splitPanelDisplayed && splitPanelPosition === 'side' && isSplitPanelOpen);
236
- const hasDrawerViewportOverlay = isMobile && (!!activeDrawerId || (!navigationHide && isNavigationOpen) || (!toolsHide && isToolsOpen));
201
+ const hasDrawerViewportOverlay = isMobile && (!!activeDrawerId || (!navigationHide && navigationOpen) || (!toolsHide && isToolsOpen));
237
202
  /**
238
203
  * The Layout element is not necessarily synonymous with the client
239
204
  * viewport width. There can be content in the horizontal viewport
@@ -261,7 +226,7 @@ export const AppLayoutInternalsProvider = React.forwardRef((_a, forwardRef) => {
261
226
  useLayoutEffect(function handleMainOffsetLeft() {
262
227
  var _a, _b;
263
228
  setMainOffsetLeft((_b = (_a = mainElement === null || mainElement === void 0 ? void 0 : mainElement.current) === null || _a === void 0 ? void 0 : _a.offsetLeft) !== null && _b !== void 0 ? _b : 0);
264
- }, [layoutWidth, isNavigationOpen, isToolsOpen, splitPanelReportedSize]);
229
+ }, [layoutWidth, navigationOpen, isToolsOpen, splitPanelReportedSize]);
265
230
  /**
266
231
  * On mobile viewports the navigation and tools drawers are adjusted to a fixed position
267
232
  * that consumes 100% of the viewport height and width. The body content could potentially
@@ -269,7 +234,7 @@ export const AppLayoutInternalsProvider = React.forwardRef((_a, forwardRef) => {
269
234
  * added to the document body that sets overflow to hidden.
270
235
  */
271
236
  useEffect(function handleBodyScroll() {
272
- if (isMobile && (isNavigationOpen || isToolsOpen || !!activeDrawer)) {
237
+ if (isMobile && (navigationOpen || isToolsOpen || !!activeDrawer)) {
273
238
  document.body.classList.add(styles['block-body-scroll']);
274
239
  }
275
240
  else {
@@ -279,7 +244,7 @@ export const AppLayoutInternalsProvider = React.forwardRef((_a, forwardRef) => {
279
244
  return function cleanup() {
280
245
  document.body.classList.remove(styles['block-body-scroll']);
281
246
  };
282
- }, [isMobile, isNavigationOpen, isToolsOpen, activeDrawer]);
247
+ }, [isMobile, navigationOpen, isToolsOpen, activeDrawer]);
283
248
  /**
284
249
  * Because the notifications slot does not give us any direction insight into
285
250
  * what the state of the child content is we need to have a mechanism for
@@ -352,7 +317,7 @@ export const AppLayoutInternalsProvider = React.forwardRef((_a, forwardRef) => {
352
317
  activeDrawerId,
353
318
  drawerSize,
354
319
  drawers,
355
- isNavigationOpen,
320
+ navigationOpen,
356
321
  isToolsOpen,
357
322
  layoutWidth,
358
323
  mainOffsetLeft,
@@ -395,7 +360,7 @@ export const AppLayoutInternalsProvider = React.forwardRef((_a, forwardRef) => {
395
360
  ]);
396
361
  return (React.createElement(AppLayoutInternalsContext.Provider, { value: Object.assign(Object.assign({}, props), { activeDrawerId,
397
362
  contentType,
398
- drawers, drawersAriaLabel: (_e = drawersProps.ariaLabelsWithDrawers) === null || _e === void 0 ? void 0 : _e.drawers, drawersOverflowAriaLabel: (_f = drawersProps.ariaLabelsWithDrawers) === null || _f === void 0 ? void 0 : _f.drawersOverflow, drawersOverflowWithBadgeAriaLabel: (_g = drawersProps.ariaLabelsWithDrawers) === null || _g === void 0 ? void 0 : _g.drawersOverflowWithBadge, drawersRefs,
363
+ drawers, drawersAriaLabel: (_c = drawersProps.ariaLabelsWithDrawers) === null || _c === void 0 ? void 0 : _c.drawers, drawersOverflowAriaLabel: (_d = drawersProps.ariaLabelsWithDrawers) === null || _d === void 0 ? void 0 : _d.drawersOverflow, drawersOverflowWithBadgeAriaLabel: (_e = drawersProps.ariaLabelsWithDrawers) === null || _e === void 0 ? void 0 : _e.drawersOverflowWithBadge, drawersRefs,
399
364
  drawersMinWidth,
400
365
  drawersMaxWidth,
401
366
  drawerSize,
@@ -404,7 +369,6 @@ export const AppLayoutInternalsProvider = React.forwardRef((_a, forwardRef) => {
404
369
  drawersTriggerCount,
405
370
  headerHeight,
406
371
  footerHeight,
407
- hasDefaultToolsWidth,
408
372
  hasDrawerViewportOverlay,
409
373
  handleDrawersClick,
410
374
  handleNavigationClick,
@@ -415,7 +379,8 @@ export const AppLayoutInternalsProvider = React.forwardRef((_a, forwardRef) => {
415
379
  hasBackgroundOverlap,
416
380
  hasNotificationsContent,
417
381
  hasOpenDrawer,
418
- hasStickyBackground, isBackgroundOverlapDisabled: props.disableContentHeaderOverlap || !hasBackgroundOverlap, isMobile, isNavigationOpen: isNavigationOpen !== null && isNavigationOpen !== void 0 ? isNavigationOpen : false, isSplitPanelForcedPosition,
382
+ hasStickyBackground, isBackgroundOverlapDisabled: props.disableContentHeaderOverlap || !hasBackgroundOverlap, isMobile,
383
+ isSplitPanelForcedPosition,
419
384
  isSplitPanelOpen,
420
385
  isToolsOpen,
421
386
  layoutElement,
@@ -438,7 +403,6 @@ export const AppLayoutInternalsProvider = React.forwardRef((_a, forwardRef) => {
438
403
  splitPanelControlId,
439
404
  splitPanelDisplayed,
440
405
  splitPanelMaxWidth,
441
- splitPanelMinWidth,
442
406
  splitPanelPosition,
443
407
  splitPanelPreferences,
444
408
  splitPanelReportedSize,