@cloudscape-design/components 3.0.669 → 3.0.671
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/utils/use-focus-control.d.ts +5 -3
- package/app-layout/utils/use-focus-control.d.ts.map +1 -1
- package/app-layout/utils/use-focus-control.js.map +1 -1
- package/app-layout/utils/use-split-panel-focus-control.d.ts +3 -3
- package/app-layout/utils/use-split-panel-focus-control.d.ts.map +1 -1
- package/app-layout/utils/use-split-panel-focus-control.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/index.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/index.js +9 -2
- package/app-layout/visual-refresh-toolbar/index.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/interfaces.d.ts +2 -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/toolbar/drawer-triggers.d.ts +17 -4
- package/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.js +10 -11
- package/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/toolbar/index.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/toolbar/index.js +9 -4
- package/app-layout/visual-refresh-toolbar/toolbar/index.js.map +1 -1
- package/breadcrumb-group/index.d.ts.map +1 -1
- package/breadcrumb-group/index.js +5 -0
- package/breadcrumb-group/index.js.map +1 -1
- package/date-range-picker/interfaces.d.ts +0 -3
- package/date-range-picker/interfaces.d.ts.map +1 -1
- package/date-range-picker/interfaces.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/manifest.json +1 -1
- package/internal/plugins/api.d.ts +4 -0
- package/internal/plugins/api.d.ts.map +1 -1
- package/internal/plugins/api.js +3 -0
- package/internal/plugins/api.js.map +1 -1
- package/internal/plugins/controllers/breadcrumbs.d.ts +31 -0
- package/internal/plugins/controllers/breadcrumbs.d.ts.map +1 -0
- package/internal/plugins/controllers/breadcrumbs.js +70 -0
- package/internal/plugins/controllers/breadcrumbs.js.map +1 -0
- package/internal/plugins/helpers/use-global-breadcrumbs.d.ts +4 -0
- package/internal/plugins/helpers/use-global-breadcrumbs.d.ts.map +1 -0
- package/internal/plugins/helpers/use-global-breadcrumbs.js +42 -0
- package/internal/plugins/helpers/use-global-breadcrumbs.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
|
-
|
|
2
|
+
export interface Focusable {
|
|
3
|
+
focus(): void;
|
|
4
|
+
}
|
|
3
5
|
export interface FocusControlRefs {
|
|
4
|
-
toggle: RefObject<
|
|
5
|
-
close: RefObject<
|
|
6
|
+
toggle: RefObject<Focusable>;
|
|
7
|
+
close: RefObject<Focusable>;
|
|
6
8
|
slider: RefObject<HTMLDivElement>;
|
|
7
9
|
}
|
|
8
10
|
export interface FocusControlState {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-focus-control.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/utils/use-focus-control.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAkC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"use-focus-control.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/utils/use-focus-control.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAkC,MAAM,OAAO,CAAC;AAElE,MAAM,WAAW,SAAS;IACxB,KAAK,IAAI,IAAI,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,KAAK,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC5B,MAAM,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,gBAAgB,CAAC;IACvB,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACpC,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,OAAO,EACf,YAAY,UAAQ,EACpB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,GAC7B,iBAAiB,CAmDnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-focus-control.js","sourceRoot":"","sources":["../../../../src/app-layout/utils/use-focus-control.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAa,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"use-focus-control.js","sourceRoot":"","sources":["../../../../src/app-layout/utils/use-focus-control.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAa,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAkBlE,MAAM,UAAU,eAAe,CAC7B,MAAe,EACf,YAAY,GAAG,KAAK,EACpB,cAA8B;IAE9B,MAAM,IAAI,GAAG;QACX,MAAM,EAAE,MAAM,CAAY,IAAI,CAAC;QAC/B,KAAK,EAAE,MAAM,CAAY,IAAI,CAAC;QAC9B,MAAM,EAAE,MAAM,CAAiB,IAAI,CAAC;KACrC,CAAC;IACF,MAAM,sBAAsB,GAAG,MAAM,EAAe,CAAC;IACrD,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAElC,MAAM,OAAO,GAAG,GAAG,EAAE;;QACnB,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE;YACxB,OAAO;SACR;QACD,IAAI,MAAM,EAAE;YACV,sBAAsB,CAAC,OAAO;gBAC5B,QAAQ,CAAC,aAAa,KAAK,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAE,QAAQ,CAAC,aAA6B,CAAC,CAAC,CAAC,SAAS,CAAC;YACjG,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;gBACvB,MAAA,IAAI,CAAC,MAAM,CAAC,OAAO,0CAAE,KAAK,EAAE,CAAC;aAC9B;iBAAM;gBACL,MAAA,IAAI,CAAC,KAAK,CAAC,OAAO,0CAAE,KAAK,EAAE,CAAC;aAC7B;SACF;aAAM;YACL,IAAI,YAAY,IAAI,sBAAsB,CAAC,OAAO,IAAI,QAAQ,CAAC,QAAQ,CAAC,sBAAsB,CAAC,OAAO,CAAC,EAAE;gBACvG,sBAAsB,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;gBACvC,sBAAsB,CAAC,OAAO,GAAG,SAAS,CAAC;aAC5C;iBAAM;gBACL,MAAA,IAAI,CAAC,MAAM,CAAC,OAAO,0CAAE,KAAK,EAAE,CAAC;aAC9B;SACF;QACD,WAAW,CAAC,OAAO,GAAG,KAAK,CAAC;IAC9B,CAAC,CAAC;IAEF,MAAM,QAAQ,GAAG,CAAC,KAAe,EAAE,EAAE;QACnC,WAAW,CAAC,OAAO,GAAG,IAAI,CAAC;QAC3B,IAAI,KAAK,IAAI,MAAM,EAAE;YACnB,OAAO,EAAE,CAAC;SACX;IACH,CAAC,CAAC;IAEF,uDAAuD;IACvD,SAAS,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC;IAE7C,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE;QACjC,sBAAsB,CAAC,OAAO,GAAG,SAAS,CAAC;IAC7C,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACL,IAAI;QACJ,QAAQ;QACR,SAAS;KACV,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { RefObject, useCallback, useEffect, useRef } from 'react';\n\nexport interface Focusable {\n focus(): void;\n}\n\nexport interface FocusControlRefs {\n toggle: RefObject<Focusable>;\n close: RefObject<Focusable>;\n slider: RefObject<HTMLDivElement>;\n}\n\nexport interface FocusControlState {\n refs: FocusControlRefs;\n setFocus: (force?: boolean) => void;\n loseFocus: () => void;\n}\n\nexport function useFocusControl(\n isOpen: boolean,\n restoreFocus = false,\n activeDrawerId?: string | null\n): FocusControlState {\n const refs = {\n toggle: useRef<Focusable>(null),\n close: useRef<Focusable>(null),\n slider: useRef<HTMLDivElement>(null),\n };\n const previousFocusedElement = useRef<HTMLElement>();\n const shouldFocus = useRef(false);\n\n const doFocus = () => {\n if (!shouldFocus.current) {\n return;\n }\n if (isOpen) {\n previousFocusedElement.current =\n document.activeElement !== document.body ? (document.activeElement as HTMLElement) : undefined;\n if (refs.slider.current) {\n refs.slider.current?.focus();\n } else {\n refs.close.current?.focus();\n }\n } else {\n if (restoreFocus && previousFocusedElement.current && document.contains(previousFocusedElement.current)) {\n previousFocusedElement.current.focus();\n previousFocusedElement.current = undefined;\n } else {\n refs.toggle.current?.focus();\n }\n }\n shouldFocus.current = false;\n };\n\n const setFocus = (force?: boolean) => {\n shouldFocus.current = true;\n if (force && isOpen) {\n doFocus();\n }\n };\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(doFocus, [isOpen, activeDrawerId]);\n\n const loseFocus = useCallback(() => {\n previousFocusedElement.current = undefined;\n }, []);\n\n return {\n refs,\n setFocus,\n loseFocus,\n };\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DependencyList, RefObject } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { Focusable } from './use-focus-control';
|
|
3
3
|
export type SplitPanelLastInteraction = {
|
|
4
4
|
type: 'open';
|
|
5
5
|
} | {
|
|
@@ -8,9 +8,9 @@ export type SplitPanelLastInteraction = {
|
|
|
8
8
|
type: 'position';
|
|
9
9
|
};
|
|
10
10
|
export interface SplitPanelFocusControlRefs {
|
|
11
|
-
toggle: RefObject<
|
|
11
|
+
toggle: RefObject<Focusable>;
|
|
12
12
|
slider: RefObject<HTMLDivElement>;
|
|
13
|
-
preferences: RefObject<
|
|
13
|
+
preferences: RefObject<Focusable>;
|
|
14
14
|
}
|
|
15
15
|
export interface SplitPanelFocusControlState {
|
|
16
16
|
refs: SplitPanelFocusControlRefs;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-split-panel-focus-control.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/utils/use-split-panel-focus-control.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAqB,MAAM,OAAO,CAAC;AACrE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"use-split-panel-focus-control.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/utils/use-split-panel-focus-control.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAqB,MAAM,OAAO,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,MAAM,MAAM,yBAAyB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC;AAEpG,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,MAAM,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC;IAClC,WAAW,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CACnC;AACD,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,0BAA0B,CAAC;IACjC,kBAAkB,EAAE,CAAC,WAAW,EAAE,yBAAyB,KAAK,IAAI,CAAC;CACtE;AAED,wBAAgB,yBAAyB,CAAC,YAAY,EAAE,cAAc,GAAG,2BAA2B,CA4BnG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-split-panel-focus-control.js","sourceRoot":"","sources":["../../../../src/app-layout/utils/use-split-panel-focus-control.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAA6B,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAerE,MAAM,UAAU,yBAAyB,CAAC,YAA4B;IACpE,MAAM,IAAI,GAAG;QACX,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"use-split-panel-focus-control.js","sourceRoot":"","sources":["../../../../src/app-layout/utils/use-split-panel-focus-control.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAA6B,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAerE,MAAM,UAAU,yBAAyB,CAAC,YAA4B;IACpE,MAAM,IAAI,GAAG;QACX,MAAM,EAAE,MAAM,CAAY,IAAI,CAAC;QAC/B,MAAM,EAAE,MAAM,CAAiB,IAAI,CAAC;QACpC,WAAW,EAAE,MAAM,CAAY,IAAI,CAAC;KACrC,CAAC;IACF,MAAM,eAAe,GAAG,MAAM,CAAmC,IAAI,CAAC,CAAC;IAEvE,SAAS,CAAC,GAAG,EAAE;;QACb,QAAQ,MAAA,eAAe,CAAC,OAAO,0CAAE,IAAI,EAAE;YACrC,KAAK,MAAM;gBACT,MAAA,IAAI,CAAC,MAAM,CAAC,OAAO,0CAAE,KAAK,EAAE,CAAC;gBAC7B,MAAM;YACR,KAAK,OAAO;gBACV,MAAA,IAAI,CAAC,MAAM,CAAC,OAAO,0CAAE,KAAK,EAAE,CAAC;gBAC7B,MAAM;YACR,KAAK,UAAU;gBACb,MAAA,IAAI,CAAC,WAAW,CAAC,OAAO,0CAAE,KAAK,EAAE,CAAC;gBAClC,MAAM;SACT;QACD,eAAe,CAAC,OAAO,GAAG,IAAI,CAAC;QAC/B,uDAAuD;IACzD,CAAC,EAAE,YAAY,CAAC,CAAC;IAEjB,OAAO;QACL,IAAI;QACJ,kBAAkB,EAAE,CAAC,WAAsC,EAAE,EAAE,CAAC,CAAC,eAAe,CAAC,OAAO,GAAG,WAAW,CAAC;KACxG,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { DependencyList, RefObject, useEffect, useRef } from 'react';\nimport { Focusable } from './use-focus-control';\n\nexport type SplitPanelLastInteraction = { type: 'open' } | { type: 'close' } | { type: 'position' };\n\nexport interface SplitPanelFocusControlRefs {\n toggle: RefObject<Focusable>;\n slider: RefObject<HTMLDivElement>;\n preferences: RefObject<Focusable>;\n}\nexport interface SplitPanelFocusControlState {\n refs: SplitPanelFocusControlRefs;\n setLastInteraction: (interaction: SplitPanelLastInteraction) => void;\n}\n\nexport function useSplitPanelFocusControl(dependencies: DependencyList): SplitPanelFocusControlState {\n const refs = {\n toggle: useRef<Focusable>(null),\n slider: useRef<HTMLDivElement>(null),\n preferences: useRef<Focusable>(null),\n };\n const lastInteraction = useRef<SplitPanelLastInteraction | null>(null);\n\n useEffect(() => {\n switch (lastInteraction.current?.type) {\n case 'open':\n refs.slider.current?.focus();\n break;\n case 'close':\n refs.toggle.current?.focus();\n break;\n case 'position':\n refs.preferences.current?.focus();\n break;\n }\n lastInteraction.current = null;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, dependencies);\n\n return {\n refs,\n setLastInteraction: (interaction: SplitPanelLastInteraction) => (lastInteraction.current = interaction),\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh-toolbar/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAQ7D,OAAO,EAAE,cAAc,EAA8B,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh-toolbar/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAQ7D,OAAO,EAAE,cAAc,EAA8B,MAAM,eAAe,CAAC;AAkB3E,QAAA,MAAM,6BAA6B;;;;;;;;;;;;;;;4CAqRlC,CAAC;AAEF,eAAe,6BAA6B,CAAC"}
|
|
@@ -14,6 +14,7 @@ import { getSplitPanelDefaultSize } from '../../split-panel/utils/size-utils';
|
|
|
14
14
|
import globalVars from '../../internal/styles/global-vars';
|
|
15
15
|
import { SkeletonLayout } from './skeleton';
|
|
16
16
|
import { AppLayoutDrawer, AppLayoutNavigation, AppLayoutNotifications, AppLayoutSplitPanelBottom, AppLayoutSplitPanelSide, AppLayoutToolbar, } from './internal';
|
|
17
|
+
import { useGetGlobalBreadcrumbs } from '../../internal/plugins/helpers/use-global-breadcrumbs';
|
|
17
18
|
const AppLayoutVisualRefreshToolbar = React.forwardRef((_a, forwardRef) => {
|
|
18
19
|
var _b;
|
|
19
20
|
var { ariaLabels, contentHeader, content, navigationOpen, navigationWidth, navigation, navigationHide, onNavigationChange, tools, toolsOpen: controlledToolsOpen, onToolsChange, toolsHide, toolsWidth, contentType, headerVariant, breadcrumbs, notifications, stickyNotifications, splitPanelPreferences: controlledSplitPanelPreferences, splitPanelOpen: controlledSplitPanelOpen, splitPanel, splitPanelSize: controlledSplitPanelSize, onSplitPanelToggle, onSplitPanelResize, onSplitPanelPreferencesChange, disableContentPaddings, minContentWidth, maxContentWidth, placement } = _a, rest = __rest(_a, ["ariaLabels", "contentHeader", "content", "navigationOpen", "navigationWidth", "navigation", "navigationHide", "onNavigationChange", "tools", "toolsOpen", "onToolsChange", "toolsHide", "toolsWidth", "contentType", "headerVariant", "breadcrumbs", "notifications", "stickyNotifications", "splitPanelPreferences", "splitPanelOpen", "splitPanel", "splitPanelSize", "onSplitPanelToggle", "onSplitPanelResize", "onSplitPanelPreferencesChange", "disableContentPaddings", "minContentWidth", "maxContentWidth", "placement"]);
|
|
@@ -94,8 +95,13 @@ const AppLayoutVisualRefreshToolbar = React.forwardRef((_a, forwardRef) => {
|
|
|
94
95
|
splitPanelOpen,
|
|
95
96
|
splitPanelPosition: splitPanelPreferences === null || splitPanelPreferences === void 0 ? void 0 : splitPanelPreferences.position,
|
|
96
97
|
});
|
|
97
|
-
const
|
|
98
|
-
|
|
98
|
+
const discoveredBreadcrumbs = useGetGlobalBreadcrumbs();
|
|
99
|
+
const hasToolbar = Boolean(!embeddedViewMode &&
|
|
100
|
+
(resolvedNavigation ||
|
|
101
|
+
breadcrumbs ||
|
|
102
|
+
discoveredBreadcrumbs ||
|
|
103
|
+
splitPanelToggleConfig.displayed ||
|
|
104
|
+
drawers.length > 0));
|
|
99
105
|
const verticalOffsets = computeVerticalLayout({
|
|
100
106
|
topOffset: placement.insetBlockStart,
|
|
101
107
|
hasToolbar: hasToolbar && toolbarState !== 'hide',
|
|
@@ -108,6 +114,7 @@ const AppLayoutVisualRefreshToolbar = React.forwardRef((_a, forwardRef) => {
|
|
|
108
114
|
headerVariant,
|
|
109
115
|
isMobile,
|
|
110
116
|
breadcrumbs,
|
|
117
|
+
discoveredBreadcrumbs,
|
|
111
118
|
stickyNotifications,
|
|
112
119
|
navigationOpen,
|
|
113
120
|
navigation: resolvedNavigation,
|
|
@@ -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,mBAAmB,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,yBAAyB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BAAkB,GAAI,EAClF,SAAS,EAAE,CAAC,CAAC,YAAY,EACzB,UAAU,EAAE,gBAAgB,EAC5B,cAAc,EACZ,kBAAkB,KAAK,MAAM;YAC7B,UAAU,IAAI,CACZ,oBAAC,uBAAuB,IAAC,kBAAkB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,mBAAmB,IACtG,UAAU,CACa,CAC3B,EAEH,gBAAgB,EACd,kBAAkB,KAAK,QAAQ,IAAI,CACjC,oBAAC,yBAAyB,IACxB,kBAAkB,EAAE,kBAAkB,EACtC,mBAAmB,EAAE,mBAAmB,IAEvC,UAAU,CACe,CAC7B,EAEH,cAAc,EAAE,cAAc,EAC9B,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,eAAe,EAAE,eAAe,EAChC,sBAAsB,EAAE,sBAAsB,GAC9C,CACH,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, { useImperativeHandle, useState } from 'react';\nimport { useControllable } from '../../internal/hooks/use-controllable';\nimport { fireNonCancelableEvent } from '../../internal/events';\nimport { useFocusControl } from '../utils/use-focus-control';\nimport { useMobile } from '../../internal/hooks/use-mobile';\nimport { useSplitPanelFocusControl } from '../utils/use-split-panel-focus-control';\nimport { useDrawers } from '../utils/use-drawers';\nimport { useUniqueId } from '../../internal/hooks/use-unique-id';\nimport { AppLayoutProps, AppLayoutPropsWithDefaults } from '../interfaces';\nimport { computeHorizontalLayout, computeVerticalLayout } from './compute-layout';\nimport { SplitPanelProviderProps } from '../split-panel';\nimport { SplitPanelSideToggleProps } from '../../internal/context/split-panel-context';\nimport { getSplitPanelDefaultSize } from '../../split-panel/utils/size-utils';\nimport globalVars from '../../internal/styles/global-vars';\nimport { SkeletonLayout } from './skeleton';\nimport {\n AppLayoutDrawer,\n AppLayoutNavigation,\n AppLayoutNotifications,\n AppLayoutSplitPanelBottom,\n AppLayoutSplitPanelSide,\n AppLayoutToolbar,\n} from './internal';\nimport { AppLayoutInternals } from './interfaces';\n\nconst AppLayoutVisualRefreshToolbar = React.forwardRef(\n (\n {\n ariaLabels,\n contentHeader,\n content,\n navigationOpen,\n navigationWidth,\n navigation,\n navigationHide,\n onNavigationChange,\n tools,\n toolsOpen: controlledToolsOpen,\n onToolsChange,\n toolsHide,\n toolsWidth,\n contentType,\n headerVariant,\n breadcrumbs,\n notifications,\n stickyNotifications,\n splitPanelPreferences: controlledSplitPanelPreferences,\n splitPanelOpen: controlledSplitPanelOpen,\n splitPanel,\n splitPanelSize: controlledSplitPanelSize,\n onSplitPanelToggle,\n onSplitPanelResize,\n onSplitPanelPreferencesChange,\n disableContentPaddings,\n minContentWidth,\n maxContentWidth,\n placement,\n ...rest\n }: AppLayoutPropsWithDefaults,\n forwardRef: React.Ref<AppLayoutProps.Ref>\n ) => {\n const isMobile = useMobile();\n const embeddedViewMode = (rest as any).__embeddedViewMode;\n const splitPanelControlId = useUniqueId('split-panel');\n const [toolbarState, setToolbarState] = useState<'show' | 'hide'>('show');\n const [toolbarHeight, setToolbarHeight] = useState(0);\n const [notificationsHeight, setNotificationsHeight] = useState(0);\n\n const onNavigationToggle = (open: boolean) => {\n fireNonCancelableEvent(onNavigationChange, { open });\n };\n\n const [toolsOpen = false, setToolsOpen] = useControllable(controlledToolsOpen, onToolsChange, false, {\n componentName: 'AppLayout',\n controlledProp: 'toolsOpen',\n changeHandler: 'onToolsChange',\n });\n const onToolsToggle = (open: boolean) => {\n setToolsOpen(open);\n drawersFocusControl.setFocus();\n fireNonCancelableEvent(onToolsChange, { open });\n };\n\n const {\n drawers,\n activeDrawer,\n minDrawerSize,\n activeDrawerSize,\n ariaLabelsWithDrawers,\n onActiveDrawerChange,\n onActiveDrawerResize,\n } = useDrawers(rest, ariaLabels, {\n ariaLabels,\n toolsHide,\n toolsOpen,\n tools,\n toolsWidth,\n onToolsToggle,\n });\n\n const [splitPanelOpen = false, setSplitPanelOpen] = useControllable(\n controlledSplitPanelOpen,\n onSplitPanelToggle,\n false,\n {\n componentName: 'AppLayout',\n controlledProp: 'splitPanelOpen',\n changeHandler: 'onSplitPanelToggle',\n }\n );\n\n const onSplitPanelToggleHandler = () => {\n setSplitPanelOpen(!splitPanelOpen);\n fireNonCancelableEvent(onSplitPanelToggle, { open: !splitPanelOpen });\n };\n\n const [splitPanelPreferences, setSplitPanelPreferences] = useControllable(\n controlledSplitPanelPreferences,\n onSplitPanelPreferencesChange,\n undefined,\n {\n componentName: 'AppLayout',\n controlledProp: 'splitPanelPreferences',\n changeHandler: 'onSplitPanelPreferencesChange',\n }\n );\n\n const onSplitPanelPreferencesChangeHandler = (detail: AppLayoutProps.SplitPanelPreferences) => {\n setSplitPanelPreferences(detail);\n splitPanelFocusControl.setLastInteraction({ type: 'position' });\n fireNonCancelableEvent(onSplitPanelPreferencesChange, detail);\n };\n\n const [splitPanelSize = 0, setSplitPanelSize] = useControllable(\n controlledSplitPanelSize,\n onSplitPanelResize,\n getSplitPanelDefaultSize(splitPanelPreferences?.position ?? 'bottom'),\n { componentName: 'AppLayout', controlledProp: 'splitPanelSize', changeHandler: 'onSplitPanelResize' }\n );\n\n const [splitPanelReportedSize, setSplitPanelReportedSize] = useState(0);\n\n const onSplitPanelResizeHandler = (size: number) => {\n setSplitPanelSize(size);\n fireNonCancelableEvent(onSplitPanelResize, { size });\n };\n\n const [splitPanelToggleConfig, setSplitPanelToggleConfig] = useState<SplitPanelSideToggleProps>({\n ariaLabel: undefined,\n displayed: false,\n });\n\n const drawersFocusControl = useFocusControl(!!activeDrawer?.id);\n const navigationFocusControl = useFocusControl(navigationOpen);\n const splitPanelFocusControl = useSplitPanelFocusControl([splitPanelPreferences, splitPanelOpen]);\n\n useImperativeHandle(forwardRef, () => ({\n closeNavigationIfNecessary: () => isMobile && onNavigationToggle(false),\n openTools: () => onToolsToggle(true),\n focusToolsClose: () => drawersFocusControl.setFocus(true),\n focusActiveDrawer: () => drawersFocusControl.setFocus(true),\n focusSplitPanel: () => splitPanelFocusControl.refs.slider.current?.focus(),\n }));\n\n const resolvedNavigation = navigationHide ? null : navigation ?? <></>;\n const { maxDrawerSize, maxSplitPanelSize, splitPanelForcedPosition, splitPanelPosition } = computeHorizontalLayout({\n activeDrawerSize,\n splitPanelSize,\n minContentWidth,\n navigationOpen: !!resolvedNavigation && navigationOpen,\n navigationWidth,\n placement,\n splitPanelOpen,\n splitPanelPosition: splitPanelPreferences?.position,\n });\n\n const hasToolbar =\n !embeddedViewMode &&\n (!!resolvedNavigation || !!breadcrumbs || splitPanelToggleConfig.displayed || drawers!.length > 0);\n\n const verticalOffsets = computeVerticalLayout({\n topOffset: placement.insetBlockStart,\n hasToolbar: hasToolbar && toolbarState !== 'hide',\n notificationsHeight: notificationsHeight ?? 0,\n toolbarHeight: toolbarHeight ?? 0,\n stickyNotifications: !!stickyNotifications,\n });\n\n const appLayoutInternals: AppLayoutInternals = {\n ariaLabels: ariaLabelsWithDrawers,\n headerVariant,\n isMobile,\n breadcrumbs,\n stickyNotifications,\n navigationOpen,\n navigation: resolvedNavigation,\n navigationFocusControl,\n activeDrawer,\n activeDrawerSize,\n minDrawerSize,\n maxDrawerSize,\n drawers: drawers!,\n drawersFocusControl,\n splitPanelPosition,\n splitPanelToggleConfig,\n splitPanelOpen,\n splitPanelControlId,\n splitPanelFocusControl,\n placement,\n toolbarState,\n setToolbarState,\n verticalOffsets,\n setToolbarHeight,\n setNotificationsHeight,\n onSplitPanelToggle: onSplitPanelToggleHandler,\n onNavigationToggle,\n onActiveDrawerChange,\n onActiveDrawerResize,\n };\n\n const splitPanelInternals: SplitPanelProviderProps = {\n bottomOffset: 0,\n getMaxHeight: () => {\n const availableHeight =\n document.documentElement.clientHeight - placement.insetBlockStart - placement.insetBlockEnd;\n // If the page is likely zoomed in at 200%, allow the split panel to fill the content area.\n return availableHeight < 400 ? availableHeight - 40 : availableHeight - 250;\n },\n maxWidth: maxSplitPanelSize,\n isForcedPosition: splitPanelForcedPosition,\n isOpen: splitPanelOpen,\n leftOffset: 0,\n onPreferencesChange: onSplitPanelPreferencesChangeHandler,\n onResize: onSplitPanelResizeHandler,\n onToggle: onSplitPanelToggleHandler,\n position: splitPanelPosition,\n reportSize: size => setSplitPanelReportedSize(size),\n reportHeaderHeight: () => {\n /*unused in this design*/\n },\n rightOffset: 0,\n size: splitPanelSize,\n topOffset: 0,\n setSplitPanelToggle: setSplitPanelToggleConfig,\n refs: splitPanelFocusControl.refs,\n };\n\n return (\n <SkeletonLayout\n style={{\n [globalVars.stickyVerticalTopOffset]: `${verticalOffsets.header}px`,\n [globalVars.stickyVerticalBottomOffset]: `${placement.insetBlockEnd}px`,\n paddingBlockEnd: splitPanelOpen ? splitPanelReportedSize : '',\n }}\n toolbar={hasToolbar && <AppLayoutToolbar appLayoutInternals={appLayoutInternals} />}\n notifications={\n notifications && (\n <AppLayoutNotifications appLayoutInternals={appLayoutInternals}>{notifications}</AppLayoutNotifications>\n )\n }\n contentHeader={contentHeader}\n content={content}\n navigation={resolvedNavigation && <AppLayoutNavigation appLayoutInternals={appLayoutInternals} />}\n navigationOpen={navigationOpen}\n navigationWidth={navigationWidth}\n tools={activeDrawer && <AppLayoutDrawer appLayoutInternals={appLayoutInternals} />}\n toolsOpen={!!activeDrawer}\n toolsWidth={activeDrawerSize}\n sideSplitPanel={\n splitPanelPosition === 'side' &&\n splitPanel && (\n <AppLayoutSplitPanelSide appLayoutInternals={appLayoutInternals} splitPanelInternals={splitPanelInternals}>\n {splitPanel}\n </AppLayoutSplitPanelSide>\n )\n }\n bottomSplitPanel={\n splitPanelPosition === 'bottom' && (\n <AppLayoutSplitPanelBottom\n appLayoutInternals={appLayoutInternals}\n splitPanelInternals={splitPanelInternals}\n >\n {splitPanel}\n </AppLayoutSplitPanelBottom>\n )\n }\n splitPanelOpen={splitPanelOpen}\n placement={placement}\n contentType={contentType}\n maxContentWidth={maxContentWidth}\n disableContentPaddings={disableContentPaddings}\n />\n );\n }\n);\n\nexport default AppLayoutVisualRefreshToolbar;\n"]}
|
|
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,mBAAmB,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAEjE,OAAO,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAGlF,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,UAAU,MAAM,mCAAmC,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,sBAAsB,EACtB,yBAAyB,EACzB,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,uBAAuB,EAAE,MAAM,uDAAuD,CAAC;AAEhG,MAAM,6BAA6B,GAAG,KAAK,CAAC,UAAU,CACpD,CACE,EA+B6B,EAC7B,UAAyC,EACzC,EAAE;;QAjCF,EACE,UAAU,EACV,aAAa,EACb,OAAO,EACP,cAAc,EACd,eAAe,EACf,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,KAAK,EACL,SAAS,EAAE,mBAAmB,EA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. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useImperativeHandle, useState } from 'react';\nimport { useControllable } from '../../internal/hooks/use-controllable';\nimport { fireNonCancelableEvent } from '../../internal/events';\nimport { useFocusControl } from '../utils/use-focus-control';\nimport { useMobile } from '../../internal/hooks/use-mobile';\nimport { useSplitPanelFocusControl } from '../utils/use-split-panel-focus-control';\nimport { useDrawers } from '../utils/use-drawers';\nimport { useUniqueId } from '../../internal/hooks/use-unique-id';\nimport { AppLayoutProps, AppLayoutPropsWithDefaults } from '../interfaces';\nimport { computeHorizontalLayout, computeVerticalLayout } from './compute-layout';\nimport { SplitPanelProviderProps } from '../split-panel';\nimport { SplitPanelSideToggleProps } from '../../internal/context/split-panel-context';\nimport { getSplitPanelDefaultSize } from '../../split-panel/utils/size-utils';\nimport globalVars from '../../internal/styles/global-vars';\nimport { SkeletonLayout } from './skeleton';\nimport {\n AppLayoutDrawer,\n AppLayoutNavigation,\n AppLayoutNotifications,\n AppLayoutSplitPanelBottom,\n AppLayoutSplitPanelSide,\n AppLayoutToolbar,\n} from './internal';\nimport { AppLayoutInternals } from './interfaces';\nimport { useGetGlobalBreadcrumbs } from '../../internal/plugins/helpers/use-global-breadcrumbs';\n\nconst AppLayoutVisualRefreshToolbar = React.forwardRef(\n (\n {\n ariaLabels,\n contentHeader,\n content,\n navigationOpen,\n navigationWidth,\n navigation,\n navigationHide,\n onNavigationChange,\n tools,\n toolsOpen: controlledToolsOpen,\n onToolsChange,\n toolsHide,\n toolsWidth,\n contentType,\n headerVariant,\n breadcrumbs,\n notifications,\n stickyNotifications,\n splitPanelPreferences: controlledSplitPanelPreferences,\n splitPanelOpen: controlledSplitPanelOpen,\n splitPanel,\n splitPanelSize: controlledSplitPanelSize,\n onSplitPanelToggle,\n onSplitPanelResize,\n onSplitPanelPreferencesChange,\n disableContentPaddings,\n minContentWidth,\n maxContentWidth,\n placement,\n ...rest\n }: AppLayoutPropsWithDefaults,\n forwardRef: React.Ref<AppLayoutProps.Ref>\n ) => {\n const isMobile = useMobile();\n const embeddedViewMode = (rest as any).__embeddedViewMode;\n const splitPanelControlId = useUniqueId('split-panel');\n const [toolbarState, setToolbarState] = useState<'show' | 'hide'>('show');\n const [toolbarHeight, setToolbarHeight] = useState(0);\n const [notificationsHeight, setNotificationsHeight] = useState(0);\n\n const onNavigationToggle = (open: boolean) => {\n fireNonCancelableEvent(onNavigationChange, { open });\n };\n\n const [toolsOpen = false, setToolsOpen] = useControllable(controlledToolsOpen, onToolsChange, false, {\n componentName: 'AppLayout',\n controlledProp: 'toolsOpen',\n changeHandler: 'onToolsChange',\n });\n const onToolsToggle = (open: boolean) => {\n setToolsOpen(open);\n drawersFocusControl.setFocus();\n fireNonCancelableEvent(onToolsChange, { open });\n };\n\n const {\n drawers,\n activeDrawer,\n minDrawerSize,\n activeDrawerSize,\n ariaLabelsWithDrawers,\n onActiveDrawerChange,\n onActiveDrawerResize,\n } = useDrawers(rest, ariaLabels, {\n ariaLabels,\n toolsHide,\n toolsOpen,\n tools,\n toolsWidth,\n onToolsToggle,\n });\n\n const [splitPanelOpen = false, setSplitPanelOpen] = useControllable(\n controlledSplitPanelOpen,\n onSplitPanelToggle,\n false,\n {\n componentName: 'AppLayout',\n controlledProp: 'splitPanelOpen',\n changeHandler: 'onSplitPanelToggle',\n }\n );\n\n const onSplitPanelToggleHandler = () => {\n setSplitPanelOpen(!splitPanelOpen);\n fireNonCancelableEvent(onSplitPanelToggle, { open: !splitPanelOpen });\n };\n\n const [splitPanelPreferences, setSplitPanelPreferences] = useControllable(\n controlledSplitPanelPreferences,\n onSplitPanelPreferencesChange,\n undefined,\n {\n componentName: 'AppLayout',\n controlledProp: 'splitPanelPreferences',\n changeHandler: 'onSplitPanelPreferencesChange',\n }\n );\n\n const onSplitPanelPreferencesChangeHandler = (detail: AppLayoutProps.SplitPanelPreferences) => {\n setSplitPanelPreferences(detail);\n splitPanelFocusControl.setLastInteraction({ type: 'position' });\n fireNonCancelableEvent(onSplitPanelPreferencesChange, detail);\n };\n\n const [splitPanelSize = 0, setSplitPanelSize] = useControllable(\n controlledSplitPanelSize,\n onSplitPanelResize,\n getSplitPanelDefaultSize(splitPanelPreferences?.position ?? 'bottom'),\n { componentName: 'AppLayout', controlledProp: 'splitPanelSize', changeHandler: 'onSplitPanelResize' }\n );\n\n const [splitPanelReportedSize, setSplitPanelReportedSize] = useState(0);\n\n const onSplitPanelResizeHandler = (size: number) => {\n setSplitPanelSize(size);\n fireNonCancelableEvent(onSplitPanelResize, { size });\n };\n\n const [splitPanelToggleConfig, setSplitPanelToggleConfig] = useState<SplitPanelSideToggleProps>({\n ariaLabel: undefined,\n displayed: false,\n });\n\n const drawersFocusControl = useFocusControl(!!activeDrawer?.id);\n const navigationFocusControl = useFocusControl(navigationOpen);\n const splitPanelFocusControl = useSplitPanelFocusControl([splitPanelPreferences, splitPanelOpen]);\n\n useImperativeHandle(forwardRef, () => ({\n closeNavigationIfNecessary: () => isMobile && onNavigationToggle(false),\n openTools: () => onToolsToggle(true),\n focusToolsClose: () => drawersFocusControl.setFocus(true),\n focusActiveDrawer: () => drawersFocusControl.setFocus(true),\n focusSplitPanel: () => splitPanelFocusControl.refs.slider.current?.focus(),\n }));\n\n const resolvedNavigation = navigationHide ? null : navigation ?? <></>;\n const { maxDrawerSize, maxSplitPanelSize, splitPanelForcedPosition, splitPanelPosition } = computeHorizontalLayout({\n activeDrawerSize,\n splitPanelSize,\n minContentWidth,\n navigationOpen: !!resolvedNavigation && navigationOpen,\n navigationWidth,\n placement,\n splitPanelOpen,\n splitPanelPosition: splitPanelPreferences?.position,\n });\n\n const discoveredBreadcrumbs = useGetGlobalBreadcrumbs();\n\n const hasToolbar = Boolean(\n !embeddedViewMode &&\n (resolvedNavigation ||\n breadcrumbs ||\n discoveredBreadcrumbs ||\n splitPanelToggleConfig.displayed ||\n drawers!.length > 0)\n );\n\n const verticalOffsets = computeVerticalLayout({\n topOffset: placement.insetBlockStart,\n hasToolbar: hasToolbar && toolbarState !== 'hide',\n notificationsHeight: notificationsHeight ?? 0,\n toolbarHeight: toolbarHeight ?? 0,\n stickyNotifications: !!stickyNotifications,\n });\n\n const appLayoutInternals: AppLayoutInternals = {\n ariaLabels: ariaLabelsWithDrawers,\n headerVariant,\n isMobile,\n breadcrumbs,\n discoveredBreadcrumbs,\n stickyNotifications,\n navigationOpen,\n navigation: resolvedNavigation,\n navigationFocusControl,\n activeDrawer,\n activeDrawerSize,\n minDrawerSize,\n maxDrawerSize,\n drawers: drawers!,\n drawersFocusControl,\n splitPanelPosition,\n splitPanelToggleConfig,\n splitPanelOpen,\n splitPanelControlId,\n splitPanelFocusControl,\n placement,\n toolbarState,\n setToolbarState,\n verticalOffsets,\n setToolbarHeight,\n setNotificationsHeight,\n onSplitPanelToggle: onSplitPanelToggleHandler,\n onNavigationToggle,\n onActiveDrawerChange,\n onActiveDrawerResize,\n };\n\n const splitPanelInternals: SplitPanelProviderProps = {\n bottomOffset: 0,\n getMaxHeight: () => {\n const availableHeight =\n document.documentElement.clientHeight - placement.insetBlockStart - placement.insetBlockEnd;\n // If the page is likely zoomed in at 200%, allow the split panel to fill the content area.\n return availableHeight < 400 ? availableHeight - 40 : availableHeight - 250;\n },\n maxWidth: maxSplitPanelSize,\n isForcedPosition: splitPanelForcedPosition,\n isOpen: splitPanelOpen,\n leftOffset: 0,\n onPreferencesChange: onSplitPanelPreferencesChangeHandler,\n onResize: onSplitPanelResizeHandler,\n onToggle: onSplitPanelToggleHandler,\n position: splitPanelPosition,\n reportSize: size => setSplitPanelReportedSize(size),\n reportHeaderHeight: () => {\n /*unused in this design*/\n },\n rightOffset: 0,\n size: splitPanelSize,\n topOffset: 0,\n setSplitPanelToggle: setSplitPanelToggleConfig,\n refs: splitPanelFocusControl.refs,\n };\n\n return (\n <SkeletonLayout\n style={{\n [globalVars.stickyVerticalTopOffset]: `${verticalOffsets.header}px`,\n [globalVars.stickyVerticalBottomOffset]: `${placement.insetBlockEnd}px`,\n paddingBlockEnd: splitPanelOpen ? splitPanelReportedSize : '',\n }}\n toolbar={hasToolbar && <AppLayoutToolbar appLayoutInternals={appLayoutInternals} />}\n notifications={\n notifications && (\n <AppLayoutNotifications appLayoutInternals={appLayoutInternals}>{notifications}</AppLayoutNotifications>\n )\n }\n contentHeader={contentHeader}\n content={content}\n navigation={resolvedNavigation && <AppLayoutNavigation appLayoutInternals={appLayoutInternals} />}\n navigationOpen={navigationOpen}\n navigationWidth={navigationWidth}\n tools={activeDrawer && <AppLayoutDrawer appLayoutInternals={appLayoutInternals} />}\n toolsOpen={!!activeDrawer}\n toolsWidth={activeDrawerSize}\n sideSplitPanel={\n splitPanelPosition === 'side' &&\n splitPanel && (\n <AppLayoutSplitPanelSide appLayoutInternals={appLayoutInternals} splitPanelInternals={splitPanelInternals}>\n {splitPanel}\n </AppLayoutSplitPanelSide>\n )\n }\n bottomSplitPanel={\n splitPanelPosition === 'bottom' && (\n <AppLayoutSplitPanelBottom\n appLayoutInternals={appLayoutInternals}\n splitPanelInternals={splitPanelInternals}\n >\n {splitPanel}\n </AppLayoutSplitPanelBottom>\n )\n }\n splitPanelOpen={splitPanelOpen}\n placement={placement}\n contentType={contentType}\n maxContentWidth={maxContentWidth}\n disableContentPaddings={disableContentPaddings}\n />\n );\n }\n);\n\nexport default AppLayoutVisualRefreshToolbar;\n"]}
|
|
@@ -3,6 +3,7 @@ import { AppLayoutProps, AppLayoutPropsWithDefaults } from '../interfaces';
|
|
|
3
3
|
import { FocusControlState } from '../utils/use-focus-control';
|
|
4
4
|
import { SplitPanelFocusControlState } from '../utils/use-split-panel-focus-control';
|
|
5
5
|
import { SplitPanelSideToggleProps } from '../../internal/context/split-panel-context';
|
|
6
|
+
import { BreadcrumbGroupProps } from '../../breadcrumb-group/interfaces';
|
|
6
7
|
import { VerticalLayoutOutput } from './compute-layout';
|
|
7
8
|
export interface AppLayoutInternals {
|
|
8
9
|
ariaLabels: AppLayoutPropsWithDefaults['ariaLabels'];
|
|
@@ -25,6 +26,7 @@ export interface AppLayoutInternals {
|
|
|
25
26
|
drawersFocusControl: FocusControlState;
|
|
26
27
|
stickyNotifications: AppLayoutPropsWithDefaults['stickyNotifications'];
|
|
27
28
|
breadcrumbs: React.ReactNode;
|
|
29
|
+
discoveredBreadcrumbs: BreadcrumbGroupProps | null;
|
|
28
30
|
toolbarState: 'show' | 'hide';
|
|
29
31
|
setToolbarState: (state: 'show' | 'hide') => void;
|
|
30
32
|
verticalOffsets: VerticalLayoutOutput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh-toolbar/interfaces.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AACrF,OAAO,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAC;AACvF,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAIxD,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,0BAA0B,CAAC,YAAY,CAAC,CAAC;IACrD,aAAa,EAAE,0BAA0B,CAAC,eAAe,CAAC,CAAC;IAC3D,SAAS,EAAE,0BAA0B,CAAC,WAAW,CAAC,CAAC;IACnD,cAAc,EAAE,0BAA0B,CAAC,gBAAgB,CAAC,CAAC;IAC7D,sBAAsB,EAAE,iBAAiB,CAAC;IAC1C,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B,kBAAkB,EAAE,cAAc,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;IACrE,cAAc,EAAE,OAAO,CAAC;IACxB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,sBAAsB,EAAE,2BAA2B,CAAC;IACpD,sBAAsB,EAAE,y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,MAAM,KAAK,IAAI,CAAC;IAClD,eAAe,EAAE,oBAAoB,CAAC;IACtC,sBAAsB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD,gBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,kBAAkB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5C,oBAAoB,EAAE,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC3D,oBAAoB,EAAE,CAAC,MAAM,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CACtE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh-toolbar/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React from 'react';\nimport { AppLayoutProps, AppLayoutPropsWithDefaults } from '../interfaces';\nimport { FocusControlState } from '../utils/use-focus-control';\nimport { SplitPanelFocusControlState } from '../utils/use-split-panel-focus-control';\nimport { SplitPanelSideToggleProps } from '../../internal/context/split-panel-context';\nimport { VerticalLayoutOutput } from './compute-layout';\n\n// Widgetization notice: structures in this file are shared multiple app layout instances, possibly different minor versions.\n// Treat thsese structures as an API and do not make incompatible changes.\nexport interface AppLayoutInternals {\n ariaLabels: AppLayoutPropsWithDefaults['ariaLabels'];\n headerVariant: AppLayoutPropsWithDefaults['headerVariant'];\n placement: AppLayoutPropsWithDefaults['placement'];\n navigationOpen: AppLayoutPropsWithDefaults['navigationOpen'];\n navigationFocusControl: FocusControlState;\n navigation: React.ReactNode;\n splitPanelPosition: AppLayoutProps.SplitPanelPreferences['position'];\n splitPanelOpen: boolean;\n splitPanelControlId: string;\n splitPanelFocusControl: SplitPanelFocusControlState;\n splitPanelToggleConfig: SplitPanelSideToggleProps;\n isMobile: boolean;\n activeDrawer: AppLayoutProps.Drawer | undefined;\n activeDrawerSize: number;\n minDrawerSize: number;\n maxDrawerSize: number;\n drawers: ReadonlyArray<AppLayoutProps.Drawer>;\n drawersFocusControl: FocusControlState;\n stickyNotifications: AppLayoutPropsWithDefaults['stickyNotifications'];\n breadcrumbs: React.ReactNode;\n toolbarState: 'show' | 'hide';\n setToolbarState: (state: 'show' | 'hide') => void;\n verticalOffsets: VerticalLayoutOutput;\n setNotificationsHeight: (height: number) => void;\n setToolbarHeight: (height: number) => void;\n onSplitPanelToggle: () => void;\n onNavigationToggle: (open: boolean) => void;\n onActiveDrawerChange: (newDrawerId: string | null) => void;\n onActiveDrawerResize: (detail: { id: string; size: number }) => void;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../src/app-layout/visual-refresh-toolbar/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React from 'react';\nimport { AppLayoutProps, AppLayoutPropsWithDefaults } from '../interfaces';\nimport { FocusControlState } from '../utils/use-focus-control';\nimport { SplitPanelFocusControlState } from '../utils/use-split-panel-focus-control';\nimport { SplitPanelSideToggleProps } from '../../internal/context/split-panel-context';\nimport { BreadcrumbGroupProps } from '../../breadcrumb-group/interfaces';\nimport { VerticalLayoutOutput } from './compute-layout';\n\n// Widgetization notice: structures in this file are shared multiple app layout instances, possibly different minor versions.\n// Treat thsese structures as an API and do not make incompatible changes.\nexport interface AppLayoutInternals {\n ariaLabels: AppLayoutPropsWithDefaults['ariaLabels'];\n headerVariant: AppLayoutPropsWithDefaults['headerVariant'];\n placement: AppLayoutPropsWithDefaults['placement'];\n navigationOpen: AppLayoutPropsWithDefaults['navigationOpen'];\n navigationFocusControl: FocusControlState;\n navigation: React.ReactNode;\n splitPanelPosition: AppLayoutProps.SplitPanelPreferences['position'];\n splitPanelOpen: boolean;\n splitPanelControlId: string;\n splitPanelFocusControl: SplitPanelFocusControlState;\n splitPanelToggleConfig: SplitPanelSideToggleProps;\n isMobile: boolean;\n activeDrawer: AppLayoutProps.Drawer | undefined;\n activeDrawerSize: number;\n minDrawerSize: number;\n maxDrawerSize: number;\n drawers: ReadonlyArray<AppLayoutProps.Drawer>;\n drawersFocusControl: FocusControlState;\n stickyNotifications: AppLayoutPropsWithDefaults['stickyNotifications'];\n breadcrumbs: React.ReactNode;\n discoveredBreadcrumbs: BreadcrumbGroupProps | null;\n toolbarState: 'show' | 'hide';\n setToolbarState: (state: 'show' | 'hide') => void;\n verticalOffsets: VerticalLayoutOutput;\n setNotificationsHeight: (height: number) => void;\n setToolbarHeight: (height: number) => void;\n onSplitPanelToggle: () => void;\n onNavigationToggle: (open: boolean) => void;\n onActiveDrawerChange: (newDrawerId: string | null) => void;\n onActiveDrawerResize: (detail: { id: string; size: number }) => void;\n}\n"]}
|
|
@@ -1,8 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Focusable } from '../../utils/use-focus-control';
|
|
3
|
+
import { AppLayoutProps, AppLayoutPropsWithDefaults } from '../../interfaces';
|
|
3
4
|
interface DrawerTriggersProps {
|
|
4
|
-
|
|
5
|
+
ariaLabels: AppLayoutPropsWithDefaults['ariaLabels'];
|
|
6
|
+
activeDrawerId: string | null;
|
|
7
|
+
drawersFocusRef: React.Ref<Focusable>;
|
|
8
|
+
drawers: ReadonlyArray<AppLayoutProps.Drawer>;
|
|
9
|
+
onActiveDrawerChange: (drawerId: string | null) => void;
|
|
10
|
+
splitPanelToggleProps: undefined | {
|
|
11
|
+
ariaLabel: string | undefined;
|
|
12
|
+
controlId: string | undefined;
|
|
13
|
+
active: boolean;
|
|
14
|
+
position: AppLayoutProps.SplitPanelPosition;
|
|
15
|
+
};
|
|
16
|
+
splitPanelFocusRef: React.Ref<Focusable>;
|
|
17
|
+
onSplitPanelToggle: () => void;
|
|
5
18
|
}
|
|
6
|
-
export declare function DrawerTriggers({
|
|
19
|
+
export declare function DrawerTriggers({ ariaLabels, activeDrawerId, drawers, drawersFocusRef, onActiveDrawerChange, splitPanelFocusRef, splitPanelToggleProps, onSplitPanelToggle, }: DrawerTriggersProps): JSX.Element | null;
|
|
7
20
|
export {};
|
|
8
21
|
//# sourceMappingURL=drawer-triggers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer-triggers.d.ts","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.tsx"],"names":[],"mappings":";
|
|
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;AAOtC,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAK1D,OAAO,EAAE,cAAc,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAE9E,UAAU,mBAAmB;IAC3B,UAAU,EAAE,0BAA0B,CAAC,YAAY,CAAC,CAAC;IAErD,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,eAAe,EAAE,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACtC,OAAO,EAAE,aAAa,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IAC9C,oBAAoB,EAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAExD,qBAAqB,EACjB,SAAS,GACT;QACE,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;QAC9B,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;QAC9B,MAAM,EAAE,OAAO,CAAC;QAChB,QAAQ,EAAE,cAAc,CAAC,kBAAkB,CAAC;KAC7C,CAAC;IACN,kBAAkB,EAAE,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACzC,kBAAkB,EAAE,MAAM,IAAI,CAAC;CAChC;AAED,wBAAgB,cAAc,CAAC,EAC7B,UAAU,EACV,cAAc,EACd,OAAO,EACP,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,GACnB,EAAE,mBAAmB,sBA8GrB"}
|
|
@@ -5,19 +5,18 @@ import { useContainerQuery } from '@cloudscape-design/component-toolkit';
|
|
|
5
5
|
import { splitItems } from '../../drawer/drawers-helpers';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
7
|
import styles from './styles.css.js';
|
|
8
|
+
import { useMobile } from '../../../internal/hooks/use-mobile';
|
|
8
9
|
import { TOOLS_DRAWER_ID } from '../../utils/use-drawers';
|
|
9
10
|
import OverflowMenu from '../../drawer/overflow-menu';
|
|
10
11
|
import TriggerButton from './trigger-button';
|
|
11
12
|
import testutilStyles from '../../test-classes/styles.css.js';
|
|
12
13
|
import splitPanelTestUtilStyles from '../../../split-panel/test-classes/styles.css.js';
|
|
13
|
-
export function DrawerTriggers({
|
|
14
|
-
const
|
|
14
|
+
export function DrawerTriggers({ ariaLabels, activeDrawerId, drawers, drawersFocusRef, onActiveDrawerChange, splitPanelFocusRef, splitPanelToggleProps, onSplitPanelToggle, }) {
|
|
15
|
+
const isMobile = useMobile();
|
|
15
16
|
const hasMultipleTriggers = drawers.length > 1;
|
|
16
|
-
const activeDrawerId = activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.id;
|
|
17
|
-
const splitPanelIcon = splitPanelPosition === 'side' ? 'view-vertical' : 'view-horizontal';
|
|
18
17
|
const previousActiveDrawerId = useRef(activeDrawerId);
|
|
19
18
|
const [containerWidth, triggersContainerRef] = useContainerQuery(rect => rect.contentBoxWidth);
|
|
20
|
-
if (!drawers && !
|
|
19
|
+
if (!drawers && !splitPanelToggleProps) {
|
|
21
20
|
return null;
|
|
22
21
|
}
|
|
23
22
|
if (activeDrawerId) {
|
|
@@ -32,7 +31,7 @@ export function DrawerTriggers({ appLayoutInternals }) {
|
|
|
32
31
|
const overflowSpot = containerWidth;
|
|
33
32
|
const index = Math.floor(overflowSpot / ITEM_WIDTH);
|
|
34
33
|
let splitPanelItem = 0;
|
|
35
|
-
if (
|
|
34
|
+
if (splitPanelToggleProps) {
|
|
36
35
|
splitPanelItem = 1;
|
|
37
36
|
}
|
|
38
37
|
return index - splitPanelItem;
|
|
@@ -44,17 +43,17 @@ export function DrawerTriggers({ appLayoutInternals }) {
|
|
|
44
43
|
const toolsOnlyMode = drawers.length === 1 && drawers[0].id === TOOLS_DRAWER_ID;
|
|
45
44
|
return (React.createElement("aside", { className: clsx(styles['drawers-desktop-triggers-container'], {
|
|
46
45
|
[styles['has-multiple-triggers']]: hasMultipleTriggers,
|
|
47
|
-
[styles['has-open-drawer']]:
|
|
46
|
+
[styles['has-open-drawer']]: activeDrawerId,
|
|
48
47
|
}), "aria-label": ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.drawers, ref: triggersContainerRef, role: "region" },
|
|
49
48
|
React.createElement("div", { className: clsx(styles['drawers-trigger-content'], {
|
|
50
49
|
[styles['has-multiple-triggers']]: hasMultipleTriggers,
|
|
51
|
-
[styles['has-open-drawer']]:
|
|
50
|
+
[styles['has-open-drawer']]: activeDrawerId,
|
|
52
51
|
}), role: "toolbar", "aria-orientation": "horizontal" },
|
|
53
|
-
|
|
52
|
+
splitPanelToggleProps && (React.createElement(TriggerButton, { ariaLabel: splitPanelToggleProps.ariaLabel, ariaControls: splitPanelToggleProps.controlId, ariaExpanded: splitPanelToggleProps.active, className: clsx(styles['drawers-trigger'], splitPanelTestUtilStyles['open-button']), iconName: splitPanelToggleProps.position === 'side' ? 'view-vertical' : 'view-horizontal', onClick: () => onSplitPanelToggle(), selected: splitPanelToggleProps.active, ref: splitPanelFocusRef })),
|
|
54
53
|
visibleItems.map(item => {
|
|
55
54
|
var _a;
|
|
56
|
-
return (React.createElement(TriggerButton, { ariaLabel: (_a = item.ariaLabels) === null || _a === void 0 ? void 0 : _a.triggerButton, ariaExpanded: item.id === activeDrawerId, 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: () => onActiveDrawerChange(activeDrawerId !== item.id ? item.id : null), ref: item.id === previousActiveDrawerId.current ?
|
|
55
|
+
return (React.createElement(TriggerButton, { ariaLabel: (_a = item.ariaLabels) === null || _a === void 0 ? void 0 : _a.triggerButton, ariaExpanded: item.id === activeDrawerId, 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: () => onActiveDrawerChange(activeDrawerId !== item.id ? item.id : null), ref: item.id === previousActiveDrawerId.current ? drawersFocusRef : undefined, selected: item.id === activeDrawerId, badge: item.badge, testId: `awsui-app-layout-trigger-${item.id}` }));
|
|
57
56
|
}),
|
|
58
|
-
overflowItems.length > 0 && (React.createElement(OverflowMenu, { items: overflowItems, 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 }) => (React.createElement(TriggerButton, { ref: triggerRef, ariaLabel: ariaLabel, ariaExpanded: ariaExpanded, badge: overflowMenuHasBadge, className: clsx(styles['drawers-trigger'], testutilStyles['drawers-trigger'], testUtilsClass), iconName: "ellipsis", onClick: onClick
|
|
57
|
+
overflowItems.length > 0 && (React.createElement(OverflowMenu, { items: overflowItems, 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 }) => (React.createElement(TriggerButton, { ref: triggerRef, ariaLabel: ariaLabel, ariaExpanded: ariaExpanded, badge: overflowMenuHasBadge, className: clsx(styles['drawers-trigger'], testutilStyles['drawers-trigger'], testUtilsClass), iconName: "ellipsis", onClick: onClick })), onItemClick: event => onActiveDrawerChange(event.detail.id) })))));
|
|
59
58
|
}
|
|
60
59
|
//# sourceMappingURL=drawer-triggers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer-triggers.js","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,YAAY,MAAM,4BAA4B,CAAC;AACtD,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAC7C,OAAO,cAAc,MAAM,kCAAkC,CAAC;AAC9D,OAAO,wBAAwB,MAAM,iDAAiD,CAAC;AAOvF,MAAM,UAAU,cAAc,CAAC,EAAE,kBAAkB,EAAuB;IACxE,MAAM,EACJ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AC,MAAM,GAAG,CAAC,IAAI,CAC3B,oBAAC,YAAY,IACX,KAAK,EAAE,aAAa,EACpB,SAAS,EAAE,oBAAoB,CAAC,CAAC,CAAC,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,wBAAwB,CAAC,CAAC,CAAC,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,eAAe,EACpG,oBAAoB,EAAE,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,EAAE,EAAE,CAAC,CAC1F,oBAAC,aAAa,IACZ,GAAG,EAAE,UAAU,EACf,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,oBAAoB,EAC3B,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,EAAE,cAAc,CAAC,iBAAiB,CAAC,EAAE,cAAc,CAAC,EAC7F,QAAQ,EAAC,UAAU,EACnB,OAAO,EAAE,OAAO,EAChB,kBAAkB,EAAE,aAAa,KAAK,eAAe,GACrD,CACH,EACD,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,GAC3D,CACH,CACG,CACA,CACT,CAAC;AACJ,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 { useContainerQuery } from '@cloudscape-design/component-toolkit';\nimport { splitItems } from '../../drawer/drawers-helpers';\nimport clsx from 'clsx';\nimport styles from './styles.css.js';\nimport { TOOLS_DRAWER_ID } from '../../utils/use-drawers';\nimport OverflowMenu from '../../drawer/overflow-menu';\nimport TriggerButton from './trigger-button';\nimport testutilStyles from '../../test-classes/styles.css.js';\nimport splitPanelTestUtilStyles from '../../../split-panel/test-classes/styles.css.js';\nimport { AppLayoutInternals } from '../interfaces';\n\ninterface DrawerTriggersProps {\n appLayoutInternals: AppLayoutInternals;\n}\n\nexport function DrawerTriggers({ appLayoutInternals }: DrawerTriggersProps) {\n const {\n ariaLabels,\n activeDrawer,\n drawers,\n drawersFocusControl,\n isMobile,\n splitPanelOpen,\n splitPanelControlId,\n splitPanelPosition,\n splitPanelFocusControl,\n splitPanelToggleConfig,\n headerVariant,\n onSplitPanelToggle,\n onActiveDrawerChange,\n } = appLayoutInternals;\n\n const hasMultipleTriggers = drawers.length > 1;\n const activeDrawerId = activeDrawer?.id;\n const splitPanelIcon = splitPanelPosition === 'side' ? 'view-vertical' : 'view-horizontal';\n\n const previousActiveDrawerId = useRef(activeDrawerId);\n const [containerWidth, triggersContainerRef] = useContainerQuery(rect => rect.contentBoxWidth);\n if (!drawers && !splitPanelToggleConfig.displayed) {\n return null;\n }\n\n if (activeDrawerId) {\n previousActiveDrawerId.current = activeDrawerId;\n }\n\n const getIndexOfOverflowItem = () => {\n if (isMobile) {\n return 2;\n }\n if (containerWidth) {\n const ITEM_WIDTH = 50; // Roughly 34px + padding = 42px but added extra for safety\n const overflowSpot = containerWidth;\n\n const index = Math.floor(overflowSpot / ITEM_WIDTH);\n\n let splitPanelItem = 0;\n if (splitPanelToggleConfig.displayed) {\n splitPanelItem = 1;\n }\n return index - splitPanelItem;\n }\n return 0;\n };\n\n const { visibleItems, overflowItems } = splitItems(drawers, getIndexOfOverflowItem(), activeDrawerId ?? null);\n const overflowMenuHasBadge = !!overflowItems.find(item => item.badge);\n const toolsOnlyMode = drawers.length === 1 && drawers[0].id === TOOLS_DRAWER_ID;\n\n return (\n <aside\n className={clsx(styles['drawers-desktop-triggers-container'], {\n [styles['has-multiple-triggers']]: hasMultipleTriggers,\n [styles['has-open-drawer']]: activeDrawer,\n })}\n aria-label={ariaLabels?.drawers}\n ref={triggersContainerRef}\n role=\"region\"\n >\n <div\n className={clsx(styles['drawers-trigger-content'], {\n [styles['has-multiple-triggers']]: hasMultipleTriggers,\n [styles['has-open-drawer']]: activeDrawer,\n })}\n role=\"toolbar\"\n aria-orientation=\"horizontal\"\n >\n {splitPanelToggleConfig.displayed && (\n <TriggerButton\n ariaLabel={splitPanelToggleConfig.ariaLabel}\n ariaControls={splitPanelControlId}\n ariaExpanded={splitPanelOpen}\n className={clsx(styles['drawers-trigger'], splitPanelTestUtilStyles['open-button'])}\n iconName={splitPanelIcon}\n onClick={() => onSplitPanelToggle()}\n selected={splitPanelOpen}\n ref={splitPanelFocusControl.refs.toggle}\n />\n )}\n {visibleItems.map(item => {\n return (\n <TriggerButton\n ariaLabel={item.ariaLabels?.triggerButton}\n ariaExpanded={item.id === activeDrawerId}\n ariaControls={activeDrawerId === item.id ? item.id : undefined}\n className={clsx(\n styles['drawers-trigger'],\n !toolsOnlyMode && testutilStyles['drawers-trigger'],\n item.id === TOOLS_DRAWER_ID && testutilStyles['tools-toggle']\n )}\n iconName={item.trigger.iconName}\n iconSvg={item.trigger.iconSvg}\n key={item.id}\n onClick={() => onActiveDrawerChange(activeDrawerId !== item.id ? item.id : null)}\n ref={item.id === previousActiveDrawerId.current ? drawersFocusControl.refs.toggle : undefined}\n selected={item.id === activeDrawerId}\n badge={item.badge}\n testId={`awsui-app-layout-trigger-${item.id}`}\n highContrastHeader={headerVariant === 'high-contrast'}\n />\n );\n })}\n {overflowItems.length > 0 && (\n <OverflowMenu\n items={overflowItems}\n ariaLabel={overflowMenuHasBadge ? ariaLabels?.drawersOverflowWithBadge : ariaLabels?.drawersOverflow}\n customTriggerBuilder={({ onClick, triggerRef, ariaLabel, ariaExpanded, testUtilsClass }) => (\n <TriggerButton\n ref={triggerRef}\n ariaLabel={ariaLabel}\n ariaExpanded={ariaExpanded}\n badge={overflowMenuHasBadge}\n className={clsx(styles['drawers-trigger'], testutilStyles['drawers-trigger'], testUtilsClass)}\n iconName=\"ellipsis\"\n onClick={onClick}\n highContrastHeader={headerVariant === 'high-contrast'}\n />\n )}\n onItemClick={event => onActiveDrawerChange(event.detail.id)}\n />\n )}\n </div>\n </aside>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"drawer-triggers.js","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,YAAY,MAAM,4BAA4B,CAAC;AACtD,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAC7C,OAAO,cAAc,MAAM,kCAAkC,CAAC;AAC9D,OAAO,wBAAwB,MAAM,iDAAiD,CAAC;AAuBvF,MAAM,UAAU,cAAc,CAAC,EAC7B,UAAU,EACV,cAAc,EACd,OAAO,EACP,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,GACE;IACpB,MAAM,QAAQ,GAAG,SAAS,EAAE,CAAC;IAC7B,MAAM,mBAAmB,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;IAE/C,MAAM,sBAAsB,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;IACtD,MAAM,CAAC,cAAc,EAAE,oBAAoB,CAAC,GAAG,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAC/F,IAAI,CAAC,OAAO,IAAI,CAAC,qBAAqB,EAAE;QACtC,OAAO,IAAI,CAAC;KACb;IAED,IAAI,cAAc,EAAE;QAClB,sBAAsB,CAAC,OAAO,GAAG,cAAc,CAAC;KACjD;IAED,MAAM,sBAAsB,GA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iliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport { useContainerQuery } from '@cloudscape-design/component-toolkit';\nimport { splitItems } from '../../drawer/drawers-helpers';\nimport clsx from 'clsx';\nimport styles from './styles.css.js';\nimport { useMobile } from '../../../internal/hooks/use-mobile';\nimport { TOOLS_DRAWER_ID } from '../../utils/use-drawers';\nimport { Focusable } from '../../utils/use-focus-control';\nimport OverflowMenu from '../../drawer/overflow-menu';\nimport TriggerButton from './trigger-button';\nimport testutilStyles from '../../test-classes/styles.css.js';\nimport splitPanelTestUtilStyles from '../../../split-panel/test-classes/styles.css.js';\nimport { AppLayoutProps, AppLayoutPropsWithDefaults } from '../../interfaces';\n\ninterface DrawerTriggersProps {\n ariaLabels: AppLayoutPropsWithDefaults['ariaLabels'];\n\n activeDrawerId: string | null;\n drawersFocusRef: React.Ref<Focusable>;\n drawers: ReadonlyArray<AppLayoutProps.Drawer>;\n onActiveDrawerChange: (drawerId: string | null) => void;\n\n splitPanelToggleProps:\n | undefined\n | {\n ariaLabel: string | undefined;\n controlId: string | undefined;\n active: boolean;\n position: AppLayoutProps.SplitPanelPosition;\n };\n splitPanelFocusRef: React.Ref<Focusable>;\n onSplitPanelToggle: () => void;\n}\n\nexport function DrawerTriggers({\n ariaLabels,\n activeDrawerId,\n drawers,\n drawersFocusRef,\n onActiveDrawerChange,\n splitPanelFocusRef,\n splitPanelToggleProps,\n onSplitPanelToggle,\n}: DrawerTriggersProps) {\n const isMobile = useMobile();\n const hasMultipleTriggers = drawers.length > 1;\n\n const previousActiveDrawerId = useRef(activeDrawerId);\n const [containerWidth, triggersContainerRef] = useContainerQuery(rect => rect.contentBoxWidth);\n if (!drawers && !splitPanelToggleProps) {\n return null;\n }\n\n if (activeDrawerId) {\n previousActiveDrawerId.current = activeDrawerId;\n }\n\n const getIndexOfOverflowItem = () => {\n if (isMobile) {\n return 2;\n }\n if (containerWidth) {\n const ITEM_WIDTH = 50; // Roughly 34px + padding = 42px but added extra for safety\n const overflowSpot = containerWidth;\n\n const index = Math.floor(overflowSpot / ITEM_WIDTH);\n\n let splitPanelItem = 0;\n if (splitPanelToggleProps) {\n splitPanelItem = 1;\n }\n return index - splitPanelItem;\n }\n return 0;\n };\n\n const { visibleItems, overflowItems } = splitItems(drawers, getIndexOfOverflowItem(), activeDrawerId ?? null);\n const overflowMenuHasBadge = !!overflowItems.find(item => item.badge);\n const toolsOnlyMode = drawers.length === 1 && drawers[0].id === TOOLS_DRAWER_ID;\n\n return (\n <aside\n className={clsx(styles['drawers-desktop-triggers-container'], {\n [styles['has-multiple-triggers']]: hasMultipleTriggers,\n [styles['has-open-drawer']]: activeDrawerId,\n })}\n aria-label={ariaLabels?.drawers}\n ref={triggersContainerRef}\n role=\"region\"\n >\n <div\n className={clsx(styles['drawers-trigger-content'], {\n [styles['has-multiple-triggers']]: hasMultipleTriggers,\n [styles['has-open-drawer']]: activeDrawerId,\n })}\n role=\"toolbar\"\n aria-orientation=\"horizontal\"\n >\n {splitPanelToggleProps && (\n <TriggerButton\n ariaLabel={splitPanelToggleProps.ariaLabel}\n ariaControls={splitPanelToggleProps.controlId}\n ariaExpanded={splitPanelToggleProps.active}\n className={clsx(styles['drawers-trigger'], splitPanelTestUtilStyles['open-button'])}\n iconName={splitPanelToggleProps.position === 'side' ? 'view-vertical' : 'view-horizontal'}\n onClick={() => onSplitPanelToggle()}\n selected={splitPanelToggleProps.active}\n ref={splitPanelFocusRef}\n />\n )}\n {visibleItems.map(item => {\n return (\n <TriggerButton\n ariaLabel={item.ariaLabels?.triggerButton}\n ariaExpanded={item.id === activeDrawerId}\n ariaControls={activeDrawerId === item.id ? item.id : undefined}\n className={clsx(\n styles['drawers-trigger'],\n !toolsOnlyMode && testutilStyles['drawers-trigger'],\n item.id === TOOLS_DRAWER_ID && testutilStyles['tools-toggle']\n )}\n iconName={item.trigger.iconName}\n iconSvg={item.trigger.iconSvg}\n key={item.id}\n onClick={() => onActiveDrawerChange(activeDrawerId !== item.id ? item.id : null)}\n ref={item.id === previousActiveDrawerId.current ? drawersFocusRef : undefined}\n selected={item.id === activeDrawerId}\n badge={item.badge}\n testId={`awsui-app-layout-trigger-${item.id}`}\n />\n );\n })}\n {overflowItems.length > 0 && (\n <OverflowMenu\n items={overflowItems}\n ariaLabel={overflowMenuHasBadge ? ariaLabels?.drawersOverflowWithBadge : ariaLabels?.drawersOverflow}\n customTriggerBuilder={({ onClick, triggerRef, ariaLabel, ariaExpanded, testUtilsClass }) => (\n <TriggerButton\n ref={triggerRef}\n ariaLabel={ariaLabel}\n ariaExpanded={ariaExpanded}\n badge={overflowMenuHasBadge}\n className={clsx(styles['drawers-trigger'], testutilStyles['drawers-trigger'], testUtilsClass)}\n iconName=\"ellipsis\"\n onClick={onClick}\n />\n )}\n onItemClick={event => onActiveDrawerChange(event.detail.id)}\n />\n )}\n </div>\n </aside>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/toolbar/index.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/toolbar/index.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAInD,UAAU,mCAAmC;IAC3C,kBAAkB,EAAE,kBAAkB,CAAC;CACxC;AAED,wBAAgB,8BAA8B,CAAC,EAAE,kBAAkB,EAAE,EAAE,mCAAmC,eA4HzG;AAED,eAAO,MAAM,gCAAgC,uGAA4D,CAAC"}
|
|
@@ -9,9 +9,10 @@ import TriggerButton from './trigger-button';
|
|
|
9
9
|
import { ToolbarSlot } from '../skeleton/slot-wrappers';
|
|
10
10
|
import { createWidgetizedComponent } from '../../../internal/widgets';
|
|
11
11
|
import { useResizeObserver } from '@cloudscape-design/component-toolkit/internal';
|
|
12
|
+
import { InternalBreadcrumbGroup } from '../../../breadcrumb-group/internal';
|
|
12
13
|
export function AppLayoutToolbarImplementation({ appLayoutInternals }) {
|
|
13
|
-
var _a;
|
|
14
|
-
const { ariaLabels, breadcrumbs, drawers, setToolbarHeight, verticalOffsets, onNavigationToggle, isMobile, toolbarState, setToolbarState, navigationOpen, navigation, navigationFocusControl, splitPanelToggleConfig, } = appLayoutInternals;
|
|
14
|
+
var _a, _b;
|
|
15
|
+
const { ariaLabels, breadcrumbs, discoveredBreadcrumbs, activeDrawer, drawers, drawersFocusControl, setToolbarHeight, verticalOffsets, onNavigationToggle, isMobile, toolbarState, setToolbarState, navigationOpen, navigation, navigationFocusControl, splitPanelControlId, splitPanelPosition, splitPanelToggleConfig, splitPanelFocusControl, onSplitPanelToggle, splitPanelOpen, onActiveDrawerChange, } = appLayoutInternals;
|
|
15
16
|
// TODO: expose configuration property
|
|
16
17
|
const pinnedToolbar = false;
|
|
17
18
|
const ref = useRef(null);
|
|
@@ -55,8 +56,12 @@ export function AppLayoutToolbarImplementation({ appLayoutInternals }) {
|
|
|
55
56
|
React.createElement("div", { className: styles['toolbar-container'] },
|
|
56
57
|
navigation && !navigationOpen && (React.createElement("nav", { "aria-hidden": navigationOpen, className: clsx(styles['universal-toolbar-nav'], { [testutilStyles['drawer-closed']]: !navigationOpen }) },
|
|
57
58
|
React.createElement(TriggerButton, { ariaLabel: (_a = ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.navigationToggle) !== null && _a !== void 0 ? _a : undefined, ariaExpanded: navigationOpen ? undefined : false, iconName: "menu", className: testutilStyles['navigation-toggle'], onClick: () => onNavigationToggle(!navigationOpen), ref: navigationFocusControl.refs.toggle, selected: navigationOpen }))),
|
|
58
|
-
breadcrumbs && (React.createElement("div", { className: clsx(styles['universal-toolbar-breadcrumbs'], testutilStyles.breadcrumbs) },
|
|
59
|
-
|
|
59
|
+
(breadcrumbs || discoveredBreadcrumbs) && (React.createElement("div", { className: clsx(styles['universal-toolbar-breadcrumbs'], testutilStyles.breadcrumbs) },
|
|
60
|
+
breadcrumbs,
|
|
61
|
+
discoveredBreadcrumbs && React.createElement(InternalBreadcrumbGroup, Object.assign({}, discoveredBreadcrumbs)))),
|
|
62
|
+
(drawers.length > 0 || splitPanelToggleConfig.displayed) && (React.createElement("span", { className: clsx(styles['universal-toolbar-drawers']) },
|
|
63
|
+
React.createElement(DrawerTriggers, { ariaLabels: ariaLabels, activeDrawerId: (_b = activeDrawer === null || activeDrawer === void 0 ? void 0 : activeDrawer.id) !== null && _b !== void 0 ? _b : null, drawers: drawers, drawersFocusRef: drawersFocusControl.refs.toggle, onActiveDrawerChange: onActiveDrawerChange, splitPanelToggleProps: splitPanelToggleConfig.displayed
|
|
64
|
+
? Object.assign(Object.assign({}, splitPanelToggleConfig), { controlId: splitPanelControlId, active: splitPanelOpen, position: splitPanelPosition }) : undefined, splitPanelFocusRef: splitPanelFocusControl.refs.toggle, onSplitPanelToggle: onSplitPanelToggle }))))));
|
|
60
65
|
}
|
|
61
66
|
export const createWidgetizedAppLayoutToolbar = createWidgetizedComponent(AppLayoutToolbarImplementation);
|
|
62
67
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/toolbar/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,cAAc,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/toolbar/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,cAAc,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAM7E,MAAM,UAAU,8BAA8B,CAAC,EAAE,kBAAkB,EAAuC;;IACxG,MAAM,EACJ,UAAU,EACV,WAAW,EACX,qBAAqB,EACrB,YAAY,EACZ,OAAO,EACP,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,QAAQ,EACR,YAAY,EACZ,eAAe,EACf,cAAc,EACd,UAAU,EACV,sBAAsB,EACtB,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,kBAAkB,EAClB,cAAc,EACd,oBAAoB,GACrB,GAAG,kBAAkB,CAAC;IACvB,sCAAsC;IACtC,MAAM,aAAa,GAAG,KAAK,CAAC;IAC5B,MAAM,GAAG,GAAG,MAAM,CAAc,IAAI,CAAC,CAAC;IACtC,iBAAiB,CA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EAAI,CAC5E,CACP;YACA,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,sBAAsB,CAAC,SAAS,CAAC,IAAI,CAC3D,8BAAM,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,2BAA2B,CAAC,CAAC;gBACxD,oBAAC,cAAc,IACb,UAAU,EAAE,UAAU,EACtB,cAAc,EAAE,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,EAAE,mCAAI,IAAI,EACxC,OAAO,EAAE,OAAO,EAChB,eAAe,EAAE,mBAAmB,CAAC,IAAI,CAAC,MAAM,EAChD,oBAAoB,EAAE,oBAAoB,EAC1C,qBAAqB,EACnB,sBAAsB,CAAC,SAAS;wBAC9B,CAAC,iCACM,sBAAsB,KACzB,SAAS,EAAE,mBAAmB,EAC9B,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,kBAAkB,IAEhC,CAAC,CAAC,SAAS,EAEf,kBAAkB,EAAE,sBAAsB,CAAC,IAAI,CAAC,MAAM,EACtD,kBAAkB,EAAE,kBAAkB,GACtC,CACG,CACR,CACG,CACM,CACf,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,gCAAgC,GAAG,yBAAyB,CAAC,8BAA8B,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef } from 'react';\nimport clsx from 'clsx';\nimport styles from './styles.css.js';\nimport testutilStyles from '../../test-classes/styles.css.js';\nimport { DrawerTriggers } from './drawer-triggers';\nimport TriggerButton from './trigger-button';\nimport { ToolbarSlot } from '../skeleton/slot-wrappers';\nimport { createWidgetizedComponent } from '../../../internal/widgets';\nimport { AppLayoutInternals } from '../interfaces';\nimport { useResizeObserver } from '@cloudscape-design/component-toolkit/internal';\nimport { InternalBreadcrumbGroup } from '../../../breadcrumb-group/internal';\n\ninterface AppLayoutToolbarImplementationProps {\n appLayoutInternals: AppLayoutInternals;\n}\n\nexport function AppLayoutToolbarImplementation({ appLayoutInternals }: AppLayoutToolbarImplementationProps) {\n const {\n ariaLabels,\n breadcrumbs,\n discoveredBreadcrumbs,\n activeDrawer,\n drawers,\n drawersFocusControl,\n setToolbarHeight,\n verticalOffsets,\n onNavigationToggle,\n isMobile,\n toolbarState,\n setToolbarState,\n navigationOpen,\n navigation,\n navigationFocusControl,\n splitPanelControlId,\n splitPanelPosition,\n splitPanelToggleConfig,\n splitPanelFocusControl,\n onSplitPanelToggle,\n splitPanelOpen,\n onActiveDrawerChange,\n } = appLayoutInternals;\n // TODO: expose configuration property\n const pinnedToolbar = false;\n const ref = useRef<HTMLElement>(null);\n useResizeObserver(ref, entry => setToolbarHeight(entry.borderBoxHeight));\n useEffect(() => {\n return () => {\n setToolbarHeight(0);\n };\n // unmount effect only\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n let lastScrollY = window.scrollY;\n\n /* istanbul ignore next not testable in JSDOM */\n const updateScrollDirection = () => {\n if (pinnedToolbar) {\n setToolbarState('show');\n return;\n }\n const scrollY = window.scrollY;\n // 80 is an arbitrary number to have a pause before the toolbar scrolls out of view at the top of the page\n const direction = scrollY > lastScrollY && scrollY > 80 ? 'hide' : 'show';\n // 2 as a buffer to avoid mistaking minor accidental mouse moves as scroll\n if (direction !== toolbarState && (scrollY - lastScrollY > 2 || scrollY - lastScrollY < -2)) {\n setToolbarState(direction);\n }\n lastScrollY = scrollY > 0 ? scrollY : 0;\n };\n\n window.addEventListener('scroll', updateScrollDirection);\n return () => {\n window.removeEventListener('scroll', updateScrollDirection);\n };\n }, [pinnedToolbar, setToolbarState, toolbarState]);\n\n const toolbarHidden = toolbarState === 'hide' && !pinnedToolbar;\n\n return (\n <ToolbarSlot\n ref={ref}\n className={clsx(styles['universal-toolbar'], {\n [testutilStyles['mobile-bar']]: isMobile,\n [styles['toolbar-hidden']]: toolbarHidden,\n })}\n style={{\n insetBlockStart: toolbarHidden ? '-60px' : verticalOffsets.toolbar,\n }}\n >\n <div className={styles['toolbar-container']}>\n {navigation && !navigationOpen && (\n <nav\n aria-hidden={navigationOpen}\n className={clsx(styles['universal-toolbar-nav'], { [testutilStyles['drawer-closed']]: !navigationOpen })}\n >\n <TriggerButton\n ariaLabel={ariaLabels?.navigationToggle ?? undefined}\n ariaExpanded={navigationOpen ? undefined : false}\n iconName=\"menu\"\n className={testutilStyles['navigation-toggle']}\n onClick={() => onNavigationToggle(!navigationOpen)}\n ref={navigationFocusControl.refs.toggle}\n selected={navigationOpen}\n />\n </nav>\n )}\n {(breadcrumbs || discoveredBreadcrumbs) && (\n <div className={clsx(styles['universal-toolbar-breadcrumbs'], testutilStyles.breadcrumbs)}>\n {breadcrumbs}\n {discoveredBreadcrumbs && <InternalBreadcrumbGroup {...discoveredBreadcrumbs} />}\n </div>\n )}\n {(drawers.length > 0 || splitPanelToggleConfig.displayed) && (\n <span className={clsx(styles['universal-toolbar-drawers'])}>\n <DrawerTriggers\n ariaLabels={ariaLabels}\n activeDrawerId={activeDrawer?.id ?? null}\n drawers={drawers}\n drawersFocusRef={drawersFocusControl.refs.toggle}\n onActiveDrawerChange={onActiveDrawerChange}\n splitPanelToggleProps={\n splitPanelToggleConfig.displayed\n ? {\n ...splitPanelToggleConfig,\n controlId: splitPanelControlId,\n active: splitPanelOpen,\n position: splitPanelPosition,\n }\n : undefined\n }\n splitPanelFocusRef={splitPanelFocusControl.refs.toggle}\n onSplitPanelToggle={onSplitPanelToggle}\n />\n </span>\n )}\n </div>\n </ToolbarSlot>\n );\n}\n\nexport const createWidgetizedAppLayoutToolbar = createWidgetizedComponent(AppLayoutToolbarImplementation);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/breadcrumb-group/index.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/breadcrumb-group/index.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAMpD,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAEhC,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,CAAC,SAAS,oBAAoB,CAAC,IAAI,GAAG,oBAAoB,CAAC,IAAI,EAAE,EACvG,KAAU,EACV,GAAG,KAAK,EACT,EAAE,oBAAoB,CAAC,CAAC,CAAC,eASzB"}
|
|
@@ -5,9 +5,14 @@ import React from 'react';
|
|
|
5
5
|
import { applyDisplayName } from '../internal/utils/apply-display-name.js';
|
|
6
6
|
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
7
7
|
import { InternalBreadcrumbGroup } from './internal';
|
|
8
|
+
import { useSetGlobalBreadcrumbs } from '../internal/plugins/helpers/use-global-breadcrumbs';
|
|
8
9
|
export default function BreadcrumbGroup(_a) {
|
|
9
10
|
var { items = [] } = _a, props = __rest(_a, ["items"]);
|
|
11
|
+
const registeredGlobally = useSetGlobalBreadcrumbs(Object.assign({ items }, props));
|
|
10
12
|
const baseComponentProps = useBaseComponent('BreadcrumbGroup');
|
|
13
|
+
if (registeredGlobally) {
|
|
14
|
+
return React.createElement(React.Fragment, null);
|
|
15
|
+
}
|
|
11
16
|
return React.createElement(InternalBreadcrumbGroup, Object.assign({ items: items }, props, baseComponentProps));
|
|
12
17
|
}
|
|
13
18
|
applyDisplayName(BreadcrumbGroup, 'BreadcrumbGroup');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/breadcrumb-group/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/breadcrumb-group/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oDAAoD,CAAC;AAI7F,MAAM,CAAC,OAAO,UAAU,eAAe,CAAkE,EAG/E;QAH+E,EACvG,KAAK,GAAG,EAAE,OAEc,EADrB,KAAK,cAF+F,SAGxG,CADS;IAER,MAAM,kBAAkB,GAAG,uBAAuB,iBAAG,KAAK,IAAK,KAAK,EAAG,CAAC;IACxE,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;IAE/D,IAAI,kBAAkB,EAAE;QACtB,OAAO,yCAAK,CAAC;KACd;IAED,OAAO,oBAAC,uBAAuB,kBAAC,KAAK,EAAE,KAAK,IAAM,KAAK,EAAM,kBAAkB,EAAI,CAAC;AACtF,CAAC;AAED,gBAAgB,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BreadcrumbGroupProps } from './interfaces';\nimport { applyDisplayName } from '../internal/utils/apply-display-name.js';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { InternalBreadcrumbGroup } from './internal';\nimport { useSetGlobalBreadcrumbs } from '../internal/plugins/helpers/use-global-breadcrumbs';\n\nexport { BreadcrumbGroupProps };\n\nexport default function BreadcrumbGroup<T extends BreadcrumbGroupProps.Item = BreadcrumbGroupProps.Item>({\n items = [],\n ...props\n}: BreadcrumbGroupProps<T>) {\n const registeredGlobally = useSetGlobalBreadcrumbs({ items, ...props });\n const baseComponentProps = useBaseComponent('BreadcrumbGroup');\n\n if (registeredGlobally) {\n return <></>;\n }\n\n return <InternalBreadcrumbGroup items={items} {...props} {...baseComponentProps} />;\n}\n\napplyDisplayName(BreadcrumbGroup, 'BreadcrumbGroup');\n"]}
|
|
@@ -348,7 +348,4 @@ export declare namespace DateRangePickerProps {
|
|
|
348
348
|
}
|
|
349
349
|
export type DayIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
350
350
|
export type RangeCalendarI18nStrings = Pick<DateRangePickerProps.I18nStrings, 'todayAriaLabel' | 'nextMonthAriaLabel' | 'previousMonthAriaLabel' | 'startDateLabel' | 'startTimeLabel' | 'endDateLabel' | 'endTimeLabel' | 'dateTimeConstraintText' | 'renderSelectedAbsoluteRangeAriaLive'>;
|
|
351
|
-
export interface Focusable {
|
|
352
|
-
focus(): void;
|
|
353
|
-
}
|
|
354
351
|
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/date-range-picker/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,+BAA+B,EAAE,MAAM,wCAAwC,CAAC;AACzF,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,KAAK,EAAE,IAAI,GAAG,oBAAoB,CAAC,KAAK,CAAC;IAEzC;;OAEG;IACH,eAAe,EAAE,aAAa,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC;IAEpE;;;;;;O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E5B;;WAEG;QACH,mCAAmC,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;KACtF;IAED,KAAY,cAAc,GAAG,KAAK,GAAG,gBAAgB,CAAC;CACvD;AAED,MAAM,MAAM,QAAQ,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEjD,MAAM,MAAM,wBAAwB,GAAG,IAAI,CACzC,oBAAoB,CAAC,WAAW,EAC9B,gBAAgB,GAChB,oBAAoB,GACpB,wBAAwB,GACxB,gBAAgB,GAChB,gBAAgB,GAChB,cAAc,GACd,cAAc,GACd,wBAAwB,GACxB,qCAAqC,CACxC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/date-range-picker/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\nimport { FormFieldValidationControlProps } from '../internal/context/form-field-context';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { TimeInputProps } from '../time-input/interfaces';\nimport { ExpandToViewport } from '../internal/components/dropdown/interfaces';\nimport React from 'react';\n\nexport interface DateRangePickerBaseProps {\n /**\n * The current date range value. Can be either an absolute time range\n * or a relative time range.\n */\n value: null | DateRangePickerProps.Value;\n\n /**\n * A list of relative time ranges that are shown as suggestions.\n */\n relativeOptions: ReadonlyArray<DateRangePickerProps.RelativeOption>;\n\n /**\n * A function that defines whether a particular date should be enabled\n * in the calendar or not. Note that disabling a date in the calendar\n * still allows users to enter this date via keyboard. We therefore\n * recommend that you also validate these constraints client- and\n * server-side, in the same way as for other form elements.\n */\n isDateEnabled?: DateRangePickerProps.IsDateEnabledFunction;\n\n /**\n * The locale to be used for rendering month names and defining the\n * starting date of the week. If not provided, it will be determined\n * from the page and browser locales. Supported values and formats\n * are as-per the [JavaScript Intl API specification](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).\n */\n locale?: string;\n\n /**\n * Starting day of the week. [0-6] maps to [Sunday-Saturday].\n * By default the starting day of the week is defined by the locale,\n * but you can override it using this property.\n */\n startOfWeek?: number;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n * @i18n\n */\n i18nStrings?: DateRangePickerProps.I18nStrings;\n\n /**\n * Hides time inputs and changes the input format to date-only, e.g. 2021-04-06.\n *\n * Do not use `dateOnly` flag conditionally. The component does not trigger the value update\n * when the flag changes which means the value format can become inconsistent.\n *\n * Default: `false`.\n */\n dateOnly?: boolean;\n\n /**\n * Determines the range selector mode as follows:\n *\n * * `default` for combined absolute/relative range selector.\n * * `absolute-only` for absolute-only range selector.\n * * `relative-only` for relative-only range selector.\n *\n * By default, the range selector mode is `default`.\n */\n rangeSelectorMode?: DateRangePickerProps.RangeSelectorMode;\n\n /**\n * Specifies the format of the time input for absolute ranges.\n *\n * Use to restrict the granularity of time that the user can enter.\n *\n * Has no effect when `dateOnly` is true.\n */\n timeInputFormat?: TimeInputProps.Format;\n\n /**\n * Fired whenever a user changes the component's value.\n * The event `detail` contains the current value of the field.\n */\n onChange?: NonCancelableEventHandler<DateRangePickerProps.ChangeDetail>;\n\n /**\n * The time offset from UTC in minutes that should be used to\n * display and produce values.\n *\n * Has no effect when `dateOnly` is true.\n *\n * Default: the user's current time offset as provided by the browser.\n *\n * @deprecated Use `getTimeOffset` instead.\n */\n timeOffset?: number;\n\n /**\n * A function that defines timezone offset from UTC in minutes for selected dates.\n * Use it to define time relative to the desired timezone.\n *\n * The function is called for the start date and the end date and takes a UTC date\n * corresponding the selected value as an argument.\n *\n * Has no effect when `dateOnly` is true.\n *\n * Default: the user's current time offset as provided by the browser.\n */\n getTimeOffset?: DateRangePickerProps.GetTimeOffsetFunction;\n}\nexport interface DateRangePickerProps\n extends BaseComponentProps,\n FormFieldValidationControlProps,\n ExpandToViewport,\n DateRangePickerBaseProps {\n /**\n * Specifies the placeholder text that is rendered when the value is empty.\n */\n placeholder?: string;\n\n /**\n * Specifies that the component is disabled, preventing the user from\n * modifying the value. A disabled component cannot receive focus.\n */\n disabled?: boolean;\n\n /**\n * Specifies that the component is read-only, preventing the user from\n * modifying the value. A read-only component can receive focus.\n */\n readOnly?: boolean;\n\n /**\n * Fired when keyboard focus is set onto the UI control.\n */\n onFocus?: NonCancelableEventHandler<null>;\n\n /**\n * Fired when keyboard focus is removed from the UI control.\n */\n onBlur?: NonCancelableEventHandler<null>;\n\n /**\n * A function that defines whether a particular range is valid or not.\n *\n * Ensure that your function checks for missing fields in the value.\n */\n isValidRange: DateRangePickerProps.ValidationFunction;\n\n /**\n * Specifies whether the component should show a button that\n * allows the user to clear the selected value.\n */\n showClearButton?: boolean;\n\n /**\n * Specifies an additional control displayed in the dropdown, located below the range calendar.\n */\n customAbsoluteRangeControl?: DateRangePickerProps.AbsoluteRangeControl;\n\n /**\n * Specifies the time format to use for displaying the absolute time range.\n *\n * It can take the following values:\n * * `iso`: ISO 8601 format, e.g.: 2024-01-30T13:32:32+01:00 (or 2024-01-30 when `dateOnly` is true)\n * * `long-localized`: a more human-readable, localized format, e.g.: January 30, 2024, 13:32:32 (UTC+1) (or January 30, 2024 when `dateOnly` is true)\n *\n * Defaults to `iso`.\n */\n absoluteFormat?: DateRangePickerProps.AbsoluteFormat;\n\n /**\n * Specifies whether to hide the time offset in the displayed absolute time range.\n * Defaults to `false`.\n */\n hideTimeOffset?: boolean;\n}\n\nexport namespace DateRangePickerProps {\n export type Value = AbsoluteValue | RelativeValue;\n export interface AbsoluteValue {\n /**\n * In ISO8601 format, e.g.: 2021-04-06T17:23:50+02:00 (or 2021-04-06 when `dateOnly` is true)\n */\n startDate: string;\n /**\n * In ISO8601 format, e.g.: 2021-04-06T17:23:50+02:00 (or 2021-04-06 when `dateOnly` is true)\n */\n endDate: string;\n type: 'absolute';\n }\n\n export interface RelativeValue {\n /**\n * If provided, used to match this value\n * to a provided relative option.\n */\n key?: string;\n amount: number;\n unit: TimeUnit;\n type: 'relative';\n }\n export interface RelativeOption {\n /**\n * Used to uniquely identify this relative option.\n */\n key: string;\n amount: number;\n unit: TimeUnit;\n type: 'relative';\n }\n\n export type TimeUnit = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';\n\n export type ValidationFunction = (value: Value | null) => ValidationResult;\n\n export type ValidationResult = ValidRangeResult | InvalidRangeResult;\n\n export interface ValidRangeResult {\n valid: true;\n }\n\n export interface InvalidRangeResult {\n valid: false;\n errorMessage: string;\n }\n\n export interface ChangeDetail {\n /**\n * The newly selected range of this date range picker.\n */\n value: null | Value;\n }\n\n export interface IsDateEnabledFunction {\n (date: Date): boolean;\n }\n\n export interface GetTimeOffsetFunction {\n (date: Date): number;\n }\n\n export interface DateTimeStrings {\n date: string;\n time: string;\n }\n\n export interface PendingAbsoluteValue {\n start: DateTimeStrings;\n end: DateTimeStrings;\n }\n\n export type AbsoluteRangeControl = (\n selectedRange: PendingAbsoluteValue,\n setSelectedRange: React.Dispatch<React.SetStateAction<PendingAbsoluteValue>>\n ) => React.ReactNode;\n\n export type RangeSelectorMode = 'default' | 'absolute-only' | 'relative-only';\n\n export interface Ref {\n /**\n * Sets the browser focus on the UI control\n */\n focus(): void;\n }\n\n export interface I18nStrings {\n /**\n * Adds `aria-label` to the trigger and dropdown.\n */\n ariaLabel?: string;\n\n /**\n * Adds `aria-labelledby` to the trigger and dropdown.\n */\n ariaLabelledby?: string;\n\n /**\n * Adds `aria-describedby` to the trigger and dropdown.\n */\n ariaDescribedby?: string;\n\n /**\n * Label of the mode selection group. In the standard view, it adds 'aria-label' to the group of segments.\n * In a narrow container the label is visible and attached to the select component.\n */\n modeSelectionLabel?: string;\n\n /**\n * Segment title of the relative range selection mode\n */\n relativeModeTitle?: string;\n\n /**\n * Segment title of the absolute range selection mode\n */\n absoluteModeTitle?: string;\n\n /**\n * Heading for the relative range selection area\n */\n relativeRangeSelectionHeading?: string;\n\n /**\n * Visible label of the Cancel button\n */\n cancelButtonLabel?: string;\n /**\n * Visible label of the Clear and dismiss button\n */\n clearButtonLabel?: string;\n /**\n * Visible label of the Apply button\n */\n applyButtonLabel?: string;\n\n /**\n * Formatting function for relative ranges.\n * This function must convert a relative range to a human-readable string.\n */\n formatRelativeRange?: (value: RelativeValue) => string;\n\n /**\n * Formatting function for time units.\n *\n * This function must return a localized form of the unit that fits the provided time value.\n */\n formatUnit?: (unit: TimeUnit, value: number) => string;\n\n /**\n * Visible label for the option for selecting\n * a custom relative range.\n */\n customRelativeRangeOptionLabel?: string;\n\n /**\n * Visible description for the option for selecting\n * a custom relative range.\n */\n customRelativeRangeOptionDescription?: string;\n\n /**\n * Visible label for the duration selector for\n * the custom relative range.\n */\n customRelativeRangeDurationLabel?: string;\n /**\n * Placeholder for the duration selector for\n * the custom relative range.\n */\n customRelativeRangeDurationPlaceholder?: string;\n /**\n * Visible label for the unit selector for the\n * custom relative range.\n */\n customRelativeRangeUnitLabel?: string;\n\n /**\n * Used as part of the aria label for today's date in the calendar.\n */\n todayAriaLabel?: string;\n\n /**\n * An aria label for the 'next month' button.\n */\n nextMonthAriaLabel?: string;\n\n /**\n * An aria label for the 'previous month' button.\n */\n previousMonthAriaLabel?: string;\n\n /**\n * Visible label for the Start Date input for the\n * absolute range.\n */\n startDateLabel?: string;\n /**\n * Visible label for the Start Time input for the\n * absolute range.\n */\n startTimeLabel?: string;\n /**\n * Visible label for the End Date input for the\n * absolute range.\n */\n endDateLabel?: string;\n /**\n * Visible label for the End Time input for the\n * absolute range.\n */\n endTimeLabel?: string;\n\n /**\n * Constraint text for the input fields for the\n * absolute range.\n */\n dateTimeConstraintText?: string;\n\n /**\n * Provides a text alternative for the error icon in the error alert.\n */\n errorIconAriaLabel?: string;\n\n /**\n * When the property is set, screen readers announce the selected range when the absolute range gets selected.\n */\n renderSelectedAbsoluteRangeAriaLive?: (startDate: string, endDate: string) => string;\n }\n\n export type AbsoluteFormat = 'iso' | 'long-localized';\n}\n\nexport type DayIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\nexport type RangeCalendarI18nStrings = Pick<\n DateRangePickerProps.I18nStrings,\n | 'todayAriaLabel'\n | 'nextMonthAriaLabel'\n | 'previousMonthAriaLabel'\n | 'startDateLabel'\n | 'startTimeLabel'\n | 'endDateLabel'\n | 'endTimeLabel'\n | 'dateTimeConstraintText'\n | 'renderSelectedAbsoluteRangeAriaLive'\n>;\n\nexport interface Focusable {\n focus(): void;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/date-range-picker/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\nimport { FormFieldValidationControlProps } from '../internal/context/form-field-context';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { TimeInputProps } from '../time-input/interfaces';\nimport { ExpandToViewport } from '../internal/components/dropdown/interfaces';\nimport React from 'react';\n\nexport interface DateRangePickerBaseProps {\n /**\n * The current date range value. Can be either an absolute time range\n * or a relative time range.\n */\n value: null | DateRangePickerProps.Value;\n\n /**\n * A list of relative time ranges that are shown as suggestions.\n */\n relativeOptions: ReadonlyArray<DateRangePickerProps.RelativeOption>;\n\n /**\n * A function that defines whether a particular date should be enabled\n * in the calendar or not. Note that disabling a date in the calendar\n * still allows users to enter this date via keyboard. We therefore\n * recommend that you also validate these constraints client- and\n * server-side, in the same way as for other form elements.\n */\n isDateEnabled?: DateRangePickerProps.IsDateEnabledFunction;\n\n /**\n * The locale to be used for rendering month names and defining the\n * starting date of the week. If not provided, it will be determined\n * from the page and browser locales. Supported values and formats\n * are as-per the [JavaScript Intl API specification](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).\n */\n locale?: string;\n\n /**\n * Starting day of the week. [0-6] maps to [Sunday-Saturday].\n * By default the starting day of the week is defined by the locale,\n * but you can override it using this property.\n */\n startOfWeek?: number;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n * @i18n\n */\n i18nStrings?: DateRangePickerProps.I18nStrings;\n\n /**\n * Hides time inputs and changes the input format to date-only, e.g. 2021-04-06.\n *\n * Do not use `dateOnly` flag conditionally. The component does not trigger the value update\n * when the flag changes which means the value format can become inconsistent.\n *\n * Default: `false`.\n */\n dateOnly?: boolean;\n\n /**\n * Determines the range selector mode as follows:\n *\n * * `default` for combined absolute/relative range selector.\n * * `absolute-only` for absolute-only range selector.\n * * `relative-only` for relative-only range selector.\n *\n * By default, the range selector mode is `default`.\n */\n rangeSelectorMode?: DateRangePickerProps.RangeSelectorMode;\n\n /**\n * Specifies the format of the time input for absolute ranges.\n *\n * Use to restrict the granularity of time that the user can enter.\n *\n * Has no effect when `dateOnly` is true.\n */\n timeInputFormat?: TimeInputProps.Format;\n\n /**\n * Fired whenever a user changes the component's value.\n * The event `detail` contains the current value of the field.\n */\n onChange?: NonCancelableEventHandler<DateRangePickerProps.ChangeDetail>;\n\n /**\n * The time offset from UTC in minutes that should be used to\n * display and produce values.\n *\n * Has no effect when `dateOnly` is true.\n *\n * Default: the user's current time offset as provided by the browser.\n *\n * @deprecated Use `getTimeOffset` instead.\n */\n timeOffset?: number;\n\n /**\n * A function that defines timezone offset from UTC in minutes for selected dates.\n * Use it to define time relative to the desired timezone.\n *\n * The function is called for the start date and the end date and takes a UTC date\n * corresponding the selected value as an argument.\n *\n * Has no effect when `dateOnly` is true.\n *\n * Default: the user's current time offset as provided by the browser.\n */\n getTimeOffset?: DateRangePickerProps.GetTimeOffsetFunction;\n}\nexport interface DateRangePickerProps\n extends BaseComponentProps,\n FormFieldValidationControlProps,\n ExpandToViewport,\n DateRangePickerBaseProps {\n /**\n * Specifies the placeholder text that is rendered when the value is empty.\n */\n placeholder?: string;\n\n /**\n * Specifies that the component is disabled, preventing the user from\n * modifying the value. A disabled component cannot receive focus.\n */\n disabled?: boolean;\n\n /**\n * Specifies that the component is read-only, preventing the user from\n * modifying the value. A read-only component can receive focus.\n */\n readOnly?: boolean;\n\n /**\n * Fired when keyboard focus is set onto the UI control.\n */\n onFocus?: NonCancelableEventHandler<null>;\n\n /**\n * Fired when keyboard focus is removed from the UI control.\n */\n onBlur?: NonCancelableEventHandler<null>;\n\n /**\n * A function that defines whether a particular range is valid or not.\n *\n * Ensure that your function checks for missing fields in the value.\n */\n isValidRange: DateRangePickerProps.ValidationFunction;\n\n /**\n * Specifies whether the component should show a button that\n * allows the user to clear the selected value.\n */\n showClearButton?: boolean;\n\n /**\n * Specifies an additional control displayed in the dropdown, located below the range calendar.\n */\n customAbsoluteRangeControl?: DateRangePickerProps.AbsoluteRangeControl;\n\n /**\n * Specifies the time format to use for displaying the absolute time range.\n *\n * It can take the following values:\n * * `iso`: ISO 8601 format, e.g.: 2024-01-30T13:32:32+01:00 (or 2024-01-30 when `dateOnly` is true)\n * * `long-localized`: a more human-readable, localized format, e.g.: January 30, 2024, 13:32:32 (UTC+1) (or January 30, 2024 when `dateOnly` is true)\n *\n * Defaults to `iso`.\n */\n absoluteFormat?: DateRangePickerProps.AbsoluteFormat;\n\n /**\n * Specifies whether to hide the time offset in the displayed absolute time range.\n * Defaults to `false`.\n */\n hideTimeOffset?: boolean;\n}\n\nexport namespace DateRangePickerProps {\n export type Value = AbsoluteValue | RelativeValue;\n export interface AbsoluteValue {\n /**\n * In ISO8601 format, e.g.: 2021-04-06T17:23:50+02:00 (or 2021-04-06 when `dateOnly` is true)\n */\n startDate: string;\n /**\n * In ISO8601 format, e.g.: 2021-04-06T17:23:50+02:00 (or 2021-04-06 when `dateOnly` is true)\n */\n endDate: string;\n type: 'absolute';\n }\n\n export interface RelativeValue {\n /**\n * If provided, used to match this value\n * to a provided relative option.\n */\n key?: string;\n amount: number;\n unit: TimeUnit;\n type: 'relative';\n }\n export interface RelativeOption {\n /**\n * Used to uniquely identify this relative option.\n */\n key: string;\n amount: number;\n unit: TimeUnit;\n type: 'relative';\n }\n\n export type TimeUnit = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';\n\n export type ValidationFunction = (value: Value | null) => ValidationResult;\n\n export type ValidationResult = ValidRangeResult | InvalidRangeResult;\n\n export interface ValidRangeResult {\n valid: true;\n }\n\n export interface InvalidRangeResult {\n valid: false;\n errorMessage: string;\n }\n\n export interface ChangeDetail {\n /**\n * The newly selected range of this date range picker.\n */\n value: null | Value;\n }\n\n export interface IsDateEnabledFunction {\n (date: Date): boolean;\n }\n\n export interface GetTimeOffsetFunction {\n (date: Date): number;\n }\n\n export interface DateTimeStrings {\n date: string;\n time: string;\n }\n\n export interface PendingAbsoluteValue {\n start: DateTimeStrings;\n end: DateTimeStrings;\n }\n\n export type AbsoluteRangeControl = (\n selectedRange: PendingAbsoluteValue,\n setSelectedRange: React.Dispatch<React.SetStateAction<PendingAbsoluteValue>>\n ) => React.ReactNode;\n\n export type RangeSelectorMode = 'default' | 'absolute-only' | 'relative-only';\n\n export interface Ref {\n /**\n * Sets the browser focus on the UI control\n */\n focus(): void;\n }\n\n export interface I18nStrings {\n /**\n * Adds `aria-label` to the trigger and dropdown.\n */\n ariaLabel?: string;\n\n /**\n * Adds `aria-labelledby` to the trigger and dropdown.\n */\n ariaLabelledby?: string;\n\n /**\n * Adds `aria-describedby` to the trigger and dropdown.\n */\n ariaDescribedby?: string;\n\n /**\n * Label of the mode selection group. In the standard view, it adds 'aria-label' to the group of segments.\n * In a narrow container the label is visible and attached to the select component.\n */\n modeSelectionLabel?: string;\n\n /**\n * Segment title of the relative range selection mode\n */\n relativeModeTitle?: string;\n\n /**\n * Segment title of the absolute range selection mode\n */\n absoluteModeTitle?: string;\n\n /**\n * Heading for the relative range selection area\n */\n relativeRangeSelectionHeading?: string;\n\n /**\n * Visible label of the Cancel button\n */\n cancelButtonLabel?: string;\n /**\n * Visible label of the Clear and dismiss button\n */\n clearButtonLabel?: string;\n /**\n * Visible label of the Apply button\n */\n applyButtonLabel?: string;\n\n /**\n * Formatting function for relative ranges.\n * This function must convert a relative range to a human-readable string.\n */\n formatRelativeRange?: (value: RelativeValue) => string;\n\n /**\n * Formatting function for time units.\n *\n * This function must return a localized form of the unit that fits the provided time value.\n */\n formatUnit?: (unit: TimeUnit, value: number) => string;\n\n /**\n * Visible label for the option for selecting\n * a custom relative range.\n */\n customRelativeRangeOptionLabel?: string;\n\n /**\n * Visible description for the option for selecting\n * a custom relative range.\n */\n customRelativeRangeOptionDescription?: string;\n\n /**\n * Visible label for the duration selector for\n * the custom relative range.\n */\n customRelativeRangeDurationLabel?: string;\n /**\n * Placeholder for the duration selector for\n * the custom relative range.\n */\n customRelativeRangeDurationPlaceholder?: string;\n /**\n * Visible label for the unit selector for the\n * custom relative range.\n */\n customRelativeRangeUnitLabel?: string;\n\n /**\n * Used as part of the aria label for today's date in the calendar.\n */\n todayAriaLabel?: string;\n\n /**\n * An aria label for the 'next month' button.\n */\n nextMonthAriaLabel?: string;\n\n /**\n * An aria label for the 'previous month' button.\n */\n previousMonthAriaLabel?: string;\n\n /**\n * Visible label for the Start Date input for the\n * absolute range.\n */\n startDateLabel?: string;\n /**\n * Visible label for the Start Time input for the\n * absolute range.\n */\n startTimeLabel?: string;\n /**\n * Visible label for the End Date input for the\n * absolute range.\n */\n endDateLabel?: string;\n /**\n * Visible label for the End Time input for the\n * absolute range.\n */\n endTimeLabel?: string;\n\n /**\n * Constraint text for the input fields for the\n * absolute range.\n */\n dateTimeConstraintText?: string;\n\n /**\n * Provides a text alternative for the error icon in the error alert.\n */\n errorIconAriaLabel?: string;\n\n /**\n * When the property is set, screen readers announce the selected range when the absolute range gets selected.\n */\n renderSelectedAbsoluteRangeAriaLive?: (startDate: string, endDate: string) => string;\n }\n\n export type AbsoluteFormat = 'iso' | 'long-localized';\n}\n\nexport type DayIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\nexport type RangeCalendarI18nStrings = Pick<\n DateRangePickerProps.I18nStrings,\n | 'todayAriaLabel'\n | 'nextMonthAriaLabel'\n | 'previousMonthAriaLabel'\n | 'startDateLabel'\n | 'startTimeLabel'\n | 'endDateLabel'\n | 'endTimeLabel'\n | 'dateTimeConstraintText'\n | 'renderSelectedAbsoluteRangeAriaLive'\n>;\n"]}
|
package/internal/environment.js
CHANGED
package/internal/manifest.json
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { DrawersApiInternal, DrawersApiPublic } from './controllers/drawers';
|
|
2
2
|
import { ActionsApiInternal, ActionsApiPublic } from './controllers/action-buttons';
|
|
3
|
+
import { BreadcrumbsApiInternal } from './controllers/breadcrumbs';
|
|
4
|
+
import { BreadcrumbGroupProps } from '../../breadcrumb-group/interfaces';
|
|
3
5
|
interface AwsuiApi {
|
|
4
6
|
awsuiPlugins: {
|
|
5
7
|
appLayout: DrawersApiPublic;
|
|
@@ -10,6 +12,7 @@ interface AwsuiApi {
|
|
|
10
12
|
appLayout: DrawersApiInternal;
|
|
11
13
|
alert: ActionsApiInternal;
|
|
12
14
|
flashbar: ActionsApiInternal;
|
|
15
|
+
breadcrumbs: BreadcrumbsApiInternal<BreadcrumbGroupProps>;
|
|
13
16
|
};
|
|
14
17
|
}
|
|
15
18
|
export declare function loadApi(): AwsuiApi;
|
|
@@ -21,6 +24,7 @@ export declare const awsuiPlugins: {
|
|
|
21
24
|
appLayout: DrawersApiInternal;
|
|
22
25
|
alert: ActionsApiInternal;
|
|
23
26
|
flashbar: ActionsApiInternal;
|
|
27
|
+
breadcrumbs: BreadcrumbsApiInternal<BreadcrumbGroupProps>;
|
|
24
28
|
};
|
|
25
29
|
export {};
|
|
26
30
|
//# sourceMappingURL=api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../src/internal/plugins/api.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAqB,MAAM,uBAAuB,CAAC;AAChG,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAA2B,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../src/internal/plugins/api.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAqB,MAAM,uBAAuB,CAAC;AAChG,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAA2B,MAAM,8BAA8B,CAAC;AAC7G,OAAO,EAAE,sBAAsB,EAAyB,MAAM,2BAA2B,CAAC;AAC1F,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAIzE,UAAU,QAAQ;IAChB,YAAY,EAAE;QACZ,SAAS,EAAE,gBAAgB,CAAC;QAC5B,KAAK,EAAE,gBAAgB,CAAC;QACxB,QAAQ,EAAE,gBAAgB,CAAC;KAC5B,CAAC;IACF,oBAAoB,EAAE;QACpB,SAAS,EAAE,kBAAkB,CAAC;QAC9B,KAAK,EAAE,kBAAkB,CAAC;QAC1B,QAAQ,EAAE,kBAAkB,CAAC;QAC7B,WAAW,EAAE,sBAAsB,CAAC,oBAAoB,CAAC,CAAC;KAC3D,CAAC;CACH;AAwBD,wBAAgB,OAAO,aAQtB;AAED,eAAO,MAAQ,YAAY;eA5CZ,gBAAgB;WACpB,gBAAgB;cACb,gBAAgB;GA0CD,oBAAoB;eAvClC,kBAAkB;WACtB,kBAAkB;cACf,kBAAkB;iBACf,uBAAuB,oBAAoB,CAAC;CAoCE,CAAC"}
|
package/internal/plugins/api.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { DrawersController } from './controllers/drawers';
|
|
4
4
|
import { ActionButtonsController } from './controllers/action-buttons';
|
|
5
|
+
import { BreadcrumbsController } from './controllers/breadcrumbs';
|
|
5
6
|
const storageKey = Symbol.for('awsui-plugin-api');
|
|
6
7
|
function findUpApi(currentWindow) {
|
|
7
8
|
try {
|
|
@@ -42,6 +43,8 @@ function installApi(api) {
|
|
|
42
43
|
const flashbarActions = new ActionButtonsController();
|
|
43
44
|
api.awsuiPlugins.flashbar = flashbarActions.installPublic(api.awsuiPlugins.flashbar);
|
|
44
45
|
api.awsuiPluginsInternal.flashbar = flashbarActions.installInternal(api.awsuiPluginsInternal.flashbar);
|
|
46
|
+
const breadcrumbs = new BreadcrumbsController();
|
|
47
|
+
api.awsuiPluginsInternal.breadcrumbs = breadcrumbs.installInternal(api.awsuiPluginsInternal.breadcrumbs);
|
|
45
48
|
return api;
|
|
46
49
|
}
|
|
47
50
|
//# sourceMappingURL=api.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../../src/internal/plugins/api.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAwC,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAChG,OAAO,EAAwC,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../../src/internal/plugins/api.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAwC,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAChG,OAAO,EAAwC,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAC7G,OAAO,EAA0B,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAG1F,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;AAoBlD,SAAS,SAAS,CAAC,aAA4B;IAC7C,IAAI;QACF,IAAI,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAG,UAAU,CAAC,EAAE;YAC/B,OAAO,aAAa,CAAC,UAAU,CAAC,CAAC;SAClC;QAED,IAAI,CAAC,aAAa,IAAI,aAAa,CAAC,MAAM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,GAAG,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IAC5E,GAAG,CAAC,oBAAoB,CAAC,KAAK,GAAG,YAAY,CAAC,eAAe,CAAC,GAAG,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;IAE9F,MAAM,eAAe,GAAG,IAAI,uBAAuB,EAAE,CAAC;IACtD,GAAG,CAAC,YAAY,CAAC,QAAQ,GAAG,eAAe,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IACrF,GAAG,CAAC,oBAAoB,CAAC,QAAQ,GAAG,eAAe,CAAC,eAAe,CAAC,GAAG,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IAEvG,MAAM,WAAW,GAAG,IAAI,qBAAqB,EAAwB,CAAC;IACtE,GAAG,CAAC,oBAAoB,CAAC,WAAW,GAAG,WAAW,CAAC,eAAe,CAAC,GAAG,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC;IAEzG,OAAO,GAAe,CAAC;AACzB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { DrawersApiInternal, DrawersApiPublic, DrawersController } from './controllers/drawers';\nimport { ActionsApiInternal, ActionsApiPublic, ActionButtonsController } from './controllers/action-buttons';\nimport { BreadcrumbsApiInternal, BreadcrumbsController } from './controllers/breadcrumbs';\nimport { BreadcrumbGroupProps } from '../../breadcrumb-group/interfaces';\n\nconst storageKey = Symbol.for('awsui-plugin-api');\n\ninterface AwsuiApi {\n awsuiPlugins: {\n appLayout: DrawersApiPublic;\n alert: ActionsApiPublic;\n flashbar: ActionsApiPublic;\n };\n awsuiPluginsInternal: {\n appLayout: DrawersApiInternal;\n alert: ActionsApiInternal;\n flashbar: ActionsApiInternal;\n breadcrumbs: BreadcrumbsApiInternal<BreadcrumbGroupProps>;\n };\n}\n\ninterface WindowWithApi extends Window {\n [storageKey]: AwsuiApi;\n}\n\nfunction findUpApi(currentWindow: WindowWithApi): AwsuiApi | undefined {\n try {\n if (currentWindow?.[storageKey]) {\n return currentWindow[storageKey];\n }\n\n if (!currentWindow || currentWindow.parent === currentWindow) {\n // When the window has no more parents, it references itself\n return undefined;\n }\n\n return findUpApi(currentWindow.parent as WindowWithApi);\n } catch (ex) {\n // Most likely a cross-origin access error\n return undefined;\n }\n}\n\nexport function loadApi() {\n if (typeof window === 'undefined') {\n return installApi({});\n }\n const win = window as unknown as WindowWithApi;\n const existingApi = findUpApi(win);\n win[storageKey] = installApi(existingApi ?? {});\n return win[storageKey];\n}\n\nexport const { awsuiPlugins, awsuiPluginsInternal } = loadApi();\n\ntype DeepPartial<T> = T extends (...args: any) => any ? T : { [P in keyof T]?: DeepPartial<T[P]> };\n\nfunction installApi(api: DeepPartial<AwsuiApi>): AwsuiApi {\n api.awsuiPlugins ??= {};\n api.awsuiPluginsInternal ??= {};\n\n const appLayoutDrawers = new DrawersController();\n api.awsuiPlugins.appLayout = appLayoutDrawers.installPublic(api.awsuiPlugins.appLayout);\n api.awsuiPluginsInternal.appLayout = appLayoutDrawers.installInternal(api.awsuiPluginsInternal.appLayout);\n\n const alertActions = new ActionButtonsController();\n api.awsuiPlugins.alert = alertActions.installPublic(api.awsuiPlugins.alert);\n api.awsuiPluginsInternal.alert = alertActions.installInternal(api.awsuiPluginsInternal.alert);\n\n const flashbarActions = new ActionButtonsController();\n api.awsuiPlugins.flashbar = flashbarActions.installPublic(api.awsuiPlugins.flashbar);\n api.awsuiPluginsInternal.flashbar = flashbarActions.installInternal(api.awsuiPluginsInternal.flashbar);\n\n const breadcrumbs = new BreadcrumbsController<BreadcrumbGroupProps>();\n api.awsuiPluginsInternal.breadcrumbs = breadcrumbs.installInternal(api.awsuiPluginsInternal.breadcrumbs);\n\n return api as AwsuiApi;\n}\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
type ChangeCallback<T> = (props: T | null) => void;
|
|
2
|
+
export interface BreadcrumbsGlobalRegistration<T> {
|
|
3
|
+
update(props: T): void;
|
|
4
|
+
cleanup(): void;
|
|
5
|
+
}
|
|
6
|
+
export interface BreadcrumbsApiInternal<T> {
|
|
7
|
+
registerAppLayout: (changeCallback: ChangeCallback<T>) => (() => void) | void;
|
|
8
|
+
registerBreadcrumbs: (props: T, onRegistered: () => void) => BreadcrumbsGlobalRegistration<T>;
|
|
9
|
+
getStateForTesting: () => {
|
|
10
|
+
appLayoutUpdateCallback: ChangeCallback<T> | null;
|
|
11
|
+
breadcrumbInstances: Array<{
|
|
12
|
+
props: T;
|
|
13
|
+
}>;
|
|
14
|
+
breadcrumbRegistrations: Array<() => void>;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export declare class BreadcrumbsController<T> {
|
|
18
|
+
#private;
|
|
19
|
+
registerAppLayout: (changeCallback: ChangeCallback<T>) => (() => void) | undefined;
|
|
20
|
+
registerBreadcrumbs: (props: T, onRegistered: () => void) => BreadcrumbsGlobalRegistration<T>;
|
|
21
|
+
getStateForTesting: () => {
|
|
22
|
+
appLayoutUpdateCallback: ChangeCallback<T> | null;
|
|
23
|
+
breadcrumbInstances: {
|
|
24
|
+
props: T;
|
|
25
|
+
}[];
|
|
26
|
+
breadcrumbRegistrations: (() => void)[];
|
|
27
|
+
};
|
|
28
|
+
installInternal(internalApi?: Partial<BreadcrumbsApiInternal<T>>): BreadcrumbsApiInternal<T>;
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=breadcrumbs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"breadcrumbs.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/controllers/breadcrumbs.ts"],"names":[],"mappings":"AAIA,KAAK,cAAc,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,KAAK,IAAI,CAAC;AAEnD,MAAM,WAAW,6BAA6B,CAAC,CAAC;IAC9C,MAAM,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IACvB,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,sBAAsB,CAAC,CAAC;IACvC,iBAAiB,EAAE,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC;IAC9E,mBAAmB,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,YAAY,EAAE,MAAM,IAAI,KAAK,6BAA6B,CAAC,CAAC,CAAC,CAAC;IAC9F,kBAAkB,EAAE,MAAM;QACxB,uBAAuB,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;QAClD,mBAAmB,EAAE,KAAK,CAAC;YAAE,KAAK,EAAE,CAAC,CAAA;SAAE,CAAC,CAAC;QACzC,uBAAuB,EAAE,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC;KAC5C,CAAC;CACH;AAED,qBAAa,qBAAqB,CAAC,CAAC;;IAoBlC,iBAAiB,mBAAoB,eAAe,CAAC,CAAC,8BASpD;IAEF,mBAAmB,UAAW,CAAC,gBAAgB,MAAM,IAAI,KAAG,8BAA8B,CAAC,CAAC,CAiB1F;IAEF,kBAAkB;;;mBAhDmB,CAAC;;wCACA,IAAI;MAqDxC;IAEF,eAAe,CAAC,WAAW,GAAE,OAAO,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAM,GAAG,sBAAsB,CAAC,CAAC,CAAC;CAOjG"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
var _BreadcrumbsController_appLayoutUpdateCallback, _BreadcrumbsController_breadcrumbInstances, _BreadcrumbsController_breadcrumbRegistrations, _BreadcrumbsController_notifyAppLayout, _BreadcrumbsController_notifyBreadcrumbs;
|
|
2
|
+
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
|
|
3
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
import debounce from '../../debounce';
|
|
6
|
+
export class BreadcrumbsController {
|
|
7
|
+
constructor() {
|
|
8
|
+
_BreadcrumbsController_appLayoutUpdateCallback.set(this, null);
|
|
9
|
+
_BreadcrumbsController_breadcrumbInstances.set(this, []);
|
|
10
|
+
_BreadcrumbsController_breadcrumbRegistrations.set(this, []);
|
|
11
|
+
_BreadcrumbsController_notifyAppLayout.set(this, debounce(() => {
|
|
12
|
+
var _a;
|
|
13
|
+
if (!__classPrivateFieldGet(this, _BreadcrumbsController_appLayoutUpdateCallback, "f")) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const latestBreadcrumb = __classPrivateFieldGet(this, _BreadcrumbsController_breadcrumbInstances, "f")[__classPrivateFieldGet(this, _BreadcrumbsController_breadcrumbInstances, "f").length - 1];
|
|
17
|
+
__classPrivateFieldGet(this, _BreadcrumbsController_appLayoutUpdateCallback, "f").call(this, (_a = latestBreadcrumb === null || latestBreadcrumb === void 0 ? void 0 : latestBreadcrumb.props) !== null && _a !== void 0 ? _a : null);
|
|
18
|
+
}, 0));
|
|
19
|
+
_BreadcrumbsController_notifyBreadcrumbs.set(this, debounce(() => {
|
|
20
|
+
if (!__classPrivateFieldGet(this, _BreadcrumbsController_appLayoutUpdateCallback, "f")) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
__classPrivateFieldGet(this, _BreadcrumbsController_breadcrumbRegistrations, "f").forEach(listener => listener());
|
|
24
|
+
}, 0));
|
|
25
|
+
this.registerAppLayout = (changeCallback) => {
|
|
26
|
+
if (__classPrivateFieldGet(this, _BreadcrumbsController_appLayoutUpdateCallback, "f")) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
__classPrivateFieldSet(this, _BreadcrumbsController_appLayoutUpdateCallback, changeCallback, "f");
|
|
30
|
+
__classPrivateFieldGet(this, _BreadcrumbsController_notifyBreadcrumbs, "f").call(this);
|
|
31
|
+
return () => {
|
|
32
|
+
__classPrivateFieldSet(this, _BreadcrumbsController_appLayoutUpdateCallback, null, "f");
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
this.registerBreadcrumbs = (props, onRegistered) => {
|
|
36
|
+
const instance = { props: props };
|
|
37
|
+
__classPrivateFieldGet(this, _BreadcrumbsController_breadcrumbInstances, "f").push(instance);
|
|
38
|
+
__classPrivateFieldGet(this, _BreadcrumbsController_breadcrumbRegistrations, "f").push(onRegistered);
|
|
39
|
+
__classPrivateFieldGet(this, _BreadcrumbsController_notifyBreadcrumbs, "f").call(this);
|
|
40
|
+
__classPrivateFieldGet(this, _BreadcrumbsController_notifyAppLayout, "f").call(this);
|
|
41
|
+
return {
|
|
42
|
+
update: props => {
|
|
43
|
+
instance.props = props;
|
|
44
|
+
__classPrivateFieldGet(this, _BreadcrumbsController_notifyAppLayout, "f").call(this);
|
|
45
|
+
},
|
|
46
|
+
cleanup: () => {
|
|
47
|
+
__classPrivateFieldGet(this, _BreadcrumbsController_breadcrumbInstances, "f").splice(__classPrivateFieldGet(this, _BreadcrumbsController_breadcrumbInstances, "f").indexOf(instance), 1);
|
|
48
|
+
__classPrivateFieldGet(this, _BreadcrumbsController_breadcrumbRegistrations, "f").splice(__classPrivateFieldGet(this, _BreadcrumbsController_breadcrumbRegistrations, "f").indexOf(onRegistered), 1);
|
|
49
|
+
__classPrivateFieldGet(this, _BreadcrumbsController_notifyAppLayout, "f").call(this);
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
this.getStateForTesting = () => {
|
|
54
|
+
return {
|
|
55
|
+
appLayoutUpdateCallback: __classPrivateFieldGet(this, _BreadcrumbsController_appLayoutUpdateCallback, "f"),
|
|
56
|
+
breadcrumbInstances: __classPrivateFieldGet(this, _BreadcrumbsController_breadcrumbInstances, "f"),
|
|
57
|
+
breadcrumbRegistrations: __classPrivateFieldGet(this, _BreadcrumbsController_breadcrumbRegistrations, "f"),
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
installInternal(internalApi = {}) {
|
|
62
|
+
var _a, _b, _c;
|
|
63
|
+
(_a = internalApi.registerBreadcrumbs) !== null && _a !== void 0 ? _a : (internalApi.registerBreadcrumbs = this.registerBreadcrumbs);
|
|
64
|
+
(_b = internalApi.registerAppLayout) !== null && _b !== void 0 ? _b : (internalApi.registerAppLayout = this.registerAppLayout);
|
|
65
|
+
(_c = internalApi.getStateForTesting) !== null && _c !== void 0 ? _c : (internalApi.getStateForTesting = this.getStateForTesting);
|
|
66
|
+
return internalApi;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
_BreadcrumbsController_appLayoutUpdateCallback = new WeakMap(), _BreadcrumbsController_breadcrumbInstances = new WeakMap(), _BreadcrumbsController_breadcrumbRegistrations = new WeakMap(), _BreadcrumbsController_notifyAppLayout = new WeakMap(), _BreadcrumbsController_notifyBreadcrumbs = new WeakMap();
|
|
70
|
+
//# sourceMappingURL=breadcrumbs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"breadcrumbs.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/controllers/breadcrumbs.ts"],"names":[],"mappings":";;AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAmBtC,MAAM,OAAO,qBAAqB;IAAlC;QACE,yDAAqD,IAAI,EAAC;QAC1D,qDAA4C,EAAE,EAAC;QAC/C,yDAA8C,EAAE,EAAC;QAEjD,iDAAmB,QAAQ,CAAC,GAAG,EAAE;;YAC/B,IAAI,CAAC,uBAAA,IAAI,sDAAyB,EAAE;gBAClC,OAAO;aACR;YACD,MAAM,gBAAgB,GAAG,uBAAA,IAAI,kDAAqB,CAAC,uBAAA,IAAI,kDAAqB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YACzF,uBAAA,IAAI,sDAAyB,MAA7B,IAAI,EAA0B,MAAA,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,KAAK,mCAAI,IAAI,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AQ,CAAC,EAAE,CAAC,CAAC,CAAC;oBACjF,uBAAA,IAAI,sDAAyB,CAAC,MAAM,CAAC,uBAAA,IAAI,sDAAyB,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC;oBAC7F,uBAAA,IAAI,8CAAiB,MAArB,IAAI,CAAmB,CAAC;gBAC1B,CAAC;aACF,CAAC;QACJ,CAAC,CAAC;QAEF,uBAAkB,GAAG,GAAG,EAAE;YACxB,OAAO;gBACL,uBAAuB,EAAE,uBAAA,IAAI,sDAAyB;gBACtD,mBAAmB,EAAE,uBAAA,IAAI,kDAAqB;gBAC9C,uBAAuB,EAAE,uBAAA,IAAI,sDAAyB;aACvD,CAAC;QACJ,CAAC,CAAC;IASJ,CAAC;IAPC,eAAe,CAAC,cAAkD,EAAE;;QAClE,MAAA,WAAW,CAAC,mBAAmB,oCAA/B,WAAW,CAAC,mBAAmB,GAAK,IAAI,CAAC,mBAAmB,EAAC;QAC7D,MAAA,WAAW,CAAC,iBAAiB,oCAA7B,WAAW,CAAC,iBAAiB,GAAK,IAAI,CAAC,iBAAiB,EAAC;QACzD,MAAA,WAAW,CAAC,kBAAkB,oCAA9B,WAAW,CAAC,kBAAkB,GAAK,IAAI,CAAC,kBAAkB,EAAC;QAE3D,OAAO,WAAwC,CAAC;IAClD,CAAC;CACF","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport debounce from '../../debounce';\n\ntype ChangeCallback<T> = (props: T | null) => void;\n\nexport interface BreadcrumbsGlobalRegistration<T> {\n update(props: T): void;\n cleanup(): void;\n}\n\nexport interface BreadcrumbsApiInternal<T> {\n registerAppLayout: (changeCallback: ChangeCallback<T>) => (() => void) | void;\n registerBreadcrumbs: (props: T, onRegistered: () => void) => BreadcrumbsGlobalRegistration<T>;\n getStateForTesting: () => {\n appLayoutUpdateCallback: ChangeCallback<T> | null;\n breadcrumbInstances: Array<{ props: T }>;\n breadcrumbRegistrations: Array<() => void>;\n };\n}\n\nexport class BreadcrumbsController<T> {\n #appLayoutUpdateCallback: ChangeCallback<T> | null = null;\n #breadcrumbInstances: Array<{ props: T }> = [];\n #breadcrumbRegistrations: Array<() => void> = [];\n\n #notifyAppLayout = debounce(() => {\n if (!this.#appLayoutUpdateCallback) {\n return;\n }\n const latestBreadcrumb = this.#breadcrumbInstances[this.#breadcrumbInstances.length - 1];\n this.#appLayoutUpdateCallback(latestBreadcrumb?.props ?? null);\n }, 0);\n\n #notifyBreadcrumbs = debounce(() => {\n if (!this.#appLayoutUpdateCallback) {\n return;\n }\n this.#breadcrumbRegistrations.forEach(listener => listener());\n }, 0);\n\n registerAppLayout = (changeCallback: ChangeCallback<T>) => {\n if (this.#appLayoutUpdateCallback) {\n return;\n }\n this.#appLayoutUpdateCallback = changeCallback;\n this.#notifyBreadcrumbs();\n return () => {\n this.#appLayoutUpdateCallback = null;\n };\n };\n\n registerBreadcrumbs = (props: T, onRegistered: () => void): BreadcrumbsGlobalRegistration<T> => {\n const instance = { props: props };\n this.#breadcrumbInstances.push(instance);\n this.#breadcrumbRegistrations.push(onRegistered);\n this.#notifyBreadcrumbs();\n this.#notifyAppLayout();\n return {\n update: props => {\n instance.props = props;\n this.#notifyAppLayout();\n },\n cleanup: () => {\n this.#breadcrumbInstances.splice(this.#breadcrumbInstances.indexOf(instance), 1);\n this.#breadcrumbRegistrations.splice(this.#breadcrumbRegistrations.indexOf(onRegistered), 1);\n this.#notifyAppLayout();\n },\n };\n };\n\n getStateForTesting = () => {\n return {\n appLayoutUpdateCallback: this.#appLayoutUpdateCallback,\n breadcrumbInstances: this.#breadcrumbInstances,\n breadcrumbRegistrations: this.#breadcrumbRegistrations,\n };\n };\n\n installInternal(internalApi: Partial<BreadcrumbsApiInternal<T>> = {}): BreadcrumbsApiInternal<T> {\n internalApi.registerBreadcrumbs ??= this.registerBreadcrumbs;\n internalApi.registerAppLayout ??= this.registerAppLayout;\n internalApi.getStateForTesting ??= this.getStateForTesting;\n\n return internalApi as BreadcrumbsApiInternal<T>;\n }\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { BreadcrumbGroupProps } from '../../../breadcrumb-group/interfaces';
|
|
2
|
+
export declare function useSetGlobalBreadcrumbs<T extends BreadcrumbGroupProps.Item>(props: BreadcrumbGroupProps<T>): boolean;
|
|
3
|
+
export declare function useGetGlobalBreadcrumbs(): BreadcrumbGroupProps<any> | null;
|
|
4
|
+
//# sourceMappingURL=use-global-breadcrumbs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-global-breadcrumbs.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/helpers/use-global-breadcrumbs.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAyB5E,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,oBAAoB,CAAC,IAAI,EAAE,KAAK,EAAE,oBAAoB,CAAC,CAAC,CAAC,WAQ1G;AAED,wBAAgB,uBAAuB,qCAUtC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
4
|
+
import { awsuiPluginsInternal } from '../api';
|
|
5
|
+
import { getGlobalFlag } from '../../utils/global-flags';
|
|
6
|
+
function useSetGlobalBreadcrumbsImplementation(props) {
|
|
7
|
+
const registrationRef = useRef();
|
|
8
|
+
const [registered, setRegistered] = useState(false);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
const registration = awsuiPluginsInternal.breadcrumbs.registerBreadcrumbs(props, () => setRegistered(true));
|
|
11
|
+
registrationRef.current = registration;
|
|
12
|
+
return () => {
|
|
13
|
+
registration.cleanup();
|
|
14
|
+
};
|
|
15
|
+
// subsequent prop changes are handled by another effect
|
|
16
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
17
|
+
}, []);
|
|
18
|
+
useLayoutEffect(() => {
|
|
19
|
+
var _a;
|
|
20
|
+
(_a = registrationRef.current) === null || _a === void 0 ? void 0 : _a.update(props);
|
|
21
|
+
});
|
|
22
|
+
return registered;
|
|
23
|
+
}
|
|
24
|
+
export function useSetGlobalBreadcrumbs(props) {
|
|
25
|
+
// avoid additional side effects when this feature is not active
|
|
26
|
+
if (!getGlobalFlag('appLayoutWidget')) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
// getGlobalFlag() value does not change without full page reload
|
|
30
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
31
|
+
return useSetGlobalBreadcrumbsImplementation(props);
|
|
32
|
+
}
|
|
33
|
+
export function useGetGlobalBreadcrumbs() {
|
|
34
|
+
const [discoveredBreadcrumbs, setDiscoveredBreadcrumbs] = useState(null);
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
return awsuiPluginsInternal.breadcrumbs.registerAppLayout(breadcrumbs => {
|
|
37
|
+
setDiscoveredBreadcrumbs(breadcrumbs);
|
|
38
|
+
});
|
|
39
|
+
}, []);
|
|
40
|
+
return discoveredBreadcrumbs;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=use-global-breadcrumbs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-global-breadcrumbs.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/helpers/use-global-breadcrumbs.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAIzD,SAAS,qCAAqC,CAAC,KAAgC;IAC7E,MAAM,eAAe,GAA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License-Identifier: Apache-2.0\nimport { useEffect, useLayoutEffect, useRef, useState } from 'react';\nimport { awsuiPluginsInternal } from '../api';\nimport { getGlobalFlag } from '../../utils/global-flags';\nimport { BreadcrumbGroupProps } from '../../../breadcrumb-group/interfaces';\nimport { BreadcrumbsGlobalRegistration } from '../controllers/breadcrumbs';\n\nfunction useSetGlobalBreadcrumbsImplementation(props: BreadcrumbGroupProps<any>) {\n const registrationRef = useRef<BreadcrumbsGlobalRegistration<BreadcrumbGroupProps> | null>();\n const [registered, setRegistered] = useState(false);\n\n useEffect(() => {\n const registration = awsuiPluginsInternal.breadcrumbs.registerBreadcrumbs(props, () => setRegistered(true));\n registrationRef.current = registration;\n\n return () => {\n registration.cleanup();\n };\n // subsequent prop changes are handled by another effect\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useLayoutEffect(() => {\n registrationRef.current?.update(props);\n });\n\n return registered;\n}\n\nexport function useSetGlobalBreadcrumbs<T extends BreadcrumbGroupProps.Item>(props: BreadcrumbGroupProps<T>) {\n // avoid additional side effects when this feature is not active\n if (!getGlobalFlag('appLayoutWidget')) {\n return false;\n }\n // getGlobalFlag() value does not change without full page reload\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useSetGlobalBreadcrumbsImplementation(props);\n}\n\nexport function useGetGlobalBreadcrumbs() {\n const [discoveredBreadcrumbs, setDiscoveredBreadcrumbs] = useState<BreadcrumbGroupProps<any> | null>(null);\n\n useEffect(() => {\n return awsuiPluginsInternal.breadcrumbs.registerAppLayout(breadcrumbs => {\n setDiscoveredBreadcrumbs(breadcrumbs);\n });\n }, []);\n\n return discoveredBreadcrumbs;\n}\n"]}
|
package/package.json
CHANGED