@olenbetong/synergi-react 4.2.6 → 4.2.7
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.
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
.ob-breadcrumbs__item {
|
|
21
21
|
display: flex;
|
|
22
|
+
flex: 0 0 auto;
|
|
22
23
|
align-items: center;
|
|
23
24
|
font-size: var(--ds-font-size-100, 0.875rem);
|
|
24
25
|
white-space: nowrap;
|
|
@@ -54,8 +55,6 @@
|
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
.ob-breadcrumbs__overflow {
|
|
57
|
-
position: relative;
|
|
58
|
-
|
|
59
58
|
button {
|
|
60
59
|
background: none;
|
|
61
60
|
border: 1px solid transparent;
|
|
@@ -86,39 +85,53 @@
|
|
|
86
85
|
}
|
|
87
86
|
}
|
|
88
87
|
|
|
88
|
+
/*
|
|
89
|
+
* The crumbs there is no room for, behind the "…" button. A popover, so it sits in the top
|
|
90
|
+
* layer where the toolbar cannot clip it; placed under the button by the component. The
|
|
91
|
+
* toolbar's contrast colour is inherited through the DOM even there, so the menu sets its own.
|
|
92
|
+
*/
|
|
89
93
|
.ob-breadcrumbs__overflow-menu {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
box-shadow: var(--ds-shadow-overlay, 0 4px 8px rgba(0, 0, 0, 0.16));
|
|
94
|
-
left: 0;
|
|
95
|
-
list-style: none;
|
|
96
|
-
margin: var(--ds-space-050, 0.25rem) 0 0;
|
|
94
|
+
position: fixed;
|
|
95
|
+
inset: auto;
|
|
96
|
+
box-sizing: border-box;
|
|
97
97
|
min-width: 10rem;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
max-width: calc(100vw - 1rem);
|
|
99
|
+
margin: 0;
|
|
100
|
+
padding: var(--ds-size-1, 0.25rem) 0;
|
|
101
|
+
list-style: none;
|
|
102
|
+
border: 1px solid var(--ds-color-neutral-border-subtle, #cbd0d6);
|
|
103
|
+
border-radius: var(--ds-border-radius-md, 4px);
|
|
104
|
+
background: var(--ds-color-neutral-background-default, #fff);
|
|
105
|
+
color: var(--ds-color-neutral-text-default, #1e2b3c);
|
|
106
|
+
box-shadow: var(--ds-shadow-md, 0 4px 8px rgb(0 0 0 / 16%));
|
|
107
|
+
font-size: var(--ds-body-sm-font-size, 0.875rem);
|
|
102
108
|
|
|
103
109
|
li {
|
|
104
110
|
a,
|
|
105
111
|
span {
|
|
106
|
-
color: var(--ds-text, inherit);
|
|
107
112
|
display: block;
|
|
108
|
-
|
|
109
|
-
|
|
113
|
+
padding: var(--ds-size-2, 0.5rem) var(--ds-size-4, 1rem);
|
|
114
|
+
overflow: hidden;
|
|
115
|
+
color: inherit;
|
|
110
116
|
text-decoration: none;
|
|
117
|
+
text-overflow: ellipsis;
|
|
111
118
|
white-space: nowrap;
|
|
119
|
+
}
|
|
112
120
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
color: var(--ds-text, inherit);
|
|
116
|
-
}
|
|
121
|
+
a:hover {
|
|
122
|
+
background: var(--ds-color-neutral-surface-hover, rgb(0 0 0 / 6%));
|
|
117
123
|
}
|
|
118
124
|
|
|
119
125
|
a:focus-visible {
|
|
120
|
-
outline: 2px solid var(--ds-
|
|
126
|
+
outline: 2px solid var(--ds-color-focus-outer, currentColor);
|
|
121
127
|
outline-offset: -2px;
|
|
122
128
|
}
|
|
123
129
|
}
|
|
130
|
+
|
|
131
|
+
/* Touch sized rows where there is no pointer to aim with. */
|
|
132
|
+
@media (pointer: coarse) {
|
|
133
|
+
li :is(a, span) {
|
|
134
|
+
padding-block: var(--ds-size-3, 0.75rem);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
124
137
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import "./Toolbar.css";
|
|
3
3
|
import { MenuHamburgerIcon } from "@navikt/aksel-icons";
|
|
4
|
-
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
4
|
+
import { useEffect, useId, useLayoutEffect, useRef, useState } from "react";
|
|
5
5
|
import { createPortal } from "react-dom";
|
|
6
6
|
import { Link } from "react-router";
|
|
7
7
|
import { getLocalizedString } from "../../i18n.js";
|
|
@@ -86,19 +86,30 @@ function BreadcrumbLink({ item }) {
|
|
|
86
86
|
}
|
|
87
87
|
function BreadcrumbsInner({ items }) {
|
|
88
88
|
let [firstVisible, setFirstVisible] = useState(0);
|
|
89
|
-
let [
|
|
89
|
+
let [menuOpen, setMenuOpen] = useState(false);
|
|
90
90
|
let navRef = useRef(null);
|
|
91
91
|
let listRef = useRef(null);
|
|
92
|
-
let
|
|
92
|
+
let buttonRef = useRef(null);
|
|
93
|
+
let menuRef = useRef(null);
|
|
94
|
+
let menuId = useId();
|
|
95
|
+
// A new trail (the user navigated) is measured from scratch. Adjusted during render, so
|
|
96
|
+
// the previous page's collapse never paints on the new one.
|
|
97
|
+
let trail = items.map((item) => item.label).join("\n");
|
|
98
|
+
let [measuredTrail, setMeasuredTrail] = useState(trail);
|
|
99
|
+
if (measuredTrail !== trail) {
|
|
100
|
+
setMeasuredTrail(trail);
|
|
101
|
+
setFirstVisible(0);
|
|
102
|
+
}
|
|
93
103
|
// Detect overflow: increment firstVisible until the list fits within the nav.
|
|
94
104
|
// Runs after every render so it keeps pushing items into overflow until the
|
|
95
105
|
// list stops overflowing or only the last item (current page) remains.
|
|
96
106
|
useLayoutEffect(() => {
|
|
97
|
-
let nav = navRef.current;
|
|
98
107
|
let list = listRef.current;
|
|
99
|
-
if (!
|
|
108
|
+
if (!list)
|
|
100
109
|
return;
|
|
101
|
-
|
|
110
|
+
// Against the list's own box, not the nav's: the nav also holds the separator the site
|
|
111
|
+
// stylesheet draws between the brand and the trail.
|
|
112
|
+
if (list.scrollWidth > list.clientWidth + 1 && firstVisible < items.length - 1) {
|
|
102
113
|
setFirstVisible((prev) => prev + 1);
|
|
103
114
|
}
|
|
104
115
|
});
|
|
@@ -108,27 +119,48 @@ function BreadcrumbsInner({ items }) {
|
|
|
108
119
|
let nav = navRef.current;
|
|
109
120
|
if (!nav)
|
|
110
121
|
return;
|
|
122
|
+
let width = nav.clientWidth;
|
|
111
123
|
let observer = new ResizeObserver(() => {
|
|
124
|
+
// The first callback reports the size the trail was just measured at.
|
|
125
|
+
if (nav.clientWidth === width)
|
|
126
|
+
return;
|
|
127
|
+
width = nav.clientWidth;
|
|
112
128
|
setFirstVisible(0);
|
|
113
129
|
});
|
|
114
130
|
observer.observe(nav);
|
|
115
131
|
return () => observer.disconnect();
|
|
116
132
|
}, []);
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
133
|
+
/*
|
|
134
|
+
* The menu is a popover: it renders in the top layer, so the toolbar and the trail, which
|
|
135
|
+
* both clip their overflow, cannot cut it off, and the browser closes it on Escape and on a
|
|
136
|
+
* click outside. The top layer has no positioned ancestor, so it is placed under the button
|
|
137
|
+
* by hand, and pulled back in when it would run past the edge of a narrow screen.
|
|
138
|
+
*/
|
|
139
|
+
function placeMenu() {
|
|
140
|
+
let button = buttonRef.current;
|
|
141
|
+
let menu = menuRef.current;
|
|
142
|
+
if (!button || !menu)
|
|
120
143
|
return;
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
128
|
-
}, [overflowOpen]);
|
|
144
|
+
let rect = button.getBoundingClientRect();
|
|
145
|
+
let margin = 8;
|
|
146
|
+
let left = Math.min(rect.left, window.innerWidth - menu.offsetWidth - margin);
|
|
147
|
+
menu.style.top = `${rect.bottom + 4}px`;
|
|
148
|
+
menu.style.left = `${Math.max(left, margin)}px`;
|
|
149
|
+
}
|
|
129
150
|
let hiddenItems = items.slice(0, firstVisible);
|
|
130
151
|
let visibleItems = items.slice(firstVisible);
|
|
131
|
-
return (_jsx("nav", { className: "ob-breadcrumbs", "aria-label": "Breadcrumb", ref: navRef, children: _jsxs("ol", { className: "ob-breadcrumbs__list", ref: listRef, children: [firstVisible > 0 && (_jsxs("li", { className: "ob-breadcrumbs__item ob-breadcrumbs__overflow",
|
|
152
|
+
return (_jsx("nav", { className: "ob-breadcrumbs", "aria-label": "Breadcrumb", ref: navRef, children: _jsxs("ol", { className: "ob-breadcrumbs__list", ref: listRef, children: [firstVisible > 0 && (_jsxs("li", { className: "ob-breadcrumbs__item ob-breadcrumbs__overflow", children: [_jsx("button", { ref: buttonRef, type: "button", "aria-label": getLocalizedString("Show hidden breadcrumbs"), "aria-expanded": menuOpen, popoverTarget: menuId, children: "\u2026" }), _jsx("ul", { ref: menuRef, id: menuId, popover: "auto", className: "ob-breadcrumbs__overflow-menu",
|
|
153
|
+
// Placed before it shows, so it never paints in the popover's default
|
|
154
|
+
// spot, and again once it has a width to keep it on the screen.
|
|
155
|
+
onBeforeToggle: (event) => {
|
|
156
|
+
if (event.newState === "open")
|
|
157
|
+
placeMenu();
|
|
158
|
+
}, onToggle: (event) => {
|
|
159
|
+
let open = event.newState === "open";
|
|
160
|
+
setMenuOpen(open);
|
|
161
|
+
if (open)
|
|
162
|
+
placeMenu();
|
|
163
|
+
}, children: hiddenItems.map((item, index) => (_jsx("li", { onClick: () => menuRef.current?.hidePopover(), children: _jsx(BreadcrumbLink, { item: item }) }, index))) })] })), visibleItems.map((item, index) => {
|
|
132
164
|
let actualIndex = firstVisible + index;
|
|
133
165
|
let isCurrent = actualIndex === items.length - 1;
|
|
134
166
|
return (_jsx("li", { className: "ob-breadcrumbs__item", children: isCurrent ? _jsx("span", { "aria-current": "page", children: item.label }) : _jsx(BreadcrumbLink, { item: item }) }, actualIndex));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@olenbetong/synergi-react",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.7",
|
|
4
4
|
"description": "Standalone React component for SynergiWeb and Partner Portal",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
"@emotion/styled": "^11.14.1",
|
|
40
40
|
"@mui/icons-material": "9.4.0",
|
|
41
41
|
"@mui/material": "9.4.0",
|
|
42
|
-
"@olenbetong/appframe-core": "2.15.
|
|
43
|
-
"@olenbetong/appframe-data": "1.8.2",
|
|
44
|
-
"@olenbetong/appframe-ds": "1.
|
|
45
|
-
"@olenbetong/appframe-mui": "7.0.
|
|
46
|
-
"@olenbetong/appframe-react": "2.2.7",
|
|
42
|
+
"@olenbetong/appframe-core": "^2.15.2",
|
|
43
|
+
"@olenbetong/appframe-data": "^1.8.2",
|
|
44
|
+
"@olenbetong/appframe-ds": "^1.4.1",
|
|
45
|
+
"@olenbetong/appframe-mui": "^7.0.10",
|
|
46
|
+
"@olenbetong/appframe-react": "^2.2.7",
|
|
47
47
|
"clsx": "^2.1.1",
|
|
48
48
|
"filepond": "^4.32.12",
|
|
49
49
|
"filepond-plugin-file-poster": "^2.5.2",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
.ob-breadcrumbs__item {
|
|
21
21
|
display: flex;
|
|
22
|
+
flex: 0 0 auto;
|
|
22
23
|
align-items: center;
|
|
23
24
|
font-size: var(--ds-font-size-100, 0.875rem);
|
|
24
25
|
white-space: nowrap;
|
|
@@ -54,8 +55,6 @@
|
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
.ob-breadcrumbs__overflow {
|
|
57
|
-
position: relative;
|
|
58
|
-
|
|
59
58
|
button {
|
|
60
59
|
background: none;
|
|
61
60
|
border: 1px solid transparent;
|
|
@@ -86,39 +85,53 @@
|
|
|
86
85
|
}
|
|
87
86
|
}
|
|
88
87
|
|
|
88
|
+
/*
|
|
89
|
+
* The crumbs there is no room for, behind the "…" button. A popover, so it sits in the top
|
|
90
|
+
* layer where the toolbar cannot clip it; placed under the button by the component. The
|
|
91
|
+
* toolbar's contrast colour is inherited through the DOM even there, so the menu sets its own.
|
|
92
|
+
*/
|
|
89
93
|
.ob-breadcrumbs__overflow-menu {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
box-shadow: var(--ds-shadow-overlay, 0 4px 8px rgba(0, 0, 0, 0.16));
|
|
94
|
-
left: 0;
|
|
95
|
-
list-style: none;
|
|
96
|
-
margin: var(--ds-space-050, 0.25rem) 0 0;
|
|
94
|
+
position: fixed;
|
|
95
|
+
inset: auto;
|
|
96
|
+
box-sizing: border-box;
|
|
97
97
|
min-width: 10rem;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
max-width: calc(100vw - 1rem);
|
|
99
|
+
margin: 0;
|
|
100
|
+
padding: var(--ds-size-1, 0.25rem) 0;
|
|
101
|
+
list-style: none;
|
|
102
|
+
border: 1px solid var(--ds-color-neutral-border-subtle, #cbd0d6);
|
|
103
|
+
border-radius: var(--ds-border-radius-md, 4px);
|
|
104
|
+
background: var(--ds-color-neutral-background-default, #fff);
|
|
105
|
+
color: var(--ds-color-neutral-text-default, #1e2b3c);
|
|
106
|
+
box-shadow: var(--ds-shadow-md, 0 4px 8px rgb(0 0 0 / 16%));
|
|
107
|
+
font-size: var(--ds-body-sm-font-size, 0.875rem);
|
|
102
108
|
|
|
103
109
|
li {
|
|
104
110
|
a,
|
|
105
111
|
span {
|
|
106
|
-
color: var(--ds-text, inherit);
|
|
107
112
|
display: block;
|
|
108
|
-
|
|
109
|
-
|
|
113
|
+
padding: var(--ds-size-2, 0.5rem) var(--ds-size-4, 1rem);
|
|
114
|
+
overflow: hidden;
|
|
115
|
+
color: inherit;
|
|
110
116
|
text-decoration: none;
|
|
117
|
+
text-overflow: ellipsis;
|
|
111
118
|
white-space: nowrap;
|
|
119
|
+
}
|
|
112
120
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
color: var(--ds-text, inherit);
|
|
116
|
-
}
|
|
121
|
+
a:hover {
|
|
122
|
+
background: var(--ds-color-neutral-surface-hover, rgb(0 0 0 / 6%));
|
|
117
123
|
}
|
|
118
124
|
|
|
119
125
|
a:focus-visible {
|
|
120
|
-
outline: 2px solid var(--ds-
|
|
126
|
+
outline: 2px solid var(--ds-color-focus-outer, currentColor);
|
|
121
127
|
outline-offset: -2px;
|
|
122
128
|
}
|
|
123
129
|
}
|
|
130
|
+
|
|
131
|
+
/* Touch sized rows where there is no pointer to aim with. */
|
|
132
|
+
@media (pointer: coarse) {
|
|
133
|
+
li :is(a, span) {
|
|
134
|
+
padding-block: var(--ds-size-3, 0.75rem);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
124
137
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./Toolbar.css";
|
|
2
2
|
|
|
3
3
|
import { MenuHamburgerIcon } from "@navikt/aksel-icons";
|
|
4
|
-
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
4
|
+
import { useEffect, useId, useLayoutEffect, useRef, useState } from "react";
|
|
5
5
|
import { createPortal } from "react-dom";
|
|
6
6
|
import { Link, type To } from "react-router";
|
|
7
7
|
import { getLocalizedString } from "../../i18n.js";
|
|
@@ -133,20 +133,32 @@ export type ToolbarBreadcrumbsProps = {
|
|
|
133
133
|
|
|
134
134
|
function BreadcrumbsInner({ items }: ToolbarBreadcrumbsProps) {
|
|
135
135
|
let [firstVisible, setFirstVisible] = useState(0);
|
|
136
|
-
let [
|
|
136
|
+
let [menuOpen, setMenuOpen] = useState(false);
|
|
137
137
|
let navRef = useRef<HTMLElement>(null);
|
|
138
138
|
let listRef = useRef<HTMLOListElement>(null);
|
|
139
|
-
let
|
|
139
|
+
let buttonRef = useRef<HTMLButtonElement>(null);
|
|
140
|
+
let menuRef = useRef<HTMLUListElement>(null);
|
|
141
|
+
let menuId = useId();
|
|
142
|
+
|
|
143
|
+
// A new trail (the user navigated) is measured from scratch. Adjusted during render, so
|
|
144
|
+
// the previous page's collapse never paints on the new one.
|
|
145
|
+
let trail = items.map((item) => item.label).join("\n");
|
|
146
|
+
let [measuredTrail, setMeasuredTrail] = useState(trail);
|
|
147
|
+
if (measuredTrail !== trail) {
|
|
148
|
+
setMeasuredTrail(trail);
|
|
149
|
+
setFirstVisible(0);
|
|
150
|
+
}
|
|
140
151
|
|
|
141
152
|
// Detect overflow: increment firstVisible until the list fits within the nav.
|
|
142
153
|
// Runs after every render so it keeps pushing items into overflow until the
|
|
143
154
|
// list stops overflowing or only the last item (current page) remains.
|
|
144
155
|
useLayoutEffect(() => {
|
|
145
|
-
let nav = navRef.current;
|
|
146
156
|
let list = listRef.current;
|
|
147
|
-
if (!
|
|
157
|
+
if (!list) return;
|
|
148
158
|
|
|
149
|
-
|
|
159
|
+
// Against the list's own box, not the nav's: the nav also holds the separator the site
|
|
160
|
+
// stylesheet draws between the brand and the trail.
|
|
161
|
+
if (list.scrollWidth > list.clientWidth + 1 && firstVisible < items.length - 1) {
|
|
150
162
|
setFirstVisible((prev) => prev + 1);
|
|
151
163
|
}
|
|
152
164
|
});
|
|
@@ -157,7 +169,11 @@ function BreadcrumbsInner({ items }: ToolbarBreadcrumbsProps) {
|
|
|
157
169
|
let nav = navRef.current;
|
|
158
170
|
if (!nav) return;
|
|
159
171
|
|
|
172
|
+
let width = nav.clientWidth;
|
|
160
173
|
let observer = new ResizeObserver(() => {
|
|
174
|
+
// The first callback reports the size the trail was just measured at.
|
|
175
|
+
if (nav.clientWidth === width) return;
|
|
176
|
+
width = nav.clientWidth;
|
|
161
177
|
setFirstVisible(0);
|
|
162
178
|
});
|
|
163
179
|
|
|
@@ -165,19 +181,23 @@ function BreadcrumbsInner({ items }: ToolbarBreadcrumbsProps) {
|
|
|
165
181
|
return () => observer.disconnect();
|
|
166
182
|
}, []);
|
|
167
183
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
184
|
+
/*
|
|
185
|
+
* The menu is a popover: it renders in the top layer, so the toolbar and the trail, which
|
|
186
|
+
* both clip their overflow, cannot cut it off, and the browser closes it on Escape and on a
|
|
187
|
+
* click outside. The top layer has no positioned ancestor, so it is placed under the button
|
|
188
|
+
* by hand, and pulled back in when it would run past the edge of a narrow screen.
|
|
189
|
+
*/
|
|
190
|
+
function placeMenu() {
|
|
191
|
+
let button = buttonRef.current;
|
|
192
|
+
let menu = menuRef.current;
|
|
193
|
+
if (!button || !menu) return;
|
|
177
194
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
195
|
+
let rect = button.getBoundingClientRect();
|
|
196
|
+
let margin = 8;
|
|
197
|
+
let left = Math.min(rect.left, window.innerWidth - menu.offsetWidth - margin);
|
|
198
|
+
menu.style.top = `${rect.bottom + 4}px`;
|
|
199
|
+
menu.style.left = `${Math.max(left, margin)}px`;
|
|
200
|
+
}
|
|
181
201
|
|
|
182
202
|
let hiddenItems = items.slice(0, firstVisible);
|
|
183
203
|
let visibleItems = items.slice(firstVisible);
|
|
@@ -186,26 +206,39 @@ function BreadcrumbsInner({ items }: ToolbarBreadcrumbsProps) {
|
|
|
186
206
|
<nav className="ob-breadcrumbs" aria-label="Breadcrumb" ref={navRef}>
|
|
187
207
|
<ol className="ob-breadcrumbs__list" ref={listRef}>
|
|
188
208
|
{firstVisible > 0 && (
|
|
189
|
-
<li className="ob-breadcrumbs__item ob-breadcrumbs__overflow"
|
|
209
|
+
<li className="ob-breadcrumbs__item ob-breadcrumbs__overflow">
|
|
190
210
|
<button
|
|
211
|
+
ref={buttonRef}
|
|
191
212
|
type="button"
|
|
192
|
-
aria-label="Show hidden breadcrumbs"
|
|
193
|
-
aria-expanded={
|
|
194
|
-
|
|
195
|
-
onClick={() => setOverflowOpen((prev) => !prev)}
|
|
213
|
+
aria-label={getLocalizedString("Show hidden breadcrumbs")}
|
|
214
|
+
aria-expanded={menuOpen}
|
|
215
|
+
popoverTarget={menuId}
|
|
196
216
|
>
|
|
197
217
|
…
|
|
198
218
|
</button>
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
219
|
+
<ul
|
|
220
|
+
ref={menuRef}
|
|
221
|
+
id={menuId}
|
|
222
|
+
popover="auto"
|
|
223
|
+
className="ob-breadcrumbs__overflow-menu"
|
|
224
|
+
// Placed before it shows, so it never paints in the popover's default
|
|
225
|
+
// spot, and again once it has a width to keep it on the screen.
|
|
226
|
+
onBeforeToggle={(event) => {
|
|
227
|
+
if (event.newState === "open") placeMenu();
|
|
228
|
+
}}
|
|
229
|
+
onToggle={(event) => {
|
|
230
|
+
let open = event.newState === "open";
|
|
231
|
+
setMenuOpen(open);
|
|
232
|
+
if (open) placeMenu();
|
|
233
|
+
}}
|
|
234
|
+
>
|
|
235
|
+
{hiddenItems.map((item, index) => (
|
|
236
|
+
// oxlint-disable-next-line react/no-array-index-key -- stable list with no reordering
|
|
237
|
+
<li key={index} onClick={() => menuRef.current?.hidePopover()}>
|
|
238
|
+
<BreadcrumbLink item={item} />
|
|
239
|
+
</li>
|
|
240
|
+
))}
|
|
241
|
+
</ul>
|
|
209
242
|
</li>
|
|
210
243
|
)}
|
|
211
244
|
{visibleItems.map((item, index) => {
|