@primer/react 0.0.0-20260702173630 → 0.0.0-20260702230323
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 +12 -1
- package/dist/ActionList/List.js +46 -45
- package/dist/AnchoredOverlay/AnchoredOverlay.js +2 -4
- package/dist/Autocomplete/AutocompleteInput.js +7 -10
- package/dist/ButtonGroup/ButtonGroup.js +23 -23
- package/dist/Checkbox/Checkbox.js +4 -5
- 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.d.ts +6 -0
- package/dist/PageLayout/PageLayout.js +549 -535
- package/dist/SplitPageLayout/SplitPageLayout.js +11 -0
- package/dist/Stack/Stack.js +2 -0
- package/dist/StateLabel/StateLabel.js +1 -0
- package/dist/SubNav/SubNav.js +3 -0
- package/dist/TabNav/TabNav.js +2 -0
- package/dist/Text/Text.js +1 -0
- package/dist/TextInput/TextInput.js +4 -5
- package/dist/Textarea/Textarea.js +1 -0
- package/dist/ThemeProvider.js +1 -0
- package/dist/TooltipV2/Tooltip.js +3 -4
- package/dist/experimental/Tabs/types.d.ts +2 -2
- package/dist/experimental/Tabs/useTabList.js +15 -16
- package/dist/hooks/useMergedRefs.js +1 -4
- package/dist/hooks/useProvidedRefOrCreate.d.ts +10 -7
- package/dist/hooks/useProvidedRefOrCreate.js +10 -7
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-20260702230323
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
@@ -8,6 +8,17 @@
|
|
|
8
8
|
|
|
9
9
|
- [#8105](https://github.com/primer/react/pull/8105) [`be2950f`](https://github.com/primer/react/commit/be2950fd1ac268dd4e79258ab2cfe9241dd9e1c6) Thanks [@joshblack](https://github.com/joshblack)! - React Compiler: Enable compiler output for Banner, ConfirmationDialog, PageLayout, Pagination, UnderlineNav, `useMergedRefs`, and `useScrollFlash`
|
|
10
10
|
|
|
11
|
+
- [#8112](https://github.com/primer/react/pull/8112) [`1f5d1c8`](https://github.com/primer/react/commit/1f5d1c87b1151c47914233306336fc4d5f2cad6b) Thanks [@llastflowers](https://github.com/llastflowers)! - Add data-component attributes and associated tests for:
|
|
12
|
+
|
|
13
|
+
SplitPageLayout
|
|
14
|
+
Stack
|
|
15
|
+
StateLabel
|
|
16
|
+
SubNav
|
|
17
|
+
TabNav
|
|
18
|
+
Text
|
|
19
|
+
TextArea
|
|
20
|
+
ThemeProvider
|
|
21
|
+
|
|
11
22
|
### Patch Changes
|
|
12
23
|
|
|
13
24
|
- [#8066](https://github.com/primer/react/pull/8066) [`dd66aa2`](https://github.com/primer/react/commit/dd66aa27611f7ad56adb7429b50813d6af5a01d7) Thanks [@janmaarten-a11y](https://github.com/janmaarten-a11y)! - Fix invalid HTML nesting in `ActionList.Heading` by applying the visually-hidden styles directly to the heading element instead of wrapping it in a `span`.
|
package/dist/ActionList/List.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
2
2
|
import useIsomorphicLayoutEffect from "../utils/useIsomorphicLayoutEffect.js";
|
|
3
3
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
4
4
|
import { fixedForwardRef } from "../utils/modern-polymorphic.js";
|
|
@@ -12,11 +12,11 @@ import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
|
12
12
|
import { c } from "react-compiler-runtime";
|
|
13
13
|
import { clsx } from "clsx";
|
|
14
14
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
-
import React
|
|
15
|
+
import React from "react";
|
|
16
16
|
//#region src/ActionList/List.tsx
|
|
17
17
|
const UnwrappedList = (props, forwardedRef) => {
|
|
18
18
|
var _slots$heading$props$;
|
|
19
|
-
const $ = c(
|
|
19
|
+
const $ = c(40);
|
|
20
20
|
let className;
|
|
21
21
|
let restProps;
|
|
22
22
|
let role;
|
|
@@ -60,8 +60,7 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
60
60
|
const { listRole: listRoleFromContainer, listLabelledBy, selectionVariant: containerSelectionVariant, enableFocusZone: enableFocusZoneFromContainer, container } = React.useContext(ActionListContainerContext);
|
|
61
61
|
const ariaLabelledBy = slots.heading ? (_slots$heading$props$ = slots.heading.props.id) !== null && _slots$heading$props$ !== void 0 ? _slots$heading$props$ : headingId : listLabelledBy;
|
|
62
62
|
const listRole = role || listRoleFromContainer;
|
|
63
|
-
const listRef =
|
|
64
|
-
const mergedRef = useMergedRefs(forwardedRef, listRef);
|
|
63
|
+
const listRef = useProvidedRefOrCreate(forwardedRef);
|
|
65
64
|
const itemGapEnabled = useFeatureFlag("primer_react_action_list_item_gap") && container === "NavList";
|
|
66
65
|
let enableFocusZone = false;
|
|
67
66
|
if (enableFocusZoneFromContainer !== void 0) enableFocusZone = enableFocusZoneFromContainer;
|
|
@@ -80,21 +79,22 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
80
79
|
const t5 = !enableFocusZone;
|
|
81
80
|
const t6 = listRole === "menu" || container === "SelectPanel" || container === "FilteredActionList" ? "wrap" : void 0;
|
|
82
81
|
let t7;
|
|
83
|
-
if ($[11] !==
|
|
82
|
+
if ($[11] !== listRef || $[12] !== t5 || $[13] !== t6) {
|
|
84
83
|
t7 = {
|
|
85
84
|
disabled: t5,
|
|
86
85
|
containerRef: listRef,
|
|
87
86
|
bindKeys: FocusKeys.ArrowVertical | FocusKeys.HomeAndEnd | FocusKeys.PageUpDown,
|
|
88
87
|
focusOutBehavior: t6
|
|
89
88
|
};
|
|
90
|
-
$[11] =
|
|
91
|
-
$[12] =
|
|
92
|
-
$[13] =
|
|
93
|
-
|
|
89
|
+
$[11] = listRef;
|
|
90
|
+
$[12] = t5;
|
|
91
|
+
$[13] = t6;
|
|
92
|
+
$[14] = t7;
|
|
93
|
+
} else t7 = $[14];
|
|
94
94
|
useFocusZone(t7);
|
|
95
95
|
const t8 = selectionVariant || containerSelectionVariant;
|
|
96
96
|
let t9;
|
|
97
|
-
if ($[
|
|
97
|
+
if ($[15] !== headingId || $[16] !== listRole || $[17] !== showDividers || $[18] !== t8 || $[19] !== variant) {
|
|
98
98
|
t9 = {
|
|
99
99
|
variant,
|
|
100
100
|
selectionVariant: t8,
|
|
@@ -102,16 +102,16 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
102
102
|
role: listRole,
|
|
103
103
|
headingId
|
|
104
104
|
};
|
|
105
|
-
$[
|
|
106
|
-
$[
|
|
107
|
-
$[
|
|
108
|
-
$[
|
|
109
|
-
$[
|
|
110
|
-
$[
|
|
111
|
-
} else t9 = $[
|
|
105
|
+
$[15] = headingId;
|
|
106
|
+
$[16] = listRole;
|
|
107
|
+
$[17] = showDividers;
|
|
108
|
+
$[18] = t8;
|
|
109
|
+
$[19] = variant;
|
|
110
|
+
$[20] = t9;
|
|
111
|
+
} else t9 = $[20];
|
|
112
112
|
const listContextValue = t9;
|
|
113
113
|
let t10;
|
|
114
|
-
if ($[
|
|
114
|
+
if ($[21] !== listRef) {
|
|
115
115
|
t10 = () => {
|
|
116
116
|
const list = listRef.current;
|
|
117
117
|
if (!list) return;
|
|
@@ -120,24 +120,25 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
120
120
|
if (hasMixed && current !== "true") list.setAttribute("data-mixed-descriptions", "true");
|
|
121
121
|
else if (!hasMixed && current !== null) list.removeAttribute("data-mixed-descriptions");
|
|
122
122
|
};
|
|
123
|
-
$[
|
|
124
|
-
|
|
123
|
+
$[21] = listRef;
|
|
124
|
+
$[22] = t10;
|
|
125
|
+
} else t10 = $[22];
|
|
125
126
|
useIsomorphicLayoutEffect(t10);
|
|
126
127
|
const t11 = slots.heading;
|
|
127
128
|
let t12;
|
|
128
|
-
if ($[
|
|
129
|
+
if ($[23] !== className) {
|
|
129
130
|
t12 = clsx(ActionList_module_css_default.ActionList, className);
|
|
130
|
-
$[
|
|
131
|
-
$[
|
|
132
|
-
} else t12 = $[
|
|
131
|
+
$[23] = className;
|
|
132
|
+
$[24] = t12;
|
|
133
|
+
} else t12 = $[24];
|
|
133
134
|
const t13 = itemGapEnabled ? "" : void 0;
|
|
134
135
|
let t14;
|
|
135
|
-
if ($[
|
|
136
|
+
if ($[25] !== Component || $[26] !== ariaLabelledBy || $[27] !== childrenWithoutSlots || $[28] !== listRef || $[29] !== listRole || $[30] !== restProps || $[31] !== showDividers || $[32] !== t12 || $[33] !== t13 || $[34] !== variant) {
|
|
136
137
|
t14 = /*#__PURE__*/ jsx(Component, {
|
|
137
138
|
className: t12,
|
|
138
139
|
role: listRole,
|
|
139
140
|
"aria-labelledby": ariaLabelledBy,
|
|
140
|
-
ref:
|
|
141
|
+
ref: listRef,
|
|
141
142
|
"data-component": "ActionList",
|
|
142
143
|
"data-dividers": showDividers,
|
|
143
144
|
"data-variant": variant,
|
|
@@ -145,29 +146,29 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
145
146
|
...restProps,
|
|
146
147
|
children: childrenWithoutSlots
|
|
147
148
|
});
|
|
148
|
-
$[
|
|
149
|
-
$[
|
|
150
|
-
$[
|
|
151
|
-
$[
|
|
152
|
-
$[
|
|
153
|
-
$[
|
|
154
|
-
$[
|
|
155
|
-
$[
|
|
156
|
-
$[
|
|
157
|
-
$[
|
|
158
|
-
$[
|
|
159
|
-
} else t14 = $[
|
|
149
|
+
$[25] = Component;
|
|
150
|
+
$[26] = ariaLabelledBy;
|
|
151
|
+
$[27] = childrenWithoutSlots;
|
|
152
|
+
$[28] = listRef;
|
|
153
|
+
$[29] = listRole;
|
|
154
|
+
$[30] = restProps;
|
|
155
|
+
$[31] = showDividers;
|
|
156
|
+
$[32] = t12;
|
|
157
|
+
$[33] = t13;
|
|
158
|
+
$[34] = variant;
|
|
159
|
+
$[35] = t14;
|
|
160
|
+
} else t14 = $[35];
|
|
160
161
|
let t15;
|
|
161
|
-
if ($[
|
|
162
|
+
if ($[36] !== listContextValue || $[37] !== slots.heading || $[38] !== t14) {
|
|
162
163
|
t15 = /*#__PURE__*/ jsxs(ListContext.Provider, {
|
|
163
164
|
value: listContextValue,
|
|
164
165
|
children: [t11, t14]
|
|
165
166
|
});
|
|
166
|
-
$[
|
|
167
|
-
$[
|
|
168
|
-
$[
|
|
169
|
-
$[
|
|
170
|
-
} else t15 = $[
|
|
167
|
+
$[36] = listContextValue;
|
|
168
|
+
$[37] = slots.heading;
|
|
169
|
+
$[38] = t14;
|
|
170
|
+
$[39] = t15;
|
|
171
|
+
} else t15 = $[39];
|
|
171
172
|
return t15;
|
|
172
173
|
};
|
|
173
174
|
const List = fixedForwardRef(UnwrappedList);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { reactMajorVersion } from "../utils/environment.js";
|
|
2
|
-
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
3
2
|
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
4
3
|
import { useAnchoredPosition } from "../hooks/useAnchoredPosition.js";
|
|
5
4
|
import { useRenderForcingRef } from "../hooks/useRenderForcingRef.js";
|
|
@@ -34,7 +33,6 @@ const AnchoredOverlay = ({ renderAnchor, anchorRef: externalAnchorRef, anchorId:
|
|
|
34
33
|
const [anchorElement, setAnchorElement] = useState(null);
|
|
35
34
|
if (anchorRef.current !== anchorElement) setAnchorElement(anchorRef.current);
|
|
36
35
|
const [overlayRef, updateOverlayRef] = useRenderForcingRef();
|
|
37
|
-
const mergedOverlayRef = useMergedRefs(updateOverlayRef, overlayProps === null || overlayProps === void 0 ? void 0 : overlayProps.ref);
|
|
38
36
|
const [overlayElement, setOverlayElement] = useState(null);
|
|
39
37
|
const anchorId = useId$1(externalAnchorId);
|
|
40
38
|
const onClickOutside = useCallback(() => onClose === null || onClose === void 0 ? void 0 : onClose("click-outside"), [onClose]);
|
|
@@ -191,10 +189,10 @@ const AnchoredOverlay = ({ renderAnchor, anchorRef: externalAnchorRef, anchorId:
|
|
|
191
189
|
...shouldRenderAsPopover ? { popover: "manual" } : {},
|
|
192
190
|
...restOverlayProps,
|
|
193
191
|
...shouldRenderAsPopover ? { id: popoverId } : {},
|
|
194
|
-
...cssAnchorPositioning ? { id: popoverId } : {},
|
|
195
192
|
ref: (node) => {
|
|
193
|
+
if (overlayProps !== null && overlayProps !== void 0 && overlayProps.ref) assignRef(overlayProps.ref, node);
|
|
194
|
+
updateOverlayRef(node);
|
|
196
195
|
setOverlayElement(node);
|
|
197
|
-
assignRef(mergedOverlayRef, node);
|
|
198
196
|
},
|
|
199
197
|
"data-anchor-position": cssAnchorPositioning,
|
|
200
198
|
"data-side": cssAnchorPositioning ? side : position === null || position === void 0 ? void 0 : position.anchorSide,
|
|
@@ -20,11 +20,9 @@ const AutocompleteInput = /*#__PURE__*/ React.forwardRef(({ as: Component = Text
|
|
|
20
20
|
if (openOnFocus) setShowMenu(true);
|
|
21
21
|
};
|
|
22
22
|
const handleInputBlur = useCallback((event) => {
|
|
23
|
-
onBlur
|
|
23
|
+
onBlur && onBlur(event);
|
|
24
24
|
safeSetTimeout(() => {
|
|
25
|
-
|
|
26
|
-
const menuElement = document.getElementById(`${id}-listbox`);
|
|
27
|
-
if (!nextFocusedElement || nextFocusedElement !== menuElement && !(menuElement !== null && menuElement !== void 0 && menuElement.contains(nextFocusedElement))) {
|
|
25
|
+
if (document.activeElement !== inputRef.current) {
|
|
28
26
|
setShowMenu(false);
|
|
29
27
|
if (inputRef.current && autocompleteSuggestion && inputRef.current.value !== inputValue) inputRef.current.value = inputValue;
|
|
30
28
|
}
|
|
@@ -35,17 +33,16 @@ const AutocompleteInput = /*#__PURE__*/ React.forwardRef(({ as: Component = Text
|
|
|
35
33
|
inputRef,
|
|
36
34
|
safeSetTimeout,
|
|
37
35
|
autocompleteSuggestion,
|
|
38
|
-
inputValue
|
|
39
|
-
id
|
|
36
|
+
inputValue
|
|
40
37
|
]);
|
|
41
38
|
const handleInputChange = (event) => {
|
|
42
|
-
onChange
|
|
39
|
+
onChange && onChange(event);
|
|
43
40
|
setInputValue(event.currentTarget.value);
|
|
44
41
|
if (!showMenu) setShowMenu(true);
|
|
45
42
|
};
|
|
46
43
|
const handleInputKeyDown = useCallback((event) => {
|
|
47
44
|
var _inputRef$current;
|
|
48
|
-
onKeyDown
|
|
45
|
+
onKeyDown && onKeyDown(event);
|
|
49
46
|
if (event.key === "Backspace") setHighlightRemainingText(false);
|
|
50
47
|
if (event.key === "Escape" && (_inputRef$current = inputRef.current) !== null && _inputRef$current !== void 0 && _inputRef$current.value) {
|
|
51
48
|
setInputValue("");
|
|
@@ -61,11 +58,11 @@ const AutocompleteInput = /*#__PURE__*/ React.forwardRef(({ as: Component = Text
|
|
|
61
58
|
setShowMenu
|
|
62
59
|
]);
|
|
63
60
|
const handleInputKeyUp = useCallback((event) => {
|
|
64
|
-
onKeyUp
|
|
61
|
+
onKeyUp && onKeyUp(event);
|
|
65
62
|
if (event.key === "Backspace") setHighlightRemainingText(true);
|
|
66
63
|
}, [setHighlightRemainingText, onKeyUp]);
|
|
67
64
|
const onInputKeyPress = useCallback((event) => {
|
|
68
|
-
onKeyPress
|
|
65
|
+
onKeyPress && onKeyPress(event);
|
|
69
66
|
if (showMenu && event.key === "Enter" && activeDescendantRef.current) {
|
|
70
67
|
event.preventDefault();
|
|
71
68
|
event.nativeEvent.stopImmediatePropagation();
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
2
2
|
import { FocusKeys, useFocusZone } from "../hooks/useFocusZone.js";
|
|
3
3
|
import ButtonGroup_module_css_default from "./ButtonGroup.module.css.js";
|
|
4
4
|
import { c } from "react-compiler-runtime";
|
|
5
5
|
import { clsx } from "clsx";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
import React
|
|
7
|
+
import React from "react";
|
|
8
8
|
//#region src/ButtonGroup/ButtonGroup.tsx
|
|
9
9
|
const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forwardRef) {
|
|
10
|
-
const $ = c(
|
|
10
|
+
const $ = c(20);
|
|
11
11
|
let children;
|
|
12
12
|
let className;
|
|
13
13
|
let rest;
|
|
@@ -29,8 +29,6 @@ const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forw
|
|
|
29
29
|
t1 = $[5];
|
|
30
30
|
}
|
|
31
31
|
const BaseComponent = t1 === void 0 ? "div" : t1;
|
|
32
|
-
const buttonRef = useRef(null);
|
|
33
|
-
const mergedRef = useMergedRefs(buttonRef, forwardRef);
|
|
34
32
|
let t2;
|
|
35
33
|
if ($[6] !== children) {
|
|
36
34
|
t2 = React.Children.map(children, _temp);
|
|
@@ -38,43 +36,45 @@ const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forw
|
|
|
38
36
|
$[7] = t2;
|
|
39
37
|
} else t2 = $[7];
|
|
40
38
|
const buttons = t2;
|
|
39
|
+
const buttonRef = useProvidedRefOrCreate(forwardRef);
|
|
41
40
|
const t3 = role !== "toolbar";
|
|
42
41
|
let t4;
|
|
43
|
-
if ($[8] !== t3) {
|
|
42
|
+
if ($[8] !== buttonRef || $[9] !== t3) {
|
|
44
43
|
t4 = {
|
|
45
44
|
containerRef: buttonRef,
|
|
46
45
|
disabled: t3,
|
|
47
46
|
bindKeys: FocusKeys.ArrowHorizontal,
|
|
48
47
|
focusOutBehavior: "wrap"
|
|
49
48
|
};
|
|
50
|
-
$[8] =
|
|
51
|
-
$[9] =
|
|
52
|
-
|
|
49
|
+
$[8] = buttonRef;
|
|
50
|
+
$[9] = t3;
|
|
51
|
+
$[10] = t4;
|
|
52
|
+
} else t4 = $[10];
|
|
53
53
|
useFocusZone(t4);
|
|
54
54
|
let t5;
|
|
55
|
-
if ($[
|
|
55
|
+
if ($[11] !== className) {
|
|
56
56
|
t5 = clsx(className, ButtonGroup_module_css_default.ButtonGroup);
|
|
57
|
-
$[
|
|
58
|
-
$[
|
|
59
|
-
} else t5 = $[
|
|
57
|
+
$[11] = className;
|
|
58
|
+
$[12] = t5;
|
|
59
|
+
} else t5 = $[12];
|
|
60
60
|
let t6;
|
|
61
|
-
if ($[
|
|
61
|
+
if ($[13] !== BaseComponent || $[14] !== buttonRef || $[15] !== buttons || $[16] !== rest || $[17] !== role || $[18] !== t5) {
|
|
62
62
|
t6 = /*#__PURE__*/ jsx(BaseComponent, {
|
|
63
|
-
ref:
|
|
63
|
+
ref: buttonRef,
|
|
64
64
|
className: t5,
|
|
65
65
|
role,
|
|
66
66
|
...rest,
|
|
67
67
|
"data-component": "ButtonGroup",
|
|
68
68
|
children: buttons
|
|
69
69
|
});
|
|
70
|
-
$[
|
|
71
|
-
$[
|
|
72
|
-
$[
|
|
73
|
-
$[
|
|
74
|
-
$[
|
|
75
|
-
$[
|
|
76
|
-
$[
|
|
77
|
-
} else t6 = $[
|
|
70
|
+
$[13] = BaseComponent;
|
|
71
|
+
$[14] = buttonRef;
|
|
72
|
+
$[15] = buttons;
|
|
73
|
+
$[16] = rest;
|
|
74
|
+
$[17] = role;
|
|
75
|
+
$[18] = t5;
|
|
76
|
+
$[19] = t6;
|
|
77
|
+
} else t6 = $[19];
|
|
78
78
|
return t6;
|
|
79
79
|
});
|
|
80
80
|
ButtonGroup.displayName = "ButtonGroup";
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
2
2
|
import useIsomorphicLayoutEffect from "../utils/useIsomorphicLayoutEffect.js";
|
|
3
3
|
import shared_module_css_default from "./shared.module.css.js";
|
|
4
4
|
import { CheckboxGroupContext } from "../CheckboxGroup/CheckboxGroupContext.js";
|
|
5
5
|
import Checkbox_module_css_default from "./Checkbox.module.css.js";
|
|
6
6
|
import { clsx } from "clsx";
|
|
7
7
|
import { jsx } from "react/jsx-runtime";
|
|
8
|
-
import React, { useContext, useEffect
|
|
8
|
+
import React, { useContext, useEffect } from "react";
|
|
9
9
|
//#region src/Checkbox/Checkbox.tsx
|
|
10
10
|
/**
|
|
11
11
|
* An accessible, native checkbox component
|
|
12
12
|
*/
|
|
13
13
|
const Checkbox = /*#__PURE__*/ React.forwardRef(({ checked, className, defaultChecked, indeterminate, disabled, onChange, required, validationStatus, value, ["data-component"]: dataComponent, ...rest }, ref) => {
|
|
14
|
-
const checkboxRef =
|
|
15
|
-
const mergedRef = useMergedRefs(checkboxRef, ref);
|
|
14
|
+
const checkboxRef = useProvidedRefOrCreate(ref);
|
|
16
15
|
const checkboxGroupContext = useContext(CheckboxGroupContext);
|
|
17
16
|
const handleOnChange = (e) => {
|
|
18
17
|
checkboxGroupContext.onChange && checkboxGroupContext.onChange(e);
|
|
@@ -25,7 +24,7 @@ const Checkbox = /*#__PURE__*/ React.forwardRef(({ checked, className, defaultCh
|
|
|
25
24
|
const inputProps = {
|
|
26
25
|
type: "checkbox",
|
|
27
26
|
disabled,
|
|
28
|
-
ref:
|
|
27
|
+
ref: checkboxRef,
|
|
29
28
|
checked: indeterminate ? false : checked,
|
|
30
29
|
defaultChecked,
|
|
31
30
|
required,
|
package/dist/Dialog/Dialog.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
2
|
+
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
2
3
|
import { useOnEscapePress } from "../hooks/useOnEscapePress.js";
|
|
3
4
|
import { useResizeObserver } from "../hooks/useResizeObserver.js";
|
|
4
5
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
@@ -243,8 +244,7 @@ const Footer = /*#__PURE__*/ React.forwardRef(function Footer({ className, ...re
|
|
|
243
244
|
Footer.displayName = "Dialog.Footer";
|
|
244
245
|
const Buttons = ({ buttons }) => {
|
|
245
246
|
var _buttons$find;
|
|
246
|
-
const autoFocusRef =
|
|
247
|
-
const mergedRef = useMergedRefs(autoFocusRef, (_buttons$find = buttons.find((button) => button.autoFocus)) === null || _buttons$find === void 0 ? void 0 : _buttons$find.ref);
|
|
247
|
+
const autoFocusRef = useProvidedRefOrCreate((_buttons$find = buttons.find((button) => button.autoFocus)) === null || _buttons$find === void 0 ? void 0 : _buttons$find.ref);
|
|
248
248
|
let autoFocusCount = 0;
|
|
249
249
|
const [hasRendered, setHasRendered] = useState(0);
|
|
250
250
|
useEffect(() => {
|
|
@@ -259,7 +259,7 @@ const Buttons = ({ buttons }) => {
|
|
|
259
259
|
"data-component": "Dialog.FooterButton",
|
|
260
260
|
...buttonProps,
|
|
261
261
|
variant: buttonType === "normal" ? "default" : buttonType,
|
|
262
|
-
ref: autoFocus && autoFocusCount === 0 ? (autoFocusCount++,
|
|
262
|
+
ref: autoFocus && autoFocusCount === 0 ? (autoFocusCount++, autoFocusRef) : null,
|
|
263
263
|
children: content
|
|
264
264
|
}, index);
|
|
265
265
|
}) });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
2
1
|
import { VisuallyHidden } from "../VisuallyHidden/VisuallyHidden.js";
|
|
2
|
+
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
3
3
|
import { useProvidedStateOrCreate } from "../hooks/useProvidedStateOrCreate.js";
|
|
4
4
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
5
5
|
import { useFocusZone } from "../hooks/useFocusZone.js";
|
|
@@ -35,10 +35,8 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
|
|
|
35
35
|
}, [onFilterChange, setInternalFilterValue]);
|
|
36
36
|
const inputAndListContainerRef = useRef(null);
|
|
37
37
|
const listRef = useRef(null);
|
|
38
|
-
const scrollContainerRef =
|
|
39
|
-
const
|
|
40
|
-
const inputRef = useRef(null);
|
|
41
|
-
const combinedInputRef = useMergedRefs(inputRef, providedInputRef);
|
|
38
|
+
const scrollContainerRef = useProvidedRefOrCreate(providedScrollContainerRef);
|
|
39
|
+
const inputRef = useProvidedRefOrCreate(providedInputRef);
|
|
42
40
|
const usingRovingTabindex = _PrivateFocusManagement === "roving-tabindex";
|
|
43
41
|
const [listContainerElement, setListContainerElement] = useState(null);
|
|
44
42
|
const activeDescendantRef = useRef();
|
|
@@ -293,7 +291,7 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
|
|
|
293
291
|
"data-component": "FilteredActionList",
|
|
294
292
|
children: [
|
|
295
293
|
/*#__PURE__*/ jsx(FilteredActionListInput, {
|
|
296
|
-
inputRef
|
|
294
|
+
inputRef,
|
|
297
295
|
value: filterValue,
|
|
298
296
|
onInputChange,
|
|
299
297
|
onInputKeyPress,
|
|
@@ -327,7 +325,7 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
|
|
|
327
325
|
})]
|
|
328
326
|
}),
|
|
329
327
|
/*#__PURE__*/ jsx("div", {
|
|
330
|
-
ref:
|
|
328
|
+
ref: scrollContainerRef,
|
|
331
329
|
className: FilteredActionList_module_css_default.Container,
|
|
332
330
|
children: getBodyContent()
|
|
333
331
|
})
|
|
@@ -3,7 +3,7 @@ import React from "react";
|
|
|
3
3
|
|
|
4
4
|
//#region src/FilteredActionList/FilteredActionListInput.d.ts
|
|
5
5
|
interface FilteredActionListInputProps extends Partial<Omit<TextInputProps, 'onChange' | 'onKeyDown'>> {
|
|
6
|
-
inputRef: React.
|
|
6
|
+
inputRef: React.RefObject<HTMLInputElement | null>;
|
|
7
7
|
onInputChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
8
8
|
onInputKeyPress?: React.KeyboardEventHandler<HTMLInputElement>;
|
|
9
9
|
onInputKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
2
2
|
import { warning } from "../utils/warning.js";
|
|
3
3
|
import { isResponsiveValue } from "../hooks/useResponsiveValue.js";
|
|
4
4
|
import { isSlot } from "../utils/is-slot.js";
|
|
@@ -10,7 +10,7 @@ import PageHeader_module_css_default from "./PageHeader.module.css.js";
|
|
|
10
10
|
import { c } from "react-compiler-runtime";
|
|
11
11
|
import { clsx } from "clsx";
|
|
12
12
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
-
import React, { useEffect
|
|
13
|
+
import React, { useEffect } from "react";
|
|
14
14
|
import { ArrowLeftIcon } from "@primer/octicons-react";
|
|
15
15
|
//#region src/PageHeader/PageHeader.tsx
|
|
16
16
|
const hiddenOnRegularAndWide = {
|
|
@@ -24,15 +24,14 @@ const hiddenOnNarrow = {
|
|
|
24
24
|
wide: false
|
|
25
25
|
};
|
|
26
26
|
const Root = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
27
|
-
const $ = c(
|
|
27
|
+
const $ = c(14);
|
|
28
28
|
const { children, className, as: t1, "aria-label": ariaLabel, role, hasBorder } = t0;
|
|
29
29
|
const BaseComponent = t1 === void 0 ? "div" : t1;
|
|
30
|
-
const rootRef =
|
|
31
|
-
const mergedRef = useMergedRefs(rootRef, forwardedRef);
|
|
30
|
+
const rootRef = useProvidedRefOrCreate(forwardedRef);
|
|
32
31
|
const isInteractive = _temp;
|
|
33
32
|
let t2;
|
|
34
33
|
let t3;
|
|
35
|
-
if ($[0] !== children) {
|
|
34
|
+
if ($[0] !== children || $[1] !== rootRef) {
|
|
36
35
|
t2 = function validateInteractiveElementsInTitle() {
|
|
37
36
|
let hasContextArea = false;
|
|
38
37
|
let hasLeadingAction = false;
|
|
@@ -47,24 +46,25 @@ const Root = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
|
47
46
|
};
|
|
48
47
|
t3 = [children, rootRef];
|
|
49
48
|
$[0] = children;
|
|
50
|
-
$[1] =
|
|
51
|
-
$[2] =
|
|
49
|
+
$[1] = rootRef;
|
|
50
|
+
$[2] = t2;
|
|
51
|
+
$[3] = t3;
|
|
52
52
|
} else {
|
|
53
|
-
t2 = $[
|
|
54
|
-
t3 = $[
|
|
53
|
+
t2 = $[2];
|
|
54
|
+
t3 = $[3];
|
|
55
55
|
}
|
|
56
56
|
useEffect(t2, t3);
|
|
57
57
|
let t4;
|
|
58
|
-
if ($[
|
|
58
|
+
if ($[4] !== className) {
|
|
59
59
|
t4 = clsx(PageHeader_module_css_default.PageHeader, className);
|
|
60
|
-
$[
|
|
61
|
-
$[
|
|
62
|
-
} else t4 = $[
|
|
60
|
+
$[4] = className;
|
|
61
|
+
$[5] = t4;
|
|
62
|
+
} else t4 = $[5];
|
|
63
63
|
const t5 = hasBorder ? "true" : void 0;
|
|
64
64
|
let t6;
|
|
65
|
-
if ($[
|
|
65
|
+
if ($[6] !== BaseComponent || $[7] !== ariaLabel || $[8] !== children || $[9] !== role || $[10] !== rootRef || $[11] !== t4 || $[12] !== t5) {
|
|
66
66
|
t6 = /*#__PURE__*/ jsx(BaseComponent, {
|
|
67
|
-
ref:
|
|
67
|
+
ref: rootRef,
|
|
68
68
|
className: t4,
|
|
69
69
|
"data-component": "PageHeader",
|
|
70
70
|
"data-has-border": t5,
|
|
@@ -72,15 +72,15 @@ const Root = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
|
72
72
|
role,
|
|
73
73
|
children
|
|
74
74
|
});
|
|
75
|
-
$[
|
|
76
|
-
$[
|
|
77
|
-
$[
|
|
78
|
-
$[8] = mergedRef;
|
|
75
|
+
$[6] = BaseComponent;
|
|
76
|
+
$[7] = ariaLabel;
|
|
77
|
+
$[8] = children;
|
|
79
78
|
$[9] = role;
|
|
80
|
-
$[10] =
|
|
81
|
-
$[11] =
|
|
82
|
-
$[12] =
|
|
83
|
-
|
|
79
|
+
$[10] = rootRef;
|
|
80
|
+
$[11] = t4;
|
|
81
|
+
$[12] = t5;
|
|
82
|
+
$[13] = t6;
|
|
83
|
+
} else t6 = $[13];
|
|
84
84
|
return t6;
|
|
85
85
|
});
|
|
86
86
|
const ContextArea = (t0) => {
|
|
@@ -262,6 +262,7 @@ const TitleArea = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
|
262
262
|
const { children, className, hidden: t1, variant: t2 } = t0;
|
|
263
263
|
const hidden = t1 === void 0 ? false : t1;
|
|
264
264
|
const variant = t2 === void 0 ? "medium" : t2;
|
|
265
|
+
const titleAreaRef = useProvidedRefOrCreate(forwardedRef);
|
|
265
266
|
let t3;
|
|
266
267
|
if ($[0] !== className) {
|
|
267
268
|
t3 = clsx(PageHeader_module_css_default.TitleArea, className);
|
|
@@ -281,20 +282,20 @@ const TitleArea = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
|
281
282
|
$[5] = t5;
|
|
282
283
|
} else t5 = $[5];
|
|
283
284
|
let t6;
|
|
284
|
-
if ($[6] !== children || $[7] !==
|
|
285
|
+
if ($[6] !== children || $[7] !== t3 || $[8] !== t4 || $[9] !== t5 || $[10] !== titleAreaRef) {
|
|
285
286
|
t6 = /*#__PURE__*/ jsx("div", {
|
|
286
287
|
className: t3,
|
|
287
|
-
ref:
|
|
288
|
+
ref: titleAreaRef,
|
|
288
289
|
"data-component": "TitleArea",
|
|
289
290
|
...t4,
|
|
290
291
|
...t5,
|
|
291
292
|
children
|
|
292
293
|
});
|
|
293
294
|
$[6] = children;
|
|
294
|
-
$[7] =
|
|
295
|
-
$[8] =
|
|
296
|
-
$[9] =
|
|
297
|
-
$[10] =
|
|
295
|
+
$[7] = t3;
|
|
296
|
+
$[8] = t4;
|
|
297
|
+
$[9] = t5;
|
|
298
|
+
$[10] = titleAreaRef;
|
|
298
299
|
$[11] = t6;
|
|
299
300
|
} else t6 = $[11];
|
|
300
301
|
return t6;
|
|
@@ -17,6 +17,7 @@ type PageLayoutProps = {
|
|
|
17
17
|
_slotsConfig?: Record<'header' | 'footer' | 'sidebar', React.ElementType>;
|
|
18
18
|
className?: string;
|
|
19
19
|
style?: React.CSSProperties;
|
|
20
|
+
'data-component'?: string;
|
|
20
21
|
};
|
|
21
22
|
type PageLayoutHeaderProps = {
|
|
22
23
|
/**
|
|
@@ -47,6 +48,7 @@ type PageLayoutHeaderProps = {
|
|
|
47
48
|
hidden?: boolean | ResponsiveValue<boolean>;
|
|
48
49
|
className?: string;
|
|
49
50
|
style?: React.CSSProperties;
|
|
51
|
+
'data-component'?: string;
|
|
50
52
|
};
|
|
51
53
|
type PageLayoutContentProps = {
|
|
52
54
|
/**
|
|
@@ -67,6 +69,7 @@ type PageLayoutContentProps = {
|
|
|
67
69
|
hidden?: boolean | ResponsiveValue<boolean>;
|
|
68
70
|
className?: string;
|
|
69
71
|
style?: React.CSSProperties;
|
|
72
|
+
'data-component'?: string;
|
|
70
73
|
};
|
|
71
74
|
type PageLayoutPaneBaseProps = {
|
|
72
75
|
position?: 'start' | 'end' | ResponsiveValue<'start' | 'end'>;
|
|
@@ -140,6 +143,7 @@ type PageLayoutPaneBaseProps = {
|
|
|
140
143
|
id?: string;
|
|
141
144
|
className?: string;
|
|
142
145
|
style?: React.CSSProperties;
|
|
146
|
+
'data-component'?: string;
|
|
143
147
|
};
|
|
144
148
|
type PageLayoutPaneProps = PageLayoutPaneBaseProps & ({
|
|
145
149
|
/**
|
|
@@ -227,6 +231,7 @@ type PageLayoutSidebarBaseProps = {
|
|
|
227
231
|
id?: string;
|
|
228
232
|
className?: string;
|
|
229
233
|
style?: React.CSSProperties;
|
|
234
|
+
'data-component'?: string;
|
|
230
235
|
};
|
|
231
236
|
type PageLayoutSidebarProps = PageLayoutSidebarBaseProps & ({
|
|
232
237
|
/**
|
|
@@ -275,6 +280,7 @@ type PageLayoutFooterProps = {
|
|
|
275
280
|
hidden?: boolean | ResponsiveValue<boolean>;
|
|
276
281
|
className?: string;
|
|
277
282
|
style?: React.CSSProperties;
|
|
283
|
+
'data-component'?: string;
|
|
278
284
|
};
|
|
279
285
|
declare const PageLayout: React.FC<React.PropsWithChildren<PageLayoutProps>> & {
|
|
280
286
|
Header: FCWithSlotMarker<React.PropsWithChildren<PageLayoutHeaderProps>>;
|