@primer/react 38.46.0-rc.f306d31b6 → 38.46.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/CHANGELOG.md +2 -0
- package/dist/Breadcrumbs/Breadcrumbs.js +9 -3
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
### Patch Changes
|
|
12
12
|
|
|
13
|
+
- [#8748](https://github.com/primer/react/pull/8748) [`324b0aa`](https://github.com/primer/react/commit/324b0aa0f1e4cc12c61a8a36b5790357e428dccc) Thanks [@mattcosta7](https://github.com/mattcosta7)! - Breadcrumbs: Collapse crumbs that render more than one element (such as a link with a sibling button) when they no longer fit, instead of overflowing the container.
|
|
14
|
+
|
|
13
15
|
- [#8683](https://github.com/primer/react/pull/8683) [`32d5061`](https://github.com/primer/react/commit/32d50618c58cceddf66d83716ac9742c2134b790) Thanks [@mattcosta7](https://github.com/mattcosta7)! - Breadcrumbs: Improve the performance of `overflow="menu"` and `"menu-with-root"` on mount, resize and navigation. Server-rendered markup now applies the collapse rules before hydration, and the overflow menu trigger is a `<button>`.
|
|
14
16
|
|
|
15
17
|
- [#8592](https://github.com/primer/react/pull/8592) [`0ae18d3`](https://github.com/primer/react/commit/0ae18d38f09044c40c1a181288c2783e93629b4e) Thanks [@liuliu-dev](https://github.com/liuliu-dev)! - Card: Improve shrinking and equal-height layouts, keep secondary controls accessible in custom whole-card compositions, and keep images edge-to-edge across padding options.
|
|
@@ -61,6 +61,12 @@ function getContentWidth(nav) {
|
|
|
61
61
|
const { paddingLeft, paddingRight } = getComputedStyle(nav);
|
|
62
62
|
return nav.clientWidth - parseFloat(paddingLeft) - parseFloat(paddingRight);
|
|
63
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
|
+
}
|
|
64
70
|
const sameFit = (a, b) => a.extra === b.extra && a.rootCollapsed === b.rootCollapsed && a.narrow === b.narrow;
|
|
65
71
|
function getValidChildren(children) {
|
|
66
72
|
return React.Children.toArray(children).filter((child) => /*#__PURE__*/ React.isValidElement(child));
|
|
@@ -245,6 +251,7 @@ function Breadcrumbs(t0) {
|
|
|
245
251
|
const previous = widthsRef.current;
|
|
246
252
|
const widths_0 = /* @__PURE__ */ new Map();
|
|
247
253
|
let separators = separatorsRef.current;
|
|
254
|
+
const range = nav.ownerDocument.createRange();
|
|
248
255
|
for (const item_0 of items) {
|
|
249
256
|
var _item_0$key;
|
|
250
257
|
const width = previous.get((_item_0$key = item_0.key) !== null && _item_0$key !== void 0 ? _item_0$key : "");
|
|
@@ -256,9 +263,8 @@ function Breadcrumbs(t0) {
|
|
|
256
263
|
for (const li of nav.querySelectorAll(":scope > ol > li[data-index]")) {
|
|
257
264
|
var _items$Number;
|
|
258
265
|
const key = (_items$Number = items[Number(li.getAttribute("data-index"))]) === null || _items$Number === void 0 ? void 0 : _items$Number.key;
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
const crumbWidth = crumb.getBoundingClientRect().width;
|
|
266
|
+
if (key == null) continue;
|
|
267
|
+
const crumbWidth = getCrumbWidth(li, range);
|
|
262
268
|
widths_0.set(key, crumbWidth);
|
|
263
269
|
if (li.nextElementSibling && !li.hasAttribute("data-collapsed")) {
|
|
264
270
|
const separator = li.getBoundingClientRect().width - crumbWidth;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primer/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "38.46.0
|
|
4
|
+
"version": "38.46.0",
|
|
5
5
|
"description": "An implementation of GitHub's Primer Design System using React",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -94,16 +94,16 @@
|
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": {
|
|
96
96
|
"@actions/core": "1.11.1",
|
|
97
|
-
"@babel/cli": "8.0
|
|
98
|
-
"@babel/core": "8.0
|
|
99
|
-
"@babel/generator": "8.0
|
|
100
|
-
"@babel/parser": "8.0
|
|
97
|
+
"@babel/cli": "8.1.0",
|
|
98
|
+
"@babel/core": "8.1.0",
|
|
99
|
+
"@babel/generator": "8.1.0",
|
|
100
|
+
"@babel/parser": "8.1.0",
|
|
101
101
|
"@babel/plugin-transform-nullish-coalescing-operator": "8.0.1",
|
|
102
102
|
"@babel/plugin-transform-optional-chaining": "8.0.5",
|
|
103
103
|
"@babel/plugin-transform-modules-commonjs": "8.0.1",
|
|
104
104
|
"@babel/preset-react": "8.0.1",
|
|
105
105
|
"@babel/preset-typescript": "8.0.7",
|
|
106
|
-
"@babel/types": "8.0
|
|
106
|
+
"@babel/types": "8.1.0",
|
|
107
107
|
"@figma/code-connect": "1.3.2",
|
|
108
108
|
"@primer/css": "^21.5.1",
|
|
109
109
|
"@primer/doc-gen": "^0.0.1",
|