@cloudscape-design/components 3.0.974 → 3.0.975
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/test-classes/styles.css.js +24 -23
- package/app-layout/test-classes/styles.scoped.css +24 -23
- package/app-layout/test-classes/styles.selectors.js +24 -23
- package/app-layout/utils/use-drawers.d.ts +2 -0
- package/app-layout/utils/use-drawers.d.ts.map +1 -1
- package/app-layout/utils/use-drawers.js +6 -0
- package/app-layout/utils/use-drawers.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/drawer/global-drawer.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/drawer/global-drawer.js +27 -15
- package/app-layout/visual-refresh-toolbar/drawer/global-drawer.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/drawer/global-drawers.js +2 -2
- package/app-layout/visual-refresh-toolbar/drawer/global-drawers.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/drawer/styles.css.js +17 -10
- package/app-layout/visual-refresh-toolbar/drawer/styles.scoped.css +145 -11
- package/app-layout/visual-refresh-toolbar/drawer/styles.selectors.js +17 -10
- package/app-layout/visual-refresh-toolbar/index.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/index.js +10 -2
- package/app-layout/visual-refresh-toolbar/index.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/interfaces.d.ts +6 -0
- package/app-layout/visual-refresh-toolbar/interfaces.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/interfaces.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/multi-layout.d.ts +2 -0
- package/app-layout/visual-refresh-toolbar/multi-layout.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/multi-layout.js +4 -0
- package/app-layout/visual-refresh-toolbar/multi-layout.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/skeleton/index.d.ts +2 -0
- package/app-layout/visual-refresh-toolbar/skeleton/index.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/skeleton/index.js +6 -5
- package/app-layout/visual-refresh-toolbar/skeleton/index.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/skeleton/styles.css.js +21 -19
- package/app-layout/visual-refresh-toolbar/skeleton/styles.scoped.css +45 -35
- package/app-layout/visual-refresh-toolbar/skeleton/styles.selectors.js +21 -19
- package/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.d.ts +3 -1
- package/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.js +33 -6
- package/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/toolbar/index.d.ts +2 -0
- package/app-layout/visual-refresh-toolbar/toolbar/index.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/toolbar/index.js +12 -3
- package/app-layout/visual-refresh-toolbar/toolbar/index.js.map +1 -1
- package/drawer/implementation.d.ts.map +1 -1
- package/drawer/implementation.js +4 -1
- package/drawer/implementation.js.map +1 -1
- package/drawer/styles.css.js +8 -6
- package/drawer/styles.scoped.css +32 -17
- package/drawer/styles.selectors.js +8 -6
- package/icon/generated/icons.js +1 -1
- package/icon/generated/icons.js.map +1 -1
- package/internal/base-component/styles.scoped.css +5 -0
- package/internal/components/drag-handle/resize-icon.d.ts.map +1 -1
- package/internal/components/drag-handle/resize-icon.js +1 -2
- package/internal/components/drag-handle/resize-icon.js.map +1 -1
- package/internal/components/panel-resize-handle/styles.css.js +2 -2
- package/internal/components/panel-resize-handle/styles.scoped.css +8 -7
- package/internal/components/panel-resize-handle/styles.selectors.js +2 -2
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/generated/styles/tokens.d.ts +1 -0
- package/internal/generated/styles/tokens.js +1 -0
- package/internal/generated/theming/index.cjs +31 -0
- package/internal/generated/theming/index.js +31 -0
- package/internal/manifest.json +1 -1
- package/internal/plugins/controllers/drawers.d.ts +2 -0
- package/internal/plugins/controllers/drawers.d.ts.map +1 -1
- package/internal/plugins/controllers/drawers.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"root": "
|
|
5
|
-
"navigation": "
|
|
6
|
-
"navigation-toggle": "awsui_navigation-
|
|
7
|
-
"navigation-close": "awsui_navigation-
|
|
8
|
-
"content": "
|
|
9
|
-
"notifications": "
|
|
10
|
-
"breadcrumbs": "
|
|
11
|
-
"tools": "
|
|
12
|
-
"tools-close": "awsui_tools-
|
|
13
|
-
"tools-toggle": "awsui_tools-
|
|
14
|
-
"drawer-closed": "awsui_drawer-
|
|
15
|
-
"mobile-bar": "awsui_mobile-
|
|
16
|
-
"disable-body-scroll-root": "awsui_disable-body-scroll-
|
|
17
|
-
"drawers-trigger": "awsui_drawers-
|
|
18
|
-
"drawers-trigger-global": "awsui_drawers-trigger-
|
|
19
|
-
"drawers-trigger-with-badge": "awsui_drawers-trigger-with-
|
|
20
|
-
"active-drawer": "awsui_active-
|
|
21
|
-
"active-drawer-close-button": "awsui_active-drawer-close-
|
|
22
|
-
"overflow-menu": "awsui_overflow-
|
|
23
|
-
"drawers-slider": "awsui_drawers-
|
|
24
|
-
"toolbar": "
|
|
25
|
-
"trigger-wrapper-tooltip-visible": "awsui_trigger-wrapper-tooltip-
|
|
26
|
-
"trigger-tooltip": "awsui_trigger-
|
|
4
|
+
"root": "awsui_root_1fj9k_jfqbk_5",
|
|
5
|
+
"navigation": "awsui_navigation_1fj9k_jfqbk_6",
|
|
6
|
+
"navigation-toggle": "awsui_navigation-toggle_1fj9k_jfqbk_7",
|
|
7
|
+
"navigation-close": "awsui_navigation-close_1fj9k_jfqbk_8",
|
|
8
|
+
"content": "awsui_content_1fj9k_jfqbk_9",
|
|
9
|
+
"notifications": "awsui_notifications_1fj9k_jfqbk_10",
|
|
10
|
+
"breadcrumbs": "awsui_breadcrumbs_1fj9k_jfqbk_11",
|
|
11
|
+
"tools": "awsui_tools_1fj9k_jfqbk_12",
|
|
12
|
+
"tools-close": "awsui_tools-close_1fj9k_jfqbk_13",
|
|
13
|
+
"tools-toggle": "awsui_tools-toggle_1fj9k_jfqbk_14",
|
|
14
|
+
"drawer-closed": "awsui_drawer-closed_1fj9k_jfqbk_15",
|
|
15
|
+
"mobile-bar": "awsui_mobile-bar_1fj9k_jfqbk_16",
|
|
16
|
+
"disable-body-scroll-root": "awsui_disable-body-scroll-root_1fj9k_jfqbk_17",
|
|
17
|
+
"drawers-trigger": "awsui_drawers-trigger_1fj9k_jfqbk_18",
|
|
18
|
+
"drawers-trigger-global": "awsui_drawers-trigger-global_1fj9k_jfqbk_19",
|
|
19
|
+
"drawers-trigger-with-badge": "awsui_drawers-trigger-with-badge_1fj9k_jfqbk_20",
|
|
20
|
+
"active-drawer": "awsui_active-drawer_1fj9k_jfqbk_21",
|
|
21
|
+
"active-drawer-close-button": "awsui_active-drawer-close-button_1fj9k_jfqbk_22",
|
|
22
|
+
"overflow-menu": "awsui_overflow-menu_1fj9k_jfqbk_23",
|
|
23
|
+
"drawers-slider": "awsui_drawers-slider_1fj9k_jfqbk_24",
|
|
24
|
+
"toolbar": "awsui_toolbar_1fj9k_jfqbk_25",
|
|
25
|
+
"trigger-wrapper-tooltip-visible": "awsui_trigger-wrapper-tooltip-visible_1fj9k_jfqbk_26",
|
|
26
|
+
"trigger-tooltip": "awsui_trigger-tooltip_1fj9k_jfqbk_27",
|
|
27
|
+
"active-drawer-expanded-mode-button": "awsui_active-drawer-expanded-mode-button_1fj9k_jfqbk_28"
|
|
27
28
|
};
|
|
28
29
|
|
|
@@ -2,28 +2,29 @@
|
|
|
2
2
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
-
.
|
|
6
|
-
.
|
|
7
|
-
.awsui_navigation-
|
|
8
|
-
.awsui_navigation-
|
|
9
|
-
.
|
|
10
|
-
.
|
|
11
|
-
.
|
|
12
|
-
.
|
|
13
|
-
.awsui_tools-
|
|
14
|
-
.awsui_tools-
|
|
15
|
-
.awsui_drawer-
|
|
16
|
-
.awsui_mobile-
|
|
17
|
-
.awsui_disable-body-scroll-
|
|
18
|
-
.awsui_drawers-
|
|
19
|
-
.awsui_drawers-trigger-
|
|
20
|
-
.awsui_drawers-trigger-with-
|
|
21
|
-
.awsui_active-
|
|
22
|
-
.awsui_active-drawer-close-
|
|
23
|
-
.awsui_overflow-
|
|
24
|
-
.awsui_drawers-
|
|
25
|
-
.
|
|
26
|
-
.awsui_trigger-wrapper-tooltip-
|
|
27
|
-
.awsui_trigger-
|
|
5
|
+
.awsui_root_1fj9k_jfqbk_5:not(#\9),
|
|
6
|
+
.awsui_navigation_1fj9k_jfqbk_6:not(#\9),
|
|
7
|
+
.awsui_navigation-toggle_1fj9k_jfqbk_7:not(#\9),
|
|
8
|
+
.awsui_navigation-close_1fj9k_jfqbk_8:not(#\9),
|
|
9
|
+
.awsui_content_1fj9k_jfqbk_9:not(#\9),
|
|
10
|
+
.awsui_notifications_1fj9k_jfqbk_10:not(#\9),
|
|
11
|
+
.awsui_breadcrumbs_1fj9k_jfqbk_11:not(#\9),
|
|
12
|
+
.awsui_tools_1fj9k_jfqbk_12:not(#\9),
|
|
13
|
+
.awsui_tools-close_1fj9k_jfqbk_13:not(#\9),
|
|
14
|
+
.awsui_tools-toggle_1fj9k_jfqbk_14:not(#\9),
|
|
15
|
+
.awsui_drawer-closed_1fj9k_jfqbk_15:not(#\9),
|
|
16
|
+
.awsui_mobile-bar_1fj9k_jfqbk_16:not(#\9),
|
|
17
|
+
.awsui_disable-body-scroll-root_1fj9k_jfqbk_17:not(#\9),
|
|
18
|
+
.awsui_drawers-trigger_1fj9k_jfqbk_18:not(#\9),
|
|
19
|
+
.awsui_drawers-trigger-global_1fj9k_jfqbk_19:not(#\9),
|
|
20
|
+
.awsui_drawers-trigger-with-badge_1fj9k_jfqbk_20:not(#\9),
|
|
21
|
+
.awsui_active-drawer_1fj9k_jfqbk_21:not(#\9),
|
|
22
|
+
.awsui_active-drawer-close-button_1fj9k_jfqbk_22:not(#\9),
|
|
23
|
+
.awsui_overflow-menu_1fj9k_jfqbk_23:not(#\9),
|
|
24
|
+
.awsui_drawers-slider_1fj9k_jfqbk_24:not(#\9),
|
|
25
|
+
.awsui_toolbar_1fj9k_jfqbk_25:not(#\9),
|
|
26
|
+
.awsui_trigger-wrapper-tooltip-visible_1fj9k_jfqbk_26:not(#\9),
|
|
27
|
+
.awsui_trigger-tooltip_1fj9k_jfqbk_27:not(#\9),
|
|
28
|
+
.awsui_active-drawer-expanded-mode-button_1fj9k_jfqbk_28:not(#\9) {
|
|
28
29
|
/* used in test-utils */
|
|
29
30
|
}
|
|
@@ -2,28 +2,29 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"root": "
|
|
6
|
-
"navigation": "
|
|
7
|
-
"navigation-toggle": "awsui_navigation-
|
|
8
|
-
"navigation-close": "awsui_navigation-
|
|
9
|
-
"content": "
|
|
10
|
-
"notifications": "
|
|
11
|
-
"breadcrumbs": "
|
|
12
|
-
"tools": "
|
|
13
|
-
"tools-close": "awsui_tools-
|
|
14
|
-
"tools-toggle": "awsui_tools-
|
|
15
|
-
"drawer-closed": "awsui_drawer-
|
|
16
|
-
"mobile-bar": "awsui_mobile-
|
|
17
|
-
"disable-body-scroll-root": "awsui_disable-body-scroll-
|
|
18
|
-
"drawers-trigger": "awsui_drawers-
|
|
19
|
-
"drawers-trigger-global": "awsui_drawers-trigger-
|
|
20
|
-
"drawers-trigger-with-badge": "awsui_drawers-trigger-with-
|
|
21
|
-
"active-drawer": "awsui_active-
|
|
22
|
-
"active-drawer-close-button": "awsui_active-drawer-close-
|
|
23
|
-
"overflow-menu": "awsui_overflow-
|
|
24
|
-
"drawers-slider": "awsui_drawers-
|
|
25
|
-
"toolbar": "
|
|
26
|
-
"trigger-wrapper-tooltip-visible": "awsui_trigger-wrapper-tooltip-
|
|
27
|
-
"trigger-tooltip": "awsui_trigger-
|
|
5
|
+
"root": "awsui_root_1fj9k_jfqbk_5",
|
|
6
|
+
"navigation": "awsui_navigation_1fj9k_jfqbk_6",
|
|
7
|
+
"navigation-toggle": "awsui_navigation-toggle_1fj9k_jfqbk_7",
|
|
8
|
+
"navigation-close": "awsui_navigation-close_1fj9k_jfqbk_8",
|
|
9
|
+
"content": "awsui_content_1fj9k_jfqbk_9",
|
|
10
|
+
"notifications": "awsui_notifications_1fj9k_jfqbk_10",
|
|
11
|
+
"breadcrumbs": "awsui_breadcrumbs_1fj9k_jfqbk_11",
|
|
12
|
+
"tools": "awsui_tools_1fj9k_jfqbk_12",
|
|
13
|
+
"tools-close": "awsui_tools-close_1fj9k_jfqbk_13",
|
|
14
|
+
"tools-toggle": "awsui_tools-toggle_1fj9k_jfqbk_14",
|
|
15
|
+
"drawer-closed": "awsui_drawer-closed_1fj9k_jfqbk_15",
|
|
16
|
+
"mobile-bar": "awsui_mobile-bar_1fj9k_jfqbk_16",
|
|
17
|
+
"disable-body-scroll-root": "awsui_disable-body-scroll-root_1fj9k_jfqbk_17",
|
|
18
|
+
"drawers-trigger": "awsui_drawers-trigger_1fj9k_jfqbk_18",
|
|
19
|
+
"drawers-trigger-global": "awsui_drawers-trigger-global_1fj9k_jfqbk_19",
|
|
20
|
+
"drawers-trigger-with-badge": "awsui_drawers-trigger-with-badge_1fj9k_jfqbk_20",
|
|
21
|
+
"active-drawer": "awsui_active-drawer_1fj9k_jfqbk_21",
|
|
22
|
+
"active-drawer-close-button": "awsui_active-drawer-close-button_1fj9k_jfqbk_22",
|
|
23
|
+
"overflow-menu": "awsui_overflow-menu_1fj9k_jfqbk_23",
|
|
24
|
+
"drawers-slider": "awsui_drawers-slider_1fj9k_jfqbk_24",
|
|
25
|
+
"toolbar": "awsui_toolbar_1fj9k_jfqbk_25",
|
|
26
|
+
"trigger-wrapper-tooltip-visible": "awsui_trigger-wrapper-tooltip-visible_1fj9k_jfqbk_26",
|
|
27
|
+
"trigger-tooltip": "awsui_trigger-tooltip_1fj9k_jfqbk_27",
|
|
28
|
+
"active-drawer-expanded-mode-button": "awsui_active-drawer-expanded-mode-button_1fj9k_jfqbk_28"
|
|
28
29
|
};
|
|
29
30
|
|
|
@@ -39,6 +39,8 @@ export declare function useDrawers({ drawers, activeDrawerId: controlledActiveDr
|
|
|
39
39
|
size: number;
|
|
40
40
|
}) => void;
|
|
41
41
|
onActiveGlobalDrawersChange: (drawerId: string, { initiatedByUserAction }?: Partial<OnChangeParams>) => void;
|
|
42
|
+
expandedDrawerId: string | null;
|
|
43
|
+
setExpandedDrawerId: React.Dispatch<React.SetStateAction<string | null>>;
|
|
42
44
|
};
|
|
43
45
|
export {};
|
|
44
46
|
//# sourceMappingURL=use-drawers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-drawers.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/utils/use-drawers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAS3D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAI/C,eAAO,MAAM,eAAe,yBAAyB,CAAC;AAEtD,UAAU,UAAU;IAClB,SAAS,EAAE,OAAO,GAAG,SAAS,CAAC;IAC/B,SAAS,EAAE,OAAO,GAAG,SAAS,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;IACnC,aAAa,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC1C,UAAU,EAAE,cAAc,CAAC,MAAM,GAAG,SAAS,CAAC;IAC9C,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,MAAM,WAAW,cAAc;IAC7B,qBAAqB,EAAE,OA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C;AAiJD,eAAO,MAAM,eAAe,MAAM,CAAC;AAEnC,KAAK,eAAe,GAAG,IAAI,CAAC,cAAc,EAAE,SAAS,GAAG,gBAAgB,GAAG,gBAAgB,CAAC,GAAG;IAC7F,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,mBAAmB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAChE,oBAAoB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CACnD,CAAC;AAEF,wBAAgB,UAAU,CACxB,EACE,OAAO,EACP,cAAc,EAAE,wBAAwB,EACxC,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EAAE,qBAAqB,GAC/C,EAAE,eAAe,EAClB,UAAU,EAAE,cAAc,CAAC,YAAY,CAAC,EACxC,UAAU,EAAE,UAAU;;;;;;;;;;;;;;wCAqBP,MAAM,GAAG,IAAI,8BACC,cAAc;;YATO,MAAM;cAAQ,MAAM;;4CAuC1D,MAAM,8BACW,QAAQ,cAAc,CAAC;;;EAmGrD"}
|
|
@@ -129,6 +129,7 @@ export function useDrawers({ drawers, activeDrawerId: controlledActiveDrawerId,
|
|
|
129
129
|
});
|
|
130
130
|
const [activeGlobalDrawersIds, setActiveGlobalDrawersIds] = useState([]);
|
|
131
131
|
const [drawerSizes, setDrawerSizes] = useState({});
|
|
132
|
+
const [expandedDrawerId, setExpandedDrawerId] = useState(null);
|
|
132
133
|
// FIFO queue that keeps track of open drawers, where the first element is the most recently opened drawer
|
|
133
134
|
const drawersOpenQueue = useRef([]);
|
|
134
135
|
function onActiveDrawerResize({ id, size }) {
|
|
@@ -167,6 +168,9 @@ export function useDrawers({ drawers, activeDrawerId: controlledActiveDrawerId,
|
|
|
167
168
|
onGlobalDrawerFocus === null || onGlobalDrawerFocus === void 0 ? void 0 : onGlobalDrawerFocus(drawerId, false);
|
|
168
169
|
drawersOpenQueue.current = drawersOpenQueue.current.filter(id => id !== drawerId);
|
|
169
170
|
fireNonCancelableEvent(drawer === null || drawer === void 0 ? void 0 : drawer.onToggle, { isOpen: false, initiatedByUserAction });
|
|
171
|
+
if (drawerId === expandedDrawerId) {
|
|
172
|
+
setExpandedDrawerId(null);
|
|
173
|
+
}
|
|
170
174
|
}
|
|
171
175
|
else if (drawerId) {
|
|
172
176
|
onAddNewActiveDrawer === null || onAddNewActiveDrawer === void 0 ? void 0 : onAddNewActiveDrawer(drawerId);
|
|
@@ -223,6 +227,8 @@ export function useDrawers({ drawers, activeDrawerId: controlledActiveDrawerId,
|
|
|
223
227
|
onActiveDrawerChange,
|
|
224
228
|
onActiveDrawerResize,
|
|
225
229
|
onActiveGlobalDrawersChange,
|
|
230
|
+
expandedDrawerId,
|
|
231
|
+
setExpandedDrawerId,
|
|
226
232
|
};
|
|
227
233
|
}
|
|
228
234
|
//# sourceMappingURL=use-drawers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-drawers.js","sourceRoot":"","sources":["../../../../src/app-layout/utils/use-drawers.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAc,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAElF,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAEtE,OAAO,EAAE,qBAAqB,EAAiB,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,CAAC,MAAM,eAAe,GAAG,sBAAsB,CAAC;AAgBtD,SAAS,kBAAk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AAC,IACzF;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,CAC5B,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,SAAS,EAAC,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,WAAW,mCAAI,eAAe,EAC5F,eAAe,CAChB,CAAC;IAEF,OAAO;QACL,qBAAqB,EAAE,UAAU;QACjC,OAAO,EAAE,oBAAoB,IAAI,SAAS;QAC1C,YAAY;QACZ,cAAc,EAAE,sBAAsB;QACtC,aAAa,EAAE,oBAAoB;QACnC,mBAAmB,EAAE,mBAAmB;QACxC,sBAAsB;QACtB,wBAAwB;QACxB,gBAAgB;QAChB,aAAa;QACb,qBAAqB;QACrB,WAAW;QACX,gBAAgB,EAAE,gBAAgB,CAAC,OAAO;QAC1C,oBAAoB;QACpB,oBAAoB;QACpB,2BAA2B;KAC5B,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef, useState } from 'react';\n\nimport { useStableCallback } from '@cloudscape-design/component-toolkit/internal';\n\nimport { fireNonCancelableEvent } from '../../internal/events';\nimport { useControllable } from '../../internal/hooks/use-controllable';\nimport { awsuiPluginsInternal } from '../../internal/plugins/api';\nimport { DrawersToggledListener } from '../../internal/plugins/controllers/drawers';\nimport { sortByPriority } from '../../internal/plugins/helpers/utils';\nimport { AppLayoutProps } from '../interfaces';\nimport { convertRuntimeDrawers, DrawersLayout } from '../runtime-drawer';\nimport { togglesConfig } from '../toggles';\n\nexport const TOOLS_DRAWER_ID = 'awsui-internal-tools';\n\ninterface ToolsProps {\n toolsHide: boolean | undefined;\n toolsOpen: boolean | undefined;\n toolsWidth: number;\n tools: React.ReactNode | undefined;\n onToolsToggle: (newOpen: boolean) => void;\n ariaLabels: AppLayoutProps.Labels | undefined;\n disableDrawersMerge?: boolean;\n}\n\nexport interface OnChangeParams {\n initiatedByUserAction: boolean;\n}\n\nfunction getToolsDrawerItem(props: ToolsProps): AppLayoutProps.Drawer | null {\n if (props.toolsHide) {\n return null;\n }\n const { iconName, getLabels } = togglesConfig.tools;\n const { mainLabel, closeLabel, openLabel } = getLabels(props.ariaLabels);\n return {\n id: TOOLS_DRAWER_ID,\n content: props.tools,\n resizable: false,\n ariaLabels: {\n triggerButton: openLabel,\n closeButton: closeLabel,\n drawerName: mainLabel ?? '',\n },\n trigger: {\n iconName: iconName,\n },\n };\n}\n\nconst DRAWERS_LIMIT = 2;\n\nconst DEFAULT_ON_CHANGE_PARAMS = { initiatedByUserAction: true };\n\nfunction useRuntimeDrawers(\n disableRuntimeDrawers: boolean | undefined,\n activeDrawerId: string | null,\n onActiveDrawerChange: (newDrawerId: string | null, { initiatedByUserAction }: OnChangeParams) => void,\n activeGlobalDrawersIds: Array<string>,\n onActiveGlobalDrawersChange: (newDrawerId: string, { initiatedByUserAction }: OnChangeParams) => void\n) {\n const [runtimeDrawers, setRuntimeDrawers] = useState<DrawersLayout>({\n localBefore: [],\n localAfter: [],\n global: [],\n });\n const onLocalDrawerChangeStable = useStableCallback(onActiveDrawerChange);\n const onGlobalDrawersChangeStable = useStableCallback(onActiveGlobalDrawersChange);\n\n const localDrawerWasOpenRef = useRef(false);\n localDrawerWasOpenRef.current = localDrawerWasOpenRef.current || !!activeDrawerId;\n const activeGlobalDrawersIdsRef = useRef<Array<string>>([]);\n activeGlobalDrawersIdsRef.current = activeGlobalDrawersIds;\n\n useEffect(() => {\n if (disableRuntimeDrawers) {\n return;\n }\n const unsubscribe = awsuiPluginsInternal.appLayout.onDrawersRegistered(drawers => {\n const localDrawers = drawers.filter(drawer => drawer.type !== 'global');\n const globalDrawers = drawers.filter(drawer => drawer.type === 'global');\n setRuntimeDrawers(convertRuntimeDrawers(localDrawers, globalDrawers));\n if (!localDrawerWasOpenRef.current) {\n const defaultActiveLocalDrawer = sortByPriority(localDrawers).find(drawer => drawer.defaultActive);\n if (defaultActiveLocalDrawer) {\n onLocalDrawerChangeStable(defaultActiveLocalDrawer.id, { initiatedByUserAction: false });\n }\n }\n\n const drawersNotActiveByDefault = globalDrawers.filter(drawer => !drawer.defaultActive);\n const hasDrawersOpenByUserAction = drawersNotActiveByDefault.find(drawer =>\n activeGlobalDrawersIdsRef.current.includes(drawer.id)\n );\n if (hasDrawersOpenByUserAction || activeGlobalDrawersIdsRef.current.length === DRAWERS_LIMIT) {\n return;\n }\n\n const defaultActiveGlobalDrawers = sortByPriority(globalDrawers).filter(\n drawer => !activeGlobalDrawersIdsRef.current.includes(drawer.id) && drawer.defaultActive\n );\n defaultActiveGlobalDrawers.forEach(drawer => {\n onGlobalDrawersChangeStable(drawer.id, { initiatedByUserAction: false });\n });\n });\n return () => {\n unsubscribe();\n setRuntimeDrawers({ localBefore: [], localAfter: [], global: [] });\n };\n }, [disableRuntimeDrawers, onGlobalDrawersChangeStable, onLocalDrawerChangeStable]);\n\n return runtimeDrawers;\n}\n\nfunction useDrawerRuntimeOpenClose(\n disableRuntimeDrawers: boolean | undefined,\n localDrawers: AppLayoutProps.Drawer[] | null,\n globalDrawers: AppLayoutProps.Drawer[],\n activeDrawerId: string | null,\n onActiveDrawerChange: (newDrawerId: string | null, { initiatedByUserAction }: OnChangeParams) => void,\n activeGlobalDrawersIds: Array<string>,\n onActiveGlobalDrawersChange: (newDrawerId: string, { initiatedByUserAction }: OnChangeParams) => void\n) {\n const onDrawerOpened: DrawersToggledListener = useStableCallback((drawerId, params = DEFAULT_ON_CHANGE_PARAMS) => {\n const localDrawer = localDrawers?.find(drawer => drawer.id === drawerId);\n const globalDrawer = globalDrawers.find(drawer => drawer.id === drawerId);\n if (localDrawer && activeDrawerId !== drawerId) {\n onActiveDrawerChange(drawerId, params);\n }\n if (globalDrawer && !activeGlobalDrawersIds.includes(drawerId)) {\n onActiveGlobalDrawersChange(drawerId, params);\n }\n });\n\n const onDrawerClosed: DrawersToggledListener = useStableCallback((drawerId, params = DEFAULT_ON_CHANGE_PARAMS) => {\n const localDrawer = localDrawers?.find(drawer => drawer.id === drawerId);\n const globalDrawer = globalDrawers.find(drawer => drawer.id === drawerId);\n if (localDrawer && activeDrawerId === drawerId) {\n onActiveDrawerChange(null, params);\n }\n if (globalDrawer && activeGlobalDrawersIds.includes(drawerId)) {\n onActiveGlobalDrawersChange(drawerId, params);\n }\n });\n\n useEffect(() => {\n if (disableRuntimeDrawers) {\n return;\n }\n return awsuiPluginsInternal.appLayout.onDrawerOpened(onDrawerOpened);\n }, [disableRuntimeDrawers, onDrawerOpened]);\n\n useEffect(() => {\n if (disableRuntimeDrawers) {\n return;\n }\n return awsuiPluginsInternal.appLayout.onDrawerClosed(onDrawerClosed);\n }, [disableRuntimeDrawers, onDrawerClosed]);\n}\n\nfunction applyToolsDrawer(toolsProps: ToolsProps, runtimeDrawers: DrawersLayout) {\n const drawers = [...runtimeDrawers.localBefore, ...runtimeDrawers.localAfter];\n if (drawers.length === 0 && toolsProps.disableDrawersMerge) {\n return null;\n }\n const toolsItem = getToolsDrawerItem(toolsProps);\n if (toolsItem) {\n drawers.unshift(toolsItem);\n }\n\n return drawers;\n}\n\nexport const MIN_DRAWER_SIZE = 290;\n\ntype UseDrawersProps = Pick<AppLayoutProps, 'drawers' | 'activeDrawerId' | 'onDrawerChange'> & {\n __disableRuntimeDrawers?: boolean;\n onGlobalDrawerFocus?: (drawerId: string, open: boolean) => void;\n onAddNewActiveDrawer?: (drawerId: string) => void;\n};\n\nexport function useDrawers(\n {\n drawers,\n activeDrawerId: controlledActiveDrawerId,\n onDrawerChange,\n onGlobalDrawerFocus,\n onAddNewActiveDrawer,\n __disableRuntimeDrawers: disableRuntimeDrawers,\n }: UseDrawersProps,\n ariaLabels: AppLayoutProps['ariaLabels'],\n toolsProps: ToolsProps\n) {\n const [activeDrawerId = null, setActiveDrawerId] = useControllable(controlledActiveDrawerId, onDrawerChange, null, {\n componentName: 'AppLayout',\n controlledProp: 'activeDrawerId',\n changeHandler: 'onChange',\n });\n const [activeGlobalDrawersIds, setActiveGlobalDrawersIds] = useState<Array<string>>([]);\n const [drawerSizes, setDrawerSizes] = useState<Record<string, number>>({});\n // FIFO queue that keeps track of open drawers, where the first element is the most recently opened drawer\n const drawersOpenQueue = useRef<Array<string>>([]);\n\n function onActiveDrawerResize({ id, size }: { id: string; size: number }) {\n setDrawerSizes(oldSizes => ({ ...oldSizes, [id]: size }));\n fireNonCancelableEvent(activeDrawer?.onResize, { id, size });\n const activeGlobalDrawer = runtimeGlobalDrawers.find(drawer => drawer.id === id);\n fireNonCancelableEvent(activeGlobalDrawer?.onResize, { id, size });\n }\n\n function onActiveDrawerChange(\n newDrawerId: string | null,\n { initiatedByUserAction }: OnChangeParams = DEFAULT_ON_CHANGE_PARAMS\n ) {\n setActiveDrawerId(newDrawerId);\n if (newDrawerId) {\n onAddNewActiveDrawer?.(newDrawerId);\n }\n if (hasOwnDrawers) {\n fireNonCancelableEvent(onDrawerChange, { activeDrawerId: newDrawerId });\n } else if (!toolsProps.toolsHide) {\n toolsProps.onToolsToggle(newDrawerId === TOOLS_DRAWER_ID);\n }\n\n if (newDrawerId) {\n drawersOpenQueue.current = [newDrawerId, ...drawersOpenQueue.current];\n const newDrawer = [...runtimeDrawers.localBefore, ...runtimeDrawers.localAfter]?.find(\n drawer => drawer.id === newDrawerId\n );\n fireNonCancelableEvent(newDrawer?.onToggle, { isOpen: true, initiatedByUserAction });\n }\n\n if (activeDrawerId) {\n drawersOpenQueue.current = drawersOpenQueue.current.filter(id => id !== activeDrawerId);\n const activeDrawer = [...runtimeDrawers.localBefore, ...runtimeDrawers.localAfter]?.find(\n drawer => drawer.id === activeDrawerId\n );\n fireNonCancelableEvent(activeDrawer?.onToggle, { isOpen: false, initiatedByUserAction });\n }\n }\n\n function onActiveGlobalDrawersChange(\n drawerId: string,\n { initiatedByUserAction }: Partial<OnChangeParams> = DEFAULT_ON_CHANGE_PARAMS\n ) {\n const drawer = runtimeGlobalDrawers.find(drawer => drawer.id === drawerId);\n if (activeGlobalDrawersIds.includes(drawerId)) {\n setActiveGlobalDrawersIds(currentState => currentState.filter(id => id !== drawerId));\n onGlobalDrawerFocus?.(drawerId, false);\n drawersOpenQueue.current = drawersOpenQueue.current.filter(id => id !== drawerId);\n fireNonCancelableEvent(drawer?.onToggle, { isOpen: false, initiatedByUserAction });\n } else if (drawerId) {\n onAddNewActiveDrawer?.(drawerId);\n setActiveGlobalDrawersIds(currentState => [drawerId, ...currentState].slice(0, DRAWERS_LIMIT!));\n onGlobalDrawerFocus?.(drawerId, true);\n drawersOpenQueue.current = [drawerId, ...drawersOpenQueue.current];\n fireNonCancelableEvent(drawer?.onToggle, { isOpen: true, initiatedByUserAction });\n }\n }\n\n const hasOwnDrawers = !!drawers;\n // support toolsOpen in runtime-drawers-only mode\n let activeDrawerIdResolved =\n toolsProps?.toolsOpen && !hasOwnDrawers\n ? TOOLS_DRAWER_ID\n : activeDrawerId !== TOOLS_DRAWER_ID\n ? activeDrawerId\n : null;\n const runtimeDrawers = useRuntimeDrawers(\n disableRuntimeDrawers,\n activeDrawerIdResolved,\n onActiveDrawerChange,\n activeGlobalDrawersIds,\n onActiveGlobalDrawersChange\n );\n const { localBefore, localAfter, global: runtimeGlobalDrawers } = runtimeDrawers;\n const combinedLocalDrawers = drawers\n ? [...localBefore, ...drawers, ...localAfter]\n : applyToolsDrawer(toolsProps, runtimeDrawers);\n const activeDrawer = combinedLocalDrawers?.find(drawer => drawer.id === activeDrawerIdResolved);\n // ensure that id is only defined when the drawer exists\n activeDrawerIdResolved = activeDrawer?.id ?? null;\n const activeGlobalDrawers = runtimeGlobalDrawers.filter(drawer => activeGlobalDrawersIds.includes(drawer.id));\n\n useDrawerRuntimeOpenClose(\n disableRuntimeDrawers,\n combinedLocalDrawers,\n runtimeGlobalDrawers,\n activeDrawerId,\n onActiveDrawerChange,\n activeGlobalDrawersIds,\n onActiveGlobalDrawersChange\n );\n\n const activeDrawerSize = activeDrawerIdResolved\n ? drawerSizes[activeDrawerIdResolved] ?? activeDrawer?.defaultSize ?? toolsProps.toolsWidth\n : toolsProps.toolsWidth;\n const activeGlobalDrawersSizes: Record<string, number> = activeGlobalDrawersIds.reduce(\n (acc, currentGlobalDrawerId) => {\n const currentGlobalDrawer = runtimeGlobalDrawers.find(drawer => drawer.id === currentGlobalDrawerId);\n return {\n ...acc,\n [currentGlobalDrawerId]:\n drawerSizes[currentGlobalDrawerId] ?? currentGlobalDrawer?.defaultSize ?? MIN_DRAWER_SIZE,\n };\n },\n {}\n );\n const minGlobalDrawersSizes: Record<string, number> = runtimeGlobalDrawers.reduce((acc, globalDrawer) => {\n return {\n ...acc,\n [globalDrawer.id]: Math.min(globalDrawer.defaultSize ?? MIN_DRAWER_SIZE, MIN_DRAWER_SIZE),\n };\n }, {});\n const minDrawerSize = Math.min(\n toolsProps?.toolsOpen ? toolsProps.toolsWidth : activeDrawer?.defaultSize ?? MIN_DRAWER_SIZE,\n MIN_DRAWER_SIZE\n );\n\n return {\n ariaLabelsWithDrawers: ariaLabels,\n drawers: combinedLocalDrawers || undefined,\n activeDrawer,\n activeDrawerId: activeDrawerIdResolved,\n globalDrawers: runtimeGlobalDrawers,\n activeGlobalDrawers: activeGlobalDrawers,\n activeGlobalDrawersIds,\n activeGlobalDrawersSizes,\n activeDrawerSize,\n minDrawerSize,\n minGlobalDrawersSizes,\n drawerSizes,\n drawersOpenQueue: drawersOpenQueue.current,\n onActiveDrawerChange,\n onActiveDrawerResize,\n onActiveGlobalDrawersChange,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"use-drawers.js","sourceRoot":"","sources":["../../../../src/app-layout/utils/use-drawers.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAc,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE3D,OAAO,EAAE,iBAAiB,EAAE,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ACpB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef, useState } from 'react';\n\nimport { useStableCallback } from '@cloudscape-design/component-toolkit/internal';\n\nimport { fireNonCancelableEvent } from '../../internal/events';\nimport { useControllable } from '../../internal/hooks/use-controllable';\nimport { awsuiPluginsInternal } from '../../internal/plugins/api';\nimport { DrawersToggledListener } from '../../internal/plugins/controllers/drawers';\nimport { sortByPriority } from '../../internal/plugins/helpers/utils';\nimport { AppLayoutProps } from '../interfaces';\nimport { convertRuntimeDrawers, DrawersLayout } from '../runtime-drawer';\nimport { togglesConfig } from '../toggles';\n\nexport const TOOLS_DRAWER_ID = 'awsui-internal-tools';\n\ninterface ToolsProps {\n toolsHide: boolean | undefined;\n toolsOpen: boolean | undefined;\n toolsWidth: number;\n tools: React.ReactNode | undefined;\n onToolsToggle: (newOpen: boolean) => void;\n ariaLabels: AppLayoutProps.Labels | undefined;\n disableDrawersMerge?: boolean;\n}\n\nexport interface OnChangeParams {\n initiatedByUserAction: boolean;\n}\n\nfunction getToolsDrawerItem(props: ToolsProps): AppLayoutProps.Drawer | null {\n if (props.toolsHide) {\n return null;\n }\n const { iconName, getLabels } = togglesConfig.tools;\n const { mainLabel, closeLabel, openLabel } = getLabels(props.ariaLabels);\n return {\n id: TOOLS_DRAWER_ID,\n content: props.tools,\n resizable: false,\n ariaLabels: {\n triggerButton: openLabel,\n closeButton: closeLabel,\n drawerName: mainLabel ?? '',\n },\n trigger: {\n iconName: iconName,\n },\n };\n}\n\nconst DRAWERS_LIMIT = 2;\n\nconst DEFAULT_ON_CHANGE_PARAMS = { initiatedByUserAction: true };\n\nfunction useRuntimeDrawers(\n disableRuntimeDrawers: boolean | undefined,\n activeDrawerId: string | null,\n onActiveDrawerChange: (newDrawerId: string | null, { initiatedByUserAction }: OnChangeParams) => void,\n activeGlobalDrawersIds: Array<string>,\n onActiveGlobalDrawersChange: (newDrawerId: string, { initiatedByUserAction }: OnChangeParams) => void\n) {\n const [runtimeDrawers, setRuntimeDrawers] = useState<DrawersLayout>({\n localBefore: [],\n localAfter: [],\n global: [],\n });\n const onLocalDrawerChangeStable = useStableCallback(onActiveDrawerChange);\n const onGlobalDrawersChangeStable = useStableCallback(onActiveGlobalDrawersChange);\n\n const localDrawerWasOpenRef = useRef(false);\n localDrawerWasOpenRef.current = localDrawerWasOpenRef.current || !!activeDrawerId;\n const activeGlobalDrawersIdsRef = useRef<Array<string>>([]);\n activeGlobalDrawersIdsRef.current = activeGlobalDrawersIds;\n\n useEffect(() => {\n if (disableRuntimeDrawers) {\n return;\n }\n const unsubscribe = awsuiPluginsInternal.appLayout.onDrawersRegistered(drawers => {\n const localDrawers = drawers.filter(drawer => drawer.type !== 'global');\n const globalDrawers = drawers.filter(drawer => drawer.type === 'global');\n setRuntimeDrawers(convertRuntimeDrawers(localDrawers, globalDrawers));\n if (!localDrawerWasOpenRef.current) {\n const defaultActiveLocalDrawer = sortByPriority(localDrawers).find(drawer => drawer.defaultActive);\n if (defaultActiveLocalDrawer) {\n onLocalDrawerChangeStable(defaultActiveLocalDrawer.id, { initiatedByUserAction: false });\n }\n }\n\n const drawersNotActiveByDefault = globalDrawers.filter(drawer => !drawer.defaultActive);\n const hasDrawersOpenByUserAction = drawersNotActiveByDefault.find(drawer =>\n activeGlobalDrawersIdsRef.current.includes(drawer.id)\n );\n if (hasDrawersOpenByUserAction || activeGlobalDrawersIdsRef.current.length === DRAWERS_LIMIT) {\n return;\n }\n\n const defaultActiveGlobalDrawers = sortByPriority(globalDrawers).filter(\n drawer => !activeGlobalDrawersIdsRef.current.includes(drawer.id) && drawer.defaultActive\n );\n defaultActiveGlobalDrawers.forEach(drawer => {\n onGlobalDrawersChangeStable(drawer.id, { initiatedByUserAction: false });\n });\n });\n return () => {\n unsubscribe();\n setRuntimeDrawers({ localBefore: [], localAfter: [], global: [] });\n };\n }, [disableRuntimeDrawers, onGlobalDrawersChangeStable, onLocalDrawerChangeStable]);\n\n return runtimeDrawers;\n}\n\nfunction useDrawerRuntimeOpenClose(\n disableRuntimeDrawers: boolean | undefined,\n localDrawers: AppLayoutProps.Drawer[] | null,\n globalDrawers: AppLayoutProps.Drawer[],\n activeDrawerId: string | null,\n onActiveDrawerChange: (newDrawerId: string | null, { initiatedByUserAction }: OnChangeParams) => void,\n activeGlobalDrawersIds: Array<string>,\n onActiveGlobalDrawersChange: (newDrawerId: string, { initiatedByUserAction }: OnChangeParams) => void\n) {\n const onDrawerOpened: DrawersToggledListener = useStableCallback((drawerId, params = DEFAULT_ON_CHANGE_PARAMS) => {\n const localDrawer = localDrawers?.find(drawer => drawer.id === drawerId);\n const globalDrawer = globalDrawers.find(drawer => drawer.id === drawerId);\n if (localDrawer && activeDrawerId !== drawerId) {\n onActiveDrawerChange(drawerId, params);\n }\n if (globalDrawer && !activeGlobalDrawersIds.includes(drawerId)) {\n onActiveGlobalDrawersChange(drawerId, params);\n }\n });\n\n const onDrawerClosed: DrawersToggledListener = useStableCallback((drawerId, params = DEFAULT_ON_CHANGE_PARAMS) => {\n const localDrawer = localDrawers?.find(drawer => drawer.id === drawerId);\n const globalDrawer = globalDrawers.find(drawer => drawer.id === drawerId);\n if (localDrawer && activeDrawerId === drawerId) {\n onActiveDrawerChange(null, params);\n }\n if (globalDrawer && activeGlobalDrawersIds.includes(drawerId)) {\n onActiveGlobalDrawersChange(drawerId, params);\n }\n });\n\n useEffect(() => {\n if (disableRuntimeDrawers) {\n return;\n }\n return awsuiPluginsInternal.appLayout.onDrawerOpened(onDrawerOpened);\n }, [disableRuntimeDrawers, onDrawerOpened]);\n\n useEffect(() => {\n if (disableRuntimeDrawers) {\n return;\n }\n return awsuiPluginsInternal.appLayout.onDrawerClosed(onDrawerClosed);\n }, [disableRuntimeDrawers, onDrawerClosed]);\n}\n\nfunction applyToolsDrawer(toolsProps: ToolsProps, runtimeDrawers: DrawersLayout) {\n const drawers = [...runtimeDrawers.localBefore, ...runtimeDrawers.localAfter];\n if (drawers.length === 0 && toolsProps.disableDrawersMerge) {\n return null;\n }\n const toolsItem = getToolsDrawerItem(toolsProps);\n if (toolsItem) {\n drawers.unshift(toolsItem);\n }\n\n return drawers;\n}\n\nexport const MIN_DRAWER_SIZE = 290;\n\ntype UseDrawersProps = Pick<AppLayoutProps, 'drawers' | 'activeDrawerId' | 'onDrawerChange'> & {\n __disableRuntimeDrawers?: boolean;\n onGlobalDrawerFocus?: (drawerId: string, open: boolean) => void;\n onAddNewActiveDrawer?: (drawerId: string) => void;\n};\n\nexport function useDrawers(\n {\n drawers,\n activeDrawerId: controlledActiveDrawerId,\n onDrawerChange,\n onGlobalDrawerFocus,\n onAddNewActiveDrawer,\n __disableRuntimeDrawers: disableRuntimeDrawers,\n }: UseDrawersProps,\n ariaLabels: AppLayoutProps['ariaLabels'],\n toolsProps: ToolsProps\n) {\n const [activeDrawerId = null, setActiveDrawerId] = useControllable(controlledActiveDrawerId, onDrawerChange, null, {\n componentName: 'AppLayout',\n controlledProp: 'activeDrawerId',\n changeHandler: 'onChange',\n });\n const [activeGlobalDrawersIds, setActiveGlobalDrawersIds] = useState<Array<string>>([]);\n const [drawerSizes, setDrawerSizes] = useState<Record<string, number>>({});\n const [expandedDrawerId, setExpandedDrawerId] = useState<string | null>(null);\n // FIFO queue that keeps track of open drawers, where the first element is the most recently opened drawer\n const drawersOpenQueue = useRef<Array<string>>([]);\n\n function onActiveDrawerResize({ id, size }: { id: string; size: number }) {\n setDrawerSizes(oldSizes => ({ ...oldSizes, [id]: size }));\n fireNonCancelableEvent(activeDrawer?.onResize, { id, size });\n const activeGlobalDrawer = runtimeGlobalDrawers.find(drawer => drawer.id === id);\n fireNonCancelableEvent(activeGlobalDrawer?.onResize, { id, size });\n }\n\n function onActiveDrawerChange(\n newDrawerId: string | null,\n { initiatedByUserAction }: OnChangeParams = DEFAULT_ON_CHANGE_PARAMS\n ) {\n setActiveDrawerId(newDrawerId);\n if (newDrawerId) {\n onAddNewActiveDrawer?.(newDrawerId);\n }\n if (hasOwnDrawers) {\n fireNonCancelableEvent(onDrawerChange, { activeDrawerId: newDrawerId });\n } else if (!toolsProps.toolsHide) {\n toolsProps.onToolsToggle(newDrawerId === TOOLS_DRAWER_ID);\n }\n\n if (newDrawerId) {\n drawersOpenQueue.current = [newDrawerId, ...drawersOpenQueue.current];\n const newDrawer = [...runtimeDrawers.localBefore, ...runtimeDrawers.localAfter]?.find(\n drawer => drawer.id === newDrawerId\n );\n fireNonCancelableEvent(newDrawer?.onToggle, { isOpen: true, initiatedByUserAction });\n }\n\n if (activeDrawerId) {\n drawersOpenQueue.current = drawersOpenQueue.current.filter(id => id !== activeDrawerId);\n const activeDrawer = [...runtimeDrawers.localBefore, ...runtimeDrawers.localAfter]?.find(\n drawer => drawer.id === activeDrawerId\n );\n fireNonCancelableEvent(activeDrawer?.onToggle, { isOpen: false, initiatedByUserAction });\n }\n }\n\n function onActiveGlobalDrawersChange(\n drawerId: string,\n { initiatedByUserAction }: Partial<OnChangeParams> = DEFAULT_ON_CHANGE_PARAMS\n ) {\n const drawer = runtimeGlobalDrawers.find(drawer => drawer.id === drawerId);\n if (activeGlobalDrawersIds.includes(drawerId)) {\n setActiveGlobalDrawersIds(currentState => currentState.filter(id => id !== drawerId));\n onGlobalDrawerFocus?.(drawerId, false);\n drawersOpenQueue.current = drawersOpenQueue.current.filter(id => id !== drawerId);\n fireNonCancelableEvent(drawer?.onToggle, { isOpen: false, initiatedByUserAction });\n if (drawerId === expandedDrawerId) {\n setExpandedDrawerId(null);\n }\n } else if (drawerId) {\n onAddNewActiveDrawer?.(drawerId);\n setActiveGlobalDrawersIds(currentState => [drawerId, ...currentState].slice(0, DRAWERS_LIMIT!));\n onGlobalDrawerFocus?.(drawerId, true);\n drawersOpenQueue.current = [drawerId, ...drawersOpenQueue.current];\n fireNonCancelableEvent(drawer?.onToggle, { isOpen: true, initiatedByUserAction });\n }\n }\n\n const hasOwnDrawers = !!drawers;\n // support toolsOpen in runtime-drawers-only mode\n let activeDrawerIdResolved =\n toolsProps?.toolsOpen && !hasOwnDrawers\n ? TOOLS_DRAWER_ID\n : activeDrawerId !== TOOLS_DRAWER_ID\n ? activeDrawerId\n : null;\n const runtimeDrawers = useRuntimeDrawers(\n disableRuntimeDrawers,\n activeDrawerIdResolved,\n onActiveDrawerChange,\n activeGlobalDrawersIds,\n onActiveGlobalDrawersChange\n );\n const { localBefore, localAfter, global: runtimeGlobalDrawers } = runtimeDrawers;\n const combinedLocalDrawers = drawers\n ? [...localBefore, ...drawers, ...localAfter]\n : applyToolsDrawer(toolsProps, runtimeDrawers);\n const activeDrawer = combinedLocalDrawers?.find(drawer => drawer.id === activeDrawerIdResolved);\n // ensure that id is only defined when the drawer exists\n activeDrawerIdResolved = activeDrawer?.id ?? null;\n const activeGlobalDrawers = runtimeGlobalDrawers.filter(drawer => activeGlobalDrawersIds.includes(drawer.id));\n\n useDrawerRuntimeOpenClose(\n disableRuntimeDrawers,\n combinedLocalDrawers,\n runtimeGlobalDrawers,\n activeDrawerId,\n onActiveDrawerChange,\n activeGlobalDrawersIds,\n onActiveGlobalDrawersChange\n );\n\n const activeDrawerSize = activeDrawerIdResolved\n ? drawerSizes[activeDrawerIdResolved] ?? activeDrawer?.defaultSize ?? toolsProps.toolsWidth\n : toolsProps.toolsWidth;\n const activeGlobalDrawersSizes: Record<string, number> = activeGlobalDrawersIds.reduce(\n (acc, currentGlobalDrawerId) => {\n const currentGlobalDrawer = runtimeGlobalDrawers.find(drawer => drawer.id === currentGlobalDrawerId);\n return {\n ...acc,\n [currentGlobalDrawerId]:\n drawerSizes[currentGlobalDrawerId] ?? currentGlobalDrawer?.defaultSize ?? MIN_DRAWER_SIZE,\n };\n },\n {}\n );\n const minGlobalDrawersSizes: Record<string, number> = runtimeGlobalDrawers.reduce((acc, globalDrawer) => {\n return {\n ...acc,\n [globalDrawer.id]: Math.min(globalDrawer.defaultSize ?? MIN_DRAWER_SIZE, MIN_DRAWER_SIZE),\n };\n }, {});\n const minDrawerSize = Math.min(\n toolsProps?.toolsOpen ? toolsProps.toolsWidth : activeDrawer?.defaultSize ?? MIN_DRAWER_SIZE,\n MIN_DRAWER_SIZE\n );\n\n return {\n ariaLabelsWithDrawers: ariaLabels,\n drawers: combinedLocalDrawers || undefined,\n activeDrawer,\n activeDrawerId: activeDrawerIdResolved,\n globalDrawers: runtimeGlobalDrawers,\n activeGlobalDrawers: activeGlobalDrawers,\n activeGlobalDrawersIds,\n activeGlobalDrawersSizes,\n activeDrawerSize,\n minDrawerSize,\n minGlobalDrawersSizes,\n drawerSizes,\n drawersOpenQueue: drawersOpenQueue.current,\n onActiveDrawerChange,\n onActiveDrawerResize,\n onActiveGlobalDrawersChange,\n expandedDrawerId,\n setExpandedDrawerId,\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global-drawer.d.ts","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/drawer/global-drawer.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"global-drawer.d.ts","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/drawer/global-drawer.tsx"],"names":[],"mappings":";AAYA,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAOnE,UAAU,wCAAwC;IAChD,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,IAAI,EAAE,OAAO,CAAC;IACd,kBAAkB,EAAE,cAAc,GAAG,SAAS,CAAC;CAChD;AAED,iBAAS,mCAAmC,CAAC,EAC3C,kBAAkB,EAClB,IAAI,EACJ,kBAAkB,GACnB,EAAE,wCAAwC,eA6J1C;AAED,eAAe,mCAAmC,CAAC"}
|
|
@@ -6,6 +6,7 @@ import clsx from 'clsx';
|
|
|
6
6
|
import { InternalButton } from '../../../button/internal';
|
|
7
7
|
import PanelResizeHandle from '../../../internal/components/panel-resize-handle';
|
|
8
8
|
import customCssProps from '../../../internal/generated/custom-css-properties';
|
|
9
|
+
import { usePrevious } from '../../../internal/hooks/use-previous';
|
|
9
10
|
import { getLimitedValue } from '../../../split-panel/utils/size-utils';
|
|
10
11
|
import { getDrawerStyles } from '../compute-layout';
|
|
11
12
|
import { useResize } from './use-resize';
|
|
@@ -14,7 +15,7 @@ import testutilStyles from '../../test-classes/styles.css.js';
|
|
|
14
15
|
import styles from './styles.css.js';
|
|
15
16
|
function AppLayoutGlobalDrawerImplementation({ appLayoutInternals, show, activeGlobalDrawer, }) {
|
|
16
17
|
var _a, _b, _c, _d, _e, _f;
|
|
17
|
-
const { ariaLabels, globalDrawersFocusControl, isMobile, placement, onActiveGlobalDrawersChange, onActiveDrawerResize, minGlobalDrawersSizes, maxGlobalDrawersSizes, activeGlobalDrawersSizes, verticalOffsets, drawersOpenQueue, } = appLayoutInternals;
|
|
18
|
+
const { ariaLabels, globalDrawersFocusControl, isMobile, placement, onActiveGlobalDrawersChange, onActiveDrawerResize, minGlobalDrawersSizes, maxGlobalDrawersSizes, activeGlobalDrawersSizes, activeGlobalDrawers, verticalOffsets, drawersOpenQueue, expandedDrawerId, setExpandedDrawerId, } = appLayoutInternals;
|
|
18
19
|
const drawerRef = useRef(null);
|
|
19
20
|
const activeDrawerId = (_a = activeGlobalDrawer === null || activeGlobalDrawer === void 0 ? void 0 : activeGlobalDrawer.id) !== null && _a !== void 0 ? _a : '';
|
|
20
21
|
const computedAriaLabels = {
|
|
@@ -37,13 +38,19 @@ function AppLayoutGlobalDrawerImplementation({ appLayoutInternals, show, activeG
|
|
|
37
38
|
const size = getLimitedValue(minDrawerSize, activeDrawerSize, maxDrawerSize);
|
|
38
39
|
const lastOpenedDrawerId = drawersOpenQueue.length ? drawersOpenQueue[0] : null;
|
|
39
40
|
const hasTriggerButton = !!(activeGlobalDrawer === null || activeGlobalDrawer === void 0 ? void 0 : activeGlobalDrawer.trigger);
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
const isExpanded = (activeGlobalDrawer === null || activeGlobalDrawer === void 0 ? void 0 : activeGlobalDrawer.isExpandable) && expandedDrawerId === activeDrawerId;
|
|
42
|
+
const wasExpanded = usePrevious(isExpanded);
|
|
43
|
+
const animationDisabled = ((activeGlobalDrawer === null || activeGlobalDrawer === void 0 ? void 0 : activeGlobalDrawer.defaultActive) && !drawersOpenQueue.includes(activeGlobalDrawer.id)) ||
|
|
44
|
+
(wasExpanded && !isExpanded);
|
|
45
|
+
return (React.createElement(Transition, { nodeRef: drawerRef, in: show || isExpanded, appear: show || isExpanded, timeout: 0 }, state => {
|
|
46
|
+
var _a, _b, _c;
|
|
47
|
+
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'], {
|
|
44
48
|
[styles['drawer-hidden']]: !show,
|
|
45
|
-
[styles['last-opened']]: lastOpenedDrawerId === activeDrawerId,
|
|
49
|
+
[styles['last-opened']]: lastOpenedDrawerId === activeDrawerId || isExpanded,
|
|
46
50
|
[testutilStyles['active-drawer']]: show,
|
|
51
|
+
[styles['drawer-expanded']]: isExpanded,
|
|
52
|
+
[styles['has-next-siblings']]: activeGlobalDrawers.findIndex(drawer => drawer.id === activeDrawerId) + 1 <
|
|
53
|
+
activeGlobalDrawers.length,
|
|
47
54
|
}), ref: drawerRef, onBlur: e => {
|
|
48
55
|
// Drawers with trigger buttons follow this restore focus logic:
|
|
49
56
|
// If a previously focused element exists, restore focus on it; otherwise, focus on the associated trigger button.
|
|
@@ -57,16 +64,21 @@ function AppLayoutGlobalDrawerImplementation({ appLayoutInternals, show, activeG
|
|
|
57
64
|
globalDrawersFocusControl.loseFocus();
|
|
58
65
|
}
|
|
59
66
|
}, style: Object.assign({ blockSize: drawerHeight, insetBlockStart: drawerTopOffset }, (!isMobile && {
|
|
60
|
-
[customCssProps.drawerSize]: `${['entering', 'entered'].includes(state) ? size : 0}
|
|
67
|
+
[customCssProps.drawerSize]: `${['entering', 'entered'].includes(state) ? (isExpanded ? '100%' : size + 'px') : 0}`,
|
|
61
68
|
})), "data-testid": `awsui-app-layout-drawer-${activeDrawerId}` },
|
|
62
|
-
|
|
63
|
-
React.createElement(
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
React.createElement("div", { className: clsx(styles['global-drawer-wrapper']) },
|
|
70
|
+
!isMobile && React.createElement("div", { className: styles['drawer-gap'] }),
|
|
71
|
+
!isMobile && (activeGlobalDrawer === null || activeGlobalDrawer === void 0 ? void 0 : activeGlobalDrawer.resizable) && !isExpanded && (React.createElement("div", { className: styles['drawer-slider'] },
|
|
72
|
+
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 }))),
|
|
73
|
+
React.createElement("div", { className: clsx(styles['drawer-content-container'], sharedStyles['with-motion-horizontal']), "data-testid": `awsui-app-layout-drawer-content-${activeDrawerId}` },
|
|
74
|
+
React.createElement("div", { className: styles['drawer-actions'] },
|
|
75
|
+
!isMobile && (activeGlobalDrawer === null || activeGlobalDrawer === void 0 ? void 0 : activeGlobalDrawer.isExpandable) && (React.createElement("div", { className: styles['drawer-expanded-mode-button'] },
|
|
76
|
+
React.createElement(InternalButton, { ariaLabel: (_c = activeGlobalDrawer === null || activeGlobalDrawer === void 0 ? void 0 : activeGlobalDrawer.ariaLabels) === null || _c === void 0 ? void 0 : _c.expandedModeButton, className: testutilStyles['active-drawer-expanded-mode-button'], formAction: "none", ariaExpanded: isExpanded, iconName: isExpanded ? 'shrink' : 'expand', onClick: () => setExpandedDrawerId(isExpanded ? null : activeDrawerId), variant: "icon", analyticsAction: isExpanded ? 'expand' : 'collapse' }))),
|
|
77
|
+
React.createElement("div", { className: clsx(styles['drawer-close-button']) },
|
|
78
|
+
React.createElement(InternalButton, { ariaLabel: computedAriaLabels.closeButton, className: clsx({
|
|
79
|
+
[testutilStyles['active-drawer-close-button']]: activeDrawerId,
|
|
80
|
+
}), formAction: "none", iconName: isMobile ? 'close' : 'angle-right', onClick: () => onActiveGlobalDrawersChange(activeDrawerId, { initiatedByUserAction: true }), ref: refs === null || refs === void 0 ? void 0 : refs.close, variant: "icon", analyticsAction: "close" }))),
|
|
81
|
+
React.createElement("div", { className: styles['drawer-content'], style: { blockSize: drawerHeight } }, activeGlobalDrawer === null || activeGlobalDrawer === void 0 ? void 0 : activeGlobalDrawer.content)))));
|
|
70
82
|
}));
|
|
71
83
|
}
|
|
72
84
|
export default AppLayoutGlobalDrawerImplementation;
|
|
@@ -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;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,iBAAiB,MAAM,kDAAkD,CAAC;AACjF,OAAO,cAAc,MAAM,mDAAmD,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,C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AO,GACvB,CACE;gBACN,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,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 { InternalButton } from '../../../button/internal';\nimport PanelResizeHandle from '../../../internal/components/panel-resize-handle';\nimport customCssProps from '../../../internal/generated/custom-css-properties';\nimport { getLimitedValue } from '../../../split-panel/utils/size-utils';\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 verticalOffsets,\n drawersOpenQueue,\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 animationDisabled = activeGlobalDrawer?.defaultActive && !drawersOpenQueue.includes(activeGlobalDrawer.id);\n\n return (\n <Transition nodeRef={drawerRef} in={show} appear={show} 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 {\n [styles['drawer-hidden']]: !show,\n [styles['last-opened']]: lastOpenedDrawerId === activeDrawerId,\n [testutilStyles['active-drawer']]: show,\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) ? size : 0}px`,\n }),\n }}\n data-testid={`awsui-app-layout-drawer-${activeDrawerId}`}\n >\n {!isMobile && activeGlobalDrawer?.resizable && (\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 <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={clsx(styles['drawer-close-button'])}>\n <InternalButton\n ariaLabel={computedAriaLabels.closeButton}\n className={clsx({\n [testutilStyles['active-drawer-close-button']]: activeDrawerId,\n })}\n formAction=\"none\"\n iconName={isMobile ? 'close' : 'angle-right'}\n onClick={() => onActiveGlobalDrawersChange(activeDrawerId, { initiatedByUserAction: true })}\n ref={refs?.close}\n variant=\"icon\"\n analyticsAction=\"close\"\n />\n </div>\n <div className={styles['drawer-content']} style={{ blockSize: drawerHeight }}>\n {activeGlobalDrawer?.content}\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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O,EAAC,MAAM,EACd,eAAe,EAAE,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,GACnD,CACE,CACP;wBACD,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;4BACjD,oBAAC,cAAc,IACb,SAAS,EAAE,kBAAkB,CAAC,WAAW,EACzC,SAAS,EAAE,IAAI,CAAC;oCACd,CAAC,cAAc,CAAC,4BAA4B,CAAC,CAAC,EAAE,cAAc;iCAC/D,CAAC,EACF,UAAU,EAAC,MAAM,EACjB,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,aAAa,EAC5C,OAAO,EAAE,GAAG,EAAE,CAAC,2BAA2B,CAAC,cAAc,EAAE,EAAE,qBAAqB,EAAE,IAAI,EAAE,CAAC,EAC3F,GAAG,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,EAChB,OAAO,EAAC,MAAM,EACd,eAAe,EAAC,OAAO,GACvB,CACE,CACF;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 { InternalButton } from '../../../button/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 { 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 } = 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\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']]: 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 {!isMobile && activeGlobalDrawer?.isExpandable && (\n <div className={styles['drawer-expanded-mode-button']}>\n <InternalButton\n ariaLabel={activeGlobalDrawer?.ariaLabels?.expandedModeButton}\n className={testutilStyles['active-drawer-expanded-mode-button']}\n formAction=\"none\"\n ariaExpanded={isExpanded}\n iconName={isExpanded ? 'shrink' : 'expand'}\n onClick={() => setExpandedDrawerId(isExpanded ? null : activeDrawerId)}\n variant=\"icon\"\n analyticsAction={isExpanded ? 'expand' : 'collapse'}\n />\n </div>\n )}\n <div className={clsx(styles['drawer-close-button'])}>\n <InternalButton\n ariaLabel={computedAriaLabels.closeButton}\n className={clsx({\n [testutilStyles['active-drawer-close-button']]: activeDrawerId,\n })}\n formAction=\"none\"\n iconName={isMobile ? 'close' : 'angle-right'}\n onClick={() => onActiveGlobalDrawersChange(activeDrawerId, { initiatedByUserAction: true })}\n ref={refs?.close}\n variant=\"icon\"\n analyticsAction=\"close\"\n />\n </div>\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"]}
|
|
@@ -4,7 +4,7 @@ import React, { useRef } from 'react';
|
|
|
4
4
|
import { createWidgetizedComponent } from '../../../internal/widgets';
|
|
5
5
|
import AppLayoutGlobalDrawer from './global-drawer';
|
|
6
6
|
export function AppLayoutGlobalDrawersImplementation({ appLayoutInternals, }) {
|
|
7
|
-
const { globalDrawers, activeGlobalDrawersIds } = appLayoutInternals;
|
|
7
|
+
const { globalDrawers, activeGlobalDrawersIds, expandedDrawerId } = appLayoutInternals;
|
|
8
8
|
const openDrawersHistory = useRef(new Set());
|
|
9
9
|
if (!globalDrawers.length) {
|
|
10
10
|
return React.createElement(React.Fragment, null);
|
|
@@ -14,7 +14,7 @@ export function AppLayoutGlobalDrawersImplementation({ appLayoutInternals, }) {
|
|
|
14
14
|
(drawer.preserveInactiveContent && openDrawersHistory.current.has(drawer.id)))
|
|
15
15
|
.map(drawer => {
|
|
16
16
|
openDrawersHistory.current.add(drawer.id);
|
|
17
|
-
return (React.createElement(AppLayoutGlobalDrawer, { key: drawer.id, show: activeGlobalDrawersIds.includes(drawer.id), activeGlobalDrawer: drawer, appLayoutInternals: appLayoutInternals }));
|
|
17
|
+
return (React.createElement(AppLayoutGlobalDrawer, { key: drawer.id, show: activeGlobalDrawersIds.includes(drawer.id) && (!expandedDrawerId || drawer.id === expandedDrawerId), activeGlobalDrawer: drawer, appLayoutInternals: appLayoutInternals }));
|
|
18
18
|
})));
|
|
19
19
|
}
|
|
20
20
|
export const createWidgetizedAppLayoutGlobalDrawers = createWidgetizedComponent(AppLayoutGlobalDrawersImplementation);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global-drawers.js","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/drawer/global-drawers.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,OAAO,qBAAqB,MAAM,iBAAiB,CAAC;AAMpD,MAAM,UAAU,oCAAoC,CAAC,EACnD,kBAAkB,GACwB;IAC1C,MAAM,EAAE,aAAa,EAAE,sBAAsB,EAAE,GAAG,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"global-drawers.js","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/drawer/global-drawers.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,OAAO,qBAAqB,MAAM,iBAAiB,CAAC;AAMpD,MAAM,UAAU,oCAAoC,CAAC,EACnD,kBAAkB,GACwB;IAC1C,MAAM,EAAE,aAAa,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,GAAG,kBAAkB,CAAC;IACvF,MAAM,kBAAkB,GAAG,MAAM,CAAc,IAAI,GAAG,EAAE,CAAC,CAAC;IAE1D,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE;QACzB,OAAO,yCAAK,CAAC;KACd;IAED,OAAO,CACL,0CACG,aAAa;SACX,MAAM,CACL,MAAM,CAAC,EAAE,CACP,sBAAsB,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1C,CAAC,MAAM,CAAC,uBAAuB,IAAI,kBAAkB,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAChF;SACA,GAAG,CAAC,MAAM,CAAC,EAAE;QACZ,kBAAkB,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC1C,OAAO,CACL,oBAAC,qBAAqB,IACpB,GAAG,EAAE,MAAM,CAAC,EAAE,EACd,IAAI,EAAE,sBAAsB,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,gBAAgB,IAAI,MAAM,CAAC,EAAE,KAAK,gBAAgB,CAAC,EACzG,kBAAkB,EAAE,MAAM,EAC1B,kBAAkB,EAAE,kBAAkB,GACtC,CACH,CAAC;IACJ,CAAC,CAAC,CACH,CACJ,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,sCAAsC,GAAG,yBAAyB,CAAC,oCAAoC,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\n\nimport { createWidgetizedComponent } from '../../../internal/widgets';\nimport { AppLayoutInternals } from '../interfaces';\nimport AppLayoutGlobalDrawer from './global-drawer';\n\ninterface AppLayoutGlobalDrawersImplementationProps {\n appLayoutInternals: AppLayoutInternals;\n}\n\nexport function AppLayoutGlobalDrawersImplementation({\n appLayoutInternals,\n}: AppLayoutGlobalDrawersImplementationProps) {\n const { globalDrawers, activeGlobalDrawersIds, expandedDrawerId } = appLayoutInternals;\n const openDrawersHistory = useRef<Set<string>>(new Set());\n\n if (!globalDrawers.length) {\n return <></>;\n }\n\n return (\n <>\n {globalDrawers\n .filter(\n drawer =>\n activeGlobalDrawersIds.includes(drawer.id) ||\n (drawer.preserveInactiveContent && openDrawersHistory.current.has(drawer.id))\n )\n .map(drawer => {\n openDrawersHistory.current.add(drawer.id);\n return (\n <AppLayoutGlobalDrawer\n key={drawer.id}\n show={activeGlobalDrawersIds.includes(drawer.id) && (!expandedDrawerId || drawer.id === expandedDrawerId)}\n activeGlobalDrawer={drawer}\n appLayoutInternals={appLayoutInternals}\n />\n );\n })}\n </>\n );\n}\n\nexport const createWidgetizedAppLayoutGlobalDrawers = createWidgetizedComponent(AppLayoutGlobalDrawersImplementation);\n"]}
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"drawer": "
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"drawer-
|
|
9
|
-
"drawer-
|
|
10
|
-
"drawer-
|
|
11
|
-
"
|
|
12
|
-
"drawer-
|
|
13
|
-
"drawer-
|
|
4
|
+
"drawer": "awsui_drawer_12i0j_dowt3_189",
|
|
5
|
+
"with-expanded-motion": "awsui_with-expanded-motion_12i0j_dowt3_203",
|
|
6
|
+
"legacy": "awsui_legacy_12i0j_dowt3_217",
|
|
7
|
+
"last-opened": "awsui_last-opened_12i0j_dowt3_225",
|
|
8
|
+
"drawer-global": "awsui_drawer-global_12i0j_dowt3_229",
|
|
9
|
+
"drawer-expanded": "awsui_drawer-expanded_12i0j_dowt3_238",
|
|
10
|
+
"drawer-hidden": "awsui_drawer-hidden_12i0j_dowt3_242",
|
|
11
|
+
"has-next-siblings": "awsui_has-next-siblings_12i0j_dowt3_252",
|
|
12
|
+
"global-drawer-wrapper": "awsui_global-drawer-wrapper_12i0j_dowt3_252",
|
|
13
|
+
"drawer-content-container": "awsui_drawer-content-container_12i0j_dowt3_266",
|
|
14
|
+
"drawer-gap": "awsui_drawer-gap_12i0j_dowt3_269",
|
|
15
|
+
"drawer-close-button": "awsui_drawer-close-button_12i0j_dowt3_287",
|
|
16
|
+
"drawer-expanded-mode-button": "awsui_drawer-expanded-mode-button_12i0j_dowt3_293",
|
|
17
|
+
"drawer-content": "awsui_drawer-content_12i0j_dowt3_266",
|
|
18
|
+
"drawer-content-hidden": "awsui_drawer-content-hidden_12i0j_dowt3_305",
|
|
19
|
+
"drawer-slider": "awsui_drawer-slider_12i0j_dowt3_308",
|
|
20
|
+
"drawer-actions": "awsui_drawer-actions_12i0j_dowt3_357"
|
|
14
21
|
};
|
|
15
22
|
|