@gooddata/sdk-ui-kit 11.36.0-alpha.6 → 11.36.0
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/esm/@ui/UiMenu/hooks.js
CHANGED
|
@@ -16,7 +16,7 @@ import { getClosestFocusableSibling, getFocusableItem, getItemInteractiveParent,
|
|
|
16
16
|
* @internal
|
|
17
17
|
*/
|
|
18
18
|
export function useUiMenuContextValue(props, menuComponentRef, itemsContainerRef) {
|
|
19
|
-
const { items, size = "medium", itemDataTestId, onSelect, onLevelChange, onClose, InteractiveItem: InteractiveItemComponent = DefaultUiMenuInteractiveItem, InteractiveItemWrapper: InteractiveItemWrapperComponent = DefaultUiMenuInteractiveItemWrapper, StaticItem: StaticItemComponent = DefaultUiMenuStaticItem, GroupItem: GroupItemComponent = DefaultUiMenuGroupItem, MenuHeader: MenuHeaderComponent = DefaultUiMenuHeader, ContentItem: ContentItemComponent = DefaultUiMenuContentItem, ContentItemWrapper: ContentItemWrapperComponent = DefaultUiMenuContentItemWrapper, Content: ContentComponent = DefaultUiMenuContent, shouldCloseOnSelect = true, isDisabledFocusable = true, ariaAttributes, menuCtxData, } = props;
|
|
19
|
+
const { items, size = "medium", itemDataTestId, onSelect, onLeaveLevel, onEnterLevel, onLevelChange, onClose, InteractiveItem: InteractiveItemComponent = DefaultUiMenuInteractiveItem, InteractiveItemWrapper: InteractiveItemWrapperComponent = DefaultUiMenuInteractiveItemWrapper, StaticItem: StaticItemComponent = DefaultUiMenuStaticItem, GroupItem: GroupItemComponent = DefaultUiMenuGroupItem, MenuHeader: MenuHeaderComponent = DefaultUiMenuHeader, ContentItem: ContentItemComponent = DefaultUiMenuContentItem, ContentItemWrapper: ContentItemWrapperComponent = DefaultUiMenuContentItemWrapper, Content: ContentComponent = DefaultUiMenuContent, shouldCloseOnSelect = true, isDisabledFocusable = true, ariaAttributes, menuCtxData, } = props;
|
|
20
20
|
const [controlType, setControlType] = useState("unknown");
|
|
21
21
|
const isItemFocusable = useCallback((item) => {
|
|
22
22
|
if (!item || (item.type !== "interactive" && item.type !== "content")) {
|
|
@@ -128,6 +128,8 @@ export function useUiMenuContextValue(props, menuComponentRef, itemsContainerRef
|
|
|
128
128
|
items,
|
|
129
129
|
size,
|
|
130
130
|
onSelect: handleSelectItem,
|
|
131
|
+
onLeaveLevel,
|
|
132
|
+
onEnterLevel,
|
|
131
133
|
itemDataTestId,
|
|
132
134
|
isItemFocusable,
|
|
133
135
|
makeItemId,
|
|
@@ -171,6 +173,8 @@ export function useUiMenuContextValue(props, menuComponentRef, itemsContainerRef
|
|
|
171
173
|
shownCustomContentItemId,
|
|
172
174
|
shownSubview,
|
|
173
175
|
size,
|
|
176
|
+
onLeaveLevel,
|
|
177
|
+
onEnterLevel,
|
|
174
178
|
]);
|
|
175
179
|
}
|
|
176
180
|
/**
|
|
@@ -222,7 +226,10 @@ export function useKeyNavigation({ menuContextValue, shouldKeyboardActionPrevent
|
|
|
222
226
|
onSelect(focusedItem, e);
|
|
223
227
|
},
|
|
224
228
|
onEnterLevel: (e) => {
|
|
225
|
-
const { onSelect, focusedItem } = menuContextRef.current;
|
|
229
|
+
const { onSelect, onEnterLevel, focusedItem } = menuContextRef.current;
|
|
230
|
+
if (onEnterLevel?.(focusedItem, e)) {
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
226
233
|
if ((focusedItem?.type !== "interactive" && focusedItem?.type !== "content") ||
|
|
227
234
|
(focusedItem?.type === "interactive" && !focusedItem.subItems) ||
|
|
228
235
|
(focusedItem?.type === "content" && !focusedItem.Component)) {
|
|
@@ -230,8 +237,11 @@ export function useKeyNavigation({ menuContextValue, shouldKeyboardActionPrevent
|
|
|
230
237
|
}
|
|
231
238
|
onSelect(focusedItem, e);
|
|
232
239
|
},
|
|
233
|
-
onLeaveLevel: () => {
|
|
234
|
-
const { setFocusedId, items } = menuContextRef.current;
|
|
240
|
+
onLeaveLevel: (e) => {
|
|
241
|
+
const { setFocusedId, onLeaveLevel, focusedItem, items } = menuContextRef.current;
|
|
242
|
+
if (onLeaveLevel?.(focusedItem, e)) {
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
235
245
|
setFocusedId((prevId) => {
|
|
236
246
|
if (prevId === undefined) {
|
|
237
247
|
return prevId;
|
|
@@ -156,6 +156,8 @@ export interface IUiMenuContext<T extends IUiMenuItemData = object, M = object>
|
|
|
156
156
|
pushShownSubview: (subview: IUiMenuSubview) => void;
|
|
157
157
|
popShownSubview: () => void;
|
|
158
158
|
onSelect: (item: IUiMenuFocusableItem<T> | undefined, event: MouseEvent | KeyboardEvent) => void;
|
|
159
|
+
onEnterLevel?: (item: IUiMenuFocusableItem<T> | undefined, event: MouseEvent | KeyboardEvent) => boolean;
|
|
160
|
+
onLeaveLevel?: (item: IUiMenuFocusableItem<T> | undefined, event: MouseEvent | KeyboardEvent) => boolean;
|
|
159
161
|
onClose?: () => void;
|
|
160
162
|
setFocusedId: Dispatch<SetStateAction<string | undefined>>;
|
|
161
163
|
isItemFocusable: (item: IUiMenuItem<T>) => boolean;
|
|
@@ -187,6 +189,8 @@ export interface IUiMenuProps<T extends IUiMenuItemData = object, M = object> ex
|
|
|
187
189
|
containerBottomPadding?: "none" | "small" | "medium";
|
|
188
190
|
containerTopPadding?: "none" | "small" | "medium";
|
|
189
191
|
onSelect?: (item: IUiMenuInteractiveItem<T>, event: MouseEvent | KeyboardEvent) => void;
|
|
192
|
+
onEnterLevel?: (item: IUiMenuFocusableItem<T> | undefined, event: MouseEvent | KeyboardEvent) => boolean;
|
|
193
|
+
onLeaveLevel?: (item: IUiMenuFocusableItem<T> | undefined, event: MouseEvent | KeyboardEvent) => boolean;
|
|
190
194
|
onLevelChange?: (level: number, item?: IUiMenuContentItem<T> | IUiMenuInteractiveItem<T>) => void;
|
|
191
195
|
onClose?: () => void;
|
|
192
196
|
onUnhandledKeyDown?: (event: KeyboardEvent, context: IUiMenuContext<T>) => void;
|
|
@@ -71,7 +71,7 @@ function createInsightsItemsGroup(featureFlags, workspaceId, workspacePermission
|
|
|
71
71
|
pushConditionally(insightItemsGroup, createIHeaderMenuItem(HEADER_ITEM_ID_METRICS, "s-menu-metrics", measuresUrl), canShowMetricsItem(hasMeasures, workspacePermissions));
|
|
72
72
|
const dataUrl = dataItemUrl(workspaceId, workspacePermissions, backendSupportsDataItem, hasNoDataSet, baseUrl);
|
|
73
73
|
pushConditionally(insightItemsGroup, createIHeaderMenuItem(HEADER_ITEM_ID_DATA, "s-menu-data", dataUrl), canShowDataItem(featureFlags, workspacePermissions));
|
|
74
|
-
pushConditionally(insightItemsGroup, createIHeaderMenuItem(HEADER_ITEM_ID_CATALOG, "s-menu-workspace-catalog", catalogItemUrl(workspaceId), true), canShowCatalogItem(featureFlags, workspacePermissions));
|
|
74
|
+
pushConditionally(insightItemsGroup, createIHeaderMenuItem(HEADER_ITEM_ID_CATALOG, "s-menu-workspace-catalog", catalogItemUrl(workspaceId, featureFlags), true), canShowCatalogItem(featureFlags, workspacePermissions));
|
|
75
75
|
const loadUrl = loadItemUrl(baseUrl, workspaceId);
|
|
76
76
|
pushConditionally(insightItemsGroup, createIHeaderMenuItem(HEADER_ITEM_ID_LOAD, "s-menu-load", loadUrl), canShowLoadItem(featureFlags, workspacePermissions, isFreemiumCustomer, backendSupportsCsvUploader));
|
|
77
77
|
return insightItemsGroup;
|
|
@@ -90,7 +90,15 @@ function pushConditionally(items, item, cond) {
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
const withBaseUrl = (baseUrl, uri) => `${baseUrl.endsWith("/") ? baseUrl.substring(0, baseUrl.length - 2) : baseUrl}${uri}`;
|
|
93
|
-
function catalogItemUrl(workspaceId) {
|
|
93
|
+
function catalogItemUrl(workspaceId, featureFlags) {
|
|
94
|
+
// When the host app and the catalog pluggable-app migration are both on,
|
|
95
|
+
// link directly to the singular host route. Otherwise fall back to the
|
|
96
|
+
// legacy plural URL owned by gdc-home-ui, which re-redirects to the host
|
|
97
|
+
// route on arrival. Skipping the indirection avoids a double redirect when
|
|
98
|
+
// switching from Dashboards/Analyze/Metrics/Data to Catalog. See LX-2426.
|
|
99
|
+
if (featureFlags.enableShellApplication && featureFlags.enableShellApplication_catalog) {
|
|
100
|
+
return `/workspace/${workspaceId}/catalog`;
|
|
101
|
+
}
|
|
94
102
|
return `/workspaces/${workspaceId}/catalog`;
|
|
95
103
|
}
|
|
96
104
|
function canShowCatalogItem(featureFlags, workspacePermissions) {
|
package/esm/sdk-ui-kit.d.ts
CHANGED
|
@@ -7171,6 +7171,8 @@ export declare interface IUiMenuContext<T extends IUiMenuItemData = object, M =
|
|
|
7171
7171
|
pushShownSubview: (subview: IUiMenuSubview) => void;
|
|
7172
7172
|
popShownSubview: () => void;
|
|
7173
7173
|
onSelect: (item: IUiMenuFocusableItem<T> | undefined, event: MouseEvent_2 | KeyboardEvent_2) => void;
|
|
7174
|
+
onEnterLevel?: (item: IUiMenuFocusableItem<T> | undefined, event: MouseEvent_2 | KeyboardEvent_2) => boolean;
|
|
7175
|
+
onLeaveLevel?: (item: IUiMenuFocusableItem<T> | undefined, event: MouseEvent_2 | KeyboardEvent_2) => boolean;
|
|
7174
7176
|
onClose?: () => void;
|
|
7175
7177
|
setFocusedId: Dispatch<SetStateAction<string | undefined>>;
|
|
7176
7178
|
isItemFocusable: (item: IUiMenuItem<T>) => boolean;
|
|
@@ -7298,6 +7300,8 @@ export declare interface IUiMenuProps<T extends IUiMenuItemData = object, M = ob
|
|
|
7298
7300
|
containerBottomPadding?: "none" | "small" | "medium";
|
|
7299
7301
|
containerTopPadding?: "none" | "small" | "medium";
|
|
7300
7302
|
onSelect?: (item: IUiMenuInteractiveItem<T>, event: MouseEvent_2 | KeyboardEvent_2) => void;
|
|
7303
|
+
onEnterLevel?: (item: IUiMenuFocusableItem<T> | undefined, event: MouseEvent_2 | KeyboardEvent_2) => boolean;
|
|
7304
|
+
onLeaveLevel?: (item: IUiMenuFocusableItem<T> | undefined, event: MouseEvent_2 | KeyboardEvent_2) => boolean;
|
|
7301
7305
|
onLevelChange?: (level: number, item?: IUiMenuContentItem<T> | IUiMenuInteractiveItem<T>) => void;
|
|
7302
7306
|
onClose?: () => void;
|
|
7303
7307
|
onUnhandledKeyDown?: (event: KeyboardEvent_2, context: IUiMenuContext<T>) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gooddata/sdk-ui-kit",
|
|
3
|
-
"version": "11.36.0
|
|
3
|
+
"version": "11.36.0",
|
|
4
4
|
"description": "GoodData SDK - UI Building Components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "GoodData Corporation",
|
|
@@ -75,11 +75,11 @@
|
|
|
75
75
|
"tslib": "2.8.1",
|
|
76
76
|
"unified": "^11.0.5",
|
|
77
77
|
"uuid": "11.1.0",
|
|
78
|
-
"@gooddata/sdk-backend-spi": "11.36.0
|
|
79
|
-
"@gooddata/sdk-
|
|
80
|
-
"@gooddata/
|
|
81
|
-
"@gooddata/
|
|
82
|
-
"@gooddata/sdk-ui-theme-provider": "11.36.0
|
|
78
|
+
"@gooddata/sdk-backend-spi": "11.36.0",
|
|
79
|
+
"@gooddata/sdk-model": "11.36.0",
|
|
80
|
+
"@gooddata/sdk-ui": "11.36.0",
|
|
81
|
+
"@gooddata/util": "11.36.0",
|
|
82
|
+
"@gooddata/sdk-ui-theme-provider": "11.36.0"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
85
|
"@microsoft/api-documenter": "^7.17.0",
|
|
@@ -128,11 +128,11 @@
|
|
|
128
128
|
"typescript": "5.9.3",
|
|
129
129
|
"vitest": "4.1.0",
|
|
130
130
|
"vitest-dom": "0.1.1",
|
|
131
|
-
"@gooddata/eslint-config": "11.36.0
|
|
132
|
-
"@gooddata/oxlint-config": "11.36.0
|
|
133
|
-
"@gooddata/
|
|
134
|
-
"@gooddata/
|
|
135
|
-
"@gooddata/
|
|
131
|
+
"@gooddata/eslint-config": "11.36.0",
|
|
132
|
+
"@gooddata/oxlint-config": "11.36.0",
|
|
133
|
+
"@gooddata/sdk-backend-mockingbird": "11.36.0",
|
|
134
|
+
"@gooddata/stylelint-config": "11.36.0",
|
|
135
|
+
"@gooddata/reference-workspace": "11.36.0"
|
|
136
136
|
},
|
|
137
137
|
"peerDependencies": {
|
|
138
138
|
"react": "^18.0.0 || ^19.0.0",
|