@cloudscape-design/components-themeable 3.0.1228 → 3.0.1230
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/internal/manifest.json +1 -1
- package/lib/internal/scss/error-boundary/styles.scss +2 -1
- package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-ai-drawer.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-ai-drawer.js +52 -46
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-ai-drawer.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-bottom-drawer.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-bottom-drawer.js +66 -64
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-bottom-drawer.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-drawer.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-drawer.js +56 -54
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-drawer.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/index.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/index.js +3 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/index.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/internal.d.ts +5 -5
- package/lib/internal/template/app-layout/visual-refresh-toolbar/internal.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/state/index.d.ts +3 -2
- package/lib/internal/template/app-layout/visual-refresh-toolbar/state/index.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/state/index.js +6 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/state/index.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.js +54 -49
- package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/index.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/index.js +31 -26
- package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/index.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/after-main-slot.d.ts +3 -2
- package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/after-main-slot.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/after-main-slot.js +6 -2
- package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/after-main-slot.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/before-main-slot.d.ts +3 -2
- package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/before-main-slot.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/before-main-slot.js +6 -2
- package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/before-main-slot.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/bottom-content-slot.d.ts +3 -2
- package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/bottom-content-slot.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/bottom-content-slot.js +6 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/bottom-content-slot.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/top-content-slot.d.ts +3 -2
- package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/top-content-slot.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/top-content-slot.js +4 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/widget-areas/top-content-slot.js.map +1 -1
- package/lib/internal/template/date-range-picker/index.d.ts.map +1 -1
- package/lib/internal/template/date-range-picker/index.js +7 -4
- package/lib/internal/template/date-range-picker/index.js.map +1 -1
- package/lib/internal/template/date-range-picker/interfaces.d.ts +7 -0
- package/lib/internal/template/date-range-picker/interfaces.d.ts.map +1 -1
- package/lib/internal/template/date-range-picker/interfaces.js.map +1 -1
- package/lib/internal/template/error-boundary/interfaces.d.ts +3 -0
- package/lib/internal/template/error-boundary/interfaces.d.ts.map +1 -1
- package/lib/internal/template/error-boundary/interfaces.js.map +1 -1
- package/lib/internal/template/error-boundary/internal.d.ts +2 -1
- package/lib/internal/template/error-boundary/internal.d.ts.map +1 -1
- package/lib/internal/template/error-boundary/internal.js +11 -0
- package/lib/internal/template/error-boundary/internal.js.map +1 -1
- package/lib/internal/template/error-boundary/styles.css.js +5 -4
- package/lib/internal/template/error-boundary/styles.scoped.css +5 -4
- package/lib/internal/template/error-boundary/styles.selectors.js +5 -4
- package/lib/internal/template/internal/base-component/styles.scoped.css +1 -1
- package/lib/internal/template/internal/components/button-trigger/index.d.ts +0 -1
- package/lib/internal/template/internal/components/button-trigger/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/button-trigger/index.js +1 -2
- package/lib/internal/template/internal/components/button-trigger/index.js.map +1 -1
- package/lib/internal/template/internal/environment.js +2 -2
- package/lib/internal/template/internal/environment.json +2 -2
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@ import React, { useRef } from 'react';
|
|
|
4
4
|
import { Transition } from 'react-transition-group';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import ButtonGroup from '../../../button-group/internal';
|
|
7
|
+
import { AppLayoutBuiltInErrorBoundary } from '../../../error-boundary/internal';
|
|
7
8
|
import PanelResizeHandle from '../../../internal/components/panel-resize-handle';
|
|
8
9
|
import customCssProps from '../../../internal/generated/custom-css-properties';
|
|
9
10
|
import { usePrevious } from '../../../internal/hooks/use-previous';
|
|
@@ -73,60 +74,61 @@ function AppLayoutGlobalDrawerImplementation({ appLayoutInternals, show, activeG
|
|
|
73
74
|
...drawerActions,
|
|
74
75
|
];
|
|
75
76
|
}
|
|
76
|
-
return (React.createElement(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
activeGlobalDrawers.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
React.createElement("div", { className: styles['drawer-
|
|
110
|
-
React.createElement(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
77
|
+
return (React.createElement(AppLayoutBuiltInErrorBoundary, null,
|
|
78
|
+
React.createElement(Transition, { nodeRef: drawerRef, in: show || isExpanded, appear: show || isExpanded, timeout: 0 }, state => {
|
|
79
|
+
var _a, _b;
|
|
80
|
+
return (React.createElement("aside", { id: activeDrawerId, "aria-hidden": !show, "aria-label": computedAriaLabels.content, className: clsx(styles.drawer, styles['drawer-global'], styles[state], !animationDisabled && sharedStyles['with-motion-horizontal'], !animationDisabled && isExpanded && styles['with-expanded-motion'], {
|
|
81
|
+
[styles['drawer-hidden']]: !show,
|
|
82
|
+
[styles['last-opened']]: (!activeAiDrawer && lastOpenedDrawerId === activeDrawerId) || isExpanded,
|
|
83
|
+
[testutilStyles['active-drawer']]: show,
|
|
84
|
+
[styles['drawer-expanded']]: isExpanded,
|
|
85
|
+
[styles['has-next-siblings']]: activeGlobalDrawers.findIndex(drawer => drawer.id === activeDrawerId) + 1 <
|
|
86
|
+
activeGlobalDrawers.length,
|
|
87
|
+
}), ref: drawerRef, onBlur: e => {
|
|
88
|
+
// Drawers with trigger buttons follow this restore focus logic:
|
|
89
|
+
// If a previously focused element exists, restore focus on it; otherwise, focus on the associated trigger button.
|
|
90
|
+
// This function resets the previously focused element.
|
|
91
|
+
// If the drawer has no trigger button and loses focus on the previously focused element, it defaults to document.body,
|
|
92
|
+
// which ideally should never happen.
|
|
93
|
+
if (!hasTriggerButton) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
if (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget)) {
|
|
97
|
+
globalDrawersFocusControl.loseFocus();
|
|
98
|
+
}
|
|
99
|
+
}, style: {
|
|
100
|
+
blockSize: drawerHeight,
|
|
101
|
+
insetBlockStart: drawerTopOffset,
|
|
102
|
+
...(!isMobile && {
|
|
103
|
+
[customCssProps.drawerSize]: `${['entering', 'entered'].includes(state) ? (isExpanded ? '100%' : size + 'px') : 0}`,
|
|
104
|
+
}),
|
|
105
|
+
}, "data-testid": `awsui-app-layout-drawer-${activeDrawerId}` },
|
|
106
|
+
React.createElement("div", { className: clsx(styles['global-drawer-wrapper']) },
|
|
107
|
+
!isMobile && React.createElement("div", { className: styles['drawer-gap'] }),
|
|
108
|
+
!isMobile && (activeGlobalDrawer === null || activeGlobalDrawer === void 0 ? void 0 : activeGlobalDrawer.resizable) && !isExpanded && (React.createElement("div", { className: styles['drawer-slider'] },
|
|
109
|
+
React.createElement(PanelResizeHandle, { ref: refs === null || refs === void 0 ? void 0 : refs.slider, position: "side", className: testutilStyles['drawers-slider'], ariaLabel: (_a = activeGlobalDrawer === null || activeGlobalDrawer === void 0 ? void 0 : activeGlobalDrawer.ariaLabels) === null || _a === void 0 ? void 0 : _a.resizeHandle, tooltipText: (_b = activeGlobalDrawer === null || activeGlobalDrawer === void 0 ? void 0 : activeGlobalDrawer.ariaLabels) === null || _b === void 0 ? void 0 : _b.resizeHandleTooltipText, ariaValuenow: resizeProps.relativeSize, onKeyDown: resizeProps.onKeyDown, onDirectionClick: resizeProps.onDirectionClick, onPointerDown: resizeProps.onPointerDown }))),
|
|
110
|
+
React.createElement("div", { className: clsx(styles['drawer-content-container'], sharedStyles['with-motion-horizontal']), "data-testid": `awsui-app-layout-drawer-content-${activeDrawerId}` },
|
|
111
|
+
React.createElement("div", { className: styles['drawer-actions'] },
|
|
112
|
+
React.createElement(ButtonGroup, { dropdownExpandToViewport: false, variant: "icon", onItemClick: event => {
|
|
113
|
+
var _a;
|
|
114
|
+
switch (event.detail.id) {
|
|
115
|
+
case 'close':
|
|
116
|
+
onActiveGlobalDrawersChange(activeDrawerId, { initiatedByUserAction: true });
|
|
117
|
+
break;
|
|
118
|
+
case 'expand':
|
|
119
|
+
setExpandedDrawerId(isExpanded ? null : activeDrawerId);
|
|
120
|
+
break;
|
|
121
|
+
default:
|
|
122
|
+
(_a = activeGlobalDrawer === null || activeGlobalDrawer === void 0 ? void 0 : activeGlobalDrawer.onHeaderActionClick) === null || _a === void 0 ? void 0 : _a.call(activeGlobalDrawer, event);
|
|
123
|
+
}
|
|
124
|
+
}, ariaLabel: "Global panel actions", items: drawerActions, __internalRootRef: (root) => {
|
|
125
|
+
if (!root) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
refs.close = { current: root.querySelector('[data-itemid="close"]') };
|
|
129
|
+
} })),
|
|
130
|
+
React.createElement("div", { className: styles['drawer-content'], style: { blockSize: drawerHeight } }, activeGlobalDrawer === null || activeGlobalDrawer === void 0 ? void 0 : activeGlobalDrawer.content)))));
|
|
131
|
+
})));
|
|
130
132
|
}
|
|
131
133
|
export default AppLayoutGlobalDrawerImplementation;
|
|
132
134
|
//# sourceMappingURL=global-drawer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global-drawer.js","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/drawer/global-drawer.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,WAAW,MAAM,gCAAgC,CAAC;AACzD,OAAO,iBAAiB,MAAM,kDAAkD,CAAC;AACjF,OAAO,cAAc,MAAM,mDAAmD,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAExE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,YAAY,MAAM,4BAA4B,CAAC;AACtD,OAAO,cAAc,MAAM,kCAAkC,CAAC;AAC9D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAQrC,SAAS,mCAAmC,CAAC,EAC3C,kBAAkB,EAClB,IAAI,EACJ,kBAAkB,GACuB;;IACzC,MAAM,EACJ,UAAU,EACV,yBAAyB,EACzB,QAAQ,EACR,SAAS,EACT,2BAA2B,EAC3B,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,wBAAwB,EACxB,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,GACf,GAAG,kBAAkB,CAAC;IACvB,MAAM,SAAS,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAC/C,MAAM,cAAc,GAAG,MAAA,kBAAkB,aAAlB,kBAAkB,uBAAlB,kBAA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K,CAAC,CAAC;gCACrD,CAAC;4BACH,CAAC,EACD,SAAS,EAAC,sBAAsB,EAChC,KAAK,EAAE,aAAa,EACpB,iBAAiB,EAAE,CAAC,IAAiB,EAAE,EAAE;gCACvC,IAAI,CAAC,IAAI,EAAE,CAAC;oCACV,OAAO;gCACT,CAAC;gCACD,IAAI,CAAC,KAAK,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,uBAAuB,CAAyB,EAAE,CAAC;4BAChG,CAAC,GACD,CACE;oBACN,6BAAK,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,YAAY,EAAE,IACzE,kBAAkB,aAAlB,kBAAkB,uBAAlB,kBAAkB,CAAE,OAAO,CACxB,CACF,CACF,CACA,CACT,CAAC;IACJ,CAAC,CACU,CACd,CAAC;AACJ,CAAC;AAED,eAAe,mCAAmC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport { Transition } from 'react-transition-group';\nimport clsx from 'clsx';\n\nimport { InternalItemOrGroup } from '../../../button-group/interfaces';\nimport ButtonGroup from '../../../button-group/internal';\nimport PanelResizeHandle from '../../../internal/components/panel-resize-handle';\nimport customCssProps from '../../../internal/generated/custom-css-properties';\nimport { usePrevious } from '../../../internal/hooks/use-previous';\nimport { getLimitedValue } from '../../../split-panel/utils/size-utils';\nimport { Focusable } from '../../utils/use-focus-control';\nimport { getDrawerStyles } from '../compute-layout';\nimport { AppLayoutInternals, InternalDrawer } from '../interfaces';\nimport { useResize } from './use-resize';\n\nimport sharedStyles from '../../resize/styles.css.js';\nimport testutilStyles from '../../test-classes/styles.css.js';\nimport styles from './styles.css.js';\n\ninterface AppLayoutGlobalDrawerImplementationProps {\n appLayoutInternals: AppLayoutInternals;\n show: boolean;\n activeGlobalDrawer: InternalDrawer | undefined;\n}\n\nfunction AppLayoutGlobalDrawerImplementation({\n appLayoutInternals,\n show,\n activeGlobalDrawer,\n}: AppLayoutGlobalDrawerImplementationProps) {\n const {\n ariaLabels,\n globalDrawersFocusControl,\n isMobile,\n placement,\n onActiveGlobalDrawersChange,\n onActiveDrawerResize,\n minGlobalDrawersSizes,\n maxGlobalDrawersSizes,\n activeGlobalDrawersSizes,\n activeGlobalDrawers,\n verticalOffsets,\n drawersOpenQueue,\n expandedDrawerId,\n setExpandedDrawerId,\n activeAiDrawer,\n } = appLayoutInternals;\n const drawerRef = useRef<HTMLDivElement>(null);\n const activeDrawerId = activeGlobalDrawer?.id ?? '';\n\n const computedAriaLabels = {\n closeButton: activeGlobalDrawer ? activeGlobalDrawer.ariaLabels?.closeButton : ariaLabels?.toolsClose,\n content: activeGlobalDrawer ? activeGlobalDrawer.ariaLabels?.drawerName : ariaLabels?.tools,\n };\n\n const { drawerTopOffset, drawerHeight } = getDrawerStyles(verticalOffsets, isMobile, placement);\n const activeDrawerSize = (activeDrawerId ? activeGlobalDrawersSizes[activeDrawerId] : 0) ?? 0;\n const minDrawerSize = (activeDrawerId ? minGlobalDrawersSizes[activeDrawerId] : 0) ?? 0;\n const maxDrawerSize = (activeDrawerId ? maxGlobalDrawersSizes[activeDrawerId] : 0) ?? 0;\n const refs = globalDrawersFocusControl.refs[activeDrawerId];\n const resizeProps = useResize({\n currentWidth: activeDrawerSize,\n minWidth: minDrawerSize,\n maxWidth: maxDrawerSize,\n panelRef: drawerRef,\n handleRef: refs?.slider,\n onResize: size => onActiveDrawerResize({ id: activeDrawerId!, size }),\n });\n const size = getLimitedValue(minDrawerSize, activeDrawerSize, maxDrawerSize);\n const lastOpenedDrawerId = drawersOpenQueue.length ? drawersOpenQueue[0] : null;\n const hasTriggerButton = !!activeGlobalDrawer?.trigger;\n const isExpanded = activeGlobalDrawer?.isExpandable && expandedDrawerId === activeDrawerId;\n const wasExpanded = usePrevious(isExpanded);\n const animationDisabled =\n (activeGlobalDrawer?.defaultActive && !drawersOpenQueue.includes(activeGlobalDrawer.id)) ||\n (wasExpanded && !isExpanded);\n let drawerActions: ReadonlyArray<InternalItemOrGroup> = [\n {\n type: 'icon-button',\n id: 'close',\n iconName: isMobile ? 'close' : 'angle-right',\n text: computedAriaLabels.closeButton ?? '',\n analyticsAction: 'close',\n },\n ];\n if (!isMobile && activeGlobalDrawer?.isExpandable) {\n drawerActions = [\n {\n type: 'icon-button',\n id: 'expand',\n iconName: isExpanded ? 'shrink' : 'expand',\n text: activeGlobalDrawer?.ariaLabels?.expandedModeButton ?? '',\n analyticsAction: isExpanded ? 'expand' : 'collapse',\n },\n ...drawerActions,\n ];\n }\n if (activeGlobalDrawer?.headerActions) {\n drawerActions = [\n {\n type: 'group',\n text: 'Actions',\n items: activeGlobalDrawer.headerActions!,\n },\n ...drawerActions,\n ];\n }\n\n return (\n <Transition nodeRef={drawerRef} in={show || isExpanded} appear={show || isExpanded} timeout={0}>\n {state => {\n return (\n <aside\n id={activeDrawerId}\n aria-hidden={!show}\n aria-label={computedAriaLabels.content}\n className={clsx(\n styles.drawer,\n styles['drawer-global'],\n styles[state],\n !animationDisabled && sharedStyles['with-motion-horizontal'],\n !animationDisabled && isExpanded && styles['with-expanded-motion'],\n {\n [styles['drawer-hidden']]: !show,\n [styles['last-opened']]: (!activeAiDrawer && lastOpenedDrawerId === activeDrawerId) || isExpanded,\n [testutilStyles['active-drawer']]: show,\n [styles['drawer-expanded']]: isExpanded,\n [styles['has-next-siblings']]:\n activeGlobalDrawers.findIndex(drawer => drawer.id === activeDrawerId) + 1 <\n activeGlobalDrawers.length,\n }\n )}\n ref={drawerRef}\n onBlur={e => {\n // Drawers with trigger buttons follow this restore focus logic:\n // If a previously focused element exists, restore focus on it; otherwise, focus on the associated trigger button.\n // This function resets the previously focused element.\n // If the drawer has no trigger button and loses focus on the previously focused element, it defaults to document.body,\n // which ideally should never happen.\n if (!hasTriggerButton) {\n return;\n }\n\n if (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget)) {\n globalDrawersFocusControl.loseFocus();\n }\n }}\n style={{\n blockSize: drawerHeight,\n insetBlockStart: drawerTopOffset,\n ...(!isMobile && {\n [customCssProps.drawerSize]: `${['entering', 'entered'].includes(state) ? (isExpanded ? '100%' : size + 'px') : 0}`,\n }),\n }}\n data-testid={`awsui-app-layout-drawer-${activeDrawerId}`}\n >\n <div className={clsx(styles['global-drawer-wrapper'])}>\n {!isMobile && <div className={styles['drawer-gap']}></div>}\n {!isMobile && activeGlobalDrawer?.resizable && !isExpanded && (\n <div className={styles['drawer-slider']}>\n <PanelResizeHandle\n ref={refs?.slider}\n position=\"side\"\n className={testutilStyles['drawers-slider']}\n ariaLabel={activeGlobalDrawer?.ariaLabels?.resizeHandle}\n tooltipText={activeGlobalDrawer?.ariaLabels?.resizeHandleTooltipText}\n ariaValuenow={resizeProps.relativeSize}\n onKeyDown={resizeProps.onKeyDown}\n onDirectionClick={resizeProps.onDirectionClick}\n onPointerDown={resizeProps.onPointerDown}\n />\n </div>\n )}\n\n <div\n className={clsx(styles['drawer-content-container'], sharedStyles['with-motion-horizontal'])}\n data-testid={`awsui-app-layout-drawer-content-${activeDrawerId}`}\n >\n <div className={styles['drawer-actions']}>\n <ButtonGroup\n dropdownExpandToViewport={false}\n variant=\"icon\"\n onItemClick={event => {\n switch (event.detail.id) {\n case 'close':\n onActiveGlobalDrawersChange(activeDrawerId, { initiatedByUserAction: true });\n break;\n case 'expand':\n setExpandedDrawerId(isExpanded ? null : activeDrawerId);\n break;\n default:\n activeGlobalDrawer?.onHeaderActionClick?.(event);\n }\n }}\n ariaLabel=\"Global panel actions\"\n items={drawerActions}\n __internalRootRef={(root: HTMLElement) => {\n if (!root) {\n return;\n }\n refs.close = { current: root.querySelector('[data-itemid=\"close\"]') as unknown as Focusable };\n }}\n />\n </div>\n <div className={styles['drawer-content']} style={{ blockSize: drawerHeight }}>\n {activeGlobalDrawer?.content}\n </div>\n </div>\n </div>\n </aside>\n );\n }}\n </Transition>\n );\n}\n\nexport default AppLayoutGlobalDrawerImplementation;\n"]}
|
|
1
|
+
{"version":3,"file":"global-drawer.js","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/drawer/global-drawer.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,WAAW,MAAM,gCAAgC,CAAC;AACzD,OAAO,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,iBAAiB,MAAM,kDAAkD,CAAC;AACjF,OAAO,cAAc,MAAM,mDAAmD,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAExE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,YAAY,MAAM,4BAA4B,CAAC;AACtD,OAAO,cAAc,MAAM,kCAAkC,CAAC;AAC9D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAQrC,SAAS,mCAAmC,CAAC,EAC3C,kBAAkB,EAClB,IAAI,EACJ,kBAAkB,GACuB;;IACzC,MAAM,EACJ,UAAU,EACV,yBAAyB,EACzB,QAAQ,EACR,SAAS,EACT,2BAA2B,EAC3B,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,wBAAwB,EACxB,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,GACf,GAAG,kBAAkB,CAAC;IACvB,MAAM,SAAS,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAC/C,MAAM,cAAc,GAAG,MAAA,kBAAkB,aAAlB,kBAAkB,u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AAlB,kBAAkB,CAAE,mBAAmB,mEAAG,KAAK,CAAC,CAAC;oCACrD,CAAC;gCACH,CAAC,EACD,SAAS,EAAC,sBAAsB,EAChC,KAAK,EAAE,aAAa,EACpB,iBAAiB,EAAE,CAAC,IAAiB,EAAE,EAAE;oCACvC,IAAI,CAAC,IAAI,EAAE,CAAC;wCACV,OAAO;oCACT,CAAC;oCACD,IAAI,CAAC,KAAK,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,uBAAuB,CAAyB,EAAE,CAAC;gCAChG,CAAC,GACD,CACE;wBACN,6BAAK,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,YAAY,EAAE,IACzE,kBAAkB,aAAlB,kBAAkB,uBAAlB,kBAAkB,CAAE,OAAO,CACxB,CACF,CACF,CACA,CACT,CAAC;QACJ,CAAC,CACU,CACiB,CACjC,CAAC;AACJ,CAAC;AAED,eAAe,mCAAmC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport { Transition } from 'react-transition-group';\nimport clsx from 'clsx';\n\nimport { InternalItemOrGroup } from '../../../button-group/interfaces';\nimport ButtonGroup from '../../../button-group/internal';\nimport { AppLayoutBuiltInErrorBoundary } from '../../../error-boundary/internal';\nimport PanelResizeHandle from '../../../internal/components/panel-resize-handle';\nimport customCssProps from '../../../internal/generated/custom-css-properties';\nimport { usePrevious } from '../../../internal/hooks/use-previous';\nimport { getLimitedValue } from '../../../split-panel/utils/size-utils';\nimport { Focusable } from '../../utils/use-focus-control';\nimport { getDrawerStyles } from '../compute-layout';\nimport { AppLayoutInternals, InternalDrawer } from '../interfaces';\nimport { useResize } from './use-resize';\n\nimport sharedStyles from '../../resize/styles.css.js';\nimport testutilStyles from '../../test-classes/styles.css.js';\nimport styles from './styles.css.js';\n\ninterface AppLayoutGlobalDrawerImplementationProps {\n appLayoutInternals: AppLayoutInternals;\n show: boolean;\n activeGlobalDrawer: InternalDrawer | undefined;\n}\n\nfunction AppLayoutGlobalDrawerImplementation({\n appLayoutInternals,\n show,\n activeGlobalDrawer,\n}: AppLayoutGlobalDrawerImplementationProps) {\n const {\n ariaLabels,\n globalDrawersFocusControl,\n isMobile,\n placement,\n onActiveGlobalDrawersChange,\n onActiveDrawerResize,\n minGlobalDrawersSizes,\n maxGlobalDrawersSizes,\n activeGlobalDrawersSizes,\n activeGlobalDrawers,\n verticalOffsets,\n drawersOpenQueue,\n expandedDrawerId,\n setExpandedDrawerId,\n activeAiDrawer,\n } = appLayoutInternals;\n const drawerRef = useRef<HTMLDivElement>(null);\n const activeDrawerId = activeGlobalDrawer?.id ?? '';\n\n const computedAriaLabels = {\n closeButton: activeGlobalDrawer ? activeGlobalDrawer.ariaLabels?.closeButton : ariaLabels?.toolsClose,\n content: activeGlobalDrawer ? activeGlobalDrawer.ariaLabels?.drawerName : ariaLabels?.tools,\n };\n\n const { drawerTopOffset, drawerHeight } = getDrawerStyles(verticalOffsets, isMobile, placement);\n const activeDrawerSize = (activeDrawerId ? activeGlobalDrawersSizes[activeDrawerId] : 0) ?? 0;\n const minDrawerSize = (activeDrawerId ? minGlobalDrawersSizes[activeDrawerId] : 0) ?? 0;\n const maxDrawerSize = (activeDrawerId ? maxGlobalDrawersSizes[activeDrawerId] : 0) ?? 0;\n const refs = globalDrawersFocusControl.refs[activeDrawerId];\n const resizeProps = useResize({\n currentWidth: activeDrawerSize,\n minWidth: minDrawerSize,\n maxWidth: maxDrawerSize,\n panelRef: drawerRef,\n handleRef: refs?.slider,\n onResize: size => onActiveDrawerResize({ id: activeDrawerId!, size }),\n });\n const size = getLimitedValue(minDrawerSize, activeDrawerSize, maxDrawerSize);\n const lastOpenedDrawerId = drawersOpenQueue.length ? drawersOpenQueue[0] : null;\n const hasTriggerButton = !!activeGlobalDrawer?.trigger;\n const isExpanded = activeGlobalDrawer?.isExpandable && expandedDrawerId === activeDrawerId;\n const wasExpanded = usePrevious(isExpanded);\n const animationDisabled =\n (activeGlobalDrawer?.defaultActive && !drawersOpenQueue.includes(activeGlobalDrawer.id)) ||\n (wasExpanded && !isExpanded);\n let drawerActions: ReadonlyArray<InternalItemOrGroup> = [\n {\n type: 'icon-button',\n id: 'close',\n iconName: isMobile ? 'close' : 'angle-right',\n text: computedAriaLabels.closeButton ?? '',\n analyticsAction: 'close',\n },\n ];\n if (!isMobile && activeGlobalDrawer?.isExpandable) {\n drawerActions = [\n {\n type: 'icon-button',\n id: 'expand',\n iconName: isExpanded ? 'shrink' : 'expand',\n text: activeGlobalDrawer?.ariaLabels?.expandedModeButton ?? '',\n analyticsAction: isExpanded ? 'expand' : 'collapse',\n },\n ...drawerActions,\n ];\n }\n if (activeGlobalDrawer?.headerActions) {\n drawerActions = [\n {\n type: 'group',\n text: 'Actions',\n items: activeGlobalDrawer.headerActions!,\n },\n ...drawerActions,\n ];\n }\n\n return (\n <AppLayoutBuiltInErrorBoundary>\n <Transition nodeRef={drawerRef} in={show || isExpanded} appear={show || isExpanded} timeout={0}>\n {state => {\n return (\n <aside\n id={activeDrawerId}\n aria-hidden={!show}\n aria-label={computedAriaLabels.content}\n className={clsx(\n styles.drawer,\n styles['drawer-global'],\n styles[state],\n !animationDisabled && sharedStyles['with-motion-horizontal'],\n !animationDisabled && isExpanded && styles['with-expanded-motion'],\n {\n [styles['drawer-hidden']]: !show,\n [styles['last-opened']]: (!activeAiDrawer && lastOpenedDrawerId === activeDrawerId) || isExpanded,\n [testutilStyles['active-drawer']]: show,\n [styles['drawer-expanded']]: isExpanded,\n [styles['has-next-siblings']]:\n activeGlobalDrawers.findIndex(drawer => drawer.id === activeDrawerId) + 1 <\n activeGlobalDrawers.length,\n }\n )}\n ref={drawerRef}\n onBlur={e => {\n // Drawers with trigger buttons follow this restore focus logic:\n // If a previously focused element exists, restore focus on it; otherwise, focus on the associated trigger button.\n // This function resets the previously focused element.\n // If the drawer has no trigger button and loses focus on the previously focused element, it defaults to document.body,\n // which ideally should never happen.\n if (!hasTriggerButton) {\n return;\n }\n\n if (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget)) {\n globalDrawersFocusControl.loseFocus();\n }\n }}\n style={{\n blockSize: drawerHeight,\n insetBlockStart: drawerTopOffset,\n ...(!isMobile && {\n [customCssProps.drawerSize]: `${['entering', 'entered'].includes(state) ? (isExpanded ? '100%' : size + 'px') : 0}`,\n }),\n }}\n data-testid={`awsui-app-layout-drawer-${activeDrawerId}`}\n >\n <div className={clsx(styles['global-drawer-wrapper'])}>\n {!isMobile && <div className={styles['drawer-gap']}></div>}\n {!isMobile && activeGlobalDrawer?.resizable && !isExpanded && (\n <div className={styles['drawer-slider']}>\n <PanelResizeHandle\n ref={refs?.slider}\n position=\"side\"\n className={testutilStyles['drawers-slider']}\n ariaLabel={activeGlobalDrawer?.ariaLabels?.resizeHandle}\n tooltipText={activeGlobalDrawer?.ariaLabels?.resizeHandleTooltipText}\n ariaValuenow={resizeProps.relativeSize}\n onKeyDown={resizeProps.onKeyDown}\n onDirectionClick={resizeProps.onDirectionClick}\n onPointerDown={resizeProps.onPointerDown}\n />\n </div>\n )}\n\n <div\n className={clsx(styles['drawer-content-container'], sharedStyles['with-motion-horizontal'])}\n data-testid={`awsui-app-layout-drawer-content-${activeDrawerId}`}\n >\n <div className={styles['drawer-actions']}>\n <ButtonGroup\n dropdownExpandToViewport={false}\n variant=\"icon\"\n onItemClick={event => {\n switch (event.detail.id) {\n case 'close':\n onActiveGlobalDrawersChange(activeDrawerId, { initiatedByUserAction: true });\n break;\n case 'expand':\n setExpandedDrawerId(isExpanded ? null : activeDrawerId);\n break;\n default:\n activeGlobalDrawer?.onHeaderActionClick?.(event);\n }\n }}\n ariaLabel=\"Global panel actions\"\n items={drawerActions}\n __internalRootRef={(root: HTMLElement) => {\n if (!root) {\n return;\n }\n refs.close = { current: root.querySelector('[data-itemid=\"close\"]') as unknown as Focusable };\n }}\n />\n </div>\n <div className={styles['drawer-content']} style={{ blockSize: drawerHeight }}>\n {activeGlobalDrawer?.content}\n </div>\n </div>\n </div>\n </aside>\n );\n }}\n </Transition>\n </AppLayoutBuiltInErrorBoundary>\n );\n}\n\nexport default AppLayoutGlobalDrawerImplementation;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh-toolbar/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAuD,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh-toolbar/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAK5E,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAE,sBAAsB,EAAyB,MAAM,cAAc,CAAC;AAsD7E,QAAA,MAAM,6BAA6B,mGAkClC,CAAC;AAEF,eAAe,6BAA6B,CAAC"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import React, { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
4
4
|
import { unstable_batchedUpdates } from 'react-dom';
|
|
5
|
+
import { AppLayoutBuiltInErrorBoundary } from '../../error-boundary/internal';
|
|
5
6
|
import ScreenreaderOnly from '../../internal/components/screenreader-only';
|
|
6
7
|
import { AppLayoutVisibilityContext } from './contexts';
|
|
7
8
|
import { AppLayoutWidgetizedState } from './internal';
|
|
@@ -38,7 +39,8 @@ const AppLayoutVisualRefreshToolbar = React.forwardRef((props, forwardRef) => {
|
|
|
38
39
|
const { __forceDeduplicationType: forceDeduplicationType, __embeddedViewMode: embeddedViewMode } = props;
|
|
39
40
|
return (React.createElement(React.Fragment, null,
|
|
40
41
|
React.createElement(AppLayoutStateProvider, { forceDeduplicationType: forceDeduplicationType, appLayoutProps: props, stateManager: stateManager }, (registered, appLayoutState, toolbarProps, skeletonAttributes) => (React.createElement(AppLayoutVisibilityContext.Provider, { value: appLayoutState.isIntersecting },
|
|
41
|
-
(embeddedViewMode || !toolbarProps) && props.breadcrumbs ? (React.createElement(
|
|
42
|
+
(embeddedViewMode || !toolbarProps) && props.breadcrumbs ? (React.createElement(AppLayoutBuiltInErrorBoundary, null,
|
|
43
|
+
React.createElement(ScreenreaderOnly, null, props.breadcrumbs))) : null,
|
|
42
44
|
React.createElement(SkeletonLayout, { registered: registered, toolbarProps: toolbarProps, appLayoutProps: props, appLayoutState: appLayoutState, skeletonSlotsAttributes: skeletonAttributes })))),
|
|
43
45
|
React.createElement(AppLayoutWidgetizedState, { forwardRef: forwardRef, appLayoutProps: props, stateManager: stateManager })));
|
|
44
46
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh-toolbar/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAEpD,OAAO,gBAAgB,MAAM,6CAA6C,CAAC;AAE3E,OAAO,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAExD,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAqB,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG/E,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGnE,MAAM,sBAAsB,GAUvB,CAAC,EAAE,sBAAsB,EAAE,cAAc,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC1E,MAAM,CAAC,cAAc,EAAE,iBAAiB,C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YAAY,CAAC,IAAI,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAC1D,oBAAC,6BAA6B;gBAC5B,oBAAC,gBAAgB,QAAE,KAAK,CAAC,WAAW,CAAoB,CAC1B,CACjC,CAAC,CAAC,CAAC,IAAI;YACR,oBAAC,cAAc,IACb,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,EAC1B,cAAc,EAAE,KAAK,EACrB,cAAc,EAAE,cAAc,EAC9B,uBAAuB,EAAE,kBAAkB,GAC3C,CACkC,CACvC,CACsB;QACzB,oBAAC,wBAAwB,IAAC,UAAU,EAAE,UAAU,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,EAAE,YAAY,GAAI,CACtG,CACJ,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,6BAA6B,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useLayoutEffect, useRef, useState } from 'react';\nimport { unstable_batchedUpdates } from 'react-dom';\n\nimport { AppLayoutBuiltInErrorBoundary } from '../../error-boundary/internal';\nimport ScreenreaderOnly from '../../internal/components/screenreader-only';\nimport { AppLayoutProps } from '../interfaces';\nimport { AppLayoutVisibilityContext } from './contexts';\nimport { AppLayoutInternalProps, AppLayoutPendingState } from './interfaces';\nimport { AppLayoutWidgetizedState } from './internal';\nimport { SkeletonLayout } from './skeleton';\nimport { SkeletonSlotsAttributes } from './skeleton/interfaces';\nimport { DeduplicationType, useMultiAppLayout } from './skeleton/multi-layout';\nimport { StateManager } from './state';\nimport { SharedProps } from './state/interfaces';\nimport { getPropsToMerge, mergeProps } from './state/props-merger';\nimport { ToolbarProps } from './toolbar';\n\nconst AppLayoutStateProvider: React.FC<{\n forceDeduplicationType: DeduplicationType;\n appLayoutProps: AppLayoutInternalProps;\n stateManager: React.MutableRefObject<StateManager>;\n children: (\n registered: boolean,\n appLayoutState: AppLayoutPendingState,\n toolbarProps: ToolbarProps | null,\n skeletonAttributes: SkeletonSlotsAttributes\n ) => React.ReactNode;\n}> = ({ forceDeduplicationType, appLayoutProps, stateManager, children }) => {\n const [appLayoutState, setAppLayoutState] = useState<AppLayoutPendingState>({ isIntersecting: true });\n const [skeletonAttributes, setSkeletonAttributes] = useState<SkeletonSlotsAttributes>({});\n // use { fn: } object wrapper to avoid confusion with callback form of setState\n const [deduplicator, setDeduplicator] = useState({ fn: mergeProps });\n const [deduplicationProps, setDeduplicationProps] = useState<SharedProps | undefined>(undefined);\n\n const { registered, toolbarProps } = useMultiAppLayout(\n forceDeduplicationType,\n appLayoutState.isIntersecting,\n deduplicationProps ?? getPropsToMerge(appLayoutProps, appLayoutState),\n deduplicator.fn\n );\n\n useLayoutEffect(() => {\n stateManager.current.setState = (appLayoutState, skeletonAttributes, deduplicationProps, mergeProps) => {\n unstable_batchedUpdates(() => {\n setAppLayoutState(appLayoutState);\n setSkeletonAttributes(skeletonAttributes);\n setDeduplicationProps(deduplicationProps);\n setDeduplicator({ fn: mergeProps });\n });\n };\n }, [stateManager]);\n\n const hasToolbar = !!toolbarProps;\n useEffect(() => {\n stateManager.current.hasToolbar = hasToolbar;\n stateManager.current.setToolbar?.(hasToolbar);\n }, [stateManager, hasToolbar]);\n\n return <>{children(registered, appLayoutState, toolbarProps, skeletonAttributes)}</>;\n};\n\nconst AppLayoutVisualRefreshToolbar = React.forwardRef<AppLayoutProps.Ref, AppLayoutInternalProps>(\n (props, forwardRef) => {\n const stateManager = useRef<StateManager>({ setState: undefined, hasToolbar: false, setToolbar: undefined });\n const { __forceDeduplicationType: forceDeduplicationType, __embeddedViewMode: embeddedViewMode } = props as any;\n\n return (\n <>\n <AppLayoutStateProvider\n forceDeduplicationType={forceDeduplicationType}\n appLayoutProps={props}\n stateManager={stateManager}\n >\n {(registered, appLayoutState, toolbarProps, skeletonAttributes) => (\n <AppLayoutVisibilityContext.Provider value={appLayoutState.isIntersecting}>\n {/* Rendering a hidden copy of breadcrumbs to trigger their deduplication */}\n {(embeddedViewMode || !toolbarProps) && props.breadcrumbs ? (\n <AppLayoutBuiltInErrorBoundary>\n <ScreenreaderOnly>{props.breadcrumbs}</ScreenreaderOnly>\n </AppLayoutBuiltInErrorBoundary>\n ) : null}\n <SkeletonLayout\n registered={registered}\n toolbarProps={toolbarProps}\n appLayoutProps={props}\n appLayoutState={appLayoutState}\n skeletonSlotsAttributes={skeletonAttributes}\n />\n </AppLayoutVisibilityContext.Provider>\n )}\n </AppLayoutStateProvider>\n <AppLayoutWidgetizedState forwardRef={forwardRef} appLayoutProps={props} stateManager={stateManager} />\n </>\n );\n }\n);\n\nexport default AppLayoutVisualRefreshToolbar;\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export declare const AppLayoutBeforeMainSlot: (
|
|
2
|
-
export declare const AppLayoutAfterMainSlot: (
|
|
3
|
-
export declare const AppLayoutTopContentSlot: (
|
|
4
|
-
export declare const AppLayoutBottomContentSlot: (
|
|
5
|
-
export declare const AppLayoutWidgetizedState: (
|
|
1
|
+
export declare const AppLayoutBeforeMainSlot: (props: import("./skeleton/interfaces").SkeletonPartProps) => JSX.Element;
|
|
2
|
+
export declare const AppLayoutAfterMainSlot: (props: import("./skeleton/interfaces").SkeletonPartProps) => JSX.Element;
|
|
3
|
+
export declare const AppLayoutTopContentSlot: (props: import("./skeleton/interfaces").SkeletonPartProps) => JSX.Element;
|
|
4
|
+
export declare const AppLayoutBottomContentSlot: (props: import("./skeleton/interfaces").SkeletonPartProps) => JSX.Element;
|
|
5
|
+
export declare const AppLayoutWidgetizedState: (props: import("./state").AppLayoutStateProps) => JSX.Element;
|
|
6
6
|
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh-toolbar/internal.tsx"],"names":[],"mappings":"AAaA,eAAO,MAAM,uBAAuB,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh-toolbar/internal.tsx"],"names":[],"mappings":"AAaA,eAAO,MAAM,uBAAuB,2EAEnC,CAAC;AACF,eAAO,MAAM,sBAAsB,2EAElC,CAAC;AACF,eAAO,MAAM,uBAAuB,2EAEnC,CAAC;AACF,eAAO,MAAM,0BAA0B,2EAEtC,CAAC;AACF,eAAO,MAAM,wBAAwB,+DAEpC,CAAC"}
|
|
@@ -13,6 +13,7 @@ export interface AppLayoutStateProps {
|
|
|
13
13
|
stateManager: React.MutableRefObject<StateManager>;
|
|
14
14
|
forwardRef: ForwardedRef<AppLayoutProps.Ref>;
|
|
15
15
|
}
|
|
16
|
-
export declare const
|
|
17
|
-
export declare const
|
|
16
|
+
export declare const AppLayoutStateProviderInternal: ({ appLayoutProps, stateManager, forwardRef }: AppLayoutStateProps) => JSX.Element;
|
|
17
|
+
export declare const AppLayoutStateProvider: (props: AppLayoutStateProps) => JSX.Element;
|
|
18
|
+
export declare const createWidgetizedAppLayoutState: (Loader?: ((props: AppLayoutStateProps) => JSX.Element) | undefined) => (props: AppLayoutStateProps) => JSX.Element;
|
|
18
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/state/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,YAAY,EAA6B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/state/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,YAAY,EAA6B,MAAM,OAAO,CAAC;AAIvE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAKvD,MAAM,WAAW,YAAY;IAC3B,QAAQ,EACJ,CAAC,CACC,cAAc,EAAE,cAAc,EAC9B,kBAAkB,EAAE,uBAAuB,EAC3C,kBAAkB,EAAE,WAAW,EAC/B,UAAU,EAAE,UAAU,KACnB,IAAI,CAAC,GACV,SAAS,CAAC;IACd,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,CAAC,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;CACzD;AAED,MAAM,WAAW,mBAAmB;IAClC,cAAc,EAAE,sBAAsB,CAAC;IACvC,YAAY,EAAE,KAAK,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;IACnD,UAAU,EAAE,YAAY,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;CAC9C;AAED,eAAO,MAAM,8BAA8B,GAAI,8CAA8C,mBAAmB,gBAuB/G,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,OAAO,mBAAmB,gBAMhE,CAAC;AAEF,eAAO,MAAM,8BAA8B,qBARG,mBAAmB,0CAAnB,mBAAmB,gBAQ8B,CAAC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import React, { useLayoutEffect, useState } from 'react';
|
|
4
|
+
import { AppLayoutBuiltInErrorBoundary } from '../../../error-boundary/internal';
|
|
4
5
|
import { createWidgetizedComponent } from '../../../internal/widgets';
|
|
5
6
|
import { getPropsToMerge, mergeProps } from './props-merger';
|
|
6
7
|
import { useAppLayout } from './use-app-layout';
|
|
7
8
|
import { useSkeletonSlotsAttributes } from './use-skeleton-slots-attributes';
|
|
8
|
-
export const
|
|
9
|
+
export const AppLayoutStateProviderInternal = ({ appLayoutProps, stateManager, forwardRef }) => {
|
|
9
10
|
var _a;
|
|
10
11
|
const [hasToolbar, setHasToolbar] = useState((_a = stateManager.current.hasToolbar) !== null && _a !== void 0 ? _a : false);
|
|
11
12
|
const appLayoutState = useAppLayout(hasToolbar, appLayoutProps, forwardRef);
|
|
@@ -23,5 +24,9 @@ export const AppLayoutStateProvider = ({ appLayoutProps, stateManager, forwardRe
|
|
|
23
24
|
}, [stateManager]);
|
|
24
25
|
return React.createElement(React.Fragment, null);
|
|
25
26
|
};
|
|
27
|
+
export const AppLayoutStateProvider = (props) => {
|
|
28
|
+
return (React.createElement(AppLayoutBuiltInErrorBoundary, null,
|
|
29
|
+
React.createElement(AppLayoutStateProviderInternal, { ...props })));
|
|
30
|
+
};
|
|
26
31
|
export const createWidgetizedAppLayoutState = createWidgetizedComponent(AppLayoutStateProvider);
|
|
27
32
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/state/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAgB,eAAe,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEvE,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAKtE,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAqB7E,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/state/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAgB,eAAe,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEvE,OAAO,EAAE,6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O,CACL,oBAAC,6BAA6B;QAC5B,oBAAC,8BAA8B,OAAK,KAAK,GAAI,CACf,CACjC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,8BAA8B,GAAG,yBAAyB,CAAC,sBAAsB,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { ForwardedRef, useLayoutEffect, useState } from 'react';\n\nimport { AppLayoutBuiltInErrorBoundary } from '../../../error-boundary/internal';\nimport { createWidgetizedComponent } from '../../../internal/widgets';\nimport { AppLayoutProps } from '../../interfaces';\nimport { AppLayoutInternalProps, AppLayoutState } from '../interfaces';\nimport { SkeletonSlotsAttributes } from '../skeleton/interfaces';\nimport { MergeProps, SharedProps } from './interfaces';\nimport { getPropsToMerge, mergeProps } from './props-merger';\nimport { useAppLayout } from './use-app-layout';\nimport { useSkeletonSlotsAttributes } from './use-skeleton-slots-attributes';\n\nexport interface StateManager {\n setState:\n | ((\n appLayoutState: AppLayoutState,\n skeletonAttributes: SkeletonSlotsAttributes,\n deduplicationProps: SharedProps,\n mergeProps: MergeProps\n ) => void)\n | undefined;\n hasToolbar: boolean;\n setToolbar: ((hasToolbar: boolean) => void) | undefined;\n}\n\nexport interface AppLayoutStateProps {\n appLayoutProps: AppLayoutInternalProps;\n stateManager: React.MutableRefObject<StateManager>;\n forwardRef: ForwardedRef<AppLayoutProps.Ref>;\n}\n\nexport const AppLayoutStateProviderInternal = ({ appLayoutProps, stateManager, forwardRef }: AppLayoutStateProps) => {\n const [hasToolbar, setHasToolbar] = useState(stateManager.current.hasToolbar ?? false);\n const appLayoutState = useAppLayout(hasToolbar, appLayoutProps, forwardRef);\n const skeletonSlotsAttributes = useSkeletonSlotsAttributes(hasToolbar, appLayoutProps, appLayoutState);\n\n useLayoutEffect(() => {\n if (!stateManager.current?.setState) {\n console.warn('AppLayout state manager is not found');\n return;\n }\n stateManager.current.setState(\n appLayoutState,\n skeletonSlotsAttributes,\n getPropsToMerge(appLayoutProps, appLayoutState),\n mergeProps\n );\n });\n\n useLayoutEffect(() => {\n stateManager.current.setToolbar = setHasToolbar;\n }, [stateManager]);\n\n return <></>;\n};\n\nexport const AppLayoutStateProvider = (props: AppLayoutStateProps) => {\n return (\n <AppLayoutBuiltInErrorBoundary>\n <AppLayoutStateProviderInternal {...props} />\n </AppLayoutBuiltInErrorBoundary>\n );\n};\n\nexport const createWidgetizedAppLayoutState = createWidgetizedComponent(AppLayoutStateProvider);\n"]}
|
package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer-triggers.d.ts","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"drawer-triggers.d.ts","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAStC,OAAO,EAAE,cAAc,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAmB,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAO/E,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,OAAO,GAAG,SAAS,CAAC;IAC/B,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,MAAM,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5B,QAAQ,E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CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;IACrD,kBAAkB,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IAC7C,QAAQ,EAAE,OAAO,CAAC;IAElB,yBAAyB,CAAC,EAAE,yBAAyB,CAAC;CACvD;AAED,wBAAgB,cAAc,CAAC,EAC7B,UAAU,EACV,cAAc,EACd,OAAO,EACP,eAAe,EACf,oBAAoB,EACpB,cAAc,EACd,kBAA6B,EAC7B,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,EAClB,QAAQ,EACR,sBAAsB,EACtB,aAAa,EACb,yBAAyB,EACzB,2BAA2B,EAC3B,gBAAgB,EAChB,mBAAmB,EACnB,0BAA0B,EAC1B,gCAAgC,EAChC,qBAAqB,EACrB,aAAa,EACb,yBAAyB,GAC1B,EAAE,mBAAmB,sBAyQrB"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import React, { useRef } from 'react';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { useContainerQuery } from '@cloudscape-design/component-toolkit';
|
|
6
|
+
import { AppLayoutBuiltInErrorBoundary } from '../../../error-boundary/internal';
|
|
6
7
|
import { useMobile } from '../../../internal/hooks/use-mobile';
|
|
7
8
|
import { splitItems } from '../../drawer/drawers-helpers';
|
|
8
9
|
import OverflowMenu from '../../drawer/overflow-menu';
|
|
@@ -77,17 +78,18 @@ export function DrawerTriggers({ ariaLabels, activeDrawerId, drawers, drawersFoc
|
|
|
77
78
|
const isForPreviousActiveDrawer = (previousActiveLocalDrawerId === null || previousActiveLocalDrawerId === void 0 ? void 0 : previousActiveLocalDrawerId.current) === item.id;
|
|
78
79
|
const selected = !expandedDrawerId && item.id === activeDrawerId;
|
|
79
80
|
const isFeatureNotificationsDrawer = ((_a = featureNotificationsProps === null || featureNotificationsProps === void 0 ? void 0 : featureNotificationsProps.drawer) === null || _a === void 0 ? void 0 : _a.id) === item.id;
|
|
80
|
-
return (React.createElement(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
81
|
+
return (React.createElement(AppLayoutBuiltInErrorBoundary, { key: item.id },
|
|
82
|
+
React.createElement(TriggerButton, { ariaLabel: (_b = item.ariaLabels) === null || _b === void 0 ? void 0 : _b.triggerButton, ariaExpanded: selected, ariaControls: activeDrawerId === item.id ? item.id : undefined, className: clsx(styles['drawers-trigger'], !toolsOnlyMode && testutilStyles['drawers-trigger'], item.id === TOOLS_DRAWER_ID && testutilStyles['tools-toggle']), iconName: item.trigger.iconName, iconSvg: item.trigger.iconSvg, key: item.id, onClick: () => {
|
|
83
|
+
exitExpandedMode();
|
|
84
|
+
if (!!expandedDrawerId && activeDrawerId === item.id) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
onActiveDrawerChange === null || onActiveDrawerChange === void 0 ? void 0 : onActiveDrawerChange(activeDrawerId !== item.id ? item.id : null, { initiatedByUserAction: true });
|
|
88
|
+
}, ref: item.id === previousActiveLocalDrawerId.current
|
|
89
|
+
? drawersFocusRef
|
|
90
|
+
: isFeatureNotificationsDrawer
|
|
91
|
+
? featureNotificationTriggerRef
|
|
92
|
+
: null, selected: selected, badge: item.badge, testId: `awsui-app-layout-trigger-${item.id}`, hasTooltip: true, hasOpenDrawer: hasOpenDrawer, tooltipText: (_c = item.ariaLabels) === null || _c === void 0 ? void 0 : _c.drawerName, isForPreviousActiveDrawer: isForPreviousActiveDrawer, isMobile: isMobile, disabled: disabled })));
|
|
91
93
|
}),
|
|
92
94
|
globalDrawersStartIndex > 0 && visibleItems.length > globalDrawersStartIndex && (React.createElement("div", { className: styles['group-divider'] })),
|
|
93
95
|
visibleItems.slice(globalDrawersStartIndex).map(item => {
|
|
@@ -99,49 +101,52 @@ export function DrawerTriggers({ ariaLabels, activeDrawerId, drawers, drawersFoc
|
|
|
99
101
|
selected = item.id === activeGlobalBottomDrawerId && (!expandedDrawerId || item.id === expandedDrawerId);
|
|
100
102
|
isForPreviousActiveDrawer = previousActiveGlobalBottomDrawerId.current === item.id;
|
|
101
103
|
}
|
|
102
|
-
return (React.createElement(
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
return (React.createElement(AppLayoutBuiltInErrorBoundary, { key: item.id },
|
|
105
|
+
React.createElement(TriggerButton, { ariaLabel: (_a = item.ariaLabels) === null || _a === void 0 ? void 0 : _a.triggerButton, ariaExpanded: selected, ariaControls: selected ? item.id : undefined, className: clsx(styles['drawers-trigger'], testutilStyles['drawers-trigger'], testutilStyles['drawers-trigger-global']), iconName: item.trigger.iconName, iconSvg: item.trigger.iconSvg, key: item.id, onClick: () => {
|
|
106
|
+
exitExpandedMode();
|
|
107
|
+
if (!!expandedDrawerId && item.id !== expandedDrawerId && activeGlobalDrawersIds.includes(item.id)) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
if (isBottom) {
|
|
111
|
+
onActiveGlobalBottomDrawerChange === null || onActiveGlobalBottomDrawerChange === void 0 ? void 0 : onActiveGlobalBottomDrawerChange(selected ? null : item.id, { initiatedByUserAction: true });
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
onActiveGlobalDrawersChange === null || onActiveGlobalDrawersChange === void 0 ? void 0 : onActiveGlobalDrawersChange(item.id, { initiatedByUserAction: true });
|
|
115
|
+
}, ref: isBottom ? bottomDrawersFocusRef : (_b = globalDrawersFocusControl === null || globalDrawersFocusControl === void 0 ? void 0 : globalDrawersFocusControl.refs[item.id]) === null || _b === void 0 ? void 0 : _b.toggle, selected: selected, badge: item.badge, testId: `awsui-app-layout-trigger-${item.id}`, hasTooltip: true, hasOpenDrawer: hasOpenDrawer, tooltipText: (_c = item.ariaLabels) === null || _c === void 0 ? void 0 : _c.drawerName, isForPreviousActiveDrawer: isForPreviousActiveDrawer, isMobile: isMobile, disabled: disabled })));
|
|
116
|
+
}),
|
|
117
|
+
overflowItems.length > 0 && (React.createElement(AppLayoutBuiltInErrorBoundary, null,
|
|
118
|
+
React.createElement(OverflowMenu, { items: overflowItems.map(item => {
|
|
119
|
+
const isBottom = (item === null || item === void 0 ? void 0 : item.position) === 'bottom';
|
|
120
|
+
let active = activeGlobalDrawersIds.includes(item.id) && (!expandedDrawerId || item.id === expandedDrawerId);
|
|
121
|
+
if (isBottom) {
|
|
122
|
+
active =
|
|
123
|
+
item.id === activeGlobalBottomDrawerId && (!expandedDrawerId || item.id === expandedDrawerId);
|
|
106
124
|
}
|
|
125
|
+
return {
|
|
126
|
+
...item,
|
|
127
|
+
active,
|
|
128
|
+
};
|
|
129
|
+
}), ariaLabel: overflowMenuHasBadge ? ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.drawersOverflowWithBadge : ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.drawersOverflow, customTriggerBuilder: ({ onClick, triggerRef, ariaLabel, ariaExpanded, testUtilsClass }) => {
|
|
130
|
+
return (React.createElement(TriggerButton, { ref: triggerRef, ariaLabel: ariaLabel, ariaExpanded: ariaExpanded, badge: overflowMenuHasBadge, className: clsx(styles['drawers-trigger'], testutilStyles['drawers-trigger'], testutilStyles['drawers-trigger-global'], testUtilsClass), iconName: "ellipsis", onClick: onClick, disabled: disabled }));
|
|
131
|
+
}, onItemClick: event => {
|
|
132
|
+
const id = event.detail.id;
|
|
133
|
+
exitExpandedMode();
|
|
134
|
+
const item = overflowItems.find(item => item.id === id);
|
|
135
|
+
const isBottom = (item === null || item === void 0 ? void 0 : item.position) === 'bottom';
|
|
107
136
|
if (isBottom) {
|
|
137
|
+
const selected = item.id === activeGlobalBottomDrawerId && (!expandedDrawerId || item.id === expandedDrawerId);
|
|
108
138
|
onActiveGlobalBottomDrawerChange === null || onActiveGlobalBottomDrawerChange === void 0 ? void 0 : onActiveGlobalBottomDrawerChange(selected ? null : item.id, { initiatedByUserAction: true });
|
|
109
139
|
return;
|
|
110
140
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
return {
|
|
121
|
-
...item,
|
|
122
|
-
active,
|
|
123
|
-
};
|
|
124
|
-
}), ariaLabel: overflowMenuHasBadge ? ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.drawersOverflowWithBadge : ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.drawersOverflow, customTriggerBuilder: ({ onClick, triggerRef, ariaLabel, ariaExpanded, testUtilsClass }) => {
|
|
125
|
-
return (React.createElement(TriggerButton, { ref: triggerRef, ariaLabel: ariaLabel, ariaExpanded: ariaExpanded, badge: overflowMenuHasBadge, className: clsx(styles['drawers-trigger'], testutilStyles['drawers-trigger'], testutilStyles['drawers-trigger-global'], testUtilsClass), iconName: "ellipsis", onClick: onClick, disabled: disabled }));
|
|
126
|
-
}, onItemClick: event => {
|
|
127
|
-
const id = event.detail.id;
|
|
128
|
-
exitExpandedMode();
|
|
129
|
-
const item = overflowItems.find(item => item.id === id);
|
|
130
|
-
const isBottom = (item === null || item === void 0 ? void 0 : item.position) === 'bottom';
|
|
131
|
-
if (isBottom) {
|
|
132
|
-
const selected = item.id === activeGlobalBottomDrawerId && (!expandedDrawerId || item.id === expandedDrawerId);
|
|
133
|
-
onActiveGlobalBottomDrawerChange === null || onActiveGlobalBottomDrawerChange === void 0 ? void 0 : onActiveGlobalBottomDrawerChange(selected ? null : item.id, { initiatedByUserAction: true });
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
if (globalDrawers.find(drawer => drawer.id === id)) {
|
|
137
|
-
if (!!expandedDrawerId && id !== expandedDrawerId && activeGlobalDrawersIds.includes(id)) {
|
|
138
|
-
return;
|
|
141
|
+
if (globalDrawers.find(drawer => drawer.id === id)) {
|
|
142
|
+
if (!!expandedDrawerId && id !== expandedDrawerId && activeGlobalDrawersIds.includes(id)) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
onActiveGlobalDrawersChange === null || onActiveGlobalDrawersChange === void 0 ? void 0 : onActiveGlobalDrawersChange(id, { initiatedByUserAction: true });
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
onActiveDrawerChange === null || onActiveDrawerChange === void 0 ? void 0 : onActiveDrawerChange(event.detail.id, { initiatedByUserAction: true });
|
|
139
149
|
}
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
else {
|
|
143
|
-
onActiveDrawerChange === null || onActiveDrawerChange === void 0 ? void 0 : onActiveDrawerChange(event.detail.id, { initiatedByUserAction: true });
|
|
144
|
-
}
|
|
145
|
-
}, globalDrawersStartIndex: globalDrawersStartIndex - indexOfOverflowItem })))));
|
|
150
|
+
}, globalDrawersStartIndex: globalDrawersStartIndex - indexOfOverflowItem }))))));
|
|
146
151
|
}
|
|
147
152
|
//# sourceMappingURL=drawer-triggers.js.map
|