@primer/react 0.0.0-20261113221055 → 0.0.0-20261113222343
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-20261113222343
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
- [#8749](https://github.com/primer/react/pull/8749) [`ba03cb6`](https://github.com/primer/react/commit/ba03cb6524b86b59b997896b31ca7bcd7b8465fb) Thanks [@adierkens](https://github.com/adierkens)! - ActionMenu, AnchoredOverlay, Tooltip: Add experimental element-based trigger composition through `@primer/react/experimental`, with automatically merged trigger props and refs.
|
|
10
10
|
|
|
11
|
-
- [#8749](https://github.com/primer/react/pull/8749) [`515add0`](https://github.com/primer/react/commit/515add0d06954240af65c1a065e7499961e5fbb7) Thanks [@adierkens](https://github.com/adierkens)! - Tooltip: Add experimental controlled and uncontrolled visibility
|
|
11
|
+
- [#8749](https://github.com/primer/react/pull/8749) [`515add0`](https://github.com/primer/react/commit/515add0d06954240af65c1a065e7499961e5fbb7) Thanks [@adierkens](https://github.com/adierkens)! - Tooltip: Add experimental tooltip-only suppression, controlled and uncontrolled visibility, and separate popup attributes. HTML attributes on the experimental component consistently configure its trigger.
|
|
12
12
|
|
|
13
13
|
- [#8692](https://github.com/primer/react/pull/8692) [`918d7cf`](https://github.com/primer/react/commit/918d7cf82d3884ab134e9b074e0a595198a1c033) Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - Stack: Add `balance` as a value for the `wrap` prop.
|
|
14
14
|
|
|
@@ -127,6 +127,7 @@ type AnchoredOverlayProps = AnchoredOverlayProps$1 | (Omit<AnchoredOverlayProps$
|
|
|
127
127
|
});
|
|
128
128
|
declare function AnchoredOverlay(props: React.PropsWithChildren<AnchoredOverlayProps>): React.JSX.Element;
|
|
129
129
|
type TooltipProps = Omit<TooltipProps$1, 'disabled'> & {
|
|
130
|
+
/** Suppresses the tooltip, not its trigger. Either suppression prop being true wins. */disabled?: boolean;
|
|
130
131
|
renderAnchor?: AnchorRenderer; /** HTML props for the tooltip bubble, separate from the trigger's HTML props. */
|
|
131
132
|
popupProps?: Omit<React.ComponentPropsWithoutRef<'span'>, 'children'> & {
|
|
132
133
|
popover?: 'auto' | 'manual' | '';
|
|
@@ -104,7 +104,7 @@ function AnchoredOverlay(props) {
|
|
|
104
104
|
return t1;
|
|
105
105
|
}
|
|
106
106
|
const Tooltip = /*#__PURE__*/ React.forwardRef((t0, ref) => {
|
|
107
|
-
const $ = c(
|
|
107
|
+
const $ = c(40);
|
|
108
108
|
let _privateDisableTooltip;
|
|
109
109
|
let anchorProps;
|
|
110
110
|
let children;
|
|
@@ -116,10 +116,11 @@ const Tooltip = /*#__PURE__*/ React.forwardRef((t0, ref) => {
|
|
|
116
116
|
let popupProps;
|
|
117
117
|
let renderAnchor;
|
|
118
118
|
let t1;
|
|
119
|
+
let t2;
|
|
119
120
|
let text;
|
|
120
121
|
let type;
|
|
121
122
|
if ($[0] !== t0) {
|
|
122
|
-
({renderAnchor, children, text, type, direction, delay, keybindingHint, _privateDisableTooltip, popupProps, open: controlledOpen, defaultOpen:
|
|
123
|
+
({renderAnchor, children, text, type, direction, delay, keybindingHint, disabled: t1, _privateDisableTooltip, popupProps, open: controlledOpen, defaultOpen: t2, onOpenChange, ...anchorProps} = t0);
|
|
123
124
|
$[0] = t0;
|
|
124
125
|
$[1] = _privateDisableTooltip;
|
|
125
126
|
$[2] = anchorProps;
|
|
@@ -132,8 +133,9 @@ const Tooltip = /*#__PURE__*/ React.forwardRef((t0, ref) => {
|
|
|
132
133
|
$[9] = popupProps;
|
|
133
134
|
$[10] = renderAnchor;
|
|
134
135
|
$[11] = t1;
|
|
135
|
-
$[12] =
|
|
136
|
-
$[13] =
|
|
136
|
+
$[12] = t2;
|
|
137
|
+
$[13] = text;
|
|
138
|
+
$[14] = type;
|
|
137
139
|
} else {
|
|
138
140
|
_privateDisableTooltip = $[1];
|
|
139
141
|
anchorProps = $[2];
|
|
@@ -146,27 +148,29 @@ const Tooltip = /*#__PURE__*/ React.forwardRef((t0, ref) => {
|
|
|
146
148
|
popupProps = $[9];
|
|
147
149
|
renderAnchor = $[10];
|
|
148
150
|
t1 = $[11];
|
|
149
|
-
|
|
150
|
-
|
|
151
|
+
t2 = $[12];
|
|
152
|
+
text = $[13];
|
|
153
|
+
type = $[14];
|
|
151
154
|
}
|
|
152
|
-
const
|
|
155
|
+
const disabled = t1 === void 0 ? false : t1;
|
|
156
|
+
const defaultOpen = t2 === void 0 ? false : t2;
|
|
153
157
|
renderAnchor && children != null && invariant(false, "Pass either `children` or `renderAnchor` to `Tooltip`, not both.");
|
|
154
|
-
let
|
|
155
|
-
if ($[
|
|
156
|
-
|
|
158
|
+
let t3;
|
|
159
|
+
if ($[15] !== controlledOpen || $[16] !== defaultOpen) {
|
|
160
|
+
t3 = {
|
|
157
161
|
name: "Tooltip",
|
|
158
162
|
value: controlledOpen,
|
|
159
163
|
defaultValue: defaultOpen
|
|
160
164
|
};
|
|
161
|
-
$[
|
|
162
|
-
$[
|
|
163
|
-
$[
|
|
164
|
-
} else
|
|
165
|
-
const [open, setOpen] = useControllableState(
|
|
165
|
+
$[15] = controlledOpen;
|
|
166
|
+
$[16] = defaultOpen;
|
|
167
|
+
$[17] = t3;
|
|
168
|
+
} else t3 = $[17];
|
|
169
|
+
const [open, setOpen] = useControllableState(t3);
|
|
166
170
|
const [controlled] = React.useState(controlledOpen !== void 0);
|
|
167
|
-
let
|
|
168
|
-
if ($[
|
|
169
|
-
|
|
171
|
+
let t4;
|
|
172
|
+
if ($[18] !== controlled || $[19] !== onOpenChange || $[20] !== open || $[21] !== setOpen) {
|
|
173
|
+
t4 = {
|
|
170
174
|
open,
|
|
171
175
|
controlled,
|
|
172
176
|
onOpenChange(next, details) {
|
|
@@ -176,59 +180,60 @@ const Tooltip = /*#__PURE__*/ React.forwardRef((t0, ref) => {
|
|
|
176
180
|
(_onOpenChange = onOpenChange) === null || _onOpenChange === void 0 || _onOpenChange(next, details);
|
|
177
181
|
}
|
|
178
182
|
};
|
|
179
|
-
$[
|
|
180
|
-
$[
|
|
181
|
-
$[
|
|
182
|
-
$[
|
|
183
|
-
$[
|
|
184
|
-
} else
|
|
185
|
-
const visibility =
|
|
186
|
-
let t4;
|
|
187
|
-
if ($[22] !== children || $[23] !== renderAnchor) {
|
|
188
|
-
t4 = renderAnchor !== null && renderAnchor !== void 0 ? renderAnchor : React.Children.only(children);
|
|
189
|
-
$[22] = children;
|
|
190
|
-
$[23] = renderAnchor;
|
|
191
|
-
$[24] = t4;
|
|
192
|
-
} else t4 = $[24];
|
|
193
|
-
const trigger = t4;
|
|
194
|
-
if (!/*#__PURE__*/ React.isValidElement(trigger) && typeof trigger !== "function") throw new Error("Tooltip requires a single trigger.");
|
|
183
|
+
$[18] = controlled;
|
|
184
|
+
$[19] = onOpenChange;
|
|
185
|
+
$[20] = open;
|
|
186
|
+
$[21] = setOpen;
|
|
187
|
+
$[22] = t4;
|
|
188
|
+
} else t4 = $[22];
|
|
189
|
+
const visibility = t4;
|
|
195
190
|
let t5;
|
|
196
|
-
if ($[
|
|
197
|
-
t5 =
|
|
191
|
+
if ($[23] !== children || $[24] !== renderAnchor) {
|
|
192
|
+
t5 = renderAnchor !== null && renderAnchor !== void 0 ? renderAnchor : React.Children.only(children);
|
|
193
|
+
$[23] = children;
|
|
194
|
+
$[24] = renderAnchor;
|
|
195
|
+
$[25] = t5;
|
|
196
|
+
} else t5 = $[25];
|
|
197
|
+
const trigger = t5;
|
|
198
|
+
if (!/*#__PURE__*/ React.isValidElement(trigger) && typeof trigger !== "function") throw new Error("Tooltip requires a single trigger.");
|
|
199
|
+
const t6 = disabled || _privateDisableTooltip;
|
|
200
|
+
let t7;
|
|
201
|
+
if ($[26] !== anchorProps || $[27] !== trigger) {
|
|
202
|
+
t7 = (tooltipAnchorProps) => /* @__PURE__ */ jsx(RenderAnchor, {
|
|
198
203
|
render: trigger,
|
|
199
204
|
props: mergeAnchorProps(tooltipAnchorProps, anchorProps)
|
|
200
205
|
});
|
|
201
|
-
$[
|
|
202
|
-
$[
|
|
203
|
-
$[
|
|
204
|
-
} else
|
|
205
|
-
let
|
|
206
|
-
if ($[
|
|
207
|
-
|
|
206
|
+
$[26] = anchorProps;
|
|
207
|
+
$[27] = trigger;
|
|
208
|
+
$[28] = t7;
|
|
209
|
+
} else t7 = $[28];
|
|
210
|
+
let t8;
|
|
211
|
+
if ($[29] !== delay || $[30] !== direction || $[31] !== keybindingHint || $[32] !== popupProps || $[33] !== ref || $[34] !== t6 || $[35] !== t7 || $[36] !== text || $[37] !== type || $[38] !== visibility) {
|
|
212
|
+
t8 = /* @__PURE__ */ jsx(TooltipImpl, {
|
|
208
213
|
...popupProps,
|
|
209
214
|
text,
|
|
210
215
|
type,
|
|
211
216
|
direction,
|
|
212
217
|
delay,
|
|
213
218
|
keybindingHint,
|
|
214
|
-
_privateDisableTooltip,
|
|
219
|
+
_privateDisableTooltip: t6,
|
|
215
220
|
visibility,
|
|
216
221
|
ref,
|
|
217
|
-
renderAnchor:
|
|
222
|
+
renderAnchor: t7
|
|
218
223
|
});
|
|
219
|
-
$[28] = _privateDisableTooltip;
|
|
220
224
|
$[29] = delay;
|
|
221
225
|
$[30] = direction;
|
|
222
226
|
$[31] = keybindingHint;
|
|
223
227
|
$[32] = popupProps;
|
|
224
228
|
$[33] = ref;
|
|
225
|
-
$[34] =
|
|
226
|
-
$[35] =
|
|
227
|
-
$[36] =
|
|
228
|
-
$[37] =
|
|
229
|
-
$[38] =
|
|
230
|
-
|
|
231
|
-
|
|
229
|
+
$[34] = t6;
|
|
230
|
+
$[35] = t7;
|
|
231
|
+
$[36] = text;
|
|
232
|
+
$[37] = type;
|
|
233
|
+
$[38] = visibility;
|
|
234
|
+
$[39] = t8;
|
|
235
|
+
} else t8 = $[39];
|
|
236
|
+
return t8;
|
|
232
237
|
});
|
|
233
238
|
Tooltip.displayName = "Tooltip";
|
|
234
239
|
asSlot(Tooltip, Tooltip$1);
|
package/package.json
CHANGED