@primer/react 0.0.0-20260320092003 → 0.0.0-20260320131357
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 +11 -2
- package/dist/ActionBar/ActionBar.d.ts +1 -1
- package/dist/ActionBar/index.d.ts +1 -1
- package/dist/ActionMenu/{ActionMenu-53493541.css → ActionMenu-58362ca7.css} +2 -2
- package/dist/ActionMenu/ActionMenu-58362ca7.css.map +1 -0
- package/dist/ActionMenu/ActionMenu.d.ts.map +1 -1
- package/dist/ActionMenu/ActionMenu.js +4 -0
- package/dist/ActionMenu/ActionMenu.module.css.js +1 -1
- package/dist/AnchoredOverlay/AnchoredOverlay-cb201301.css +2 -0
- package/dist/AnchoredOverlay/AnchoredOverlay-cb201301.css.map +1 -0
- package/dist/AnchoredOverlay/AnchoredOverlay.d.ts.map +1 -1
- package/dist/AnchoredOverlay/AnchoredOverlay.js +39 -2
- package/dist/AnchoredOverlay/AnchoredOverlay.module.css.js +2 -2
- package/dist/Banner/Banner.js +1 -1
- package/dist/Button/types.d.ts +1 -1
- package/dist/Button/types.d.ts.map +1 -1
- package/dist/Details/Details.js +1 -1
- package/dist/FeatureFlags/DefaultFeatureFlags.d.ts.map +1 -1
- package/dist/FeatureFlags/DefaultFeatureFlags.js +2 -1
- package/dist/Overlay/{Overlay-2e0ce8db.css → Overlay-f81a131d.css} +2 -2
- package/dist/Overlay/Overlay-f81a131d.css.map +1 -0
- package/dist/Overlay/Overlay.d.ts.map +1 -1
- package/dist/Overlay/Overlay.js +48 -23
- package/dist/Overlay/Overlay.module.css.js +1 -1
- package/dist/StateLabel/{StateLabel-cd51ae39.css → StateLabel-056eec66.css} +2 -2
- package/dist/StateLabel/StateLabel-056eec66.css.map +1 -0
- package/dist/StateLabel/StateLabel.d.ts +0 -1
- package/dist/StateLabel/StateLabel.d.ts.map +1 -1
- package/dist/StateLabel/StateLabel.js +2 -4
- package/dist/StateLabel/StateLabel.module.css.js +1 -1
- package/dist/TooltipV2/{Tooltip-fcb90d9c.css → Tooltip-dd983e5b.css} +2 -2
- package/dist/TooltipV2/Tooltip-dd983e5b.css.map +1 -0
- package/dist/TooltipV2/Tooltip.d.ts +1 -1
- package/dist/TooltipV2/Tooltip.d.ts.map +1 -1
- package/dist/TooltipV2/Tooltip.js +17 -11
- package/dist/TooltipV2/Tooltip.module.css.js +2 -2
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/useMergedRefs.d.ts +51 -0
- package/dist/hooks/useMergedRefs.d.ts.map +1 -0
- package/dist/hooks/useMergedRefs.js +86 -0
- package/dist/hooks/useProvidedRefOrCreate.d.ts +12 -0
- package/dist/hooks/useProvidedRefOrCreate.d.ts.map +1 -1
- package/dist/hooks/useProvidedRefOrCreate.js +12 -0
- package/dist/hooks/useRefObjectAsForwardedRef.d.ts +12 -0
- package/dist/hooks/useRefObjectAsForwardedRef.d.ts.map +1 -1
- package/dist/hooks/useRefObjectAsForwardedRef.js +12 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroup.d.ts.map +1 -1
- package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroup.js +17 -8
- package/generated/components.json +5 -9
- package/generated/hooks.json +22 -0
- package/package.json +1 -1
- package/dist/ActionMenu/ActionMenu-53493541.css.map +0 -1
- package/dist/AnchoredOverlay/AnchoredOverlay-0f6f45b5.css +0 -2
- package/dist/AnchoredOverlay/AnchoredOverlay-0f6f45b5.css.map +0 -1
- package/dist/Overlay/Overlay-2e0ce8db.css.map +0 -1
- package/dist/StateLabel/StateLabel-cd51ae39.css.map +0 -1
- package/dist/TooltipV2/Tooltip-fcb90d9c.css.map +0 -1
- package/dist/internal/hooks/useMergedRefs.d.ts +0 -2
- package/dist/internal/hooks/useMergedRefs.d.ts.map +0 -1
- package/dist/internal/hooks/useMergedRefs.js +0 -16
|
@@ -76,6 +76,7 @@ const isInteractive = element => {
|
|
|
76
76
|
return interactiveElements.some(selector => element.matches(selector)) || element.hasAttribute('role') && element.getAttribute('role') === 'button';
|
|
77
77
|
};
|
|
78
78
|
const TooltipContext = /*#__PURE__*/React.createContext({});
|
|
79
|
+
const emptyKeybindingHints = [];
|
|
79
80
|
const Tooltip = /*#__PURE__*/React.forwardRef(({
|
|
80
81
|
direction = 's',
|
|
81
82
|
text,
|
|
@@ -83,7 +84,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef(({
|
|
|
83
84
|
children,
|
|
84
85
|
id,
|
|
85
86
|
className,
|
|
86
|
-
keybindingHint,
|
|
87
|
+
keybindingHint = emptyKeybindingHints,
|
|
87
88
|
delay = 'short',
|
|
88
89
|
_privateDisableTooltip = false,
|
|
89
90
|
...rest
|
|
@@ -196,6 +197,9 @@ const Tooltip = /*#__PURE__*/React.forwardRef(({
|
|
|
196
197
|
}, [isPopoverOpen]);
|
|
197
198
|
const isMacOS = useIsMacOS();
|
|
198
199
|
const hasAriaLabel = 'aria-label' in rest;
|
|
200
|
+
|
|
201
|
+
// Normalize keybindingHint to an array for uniform rendering
|
|
202
|
+
const keybindingHints = Array.isArray(keybindingHint) ? keybindingHint : [keybindingHint];
|
|
199
203
|
return /*#__PURE__*/jsx(TooltipContext.Provider, {
|
|
200
204
|
value: value,
|
|
201
205
|
children: /*#__PURE__*/jsxs(Fragment, {
|
|
@@ -283,22 +287,24 @@ const Tooltip = /*#__PURE__*/React.forwardRef(({
|
|
|
283
287
|
onMouseLeave: closeTooltip
|
|
284
288
|
// If there is an aria-label prop, always assign the ID to the parent so the accessible label can be overridden
|
|
285
289
|
,
|
|
286
|
-
id: hasAriaLabel ||
|
|
287
|
-
children:
|
|
290
|
+
id: hasAriaLabel || keybindingHints.length === 0 ? tooltipId : undefined,
|
|
291
|
+
children: keybindingHints.length > 0 ? /*#__PURE__*/jsxs(Fragment, {
|
|
288
292
|
children: [/*#__PURE__*/jsxs("span", {
|
|
289
293
|
id: hasAriaLabel ? undefined : tooltipId,
|
|
290
294
|
children: [text, /*#__PURE__*/jsxs(VisuallyHidden, {
|
|
291
|
-
children: ["(", getAccessibleKeybindingHintString(
|
|
295
|
+
children: ["(", keybindingHints.map(hint => getAccessibleKeybindingHintString(hint, isMacOS)).join(' or '), ")"]
|
|
292
296
|
})]
|
|
293
297
|
}), /*#__PURE__*/jsx("span", {
|
|
294
|
-
className: clsx(classes.KeybindingHintContainer, text && classes.HasTextBefore),
|
|
298
|
+
className: clsx(classes.KeybindingHintContainer, text && classes.HasTextBefore, keybindingHints.length > 1 && classes.HasMultipleHints),
|
|
295
299
|
"aria-hidden": true,
|
|
296
|
-
children: /*#__PURE__*/
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
300
|
+
children: keybindingHints.map((hint, i) => /*#__PURE__*/jsxs(React.Fragment, {
|
|
301
|
+
children: [i > 0 && ' or ', /*#__PURE__*/jsx(KeybindingHint, {
|
|
302
|
+
keys: hint,
|
|
303
|
+
format: "condensed",
|
|
304
|
+
variant: "onEmphasis",
|
|
305
|
+
size: "small"
|
|
306
|
+
})]
|
|
307
|
+
}, `${i}-${hint}`))
|
|
302
308
|
})]
|
|
303
309
|
}) : text
|
|
304
310
|
})]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import './Tooltip-
|
|
1
|
+
import './Tooltip-dd983e5b.css';
|
|
2
2
|
|
|
3
|
-
var classes = {"Tooltip":"prc-TooltipV2-Tooltip-tLeuB","tooltip-appear":"prc-TooltipV2-tooltip-appear-xyBco","KeybindingHintContainer":"prc-TooltipV2-KeybindingHintContainer-Ymj-3","HasTextBefore":"prc-TooltipV2-HasTextBefore-fdOXj"};
|
|
3
|
+
var classes = {"Tooltip":"prc-TooltipV2-Tooltip-tLeuB","tooltip-appear":"prc-TooltipV2-tooltip-appear-xyBco","KeybindingHintContainer":"prc-TooltipV2-KeybindingHintContainer-Ymj-3","HasTextBefore":"prc-TooltipV2-HasTextBefore-fdOXj","HasMultipleHints":"prc-TooltipV2-HasMultipleHints-9VYeg"};
|
|
4
4
|
|
|
5
5
|
export { classes as default };
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -16,4 +16,5 @@ export { useMnemonics } from './useMnemonics';
|
|
|
16
16
|
export { useRefObjectAsForwardedRef } from './useRefObjectAsForwardedRef';
|
|
17
17
|
export { useId } from './useId';
|
|
18
18
|
export { useIsMacOS } from './useIsMacOS';
|
|
19
|
+
export { useMergedRefs } from './useMergedRefs';
|
|
19
20
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAA;AACrD,YAAY,EAAC,yBAAyB,EAAE,iBAAiB,EAAC,MAAM,qBAAqB,CAAA;AACrF,OAAO,EAAC,sBAAsB,EAAC,MAAM,0BAA0B,CAAA;AAC/D,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAA;AACnD,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAA;AAC3D,YAAY,EAAC,4BAA4B,EAAC,MAAM,wBAAwB,CAAA;AACxE,YAAY,EAAC,4BAA4B,EAAC,MAAM,uBAAuB,CAAA;AACvE,OAAO,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAA;AACvC,YAAY,EAAC,kBAAkB,EAAC,MAAM,cAAc,CAAA;AACpD,OAAO,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAC,wBAAwB,EAAC,MAAM,4BAA4B,CAAA;AACnE,OAAO,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAC,yBAAyB,EAA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U,EAAC,MAAM,cAAc,CAAA;AACvC,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { ForwardedRef, Ref as StandardRef } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Combine two refs of matching type (typically an external or forwarded ref and an internal `useRef` object or
|
|
4
|
+
* callback ref).
|
|
5
|
+
*
|
|
6
|
+
* If you need to combine more than two refs (what are you doing?) just nest the hook:
|
|
7
|
+
* `useMergedRefs(refA, useMergedRefs(refB, refC))`
|
|
8
|
+
*
|
|
9
|
+
* @param refA First ref to merge. The order is not important.
|
|
10
|
+
* @param refB Second ref to merge. The order is not important.
|
|
11
|
+
* @returns A new ref which must be passed to the relevant child component. **Important**: do not pass `refA` or
|
|
12
|
+
* `refB` to the component!
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* // React 18
|
|
16
|
+
* const Example = forwardRef<HTMLButtonElement, {}>((props, forwardedRef) => {
|
|
17
|
+
* const ref = useRef<HTMLButtonElement>(null)
|
|
18
|
+
* const combinedRef = useMergedRefs(forwardedRef, ref)
|
|
19
|
+
*
|
|
20
|
+
* return <button ref={combinedRef} />
|
|
21
|
+
* })
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* // React 19
|
|
25
|
+
* const Example = ({ref: externalRef}: {ref?: Ref<HTMLButtonElement>}) => {
|
|
26
|
+
* const ref = useRef<HTMLButtonElement>(null)
|
|
27
|
+
* const combinedRef = useMergedRefs(externalRef, ref)
|
|
28
|
+
*
|
|
29
|
+
* return <button ref={combinedRef} />
|
|
30
|
+
* }
|
|
31
|
+
*/
|
|
32
|
+
export declare function useMergedRefs<T>(refA: Ref<T | null>, refB: Ref<T | null>): (value: T | null) => () => void;
|
|
33
|
+
type CleanupFunction = () => void;
|
|
34
|
+
/**
|
|
35
|
+
* React 19 supports callback refs that can return a cleanup function. If a cleanup function is returned, the
|
|
36
|
+
* cleanup is called on unmount **instead** of setting the ref to null.
|
|
37
|
+
*/
|
|
38
|
+
type React19RefCallback<T> = {
|
|
39
|
+
bivarianceHack(instance: T): void | CleanupFunction;
|
|
40
|
+
}['bivarianceHack'];
|
|
41
|
+
/**
|
|
42
|
+
* Supporting React 18 and 19 while alleviating the need for any hacks or casts in consumers:
|
|
43
|
+
* - `ForwardedRef` from the React 18 `forwardRef` HOC
|
|
44
|
+
* - `React19RefCallback` for callback refs that can return a cleanup function (this is included in `Ref` in React 19
|
|
45
|
+
* but not in 18)
|
|
46
|
+
* - `Ref` for standard refs from `useRef` or passed in as React 19 prop
|
|
47
|
+
* - `undefined` to allow for easy use of optional `ref` props in React 19
|
|
48
|
+
*/
|
|
49
|
+
type Ref<T> = ForwardedRef<T> | React19RefCallback<T> | StandardRef<T> | undefined;
|
|
50
|
+
export {};
|
|
51
|
+
//# sourceMappingURL=useMergedRefs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMergedRefs.d.ts","sourceRoot":"","sources":["../../src/hooks/useMergedRefs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAE,GAAG,IAAI,WAAW,EAAmB,MAAM,OAAO,CAAA;AAG7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,WAE7D,CAAC,GAAG,IAAI,gBAiBnB;AAED,KAAK,eAAe,GAAG,MAAM,IAAI,CAAA;AAEjC;;;GAGG;AAEH,KAAK,kBAAkB,CAAC,CAAC,IAAI;IAC3B,cAAc,CAAC,QAAQ,EAAE,CAAC,GAAG,IAAI,GAAG,eAAe,CAAA;CACpD,CAAC,gBAAgB,CAAC,CAAA;AAEnB;;;;;;;GAOG;AACH,KAAK,GAAG,CAAC,CAAC,IAAI,YAAY,CAAC,CAAC,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { c } from 'react-compiler-runtime';
|
|
2
|
+
import 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Combine two refs of matching type (typically an external or forwarded ref and an internal `useRef` object or
|
|
6
|
+
* callback ref).
|
|
7
|
+
*
|
|
8
|
+
* If you need to combine more than two refs (what are you doing?) just nest the hook:
|
|
9
|
+
* `useMergedRefs(refA, useMergedRefs(refB, refC))`
|
|
10
|
+
*
|
|
11
|
+
* @param refA First ref to merge. The order is not important.
|
|
12
|
+
* @param refB Second ref to merge. The order is not important.
|
|
13
|
+
* @returns A new ref which must be passed to the relevant child component. **Important**: do not pass `refA` or
|
|
14
|
+
* `refB` to the component!
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // React 18
|
|
18
|
+
* const Example = forwardRef<HTMLButtonElement, {}>((props, forwardedRef) => {
|
|
19
|
+
* const ref = useRef<HTMLButtonElement>(null)
|
|
20
|
+
* const combinedRef = useMergedRefs(forwardedRef, ref)
|
|
21
|
+
*
|
|
22
|
+
* return <button ref={combinedRef} />
|
|
23
|
+
* })
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* // React 19
|
|
27
|
+
* const Example = ({ref: externalRef}: {ref?: Ref<HTMLButtonElement>}) => {
|
|
28
|
+
* const ref = useRef<HTMLButtonElement>(null)
|
|
29
|
+
* const combinedRef = useMergedRefs(externalRef, ref)
|
|
30
|
+
*
|
|
31
|
+
* return <button ref={combinedRef} />
|
|
32
|
+
* }
|
|
33
|
+
*/
|
|
34
|
+
function useMergedRefs(refA, refB) {
|
|
35
|
+
const $ = c(3);
|
|
36
|
+
let t0;
|
|
37
|
+
if ($[0] !== refA || $[1] !== refB) {
|
|
38
|
+
t0 = value => {
|
|
39
|
+
const cleanupA = setRef(refA, value);
|
|
40
|
+
const cleanupB = setRef(refB, value);
|
|
41
|
+
return () => {
|
|
42
|
+
if (cleanupA) {
|
|
43
|
+
cleanupA();
|
|
44
|
+
} else {
|
|
45
|
+
setRef(refA, null);
|
|
46
|
+
}
|
|
47
|
+
if (cleanupB) {
|
|
48
|
+
cleanupB();
|
|
49
|
+
} else {
|
|
50
|
+
setRef(refB, null);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
$[0] = refA;
|
|
55
|
+
$[1] = refB;
|
|
56
|
+
$[2] = t0;
|
|
57
|
+
} else {
|
|
58
|
+
t0 = $[2];
|
|
59
|
+
}
|
|
60
|
+
return t0;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* React 19 supports callback refs that can return a cleanup function. If a cleanup function is returned, the
|
|
65
|
+
* cleanup is called on unmount **instead** of setting the ref to null.
|
|
66
|
+
*/
|
|
67
|
+
// bivarianceHack copied from React types
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Supporting React 18 and 19 while alleviating the need for any hacks or casts in consumers:
|
|
71
|
+
* - `ForwardedRef` from the React 18 `forwardRef` HOC
|
|
72
|
+
* - `React19RefCallback` for callback refs that can return a cleanup function (this is included in `Ref` in React 19
|
|
73
|
+
* but not in 18)
|
|
74
|
+
* - `Ref` for standard refs from `useRef` or passed in as React 19 prop
|
|
75
|
+
* - `undefined` to allow for easy use of optional `ref` props in React 19
|
|
76
|
+
*/
|
|
77
|
+
|
|
78
|
+
function setRef(ref, value) {
|
|
79
|
+
if (typeof ref === 'function') {
|
|
80
|
+
return ref(value);
|
|
81
|
+
} else if (ref) {
|
|
82
|
+
ref.current = value;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export { useMergedRefs };
|
|
@@ -6,6 +6,18 @@ import React from 'react';
|
|
|
6
6
|
* This hook aims to encapsulate that logic, so the consumer doesn't need to be concerned with violating `rules-of-hooks`.
|
|
7
7
|
* @param providedRef The ref to use - if undefined, will use the ref from a call to React.useRef
|
|
8
8
|
* @type TRef The type of the RefObject which should be created.
|
|
9
|
+
*
|
|
10
|
+
* @deprecated This hook is incompatible with forwarded callback refs. Prefer `useMergedRefs` with an internally
|
|
11
|
+
* created ref instead.
|
|
12
|
+
*
|
|
13
|
+
* ```diff
|
|
14
|
+
* - const ref = useProvidedRefOrCreate(forwardedRef as RefObject<...>)
|
|
15
|
+
* + const ref = useRef(null)
|
|
16
|
+
* + const mergedRef = useMergedRefs(forwardedRef, ref)
|
|
17
|
+
*
|
|
18
|
+
* - return <div ref={ref} />
|
|
19
|
+
* + return <div ref={mergedRef} />
|
|
20
|
+
* ```
|
|
9
21
|
*/
|
|
10
22
|
export declare function useProvidedRefOrCreate<TRef>(providedRef?: React.RefObject<TRef | null>): React.RefObject<TRef | null>;
|
|
11
23
|
//# sourceMappingURL=useProvidedRefOrCreate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useProvidedRefOrCreate.d.ts","sourceRoot":"","sources":["../../src/hooks/useProvidedRefOrCreate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB
|
|
1
|
+
{"version":3,"file":"useProvidedRefOrCreate.d.ts","sourceRoot":"","sources":["../../src/hooks/useProvidedRefOrCreate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,CAGrH"}
|
|
@@ -7,6 +7,18 @@ import React from 'react';
|
|
|
7
7
|
* This hook aims to encapsulate that logic, so the consumer doesn't need to be concerned with violating `rules-of-hooks`.
|
|
8
8
|
* @param providedRef The ref to use - if undefined, will use the ref from a call to React.useRef
|
|
9
9
|
* @type TRef The type of the RefObject which should be created.
|
|
10
|
+
*
|
|
11
|
+
* @deprecated This hook is incompatible with forwarded callback refs. Prefer `useMergedRefs` with an internally
|
|
12
|
+
* created ref instead.
|
|
13
|
+
*
|
|
14
|
+
* ```diff
|
|
15
|
+
* - const ref = useProvidedRefOrCreate(forwardedRef as RefObject<...>)
|
|
16
|
+
* + const ref = useRef(null)
|
|
17
|
+
* + const mergedRef = useMergedRefs(forwardedRef, ref)
|
|
18
|
+
*
|
|
19
|
+
* - return <div ref={ref} />
|
|
20
|
+
* + return <div ref={mergedRef} />
|
|
21
|
+
* ```
|
|
10
22
|
*/
|
|
11
23
|
function useProvidedRefOrCreate(providedRef) {
|
|
12
24
|
const createdRef = React.useRef(null);
|
|
@@ -5,6 +5,18 @@ import type { ForwardedRef, RefObject } from 'react';
|
|
|
5
5
|
* instance with `.current`.
|
|
6
6
|
*
|
|
7
7
|
* **NOTE**: The `refObject` should be passed to the underlying element, NOT the `forwardedRef`.
|
|
8
|
+
*
|
|
9
|
+
* @deprecated Migrate to `useMergedRefs`. It's safer, faster, and easier to use:
|
|
10
|
+
*
|
|
11
|
+
* ```diff
|
|
12
|
+
* const ref = useRef(null)
|
|
13
|
+
*
|
|
14
|
+
* - useRefObjectAsForwardedRef(forwardedRef, ref)
|
|
15
|
+
* + const mergedRef = useMergedRefs(forwardedRef, ref)
|
|
16
|
+
*
|
|
17
|
+
* - return <div ref={ref} />
|
|
18
|
+
* + return <div ref={mergedRef} />
|
|
19
|
+
* ```
|
|
8
20
|
*/
|
|
9
21
|
export declare function useRefObjectAsForwardedRef<T>(forwardedRef: ForwardedRef<T>, refObject: RefObject<T | null>): void;
|
|
10
22
|
//# sourceMappingURL=useRefObjectAsForwardedRef.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRefObjectAsForwardedRef.d.ts","sourceRoot":"","sources":["../../src/hooks/useRefObjectAsForwardedRef.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAE,SAAS,EAAC,MAAM,OAAO,CAAA;AAGlD
|
|
1
|
+
{"version":3,"file":"useRefObjectAsForwardedRef.d.ts","sourceRoot":"","sources":["../../src/hooks/useRefObjectAsForwardedRef.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAE,SAAS,EAAC,MAAM,OAAO,CAAA;AAGlD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAEjH"}
|
|
@@ -7,6 +7,18 @@ import { useImperativeHandle } from 'react';
|
|
|
7
7
|
* instance with `.current`.
|
|
8
8
|
*
|
|
9
9
|
* **NOTE**: The `refObject` should be passed to the underlying element, NOT the `forwardedRef`.
|
|
10
|
+
*
|
|
11
|
+
* @deprecated Migrate to `useMergedRefs`. It's safer, faster, and easier to use:
|
|
12
|
+
*
|
|
13
|
+
* ```diff
|
|
14
|
+
* const ref = useRef(null)
|
|
15
|
+
*
|
|
16
|
+
* - useRefObjectAsForwardedRef(forwardedRef, ref)
|
|
17
|
+
* + const mergedRef = useMergedRefs(forwardedRef, ref)
|
|
18
|
+
*
|
|
19
|
+
* - return <div ref={ref} />
|
|
20
|
+
* + return <div ref={mergedRef} />
|
|
21
|
+
* ```
|
|
10
22
|
*/
|
|
11
23
|
function useRefObjectAsForwardedRef(forwardedRef, refObject) {
|
|
12
24
|
const $ = c(2);
|
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export type { FocusTrapHookSettings } from './hooks/useFocusTrap';
|
|
|
21
21
|
export { useFocusZone } from './hooks/useFocusZone';
|
|
22
22
|
export type { FocusZoneHookSettings } from './hooks/useFocusZone';
|
|
23
23
|
export { useRefObjectAsForwardedRef } from './hooks/useRefObjectAsForwardedRef';
|
|
24
|
+
export { useMergedRefs } from './hooks/useMergedRefs';
|
|
24
25
|
export { useResizeObserver } from './hooks/useResizeObserver';
|
|
25
26
|
export { useResponsiveValue, type ResponsiveValue } from './hooks/useResponsiveValue';
|
|
26
27
|
export { default as useIsomorphicLayoutEffect } from './utils/useIsomorphicLayoutEffect';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,OAAO,IAAI,KAAK,EAAE,KAAK,eAAe,EAAE,KAAK,gBAAgB,EAAC,MAAM,SAAS,CAAA;AACrF,OAAO,EAAC,OAAO,IAAI,UAAU,EAAC,MAAM,cAAc,CAAA;AAClD,YAAY,EAAC,eAAe,EAAC,MAAM,cAAc,CAAA;AACjD,OAAO,EAAC,OAAO,IAAI,aAAa,EAAE,QAAQ,EAAE,iBAAiB,EAAC,MAAM,iBAAiB,CAAA;AACrF,YAAY,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAA;AAGvD,cAAc,UAAU,CAAA;AACxB,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAA;AACvC,YAAY,EACV,eAAe,EACf,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAA;AACjD,YAAY,EACV,oBAAoB,EACpB,0BAA0B,EAC1B,2BAA2B,EAC3B,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EAAC,OAAO,IAAI,UAAU,EAAC,MAAM,oBAAoB,CAAA;AACxD,OAAO,EAAC,OAAO,IAAI,cAAc,EAAC,MAAM,wBAAwB,CAAA;AAChE,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAA;AAC3D,YAAY,EAAC,iBAAiB,EAAC,MAAM,2B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ap.js';
|
|
13
13
|
export { useFocusZone } from './hooks/useFocusZone.js';
|
|
14
14
|
export { useRefObjectAsForwardedRef } from './hooks/useRefObjectAsForwardedRef.js';
|
|
15
|
+
export { useMergedRefs } from './hooks/useMergedRefs.js';
|
|
15
16
|
export { useResizeObserver } from './hooks/useResizeObserver.js';
|
|
16
17
|
export { useResponsiveValue } from './hooks/useResponsiveValue.js';
|
|
17
18
|
export { default as useIsomorphicLayoutEffect } from './utils/useIsomorphicLayoutEffect.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxOrRadioGroup.d.ts","sourceRoot":"","sources":["../../../../src/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAazB,MAAM,MAAM,yBAAyB,GAAG;IACtC,oCAAoC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,CAAC,iBAAiB,CAAC,CAAC,EAAE,MAAM,CAAA;IAC5B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;
|
|
1
|
+
{"version":3,"file":"CheckboxOrRadioGroup.d.ts","sourceRoot":"","sources":["../../../../src/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAazB,MAAM,MAAM,yBAAyB,GAAG;IACtC,oCAAoC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,CAAC,iBAAiB,CAAC,CAAC,EAAE,MAAM,CAAA;IAC5B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAyHD,YAAY,EAAC,8BAA8B,EAAC,MAAM,6BAA6B,CAAA;;;;;;;;;;AAC/E,wBAIE"}
|
|
@@ -10,7 +10,7 @@ import { useSlots } from '../../../hooks/useSlots.js';
|
|
|
10
10
|
import classes from './CheckboxOrRadioGroup.module.css.js';
|
|
11
11
|
import { clsx } from 'clsx';
|
|
12
12
|
import { isSlot } from '../../../utils/is-slot.js';
|
|
13
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
13
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
14
14
|
|
|
15
15
|
const CheckboxOrRadioGroup = ({
|
|
16
16
|
'aria-labelledby': ariaLabelledby,
|
|
@@ -31,6 +31,7 @@ const CheckboxOrRadioGroup = ({
|
|
|
31
31
|
const id = useId(idProp);
|
|
32
32
|
const validationMessageId = validationChild ? `${id}-validationMessage` : undefined;
|
|
33
33
|
const captionId = captionChild ? `${id}-caption` : undefined;
|
|
34
|
+
const requiredMessageId = required ? `${id}-requiredMessage` : undefined;
|
|
34
35
|
if (!labelChild && !ariaLabelledby) {
|
|
35
36
|
// eslint-disable-next-line no-console
|
|
36
37
|
console.warn('A choice group must be labelled using a `CheckboxOrRadioGroup.Label` child, or by passing `aria-labelledby` to the CheckboxOrRadioGroup component.');
|
|
@@ -61,19 +62,27 @@ const CheckboxOrRadioGroup = ({
|
|
|
61
62
|
jsxs("legend", {
|
|
62
63
|
className: classes.GroupLegend,
|
|
63
64
|
"data-legend-visible": isLegendVisible ? '' : undefined,
|
|
64
|
-
children: [slots.label,
|
|
65
|
+
children: [slots.label, required && /*#__PURE__*/jsx(VisuallyHidden, {
|
|
66
|
+
children: ", required"
|
|
67
|
+
}), slots.caption, /*#__PURE__*/React.isValidElement(slots.validation) && slots.validation.props.children && /*#__PURE__*/jsx(VisuallyHidden, {
|
|
65
68
|
children: slots.validation.props.children
|
|
66
69
|
})]
|
|
67
|
-
}) :
|
|
70
|
+
}) :
|
|
71
|
+
/*#__PURE__*/
|
|
68
72
|
/*
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
+
If CheckboxOrRadioGroup.Label wasn't passed as a child, we don't render a <legend>
|
|
74
|
+
but we still want to render a caption
|
|
75
|
+
*/
|
|
76
|
+
jsxs(Fragment, {
|
|
77
|
+
children: [slots.caption, required && requiredMessageId && /*#__PURE__*/jsx(VisuallyHidden, {
|
|
78
|
+
id: requiredMessageId,
|
|
79
|
+
children: "Required"
|
|
80
|
+
})]
|
|
81
|
+
}), /*#__PURE__*/jsx("div", {
|
|
73
82
|
className: classes.Body,
|
|
74
83
|
...(!labelChild ? {
|
|
75
84
|
['aria-labelledby']: ariaLabelledby,
|
|
76
|
-
['aria-describedby']: [validationMessageId, captionId].filter(Boolean).join(' '),
|
|
85
|
+
['aria-describedby']: [validationMessageId, captionId, requiredMessageId].filter(Boolean).join(' '),
|
|
77
86
|
as: 'div',
|
|
78
87
|
role: 'group'
|
|
79
88
|
} : {}),
|
|
@@ -2043,8 +2043,8 @@
|
|
|
2043
2043
|
},
|
|
2044
2044
|
{
|
|
2045
2045
|
"name": "keybindingHint",
|
|
2046
|
-
"type": "string",
|
|
2047
|
-
"description": "Optional keybinding hint to show in the tooltip for this button. See the `KeybindingHint` component documentation for the correct format
|
|
2046
|
+
"type": "string | string[]",
|
|
2047
|
+
"description": "Optional keybinding hint to show in the tooltip for this button. Pass a string for a single shortcut or an array of strings to show multiple shortcuts joined with \"or\". See the `KeybindingHint` component documentation for the correct format. Has no effect if tooltip is overridden or disabled. Does **not** bind any keybindings for this button - this is only for visual hints."
|
|
2048
2048
|
},
|
|
2049
2049
|
{
|
|
2050
2050
|
"name": "tooltipDirection",
|
|
@@ -7141,10 +7141,6 @@
|
|
|
7141
7141
|
{
|
|
7142
7142
|
"id": "components-statelabel-features--closed",
|
|
7143
7143
|
"code": "() => <StateLabel status=\"closed\">Closed</StateLabel>"
|
|
7144
|
-
},
|
|
7145
|
-
{
|
|
7146
|
-
"id": "components-statelabel-features--archived",
|
|
7147
|
-
"code": "() => <StateLabel status=\"archived\">Archived</StateLabel>"
|
|
7148
7144
|
}
|
|
7149
7145
|
],
|
|
7150
7146
|
"importPath": "@primer/react",
|
|
@@ -7156,7 +7152,7 @@
|
|
|
7156
7152
|
},
|
|
7157
7153
|
{
|
|
7158
7154
|
"name": "status",
|
|
7159
|
-
"type": "'issueOpened' | 'issueClosed' | 'issueClosedNotPlanned' | 'pullOpened' | 'pullClosed' | 'pullMerged' | 'draft' | 'issueDraft' | 'pullQueued' | 'unavailable' | 'alertOpened' | 'alertFixed' | 'alertDismissed' | 'alertClosed' | 'open' | 'closed'
|
|
7155
|
+
"type": "'issueOpened' | 'issueClosed' | 'issueClosedNotPlanned' | 'pullOpened' | 'pullClosed' | 'pullMerged' | 'draft' | 'issueDraft' | 'pullQueued' | 'unavailable' | 'alertOpened' | 'alertFixed' | 'alertDismissed' | 'alertClosed' | 'open' | 'closed'",
|
|
7160
7156
|
"required": true
|
|
7161
7157
|
}
|
|
7162
7158
|
],
|
|
@@ -8302,8 +8298,8 @@
|
|
|
8302
8298
|
},
|
|
8303
8299
|
{
|
|
8304
8300
|
"name": "keybindingHint",
|
|
8305
|
-
"type": "string",
|
|
8306
|
-
"description": "Optional keybinding hint to indicate the availability of a keyboard shortcut. Supported syntax is described in the docs for the `KeybindingHint` component."
|
|
8301
|
+
"type": "string | string[]",
|
|
8302
|
+
"description": "Optional keybinding hint to indicate the availability of a keyboard shortcut. Pass a string for a single shortcut or an array of strings to show multiple shortcuts joined with \"or\". Supported syntax is described in the docs for the `KeybindingHint` component."
|
|
8307
8303
|
},
|
|
8308
8304
|
{
|
|
8309
8305
|
"name": "delay",
|
package/generated/hooks.json
CHANGED
|
@@ -519,6 +519,28 @@
|
|
|
519
519
|
"description": "The refs for the trapping container and the initial focus element."
|
|
520
520
|
}
|
|
521
521
|
},
|
|
522
|
+
"useMergedRefs": {
|
|
523
|
+
"name": "useMergedRefs",
|
|
524
|
+
"importPath": "@primer/react",
|
|
525
|
+
"stories": [],
|
|
526
|
+
"parameters": [
|
|
527
|
+
{
|
|
528
|
+
"name": "refA",
|
|
529
|
+
"type": "React.Ref<T> | undefined",
|
|
530
|
+
"required": true,
|
|
531
|
+
"description": "First ref to combine."
|
|
532
|
+
},
|
|
533
|
+
{
|
|
534
|
+
"name": "refB",
|
|
535
|
+
"type": "React.Ref<T> | undefined",
|
|
536
|
+
"required": true,
|
|
537
|
+
"description": "Second ref to combine."
|
|
538
|
+
}
|
|
539
|
+
],
|
|
540
|
+
"returns": {
|
|
541
|
+
"type": "React.RefCallback<T>"
|
|
542
|
+
}
|
|
543
|
+
},
|
|
522
544
|
"useOnEscapePress": {
|
|
523
545
|
"name": "useOnEscapePress",
|
|
524
546
|
"importPath": "@primer/react",
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ActionMenu/ActionMenu.module.css.js"],"names":[],"mappings":"AAAA,0CAEE,gBA+CF,CA7CE,2EACE,uCACF,CAGA,sEACE,aACF,CAEA,wEACE,eACF,CAEA,wEACE,eACF,CAEA,yEACE,gBACF,CAGA,0EACE,gBACF,CAEA,yEACE,gBACF,CAEA,0EACE,gBACF,CAEA,yEACE,gBACF,CAEA,0EACE,gBACF,CAEA,+EACE,2BAAuB,CAAvB,sBACF","file":"ActionMenu-53493541.css","sourcesContent":[".ActionMenuContainer {\n /* add default max height */\n max-height: 100vh;\n\n &:where([data-variant='fullscreen']) {\n padding-top: var(--base-size-36);\n }\n\n /* Overflow variants */\n &:where([data-overflow-auto]) {\n overflow: auto;\n }\n\n &:where([data-overflow-hidden]) {\n overflow: hidden;\n }\n\n &:where([data-overflow-scroll]) {\n overflow: scroll;\n }\n\n &:where([data-overflow-visible]) {\n overflow: visible;\n }\n\n /* Max-height size tokens (mirror Overlay sizes) */\n &:where([data-max-height-xsmall]) {\n max-height: 192px;\n }\n\n &:where([data-max-height-small]) {\n max-height: 256px;\n }\n\n &:where([data-max-height-medium]) {\n max-height: 320px;\n }\n\n &:where([data-max-height-large]) {\n max-height: 432px;\n }\n\n &:where([data-max-height-xlarge]) {\n max-height: 600px;\n }\n\n &:where([data-max-height-fit-content]) {\n max-height: fit-content;\n }\n}\n"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
.prc-AnchoredOverlay-ResponsiveCloseButtonContainer-nuium{position:relative}.prc-AnchoredOverlay-ResponsiveCloseButton-z-2rx{display:none;position:absolute;right:var(--base-size-8,.5rem);top:var(--base-size-8,.5rem)}@media screen and (max-width:calc(48rem - 0.02px)){.prc-AnchoredOverlay-ResponsiveCloseButton-z-2rx{display:inline-grid}}.prc-AnchoredOverlay-Wrapper-w6jU3{anchor-scope:--anchored-overlay-anchor}.prc-AnchoredOverlay-Anchor-DWRfK{anchor-name:--anchored-overlay-anchor}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z{position-anchor:--anchored-overlay-anchor;position-try-fallbacks:flip-block,flip-inline,flip-block flip-inline;position-visibility:anchors-visible;position:fixed;z-index:100}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-bottom]{left:anchor(left);top:calc(anchor(bottom) + var(--base-size-4,.25rem))}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-top]{bottom:anchor(top);left:anchor(left);margin-bottom:var(--base-size-4,.25rem)}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-left]{margin-right:var(--base-size-4,.25rem);right:anchor(left);top:anchor(top)}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-right]{left:anchor(right);margin-left:var(--base-size-4,.25rem);top:anchor(top)}
|
|
2
|
-
/*# sourceMappingURL=AnchoredOverlay-0f6f45b5.css.map */
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/AnchoredOverlay/AnchoredOverlay.module.css.js"],"names":[],"mappings":"AAAA,0DACE,iBACF,CAEA,iDAIE,YAAa,CAHb,iBAAkB,CAElB,8BAAyB,CADzB,4BAOF,CAHE,mDANF,iDAOI,mBAEJ,CADE,CAGF,mCACE,sCACF,CAEA,kCAEE,qCACF,CAEA,2CAEE,yCAA0C,CAC1C,oEAGwB,CACxB,mCAAoC,CAEpC,cAAe,CADf,WA0BF,CAvBE,qEAGE,iBAAkB,CADlB,oDAEF,CAEA,kEAEE,kBAAmB,CACnB,iBAAkB,CAFlB,uCAGF,CAEA,mEAGE,sCAAgC,CAFhC,kBAAmB,CACnB,eAEF,CAEA,oEACE,kBAAmB,CAEnB,qCAA+B,CAD/B,eAEF","file":"AnchoredOverlay-0f6f45b5.css","sourcesContent":[".ResponsiveCloseButtonContainer {\n position: relative;\n}\n\n.ResponsiveCloseButton {\n position: absolute;\n top: var(--base-size-8);\n right: var(--base-size-8);\n display: none;\n\n @media screen and (--viewportRange-narrow) {\n display: inline-grid;\n }\n}\n\n.Wrapper {\n anchor-scope: --anchored-overlay-anchor;\n}\n\n.Anchor {\n /* Anchor name, this is currently tied to `renderAnchor` */\n anchor-name: --anchored-overlay-anchor;\n}\n\n.AnchoredOverlay {\n /* Anchor position, this is currently tied to `<Overlay>` */\n position-anchor: --anchored-overlay-anchor;\n position-try-fallbacks:\n flip-block,\n flip-inline,\n flip-block flip-inline;\n position-visibility: anchors-visible;\n z-index: 100;\n position: fixed;\n\n &[data-side='outside-bottom'] {\n /* stylelint-disable primer/spacing */\n top: calc(anchor(bottom) + var(--base-size-4));\n left: anchor(left);\n }\n\n &[data-side='outside-top'] {\n margin-bottom: var(--base-size-4);\n bottom: anchor(top);\n left: anchor(left);\n }\n\n &[data-side='outside-left'] {\n right: anchor(left);\n top: anchor(top);\n margin-right: var(--base-size-4);\n }\n\n &[data-side='outside-right'] {\n left: anchor(right);\n top: anchor(top);\n margin-left: var(--base-size-4);\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/Overlay/Overlay.module.css.js"],"names":[],"mappings":"AAAA,4CACE,GACE,SACF,CAEA,GACE,SACF,CACF,CAEA,2BAQE,mEAAwC,CACxC,8CAAwC,CACxC,mEAAwC,CALxC,WAAY,CACZ,gBAAiB,CAJjB,4BAA6B,CAE7B,eAAgB,CAGhB,aAAc,CANd,iBAAkB,CAElB,UAoMF,CA3LE,wIAKE,yBAA2B,CAF3B,uBAkBF,CAZI,mDADF,6LAGI,MAAO,CADP,KAGJ,CADE,CAGF,iKAIE,qBAAuB,CAFvB,mBAGF,CAGF,iCACE,YACF,CAEA,8BAvCF,2BAyCI,6BA8JJ,CA7JE,CAEA,+DACE,4BACF,CAEA,uDACE,aACF,CAEA,yDACE,eACF,CAEA,yDACE,eACF,CAEA,0DACE,gBACF,CAEA,uDACE,YACF,CAEA,sDACE,YACF,CAEA,uDACE,YACF,CAEA,sDACE,YACF,CAEA,uDACE,YACF,CAEA,6GAEE,WACF,CAEA,4DACE,uBAAmB,CAAnB,kBACF,CAEA,2DACE,gBACF,CAEA,0DACE,gBACF,CAEA,2DACE,gBACF,CAEA,0DACE,gBACF,CAEA,2DACE,gBACF,CAEA,gEACE,2BAAuB,CAAvB,sBACF,CAEA,qDACE,WACF,CAEA,sDACE,WACF,CAEA,qDAEE,WACF,CAEA,sDAEE,WACF,CAEA,uDAEE,WACF,CAEA,oDACE,UACF,CAEA,yDACE,eACF,CAEA,0DACE,eACF,CAEA,yDACE,eACF,CAEA,0DACE,eACF,CAEA,2DACE,eACF,CAEA,4DACE,kBACF,CAEA,2DACE,iBACF,CAGE,mDADF,+DAUI,mBAAoB,CAHpB,YAAa,CAHb,MAAO,CAKP,QAAS,CADT,eAAgB,CAFhB,cAAe,CAMf,0CAA2C,CAV3C,cAAe,CACf,KAAM,CAEN,WAcJ,CALI,0BAdJ,+DAgBM,aAGN,CAFI,CACF,CAGF,0BAEE,4DACE,aACF,CACF,CAGF,8CACE,2BACE,wEACF,CACF","file":"Overlay-2e0ce8db.css","sourcesContent":["@keyframes overlay-appear {\n 0% {\n opacity: 0;\n }\n\n 100% {\n opacity: 1;\n }\n}\n\n.Overlay {\n position: absolute;\n max-width: calc(100vw - 2rem);\n width: auto;\n min-width: 192px;\n height: auto;\n max-height: 100vh;\n overflow: auto;\n background-color: var(--overlay-bgColor);\n border-radius: var(--borderRadius-large);\n box-shadow: var(--shadow-floating-small);\n\n &[data-anchor-position='false'],\n &:not([data-anchor-position]):not([data-variant='modal']) {\n /* stylelint-disable-next-line primer/spacing */\n right: var(--right, auto);\n /* stylelint-disable-next-line primer/spacing */\n bottom: var(--bottom, auto);\n\n /* stylelint-disable-next-line selector-max-specificity */\n &[data-responsive='fullscreen']:not([data-variant]) {\n @media screen and (--viewportRange-narrow) {\n top: 0;\n left: 0;\n }\n }\n\n &:not([data-variant]) {\n /* stylelint-disable-next-line primer/spacing */\n top: var(--top, auto);\n /* stylelint-disable-next-line primer/spacing */\n left: var(--left, auto);\n }\n }\n\n &:focus {\n outline: none;\n }\n\n @media (forced-colors: active) {\n /* Support for Windows high contrast https://sarahmhigley.com/writing/whcm-quick-tips */\n outline: solid 1px transparent;\n }\n\n &:where([data-reflow-container='true']) {\n max-width: calc(100vw - 2rem);\n }\n\n &:where([data-overflow-auto]) {\n overflow: auto;\n }\n\n &:where([data-overflow-hidden]) {\n overflow: hidden;\n }\n\n &:where([data-overflow-scroll]) {\n overflow: scroll;\n }\n\n &:where([data-overflow-visible]) {\n overflow: visible;\n }\n\n &:where([data-height-xsmall]) {\n height: 192px;\n }\n\n &:where([data-height-small]) {\n height: 256px;\n }\n\n &:where([data-height-medium]) {\n height: 320px;\n }\n\n &:where([data-height-large]) {\n height: 432px;\n }\n\n &:where([data-height-xlarge]) {\n height: 600px;\n }\n\n &:where([data-height-auto]),\n &:where([data-height-initial]) {\n height: auto;\n }\n\n &:where([data-height-fit-content]) {\n height: fit-content;\n }\n\n &:where([data-max-height-xsmall]) {\n max-height: 192px;\n }\n\n &:where([data-max-height-small]) {\n max-height: 256px;\n }\n\n &:where([data-max-height-medium]) {\n max-height: 320px;\n }\n\n &:where([data-max-height-large]) {\n max-height: 432px;\n }\n\n &:where([data-max-height-xlarge]) {\n max-height: 600px;\n }\n\n &:where([data-max-height-fit-content]) {\n max-height: fit-content;\n }\n\n &:where([data-width-small]) {\n width: 256px;\n }\n\n &:where([data-width-medium]) {\n width: 320px;\n }\n\n &:where([data-width-large]) {\n /* stylelint-disable-next-line primer/responsive-widths */\n width: 480px;\n }\n\n &:where([data-width-xlarge]) {\n /* stylelint-disable-next-line primer/responsive-widths */\n width: 640px;\n }\n\n &:where([data-width-xxlarge]) {\n /* stylelint-disable-next-line primer/responsive-widths */\n width: 960px;\n }\n\n &:where([data-width-auto]) {\n width: auto;\n }\n\n &:where([data-max-width-small]) {\n max-width: 256px;\n }\n\n &:where([data-max-width-medium]) {\n max-width: 320px;\n }\n\n &:where([data-max-width-large]) {\n max-width: 480px;\n }\n\n &:where([data-max-width-xlarge]) {\n max-width: 640px;\n }\n\n &:where([data-max-width-xxlarge]) {\n max-width: 960px;\n }\n\n &:where([data-visibility-visible]) {\n visibility: visible;\n }\n\n &:where([data-visibility-hidden]) {\n visibility: hidden;\n }\n\n &:where([data-responsive='fullscreen']) {\n @media screen and (--viewportRange-narrow) {\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n max-width: none;\n height: 100vh;\n max-height: none;\n margin: 0;\n border-radius: unset;\n /* stylelint-disable-next-line primer/spacing */\n padding-bottom: env(safe-area-inset-bottom);\n\n @supports (height: 100dvh) {\n /* fix for mobile safari (100vh clips the screen with the toolbar) */\n height: 100dvh;\n }\n }\n }\n\n @supports (height: 100dvh) {\n /* fix for mobile safari (100vh clips the screen with the toolbar) */\n &:where([data-variant='fullscreen']) {\n height: 100dvh;\n }\n }\n}\n\n@media (prefers-reduced-motion: no-preference) {\n .Overlay {\n animation: overlay-appear 200ms cubic-bezier(0.33, 1, 0.68, 1);\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/StateLabel/StateLabel.module.css.js"],"names":[],"mappings":"AAAA,iCAEE,kBAAmB,CAMnB,kDAAuC,CAFvC,2DAAgC,CALhC,mBAAoB,CAEpB,gDAA6C,CAE7C,gBAAiB,CAEjB,iBAEF,CAGA,0DAEE,4CAAsC,CADtC,0DAEF,CAEA,2DAEE,8CAAuC,CADvC,2DAEF,CAGA,kEACE,wEAA8C,CAE9C,6FAAgG,CADhG,2DAEF,CAEA,4EACE,uEAAiD,CAEjD,gGAAmG,CADnG,2DAEF,CAEA,iEACE,4EAAgD,CAEhD,+FAAkG,CADlG,2DAEF,CAEA,iEACE,wEAA8C,CAE9C,6FAAgG,CADhG,2DAEF,CAEA,iEACE,kFAAmD,CAEnD,kGAAqG,CADrG,2DAEF,CAEA,kEACE,wEAA8C,CAE9C,6FAAgG,CADhG,2DAEF,CAEA,iEACE,wEAA8C,CAE9C,6FAAgG,CADhG,2DAEF,CAEA,4DACE,qGAAgF,CAEhF,kIACqF,CAFrF,2DAGF,CAEA,iEACE,qGAAgF,CAEhF,kIACqF,CAFrF,2DAGF,CAEA,kEACE,uEAAiD,CAEjD,gGAAmG,CADnG,2DAEF,CAEA,2DACE,wEAA8C,CAE9C,6FAAgG,CADhG,2DAEF,CAEA,6DACE,wEAA8C,CAE9C,6FAAgG,CADhG,2DAEF,CAEA,kEACE,wEAA8C,CAE9C,6FAAgG,CADhG,2DAEF,CAEA,iEACE,wEAA8C,CAE9C,6FAAgG,CADhG,2DAEF,CAEA,qEACE,qGAAgF,CAEhF,kIACqF,CAFrF,2DAGF,CAEA,kEACE,4EAAgD,CAEhD,+FAAkG,CADlG,2DAEF,CAEA,+DACE,uEAAiD,CAEjD,gGAAmG,CADnG,2DAEF,CAEA,2BACE,sCACF,CAEA,oDACE,SACF","file":"StateLabel-cd51ae39.css","sourcesContent":[".StateLabel {\n display: inline-flex;\n align-items: center;\n font-weight: var(--base-text-weight-semibold);\n /* stylelint-disable-next-line primer/typography */\n line-height: 16px;\n color: var(--fgColor-onEmphasis);\n text-align: center;\n border-radius: var(--borderRadius-full);\n}\n\n/* Size variants */\n.StateLabel:where([data-size='small']) {\n padding: var(--base-size-4) var(--base-size-8);\n font-size: var(--text-body-size-small);\n}\n\n.StateLabel:where([data-size='medium']) {\n padding: var(--base-size-8) var(--base-size-12);\n font-size: var(--text-body-size-medium);\n}\n\n/* Status color variants */\n.StateLabel:where([data-status='issueClosed']) {\n background-color: var(--bgColor-done-emphasis);\n color: var(--fgColor-onEmphasis);\n box-shadow: var(--boxShadow-thin, inset 0 0 0 1px) var(--borderColor-done-emphasis, transparent);\n}\n\n.StateLabel:where([data-status='issueClosedNotPlanned']) {\n background-color: var(--bgColor-neutral-emphasis);\n color: var(--fgColor-onEmphasis);\n box-shadow: var(--boxShadow-thin, inset 0 0 0 1px) var(--borderColor-neutral-emphasis, transparent);\n}\n\n.StateLabel:where([data-status='pullClosed']) {\n background-color: var(--bgColor-closed-emphasis);\n color: var(--fgColor-onEmphasis);\n box-shadow: var(--boxShadow-thin, inset 0 0 0 1px) var(--borderColor-closed-emphasis, transparent);\n}\n\n.StateLabel:where([data-status='pullMerged']) {\n background-color: var(--bgColor-done-emphasis);\n color: var(--fgColor-onEmphasis);\n box-shadow: var(--boxShadow-thin, inset 0 0 0 1px) var(--borderColor-done-emphasis, transparent);\n}\n\n.StateLabel:where([data-status='pullQueued']) {\n background-color: var(--bgColor-attention-emphasis);\n color: var(--fgColor-onEmphasis);\n box-shadow: var(--boxShadow-thin, inset 0 0 0 1px) var(--borderColor-attention-emphasis, transparent);\n}\n\n.StateLabel:where([data-status='issueOpened']) {\n background-color: var(--bgColor-open-emphasis);\n color: var(--fgColor-onEmphasis);\n box-shadow: var(--boxShadow-thin, inset 0 0 0 1px) var(--borderColor-open-emphasis, transparent);\n}\n\n.StateLabel:where([data-status='pullOpened']) {\n background-color: var(--bgColor-open-emphasis);\n color: var(--fgColor-onEmphasis);\n box-shadow: var(--boxShadow-thin, inset 0 0 0 1px) var(--borderColor-open-emphasis, transparent);\n}\n\n.StateLabel:where([data-status='draft']) {\n background-color: var(--bgColor-draft-emphasis, var(--bgColor-neutral-emphasis));\n color: var(--fgColor-onEmphasis);\n box-shadow: var(--boxShadow-thin, inset 0 0 0 1px)\n var(--borderColor-draft-emphasis, var(--borderColor-neutral-emphasis, transparent));\n}\n\n.StateLabel:where([data-status='issueDraft']) {\n background-color: var(--bgColor-draft-emphasis, var(--bgColor-neutral-emphasis));\n color: var(--fgColor-onEmphasis);\n box-shadow: var(--boxShadow-thin, inset 0 0 0 1px)\n var(--borderColor-draft-emphasis, var(--borderColor-neutral-emphasis, transparent));\n}\n\n.StateLabel:where([data-status='unavailable']) {\n background-color: var(--bgColor-neutral-emphasis);\n color: var(--fgColor-onEmphasis);\n box-shadow: var(--boxShadow-thin, inset 0 0 0 1px) var(--borderColor-neutral-emphasis, transparent);\n}\n\n.StateLabel:where([data-status='open']) {\n background-color: var(--bgColor-open-emphasis);\n color: var(--fgColor-onEmphasis);\n box-shadow: var(--boxShadow-thin, inset 0 0 0 1px) var(--borderColor-open-emphasis, transparent);\n}\n\n.StateLabel:where([data-status='closed']) {\n background-color: var(--bgColor-done-emphasis);\n color: var(--fgColor-onEmphasis);\n box-shadow: var(--boxShadow-thin, inset 0 0 0 1px) var(--borderColor-done-emphasis, transparent);\n}\n\n.StateLabel:where([data-status='alertOpened']) {\n background-color: var(--bgColor-open-emphasis);\n color: var(--fgColor-onEmphasis);\n box-shadow: var(--boxShadow-thin, inset 0 0 0 1px) var(--borderColor-open-emphasis, transparent);\n}\n\n.StateLabel:where([data-status='alertFixed']) {\n background-color: var(--bgColor-done-emphasis);\n color: var(--fgColor-onEmphasis);\n box-shadow: var(--boxShadow-thin, inset 0 0 0 1px) var(--borderColor-done-emphasis, transparent);\n}\n\n.StateLabel:where([data-status='alertDismissed']) {\n background-color: var(--bgColor-draft-emphasis, var(--bgColor-neutral-emphasis));\n color: var(--fgColor-onEmphasis);\n box-shadow: var(--boxShadow-thin, inset 0 0 0 1px)\n var(--borderColor-draft-emphasis, var(--borderColor-neutral-emphasis, transparent));\n}\n\n.StateLabel:where([data-status='alertClosed']) {\n background-color: var(--bgColor-closed-emphasis);\n color: var(--fgColor-onEmphasis);\n box-shadow: var(--boxShadow-thin, inset 0 0 0 1px) var(--borderColor-closed-emphasis, transparent);\n}\n\n.StateLabel:where([data-status='archived']) {\n background-color: var(--bgColor-neutral-emphasis);\n color: var(--fgColor-onEmphasis);\n box-shadow: var(--boxShadow-thin, inset 0 0 0 1px) var(--borderColor-neutral-emphasis, transparent);\n}\n\n.Icon {\n margin-right: var(--base-size-4);\n}\n\n.Icon:where([data-size-small]) {\n width: 1em;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/TooltipV2/Tooltip.module.css.js"],"names":[],"mappings":"AACA,8CACE,GACE,SACF,CAEA,GACE,SACF,CACF,CAEA,6BAEE,YA8GF,CA5GE,sCAME,WAAY,CAHZ,eAAgB,CAMhB,gBAAiB,CAJjB,2FAA+E,CAJ/E,iBAAkB,CAClB,iBAAkB,CASlB,SAAU,CAMV,yCAAkC,CAClC,QAAS,CACT,gDAAyC,CANzC,iCAA6B,CAD7B,8KAAsC,CAGtC,wBAAyB,CADzB,iBAAkB,CAElB,kBAAmB,CAInB,2CAA4C,CAC5C,UAAW,CACX,iBACF,CAGA,mDACE,aACF,CAIA,sDACE,aACF,CAEA,8BAxCF,6BAyCI,6BAuEJ,CAtEE,CAGA,mCAME,UAAW,CAFX,aAAc,CACd,mCAA6B,CAF7B,MAAO,CAFP,iBAAkB,CAClB,OAKF,CAGA,iKAGE,QACF,CAEA,iKAGE,WACF,CAEA,qDAGE,SAKF,CAGA,0GATE,QAAS,CAKT,UAAW,CAHX,aAAc,CAEd,WAAY,CALZ,iBAAkB,CAIlB,SAgBF,CAVA,qDAQE,gBAAiB,CANjB,UAQF,CAGA,yDAEE,2FAME,kBAAmB,CAHnB,sBAAwB,CACxB,4BAA6B,CAF7B,iDAA8B,CAG9B,iCAEF,CAGA,iGAME,kBAAmB,CAHnB,sBAAwB,CACxB,4BAA6B,CAF7B,iDAA8B,CAG9B,iCAEF,CACF,CAGF,+EACE,sCACF","file":"Tooltip-fcb90d9c.css","sourcesContent":["/* Animation definition */\n@keyframes tooltip-appear {\n from {\n opacity: 0;\n }\n\n to {\n opacity: 1;\n }\n}\n\n.Tooltip {\n /* Overriding the default popover styles */\n display: none;\n\n &[popover] {\n position: absolute;\n width: max-content;\n max-width: 250px;\n /* stylelint-disable-next-line primer/spacing */\n padding: var(--overlay-paddingBlock-condensed) var(--overlay-padding-condensed);\n margin: auto;\n\n /* for scrollbar */\n overflow: visible;\n /* stylelint-disable-next-line property-no-deprecated */\n clip: auto;\n font: var(--text-body-shorthand-small);\n color: var(--tooltip-fgColor);\n text-align: center;\n overflow-wrap: break-word;\n white-space: normal;\n background: var(--tooltip-bgColor);\n border: 0;\n border-radius: var(--borderRadius-medium);\n -webkit-font-smoothing: subpixel-antialiased;\n inset: auto;\n text-wrap: balance;\n }\n\n /* class name in chrome is :popover-open */\n &[popover]:popover-open {\n display: block;\n }\n\n /* class name in firefox and safari is \\:popover-open */\n /* stylelint-disable-next-line selector-class-pattern */\n &[popover]:global(.\\\\:popover-open) {\n display: block;\n }\n\n @media (forced-colors: active) {\n outline: 1px solid transparent;\n }\n\n /* This is needed to keep the tooltip open when the user leaves the trigger element to hover tooltip */\n &::after {\n position: absolute;\n right: 0;\n left: 0;\n display: block;\n height: var(--overlay-offset);\n content: '';\n }\n\n /* South, East, Southeast, Southwest after */\n &[data-direction='n']::after,\n &[data-direction='ne']::after,\n &[data-direction='nw']::after {\n top: 100%;\n }\n\n &[data-direction='s']::after,\n &[data-direction='se']::after,\n &[data-direction='sw']::after {\n bottom: 100%;\n }\n\n &[data-direction='w']::after {\n position: absolute;\n bottom: 0;\n left: 100%;\n display: block;\n width: 8px;\n height: 100%;\n content: '';\n }\n\n /* East before and after */\n &[data-direction='e']::after {\n position: absolute;\n right: 100%;\n bottom: 0;\n display: block;\n width: 8px;\n height: 100%;\n /* stylelint-disable-next-line primer/spacing */\n margin-left: -8px;\n content: '';\n }\n\n /* Only show animations if users don't have a preference for reduced motion */\n @media screen and (prefers-reduced-motion: no-preference) {\n /* Animation styles */\n &:popover-open,\n &:popover-open::before {\n animation-name: tooltip-appear;\n animation-duration: 0.1s;\n animation-fill-mode: forwards;\n animation-timing-function: ease-in;\n animation-delay: 0s;\n }\n\n /* Animation styles */\n &:global(.\\\\:popover-open) /* stylelint-disable-line selector-class-pattern */,\n &:global(.\\\\:popover-open)::before /* stylelint-disable-line selector-class-pattern */ {\n animation-name: tooltip-appear;\n animation-duration: 0.1s;\n animation-fill-mode: forwards;\n animation-timing-function: ease-in;\n animation-delay: 0s;\n }\n }\n}\n\n.KeybindingHintContainer.HasTextBefore {\n margin-left: var(--base-size-6);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useMergedRefs.d.ts","sourceRoot":"","sources":["../../../src/internal/hooks/useMergedRefs.ts"],"names":[],"mappings":"AAEA,wBAAgB,aAAa,CAAC,CAAC,EAC7B,GAAG,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GACvF,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAWtB"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { useCallback } from 'react';
|
|
2
|
-
|
|
3
|
-
function useMergedRefs(...refs) {
|
|
4
|
-
return useCallback(instance => {
|
|
5
|
-
for (const ref of refs) {
|
|
6
|
-
if (typeof ref === 'function') {
|
|
7
|
-
ref(instance);
|
|
8
|
-
} else if (ref) {
|
|
9
|
-
ref.current = instance;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
13
|
-
}, refs);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export { useMergedRefs };
|