@primer/react 38.47.0-rc.207872287 → 38.47.0-rc.2f87f01e5
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/List.js +43 -50
- package/dist/AnchoredOverlay/AnchoredOverlay.js +1 -10
- package/dist/ButtonGroup/ButtonGroup.js +20 -27
- package/dist/Checkbox/Checkbox.js +47 -61
- package/dist/Dialog/Dialog.js +4 -10
- package/dist/FeatureFlags/DefaultFeatureFlags.js +0 -1
- package/dist/FilteredActionList/FilteredActionList.js +17 -36
- package/dist/PageHeader/PageHeader.js +31 -41
- package/dist/TextInput/TextInput.js +107 -114
- package/dist/TooltipV2/Tooltip.js +76 -87
- package/dist/experimental/Tabs/useTabList.js +14 -21
- package/dist/experimental/UnderlinePanels/UnderlinePanels.js +40 -52
- package/package.json +3 -4
package/CHANGELOG.md
CHANGED
|
@@ -8,8 +8,12 @@
|
|
|
8
8
|
|
|
9
9
|
- [#8563](https://github.com/primer/react/pull/8563) [`998b471`](https://github.com/primer/react/commit/998b471a4ad78c7c23426038ef0c4a5261fc41cf) Thanks [@joshblack](https://github.com/joshblack)! - ActionMenu: Improve rendering performance with React Compiler support.
|
|
10
10
|
|
|
11
|
+
- [#8746](https://github.com/primer/react/pull/8746) [`d2dd516`](https://github.com/primer/react/commit/d2dd516adc1eb82657df80a07e91b9a86a295165) Thanks [@Archanachaurasiya30](https://github.com/Archanachaurasiya30)! - Remove the unused hsluv dependency and move react-intersection-observer to devDependencies.
|
|
12
|
+
|
|
11
13
|
### Patch Changes
|
|
12
14
|
|
|
15
|
+
- [#8548](https://github.com/primer/react/pull/8548) [`6075e98`](https://github.com/primer/react/commit/6075e98c6ea8fefb1d20f3918a0c133e77a68c9a) Thanks [@llastflowers](https://github.com/llastflowers)! - Ref handling: Preserve forwarded refs while maintaining internal component refs.
|
|
16
|
+
|
|
13
17
|
- [#8708](https://github.com/primer/react/pull/8708) [`16c41d3`](https://github.com/primer/react/commit/16c41d3e57bb7358d887c613aaeb22aaea3a0d97) Thanks [@vivanvv](https://github.com/vivanvv)! - Pagination: Disable Next for empty results when page numbers are hidden.
|
|
14
18
|
|
|
15
19
|
- [#8731](https://github.com/primer/react/pull/8731) [`cb71c93`](https://github.com/primer/react/commit/cb71c93fada0adb063905e1894fe1667c0e3c3fa) Thanks [@dependabot](https://github.com/apps/dependabot)! - PageLayout and TreeView: Preserve pane resizing and keyboard focus behavior
|
package/dist/ActionList/List.js
CHANGED
|
@@ -6,7 +6,6 @@ import { Heading } from "./Heading.js";
|
|
|
6
6
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
7
7
|
import { ListContext } from "./shared.js";
|
|
8
8
|
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
9
|
-
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
10
9
|
import { FocusKeys, useFocusZone } from "../hooks/useFocusZone.js";
|
|
11
10
|
import ActionList_module_css_default from "./ActionList.module.css.js";
|
|
12
11
|
import useIsomorphicLayoutEffect from "../utils/useIsomorphicLayoutEffect.js";
|
|
@@ -17,7 +16,7 @@ import { clsx } from "clsx";
|
|
|
17
16
|
// src/ActionList/List.tsx
|
|
18
17
|
const UnwrappedList = (props, forwardedRef) => {
|
|
19
18
|
var _slots$heading$props$;
|
|
20
|
-
const $ = c(
|
|
19
|
+
const $ = c(39);
|
|
21
20
|
let className;
|
|
22
21
|
let restProps;
|
|
23
22
|
let role;
|
|
@@ -65,12 +64,8 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
65
64
|
const { listRole: listRoleFromContainer, listLabelledBy, selectionVariant: containerSelectionVariant, enableFocusZone: enableFocusZoneFromContainer, container } = React.useContext(ActionListContainerContext);
|
|
66
65
|
const ariaLabelledBy = slots.heading ? (_slots$heading$props$ = slots.heading.props.id) !== null && _slots$heading$props$ !== void 0 ? _slots$heading$props$ : headingId : listLabelledBy;
|
|
67
66
|
const listRole = role || listRoleFromContainer;
|
|
68
|
-
const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
|
|
69
67
|
const listRef = useRef(null);
|
|
70
68
|
const mergedRef = useMergedRefs(listRef, forwardedRef);
|
|
71
|
-
const providedOrCreatedRef = useProvidedRefOrCreate(forwardedRef);
|
|
72
|
-
const readRef = mergedRefEnabled ? listRef : providedOrCreatedRef;
|
|
73
|
-
const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
|
|
74
69
|
const itemGapEnabled = useFeatureFlag("primer_react_action_list_item_gap") && !disableItemGap && container === "NavList";
|
|
75
70
|
let enableFocusZone = false;
|
|
76
71
|
if (enableFocusZoneFromContainer !== void 0) enableFocusZone = enableFocusZoneFromContainer;
|
|
@@ -89,22 +84,21 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
89
84
|
const t6 = !enableFocusZone;
|
|
90
85
|
const t7 = listRole === "menu" || container === "SelectPanel" || container === "FilteredActionList" ? "wrap" : void 0;
|
|
91
86
|
let t8;
|
|
92
|
-
if ($[12] !==
|
|
87
|
+
if ($[12] !== t6 || $[13] !== t7) {
|
|
93
88
|
t8 = {
|
|
94
89
|
disabled: t6,
|
|
95
|
-
containerRef:
|
|
90
|
+
containerRef: listRef,
|
|
96
91
|
bindKeys: FocusKeys.ArrowVertical | FocusKeys.HomeAndEnd | FocusKeys.PageUpDown,
|
|
97
92
|
focusOutBehavior: t7
|
|
98
93
|
};
|
|
99
|
-
$[12] =
|
|
100
|
-
$[13] =
|
|
101
|
-
$[14] =
|
|
102
|
-
|
|
103
|
-
} else t8 = $[15];
|
|
94
|
+
$[12] = t6;
|
|
95
|
+
$[13] = t7;
|
|
96
|
+
$[14] = t8;
|
|
97
|
+
} else t8 = $[14];
|
|
104
98
|
useFocusZone(t8);
|
|
105
99
|
const t9 = selectionVariant || containerSelectionVariant;
|
|
106
100
|
let t10;
|
|
107
|
-
if ($[
|
|
101
|
+
if ($[15] !== headingId || $[16] !== listRole || $[17] !== showDividers || $[18] !== t9 || $[19] !== variant) {
|
|
108
102
|
t10 = {
|
|
109
103
|
variant,
|
|
110
104
|
selectionVariant: t9,
|
|
@@ -112,43 +106,42 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
112
106
|
role: listRole,
|
|
113
107
|
headingId
|
|
114
108
|
};
|
|
115
|
-
$[
|
|
116
|
-
$[
|
|
117
|
-
$[
|
|
118
|
-
$[
|
|
119
|
-
$[
|
|
120
|
-
$[
|
|
121
|
-
} else t10 = $[
|
|
109
|
+
$[15] = headingId;
|
|
110
|
+
$[16] = listRole;
|
|
111
|
+
$[17] = showDividers;
|
|
112
|
+
$[18] = t9;
|
|
113
|
+
$[19] = variant;
|
|
114
|
+
$[20] = t10;
|
|
115
|
+
} else t10 = $[20];
|
|
122
116
|
const listContextValue = t10;
|
|
123
117
|
let t11;
|
|
124
|
-
if ($[
|
|
118
|
+
if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
|
|
125
119
|
t11 = () => {
|
|
126
|
-
const list =
|
|
120
|
+
const list = listRef.current;
|
|
127
121
|
if (!list) return;
|
|
128
122
|
const hasMixed = list.querySelector("[data-has-description=\"true\"]") !== null && list.querySelector("[data-has-description=\"false\"]") !== null;
|
|
129
123
|
const current = list.getAttribute("data-mixed-descriptions");
|
|
130
124
|
if (hasMixed && current !== "true") list.setAttribute("data-mixed-descriptions", "true");
|
|
131
125
|
else if (!hasMixed && current !== null) list.removeAttribute("data-mixed-descriptions");
|
|
132
126
|
};
|
|
133
|
-
$[
|
|
134
|
-
|
|
135
|
-
} else t11 = $[23];
|
|
127
|
+
$[21] = t11;
|
|
128
|
+
} else t11 = $[21];
|
|
136
129
|
useIsomorphicLayoutEffect(t11);
|
|
137
130
|
const t12 = slots.heading;
|
|
138
131
|
let t13;
|
|
139
|
-
if ($[
|
|
132
|
+
if ($[22] !== className) {
|
|
140
133
|
t13 = clsx(ActionList_module_css_default.ActionList, className);
|
|
141
|
-
$[
|
|
142
|
-
$[
|
|
143
|
-
} else t13 = $[
|
|
134
|
+
$[22] = className;
|
|
135
|
+
$[23] = t13;
|
|
136
|
+
} else t13 = $[23];
|
|
144
137
|
const t14 = itemGapEnabled ? "" : void 0;
|
|
145
138
|
let t15;
|
|
146
|
-
if ($[
|
|
139
|
+
if ($[24] !== Component || $[25] !== ariaLabelledBy || $[26] !== childrenWithoutSlots || $[27] !== listRole || $[28] !== mergedRef || $[29] !== restProps || $[30] !== showDividers || $[31] !== t13 || $[32] !== t14 || $[33] !== variant) {
|
|
147
140
|
t15 = /* @__PURE__ */ jsx(Component, {
|
|
148
141
|
className: t13,
|
|
149
142
|
role: listRole,
|
|
150
143
|
"aria-labelledby": ariaLabelledBy,
|
|
151
|
-
ref:
|
|
144
|
+
ref: mergedRef,
|
|
152
145
|
"data-component": "ActionList",
|
|
153
146
|
"data-dividers": showDividers,
|
|
154
147
|
"data-variant": variant,
|
|
@@ -156,29 +149,29 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
156
149
|
...restProps,
|
|
157
150
|
children: childrenWithoutSlots
|
|
158
151
|
});
|
|
159
|
-
$[
|
|
160
|
-
$[
|
|
161
|
-
$[
|
|
162
|
-
$[
|
|
163
|
-
$[
|
|
164
|
-
$[
|
|
165
|
-
$[
|
|
166
|
-
$[
|
|
167
|
-
$[
|
|
168
|
-
$[
|
|
169
|
-
$[
|
|
170
|
-
} else t15 = $[
|
|
152
|
+
$[24] = Component;
|
|
153
|
+
$[25] = ariaLabelledBy;
|
|
154
|
+
$[26] = childrenWithoutSlots;
|
|
155
|
+
$[27] = listRole;
|
|
156
|
+
$[28] = mergedRef;
|
|
157
|
+
$[29] = restProps;
|
|
158
|
+
$[30] = showDividers;
|
|
159
|
+
$[31] = t13;
|
|
160
|
+
$[32] = t14;
|
|
161
|
+
$[33] = variant;
|
|
162
|
+
$[34] = t15;
|
|
163
|
+
} else t15 = $[34];
|
|
171
164
|
let t16;
|
|
172
|
-
if ($[
|
|
165
|
+
if ($[35] !== listContextValue || $[36] !== slots.heading || $[37] !== t15) {
|
|
173
166
|
t16 = /* @__PURE__ */ jsxs(ListContext.Provider, {
|
|
174
167
|
value: listContextValue,
|
|
175
168
|
children: [t12, t15]
|
|
176
169
|
});
|
|
177
|
-
$[
|
|
178
|
-
$[
|
|
179
|
-
$[
|
|
180
|
-
$[
|
|
181
|
-
} else t16 = $[
|
|
170
|
+
$[35] = listContextValue;
|
|
171
|
+
$[36] = slots.heading;
|
|
172
|
+
$[37] = t15;
|
|
173
|
+
$[38] = t16;
|
|
174
|
+
} else t16 = $[38];
|
|
182
175
|
return t16;
|
|
183
176
|
};
|
|
184
177
|
const List = fixedForwardRef(UnwrappedList);
|
|
@@ -34,7 +34,6 @@ const AnchoredOverlay = ({ renderAnchor, anchorRef: externalAnchorRef, anchorId:
|
|
|
34
34
|
const [anchorElement, setAnchorElement] = useState(null);
|
|
35
35
|
if (anchorRef.current !== anchorElement) setAnchorElement(anchorRef.current);
|
|
36
36
|
const [overlayRef, updateOverlayRef] = useRenderForcingRef();
|
|
37
|
-
const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
|
|
38
37
|
const [overlayElement, setOverlayElement] = useState(null);
|
|
39
38
|
const mergedOverlayRef = useMergedRefs(updateOverlayRef, useMergedRefs(overlayProps === null || overlayProps === void 0 ? void 0 : overlayProps.ref, setOverlayElement));
|
|
40
39
|
const anchorId = useId$1(externalAnchorId);
|
|
@@ -193,11 +192,7 @@ const AnchoredOverlay = ({ renderAnchor, anchorRef: externalAnchorRef, anchorId:
|
|
|
193
192
|
...shouldRenderAsPopover ? { popover: "manual" } : {},
|
|
194
193
|
...restOverlayProps,
|
|
195
194
|
...shouldRenderAsPopover ? { id: popoverId } : {},
|
|
196
|
-
ref:
|
|
197
|
-
setOverlayElement(node);
|
|
198
|
-
if (overlayProps !== null && overlayProps !== void 0 && overlayProps.ref) assignRef(overlayProps.ref, node);
|
|
199
|
-
updateOverlayRef(node);
|
|
200
|
-
},
|
|
195
|
+
ref: (node) => mergedOverlayRef(node),
|
|
201
196
|
"data-anchor-position": cssAnchorPositioning,
|
|
202
197
|
"data-side": cssAnchorPositioning ? side : position === null || position === void 0 ? void 0 : position.anchorSide,
|
|
203
198
|
children: [showXIcon ? /* @__PURE__ */ jsx("div", {
|
|
@@ -268,9 +263,5 @@ function getCSSAnchorPositionTryFallbacks(side, strategy) {
|
|
|
268
263
|
default: return;
|
|
269
264
|
}
|
|
270
265
|
}
|
|
271
|
-
function assignRef(ref, value) {
|
|
272
|
-
if (typeof ref === "function") ref(value);
|
|
273
|
-
else if (ref) ref.current = value;
|
|
274
|
-
}
|
|
275
266
|
AnchoredOverlay.displayName = "AnchoredOverlay";
|
|
276
267
|
export { AnchoredOverlay };
|
|
@@ -2,14 +2,12 @@ import { c } from "../utils/react-compiler-runtime.js";
|
|
|
2
2
|
import ButtonGroup_module_css_default from "./ButtonGroup.module.css.js";
|
|
3
3
|
import { FocusKeys, useFocusZone } from "../hooks/useFocusZone.js";
|
|
4
4
|
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
5
|
-
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
6
|
-
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
7
5
|
import React, { useRef } from "react";
|
|
8
6
|
import { jsx } from "react/jsx-runtime";
|
|
9
7
|
import { clsx } from "clsx";
|
|
10
8
|
// src/ButtonGroup/ButtonGroup.tsx
|
|
11
9
|
const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forwardRef) {
|
|
12
|
-
const $ = c(
|
|
10
|
+
const $ = c(19);
|
|
13
11
|
let children;
|
|
14
12
|
let className;
|
|
15
13
|
let rest;
|
|
@@ -31,12 +29,8 @@ const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forw
|
|
|
31
29
|
t1 = $[5];
|
|
32
30
|
}
|
|
33
31
|
const BaseComponent = t1 === void 0 ? "div" : t1;
|
|
34
|
-
const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
|
|
35
32
|
const buttonRef = useRef(null);
|
|
36
33
|
const mergedRef = useMergedRefs(buttonRef, forwardRef);
|
|
37
|
-
const providedOrCreatedRef = useProvidedRefOrCreate(forwardRef);
|
|
38
|
-
const readRef = mergedRefEnabled ? buttonRef : providedOrCreatedRef;
|
|
39
|
-
const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
|
|
40
34
|
let t2;
|
|
41
35
|
if ($[6] !== children) {
|
|
42
36
|
t2 = React.Children.map(children, _temp);
|
|
@@ -46,42 +40,41 @@ const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forw
|
|
|
46
40
|
const buttons = t2;
|
|
47
41
|
const t3 = role !== "toolbar";
|
|
48
42
|
let t4;
|
|
49
|
-
if ($[8] !==
|
|
43
|
+
if ($[8] !== t3) {
|
|
50
44
|
t4 = {
|
|
51
|
-
containerRef:
|
|
45
|
+
containerRef: buttonRef,
|
|
52
46
|
disabled: t3,
|
|
53
47
|
bindKeys: FocusKeys.ArrowHorizontal,
|
|
54
48
|
focusOutBehavior: "wrap"
|
|
55
49
|
};
|
|
56
|
-
$[8] =
|
|
57
|
-
$[9] =
|
|
58
|
-
|
|
59
|
-
} else t4 = $[10];
|
|
50
|
+
$[8] = t3;
|
|
51
|
+
$[9] = t4;
|
|
52
|
+
} else t4 = $[9];
|
|
60
53
|
useFocusZone(t4);
|
|
61
54
|
let t5;
|
|
62
|
-
if ($[
|
|
55
|
+
if ($[10] !== className) {
|
|
63
56
|
t5 = clsx(className, ButtonGroup_module_css_default.ButtonGroup);
|
|
64
|
-
$[
|
|
65
|
-
$[
|
|
66
|
-
} else t5 = $[
|
|
57
|
+
$[10] = className;
|
|
58
|
+
$[11] = t5;
|
|
59
|
+
} else t5 = $[11];
|
|
67
60
|
let t6;
|
|
68
|
-
if ($[
|
|
61
|
+
if ($[12] !== BaseComponent || $[13] !== buttons || $[14] !== mergedRef || $[15] !== rest || $[16] !== role || $[17] !== t5) {
|
|
69
62
|
t6 = /* @__PURE__ */ jsx(BaseComponent, {
|
|
70
|
-
ref:
|
|
63
|
+
ref: mergedRef,
|
|
71
64
|
className: t5,
|
|
72
65
|
role,
|
|
73
66
|
...rest,
|
|
74
67
|
"data-component": "ButtonGroup",
|
|
75
68
|
children: buttons
|
|
76
69
|
});
|
|
77
|
-
$[
|
|
78
|
-
$[
|
|
79
|
-
$[
|
|
80
|
-
$[
|
|
81
|
-
$[
|
|
82
|
-
$[
|
|
83
|
-
$[
|
|
84
|
-
} else t6 = $[
|
|
70
|
+
$[12] = BaseComponent;
|
|
71
|
+
$[13] = buttons;
|
|
72
|
+
$[14] = mergedRef;
|
|
73
|
+
$[15] = rest;
|
|
74
|
+
$[16] = role;
|
|
75
|
+
$[17] = t5;
|
|
76
|
+
$[18] = t6;
|
|
77
|
+
} else t6 = $[18];
|
|
85
78
|
return t6;
|
|
86
79
|
});
|
|
87
80
|
ButtonGroup.displayName = "ButtonGroup";
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { c } from "../utils/react-compiler-runtime.js";
|
|
2
2
|
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
3
|
-
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
4
|
-
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
5
3
|
import useIsomorphicLayoutEffect from "../utils/useIsomorphicLayoutEffect.js";
|
|
6
4
|
import { CheckboxGroupContext } from "../CheckboxGroup/CheckboxGroupContext.js";
|
|
7
5
|
import Checkbox_module_css_default from "./Checkbox.module.css.js";
|
|
@@ -14,7 +12,7 @@ import { clsx } from "clsx";
|
|
|
14
12
|
* An accessible, native checkbox component
|
|
15
13
|
*/
|
|
16
14
|
const Checkbox = /*#__PURE__*/ React.forwardRef((t0, ref) => {
|
|
17
|
-
const $ = c(
|
|
15
|
+
const $ = c(40);
|
|
18
16
|
let checked;
|
|
19
17
|
let className;
|
|
20
18
|
let dataComponent;
|
|
@@ -53,39 +51,34 @@ const Checkbox = /*#__PURE__*/ React.forwardRef((t0, ref) => {
|
|
|
53
51
|
validationStatus = $[10];
|
|
54
52
|
value = $[11];
|
|
55
53
|
}
|
|
56
|
-
const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
|
|
57
54
|
const checkboxRef = useRef(null);
|
|
58
55
|
const mergedRef = useMergedRefs(checkboxRef, ref);
|
|
59
|
-
const providedOrCreatedRef = useProvidedRefOrCreate(ref);
|
|
60
|
-
const readRef = mergedRefEnabled ? checkboxRef : providedOrCreatedRef;
|
|
61
|
-
const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
|
|
62
56
|
const checkboxGroupContext = useContext(CheckboxGroupContext);
|
|
63
57
|
let t1;
|
|
64
|
-
if ($[12] !== checkboxGroupContext || $[13] !== indeterminate || $[14] !== onChange
|
|
58
|
+
if ($[12] !== checkboxGroupContext || $[13] !== indeterminate || $[14] !== onChange) {
|
|
65
59
|
t1 = (e) => {
|
|
66
60
|
checkboxGroupContext.onChange && checkboxGroupContext.onChange(e);
|
|
67
61
|
onChange && onChange(e);
|
|
68
|
-
if (indeterminate &&
|
|
69
|
-
|
|
70
|
-
|
|
62
|
+
if (indeterminate && checkboxRef.current) {
|
|
63
|
+
checkboxRef.current.indeterminate = true;
|
|
64
|
+
checkboxRef.current.setAttribute("aria-checked", "mixed");
|
|
71
65
|
}
|
|
72
66
|
};
|
|
73
67
|
$[12] = checkboxGroupContext;
|
|
74
68
|
$[13] = indeterminate;
|
|
75
69
|
$[14] = onChange;
|
|
76
|
-
$[15] =
|
|
77
|
-
|
|
78
|
-
} else t1 = $[16];
|
|
70
|
+
$[15] = t1;
|
|
71
|
+
} else t1 = $[15];
|
|
79
72
|
const handleOnChange = t1;
|
|
80
73
|
const t2 = indeterminate ? false : checked;
|
|
81
74
|
const t3 = required ? "true" : "false";
|
|
82
75
|
const t4 = validationStatus === "error" ? "true" : "false";
|
|
83
76
|
let t5;
|
|
84
|
-
if ($[
|
|
77
|
+
if ($[16] !== defaultChecked || $[17] !== disabled || $[18] !== handleOnChange || $[19] !== mergedRef || $[20] !== required || $[21] !== rest || $[22] !== t2 || $[23] !== t3 || $[24] !== t4 || $[25] !== value) {
|
|
85
78
|
t5 = {
|
|
86
79
|
type: "checkbox",
|
|
87
80
|
disabled,
|
|
88
|
-
ref:
|
|
81
|
+
ref: mergedRef,
|
|
89
82
|
checked: t2,
|
|
90
83
|
defaultChecked,
|
|
91
84
|
required,
|
|
@@ -96,73 +89,66 @@ const Checkbox = /*#__PURE__*/ React.forwardRef((t0, ref) => {
|
|
|
96
89
|
name: value,
|
|
97
90
|
...rest
|
|
98
91
|
};
|
|
99
|
-
$[
|
|
100
|
-
$[
|
|
101
|
-
$[
|
|
102
|
-
$[
|
|
103
|
-
$[
|
|
104
|
-
$[
|
|
105
|
-
$[
|
|
106
|
-
$[
|
|
107
|
-
$[
|
|
108
|
-
$[
|
|
109
|
-
$[
|
|
110
|
-
} else t5 = $[
|
|
92
|
+
$[16] = defaultChecked;
|
|
93
|
+
$[17] = disabled;
|
|
94
|
+
$[18] = handleOnChange;
|
|
95
|
+
$[19] = mergedRef;
|
|
96
|
+
$[20] = required;
|
|
97
|
+
$[21] = rest;
|
|
98
|
+
$[22] = t2;
|
|
99
|
+
$[23] = t3;
|
|
100
|
+
$[24] = t4;
|
|
101
|
+
$[25] = value;
|
|
102
|
+
$[26] = t5;
|
|
103
|
+
} else t5 = $[26];
|
|
111
104
|
const inputProps = t5;
|
|
112
105
|
let t6;
|
|
113
|
-
if ($[
|
|
106
|
+
if ($[27] !== indeterminate) {
|
|
114
107
|
t6 = () => {
|
|
115
|
-
if (
|
|
108
|
+
if (checkboxRef.current) checkboxRef.current.indeterminate = indeterminate || false;
|
|
116
109
|
};
|
|
117
|
-
$[
|
|
118
|
-
$[
|
|
119
|
-
|
|
120
|
-
} else t6 = $[30];
|
|
110
|
+
$[27] = indeterminate;
|
|
111
|
+
$[28] = t6;
|
|
112
|
+
} else t6 = $[28];
|
|
121
113
|
let t7;
|
|
122
|
-
if ($[
|
|
123
|
-
t7 = [
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
$[31] = checked;
|
|
129
|
-
$[32] = indeterminate;
|
|
130
|
-
$[33] = readRef;
|
|
131
|
-
$[34] = t7;
|
|
132
|
-
} else t7 = $[34];
|
|
114
|
+
if ($[29] !== checked || $[30] !== indeterminate) {
|
|
115
|
+
t7 = [indeterminate, checked];
|
|
116
|
+
$[29] = checked;
|
|
117
|
+
$[30] = indeterminate;
|
|
118
|
+
$[31] = t7;
|
|
119
|
+
} else t7 = $[31];
|
|
133
120
|
useIsomorphicLayoutEffect(t6, t7);
|
|
134
121
|
let t8;
|
|
135
|
-
if ($[
|
|
122
|
+
if ($[32] !== indeterminate) {
|
|
136
123
|
t8 = () => {
|
|
137
|
-
const { current: checkbox } =
|
|
124
|
+
const { current: checkbox } = checkboxRef;
|
|
138
125
|
if (!checkbox) return;
|
|
139
126
|
if (indeterminate) checkbox.setAttribute("aria-checked", "mixed");
|
|
140
127
|
else checkbox.setAttribute("aria-checked", checkbox.checked ? "true" : "false");
|
|
141
128
|
};
|
|
142
|
-
$[
|
|
143
|
-
$[
|
|
144
|
-
|
|
145
|
-
} else t8 = $[37];
|
|
129
|
+
$[32] = indeterminate;
|
|
130
|
+
$[33] = t8;
|
|
131
|
+
} else t8 = $[33];
|
|
146
132
|
useEffect(t8);
|
|
147
133
|
const t9 = dataComponent !== null && dataComponent !== void 0 ? dataComponent : "Checkbox";
|
|
148
134
|
let t10;
|
|
149
|
-
if ($[
|
|
135
|
+
if ($[34] !== className) {
|
|
150
136
|
t10 = clsx(className, shared_module_css_default.Input, Checkbox_module_css_default.Checkbox);
|
|
151
|
-
$[
|
|
152
|
-
$[
|
|
153
|
-
} else t10 = $[
|
|
137
|
+
$[34] = className;
|
|
138
|
+
$[35] = t10;
|
|
139
|
+
} else t10 = $[35];
|
|
154
140
|
let t11;
|
|
155
|
-
if ($[
|
|
141
|
+
if ($[36] !== inputProps || $[37] !== t10 || $[38] !== t9) {
|
|
156
142
|
t11 = /* @__PURE__ */ jsx("input", {
|
|
157
143
|
...inputProps,
|
|
158
144
|
"data-component": t9,
|
|
159
145
|
className: t10
|
|
160
146
|
});
|
|
161
|
-
$[
|
|
162
|
-
$[
|
|
163
|
-
$[
|
|
164
|
-
$[
|
|
165
|
-
} else t11 = $[
|
|
147
|
+
$[36] = inputProps;
|
|
148
|
+
$[37] = t10;
|
|
149
|
+
$[38] = t9;
|
|
150
|
+
$[39] = t11;
|
|
151
|
+
} else t11 = $[39];
|
|
166
152
|
return t11;
|
|
167
153
|
});
|
|
168
154
|
Checkbox.displayName = "Checkbox";
|
package/dist/Dialog/Dialog.js
CHANGED
|
@@ -2,8 +2,6 @@ import { ButtonComponent } from "../Button/Button.js";
|
|
|
2
2
|
import { IconButton } from "../Button/IconButton.js";
|
|
3
3
|
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
4
4
|
import { useOnEscapePress } from "../hooks/useOnEscapePress.js";
|
|
5
|
-
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
6
|
-
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
7
5
|
import { useFocusTrap } from "../hooks/useFocusTrap.js";
|
|
8
6
|
import { useFocusZone } from "../hooks/useFocusZone.js";
|
|
9
7
|
import Portal_default from "../Portal/index.js";
|
|
@@ -244,28 +242,24 @@ const Footer = /*#__PURE__*/ React.forwardRef(function Footer({ className, ...re
|
|
|
244
242
|
Footer.displayName = "Dialog.Footer";
|
|
245
243
|
const Buttons = ({ buttons }) => {
|
|
246
244
|
var _buttons$find;
|
|
247
|
-
const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
|
|
248
245
|
const providedButtonRef = (_buttons$find = buttons.find((button) => button.autoFocus)) === null || _buttons$find === void 0 ? void 0 : _buttons$find.ref;
|
|
249
246
|
const autoFocusRef = useRef(null);
|
|
250
247
|
const mergedRef = useMergedRefs(autoFocusRef, providedButtonRef);
|
|
251
|
-
const providedOrCreatedRef = useProvidedRefOrCreate(providedButtonRef);
|
|
252
|
-
const readRef = mergedRefEnabled ? autoFocusRef : providedOrCreatedRef;
|
|
253
|
-
const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
|
|
254
248
|
let autoFocusCount = 0;
|
|
255
249
|
const [hasRendered, setHasRendered] = useState(0);
|
|
256
250
|
useEffect(() => {
|
|
257
251
|
if (hasRendered === 1) {
|
|
258
|
-
var
|
|
259
|
-
(
|
|
252
|
+
var _autoFocusRef$current;
|
|
253
|
+
(_autoFocusRef$current = autoFocusRef.current) === null || _autoFocusRef$current === void 0 || _autoFocusRef$current.focus();
|
|
260
254
|
} else setHasRendered(hasRendered + 1);
|
|
261
|
-
}, [
|
|
255
|
+
}, [hasRendered]);
|
|
262
256
|
return /* @__PURE__ */ jsx(Fragment$1, { children: buttons.map((dialogButtonProps, index) => {
|
|
263
257
|
const { content, buttonType = "default", autoFocus = false, ...buttonProps } = dialogButtonProps;
|
|
264
258
|
return /* @__PURE__ */ jsx(ButtonComponent, {
|
|
265
259
|
"data-component": "Dialog.FooterButton",
|
|
266
260
|
...buttonProps,
|
|
267
261
|
variant: buttonType === "normal" ? "default" : buttonType,
|
|
268
|
-
ref: autoFocus && autoFocusCount === 0 ? (autoFocusCount++,
|
|
262
|
+
ref: autoFocus && autoFocusCount === 0 ? (autoFocusCount++, mergedRef) : null,
|
|
269
263
|
children: content
|
|
270
264
|
}, index);
|
|
271
265
|
}) });
|
|
@@ -9,7 +9,6 @@ const DefaultFeatureFlags = FeatureFlagScope.create({
|
|
|
9
9
|
primer_react_action_list_group_heading_trailing_action: false,
|
|
10
10
|
primer_react_action_list_item_gap: false,
|
|
11
11
|
primer_react_timeline_list_semantics: false,
|
|
12
|
-
primer_react_merged_forwarded_refs: false,
|
|
13
12
|
primer_react_button_loading_disabled_styles: false,
|
|
14
13
|
primer_react_blankslate_compact_default: false
|
|
15
14
|
});
|