@cloudscape-design/components 3.0.339 → 3.0.340
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.js +6 -5
- package/app-layout/drawer/index.js.map +1 -1
- package/app-layout/drawer/interfaces.d.ts +6 -3
- package/app-layout/drawer/interfaces.d.ts.map +1 -1
- package/app-layout/drawer/interfaces.js.map +1 -1
- package/app-layout/drawer/styles.css.js +10 -10
- package/app-layout/drawer/styles.scoped.css +32 -35
- package/app-layout/drawer/styles.selectors.js +10 -10
- package/app-layout/mobile-toolbar/index.d.ts.map +1 -1
- package/app-layout/mobile-toolbar/index.js +6 -5
- package/app-layout/mobile-toolbar/index.js.map +1 -1
- package/app-layout/mobile-toolbar/styles.css.js +8 -6
- package/app-layout/mobile-toolbar/styles.scoped.css +11 -23
- package/app-layout/mobile-toolbar/styles.selectors.js +8 -6
- package/app-layout/toggles/index.d.ts +3 -1
- package/app-layout/toggles/index.d.ts.map +1 -1
- package/app-layout/toggles/index.js +6 -3
- package/app-layout/toggles/index.js.map +1 -1
- package/app-layout/toggles/interfaces.d.ts +3 -2
- package/app-layout/toggles/interfaces.d.ts.map +1 -1
- package/app-layout/toggles/interfaces.js.map +1 -1
- package/app-layout/toggles/styles.css.js +2 -1
- package/app-layout/toggles/styles.scoped.css +31 -1
- package/app-layout/toggles/styles.selectors.js +2 -1
- package/app-layout/visual-refresh/drawers.d.ts.map +1 -1
- package/app-layout/visual-refresh/drawers.js +2 -2
- package/app-layout/visual-refresh/drawers.js.map +1 -1
- package/app-layout/visual-refresh/trigger-button.d.ts +1 -0
- package/app-layout/visual-refresh/trigger-button.d.ts.map +1 -1
- package/app-layout/visual-refresh/trigger-button.js +2 -2
- package/app-layout/visual-refresh/trigger-button.js.map +1 -1
- package/internal/base-component/styles.scoped.css +0 -5
- package/internal/environment.js +1 -1
- package/internal/generated/theming/index.cjs +0 -27
- package/internal/generated/theming/index.js +0 -27
- package/internal/manifest.json +1 -1
- package/package.json +1 -1
- package/test-utils/dom/app-layout/index.d.ts +1 -0
- package/test-utils/dom/app-layout/index.js +3 -0
- package/test-utils/dom/app-layout/index.js.map +1 -1
- package/test-utils/selectors/app-layout/index.d.ts +1 -0
- package/test-utils/selectors/app-layout/index.js +3 -0
- package/test-utils/selectors/app-layout/index.js.map +1 -1
- package/test-utils/tsconfig.tsbuildinfo +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import React, { useRef } from 'react';
|
|
5
|
-
import {
|
|
5
|
+
import { ToggleButton, CloseButton, togglesConfig } from '../toggles';
|
|
6
6
|
import testutilStyles from '../test-classes/styles.css.js';
|
|
7
7
|
import styles from './styles.css.js';
|
|
8
8
|
// We are using two landmarks per drawer, i.e. two NAVs and two ASIDEs, because of several
|
|
@@ -34,7 +34,7 @@ export const Drawer = React.forwardRef(({ contentClassName, toggleClassName, clo
|
|
|
34
34
|
});
|
|
35
35
|
const { drawerMainLabel, drawerCloseLabel } = getDrawersLabels(drawersAriaLabels);
|
|
36
36
|
const regularOpenButton = (React.createElement(TagName, { ref: openButtonWrapperRef, "aria-label": mainLabel, className: styles.toggle, "aria-hidden": isOpen },
|
|
37
|
-
React.createElement(
|
|
37
|
+
React.createElement(ToggleButton, { ref: toggleRefs.toggle, className: toggleClassName, iconName: iconName, ariaLabel: openLabel, onClick: () => onToggle(true), ariaExpanded: false })));
|
|
38
38
|
return (React.createElement("div", { ref: ref, className: clsx(styles.drawer, {
|
|
39
39
|
[styles['drawer-closed']]: !isOpen,
|
|
40
40
|
[testutilStyles['drawer-closed']]: !isOpen,
|
|
@@ -58,7 +58,7 @@ export const Drawer = React.forwardRef(({ contentClassName, toggleClassName, clo
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
} },
|
|
61
|
-
React.createElement("div", { style: { width: drawerContentWidth, top: topOffset, bottom: bottomOffset }, className: clsx(styles['drawer-content'], contentClassName) },
|
|
61
|
+
React.createElement("div", { style: { width: drawerContentWidth, top: topOffset, bottom: bottomOffset }, className: clsx(styles['drawer-content'], styles['drawer-content-clickable'], contentClassName) },
|
|
62
62
|
!isMobile && regularOpenButton,
|
|
63
63
|
resizeHandle,
|
|
64
64
|
React.createElement(TagName, { "aria-label": drawers ? drawerMainLabel : mainLabel, "aria-hidden": !isOpen },
|
|
@@ -73,9 +73,10 @@ export function DrawerTriggersBar({ isMobile, topOffset, bottomOffset, drawers,
|
|
|
73
73
|
return (React.createElement("div", { className: clsx(styles.drawer, styles['drawer-closed'], testutilStyles['drawer-closed'], {
|
|
74
74
|
[styles['drawer-mobile']]: isMobile,
|
|
75
75
|
}) },
|
|
76
|
-
React.createElement("div", { style: { top: topOffset, bottom: bottomOffset }, className:
|
|
76
|
+
React.createElement("div", { style: { top: topOffset, bottom: bottomOffset }, className: styles['drawer-content'] }, !isMobile && (React.createElement("aside", { "aria-label": drawers === null || drawers === void 0 ? void 0 : drawers.ariaLabel, className: clsx(styles['drawer-triggers-wrapper'], contentClassName) }, (_a = drawers === null || drawers === void 0 ? void 0 : drawers.items) === null || _a === void 0 ? void 0 : _a.map((item, index) => {
|
|
77
77
|
var _a;
|
|
78
|
-
return (React.createElement(
|
|
78
|
+
return (React.createElement("span", { key: index, className: clsx(styles['drawer-trigger'], drawers.activeDrawerId === item.id && styles['drawer-trigger-active']), onClick: () => drawers.onChange({ activeDrawerId: item.id !== drawers.activeDrawerId ? item.id : undefined }) },
|
|
79
|
+
React.createElement(ToggleButton, { className: toggleClassName, iconName: item.trigger.iconName, iconSvg: item.trigger.iconSvg, ariaLabel: (_a = item.ariaLabels) === null || _a === void 0 ? void 0 : _a.triggerButton, ariaExpanded: drawers.activeDrawerId !== undefined, testId: `awsui-app-layout-trigger-${item.id}` })));
|
|
79
80
|
}))))));
|
|
80
81
|
}
|
|
81
82
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
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C,QAAQ,CAAC,EAAE,cAAc,EAAE,IAAI,CAAC,EAAE,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,EAEhG,YAAY,EAAE,OAAO,CAAC,cAAc,KAAK,SAAS,GAClD,CACH,CAAA;SAAA,CAAC,CACI,CACT,CACG,CACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useRef } from 'react';\nimport { AppLayoutButton, CloseButton, togglesConfig } from '../toggles';\n\nimport testutilStyles from '../test-classes/styles.css.js';\nimport styles from './styles.css.js';\nimport { DesktopDrawerProps, DrawerTriggersBarProps, DrawerItem, DrawerItemAriaLabels } from './interfaces';\n\n// We are using two landmarks per drawer, i.e. two NAVs and two ASIDEs, because of several\n// known bugs in NVDA that cause focus changes within a container to sometimes not be\n// announced. As a result, we use one region for the open button and one region for the\n// actual drawer content, always hiding the other one when it's not visible.\n// An alternative solution to follow a more classic implementation here to only have one\n// button that triggers the opening/closing of the drawer also did not work due to another\n// series of bugs in NVDA (together with Firefox) which prevent the changed expanded state\n// from being announced.\n// Even with this workaround in place, the announcement of the close button when opening a\n// panel in NVDA is not working correctly. The suspected root cause is one of the bugs below\n// as well.\n// Relevant tickets:\n// * https://github.com/nvaccess/nvda/issues/6606\n// * https://github.com/nvaccess/nvda/issues/5825\n// * https://github.com/nvaccess/nvda/issues/5247\n// * https://github.com/nvaccess/nvda/pull/8869 (reverted PR that was going to fix it)\nexport const Drawer = React.forwardRef(\n (\n {\n contentClassName,\n toggleClassName,\n closeClassName,\n width,\n type,\n toggleRefs,\n topOffset,\n bottomOffset,\n ariaLabels,\n drawersAriaLabels,\n children,\n isOpen,\n isMobile,\n onToggle,\n onClick,\n onLoseFocus,\n drawers,\n resizeHandle,\n }: DesktopDrawerProps,\n ref: React.Ref<HTMLDivElement>\n ) => {\n const openButtonWrapperRef = useRef<HTMLElement | null>(null);\n const { TagName, iconName, getLabels } = togglesConfig[type];\n const { mainLabel, closeLabel, openLabel } = getLabels(ariaLabels);\n const drawerContentWidthOpen = isMobile ? undefined : width;\n const drawerContentWidth = isOpen ? drawerContentWidthOpen : undefined;\n\n const getDrawersLabels = (labels: DrawerItemAriaLabels = {}) => ({\n drawerMainLabel: labels?.content,\n drawerOpenLabel: labels?.triggerButton,\n drawerCloseLabel: labels?.closeButton,\n });\n const { drawerMainLabel, drawerCloseLabel } = getDrawersLabels(drawersAriaLabels);\n\n const regularOpenButton = (\n <TagName ref={openButtonWrapperRef} aria-label={mainLabel} className={styles.toggle} aria-hidden={isOpen}>\n <AppLayoutButton\n ref={toggleRefs.toggle}\n className={toggleClassName}\n iconName={iconName}\n ariaLabel={openLabel}\n onClick={() => onToggle(true)}\n ariaExpanded={false}\n />\n </TagName>\n );\n\n return (\n <div\n ref={ref}\n className={clsx(styles.drawer, {\n [styles['drawer-closed']]: !isOpen,\n [testutilStyles['drawer-closed']]: !isOpen,\n [styles['drawer-mobile']]: isMobile,\n })}\n style={{ width: drawerContentWidth }}\n onBlur={\n onLoseFocus\n ? e => {\n if (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget)) {\n onLoseFocus(e);\n }\n }\n : undefined\n }\n onClick={event => {\n if (onClick) {\n onClick(event);\n }\n if (!isOpen) {\n // to prevent calling onToggle from the drawer when it's called from the toggle button\n if (\n openButtonWrapperRef.current === event.target ||\n !openButtonWrapperRef.current?.contains(event.target as Node)\n ) {\n onToggle(true);\n }\n }\n }}\n >\n <div\n style={{ width: drawerContentWidth, top: topOffset, bottom: bottomOffset }}\n className={clsx(styles['drawer-content'], contentClassName)}\n >\n {!isMobile && regularOpenButton}\n {resizeHandle}\n <TagName aria-label={drawers ? drawerMainLabel : mainLabel} aria-hidden={!isOpen}>\n <CloseButton\n ref={toggleRefs.close}\n className={closeClassName}\n ariaLabel={drawers ? drawerCloseLabel : closeLabel}\n onClick={() => {\n onToggle(false);\n drawers?.onChange({ activeDrawerId: undefined });\n }}\n />\n {children}\n </TagName>\n </div>\n </div>\n );\n }\n);\n\nexport function DrawerTriggersBar({\n isMobile,\n topOffset,\n bottomOffset,\n drawers,\n contentClassName,\n toggleClassName,\n}: DrawerTriggersBarProps) {\n return (\n <div\n className={clsx(styles.drawer, styles['drawer-closed'], testutilStyles['drawer-closed'], {\n [styles['drawer-mobile']]: isMobile,\n })}\n >\n <div\n style={{ top: topOffset, bottom: bottomOffset }}\n className={clsx(styles['drawer-content'], styles['non-interactive'])}\n >\n {!isMobile && (\n <aside aria-label={drawers?.ariaLabel} className={clsx(styles['drawer-triggers'], contentClassName)}>\n {drawers?.items?.map((item: DrawerItem, index: number) => (\n <AppLayoutButton\n className={clsx(\n toggleClassName,\n styles.trigger,\n styles['trigger-drawer'],\n drawers.activeDrawerId === item.id && styles.selected\n )}\n key={`drawer-trigger-${index}`}\n iconName={item.trigger.iconName}\n iconSvg={item.trigger.iconSvg}\n ariaLabel={item.ariaLabels?.triggerButton}\n onClick={() =>\n drawers.onChange({ activeDrawerId: item.id !== drawers.activeDrawerId ? item.id : undefined })\n }\n ariaExpanded={drawers.activeDrawerId !== undefined}\n />\n ))}\n </aside>\n )}\n </div>\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["app-layout/drawer/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEtE,OAAO,cAAc,MAAM,+BAA+B,CAAC;AAC3D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAGrC,0FAA0F;AAC1F,qFAAqF;AACrF,uFAAuF;AACv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EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,IACtF,CAAC,QAAQ,IAAI,CACZ,6CAAmB,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,yBAAyB,CAAC,EAAE,gBAAgB,CAAC,IACxG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,0CAAE,GAAG,CAAC,CAAC,IAAgB,EAAE,KAAa,EAAE,EAAE;;YAAC,OAAA,CACxD,8BACE,GAAG,EAAE,KAAK,EACV,SAAS,EAAE,IAAI,CACb,MAAM,CAAC,gBAAgB,CAAC,EACxB,OAAO,CAAC,cAAc,KAAK,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,uBAAuB,CAAC,CACtE,EACD,OAAO,EAAE,GAAG,EAAE,CACZ,OAAO,CAAC,QAAQ,CAAC,EAAE,cAAc,EAAE,IAAI,CAAC,EAAE,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;gBAGhG,oBAAC,YAAY,IACX,SAAS,EAAE,eAAe,EAC1B,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,EAC/B,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,EAC7B,SAAS,EAAE,MAAA,IAAI,CAAC,UAAU,0CAAE,aAAa,EACzC,YAAY,EAAE,OAAO,CAAC,cAAc,KAAK,SAAS,EAClD,MAAM,EAAE,4BAA4B,IAAI,CAAC,EAAE,EAAE,GAC7C,CACG,CACR,CAAA;SAAA,CAAC,CACI,CACT,CACG,CACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useRef } from 'react';\nimport { ToggleButton, CloseButton, togglesConfig } from '../toggles';\n\nimport testutilStyles from '../test-classes/styles.css.js';\nimport styles from './styles.css.js';\nimport { DesktopDrawerProps, DrawerTriggersBarProps, DrawerItem, DrawerItemAriaLabels } from './interfaces';\n\n// We are using two landmarks per drawer, i.e. two NAVs and two ASIDEs, because of several\n// known bugs in NVDA that cause focus changes within a container to sometimes not be\n// announced. As a result, we use one region for the open button and one region for the\n// actual drawer content, always hiding the other one when it's not visible.\n// An alternative solution to follow a more classic implementation here to only have one\n// button that triggers the opening/closing of the drawer also did not work due to another\n// series of bugs in NVDA (together with Firefox) which prevent the changed expanded state\n// from being announced.\n// Even with this workaround in place, the announcement of the close button when opening a\n// panel in NVDA is not working correctly. The suspected root cause is one of the bugs below\n// as well.\n// Relevant tickets:\n// * https://github.com/nvaccess/nvda/issues/6606\n// * https://github.com/nvaccess/nvda/issues/5825\n// * https://github.com/nvaccess/nvda/issues/5247\n// * https://github.com/nvaccess/nvda/pull/8869 (reverted PR that was going to fix it)\nexport const Drawer = React.forwardRef(\n (\n {\n contentClassName,\n toggleClassName,\n closeClassName,\n width,\n type,\n toggleRefs,\n topOffset,\n bottomOffset,\n ariaLabels,\n drawersAriaLabels,\n children,\n isOpen,\n isMobile,\n onToggle,\n onClick,\n onLoseFocus,\n drawers,\n resizeHandle,\n }: DesktopDrawerProps,\n ref: React.Ref<HTMLDivElement>\n ) => {\n const openButtonWrapperRef = useRef<HTMLElement | null>(null);\n const { TagName, iconName, getLabels } = togglesConfig[type];\n const { mainLabel, closeLabel, openLabel } = getLabels(ariaLabels);\n const drawerContentWidthOpen = isMobile ? undefined : width;\n const drawerContentWidth = isOpen ? drawerContentWidthOpen : undefined;\n\n const getDrawersLabels = (labels: DrawerItemAriaLabels = {}) => ({\n drawerMainLabel: labels?.content,\n drawerOpenLabel: labels?.triggerButton,\n drawerCloseLabel: labels?.closeButton,\n });\n const { drawerMainLabel, drawerCloseLabel } = getDrawersLabels(drawersAriaLabels);\n\n const regularOpenButton = (\n <TagName ref={openButtonWrapperRef} aria-label={mainLabel} className={styles.toggle} aria-hidden={isOpen}>\n <ToggleButton\n ref={toggleRefs.toggle}\n className={toggleClassName}\n iconName={iconName}\n ariaLabel={openLabel}\n onClick={() => onToggle(true)}\n ariaExpanded={false}\n />\n </TagName>\n );\n\n return (\n <div\n ref={ref}\n className={clsx(styles.drawer, {\n [styles['drawer-closed']]: !isOpen,\n [testutilStyles['drawer-closed']]: !isOpen,\n [styles['drawer-mobile']]: isMobile,\n })}\n style={{ width: drawerContentWidth }}\n onBlur={\n onLoseFocus\n ? e => {\n if (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget)) {\n onLoseFocus(e);\n }\n }\n : undefined\n }\n onClick={event => {\n if (onClick) {\n onClick(event);\n }\n if (!isOpen) {\n // to prevent calling onToggle from the drawer when it's called from the toggle button\n if (\n openButtonWrapperRef.current === event.target ||\n !openButtonWrapperRef.current?.contains(event.target as Node)\n ) {\n onToggle(true);\n }\n }\n }}\n >\n <div\n style={{ width: drawerContentWidth, top: topOffset, bottom: bottomOffset }}\n className={clsx(styles['drawer-content'], styles['drawer-content-clickable'], contentClassName)}\n >\n {!isMobile && regularOpenButton}\n {resizeHandle}\n <TagName aria-label={drawers ? drawerMainLabel : mainLabel} aria-hidden={!isOpen}>\n <CloseButton\n ref={toggleRefs.close}\n className={closeClassName}\n ariaLabel={drawers ? drawerCloseLabel : closeLabel}\n onClick={() => {\n onToggle(false);\n drawers?.onChange({ activeDrawerId: undefined });\n }}\n />\n {children}\n </TagName>\n </div>\n </div>\n );\n }\n);\n\nexport function DrawerTriggersBar({\n isMobile,\n topOffset,\n bottomOffset,\n drawers,\n contentClassName,\n toggleClassName,\n}: DrawerTriggersBarProps) {\n return (\n <div\n className={clsx(styles.drawer, styles['drawer-closed'], testutilStyles['drawer-closed'], {\n [styles['drawer-mobile']]: isMobile,\n })}\n >\n <div style={{ top: topOffset, bottom: bottomOffset }} className={styles['drawer-content']}>\n {!isMobile && (\n <aside aria-label={drawers?.ariaLabel} className={clsx(styles['drawer-triggers-wrapper'], contentClassName)}>\n {drawers?.items?.map((item: DrawerItem, index: number) => (\n <span\n key={index}\n className={clsx(\n styles['drawer-trigger'],\n drawers.activeDrawerId === item.id && styles['drawer-trigger-active']\n )}\n onClick={() =>\n drawers.onChange({ activeDrawerId: item.id !== drawers.activeDrawerId ? item.id : undefined })\n }\n >\n <ToggleButton\n className={toggleClassName}\n iconName={item.trigger.iconName}\n iconSvg={item.trigger.iconSvg}\n ariaLabel={item.ariaLabels?.triggerButton}\n ariaExpanded={drawers.activeDrawerId !== undefined}\n testId={`awsui-app-layout-trigger-${item.id}`}\n />\n </span>\n ))}\n </aside>\n )}\n </div>\n </div>\n );\n}\n"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ButtonProps } from '../../button/interfaces';
|
|
3
2
|
import { togglesConfig } from '../toggles';
|
|
4
3
|
import { AppLayoutProps } from '../interfaces';
|
|
5
4
|
import { IconProps } from '../../icon/interfaces';
|
|
@@ -10,8 +9,12 @@ export interface DesktopDrawerProps {
|
|
|
10
9
|
toggleClassName: string;
|
|
11
10
|
closeClassName: string;
|
|
12
11
|
toggleRefs: {
|
|
13
|
-
toggle: React.Ref<
|
|
14
|
-
|
|
12
|
+
toggle: React.Ref<{
|
|
13
|
+
focus(): void;
|
|
14
|
+
}>;
|
|
15
|
+
close: React.Ref<{
|
|
16
|
+
focus(): void;
|
|
17
|
+
}>;
|
|
15
18
|
};
|
|
16
19
|
width: number;
|
|
17
20
|
topOffset: number | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"lib/default/","sources":["app-layout/drawer/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"lib/default/","sources":["app-layout/dr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C;CACvB;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,OAAO,EAAE;QACP,QAAQ,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC;QAC1B,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;KAC3B,CAAC;IACF,UAAU,EAAE,oBAAoB,CAAC;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,yBAAyB,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACpE;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE;QACR,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;QACzB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,EAAE,yBAAyB,CAAC,MAAM,CAAC,CAAC;QAC7C,QAAQ,CAAC,EAAE,yBAAyB,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,EAAE,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QACnE,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["app-layout/drawer/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport {
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["app-layout/drawer/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { togglesConfig } from '../toggles';\nimport { AppLayoutProps } from '../interfaces';\nimport { IconProps } from '../../icon/interfaces';\nimport { NonCancelableEventHandler } from '../../internal/events';\n\nimport { DrawerFocusControlRefs } from '../utils/use-drawer-focus-control';\n\nexport interface DesktopDrawerProps {\n contentClassName: string;\n toggleClassName: string;\n closeClassName: string;\n toggleRefs: {\n toggle: React.Ref<{ focus(): void }>;\n close: React.Ref<{ focus(): void }>;\n };\n width: number;\n topOffset: number | undefined;\n bottomOffset: number | undefined;\n ariaLabels: AppLayoutProps.Labels | undefined;\n drawersAriaLabels?: DrawerItemAriaLabels | undefined;\n children: React.ReactNode;\n type: keyof typeof togglesConfig;\n isMobile: boolean;\n isOpen: boolean;\n onToggle: (isOpen: boolean) => void;\n onClick?: (event: React.MouseEvent) => void;\n onLoseFocus?: (event: React.FocusEvent) => void;\n drawers?: {\n items: Array<DrawerItem>;\n activeDrawerId: string | undefined;\n onChange: (changeDetail: { activeDrawerId: string | undefined }) => void;\n };\n resizeHandle?: React.ReactNode;\n}\n\nexport interface ResizableDrawerProps extends DesktopDrawerProps {\n activeDrawer?: DrawerItem;\n onResize: (resizeDetail: { size: number; id: string }) => void;\n size: number;\n getMaxWidth: () => number;\n refs: DrawerFocusControlRefs;\n}\n\nexport interface DrawerTriggersBarProps {\n contentClassName: string;\n toggleClassName: string;\n topOffset: number | undefined;\n bottomOffset: number | undefined;\n isMobile: boolean;\n drawers?: {\n items: Array<DrawerItem>;\n activeDrawerId?: string;\n onChange: (changeDetail: { activeDrawerId: string | undefined }) => void;\n ariaLabel?: string;\n };\n}\n\nexport interface DrawerItemAriaLabels {\n content?: string;\n closeButton?: string;\n triggerButton?: string;\n resizeHandle?: string;\n}\n\nexport interface DrawerItem {\n id: string;\n content: React.ReactNode;\n trigger: {\n iconName?: IconProps.Name;\n iconSvg?: React.ReactNode;\n };\n ariaLabels: DrawerItemAriaLabels;\n resizable?: boolean;\n defaultSize?: number;\n onResize?: NonCancelableEventHandler<{ size: number; id: string }>;\n}\n\nexport interface InternalDrawerProps {\n drawers?: {\n items: Array<DrawerItem>;\n activeDrawerId?: string;\n onChange?: NonCancelableEventHandler<string>;\n onResize?: NonCancelableEventHandler<{ size: number; id: string }>;\n ariaLabel?: string;\n };\n}\n"]}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"toggle": "
|
|
5
|
-
"drawer-triggers": "awsui_drawer-
|
|
6
|
-
"drawer": "
|
|
7
|
-
"drawer-mobile": "awsui_drawer-
|
|
8
|
-
"drawer-closed": "awsui_drawer-
|
|
9
|
-
"drawer-content": "awsui_drawer-
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"trigger
|
|
13
|
-
"
|
|
4
|
+
"toggle": "awsui_toggle_1uo6m_18jbl_97",
|
|
5
|
+
"drawer-triggers": "awsui_drawer-triggers_1uo6m_18jbl_102",
|
|
6
|
+
"drawer": "awsui_drawer_1uo6m_18jbl_102",
|
|
7
|
+
"drawer-mobile": "awsui_drawer-mobile_1uo6m_18jbl_112",
|
|
8
|
+
"drawer-closed": "awsui_drawer-closed_1uo6m_18jbl_115",
|
|
9
|
+
"drawer-content": "awsui_drawer-content_1uo6m_18jbl_122",
|
|
10
|
+
"drawer-content-clickable": "awsui_drawer-content-clickable_1uo6m_18jbl_137",
|
|
11
|
+
"drawer-triggers-wrapper": "awsui_drawer-triggers-wrapper_1uo6m_18jbl_148",
|
|
12
|
+
"drawer-trigger": "awsui_drawer-trigger_1uo6m_18jbl_102",
|
|
13
|
+
"drawer-trigger-active": "awsui_drawer-trigger-active_1uo6m_18jbl_166"
|
|
14
14
|
};
|
|
15
15
|
|
|
@@ -94,79 +94,76 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
94
94
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
95
95
|
SPDX-License-Identifier: Apache-2.0
|
|
96
96
|
*/
|
|
97
|
-
.
|
|
97
|
+
.awsui_toggle_1uo6m_18jbl_97:not(#\9) {
|
|
98
98
|
box-sizing: border-box;
|
|
99
99
|
padding: var(--space-xxs-ja5cp8, 4px) 7px;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
.awsui_drawer-
|
|
102
|
+
.awsui_drawer-triggers_1uo6m_18jbl_102:not(#\9) {
|
|
103
103
|
box-sizing: border-box;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
.
|
|
106
|
+
.awsui_drawer_1uo6m_18jbl_102:not(#\9) {
|
|
107
107
|
flex-shrink: 0;
|
|
108
108
|
position: relative;
|
|
109
109
|
word-wrap: break-word;
|
|
110
110
|
box-shadow: var(--shadow-panel-pj5weo, 0px 1px 1px 1px #e9ebed, 0px 6px 36px rgba(0, 7, 22, 0.1));
|
|
111
111
|
}
|
|
112
|
-
.
|
|
112
|
+
.awsui_drawer_1uo6m_18jbl_102:not(#\9):not(.awsui_drawer-mobile_1uo6m_18jbl_112) {
|
|
113
113
|
z-index: 830;
|
|
114
114
|
}
|
|
115
|
-
.awsui_drawer-
|
|
115
|
+
.awsui_drawer-closed_1uo6m_18jbl_115:not(#\9) {
|
|
116
116
|
min-width: 40px;
|
|
117
|
-
cursor: pointer;
|
|
118
117
|
}
|
|
119
|
-
.awsui_drawer-
|
|
118
|
+
.awsui_drawer-closed_1uo6m_18jbl_115.awsui_drawer-mobile_1uo6m_18jbl_112:not(#\9) {
|
|
120
119
|
display: none;
|
|
121
120
|
}
|
|
122
121
|
|
|
123
|
-
.awsui_drawer-
|
|
122
|
+
.awsui_drawer-content_1uo6m_18jbl_122:not(#\9) {
|
|
124
123
|
position: fixed;
|
|
125
124
|
overflow: auto;
|
|
126
125
|
background-color: var(--color-background-layout-panel-content-6tvac7, #ffffff);
|
|
127
126
|
}
|
|
128
|
-
.awsui_drawer-
|
|
127
|
+
.awsui_drawer-mobile_1uo6m_18jbl_112 > .awsui_drawer-content_1uo6m_18jbl_122:not(#\9) {
|
|
129
128
|
z-index: 1001;
|
|
130
129
|
top: 0;
|
|
131
130
|
bottom: 0;
|
|
132
131
|
left: 0;
|
|
133
132
|
right: 0;
|
|
134
133
|
}
|
|
135
|
-
.awsui_drawer-
|
|
134
|
+
.awsui_drawer-closed_1uo6m_18jbl_115 > .awsui_drawer-content_1uo6m_18jbl_122:not(#\9) {
|
|
136
135
|
width: 40px;
|
|
137
136
|
}
|
|
138
|
-
.awsui_drawer-
|
|
139
|
-
|
|
137
|
+
.awsui_drawer-closed_1uo6m_18jbl_115 > .awsui_drawer-content_1uo6m_18jbl_122.awsui_drawer-content-clickable_1uo6m_18jbl_137:not(#\9) {
|
|
138
|
+
cursor: pointer;
|
|
139
|
+
color: var(--color-text-interactive-default-2sml2m, #414d5c);
|
|
140
140
|
}
|
|
141
|
-
.awsui_drawer-
|
|
142
|
-
background: var(--color-background-layout-panel-
|
|
143
|
-
cursor: default;
|
|
141
|
+
.awsui_drawer-closed_1uo6m_18jbl_115 > .awsui_drawer-content_1uo6m_18jbl_122.awsui_drawer-content-clickable_1uo6m_18jbl_137:not(#\9):hover {
|
|
142
|
+
background: var(--color-background-layout-panel-hover-4hingm, #e9ebed);
|
|
144
143
|
}
|
|
145
|
-
.awsui_drawer-
|
|
144
|
+
.awsui_drawer-content_1uo6m_18jbl_122 > [aria-hidden=true]:not(#\9) {
|
|
146
145
|
display: none;
|
|
147
146
|
}
|
|
148
147
|
|
|
149
|
-
.awsui_drawer-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
padding: var(--space-scaled-xs-wbfgrv, 8px) var(--space-s-hdd878, 12px);
|
|
155
|
-
margin-top: 1px;
|
|
156
|
-
}
|
|
157
|
-
.awsui_drawer-content_1uo6m_184sl_123 > .awsui_drawer-triggers_1uo6m_184sl_102 > .awsui_trigger_1uo6m_184sl_149:not(#\9):not(:last-child) {
|
|
158
|
-
box-shadow: 0px 1px var(--color-shadow-layout-toggle-u6bbly, #d1d5db);
|
|
159
|
-
}
|
|
160
|
-
.awsui_drawer-content_1uo6m_184sl_123 > .awsui_drawer-triggers_1uo6m_184sl_102 > .awsui_trigger-drawer_1uo6m_184sl_160:not(#\9):hover:not(.awsui_selected_1uo6m_184sl_160) {
|
|
161
|
-
color: var(--color-text-layout-toggle-hover-dhzmbj, #0972d3);
|
|
148
|
+
.awsui_drawer-triggers-wrapper_1uo6m_18jbl_148:not(#\9) {
|
|
149
|
+
display: flex;
|
|
150
|
+
flex-direction: column;
|
|
151
|
+
text-align: center;
|
|
152
|
+
align-items: stretch;
|
|
162
153
|
}
|
|
163
|
-
|
|
164
|
-
|
|
154
|
+
|
|
155
|
+
.awsui_drawer-trigger_1uo6m_18jbl_102:not(#\9) {
|
|
156
|
+
padding: var(--space-xxs-ja5cp8, 4px) 7px;
|
|
157
|
+
cursor: pointer;
|
|
158
|
+
color: var(--color-text-interactive-default-2sml2m, #414d5c);
|
|
159
|
+
}
|
|
160
|
+
.awsui_drawer-trigger_1uo6m_18jbl_102:not(#\9):not(:first-child) {
|
|
161
|
+
border-top: 1px solid var(--color-border-layout-wyrb3c, #d1d5db);
|
|
162
|
+
}
|
|
163
|
+
.awsui_drawer-trigger_1uo6m_18jbl_102:not(#\9):hover {
|
|
164
|
+
color: var(--color-text-layout-toggle-hover-dhzmbj, #0972d3);
|
|
165
165
|
}
|
|
166
|
-
.awsui_drawer-
|
|
166
|
+
.awsui_drawer-trigger-active_1uo6m_18jbl_166:not(#\9), .awsui_drawer-trigger-active_1uo6m_18jbl_166:not(#\9):hover {
|
|
167
167
|
background-color: var(--color-background-layout-toggle-selected-default-ir617m, #0972d3);
|
|
168
|
-
border-top: 1px solid var(--color-background-layout-toggle-selected-default-ir617m, #0972d3);
|
|
169
|
-
box-shadow: none;
|
|
170
168
|
color: var(--color-text-layout-toggle-active-lzrbla, #ffffff);
|
|
171
|
-
margin: 0;
|
|
172
169
|
}
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"toggle": "
|
|
6
|
-
"drawer-triggers": "awsui_drawer-
|
|
7
|
-
"drawer": "
|
|
8
|
-
"drawer-mobile": "awsui_drawer-
|
|
9
|
-
"drawer-closed": "awsui_drawer-
|
|
10
|
-
"drawer-content": "awsui_drawer-
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"trigger
|
|
14
|
-
"
|
|
5
|
+
"toggle": "awsui_toggle_1uo6m_18jbl_97",
|
|
6
|
+
"drawer-triggers": "awsui_drawer-triggers_1uo6m_18jbl_102",
|
|
7
|
+
"drawer": "awsui_drawer_1uo6m_18jbl_102",
|
|
8
|
+
"drawer-mobile": "awsui_drawer-mobile_1uo6m_18jbl_112",
|
|
9
|
+
"drawer-closed": "awsui_drawer-closed_1uo6m_18jbl_115",
|
|
10
|
+
"drawer-content": "awsui_drawer-content_1uo6m_18jbl_122",
|
|
11
|
+
"drawer-content-clickable": "awsui_drawer-content-clickable_1uo6m_18jbl_137",
|
|
12
|
+
"drawer-triggers-wrapper": "awsui_drawer-triggers-wrapper_1uo6m_18jbl_148",
|
|
13
|
+
"drawer-trigger": "awsui_drawer-trigger_1uo6m_18jbl_102",
|
|
14
|
+
"drawer-trigger-active": "awsui_drawer-trigger-active_1uo6m_18jbl_166"
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["app-layout/mobile-toolbar/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAqClD,UAAU,kBAAkB;IAC1B,YAAY,EAAE,OAAO,GAAG,S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.0
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import React, { useEffect } from 'react';
|
|
5
|
-
import {
|
|
5
|
+
import { ToggleButton, togglesConfig } from '../toggles';
|
|
6
6
|
import styles from './styles.css.js';
|
|
7
7
|
import sharedStyles from '../styles.css.js';
|
|
8
8
|
import testutilStyles from '../test-classes/styles.css.js';
|
|
9
9
|
const MobileToggle = React.forwardRef(({ className, ariaLabels, type, disabled, onClick }, ref) => {
|
|
10
10
|
const { TagName, iconName, getLabels } = togglesConfig[type];
|
|
11
11
|
const { mainLabel, openLabel } = getLabels(ariaLabels);
|
|
12
|
-
return (React.createElement(TagName, { className: clsx(styles['mobile-toggle']), "aria-hidden": disabled, "aria-label": mainLabel, onClick: e => e.target === e.currentTarget && onClick() },
|
|
13
|
-
React.createElement(
|
|
12
|
+
return (React.createElement(TagName, { className: clsx(styles['mobile-toggle'], styles[`mobile-toggle-type-${type}`]), "aria-hidden": disabled, "aria-label": mainLabel, onClick: e => e.target === e.currentTarget && onClick() },
|
|
13
|
+
React.createElement(ToggleButton, { ref: ref, className: className, iconName: iconName, onClick: onClick, ariaLabel: openLabel, disabled: disabled, ariaExpanded: disabled })));
|
|
14
14
|
});
|
|
15
15
|
export function MobileToolbar({ ariaLabels = {}, toggleRefs, topOffset, navigationHide, toolsHide, anyPanelOpen = false, unfocusable, children, onNavigationOpen, onToolsOpen, drawers, mobileBarRef, }) {
|
|
16
16
|
useEffect(() => {
|
|
@@ -28,9 +28,10 @@ export function MobileToolbar({ ariaLabels = {}, toggleRefs, topOffset, navigati
|
|
|
28
28
|
!navigationHide && (React.createElement(MobileToggle, { ref: toggleRefs.navigation, type: "navigation", className: testutilStyles['navigation-toggle'], ariaLabels: ariaLabels, disabled: anyPanelOpen, onClick: onNavigationOpen })),
|
|
29
29
|
React.createElement("div", { className: styles['mobile-bar-breadcrumbs'] }, children && React.createElement("div", { className: testutilStyles.breadcrumbs }, children)),
|
|
30
30
|
!toolsHide && !drawers && (React.createElement(MobileToggle, { ref: toggleRefs.tools, type: "tools", className: testutilStyles['tools-toggle'], ariaLabels: ariaLabels, disabled: anyPanelOpen, onClick: onToolsOpen })),
|
|
31
|
-
drawers && (React.createElement("aside", { "aria-label": drawers.ariaLabel, className: clsx(styles['
|
|
31
|
+
drawers && (React.createElement("aside", { "aria-label": drawers.ariaLabel, className: clsx(styles['drawers-container'], testutilStyles['drawers-mobile-triggers-container']) }, drawers.items.map((item, index) => {
|
|
32
32
|
var _a;
|
|
33
|
-
return (React.createElement(
|
|
33
|
+
return (React.createElement("span", { className: clsx(styles['mobile-toggle'], styles['mobile-toggle-type-drawer']), key: index },
|
|
34
|
+
React.createElement(ToggleButton, { className: testutilStyles['drawers-trigger'], iconName: item.trigger.iconName, iconSvg: item.trigger.iconSvg, ariaLabel: (_a = item.ariaLabels) === null || _a === void 0 ? void 0 : _a.triggerButton, onClick: () => drawers.onChange({ activeDrawerId: item.id }), ariaExpanded: drawers.activeDrawerId !== undefined, testId: `awsui-app-layout-trigger-${item.id}` })));
|
|
34
35
|
})))));
|
|
35
36
|
}
|
|
36
37
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["app-layout/mobile-toolbar/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIzC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["app-layout/mobile-toolbar/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIzC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACz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,mBAAmB,CAAC,EAAE,cAAc,CAAC,mCAAmC,CAAC,CAAC,IAEhG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAgB,EAAE,KAAa,EAAE,EAAE;;YAAC,OAAA,CACtD,8BAAM,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC,2BAA2B,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK;gBAC7F,oBAAC,YAAY,IACX,SAAS,EAAE,cAAc,CAAC,iBAAiB,CAAC,EAC5C,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,EAC/B,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,EAC7B,SAAS,EAAE,MAAA,IAAI,CAAC,UAAU,0CAAE,aAAa,EACzC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,cAAc,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,EAC5D,YAAY,EAAE,OAAO,CAAC,cAAc,KAAK,SAAS,EAClD,MAAM,EAAE,4BAA4B,IAAI,CAAC,EAAE,EAAE,GAC7C,CACG,CACR,CAAA;SAAA,CAAC,CACI,CACT,CACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useEffect } from 'react';\nimport { ButtonProps } from '../../button/interfaces';\nimport { AppLayoutProps } from '../interfaces';\nimport { DrawerItem } from '../drawer/interfaces';\nimport { ToggleButton, togglesConfig } from '../toggles';\nimport styles from './styles.css.js';\nimport sharedStyles from '../styles.css.js';\nimport testutilStyles from '../test-classes/styles.css.js';\ninterface MobileToggleProps {\n className?: string;\n ariaLabels?: AppLayoutProps.Labels;\n type: keyof typeof togglesConfig;\n disabled?: boolean;\n onClick: () => void;\n}\nconst MobileToggle = React.forwardRef(\n ({ className, ariaLabels, type, disabled, onClick }: MobileToggleProps, ref: React.Ref<ButtonProps.Ref>) => {\n const { TagName, iconName, getLabels } = togglesConfig[type];\n const { mainLabel, openLabel } = getLabels(ariaLabels);\n\n return (\n <TagName\n className={clsx(styles['mobile-toggle'], styles[`mobile-toggle-type-${type}`])}\n aria-hidden={disabled}\n aria-label={mainLabel}\n onClick={e => e.target === e.currentTarget && onClick()}\n >\n <ToggleButton\n ref={ref}\n className={className}\n iconName={iconName}\n onClick={onClick}\n ariaLabel={openLabel}\n disabled={disabled}\n ariaExpanded={disabled}\n />\n </TagName>\n );\n }\n);\ninterface MobileToolbarProps {\n anyPanelOpen: boolean | undefined;\n unfocusable: boolean | undefined;\n toggleRefs: {\n navigation: React.Ref<ButtonProps.Ref>;\n tools: React.Ref<ButtonProps.Ref>;\n };\n navigationHide: boolean | undefined;\n toolsHide: boolean | undefined;\n topOffset?: number;\n ariaLabels?: AppLayoutProps.Labels;\n mobileBarRef: React.Ref<HTMLDivElement>;\n children: React.ReactNode;\n onNavigationOpen: () => void;\n onToolsOpen: () => void;\n drawers?: {\n items: Array<DrawerItem>;\n activeDrawerId: string | undefined;\n onChange: (changeDetail: { activeDrawerId: string | undefined }) => void;\n ariaLabel?: string;\n };\n}\n\nexport function MobileToolbar({\n ariaLabels = {},\n toggleRefs,\n topOffset,\n navigationHide,\n toolsHide,\n anyPanelOpen = false,\n unfocusable,\n children,\n onNavigationOpen,\n onToolsOpen,\n drawers,\n mobileBarRef,\n}: MobileToolbarProps) {\n useEffect(() => {\n if (anyPanelOpen) {\n document.body.classList.add(styles['block-body-scroll']);\n return () => {\n document.body.classList.remove(styles['block-body-scroll']);\n };\n } else {\n document.body.classList.remove(styles['block-body-scroll']);\n }\n }, [anyPanelOpen]);\n return (\n <div\n ref={mobileBarRef}\n className={clsx(styles['mobile-bar'], unfocusable && sharedStyles.unfocusable)}\n style={{ top: topOffset }}\n >\n {!navigationHide && (\n <MobileToggle\n ref={toggleRefs.navigation}\n type=\"navigation\"\n className={testutilStyles['navigation-toggle']}\n ariaLabels={ariaLabels}\n disabled={anyPanelOpen}\n onClick={onNavigationOpen}\n />\n )}\n <div className={styles['mobile-bar-breadcrumbs']}>\n {children && <div className={testutilStyles.breadcrumbs}>{children}</div>}\n </div>\n {!toolsHide && !drawers && (\n <MobileToggle\n ref={toggleRefs.tools}\n type=\"tools\"\n className={testutilStyles['tools-toggle']}\n ariaLabels={ariaLabels}\n disabled={anyPanelOpen}\n onClick={onToolsOpen}\n />\n )}\n {drawers && (\n <aside\n aria-label={drawers.ariaLabel}\n className={clsx(styles['drawers-container'], testutilStyles['drawers-mobile-triggers-container'])}\n >\n {drawers.items.map((item: DrawerItem, index: number) => (\n <span className={clsx(styles['mobile-toggle'], styles['mobile-toggle-type-drawer'])} key={index}>\n <ToggleButton\n className={testutilStyles['drawers-trigger']}\n iconName={item.trigger.iconName}\n iconSvg={item.trigger.iconSvg}\n ariaLabel={item.ariaLabels?.triggerButton}\n onClick={() => drawers.onChange({ activeDrawerId: item.id })}\n ariaExpanded={drawers.activeDrawerId !== undefined}\n testId={`awsui-app-layout-trigger-${item.id}`}\n />\n </span>\n ))}\n </aside>\n )}\n </div>\n );\n}\n"]}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"block-body-scroll": "awsui_block-body-
|
|
5
|
-
"mobile-bar": "awsui_mobile-
|
|
6
|
-
"mobile-bar-breadcrumbs": "awsui_mobile-bar-
|
|
7
|
-
"mobile-
|
|
8
|
-
"mobile-toggle": "awsui_mobile-
|
|
9
|
-
"mobile-toggle-
|
|
4
|
+
"block-body-scroll": "awsui_block-body-scroll_19d8l_15f1h_97",
|
|
5
|
+
"mobile-bar": "awsui_mobile-bar_19d8l_15f1h_101",
|
|
6
|
+
"mobile-bar-breadcrumbs": "awsui_mobile-bar-breadcrumbs_19d8l_15f1h_114",
|
|
7
|
+
"mobile-toggle": "awsui_mobile-toggle_19d8l_15f1h_121",
|
|
8
|
+
"mobile-toggle-type-navigation": "awsui_mobile-toggle-type-navigation_19d8l_15f1h_129",
|
|
9
|
+
"mobile-toggle-type-tools": "awsui_mobile-toggle-type-tools_19d8l_15f1h_132",
|
|
10
|
+
"mobile-toggle-type-drawer": "awsui_mobile-toggle-type-drawer_19d8l_15f1h_132",
|
|
11
|
+
"drawers-container": "awsui_drawers-container_19d8l_15f1h_139"
|
|
10
12
|
};
|
|
11
13
|
|
|
@@ -94,12 +94,11 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
94
94
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
95
95
|
SPDX-License-Identifier: Apache-2.0
|
|
96
96
|
*/
|
|
97
|
-
.awsui_block-body-
|
|
97
|
+
.awsui_block-body-scroll_19d8l_15f1h_97:not(#\9) {
|
|
98
98
|
overflow: hidden;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
.awsui_mobile-
|
|
102
|
-
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
101
|
+
.awsui_mobile-bar_19d8l_15f1h_101:not(#\9) {
|
|
103
102
|
position: sticky;
|
|
104
103
|
display: flex;
|
|
105
104
|
align-items: center;
|
|
@@ -112,43 +111,32 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
112
111
|
height: calc(2 * var(--space-m-h2th94, 16px) + var(--space-scaled-xs-wbfgrv, 8px));
|
|
113
112
|
}
|
|
114
113
|
|
|
115
|
-
.awsui_mobile-bar-
|
|
114
|
+
.awsui_mobile-bar-breadcrumbs_19d8l_15f1h_114:not(#\9) {
|
|
116
115
|
min-width: 0;
|
|
117
116
|
flex: 1;
|
|
118
117
|
margin-left: var(--space-m-h2th94, 16px);
|
|
119
118
|
margin-right: var(--space-m-h2th94, 16px);
|
|
120
119
|
}
|
|
121
120
|
|
|
122
|
-
.awsui_mobile-
|
|
123
|
-
width: 40px;
|
|
124
|
-
display: flex;
|
|
125
|
-
justify-content: center;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.awsui_mobile-toggle_19d8l_1xapg_128:not(#\9) {
|
|
121
|
+
.awsui_mobile-toggle_19d8l_15f1h_121:not(#\9) {
|
|
129
122
|
box-sizing: border-box;
|
|
130
123
|
cursor: pointer;
|
|
131
124
|
z-index: 1;
|
|
132
125
|
padding: var(--space-xxs-ja5cp8, 4px) 7px;
|
|
133
126
|
width: 40px;
|
|
127
|
+
color: var(--color-text-interactive-default-2sml2m, #414d5c);
|
|
134
128
|
}
|
|
135
|
-
.awsui_mobile-
|
|
129
|
+
.awsui_mobile-toggle-type-navigation_19d8l_15f1h_129:not(#\9) {
|
|
136
130
|
border-right: 1px solid var(--color-border-layout-wyrb3c, #d1d5db);
|
|
137
131
|
}
|
|
138
|
-
.awsui_mobile-
|
|
132
|
+
.awsui_mobile-toggle-type-tools_19d8l_15f1h_132:not(#\9), .awsui_mobile-toggle-type-drawer_19d8l_15f1h_132:not(#\9) {
|
|
139
133
|
border-left: 1px solid var(--color-border-layout-wyrb3c, #d1d5db);
|
|
140
134
|
}
|
|
141
|
-
.awsui_mobile-
|
|
135
|
+
.awsui_mobile-toggle_19d8l_15f1h_121:not(#\9):hover {
|
|
142
136
|
background: var(--color-background-layout-panel-hover-4hingm, #e9ebed);
|
|
143
137
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
width: auto;
|
|
147
|
-
padding: 0;
|
|
148
|
-
height: 100%;
|
|
149
|
-
}
|
|
150
|
-
.awsui_mobile-toggle-with-drawers_19d8l_1xapg_138 > .awsui_mobile-trigger-with-drawers_19d8l_1xapg_122:not(#\9) {
|
|
151
|
-
border-left: 1px solid var(--color-border-layout-wyrb3c, #d1d5db);
|
|
138
|
+
|
|
139
|
+
.awsui_drawers-container_19d8l_15f1h_139:not(#\9) {
|
|
152
140
|
display: flex;
|
|
153
|
-
align-items:
|
|
141
|
+
align-items: stretch;
|
|
154
142
|
}
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"block-body-scroll": "awsui_block-body-
|
|
6
|
-
"mobile-bar": "awsui_mobile-
|
|
7
|
-
"mobile-bar-breadcrumbs": "awsui_mobile-bar-
|
|
8
|
-
"mobile-
|
|
9
|
-
"mobile-toggle": "awsui_mobile-
|
|
10
|
-
"mobile-toggle-
|
|
5
|
+
"block-body-scroll": "awsui_block-body-scroll_19d8l_15f1h_97",
|
|
6
|
+
"mobile-bar": "awsui_mobile-bar_19d8l_15f1h_101",
|
|
7
|
+
"mobile-bar-breadcrumbs": "awsui_mobile-bar-breadcrumbs_19d8l_15f1h_114",
|
|
8
|
+
"mobile-toggle": "awsui_mobile-toggle_19d8l_15f1h_121",
|
|
9
|
+
"mobile-toggle-type-navigation": "awsui_mobile-toggle-type-navigation_19d8l_15f1h_129",
|
|
10
|
+
"mobile-toggle-type-tools": "awsui_mobile-toggle-type-tools_19d8l_15f1h_132",
|
|
11
|
+
"mobile-toggle-type-drawer": "awsui_mobile-toggle-type-drawer_19d8l_15f1h_132",
|
|
12
|
+
"drawers-container": "awsui_drawers-container_19d8l_15f1h_139"
|
|
11
13
|
};
|
|
12
14
|
|
|
@@ -22,7 +22,9 @@ export declare const togglesConfig: {
|
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
24
|
};
|
|
25
|
-
export declare const
|
|
25
|
+
export declare const ToggleButton: React.ForwardRefExoticComponent<AppLayoutButtonProps & React.RefAttributes<{
|
|
26
|
+
focus(): void;
|
|
27
|
+
}>>;
|
|
26
28
|
interface CloseButtonProps {
|
|
27
29
|
className?: string;
|
|
28
30
|
ariaLabel: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["app-layout/toggles/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["app-layout/toggles/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAGtD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAGpD,eAAO,MAAM,aAAa;;;;sCAIF,eAAe,MAAM;;;;;;;;;sCASrB,eAAe,MAAM;;;;;;CAMnC,CAAC;AAEX,eAAO,MAAM,YAAY;aAGK,IAAI;GAkBjC,CAAC;AAEF,UAAU,gBAAgB;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,eAAO,MAAM,WAAW,0FAgBvB,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import clsx from 'clsx';
|
|
3
4
|
import React from 'react';
|
|
4
5
|
import { InternalButton } from '../../button/internal';
|
|
6
|
+
import InternalIcon from '../../icon/internal';
|
|
5
7
|
import styles from './styles.css.js';
|
|
6
8
|
export const togglesConfig = {
|
|
7
9
|
navigation: {
|
|
@@ -23,11 +25,12 @@ export const togglesConfig = {
|
|
|
23
25
|
}),
|
|
24
26
|
},
|
|
25
27
|
};
|
|
26
|
-
export const
|
|
27
|
-
return (React.createElement(
|
|
28
|
+
export const ToggleButton = React.forwardRef(({ className, ariaLabel, ariaExpanded, iconName, iconSvg, disabled, testId, onClick }, ref) => {
|
|
29
|
+
return (React.createElement("button", { ref: ref, className: clsx(className, styles['toggle-button']), "aria-label": ariaLabel, type: "button", onClick: onClick, disabled: disabled, "aria-expanded": ariaExpanded ? undefined : false, "aria-haspopup": ariaExpanded ? undefined : true, "data-testid": testId },
|
|
30
|
+
React.createElement(InternalIcon, { svg: iconSvg, name: iconName })));
|
|
28
31
|
});
|
|
29
32
|
export const CloseButton = React.forwardRef(({ className, ariaLabel, onClick }, ref) => {
|
|
30
33
|
return (React.createElement("span", { className: styles['close-button'] },
|
|
31
|
-
React.createElement(
|
|
34
|
+
React.createElement(InternalButton, { ref: ref, className: className, ariaLabel: ariaLabel, variant: "icon", formAction: "none", iconName: "close", onClick: onClick })));
|
|
32
35
|
});
|
|
33
36
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["app-layout/toggles/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["app-layout/toggles/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,YAAY,MAAM,qBAAqB,CAAC;AAG/C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,UAAU,EAAE;QACV,OAAO,EAAE,KAAK;QACd,QAAQ,EAAE,MAAM;QAChB,SAAS,EAAE,CAAC,SAAgC,EAAE,EAAE,EAAE,CAAC,CAAC;YAClD,SAAS,EAAE,MAAM,CAAC,UAAU;YAC5B,SAAS,EAAE,MAAM,CAAC,gBAAgB;YAClC,UAAU,EAAE,MAAM,CAAC,eAAe;SACnC,CAAC;KACH;IACD,KAAK,EAAE;QACL,OAAO,EAAE,OAAO;QAChB,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AAO,EAAE,OAAO,GAChB,CACG,CACR,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React from 'react';\nimport { ButtonProps } from '../../button/interfaces';\nimport { InternalButton } from '../../button/internal';\nimport InternalIcon from '../../icon/internal';\nimport { AppLayoutProps } from '../interfaces';\nimport { AppLayoutButtonProps } from './interfaces';\nimport styles from './styles.css.js';\n\nexport const togglesConfig = {\n navigation: {\n TagName: 'nav',\n iconName: 'menu',\n getLabels: (labels: AppLayoutProps.Labels = {}) => ({\n mainLabel: labels.navigation,\n openLabel: labels.navigationToggle,\n closeLabel: labels.navigationClose,\n }),\n },\n tools: {\n TagName: 'aside',\n iconName: 'status-info',\n getLabels: (labels: AppLayoutProps.Labels = {}) => ({\n mainLabel: labels.tools,\n openLabel: labels.toolsToggle,\n closeLabel: labels.toolsClose,\n }),\n },\n} as const;\n\nexport const ToggleButton = React.forwardRef(\n (\n { className, ariaLabel, ariaExpanded, iconName, iconSvg, disabled, testId, onClick }: AppLayoutButtonProps,\n ref: React.Ref<{ focus(): void }>\n ) => {\n return (\n <button\n ref={ref as React.Ref<HTMLButtonElement>}\n className={clsx(className, styles['toggle-button'])}\n aria-label={ariaLabel}\n type=\"button\"\n onClick={onClick}\n disabled={disabled}\n aria-expanded={ariaExpanded ? undefined : false}\n aria-haspopup={ariaExpanded ? undefined : true}\n data-testid={testId}\n >\n <InternalIcon svg={iconSvg} name={iconName} />\n </button>\n );\n }\n);\n\ninterface CloseButtonProps {\n className?: string;\n ariaLabel: string | undefined;\n onClick: () => void;\n}\n\nexport const CloseButton = React.forwardRef(\n ({ className, ariaLabel, onClick }: CloseButtonProps, ref: React.Ref<ButtonProps.Ref>) => {\n return (\n <span className={styles['close-button']}>\n <InternalButton\n ref={ref}\n className={className}\n ariaLabel={ariaLabel}\n variant=\"icon\"\n formAction=\"none\"\n iconName=\"close\"\n onClick={onClick}\n />\n </span>\n );\n }\n);\n"]}
|