@primer/react 0.0.0-20260220145113 → 0.0.0-20260220162457
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 -8
- package/dist/Autocomplete/Autocomplete.js +159 -76
- package/dist/Autocomplete/AutocompleteMenu.js +333 -128
- package/dist/Autocomplete/AutocompleteOverlay.js +130 -49
- package/dist/Banner/Banner.js +238 -64
- package/dist/Button/Button.js +34 -11
- package/dist/Button/IconButton.js +140 -51
- package/dist/Button/LinkButton.js +39 -11
- package/dist/Checkbox/Checkbox.js +163 -55
- package/dist/Dialog/Dialog.js +347 -105
- package/dist/PageLayout/PageLayout.js +1560 -622
- package/dist/Text/Text.d.ts +1 -1
- package/dist/Text/Text.d.ts.map +1 -1
- package/dist/Text/Text.js +13 -10
- package/dist/UnderlineNav/UnderlineNavItem.js +149 -56
- package/dist/experimental/SelectPanel2/SelectPanel.js +593 -209
- package/dist/hooks/useScrollFlash.d.ts.map +1 -1
- package/dist/hooks/useScrollFlash.js +22 -14
- package/dist/hooks/useSlots.d.ts +6 -50
- package/dist/hooks/useSlots.d.ts.map +1 -1
- package/dist/hooks/useSlots.js +36 -114
- package/package.json +1 -1
package/dist/Text/Text.d.ts
CHANGED
package/dist/Text/Text.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../src/Text/Text.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../src/Text/Text.tsx"],"names":[],"mappings":"AACA,OAAO,KAA0B,MAAM,OAAO,CAAA;AAG9C,OAAO,EAAkB,KAAK,gBAAgB,EAAC,MAAM,6BAA6B,CAAA;AAElF,MAAM,MAAM,SAAS,CAAC,EAAE,SAAS,KAAK,CAAC,WAAW,GAAG,MAAM,IAAI,gBAAgB,CAC7E,EAAE,EACF,MAAM,EACN;IACE,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAA;IACnC,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAA;IACnD,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CACF,CAAA;yBAGa,EAAE,SAAS,KAAK,CAAC,WAAW;WAP/B,OAAO,GAAG,QAAQ,GAAG,OAAO;aAC1B,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU;gBACvC,MAAM;;WAFX,OAAO,GAAG,QAAQ,GAAG,OAAO;aAC1B,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU;gBACvC,MAAM;;;;AAuBtB,wBAAoC"}
|
package/dist/Text/Text.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { c } from 'react-compiler-runtime';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
|
+
import React from 'react';
|
|
3
4
|
import classes from './Text.module.css.js';
|
|
4
5
|
import { fixedForwardRef } from '../utils/modern-polymorphic.js';
|
|
5
6
|
import { jsx } from 'react/jsx-runtime';
|
|
7
|
+
import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
|
|
6
8
|
|
|
7
9
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
10
|
function Text(props, ref) {
|
|
9
|
-
const $ = c(
|
|
11
|
+
const $ = c(14);
|
|
10
12
|
let className;
|
|
11
13
|
let rest;
|
|
12
14
|
let size;
|
|
@@ -34,6 +36,8 @@ function Text(props, ref) {
|
|
|
34
36
|
weight = $[5];
|
|
35
37
|
}
|
|
36
38
|
const Component = t0 === undefined ? "span" : t0;
|
|
39
|
+
const innerRef = React.useRef(null);
|
|
40
|
+
useRefObjectAsForwardedRef(ref, innerRef);
|
|
37
41
|
let t1;
|
|
38
42
|
if ($[6] !== className) {
|
|
39
43
|
t1 = clsx(className, classes.Text);
|
|
@@ -43,23 +47,22 @@ function Text(props, ref) {
|
|
|
43
47
|
t1 = $[7];
|
|
44
48
|
}
|
|
45
49
|
let t2;
|
|
46
|
-
if ($[8] !== Component || $[9] !==
|
|
50
|
+
if ($[8] !== Component || $[9] !== rest || $[10] !== size || $[11] !== t1 || $[12] !== weight) {
|
|
47
51
|
t2 = /*#__PURE__*/jsx(Component, {
|
|
48
52
|
className: t1,
|
|
49
53
|
"data-size": size,
|
|
50
54
|
"data-weight": weight,
|
|
51
55
|
...rest,
|
|
52
|
-
ref:
|
|
56
|
+
ref: innerRef
|
|
53
57
|
});
|
|
54
58
|
$[8] = Component;
|
|
55
|
-
$[9] =
|
|
56
|
-
$[10] =
|
|
57
|
-
$[11] =
|
|
58
|
-
$[12] =
|
|
59
|
-
$[13] =
|
|
60
|
-
$[14] = t2;
|
|
59
|
+
$[9] = rest;
|
|
60
|
+
$[10] = size;
|
|
61
|
+
$[11] = t1;
|
|
62
|
+
$[12] = weight;
|
|
63
|
+
$[13] = t2;
|
|
61
64
|
} else {
|
|
62
|
-
t2 = $[
|
|
65
|
+
t2 = $[13];
|
|
63
66
|
}
|
|
64
67
|
return t2;
|
|
65
68
|
}
|
|
@@ -1,21 +1,58 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { c } from 'react-compiler-runtime';
|
|
2
|
+
import { forwardRef, useRef, useContext } from 'react';
|
|
2
3
|
import { UnderlineNavContext } from './UnderlineNavContext.js';
|
|
3
4
|
import useIsomorphicLayoutEffect from '../utils/useIsomorphicLayoutEffect.js';
|
|
4
5
|
import { UnderlineItem } from '../internal/components/UnderlineTabbedInterface.js';
|
|
5
6
|
import classes from './UnderlineNavItem.module.css.js';
|
|
6
7
|
import { jsx } from 'react/jsx-runtime';
|
|
7
8
|
|
|
8
|
-
const UnderlineNavItem = /*#__PURE__*/forwardRef(({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
const UnderlineNavItem = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
10
|
+
var _leadingVisual;
|
|
11
|
+
const $ = c(32);
|
|
12
|
+
let Icon;
|
|
13
|
+
let ariaCurrent;
|
|
14
|
+
let children;
|
|
15
|
+
let counter;
|
|
16
|
+
let leadingVisual;
|
|
17
|
+
let onSelect;
|
|
18
|
+
let props;
|
|
19
|
+
let t1;
|
|
20
|
+
let t2;
|
|
21
|
+
if ($[0] !== t0) {
|
|
22
|
+
({
|
|
23
|
+
as: t1,
|
|
24
|
+
href: t2,
|
|
25
|
+
children,
|
|
26
|
+
counter,
|
|
27
|
+
onSelect,
|
|
28
|
+
"aria-current": ariaCurrent,
|
|
29
|
+
icon: Icon,
|
|
30
|
+
leadingVisual,
|
|
31
|
+
...props
|
|
32
|
+
} = t0);
|
|
33
|
+
$[0] = t0;
|
|
34
|
+
$[1] = Icon;
|
|
35
|
+
$[2] = ariaCurrent;
|
|
36
|
+
$[3] = children;
|
|
37
|
+
$[4] = counter;
|
|
38
|
+
$[5] = leadingVisual;
|
|
39
|
+
$[6] = onSelect;
|
|
40
|
+
$[7] = props;
|
|
41
|
+
$[8] = t1;
|
|
42
|
+
$[9] = t2;
|
|
43
|
+
} else {
|
|
44
|
+
Icon = $[1];
|
|
45
|
+
ariaCurrent = $[2];
|
|
46
|
+
children = $[3];
|
|
47
|
+
counter = $[4];
|
|
48
|
+
leadingVisual = $[5];
|
|
49
|
+
onSelect = $[6];
|
|
50
|
+
props = $[7];
|
|
51
|
+
t1 = $[8];
|
|
52
|
+
t2 = $[9];
|
|
53
|
+
}
|
|
54
|
+
const Component = t1 === undefined ? "a" : t1;
|
|
55
|
+
const href = t2 === undefined ? "#" : t2;
|
|
19
56
|
const backupRef = useRef(null);
|
|
20
57
|
const ref = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : backupRef;
|
|
21
58
|
const {
|
|
@@ -24,51 +61,107 @@ const UnderlineNavItem = /*#__PURE__*/forwardRef(({
|
|
|
24
61
|
loadingCounters,
|
|
25
62
|
iconsVisible
|
|
26
63
|
} = useContext(UnderlineNavContext);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
text
|
|
36
|
-
width:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
64
|
+
let t3;
|
|
65
|
+
let t4;
|
|
66
|
+
if ($[10] !== ref || $[11] !== setChildrenWidth || $[12] !== setNoIconChildrenWidth) {
|
|
67
|
+
t3 = () => {
|
|
68
|
+
if (ref.current) {
|
|
69
|
+
const domRect = ref.current.getBoundingClientRect();
|
|
70
|
+
const icon = Array.from(ref.current.children).find(_temp);
|
|
71
|
+
const content = Array.from(ref.current.children).find(_temp2);
|
|
72
|
+
const text = content.textContent;
|
|
73
|
+
const iconWidthWithMargin = icon ? icon.getBoundingClientRect().width + Number(getComputedStyle(icon).marginRight.slice(0, -2)) + Number(getComputedStyle(icon).marginLeft.slice(0, -2)) : 0;
|
|
74
|
+
setChildrenWidth({
|
|
75
|
+
text,
|
|
76
|
+
width: domRect.width
|
|
77
|
+
});
|
|
78
|
+
setNoIconChildrenWidth({
|
|
79
|
+
text,
|
|
80
|
+
width: domRect.width - iconWidthWithMargin
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
t4 = [ref, setChildrenWidth, setNoIconChildrenWidth];
|
|
85
|
+
$[10] = ref;
|
|
86
|
+
$[11] = setChildrenWidth;
|
|
87
|
+
$[12] = setNoIconChildrenWidth;
|
|
88
|
+
$[13] = t3;
|
|
89
|
+
$[14] = t4;
|
|
90
|
+
} else {
|
|
91
|
+
t3 = $[13];
|
|
92
|
+
t4 = $[14];
|
|
93
|
+
}
|
|
94
|
+
useIsomorphicLayoutEffect(t3, t4);
|
|
95
|
+
let t5;
|
|
96
|
+
if ($[15] !== onSelect) {
|
|
97
|
+
t5 = event => {
|
|
98
|
+
if ((event.key === " " || event.key === "Enter") && !event.defaultPrevented && typeof onSelect === "function") {
|
|
99
|
+
onSelect(event);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
$[15] = onSelect;
|
|
103
|
+
$[16] = t5;
|
|
104
|
+
} else {
|
|
105
|
+
t5 = $[16];
|
|
106
|
+
}
|
|
107
|
+
const keyDownHandler = t5;
|
|
108
|
+
let t6;
|
|
109
|
+
if ($[17] !== onSelect) {
|
|
110
|
+
t6 = event_0 => {
|
|
111
|
+
if (!event_0.defaultPrevented && typeof onSelect === "function") {
|
|
112
|
+
onSelect(event_0);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
$[17] = onSelect;
|
|
116
|
+
$[18] = t6;
|
|
117
|
+
} else {
|
|
118
|
+
t6 = $[18];
|
|
119
|
+
}
|
|
120
|
+
const clickHandler = t6;
|
|
121
|
+
const t7 = (_leadingVisual = leadingVisual) !== null && _leadingVisual !== void 0 ? _leadingVisual : Icon;
|
|
122
|
+
let t8;
|
|
123
|
+
if ($[19] !== Component || $[20] !== ariaCurrent || $[21] !== children || $[22] !== clickHandler || $[23] !== counter || $[24] !== href || $[25] !== iconsVisible || $[26] !== keyDownHandler || $[27] !== loadingCounters || $[28] !== props || $[29] !== ref || $[30] !== t7) {
|
|
124
|
+
t8 = /*#__PURE__*/jsx("li", {
|
|
125
|
+
className: classes.UnderlineNavItem,
|
|
126
|
+
children: /*#__PURE__*/jsx(UnderlineItem, {
|
|
127
|
+
ref: ref,
|
|
128
|
+
as: Component,
|
|
129
|
+
href: href,
|
|
130
|
+
"aria-current": ariaCurrent,
|
|
131
|
+
onKeyDown: keyDownHandler,
|
|
132
|
+
onClick: clickHandler,
|
|
133
|
+
counter: counter,
|
|
134
|
+
icon: t7,
|
|
135
|
+
loadingCounters: loadingCounters,
|
|
136
|
+
iconsVisible: iconsVisible,
|
|
137
|
+
...props,
|
|
138
|
+
children: children
|
|
139
|
+
})
|
|
140
|
+
});
|
|
141
|
+
$[19] = Component;
|
|
142
|
+
$[20] = ariaCurrent;
|
|
143
|
+
$[21] = children;
|
|
144
|
+
$[22] = clickHandler;
|
|
145
|
+
$[23] = counter;
|
|
146
|
+
$[24] = href;
|
|
147
|
+
$[25] = iconsVisible;
|
|
148
|
+
$[26] = keyDownHandler;
|
|
149
|
+
$[27] = loadingCounters;
|
|
150
|
+
$[28] = props;
|
|
151
|
+
$[29] = ref;
|
|
152
|
+
$[30] = t7;
|
|
153
|
+
$[31] = t8;
|
|
154
|
+
} else {
|
|
155
|
+
t8 = $[31];
|
|
156
|
+
}
|
|
157
|
+
return t8;
|
|
71
158
|
});
|
|
72
159
|
UnderlineNavItem.displayName = 'UnderlineNavItem';
|
|
160
|
+
function _temp(child) {
|
|
161
|
+
return child.getAttribute("data-component") === "icon";
|
|
162
|
+
}
|
|
163
|
+
function _temp2(child_0) {
|
|
164
|
+
return child_0.getAttribute("data-component") === "text";
|
|
165
|
+
}
|
|
73
166
|
|
|
74
167
|
export { UnderlineNavItem };
|