@primer/react 0.0.0-20260701235500 → 0.0.0-20260702155148
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 +7 -1
- package/dist/ActionList/Heading.js +25 -35
- package/dist/ActionList/List.js +46 -45
- package/dist/AnchoredOverlay/AnchoredOverlay.js +2 -4
- package/dist/Autocomplete/Autocomplete.js +131 -74
- package/dist/Autocomplete/AutocompleteInput.js +7 -10
- package/dist/Autocomplete/AutocompleteMenu.js +277 -119
- package/dist/Autocomplete/AutocompleteOverlay.js +113 -38
- package/dist/Banner/Banner.js +414 -96
- package/dist/Button/Button.js +29 -8
- package/dist/Button/IconButton.js +120 -28
- package/dist/Button/LinkButton.js +34 -8
- package/dist/ButtonGroup/ButtonGroup.js +23 -23
- package/dist/Checkbox/Checkbox.js +4 -5
- package/dist/ConfirmationDialog/ConfirmationDialog.js +86 -24
- package/dist/Dialog/Dialog.js +3 -3
- package/dist/FilteredActionList/FilteredActionList.js +5 -7
- package/dist/FilteredActionList/FilteredActionListInput.d.ts +1 -1
- package/dist/PageHeader/PageHeader.js +31 -30
- package/dist/PageLayout/PageLayout.js +1274 -478
- package/dist/Pagination/Pagination.js +196 -70
- package/dist/SelectPanel/SelectPanelMessage.js +72 -29
- package/dist/TextInput/TextInput.js +4 -5
- package/dist/TooltipV2/Tooltip.js +5 -15
- package/dist/UnderlineNav/UnderlineNav-964b246d.css +2 -0
- package/dist/UnderlineNav/UnderlineNav-964b246d.css.map +1 -0
- package/dist/UnderlineNav/UnderlineNav.js +198 -64
- package/dist/UnderlineNav/UnderlineNav.module.css.js +2 -1
- package/dist/UnderlineNav/UnderlineNavItem.js +110 -22
- package/dist/experimental/Tabs/types.d.ts +2 -2
- package/dist/experimental/Tabs/useTabList.js +15 -16
- package/dist/hooks/useMergedRefs.js +20 -14
- package/dist/hooks/useOpenAndCloseFocus.js +1 -7
- package/dist/hooks/useProvidedRefOrCreate.d.ts +10 -7
- package/dist/hooks/useProvidedRefOrCreate.js +10 -7
- package/dist/hooks/useScrollFlash.js +24 -10
- package/dist/internal/components/UnderlineTabbedInterface-25587345.css +2 -0
- package/dist/internal/components/UnderlineTabbedInterface-25587345.css.map +1 -0
- package/dist/internal/components/UnderlineTabbedInterface.module.css.js +1 -1
- package/package.json +1 -1
- package/dist/UnderlineNav/UnderlineNav-47547980.css +0 -2
- package/dist/UnderlineNav/UnderlineNav-47547980.css.map +0 -1
- package/dist/internal/components/UnderlineTabbedInterface-1745a3d6.css +0 -2
- package/dist/internal/components/UnderlineTabbedInterface-1745a3d6.css.map +0 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { viewportRanges } from "../hooks/useResponsiveValue.js";
|
|
2
2
|
import { buildComponentData, buildPaginationModel } from "./model.js";
|
|
3
3
|
import Pagination_module_css_default from "./Pagination.module.css.js";
|
|
4
|
+
import { c } from "react-compiler-runtime";
|
|
4
5
|
import { clsx } from "clsx";
|
|
5
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import
|
|
7
|
+
import "react";
|
|
7
8
|
import { ChevronLeftIcon, ChevronRightIcon } from "@primer/octicons-react";
|
|
8
9
|
//#region src/Pagination/Pagination.tsx
|
|
9
10
|
const getViewportRangesToHidePages = (showPages) => {
|
|
@@ -11,79 +12,204 @@ const getViewportRangesToHidePages = (showPages) => {
|
|
|
11
12
|
if (showPages) return [];
|
|
12
13
|
else return Object.keys(viewportRanges);
|
|
13
14
|
};
|
|
14
|
-
const PageLabel = (
|
|
15
|
-
|
|
16
|
-
children,
|
|
17
|
-
|
|
18
|
-
]
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
15
|
+
const PageLabel = (t0) => {
|
|
16
|
+
const $ = c(8);
|
|
17
|
+
const { children, direction } = t0;
|
|
18
|
+
let t1;
|
|
19
|
+
if ($[0] !== direction) {
|
|
20
|
+
t1 = direction === "page-prev" ? /*#__PURE__*/ jsx(ChevronLeftIcon, { "data-component": "Pagination.PreviousPageIcon" }) : null;
|
|
21
|
+
$[0] = direction;
|
|
22
|
+
$[1] = t1;
|
|
23
|
+
} else t1 = $[1];
|
|
24
|
+
let t2;
|
|
25
|
+
if ($[2] !== direction) {
|
|
26
|
+
t2 = direction === "page-next" ? /*#__PURE__*/ jsx(ChevronRightIcon, { "data-component": "Pagination.NextPageIcon" }) : null;
|
|
27
|
+
$[2] = direction;
|
|
28
|
+
$[3] = t2;
|
|
29
|
+
} else t2 = $[3];
|
|
30
|
+
let t3;
|
|
31
|
+
if ($[4] !== children || $[5] !== t1 || $[6] !== t2) {
|
|
32
|
+
t3 = /*#__PURE__*/ jsxs(Fragment, { children: [
|
|
33
|
+
t1,
|
|
34
|
+
children,
|
|
35
|
+
t2
|
|
36
|
+
] });
|
|
37
|
+
$[4] = children;
|
|
38
|
+
$[5] = t1;
|
|
39
|
+
$[6] = t2;
|
|
40
|
+
$[7] = t3;
|
|
41
|
+
} else t3 = $[7];
|
|
42
|
+
return t3;
|
|
43
|
+
};
|
|
44
|
+
function usePaginationPages(t0) {
|
|
45
|
+
const $ = c(17);
|
|
46
|
+
const { pageCount, currentPage, onPageChange, hrefBuilder, marginPageCount, showPages, surroundingPageCount, renderPage } = t0;
|
|
47
|
+
let t1;
|
|
48
|
+
if ($[0] !== onPageChange) {
|
|
49
|
+
t1 = (n) => (e) => onPageChange(e, n);
|
|
50
|
+
$[0] = onPageChange;
|
|
51
|
+
$[1] = t1;
|
|
52
|
+
} else t1 = $[1];
|
|
53
|
+
const pageChange = t1;
|
|
54
|
+
const t2 = !!showPages;
|
|
55
|
+
let t3;
|
|
56
|
+
if ($[2] !== currentPage || $[3] !== marginPageCount || $[4] !== pageCount || $[5] !== surroundingPageCount || $[6] !== t2) {
|
|
57
|
+
t3 = buildPaginationModel(pageCount, currentPage, t2, marginPageCount, surroundingPageCount);
|
|
58
|
+
$[2] = currentPage;
|
|
59
|
+
$[3] = marginPageCount;
|
|
60
|
+
$[4] = pageCount;
|
|
61
|
+
$[5] = surroundingPageCount;
|
|
62
|
+
$[6] = t2;
|
|
63
|
+
$[7] = t3;
|
|
64
|
+
} else t3 = $[7];
|
|
65
|
+
const model = t3;
|
|
66
|
+
let t4;
|
|
67
|
+
if ($[8] !== hrefBuilder || $[9] !== model || $[10] !== pageChange || $[11] !== renderPage) {
|
|
68
|
+
let t5;
|
|
69
|
+
if ($[13] !== hrefBuilder || $[14] !== pageChange || $[15] !== renderPage) {
|
|
70
|
+
t5 = (page) => {
|
|
71
|
+
const { props, key, content } = buildComponentData(page, hrefBuilder, pageChange(page.num));
|
|
72
|
+
if (renderPage && props.as !== "span") return renderPage({
|
|
73
|
+
key,
|
|
74
|
+
children: /*#__PURE__*/ jsx(PageLabel, {
|
|
75
|
+
direction: key,
|
|
76
|
+
children: content
|
|
77
|
+
}),
|
|
78
|
+
number: page.num,
|
|
79
|
+
className: Pagination_module_css_default.Page,
|
|
80
|
+
"data-component": "Pagination.Page",
|
|
81
|
+
...props
|
|
82
|
+
});
|
|
83
|
+
const Component = props.as || "a";
|
|
84
|
+
const dataComponentAttribute = props.rel === "prev" ? "Pagination.PreviousPage" : props.rel === "next" ? "Pagination.NextPage" : "Pagination.Page";
|
|
85
|
+
return /*#__PURE__*/ jsx(Component, {
|
|
86
|
+
className: clsx(Pagination_module_css_default.Page),
|
|
87
|
+
"data-component": dataComponentAttribute,
|
|
88
|
+
...props,
|
|
89
|
+
children: /*#__PURE__*/ jsx(PageLabel, {
|
|
90
|
+
direction: key,
|
|
91
|
+
children: content
|
|
92
|
+
})
|
|
93
|
+
}, key);
|
|
94
|
+
};
|
|
95
|
+
$[13] = hrefBuilder;
|
|
96
|
+
$[14] = pageChange;
|
|
97
|
+
$[15] = renderPage;
|
|
98
|
+
$[16] = t5;
|
|
99
|
+
} else t5 = $[16];
|
|
100
|
+
t4 = model.map(t5);
|
|
101
|
+
$[8] = hrefBuilder;
|
|
102
|
+
$[9] = model;
|
|
103
|
+
$[10] = pageChange;
|
|
104
|
+
$[11] = renderPage;
|
|
105
|
+
$[12] = t4;
|
|
106
|
+
} else t4 = $[12];
|
|
107
|
+
return t4;
|
|
62
108
|
}
|
|
63
|
-
function Pagination(
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
109
|
+
function Pagination(t0) {
|
|
110
|
+
const $ = c(31);
|
|
111
|
+
let className;
|
|
112
|
+
let currentPage;
|
|
113
|
+
let pageCount;
|
|
114
|
+
let renderPage;
|
|
115
|
+
let rest;
|
|
116
|
+
let t1;
|
|
117
|
+
let t2;
|
|
118
|
+
let t3;
|
|
119
|
+
let t4;
|
|
120
|
+
let t5;
|
|
121
|
+
if ($[0] !== t0) {
|
|
122
|
+
({className, pageCount, currentPage, onPageChange: t1, hrefBuilder: t2, marginPageCount: t3, showPages: t4, surroundingPageCount: t5, renderPage, ...rest} = t0);
|
|
123
|
+
$[0] = t0;
|
|
124
|
+
$[1] = className;
|
|
125
|
+
$[2] = currentPage;
|
|
126
|
+
$[3] = pageCount;
|
|
127
|
+
$[4] = renderPage;
|
|
128
|
+
$[5] = rest;
|
|
129
|
+
$[6] = t1;
|
|
130
|
+
$[7] = t2;
|
|
131
|
+
$[8] = t3;
|
|
132
|
+
$[9] = t4;
|
|
133
|
+
$[10] = t5;
|
|
134
|
+
} else {
|
|
135
|
+
className = $[1];
|
|
136
|
+
currentPage = $[2];
|
|
137
|
+
pageCount = $[3];
|
|
138
|
+
renderPage = $[4];
|
|
139
|
+
rest = $[5];
|
|
140
|
+
t1 = $[6];
|
|
141
|
+
t2 = $[7];
|
|
142
|
+
t3 = $[8];
|
|
143
|
+
t4 = $[9];
|
|
144
|
+
t5 = $[10];
|
|
145
|
+
}
|
|
146
|
+
const onPageChange = t1 === void 0 ? noop : t1;
|
|
147
|
+
const hrefBuilder = t2 === void 0 ? defaultHrefBuilder : t2;
|
|
148
|
+
const marginPageCount = t3 === void 0 ? 1 : t3;
|
|
149
|
+
const showPages = t4 === void 0 ? true : t4;
|
|
150
|
+
const surroundingPageCount = t5 === void 0 ? 2 : t5;
|
|
151
|
+
let t6;
|
|
152
|
+
if ($[11] !== currentPage || $[12] !== hrefBuilder || $[13] !== marginPageCount || $[14] !== onPageChange || $[15] !== pageCount || $[16] !== renderPage || $[17] !== showPages || $[18] !== surroundingPageCount) {
|
|
153
|
+
t6 = {
|
|
154
|
+
pageCount,
|
|
155
|
+
currentPage,
|
|
156
|
+
onPageChange,
|
|
157
|
+
hrefBuilder,
|
|
158
|
+
marginPageCount,
|
|
159
|
+
showPages,
|
|
160
|
+
surroundingPageCount,
|
|
161
|
+
renderPage
|
|
162
|
+
};
|
|
163
|
+
$[11] = currentPage;
|
|
164
|
+
$[12] = hrefBuilder;
|
|
165
|
+
$[13] = marginPageCount;
|
|
166
|
+
$[14] = onPageChange;
|
|
167
|
+
$[15] = pageCount;
|
|
168
|
+
$[16] = renderPage;
|
|
169
|
+
$[17] = showPages;
|
|
170
|
+
$[18] = surroundingPageCount;
|
|
171
|
+
$[19] = t6;
|
|
172
|
+
} else t6 = $[19];
|
|
173
|
+
const pageElements = usePaginationPages(t6);
|
|
174
|
+
let t7;
|
|
175
|
+
if ($[20] !== className) {
|
|
176
|
+
t7 = clsx(Pagination_module_css_default.PaginationContainer, className);
|
|
177
|
+
$[20] = className;
|
|
178
|
+
$[21] = t7;
|
|
179
|
+
} else t7 = $[21];
|
|
180
|
+
let t8;
|
|
181
|
+
if ($[22] !== showPages) {
|
|
182
|
+
t8 = getViewportRangesToHidePages(showPages).join(" ");
|
|
183
|
+
$[22] = showPages;
|
|
184
|
+
$[23] = t8;
|
|
185
|
+
} else t8 = $[23];
|
|
186
|
+
let t9;
|
|
187
|
+
if ($[24] !== pageElements || $[25] !== t8) {
|
|
188
|
+
t9 = /*#__PURE__*/ jsx("div", {
|
|
80
189
|
className: Pagination_module_css_default.TablePaginationSteps,
|
|
81
|
-
"data-hidden-viewport-ranges":
|
|
190
|
+
"data-hidden-viewport-ranges": t8,
|
|
82
191
|
children: pageElements
|
|
83
|
-
})
|
|
84
|
-
|
|
192
|
+
});
|
|
193
|
+
$[24] = pageElements;
|
|
194
|
+
$[25] = t8;
|
|
195
|
+
$[26] = t9;
|
|
196
|
+
} else t9 = $[26];
|
|
197
|
+
let t10;
|
|
198
|
+
if ($[27] !== rest || $[28] !== t7 || $[29] !== t9) {
|
|
199
|
+
t10 = /*#__PURE__*/ jsx("nav", {
|
|
200
|
+
className: t7,
|
|
201
|
+
"aria-label": "Pagination",
|
|
202
|
+
"data-component": "Pagination",
|
|
203
|
+
...rest,
|
|
204
|
+
children: t9
|
|
205
|
+
});
|
|
206
|
+
$[27] = rest;
|
|
207
|
+
$[28] = t7;
|
|
208
|
+
$[29] = t9;
|
|
209
|
+
$[30] = t10;
|
|
210
|
+
} else t10 = $[30];
|
|
211
|
+
return t10;
|
|
85
212
|
}
|
|
86
|
-
Pagination.displayName = "Pagination";
|
|
87
213
|
function defaultHrefBuilder(pageNum) {
|
|
88
214
|
return `#${pageNum}`;
|
|
89
215
|
}
|
|
@@ -1,40 +1,83 @@
|
|
|
1
1
|
import Text_default from "../Text/Text.js";
|
|
2
2
|
import Octicon from "../Octicon/Octicon.js";
|
|
3
3
|
import SelectPanel_module_css_default from "./SelectPanel.module.css.js";
|
|
4
|
+
import { c } from "react-compiler-runtime";
|
|
4
5
|
import { clsx } from "clsx";
|
|
5
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
7
|
import { AlertIcon } from "@primer/octicons-react";
|
|
7
8
|
//#region src/SelectPanel/SelectPanelMessage.tsx
|
|
8
|
-
const SelectPanelMessage = (
|
|
9
|
+
const SelectPanelMessage = (t0) => {
|
|
10
|
+
const $ = c(17);
|
|
11
|
+
const { variant, title, children, className, icon: CustomIcon, action } = t0;
|
|
9
12
|
const IconComponent = CustomIcon || (variant !== "empty" ? AlertIcon : void 0);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
]
|
|
36
|
-
|
|
13
|
+
let t1;
|
|
14
|
+
if ($[0] !== className) {
|
|
15
|
+
t1 = clsx(SelectPanel_module_css_default.Message, className);
|
|
16
|
+
$[0] = className;
|
|
17
|
+
$[1] = t1;
|
|
18
|
+
} else t1 = $[1];
|
|
19
|
+
let t2;
|
|
20
|
+
if ($[2] !== IconComponent || $[3] !== variant) {
|
|
21
|
+
t2 = IconComponent && /*#__PURE__*/ jsx(Octicon, {
|
|
22
|
+
icon: IconComponent,
|
|
23
|
+
className: SelectPanel_module_css_default.MessageIcon,
|
|
24
|
+
"data-variant": variant,
|
|
25
|
+
"data-component": "SelectPanel.MessageIcon"
|
|
26
|
+
});
|
|
27
|
+
$[2] = IconComponent;
|
|
28
|
+
$[3] = variant;
|
|
29
|
+
$[4] = t2;
|
|
30
|
+
} else t2 = $[4];
|
|
31
|
+
let t3;
|
|
32
|
+
if ($[5] !== title) {
|
|
33
|
+
t3 = /*#__PURE__*/ jsx(Text_default, {
|
|
34
|
+
className: SelectPanel_module_css_default.MessageTitle,
|
|
35
|
+
"data-component": "SelectPanel.MessageTitle",
|
|
36
|
+
children: title
|
|
37
|
+
});
|
|
38
|
+
$[5] = title;
|
|
39
|
+
$[6] = t3;
|
|
40
|
+
} else t3 = $[6];
|
|
41
|
+
let t4;
|
|
42
|
+
if ($[7] !== children) {
|
|
43
|
+
t4 = /*#__PURE__*/ jsx(Text_default, {
|
|
44
|
+
className: SelectPanel_module_css_default.MessageBody,
|
|
45
|
+
"data-component": "SelectPanel.MessageBody",
|
|
46
|
+
children
|
|
47
|
+
});
|
|
48
|
+
$[7] = children;
|
|
49
|
+
$[8] = t4;
|
|
50
|
+
} else t4 = $[8];
|
|
51
|
+
let t5;
|
|
52
|
+
if ($[9] !== action) {
|
|
53
|
+
t5 = action && /*#__PURE__*/ jsx("div", {
|
|
54
|
+
className: SelectPanel_module_css_default.MessageAction,
|
|
55
|
+
"data-component": "SelectPanel.MessageAction",
|
|
56
|
+
children: action
|
|
57
|
+
});
|
|
58
|
+
$[9] = action;
|
|
59
|
+
$[10] = t5;
|
|
60
|
+
} else t5 = $[10];
|
|
61
|
+
let t6;
|
|
62
|
+
if ($[11] !== t1 || $[12] !== t2 || $[13] !== t3 || $[14] !== t4 || $[15] !== t5) {
|
|
63
|
+
t6 = /*#__PURE__*/ jsxs("div", {
|
|
64
|
+
className: t1,
|
|
65
|
+
"data-component": "SelectPanel.Message",
|
|
66
|
+
children: [
|
|
67
|
+
t2,
|
|
68
|
+
t3,
|
|
69
|
+
t4,
|
|
70
|
+
t5
|
|
71
|
+
]
|
|
72
|
+
});
|
|
73
|
+
$[11] = t1;
|
|
74
|
+
$[12] = t2;
|
|
75
|
+
$[13] = t3;
|
|
76
|
+
$[14] = t4;
|
|
77
|
+
$[15] = t5;
|
|
78
|
+
$[16] = t6;
|
|
79
|
+
} else t6 = $[16];
|
|
80
|
+
return t6;
|
|
37
81
|
};
|
|
38
|
-
SelectPanelMessage.displayName = "SelectPanelMessage";
|
|
39
82
|
//#endregion
|
|
40
83
|
export { SelectPanelMessage };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
2
2
|
import { AriaStatus } from "../live-region/AriaStatus.js";
|
|
3
3
|
import Text_default from "../Text/Text.js";
|
|
4
4
|
import _VisuallyHidden_module_css_default from "../_VisuallyHidden.module.css.js";
|
|
@@ -11,15 +11,14 @@ import UnstyledTextInput from "../internal/components/UnstyledTextInput.js";
|
|
|
11
11
|
import { getCharacterCountState } from "../utils/character-counter.js";
|
|
12
12
|
import { clsx } from "clsx";
|
|
13
13
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
-
import React, { useCallback, useId,
|
|
14
|
+
import React, { useCallback, useId, useState } from "react";
|
|
15
15
|
import { isValidElementType } from "react-is";
|
|
16
16
|
import { AlertFillIcon } from "@primer/octicons-react";
|
|
17
17
|
//#region src/TextInput/TextInput.tsx
|
|
18
18
|
const TextInput = /*#__PURE__*/ React.forwardRef(({ icon: IconComponent, leadingVisual: LeadingVisual, trailingVisual: TrailingVisual, trailingAction, block, className, contrast, disabled, loading, loaderPosition = "auto", loaderText = "Loading", monospace, validationStatus, size: sizeProp, onFocus, onBlur, variant: variantProp, width: widthProp, minWidth: minWidthProp, maxWidth: maxWidthProp, type = "text", required, characterLimit, onChange, value, defaultValue, "data-component": dataComponent, ...inputProps }, ref) => {
|
|
19
19
|
var _counter$isOverLimit;
|
|
20
20
|
const [isInputFocused, setIsInputFocused] = useState(false);
|
|
21
|
-
const inputRef =
|
|
22
|
-
const mergedRef = useMergedRefs(inputRef, ref);
|
|
21
|
+
const inputRef = useProvidedRefOrCreate(ref);
|
|
23
22
|
const isControlled = value !== void 0;
|
|
24
23
|
const [uncontrolledLength, setUncontrolledLength] = useState(() => defaultValue !== void 0 ? String(defaultValue).length : 0);
|
|
25
24
|
const currentLength = isControlled ? String(value).length : uncontrolledLength;
|
|
@@ -89,7 +88,7 @@ const TextInput = /*#__PURE__*/ React.forwardRef(({ icon: IconComponent, leading
|
|
|
89
88
|
children: typeof LeadingVisual !== "string" && isValidElementType(LeadingVisual) ? /*#__PURE__*/ jsx(LeadingVisual, {}) : LeadingVisual
|
|
90
89
|
}),
|
|
91
90
|
/*#__PURE__*/ jsx(UnstyledTextInput, {
|
|
92
|
-
ref:
|
|
91
|
+
ref: inputRef,
|
|
93
92
|
disabled,
|
|
94
93
|
onFocus: handleInputFocus,
|
|
95
94
|
onBlur: handleInputBlur,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
1
2
|
import { useOnEscapePress } from "../hooks/useOnEscapePress.js";
|
|
2
3
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
3
4
|
import { warning } from "../utils/warning.js";
|
|
@@ -79,18 +80,8 @@ const emptyKeybindingHints = [];
|
|
|
79
80
|
const Tooltip = /*#__PURE__*/ React.forwardRef(({ direction = "s", text, type = "description", children, id, className, keybindingHint = emptyKeybindingHints, delay = "short", _privateDisableTooltip = false, ...rest }, forwardedRef) => {
|
|
80
81
|
const tooltipId = useId$1(id);
|
|
81
82
|
const child = Children.only(children);
|
|
82
|
-
const
|
|
83
|
-
const
|
|
84
|
-
const tooltipElRef = React.useRef(null);
|
|
85
|
-
const assignRef = (ref, node) => {
|
|
86
|
-
if (typeof ref === "function") ref(node);
|
|
87
|
-
else if (ref) ref.current = node;
|
|
88
|
-
};
|
|
89
|
-
const setTriggerRef = (node) => {
|
|
90
|
-
assignRef(triggerRef, node);
|
|
91
|
-
assignRef(childRef, node);
|
|
92
|
-
assignRef(forwardedRef, node);
|
|
93
|
-
};
|
|
83
|
+
const triggerRef = useProvidedRefOrCreate(forwardedRef);
|
|
84
|
+
const tooltipElRef = useRef(null);
|
|
94
85
|
const [calculatedDirection, setCalculatedDirection] = useState(direction);
|
|
95
86
|
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
|
|
96
87
|
const openTimeoutRef = React.useRef(null);
|
|
@@ -166,7 +157,7 @@ const Tooltip = /*#__PURE__*/ React.forwardRef(({ direction = "s", text, type =
|
|
|
166
157
|
return /*#__PURE__*/ jsx(TooltipContext.Provider, {
|
|
167
158
|
value,
|
|
168
159
|
children: /*#__PURE__*/ jsxs(Fragment, { children: [/*#__PURE__*/ React.isValidElement(child) && /*#__PURE__*/ React.cloneElement(child, {
|
|
169
|
-
ref:
|
|
160
|
+
ref: triggerRef,
|
|
170
161
|
"aria-describedby": (() => {
|
|
171
162
|
if (type !== "description") return child.props["aria-describedby"];
|
|
172
163
|
const existingDescribedBy = child.props["aria-describedby"];
|
|
@@ -188,8 +179,7 @@ const Tooltip = /*#__PURE__*/ React.forwardRef(({ direction = "s", text, type =
|
|
|
188
179
|
var _child$props$onFocus, _child$props3;
|
|
189
180
|
try {
|
|
190
181
|
if (!event.target.matches(":focus-visible")) return;
|
|
191
|
-
} catch {}
|
|
192
|
-
if (event.currentTarget.hasAttribute("data-restoring-focus")) return;
|
|
182
|
+
} catch (_error) {}
|
|
193
183
|
openTooltip();
|
|
194
184
|
(_child$props$onFocus = (_child$props3 = child.props).onFocus) === null || _child$props$onFocus === void 0 || _child$props$onFocus.call(_child$props3, event);
|
|
195
185
|
},
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
.prc-UnderlineNav-UnderlineWrapper-GWONT{animation:prc-UnderlineNav-detect-overflow-6HuSH linear;animation-timeline:scroll(self block);--UnderlineNav_moreButton-visibility:hidden}.prc-UnderlineNav-UnderlineWrapper-GWONT[data-has-overflow=true]{--UnderlineNav_moreButton-visibility:visible}@keyframes prc-UnderlineNav-detect-overflow-6HuSH{0%,to{--UnderlineNav_moreButton-visibility:visible;--UnderlineNav_hide-icons-play-state:running}}.prc-UnderlineNav-ItemsList-oj8gN [data-component=icon]{animation-duration:1ms;animation-fill-mode:forwards;animation-iteration-count:1;animation-name:prc-UnderlineNav-hide-icons-FR8HX;animation-play-state:var(--UnderlineNav_hide-icons-play-state,paused)}@keyframes prc-UnderlineNav-hide-icons-FR8HX{0%{display:inline}to{display:none}}.prc-UnderlineNav-MoreButtonContainer-Dnrq6{align-items:center;display:flex;visibility:var(--UnderlineNav_moreButton-visibility)}.prc-UnderlineNav-OverflowMenuItem-7SG7M [aria-current]{position:relative}.prc-UnderlineNav-OverflowMenuItem-7SG7M [aria-current] .prc-UnderlineNav-OverflowMenuItemLabel-F80v6{font-weight:var(--base-text-weight-semibold,600)}.prc-UnderlineNav-OverflowMenuItem-7SG7M [aria-current]:after{background:var(--underlineNav-borderColor-active,#fd8c73);content:"";inset:var(--base-size-2,.125rem) auto var(--base-size-2,.125rem) 0;position:absolute;width:var(--base-size-2,.125rem)}.prc-UnderlineNav-MoreButtonDivider-dN0a-{border-left:var(--borderWidth-thin,.0625rem) solid var(--borderColor-muted,#d1d9e0b3);display:inline-block;height:var(--base-size-24,1.5rem);margin-inline:var(--base-size-4,.25rem);width:0}.prc-UnderlineNav-MoreButton-Y8soj{font-weight:var(--base-text-weight-normal,400);margin:0;position:relative}.prc-UnderlineNav-MoreButton-Y8soj>[data-component=trailingVisual]{margin-left:0}.prc-UnderlineNav-MoreButton-Y8soj[data-current=true]{font-weight:var(--base-text-weight-semibold,600)}.prc-UnderlineNav-MoreButton-Y8soj[data-current=true]:after{background-color:var(--underlineNav-borderColor-active,var(--color-primer-border-active,#fd8c73));content:"";height:2px;inset:auto 0 0;margin-bottom:calc((var(--base-size-8,.5rem) + var(--borderWidth-thin,.0625rem))*-1);pointer-events:none;position:absolute}@media (forced-colors:active){.prc-UnderlineNav-MoreButton-Y8soj[data-current=true]:after{background-color:LinkText}}
|
|
2
|
+
/*# sourceMappingURL=UnderlineNav-964b246d.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/UnderlineNav/UnderlineNav.module.css.js"],"names":[],"mappings":"AAAA,yCAIE,uDAAiC,CACjC,qCAAsC,CAEtC,2CAKF,CAHE,iEACE,4CACF,CAGF,kDACE,MAEE,4CAA6C,CAC7C,4CACF,CACF,CAEA,wDAWE,sBAAuB,CADvB,4BAA6B,CAD7B,2BAA4B,CAD5B,gDAA0B,CAD1B,qEAKF,CAEA,6CACE,GACE,cACF,CAEA,GACE,YACF,CACF,CAEA,4CAGE,kBAAmB,CAFnB,YAAa,CACb,oDAEF,CAEA,wDACE,iBAcF,CAZE,sGACE,gDACF,CAEA,8DAME,yDAAkD,CALlD,UAAW,CAGX,kEAAmD,CADnD,iBAAkB,CADlB,gCAKF,CAGF,0CAEE,qFAAmE,CADnE,oBAAqB,CAIrB,iCAA2B,CAD3B,uCAAiC,CADjC,OAGF,CAEA,mCAEE,8CAA2C,CAD3C,QAAS,CAET,iBA6BF,CA3BE,mEACE,aACF,CAIA,sDACE,gDAmBF,CAjBE,4DAUE,iGAAoG,CAFpG,UAAW,CAFX,UAAW,CAJX,cAAe,CAGf,oFAAwE,CAExE,mBAAoB,CANpB,iBAeF,CAJE,8BAZF,4DAcI,yBAEJ,CADE","file":"UnderlineNav-964b246d.css","sourcesContent":[".UnderlineWrapper {\n /* Progressive enhancement: Detect overflow using scroll-based animations.\n The idiomatic way would be a scroll-state container query but browser support\n is slightly better for animations. */\n animation: detect-overflow linear;\n animation-timeline: scroll(self block);\n\n --UnderlineNav_moreButton-visibility: hidden;\n\n &[data-has-overflow='true'] {\n --UnderlineNav_moreButton-visibility: visible;\n }\n}\n\n@keyframes detect-overflow {\n 0%,\n 100% {\n --UnderlineNav_moreButton-visibility: visible;\n --UnderlineNav_hide-icons-play-state: running;\n }\n}\n\n.ItemsList [data-component='icon'] {\n /* Unlike the more button, which reserves space when hidden, the icons are removed from the layout when hidden. This\n can cause the container to no longer overflow, which would cause a flickering loop if we just drove the visibility\n directly from the scroll state. So instead, we drive an animation that can only play forwards - this way, the icons\n will remain hidden forever after being hidden for the first tiem, even if the container is no longer overflowing.\n You might think we could just do this directly with the scroll-driven animation instead of driving a second animation,\n but this approach doesn't work for scroll-driven animations because they are conditionally applied. */\n animation-play-state: var(--UnderlineNav_hide-icons-play-state, paused);\n animation-name: hide-icons;\n animation-iteration-count: 1;\n animation-fill-mode: forwards;\n animation-duration: 1ms; /* must be non-zero or the animation will finish immediately even if paused */\n}\n\n@keyframes hide-icons {\n 0% {\n display: inline;\n }\n\n 100% {\n display: none;\n }\n}\n\n.MoreButtonContainer {\n display: flex;\n visibility: var(--UnderlineNav_moreButton-visibility);\n align-items: center;\n}\n\n.OverflowMenuItem [aria-current] {\n position: relative;\n\n .OverflowMenuItemLabel {\n font-weight: var(--base-text-weight-semibold);\n }\n\n &::after {\n content: '';\n width: var(--base-size-2);\n position: absolute;\n inset: var(--base-size-2) auto var(--base-size-2) 0;\n /* stylelint-disable-next-line primer/colors */\n background: var(--underlineNav-borderColor-active);\n }\n}\n\n.MoreButtonDivider {\n display: inline-block;\n border-left: var(--borderWidth-thin) solid var(--borderColor-muted);\n width: 0;\n margin-inline: var(--base-size-4);\n height: var(--base-size-24);\n}\n\n.MoreButton {\n margin: 0; /* reset Safari extra margin */\n font-weight: var(--base-text-weight-normal);\n position: relative;\n\n & > [data-component='trailingVisual'] {\n margin-left: 0;\n }\n\n /* When the current item has overflowed into the menu, style the overflow\n anchor so it looks like the current item (semibold text + active underline). */\n &[data-current='true'] {\n font-weight: var(--base-text-weight-semibold);\n\n &::after {\n position: absolute;\n inset: auto 0 0;\n /* Pull down same amount as the item-level decoration, plus the border width of the button */\n /* stylelint-disable-next-line primer/spacing */\n margin-bottom: calc(-1 * (var(--base-size-8) + var(--borderWidth-thin)));\n height: 2px;\n pointer-events: none;\n content: '';\n /* stylelint-disable-next-line primer/colors */\n background-color: var(--underlineNav-borderColor-active, var(--color-primer-border-active, #fd8c73));\n\n @media (forced-colors: active) {\n /* Support for Windows Forced Color Mode https://learn.microsoft.com/en-us/fluent-ui/web-components/design-system/high-contrast */\n background-color: LinkText;\n }\n }\n }\n}\n"]}
|