@primer/react 0.0.0-20261105032740 → 0.0.0-20261105032835
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/CHANGELOG.md +5 -3
- package/dist/ActionList/ActionList-ef1aa265.css +2 -0
- package/dist/ActionList/ActionList-ef1aa265.css.map +1 -0
- package/dist/ActionList/ActionList.module.css.js +4 -2
- package/dist/ActionList/Item.js +169 -162
- package/dist/Breadcrumbs/{Breadcrumbs-13089350.css → Breadcrumbs-16d81430.css} +2 -2
- package/dist/Breadcrumbs/Breadcrumbs-16d81430.css.map +1 -0
- package/dist/Breadcrumbs/Breadcrumbs.js +392 -359
- package/dist/Breadcrumbs/Breadcrumbs.module.css.js +1 -1
- package/dist/TreeView/{TreeView-1bf45a33.css → TreeView-6e565888.css} +2 -2
- package/dist/TreeView/TreeView-6e565888.css.map +1 -0
- package/dist/TreeView/TreeView.module.css.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/ActionList/ActionList-64885d7a.css +0 -2
- package/dist/ActionList/ActionList-64885d7a.css.map +0 -1
- package/dist/Breadcrumbs/Breadcrumbs-13089350.css.map +0 -1
- package/dist/TreeView/TreeView-1bf45a33.css.map +0 -1
|
@@ -7,422 +7,446 @@ import { fixedForwardRef } from "../utils/modern-polymorphic.js";
|
|
|
7
7
|
import { IconButton } from "../Button/IconButton.js";
|
|
8
8
|
import { ActionList } from "../ActionList/index.js";
|
|
9
9
|
import Breadcrumbs_module_css_default from "./Breadcrumbs.module.css.js";
|
|
10
|
+
import Details from "../Details/Details.js";
|
|
10
11
|
import React, { useRef, useState } from "react";
|
|
11
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
13
|
import { clsx } from "clsx";
|
|
13
14
|
import { KebabHorizontalIcon } from "@primer/octicons-react";
|
|
14
15
|
//#region src/Breadcrumbs/Breadcrumbs.tsx
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const INITIAL_FIT = {
|
|
19
|
-
extra: 0,
|
|
20
|
-
rootCollapsed: false,
|
|
21
|
-
narrow: false
|
|
22
|
-
};
|
|
23
|
-
function minVisible(withRoot, narrow, itemCount) {
|
|
24
|
-
if (withRoot) return 3;
|
|
25
|
-
return narrow && itemCount > 2 ? 1 : 4;
|
|
26
|
-
}
|
|
27
|
-
function countRule(withRoot, narrow, itemCount) {
|
|
28
|
-
return Math.max(0, itemCount - minVisible(withRoot, narrow, itemCount));
|
|
29
|
-
}
|
|
30
|
-
function computeFit(widths, available, withRoot) {
|
|
31
|
-
const itemCount = widths.length;
|
|
32
|
-
if (available <= 0 || itemCount === 0) return INITIAL_FIT;
|
|
33
|
-
const narrow = available < NARROW_WIDTH;
|
|
34
|
-
const min = minVisible(withRoot, narrow, itemCount);
|
|
35
|
-
const rootWidth = withRoot ? widths[0] : 0;
|
|
36
|
-
let visibleWidth = widths.reduce((sum, width) => sum + width + SEPARATOR_ALLOWANCE, 0);
|
|
37
|
-
let collapsed = 0;
|
|
38
|
-
let rootCollapsed = false;
|
|
39
|
-
while (rootWidth + visibleWidth + (collapsed > 0 ? MENU_BUTTON_WIDTH : 0) > available || itemCount - collapsed > min) {
|
|
40
|
-
visibleWidth -= widths[collapsed] + SEPARATOR_ALLOWANCE;
|
|
41
|
-
collapsed += 1;
|
|
42
|
-
if (itemCount - collapsed === 1 && rootWidth + visibleWidth + MENU_BUTTON_WIDTH > available) {
|
|
43
|
-
rootCollapsed = withRoot;
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return {
|
|
48
|
-
extra: collapsed - countRule(withRoot, narrow, itemCount),
|
|
49
|
-
rootCollapsed,
|
|
50
|
-
narrow
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
const sameFit = (a, b) => a.extra === b.extra && a.rootCollapsed === b.rootCollapsed && a.narrow === b.narrow;
|
|
54
|
-
function getValidChildren(children) {
|
|
55
|
-
return React.Children.toArray(children).filter((child) => /*#__PURE__*/ React.isValidElement(child));
|
|
56
|
-
}
|
|
57
|
-
function OverflowMenu(t0) {
|
|
58
|
-
const $ = c(15);
|
|
59
|
-
const { items, open, setOpen } = t0;
|
|
60
|
-
const buttonRef = useRef(null);
|
|
16
|
+
const BreadcrumbsList = (t0) => {
|
|
17
|
+
const $ = c(2);
|
|
18
|
+
const { children } = t0;
|
|
61
19
|
let t1;
|
|
62
|
-
if ($[0] !==
|
|
63
|
-
t1 =
|
|
64
|
-
|
|
20
|
+
if ($[0] !== children) {
|
|
21
|
+
t1 = /* @__PURE__ */ jsx("ol", {
|
|
22
|
+
className: Breadcrumbs_module_css_default.BreadcrumbsList,
|
|
23
|
+
children
|
|
24
|
+
});
|
|
25
|
+
$[0] = children;
|
|
65
26
|
$[1] = t1;
|
|
66
27
|
} else t1 = $[1];
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
$[6] = t3;
|
|
90
|
-
$[7] = t4;
|
|
91
|
-
} else t4 = $[7];
|
|
92
|
-
let t5;
|
|
93
|
-
if ($[8] !== close || $[9] !== items || $[10] !== open) {
|
|
94
|
-
t5 = open ? /* @__PURE__ */ jsx(OverflowMenuOverlay, {
|
|
95
|
-
items,
|
|
96
|
-
close,
|
|
97
|
-
buttonRef
|
|
98
|
-
}) : null;
|
|
99
|
-
$[8] = close;
|
|
100
|
-
$[9] = items;
|
|
101
|
-
$[10] = open;
|
|
102
|
-
$[11] = t5;
|
|
103
|
-
} else t5 = $[11];
|
|
104
|
-
let t6;
|
|
105
|
-
if ($[12] !== t4 || $[13] !== t5) {
|
|
106
|
-
t6 = /* @__PURE__ */ jsxs("div", {
|
|
107
|
-
className: Breadcrumbs_module_css_default.MenuDetails,
|
|
108
|
-
"data-component": "Breadcrumbs.MenuItem",
|
|
109
|
-
children: [t4, t5]
|
|
110
|
-
});
|
|
111
|
-
$[12] = t4;
|
|
112
|
-
$[13] = t5;
|
|
113
|
-
$[14] = t6;
|
|
114
|
-
} else t6 = $[14];
|
|
115
|
-
return t6;
|
|
116
|
-
}
|
|
117
|
-
function _temp(value) {
|
|
118
|
-
return !value;
|
|
119
|
-
}
|
|
120
|
-
function OverflowMenuOverlay(t0) {
|
|
121
|
-
const $ = c(13);
|
|
122
|
-
const { items, close, buttonRef } = t0;
|
|
123
|
-
const containerRef = useRef(null);
|
|
28
|
+
return t1;
|
|
29
|
+
};
|
|
30
|
+
const BreadcrumbsMenuItem = /*#__PURE__*/ React.forwardRef((t0, menuRefCallback) => {
|
|
31
|
+
const $ = c(25);
|
|
32
|
+
let ariaLabel;
|
|
33
|
+
let items;
|
|
34
|
+
let rest;
|
|
35
|
+
if ($[0] !== t0) {
|
|
36
|
+
({items, "aria-label": ariaLabel, ...rest} = t0);
|
|
37
|
+
$[0] = t0;
|
|
38
|
+
$[1] = ariaLabel;
|
|
39
|
+
$[2] = items;
|
|
40
|
+
$[3] = rest;
|
|
41
|
+
} else {
|
|
42
|
+
ariaLabel = $[1];
|
|
43
|
+
items = $[2];
|
|
44
|
+
rest = $[3];
|
|
45
|
+
}
|
|
46
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
47
|
+
const detailsRef = useRef(null);
|
|
48
|
+
const menuButtonRef = useRef(null);
|
|
49
|
+
const menuContainerRef = useRef(null);
|
|
124
50
|
let t1;
|
|
51
|
+
if ($[4] !== menuRefCallback) {
|
|
52
|
+
t1 = (element) => {
|
|
53
|
+
detailsRef.current = element;
|
|
54
|
+
if (typeof menuRefCallback === "function") menuRefCallback(element);
|
|
55
|
+
};
|
|
56
|
+
$[4] = menuRefCallback;
|
|
57
|
+
$[5] = t1;
|
|
58
|
+
} else t1 = $[5];
|
|
59
|
+
const detailsRefCallback = t1;
|
|
125
60
|
let t2;
|
|
126
|
-
if ($[
|
|
127
|
-
|
|
128
|
-
var _buttonRef$current;
|
|
61
|
+
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
|
62
|
+
t2 = (event) => {
|
|
129
63
|
event.preventDefault();
|
|
130
|
-
|
|
131
|
-
|
|
64
|
+
if (detailsRef.current) {
|
|
65
|
+
const newOpenState = !detailsRef.current.open;
|
|
66
|
+
detailsRef.current.open = newOpenState;
|
|
67
|
+
setIsOpen(newOpenState);
|
|
68
|
+
}
|
|
132
69
|
};
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
$[2] = t1;
|
|
137
|
-
$[3] = t2;
|
|
138
|
-
} else {
|
|
139
|
-
t1 = $[2];
|
|
140
|
-
t2 = $[3];
|
|
141
|
-
}
|
|
142
|
-
useOnEscapePress(t1, t2);
|
|
70
|
+
$[6] = t2;
|
|
71
|
+
} else t2 = $[6];
|
|
72
|
+
const handleSummaryClick = t2;
|
|
143
73
|
let t3;
|
|
144
|
-
if ($[
|
|
145
|
-
t3 =
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
if ($[6] !== close || $[7] !== t3) {
|
|
151
|
-
t4 = {
|
|
152
|
-
onClickOutside: close,
|
|
153
|
-
containerRef,
|
|
154
|
-
ignoreClickRefs: t3
|
|
74
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
75
|
+
t3 = () => {
|
|
76
|
+
if (detailsRef.current) {
|
|
77
|
+
detailsRef.current.open = false;
|
|
78
|
+
setIsOpen(false);
|
|
79
|
+
}
|
|
155
80
|
};
|
|
156
|
-
$[6] = close;
|
|
157
81
|
$[7] = t3;
|
|
82
|
+
} else t3 = $[7];
|
|
83
|
+
const closeOverlay = t3;
|
|
84
|
+
let t4;
|
|
85
|
+
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
86
|
+
t4 = () => {
|
|
87
|
+
var _menuButtonRef$curren;
|
|
88
|
+
(_menuButtonRef$curren = menuButtonRef.current) === null || _menuButtonRef$curren === void 0 || _menuButtonRef$curren.focus();
|
|
89
|
+
};
|
|
158
90
|
$[8] = t4;
|
|
159
91
|
} else t4 = $[8];
|
|
160
|
-
|
|
92
|
+
const focusOnMenuButton = t4;
|
|
161
93
|
let t5;
|
|
162
|
-
if ($[9] !== items) {
|
|
163
|
-
t5 = items.map(_temp2);
|
|
164
|
-
$[9] = items;
|
|
165
|
-
$[10] = t5;
|
|
166
|
-
} else t5 = $[10];
|
|
167
94
|
let t6;
|
|
168
|
-
if ($[
|
|
169
|
-
|
|
170
|
-
|
|
95
|
+
if ($[9] !== isOpen) {
|
|
96
|
+
t5 = (event_0) => {
|
|
97
|
+
if (isOpen) {
|
|
98
|
+
event_0.preventDefault();
|
|
99
|
+
closeOverlay();
|
|
100
|
+
focusOnMenuButton();
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
t6 = [isOpen];
|
|
104
|
+
$[9] = isOpen;
|
|
105
|
+
$[10] = t5;
|
|
106
|
+
$[11] = t6;
|
|
107
|
+
} else {
|
|
108
|
+
t5 = $[10];
|
|
109
|
+
t6 = $[11];
|
|
110
|
+
}
|
|
111
|
+
useOnEscapePress(t5, t6);
|
|
112
|
+
let t7;
|
|
113
|
+
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
|
|
114
|
+
t7 = {
|
|
115
|
+
onClickOutside: closeOverlay,
|
|
116
|
+
containerRef: menuContainerRef,
|
|
117
|
+
ignoreClickRefs: [menuButtonRef]
|
|
118
|
+
};
|
|
119
|
+
$[12] = t7;
|
|
120
|
+
} else t7 = $[12];
|
|
121
|
+
useOnOutsideClick(t7);
|
|
122
|
+
const t8 = ariaLabel || `${items.length} more breadcrumb items`;
|
|
123
|
+
const t9 = isOpen ? "true" : "false";
|
|
124
|
+
let t10;
|
|
125
|
+
if ($[13] !== rest || $[14] !== t8 || $[15] !== t9) {
|
|
126
|
+
t10 = /* @__PURE__ */ jsx(IconButton, {
|
|
127
|
+
as: "summary",
|
|
128
|
+
role: "button",
|
|
129
|
+
ref: menuButtonRef,
|
|
130
|
+
"aria-label": t8,
|
|
131
|
+
"aria-expanded": t9,
|
|
132
|
+
onClick: handleSummaryClick,
|
|
133
|
+
variant: "invisible",
|
|
134
|
+
size: "small",
|
|
135
|
+
icon: KebabHorizontalIcon,
|
|
136
|
+
tooltipDirection: "e",
|
|
137
|
+
...rest
|
|
138
|
+
});
|
|
139
|
+
$[13] = rest;
|
|
140
|
+
$[14] = t8;
|
|
141
|
+
$[15] = t9;
|
|
142
|
+
$[16] = t10;
|
|
143
|
+
} else t10 = $[16];
|
|
144
|
+
let t11;
|
|
145
|
+
if ($[17] !== items) {
|
|
146
|
+
t11 = items.map(_temp);
|
|
147
|
+
$[17] = items;
|
|
148
|
+
$[18] = t11;
|
|
149
|
+
} else t11 = $[18];
|
|
150
|
+
let t12;
|
|
151
|
+
if ($[19] !== t11) {
|
|
152
|
+
t12 = /* @__PURE__ */ jsx("div", {
|
|
153
|
+
ref: menuContainerRef,
|
|
171
154
|
className: Breadcrumbs_module_css_default.MenuOverlay,
|
|
172
|
-
children: /* @__PURE__ */ jsx(ActionList, { children:
|
|
155
|
+
children: /* @__PURE__ */ jsx(ActionList, { children: t11 })
|
|
173
156
|
});
|
|
174
|
-
$[
|
|
175
|
-
$[
|
|
176
|
-
} else
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
157
|
+
$[19] = t11;
|
|
158
|
+
$[20] = t12;
|
|
159
|
+
} else t12 = $[20];
|
|
160
|
+
let t13;
|
|
161
|
+
if ($[21] !== detailsRefCallback || $[22] !== t10 || $[23] !== t12) {
|
|
162
|
+
t13 = /* @__PURE__ */ jsxs(Details, {
|
|
163
|
+
ref: detailsRefCallback,
|
|
164
|
+
className: Breadcrumbs_module_css_default.MenuDetails,
|
|
165
|
+
"data-component": "Breadcrumbs.MenuItem",
|
|
166
|
+
children: [t10, t12]
|
|
167
|
+
});
|
|
168
|
+
$[21] = detailsRefCallback;
|
|
169
|
+
$[22] = t10;
|
|
170
|
+
$[23] = t12;
|
|
171
|
+
$[24] = t13;
|
|
172
|
+
} else t13 = $[24];
|
|
173
|
+
return t13;
|
|
174
|
+
});
|
|
175
|
+
BreadcrumbsMenuItem.displayName = "Breadcrumbs.MenuItem";
|
|
176
|
+
const getValidChildren = (children) => {
|
|
177
|
+
return React.Children.toArray(children).filter((child) => /*#__PURE__*/ React.isValidElement(child));
|
|
178
|
+
};
|
|
179
|
+
const MENU_BUTTON_FALLBACK_WIDTH = 32;
|
|
180
|
+
const CONTAINER_FALLBACK_WIDTH = 800;
|
|
181
|
+
function calculateOverflow({ availableWidth, itemCount, childArrayWidths, menuButtonWidth, overflow, hideRoot }) {
|
|
182
|
+
var _childArrayWidths$;
|
|
183
|
+
let eHideRoot = hideRoot;
|
|
184
|
+
const rootItemWidth = (_childArrayWidths$ = childArrayWidths[0]) !== null && _childArrayWidths$ !== void 0 ? _childArrayWidths$ : 0;
|
|
185
|
+
const isNarrow = availableWidth < 544;
|
|
186
|
+
let MIN_VISIBLE_ITEMS = 4;
|
|
187
|
+
if (!eHideRoot) MIN_VISIBLE_ITEMS = 3;
|
|
188
|
+
else if (isNarrow && itemCount > 2) MIN_VISIBLE_ITEMS = 1;
|
|
189
|
+
const calculateVisibleItemsWidth = (w) => {
|
|
190
|
+
const widths = w.reduce((sum, width) => sum + width + 16, 0);
|
|
191
|
+
return !eHideRoot ? rootItemWidth + widths : widths;
|
|
192
|
+
};
|
|
193
|
+
let currentVisibleItemWidths = [...childArrayWidths];
|
|
194
|
+
let menuItemCount = 0;
|
|
195
|
+
if (availableWidth > 0 && currentVisibleItemWidths.length > 0) {
|
|
196
|
+
let visibleItemsWidthTotal = calculateVisibleItemsWidth(currentVisibleItemWidths);
|
|
197
|
+
while ((overflow === "menu" || overflow === "menu-with-root") && (visibleItemsWidthTotal > availableWidth || currentVisibleItemWidths.length > MIN_VISIBLE_ITEMS)) {
|
|
198
|
+
menuItemCount += 1;
|
|
199
|
+
currentVisibleItemWidths = currentVisibleItemWidths.slice(1);
|
|
200
|
+
visibleItemsWidthTotal = calculateVisibleItemsWidth(currentVisibleItemWidths) + menuButtonWidth;
|
|
201
|
+
if (currentVisibleItemWidths.length === 1 && visibleItemsWidthTotal > availableWidth) {
|
|
202
|
+
eHideRoot = true;
|
|
203
|
+
break;
|
|
204
|
+
} else eHideRoot = hideRoot;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
return {
|
|
208
|
+
menuItemCount,
|
|
209
|
+
effectiveHideRoot: eHideRoot
|
|
210
|
+
};
|
|
187
211
|
}
|
|
188
212
|
function Breadcrumbs(t0) {
|
|
189
|
-
const $ = c(
|
|
213
|
+
const $ = c(48);
|
|
190
214
|
const { className, children, style, overflow: t1, variant: t2 } = t0;
|
|
191
215
|
const overflow = t1 === void 0 ? "wrap" : t1;
|
|
192
216
|
const variant = t2 === void 0 ? "normal" : t2;
|
|
193
|
-
const
|
|
217
|
+
const containerRef = useRef(null);
|
|
218
|
+
const hideRoot = !(overflow === "menu-with-root");
|
|
194
219
|
let t3;
|
|
195
|
-
if ($[0]
|
|
196
|
-
t3 =
|
|
197
|
-
$[0] =
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
const
|
|
201
|
-
const
|
|
202
|
-
const [
|
|
203
|
-
const
|
|
204
|
-
const
|
|
220
|
+
if ($[0] !== children) {
|
|
221
|
+
t3 = getValidChildren(children);
|
|
222
|
+
$[0] = children;
|
|
223
|
+
$[1] = t3;
|
|
224
|
+
} else t3 = $[1];
|
|
225
|
+
const childArray = t3;
|
|
226
|
+
const rootItem = childArray[0];
|
|
227
|
+
const [childArrayWidths, setChildArrayWidths] = useState(_temp2);
|
|
228
|
+
const [containerWidth, setContainerWidth] = useState(null);
|
|
229
|
+
const [menuButtonWidth, setMenuButtonWidth] = useState(MENU_BUTTON_FALLBACK_WIDTH);
|
|
205
230
|
let t4;
|
|
206
|
-
if ($[
|
|
207
|
-
t4 =
|
|
208
|
-
|
|
231
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
232
|
+
t4 = (element) => {
|
|
233
|
+
if (element) {
|
|
234
|
+
const iconButtonElement = element.querySelector("button[data-component=\"IconButton\"]");
|
|
235
|
+
if (iconButtonElement) {
|
|
236
|
+
const measuredWidth = iconButtonElement.offsetWidth;
|
|
237
|
+
setMenuButtonWidth((prev) => prev === measuredWidth ? prev : measuredWidth);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
};
|
|
209
241
|
$[2] = t4;
|
|
210
242
|
} else t4 = $[2];
|
|
211
|
-
const
|
|
212
|
-
const itemCount = items.length;
|
|
243
|
+
const measureMenuButton = t4;
|
|
213
244
|
let t5;
|
|
214
|
-
if ($[3] !==
|
|
215
|
-
t5 = (
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
245
|
+
if ($[3] !== childArray.length || $[4] !== overflow) {
|
|
246
|
+
t5 = () => {
|
|
247
|
+
if (overflow === "wrap") return;
|
|
248
|
+
const containerElement = containerRef.current;
|
|
249
|
+
if (!containerElement) return;
|
|
250
|
+
const measuredContainerWidth = containerElement.offsetWidth;
|
|
251
|
+
setContainerWidth((prev_0) => prev_0 === measuredContainerWidth ? prev_0 : measuredContainerWidth);
|
|
252
|
+
const listElement = containerElement.querySelector("ol");
|
|
253
|
+
if (listElement && listElement.children.length > 0 && listElement.children.length === childArray.length) {
|
|
254
|
+
const widths = Array.from(listElement.children).map(_temp3);
|
|
255
|
+
setChildArrayWidths(widths);
|
|
256
|
+
}
|
|
223
257
|
};
|
|
224
|
-
$[3] =
|
|
225
|
-
$[4] =
|
|
258
|
+
$[3] = childArray.length;
|
|
259
|
+
$[4] = overflow;
|
|
226
260
|
$[5] = t5;
|
|
227
261
|
} else t5 = $[5];
|
|
228
|
-
const updateFit = t5;
|
|
229
262
|
let t6;
|
|
230
|
-
if ($[6] !==
|
|
231
|
-
t6 =
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
for (const li of nav.querySelectorAll(":scope > ol > li[data-index]")) {
|
|
246
|
-
var _items$Number;
|
|
247
|
-
const key = (_items$Number = items[Number(li.getAttribute("data-index"))]) === null || _items$Number === void 0 ? void 0 : _items$Number.key;
|
|
248
|
-
if (key != null) widths_0.set(key, li.scrollWidth);
|
|
263
|
+
if ($[6] !== childArray || $[7] !== overflow) {
|
|
264
|
+
t6 = [childArray, overflow];
|
|
265
|
+
$[6] = childArray;
|
|
266
|
+
$[7] = overflow;
|
|
267
|
+
$[8] = t6;
|
|
268
|
+
} else t6 = $[8];
|
|
269
|
+
useIsomorphicLayoutEffect(t5, t6);
|
|
270
|
+
let t7;
|
|
271
|
+
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
272
|
+
t7 = (entries) => {
|
|
273
|
+
if (entries[0]) {
|
|
274
|
+
const width = Math.round(entries[0].contentRect.width);
|
|
275
|
+
setContainerWidth((prev_1) => prev_1 === width ? prev_1 : width);
|
|
249
276
|
}
|
|
250
|
-
widthsRef.current = widths_0;
|
|
251
|
-
updateFit(nav.clientWidth);
|
|
252
277
|
};
|
|
253
|
-
$[
|
|
254
|
-
|
|
255
|
-
$[8] = updateFit;
|
|
256
|
-
$[9] = t6;
|
|
257
|
-
} else t6 = $[9];
|
|
258
|
-
let t7;
|
|
259
|
-
if ($[10] !== collapsible || $[11] !== fit || $[12] !== items || $[13] !== menuOpen || $[14] !== updateFit) {
|
|
260
|
-
t7 = [
|
|
261
|
-
items,
|
|
262
|
-
collapsible,
|
|
263
|
-
fit,
|
|
264
|
-
menuOpen,
|
|
265
|
-
updateFit
|
|
266
|
-
];
|
|
267
|
-
$[10] = collapsible;
|
|
268
|
-
$[11] = fit;
|
|
269
|
-
$[12] = items;
|
|
270
|
-
$[13] = menuOpen;
|
|
271
|
-
$[14] = updateFit;
|
|
272
|
-
$[15] = t7;
|
|
273
|
-
} else t7 = $[15];
|
|
274
|
-
useIsomorphicLayoutEffect(t6, t7);
|
|
278
|
+
$[9] = t7;
|
|
279
|
+
} else t7 = $[9];
|
|
275
280
|
let t8;
|
|
276
|
-
if ($[
|
|
277
|
-
t8 =
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
$[17] = t8;
|
|
282
|
-
} else t8 = $[17];
|
|
281
|
+
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
282
|
+
t8 = [];
|
|
283
|
+
$[10] = t8;
|
|
284
|
+
} else t8 = $[10];
|
|
285
|
+
useResizeObserver(t7, containerRef, t8, overflow !== "wrap");
|
|
283
286
|
let t9;
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
$[
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
const isCollapsed = index < collapsed && !(isRoot && rootVisible);
|
|
319
|
-
if (isCollapsed && index < alwaysCollapsed && !isRoot) continue;
|
|
320
|
-
const rendered = !isCollapsed || !menuOpen;
|
|
321
|
-
listItems.push(/* @__PURE__ */ jsxs("li", {
|
|
322
|
-
className: plain ? Breadcrumbs_module_css_default.ItemWrapper : Breadcrumbs_module_css_default.BreadcrumbsItem,
|
|
323
|
-
"data-index": rendered ? index : void 0,
|
|
324
|
-
"data-collapsed": isCollapsed ? "" : void 0,
|
|
325
|
-
children: [rendered ? item_1 : null, plain ? null : /* @__PURE__ */ jsx(ItemSeparator, {})]
|
|
326
|
-
}, item_1.key));
|
|
327
|
-
}
|
|
328
|
-
if (!plain || !withRoot && itemCount > 2) {
|
|
329
|
-
let t11;
|
|
330
|
-
if ($[35] !== itemCount || $[36] !== items || $[37] !== menuItems || $[38] !== plain) {
|
|
331
|
-
t11 = plain ? items.slice(0, itemCount - 1) : menuItems;
|
|
332
|
-
$[35] = itemCount;
|
|
333
|
-
$[36] = items;
|
|
334
|
-
$[37] = menuItems;
|
|
335
|
-
$[38] = plain;
|
|
336
|
-
$[39] = t11;
|
|
337
|
-
} else t11 = $[39];
|
|
338
|
-
let t12;
|
|
339
|
-
if ($[40] !== menuOpen || $[41] !== t11) {
|
|
340
|
-
t12 = /* @__PURE__ */ jsx(OverflowMenu, {
|
|
341
|
-
items: t11,
|
|
342
|
-
open: menuOpen,
|
|
343
|
-
setOpen: setMenuOpen
|
|
344
|
-
});
|
|
345
|
-
$[40] = menuOpen;
|
|
346
|
-
$[41] = t11;
|
|
347
|
-
$[42] = t12;
|
|
348
|
-
} else t12 = $[42];
|
|
349
|
-
let t13;
|
|
350
|
-
if ($[43] === Symbol.for("react.memo_cache_sentinel")) {
|
|
351
|
-
t13 = /* @__PURE__ */ jsx(ItemSeparator, {});
|
|
352
|
-
$[43] = t13;
|
|
353
|
-
} else t13 = $[43];
|
|
354
|
-
let t14;
|
|
355
|
-
if ($[44] !== plain || $[45] !== t12) {
|
|
356
|
-
t14 = /* @__PURE__ */ jsxs("li", {
|
|
357
|
-
className: Breadcrumbs_module_css_default.BreadcrumbsItem,
|
|
358
|
-
"data-overflow-menu": "",
|
|
359
|
-
hidden: plain,
|
|
360
|
-
children: [t12, t13]
|
|
361
|
-
}, "breadcrumbs-menu");
|
|
362
|
-
$[44] = plain;
|
|
363
|
-
$[45] = t12;
|
|
364
|
-
$[46] = t14;
|
|
365
|
-
} else t14 = $[46];
|
|
366
|
-
listItems.splice(withRoot && rootVisible ? 1 : 0, 0, t14);
|
|
367
|
-
}
|
|
368
|
-
$[25] = alwaysCollapsed;
|
|
369
|
-
$[26] = collapsed;
|
|
370
|
-
$[27] = itemCount;
|
|
371
|
-
$[28] = items;
|
|
372
|
-
$[29] = menuItems;
|
|
373
|
-
$[30] = menuOpen;
|
|
374
|
-
$[31] = plain;
|
|
375
|
-
$[32] = rootVisible;
|
|
376
|
-
$[33] = withRoot;
|
|
377
|
-
$[34] = listItems;
|
|
378
|
-
} else listItems = $[34];
|
|
379
|
-
content = listItems;
|
|
287
|
+
bb0: {
|
|
288
|
+
if (overflow === "wrap" || childArrayWidths.length !== childArray.length) {
|
|
289
|
+
let t10;
|
|
290
|
+
if ($[11] !== hideRoot) {
|
|
291
|
+
t10 = {
|
|
292
|
+
menuItemCount: 0,
|
|
293
|
+
effectiveHideRoot: hideRoot
|
|
294
|
+
};
|
|
295
|
+
$[11] = hideRoot;
|
|
296
|
+
$[12] = t10;
|
|
297
|
+
} else t10 = $[12];
|
|
298
|
+
t9 = t10;
|
|
299
|
+
break bb0;
|
|
300
|
+
}
|
|
301
|
+
const t10 = containerWidth !== null && containerWidth !== void 0 ? containerWidth : CONTAINER_FALLBACK_WIDTH;
|
|
302
|
+
let t11;
|
|
303
|
+
if ($[13] !== childArray.length || $[14] !== childArrayWidths || $[15] !== hideRoot || $[16] !== menuButtonWidth || $[17] !== overflow || $[18] !== t10) {
|
|
304
|
+
t11 = calculateOverflow({
|
|
305
|
+
availableWidth: t10,
|
|
306
|
+
itemCount: childArray.length,
|
|
307
|
+
childArrayWidths,
|
|
308
|
+
menuButtonWidth,
|
|
309
|
+
overflow,
|
|
310
|
+
hideRoot
|
|
311
|
+
});
|
|
312
|
+
$[13] = childArray.length;
|
|
313
|
+
$[14] = childArrayWidths;
|
|
314
|
+
$[15] = hideRoot;
|
|
315
|
+
$[16] = menuButtonWidth;
|
|
316
|
+
$[17] = overflow;
|
|
317
|
+
$[18] = t10;
|
|
318
|
+
$[19] = t11;
|
|
319
|
+
} else t11 = $[19];
|
|
320
|
+
t9 = t11;
|
|
380
321
|
}
|
|
322
|
+
const { menuItemCount, effectiveHideRoot } = t9;
|
|
381
323
|
let t10;
|
|
382
|
-
if ($[
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
324
|
+
if ($[20] !== childArray || $[21] !== children || $[22] !== effectiveHideRoot || $[23] !== menuItemCount || $[24] !== overflow || $[25] !== rootItem) {
|
|
325
|
+
bb1: {
|
|
326
|
+
if (overflow === "wrap" || menuItemCount === 0) {
|
|
327
|
+
let t11;
|
|
328
|
+
if ($[27] !== children) {
|
|
329
|
+
t11 = React.Children.map(children, _temp4);
|
|
330
|
+
$[27] = children;
|
|
331
|
+
$[28] = t11;
|
|
332
|
+
} else t11 = $[28];
|
|
333
|
+
t10 = t11;
|
|
334
|
+
break bb1;
|
|
335
|
+
}
|
|
336
|
+
const menuItems = childArray.slice(0, menuItemCount);
|
|
337
|
+
const visibleItems = childArray.slice(menuItemCount);
|
|
338
|
+
const effectiveMenuItems = effectiveHideRoot ? menuItems : menuItems.slice(1);
|
|
339
|
+
const t11 = `${effectiveMenuItems.length} more breadcrumb items`;
|
|
340
|
+
let t12;
|
|
341
|
+
if ($[29] !== effectiveMenuItems || $[30] !== t11) {
|
|
342
|
+
t12 = /* @__PURE__ */ jsx(BreadcrumbsMenuItem, {
|
|
343
|
+
ref: measureMenuButton,
|
|
344
|
+
items: effectiveMenuItems,
|
|
345
|
+
"aria-label": t11
|
|
346
|
+
});
|
|
347
|
+
$[29] = effectiveMenuItems;
|
|
348
|
+
$[30] = t11;
|
|
349
|
+
$[31] = t12;
|
|
350
|
+
} else t12 = $[31];
|
|
351
|
+
let t13;
|
|
352
|
+
if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
|
|
353
|
+
t13 = /* @__PURE__ */ jsx(ItemSeparator, {});
|
|
354
|
+
$[32] = t13;
|
|
355
|
+
} else t13 = $[32];
|
|
356
|
+
let t14;
|
|
357
|
+
if ($[33] !== t12) {
|
|
358
|
+
t14 = /* @__PURE__ */ jsxs("li", {
|
|
359
|
+
className: Breadcrumbs_module_css_default.BreadcrumbsItem,
|
|
360
|
+
"data-overflow-menu": "",
|
|
361
|
+
children: [t12, t13]
|
|
362
|
+
}, "breadcrumbs-menu");
|
|
363
|
+
$[33] = t12;
|
|
364
|
+
$[34] = t14;
|
|
365
|
+
} else t14 = $[34];
|
|
366
|
+
const menuElement = t14;
|
|
367
|
+
const visibleElements = visibleItems.map(_temp5);
|
|
368
|
+
let t15;
|
|
369
|
+
if ($[35] === Symbol.for("react.memo_cache_sentinel")) {
|
|
370
|
+
t15 = /* @__PURE__ */ jsx(ItemSeparator, {});
|
|
371
|
+
$[35] = t15;
|
|
372
|
+
} else t15 = $[35];
|
|
373
|
+
let t16;
|
|
374
|
+
if ($[36] !== rootItem) {
|
|
375
|
+
t16 = /* @__PURE__ */ jsxs("li", {
|
|
376
|
+
className: Breadcrumbs_module_css_default.BreadcrumbsItem,
|
|
377
|
+
children: [rootItem, t15]
|
|
378
|
+
}, "rootElement");
|
|
379
|
+
$[36] = rootItem;
|
|
380
|
+
$[37] = t16;
|
|
381
|
+
} else t16 = $[37];
|
|
382
|
+
const rootElement = t16;
|
|
383
|
+
if (effectiveHideRoot) t10 = [menuElement, ...visibleElements];
|
|
384
|
+
else t10 = [
|
|
385
|
+
rootElement,
|
|
386
|
+
menuElement,
|
|
387
|
+
...visibleElements
|
|
388
|
+
];
|
|
389
|
+
}
|
|
390
|
+
$[20] = childArray;
|
|
391
|
+
$[21] = children;
|
|
392
|
+
$[22] = effectiveHideRoot;
|
|
393
|
+
$[23] = menuItemCount;
|
|
394
|
+
$[24] = overflow;
|
|
395
|
+
$[25] = rootItem;
|
|
396
|
+
$[26] = t10;
|
|
397
|
+
} else t10 = $[26];
|
|
398
|
+
const finalChildren = t10;
|
|
399
|
+
let t11;
|
|
400
|
+
if ($[38] !== className) {
|
|
401
|
+
t11 = clsx(className, Breadcrumbs_module_css_default.BreadcrumbsBase);
|
|
402
|
+
$[38] = className;
|
|
403
|
+
$[39] = t11;
|
|
404
|
+
} else t11 = $[39];
|
|
388
405
|
let t12;
|
|
389
|
-
if ($[
|
|
390
|
-
t12 = /* @__PURE__ */ jsx(
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
});
|
|
395
|
-
$[49] = content;
|
|
396
|
-
$[50] = t11;
|
|
397
|
-
$[51] = t12;
|
|
398
|
-
} else t12 = $[51];
|
|
406
|
+
if ($[40] !== finalChildren) {
|
|
407
|
+
t12 = /* @__PURE__ */ jsx(BreadcrumbsList, { children: finalChildren });
|
|
408
|
+
$[40] = finalChildren;
|
|
409
|
+
$[41] = t12;
|
|
410
|
+
} else t12 = $[41];
|
|
399
411
|
let t13;
|
|
400
|
-
if ($[
|
|
412
|
+
if ($[42] !== overflow || $[43] !== style || $[44] !== t11 || $[45] !== t12 || $[46] !== variant) {
|
|
401
413
|
t13 = /* @__PURE__ */ jsx("nav", {
|
|
402
|
-
className:
|
|
414
|
+
className: t11,
|
|
403
415
|
"aria-label": "Breadcrumbs",
|
|
404
416
|
style,
|
|
405
|
-
ref:
|
|
417
|
+
ref: containerRef,
|
|
406
418
|
"data-overflow": overflow,
|
|
407
419
|
"data-variant": variant,
|
|
408
420
|
"data-component": "Breadcrumbs",
|
|
409
421
|
children: t12
|
|
410
422
|
});
|
|
411
|
-
$[
|
|
412
|
-
$[
|
|
413
|
-
$[
|
|
414
|
-
$[
|
|
415
|
-
$[
|
|
416
|
-
$[
|
|
417
|
-
} else t13 = $[
|
|
423
|
+
$[42] = overflow;
|
|
424
|
+
$[43] = style;
|
|
425
|
+
$[44] = t11;
|
|
426
|
+
$[45] = t12;
|
|
427
|
+
$[46] = variant;
|
|
428
|
+
$[47] = t13;
|
|
429
|
+
} else t13 = $[47];
|
|
418
430
|
return t13;
|
|
419
431
|
}
|
|
420
|
-
function
|
|
432
|
+
function _temp5(child_1, index) {
|
|
433
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
434
|
+
className: Breadcrumbs_module_css_default.BreadcrumbsItem,
|
|
435
|
+
children: [child_1, /* @__PURE__ */ jsx(ItemSeparator, {})]
|
|
436
|
+
}, `visible + ${index}`);
|
|
437
|
+
}
|
|
438
|
+
function _temp4(child_0) {
|
|
421
439
|
return /* @__PURE__ */ jsx("li", {
|
|
422
440
|
className: Breadcrumbs_module_css_default.ItemWrapper,
|
|
423
|
-
children:
|
|
441
|
+
children: child_0
|
|
424
442
|
});
|
|
425
443
|
}
|
|
444
|
+
function _temp3(child) {
|
|
445
|
+
return child.offsetWidth;
|
|
446
|
+
}
|
|
447
|
+
function _temp2() {
|
|
448
|
+
return [];
|
|
449
|
+
}
|
|
426
450
|
const ItemSeparator = () => {
|
|
427
451
|
const $ = c(1);
|
|
428
452
|
let t0;
|
|
@@ -462,5 +486,14 @@ var Breadcrumbs_default = Object.assign(Breadcrumbs, { Item: BreadcrumbsItemWith
|
|
|
462
486
|
* @deprecated Use the `Breadcrumbs` component instead (i.e. `<Breadcrumb>` → `<Breadcrumbs>`)
|
|
463
487
|
*/
|
|
464
488
|
const Breadcrumb = Object.assign(Breadcrumbs, { Item: BreadcrumbsItem });
|
|
489
|
+
function _temp(item, index) {
|
|
490
|
+
const { children, selected, as: Component, ...itemProps } = item.props;
|
|
491
|
+
return /* @__PURE__ */ jsx(ActionList.LinkItem, {
|
|
492
|
+
as: Component,
|
|
493
|
+
...itemProps,
|
|
494
|
+
"aria-current": selected ? "page" : void 0,
|
|
495
|
+
children
|
|
496
|
+
}, index);
|
|
497
|
+
}
|
|
465
498
|
//#endregion
|
|
466
499
|
export { Breadcrumb, Breadcrumbs_default as default };
|