@primer/react 0.0.0-20260220174352 → 0.0.0-20260220184804
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 +15 -1
- package/dist/Autocomplete/Autocomplete.js +76 -159
- package/dist/Autocomplete/AutocompleteMenu.js +128 -333
- package/dist/Autocomplete/AutocompleteOverlay.js +49 -130
- package/dist/Banner/Banner.js +64 -238
- package/dist/Button/Button.js +11 -34
- package/dist/Button/IconButton.js +51 -140
- package/dist/Button/LinkButton.js +11 -39
- package/dist/Checkbox/Checkbox.js +55 -163
- package/dist/Dialog/Dialog.js +105 -347
- package/dist/FilteredActionList/FilteredActionList.d.ts +16 -1
- package/dist/FilteredActionList/FilteredActionList.d.ts.map +1 -1
- package/dist/FilteredActionList/FilteredActionList.js +147 -42
- package/dist/Overlay/Overlay-15519c09.css +2 -0
- package/dist/Overlay/Overlay-15519c09.css.map +1 -0
- package/dist/Overlay/Overlay.module.css.js +1 -1
- package/dist/PageLayout/PageLayout.js +622 -1560
- package/dist/SelectPanel/SelectPanel.d.ts +1 -1
- package/dist/SelectPanel/SelectPanel.d.ts.map +1 -1
- package/dist/SelectPanel/SelectPanel.js +3 -1
- package/dist/Text/Text.d.ts +1 -1
- package/dist/Text/Text.d.ts.map +1 -1
- package/dist/Text/Text.js +10 -13
- package/dist/UnderlineNav/UnderlineNavItem.js +56 -149
- package/dist/experimental/SelectPanel2/SelectPanel.js +209 -593
- package/dist/hooks/useRefObjectAsForwardedRef.d.ts.map +1 -1
- package/dist/hooks/useRefObjectAsForwardedRef.js +10 -2
- package/dist/hooks/useScrollFlash.d.ts.map +1 -1
- package/dist/hooks/useScrollFlash.js +14 -22
- package/dist/hooks/useSlots.d.ts +50 -6
- package/dist/hooks/useSlots.d.ts.map +1 -1
- package/dist/hooks/useSlots.js +114 -36
- package/generated/components.json +6 -0
- package/package.json +2 -2
- package/dist/Overlay/Overlay-43cda449.css +0 -2
- package/dist/Overlay/Overlay-43cda449.css.map +0 -1
|
@@ -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;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,
|
|
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;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAIjH"}
|
|
@@ -9,7 +9,7 @@ import { useImperativeHandle } from 'react';
|
|
|
9
9
|
* **NOTE**: The `refObject` should be passed to the underlying element, NOT the `forwardedRef`.
|
|
10
10
|
*/
|
|
11
11
|
function useRefObjectAsForwardedRef(forwardedRef, refObject) {
|
|
12
|
-
const $ = c(
|
|
12
|
+
const $ = c(4);
|
|
13
13
|
let t0;
|
|
14
14
|
if ($[0] !== refObject.current) {
|
|
15
15
|
t0 = () => refObject.current;
|
|
@@ -18,7 +18,15 @@ function useRefObjectAsForwardedRef(forwardedRef, refObject) {
|
|
|
18
18
|
} else {
|
|
19
19
|
t0 = $[1];
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
let t1;
|
|
22
|
+
if ($[2] !== refObject) {
|
|
23
|
+
t1 = [refObject];
|
|
24
|
+
$[2] = refObject;
|
|
25
|
+
$[3] = t1;
|
|
26
|
+
} else {
|
|
27
|
+
t1 = $[3];
|
|
28
|
+
}
|
|
29
|
+
useImperativeHandle(forwardedRef, t0, t1);
|
|
22
30
|
}
|
|
23
31
|
|
|
24
32
|
export { useRefObjectAsForwardedRef };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScrollFlash.d.ts","sourceRoot":"","sources":["../../src/hooks/useScrollFlash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,kBAAkB,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"useScrollFlash.d.ts","sourceRoot":"","sources":["../../src/hooks/useScrollFlash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,kBAAkB,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,QAoB7F"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { c } from 'react-compiler-runtime';
|
|
2
1
|
import { useEffect } from 'react';
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -6,30 +5,23 @@ import { useEffect } from 'react';
|
|
|
6
5
|
* @param scrollContainerRef The ref of the scrollable content
|
|
7
6
|
*/
|
|
8
7
|
function useScrollFlash(scrollContainerRef) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
// https://adxlv.computer/projects/flash-scrollers/
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
const scrollContainer = scrollContainerRef.current;
|
|
11
|
+
if (!scrollContainer) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Defer to the next frame to avoid forcing a synchronous reflow
|
|
16
|
+
// when the effect runs immediately after React commits DOM changes.
|
|
17
|
+
const id = requestAnimationFrame(() => {
|
|
18
18
|
const currentScroll = scrollContainer.scrollTop;
|
|
19
|
-
const
|
|
20
|
-
const altScroll = currentScroll < Math.min(1, maxScroll) ? currentScroll + 1 : currentScroll - 1;
|
|
19
|
+
const altScroll = currentScroll < 1 ? currentScroll + 1 : currentScroll - 1;
|
|
21
20
|
scrollContainer.scrollTop = altScroll;
|
|
22
21
|
scrollContainer.scrollTop = currentScroll;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
$[1] = t0;
|
|
27
|
-
$[2] = t1;
|
|
28
|
-
} else {
|
|
29
|
-
t0 = $[1];
|
|
30
|
-
t1 = $[2];
|
|
31
|
-
}
|
|
32
|
-
useEffect(t0, t1);
|
|
22
|
+
});
|
|
23
|
+
return () => cancelAnimationFrame(id);
|
|
24
|
+
}, [scrollContainerRef]);
|
|
33
25
|
}
|
|
34
26
|
|
|
35
27
|
export { useScrollFlash as default };
|
package/dist/hooks/useSlots.d.ts
CHANGED
|
@@ -1,8 +1,56 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* useSlots - Extract slot components from children for SSR-compatible slot APIs.
|
|
4
|
+
*
|
|
5
|
+
* Given a list of children and a config mapping slot names to component types,
|
|
6
|
+
* separates children into two groups: matched slots and the rest.
|
|
7
|
+
*
|
|
8
|
+
* Config: { leadingVisual: LeadingVisual, description: Description }
|
|
9
|
+
*
|
|
10
|
+
* Children: Matching: Output:
|
|
11
|
+
* +----------------+ slots = {
|
|
12
|
+
* | LeadingVisual | -> matches slot 0 --> leadingVisual: <LeadingVisual />
|
|
13
|
+
* | "Project name" | -> no match --> description: <Description />
|
|
14
|
+
* | Description | -> matches slot 1 --> }
|
|
15
|
+
* | TrailingVisual | -> no match --> rest = ["Project name", <TrailingVisual />]
|
|
16
|
+
* +----------------+
|
|
17
|
+
*
|
|
18
|
+
* Performance-sensitive: called per item in lists (e.g. 100-item ActionList
|
|
19
|
+
* calls this 101 times per render).
|
|
20
|
+
*
|
|
21
|
+
* Once all slots are filled, remaining children skip matching entirely in
|
|
22
|
+
* production (single integer comparison). In dev, we still scan for duplicates
|
|
23
|
+
* to emit a warning.
|
|
24
|
+
*
|
|
25
|
+
* Flow per child:
|
|
26
|
+
*
|
|
27
|
+
* child ──> isValidElement? ──no──> rest[]
|
|
28
|
+
* |
|
|
29
|
+
* yes
|
|
30
|
+
* |
|
|
31
|
+
* v
|
|
32
|
+
* all slots filled? ──yes──> rest[] (prod)
|
|
33
|
+
* | |
|
|
34
|
+
* no [dev: check for
|
|
35
|
+
* | duplicate warning]
|
|
36
|
+
* v
|
|
37
|
+
* match against unfilled slots
|
|
38
|
+
* |
|
|
39
|
+
* found match? ──no──> rest[]
|
|
40
|
+
* |
|
|
41
|
+
* yes
|
|
42
|
+
* |
|
|
43
|
+
* v
|
|
44
|
+
* slots[key] = child, slotsFound++
|
|
45
|
+
*
|
|
46
|
+
* Slot config supports two matcher styles:
|
|
47
|
+
* 1. Component reference: { visual: LeadingVisual }
|
|
48
|
+
* 2. Component + test fn: { block: [Description, props => props.variant === 'block'] }
|
|
49
|
+
*/
|
|
50
|
+
type Props = any;
|
|
2
51
|
type ComponentMatcher = React.ElementType<Props>;
|
|
3
52
|
type ComponentAndPropsMatcher = [ComponentMatcher, (props: Props) => boolean];
|
|
4
53
|
export type SlotConfig = Record<string, ComponentMatcher | ComponentAndPropsMatcher>;
|
|
5
|
-
type Props = any;
|
|
6
54
|
type SlotElements<Config extends SlotConfig> = {
|
|
7
55
|
[Property in keyof Config]: SlotValue<Config, Property>;
|
|
8
56
|
};
|
|
@@ -10,11 +58,7 @@ type SlotValue<Config, Property extends keyof Config> = Config[Property] extends
|
|
|
10
58
|
infer ElementType extends React.ElementType,
|
|
11
59
|
infer _testFn
|
|
12
60
|
] ? React.ReactElement<React.ComponentPropsWithoutRef<ElementType>, ElementType> : never;
|
|
13
|
-
/**
|
|
14
|
-
* Extract components from `children` so we can render them in different places,
|
|
15
|
-
* allowing us to implement components with SSR-compatible slot APIs.
|
|
16
|
-
* Note: We can only extract direct children, not nested ones.
|
|
17
|
-
*/
|
|
61
|
+
/** Extract slot components from children. See file header for details. */
|
|
18
62
|
export declare function useSlots<Config extends SlotConfig>(children: React.ReactNode, config: Config): [Partial<SlotElements<Config>>, React.ReactNode[]];
|
|
19
63
|
export {};
|
|
20
64
|
//# sourceMappingURL=useSlots.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSlots.d.ts","sourceRoot":"","sources":["../../src/hooks/useSlots.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"useSlots.d.ts","sourceRoot":"","sources":["../../src/hooks/useSlots.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAKH,KAAK,KAAK,GAAG,GAAG,CAAA;AAChB,KAAK,gBAAgB,GAAG,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAA;AAChD,KAAK,wBAAwB,GAAG,CAAC,gBAAgB,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,CAAA;AAE7E,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,wBAAwB,CAAC,CAAA;AAEpF,KAAK,YAAY,CAAC,MAAM,SAAS,UAAU,IAAI;KAC5C,QAAQ,IAAI,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC;CACxD,CAAA;AAED,KAAK,SAAS,CAAC,MAAM,EAAE,QAAQ,SAAS,MAAM,MAAM,IAAI,MAAM,CAAC,QAAQ,CAAC,SAAS,KAAK,CAAC,WAAW,GAC9F,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,wBAAwB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,GACtF,MAAM,CAAC,QAAQ,CAAC,SAAS,SAAS;IAC9B,MAAM,WAAW,SAAS,KAAK,CAAC,WAAW;IAE3C,MAAM,OAAO;CACd,GACD,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,wBAAwB,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC,GAC5E,KAAK,CAAA;AAeX,0EAA0E;AAC1E,wBAAgB,QAAQ,CAAC,MAAM,SAAS,UAAU,EAChD,QAAQ,EAAE,KAAK,CAAC,SAAS,EACzB,MAAM,EAAE,MAAM,GACb,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC,CAqDpD"}
|
package/dist/hooks/useSlots.js
CHANGED
|
@@ -2,29 +2,85 @@ import React from 'react';
|
|
|
2
2
|
import { warning } from '../utils/warning.js';
|
|
3
3
|
import { isSlot } from '../utils/is-slot.js';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* useSlots - Extract slot components from children for SSR-compatible slot APIs.
|
|
7
|
+
*
|
|
8
|
+
* Given a list of children and a config mapping slot names to component types,
|
|
9
|
+
* separates children into two groups: matched slots and the rest.
|
|
10
|
+
*
|
|
11
|
+
* Config: { leadingVisual: LeadingVisual, description: Description }
|
|
12
|
+
*
|
|
13
|
+
* Children: Matching: Output:
|
|
14
|
+
* +----------------+ slots = {
|
|
15
|
+
* | LeadingVisual | -> matches slot 0 --> leadingVisual: <LeadingVisual />
|
|
16
|
+
* | "Project name" | -> no match --> description: <Description />
|
|
17
|
+
* | Description | -> matches slot 1 --> }
|
|
18
|
+
* | TrailingVisual | -> no match --> rest = ["Project name", <TrailingVisual />]
|
|
19
|
+
* +----------------+
|
|
20
|
+
*
|
|
21
|
+
* Performance-sensitive: called per item in lists (e.g. 100-item ActionList
|
|
22
|
+
* calls this 101 times per render).
|
|
23
|
+
*
|
|
24
|
+
* Once all slots are filled, remaining children skip matching entirely in
|
|
25
|
+
* production (single integer comparison). In dev, we still scan for duplicates
|
|
26
|
+
* to emit a warning.
|
|
27
|
+
*
|
|
28
|
+
* Flow per child:
|
|
29
|
+
*
|
|
30
|
+
* child ──> isValidElement? ──no──> rest[]
|
|
31
|
+
* |
|
|
32
|
+
* yes
|
|
33
|
+
* |
|
|
34
|
+
* v
|
|
35
|
+
* all slots filled? ──yes──> rest[] (prod)
|
|
36
|
+
* | |
|
|
37
|
+
* no [dev: check for
|
|
38
|
+
* | duplicate warning]
|
|
39
|
+
* v
|
|
40
|
+
* match against unfilled slots
|
|
41
|
+
* |
|
|
42
|
+
* found match? ──no──> rest[]
|
|
43
|
+
* |
|
|
44
|
+
* yes
|
|
45
|
+
* |
|
|
46
|
+
* v
|
|
47
|
+
* slots[key] = child, slotsFound++
|
|
48
|
+
*
|
|
49
|
+
* Slot config supports two matcher styles:
|
|
50
|
+
* 1. Component reference: { visual: LeadingVisual }
|
|
51
|
+
* 2. Component + test fn: { block: [Description, props => props.variant === 'block'] }
|
|
52
|
+
*/
|
|
7
53
|
|
|
8
|
-
//
|
|
54
|
+
// --- Types ---
|
|
9
55
|
|
|
10
|
-
// We don't know what the props are yet, we set them later based on slot config
|
|
11
56
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
57
|
|
|
13
|
-
//
|
|
58
|
+
// --- Matching ---
|
|
14
59
|
|
|
15
|
-
/**
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
60
|
+
/** Check if a child element matches a slot config entry, either by direct type comparison or slot symbol. */
|
|
61
|
+
function childMatchesSlot(child, slotValue) {
|
|
62
|
+
if (Array.isArray(slotValue)) {
|
|
63
|
+
const [component, testFn] = slotValue;
|
|
64
|
+
return (child.type === component || isSlot(child, component)) && testFn(child.props);
|
|
65
|
+
}
|
|
66
|
+
return child.type === slotValue || isSlot(child, slotValue);
|
|
67
|
+
}
|
|
23
68
|
|
|
24
|
-
|
|
69
|
+
// --- Hook ---
|
|
70
|
+
|
|
71
|
+
/** Extract slot components from children. See file header for details. */
|
|
72
|
+
function useSlots(children, config) {
|
|
25
73
|
const rest = [];
|
|
26
74
|
const keys = Object.keys(config);
|
|
27
75
|
const values = Object.values(config);
|
|
76
|
+
const totalSlots = keys.length;
|
|
77
|
+
|
|
78
|
+
// Initialize all slot keys to undefined so callers can check `slots.x === undefined`
|
|
79
|
+
const slots = {};
|
|
80
|
+
for (let i = 0; i < totalSlots; i++) {
|
|
81
|
+
slots[keys[i]] = undefined;
|
|
82
|
+
}
|
|
83
|
+
let slotsFound = 0;
|
|
28
84
|
|
|
29
85
|
// eslint-disable-next-line github/array-foreach
|
|
30
86
|
React.Children.forEach(children, child => {
|
|
@@ -32,41 +88,63 @@ function useSlots(children, config) {
|
|
|
32
88
|
rest.push(child);
|
|
33
89
|
return;
|
|
34
90
|
}
|
|
35
|
-
const index = values.findIndex(value => {
|
|
36
|
-
if (Array.isArray(value)) {
|
|
37
|
-
const [component, testFn] = value;
|
|
38
|
-
return (child.type === component || isSlot(child, component)) && testFn(child.props);
|
|
39
|
-
} else {
|
|
40
|
-
return child.type === value || isSlot(child, value);
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
91
|
|
|
44
|
-
//
|
|
45
|
-
if (
|
|
92
|
+
// Short-circuit: all slots filled, no more matching needed
|
|
93
|
+
if (slotsFound === totalSlots) {
|
|
94
|
+
if (process.env.NODE_ENV !== "production" && warnIfDuplicate(child, keys, values, totalSlots)) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
46
97
|
rest.push(child);
|
|
47
98
|
return;
|
|
48
99
|
}
|
|
49
|
-
const slotKey = keys[index];
|
|
50
100
|
|
|
51
|
-
//
|
|
52
|
-
|
|
53
|
-
|
|
101
|
+
// Try to match child against a slot
|
|
102
|
+
const matchedIndex = findMatchingSlot(child, values, totalSlots);
|
|
103
|
+
if (matchedIndex === -1) {
|
|
104
|
+
rest.push(child);
|
|
54
105
|
return;
|
|
55
106
|
}
|
|
107
|
+
const slotKey = keys[matchedIndex];
|
|
56
108
|
|
|
57
|
-
//
|
|
58
|
-
|
|
109
|
+
// Duplicate: slot already filled by an earlier child
|
|
110
|
+
if (slots[slotKey] !== undefined) {
|
|
111
|
+
if (process.env.NODE_ENV !== "production") {
|
|
112
|
+
process.env.NODE_ENV !== "production" ? warning(true, `Found duplicate "${String(slotKey)}" slot. Only the first will be rendered.`) : void 0;
|
|
113
|
+
}
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
59
116
|
slots[slotKey] = child;
|
|
117
|
+
slotsFound++;
|
|
60
118
|
});
|
|
61
119
|
return [slots, rest];
|
|
62
120
|
}
|
|
63
121
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
122
|
+
// --- Helpers ---
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Find the first slot config entry matching this child.
|
|
126
|
+
* Returns the config index, or -1 if no match.
|
|
127
|
+
*/
|
|
128
|
+
function findMatchingSlot(child, values, totalSlots) {
|
|
129
|
+
for (let i = 0; i < totalSlots; i++) {
|
|
130
|
+
if (childMatchesSlot(child, values[i])) return i;
|
|
131
|
+
}
|
|
132
|
+
return -1;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Dev-only: check if a child duplicates an already-filled slot.
|
|
137
|
+
* Returns true (and warns) if a duplicate is found, false otherwise.
|
|
138
|
+
* Used in the short-circuit path where all slots are already filled.
|
|
139
|
+
*/
|
|
140
|
+
function warnIfDuplicate(child, keys, values, totalSlots) {
|
|
141
|
+
for (let i = 0; i < totalSlots; i++) {
|
|
142
|
+
if (childMatchesSlot(child, values[i])) {
|
|
143
|
+
process.env.NODE_ENV !== "production" ? warning(true, `Found duplicate "${String(keys[i])}" slot. Only the first will be rendered.`) : void 0;
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return false;
|
|
70
148
|
}
|
|
71
149
|
|
|
72
150
|
export { useSlots };
|
|
@@ -6403,6 +6403,12 @@
|
|
|
6403
6403
|
"type": "(newActiveDescendant: HTMLElement | undefined, previousActiveDescendant: HTMLElement | undefined, directlyActivated: boolean) => void | undefined",
|
|
6404
6404
|
"defaultValue": "undefined",
|
|
6405
6405
|
"description": "Callback function that is called when the active descendant changes."
|
|
6406
|
+
},
|
|
6407
|
+
{
|
|
6408
|
+
"name": "virtualized",
|
|
6409
|
+
"type": "boolean",
|
|
6410
|
+
"defaultValue": "false",
|
|
6411
|
+
"description": "If true, enables client-side list virtualization. Only the visible items plus a small overscan buffer are rendered in the DOM, dramatically improving performance for large lists. Recommended for lists with more than 100 items. Has no effect when `groupMetadata` is provided."
|
|
6406
6412
|
}
|
|
6407
6413
|
],
|
|
6408
6414
|
"subcomponents": []
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primer/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-
|
|
4
|
+
"version": "0.0.0-20260220184804",
|
|
5
5
|
"description": "An implementation of GitHub's Primer Design System using React",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -83,6 +83,7 @@
|
|
|
83
83
|
"@primer/live-region-element": "^0.7.1",
|
|
84
84
|
"@primer/octicons-react": "^19.21.0",
|
|
85
85
|
"@primer/primitives": "10.x || 11.x",
|
|
86
|
+
"@tanstack/react-virtual": "^3.13.18",
|
|
86
87
|
"clsx": "^2.1.1",
|
|
87
88
|
"color2k": "^2.0.3",
|
|
88
89
|
"deepmerge": "^4.3.1",
|
|
@@ -107,7 +108,6 @@
|
|
|
107
108
|
"@figma/code-connect": "1.3.2",
|
|
108
109
|
"@primer/css": "^21.5.1",
|
|
109
110
|
"@primer/doc-gen": "^0.0.1",
|
|
110
|
-
"@tanstack/react-virtual": "^3.13.12",
|
|
111
111
|
"@rollup/plugin-babel": "6.1.0",
|
|
112
112
|
"@rollup/plugin-commonjs": "29.0.0",
|
|
113
113
|
"@rollup/plugin-json": "6.1.0",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
@keyframes prc-Overlay-overlay-appear-JpFey{0%{opacity:0}to{opacity:1}}.prc-Overlay-Overlay-jfs-T{background-color:var(--overlay-bgColor,var(--color-canvas-overlay));border-radius:var(--borderRadius-large,.75rem);bottom:var(--bottom,auto);box-shadow:var(--shadow-floating-small,var(--color-overlay-shadow));height:auto;left:var(--left,auto);max-height:100vh;max-width:calc(100vw - 2rem);min-width:192px;overflow:hidden;position:absolute;right:var(--right,auto);top:var(--top,auto);width:auto}.prc-Overlay-Overlay-jfs-T:focus{outline:none}@media (forced-colors:active){.prc-Overlay-Overlay-jfs-T{outline:1px solid transparent}}.prc-Overlay-Overlay-jfs-T:where([data-reflow-container=true]){max-width:calc(100vw - 2rem)}.prc-Overlay-Overlay-jfs-T:where([data-overflow-auto]){overflow:auto}.prc-Overlay-Overlay-jfs-T:where([data-overflow-hidden]){overflow:hidden}.prc-Overlay-Overlay-jfs-T:where([data-overflow-scroll]){overflow:scroll}.prc-Overlay-Overlay-jfs-T:where([data-overflow-visible]){overflow:visible}.prc-Overlay-Overlay-jfs-T:where([data-height-xsmall]){height:192px}.prc-Overlay-Overlay-jfs-T:where([data-height-small]){height:256px}.prc-Overlay-Overlay-jfs-T:where([data-height-medium]){height:320px}.prc-Overlay-Overlay-jfs-T:where([data-height-large]){height:432px}.prc-Overlay-Overlay-jfs-T:where([data-height-xlarge]){height:600px}.prc-Overlay-Overlay-jfs-T:where([data-height-auto]),.prc-Overlay-Overlay-jfs-T:where([data-height-initial]){height:auto}.prc-Overlay-Overlay-jfs-T:where([data-height-fit-content]){height:-moz-fit-content;height:fit-content}.prc-Overlay-Overlay-jfs-T:where([data-max-height-xsmall]){max-height:192px}.prc-Overlay-Overlay-jfs-T:where([data-max-height-small]){max-height:256px}.prc-Overlay-Overlay-jfs-T:where([data-max-height-medium]){max-height:320px}.prc-Overlay-Overlay-jfs-T:where([data-max-height-large]){max-height:432px}.prc-Overlay-Overlay-jfs-T:where([data-max-height-xlarge]){max-height:600px}.prc-Overlay-Overlay-jfs-T:where([data-max-height-fit-content]){max-height:-moz-fit-content;max-height:fit-content}.prc-Overlay-Overlay-jfs-T:where([data-width-small]){width:256px}.prc-Overlay-Overlay-jfs-T:where([data-width-medium]){width:320px}.prc-Overlay-Overlay-jfs-T:where([data-width-large]){width:480px}.prc-Overlay-Overlay-jfs-T:where([data-width-xlarge]){width:640px}.prc-Overlay-Overlay-jfs-T:where([data-width-xxlarge]){width:960px}.prc-Overlay-Overlay-jfs-T:where([data-width-auto]){width:auto}.prc-Overlay-Overlay-jfs-T:where([data-max-width-small]){max-width:256px}.prc-Overlay-Overlay-jfs-T:where([data-max-width-medium]){max-width:320px}.prc-Overlay-Overlay-jfs-T:where([data-max-width-large]){max-width:480px}.prc-Overlay-Overlay-jfs-T:where([data-max-width-xlarge]){max-width:640px}.prc-Overlay-Overlay-jfs-T:where([data-max-width-xxlarge]){max-width:960px}.prc-Overlay-Overlay-jfs-T:where([data-visibility-visible]){visibility:visible}.prc-Overlay-Overlay-jfs-T:where([data-visibility-hidden]){visibility:hidden}@media screen and (max-width:calc(48rem - 0.02px)){.prc-Overlay-Overlay-jfs-T:where([data-responsive=fullscreen]){border-radius:unset;height:100vh;left:0;margin:0;max-height:none;max-width:none;position:fixed;top:0;width:100vw}}@supports (height:100dvh){.prc-Overlay-Overlay-jfs-T:where([data-variant=fullscreen]){height:100dvh}}@media (prefers-reduced-motion:no-preference){.prc-Overlay-Overlay-jfs-T{animation:prc-Overlay-overlay-appear-JpFey .2s cubic-bezier(.33,1,.68,1)}}
|
|
2
|
-
/*# sourceMappingURL=Overlay-43cda449.css.map */
|
|
@@ -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,CASxC,yBAA2B,CAR3B,mEAAwC,CALxC,WAAY,CASZ,qBAAuB,CARvB,gBAAiB,CAJjB,4BAA6B,CAE7B,eAAgB,CAGhB,eAAgB,CANhB,iBAAkB,CAelB,uBAAyB,CAJzB,mBAAqB,CATrB,UA8KF,CA7JE,iCACE,YACF,CAEA,8BAxBF,2BA0BI,6BAuJJ,CAtJE,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,CAJf,cAAe,CACf,KAAM,CAEN,WAOJ,CADE,CAGF,0BAEE,4DACE,aACF,CACF,CAGF,8CACE,2BACE,wEACF,CACF","file":"Overlay-43cda449.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: hidden;\n background-color: var(--overlay-bgColor);\n border-radius: var(--borderRadius-large);\n box-shadow: var(--shadow-floating-small);\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 /* 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 &: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 }\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"]}
|