@cloudscape-design/components 3.0.235 → 3.0.236
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/app-layout/drawer/index.d.ts +2 -5
- package/app-layout/drawer/index.d.ts.map +1 -1
- package/app-layout/drawer/index.js.map +1 -1
- package/app-layout/index.d.ts.map +1 -1
- package/app-layout/index.js +20 -15
- package/app-layout/index.js.map +1 -1
- package/app-layout/utils/use-focus-control.d.ts +8 -6
- package/app-layout/utils/use-focus-control.d.ts.map +1 -1
- package/app-layout/utils/use-focus-control.js +21 -10
- package/app-layout/utils/use-focus-control.js.map +1 -1
- package/app-layout/utils/use-split-panel-focus-control.d.ts +21 -0
- package/app-layout/utils/use-split-panel-focus-control.d.ts.map +1 -0
- package/app-layout/utils/use-split-panel-focus-control.js +32 -0
- package/app-layout/utils/use-split-panel-focus-control.js.map +1 -0
- package/app-layout/visual-refresh/app-bar.d.ts.map +1 -1
- package/app-layout/visual-refresh/app-bar.js +3 -6
- package/app-layout/visual-refresh/app-bar.js.map +1 -1
- package/app-layout/visual-refresh/context.d.ts +6 -2
- package/app-layout/visual-refresh/context.d.ts.map +1 -1
- package/app-layout/visual-refresh/context.js +24 -11
- package/app-layout/visual-refresh/context.js.map +1 -1
- package/app-layout/visual-refresh/navigation.d.ts.map +1 -1
- package/app-layout/visual-refresh/navigation.js +3 -5
- package/app-layout/visual-refresh/navigation.js.map +1 -1
- package/app-layout/visual-refresh/split-panel.d.ts.map +1 -1
- package/app-layout/visual-refresh/split-panel.js +4 -8
- package/app-layout/visual-refresh/split-panel.js.map +1 -1
- package/app-layout/visual-refresh/tools.js +5 -6
- package/app-layout/visual-refresh/tools.js.map +1 -1
- package/autosuggest/internal.d.ts.map +1 -1
- package/autosuggest/internal.js +10 -4
- package/autosuggest/internal.js.map +1 -1
- package/breadcrumb-group/internal.d.ts.map +1 -1
- package/breadcrumb-group/internal.js +2 -2
- package/breadcrumb-group/internal.js.map +1 -1
- package/breadcrumb-group/styles.css.js +7 -6
- package/breadcrumb-group/styles.scoped.css +14 -11
- package/breadcrumb-group/styles.selectors.js +7 -6
- package/calendar/grid/index.d.ts +1 -1
- package/calendar/grid/index.d.ts.map +1 -1
- package/calendar/grid/index.js.map +1 -1
- package/calendar/header/header-button.d.ts +1 -1
- package/calendar/header/header-button.d.ts.map +1 -1
- package/calendar/header/header-button.js.map +1 -1
- package/calendar/header/index.d.ts +2 -2
- package/calendar/header/index.d.ts.map +1 -1
- package/calendar/header/index.js.map +1 -1
- package/calendar/interfaces.d.ts +3 -3
- package/calendar/interfaces.d.ts.map +1 -1
- package/calendar/interfaces.js.map +1 -1
- package/calendar/internal.d.ts +1 -1
- package/calendar/internal.d.ts.map +1 -1
- package/calendar/internal.js +6 -1
- package/calendar/internal.js.map +1 -1
- package/date-picker/index.d.ts.map +1 -1
- package/date-picker/index.js +6 -4
- package/date-picker/index.js.map +1 -1
- package/internal/context/split-panel-context.d.ts +2 -8
- package/internal/context/split-panel-context.d.ts.map +1 -1
- package/internal/context/split-panel-context.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/i18n/context.d.ts +6 -1
- package/internal/i18n/context.d.ts.map +1 -1
- package/internal/i18n/context.js +8 -2
- package/internal/i18n/context.js.map +1 -1
- package/internal/i18n/messages/all.all.js +219 -210
- package/internal/i18n/messages/all.all.json +231 -231
- package/internal/i18n/messages/all.de.js +20 -20
- package/internal/i18n/messages/all.de.json +20 -20
- package/internal/i18n/messages/all.en-GB.js +20 -20
- package/internal/i18n/messages/all.en-GB.json +20 -20
- package/internal/i18n/messages/all.en.js +20 -20
- package/internal/i18n/messages/all.en.json +20 -20
- package/internal/i18n/messages/all.es.js +20 -20
- package/internal/i18n/messages/all.es.json +20 -20
- package/internal/i18n/messages/all.fr.js +20 -20
- package/internal/i18n/messages/all.fr.json +20 -20
- package/internal/i18n/messages/all.id.js +20 -20
- package/internal/i18n/messages/all.id.json +20 -20
- package/internal/i18n/messages/all.it.js +20 -20
- package/internal/i18n/messages/all.it.json +20 -20
- package/internal/i18n/messages/all.ja.js +20 -20
- package/internal/i18n/messages/all.ja.json +20 -20
- package/internal/i18n/messages/all.ko.js +22 -19
- package/internal/i18n/messages/all.ko.json +20 -20
- package/internal/i18n/messages/all.pt-BR.js +20 -20
- package/internal/i18n/messages/all.pt-BR.json +20 -20
- package/internal/i18n/messages/all.zh-CN.js +24 -21
- package/internal/i18n/messages/all.zh-CN.json +22 -22
- package/internal/i18n/messages/all.zh-TW.js +23 -20
- package/internal/i18n/messages/all.zh-TW.json +21 -21
- package/internal/i18n/provider.js +1 -1
- package/internal/i18n/provider.js.map +1 -1
- package/internal/manifest.json +1 -1
- package/package.json +1 -1
- package/property-filter/index.js.map +1 -1
- package/select/parts/styles.css.js +9 -9
- package/select/parts/styles.scoped.css +9 -27
- package/select/parts/styles.selectors.js +9 -9
- package/split-panel/index.d.ts.map +1 -1
- package/split-panel/index.js +6 -24
- package/split-panel/index.js.map +1 -1
- package/table/body-cell/use-stable-scroll-position.d.ts.map +1 -1
- package/table/body-cell/use-stable-scroll-position.js +10 -4
- package/table/body-cell/use-stable-scroll-position.js.map +1 -1
- package/table/header-cell/index.js +2 -3
- package/table/header-cell/index.js.map +1 -1
- package/table/use-table-focus-navigation.d.ts +1 -1
- package/table/use-table-focus-navigation.d.ts.map +1 -1
- package/table/use-table-focus-navigation.js +4 -4
- package/table/use-table-focus-navigation.js.map +1 -1
- package/tutorial-panel/components/tutorial-list/index.d.ts +0 -1
- package/tutorial-panel/components/tutorial-list/index.d.ts.map +1 -1
- package/tutorial-panel/components/tutorial-list/index.js +3 -15
- package/tutorial-panel/components/tutorial-list/index.js.map +1 -1
- package/tutorial-panel/index.d.ts.map +1 -1
- package/tutorial-panel/index.js +2 -14
- package/tutorial-panel/index.js.map +1 -1
- package/tutorial-panel/interfaces.d.ts +1 -1
- package/tutorial-panel/interfaces.d.ts.map +1 -1
- package/tutorial-panel/interfaces.js.map +1 -1
- package/wizard/index.d.ts +1 -1
- package/wizard/index.d.ts.map +1 -1
- package/wizard/index.js +4 -1
- package/wizard/index.js.map +1 -1
- package/wizard/interfaces.d.ts +5 -5
- package/wizard/interfaces.d.ts.map +1 -1
- package/wizard/interfaces.js.map +1 -1
- package/wizard/wizard-actions.d.ts +3 -3
- package/wizard/wizard-actions.d.ts.map +1 -1
- package/wizard/wizard-actions.js.map +1 -1
- package/wizard/wizard-form.js +2 -1
- package/wizard/wizard-form.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-bar.js","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/app-bar.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,cAAc,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"app-bar.js","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/app-bar.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,cAAc,MAAM,+BAA+B,CAAC;AAE3D;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM;;IAC5B,MAAM,EACJ,UAAU,EACV,WAAW,EACX,aAAa,EACb,WAAW,EACX,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EAChB,uBAAuB,EACvB,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amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\nimport { useAppLayoutInternals } from './context';\nimport { InternalButton } from '../../button/internal';\nimport styles from './styles.css.js';\nimport testutilStyles from '../test-classes/styles.css.js';\n\n/**\n * The CSS class 'awsui-context-content-header' needs to be added to the root element so\n * that the design tokens used are overridden with the appropriate values.\n */\nexport default function AppBar() {\n const {\n ariaLabels,\n breadcrumbs,\n contentHeader,\n contentType,\n dynamicOverlapHeight,\n handleNavigationClick,\n handleToolsClick,\n hasNotificationsContent,\n hasStickyBackground,\n isMobile,\n navigationHide,\n isNavigationOpen,\n isToolsOpen,\n toolsHide,\n isAnyPanelOpen,\n navigationRefs,\n toolsRefs,\n } = useAppLayoutInternals();\n\n if (navigationHide && !breadcrumbs && toolsHide) {\n return null;\n }\n\n return (\n <section\n aria-hidden={!isMobile && !breadcrumbs ? true : undefined}\n className={clsx(\n styles.appbar,\n {\n [styles['has-breadcrumbs']]: breadcrumbs,\n [styles.unfocusable]: isMobile && isAnyPanelOpen,\n [testutilStyles['mobile-bar']]: isMobile,\n },\n 'awsui-context-content-header'\n )}\n >\n {!navigationHide && isMobile && (\n <nav\n className={clsx(styles['appbar-nav'], { [testutilStyles['drawer-closed']]: !isNavigationOpen })}\n aria-hidden={isNavigationOpen}\n >\n <InternalButton\n ariaLabel={ariaLabels?.navigationToggle ?? undefined}\n ariaExpanded={isNavigationOpen ? undefined : false}\n iconName=\"menu\"\n formAction=\"none\"\n onClick={() => handleNavigationClick(true)}\n variant=\"icon\"\n className={testutilStyles['navigation-toggle']}\n ref={navigationRefs.toggle}\n disabled={isAnyPanelOpen}\n __nativeAttributes={{ 'aria-haspopup': isNavigationOpen ? undefined : true }}\n />\n </nav>\n )}\n\n {breadcrumbs && (\n <div\n className={clsx(styles.breadcrumbs, styles[`content-type-${contentType}`], testutilStyles.breadcrumbs, {\n [styles['has-dynamic-overlap-height']]: dynamicOverlapHeight > 0,\n [styles['has-header']]: contentHeader,\n [styles['has-notifications-content']]: hasNotificationsContent,\n [styles['has-sticky-background']]: hasStickyBackground,\n })}\n >\n {breadcrumbs}\n </div>\n )}\n\n {!toolsHide && isMobile && (\n <aside\n className={clsx(styles['appbar-tools'], { [testutilStyles['drawer-closed']]: !isToolsOpen })}\n aria-hidden={isToolsOpen}\n aria-label={ariaLabels?.tools ?? undefined}\n >\n <InternalButton\n className={testutilStyles['tools-toggle']}\n ariaExpanded={isToolsOpen}\n disabled={isAnyPanelOpen}\n ariaLabel={ariaLabels?.toolsToggle ?? undefined}\n iconName=\"status-info\"\n formAction=\"none\"\n onClick={() => handleToolsClick(true)}\n variant=\"icon\"\n ref={toolsRefs.toggle}\n __nativeAttributes={{ 'aria-haspopup': true }}\n />\n </aside>\n )}\n </section>\n );\n}\n"]}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AppLayoutProps } from '../interfaces';
|
|
3
|
-
import {
|
|
3
|
+
import { FocusControlRefs } from '../utils/use-focus-control';
|
|
4
4
|
import { SplitPanelSideToggleProps } from '../../internal/context/split-panel-context';
|
|
5
|
+
import { SplitPanelFocusControlRefs } from '../utils/use-split-panel-focus-control';
|
|
5
6
|
interface AppLayoutInternals extends AppLayoutProps {
|
|
6
7
|
dynamicOverlapHeight: number;
|
|
7
8
|
handleSplitPanelClick: () => void;
|
|
@@ -41,7 +42,10 @@ interface AppLayoutInternals extends AppLayoutProps {
|
|
|
41
42
|
splitPanelToggle: SplitPanelSideToggleProps;
|
|
42
43
|
setSplitPanelToggle: (toggle: SplitPanelSideToggleProps) => void;
|
|
43
44
|
splitPanelDisplayed: boolean;
|
|
44
|
-
|
|
45
|
+
splitPanelRefs: SplitPanelFocusControlRefs;
|
|
46
|
+
navigationRefs: FocusControlRefs;
|
|
47
|
+
toolsRefs: FocusControlRefs;
|
|
48
|
+
loseToolsFocus: () => void;
|
|
45
49
|
}
|
|
46
50
|
interface AppLayoutProviderInternalsProps extends AppLayoutProps {
|
|
47
51
|
children: React.ReactNode;
|
|
@@ -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;AACf,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAW/C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/context.tsx"],"names":[],"mappings":"AAEA,OAAO,KASN,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAW/C,OAAO,EAAE,gBAAgB,EAAmB,MAAM,4BAA4B,CAAC;AAG/E,OAAO,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAC;AACvF,OAAO,EAAE,0BAA0B,EAA6B,MAAM,wCAAwC,CAAC;AAE/G,UAAU,kBAAmB,SAAQ,cAAc;IACjD,oBAAoB,EAAE,MAAM,CAAC;IAC7B,qBAAqB,EAAE,MAAM,IAAI,CAAC;IAClC,qBAAqB,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACjD,iCAAiC,EAAE,CAAC,MAAM,EAAE,cAAc,CAAC,qBAAqB,KAAK,IAAI,CAAC;IAC1F,sBAAsB,EAAE,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC3D,gBAAgB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3C,oBAAoB,EAAE,OAAO,CAAC;IAC9B,uBAAuB,EAAE,OAAO,CAAC;IACjC,mBAAmB,EAAE,OAAO,CAAC;IAC7B,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;IAClB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,0BAA0B,EAAE,OAAO,C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3B;AAED,wBAAgB,qBAAqB,uBAMpC;AAED,eAAO,MAAM,0BAA0B,4GAwdtC,CAAC"}
|
|
@@ -15,6 +15,7 @@ import { applyDefaults } from '../defaults';
|
|
|
15
15
|
import { useFocusControl } from '../utils/use-focus-control';
|
|
16
16
|
import { useObservedElement } from '../utils/use-observed-element';
|
|
17
17
|
import { AppLayoutContext } from '../../internal/context/app-layout-context';
|
|
18
|
+
import { useSplitPanelFocusControl } from '../utils/use-split-panel-focus-control';
|
|
18
19
|
/**
|
|
19
20
|
* The default values are destructured in the context instantiation to
|
|
20
21
|
* prevent downstream Typescript errors. This could likely be replaced
|
|
@@ -76,10 +77,12 @@ export const AppLayoutInternalsProvider = React.forwardRef((_a, forwardRef) => {
|
|
|
76
77
|
* emit the state change.
|
|
77
78
|
*/
|
|
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);
|
|
79
81
|
const handleNavigationClick = useCallback(function handleNavigationChange(isOpen) {
|
|
80
82
|
setIsNavigationOpen(isOpen);
|
|
83
|
+
focusNavButtons();
|
|
81
84
|
fireNonCancelableEvent(props.onNavigationChange, { open: isOpen });
|
|
82
|
-
}, [props.onNavigationChange, setIsNavigationOpen]);
|
|
85
|
+
}, [props.onNavigationChange, setIsNavigationOpen, focusNavButtons]);
|
|
83
86
|
/**
|
|
84
87
|
* The useControllable hook will set the default value and manage either
|
|
85
88
|
* the controlled or uncontrolled state of the Tools drawer. The logic
|
|
@@ -94,11 +97,12 @@ export const AppLayoutInternalsProvider = React.forwardRef((_a, forwardRef) => {
|
|
|
94
97
|
const toolsWidth = (_d = props.toolsWidth) !== null && _d !== void 0 ? _d : 290;
|
|
95
98
|
const hasDefaultToolsWidth = props.toolsWidth === undefined;
|
|
96
99
|
const [isToolsOpen = false, setIsToolsOpen] = useControllable(controlledToolsOpen, props.onToolsChange, isMobile ? false : contentTypeDefaults.toolsOpen, { componentName: 'AppLayout', controlledProp: 'toolsOpen', changeHandler: 'onToolsChange' });
|
|
97
|
-
const
|
|
100
|
+
const { refs: toolsRefs, setFocus: focusToolsButtons, loseFocus: loseToolsFocus, } = useFocusControl(isToolsOpen, true);
|
|
98
101
|
const handleToolsClick = useCallback(function handleToolsChange(isOpen) {
|
|
99
102
|
setIsToolsOpen(isOpen);
|
|
103
|
+
focusToolsButtons();
|
|
100
104
|
fireNonCancelableEvent(props.onToolsChange, { open: isOpen });
|
|
101
|
-
}, [props.onToolsChange, setIsToolsOpen]);
|
|
105
|
+
}, [props.onToolsChange, setIsToolsOpen, focusToolsButtons]);
|
|
102
106
|
const navigationVisible = !navigationHide && isNavigationOpen;
|
|
103
107
|
const toolsVisible = !toolsHide && isToolsOpen;
|
|
104
108
|
const isAnyPanelOpen = navigationVisible || toolsVisible;
|
|
@@ -134,9 +138,9 @@ export const AppLayoutInternalsProvider = React.forwardRef((_a, forwardRef) => {
|
|
|
134
138
|
openTools: function () {
|
|
135
139
|
handleToolsClick(true);
|
|
136
140
|
},
|
|
137
|
-
focusToolsClose:
|
|
141
|
+
focusToolsClose: () => focusToolsButtons(true),
|
|
138
142
|
};
|
|
139
|
-
}, [isMobile, handleNavigationClick, handleToolsClick,
|
|
143
|
+
}, [isMobile, handleNavigationClick, handleToolsClick, focusToolsButtons]);
|
|
140
144
|
/**
|
|
141
145
|
* Query the DOM for the header and footer elements based on the selectors provided
|
|
142
146
|
* by the properties and pass the heights to the custom property definitions.
|
|
@@ -163,10 +167,6 @@ export const AppLayoutInternalsProvider = React.forwardRef((_a, forwardRef) => {
|
|
|
163
167
|
* controlled state and fire the onSplitPanelToggle event.
|
|
164
168
|
*/
|
|
165
169
|
const [isSplitPanelOpen, setIsSplitPanelOpen] = useControllable(props.splitPanelOpen, props.onSplitPanelToggle, false, { componentName: 'AppLayout', controlledProp: 'splitPanelOpen', changeHandler: 'onSplitPanelToggle' });
|
|
166
|
-
const handleSplitPanelClick = useCallback(function handleSplitPanelChange() {
|
|
167
|
-
setIsSplitPanelOpen(!isSplitPanelOpen);
|
|
168
|
-
fireNonCancelableEvent(props.onSplitPanelToggle, { open: !isSplitPanelOpen });
|
|
169
|
-
}, [props.onSplitPanelToggle, isSplitPanelOpen, setIsSplitPanelOpen]);
|
|
170
170
|
/**
|
|
171
171
|
* The useControllable hook will manage the controlled or uncontrolled
|
|
172
172
|
* state of the splitPanelPreferences. By default the splitPanelPreferences
|
|
@@ -182,6 +182,15 @@ export const AppLayoutInternalsProvider = React.forwardRef((_a, forwardRef) => {
|
|
|
182
182
|
controlledProp: 'splitPanelPreferences',
|
|
183
183
|
changeHandler: 'onSplitPanelPreferencesChange',
|
|
184
184
|
});
|
|
185
|
+
const { refs: splitPanelRefs, setLastInteraction: setSplitPanelLastInteraction } = useSplitPanelFocusControl([
|
|
186
|
+
splitPanelPreferences,
|
|
187
|
+
isSplitPanelOpen,
|
|
188
|
+
]);
|
|
189
|
+
const handleSplitPanelClick = useCallback(function handleSplitPanelChange() {
|
|
190
|
+
setIsSplitPanelOpen(!isSplitPanelOpen);
|
|
191
|
+
setSplitPanelLastInteraction({ type: isSplitPanelOpen ? 'close' : 'open' });
|
|
192
|
+
fireNonCancelableEvent(props.onSplitPanelToggle, { open: !isSplitPanelOpen });
|
|
193
|
+
}, [props.onSplitPanelToggle, isSplitPanelOpen, setIsSplitPanelOpen, setSplitPanelLastInteraction]);
|
|
185
194
|
/**
|
|
186
195
|
* The Split Panel will be in forced (bottom) position if the defined minimum width is
|
|
187
196
|
* greater than the maximum width. In other words, the maximum width is the currently
|
|
@@ -219,8 +228,9 @@ export const AppLayoutInternalsProvider = React.forwardRef((_a, forwardRef) => {
|
|
|
219
228
|
}, [props.onSplitPanelResize, setSplitPanelSize]);
|
|
220
229
|
const handleSplitPanelPreferencesChange = useCallback(function handleSplitPanelChange(detail) {
|
|
221
230
|
setSplitPanelPreferences(detail);
|
|
231
|
+
setSplitPanelLastInteraction({ type: 'position' });
|
|
222
232
|
fireNonCancelableEvent(props.onSplitPanelPreferencesChange, detail);
|
|
223
|
-
}, [props.onSplitPanelPreferencesChange, setSplitPanelPreferences]);
|
|
233
|
+
}, [props.onSplitPanelPreferencesChange, setSplitPanelPreferences, setSplitPanelLastInteraction]);
|
|
224
234
|
/**
|
|
225
235
|
* The Layout element is not necessarily synonymous with the client
|
|
226
236
|
* viewport width. There can be content in the horizontal viewport
|
|
@@ -347,8 +357,11 @@ export const AppLayoutInternalsProvider = React.forwardRef((_a, forwardRef) => {
|
|
|
347
357
|
splitPanelSize,
|
|
348
358
|
splitPanelToggle,
|
|
349
359
|
setSplitPanelToggle,
|
|
360
|
+
splitPanelRefs,
|
|
350
361
|
toolsHide, toolsOpen: isToolsOpen, toolsWidth,
|
|
351
|
-
|
|
362
|
+
toolsRefs,
|
|
363
|
+
navigationRefs,
|
|
364
|
+
loseToolsFocus }) },
|
|
352
365
|
React.createElement(AppLayoutContext.Provider, { value: {
|
|
353
366
|
stickyOffsetBottom: offsetBottom,
|
|
354
367
|
stickyOffsetTop: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/context.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EACZ,aAAa,EACb,WAAW,EACX,SAAS,EACT,eAAe,EACf,mBAAmB,EACnB,MAAM,EACN,QAAQ,EACR,UAAU,GACX,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAi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// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, {\n createContext,\n useCallback,\n useEffect,\n useLayoutEffect,\n useImperativeHandle,\n useRef,\n useState,\n useContext,\n} from 'react';\nimport { AppLayoutProps } from '../interfaces';\nimport { fireNonCancelableEvent } from '../../internal/events';\nimport { getSplitPanelPosition } from './split-panel';\nimport { useControllable } from '../../internal/hooks/use-controllable';\nimport { useMobile } from '../../internal/hooks/use-mobile';\nimport { useContainerQuery } from '../../internal/hooks/container-queries';\nimport { getSplitPanelDefaultSize } from '../../split-panel/utils/size-utils';\nimport styles from './styles.css.js';\nimport { isDevelopment } from '../../internal/is-development';\nimport { warnOnce } from '../../internal/logging';\nimport { applyDefaults } from '../defaults';\nimport { FocusControlState, useFocusControl } from '../utils/use-focus-control';\nimport { useObservedElement } from '../utils/use-observed-element';\nimport { AppLayoutContext } from '../../internal/context/app-layout-context';\nimport { SplitPanelSideToggleProps } from '../../internal/context/split-panel-context';\n\ninterface AppLayoutInternals extends AppLayoutProps {\n dynamicOverlapHeight: number;\n handleSplitPanelClick: () => void;\n handleNavigationClick: (isOpen: boolean) => void;\n handleSplitPanelPreferencesChange: (detail: AppLayoutProps.SplitPanelPreferences) => void;\n handleSplitPanelResize: (detail: { size: number }) => void;\n handleToolsClick: (value: boolean) => void;\n hasDefaultToolsWidth: boolean;\n hasNotificationsContent: boolean;\n hasStickyBackground: boolean;\n isAnyPanelOpen: boolean;\n isMobile: boolean;\n isNavigationOpen: boolean;\n isSplitPanelForcedPosition: boolean;\n isSplitPanelOpen?: boolean;\n isToolsOpen: boolean;\n layoutElement: React.Ref<HTMLElement>;\n layoutWidth: number;\n mainElement: React.Ref<HTMLDivElement>;\n mainOffsetLeft: number;\n notificationsElement: React.Ref<HTMLDivElement>;\n notificationsHeight: number;\n offsetBottom: number;\n setDynamicOverlapHeight: (value: number) => void;\n setHasStickyBackground: (value: boolean) => void;\n setSplitPanelReportedSize: (value: number) => void;\n setSplitPanelReportedHeaderHeight: (value: number) => void;\n headerHeight: number;\n footerHeight: number;\n splitPanelMaxWidth: number;\n splitPanelMinWidth: number;\n splitPanelPosition: AppLayoutProps.SplitPanelPosition;\n splitPanelReportedSize: number;\n splitPanelReportedHeaderHeight: number;\n splitPanelToggle: SplitPanelSideToggleProps;\n setSplitPanelToggle: (toggle: SplitPanelSideToggleProps) => void;\n splitPanelDisplayed: boolean;\n toolsFocusControl: FocusControlState;\n}\n\n/**\n * The default values are destructured in the context instantiation to\n * prevent downstream Typescript errors. This could likely be replaced\n * by a context interface definition that extends the AppLayout interface.\n */\nconst AppLayoutInternalsContext = createContext<AppLayoutInternals | null>(null);\n\ninterface AppLayoutProviderInternalsProps extends AppLayoutProps {\n children: React.ReactNode;\n}\n\nexport function useAppLayoutInternals() {\n const ctx = useContext(AppLayoutInternalsContext);\n if (!ctx) {\n throw new Error('Invariant violation: this context is only available inside app layout');\n }\n return ctx;\n}\n\nexport const AppLayoutInternalsProvider = React.forwardRef(\n (\n {\n toolsHide,\n toolsOpen: controlledToolsOpen,\n navigationHide,\n navigationOpen: controlledNavigationOpen,\n contentType = 'default',\n headerSelector = '#b #h',\n footerSelector = '#b #h',\n children,\n splitPanel,\n ...props\n }: AppLayoutProviderInternalsProps,\n forwardRef: React.Ref<AppLayoutProps.Ref>\n ) => {\n const isMobile = useMobile();\n\n if (isDevelopment) {\n if (controlledToolsOpen && toolsHide) {\n warnOnce(\n 'AppLayout',\n `You have enabled both the \\`toolsOpen\\` prop and the \\`toolsHide\\` prop. This is not supported. Set \\`toolsOpen\\` to \\`false\\` when you set \\`toolsHide\\` to \\`true\\`.`\n );\n }\n }\n\n /**\n * The overlap height has a default set in CSS but can also be dynamically overridden\n * for content types (such as Table and Wizard) that have variable size content in the overlap.\n * If a child component utilizes a sticky header the hasStickyBackground property will determine\n * if the background remains in the same vertical position.\n */\n const [dynamicOverlapHeight, setDynamicOverlapHeight] = useState(0);\n const [hasStickyBackground, setHasStickyBackground] = useState(false);\n\n /**\n * Set the default values for minimum and maximum content width.\n */\n const geckoMaxCssLength = ((1 << 30) - 1) / 60;\n const halfGeckoMaxCssLength = geckoMaxCssLength / 2;\n // CSS lengths in Gecko are limited to at most (1<<30)-1 app units (Gecko uses 60 as app unit).\n // Limit the maxContentWidth to the half of the upper boundary (≈4230^2) to be on the safe side.\n const maxContentWidth =\n props.maxContentWidth && props.maxContentWidth > halfGeckoMaxCssLength\n ? halfGeckoMaxCssLength\n : props.maxContentWidth ?? 0;\n const minContentWidth = props.minContentWidth ?? 280;\n\n /**\n * Determine the default state of the Navigation and Tools drawers.\n * Mobile viewports should be closed by default under all circumstances.\n * If the navigationOpen prop has been set then that should take precedence\n * over the contentType prop. Desktop viewports that do not have the\n * navigationOpen or contentType props set will use the default contentType.\n */\n const contentTypeDefaults = applyDefaults(contentType, { maxContentWidth, minContentWidth }, true);\n\n /**\n * The useControllable hook will set the default value and manage either\n * the controlled or uncontrolled state of the Navigation drawer. The logic\n * for determining the default state is colocated with the Navigation component.\n *\n * The callback that will be passed to the Navigation and AppBar\n * components to handle the click events that will change the state\n * of the Navigation drawer. It will set the Navigation state with the\n * useControllable hook and also fire the onNavigationChange function to\n * emit the state change.\n */\n const [isNavigationOpen = false, setIsNavigationOpen] = useControllable(\n controlledNavigationOpen,\n props.onNavigationChange,\n isMobile ? false : contentTypeDefaults.navigationOpen,\n { componentName: 'AppLayout', controlledProp: 'navigationOpen', changeHandler: 'onNavigationChange' }\n );\n\n const handleNavigationClick = useCallback(\n function handleNavigationChange(isOpen: boolean) {\n setIsNavigationOpen(isOpen);\n fireNonCancelableEvent(props.onNavigationChange, { open: isOpen });\n },\n [props.onNavigationChange, setIsNavigationOpen]\n );\n\n /**\n * The useControllable hook will set the default value and manage either\n * the controlled or uncontrolled state of the Tools drawer. The logic\n * for determining the default state is colocated with the Tools component.\n *\n * The callback that will be passed to the Navigation and AppBar\n * components to handle the click events that will change the state\n * of the Tools drawer. It will set the Tools state with the\n * useControllable hook and also fire the onToolsChange function to\n * emit the state change.\n */\n const toolsWidth = props.toolsWidth ?? 290;\n const hasDefaultToolsWidth = props.toolsWidth === undefined;\n\n const [isToolsOpen = false, setIsToolsOpen] = useControllable(\n controlledToolsOpen,\n props.onToolsChange,\n isMobile ? false : contentTypeDefaults.toolsOpen,\n { componentName: 'AppLayout', controlledProp: 'toolsOpen', changeHandler: 'onToolsChange' }\n );\n\n const toolsFocusControl = useFocusControl(isToolsOpen, true);\n\n const handleToolsClick = useCallback(\n function handleToolsChange(isOpen: boolean) {\n setIsToolsOpen(isOpen);\n fireNonCancelableEvent(props.onToolsChange, { open: isOpen });\n },\n [props.onToolsChange, setIsToolsOpen]\n );\n\n const navigationVisible = !navigationHide && isNavigationOpen;\n const toolsVisible = !toolsHide && isToolsOpen;\n const isAnyPanelOpen = navigationVisible || toolsVisible;\n\n /**\n * On mobile viewports the navigation and tools drawers are adjusted to a fixed position\n * that consumes 100% of the viewport height and width. The body content could potentially\n * be scrollable underneath the drawer. In order to prevent this a CSS class needs to be\n * added to the document body that sets overflow to hidden.\n */\n useEffect(\n function handleBodyScroll() {\n if (isMobile && (isNavigationOpen || isToolsOpen)) {\n document.body.classList.add(styles['block-body-scroll']);\n } else {\n document.body.classList.remove(styles['block-body-scroll']);\n }\n\n // Ensure the CSS class is removed from the body on side effect cleanup\n return function cleanup() {\n document.body.classList.remove(styles['block-body-scroll']);\n };\n },\n [isMobile, isNavigationOpen, isToolsOpen]\n );\n\n /**\n * The useImperativeHandle hook in conjunction with the forwardRef function\n * in the AppLayout component definition expose the following callable\n * functions to component consumers when they put a ref as a property on\n * their component implementation.\n */\n useImperativeHandle(\n forwardRef,\n function createImperativeHandle() {\n return {\n closeNavigationIfNecessary: function () {\n isMobile && handleNavigationClick(false);\n },\n openTools: function () {\n handleToolsClick(true);\n },\n focusToolsClose: toolsFocusControl.setFocus,\n };\n },\n [isMobile, handleNavigationClick, handleToolsClick, toolsFocusControl.setFocus]\n );\n\n /**\n * Query the DOM for the header and footer elements based on the selectors provided\n * by the properties and pass the heights to the custom property definitions.\n */\n const headerHeight = useObservedElement(headerSelector);\n const footerHeight = useObservedElement(footerSelector);\n\n /**\n * Set the default values for the minimum and maximum Split Panel width when it is\n * in the side position. The useLayoutEffect will compute the available space in the\n * DOM for the Split Panel given the current state. The minimum and maximum\n * widths will potentially trigger a side effect that will put the Split Panel into\n * a forced position on the bottom.\n */\n const splitPanelMinWidth = 280;\n const [splitPanelMaxWidth, setSplitPanelMaxWidth] = useState(splitPanelMinWidth);\n\n /**\n * The useControllable hook will set the default value and manage either\n * the controlled or uncontrolled state of the Split Panel. By default\n * the Split Panel should always be closed on page load.\n *\n * The callback that will be passed to the SplitPanel component\n * to handle the click events that will change the state of the SplitPanel\n * to open or closed given the current state. It will set the isSplitPanelOpen\n * controlled state and fire the onSplitPanelToggle event.\n */\n const [isSplitPanelOpen, setIsSplitPanelOpen] = useControllable(\n props.splitPanelOpen,\n props.onSplitPanelToggle,\n false,\n { componentName: 'AppLayout', controlledProp: 'splitPanelOpen', changeHandler: 'onSplitPanelToggle' }\n );\n\n const handleSplitPanelClick = useCallback(\n function handleSplitPanelChange() {\n setIsSplitPanelOpen(!isSplitPanelOpen);\n fireNonCancelableEvent(props.onSplitPanelToggle, { open: !isSplitPanelOpen });\n },\n [props.onSplitPanelToggle, isSplitPanelOpen, setIsSplitPanelOpen]\n );\n\n /**\n * The useControllable hook will manage the controlled or uncontrolled\n * state of the splitPanelPreferences. By default the splitPanelPreferences\n * is undefined. When set the object shape should have a single key to indicate\n * either bottom or side position.\n *\n * The callback that will handle changes to the splitPanelPreferences\n * object that will determine if the SplitPanel is rendered either on the\n * bottom of the viewport or within the Tools container.\n */\n const [splitPanelPreferences, setSplitPanelPreferences] = useControllable(\n props.splitPanelPreferences,\n props.onSplitPanelPreferencesChange,\n undefined,\n {\n componentName: 'AppLayout',\n controlledProp: 'splitPanelPreferences',\n changeHandler: 'onSplitPanelPreferencesChange',\n }\n );\n\n /**\n * The Split Panel will be in forced (bottom) position if the defined minimum width is\n * greater than the maximum width. In other words, the maximum width is the currently\n * available horizontal space based on all other components that are rendered. If the\n * minimum width exceeds this value then there is not enough horizontal space and we must\n * force it to the bottom position.\n */\n const [isSplitPanelForcedPosition, setSplitPanelForcedPosition] = useState(false);\n const splitPanelPosition = getSplitPanelPosition(isSplitPanelForcedPosition, splitPanelPreferences);\n\n useLayoutEffect(\n function handleSplitPanelForcePosition() {\n setSplitPanelForcedPosition(splitPanelMinWidth > splitPanelMaxWidth);\n },\n [splitPanelMaxWidth, splitPanelMinWidth]\n );\n\n /**\n * The useControllable hook will set the default size of the SplitPanel based\n * on the default position set in the splitPanelPreferences. The logic for the\n * default size is contained in the SplitPanel component. The splitPanelControlledSize\n * will be bound to the size property in the SplitPanel context for rendering.\n *\n * The callback that will be passed to the SplitPanel component\n * to handle the resize events that will change the size of the SplitPanel.\n * It will set the splitPanelControlledSize controlled state and fire the\n * onSplitPanelResize event.\n */\n const [splitPanelReportedSize, setSplitPanelReportedSize] = useState(0);\n const [splitPanelReportedHeaderHeight, setSplitPanelReportedHeaderHeight] = useState(0);\n const [splitPanelToggle, setSplitPanelToggle] = useState<SplitPanelSideToggleProps>({\n displayed: false,\n ariaLabel: undefined,\n });\n const splitPanelDisplayed = !!(splitPanelToggle.displayed || isSplitPanelOpen);\n\n const [splitPanelSize, setSplitPanelSize] = useControllable(\n props.splitPanelSize,\n props.onSplitPanelResize,\n getSplitPanelDefaultSize(splitPanelPosition),\n { componentName: 'AppLayout', controlledProp: 'splitPanelSize', changeHandler: 'onSplitPanelResize' }\n );\n\n const handleSplitPanelResize = useCallback(\n function handleSplitPanelChange(detail: { size: number }) {\n setSplitPanelSize(detail.size);\n fireNonCancelableEvent(props.onSplitPanelResize, detail);\n },\n [props.onSplitPanelResize, setSplitPanelSize]\n );\n\n const handleSplitPanelPreferencesChange = useCallback(\n function handleSplitPanelChange(detail: AppLayoutProps.SplitPanelPreferences) {\n setSplitPanelPreferences(detail);\n fireNonCancelableEvent(props.onSplitPanelPreferencesChange, detail);\n },\n [props.onSplitPanelPreferencesChange, setSplitPanelPreferences]\n );\n\n /**\n * The Layout element is not necessarily synonymous with the client\n * viewport width. There can be content in the horizontal viewport\n * that exists on either side of the AppLayout. This resize observer\n * will set the custom property of the Layout element width that\n * is used for various horizontal constraints such as the maximum\n * allowed width of the Tools container.\n *\n * The offsetLeft of the Main will return the distance that the\n * Main element has from the left edge of the Layout component.\n * The offsetLeft value can vary based on the presence and state\n * of the Navigation as well as content gaps in the grid definition.\n * This value is used to determine the max width constraint calculation\n * for the Tools container.\n */\n const [layoutContainerQuery, layoutElement] = useContainerQuery(rect => rect.width);\n const layoutWidth = layoutContainerQuery ?? 0;\n\n const mainElement = useRef<HTMLDivElement>(null);\n const [mainOffsetLeft, setMainOffsetLeft] = useState(0);\n\n useLayoutEffect(\n function handleMainOffsetLeft() {\n setMainOffsetLeft(mainElement?.current?.offsetLeft ?? 0);\n },\n [layoutWidth, isNavigationOpen, isToolsOpen, splitPanelReportedSize]\n );\n\n useLayoutEffect(\n function handleSplitPanelMaxWidth() {\n /**\n * Warning! This is a hack! In order to accurately calculate if there is adequate\n * horizontal space for the Split Panel to be in the side position we need two values\n * that are not available in JavaScript.\n *\n * The first is the the content gap on the right which is stored in a design token\n * and applied in the Layout CSS:\n *\n * $contentGapRight: #{awsui.$space-scaled-2x-xxxl};\n *\n * The second is the width of the element that has the circular buttons for the\n * Tools and Split Panel. This could be suppressed given the state of the Tools\n * drawer returning a zero value. It would, however, be rendered if the Split Panel\n * were to move into the side position. This is calculated in the Tools CSS and\n * the Trigger button CSS with design tokens:\n *\n * padding: awsui.$space-scaled-s awsui.$space-layout-toggle-padding;\n * width: awsui.$space-layout-toggle-diameter;\n *\n * These values will be defined below as static integers that are rough approximations\n * of their computed width when rendered in the DOM, but doubled to ensure adequate\n * spacing for the Split Panel to be in side position.\n */\n const contentGapRight = 80; // Approximately 40px when rendered but doubled for safety\n const toolsFormOffsetWidth = 160; // Approximately 80px when rendered but doubled for safety\n const toolsOffsetWidth = isToolsOpen ? toolsWidth : 0;\n\n setSplitPanelMaxWidth(\n layoutWidth - mainOffsetLeft - minContentWidth - contentGapRight - toolsOffsetWidth - toolsFormOffsetWidth\n );\n },\n [isNavigationOpen, isToolsOpen, layoutWidth, mainOffsetLeft, minContentWidth, toolsWidth]\n );\n\n /**\n * Because the notifications slot does not give us any direction insight into\n * what the state of the child content is we need to have a mechanism for\n * tracking the height of the notifications and whether or not it has content.\n * The height of the notifications is an integer that will be used as a custom\n * property on the Layout component to determine what the sticky offset should\n * be if there are sticky notifications. This could be any number including\n * zero based on how the child content renders. The hasNotificationsContent boolean\n * is simply centralizing the logic of the notifications height being > 0 such\n * that it is not repeated in various components (such as AppBar) that need to\n * know if the notifications slot is empty.\n */\n const [notificationsContainerQuery, notificationsElement] = useContainerQuery(rect => rect.height);\n const [notificationsHeight, setNotificationsHeight] = useState(0);\n const [hasNotificationsContent, setHasNotificationsContent] = useState(false);\n\n useEffect(\n function handleNotificationsContent() {\n setNotificationsHeight(notificationsContainerQuery ?? 0);\n setHasNotificationsContent(notificationsContainerQuery && notificationsContainerQuery > 0 ? true : false);\n },\n [notificationsContainerQuery]\n );\n\n /**\n * Determine the offsetBottom value based on the presence of a footer element and\n * the SplitPanel component. Ignore the SplitPanel if it is not in the bottom\n * position. Use the size property if it is open and the header height if it is closed.\n */\n let offsetBottom = footerHeight;\n if (splitPanelDisplayed && splitPanelPosition === 'bottom') {\n if (isSplitPanelOpen) {\n offsetBottom += splitPanelReportedSize;\n } else {\n offsetBottom += splitPanelReportedHeaderHeight;\n }\n }\n\n return (\n <AppLayoutInternalsContext.Provider\n value={{\n ...props,\n contentType,\n dynamicOverlapHeight,\n headerHeight,\n footerHeight,\n hasDefaultToolsWidth,\n handleNavigationClick,\n handleSplitPanelClick,\n handleSplitPanelPreferencesChange,\n handleSplitPanelResize,\n handleToolsClick,\n hasNotificationsContent,\n hasStickyBackground,\n isAnyPanelOpen,\n isMobile,\n isNavigationOpen: isNavigationOpen ?? false,\n isSplitPanelForcedPosition,\n isSplitPanelOpen,\n isToolsOpen,\n layoutElement,\n layoutWidth,\n mainElement,\n mainOffsetLeft,\n maxContentWidth,\n minContentWidth,\n navigationHide,\n notificationsElement,\n notificationsHeight,\n offsetBottom,\n setDynamicOverlapHeight,\n setHasStickyBackground,\n setSplitPanelReportedSize,\n setSplitPanelReportedHeaderHeight,\n splitPanel,\n splitPanelDisplayed,\n splitPanelMaxWidth,\n splitPanelMinWidth,\n splitPanelPosition,\n splitPanelPreferences,\n splitPanelReportedSize,\n splitPanelReportedHeaderHeight,\n splitPanelSize,\n splitPanelToggle,\n setSplitPanelToggle,\n toolsHide,\n toolsOpen: isToolsOpen,\n toolsWidth,\n toolsFocusControl,\n }}\n >\n <AppLayoutContext.Provider\n value={{\n stickyOffsetBottom: offsetBottom,\n stickyOffsetTop: 0, // not used in this design. Sticky headers read a CSS-var instead\n hasBreadcrumbs: !!props.breadcrumbs,\n setHasStickyBackground,\n setDynamicOverlapHeight,\n }}\n >\n {children}\n </AppLayoutContext.Provider>\n </AppLayoutInternalsContext.Provider>\n );\n }\n);\n"]}
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/context.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EACZ,aAAa,EACb,WAAW,EACX,SAAS,EACT,eAAe,EACf,mBAAmB,EACnB,MAAM,EACN,QAAQ,EACR,UAAU,GACX,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,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YACX,cAAc;YACd,eAAe;YACf,eAAe;YACf,cAAc;YACd,oBAAoB;YACpB,mBAAmB;YACnB,YAAY;YACZ,uBAAuB;YACvB,sBAAsB;YACtB,yBAAyB;YACzB,iCAAiC;YACjC,UAAU;YACV,mBAAmB;YACnB,kBAAkB;YAClB,kBAAkB;YAClB,kBAAkB;YAClB,qBAAqB;YACrB,sBAAsB;YACtB,8BAA8B;YAC9B,cAAc;YACd,gBAAgB;YAChB,mBAAmB;YACnB,cAAc;YACd,SAAS,EACT,SAAS,EAAE,WAAW,EACtB,UAAU;YACV,SAAS;YACT,cAAc;YACd,cAAc;QAGhB,oBAAC,gBAAgB,CAAC,QAAQ,IACxB,KAAK,EAAE;gBACL,kBAAkB,EAAE,YAAY;gBAChC,eAAe,EAAE,CAAC;gBAClB,cAAc,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW;gBACnC,sBAAsB;gBACtB,uBAAuB;aACxB,IAEA,QAAQ,CACiB,CACO,CACtC,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, {\n createContext,\n useCallback,\n useEffect,\n useLayoutEffect,\n useImperativeHandle,\n useRef,\n useState,\n useContext,\n} from 'react';\nimport { AppLayoutProps } from '../interfaces';\nimport { fireNonCancelableEvent } from '../../internal/events';\nimport { getSplitPanelPosition } from './split-panel';\nimport { useControllable } from '../../internal/hooks/use-controllable';\nimport { useMobile } from '../../internal/hooks/use-mobile';\nimport { useContainerQuery } from '../../internal/hooks/container-queries';\nimport { getSplitPanelDefaultSize } from '../../split-panel/utils/size-utils';\nimport styles from './styles.css.js';\nimport { isDevelopment } from '../../internal/is-development';\nimport { warnOnce } from '../../internal/logging';\nimport { applyDefaults } from '../defaults';\nimport { FocusControlRefs, useFocusControl } from '../utils/use-focus-control';\nimport { useObservedElement } from '../utils/use-observed-element';\nimport { AppLayoutContext } from '../../internal/context/app-layout-context';\nimport { SplitPanelSideToggleProps } from '../../internal/context/split-panel-context';\nimport { SplitPanelFocusControlRefs, useSplitPanelFocusControl } from '../utils/use-split-panel-focus-control';\n\ninterface AppLayoutInternals extends AppLayoutProps {\n dynamicOverlapHeight: number;\n handleSplitPanelClick: () => void;\n handleNavigationClick: (isOpen: boolean) => void;\n handleSplitPanelPreferencesChange: (detail: AppLayoutProps.SplitPanelPreferences) => void;\n handleSplitPanelResize: (detail: { size: number }) => void;\n handleToolsClick: (value: boolean) => void;\n hasDefaultToolsWidth: boolean;\n hasNotificationsContent: boolean;\n hasStickyBackground: boolean;\n isAnyPanelOpen: boolean;\n isMobile: boolean;\n isNavigationOpen: boolean;\n isSplitPanelForcedPosition: boolean;\n isSplitPanelOpen?: boolean;\n isToolsOpen: boolean;\n layoutElement: React.Ref<HTMLElement>;\n layoutWidth: number;\n mainElement: React.Ref<HTMLDivElement>;\n mainOffsetLeft: number;\n notificationsElement: React.Ref<HTMLDivElement>;\n notificationsHeight: number;\n offsetBottom: number;\n setDynamicOverlapHeight: (value: number) => void;\n setHasStickyBackground: (value: boolean) => void;\n setSplitPanelReportedSize: (value: number) => void;\n setSplitPanelReportedHeaderHeight: (value: number) => void;\n headerHeight: number;\n footerHeight: number;\n splitPanelMaxWidth: number;\n splitPanelMinWidth: number;\n splitPanelPosition: AppLayoutProps.SplitPanelPosition;\n splitPanelReportedSize: number;\n splitPanelReportedHeaderHeight: number;\n splitPanelToggle: SplitPanelSideToggleProps;\n setSplitPanelToggle: (toggle: SplitPanelSideToggleProps) => void;\n splitPanelDisplayed: boolean;\n splitPanelRefs: SplitPanelFocusControlRefs;\n navigationRefs: FocusControlRefs;\n toolsRefs: FocusControlRefs;\n loseToolsFocus: () => void;\n}\n\n/**\n * The default values are destructured in the context instantiation to\n * prevent downstream Typescript errors. This could likely be replaced\n * by a context interface definition that extends the AppLayout interface.\n */\nconst AppLayoutInternalsContext = createContext<AppLayoutInternals | null>(null);\n\ninterface AppLayoutProviderInternalsProps extends AppLayoutProps {\n children: React.ReactNode;\n}\n\nexport function useAppLayoutInternals() {\n const ctx = useContext(AppLayoutInternalsContext);\n if (!ctx) {\n throw new Error('Invariant violation: this context is only available inside app layout');\n }\n return ctx;\n}\n\nexport const AppLayoutInternalsProvider = React.forwardRef(\n (\n {\n toolsHide,\n toolsOpen: controlledToolsOpen,\n navigationHide,\n navigationOpen: controlledNavigationOpen,\n contentType = 'default',\n headerSelector = '#b #h',\n footerSelector = '#b #h',\n children,\n splitPanel,\n ...props\n }: AppLayoutProviderInternalsProps,\n forwardRef: React.Ref<AppLayoutProps.Ref>\n ) => {\n const isMobile = useMobile();\n\n if (isDevelopment) {\n if (controlledToolsOpen && toolsHide) {\n warnOnce(\n 'AppLayout',\n `You have enabled both the \\`toolsOpen\\` prop and the \\`toolsHide\\` prop. This is not supported. Set \\`toolsOpen\\` to \\`false\\` when you set \\`toolsHide\\` to \\`true\\`.`\n );\n }\n }\n\n /**\n * The overlap height has a default set in CSS but can also be dynamically overridden\n * for content types (such as Table and Wizard) that have variable size content in the overlap.\n * If a child component utilizes a sticky header the hasStickyBackground property will determine\n * if the background remains in the same vertical position.\n */\n const [dynamicOverlapHeight, setDynamicOverlapHeight] = useState(0);\n const [hasStickyBackground, setHasStickyBackground] = useState(false);\n\n /**\n * Set the default values for minimum and maximum content width.\n */\n const geckoMaxCssLength = ((1 << 30) - 1) / 60;\n const halfGeckoMaxCssLength = geckoMaxCssLength / 2;\n // CSS lengths in Gecko are limited to at most (1<<30)-1 app units (Gecko uses 60 as app unit).\n // Limit the maxContentWidth to the half of the upper boundary (≈4230^2) to be on the safe side.\n const maxContentWidth =\n props.maxContentWidth && props.maxContentWidth > halfGeckoMaxCssLength\n ? halfGeckoMaxCssLength\n : props.maxContentWidth ?? 0;\n const minContentWidth = props.minContentWidth ?? 280;\n\n /**\n * Determine the default state of the Navigation and Tools drawers.\n * Mobile viewports should be closed by default under all circumstances.\n * If the navigationOpen prop has been set then that should take precedence\n * over the contentType prop. Desktop viewports that do not have the\n * navigationOpen or contentType props set will use the default contentType.\n */\n const contentTypeDefaults = applyDefaults(contentType, { maxContentWidth, minContentWidth }, true);\n\n /**\n * The useControllable hook will set the default value and manage either\n * the controlled or uncontrolled state of the Navigation drawer. The logic\n * for determining the default state is colocated with the Navigation component.\n *\n * The callback that will be passed to the Navigation and AppBar\n * components to handle the click events that will change the state\n * of the Navigation drawer. It will set the Navigation state with the\n * useControllable hook and also fire the onNavigationChange function to\n * emit the state change.\n */\n const [isNavigationOpen = false, setIsNavigationOpen] = useControllable(\n controlledNavigationOpen,\n props.onNavigationChange,\n isMobile ? false : contentTypeDefaults.navigationOpen,\n { componentName: 'AppLayout', controlledProp: 'navigationOpen', changeHandler: 'onNavigationChange' }\n );\n\n const { refs: navigationRefs, setFocus: focusNavButtons } = useFocusControl(isNavigationOpen);\n\n const handleNavigationClick = useCallback(\n function handleNavigationChange(isOpen: boolean) {\n setIsNavigationOpen(isOpen);\n focusNavButtons();\n fireNonCancelableEvent(props.onNavigationChange, { open: isOpen });\n },\n [props.onNavigationChange, setIsNavigationOpen, focusNavButtons]\n );\n\n /**\n * The useControllable hook will set the default value and manage either\n * the controlled or uncontrolled state of the Tools drawer. The logic\n * for determining the default state is colocated with the Tools component.\n *\n * The callback that will be passed to the Navigation and AppBar\n * components to handle the click events that will change the state\n * of the Tools drawer. It will set the Tools state with the\n * useControllable hook and also fire the onToolsChange function to\n * emit the state change.\n */\n const toolsWidth = props.toolsWidth ?? 290;\n const hasDefaultToolsWidth = props.toolsWidth === undefined;\n\n const [isToolsOpen = false, setIsToolsOpen] = useControllable(\n controlledToolsOpen,\n props.onToolsChange,\n isMobile ? false : contentTypeDefaults.toolsOpen,\n { componentName: 'AppLayout', controlledProp: 'toolsOpen', changeHandler: 'onToolsChange' }\n );\n\n const {\n refs: toolsRefs,\n setFocus: focusToolsButtons,\n loseFocus: loseToolsFocus,\n } = useFocusControl(isToolsOpen, true);\n\n const handleToolsClick = useCallback(\n function handleToolsChange(isOpen: boolean) {\n setIsToolsOpen(isOpen);\n focusToolsButtons();\n fireNonCancelableEvent(props.onToolsChange, { open: isOpen });\n },\n [props.onToolsChange, setIsToolsOpen, focusToolsButtons]\n );\n\n const navigationVisible = !navigationHide && isNavigationOpen;\n const toolsVisible = !toolsHide && isToolsOpen;\n const isAnyPanelOpen = navigationVisible || toolsVisible;\n\n /**\n * On mobile viewports the navigation and tools drawers are adjusted to a fixed position\n * that consumes 100% of the viewport height and width. The body content could potentially\n * be scrollable underneath the drawer. In order to prevent this a CSS class needs to be\n * added to the document body that sets overflow to hidden.\n */\n useEffect(\n function handleBodyScroll() {\n if (isMobile && (isNavigationOpen || isToolsOpen)) {\n document.body.classList.add(styles['block-body-scroll']);\n } else {\n document.body.classList.remove(styles['block-body-scroll']);\n }\n\n // Ensure the CSS class is removed from the body on side effect cleanup\n return function cleanup() {\n document.body.classList.remove(styles['block-body-scroll']);\n };\n },\n [isMobile, isNavigationOpen, isToolsOpen]\n );\n\n /**\n * The useImperativeHandle hook in conjunction with the forwardRef function\n * in the AppLayout component definition expose the following callable\n * functions to component consumers when they put a ref as a property on\n * their component implementation.\n */\n useImperativeHandle(\n forwardRef,\n function createImperativeHandle() {\n return {\n closeNavigationIfNecessary: function () {\n isMobile && handleNavigationClick(false);\n },\n openTools: function () {\n handleToolsClick(true);\n },\n focusToolsClose: () => focusToolsButtons(true),\n };\n },\n [isMobile, handleNavigationClick, handleToolsClick, focusToolsButtons]\n );\n\n /**\n * Query the DOM for the header and footer elements based on the selectors provided\n * by the properties and pass the heights to the custom property definitions.\n */\n const headerHeight = useObservedElement(headerSelector);\n const footerHeight = useObservedElement(footerSelector);\n\n /**\n * Set the default values for the minimum and maximum Split Panel width when it is\n * in the side position. The useLayoutEffect will compute the available space in the\n * DOM for the Split Panel given the current state. The minimum and maximum\n * widths will potentially trigger a side effect that will put the Split Panel into\n * a forced position on the bottom.\n */\n const splitPanelMinWidth = 280;\n const [splitPanelMaxWidth, setSplitPanelMaxWidth] = useState(splitPanelMinWidth);\n\n /**\n * The useControllable hook will set the default value and manage either\n * the controlled or uncontrolled state of the Split Panel. By default\n * the Split Panel should always be closed on page load.\n *\n * The callback that will be passed to the SplitPanel component\n * to handle the click events that will change the state of the SplitPanel\n * to open or closed given the current state. It will set the isSplitPanelOpen\n * controlled state and fire the onSplitPanelToggle event.\n */\n const [isSplitPanelOpen, setIsSplitPanelOpen] = useControllable(\n props.splitPanelOpen,\n props.onSplitPanelToggle,\n false,\n { componentName: 'AppLayout', controlledProp: 'splitPanelOpen', changeHandler: 'onSplitPanelToggle' }\n );\n\n /**\n * The useControllable hook will manage the controlled or uncontrolled\n * state of the splitPanelPreferences. By default the splitPanelPreferences\n * is undefined. When set the object shape should have a single key to indicate\n * either bottom or side position.\n *\n * The callback that will handle changes to the splitPanelPreferences\n * object that will determine if the SplitPanel is rendered either on the\n * bottom of the viewport or within the Tools container.\n */\n const [splitPanelPreferences, setSplitPanelPreferences] = useControllable(\n props.splitPanelPreferences,\n props.onSplitPanelPreferencesChange,\n undefined,\n {\n componentName: 'AppLayout',\n controlledProp: 'splitPanelPreferences',\n changeHandler: 'onSplitPanelPreferencesChange',\n }\n );\n\n const { refs: splitPanelRefs, setLastInteraction: setSplitPanelLastInteraction } = useSplitPanelFocusControl([\n splitPanelPreferences,\n isSplitPanelOpen,\n ]);\n\n const handleSplitPanelClick = useCallback(\n function handleSplitPanelChange() {\n setIsSplitPanelOpen(!isSplitPanelOpen);\n setSplitPanelLastInteraction({ type: isSplitPanelOpen ? 'close' : 'open' });\n fireNonCancelableEvent(props.onSplitPanelToggle, { open: !isSplitPanelOpen });\n },\n [props.onSplitPanelToggle, isSplitPanelOpen, setIsSplitPanelOpen, setSplitPanelLastInteraction]\n );\n\n /**\n * The Split Panel will be in forced (bottom) position if the defined minimum width is\n * greater than the maximum width. In other words, the maximum width is the currently\n * available horizontal space based on all other components that are rendered. If the\n * minimum width exceeds this value then there is not enough horizontal space and we must\n * force it to the bottom position.\n */\n const [isSplitPanelForcedPosition, setSplitPanelForcedPosition] = useState(false);\n const splitPanelPosition = getSplitPanelPosition(isSplitPanelForcedPosition, splitPanelPreferences);\n\n useLayoutEffect(\n function handleSplitPanelForcePosition() {\n setSplitPanelForcedPosition(splitPanelMinWidth > splitPanelMaxWidth);\n },\n [splitPanelMaxWidth, splitPanelMinWidth]\n );\n\n /**\n * The useControllable hook will set the default size of the SplitPanel based\n * on the default position set in the splitPanelPreferences. The logic for the\n * default size is contained in the SplitPanel component. The splitPanelControlledSize\n * will be bound to the size property in the SplitPanel context for rendering.\n *\n * The callback that will be passed to the SplitPanel component\n * to handle the resize events that will change the size of the SplitPanel.\n * It will set the splitPanelControlledSize controlled state and fire the\n * onSplitPanelResize event.\n */\n const [splitPanelReportedSize, setSplitPanelReportedSize] = useState(0);\n const [splitPanelReportedHeaderHeight, setSplitPanelReportedHeaderHeight] = useState(0);\n const [splitPanelToggle, setSplitPanelToggle] = useState<SplitPanelSideToggleProps>({\n displayed: false,\n ariaLabel: undefined,\n });\n const splitPanelDisplayed = !!(splitPanelToggle.displayed || isSplitPanelOpen);\n\n const [splitPanelSize, setSplitPanelSize] = useControllable(\n props.splitPanelSize,\n props.onSplitPanelResize,\n getSplitPanelDefaultSize(splitPanelPosition),\n { componentName: 'AppLayout', controlledProp: 'splitPanelSize', changeHandler: 'onSplitPanelResize' }\n );\n\n const handleSplitPanelResize = useCallback(\n function handleSplitPanelChange(detail: { size: number }) {\n setSplitPanelSize(detail.size);\n fireNonCancelableEvent(props.onSplitPanelResize, detail);\n },\n [props.onSplitPanelResize, setSplitPanelSize]\n );\n\n const handleSplitPanelPreferencesChange = useCallback(\n function handleSplitPanelChange(detail: AppLayoutProps.SplitPanelPreferences) {\n setSplitPanelPreferences(detail);\n setSplitPanelLastInteraction({ type: 'position' });\n fireNonCancelableEvent(props.onSplitPanelPreferencesChange, detail);\n },\n [props.onSplitPanelPreferencesChange, setSplitPanelPreferences, setSplitPanelLastInteraction]\n );\n\n /**\n * The Layout element is not necessarily synonymous with the client\n * viewport width. There can be content in the horizontal viewport\n * that exists on either side of the AppLayout. This resize observer\n * will set the custom property of the Layout element width that\n * is used for various horizontal constraints such as the maximum\n * allowed width of the Tools container.\n *\n * The offsetLeft of the Main will return the distance that the\n * Main element has from the left edge of the Layout component.\n * The offsetLeft value can vary based on the presence and state\n * of the Navigation as well as content gaps in the grid definition.\n * This value is used to determine the max width constraint calculation\n * for the Tools container.\n */\n const [layoutContainerQuery, layoutElement] = useContainerQuery(rect => rect.width);\n const layoutWidth = layoutContainerQuery ?? 0;\n\n const mainElement = useRef<HTMLDivElement>(null);\n const [mainOffsetLeft, setMainOffsetLeft] = useState(0);\n\n useLayoutEffect(\n function handleMainOffsetLeft() {\n setMainOffsetLeft(mainElement?.current?.offsetLeft ?? 0);\n },\n [layoutWidth, isNavigationOpen, isToolsOpen, splitPanelReportedSize]\n );\n\n useLayoutEffect(\n function handleSplitPanelMaxWidth() {\n /**\n * Warning! This is a hack! In order to accurately calculate if there is adequate\n * horizontal space for the Split Panel to be in the side position we need two values\n * that are not available in JavaScript.\n *\n * The first is the the content gap on the right which is stored in a design token\n * and applied in the Layout CSS:\n *\n * $contentGapRight: #{awsui.$space-scaled-2x-xxxl};\n *\n * The second is the width of the element that has the circular buttons for the\n * Tools and Split Panel. This could be suppressed given the state of the Tools\n * drawer returning a zero value. It would, however, be rendered if the Split Panel\n * were to move into the side position. This is calculated in the Tools CSS and\n * the Trigger button CSS with design tokens:\n *\n * padding: awsui.$space-scaled-s awsui.$space-layout-toggle-padding;\n * width: awsui.$space-layout-toggle-diameter;\n *\n * These values will be defined below as static integers that are rough approximations\n * of their computed width when rendered in the DOM, but doubled to ensure adequate\n * spacing for the Split Panel to be in side position.\n */\n const contentGapRight = 80; // Approximately 40px when rendered but doubled for safety\n const toolsFormOffsetWidth = 160; // Approximately 80px when rendered but doubled for safety\n const toolsOffsetWidth = isToolsOpen ? toolsWidth : 0;\n\n setSplitPanelMaxWidth(\n layoutWidth - mainOffsetLeft - minContentWidth - contentGapRight - toolsOffsetWidth - toolsFormOffsetWidth\n );\n },\n [isNavigationOpen, isToolsOpen, layoutWidth, mainOffsetLeft, minContentWidth, toolsWidth]\n );\n\n /**\n * Because the notifications slot does not give us any direction insight into\n * what the state of the child content is we need to have a mechanism for\n * tracking the height of the notifications and whether or not it has content.\n * The height of the notifications is an integer that will be used as a custom\n * property on the Layout component to determine what the sticky offset should\n * be if there are sticky notifications. This could be any number including\n * zero based on how the child content renders. The hasNotificationsContent boolean\n * is simply centralizing the logic of the notifications height being > 0 such\n * that it is not repeated in various components (such as AppBar) that need to\n * know if the notifications slot is empty.\n */\n const [notificationsContainerQuery, notificationsElement] = useContainerQuery(rect => rect.height);\n const [notificationsHeight, setNotificationsHeight] = useState(0);\n const [hasNotificationsContent, setHasNotificationsContent] = useState(false);\n\n useEffect(\n function handleNotificationsContent() {\n setNotificationsHeight(notificationsContainerQuery ?? 0);\n setHasNotificationsContent(notificationsContainerQuery && notificationsContainerQuery > 0 ? true : false);\n },\n [notificationsContainerQuery]\n );\n\n /**\n * Determine the offsetBottom value based on the presence of a footer element and\n * the SplitPanel component. Ignore the SplitPanel if it is not in the bottom\n * position. Use the size property if it is open and the header height if it is closed.\n */\n let offsetBottom = footerHeight;\n if (splitPanelDisplayed && splitPanelPosition === 'bottom') {\n if (isSplitPanelOpen) {\n offsetBottom += splitPanelReportedSize;\n } else {\n offsetBottom += splitPanelReportedHeaderHeight;\n }\n }\n\n return (\n <AppLayoutInternalsContext.Provider\n value={{\n ...props,\n contentType,\n dynamicOverlapHeight,\n headerHeight,\n footerHeight,\n hasDefaultToolsWidth,\n handleNavigationClick,\n handleSplitPanelClick,\n handleSplitPanelPreferencesChange,\n handleSplitPanelResize,\n handleToolsClick,\n hasNotificationsContent,\n hasStickyBackground,\n isAnyPanelOpen,\n isMobile,\n isNavigationOpen: isNavigationOpen ?? false,\n isSplitPanelForcedPosition,\n isSplitPanelOpen,\n isToolsOpen,\n layoutElement,\n layoutWidth,\n mainElement,\n mainOffsetLeft,\n maxContentWidth,\n minContentWidth,\n navigationHide,\n notificationsElement,\n notificationsHeight,\n offsetBottom,\n setDynamicOverlapHeight,\n setHasStickyBackground,\n setSplitPanelReportedSize,\n setSplitPanelReportedHeaderHeight,\n splitPanel,\n splitPanelDisplayed,\n splitPanelMaxWidth,\n splitPanelMinWidth,\n splitPanelPosition,\n splitPanelPreferences,\n splitPanelReportedSize,\n splitPanelReportedHeaderHeight,\n splitPanelSize,\n splitPanelToggle,\n setSplitPanelToggle,\n splitPanelRefs,\n toolsHide,\n toolsOpen: isToolsOpen,\n toolsWidth,\n toolsRefs,\n navigationRefs,\n loseToolsFocus,\n }}\n >\n <AppLayoutContext.Provider\n value={{\n stickyOffsetBottom: offsetBottom,\n stickyOffsetTop: 0, // not used in this design. Sticky headers read a CSS-var instead\n hasBreadcrumbs: !!props.breadcrumbs,\n setHasStickyBackground,\n setDynamicOverlapHeight,\n }}\n >\n {children}\n </AppLayoutContext.Provider>\n </AppLayoutInternalsContext.Provider>\n );\n }\n);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/navigation.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/navigation.tsx"],"names":[],"mappings":";AAaA;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,uBAkGjC"}
|
|
@@ -7,7 +7,6 @@ import { InternalButton } from '../../button/internal';
|
|
|
7
7
|
import TriggerButton from './trigger-button';
|
|
8
8
|
import styles from './styles.css.js';
|
|
9
9
|
import testutilStyles from '../test-classes/styles.css.js';
|
|
10
|
-
import { useFocusControl } from '../utils/use-focus-control';
|
|
11
10
|
import { Transition } from '../../internal/components/transition';
|
|
12
11
|
import { findUpUntil } from '../../internal/utils/dom';
|
|
13
12
|
import customCssProps from '../../internal/generated/custom-css-properties';
|
|
@@ -19,8 +18,7 @@ import customCssProps from '../../internal/generated/custom-css-properties';
|
|
|
19
18
|
* passed through the API;
|
|
20
19
|
*/
|
|
21
20
|
export default function Navigation() {
|
|
22
|
-
const { ariaLabels, handleNavigationClick, isMobile, isNavigationOpen, navigation, navigationHide, navigationWidth, isToolsOpen, isAnyPanelOpen, toolsHide, } = useAppLayoutInternals();
|
|
23
|
-
const { refs: focusRefs } = useFocusControl(isNavigationOpen);
|
|
21
|
+
const { ariaLabels, handleNavigationClick, isMobile, isNavigationOpen, navigation, navigationHide, navigationWidth, isToolsOpen, isAnyPanelOpen, toolsHide, navigationRefs, } = useAppLayoutInternals();
|
|
24
22
|
if (navigationHide) {
|
|
25
23
|
return null;
|
|
26
24
|
}
|
|
@@ -44,7 +42,7 @@ export default function Navigation() {
|
|
|
44
42
|
[styles.animating]: state === 'exiting',
|
|
45
43
|
[styles['is-navigation-open']]: isNavigationOpen,
|
|
46
44
|
}), ref: state === 'exiting' ? transitionEventsRef : undefined },
|
|
47
|
-
React.createElement(TriggerButton, { ariaLabel: ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.navigationToggle, iconName: "menu", className: testutilStyles['navigation-toggle'], onClick: () => handleNavigationClick(true), ref:
|
|
45
|
+
React.createElement(TriggerButton, { ariaLabel: ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.navigationToggle, iconName: "menu", className: testutilStyles['navigation-toggle'], onClick: () => handleNavigationClick(true), ref: navigationRefs.toggle }))),
|
|
48
46
|
React.createElement("nav", { "aria-label": (_b = ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.navigation) !== null && _b !== void 0 ? _b : undefined, className: clsx(styles.navigation, {
|
|
49
47
|
[styles.animating]: state === 'entering',
|
|
50
48
|
[styles['is-navigation-open']]: isNavigationOpen,
|
|
@@ -53,7 +51,7 @@ export default function Navigation() {
|
|
|
53
51
|
} },
|
|
54
52
|
React.createElement("div", { className: clsx(styles['animated-content']) },
|
|
55
53
|
React.createElement("div", { className: clsx(styles['hide-navigation']) },
|
|
56
|
-
React.createElement(InternalButton, { ariaLabel: (_c = ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.navigationClose) !== null && _c !== void 0 ? _c : undefined, iconName: isMobile ? 'close' : 'angle-left', onClick: () => handleNavigationClick(false), variant: "icon", formAction: "none", className: testutilStyles['navigation-close'], ref:
|
|
54
|
+
React.createElement(InternalButton, { ariaLabel: (_c = ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.navigationClose) !== null && _c !== void 0 ? _c : undefined, iconName: isMobile ? 'close' : 'angle-left', onClick: () => handleNavigationClick(false), variant: "icon", formAction: "none", className: testutilStyles['navigation-close'], ref: navigationRefs.close })),
|
|
57
55
|
navigation))));
|
|
58
56
|
}));
|
|
59
57
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.js","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/navigation.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAC7C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,cAAc,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"navigation.js","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/navigation.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,cA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SAAS,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,SAAS,iBAC7C,CAAC,gBAAgB,EAC9B,OAAO,EAAE,KAAK,CAAC,EAAE;oBACf,iBAAiB,IAAI,iBAAiB,CAAC,KAAK,CAAC,CAAC;gBAChD,CAAC;gBAED,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;oBAC9C,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;wBAC7C,oBAAC,cAAc,IACb,SAAS,EAAE,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,eAAe,mCAAI,SAAS,EACnD,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,EAC3C,OAAO,EAAE,GAAG,EAAE,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAC3C,OAAO,EAAC,MAAM,EACd,UAAU,EAAC,MAAM,EACjB,SAAS,EAAE,cAAc,CAAC,kBAAkB,CAAC,EAC7C,GAAG,EAAE,cAAc,CAAC,KAAK,GACzB,CACE;oBACL,UAAU,CACP,CACF,CACF,CACP,CAAA;KAAA,CACU,CACd,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\nimport { useAppLayoutInternals } from './context';\nimport { InternalButton } from '../../button/internal';\nimport TriggerButton from './trigger-button';\nimport styles from './styles.css.js';\nimport testutilStyles from '../test-classes/styles.css.js';\nimport { Transition } from '../../internal/components/transition';\nimport { findUpUntil } from '../../internal/utils/dom';\nimport customCssProps from '../../internal/generated/custom-css-properties';\n\n/**\n * The Navigation component consists of the following elements:\n * the container, or root element, that sits as a direct child to the Layout grid definition;\n * the show navigation form that contains the trigger for the drawer in large viewports;\n * the navigation, or drawer, that contains the hide navigation form and the children\n * passed through the API;\n */\nexport default function Navigation() {\n const {\n ariaLabels,\n handleNavigationClick,\n isMobile,\n isNavigationOpen,\n navigation,\n navigationHide,\n navigationWidth,\n isToolsOpen,\n isAnyPanelOpen,\n toolsHide,\n navigationRefs,\n } = useAppLayoutInternals();\n\n if (navigationHide) {\n return null;\n }\n\n // Close the Navigation drawer on mobile when a user clicks a link inside.\n const onNavigationClick = (event: React.MouseEvent) => {\n const hasLink = findUpUntil(\n event.target as HTMLElement,\n node => node.tagName === 'A' && !!(node as HTMLAnchorElement).href\n );\n if (hasLink && isMobile) {\n handleNavigationClick(false);\n }\n };\n\n const isUnfocusable = isMobile && isAnyPanelOpen && isToolsOpen && !toolsHide;\n\n return (\n <Transition in={isNavigationOpen}>\n {(state, transitionEventsRef) => (\n <div\n className={clsx(styles['navigation-container'], {\n [testutilStyles['drawer-closed']]: !isNavigationOpen,\n [styles.unfocusable]: isUnfocusable,\n })}\n // Overwrite the default nav width (depends on breakpoints) only when the `navigationWidth` property is set.\n style={{ ...(navigationWidth && { [customCssProps.navigationWidth]: `${navigationWidth}px` }) }}\n >\n {!isMobile && (\n <nav\n aria-hidden={isMobile || isNavigationOpen ? true : false}\n aria-label={ariaLabels?.navigation ?? undefined}\n className={clsx(styles['show-navigation'], {\n [styles.animating]: state === 'exiting',\n [styles['is-navigation-open']]: isNavigationOpen,\n })}\n ref={state === 'exiting' ? transitionEventsRef : undefined}\n >\n <TriggerButton\n ariaLabel={ariaLabels?.navigationToggle}\n iconName=\"menu\"\n className={testutilStyles['navigation-toggle']}\n onClick={() => handleNavigationClick(true)}\n ref={navigationRefs.toggle}\n />\n </nav>\n )}\n\n <nav\n aria-label={ariaLabels?.navigation ?? undefined}\n className={clsx(\n styles.navigation,\n {\n [styles.animating]: state === 'entering',\n [styles['is-navigation-open']]: isNavigationOpen,\n },\n testutilStyles.navigation\n )}\n ref={state !== 'exiting' ? transitionEventsRef : undefined}\n aria-hidden={!isNavigationOpen}\n onClick={event => {\n onNavigationClick && onNavigationClick(event);\n }}\n >\n <div className={clsx(styles['animated-content'])}>\n <div className={clsx(styles['hide-navigation'])}>\n <InternalButton\n ariaLabel={ariaLabels?.navigationClose ?? undefined}\n iconName={isMobile ? 'close' : 'angle-left'}\n onClick={() => handleNavigationClick(false)}\n variant=\"icon\"\n formAction=\"none\"\n className={testutilStyles['navigation-close']}\n ref={navigationRefs.close}\n />\n </div>\n {navigation}\n </div>\n </nav>\n </div>\n )}\n </Transition>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split-panel.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/split-panel.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"split-panel.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/split-panel.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAI/C;;;GAGG;AACH,iBAAS,UAAU,CAAC,EAAE,QAAQ,EAAE,EAAE,KAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC,eA4CjE;kBA5CQ,UAAU;;;;AA8CnB;;;;;GAKG;AACH,iBAAS,gBAAgB,uBAuCxB;AAED;;;;;GAKG;AACH,iBAAS,cAAc,uBAmCtB;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,0BAA0B,EAAE,OAAO,EACnC,qBAAqB,EAAE,cAAc,CAAC,qBAAqB,GAAG,SAAS,qCASxE;AAID,eAAe,UAAU,CAAC"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import React
|
|
3
|
+
import React from 'react';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { useAppLayoutInternals } from './context';
|
|
6
|
-
import { SplitPanelContextProvider
|
|
6
|
+
import { SplitPanelContextProvider } from '../../internal/context/split-panel-context';
|
|
7
7
|
import styles from './styles.css.js';
|
|
8
|
-
import { useEffectOnUpdate } from '../../internal/hooks/use-effect-on-update';
|
|
9
8
|
import { Transition } from '../../internal/components/transition';
|
|
10
9
|
import customCssProps from '../../internal/generated/custom-css-properties';
|
|
11
10
|
/**
|
|
@@ -13,10 +12,7 @@ import customCssProps from '../../internal/generated/custom-css-properties';
|
|
|
13
12
|
* will pass through the AppLayout children without the context.
|
|
14
13
|
*/
|
|
15
14
|
function SplitPanel({ children }) {
|
|
16
|
-
const { handleSplitPanelClick, handleSplitPanelPreferencesChange, handleSplitPanelResize, isMobile, isSplitPanelForcedPosition, isSplitPanelOpen, setSplitPanelReportedSize, setSplitPanelReportedHeaderHeight, splitPanelPosition, splitPanelSize, setSplitPanelToggle, headerHeight, footerHeight, } = useAppLayoutInternals();
|
|
17
|
-
const [splitPanelLastInteraction, setSplitPanelLastInteraction] = useState();
|
|
18
|
-
useEffectOnUpdate(() => setSplitPanelLastInteraction(isSplitPanelOpen ? { type: 'open' } : { type: 'close' }), [isSplitPanelOpen]);
|
|
19
|
-
useEffectOnUpdate(() => setSplitPanelLastInteraction({ type: 'position' }), [splitPanelPosition]);
|
|
15
|
+
const { handleSplitPanelClick, handleSplitPanelPreferencesChange, handleSplitPanelResize, isMobile, isSplitPanelForcedPosition, isSplitPanelOpen, setSplitPanelReportedSize, setSplitPanelReportedHeaderHeight, splitPanelPosition, splitPanelSize, setSplitPanelToggle, splitPanelRefs, headerHeight, footerHeight, } = useAppLayoutInternals();
|
|
20
16
|
const context = {
|
|
21
17
|
bottomOffset: 0,
|
|
22
18
|
getMaxHeight: () => {
|
|
@@ -39,7 +35,7 @@ function SplitPanel({ children }) {
|
|
|
39
35
|
size: splitPanelSize || 0,
|
|
40
36
|
topOffset: 0,
|
|
41
37
|
setSplitPanelToggle,
|
|
42
|
-
|
|
38
|
+
refs: splitPanelRefs,
|
|
43
39
|
};
|
|
44
40
|
return React.createElement(SplitPanelContextProvider, { value: context }, children);
|
|
45
41
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split-panel.js","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/split-panel.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EACL,yBAAyB,GAG1B,MAAM,4CAA4C,CAAC;AACpD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAClE,OAAO,cAAc,MAAM,gDAAgD,CAAC;AAE5E;;;GAGG;AACH,SAAS,UAAU,CAAC,EAAE,QAAQ,EAAoC;IAChE,MAAM,EACJ,qBAAqB,EACrB,iCAAiC,EACjC,sBAAsB,EACtB,QAAQ,EACR,0BAA0B,EAC1B,gBAAgB,EAChB,yBAAyB,EACzB,iCAAiC,EACjC,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,YAAY,EACZ,YAAY,GACb,GAAG,qBAAqB,EAAE,CAAC;IAE5B,MAAM,CAAC,yBAAyB,EAAE,4BAA4B,CAAC,GAAG,QAAQ,EAAyC,CAAC;IACpH,iBAAiB,CACf,GAAG,EAAE,CAAC,4BAA4B,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAC3F,CAAC,gBAAgB,CAAC,CACnB,CAAC;IACF,iBAAiB,CAAC,GAAG,EAAE,CAAC,4BAA4B,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,kBAAkB,C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,CAAC,CAAC,CAAC,KAAK,EAChF,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC,YAAY,kBAAkB,EAAE,CAAC,EAAE;YACpF,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,KAAK,KAAK,UAAU;YACxC,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC,EAAE,gBAAgB;SAClD,CAAC,EACF,GAAG,EAAE,mBAAmB,EACxB,KAAK,EAAE;YACL,CAAC,cAAc,CAAC,kBAAkB,CAAC,EAAE,GAAG,kBAAkB,IAAI;YAC9D,CAAC,cAAc,CAAC,kBAAkB,CAAC,EAAE,GAAG,kBAAkB,IAAI;YAC9D,CAAC,cAAc,CAAC,4BAA4B,CAAC,EAAE,GAAG,sBAAsB,IAAI;SAC7E;QAED,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,IAAG,kBAAkB,KAAK,MAAM,IAAI,UAAU,CAAO,CAC7F,CACX,CACU,CACd,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CACnC,0BAAmC,EACnC,qBAAuE;IAEvE,IAAI,kBAAkB,GAAsC,QAAQ,CAAC;IAErE,IAAI,CAAC,0BAA0B,IAAI,CAAA,qBAAqB,aAArB,qBAAqB,uBAArB,qBAAqB,CAAE,QAAQ,MAAK,MAAM,EAAE;QAC7E,kBAAkB,GAAG,MAAM,CAAC;KAC7B;IAED,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AACD,UAAU,CAAC,MAAM,GAAG,gBAAgB,CAAC;AACrC,UAAU,CAAC,IAAI,GAAG,cAAc,CAAC;AAEjC,eAAe,UAAU,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useState } from 'react';\nimport clsx from 'clsx';\nimport { useAppLayoutInternals } from './context';\nimport {\n SplitPanelContextProvider,\n SplitPanelContextProps,\n SplitPanelLastInteraction,\n} from '../../internal/context/split-panel-context';\nimport styles from './styles.css.js';\nimport { AppLayoutProps } from '../interfaces';\nimport { useEffectOnUpdate } from '../../internal/hooks/use-effect-on-update';\nimport { Transition } from '../../internal/components/transition';\nimport customCssProps from '../../internal/generated/custom-css-properties';\n\n/**\n * If there is no Split Panel in the AppLayout context then the SplitPanel\n * will pass through the AppLayout children without the context.\n */\nfunction SplitPanel({ children }: React.PropsWithChildren<unknown>) {\n const {\n handleSplitPanelClick,\n handleSplitPanelPreferencesChange,\n handleSplitPanelResize,\n isMobile,\n isSplitPanelForcedPosition,\n isSplitPanelOpen,\n setSplitPanelReportedSize,\n setSplitPanelReportedHeaderHeight,\n splitPanelPosition,\n splitPanelSize,\n setSplitPanelToggle,\n headerHeight,\n footerHeight,\n } = useAppLayoutInternals();\n\n const [splitPanelLastInteraction, setSplitPanelLastInteraction] = useState<undefined | SplitPanelLastInteraction>();\n useEffectOnUpdate(\n () => setSplitPanelLastInteraction(isSplitPanelOpen ? { type: 'open' } : { type: 'close' }),\n [isSplitPanelOpen]\n );\n useEffectOnUpdate(() => setSplitPanelLastInteraction({ type: 'position' }), [splitPanelPosition]);\n\n const context: SplitPanelContextProps = {\n bottomOffset: 0,\n getMaxHeight: () => {\n const availableHeight = document.documentElement.clientHeight - headerHeight - footerHeight;\n // If the page is likely zoomed in at 200%, allow the split panel to fill the content area.\n return availableHeight < 400 ? availableHeight - 40 : availableHeight - 250;\n },\n getMaxWidth: () => document.documentElement.clientWidth,\n isForcedPosition: isSplitPanelForcedPosition,\n isMobile,\n isOpen: isSplitPanelOpen,\n leftOffset: 0,\n onPreferencesChange: handleSplitPanelPreferencesChange,\n onResize: handleSplitPanelResize,\n onToggle: handleSplitPanelClick,\n position: splitPanelPosition,\n reportSize: setSplitPanelReportedSize,\n reportHeaderHeight: setSplitPanelReportedHeaderHeight,\n rightOffset: 0,\n size: splitPanelSize || 0,\n topOffset: 0,\n setSplitPanelToggle,\n lastInteraction: splitPanelLastInteraction,\n };\n\n return <SplitPanelContextProvider value={context}>{children}</SplitPanelContextProvider>;\n}\n\n/**\n * This is the render function for the SplitPanel when it is in bottom position.\n * The Split Panel container will be another row entry in the grid definition in\n * the Layout component. The start and finish columns will be variable based\n * on the presence and state of the Navigation and Tools components.\n */\nfunction SplitPanelBottom() {\n const {\n disableBodyScroll,\n isNavigationOpen,\n isSplitPanelOpen,\n isToolsOpen,\n splitPanel,\n splitPanelPosition,\n splitPanelReportedSize,\n splitPanelReportedHeaderHeight,\n } = useAppLayoutInternals();\n\n if (!splitPanel) {\n return null;\n }\n\n return (\n <Transition in={isSplitPanelOpen ?? false} exit={false}>\n {(state, transitionEventsRef) => (\n <section\n className={clsx(styles['split-panel-bottom'], styles[`position-${splitPanelPosition}`], {\n [styles.animating]: state === 'entering',\n [styles['disable-body-scroll']]: disableBodyScroll,\n [styles['is-navigation-open']]: isNavigationOpen,\n [styles['is-split-panel-open']]: isSplitPanelOpen,\n [styles['is-tools-open']]: isToolsOpen,\n })}\n ref={transitionEventsRef}\n style={{\n [customCssProps.splitPanelReportedSize]: `${splitPanelReportedSize}px`,\n [customCssProps.splitPanelReportedHeaderSize]: `${splitPanelReportedHeaderHeight}px`,\n }}\n >\n <SplitPanel></SplitPanel>\n {splitPanelPosition === 'bottom' && splitPanel}\n </section>\n )}\n </Transition>\n );\n}\n\n/**\n * This is the render function for the SplitPanel when it is side position.\n * The Split Panel will not be within the grid defined in the Layout component\n * but instead a direct child of the Tools component. The width constraints\n * for this position are computed in the Tools component.\n */\nfunction SplitPanelSide() {\n const {\n isSplitPanelOpen,\n splitPanel,\n splitPanelPosition,\n splitPanelMaxWidth,\n splitPanelMinWidth,\n splitPanelReportedSize,\n } = useAppLayoutInternals();\n\n if (!splitPanel) {\n return null;\n }\n\n return (\n <Transition in={isSplitPanelOpen ?? false} exit={false}>\n {(state, transitionEventsRef) => (\n <section\n aria-hidden={!isSplitPanelOpen || splitPanelPosition === 'bottom' ? true : false}\n className={clsx(styles['split-panel-side'], styles[`position-${splitPanelPosition}`], {\n [styles.animating]: state === 'entering',\n [styles['is-split-panel-open']]: isSplitPanelOpen,\n })}\n ref={transitionEventsRef}\n style={{\n [customCssProps.splitPanelMaxWidth]: `${splitPanelMaxWidth}px`,\n [customCssProps.splitPanelMinWidth]: `${splitPanelMinWidth}px`,\n [customCssProps.splitPanelReportedHeaderSize]: `${splitPanelReportedSize}px`,\n }}\n >\n <div className={clsx(styles['animated-content'])}>{splitPanelPosition === 'side' && splitPanel}</div>\n </section>\n )}\n </Transition>\n );\n}\n\n/**\n * This logic will determine what the Split Panel position should be. It reconciles the possibility\n * of being in forced position with the current selected position in the settings.\n */\nexport function getSplitPanelPosition(\n isSplitPanelForcedPosition: boolean,\n splitPanelPreferences: AppLayoutProps.SplitPanelPreferences | undefined\n) {\n let splitPanelPosition: AppLayoutProps.SplitPanelPosition = 'bottom';\n\n if (!isSplitPanelForcedPosition && splitPanelPreferences?.position === 'side') {\n splitPanelPosition = 'side';\n }\n\n return splitPanelPosition;\n}\nSplitPanel.Bottom = SplitPanelBottom;\nSplitPanel.Side = SplitPanelSide;\n\nexport default SplitPanel;\n"]}
|
|
1
|
+
{"version":3,"file":"split-panel.js","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/split-panel.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,yBAAyB,EAA0B,MAAM,4CAA4C,CAAC;AAC/G,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAClE,OAAO,cAAc,MAAM,gDAAgD,CAAC;AAE5E;;;GAGG;AACH,SAAS,UAAU,CAAC,EAAE,QAAQ,EAAoC;IAChE,MAAM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AG,cAAc,CAAC;AAEjC,eAAe,UAAU,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\nimport { useAppLayoutInternals } from './context';\nimport { SplitPanelContextProvider, SplitPanelContextProps } from '../../internal/context/split-panel-context';\nimport styles from './styles.css.js';\nimport { AppLayoutProps } from '../interfaces';\nimport { Transition } from '../../internal/components/transition';\nimport customCssProps from '../../internal/generated/custom-css-properties';\n\n/**\n * If there is no Split Panel in the AppLayout context then the SplitPanel\n * will pass through the AppLayout children without the context.\n */\nfunction SplitPanel({ children }: React.PropsWithChildren<unknown>) {\n const {\n handleSplitPanelClick,\n handleSplitPanelPreferencesChange,\n handleSplitPanelResize,\n isMobile,\n isSplitPanelForcedPosition,\n isSplitPanelOpen,\n setSplitPanelReportedSize,\n setSplitPanelReportedHeaderHeight,\n splitPanelPosition,\n splitPanelSize,\n setSplitPanelToggle,\n splitPanelRefs,\n headerHeight,\n footerHeight,\n } = useAppLayoutInternals();\n\n const context: SplitPanelContextProps = {\n bottomOffset: 0,\n getMaxHeight: () => {\n const availableHeight = document.documentElement.clientHeight - headerHeight - footerHeight;\n // If the page is likely zoomed in at 200%, allow the split panel to fill the content area.\n return availableHeight < 400 ? availableHeight - 40 : availableHeight - 250;\n },\n getMaxWidth: () => document.documentElement.clientWidth,\n isForcedPosition: isSplitPanelForcedPosition,\n isMobile,\n isOpen: isSplitPanelOpen,\n leftOffset: 0,\n onPreferencesChange: handleSplitPanelPreferencesChange,\n onResize: handleSplitPanelResize,\n onToggle: handleSplitPanelClick,\n position: splitPanelPosition,\n reportSize: setSplitPanelReportedSize,\n reportHeaderHeight: setSplitPanelReportedHeaderHeight,\n rightOffset: 0,\n size: splitPanelSize || 0,\n topOffset: 0,\n setSplitPanelToggle,\n refs: splitPanelRefs,\n };\n\n return <SplitPanelContextProvider value={context}>{children}</SplitPanelContextProvider>;\n}\n\n/**\n * This is the render function for the SplitPanel when it is in bottom position.\n * The Split Panel container will be another row entry in the grid definition in\n * the Layout component. The start and finish columns will be variable based\n * on the presence and state of the Navigation and Tools components.\n */\nfunction SplitPanelBottom() {\n const {\n disableBodyScroll,\n isNavigationOpen,\n isSplitPanelOpen,\n isToolsOpen,\n splitPanel,\n splitPanelPosition,\n splitPanelReportedSize,\n splitPanelReportedHeaderHeight,\n } = useAppLayoutInternals();\n\n if (!splitPanel) {\n return null;\n }\n\n return (\n <Transition in={isSplitPanelOpen ?? false} exit={false}>\n {(state, transitionEventsRef) => (\n <section\n className={clsx(styles['split-panel-bottom'], styles[`position-${splitPanelPosition}`], {\n [styles.animating]: state === 'entering',\n [styles['disable-body-scroll']]: disableBodyScroll,\n [styles['is-navigation-open']]: isNavigationOpen,\n [styles['is-split-panel-open']]: isSplitPanelOpen,\n [styles['is-tools-open']]: isToolsOpen,\n })}\n ref={transitionEventsRef}\n style={{\n [customCssProps.splitPanelReportedSize]: `${splitPanelReportedSize}px`,\n [customCssProps.splitPanelReportedHeaderSize]: `${splitPanelReportedHeaderHeight}px`,\n }}\n >\n <SplitPanel></SplitPanel>\n {splitPanelPosition === 'bottom' && splitPanel}\n </section>\n )}\n </Transition>\n );\n}\n\n/**\n * This is the render function for the SplitPanel when it is side position.\n * The Split Panel will not be within the grid defined in the Layout component\n * but instead a direct child of the Tools component. The width constraints\n * for this position are computed in the Tools component.\n */\nfunction SplitPanelSide() {\n const {\n isSplitPanelOpen,\n splitPanel,\n splitPanelPosition,\n splitPanelMaxWidth,\n splitPanelMinWidth,\n splitPanelReportedSize,\n } = useAppLayoutInternals();\n\n if (!splitPanel) {\n return null;\n }\n\n return (\n <Transition in={isSplitPanelOpen ?? false} exit={false}>\n {(state, transitionEventsRef) => (\n <section\n aria-hidden={!isSplitPanelOpen || splitPanelPosition === 'bottom' ? true : false}\n className={clsx(styles['split-panel-side'], styles[`position-${splitPanelPosition}`], {\n [styles.animating]: state === 'entering',\n [styles['is-split-panel-open']]: isSplitPanelOpen,\n })}\n ref={transitionEventsRef}\n style={{\n [customCssProps.splitPanelMaxWidth]: `${splitPanelMaxWidth}px`,\n [customCssProps.splitPanelMinWidth]: `${splitPanelMinWidth}px`,\n [customCssProps.splitPanelReportedHeaderSize]: `${splitPanelReportedSize}px`,\n }}\n >\n <div className={clsx(styles['animated-content'])}>{splitPanelPosition === 'side' && splitPanel}</div>\n </section>\n )}\n </Transition>\n );\n}\n\n/**\n * This logic will determine what the Split Panel position should be. It reconciles the possibility\n * of being in forced position with the current selected position in the settings.\n */\nexport function getSplitPanelPosition(\n isSplitPanelForcedPosition: boolean,\n splitPanelPreferences: AppLayoutProps.SplitPanelPreferences | undefined\n) {\n let splitPanelPosition: AppLayoutProps.SplitPanelPosition = 'bottom';\n\n if (!isSplitPanelForcedPosition && splitPanelPreferences?.position === 'side') {\n splitPanelPosition = 'side';\n }\n\n return splitPanelPosition;\n}\nSplitPanel.Bottom = SplitPanelBottom;\nSplitPanel.Side = SplitPanelSide;\n\nexport default SplitPanel;\n"]}
|
|
@@ -19,11 +19,10 @@ import customCssProps from '../../internal/generated/custom-css-properties';
|
|
|
19
19
|
* split panel in large viewports;
|
|
20
20
|
*/
|
|
21
21
|
export default function Tools({ children }) {
|
|
22
|
-
const { ariaLabels, handleSplitPanelClick, handleToolsClick, hasDefaultToolsWidth, isNavigationOpen, isMobile, isSplitPanelOpen, isToolsOpen, splitPanelDisplayed, tools, toolsHide, toolsWidth, isAnyPanelOpen, navigationHide,
|
|
22
|
+
const { ariaLabels, handleSplitPanelClick, handleToolsClick, hasDefaultToolsWidth, isNavigationOpen, isMobile, isSplitPanelOpen, isToolsOpen, splitPanelDisplayed, tools, toolsHide, toolsWidth, isAnyPanelOpen, navigationHide, toolsRefs, loseToolsFocus, splitPanelPosition, splitPanelToggle, splitPanelRefs, } = useAppLayoutInternals();
|
|
23
23
|
const hasSplitPanel = getSplitPanelStatus(splitPanelDisplayed, splitPanelPosition);
|
|
24
24
|
const hasToolsForm = getToolsFormStatus(hasSplitPanel, isMobile, isSplitPanelOpen, isToolsOpen, toolsHide);
|
|
25
25
|
const hasToolsFormPersistence = getToolsFormPersistence(hasSplitPanel, isSplitPanelOpen, isToolsOpen, toolsHide);
|
|
26
|
-
const { refs: focusRefs } = toolsFocusControl;
|
|
27
26
|
if (toolsHide && !hasSplitPanel) {
|
|
28
27
|
return null;
|
|
29
28
|
}
|
|
@@ -39,7 +38,7 @@ export default function Tools({ children }) {
|
|
|
39
38
|
[customCssProps.toolsWidth]: hasDefaultToolsWidth ? '' : `${toolsWidth}px`,
|
|
40
39
|
}, onBlur: e => {
|
|
41
40
|
if (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget)) {
|
|
42
|
-
|
|
41
|
+
loseToolsFocus();
|
|
43
42
|
}
|
|
44
43
|
} },
|
|
45
44
|
children,
|
|
@@ -50,15 +49,15 @@ export default function Tools({ children }) {
|
|
|
50
49
|
}, testutilStyles.tools), ref: state !== 'exiting' ? transitionEventsRef : undefined },
|
|
51
50
|
React.createElement("div", { className: clsx(styles['animated-content']) },
|
|
52
51
|
React.createElement("div", { className: clsx(styles['hide-tools']) },
|
|
53
|
-
React.createElement(InternalButton, { ariaLabel: (_b = ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.toolsClose) !== null && _b !== void 0 ? _b : undefined, iconName: isMobile ? 'close' : 'angle-right', onClick: () => handleToolsClick(false), variant: "icon", formAction: "none", className: testutilStyles['tools-close'], ref:
|
|
52
|
+
React.createElement(InternalButton, { ariaLabel: (_b = ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.toolsClose) !== null && _b !== void 0 ? _b : undefined, iconName: isMobile ? 'close' : 'angle-right', onClick: () => handleToolsClick(false), variant: "icon", formAction: "none", className: testutilStyles['tools-close'], ref: toolsRefs.close })),
|
|
54
53
|
tools))),
|
|
55
54
|
!isMobile && (React.createElement("aside", { "aria-hidden": !hasToolsForm ? true : false, "aria-label": (_c = ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.tools) !== null && _c !== void 0 ? _c : undefined, className: clsx(styles['show-tools'], {
|
|
56
55
|
[styles.animating]: state === 'exiting',
|
|
57
56
|
[styles['has-tools-form']]: hasToolsForm,
|
|
58
57
|
[styles['has-tools-form-persistence']]: hasToolsFormPersistence,
|
|
59
58
|
}), ref: state === 'exiting' ? transitionEventsRef : undefined },
|
|
60
|
-
!toolsHide && (React.createElement(TriggerButton, { ariaLabel: ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.toolsToggle, iconName: "status-info", onClick: () => handleToolsClick(!isToolsOpen), selected: hasSplitPanel && isToolsOpen, className: testutilStyles['tools-toggle'], ref:
|
|
61
|
-
hasSplitPanel && splitPanelToggle.displayed && (React.createElement(TriggerButton, { ariaLabel: splitPanelToggle.ariaLabel, iconName: "view-vertical", onClick: () => handleSplitPanelClick(), selected: hasSplitPanel && isSplitPanelOpen, className: splitPanelStyles['open-button'] }))))));
|
|
59
|
+
!toolsHide && (React.createElement(TriggerButton, { ariaLabel: ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.toolsToggle, iconName: "status-info", onClick: () => handleToolsClick(!isToolsOpen), selected: hasSplitPanel && isToolsOpen, className: testutilStyles['tools-toggle'], ref: toolsRefs.toggle })),
|
|
60
|
+
hasSplitPanel && splitPanelToggle.displayed && (React.createElement(TriggerButton, { ariaLabel: splitPanelToggle.ariaLabel, iconName: "view-vertical", onClick: () => handleSplitPanelClick(), selected: hasSplitPanel && isSplitPanelOpen, className: splitPanelStyles['open-button'], ref: splitPanelRefs.toggle }))))));
|
|
62
61
|
}));
|
|
63
62
|
}
|
|
64
63
|
/**
|