@cloudscape-design/components-themeable 3.0.1126 → 3.0.1127
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.
- package/lib/internal/manifest.json +1 -1
- package/lib/internal/scss/app-layout/resize/styles.scss +1 -1
- package/lib/internal/scss/app-layout/visual-refresh-toolbar/drawer/styles.scss +40 -0
- package/lib/internal/scss/app-layout/visual-refresh-toolbar/skeleton/styles.scss +20 -3
- package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +87 -86
- package/lib/internal/template/alert/styles.css.js +27 -27
- package/lib/internal/template/alert/styles.scoped.css +50 -50
- package/lib/internal/template/alert/styles.selectors.js +27 -27
- package/lib/internal/template/annotation-context/annotation/styles.css.js +24 -24
- package/lib/internal/template/annotation-context/annotation/styles.scoped.css +32 -32
- package/lib/internal/template/annotation-context/annotation/styles.selectors.js +24 -24
- package/lib/internal/template/app-layout/notifications/styles.css.js +3 -3
- package/lib/internal/template/app-layout/notifications/styles.scoped.css +7 -7
- package/lib/internal/template/app-layout/notifications/styles.selectors.js +3 -3
- package/lib/internal/template/app-layout/resize/styles.css.js +5 -5
- package/lib/internal/template/app-layout/resize/styles.scoped.css +13 -13
- package/lib/internal/template/app-layout/resize/styles.selectors.js +5 -5
- package/lib/internal/template/app-layout/runtime-drawer/index.d.ts +1 -0
- package/lib/internal/template/app-layout/runtime-drawer/index.d.ts.map +1 -1
- package/lib/internal/template/app-layout/runtime-drawer/index.js.map +1 -1
- package/lib/internal/template/app-layout/utils/use-drawers.d.ts +1 -1
- package/lib/internal/template/app-layout/utils/use-drawers.d.ts.map +1 -1
- package/lib/internal/template/app-layout/utils/use-drawers.js +4 -2
- package/lib/internal/template/app-layout/utils/use-drawers.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh/styles.css.js +86 -86
- package/lib/internal/template/app-layout/visual-refresh/styles.scoped.css +258 -258
- package/lib/internal/template/app-layout/visual-refresh/styles.selectors.js +86 -86
- package/lib/internal/template/app-layout/visual-refresh-toolbar/compute-layout.d.ts +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/compute-layout.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/compute-layout.js +2 -2
- package/lib/internal/template/app-layout/visual-refresh-toolbar/compute-layout.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-bottom-drawer.d.ts +13 -0
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-bottom-drawer.d.ts.map +1 -0
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-bottom-drawer.js +183 -0
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-bottom-drawer.js.map +1 -0
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-drawers.js +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-drawers.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/local-drawer.d.ts +2 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/local-drawer.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/local-drawer.js +2 -2
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/local-drawer.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/styles.css.js +27 -26
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/styles.scoped.css +110 -76
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/styles.selectors.js +27 -26
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/use-resize.d.ts +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/use-resize.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/use-resize.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/interfaces.d.ts +15 -2
- package/lib/internal/template/app-layout/visual-refresh-toolbar/interfaces.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/interfaces.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/navigation/index.d.ts +2 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/navigation/index.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/navigation/index.js +2 -2
- package/lib/internal/template/app-layout/visual-refresh-toolbar/navigation/index.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/navigation/styles.css.js +4 -4
- package/lib/internal/template/app-layout/visual-refresh-toolbar/navigation/styles.scoped.css +7 -7
- package/lib/internal/template/app-layout/visual-refresh-toolbar/navigation/styles.selectors.js +4 -4
- package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/styles.css.js +27 -25
- package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/styles.scoped.css +68 -52
- package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/styles.selectors.js +27 -25
- package/lib/internal/template/app-layout/visual-refresh-toolbar/split-panel/index.d.ts +2 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/split-panel/index.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/split-panel/index.js +2 -2
- package/lib/internal/template/app-layout/visual-refresh-toolbar/split-panel/index.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/state/interfaces.d.ts +4 -0
- package/lib/internal/template/app-layout/visual-refresh-toolbar/state/interfaces.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/state/interfaces.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/state/props-merger.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/state/props-merger.js +12 -0
- package/lib/internal/template/app-layout/visual-refresh-toolbar/state/props-merger.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/state/use-ai-drawer.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/state/use-ai-drawer.js +0 -17
- package/lib/internal/template/app-layout/visual-refresh-toolbar/state/use-ai-drawer.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/state/use-app-layout.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/state/use-app-layout.js +108 -12
- package/lib/internal/template/app-layout/visual-refresh-toolbar/state/use-app-layout.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/state/use-bottom-drawers.d.ts +33 -0
- package/lib/internal/template/app-layout/visual-refresh-toolbar/state/use-bottom-drawers.d.ts.map +1 -0
- package/lib/internal/template/app-layout/visual-refresh-toolbar/state/use-bottom-drawers.js +85 -0
- package/lib/internal/template/app-layout/visual-refresh-toolbar/state/use-bottom-drawers.js.map +1 -0
- package/lib/internal/template/app-layout/visual-refresh-toolbar/state/use-skeleton-slots-attributes.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/state/use-skeleton-slots-attributes.js +3 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/state/use-skeleton-slots-attributes.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.d.ts +8 -3
- package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.js +34 -7
- package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/index.d.ts +4 -0
- package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/index.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/index.js +7 -3
- package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/index.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/after-main-slot.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/after-main-slot.js +7 -3
- package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/after-main-slot.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/before-main-slot.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/before-main-slot.js +2 -2
- package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/before-main-slot.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/bottom-content-slot.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/bottom-content-slot.js +6 -2
- package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/bottom-content-slot.js.map +1 -1
- package/lib/internal/template/attribute-editor/interfaces.d.ts +2 -0
- package/lib/internal/template/attribute-editor/interfaces.d.ts.map +1 -1
- package/lib/internal/template/attribute-editor/interfaces.js.map +1 -1
- package/lib/internal/template/attribute-editor/row.d.ts.map +1 -1
- package/lib/internal/template/attribute-editor/row.js +2 -2
- package/lib/internal/template/attribute-editor/row.js.map +1 -1
- package/lib/internal/template/attribute-editor/styles.css.js +15 -15
- package/lib/internal/template/attribute-editor/styles.scoped.css +28 -28
- package/lib/internal/template/attribute-editor/styles.selectors.js +15 -15
- package/lib/internal/template/breadcrumb-group/item/styles.css.js +7 -7
- package/lib/internal/template/breadcrumb-group/item/styles.scoped.css +28 -28
- package/lib/internal/template/breadcrumb-group/item/styles.selectors.js +7 -7
- package/lib/internal/template/button/styles.css.js +22 -22
- package/lib/internal/template/button/styles.scoped.css +256 -256
- package/lib/internal/template/button/styles.selectors.js +22 -22
- package/lib/internal/template/button-dropdown/interfaces.d.ts +3 -1
- package/lib/internal/template/button-dropdown/interfaces.d.ts.map +1 -1
- package/lib/internal/template/button-dropdown/interfaces.js.map +1 -1
- package/lib/internal/template/button-dropdown/item-element/index.d.ts.map +1 -1
- package/lib/internal/template/button-dropdown/item-element/index.js +1 -1
- package/lib/internal/template/button-dropdown/item-element/index.js.map +1 -1
- package/lib/internal/template/button-dropdown/item-element/styles.css.js +16 -16
- package/lib/internal/template/button-dropdown/item-element/styles.scoped.css +27 -27
- package/lib/internal/template/button-dropdown/item-element/styles.selectors.js +16 -16
- package/lib/internal/template/checkbox/styles.css.js +3 -3
- package/lib/internal/template/checkbox/styles.scoped.css +11 -11
- package/lib/internal/template/checkbox/styles.selectors.js +3 -3
- package/lib/internal/template/content-layout/styles.css.js +14 -14
- package/lib/internal/template/content-layout/styles.scoped.css +27 -27
- package/lib/internal/template/content-layout/styles.selectors.js +14 -14
- package/lib/internal/template/flashbar/styles.css.js +50 -50
- package/lib/internal/template/flashbar/styles.scoped.css +187 -187
- package/lib/internal/template/flashbar/styles.selectors.js +50 -50
- package/lib/internal/template/help-panel/styles.css.js +6 -6
- package/lib/internal/template/help-panel/styles.scoped.css +73 -73
- package/lib/internal/template/help-panel/styles.selectors.js +6 -6
- package/lib/internal/template/internal/base-component/styles.scoped.css +1 -1
- package/lib/internal/template/internal/components/autosuggest-input/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/autosuggest-input/index.js +30 -7
- package/lib/internal/template/internal/components/autosuggest-input/index.js.map +1 -1
- package/lib/internal/template/internal/components/drag-handle-wrapper/styles.css.js +20 -20
- package/lib/internal/template/internal/components/drag-handle-wrapper/styles.scoped.css +48 -48
- package/lib/internal/template/internal/components/drag-handle-wrapper/styles.selectors.js +20 -20
- package/lib/internal/template/internal/components/dropdown/styles.css.js +20 -20
- package/lib/internal/template/internal/components/dropdown/styles.scoped.css +38 -38
- package/lib/internal/template/internal/components/dropdown/styles.selectors.js +20 -20
- package/lib/internal/template/internal/components/token-list/styles.css.js +10 -10
- package/lib/internal/template/internal/components/token-list/styles.scoped.css +25 -25
- package/lib/internal/template/internal/components/token-list/styles.selectors.js +10 -10
- package/lib/internal/template/internal/environment.js +2 -2
- package/lib/internal/template/internal/environment.json +2 -2
- package/lib/internal/template/internal/generated/custom-css-properties/index.d.ts +1 -0
- package/lib/internal/template/internal/generated/custom-css-properties/index.d.ts.map +1 -1
- package/lib/internal/template/internal/generated/custom-css-properties/index.js +86 -85
- package/lib/internal/template/internal/generated/custom-css-properties/index.js.map +1 -1
- package/lib/internal/template/internal/plugins/controllers/drawers.d.ts +1 -1
- package/lib/internal/template/internal/plugins/controllers/drawers.d.ts.map +1 -1
- package/lib/internal/template/internal/plugins/controllers/drawers.js.map +1 -1
- package/lib/internal/template/internal/plugins/widget/index.d.ts +6 -1
- package/lib/internal/template/internal/plugins/widget/index.d.ts.map +1 -1
- package/lib/internal/template/internal/plugins/widget/index.js +11 -1
- package/lib/internal/template/internal/plugins/widget/index.js.map +1 -1
- package/lib/internal/template/internal/plugins/widget/interfaces.d.ts +2 -1
- package/lib/internal/template/internal/plugins/widget/interfaces.d.ts.map +1 -1
- package/lib/internal/template/internal/plugins/widget/interfaces.js.map +1 -1
- package/lib/internal/template/internal/plugins/widget.d.ts +1 -1
- package/lib/internal/template/internal/plugins/widget.d.ts.map +1 -1
- package/lib/internal/template/internal/plugins/widget.js +1 -1
- package/lib/internal/template/internal/plugins/widget.js.map +1 -1
- package/lib/internal/template/link/styles.css.js +20 -20
- package/lib/internal/template/link/styles.scoped.css +103 -103
- package/lib/internal/template/link/styles.selectors.js +20 -20
- package/lib/internal/template/radio-group/styles.css.js +10 -10
- package/lib/internal/template/radio-group/styles.scoped.css +22 -22
- package/lib/internal/template/radio-group/styles.selectors.js +10 -10
- package/lib/internal/template/slider/styles.css.js +26 -26
- package/lib/internal/template/slider/styles.scoped.css +86 -86
- package/lib/internal/template/slider/styles.selectors.js +26 -26
- package/lib/internal/template/spinner/styles.css.js +13 -13
- package/lib/internal/template/spinner/styles.scoped.css +39 -39
- package/lib/internal/template/spinner/styles.selectors.js +13 -13
- package/lib/internal/template/tag-editor/styles.css.js +3 -3
- package/lib/internal/template/tag-editor/styles.scoped.css +13 -13
- package/lib/internal/template/tag-editor/styles.selectors.js +3 -3
- package/lib/internal/template/text-content/styles.css.js +1 -1
- package/lib/internal/template/text-content/styles.scoped.css +66 -66
- package/lib/internal/template/text-content/styles.selectors.js +1 -1
- package/lib/internal/template/toggle/styles.css.js +10 -10
- package/lib/internal/template/toggle/styles.scoped.css +23 -23
- package/lib/internal/template/toggle/styles.selectors.js +10 -10
- package/lib/internal/template/top-navigation/interfaces.d.ts +1 -1
- package/lib/internal/template/top-navigation/interfaces.js.map +1 -1
- package/lib/internal/template/top-navigation/internal.d.ts.map +1 -1
- package/lib/internal/template/top-navigation/internal.js +0 -9
- package/lib/internal/template/top-navigation/internal.js.map +1 -1
- package/lib/internal/template/top-navigation/parts/utility.d.ts.map +1 -1
- package/lib/internal/template/top-navigation/parts/utility.js +1 -15
- package/lib/internal/template/top-navigation/parts/utility.js.map +1 -1
- package/package.json +1 -1
|
@@ -4,9 +4,10 @@ import { AppLayoutInternals } from '../interfaces';
|
|
|
4
4
|
interface AppLayoutSplitPanelDrawerSideImplementationProps {
|
|
5
5
|
appLayoutInternals: AppLayoutInternals;
|
|
6
6
|
splitPanelInternals: SplitPanelProviderProps;
|
|
7
|
+
bottomDrawerReportedSize?: number;
|
|
7
8
|
children: React.ReactNode;
|
|
8
9
|
}
|
|
9
|
-
export declare function AppLayoutSplitPanelDrawerSideImplementation({ children, appLayoutInternals, splitPanelInternals, }: AppLayoutSplitPanelDrawerSideImplementationProps): JSX.Element;
|
|
10
|
+
export declare function AppLayoutSplitPanelDrawerSideImplementation({ children, appLayoutInternals, splitPanelInternals, bottomDrawerReportedSize, }: AppLayoutSplitPanelDrawerSideImplementationProps): JSX.Element;
|
|
10
11
|
interface AppLayoutSplitPanelDrawerBottomImplementationProps {
|
|
11
12
|
appLayoutInternals: AppLayoutInternals;
|
|
12
13
|
splitPanelInternals: SplitPanelProviderProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/split-panel/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAsB,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAEhF,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAInD,UAAU,gDAAgD;IACxD,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,mBAAmB,EAAE,uBAAuB,CAAC;IAC7C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,wBAAgB,2CAA2C,CAAC,EAC1D,QAAQ,EACR,kBAAkB,EAClB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/split-panel/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAsB,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAEhF,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAInD,UAAU,gDAAgD;IACxD,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,mBAAmB,EAAE,uBAAuB,CAAC;IAC7C,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,wBAAgB,2CAA2C,CAAC,EAC1D,QAAQ,EACR,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,GACzB,EAAE,gDAAgD,eAuBlD;AAED,UAAU,kDAAkD;IAC1D,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,mBAAmB,EAAE,uBAAuB,CAAC;IAC7C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,wBAAgB,6CAA6C,CAAC,EAC5D,QAAQ,EACR,mBAAmB,EACnB,kBAAkB,GACnB,EAAE,kDAAkD,eAOpD"}
|
|
@@ -4,9 +4,9 @@ import React from 'react';
|
|
|
4
4
|
import { SplitPanelProvider } from '../../split-panel';
|
|
5
5
|
import { getDrawerStyles } from '../compute-layout';
|
|
6
6
|
import styles from './styles.css.js';
|
|
7
|
-
export function AppLayoutSplitPanelDrawerSideImplementation({ children, appLayoutInternals, splitPanelInternals, }) {
|
|
7
|
+
export function AppLayoutSplitPanelDrawerSideImplementation({ children, appLayoutInternals, splitPanelInternals, bottomDrawerReportedSize, }) {
|
|
8
8
|
const { splitPanelControlId, placement, verticalOffsets, isMobile, splitPanelAnimationDisabled } = appLayoutInternals;
|
|
9
|
-
const { drawerTopOffset, drawerHeight } = getDrawerStyles(verticalOffsets, isMobile, placement);
|
|
9
|
+
const { drawerTopOffset, drawerHeight } = getDrawerStyles(verticalOffsets, isMobile, placement, isMobile ? 0 : (bottomDrawerReportedSize !== null && bottomDrawerReportedSize !== void 0 ? bottomDrawerReportedSize : 0));
|
|
10
10
|
return (React.createElement(SplitPanelProvider, Object.assign({}, splitPanelInternals, { animationDisabled: splitPanelAnimationDisabled }),
|
|
11
11
|
React.createElement("section", { id: splitPanelControlId, className: styles['split-panel-side'], style: {
|
|
12
12
|
blockSize: drawerHeight,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/split-panel/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,kBAAkB,EAA2B,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD,OAAO,MAAM,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/split-panel/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,kBAAkB,EAA2B,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AASrC,MAAM,UAAU,2CAA2C,CAAC,EAC1D,QAAQ,EACR,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,GACyB;IACjD,MAAM,EAAE,mBAAmB,EAAE,SAAS,EAAE,eAAe,EAAE,QAAQ,EAAE,2BAA2B,EAAE,GAAG,kBAAkB,CAAC;IACtH,MAAM,EAAE,eAAe,EAAE,YAAY,EAAE,GAAG,eAAe,CACvD,eAAe,EACf,QAAQ,EACR,SAAS,EACT,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,wBAAwB,aAAxB,wBAAwB,cAAxB,wBAAwB,GAAI,CAAC,CAAC,CAC/C,CAAC;IAEF,OAAO,CACL,oBAAC,kBAAkB,oBAAK,mBAAmB,IAAE,iBAAiB,EAAE,2BAA2B;QACzF,iCACE,EAAE,EAAE,mBAAmB,EACvB,SAAS,EAAE,MAAM,CAAC,kBAAkB,CAAC,EACrC,KAAK,EAAE;gBACL,SAAS,EAAE,YAAY;gBACvB,eAAe,EAAE,eAAe;aACjC,IAEA,QAAQ,CACD,CACS,CACtB,CAAC;AACJ,CAAC;AAQD,MAAM,UAAU,6CAA6C,CAAC,EAC5D,QAAQ,EACR,mBAAmB,EACnB,kBAAkB,GACiC;IACnD,MAAM,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,GAAG,kBAAkB,CAAC;IAChF,OAAO,CACL,oBAAC,kBAAkB,oBAAK,mBAAmB,IAAE,iBAAiB,EAAE,2BAA2B;QACzF,iCAAS,EAAE,EAAE,mBAAmB,IAAG,QAAQ,CAAW,CACnC,CACtB,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';\n\nimport { SplitPanelProvider, SplitPanelProviderProps } from '../../split-panel';\nimport { getDrawerStyles } from '../compute-layout';\nimport { AppLayoutInternals } from '../interfaces';\n\nimport styles from './styles.css.js';\n\ninterface AppLayoutSplitPanelDrawerSideImplementationProps {\n appLayoutInternals: AppLayoutInternals;\n splitPanelInternals: SplitPanelProviderProps;\n bottomDrawerReportedSize?: number;\n children: React.ReactNode;\n}\n\nexport function AppLayoutSplitPanelDrawerSideImplementation({\n children,\n appLayoutInternals,\n splitPanelInternals,\n bottomDrawerReportedSize,\n}: AppLayoutSplitPanelDrawerSideImplementationProps) {\n const { splitPanelControlId, placement, verticalOffsets, isMobile, splitPanelAnimationDisabled } = appLayoutInternals;\n const { drawerTopOffset, drawerHeight } = getDrawerStyles(\n verticalOffsets,\n isMobile,\n placement,\n isMobile ? 0 : (bottomDrawerReportedSize ?? 0)\n );\n\n return (\n <SplitPanelProvider {...splitPanelInternals} animationDisabled={splitPanelAnimationDisabled}>\n <section\n id={splitPanelControlId}\n className={styles['split-panel-side']}\n style={{\n blockSize: drawerHeight,\n insetBlockStart: drawerTopOffset,\n }}\n >\n {children}\n </section>\n </SplitPanelProvider>\n );\n}\n\ninterface AppLayoutSplitPanelDrawerBottomImplementationProps {\n appLayoutInternals: AppLayoutInternals;\n splitPanelInternals: SplitPanelProviderProps;\n children: React.ReactNode;\n}\n\nexport function AppLayoutSplitPanelDrawerBottomImplementation({\n children,\n splitPanelInternals,\n appLayoutInternals,\n}: AppLayoutSplitPanelDrawerBottomImplementationProps) {\n const { splitPanelControlId, splitPanelAnimationDisabled } = appLayoutInternals;\n return (\n <SplitPanelProvider {...splitPanelInternals} animationDisabled={splitPanelAnimationDisabled}>\n <section id={splitPanelControlId}>{children}</section>\n </SplitPanelProvider>\n );\n}\n"]}
|
|
@@ -14,6 +14,7 @@ export interface SharedProps {
|
|
|
14
14
|
drawers: ReadonlyArray<AppLayoutProps.Drawer> | undefined;
|
|
15
15
|
onActiveDrawerChange: ((drawerId: string | null, params: OnChangeParams) => void) | undefined;
|
|
16
16
|
drawersFocusRef: React.Ref<Focusable> | undefined;
|
|
17
|
+
bottomDrawersFocusRef?: React.Ref<Focusable> | undefined;
|
|
17
18
|
globalDrawersFocusControl?: FocusControlMultipleStates | undefined;
|
|
18
19
|
globalDrawers?: ReadonlyArray<AppLayoutProps.Drawer> | undefined;
|
|
19
20
|
activeGlobalDrawersIds?: ReadonlyArray<string> | undefined;
|
|
@@ -26,6 +27,9 @@ export interface SharedProps {
|
|
|
26
27
|
setExpandedDrawerId?: (value: string | null) => void;
|
|
27
28
|
aiDrawer?: AppLayoutProps.Drawer | undefined;
|
|
28
29
|
aiDrawerFocusRef: React.Ref<Focusable> | undefined;
|
|
30
|
+
activeGlobalBottomDrawerId?: string | null;
|
|
31
|
+
onActiveGlobalBottomDrawerChange?: (value: string | null, params: OnChangeParams) => void;
|
|
32
|
+
bottomDrawers?: ReadonlyArray<AppLayoutProps.Drawer> | undefined;
|
|
29
33
|
}
|
|
30
34
|
export type MergeProps = (ownProps: SharedProps, additionalProps: ReadonlyArray<Partial<SharedProps>>) => ToolbarProps | null;
|
|
31
35
|
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/state/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AACtF,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAEjE,MAAM,WAAW,WAAW;IAC1B,cAAc,EAAE,OAAO,CAAC;IACxB,UAAU,EAAE,cAAc,CAAC,MAAM,GAAG,SAAS,CAAC;IAC9C,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAA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Ac,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IACjE,sBAAsB,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IAC3D,2BAA2B,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAClG,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B,qBAAqB,EAAE,qBAAqB,GAAG,SAAS,CAAC;IACzD,kBAAkB,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;IACtD,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;IAChC,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACrD,QAAQ,CAAC,EAAE,cAAc,CAAC,MAAM,GAAG,SAAS,CAAC;IAC7C,gBAAgB,EAAE,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;IACnD,0BAA0B,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3C,gCAAgC,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;IAC1F,aAAa,CAAC,EAAE,aAAa,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;CAClE;AAED,MAAM,MAAM,UAAU,GAAG,CACvB,QAAQ,EAAE,WAAW,EACrB,eAAe,EAAE,aAAa,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,KACjD,YAAY,GAAG,IAAI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/state/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { AppLayoutProps } from '../../interfaces';\nimport { OnChangeParams } from '../../utils/use-drawers';\nimport { Focusable, FocusControlMultipleStates } from '../../utils/use-focus-control';\nimport { SplitPanelToggleProps, ToolbarProps } from '../toolbar';\n\nexport interface SharedProps {\n navigationOpen: boolean;\n ariaLabels: AppLayoutProps.Labels | undefined;\n navigation: React.ReactNode;\n onNavigationToggle?: (open: boolean) => void;\n navigationFocusRef: React.Ref<Focusable> | undefined;\n breadcrumbs: React.ReactNode;\n activeDrawerId: string | null;\n drawers: ReadonlyArray<AppLayoutProps.Drawer> | undefined;\n onActiveDrawerChange: ((drawerId: string | null, params: OnChangeParams) => void) | undefined;\n drawersFocusRef: React.Ref<Focusable> | undefined;\n globalDrawersFocusControl?: FocusControlMultipleStates | undefined;\n globalDrawers?: ReadonlyArray<AppLayoutProps.Drawer> | undefined;\n activeGlobalDrawersIds?: ReadonlyArray<string> | undefined;\n onActiveGlobalDrawersChange?: ((newDrawerId: string, params: OnChangeParams) => void) | undefined;\n splitPanel: React.ReactNode;\n splitPanelToggleProps: SplitPanelToggleProps | undefined;\n splitPanelFocusRef?: React.Ref<Focusable> | undefined;\n onSplitPanelToggle?: () => void;\n expandedDrawerId?: string | null;\n setExpandedDrawerId?: (value: string | null) => void;\n aiDrawer?: AppLayoutProps.Drawer | undefined;\n aiDrawerFocusRef: React.Ref<Focusable> | undefined;\n}\n\nexport type MergeProps = (\n ownProps: SharedProps,\n additionalProps: ReadonlyArray<Partial<SharedProps>>\n) => ToolbarProps | null;\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/state/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { AppLayoutProps } from '../../interfaces';\nimport { OnChangeParams } from '../../utils/use-drawers';\nimport { Focusable, FocusControlMultipleStates } from '../../utils/use-focus-control';\nimport { SplitPanelToggleProps, ToolbarProps } from '../toolbar';\n\nexport interface SharedProps {\n navigationOpen: boolean;\n ariaLabels: AppLayoutProps.Labels | undefined;\n navigation: React.ReactNode;\n onNavigationToggle?: (open: boolean) => void;\n navigationFocusRef: React.Ref<Focusable> | undefined;\n breadcrumbs: React.ReactNode;\n activeDrawerId: string | null;\n drawers: ReadonlyArray<AppLayoutProps.Drawer> | undefined;\n onActiveDrawerChange: ((drawerId: string | null, params: OnChangeParams) => void) | undefined;\n drawersFocusRef: React.Ref<Focusable> | undefined;\n bottomDrawersFocusRef?: React.Ref<Focusable> | undefined;\n globalDrawersFocusControl?: FocusControlMultipleStates | undefined;\n globalDrawers?: ReadonlyArray<AppLayoutProps.Drawer> | undefined;\n activeGlobalDrawersIds?: ReadonlyArray<string> | undefined;\n onActiveGlobalDrawersChange?: ((newDrawerId: string, params: OnChangeParams) => void) | undefined;\n splitPanel: React.ReactNode;\n splitPanelToggleProps: SplitPanelToggleProps | undefined;\n splitPanelFocusRef?: React.Ref<Focusable> | undefined;\n onSplitPanelToggle?: () => void;\n expandedDrawerId?: string | null;\n setExpandedDrawerId?: (value: string | null) => void;\n aiDrawer?: AppLayoutProps.Drawer | undefined;\n aiDrawerFocusRef: React.Ref<Focusable> | undefined;\n activeGlobalBottomDrawerId?: string | null;\n onActiveGlobalBottomDrawerChange?: (value: string | null, params: OnChangeParams) => void;\n bottomDrawers?: ReadonlyArray<AppLayoutProps.Drawer> | undefined;\n}\n\nexport type MergeProps = (\n ownProps: SharedProps,\n additionalProps: ReadonlyArray<Partial<SharedProps>>\n) => ToolbarProps | null;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props-merger.d.ts","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/state/props-merger.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAE9E,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAavD,eAAO,MAAM,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"props-merger.d.ts","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/state/props-merger.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAE9E,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAavD,eAAO,MAAM,UAAU,EAAE,UA+DxB,CAAC;AAEF,eAAO,MAAM,eAAe,UAAW,sBAAsB,kBAAkB,qBAAqB,KAAG,WAoCtG,CAAC"}
|
|
@@ -32,6 +32,14 @@ export const mergeProps = (ownProps, additionalProps) => {
|
|
|
32
32
|
!checkAlreadyExists(!!toolbar.aiDrawerFocusRef, 'aiDrawerFocusRef')) {
|
|
33
33
|
toolbar.aiDrawerFocusRef = props.aiDrawerFocusRef;
|
|
34
34
|
}
|
|
35
|
+
if (props.bottomDrawers &&
|
|
36
|
+
props.bottomDrawers.some(drawer => drawer.trigger) &&
|
|
37
|
+
!checkAlreadyExists(!!toolbar.bottomDrawers, 'bottomDrawers')) {
|
|
38
|
+
toolbar.bottomDrawers = props.bottomDrawers;
|
|
39
|
+
toolbar.bottomDrawersFocusRef = props.bottomDrawersFocusRef;
|
|
40
|
+
toolbar.activeGlobalBottomDrawerId = props.activeGlobalBottomDrawerId;
|
|
41
|
+
toolbar.onActiveGlobalBottomDrawerChange = props.onActiveGlobalBottomDrawerChange;
|
|
42
|
+
}
|
|
35
43
|
if (props.navigation && !checkAlreadyExists(!!toolbar.hasNavigation, 'navigation')) {
|
|
36
44
|
toolbar.hasNavigation = true;
|
|
37
45
|
toolbar.navigationOpen = props.navigationOpen;
|
|
@@ -75,7 +83,11 @@ export const getPropsToMerge = (props, appLayoutState) => {
|
|
|
75
83
|
activeGlobalDrawersIds: state === null || state === void 0 ? void 0 : state.activeGlobalDrawersIds,
|
|
76
84
|
onActiveGlobalDrawersChange: state === null || state === void 0 ? void 0 : state.onActiveGlobalDrawersChange,
|
|
77
85
|
onActiveDrawerChange: state === null || state === void 0 ? void 0 : state.onActiveDrawerChange,
|
|
86
|
+
bottomDrawers: state === null || state === void 0 ? void 0 : state.bottomDrawers,
|
|
87
|
+
activeGlobalBottomDrawerId: state === null || state === void 0 ? void 0 : state.activeGlobalBottomDrawerId,
|
|
88
|
+
onActiveGlobalBottomDrawerChange: state === null || state === void 0 ? void 0 : state.onActiveGlobalBottomDrawerChange,
|
|
78
89
|
drawersFocusRef: state === null || state === void 0 ? void 0 : state.drawersFocusControl.refs.toggle,
|
|
90
|
+
bottomDrawersFocusRef: state === null || state === void 0 ? void 0 : state.bottomDrawersFocusControl.refs.toggle,
|
|
79
91
|
splitPanel: props.splitPanel,
|
|
80
92
|
splitPanelToggleProps: (state === null || state === void 0 ? void 0 : state.splitPanelToggleConfig) && Object.assign(Object.assign({}, state.splitPanelToggleConfig), { active: state === null || state === void 0 ? void 0 : state.splitPanelOpen, controlId: state === null || state === void 0 ? void 0 : state.splitPanelControlId, position: state === null || state === void 0 ? void 0 : state.splitPanelPosition }),
|
|
81
93
|
splitPanelFocusRef: state === null || state === void 0 ? void 0 : state.splitPanelFocusControl.refs.toggle,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props-merger.js","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/state/props-merger.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAMzE,SAAS,kBAAkB,CAAC,KAAc,EAAE,QAAgB;IAC1D,IAAI,KAAK,EAAE;QACT,QAAQ,CACN,WAAW,EACX,4DAA4D,QAAQ,2CAA2C,CAChH,CAAC;QACF,OAAO,IA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ourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { AppLayoutInternalProps, AppLayoutPendingState } from '../interfaces';\nimport { ToolbarProps } from '../toolbar';\nimport { MergeProps, SharedProps } from './interfaces';\n\nfunction checkAlreadyExists(value: boolean, propName: string) {\n if (value) {\n warnOnce(\n 'AppLayout',\n `Another app layout instance on this page already defines ${propName} property. This instance will be ignored.`\n );\n return true;\n }\n return false;\n}\n\nexport const mergeProps: MergeProps = (ownProps, additionalProps) => {\n const toolbar: ToolbarProps = {};\n for (const props of [ownProps, ...additionalProps]) {\n toolbar.ariaLabels = { ...toolbar.ariaLabels, ...props.ariaLabels };\n if (\n props.drawers &&\n props.drawers.some(drawer => drawer.trigger) &&\n !checkAlreadyExists(!!toolbar.drawers, 'tools or drawers')\n ) {\n toolbar.drawers = props.drawers;\n toolbar.activeDrawerId = props.activeDrawerId;\n toolbar.drawersFocusRef = props.drawersFocusRef;\n toolbar.onActiveDrawerChange = props.onActiveDrawerChange;\n }\n if (props.globalDrawers && !checkAlreadyExists(!!toolbar.globalDrawers, 'globalDrawers')) {\n toolbar.globalDrawersFocusControl = props.globalDrawersFocusControl;\n toolbar.globalDrawers = props.globalDrawers;\n toolbar.activeGlobalDrawersIds = props.activeGlobalDrawersIds;\n toolbar.onActiveGlobalDrawersChange = props.onActiveGlobalDrawersChange;\n }\n if (\n props.aiDrawer &&\n props.aiDrawerFocusRef &&\n !checkAlreadyExists(!!toolbar.aiDrawerFocusRef, 'aiDrawerFocusRef')\n ) {\n toolbar.aiDrawerFocusRef = props.aiDrawerFocusRef;\n }\n if (props.navigation && !checkAlreadyExists(!!toolbar.hasNavigation, 'navigation')) {\n toolbar.hasNavigation = true;\n toolbar.navigationOpen = props.navigationOpen;\n toolbar.navigationFocusRef = props.navigationFocusRef;\n toolbar.onNavigationToggle = props.onNavigationToggle;\n }\n if (\n props.splitPanel &&\n props.splitPanelToggleProps?.displayed &&\n !checkAlreadyExists(!!toolbar.hasSplitPanel, 'splitPanel')\n ) {\n toolbar.hasSplitPanel = true;\n toolbar.splitPanelFocusRef = props.splitPanelFocusRef;\n toolbar.splitPanelToggleProps = props.splitPanelToggleProps;\n toolbar.onSplitPanelToggle = props.onSplitPanelToggle;\n }\n if (props.breadcrumbs && !checkAlreadyExists(!!toolbar.hasBreadcrumbsPortal, 'hasBreadcrumbsPortal')) {\n toolbar.hasBreadcrumbsPortal = true;\n }\n if (props.expandedDrawerId && !checkAlreadyExists(!!toolbar.expandedDrawerId, 'expandedDrawerId')) {\n toolbar.expandedDrawerId = props.expandedDrawerId;\n toolbar.setExpandedDrawerId = props.setExpandedDrawerId;\n }\n }\n // do not render toolbar if no fields are defined, except ariaLabels, which are always there\n return Object.keys(toolbar).filter(key => key !== 'ariaLabels').length > 0 ? toolbar : null;\n};\n\nexport const getPropsToMerge = (props: AppLayoutInternalProps, appLayoutState: AppLayoutPendingState): SharedProps => {\n const state = appLayoutState.widgetizedState;\n return {\n breadcrumbs: props.breadcrumbs,\n ariaLabels: state ? state.ariaLabels : props.ariaLabels,\n navigation: !props.navigationTriggerHide && !props.navigationHide,\n navigationOpen: state ? state.navigationOpen : props.navigationOpen,\n onNavigationToggle: state?.onNavigationToggle,\n navigationFocusRef: state?.navigationFocusControl.refs.toggle,\n activeDrawerId: state?.activeDrawer?.id ?? null,\n // only pass it down if there are non-empty drawers or tools\n drawers: state?.drawers?.length || !props.toolsHide ? state?.drawers : undefined,\n globalDrawersFocusControl: state?.globalDrawersFocusControl,\n globalDrawers: state?.globalDrawers?.length ? state.globalDrawers : undefined,\n activeGlobalDrawersIds: state?.activeGlobalDrawersIds,\n onActiveGlobalDrawersChange: state?.onActiveGlobalDrawersChange,\n onActiveDrawerChange: state?.onActiveDrawerChange,\n drawersFocusRef: state?.drawersFocusControl.refs.toggle,\n splitPanel: props.splitPanel,\n splitPanelToggleProps: state?.splitPanelToggleConfig && {\n ...state.splitPanelToggleConfig,\n active: state?.splitPanelOpen,\n controlId: state?.splitPanelControlId,\n position: state?.splitPanelPosition,\n },\n splitPanelFocusRef: state?.splitPanelFocusControl.refs.toggle,\n onSplitPanelToggle: state?.onSplitPanelToggle,\n expandedDrawerId: state?.expandedDrawerId,\n setExpandedDrawerId: state?.setExpandedDrawerId,\n aiDrawer: state?.aiDrawer ?? undefined,\n aiDrawerFocusRef: state?.aiDrawerFocusControl?.refs?.toggle,\n };\n};\n"]}
|
|
1
|
+
{"version":3,"file":"props-merger.js","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/state/props-merger.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAMzE,SAAS,kBAAkB,CAAC,KAAc,EAAE,QAAgB;IAC1D,IAAI,KAAK,EAAE;QACT,QAAQ,CACN,WAAW,EACX,4DAA4D,QAAQ,2CAA2C,CAChH,CAAC;QACF,OAAO,IAAI,CAAC;KACb;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,CAAC,MAAM,UAAU,GAAe,CAAC,QAAQ,EAAE,eAAe,EAAE,EAAE;;IAClE,MAAM,OAAO,GAAiB,EAAE,CAAC;IACjC,KAAK,MAAM,KAAK,IAAI,CAAC,QAAQ,EAAE,GAAG,eAAe,CAAC,EAAE;QAClD,OAAO,CAAC,UAAU,mCAAQ,OAAO,CAAC,UAAU,GAAK,KAAK,CAAC,UAAU,CAAE,CAAC;QACpE,IACE,KAAK,CAAC,OAAO;YACb,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC;YAC5C,CAAC,kBAAkB,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,kBAAkB,CAAC,EAC1D;YACA,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;YAChC,OAA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;QACtC,gBAAgB,EAAE,MAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,oBAAoB,0CAAE,IAAI,0CAAE,MAAM;KAC5D,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { AppLayoutInternalProps, AppLayoutPendingState } from '../interfaces';\nimport { ToolbarProps } from '../toolbar';\nimport { MergeProps, SharedProps } from './interfaces';\n\nfunction checkAlreadyExists(value: boolean, propName: string) {\n if (value) {\n warnOnce(\n 'AppLayout',\n `Another app layout instance on this page already defines ${propName} property. This instance will be ignored.`\n );\n return true;\n }\n return false;\n}\n\nexport const mergeProps: MergeProps = (ownProps, additionalProps) => {\n const toolbar: ToolbarProps = {};\n for (const props of [ownProps, ...additionalProps]) {\n toolbar.ariaLabels = { ...toolbar.ariaLabels, ...props.ariaLabels };\n if (\n props.drawers &&\n props.drawers.some(drawer => drawer.trigger) &&\n !checkAlreadyExists(!!toolbar.drawers, 'tools or drawers')\n ) {\n toolbar.drawers = props.drawers;\n toolbar.activeDrawerId = props.activeDrawerId;\n toolbar.drawersFocusRef = props.drawersFocusRef;\n toolbar.onActiveDrawerChange = props.onActiveDrawerChange;\n }\n if (props.globalDrawers && !checkAlreadyExists(!!toolbar.globalDrawers, 'globalDrawers')) {\n toolbar.globalDrawersFocusControl = props.globalDrawersFocusControl;\n toolbar.globalDrawers = props.globalDrawers;\n toolbar.activeGlobalDrawersIds = props.activeGlobalDrawersIds;\n toolbar.onActiveGlobalDrawersChange = props.onActiveGlobalDrawersChange;\n }\n if (\n props.aiDrawer &&\n props.aiDrawerFocusRef &&\n !checkAlreadyExists(!!toolbar.aiDrawerFocusRef, 'aiDrawerFocusRef')\n ) {\n toolbar.aiDrawerFocusRef = props.aiDrawerFocusRef;\n }\n if (\n props.bottomDrawers &&\n props.bottomDrawers.some(drawer => drawer.trigger) &&\n !checkAlreadyExists(!!toolbar.bottomDrawers, 'bottomDrawers')\n ) {\n toolbar.bottomDrawers = props.bottomDrawers;\n toolbar.bottomDrawersFocusRef = props.bottomDrawersFocusRef;\n toolbar.activeGlobalBottomDrawerId = props.activeGlobalBottomDrawerId;\n toolbar.onActiveGlobalBottomDrawerChange = props.onActiveGlobalBottomDrawerChange;\n }\n if (props.navigation && !checkAlreadyExists(!!toolbar.hasNavigation, 'navigation')) {\n toolbar.hasNavigation = true;\n toolbar.navigationOpen = props.navigationOpen;\n toolbar.navigationFocusRef = props.navigationFocusRef;\n toolbar.onNavigationToggle = props.onNavigationToggle;\n }\n if (\n props.splitPanel &&\n props.splitPanelToggleProps?.displayed &&\n !checkAlreadyExists(!!toolbar.hasSplitPanel, 'splitPanel')\n ) {\n toolbar.hasSplitPanel = true;\n toolbar.splitPanelFocusRef = props.splitPanelFocusRef;\n toolbar.splitPanelToggleProps = props.splitPanelToggleProps;\n toolbar.onSplitPanelToggle = props.onSplitPanelToggle;\n }\n if (props.breadcrumbs && !checkAlreadyExists(!!toolbar.hasBreadcrumbsPortal, 'hasBreadcrumbsPortal')) {\n toolbar.hasBreadcrumbsPortal = true;\n }\n if (props.expandedDrawerId && !checkAlreadyExists(!!toolbar.expandedDrawerId, 'expandedDrawerId')) {\n toolbar.expandedDrawerId = props.expandedDrawerId;\n toolbar.setExpandedDrawerId = props.setExpandedDrawerId;\n }\n }\n // do not render toolbar if no fields are defined, except ariaLabels, which are always there\n return Object.keys(toolbar).filter(key => key !== 'ariaLabels').length > 0 ? toolbar : null;\n};\n\nexport const getPropsToMerge = (props: AppLayoutInternalProps, appLayoutState: AppLayoutPendingState): SharedProps => {\n const state = appLayoutState.widgetizedState;\n return {\n breadcrumbs: props.breadcrumbs,\n ariaLabels: state ? state.ariaLabels : props.ariaLabels,\n navigation: !props.navigationTriggerHide && !props.navigationHide,\n navigationOpen: state ? state.navigationOpen : props.navigationOpen,\n onNavigationToggle: state?.onNavigationToggle,\n navigationFocusRef: state?.navigationFocusControl.refs.toggle,\n activeDrawerId: state?.activeDrawer?.id ?? null,\n // only pass it down if there are non-empty drawers or tools\n drawers: state?.drawers?.length || !props.toolsHide ? state?.drawers : undefined,\n globalDrawersFocusControl: state?.globalDrawersFocusControl,\n globalDrawers: state?.globalDrawers?.length ? state.globalDrawers : undefined,\n activeGlobalDrawersIds: state?.activeGlobalDrawersIds,\n onActiveGlobalDrawersChange: state?.onActiveGlobalDrawersChange,\n onActiveDrawerChange: state?.onActiveDrawerChange,\n bottomDrawers: state?.bottomDrawers,\n activeGlobalBottomDrawerId: state?.activeGlobalBottomDrawerId,\n onActiveGlobalBottomDrawerChange: state?.onActiveGlobalBottomDrawerChange,\n drawersFocusRef: state?.drawersFocusControl.refs.toggle,\n bottomDrawersFocusRef: state?.bottomDrawersFocusControl.refs.toggle,\n splitPanel: props.splitPanel,\n splitPanelToggleProps: state?.splitPanelToggleConfig && {\n ...state.splitPanelToggleConfig,\n active: state?.splitPanelOpen,\n controlId: state?.splitPanelControlId,\n position: state?.splitPanelPosition,\n },\n splitPanelFocusRef: state?.splitPanelFocusControl.refs.toggle,\n onSplitPanelToggle: state?.onSplitPanelToggle,\n expandedDrawerId: state?.expandedDrawerId,\n setExpandedDrawerId: state?.setExpandedDrawerId,\n aiDrawer: state?.aiDrawer ?? undefined,\n aiDrawerFocusRef: state?.aiDrawerFocusControl?.refs?.toggle,\n };\n};\n"]}
|
package/lib/internal/template/app-layout/visual-refresh-toolbar/state/use-ai-drawer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-ai-drawer.d.ts","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/state/use-ai-drawer.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"use-ai-drawer.d.ts","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/state/use-ai-drawer.ts"],"names":[],"mappings":";AAKA,OAAO,EAA0C,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAIpH,MAAM,WAAW,cAAc;IAC7B,qBAAqB,EAAE,OAAO,CAAC;CAChC;AAMD,UAAU,eAAe;IACvB,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACpD,kBAAkB,EAAE,MAAM,MAAM,CAAC;CAClC;AAED,wBAAgB,WAAW,CAAC,EAC1B,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,GACnB,EAAE,eAAe;;;;;;;oCAkCuB,aAAa;0CApBrC,MAAM,GAAG,IAAI,8BACC,cAAc;;;;;;;;;;mCARL,MAAM;EAmE7C"}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { useRef, useState } from 'react';
|
|
4
4
|
import { fireNonCancelableEvent } from '../../../internal/events';
|
|
5
|
-
import { metrics } from '../../../internal/metrics';
|
|
6
5
|
import { getLimitedValue } from '../../../split-panel/utils/size-utils';
|
|
7
6
|
import { mapRuntimeConfigToAiDrawer } from '../../runtime-drawer';
|
|
8
7
|
const DEFAULT_ON_CHANGE_PARAMS = { initiatedByUserAction: true };
|
|
@@ -32,11 +31,6 @@ export function useAiDrawer({ onAiDrawerFocus, expandedDrawerId, setExpandedDraw
|
|
|
32
31
|
}
|
|
33
32
|
onAiDrawerFocus === null || onAiDrawerFocus === void 0 ? void 0 : onAiDrawerFocus();
|
|
34
33
|
}
|
|
35
|
-
function checkId(newId) {
|
|
36
|
-
if (runtimeDrawer && runtimeDrawer.id !== newId) {
|
|
37
|
-
metrics.sendOpsMetricObject('awsui-widget-drawer-incorrect-id', { oldId: runtimeDrawer.id, newId });
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
34
|
function aiDrawerMessageHandler(event) {
|
|
41
35
|
if (event.type === 'registerLeftDrawer') {
|
|
42
36
|
setRuntimeDrawer(event.payload);
|
|
@@ -47,28 +41,17 @@ export function useAiDrawer({ onAiDrawerFocus, expandedDrawerId, setExpandedDraw
|
|
|
47
41
|
}
|
|
48
42
|
switch (event.type) {
|
|
49
43
|
case 'updateDrawerConfig':
|
|
50
|
-
checkId(event.payload.id);
|
|
51
44
|
setRuntimeDrawer(current => (current ? Object.assign(Object.assign({}, current), event.payload) : current));
|
|
52
45
|
break;
|
|
53
46
|
case 'openDrawer':
|
|
54
|
-
checkId(event.payload.id);
|
|
55
47
|
onActiveAiDrawerChange(event.payload.id, { initiatedByUserAction: false });
|
|
56
48
|
break;
|
|
57
49
|
case 'closeDrawer':
|
|
58
|
-
checkId(event.payload.id);
|
|
59
50
|
onActiveAiDrawerChange(null, { initiatedByUserAction: false });
|
|
60
51
|
break;
|
|
61
52
|
case 'resizeDrawer':
|
|
62
|
-
checkId(event.payload.id);
|
|
63
53
|
onActiveAiDrawerResize(event.payload.size);
|
|
64
54
|
break;
|
|
65
|
-
case 'expandDrawer':
|
|
66
|
-
checkId(event.payload.id);
|
|
67
|
-
setExpandedDrawerId(event.payload.id);
|
|
68
|
-
break;
|
|
69
|
-
case 'exitExpandedMode':
|
|
70
|
-
setExpandedDrawerId(null);
|
|
71
|
-
break;
|
|
72
55
|
}
|
|
73
56
|
}
|
|
74
57
|
const aiDrawer = runtimeDrawer && mapRuntimeConfigToAiDrawer(runtimeDrawer);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-ai-drawer.js","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/state/use-ai-drawer.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"use-ai-drawer.js","sourceR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qBAAqB,EAAE,KAAK,EAAE,CAAC,CAAC;gBAC3E,MAAM;YACR,KAAK,aAAa;gBAChB,sBAAsB,CAAC,IAAI,EAAE,EAAE,qBAAqB,EAAE,KAAK,EAAE,CAAC,CAAC;gBAC/D,MAAM;YACR,KAAK,cAAc;gBACjB,sBAAsB,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;gBAC3C,MAAM;SACT;IACH,CAAC;IAED,MAAM,QAAQ,GAAG,aAAa,IAAI,0BAA0B,CAAC,aAAa,CAAC,CAAC;IAC5E,MAAM,cAAc,GAAG,gBAAgB,IAAI,gBAAgB,MAAK,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,EAAE,CAAA,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;IAC/F,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,MAAA,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,WAAW,mCAAI,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3G,MAAM,eAAe,GAAG,IAAI,CAAC,GAAG,CAAC,MAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,WAAW,mCAAI,eAAe,EAAE,eAAe,CAAC,CAAC;IAElG,OAAO;QACL,QAAQ;QACR,sBAAsB;QACtB,sBAAsB;QACtB,cAAc;QACd,gBAAgB;QAChB,kBAAkB;QAClB,eAAe;QACf,sBAAsB;KACvB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { useRef, useState } from 'react';\n\nimport { fireNonCancelableEvent } from '../../../internal/events';\nimport { DrawerPayload as RuntimeAiDrawerConfig, WidgetMessage } from '../../../internal/plugins/widget/interfaces';\nimport { getLimitedValue } from '../../../split-panel/utils/size-utils';\nimport { mapRuntimeConfigToAiDrawer } from '../../runtime-drawer';\n\nexport interface OnChangeParams {\n initiatedByUserAction: boolean;\n}\n\nconst DEFAULT_ON_CHANGE_PARAMS = { initiatedByUserAction: true };\n\nconst MIN_DRAWER_SIZE = 400;\n\ninterface UseDrawersProps {\n onAiDrawerFocus: () => void;\n expandedDrawerId: string | null;\n setExpandedDrawerId: (value: string | null) => void;\n getMaxAiDrawerSize: () => number;\n}\n\nexport function useAiDrawer({\n onAiDrawerFocus,\n expandedDrawerId,\n setExpandedDrawerId,\n getMaxAiDrawerSize,\n}: UseDrawersProps) {\n const [runtimeDrawer, setRuntimeDrawer] = useState<RuntimeAiDrawerConfig | null>(null);\n const [activeAiDrawerId, setActiveAiDrawerId] = useState<string | null>(null);\n const [size, setSize] = useState<number | null>(null);\n const aiDrawerWasOpenRef = useRef(false);\n aiDrawerWasOpenRef.current = aiDrawerWasOpenRef.current || !!activeAiDrawerId;\n\n function onActiveAiDrawerResize(size: number) {\n const limitedSize = getLimitedValue(minAiDrawerSize, size, getMaxAiDrawerSize());\n setSize(limitedSize);\n fireNonCancelableEvent(activeAiDrawer?.onResize, { id: activeAiDrawerId, size: limitedSize });\n }\n\n function onActiveAiDrawerChange(\n newDrawerId: string | null,\n { initiatedByUserAction }: OnChangeParams = DEFAULT_ON_CHANGE_PARAMS\n ) {\n setActiveAiDrawerId(newDrawerId);\n\n if (newDrawerId) {\n fireNonCancelableEvent(runtimeDrawer?.onToggle, { isOpen: true, initiatedByUserAction });\n }\n\n if (activeAiDrawerId) {\n fireNonCancelableEvent(runtimeDrawer?.onToggle, { isOpen: false, initiatedByUserAction });\n\n if (activeAiDrawerId === expandedDrawerId) {\n setExpandedDrawerId?.(null);\n }\n }\n\n onAiDrawerFocus?.();\n }\n\n function aiDrawerMessageHandler(event: WidgetMessage) {\n if (event.type === 'registerLeftDrawer') {\n setRuntimeDrawer(event.payload);\n if (!aiDrawerWasOpenRef.current && event.payload.defaultActive) {\n onActiveAiDrawerChange(event.payload.id, { initiatedByUserAction: false });\n }\n return;\n }\n\n switch (event.type) {\n case 'updateDrawerConfig':\n setRuntimeDrawer(current => (current ? { ...current, ...event.payload } : current));\n break;\n case 'openDrawer':\n onActiveAiDrawerChange(event.payload.id, { initiatedByUserAction: false });\n break;\n case 'closeDrawer':\n onActiveAiDrawerChange(null, { initiatedByUserAction: false });\n break;\n case 'resizeDrawer':\n onActiveAiDrawerResize(event.payload.size);\n break;\n }\n }\n\n const aiDrawer = runtimeDrawer && mapRuntimeConfigToAiDrawer(runtimeDrawer);\n const activeAiDrawer = activeAiDrawerId && activeAiDrawerId === aiDrawer?.id ? aiDrawer : null;\n const activeAiDrawerSize = activeAiDrawerId ? (size ?? activeAiDrawer?.defaultSize ?? MIN_DRAWER_SIZE) : 0;\n const minAiDrawerSize = Math.min(activeAiDrawer?.defaultSize ?? MIN_DRAWER_SIZE, MIN_DRAWER_SIZE);\n\n return {\n aiDrawer,\n aiDrawerMessageHandler,\n onActiveAiDrawerChange,\n activeAiDrawer,\n activeAiDrawerId,\n activeAiDrawerSize,\n minAiDrawerSize,\n onActiveAiDrawerResize,\n };\n}\n"]}
|
package/lib/internal/template/app-layout/visual-refresh-toolbar/state/use-app-layout.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-app-layout.d.ts","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/state/use-app-layout.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,YAAY,EAAiE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"use-app-layout.d.ts","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/state/use-app-layout.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,YAAY,EAAiE,MAAM,OAAO,CAAC;AAc3G,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAYlD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,sBAAsB,EAAsB,MAAM,eAAe,CAAC;AAK3E,eAAO,MAAM,YAAY,eACX,OAAO,4fA2BhB,sBAAsB,cACb,aAAa,eAAe,GAAG,CAAC,KAC3C,cA4hBF,CAAC"}
|
|
@@ -7,6 +7,7 @@ import { fireNonCancelableEvent } from '../../../internal/events';
|
|
|
7
7
|
import { useControllable } from '../../../internal/hooks/use-controllable';
|
|
8
8
|
import { useIntersectionObserver } from '../../../internal/hooks/use-intersection-observer';
|
|
9
9
|
import { useMobile } from '../../../internal/hooks/use-mobile';
|
|
10
|
+
import { metrics } from '../../../internal/metrics';
|
|
10
11
|
import { useGetGlobalBreadcrumbs } from '../../../internal/plugins/helpers/use-global-breadcrumbs';
|
|
11
12
|
import globalVars from '../../../internal/styles/global-vars';
|
|
12
13
|
import { getSplitPanelDefaultSize } from '../../../split-panel/utils/size-utils';
|
|
@@ -16,9 +17,10 @@ import { useGlobalScrollPadding } from '../../utils/use-global-scroll-padding';
|
|
|
16
17
|
import { useSplitPanelFocusControl } from '../../utils/use-split-panel-focus-control';
|
|
17
18
|
import { computeHorizontalLayout, computeSplitPanelOffsets, computeVerticalLayout, CONTENT_PADDING, } from '../compute-layout';
|
|
18
19
|
import { useAiDrawer } from './use-ai-drawer';
|
|
20
|
+
import { useBottomDrawers } from './use-bottom-drawers';
|
|
19
21
|
import { useWidgetMessages } from './use-widget-messages';
|
|
20
22
|
export const useAppLayout = (hasToolbar, _a, forwardRef) => {
|
|
21
|
-
var _b, _c;
|
|
23
|
+
var _b, _c, _d;
|
|
22
24
|
var { ariaLabels, navigationOpen, navigationWidth, navigation, navigationHide, onNavigationChange, tools, toolsOpen: controlledToolsOpen, onToolsChange, toolsHide, toolsWidth, headerVariant, breadcrumbs, stickyNotifications, splitPanelPreferences: controlledSplitPanelPreferences, splitPanelOpen: controlledSplitPanelOpen, splitPanel, splitPanelSize: controlledSplitPanelSize, onSplitPanelToggle, onSplitPanelResize, onSplitPanelPreferencesChange, minContentWidth, placement, navigationTriggerHide } = _a, rest = __rest(_a, ["ariaLabels", "navigationOpen", "navigationWidth", "navigation", "navigationHide", "onNavigationChange", "tools", "toolsOpen", "onToolsChange", "toolsHide", "toolsWidth", "headerVariant", "breadcrumbs", "stickyNotifications", "splitPanelPreferences", "splitPanelOpen", "splitPanel", "splitPanelSize", "onSplitPanelToggle", "onSplitPanelResize", "onSplitPanelPreferencesChange", "minContentWidth", "placement", "navigationTriggerHide"]);
|
|
23
25
|
const isMobile = useMobile();
|
|
24
26
|
const splitPanelControlId = useUniqueId('split-panel');
|
|
@@ -49,10 +51,10 @@ export const useAppLayout = (hasToolbar, _a, forwardRef) => {
|
|
|
49
51
|
};
|
|
50
52
|
const onAddNewActiveDrawer = (drawerId) => {
|
|
51
53
|
var _a, _b;
|
|
52
|
-
// If a local drawer is already open, and we attempt to open a new one,
|
|
54
|
+
// If either a local drawer or a bottom drawer is already open, and we attempt to open a new one,
|
|
53
55
|
// it will replace the existing one instead of opening an additional drawer,
|
|
54
56
|
// since only one local drawer is supported. Therefore, layout calculations are not necessary.
|
|
55
|
-
if (activeDrawer && (drawers === null || drawers === void 0 ? void 0 : drawers.find(drawer => drawer.id === drawerId))) {
|
|
57
|
+
if ((activeDrawer && (drawers === null || drawers === void 0 ? void 0 : drawers.find(drawer => drawer.id === drawerId))) || activeGlobalBottomDrawerId === drawerId) {
|
|
56
58
|
return;
|
|
57
59
|
}
|
|
58
60
|
// get the size of drawerId. it could be either local or global drawer
|
|
@@ -73,6 +75,9 @@ export const useAppLayout = (hasToolbar, _a, forwardRef) => {
|
|
|
73
75
|
// now we made sure we cannot accommodate the new drawer with existing ones
|
|
74
76
|
closeFirstDrawer();
|
|
75
77
|
};
|
|
78
|
+
const onGlobalBottomDrawerFocus = () => {
|
|
79
|
+
bottomDrawersFocusControl.setFocus();
|
|
80
|
+
};
|
|
76
81
|
const { drawers, activeDrawer, minDrawerSize, minGlobalDrawersSizes, activeDrawerSize, ariaLabelsWithDrawers, globalDrawers, activeGlobalDrawers, activeGlobalDrawersIds, activeGlobalDrawersSizes, drawerSizes, drawersOpenQueue, onActiveDrawerChange, onActiveDrawerResize, onActiveGlobalDrawersChange, expandedDrawerId, setExpandedDrawerId, } = useDrawers(Object.assign(Object.assign({}, rest), { onGlobalDrawerFocus, onAddNewActiveDrawer }), ariaLabels, {
|
|
77
82
|
ariaLabels,
|
|
78
83
|
toolsHide,
|
|
@@ -87,8 +92,72 @@ export const useAppLayout = (hasToolbar, _a, forwardRef) => {
|
|
|
87
92
|
expandedDrawerId,
|
|
88
93
|
setExpandedDrawerId,
|
|
89
94
|
});
|
|
90
|
-
useWidgetMessages(hasToolbar, message => aiDrawerMessageHandler(message));
|
|
91
95
|
const aiDrawerFocusControl = useAsyncFocusControl(!!(activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.id), true, activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.id);
|
|
96
|
+
const { bottomDrawers, activeBottomDrawer, onActiveBottomDrawerChange: onActiveGlobalBottomDrawerChange, activeBottomDrawerSize: activeGlobalBottomDrawerSize, minBottomDrawerSize: minGlobalBottomDrawerSize, onActiveBottomDrawerResize, bottomDrawersMessageHandler, } = useBottomDrawers({
|
|
97
|
+
onBottomDrawerFocus: onGlobalBottomDrawerFocus,
|
|
98
|
+
expandedDrawerId,
|
|
99
|
+
setExpandedDrawerId,
|
|
100
|
+
drawersOpenQueue,
|
|
101
|
+
});
|
|
102
|
+
const activeGlobalBottomDrawerId = (_b = activeBottomDrawer === null || activeBottomDrawer === void 0 ? void 0 : activeBottomDrawer.id) !== null && _b !== void 0 ? _b : null;
|
|
103
|
+
const checkAIDrawerIdExists = (id) => {
|
|
104
|
+
return (aiDrawer === null || aiDrawer === void 0 ? void 0 : aiDrawer.id) === id;
|
|
105
|
+
};
|
|
106
|
+
const checkBottomDrawerIdExists = (id) => {
|
|
107
|
+
return !!bottomDrawers.find(drawer => drawer.id === id);
|
|
108
|
+
};
|
|
109
|
+
const checkDrawerIdExists = (id) => {
|
|
110
|
+
return checkAIDrawerIdExists(id) || checkBottomDrawerIdExists(id);
|
|
111
|
+
};
|
|
112
|
+
const drawerGenericMessageHandler = (message) => {
|
|
113
|
+
var _a;
|
|
114
|
+
switch (message.type) {
|
|
115
|
+
case 'expandDrawer':
|
|
116
|
+
if (!checkDrawerIdExists(message.payload.id)) {
|
|
117
|
+
metrics.sendOpsMetricObject('awsui-widget-drawer-incorrect-id', {
|
|
118
|
+
id: message.payload.id,
|
|
119
|
+
type: message.type,
|
|
120
|
+
bottomDrawers: bottomDrawers.map(drawer => drawer.id).join(','),
|
|
121
|
+
aiDrawer: (_a = aiDrawer === null || aiDrawer === void 0 ? void 0 : aiDrawer.id) !== null && _a !== void 0 ? _a : '',
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
setExpandedDrawerId(message.payload.id);
|
|
125
|
+
break;
|
|
126
|
+
case 'exitExpandedMode':
|
|
127
|
+
setExpandedDrawerId(null);
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
useWidgetMessages(hasToolbar, message => {
|
|
132
|
+
var _a, _b;
|
|
133
|
+
if (message.type === 'expandDrawer' || message.type === 'exitExpandedMode') {
|
|
134
|
+
drawerGenericMessageHandler(message);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (!('payload' in message && 'id' in message.payload)) {
|
|
138
|
+
metrics.sendOpsMetricObject('awsui-widget-drawer-incorrect-payload', {
|
|
139
|
+
type: message.type,
|
|
140
|
+
bottomDrawers: bottomDrawers.map(drawer => drawer.id).join(','),
|
|
141
|
+
aiDrawer: (_a = aiDrawer === null || aiDrawer === void 0 ? void 0 : aiDrawer.id) !== null && _a !== void 0 ? _a : '',
|
|
142
|
+
});
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
const { id } = message.payload;
|
|
146
|
+
if (checkAIDrawerIdExists(id) || message.type === 'registerLeftDrawer') {
|
|
147
|
+
aiDrawerMessageHandler(message);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if (checkBottomDrawerIdExists(id) || message.type === 'registerBottomDrawer') {
|
|
151
|
+
bottomDrawersMessageHandler(message);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
metrics.sendOpsMetricObject('awsui-widget-drawer-incorrect-id', {
|
|
155
|
+
id,
|
|
156
|
+
type: message.type,
|
|
157
|
+
bottomDrawers: bottomDrawers.map(drawer => drawer.id).join(','),
|
|
158
|
+
aiDrawer: (_b = aiDrawer === null || aiDrawer === void 0 ? void 0 : aiDrawer.id) !== null && _b !== void 0 ? _b : '',
|
|
159
|
+
});
|
|
160
|
+
});
|
|
92
161
|
const onActiveDrawerChangeHandler = (drawerId, params = { initiatedByUserAction: true }) => {
|
|
93
162
|
onActiveDrawerChange(drawerId, params);
|
|
94
163
|
drawersFocusControl.setFocus();
|
|
@@ -114,7 +183,7 @@ export const useAppLayout = (hasToolbar, _a, forwardRef) => {
|
|
|
114
183
|
splitPanelFocusControl.setLastInteraction({ type: 'position' });
|
|
115
184
|
fireNonCancelableEvent(onSplitPanelPreferencesChange, detail);
|
|
116
185
|
};
|
|
117
|
-
const [splitPanelSize = 0, setSplitPanelSize] = useControllable(controlledSplitPanelSize, onSplitPanelResize, getSplitPanelDefaultSize((
|
|
186
|
+
const [splitPanelSize = 0, setSplitPanelSize] = useControllable(controlledSplitPanelSize, onSplitPanelResize, getSplitPanelDefaultSize((_c = splitPanelPreferences === null || splitPanelPreferences === void 0 ? void 0 : splitPanelPreferences.position) !== null && _c !== void 0 ? _c : 'bottom'), { componentName: 'AppLayout', controlledProp: 'splitPanelSize', changeHandler: 'onSplitPanelResize' });
|
|
118
187
|
const [splitPanelReportedSize, setSplitPanelReportedSize] = useState(0);
|
|
119
188
|
const [splitPanelHeaderBlockSize, setSplitPanelHeaderBlockSize] = useState(0);
|
|
120
189
|
const onSplitPanelResizeHandler = (size) => {
|
|
@@ -125,8 +194,10 @@ export const useAppLayout = (hasToolbar, _a, forwardRef) => {
|
|
|
125
194
|
ariaLabel: undefined,
|
|
126
195
|
displayed: false,
|
|
127
196
|
});
|
|
197
|
+
const [bottomDrawerReportedSize, setBottomDrawerReportedSize] = useState(0);
|
|
128
198
|
const globalDrawersFocusControl = useMultipleFocusControl(true, activeGlobalDrawersIds);
|
|
129
199
|
const drawersFocusControl = useAsyncFocusControl(!!(activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.id), true, activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.id);
|
|
200
|
+
const bottomDrawersFocusControl = useAsyncFocusControl(!!activeGlobalBottomDrawerId, true, activeGlobalBottomDrawerId);
|
|
130
201
|
const navigationFocusControl = useAsyncFocusControl(navigationOpen, navigationTriggerHide);
|
|
131
202
|
const splitPanelFocusControl = useSplitPanelFocusControl([splitPanelPreferences, splitPanelOpen]);
|
|
132
203
|
const onNavigationToggle = useStableCallback(({ isOpen, autoFocus }) => {
|
|
@@ -170,7 +241,17 @@ export const useAppLayout = (hasToolbar, _a, forwardRef) => {
|
|
|
170
241
|
const { ref: intersectionObserverRef, isIntersecting } = useIntersectionObserver({ initialState: true });
|
|
171
242
|
const rootRef = useMergeRefs(rootRefInternal, intersectionObserverRef, onMountRootRef);
|
|
172
243
|
const discoveredBreadcrumbs = useGetGlobalBreadcrumbs(hasToolbar && !breadcrumbs);
|
|
173
|
-
useGlobalScrollPadding((
|
|
244
|
+
useGlobalScrollPadding((_d = verticalOffsets.header) !== null && _d !== void 0 ? _d : 0);
|
|
245
|
+
const getMaxGlobalBottomDrawerHeight = useCallback(() => {
|
|
246
|
+
const splitPanelSize = splitPanelOpen && splitPanelPosition === 'bottom' ? splitPanelReportedSize : 0;
|
|
247
|
+
const availableHeight = document.documentElement.clientHeight - placement.insetBlockStart - placement.insetBlockEnd - splitPanelSize;
|
|
248
|
+
// skip reading sizes in JSDOM
|
|
249
|
+
if (availableHeight === 0) {
|
|
250
|
+
return Infinity;
|
|
251
|
+
}
|
|
252
|
+
// If the page is likely zoomed in at 200%, allow the split panel to fill the content area.
|
|
253
|
+
return availableHeight < 400 ? availableHeight - 40 : availableHeight - 250;
|
|
254
|
+
}, [splitPanelOpen, splitPanelPosition, splitPanelReportedSize, placement.insetBlockStart, placement.insetBlockEnd]);
|
|
174
255
|
const appLayoutInternals = {
|
|
175
256
|
ariaLabels: ariaLabelsWithDrawers,
|
|
176
257
|
headerVariant,
|
|
@@ -204,7 +285,7 @@ export const useAppLayout = (hasToolbar, _a, forwardRef) => {
|
|
|
204
285
|
toolbarState,
|
|
205
286
|
setToolbarState,
|
|
206
287
|
verticalOffsets,
|
|
207
|
-
drawersOpenQueue,
|
|
288
|
+
drawersOpenQueue: drawersOpenQueue.current,
|
|
208
289
|
setToolbarHeight,
|
|
209
290
|
setNotificationsHeight,
|
|
210
291
|
onSplitPanelToggle: onSplitPanelToggleHandler,
|
|
@@ -226,11 +307,15 @@ export const useAppLayout = (hasToolbar, _a, forwardRef) => {
|
|
|
226
307
|
};
|
|
227
308
|
const splitPanelInternals = {
|
|
228
309
|
bottomOffset: 0,
|
|
229
|
-
getMaxHeight:
|
|
230
|
-
const
|
|
310
|
+
getMaxHeight: useCallback(() => {
|
|
311
|
+
const bottomDrawerHeight = activeGlobalBottomDrawerId ? bottomDrawerReportedSize : 0;
|
|
312
|
+
const availableHeight = document.documentElement.clientHeight -
|
|
313
|
+
placement.insetBlockStart -
|
|
314
|
+
placement.insetBlockEnd -
|
|
315
|
+
bottomDrawerHeight;
|
|
231
316
|
// If the page is likely zoomed in at 200%, allow the split panel to fill the content area.
|
|
232
317
|
return availableHeight < 400 ? availableHeight - 40 : availableHeight - 250;
|
|
233
|
-
}),
|
|
318
|
+
}, [activeGlobalBottomDrawerId, bottomDrawerReportedSize, placement.insetBlockEnd, placement.insetBlockStart]),
|
|
234
319
|
maxWidth: maxSplitPanelSize,
|
|
235
320
|
isForcedPosition: splitPanelForcedPosition,
|
|
236
321
|
isOpen: splitPanelOpen,
|
|
@@ -249,7 +334,10 @@ export const useAppLayout = (hasToolbar, _a, forwardRef) => {
|
|
|
249
334
|
refs: splitPanelFocusControl.refs,
|
|
250
335
|
};
|
|
251
336
|
const closeFirstDrawer = useStableCallback(() => {
|
|
252
|
-
|
|
337
|
+
let drawerToClose = drawersOpenQueue.current[drawersOpenQueue.current.length - 1];
|
|
338
|
+
if (drawerToClose === (activeBottomDrawer === null || activeBottomDrawer === void 0 ? void 0 : activeBottomDrawer.id)) {
|
|
339
|
+
drawerToClose = drawersOpenQueue.current[drawersOpenQueue.current.length - 2];
|
|
340
|
+
}
|
|
253
341
|
if (activeDrawer && (activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.id) === drawerToClose) {
|
|
254
342
|
onActiveDrawerChange(null, { initiatedByUserAction: true });
|
|
255
343
|
}
|
|
@@ -339,7 +427,15 @@ export const useAppLayout = (hasToolbar, _a, forwardRef) => {
|
|
|
339
427
|
widgetizedState: Object.assign(Object.assign({}, appLayoutInternals), { aiDrawerExpandedMode: expandedDrawerId === (activeAiDrawer === null || activeAiDrawer === void 0 ? void 0 : activeAiDrawer.id), isNested,
|
|
340
428
|
navigationAnimationDisabled,
|
|
341
429
|
verticalOffsets,
|
|
342
|
-
splitPanelOffsets
|
|
430
|
+
splitPanelOffsets,
|
|
431
|
+
activeGlobalBottomDrawerId,
|
|
432
|
+
onActiveGlobalBottomDrawerChange,
|
|
433
|
+
activeGlobalBottomDrawerSize,
|
|
434
|
+
bottomDrawerReportedSize,
|
|
435
|
+
minGlobalBottomDrawerSize,
|
|
436
|
+
getMaxGlobalBottomDrawerHeight, reportBottomDrawerSize: useStableCallback(size => setBottomDrawerReportedSize(size)), onActiveBottomDrawerResize,
|
|
437
|
+
bottomDrawers,
|
|
438
|
+
bottomDrawersFocusControl }),
|
|
343
439
|
};
|
|
344
440
|
};
|
|
345
441
|
//# sourceMappingURL=use-app-layout.js.map
|