@primer/react 38.46.0-rc.7155241f3 → 38.46.0-rc.98e20d26c
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 +22 -0
- package/dist/ActionList/LinkItem.js +97 -30
- package/dist/Breadcrumbs/{Breadcrumbs-16d81430.css → Breadcrumbs-6c9aadcf.css} +2 -2
- package/dist/Breadcrumbs/Breadcrumbs-6c9aadcf.css.map +1 -0
- package/dist/Breadcrumbs/Breadcrumbs.js +409 -391
- package/dist/Breadcrumbs/Breadcrumbs.module.css.js +1 -1
- package/dist/Card/Card-0e84ee3c.css +2 -0
- package/dist/Card/Card-0e84ee3c.css.map +1 -0
- package/dist/Card/Card.d.ts +13 -3
- package/dist/Card/Card.js +286 -161
- package/dist/Card/Card.module.css.js +2 -1
- package/dist/Card/index.d.ts +13 -3
- package/dist/Card/index.js +3 -1
- package/dist/ProgressBar/ProgressBar-3d1db6c7.css +2 -0
- package/dist/ProgressBar/ProgressBar-3d1db6c7.css.map +1 -0
- package/dist/ProgressBar/ProgressBar.module.css.js +1 -1
- package/dist/Skeleton/SkeletonBox-6305aba6.css +2 -0
- package/dist/Skeleton/SkeletonBox-6305aba6.css.map +1 -0
- package/dist/Skeleton/SkeletonBox.js +2 -1
- package/dist/Skeleton/SkeletonBox.module.css.js +2 -5
- package/dist/Skeleton/skeleton-bdbe6bf2.css +2 -0
- package/dist/Skeleton/skeleton-bdbe6bf2.css.map +1 -0
- package/dist/Skeleton/skeleton.module.css.js +8 -0
- package/dist/SkeletonAvatar/SkeletonAvatar.d.ts +3 -0
- package/dist/SkeletonAvatar/SkeletonAvatar.js +75 -59
- package/dist/SkeletonText/SkeletonText.d.ts +3 -0
- package/dist/SkeletonText/SkeletonText.js +86 -70
- package/dist/TooltipV2/Tooltip.js +55 -51
- package/dist/TreeView/TreeView.js +29 -15
- package/dist/TreeView/useTreeRovingTabIndex.js +155 -0
- package/dist/experimental/index.d.ts +2 -2
- package/dist/hooks/useOnEscapePress.d.ts +2 -0
- package/dist/hooks/useOnEscapePress.js +11 -4
- package/dist/hooks/useOnOutsideClick.js +2 -1
- package/dist/index.js +1 -1
- package/generated/components.json +82 -3
- package/package.json +13 -13
- package/dist/Breadcrumbs/Breadcrumbs-16d81430.css.map +0 -1
- package/dist/Card/Card-59b77d05.css +0 -2
- package/dist/Card/Card-59b77d05.css.map +0 -1
- package/dist/ProgressBar/ProgressBar-e403d83d.css +0 -2
- package/dist/ProgressBar/ProgressBar-e403d83d.css.map +0 -1
- package/dist/Skeleton/SkeletonBox-e078be7c.css +0 -2
- package/dist/Skeleton/SkeletonBox-e078be7c.css.map +0 -1
|
@@ -7,446 +7,473 @@ 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";
|
|
11
10
|
import React, { useRef, useState } from "react";
|
|
12
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
12
|
import { clsx } from "clsx";
|
|
14
13
|
import { KebabHorizontalIcon } from "@primer/octicons-react";
|
|
15
14
|
//#region src/Breadcrumbs/Breadcrumbs.tsx
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
const MENU_BUTTON_WIDTH = 32;
|
|
16
|
+
const SEPARATOR_ICON_WIDTH = 16;
|
|
17
|
+
const NARROW_WIDTH = 544;
|
|
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
|
+
const INITIAL_SEPARATORS = {
|
|
31
|
+
plain: SEPARATOR_ICON_WIDTH,
|
|
32
|
+
collapsed: SEPARATOR_ICON_WIDTH
|
|
33
|
+
};
|
|
34
|
+
function computeFit(widths, separators, available, withRoot) {
|
|
35
|
+
const itemCount = widths.length;
|
|
36
|
+
if (available <= 0 || itemCount === 0) return INITIAL_FIT;
|
|
37
|
+
const narrow = available < NARROW_WIDTH;
|
|
38
|
+
const min = minVisible(withRoot, narrow, itemCount);
|
|
39
|
+
const rootWidth = withRoot ? widths[0] + separators.collapsed : 0;
|
|
40
|
+
const menuCount = (collapsed) => Math.max(0, collapsed - (withRoot ? 1 : 0));
|
|
41
|
+
let tailWidth = widths.reduce((sum, width) => sum + width + separators.collapsed, 0);
|
|
42
|
+
const total = widths.reduce((sum, width) => sum + width, 0);
|
|
43
|
+
const width = (collapsed) => menuCount(collapsed) === 0 ? total + separators.plain * (itemCount - 1) : rootWidth + tailWidth + MENU_BUTTON_WIDTH;
|
|
44
|
+
let collapsed = 0;
|
|
45
|
+
let rootCollapsed = false;
|
|
46
|
+
while (width(collapsed) > available || itemCount - collapsed > min) {
|
|
47
|
+
tailWidth -= widths[collapsed] + separators.collapsed;
|
|
48
|
+
collapsed += 1;
|
|
49
|
+
if (itemCount - collapsed === 1 && width(collapsed) > available) {
|
|
50
|
+
rootCollapsed = withRoot;
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
extra: collapsed - countRule(withRoot, narrow, itemCount),
|
|
56
|
+
rootCollapsed,
|
|
57
|
+
narrow
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function getContentWidth(nav) {
|
|
61
|
+
const { paddingLeft, paddingRight } = getComputedStyle(nav);
|
|
62
|
+
return nav.clientWidth - parseFloat(paddingLeft) - parseFloat(paddingRight);
|
|
63
|
+
}
|
|
64
|
+
function getCrumbWidth(li, range) {
|
|
65
|
+
range.selectNodeContents(li);
|
|
66
|
+
const last = li.lastElementChild;
|
|
67
|
+
if (last !== null && last !== void 0 && last.classList.contains(Breadcrumbs_module_css_default.ItemSeparator)) range.setEndBefore(last);
|
|
68
|
+
return range.getBoundingClientRect().width;
|
|
69
|
+
}
|
|
70
|
+
const sameFit = (a, b) => a.extra === b.extra && a.rootCollapsed === b.rootCollapsed && a.narrow === b.narrow;
|
|
71
|
+
function getValidChildren(children) {
|
|
72
|
+
return React.Children.toArray(children).filter((child) => /*#__PURE__*/ React.isValidElement(child));
|
|
73
|
+
}
|
|
74
|
+
function OverflowMenu(t0) {
|
|
75
|
+
const $ = c(15);
|
|
76
|
+
const { items, open, setOpen } = t0;
|
|
77
|
+
const buttonRef = useRef(null);
|
|
19
78
|
let t1;
|
|
20
|
-
if ($[0] !==
|
|
21
|
-
t1 =
|
|
22
|
-
|
|
23
|
-
children
|
|
24
|
-
});
|
|
25
|
-
$[0] = children;
|
|
79
|
+
if ($[0] !== setOpen) {
|
|
80
|
+
t1 = () => setOpen(false);
|
|
81
|
+
$[0] = setOpen;
|
|
26
82
|
$[1] = t1;
|
|
27
83
|
} else t1 = $[1];
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
84
|
+
const close = t1;
|
|
85
|
+
const t2 = `${items.length} more breadcrumb items`;
|
|
86
|
+
let t3;
|
|
87
|
+
if ($[2] !== setOpen) {
|
|
88
|
+
t3 = () => setOpen(_temp);
|
|
89
|
+
$[2] = setOpen;
|
|
90
|
+
$[3] = t3;
|
|
91
|
+
} else t3 = $[3];
|
|
92
|
+
let t4;
|
|
93
|
+
if ($[4] !== open || $[5] !== t2 || $[6] !== t3) {
|
|
94
|
+
t4 = /* @__PURE__ */ jsx(IconButton, {
|
|
95
|
+
ref: buttonRef,
|
|
96
|
+
"aria-label": t2,
|
|
97
|
+
"aria-haspopup": "true",
|
|
98
|
+
"aria-expanded": open,
|
|
99
|
+
onClick: t3,
|
|
100
|
+
variant: "invisible",
|
|
101
|
+
size: "small",
|
|
102
|
+
icon: KebabHorizontalIcon,
|
|
103
|
+
tooltipDirection: "e"
|
|
104
|
+
});
|
|
105
|
+
$[4] = open;
|
|
106
|
+
$[5] = t2;
|
|
107
|
+
$[6] = t3;
|
|
108
|
+
$[7] = t4;
|
|
109
|
+
} else t4 = $[7];
|
|
110
|
+
let t5;
|
|
111
|
+
if ($[8] !== close || $[9] !== items || $[10] !== open) {
|
|
112
|
+
t5 = open ? /* @__PURE__ */ jsx(OverflowMenuOverlay, {
|
|
113
|
+
items,
|
|
114
|
+
close,
|
|
115
|
+
buttonRef
|
|
116
|
+
}) : null;
|
|
117
|
+
$[8] = close;
|
|
118
|
+
$[9] = items;
|
|
119
|
+
$[10] = open;
|
|
120
|
+
$[11] = t5;
|
|
121
|
+
} else t5 = $[11];
|
|
122
|
+
let t6;
|
|
123
|
+
if ($[12] !== t4 || $[13] !== t5) {
|
|
124
|
+
t6 = /* @__PURE__ */ jsxs("div", {
|
|
125
|
+
className: Breadcrumbs_module_css_default.MenuDetails,
|
|
126
|
+
"data-component": "Breadcrumbs.MenuItem",
|
|
127
|
+
children: [t4, t5]
|
|
128
|
+
});
|
|
129
|
+
$[12] = t4;
|
|
130
|
+
$[13] = t5;
|
|
131
|
+
$[14] = t6;
|
|
132
|
+
} else t6 = $[14];
|
|
133
|
+
return t6;
|
|
134
|
+
}
|
|
135
|
+
function _temp(value) {
|
|
136
|
+
return !value;
|
|
137
|
+
}
|
|
138
|
+
function OverflowMenuOverlay(t0) {
|
|
139
|
+
const $ = c(13);
|
|
140
|
+
const { items, close, buttonRef } = t0;
|
|
141
|
+
const containerRef = useRef(null);
|
|
50
142
|
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;
|
|
60
143
|
let t2;
|
|
61
|
-
if ($[
|
|
62
|
-
|
|
144
|
+
if ($[0] !== buttonRef || $[1] !== close) {
|
|
145
|
+
t1 = (event) => {
|
|
146
|
+
var _buttonRef$current;
|
|
63
147
|
event.preventDefault();
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
detailsRef.current.open = newOpenState;
|
|
67
|
-
setIsOpen(newOpenState);
|
|
68
|
-
}
|
|
148
|
+
close();
|
|
149
|
+
(_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 || _buttonRef$current.focus();
|
|
69
150
|
};
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
151
|
+
t2 = [close, buttonRef];
|
|
152
|
+
$[0] = buttonRef;
|
|
153
|
+
$[1] = close;
|
|
154
|
+
$[2] = t1;
|
|
155
|
+
$[3] = t2;
|
|
156
|
+
} else {
|
|
157
|
+
t1 = $[2];
|
|
158
|
+
t2 = $[3];
|
|
159
|
+
}
|
|
160
|
+
useOnEscapePress(t1, t2);
|
|
73
161
|
let t3;
|
|
74
|
-
if ($[
|
|
75
|
-
t3 =
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
$[7] = t3;
|
|
82
|
-
} else t3 = $[7];
|
|
83
|
-
const closeOverlay = t3;
|
|
162
|
+
if ($[4] !== buttonRef) {
|
|
163
|
+
t3 = [buttonRef];
|
|
164
|
+
$[4] = buttonRef;
|
|
165
|
+
$[5] = t3;
|
|
166
|
+
} else t3 = $[5];
|
|
84
167
|
let t4;
|
|
85
|
-
if ($[
|
|
86
|
-
t4 =
|
|
87
|
-
|
|
88
|
-
|
|
168
|
+
if ($[6] !== close || $[7] !== t3) {
|
|
169
|
+
t4 = {
|
|
170
|
+
onClickOutside: close,
|
|
171
|
+
containerRef,
|
|
172
|
+
ignoreClickRefs: t3
|
|
89
173
|
};
|
|
174
|
+
$[6] = close;
|
|
175
|
+
$[7] = t3;
|
|
90
176
|
$[8] = t4;
|
|
91
177
|
} else t4 = $[8];
|
|
92
|
-
|
|
178
|
+
useOnOutsideClick(t4);
|
|
93
179
|
let t5;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
if (isOpen) {
|
|
98
|
-
event_0.preventDefault();
|
|
99
|
-
closeOverlay();
|
|
100
|
-
focusOnMenuButton();
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
t6 = [isOpen];
|
|
104
|
-
$[9] = isOpen;
|
|
180
|
+
if ($[9] !== items) {
|
|
181
|
+
t5 = items.map(_temp2);
|
|
182
|
+
$[9] = items;
|
|
105
183
|
$[10] = t5;
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
t6 =
|
|
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,
|
|
184
|
+
} else t5 = $[10];
|
|
185
|
+
let t6;
|
|
186
|
+
if ($[11] !== t5) {
|
|
187
|
+
t6 = /* @__PURE__ */ jsx("div", {
|
|
188
|
+
ref: containerRef,
|
|
154
189
|
className: Breadcrumbs_module_css_default.MenuOverlay,
|
|
155
|
-
children: /* @__PURE__ */ jsx(ActionList, { children:
|
|
190
|
+
children: /* @__PURE__ */ jsx(ActionList, { children: t5 })
|
|
156
191
|
});
|
|
157
|
-
$[
|
|
158
|
-
$[
|
|
159
|
-
} else
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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
|
-
};
|
|
192
|
+
$[11] = t5;
|
|
193
|
+
$[12] = t6;
|
|
194
|
+
} else t6 = $[12];
|
|
195
|
+
return t6;
|
|
196
|
+
}
|
|
197
|
+
function _temp2(item) {
|
|
198
|
+
const { children, selected, as: Component, ...itemProps } = item.props;
|
|
199
|
+
return /* @__PURE__ */ jsx(ActionList.LinkItem, {
|
|
200
|
+
as: Component,
|
|
201
|
+
...itemProps,
|
|
202
|
+
"aria-current": selected ? "page" : void 0,
|
|
203
|
+
children
|
|
204
|
+
}, item.key);
|
|
211
205
|
}
|
|
212
206
|
function Breadcrumbs(t0) {
|
|
213
|
-
const $ = c(
|
|
207
|
+
const $ = c(60);
|
|
214
208
|
const { className, children, style, overflow: t1, variant: t2 } = t0;
|
|
215
209
|
const overflow = t1 === void 0 ? "wrap" : t1;
|
|
216
210
|
const variant = t2 === void 0 ? "normal" : t2;
|
|
217
|
-
const
|
|
218
|
-
const hideRoot = !(overflow === "menu-with-root");
|
|
211
|
+
const navRef = useRef(null);
|
|
219
212
|
let t3;
|
|
220
|
-
if ($[0]
|
|
221
|
-
t3 =
|
|
222
|
-
$[0] =
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
const
|
|
226
|
-
const
|
|
227
|
-
const
|
|
228
|
-
const [
|
|
229
|
-
const
|
|
213
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
214
|
+
t3 = /* @__PURE__ */ new Map();
|
|
215
|
+
$[0] = t3;
|
|
216
|
+
} else t3 = $[0];
|
|
217
|
+
const widthsRef = useRef(t3);
|
|
218
|
+
const [fit, setFit] = useState(INITIAL_FIT);
|
|
219
|
+
const fitRef = useRef(INITIAL_FIT);
|
|
220
|
+
const separatorsRef = useRef(INITIAL_SEPARATORS);
|
|
221
|
+
const [menuOpen, setMenuOpen] = useState(false);
|
|
222
|
+
const collapsible = overflow !== "wrap";
|
|
223
|
+
const withRoot = overflow === "menu-with-root";
|
|
230
224
|
let t4;
|
|
231
|
-
if ($[
|
|
232
|
-
t4 = (
|
|
233
|
-
|
|
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
|
-
};
|
|
225
|
+
if ($[1] !== children) {
|
|
226
|
+
t4 = getValidChildren(children);
|
|
227
|
+
$[1] = children;
|
|
241
228
|
$[2] = t4;
|
|
242
229
|
} else t4 = $[2];
|
|
243
|
-
const
|
|
230
|
+
const items = t4;
|
|
231
|
+
const itemCount = items.length;
|
|
244
232
|
let t5;
|
|
245
|
-
if ($[3] !==
|
|
246
|
-
t5 = () => {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
const widths = Array.from(listElement.children).map(_temp3);
|
|
255
|
-
setChildArrayWidths(widths);
|
|
256
|
-
}
|
|
233
|
+
if ($[3] !== items || $[4] !== withRoot) {
|
|
234
|
+
t5 = (available) => {
|
|
235
|
+
const next = computeFit(items.map((item) => {
|
|
236
|
+
var _widthsRef$current$ge, _item$key;
|
|
237
|
+
return (_widthsRef$current$ge = widthsRef.current.get((_item$key = item.key) !== null && _item$key !== void 0 ? _item$key : "")) !== null && _widthsRef$current$ge !== void 0 ? _widthsRef$current$ge : 0;
|
|
238
|
+
}), separatorsRef.current, available, withRoot);
|
|
239
|
+
if (sameFit(fitRef.current, next)) return;
|
|
240
|
+
fitRef.current = next;
|
|
241
|
+
setFit(next);
|
|
257
242
|
};
|
|
258
|
-
$[3] =
|
|
259
|
-
$[4] =
|
|
243
|
+
$[3] = items;
|
|
244
|
+
$[4] = withRoot;
|
|
260
245
|
$[5] = t5;
|
|
261
246
|
} else t5 = $[5];
|
|
247
|
+
const updateFit = t5;
|
|
262
248
|
let t6;
|
|
263
|
-
if ($[6] !==
|
|
264
|
-
t6 =
|
|
265
|
-
|
|
266
|
-
|
|
249
|
+
if ($[6] !== items || $[7] !== updateFit) {
|
|
250
|
+
t6 = (nav, available_0) => {
|
|
251
|
+
const previous = widthsRef.current;
|
|
252
|
+
const widths_0 = /* @__PURE__ */ new Map();
|
|
253
|
+
let separators = separatorsRef.current;
|
|
254
|
+
const range = nav.ownerDocument.createRange();
|
|
255
|
+
for (const item_0 of items) {
|
|
256
|
+
var _item_0$key;
|
|
257
|
+
const width = previous.get((_item_0$key = item_0.key) !== null && _item_0$key !== void 0 ? _item_0$key : "");
|
|
258
|
+
if (width !== void 0) {
|
|
259
|
+
var _item_0$key2;
|
|
260
|
+
widths_0.set((_item_0$key2 = item_0.key) !== null && _item_0$key2 !== void 0 ? _item_0$key2 : "", width);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
for (const li of nav.querySelectorAll(":scope > ol > li[data-index]")) {
|
|
264
|
+
var _items$Number;
|
|
265
|
+
const key = (_items$Number = items[Number(li.getAttribute("data-index"))]) === null || _items$Number === void 0 ? void 0 : _items$Number.key;
|
|
266
|
+
if (key == null) continue;
|
|
267
|
+
const crumbWidth = getCrumbWidth(li, range);
|
|
268
|
+
widths_0.set(key, crumbWidth);
|
|
269
|
+
if (li.nextElementSibling && !li.hasAttribute("data-collapsed")) {
|
|
270
|
+
const separator = li.getBoundingClientRect().width - crumbWidth;
|
|
271
|
+
const kind = li.classList.contains(Breadcrumbs_module_css_default.ItemWrapper) ? "plain" : "collapsed";
|
|
272
|
+
if (separators[kind] !== separator) separators = {
|
|
273
|
+
...separators,
|
|
274
|
+
[kind]: separator
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
separatorsRef.current = separators;
|
|
279
|
+
widthsRef.current = widths_0;
|
|
280
|
+
updateFit(available_0);
|
|
281
|
+
};
|
|
282
|
+
$[6] = items;
|
|
283
|
+
$[7] = updateFit;
|
|
267
284
|
$[8] = t6;
|
|
268
285
|
} else t6 = $[8];
|
|
269
|
-
|
|
286
|
+
const measure = t6;
|
|
287
|
+
const hiddenRef = useRef(false);
|
|
270
288
|
let t7;
|
|
271
|
-
if ($[9]
|
|
272
|
-
t7 = (
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
289
|
+
if ($[9] !== collapsible || $[10] !== measure) {
|
|
290
|
+
t7 = () => {
|
|
291
|
+
const nav_0 = navRef.current;
|
|
292
|
+
if (!collapsible || !nav_0) return;
|
|
293
|
+
if (!nav_0.hasAttribute("data-hydrated")) nav_0.setAttribute("data-hydrated", "");
|
|
294
|
+
const available_1 = getContentWidth(nav_0);
|
|
295
|
+
hiddenRef.current = available_1 <= 0;
|
|
296
|
+
if (!hiddenRef.current) measure(nav_0, available_1);
|
|
277
297
|
};
|
|
278
|
-
$[9] =
|
|
279
|
-
|
|
298
|
+
$[9] = collapsible;
|
|
299
|
+
$[10] = measure;
|
|
300
|
+
$[11] = t7;
|
|
301
|
+
} else t7 = $[11];
|
|
280
302
|
let t8;
|
|
281
|
-
if ($[
|
|
282
|
-
t8 = [
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
303
|
+
if ($[12] !== collapsible || $[13] !== fit || $[14] !== measure || $[15] !== menuOpen) {
|
|
304
|
+
t8 = [
|
|
305
|
+
collapsible,
|
|
306
|
+
fit,
|
|
307
|
+
menuOpen,
|
|
308
|
+
measure
|
|
309
|
+
];
|
|
310
|
+
$[12] = collapsible;
|
|
311
|
+
$[13] = fit;
|
|
312
|
+
$[14] = measure;
|
|
313
|
+
$[15] = menuOpen;
|
|
314
|
+
$[16] = t8;
|
|
315
|
+
} else t8 = $[16];
|
|
316
|
+
useIsomorphicLayoutEffect(t7, t8);
|
|
286
317
|
let t9;
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
if (
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
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;
|
|
321
|
-
}
|
|
322
|
-
const { menuItemCount, effectiveHideRoot } = t9;
|
|
318
|
+
if ($[17] !== measure || $[18] !== updateFit) {
|
|
319
|
+
t9 = () => {
|
|
320
|
+
const nav_1 = navRef.current;
|
|
321
|
+
if (!nav_1) return;
|
|
322
|
+
const available_2 = getContentWidth(nav_1);
|
|
323
|
+
if (available_2 <= 0) hiddenRef.current = true;
|
|
324
|
+
else if (hiddenRef.current) {
|
|
325
|
+
hiddenRef.current = false;
|
|
326
|
+
measure(nav_1, available_2);
|
|
327
|
+
} else updateFit(available_2);
|
|
328
|
+
};
|
|
329
|
+
$[17] = measure;
|
|
330
|
+
$[18] = updateFit;
|
|
331
|
+
$[19] = t9;
|
|
332
|
+
} else t9 = $[19];
|
|
323
333
|
let t10;
|
|
324
|
-
if ($[20]
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
334
|
+
if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
|
|
335
|
+
t10 = [];
|
|
336
|
+
$[20] = t10;
|
|
337
|
+
} else t10 = $[20];
|
|
338
|
+
useResizeObserver(t9, navRef, t10, collapsible);
|
|
339
|
+
let content;
|
|
340
|
+
if (!collapsible) {
|
|
341
|
+
if (menuOpen) setMenuOpen(false);
|
|
342
|
+
let t11;
|
|
343
|
+
if ($[21] !== children) {
|
|
344
|
+
t11 = React.Children.map(children, _temp3);
|
|
345
|
+
$[21] = children;
|
|
346
|
+
$[22] = t11;
|
|
347
|
+
} else t11 = $[22];
|
|
348
|
+
content = t11;
|
|
349
|
+
} else {
|
|
350
|
+
const collapsed = Math.min(Math.max(itemCount - 1, 0), countRule(withRoot, fit.narrow, itemCount) + fit.extra);
|
|
351
|
+
const rootVisible = withRoot && !(collapsed > 0 && fit.rootCollapsed);
|
|
352
|
+
let t11;
|
|
353
|
+
if ($[23] !== collapsed || $[24] !== items || $[25] !== rootVisible) {
|
|
354
|
+
t11 = items.slice(rootVisible ? 1 : 0, collapsed);
|
|
355
|
+
$[23] = collapsed;
|
|
356
|
+
$[24] = items;
|
|
357
|
+
$[25] = rootVisible;
|
|
358
|
+
$[26] = t11;
|
|
359
|
+
} else t11 = $[26];
|
|
360
|
+
const menuItems = t11;
|
|
361
|
+
if (menuOpen && menuItems.length === 0) setMenuOpen(false);
|
|
362
|
+
const plain = menuItems.length === 0;
|
|
363
|
+
const alwaysCollapsed = countRule(withRoot, false, itemCount);
|
|
364
|
+
let listItems;
|
|
365
|
+
if ($[27] !== alwaysCollapsed || $[28] !== collapsed || $[29] !== itemCount || $[30] !== items || $[31] !== menuItems || $[32] !== menuOpen || $[33] !== plain || $[34] !== rootVisible || $[35] !== withRoot) {
|
|
366
|
+
listItems = [];
|
|
367
|
+
for (const [index, item_1] of items.entries()) {
|
|
368
|
+
const isRoot = withRoot && index === 0;
|
|
369
|
+
const isCollapsed = index < collapsed && !(isRoot && rootVisible);
|
|
370
|
+
if (isCollapsed && index < alwaysCollapsed && !isRoot) continue;
|
|
371
|
+
const rendered = !isCollapsed || !menuOpen;
|
|
372
|
+
listItems.push(/* @__PURE__ */ jsxs("li", {
|
|
373
|
+
className: plain ? Breadcrumbs_module_css_default.ItemWrapper : Breadcrumbs_module_css_default.BreadcrumbsItem,
|
|
374
|
+
"data-index": rendered ? index : void 0,
|
|
375
|
+
"data-collapsed": isCollapsed ? "" : void 0,
|
|
376
|
+
children: [rendered ? item_1 : null, plain ? null : /* @__PURE__ */ jsx(ItemSeparator, {})]
|
|
377
|
+
}, item_1.key));
|
|
335
378
|
}
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
$[
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
$[
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
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;
|
|
379
|
+
if (!plain || !withRoot && itemCount > 2) {
|
|
380
|
+
let t12;
|
|
381
|
+
if ($[37] !== itemCount || $[38] !== items || $[39] !== menuItems || $[40] !== plain) {
|
|
382
|
+
t12 = plain ? items.slice(0, itemCount - 1) : menuItems;
|
|
383
|
+
$[37] = itemCount;
|
|
384
|
+
$[38] = items;
|
|
385
|
+
$[39] = menuItems;
|
|
386
|
+
$[40] = plain;
|
|
387
|
+
$[41] = t12;
|
|
388
|
+
} else t12 = $[41];
|
|
389
|
+
let t13;
|
|
390
|
+
if ($[42] !== menuOpen || $[43] !== t12) {
|
|
391
|
+
t13 = /* @__PURE__ */ jsx(OverflowMenu, {
|
|
392
|
+
items: t12,
|
|
393
|
+
open: menuOpen,
|
|
394
|
+
setOpen: setMenuOpen
|
|
395
|
+
});
|
|
396
|
+
$[42] = menuOpen;
|
|
397
|
+
$[43] = t12;
|
|
398
|
+
$[44] = t13;
|
|
399
|
+
} else t13 = $[44];
|
|
400
|
+
let t14;
|
|
401
|
+
if ($[45] === Symbol.for("react.memo_cache_sentinel")) {
|
|
402
|
+
t14 = /* @__PURE__ */ jsx(ItemSeparator, {});
|
|
403
|
+
$[45] = t14;
|
|
404
|
+
} else t14 = $[45];
|
|
405
|
+
let t15;
|
|
406
|
+
if ($[46] !== plain || $[47] !== t13) {
|
|
407
|
+
t15 = /* @__PURE__ */ jsxs("li", {
|
|
408
|
+
className: Breadcrumbs_module_css_default.BreadcrumbsItem,
|
|
409
|
+
"data-overflow-menu": "",
|
|
410
|
+
hidden: plain,
|
|
411
|
+
children: [t13, t14]
|
|
412
|
+
}, "breadcrumbs-menu");
|
|
413
|
+
$[46] = plain;
|
|
414
|
+
$[47] = t13;
|
|
415
|
+
$[48] = t15;
|
|
416
|
+
} else t15 = $[48];
|
|
417
|
+
listItems.splice(withRoot && rootVisible ? 1 : 0, 0, t15);
|
|
418
|
+
}
|
|
419
|
+
$[27] = alwaysCollapsed;
|
|
420
|
+
$[28] = collapsed;
|
|
421
|
+
$[29] = itemCount;
|
|
422
|
+
$[30] = items;
|
|
423
|
+
$[31] = menuItems;
|
|
424
|
+
$[32] = menuOpen;
|
|
425
|
+
$[33] = plain;
|
|
426
|
+
$[34] = rootVisible;
|
|
427
|
+
$[35] = withRoot;
|
|
428
|
+
$[36] = listItems;
|
|
429
|
+
} else listItems = $[36];
|
|
430
|
+
content = listItems;
|
|
431
|
+
}
|
|
399
432
|
let t11;
|
|
400
|
-
if ($[
|
|
433
|
+
if ($[49] !== className) {
|
|
401
434
|
t11 = clsx(className, Breadcrumbs_module_css_default.BreadcrumbsBase);
|
|
402
|
-
$[
|
|
403
|
-
$[
|
|
404
|
-
} else t11 = $[
|
|
405
|
-
|
|
406
|
-
if ($[40] !== finalChildren) {
|
|
407
|
-
t12 = /* @__PURE__ */ jsx(BreadcrumbsList, { children: finalChildren });
|
|
408
|
-
$[40] = finalChildren;
|
|
409
|
-
$[41] = t12;
|
|
410
|
-
} else t12 = $[41];
|
|
435
|
+
$[49] = className;
|
|
436
|
+
$[50] = t11;
|
|
437
|
+
} else t11 = $[50];
|
|
438
|
+
const t12 = collapsible && overflow === "menu" && itemCount > 2 ? "" : void 0;
|
|
411
439
|
let t13;
|
|
412
|
-
if ($[
|
|
413
|
-
t13 = /* @__PURE__ */ jsx("
|
|
440
|
+
if ($[51] !== content || $[52] !== t12) {
|
|
441
|
+
t13 = /* @__PURE__ */ jsx("ol", {
|
|
442
|
+
className: Breadcrumbs_module_css_default.BreadcrumbsList,
|
|
443
|
+
"data-narrow-collapse": t12,
|
|
444
|
+
children: content
|
|
445
|
+
});
|
|
446
|
+
$[51] = content;
|
|
447
|
+
$[52] = t12;
|
|
448
|
+
$[53] = t13;
|
|
449
|
+
} else t13 = $[53];
|
|
450
|
+
let t14;
|
|
451
|
+
if ($[54] !== overflow || $[55] !== style || $[56] !== t11 || $[57] !== t13 || $[58] !== variant) {
|
|
452
|
+
t14 = /* @__PURE__ */ jsx("nav", {
|
|
414
453
|
className: t11,
|
|
415
454
|
"aria-label": "Breadcrumbs",
|
|
416
455
|
style,
|
|
417
|
-
ref:
|
|
456
|
+
ref: navRef,
|
|
418
457
|
"data-overflow": overflow,
|
|
419
458
|
"data-variant": variant,
|
|
420
459
|
"data-component": "Breadcrumbs",
|
|
421
|
-
children:
|
|
460
|
+
children: t13
|
|
422
461
|
});
|
|
423
|
-
$[
|
|
424
|
-
$[
|
|
425
|
-
$[
|
|
426
|
-
$[
|
|
427
|
-
$[
|
|
428
|
-
$[
|
|
429
|
-
} else
|
|
430
|
-
return
|
|
462
|
+
$[54] = overflow;
|
|
463
|
+
$[55] = style;
|
|
464
|
+
$[56] = t11;
|
|
465
|
+
$[57] = t13;
|
|
466
|
+
$[58] = variant;
|
|
467
|
+
$[59] = t14;
|
|
468
|
+
} else t14 = $[59];
|
|
469
|
+
return t14;
|
|
431
470
|
}
|
|
432
|
-
function
|
|
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) {
|
|
471
|
+
function _temp3(child) {
|
|
439
472
|
return /* @__PURE__ */ jsx("li", {
|
|
440
473
|
className: Breadcrumbs_module_css_default.ItemWrapper,
|
|
441
|
-
children:
|
|
474
|
+
children: child
|
|
442
475
|
});
|
|
443
476
|
}
|
|
444
|
-
function _temp3(child) {
|
|
445
|
-
return child.offsetWidth;
|
|
446
|
-
}
|
|
447
|
-
function _temp2() {
|
|
448
|
-
return [];
|
|
449
|
-
}
|
|
450
477
|
const ItemSeparator = () => {
|
|
451
478
|
const $ = c(1);
|
|
452
479
|
let t0;
|
|
@@ -486,14 +513,5 @@ var Breadcrumbs_default = Object.assign(Breadcrumbs, { Item: BreadcrumbsItemWith
|
|
|
486
513
|
* @deprecated Use the `Breadcrumbs` component instead (i.e. `<Breadcrumb>` → `<Breadcrumbs>`)
|
|
487
514
|
*/
|
|
488
515
|
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
|
-
}
|
|
498
516
|
//#endregion
|
|
499
517
|
export { Breadcrumb, Breadcrumbs_default as default };
|