@cloudscape-design/components 3.0.109 → 3.0.111
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/visual-refresh/app-bar.d.ts.map +1 -1
- package/app-layout/visual-refresh/app-bar.js +2 -1
- package/app-layout/visual-refresh/app-bar.js.map +1 -1
- package/app-layout/visual-refresh/background.d.ts.map +1 -1
- package/app-layout/visual-refresh/background.js +7 -4
- package/app-layout/visual-refresh/background.js.map +1 -1
- package/app-layout/visual-refresh/context.d.ts +2 -0
- package/app-layout/visual-refresh/context.d.ts.map +1 -1
- package/app-layout/visual-refresh/context.js +23 -18
- package/app-layout/visual-refresh/context.js.map +1 -1
- package/app-layout/visual-refresh/styles.css.js +60 -59
- package/app-layout/visual-refresh/styles.scoped.css +175 -152
- package/app-layout/visual-refresh/styles.selectors.js +60 -59
- package/cards/index.d.ts.map +1 -1
- package/cards/index.js +1 -1
- package/cards/index.js.map +1 -1
- package/container/internal.d.ts +2 -1
- package/container/internal.d.ts.map +1 -1
- package/container/internal.js +21 -6
- package/container/internal.js.map +1 -1
- package/container/styles.css.js +16 -16
- package/container/styles.scoped.css +36 -26
- package/container/styles.selectors.js +16 -16
- package/internal/environment.js +1 -1
- package/internal/hooks/forward-focus/radio-group.d.ts +12 -0
- package/internal/hooks/forward-focus/radio-group.d.ts.map +1 -0
- package/internal/hooks/forward-focus/radio-group.js +27 -0
- package/internal/hooks/forward-focus/radio-group.js.map +1 -0
- package/manifest.json +3 -0
- package/package.json +1 -1
- package/radio-group/index.d.ts +3 -1
- package/radio-group/index.d.ts.map +1 -1
- package/radio-group/index.js +4 -3
- package/radio-group/index.js.map +1 -1
- package/radio-group/interfaces.d.ts +6 -0
- package/radio-group/interfaces.d.ts.map +1 -1
- package/radio-group/interfaces.js.map +1 -1
- package/radio-group/internal.d.ts +3 -3
- package/radio-group/internal.d.ts.map +1 -1
- package/radio-group/internal.js +6 -3
- package/radio-group/internal.js.map +1 -1
- package/split-panel/icons/bottom-icon-refresh.d.ts.map +1 -1
- package/split-panel/icons/bottom-icon-refresh.js +6 -9
- package/split-panel/icons/bottom-icon-refresh.js.map +1 -1
- package/split-panel/icons/side-position-refresh.d.ts +1 -0
- package/split-panel/icons/side-position-refresh.d.ts.map +1 -1
- package/split-panel/icons/side-position-refresh.js +6 -9
- package/split-panel/icons/side-position-refresh.js.map +1 -1
- package/split-panel/styles.css.js +59 -58
- package/split-panel/styles.scoped.css +84 -81
- package/split-panel/styles.selectors.js +59 -58
- package/table/header-cell/index.d.ts +2 -1
- package/table/header-cell/index.d.ts.map +1 -1
- package/table/header-cell/index.js +2 -1
- package/table/header-cell/index.js.map +1 -1
- package/table/header-cell/styles.css.js +16 -15
- package/table/header-cell/styles.scoped.css +26 -26
- package/table/header-cell/styles.selectors.js +16 -15
- package/table/internal.d.ts.map +1 -1
- package/table/internal.js +7 -3
- package/table/internal.js.map +1 -1
- package/table/sticky-header.d.ts +1 -0
- package/table/sticky-header.d.ts.map +1 -1
- package/table/sticky-header.js +2 -1
- package/table/sticky-header.js.map +1 -1
- package/table/styles.css.js +34 -32
- package/table/styles.scoped.css +47 -39
- package/table/styles.selectors.js +34 -32
- package/table/thead.d.ts.map +1 -1
- package/table/thead.js +3 -3
- package/table/thead.js.map +1 -1
- package/tiles/index.d.ts +3 -1
- package/tiles/index.d.ts.map +1 -1
- package/tiles/index.js +4 -3
- package/tiles/index.js.map +1 -1
- package/tiles/interfaces.d.ts +6 -0
- package/tiles/interfaces.d.ts.map +1 -1
- package/tiles/interfaces.js.map +1 -1
- package/tiles/internal.d.ts +3 -3
- package/tiles/internal.d.ts.map +1 -1
- package/tiles/internal.js +24 -21
- package/tiles/internal.js.map +1 -1
- package/tiles/tile.d.ts +2 -1
- package/tiles/tile.d.ts.map +1 -1
- package/tiles/tile.js +7 -5
- package/tiles/tile.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-bar.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/app-bar.tsx"],"names":[],"mappings":"AAUA;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,
|
|
1
|
+
{"version":3,"file":"app-bar.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/app-bar.tsx"],"names":[],"mappings":"AAUA;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,uBA6F7B"}
|
|
@@ -14,7 +14,7 @@ import { useFocusControl } from '../utils/use-focus-control';
|
|
|
14
14
|
export default function AppBar() {
|
|
15
15
|
var _a, _b, _c, _d;
|
|
16
16
|
var _e, _f, _g;
|
|
17
|
-
var _h = useContext(AppLayoutContext), ariaLabels = _h.ariaLabels, breadcrumbs = _h.breadcrumbs, contentHeader = _h.contentHeader, contentType = _h.contentType, dynamicOverlapHeight = _h.dynamicOverlapHeight, handleNavigationClick = _h.handleNavigationClick, handleToolsClick = _h.handleToolsClick, hasNotificationsContent = _h.hasNotificationsContent, isMobile = _h.isMobile, navigationHide = _h.navigationHide, isNavigationOpen = _h.isNavigationOpen, isToolsOpen = _h.isToolsOpen, toolsHide = _h.toolsHide, isAnyPanelOpen = _h.isAnyPanelOpen;
|
|
17
|
+
var _h = useContext(AppLayoutContext), ariaLabels = _h.ariaLabels, breadcrumbs = _h.breadcrumbs, contentHeader = _h.contentHeader, contentType = _h.contentType, dynamicOverlapHeight = _h.dynamicOverlapHeight, handleNavigationClick = _h.handleNavigationClick, handleToolsClick = _h.handleToolsClick, hasNotificationsContent = _h.hasNotificationsContent, hasStickyBackground = _h.hasStickyBackground, isMobile = _h.isMobile, navigationHide = _h.navigationHide, isNavigationOpen = _h.isNavigationOpen, isToolsOpen = _h.isToolsOpen, toolsHide = _h.toolsHide, isAnyPanelOpen = _h.isAnyPanelOpen;
|
|
18
18
|
var focusRefsNav = useFocusControl(isNavigationOpen).refs;
|
|
19
19
|
var focusRefsTools = useFocusControl(isToolsOpen, true).refs;
|
|
20
20
|
if (navigationHide && !breadcrumbs && toolsHide) {
|
|
@@ -31,6 +31,7 @@ export default function AppBar() {
|
|
|
31
31
|
_c[styles['has-dynamic-overlap-height']] = dynamicOverlapHeight > 0,
|
|
32
32
|
_c[styles['has-header']] = contentHeader,
|
|
33
33
|
_c[styles['has-notifications-content']] = hasNotificationsContent,
|
|
34
|
+
_c[styles['has-sticky-background']] = hasStickyBackground,
|
|
34
35
|
_c)) }, breadcrumbs)),
|
|
35
36
|
!toolsHide && isMobile && (React.createElement("aside", { className: clsx(styles['appbar-tools'], (_d = {}, _d[testutilStyles['drawer-closed']] = !isToolsOpen, _d)), "aria-hidden": isToolsOpen, "aria-label": (_f = ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.tools) !== null && _f !== void 0 ? _f : undefined },
|
|
36
37
|
React.createElement(InternalButton, { className: testutilStyles['tools-toggle'], ariaExpanded: isToolsOpen, disabled: isAnyPanelOpen, ariaLabel: (_g = ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.toolsToggle) !== null && _g !== void 0 ? _g : undefined, iconName: "status-info", formAction: "none", onClick: function () { return handleToolsClick(true); }, variant: "icon", ref: focusRefsTools.toggle, __nativeAttributes: { 'aria-haspopup': true } })))));
|
|
@@ -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,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,cAAc,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D;;;GA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CACR,CACP;QAEA,CAAC,SAAS,IAAI,QAAQ,IAAI,CACzB,+BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,YAAI,GAAC,cAAc,CAAC,eAAe,CAAC,IAAG,CAAC,WAAW,MAAG,iBAC/E,WAAW,gBACZ,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,mCAAI,SAAS;YAE1C,oBAAC,cAAc,IACb,SAAS,EAAE,cAAc,CAAC,cAAc,CAAC,EACzC,YAAY,EAAE,WAAW,EACzB,QAAQ,EAAE,cAAc,EACxB,SAAS,EAAE,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,WAAW,mCAAI,SAAS,EAC/C,QAAQ,EAAC,aAAa,EACtB,UAAU,EAAC,MAAM,EACjB,OAAO,EAAE,cAAM,OAAA,gBAAgB,CAAC,IAAI,CAAC,EAAtB,CAAsB,EACrC,OAAO,EAAC,MAAM,EACd,GAAG,EAAE,cAAc,CAAC,MAAM,EAC1B,kBAAkB,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,GAC7C,CACI,CACT,CACO,CACX,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useContext } from 'react';\nimport clsx from 'clsx';\nimport { AppLayoutContext } from './context';\nimport { InternalButton } from '../../button/internal';\nimport styles from './styles.css.js';\nimport testutilStyles from '../test-classes/styles.css.js';\nimport { useFocusControl } from '../utils/use-focus-control';\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 } = useContext(AppLayoutContext);\n const { refs: focusRefsNav } = useFocusControl(isNavigationOpen);\n const { refs: focusRefsTools } = useFocusControl(isToolsOpen, true);\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}\n iconName=\"menu\"\n formAction=\"none\"\n onClick={() => handleNavigationClick(true)}\n variant=\"icon\"\n className={testutilStyles['navigation-toggle']}\n ref={focusRefsNav.toggle}\n disabled={isAnyPanelOpen}\n __nativeAttributes={{ 'aria-haspopup': 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={focusRefsTools.toggle}\n __nativeAttributes={{ 'aria-haspopup': true }}\n />\n </aside>\n )}\n </section>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"background.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/background.tsx"],"names":[],"mappings":"AAOA;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,
|
|
1
|
+
{"version":3,"file":"background.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/background.tsx"],"names":[],"mappings":"AAOA;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,gBAoBjC"}
|
|
@@ -9,13 +9,16 @@ import styles from './styles.css.js';
|
|
|
9
9
|
* that the design tokens used are overridden with the appropriate values.
|
|
10
10
|
*/
|
|
11
11
|
export default function Background() {
|
|
12
|
-
var _a;
|
|
13
|
-
var
|
|
12
|
+
var _a, _b;
|
|
13
|
+
var _c = useContext(AppLayoutContext), hasNotificationsContent = _c.hasNotificationsContent, hasStickyBackground = _c.hasStickyBackground, stickyNotifications = _c.stickyNotifications;
|
|
14
14
|
return (React.createElement("div", { className: clsx(styles.background, 'awsui-context-content-header') },
|
|
15
|
-
React.createElement("div", { className: clsx(styles['notifications-appbar-header'],
|
|
15
|
+
React.createElement("div", { className: clsx(styles['notifications-appbar-header'], (_a = {},
|
|
16
16
|
_a[styles['has-notifications-content']] = hasNotificationsContent,
|
|
17
|
+
_a[styles['has-sticky-background']] = hasStickyBackground,
|
|
17
18
|
_a[styles['sticky-notifications']] = stickyNotifications,
|
|
18
19
|
_a)) }),
|
|
19
|
-
React.createElement("div", { className: clsx(styles.overlap,
|
|
20
|
+
React.createElement("div", { className: clsx(styles.overlap, (_b = {},
|
|
21
|
+
_b[styles['has-sticky-background']] = hasStickyBackground,
|
|
22
|
+
_b)) })));
|
|
20
23
|
}
|
|
21
24
|
//# sourceMappingURL=background.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"background.js","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/background.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU;;IAC1B,IAAA,
|
|
1
|
+
{"version":3,"file":"background.js","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh/background.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU;;IAC1B,IAAA,KAAwE,UAAU,CAAC,gBAAgB,CAAC,EAAlG,uBAAuB,6BAAA,EAAE,mBAAmB,yBAAA,EAAE,mBAAmB,yBAAiC,CAAC;IAE3G,OAAO,CACL,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,8BAA8B,CAAC;QACrE,6BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,6BAA6B,CAAC;gBACnD,GAAC,MAAM,CAAC,2BAA2B,CAAC,IAAG,uBAAuB;gBAC9D,GAAC,MAAM,CAAC,uBAAuB,CAAC,IAAG,mBAAmB;gBACtD,GAAC,MAAM,CAAC,sBAAsB,CAAC,IAAG,mBAAmB;oBACrD,GACF;QAEF,6BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO;gBAC5B,GAAC,MAAM,CAAC,uBAAuB,CAAC,IAAG,mBAAmB;oBACtD,GACF,CACE,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useContext } from 'react';\nimport clsx from 'clsx';\nimport { AppLayoutContext } from './context';\nimport styles from './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 Background() {\n const { hasNotificationsContent, hasStickyBackground, stickyNotifications } = useContext(AppLayoutContext);\n\n return (\n <div className={clsx(styles.background, 'awsui-context-content-header')}>\n <div\n className={clsx(styles['notifications-appbar-header'], {\n [styles['has-notifications-content']]: hasNotificationsContent,\n [styles['has-sticky-background']]: hasStickyBackground,\n [styles['sticky-notifications']]: stickyNotifications,\n })}\n />\n\n <div\n className={clsx(styles.overlap, {\n [styles['has-sticky-background']]: hasStickyBackground,\n })}\n />\n </div>\n );\n}\n"]}
|
|
@@ -17,6 +17,7 @@ export declare const AppLayoutContext: React.Context<{
|
|
|
17
17
|
handleToolsClick: (value: boolean) => void;
|
|
18
18
|
hasDefaultToolsWidth: boolean;
|
|
19
19
|
hasNotificationsContent: boolean;
|
|
20
|
+
hasStickyBackground: boolean;
|
|
20
21
|
isAnyPanelOpen: boolean;
|
|
21
22
|
isMobile: boolean;
|
|
22
23
|
isNavigationOpen: boolean;
|
|
@@ -31,6 +32,7 @@ export declare const AppLayoutContext: React.Context<{
|
|
|
31
32
|
notificationsHeight: number;
|
|
32
33
|
offsetBottom: number;
|
|
33
34
|
setDynamicOverlapHeight: (value: number) => void;
|
|
35
|
+
setHasStickyBackground: (value: boolean) => void;
|
|
34
36
|
setIsNavigationOpen: (value: boolean) => void;
|
|
35
37
|
setIsToolsOpen: (value: boolean) => void;
|
|
36
38
|
setOffsetBottom: (value: number) => void;
|
|
@@ -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,iBAAiB,EAAmB,MAAM,4BAA4B,CAAC;
|
|
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,iBAAiB,EAAmB,MAAM,4BAA4B,CAAC;AAsGhF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB;0BAxGL,MAAM;2BACL,MAAM,IAAI;oCACD,OAAO,KAAK,IAAI;gDACJ,eAAe,qBAAqB,KAAK,IAAI;qCACxD;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI;8BAChC,OAAO,KAAK,IAAI;0BACpB,OAAO;6BACJ,OAAO;yBACX,OAAO;oBACZ,OAAO;cACb,OAAO;sBACC,OAAO;gCACG,OAAO;;iBAEtB,OAAO;mBACL,MAAM,GAAG,CAAC,WAAW,CAAC;iBACxB,MAAM;iBACN,MAAM,GAAG,CAAC,cAAc,CAAC;oBACtB,MAAM;0BACA,MAAM,GAAG,CAAC,cAAc,CAAC;yBAC1B,MAAM;kBACb,MAAM;qCACa,MAAM,KAAK,IAAI;oCAChB,OAAO,KAAK,IAAI;iCACnB,OAAO,KAAK,IAAI;4BACrB,OAAO,KAAK,IAAI;6BACf,MAAM,KAAK,IAAI;uCACL,MAAM,KAAK,IAAI;kBACpC,MAAM;kBACN,MAAM;wBACA,MAAM;wBACN,MAAM;wBACN,eAAe,kBAAkB;4BAC7B,MAAM;uBACX,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsEwB,CAAC;AAM/D,eAAO,MAAM,iBAAiB;cAHlB,MAAM,SAAS;4CAmb1B,CAAC"}
|
|
@@ -32,6 +32,7 @@ var defaults = {
|
|
|
32
32
|
handleToolsClick: function (value) { return value; },
|
|
33
33
|
hasDefaultToolsWidth: true,
|
|
34
34
|
hasNotificationsContent: false,
|
|
35
|
+
hasStickyBackground: false,
|
|
35
36
|
isAnyPanelOpen: false,
|
|
36
37
|
isMobile: false,
|
|
37
38
|
isNavigationOpen: false,
|
|
@@ -57,6 +58,7 @@ var defaults = {
|
|
|
57
58
|
onSplitPanelToggle: function () { },
|
|
58
59
|
onSplitPanelPreferencesChange: function () { },
|
|
59
60
|
setDynamicOverlapHeight: function (value) { return void value; },
|
|
61
|
+
setHasStickyBackground: function (value) { return value; },
|
|
60
62
|
setIsNavigationOpen: function (value) { return value; },
|
|
61
63
|
setIsToolsOpen: function (value) { return value; },
|
|
62
64
|
setOffsetBottom: function (value) { return void value; },
|
|
@@ -90,8 +92,11 @@ export var AppLayoutProvider = React.forwardRef(function (_a, forwardRef) {
|
|
|
90
92
|
/**
|
|
91
93
|
* The overlap height has a default set in CSS but can also be dynamically overridden
|
|
92
94
|
* for content types (such as Table and Wizard) that have variable size content in the overlap.
|
|
95
|
+
* If a child component utilizes a sticky header the hasStickyBackground property will determine
|
|
96
|
+
* if the background remains in the same vertical position.
|
|
93
97
|
*/
|
|
94
98
|
var _h = useState(0), dynamicOverlapHeight = _h[0], setDynamicOverlapHeight = _h[1];
|
|
99
|
+
var _j = useState(false), hasStickyBackground = _j[0], setHasStickyBackground = _j[1];
|
|
95
100
|
/**
|
|
96
101
|
* Set the default values for minimum and maximum content width.
|
|
97
102
|
*/
|
|
@@ -122,7 +127,7 @@ export var AppLayoutProvider = React.forwardRef(function (_a, forwardRef) {
|
|
|
122
127
|
* useControllable hook and also fire the onNavigationChange function to
|
|
123
128
|
* emit the state change.
|
|
124
129
|
*/
|
|
125
|
-
var
|
|
130
|
+
var _k = useControllable(controlledNavigationOpen, props.onNavigationChange, isMobile ? false : contentTypeDefaults.navigationOpen, { componentName: 'AppLayout', controlledProp: 'navigationOpen', changeHandler: 'onNavigationChange' }), _l = _k[0], isNavigationOpen = _l === void 0 ? false : _l, setIsNavigationOpen = _k[1];
|
|
126
131
|
var handleNavigationClick = useCallback(function handleNavigationChange(isOpen) {
|
|
127
132
|
setIsNavigationOpen(isOpen);
|
|
128
133
|
fireNonCancelableEvent(props.onNavigationChange, { open: isOpen });
|
|
@@ -140,7 +145,7 @@ export var AppLayoutProvider = React.forwardRef(function (_a, forwardRef) {
|
|
|
140
145
|
*/
|
|
141
146
|
var toolsWidth = (_d = props.toolsWidth) !== null && _d !== void 0 ? _d : 290;
|
|
142
147
|
var hasDefaultToolsWidth = props.toolsWidth === undefined;
|
|
143
|
-
var
|
|
148
|
+
var _m = useControllable(controlledToolsOpen, props.onToolsChange, isMobile ? false : contentTypeDefaults.toolsOpen, { componentName: 'AppLayout', controlledProp: 'toolsOpen', changeHandler: 'onToolsChange' }), _o = _m[0], isToolsOpen = _o === void 0 ? false : _o, setIsToolsOpen = _m[1];
|
|
144
149
|
var toolsFocusControl = useFocusControl(isToolsOpen, true);
|
|
145
150
|
var handleToolsClick = useCallback(function handleToolsChange(isOpen) {
|
|
146
151
|
setIsToolsOpen(isOpen);
|
|
@@ -188,10 +193,10 @@ export var AppLayoutProvider = React.forwardRef(function (_a, forwardRef) {
|
|
|
188
193
|
* Query the DOM for the header and footer elements based on the selectors provided
|
|
189
194
|
* by the properties and pass the heights to the custom property definitions.
|
|
190
195
|
*/
|
|
191
|
-
var
|
|
196
|
+
var _p = useState(0), headerHeight = _p[0], setHeaderHeight = _p[1];
|
|
192
197
|
var getHeader = useCallback(function () { return document.querySelector(headerSelector); }, [headerSelector]);
|
|
193
198
|
useResizeObserver(getHeader, function (entry) { return setHeaderHeight(entry.borderBoxHeight); });
|
|
194
|
-
var
|
|
199
|
+
var _q = useState(0), footerHeight = _q[0], setFooterHeight = _q[1];
|
|
195
200
|
var getFooter = useCallback(function () { return document.querySelector(footerSelector); }, [footerSelector]);
|
|
196
201
|
useResizeObserver(getFooter, function (entry) { return setFooterHeight(entry.borderBoxHeight); });
|
|
197
202
|
/**
|
|
@@ -202,7 +207,7 @@ export var AppLayoutProvider = React.forwardRef(function (_a, forwardRef) {
|
|
|
202
207
|
* a forced position on the bottom.
|
|
203
208
|
*/
|
|
204
209
|
var splitPanelMinWidth = 280;
|
|
205
|
-
var
|
|
210
|
+
var _r = useState(splitPanelMinWidth), splitPanelMaxWidth = _r[0], setSplitPanelMaxWidth = _r[1];
|
|
206
211
|
/**
|
|
207
212
|
* The useControllable hook will set the default value and manage either
|
|
208
213
|
* the controlled or uncontrolled state of the Split Panel. By default
|
|
@@ -213,7 +218,7 @@ export var AppLayoutProvider = React.forwardRef(function (_a, forwardRef) {
|
|
|
213
218
|
* to open or closed given the current state. It will set the isSplitPanelOpen
|
|
214
219
|
* controlled state and fire the onSplitPanelToggle event.
|
|
215
220
|
*/
|
|
216
|
-
var
|
|
221
|
+
var _s = useControllable(props.splitPanelOpen, props.onSplitPanelToggle, false, { componentName: 'AppLayout', controlledProp: 'splitPanelOpen', changeHandler: 'onSplitPanelToggle' }), isSplitPanelOpen = _s[0], setIsSplitPanelOpen = _s[1];
|
|
217
222
|
var handleSplitPanelClick = useCallback(function handleSplitPanelChange() {
|
|
218
223
|
setIsSplitPanelOpen(!isSplitPanelOpen);
|
|
219
224
|
fireNonCancelableEvent(props.onSplitPanelToggle, { open: !isSplitPanelOpen });
|
|
@@ -228,11 +233,11 @@ export var AppLayoutProvider = React.forwardRef(function (_a, forwardRef) {
|
|
|
228
233
|
* object that will determine if the SplitPanel is rendered either on the
|
|
229
234
|
* bottom of the viewport or within the Tools container.
|
|
230
235
|
*/
|
|
231
|
-
var
|
|
236
|
+
var _t = useControllable(props.splitPanelPreferences, props.onSplitPanelPreferencesChange, undefined, {
|
|
232
237
|
componentName: 'AppLayout',
|
|
233
238
|
controlledProp: 'splitPanelPreferences',
|
|
234
239
|
changeHandler: 'onSplitPanelPreferencesChange'
|
|
235
|
-
}), splitPanelPreferences =
|
|
240
|
+
}), splitPanelPreferences = _t[0], setSplitPanelPreferences = _t[1];
|
|
236
241
|
/**
|
|
237
242
|
* The Split Panel will be in forced (bottom) position if the defined minimum width is
|
|
238
243
|
* greater than the maximum width. In other words, the maximum width is the currently
|
|
@@ -240,7 +245,7 @@ export var AppLayoutProvider = React.forwardRef(function (_a, forwardRef) {
|
|
|
240
245
|
* minimum width exceeds this value then there is not enough horizontal space and we must
|
|
241
246
|
* force it to the bottom position.
|
|
242
247
|
*/
|
|
243
|
-
var
|
|
248
|
+
var _u = useState(false), isSplitPanelForcedPosition = _u[0], setSplitPanelForcedPosition = _u[1];
|
|
244
249
|
var splitPanelPosition = getSplitPanelPosition(isSplitPanelForcedPosition, splitPanelPreferences);
|
|
245
250
|
useLayoutEffect(function handleSplitPanelForcePosition() {
|
|
246
251
|
setSplitPanelForcedPosition(splitPanelMinWidth > splitPanelMaxWidth);
|
|
@@ -256,8 +261,8 @@ export var AppLayoutProvider = React.forwardRef(function (_a, forwardRef) {
|
|
|
256
261
|
* It will set the splitPanelControlledSize controlled state and fire the
|
|
257
262
|
* onSplitPanelResize event.
|
|
258
263
|
*/
|
|
259
|
-
var
|
|
260
|
-
var
|
|
264
|
+
var _v = useState(0), splitPanelReportedSize = _v[0], setSplitPanelReportedSize = _v[1];
|
|
265
|
+
var _w = useControllable(props.splitPanelSize, props.onSplitPanelResize, getSplitPanelDefaultSize(splitPanelPosition), { componentName: 'AppLayout', controlledProp: 'splitPanelSize', changeHandler: 'onSplitPanelResize' }), splitPanelSize = _w[0], setSplitPanelSize = _w[1];
|
|
261
266
|
var handleSplitPanelResize = useCallback(function handleSplitPanelChange(detail) {
|
|
262
267
|
setSplitPanelSize(detail.size);
|
|
263
268
|
fireNonCancelableEvent(props.onSplitPanelResize, detail);
|
|
@@ -281,10 +286,10 @@ export var AppLayoutProvider = React.forwardRef(function (_a, forwardRef) {
|
|
|
281
286
|
* This value is used to determine the max width constraint calculation
|
|
282
287
|
* for the Tools container.
|
|
283
288
|
*/
|
|
284
|
-
var
|
|
289
|
+
var _x = useContainerQuery(function (rect) { return rect.width; }), layoutContainerQuery = _x[0], layoutElement = _x[1];
|
|
285
290
|
var layoutWidth = layoutContainerQuery !== null && layoutContainerQuery !== void 0 ? layoutContainerQuery : 0;
|
|
286
291
|
var mainElement = useRef(null);
|
|
287
|
-
var
|
|
292
|
+
var _y = useState(0), mainOffsetLeft = _y[0], setMainOffsetLeft = _y[1];
|
|
288
293
|
useLayoutEffect(function handleMainOffsetLeft() {
|
|
289
294
|
var _a, _b;
|
|
290
295
|
setMainOffsetLeft((_b = (_a = mainElement === null || mainElement === void 0 ? void 0 : mainElement.current) === null || _a === void 0 ? void 0 : _a.offsetLeft) !== null && _b !== void 0 ? _b : 0);
|
|
@@ -330,9 +335,9 @@ export var AppLayoutProvider = React.forwardRef(function (_a, forwardRef) {
|
|
|
330
335
|
* that it is not repeated in various components (such as AppBar) that need to
|
|
331
336
|
* know if the notifications slot is empty.
|
|
332
337
|
*/
|
|
333
|
-
var
|
|
334
|
-
var
|
|
335
|
-
var
|
|
338
|
+
var _z = useContainerQuery(function (rect) { return rect.height; }), notificationsContainerQuery = _z[0], notificationsElement = _z[1];
|
|
339
|
+
var _0 = useState(0), notificationsHeight = _0[0], setNotificationsHeight = _0[1];
|
|
340
|
+
var _1 = useState(false), hasNotificationsContent = _1[0], setHasNotificationsContent = _1[1];
|
|
336
341
|
useEffect(function handleNotificationsContent() {
|
|
337
342
|
setNotificationsHeight(notificationsContainerQuery !== null && notificationsContainerQuery !== void 0 ? notificationsContainerQuery : 0);
|
|
338
343
|
setHasNotificationsContent(notificationsContainerQuery && notificationsContainerQuery > 0 ? true : false);
|
|
@@ -343,7 +348,7 @@ export var AppLayoutProvider = React.forwardRef(function (_a, forwardRef) {
|
|
|
343
348
|
* is either a footer outside of the AppLayout, a SplitPanel in the bottom position
|
|
344
349
|
* within the AppLayout, or both.
|
|
345
350
|
*/
|
|
346
|
-
var
|
|
347
|
-
return (React.createElement(AppLayoutContext.Provider, { value: __assign(__assign(__assign({}, defaults), props), { contentType: contentType, dynamicOverlapHeight: dynamicOverlapHeight, headerHeight: headerHeight, footerHeight: footerHeight, hasDefaultToolsWidth: hasDefaultToolsWidth, handleNavigationClick: handleNavigationClick, handleSplitPanelClick: handleSplitPanelClick, handleSplitPanelPreferencesChange: handleSplitPanelPreferencesChange, handleSplitPanelResize: handleSplitPanelResize, handleToolsClick: handleToolsClick, hasNotificationsContent: hasNotificationsContent, isAnyPanelOpen: isAnyPanelOpen, isMobile: isMobile, isNavigationOpen: isNavigationOpen !== null && isNavigationOpen !== void 0 ? isNavigationOpen : false, isSplitPanelForcedPosition: isSplitPanelForcedPosition, isSplitPanelOpen: isSplitPanelOpen, isToolsOpen: isToolsOpen, layoutElement: layoutElement, layoutWidth: layoutWidth, mainElement: mainElement, mainOffsetLeft: mainOffsetLeft, maxContentWidth: maxContentWidth, minContentWidth: minContentWidth, navigationHide: navigationHide, notificationsElement: notificationsElement, notificationsHeight: notificationsHeight, offsetBottom: offsetBottom, setDynamicOverlapHeight: setDynamicOverlapHeight, setOffsetBottom: setOffsetBottom, setSplitPanelReportedSize: setSplitPanelReportedSize, splitPanelMaxWidth: splitPanelMaxWidth, splitPanelMinWidth: splitPanelMinWidth, splitPanelPosition: splitPanelPosition, splitPanelPreferences: splitPanelPreferences, splitPanelReportedSize: splitPanelReportedSize, splitPanelSize: splitPanelSize, toolsHide: toolsHide, toolsOpen: isToolsOpen, toolsWidth: toolsWidth, toolsFocusControl: toolsFocusControl }) }, children));
|
|
351
|
+
var _2 = useState(0), offsetBottom = _2[0], setOffsetBottom = _2[1];
|
|
352
|
+
return (React.createElement(AppLayoutContext.Provider, { value: __assign(__assign(__assign({}, defaults), props), { contentType: contentType, dynamicOverlapHeight: dynamicOverlapHeight, headerHeight: headerHeight, footerHeight: footerHeight, hasDefaultToolsWidth: hasDefaultToolsWidth, handleNavigationClick: handleNavigationClick, handleSplitPanelClick: handleSplitPanelClick, handleSplitPanelPreferencesChange: handleSplitPanelPreferencesChange, handleSplitPanelResize: handleSplitPanelResize, handleToolsClick: handleToolsClick, hasNotificationsContent: hasNotificationsContent, hasStickyBackground: hasStickyBackground, isAnyPanelOpen: isAnyPanelOpen, isMobile: isMobile, isNavigationOpen: isNavigationOpen !== null && isNavigationOpen !== void 0 ? isNavigationOpen : false, isSplitPanelForcedPosition: isSplitPanelForcedPosition, isSplitPanelOpen: isSplitPanelOpen, isToolsOpen: isToolsOpen, layoutElement: layoutElement, layoutWidth: layoutWidth, mainElement: mainElement, mainOffsetLeft: mainOffsetLeft, maxContentWidth: maxContentWidth, minContentWidth: minContentWidth, navigationHide: navigationHide, notificationsElement: notificationsElement, notificationsHeight: notificationsHeight, offsetBottom: offsetBottom, setDynamicOverlapHeight: setDynamicOverlapHeight, setHasStickyBackground: setHasStickyBackground, setOffsetBottom: setOffsetBottom, setSplitPanelReportedSize: setSplitPanelReportedSize, splitPanelMaxWidth: splitPanelMaxWidth, splitPanelMinWidth: splitPanelMinWidth, splitPanelPosition: splitPanelPosition, splitPanelPreferences: splitPanelPreferences, splitPanelReportedSize: splitPanelReportedSize, splitPanelSize: splitPanelSize, toolsHide: toolsHide, toolsOpen: isToolsOpen, toolsWidth: toolsWidth, toolsFocusControl: toolsFocusControl }) }, children));
|
|
348
353
|
});
|
|
349
354
|
//# sourceMappingURL=context.js.map
|
|
@@ -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,SAAS,EACT,WAAW,EACX,SAAS,EACT,eAAe,EACf,mBAAmB,EACnB,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,E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ACtB,gBAAgB,kBAAA,EAChB,uBAAuB,yBAAA,EACvB,cAAc,gBAAA,EACd,QAAQ,UAAA,EACR,gBAAgB,EAAE,gBAAgB,aAAhB,gBAAgB,cAAhB,gBAAgB,GAAI,KAAK,EAC3C,0BAA0B,4BAAA,EAC1B,gBAAgB,kBAAA,EAChB,WAAW,aAAA,EACX,aAAa,eAAA,EACb,WAAW,aAAA,EACX,WAAW,aAAA,EACX,cAAc,gBAAA,EACd,eAAe,iBAAA,EACf,eAAe,iBAAA,EACf,cAAc,gBAAA,EACd,oBAAoB,sBAAA,EACpB,mBAAmB,qBAAA,EACnB,YAAY,cAAA,EACZ,uBAAuB,yBAAA,EACvB,eAAe,iBAAA,EACf,yBAAyB,2BAAA,EACzB,kBAAkB,oBAAA,EAClB,kBAAkB,oBAAA,EAClB,kBAAkB,oBAAA,EAClB,qBAAqB,uBAAA,EACrB,sBAAsB,wBAAA,EACtB,cAAc,gBAAA,EACd,SAAS,WAAA,EACT,SAAS,EAAE,WAAW,EACtB,UAAU,YAAA,EACV,iBAAiB,mBAAA,OAGlB,QAAQ,CACiB,CAC7B,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 createRef,\n useCallback,\n useEffect,\n useLayoutEffect,\n useImperativeHandle,\n useRef,\n useState,\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, useResizeObserver } 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';\n\ninterface AppLayoutContextProps 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 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 setIsNavigationOpen: (value: boolean) => void;\n setIsToolsOpen: (value: boolean) => void;\n setOffsetBottom: (value: number) => void;\n setSplitPanelReportedSize: (value: number) => void;\n headerHeight: number;\n footerHeight: number;\n splitPanelMaxWidth: number;\n splitPanelMinWidth: number;\n splitPanelPosition: AppLayoutProps.SplitPanelPosition;\n splitPanelReportedSize: number;\n toolsFocusControl: FocusControlState;\n}\n\n// TODO simplify default params + typings\nconst defaults: AppLayoutContextProps = {\n breadcrumbs: null,\n content: null,\n contentHeader: null,\n contentType: 'default',\n disableBodyScroll: false,\n disableContentHeaderOverlap: false,\n disableContentPaddings: false,\n dynamicOverlapHeight: 0,\n headerHeight: 0,\n footerHeight: 0,\n handleNavigationClick: (value: boolean) => value,\n handleSplitPanelClick: () => {},\n handleSplitPanelPreferencesChange: () => {},\n handleSplitPanelResize: () => {},\n handleToolsClick: (value: boolean) => value,\n hasDefaultToolsWidth: true,\n hasNotificationsContent: false,\n isAnyPanelOpen: false,\n isMobile: false,\n isNavigationOpen: false,\n isSplitPanelForcedPosition: false,\n isSplitPanelOpen: false,\n isToolsOpen: false,\n // TODO: these refs are currently only instantiated once globally\n layoutElement: createRef<HTMLElement>(),\n layoutWidth: 0,\n mainElement: createRef<HTMLDivElement>(),\n mainOffsetLeft: 0,\n maxContentWidth: 0,\n minContentWidth: 280,\n navigation: null,\n navigationHide: false,\n navigationOpen: false,\n notifications: null,\n notificationsElement: createRef<HTMLDivElement>(),\n notificationsHeight: 0,\n offsetBottom: 0,\n onNavigationChange: () => {},\n onSplitPanelResize: () => {},\n onSplitPanelToggle: () => {},\n onSplitPanelPreferencesChange: () => {},\n setDynamicOverlapHeight: (value: number) => void value,\n setIsNavigationOpen: (value: boolean) => value,\n setIsToolsOpen: (value: boolean) => value,\n setOffsetBottom: (value: number) => void value,\n setSplitPanelReportedSize: (value: number) => void value,\n splitPanelMaxWidth: 280,\n splitPanelMinWidth: 280,\n splitPanelOpen: false,\n splitPanelPosition: 'bottom',\n splitPanelPreferences: { position: 'bottom' },\n splitPanelReportedSize: 0,\n splitPanelSize: 0,\n stickyNotifications: false,\n tools: null,\n toolsFocusControl: {} as 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 */\nexport const AppLayoutContext = createContext({ ...defaults });\n\ntype AppLayoutProviderProps = AppLayoutProps & {\n children: React.ReactNode;\n};\n\nexport const AppLayoutProvider = 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 ...props\n }: AppLayoutProviderProps,\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 */\n const [dynamicOverlapHeight, setDynamicOverlapHeight] = useState(0);\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, setHeaderHeight] = useState(0);\n const getHeader = useCallback(() => document.querySelector(headerSelector), [headerSelector]);\n useResizeObserver(getHeader, entry => setHeaderHeight(entry.borderBoxHeight));\n\n const [footerHeight, setFooterHeight] = useState(0);\n const getFooter = useCallback(() => document.querySelector(footerSelector), [footerSelector]);\n useResizeObserver(getFooter, entry => setFooterHeight(entry.borderBoxHeight));\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\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 * The offsetBottom value is used to determine the distance from the bottom of the\n * viewport a sticky element should be placed. A non-zero value means that there\n * is either a footer outside of the AppLayout, a SplitPanel in the bottom position\n * within the AppLayout, or both.\n */\n const [offsetBottom, setOffsetBottom] = useState(0);\n\n return (\n <AppLayoutContext.Provider\n value={{\n ...defaults,\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 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 setOffsetBottom,\n setSplitPanelReportedSize,\n splitPanelMaxWidth,\n splitPanelMinWidth,\n splitPanelPosition,\n splitPanelPreferences,\n splitPanelReportedSize,\n splitPanelSize,\n toolsHide,\n toolsOpen: isToolsOpen,\n toolsWidth,\n toolsFocusControl,\n }}\n >\n {children}\n </AppLayoutContext.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,SAAS,EACT,WAAW,EACX,SAAS,EACT,eAAe,EACf,mBAAmB,EACnB,MAAM,EACN,QAAQ,GACT,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,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC9F,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAA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A,EACb,WAAW,aAAA,EACX,WAAW,aAAA,EACX,cAAc,gBAAA,EACd,eAAe,iBAAA,EACf,eAAe,iBAAA,EACf,cAAc,gBAAA,EACd,oBAAoB,sBAAA,EACpB,mBAAmB,qBAAA,EACnB,YAAY,cAAA,EACZ,uBAAuB,yBAAA,EACvB,sBAAsB,wBAAA,EACtB,eAAe,iBAAA,EACf,yBAAyB,2BAAA,EACzB,kBAAkB,oBAAA,EAClB,kBAAkB,oBAAA,EAClB,kBAAkB,oBAAA,EAClB,qBAAqB,uBAAA,EACrB,sBAAsB,wBAAA,EACtB,cAAc,gBAAA,EACd,SAAS,WAAA,EACT,SAAS,EAAE,WAAW,EACtB,UAAU,YAAA,EACV,iBAAiB,mBAAA,OAGlB,QAAQ,CACiB,CAC7B,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 createRef,\n useCallback,\n useEffect,\n useLayoutEffect,\n useImperativeHandle,\n useRef,\n useState,\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, useResizeObserver } 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';\n\ninterface AppLayoutContextProps 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 setIsNavigationOpen: (value: boolean) => void;\n setIsToolsOpen: (value: boolean) => void;\n setOffsetBottom: (value: number) => void;\n setSplitPanelReportedSize: (value: number) => void;\n headerHeight: number;\n footerHeight: number;\n splitPanelMaxWidth: number;\n splitPanelMinWidth: number;\n splitPanelPosition: AppLayoutProps.SplitPanelPosition;\n splitPanelReportedSize: number;\n toolsFocusControl: FocusControlState;\n}\n\n// TODO simplify default params + typings\nconst defaults: AppLayoutContextProps = {\n breadcrumbs: null,\n content: null,\n contentHeader: null,\n contentType: 'default',\n disableBodyScroll: false,\n disableContentHeaderOverlap: false,\n disableContentPaddings: false,\n dynamicOverlapHeight: 0,\n headerHeight: 0,\n footerHeight: 0,\n handleNavigationClick: (value: boolean) => value,\n handleSplitPanelClick: () => {},\n handleSplitPanelPreferencesChange: () => {},\n handleSplitPanelResize: () => {},\n handleToolsClick: (value: boolean) => value,\n hasDefaultToolsWidth: true,\n hasNotificationsContent: false,\n hasStickyBackground: false,\n isAnyPanelOpen: false,\n isMobile: false,\n isNavigationOpen: false,\n isSplitPanelForcedPosition: false,\n isSplitPanelOpen: false,\n isToolsOpen: false,\n // TODO: these refs are currently only instantiated once globally\n layoutElement: createRef<HTMLElement>(),\n layoutWidth: 0,\n mainElement: createRef<HTMLDivElement>(),\n mainOffsetLeft: 0,\n maxContentWidth: 0,\n minContentWidth: 280,\n navigation: null,\n navigationHide: false,\n navigationOpen: false,\n notifications: null,\n notificationsElement: createRef<HTMLDivElement>(),\n notificationsHeight: 0,\n offsetBottom: 0,\n onNavigationChange: () => {},\n onSplitPanelResize: () => {},\n onSplitPanelToggle: () => {},\n onSplitPanelPreferencesChange: () => {},\n setDynamicOverlapHeight: (value: number) => void value,\n setHasStickyBackground: (value: boolean) => value,\n setIsNavigationOpen: (value: boolean) => value,\n setIsToolsOpen: (value: boolean) => value,\n setOffsetBottom: (value: number) => void value,\n setSplitPanelReportedSize: (value: number) => void value,\n splitPanelMaxWidth: 280,\n splitPanelMinWidth: 280,\n splitPanelOpen: false,\n splitPanelPosition: 'bottom',\n splitPanelPreferences: { position: 'bottom' },\n splitPanelReportedSize: 0,\n splitPanelSize: 0,\n stickyNotifications: false,\n tools: null,\n toolsFocusControl: {} as 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 */\nexport const AppLayoutContext = createContext({ ...defaults });\n\ntype AppLayoutProviderProps = AppLayoutProps & {\n children: React.ReactNode;\n};\n\nexport const AppLayoutProvider = 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 ...props\n }: AppLayoutProviderProps,\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, setHeaderHeight] = useState(0);\n const getHeader = useCallback(() => document.querySelector(headerSelector), [headerSelector]);\n useResizeObserver(getHeader, entry => setHeaderHeight(entry.borderBoxHeight));\n\n const [footerHeight, setFooterHeight] = useState(0);\n const getFooter = useCallback(() => document.querySelector(footerSelector), [footerSelector]);\n useResizeObserver(getFooter, entry => setFooterHeight(entry.borderBoxHeight));\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\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 * The offsetBottom value is used to determine the distance from the bottom of the\n * viewport a sticky element should be placed. A non-zero value means that there\n * is either a footer outside of the AppLayout, a SplitPanel in the bottom position\n * within the AppLayout, or both.\n */\n const [offsetBottom, setOffsetBottom] = useState(0);\n\n return (\n <AppLayoutContext.Provider\n value={{\n ...defaults,\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 setOffsetBottom,\n setSplitPanelReportedSize,\n splitPanelMaxWidth,\n splitPanelMinWidth,\n splitPanelPosition,\n splitPanelPreferences,\n splitPanelReportedSize,\n splitPanelSize,\n toolsHide,\n toolsOpen: isToolsOpen,\n toolsWidth,\n toolsFocusControl,\n }}\n >\n {children}\n </AppLayoutContext.Provider>\n );\n }\n);\n"]}
|
|
@@ -1,64 +1,65 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"appbar": "
|
|
5
|
-
"appbar-nav": "awsui_appbar-
|
|
6
|
-
"breadcrumbs": "
|
|
7
|
-
"appbar-tools": "awsui_appbar-
|
|
8
|
-
"has-breadcrumbs": "awsui_has-
|
|
9
|
-
"has-notifications-content": "awsui_has-notifications-
|
|
10
|
-
"has-header": "awsui_has-
|
|
11
|
-
"has-dynamic-overlap-height": "awsui_has-dynamic-overlap-
|
|
12
|
-
"content-type-wizard": "awsui_content-type-
|
|
13
|
-
"content-type-cards": "awsui_content-type-
|
|
14
|
-
"content-type-table": "awsui_content-type-
|
|
15
|
-
"background": "
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"has-
|
|
26
|
-
"split-panel
|
|
27
|
-
"
|
|
28
|
-
"has-content-gap-
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"is-
|
|
34
|
-
"is-
|
|
35
|
-
"split-panel-
|
|
36
|
-
"
|
|
37
|
-
"content-type-
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"tools": "
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
4
|
+
"appbar": "awsui_appbar_hyvsj_8eynx_93",
|
|
5
|
+
"appbar-nav": "awsui_appbar-nav_hyvsj_8eynx_117",
|
|
6
|
+
"breadcrumbs": "awsui_breadcrumbs_hyvsj_8eynx_121",
|
|
7
|
+
"appbar-tools": "awsui_appbar-tools_hyvsj_8eynx_125",
|
|
8
|
+
"has-breadcrumbs": "awsui_has-breadcrumbs_hyvsj_8eynx_166",
|
|
9
|
+
"has-notifications-content": "awsui_has-notifications-content_hyvsj_8eynx_173",
|
|
10
|
+
"has-header": "awsui_has-header_hyvsj_8eynx_179",
|
|
11
|
+
"has-dynamic-overlap-height": "awsui_has-dynamic-overlap-height_hyvsj_8eynx_179",
|
|
12
|
+
"content-type-wizard": "awsui_content-type-wizard_hyvsj_8eynx_180",
|
|
13
|
+
"content-type-cards": "awsui_content-type-cards_hyvsj_8eynx_183",
|
|
14
|
+
"content-type-table": "awsui_content-type-table_hyvsj_8eynx_184",
|
|
15
|
+
"has-sticky-background": "awsui_has-sticky-background_hyvsj_8eynx_187",
|
|
16
|
+
"background": "awsui_background_hyvsj_8eynx_221",
|
|
17
|
+
"notifications-appbar-header": "awsui_notifications-appbar-header_hyvsj_8eynx_224",
|
|
18
|
+
"sticky-notifications": "awsui_sticky-notifications_hyvsj_8eynx_236",
|
|
19
|
+
"overlap": "awsui_overlap_hyvsj_8eynx_242",
|
|
20
|
+
"content": "awsui_content_hyvsj_8eynx_180",
|
|
21
|
+
"layout": "awsui_layout_hyvsj_8eynx_329",
|
|
22
|
+
"has-max-content-width": "awsui_has-max-content-width_hyvsj_8eynx_411",
|
|
23
|
+
"is-overlap-disabled": "awsui_is-overlap-disabled_hyvsj_8eynx_438",
|
|
24
|
+
"disable-body-scroll": "awsui_disable-body-scroll_hyvsj_8eynx_441",
|
|
25
|
+
"has-sticky-notifications": "awsui_has-sticky-notifications_hyvsj_8eynx_445",
|
|
26
|
+
"has-split-panel": "awsui_has-split-panel_hyvsj_8eynx_459",
|
|
27
|
+
"split-panel-position-bottom": "awsui_split-panel-position-bottom_hyvsj_8eynx_459",
|
|
28
|
+
"has-content-gap-left": "awsui_has-content-gap-left_hyvsj_8eynx_471",
|
|
29
|
+
"has-content-gap-right": "awsui_has-content-gap-right_hyvsj_8eynx_474",
|
|
30
|
+
"block-body-scroll": "awsui_block-body-scroll_hyvsj_8eynx_489",
|
|
31
|
+
"container": "awsui_container_hyvsj_8eynx_497",
|
|
32
|
+
"disable-content-paddings": "awsui_disable-content-paddings_hyvsj_8eynx_514",
|
|
33
|
+
"is-navigation-open": "awsui_is-navigation-open_hyvsj_8eynx_519",
|
|
34
|
+
"is-tools-open": "awsui_is-tools-open_hyvsj_8eynx_522",
|
|
35
|
+
"is-split-panel-open": "awsui_is-split-panel-open_hyvsj_8eynx_522",
|
|
36
|
+
"split-panel-position-side": "awsui_split-panel-position-side_hyvsj_8eynx_522",
|
|
37
|
+
"content-type-default": "awsui_content-type-default_hyvsj_8eynx_542",
|
|
38
|
+
"content-type-form": "awsui_content-type-form_hyvsj_8eynx_542",
|
|
39
|
+
"unfocusable": "awsui_unfocusable_hyvsj_8eynx_583",
|
|
40
|
+
"navigation-container": "awsui_navigation-container_hyvsj_8eynx_591",
|
|
41
|
+
"show-navigation": "awsui_show-navigation_hyvsj_8eynx_626",
|
|
42
|
+
"animating": "awsui_animating_hyvsj_8eynx_648",
|
|
43
|
+
"showButtons": "awsui_showButtons_hyvsj_8eynx_1",
|
|
44
|
+
"navigation": "awsui_navigation_hyvsj_8eynx_591",
|
|
45
|
+
"openNavigation": "awsui_openNavigation_hyvsj_8eynx_1",
|
|
46
|
+
"animated-content": "awsui_animated-content_hyvsj_8eynx_709",
|
|
47
|
+
"hide-navigation": "awsui_hide-navigation_hyvsj_8eynx_718",
|
|
48
|
+
"notifications": "awsui_notifications_hyvsj_8eynx_224",
|
|
49
|
+
"split-panel-bottom": "awsui_split-panel-bottom_hyvsj_8eynx_785",
|
|
50
|
+
"position-bottom": "awsui_position-bottom_hyvsj_8eynx_820",
|
|
51
|
+
"openSplitPanelBottom": "awsui_openSplitPanelBottom_hyvsj_8eynx_1",
|
|
52
|
+
"split-panel-side": "awsui_split-panel-side_hyvsj_8eynx_849",
|
|
53
|
+
"position-side": "awsui_position-side_hyvsj_8eynx_877",
|
|
54
|
+
"openSplitPanelSide": "awsui_openSplitPanelSide_hyvsj_8eynx_1",
|
|
55
|
+
"tools-container": "awsui_tools-container_hyvsj_8eynx_914",
|
|
56
|
+
"tools": "awsui_tools_hyvsj_8eynx_914",
|
|
57
|
+
"openTools": "awsui_openTools_hyvsj_8eynx_1",
|
|
58
|
+
"has-tools-form-persistence": "awsui_has-tools-form-persistence_hyvsj_8eynx_999",
|
|
59
|
+
"hide-tools": "awsui_hide-tools_hyvsj_8eynx_1009",
|
|
60
|
+
"show-tools": "awsui_show-tools_hyvsj_8eynx_1021",
|
|
61
|
+
"has-tools-form": "awsui_has-tools-form_hyvsj_8eynx_999",
|
|
62
|
+
"trigger": "awsui_trigger_hyvsj_8eynx_1078",
|
|
63
|
+
"selected": "awsui_selected_hyvsj_8eynx_1117"
|
|
63
64
|
};
|
|
64
65
|
|