@primer/react 38.46.0-rc.a85a32423 → 38.46.0-rc.bd9baf288
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 +4 -0
- package/dist/ActionList/LinkItem.js +97 -30
- package/dist/Breadcrumbs/Breadcrumbs.js +1 -0
- package/dist/TooltipV2/Tooltip.js +55 -51
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -8,10 +8,14 @@
|
|
|
8
8
|
|
|
9
9
|
### Patch Changes
|
|
10
10
|
|
|
11
|
+
- [#8679](https://github.com/primer/react/pull/8679) [`dbf2ac1`](https://github.com/primer/react/commit/dbf2ac1d758a0aae69f37ad1bd789480ce58ff4c) Thanks [@llastflowers](https://github.com/llastflowers)! - Breadcrumbs: Close the overflow menu when Escape is pressed while its tooltip is open.
|
|
12
|
+
|
|
11
13
|
- [#8628](https://github.com/primer/react/pull/8628) [`41f29c8`](https://github.com/primer/react/commit/41f29c845663936043618af29dcb71de4c9384b2) Thanks [@joshblack](https://github.com/joshblack)! - SkeletonAvatar, SkeletonText: Preserve the requested size and shape regardless of stylesheet load order
|
|
12
14
|
|
|
13
15
|
- [#8562](https://github.com/primer/react/pull/8562) [`ee46232`](https://github.com/primer/react/commit/ee46232fafa24701415b21eed60cca68e589cf1c) Thanks [@joshblack](https://github.com/joshblack)! - useOnEscapePress, useOnOutsideClick: Improve performance when callbacks change between renders.
|
|
14
16
|
|
|
17
|
+
- [#8609](https://github.com/primer/react/pull/8609) [`da90227`](https://github.com/primer/react/commit/da9022741a8109195480d7e6ccdf80cd723d6199) Thanks [@tay1orjones](https://github.com/tay1orjones)! - ActionList.LinkItem, NavList.Item: Preserve keyboard focus and running child animations when links rerender.
|
|
18
|
+
|
|
15
19
|
## 38.45.0
|
|
16
20
|
|
|
17
21
|
### Minor Changes
|
|
@@ -1,43 +1,110 @@
|
|
|
1
|
+
import { c } from "../utils/react-compiler-runtime.js";
|
|
1
2
|
import { fixedForwardRef } from "../utils/modern-polymorphic.js";
|
|
2
3
|
import { Tooltip } from "../TooltipV2/Tooltip.js";
|
|
3
4
|
import { Item } from "./Item.js";
|
|
4
5
|
import Link from "../Link/Link.js";
|
|
6
|
+
import React from "react";
|
|
5
7
|
import { jsx } from "react/jsx-runtime";
|
|
6
8
|
//#region src/ActionList/LinkItem.tsx
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
9
|
+
const LinkItemWrapperContext = /*#__PURE__*/ React.createContext(null);
|
|
10
|
+
const LinkItemWrapper = (t0) => {
|
|
11
|
+
const $ = c(21);
|
|
12
|
+
let children;
|
|
13
|
+
let onClick;
|
|
14
|
+
let rest;
|
|
15
|
+
if ($[0] !== t0) {
|
|
16
|
+
({children, onClick, ...rest} = t0);
|
|
17
|
+
$[0] = t0;
|
|
18
|
+
$[1] = children;
|
|
19
|
+
$[2] = onClick;
|
|
20
|
+
$[3] = rest;
|
|
21
|
+
} else {
|
|
22
|
+
children = $[1];
|
|
23
|
+
onClick = $[2];
|
|
24
|
+
rest = $[3];
|
|
25
|
+
}
|
|
26
|
+
const context = React.useContext(LinkItemWrapperContext);
|
|
27
|
+
if (!context) throw new Error("LinkItemWrapper must be rendered within ActionList.LinkItem");
|
|
28
|
+
const { Component, linkProps, inactiveText, forwardedRef, tooltipText } = context;
|
|
29
|
+
let t1;
|
|
30
|
+
if ($[4] !== linkProps || $[5] !== onClick) {
|
|
31
|
+
t1 = (event) => {
|
|
32
|
+
onClick && onClick(event);
|
|
33
|
+
linkProps.onClick && linkProps.onClick(event);
|
|
34
|
+
};
|
|
35
|
+
$[4] = linkProps;
|
|
36
|
+
$[5] = onClick;
|
|
37
|
+
$[6] = t1;
|
|
38
|
+
} else t1 = $[6];
|
|
39
|
+
const clickHandler = t1;
|
|
40
|
+
if (inactiveText) {
|
|
41
|
+
let t2;
|
|
42
|
+
if ($[7] !== children || $[8] !== rest) {
|
|
43
|
+
t2 = /* @__PURE__ */ jsx("span", {
|
|
21
44
|
...rest,
|
|
22
45
|
children
|
|
23
46
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
47
|
+
$[7] = children;
|
|
48
|
+
$[8] = rest;
|
|
49
|
+
$[9] = t2;
|
|
50
|
+
} else t2 = $[9];
|
|
51
|
+
return t2;
|
|
52
|
+
}
|
|
53
|
+
const t2 = tooltipText ? void 0 : forwardedRef;
|
|
54
|
+
let t3;
|
|
55
|
+
if ($[10] !== Component || $[11] !== children || $[12] !== clickHandler || $[13] !== linkProps || $[14] !== rest || $[15] !== t2) {
|
|
56
|
+
t3 = /* @__PURE__ */ jsx(Link, {
|
|
57
|
+
as: Component,
|
|
58
|
+
...rest,
|
|
59
|
+
...linkProps,
|
|
60
|
+
onClick: clickHandler,
|
|
61
|
+
ref: t2,
|
|
62
|
+
children
|
|
63
|
+
});
|
|
64
|
+
$[10] = Component;
|
|
65
|
+
$[11] = children;
|
|
66
|
+
$[12] = clickHandler;
|
|
67
|
+
$[13] = linkProps;
|
|
68
|
+
$[14] = rest;
|
|
69
|
+
$[15] = t2;
|
|
70
|
+
$[16] = t3;
|
|
71
|
+
} else t3 = $[16];
|
|
72
|
+
const link = t3;
|
|
73
|
+
let t4;
|
|
74
|
+
if ($[17] !== forwardedRef || $[18] !== link || $[19] !== tooltipText) {
|
|
75
|
+
t4 = tooltipText ? /* @__PURE__ */ jsx(Tooltip, {
|
|
76
|
+
ref: forwardedRef,
|
|
77
|
+
text: tooltipText,
|
|
78
|
+
direction: "e",
|
|
79
|
+
delay: "medium",
|
|
80
|
+
children: link
|
|
81
|
+
}) : link;
|
|
82
|
+
$[17] = forwardedRef;
|
|
83
|
+
$[18] = link;
|
|
84
|
+
$[19] = tooltipText;
|
|
85
|
+
$[20] = t4;
|
|
86
|
+
} else t4 = $[20];
|
|
87
|
+
return t4;
|
|
88
|
+
};
|
|
89
|
+
const LinkItemComponent = fixedForwardRef(({ active, inactiveText, variant, size, as: Component, className, _PrivateTooltipText, ...props }, forwardedRef) => {
|
|
90
|
+
return /* @__PURE__ */ jsx(LinkItemWrapperContext.Provider, {
|
|
91
|
+
value: {
|
|
92
|
+
Component,
|
|
93
|
+
linkProps: props,
|
|
94
|
+
inactiveText,
|
|
95
|
+
forwardedRef,
|
|
96
|
+
tooltipText: _PrivateTooltipText
|
|
39
97
|
},
|
|
40
|
-
children:
|
|
98
|
+
children: /* @__PURE__ */ jsx(Item, {
|
|
99
|
+
className,
|
|
100
|
+
active,
|
|
101
|
+
inactiveText,
|
|
102
|
+
"data-inactive": inactiveText ? true : void 0,
|
|
103
|
+
variant,
|
|
104
|
+
size,
|
|
105
|
+
_PrivateItemWrapper: LinkItemWrapper,
|
|
106
|
+
children: props.children
|
|
107
|
+
})
|
|
41
108
|
});
|
|
42
109
|
});
|
|
43
110
|
const LinkItem = Object.assign(LinkItemComponent, {
|
|
@@ -128,6 +128,7 @@ const BreadcrumbsMenuItem = /*#__PURE__*/ React.forwardRef((t0, menuRefCallback)
|
|
|
128
128
|
role: "button",
|
|
129
129
|
ref: menuButtonRef,
|
|
130
130
|
"aria-label": t8,
|
|
131
|
+
"aria-haspopup": "true",
|
|
131
132
|
"aria-expanded": t9,
|
|
132
133
|
onClick: handleSummaryClick,
|
|
133
134
|
variant: "invisible",
|
|
@@ -82,7 +82,7 @@ const isInteractive = (element) => {
|
|
|
82
82
|
};
|
|
83
83
|
const emptyKeybindingHints = [];
|
|
84
84
|
const Tooltip = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
85
|
-
const $ = c(
|
|
85
|
+
const $ = c(60);
|
|
86
86
|
let children;
|
|
87
87
|
let className;
|
|
88
88
|
let id;
|
|
@@ -240,33 +240,37 @@ const Tooltip = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
|
240
240
|
} else t10 = $[26];
|
|
241
241
|
useEffect(t9, t10);
|
|
242
242
|
let t11;
|
|
243
|
-
if ($[27] !==
|
|
243
|
+
if ($[27] !== _privateDisableTooltip || $[28] !== closeTooltip || $[29] !== isPopoverOpen) {
|
|
244
244
|
t11 = (event) => {
|
|
245
245
|
if (isPopoverOpen) {
|
|
246
|
-
|
|
247
|
-
|
|
246
|
+
if (!_privateDisableTooltip) {
|
|
247
|
+
event.stopImmediatePropagation();
|
|
248
|
+
event.preventDefault();
|
|
249
|
+
}
|
|
248
250
|
closeTooltip();
|
|
249
251
|
}
|
|
250
252
|
};
|
|
251
|
-
$[27] =
|
|
252
|
-
$[28] =
|
|
253
|
-
$[29] =
|
|
254
|
-
|
|
253
|
+
$[27] = _privateDisableTooltip;
|
|
254
|
+
$[28] = closeTooltip;
|
|
255
|
+
$[29] = isPopoverOpen;
|
|
256
|
+
$[30] = t11;
|
|
257
|
+
} else t11 = $[30];
|
|
255
258
|
let t12;
|
|
256
|
-
if ($[
|
|
257
|
-
t12 = [isPopoverOpen];
|
|
258
|
-
$[
|
|
259
|
-
$[
|
|
260
|
-
|
|
259
|
+
if ($[31] !== _privateDisableTooltip || $[32] !== isPopoverOpen) {
|
|
260
|
+
t12 = [isPopoverOpen, _privateDisableTooltip];
|
|
261
|
+
$[31] = _privateDisableTooltip;
|
|
262
|
+
$[32] = isPopoverOpen;
|
|
263
|
+
$[33] = t12;
|
|
264
|
+
} else t12 = $[33];
|
|
261
265
|
useOnEscapePress(t11, t12);
|
|
262
266
|
const platform = usePlatform();
|
|
263
267
|
const hasAriaLabel_0 = "aria-label" in rest;
|
|
264
268
|
let t13;
|
|
265
|
-
if ($[
|
|
269
|
+
if ($[34] !== keybindingHint) {
|
|
266
270
|
t13 = Array.isArray(keybindingHint) ? keybindingHint : [keybindingHint];
|
|
267
|
-
$[
|
|
268
|
-
$[
|
|
269
|
-
} else t13 = $[
|
|
271
|
+
$[34] = keybindingHint;
|
|
272
|
+
$[35] = t13;
|
|
273
|
+
} else t13 = $[35];
|
|
270
274
|
const keybindingHints = t13;
|
|
271
275
|
if (isFragmentTrigger) return child;
|
|
272
276
|
const t14 = TooltipContext;
|
|
@@ -313,15 +317,15 @@ const Tooltip = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
|
313
317
|
}
|
|
314
318
|
});
|
|
315
319
|
let t17;
|
|
316
|
-
if ($[
|
|
320
|
+
if ($[36] !== className) {
|
|
317
321
|
t17 = clsx(className, Tooltip_module_css_default.Tooltip);
|
|
318
|
-
$[
|
|
319
|
-
$[
|
|
320
|
-
} else t17 = $[
|
|
322
|
+
$[36] = className;
|
|
323
|
+
$[37] = t17;
|
|
324
|
+
} else t17 = $[37];
|
|
321
325
|
const t18 = type === "description" ? "tooltip" : void 0;
|
|
322
326
|
const t19 = hasAriaLabel_0 || keybindingHints.length === 0 ? tooltipId : void 0;
|
|
323
327
|
let t20;
|
|
324
|
-
if ($[
|
|
328
|
+
if ($[38] !== hasAriaLabel_0 || $[39] !== keybindingHints || $[40] !== platform || $[41] !== text || $[42] !== tooltipId) {
|
|
325
329
|
t20 = keybindingHints.length > 0 ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("span", {
|
|
326
330
|
id: hasAriaLabel_0 ? void 0 : tooltipId,
|
|
327
331
|
children: [text, /* @__PURE__ */ jsxs(VisuallyHidden, { children: [
|
|
@@ -335,15 +339,15 @@ const Tooltip = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
|
335
339
|
"data-component": "Tooltip.KeybindingHintContainer",
|
|
336
340
|
children: keybindingHints.map(_temp4)
|
|
337
341
|
})] }) : text;
|
|
338
|
-
$[
|
|
339
|
-
$[
|
|
340
|
-
$[
|
|
341
|
-
$[
|
|
342
|
-
$[
|
|
343
|
-
$[
|
|
344
|
-
} else t20 = $[
|
|
342
|
+
$[38] = hasAriaLabel_0;
|
|
343
|
+
$[39] = keybindingHints;
|
|
344
|
+
$[40] = platform;
|
|
345
|
+
$[41] = text;
|
|
346
|
+
$[42] = tooltipId;
|
|
347
|
+
$[43] = t20;
|
|
348
|
+
} else t20 = $[43];
|
|
345
349
|
let t21;
|
|
346
|
-
if ($[
|
|
350
|
+
if ($[44] !== calculatedDirection || $[45] !== closeTooltip || $[46] !== openTooltip || $[47] !== rest || $[48] !== t17 || $[49] !== t18 || $[50] !== t19 || $[51] !== t20) {
|
|
347
351
|
t21 = /* @__PURE__ */ jsx("span", {
|
|
348
352
|
className: t17,
|
|
349
353
|
ref: tooltipElRef,
|
|
@@ -357,34 +361,34 @@ const Tooltip = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
|
357
361
|
id: t19,
|
|
358
362
|
children: t20
|
|
359
363
|
});
|
|
360
|
-
$[
|
|
361
|
-
$[
|
|
362
|
-
$[
|
|
363
|
-
$[
|
|
364
|
-
$[
|
|
365
|
-
$[
|
|
366
|
-
$[
|
|
367
|
-
$[
|
|
368
|
-
$[
|
|
369
|
-
} else t21 = $[
|
|
364
|
+
$[44] = calculatedDirection;
|
|
365
|
+
$[45] = closeTooltip;
|
|
366
|
+
$[46] = openTooltip;
|
|
367
|
+
$[47] = rest;
|
|
368
|
+
$[48] = t17;
|
|
369
|
+
$[49] = t18;
|
|
370
|
+
$[50] = t19;
|
|
371
|
+
$[51] = t20;
|
|
372
|
+
$[52] = t21;
|
|
373
|
+
} else t21 = $[52];
|
|
370
374
|
let t22;
|
|
371
|
-
if ($[
|
|
375
|
+
if ($[53] !== t15 || $[54] !== t21) {
|
|
372
376
|
t22 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t15, t21] });
|
|
373
|
-
$[
|
|
374
|
-
$[
|
|
375
|
-
$[
|
|
376
|
-
} else t22 = $[
|
|
377
|
+
$[53] = t15;
|
|
378
|
+
$[54] = t21;
|
|
379
|
+
$[55] = t22;
|
|
380
|
+
} else t22 = $[55];
|
|
377
381
|
let t23;
|
|
378
|
-
if ($[
|
|
382
|
+
if ($[56] !== t14.Provider || $[57] !== t22 || $[58] !== value) {
|
|
379
383
|
t23 = /* @__PURE__ */ jsx(t14.Provider, {
|
|
380
384
|
value,
|
|
381
385
|
children: t22
|
|
382
386
|
});
|
|
383
|
-
$[
|
|
384
|
-
$[
|
|
385
|
-
$[
|
|
386
|
-
$[
|
|
387
|
-
} else t23 = $[
|
|
387
|
+
$[56] = t14.Provider;
|
|
388
|
+
$[57] = t22;
|
|
389
|
+
$[58] = value;
|
|
390
|
+
$[59] = t23;
|
|
391
|
+
} else t23 = $[59];
|
|
388
392
|
return t23;
|
|
389
393
|
});
|
|
390
394
|
Tooltip.__SLOT__ = Symbol("Tooltip");
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primer/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "38.46.0-rc.
|
|
4
|
+
"version": "38.46.0-rc.bd9baf288",
|
|
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",
|
|
@@ -109,12 +109,12 @@
|
|
|
109
109
|
"@primer/doc-gen": "^0.0.1",
|
|
110
110
|
"@primer/react-compiler-check": "^0.0.0",
|
|
111
111
|
"@rolldown/plugin-babel": "^0.2.4",
|
|
112
|
-
"@storybook/addon-a11y": "10.
|
|
113
|
-
"@storybook/addon-docs": "10.
|
|
114
|
-
"@storybook/addon-links": "10.
|
|
115
|
-
"@storybook/addon-mcp": "^
|
|
116
|
-
"@storybook/icons": "^2.
|
|
117
|
-
"@storybook/react-vite": "10.
|
|
112
|
+
"@storybook/addon-a11y": "10.6.2",
|
|
113
|
+
"@storybook/addon-docs": "10.6.2",
|
|
114
|
+
"@storybook/addon-links": "10.6.2",
|
|
115
|
+
"@storybook/addon-mcp": "^10.6.2",
|
|
116
|
+
"@storybook/icons": "^2.2.0",
|
|
117
|
+
"@storybook/react-vite": "10.6.2",
|
|
118
118
|
"@testing-library/dom": "^10.4.0",
|
|
119
119
|
"@testing-library/jest-dom": "^6.4.5",
|
|
120
120
|
"@testing-library/react": "^16.3.0",
|
|
@@ -169,7 +169,7 @@
|
|
|
169
169
|
"rolldown-plugin-dts": "^0.26.0",
|
|
170
170
|
"rolldown-plugin-import-css": "^0.0.0",
|
|
171
171
|
"rolldown-plugin-preserve-directives": "^0.0.0",
|
|
172
|
-
"storybook": "10.
|
|
172
|
+
"storybook": "10.6.6",
|
|
173
173
|
"terser": "5.36.0",
|
|
174
174
|
"ts-toolbelt": "9.6.0",
|
|
175
175
|
"tsx": "4.20.3",
|