@primer/react 38.42.0-rc.ebd425836 → 38.42.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 +10 -0
- package/dist/ActionBar/ActionBar.js +498 -162
- package/dist/ActionBar/index.d.ts +2 -2
- package/dist/ActionList/Group.js +4 -5
- package/dist/ActionList/Item.js +2 -2
- package/dist/Banner/Banner.js +3 -5
- package/dist/Button/ButtonBase.js +3 -2
- package/dist/Button/IconButton.js +3 -4
- package/dist/Button/types.d.ts +2 -2
- package/dist/Card/Card.js +1 -2
- package/dist/Checkbox/Checkbox.js +145 -41
- package/dist/CounterLabel/CounterLabel.js +80 -18
- package/dist/Details/Details.js +2 -4
- package/dist/FeatureFlags/FeatureFlagScope.js +1 -0
- package/dist/FilteredActionList/constants.js +2 -0
- package/dist/FilteredActionList/useAnnouncements.js +148 -81
- package/dist/FormControl/FormControlLabel.js +1 -2
- package/dist/InlineMessage/InlineMessage.js +1 -2
- package/dist/NavList/NavList.js +3 -4
- package/dist/Overlay/Overlay.js +299 -64
- package/dist/PageLayout/usePaneWidth.js +2 -2
- package/dist/Popover/Popover.js +3 -5
- package/dist/ProgressBar/ProgressBar.js +1 -2
- package/dist/SegmentedControl/SegmentedControlButton.js +1 -2
- package/dist/Select/Select.js +2 -2
- package/dist/SelectPanel/SelectPanel.d.ts +1 -1
- package/dist/SelectPanel/SelectPanel.js +1 -1
- package/dist/Spinner/Spinner.js +1 -2
- package/dist/TextInput/TextInput.js +242 -87
- package/dist/Textarea/Textarea.d.ts +2 -2
- package/dist/ToggleSwitch/ToggleSwitch.js +2 -3
- package/dist/Tooltip/Tooltip.js +98 -17
- package/dist/TooltipV2/Tooltip.js +295 -138
- package/dist/TopicTag/TopicTag.js +1 -2
- package/dist/Truncate/Truncate.js +87 -14
- package/dist/UnderlineNav/UnderlineNavItem.js +2 -4
- package/dist/deprecated/ActionList/List.js +1 -1
- package/dist/experimental/SelectPanel2/SelectPanel.d.ts +1 -1
- package/dist/internal/components/InputLabel.js +1 -2
- package/dist/internal/components/TextInputInnerAction.js +1 -2
- package/dist/internal/components/TextInputWrapper.d.ts +3 -0
- package/dist/internal/hooks/useThemeProvider.js +3 -3
- package/generated/components.json +22 -20
- package/package.json +12 -13
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c } from "../utils/react-compiler-runtime.js";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
2
3
|
import { announce } from "@primer/live-region-element";
|
|
3
4
|
//#region src/FilteredActionList/useAnnouncements.tsx
|
|
4
5
|
const delayMs = 500;
|
|
@@ -43,91 +44,157 @@ const getAnnouncementState = (items, loading, message, filterValue) => JSON.stri
|
|
|
43
44
|
message,
|
|
44
45
|
filterValue
|
|
45
46
|
});
|
|
46
|
-
const useAnnouncements = (items, listContainerRef, inputRef,
|
|
47
|
+
const useAnnouncements = (items, listContainerRef, inputRef, t0, t1, message, focusManagement, filterValue) => {
|
|
48
|
+
const $ = c(37);
|
|
49
|
+
const enabled = t0 === void 0 ? true : t0;
|
|
50
|
+
const loading = t1 === void 0 ? false : t1;
|
|
47
51
|
const usingRovingTabindex = focusManagement === "roving-tabindex";
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
52
|
+
let t2;
|
|
53
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
54
|
+
t2 = document.querySelector("live-region");
|
|
55
|
+
$[0] = t2;
|
|
56
|
+
} else t2 = $[0];
|
|
57
|
+
const liveRegion = t2;
|
|
58
|
+
let t3;
|
|
59
|
+
if ($[1] !== items) {
|
|
60
|
+
t3 = items.filter(_temp);
|
|
61
|
+
$[1] = items;
|
|
62
|
+
$[2] = t3;
|
|
63
|
+
} else t3 = $[2];
|
|
64
|
+
const selectedItems = t3.length;
|
|
65
|
+
let t4;
|
|
66
|
+
if ($[3] !== enabled) {
|
|
67
|
+
t4 = (...t5) => {
|
|
68
|
+
const args = t5;
|
|
69
|
+
if (enabled) return announce(...args);
|
|
70
|
+
};
|
|
71
|
+
$[3] = enabled;
|
|
72
|
+
$[4] = t4;
|
|
73
|
+
} else t4 = $[4];
|
|
74
|
+
const announce$1 = t4;
|
|
75
|
+
let t5;
|
|
76
|
+
if ($[5] !== announce$1 || $[6] !== inputRef || $[7] !== items || $[8] !== listContainerRef || $[9] !== selectedItems || $[10] !== usingRovingTabindex) {
|
|
77
|
+
t5 = () => {
|
|
78
|
+
if (usingRovingTabindex) {
|
|
79
|
+
const announcementText = `${items.length} item${items.length > 1 ? "s" : ""} available, ${selectedItems} selected.`;
|
|
80
|
+
announce$1(announcementText, {
|
|
81
|
+
delayMs,
|
|
82
|
+
from: liveRegion ? liveRegion : void 0
|
|
83
|
+
});
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
window.setTimeout(() => {
|
|
87
|
+
const activeItem = getItemWithActiveDescendant(listContainerRef, items);
|
|
88
|
+
if (!activeItem) return;
|
|
89
|
+
const { index, text, selected } = activeItem;
|
|
90
|
+
const inputLabel = getInputLabel(inputRef.current);
|
|
91
|
+
const announcementText_0 = [
|
|
92
|
+
inputLabel ? `${inputLabel}, filter text box and list of items` : "Focus on filter text box and list of items",
|
|
93
|
+
`Focused item: ${text}`,
|
|
94
|
+
`${selected ? "selected" : "not selected"}`,
|
|
95
|
+
`${index + 1} of ${items.length}`
|
|
96
|
+
].join(", ");
|
|
97
|
+
announce$1(announcementText_0, {
|
|
98
|
+
delayMs,
|
|
99
|
+
from: liveRegion ? liveRegion : void 0
|
|
100
|
+
});
|
|
59
101
|
});
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
inputRef,
|
|
81
|
-
items,
|
|
82
|
-
listContainerRef,
|
|
83
|
-
liveRegion,
|
|
84
|
-
selectedItems,
|
|
85
|
-
usingRovingTabindex
|
|
86
|
-
]);
|
|
87
|
-
const announcementState = getAnnouncementState(items, loading, message, filterValue);
|
|
102
|
+
};
|
|
103
|
+
$[5] = announce$1;
|
|
104
|
+
$[6] = inputRef;
|
|
105
|
+
$[7] = items;
|
|
106
|
+
$[8] = listContainerRef;
|
|
107
|
+
$[9] = selectedItems;
|
|
108
|
+
$[10] = usingRovingTabindex;
|
|
109
|
+
$[11] = t5;
|
|
110
|
+
} else t5 = $[11];
|
|
111
|
+
const onInputFocus = t5;
|
|
112
|
+
let t6;
|
|
113
|
+
if ($[12] !== filterValue || $[13] !== items || $[14] !== loading || $[15] !== message) {
|
|
114
|
+
t6 = getAnnouncementState(items, loading, message, filterValue);
|
|
115
|
+
$[12] = filterValue;
|
|
116
|
+
$[13] = items;
|
|
117
|
+
$[14] = loading;
|
|
118
|
+
$[15] = message;
|
|
119
|
+
$[16] = t6;
|
|
120
|
+
} else t6 = $[16];
|
|
121
|
+
const announcementState = t6;
|
|
88
122
|
const previousAnnouncementState = useRef(announcementState);
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
123
|
+
let t7;
|
|
124
|
+
if ($[17] !== announce$1 || $[18] !== announcementState || $[19] !== items || $[20] !== listContainerRef || $[21] !== loading || $[22] !== (message === null || message === void 0 ? void 0 : message.description) || $[23] !== (message === null || message === void 0 ? void 0 : message.title) || $[24] !== selectedItems || $[25] !== usingRovingTabindex) {
|
|
125
|
+
t7 = function announceListUpdates() {
|
|
126
|
+
if (previousAnnouncementState.current === announcementState) return;
|
|
127
|
+
previousAnnouncementState.current = announcementState;
|
|
128
|
+
liveRegion === null || liveRegion === void 0 || liveRegion.clear();
|
|
129
|
+
if (items.length === 0 && !loading) {
|
|
130
|
+
announce$1(`${message === null || message === void 0 ? void 0 : message.title}. ${message === null || message === void 0 ? void 0 : message.description}`, { delayMs });
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
if (usingRovingTabindex) {
|
|
134
|
+
const announcementText_1 = `${items.length} item${items.length > 1 ? "s" : ""} available, ${selectedItems} selected.`;
|
|
135
|
+
announce$1(announcementText_1, {
|
|
136
|
+
delayMs,
|
|
137
|
+
from: liveRegion ? liveRegion : void 0
|
|
138
|
+
});
|
|
139
|
+
} else window.requestAnimationFrame(() => {
|
|
140
|
+
const activeItem_0 = getItemWithActiveDescendant(listContainerRef, items);
|
|
141
|
+
if (!activeItem_0) return;
|
|
142
|
+
const { index: index_0, text: text_0, selected: selected_0 } = activeItem_0;
|
|
143
|
+
const announcementText_2 = [
|
|
144
|
+
"List updated",
|
|
145
|
+
`Focused item: ${text_0}`,
|
|
146
|
+
`${selected_0 ? "selected" : "not selected"}`,
|
|
147
|
+
`${index_0 + 1} of ${items.length}`
|
|
148
|
+
].join(", ");
|
|
149
|
+
announce$1(announcementText_2, {
|
|
150
|
+
delayMs,
|
|
151
|
+
from: liveRegion ? liveRegion : void 0
|
|
152
|
+
});
|
|
116
153
|
});
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
154
|
+
};
|
|
155
|
+
$[17] = announce$1;
|
|
156
|
+
$[18] = announcementState;
|
|
157
|
+
$[19] = items;
|
|
158
|
+
$[20] = listContainerRef;
|
|
159
|
+
$[21] = loading;
|
|
160
|
+
$[22] = message === null || message === void 0 ? void 0 : message.description;
|
|
161
|
+
$[23] = message === null || message === void 0 ? void 0 : message.title;
|
|
162
|
+
$[24] = selectedItems;
|
|
163
|
+
$[25] = usingRovingTabindex;
|
|
164
|
+
$[26] = t7;
|
|
165
|
+
} else t7 = $[26];
|
|
166
|
+
const t8 = message === null || message === void 0 ? void 0 : message.title;
|
|
167
|
+
const t9 = message === null || message === void 0 ? void 0 : message.description;
|
|
168
|
+
let t10;
|
|
169
|
+
if ($[27] !== announce$1 || $[28] !== announcementState || $[29] !== items || $[30] !== listContainerRef || $[31] !== loading || $[32] !== selectedItems || $[33] !== t8 || $[34] !== t9 || $[35] !== usingRovingTabindex) {
|
|
170
|
+
t10 = [
|
|
171
|
+
announce$1,
|
|
172
|
+
announcementState,
|
|
173
|
+
items,
|
|
174
|
+
listContainerRef,
|
|
175
|
+
liveRegion,
|
|
176
|
+
usingRovingTabindex,
|
|
177
|
+
t8,
|
|
178
|
+
t9,
|
|
179
|
+
loading,
|
|
180
|
+
selectedItems
|
|
181
|
+
];
|
|
182
|
+
$[27] = announce$1;
|
|
183
|
+
$[28] = announcementState;
|
|
184
|
+
$[29] = items;
|
|
185
|
+
$[30] = listContainerRef;
|
|
186
|
+
$[31] = loading;
|
|
187
|
+
$[32] = selectedItems;
|
|
188
|
+
$[33] = t8;
|
|
189
|
+
$[34] = t9;
|
|
190
|
+
$[35] = usingRovingTabindex;
|
|
191
|
+
$[36] = t10;
|
|
192
|
+
} else t10 = $[36];
|
|
193
|
+
useEffect(t7, t10);
|
|
130
194
|
return onInputFocus;
|
|
131
195
|
};
|
|
196
|
+
function _temp(item) {
|
|
197
|
+
return item.selected;
|
|
198
|
+
}
|
|
132
199
|
//#endregion
|
|
133
200
|
export { useAnnouncements };
|
|
@@ -4,7 +4,6 @@ import { InputLabel } from "../internal/components/InputLabel.js";
|
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
//#region src/FormControl/FormControlLabel.tsx
|
|
6
6
|
const FormControlLabel = (t0) => {
|
|
7
|
-
var _id;
|
|
8
7
|
const $ = c(26);
|
|
9
8
|
let as;
|
|
10
9
|
let children;
|
|
@@ -40,7 +39,7 @@ const FormControlLabel = (t0) => {
|
|
|
40
39
|
}
|
|
41
40
|
const requiredIndicator = t1 === void 0 ? true : t1;
|
|
42
41
|
const { disabled, id: formControlId, required, isReferenced, labelId } = useFormControlContext();
|
|
43
|
-
const resolvedId =
|
|
42
|
+
const resolvedId = id !== null && id !== void 0 ? id : labelId;
|
|
44
43
|
let t2;
|
|
45
44
|
if ($[10] !== as || $[11] !== className || $[12] !== disabled || $[13] !== formControlId || $[14] !== htmlFor || $[15] !== isReferenced || $[16] !== props || $[17] !== required || $[18] !== requiredIndicator || $[19] !== requiredText || $[20] !== resolvedId || $[21] !== visuallyHidden) {
|
|
46
45
|
t2 = as === "legend" || as === "span" ? {
|
|
@@ -30,7 +30,6 @@ const smallIcons = {
|
|
|
30
30
|
})
|
|
31
31
|
};
|
|
32
32
|
function InlineMessage(t0) {
|
|
33
|
-
var _variant;
|
|
34
33
|
const $ = c(19);
|
|
35
34
|
let LeadingVisual;
|
|
36
35
|
let children;
|
|
@@ -82,7 +81,7 @@ function InlineMessage(t0) {
|
|
|
82
81
|
$[10] = className;
|
|
83
82
|
$[11] = t2;
|
|
84
83
|
} else t2 = $[11];
|
|
85
|
-
const t3 =
|
|
84
|
+
const t3 = variant !== null && variant !== void 0 ? variant : void 0;
|
|
86
85
|
let t4;
|
|
87
86
|
if ($[12] !== children || $[13] !== icon || $[14] !== rest || $[15] !== size || $[16] !== t2 || $[17] !== t3) {
|
|
88
87
|
t4 = /* @__PURE__ */ jsxs("div", {
|
package/dist/NavList/NavList.js
CHANGED
|
@@ -25,7 +25,7 @@ function levelToHeadingTag(level) {
|
|
|
25
25
|
return `h${Math.min(Math.max(level, 1), 4)}`;
|
|
26
26
|
}
|
|
27
27
|
const Root = /*#__PURE__*/ React.forwardRef((t0, ref) => {
|
|
28
|
-
var _heading$props$id
|
|
28
|
+
var _heading$props$id;
|
|
29
29
|
const $ = c(26);
|
|
30
30
|
let ariaLabel;
|
|
31
31
|
let ariaLabelledby;
|
|
@@ -64,7 +64,7 @@ const Root = /*#__PURE__*/ React.forwardRef((t0, ref) => {
|
|
|
64
64
|
$[8] = t2;
|
|
65
65
|
} else t2 = $[8];
|
|
66
66
|
const headingLevel = t2;
|
|
67
|
-
const navLabelledby =
|
|
67
|
+
const navLabelledby = ariaLabelledby !== null && ariaLabelledby !== void 0 ? ariaLabelledby : ariaLabel ? void 0 : headingId;
|
|
68
68
|
let t3;
|
|
69
69
|
if ($[9] !== heading || $[10] !== headingId) {
|
|
70
70
|
t3 = heading ? /*#__PURE__*/ React.cloneElement(heading, { id: headingId }) : null;
|
|
@@ -601,8 +601,7 @@ const GroupHeadingImpl = (t0) => {
|
|
|
601
601
|
const headingLevel = React.useContext(NavListHeadingLevelContext);
|
|
602
602
|
let t1;
|
|
603
603
|
if ($[4] !== as || $[5] !== headingLevel) {
|
|
604
|
-
|
|
605
|
-
t1 = (_as = as) !== null && _as !== void 0 ? _as : headingLevel ? levelToHeadingTag(headingLevel + 1) : "h3";
|
|
604
|
+
t1 = as !== null && as !== void 0 ? as : headingLevel ? levelToHeadingTag(headingLevel + 1) : "h3";
|
|
606
605
|
$[4] = as;
|
|
607
606
|
$[5] = headingLevel;
|
|
608
607
|
$[6] = t1;
|