@primer/react 0.0.0-20260318110838 → 0.0.0-20260318115733
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -2
- package/dist/ActionList/LinkItem.d.ts +6 -3
- package/dist/ActionList/LinkItem.d.ts.map +1 -1
- package/dist/ActionList/LinkItem.js +42 -87
- package/dist/ActionList/index.d.ts +25 -1
- package/dist/ActionList/index.d.ts.map +1 -1
- package/dist/ActionMenu/ActionMenu.d.ts.map +1 -1
- package/dist/ActionMenu/ActionMenu.js +9 -1
- package/dist/AnchoredOverlay/AnchoredOverlay-0f6f45b5.css +2 -0
- package/dist/AnchoredOverlay/AnchoredOverlay-0f6f45b5.css.map +1 -0
- package/dist/AnchoredOverlay/AnchoredOverlay.d.ts.map +1 -1
- package/dist/AnchoredOverlay/AnchoredOverlay.js +43 -10
- package/dist/AnchoredOverlay/AnchoredOverlay.module.css.js +2 -2
- package/dist/Breadcrumbs/Breadcrumbs.d.ts +23 -8
- package/dist/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.js +27 -65
- package/dist/FeatureFlags/DefaultFeatureFlags.d.ts.map +1 -1
- package/dist/FeatureFlags/DefaultFeatureFlags.js +1 -0
- package/dist/NavList/NavList.d.ts +20 -3
- package/dist/NavList/NavList.d.ts.map +1 -1
- package/dist/NavList/NavList.js +50 -124
- package/dist/Overlay/Overlay-2e0ce8db.css +2 -0
- package/dist/Overlay/Overlay-2e0ce8db.css.map +1 -0
- package/dist/Overlay/Overlay.d.ts.map +1 -1
- package/dist/Overlay/Overlay.js +10 -4
- package/dist/Overlay/Overlay.module.css.js +1 -1
- package/package.json +2 -1
- package/dist/AnchoredOverlay/AnchoredOverlay-73c1b2d1.css +0 -2
- package/dist/AnchoredOverlay/AnchoredOverlay-73c1b2d1.css.map +0 -1
- package/dist/Overlay/Overlay-dbaa6b8c.css +0 -2
- package/dist/Overlay/Overlay-dbaa6b8c.css.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-20260318115733
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#7658](https://github.com/primer/react/pull/7658) [`259fdff`](https://github.com/primer/react/commit/259fdff67550e328b851129a78e87413ddb07229) Thanks [@hussam-i-am](https://github.com/hussam-i-am)! - fix(polymorphic): Improve prop passthrough for ActionList.LinkItem and Breadcrumbs.Item
|
|
4
8
|
|
|
5
9
|
### Patch Changes
|
|
6
10
|
|
|
7
11
|
- Fake entry to force publishing
|
|
8
12
|
|
|
9
|
-
- [
|
|
13
|
+
- [`8e7ec64`](https://github.com/primer/react/commit/8e7ec64c2eb31fac8a15f47d773ece618a739cf3) Thanks [@Copilot](https://github.com/Copilot)! - fix(Link): Remove underline on hover for inline links when `data-a11y-link-underlines` is enabled
|
|
14
|
+
|
|
15
|
+
## 38.16.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- [#7661](https://github.com/primer/react/pull/7661) [`dceb79c`](https://github.com/primer/react/commit/dceb79c5e0f8ab5c25bbc9727bc3207fb77d520e) Thanks [@TylerJDev](https://github.com/TylerJDev)! - AnchoredOverlay: Add CSS Anchor Positioning to `AnchoredOverlay` (under a feature flag)
|
|
10
20
|
|
|
11
21
|
## 38.15.1
|
|
12
22
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type {
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { WithSlotMarker } from '../utils/types/Slots';
|
|
3
3
|
import type { ActionListItemProps } from './shared';
|
|
4
4
|
type LinkProps = {
|
|
5
5
|
download?: string;
|
|
@@ -14,6 +14,9 @@ type LinkProps = {
|
|
|
14
14
|
className?: string;
|
|
15
15
|
};
|
|
16
16
|
export type ActionListLinkItemProps = Pick<ActionListItemProps, 'active' | 'children' | 'inactiveText' | 'variant' | 'size'> & LinkProps;
|
|
17
|
-
|
|
17
|
+
declare const LinkItemComponent: <As extends React.ElementType = "a">(props: (React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As> & Pick<ActionListItemProps, "children" | "size" | "active" | "variant" | "inactiveText"> & LinkProps extends infer T ? T extends React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As> & Pick<ActionListItemProps, "children" | "size" | "active" | "variant" | "inactiveText"> & LinkProps ? T extends unknown ? Omit<T, "as"> : never : never : never) & {
|
|
18
|
+
as?: As | undefined;
|
|
19
|
+
} & React.RefAttributes<unknown>) => React.ReactNode;
|
|
20
|
+
export declare const LinkItem: WithSlotMarker<typeof LinkItemComponent>;
|
|
18
21
|
export {};
|
|
19
22
|
//# sourceMappingURL=LinkItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinkItem.d.ts","sourceRoot":"","sources":["../../src/ActionList/LinkItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"LinkItem.d.ts","sourceRoot":"","sources":["../../src/ActionList/LinkItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,sBAAsB,CAAA;AAGxD,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,UAAU,CAAA;AAIjD,KAAK,SAAS,GAAG;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,cAAc,CAAC,EAAE,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC,gBAAgB,CAAC,CAAA;IAChF,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAGD,MAAM,MAAM,uBAAuB,GAAG,IAAI,CACxC,mBAAmB,EACnB,QAAQ,GAAG,UAAU,GAAG,cAAc,GAAG,SAAS,GAAG,MAAM,CAC5D,GACC,SAAS,CAAA;AAIX,QAAA,MAAM,iBAAiB,GACpB,EAAE,SAAS,KAAK,CAAC,WAAW;;oDAqC9B,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,cAAc,CAAC,OAAO,iBAAiB,CAG5D,CAAA"}
|
|
@@ -1,62 +1,46 @@
|
|
|
1
|
-
import { c } from 'react-compiler-runtime';
|
|
2
|
-
import React from 'react';
|
|
3
1
|
import { Item } from './Item.js';
|
|
2
|
+
import { fixedForwardRef } from '../utils/modern-polymorphic.js';
|
|
4
3
|
import { jsx } from 'react/jsx-runtime';
|
|
5
4
|
import Link from '../Link/Link.js';
|
|
6
5
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
$[2] = active;
|
|
29
|
-
$[3] = className;
|
|
30
|
-
$[4] = inactiveText;
|
|
31
|
-
$[5] = props;
|
|
32
|
-
$[6] = size;
|
|
33
|
-
$[7] = variant;
|
|
34
|
-
} else {
|
|
35
|
-
Component = $[1];
|
|
36
|
-
active = $[2];
|
|
37
|
-
className = $[3];
|
|
38
|
-
inactiveText = $[4];
|
|
39
|
-
props = $[5];
|
|
40
|
-
size = $[6];
|
|
41
|
-
variant = $[7];
|
|
42
|
-
}
|
|
43
|
-
const t1 = inactiveText ? true : undefined;
|
|
44
|
-
let t2;
|
|
45
|
-
if ($[8] !== Component || $[9] !== forwardedRef || $[10] !== inactiveText || $[11] !== props) {
|
|
46
|
-
t2 = t3 => {
|
|
47
|
-
const {
|
|
48
|
-
children,
|
|
49
|
-
onClick,
|
|
50
|
-
...rest
|
|
51
|
-
} = t3;
|
|
6
|
+
const LinkItemComponent = fixedForwardRef(({
|
|
7
|
+
active,
|
|
8
|
+
inactiveText,
|
|
9
|
+
variant,
|
|
10
|
+
size,
|
|
11
|
+
as: Component,
|
|
12
|
+
className,
|
|
13
|
+
...props
|
|
14
|
+
}, forwardedRef) => {
|
|
15
|
+
return /*#__PURE__*/jsx(Item, {
|
|
16
|
+
className: className,
|
|
17
|
+
active: active,
|
|
18
|
+
inactiveText: inactiveText,
|
|
19
|
+
"data-inactive": inactiveText ? true : undefined,
|
|
20
|
+
variant: variant,
|
|
21
|
+
size: size,
|
|
22
|
+
_PrivateItemWrapper: ({
|
|
23
|
+
children,
|
|
24
|
+
onClick,
|
|
25
|
+
...rest
|
|
26
|
+
}) => {
|
|
52
27
|
const clickHandler = event => {
|
|
53
28
|
onClick && onClick(event);
|
|
54
29
|
props.onClick && props.onClick(event);
|
|
55
30
|
};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
31
|
+
if (inactiveText) {
|
|
32
|
+
return /*#__PURE__*/jsx("span", {
|
|
33
|
+
...rest,
|
|
34
|
+
children: children
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Type safety for the polymorphic `as` prop is enforced at the
|
|
39
|
+
// LinkItem boundary via fixedForwardRef. Internally we widen
|
|
40
|
+
// Link's type so TypeScript doesn't re-check the generic
|
|
41
|
+
// constraint across two polymorphic layers.
|
|
42
|
+
const InternalLink = Link;
|
|
43
|
+
return /*#__PURE__*/jsx(InternalLink, {
|
|
60
44
|
as: Component,
|
|
61
45
|
...rest,
|
|
62
46
|
...props,
|
|
@@ -64,42 +48,13 @@ const LinkItem = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
|
64
48
|
ref: forwardedRef,
|
|
65
49
|
children: children
|
|
66
50
|
});
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
t2 = $[12];
|
|
75
|
-
}
|
|
76
|
-
let t3;
|
|
77
|
-
if ($[13] !== active || $[14] !== className || $[15] !== inactiveText || $[16] !== props.children || $[17] !== size || $[18] !== t1 || $[19] !== t2 || $[20] !== variant) {
|
|
78
|
-
t3 = /*#__PURE__*/jsx(Item, {
|
|
79
|
-
className: className,
|
|
80
|
-
active: active,
|
|
81
|
-
inactiveText: inactiveText,
|
|
82
|
-
"data-inactive": t1,
|
|
83
|
-
variant: variant,
|
|
84
|
-
size: size,
|
|
85
|
-
_PrivateItemWrapper: t2,
|
|
86
|
-
children: props.children
|
|
87
|
-
});
|
|
88
|
-
$[13] = active;
|
|
89
|
-
$[14] = className;
|
|
90
|
-
$[15] = inactiveText;
|
|
91
|
-
$[16] = props.children;
|
|
92
|
-
$[17] = size;
|
|
93
|
-
$[18] = t1;
|
|
94
|
-
$[19] = t2;
|
|
95
|
-
$[20] = variant;
|
|
96
|
-
$[21] = t3;
|
|
97
|
-
} else {
|
|
98
|
-
t3 = $[21];
|
|
99
|
-
}
|
|
100
|
-
return t3;
|
|
51
|
+
},
|
|
52
|
+
children: props.children
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
const LinkItem = Object.assign(LinkItemComponent, {
|
|
56
|
+
displayName: 'ActionList.LinkItem',
|
|
57
|
+
__SLOT__: Symbol('ActionList.LinkItem')
|
|
101
58
|
});
|
|
102
|
-
LinkItem.displayName = 'ActionList.LinkItem';
|
|
103
|
-
LinkItem.__SLOT__ = Symbol('ActionList.LinkItem');
|
|
104
59
|
|
|
105
60
|
export { LinkItem };
|
|
@@ -84,7 +84,31 @@ export declare const ActionList: (<As extends React.ElementType = "ul">(props: (
|
|
|
84
84
|
__SLOT__: symbol;
|
|
85
85
|
};
|
|
86
86
|
/** A `Item` that renders a full-size anchor inside ListItem */
|
|
87
|
-
LinkItem: import("../utils/
|
|
87
|
+
LinkItem: import("../utils/types").WithSlotMarker<(<As extends React.ElementType = "a">(props: (import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "a" : As> & Pick<import("./shared").ActionListItemProps, "children" | "size" | "active" | "variant" | "inactiveText"> & {
|
|
88
|
+
download?: string;
|
|
89
|
+
href?: string;
|
|
90
|
+
hrefLang?: string;
|
|
91
|
+
media?: string;
|
|
92
|
+
ping?: string;
|
|
93
|
+
rel?: string;
|
|
94
|
+
target?: string;
|
|
95
|
+
type?: string;
|
|
96
|
+
referrerPolicy?: React.AnchorHTMLAttributes<HTMLAnchorElement>["referrerPolicy"];
|
|
97
|
+
className?: string;
|
|
98
|
+
} extends infer T ? T extends import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "a" : As> & Pick<import("./shared").ActionListItemProps, "children" | "size" | "active" | "variant" | "inactiveText"> & {
|
|
99
|
+
download?: string;
|
|
100
|
+
href?: string;
|
|
101
|
+
hrefLang?: string;
|
|
102
|
+
media?: string;
|
|
103
|
+
ping?: string;
|
|
104
|
+
rel?: string;
|
|
105
|
+
target?: string;
|
|
106
|
+
type?: string;
|
|
107
|
+
referrerPolicy?: React.AnchorHTMLAttributes<HTMLAnchorElement>["referrerPolicy"];
|
|
108
|
+
className?: string;
|
|
109
|
+
} ? T extends unknown ? Omit<T, "as"> : never : never : never) & {
|
|
110
|
+
as?: As | undefined;
|
|
111
|
+
} & import("react").RefAttributes<unknown>) => React.ReactNode)>;
|
|
88
112
|
/** Visually separates `Item`s or `Group`s in an `ActionList`. */
|
|
89
113
|
Divider: import("../utils/types").FCWithSlotMarker<import("react").PropsWithChildren<import("./Divider").ActionListDividerProps>>;
|
|
90
114
|
/** Secondary text which provides additional information about an `Item`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ActionList/index.ts"],"names":[],"mappings":"AAUA,YAAY,EAAC,eAAe,EAAC,MAAM,UAAU,CAAA;AAC7C,YAAY,EAAC,oBAAoB,EAAE,2BAA2B,EAAC,MAAM,SAAS,CAAA;AAC9E,YAAY,EAAC,mBAAmB,EAAC,MAAM,UAAU,CAAA;AACjD,YAAY,EAAC,uBAAuB,EAAC,MAAM,YAAY,CAAA;AACvD,YAAY,EAAC,sBAAsB,EAAC,MAAM,WAAW,CAAA;AACrD,YAAY,EAAC,0BAA0B,EAAC,MAAM,eAAe,CAAA;AAC7D,YAAY,EAAC,4BAA4B,EAAE,6BAA6B,EAAC,MAAM,WAAW,CAAA;AAC1F,YAAY,EAAC,sBAAsB,EAAC,MAAM,WAAW,CAAA;AACrD,YAAY,EAAC,6BAA6B,EAAC,MAAM,kBAAkB,CAAA;AAEnE;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;IACrB,mDAAmD;;IAGnD,yCAAyC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAGzC,+DAA+D
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ActionList/index.ts"],"names":[],"mappings":"AAUA,YAAY,EAAC,eAAe,EAAC,MAAM,UAAU,CAAA;AAC7C,YAAY,EAAC,oBAAoB,EAAE,2BAA2B,EAAC,MAAM,SAAS,CAAA;AAC9E,YAAY,EAAC,mBAAmB,EAAC,MAAM,UAAU,CAAA;AACjD,YAAY,EAAC,uBAAuB,EAAC,MAAM,YAAY,CAAA;AACvD,YAAY,EAAC,sBAAsB,EAAC,MAAM,WAAW,CAAA;AACrD,YAAY,EAAC,0BAA0B,EAAC,MAAM,eAAe,CAAA;AAC7D,YAAY,EAAC,4BAA4B,EAAE,6BAA6B,EAAC,MAAM,WAAW,CAAA;AAC1F,YAAY,EAAC,sBAAsB,EAAC,MAAM,WAAW,CAAA;AACrD,YAAY,EAAC,6BAA6B,EAAC,MAAM,kBAAkB,CAAA;AAEnE;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;IACrB,mDAAmD;;IAGnD,yCAAyC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAGzC,+DAA+D;;;;;;;;;;;;;;;;;;;;;;;;;;IAG/D,iEAAiE;;IAGjE,4EAA4E;;IAG5E,uDAAuD;;IAGvD,sDAAsD;;IAGtD,mCAAmC;;IAGnC,qCAAqC;;IAGrC,uBAAuB;;CAEvB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionMenu.d.ts","sourceRoot":"","sources":["../../src/ActionMenu/ActionMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8D,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"ActionMenu.d.ts","sourceRoot":"","sources":["../../src/ActionMenu/ActionMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8D,MAAM,OAAO,CAAA;AAGlF,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,oBAAoB,CAAA;AAE5D,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,YAAY,CAAA;AAI5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,WAAW,CAAA;AAC1C,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,mBAAmB,CAAA;AAIrD,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAK/F,OAAO,KAAK,EAAC,gBAAgB,EAAE,cAAc,EAAC,MAAM,sBAAsB,CAAA;AAI1E,MAAM,MAAM,gBAAgB,GAAG,CAC7B,OAAO,EAAE,cAAc,GAAG,eAAe,GAAG,QAAQ,GAAG,KAAK,GAAG,aAAa,GAAG,YAAY,GAAG,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;;;;CA4L4E,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { useContext, useState, useEffect, useCallback, useMemo } from 'react';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
2
3
|
import { ChevronRightIcon, TriangleDownIcon } from '@primer/octicons-react';
|
|
3
4
|
import { Divider } from '../ActionList/Divider.js';
|
|
4
5
|
import { ActionListContainerContext } from '../ActionList/ActionListContainerContext.js';
|
|
@@ -43,6 +44,9 @@ const mergeAnchorHandlers = (anchorProps, buttonProps) => {
|
|
|
43
44
|
};
|
|
44
45
|
mergedAnchorProps.onKeyDown = mergedOnAnchorKeyDown;
|
|
45
46
|
}
|
|
47
|
+
if (buttonProps.className) {
|
|
48
|
+
mergedAnchorProps.className = clsx(anchorProps.className, buttonProps.className);
|
|
49
|
+
}
|
|
46
50
|
return mergedAnchorProps;
|
|
47
51
|
};
|
|
48
52
|
const Menu = ({
|
|
@@ -120,7 +124,10 @@ const Menu = ({
|
|
|
120
124
|
};
|
|
121
125
|
}
|
|
122
126
|
} else {
|
|
123
|
-
renderAnchor = anchorProps => /*#__PURE__*/React.cloneElement(child,
|
|
127
|
+
renderAnchor = anchorProps => /*#__PURE__*/React.cloneElement(child, {
|
|
128
|
+
...anchorProps,
|
|
129
|
+
className: clsx(anchorProps.className, child.props.className)
|
|
130
|
+
});
|
|
124
131
|
}
|
|
125
132
|
return null;
|
|
126
133
|
} else if (child.type === MenuButton || isSlot(child, MenuButton)) {
|
|
@@ -181,6 +188,7 @@ const Anchor = /*#__PURE__*/React.forwardRef(({
|
|
|
181
188
|
children: /*#__PURE__*/React.cloneElement(child, {
|
|
182
189
|
...anchorProps,
|
|
183
190
|
ref: anchorRef,
|
|
191
|
+
className: clsx(anchorProps.className, child.props.className),
|
|
184
192
|
onClick: onButtonClick,
|
|
185
193
|
onKeyDown: onButtonKeyDown
|
|
186
194
|
})
|
|
@@ -0,0 +1,2 @@
|
|
|
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 */
|
|
@@ -0,0 +1 @@
|
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnchoredOverlay.d.ts","sourceRoot":"","sources":["../../src/AnchoredOverlay/AnchoredOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,
|
|
1
|
+
{"version":3,"file":"AnchoredOverlay.d.ts","sourceRoot":"","sources":["../../src/AnchoredOverlay/AnchoredOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAA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AA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useCallback, useEffect } from 'react';
|
|
1
|
+
import { useCallback, useRef, useEffect } from 'react';
|
|
2
2
|
import { useFocusTrap } from '../hooks/useFocusTrap.js';
|
|
3
3
|
import { useFocusZone } from '../hooks/useFocusZone.js';
|
|
4
4
|
import { useId } from '../hooks/useId.js';
|
|
@@ -7,11 +7,22 @@ import { XIcon } from '@primer/octicons-react';
|
|
|
7
7
|
import classes from './AnchoredOverlay.module.css.js';
|
|
8
8
|
import { clsx } from 'clsx';
|
|
9
9
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
10
|
+
import { useFeatureFlag } from '../FeatureFlags/useFeatureFlag.js';
|
|
10
11
|
import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
|
|
11
12
|
import { useRenderForcingRef } from '../hooks/useRenderForcingRef.js';
|
|
12
13
|
import { useAnchoredPosition } from '../hooks/useAnchoredPosition.js';
|
|
13
14
|
import Overlay from '../Overlay/Overlay.js';
|
|
14
15
|
|
|
16
|
+
const applyAnchorPositioningPolyfill = async () => {
|
|
17
|
+
if (typeof window !== 'undefined' && !('anchorName' in document.documentElement.style)) {
|
|
18
|
+
try {
|
|
19
|
+
await import('@oddbird/css-anchor-positioning');
|
|
20
|
+
} catch (e) {
|
|
21
|
+
// eslint-disable-next-line no-console
|
|
22
|
+
console.warn('Failed to load CSS anchor positioning polyfill:', e);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
};
|
|
15
26
|
const defaultVariant = {
|
|
16
27
|
regular: 'anchored',
|
|
17
28
|
narrow: 'anchored'
|
|
@@ -48,6 +59,7 @@ const AnchoredOverlay = ({
|
|
|
48
59
|
displayCloseButton = true,
|
|
49
60
|
closeButtonProps = defaultCloseButtonProps
|
|
50
61
|
}) => {
|
|
62
|
+
const cssAnchorPositioning = useFeatureFlag('primer_react_css_anchor_positioning');
|
|
51
63
|
const anchorRef = useProvidedRefOrCreate(externalAnchorRef);
|
|
52
64
|
const [overlayRef, updateOverlayRef] = useRenderForcingRef();
|
|
53
65
|
const anchorId = useId(externalAnchorId);
|
|
@@ -91,12 +103,17 @@ const AnchoredOverlay = ({
|
|
|
91
103
|
displayInViewport,
|
|
92
104
|
onPositionChange: positionChange
|
|
93
105
|
}, [overlayRef.current]);
|
|
106
|
+
const hasLoadedAnchorPositioningPolyfill = useRef(false);
|
|
94
107
|
useEffect(() => {
|
|
95
108
|
// ensure overlay ref gets cleared when closed, so position can reset between closing/re-opening
|
|
96
109
|
if (!open && overlayRef.current) {
|
|
97
110
|
updateOverlayRef(null);
|
|
98
111
|
}
|
|
99
|
-
|
|
112
|
+
if (cssAnchorPositioning && !hasLoadedAnchorPositioningPolyfill.current) {
|
|
113
|
+
applyAnchorPositioningPolyfill();
|
|
114
|
+
hasLoadedAnchorPositioningPolyfill.current = true;
|
|
115
|
+
}
|
|
116
|
+
}, [open, overlayRef, updateOverlayRef, cssAnchorPositioning]);
|
|
100
117
|
useFocusZone({
|
|
101
118
|
containerRef: overlayRef,
|
|
102
119
|
disabled: !open || !position_0,
|
|
@@ -110,7 +127,11 @@ const AnchoredOverlay = ({
|
|
|
110
127
|
const showXIcon = onClose && variant.narrow === 'fullscreen' && displayCloseButton;
|
|
111
128
|
const XButtonAriaLabelledBy = closeButtonProps['aria-labelledby'];
|
|
112
129
|
const XButtonAriaLabel = closeButtonProps['aria-label'];
|
|
113
|
-
|
|
130
|
+
const {
|
|
131
|
+
className: overlayClassName,
|
|
132
|
+
...restOverlayProps
|
|
133
|
+
} = overlayProps || {};
|
|
134
|
+
const innerContent = /*#__PURE__*/jsxs(Fragment, {
|
|
114
135
|
children: [renderAnchor && renderAnchor({
|
|
115
136
|
ref: anchorRef,
|
|
116
137
|
id: anchorId,
|
|
@@ -118,30 +139,35 @@ const AnchoredOverlay = ({
|
|
|
118
139
|
'aria-expanded': open,
|
|
119
140
|
tabIndex: 0,
|
|
120
141
|
onClick: onAnchorClick,
|
|
121
|
-
onKeyDown: onAnchorKeyDown
|
|
142
|
+
onKeyDown: onAnchorKeyDown,
|
|
143
|
+
...(cssAnchorPositioning ? {
|
|
144
|
+
className: classes.Anchor
|
|
145
|
+
} : {})
|
|
122
146
|
}), open ? /*#__PURE__*/jsxs(Overlay, {
|
|
123
147
|
returnFocusRef: anchorRef,
|
|
124
148
|
onClickOutside: onClickOutside,
|
|
125
149
|
ignoreClickRefs: [anchorRef],
|
|
126
150
|
onEscape: onEscape,
|
|
127
151
|
role: "none",
|
|
128
|
-
visibility: position_0 ? 'visible' : 'hidden',
|
|
152
|
+
visibility: cssAnchorPositioning || position_0 ? 'visible' : 'hidden',
|
|
129
153
|
height: height,
|
|
130
154
|
width: width,
|
|
131
|
-
top: (position_0 === null || position_0 === void 0 ? void 0 : position_0.top) || 0,
|
|
132
|
-
left: (position_0 === null || position_0 === void 0 ? void 0 : position_0.left) || 0,
|
|
155
|
+
top: cssAnchorPositioning ? undefined : (position_0 === null || position_0 === void 0 ? void 0 : position_0.top) || 0,
|
|
156
|
+
left: cssAnchorPositioning ? undefined : (position_0 === null || position_0 === void 0 ? void 0 : position_0.left) || 0,
|
|
133
157
|
responsiveVariant: variant.narrow === 'fullscreen' ? 'fullscreen' : undefined,
|
|
134
|
-
anchorSide: position_0 === null || position_0 === void 0 ? void 0 : position_0.anchorSide,
|
|
135
|
-
className: className,
|
|
158
|
+
anchorSide: cssAnchorPositioning ? undefined : position_0 === null || position_0 === void 0 ? void 0 : position_0.anchorSide,
|
|
159
|
+
className: clsx(className, overlayClassName, cssAnchorPositioning ? classes.AnchoredOverlay : undefined),
|
|
136
160
|
preventOverflow: preventOverflow,
|
|
137
161
|
"data-component": "AnchoredOverlay",
|
|
138
|
-
...
|
|
162
|
+
...restOverlayProps,
|
|
139
163
|
ref: node => {
|
|
140
164
|
if (overlayProps !== null && overlayProps !== void 0 && overlayProps.ref) {
|
|
141
165
|
assignRef(overlayProps.ref, node);
|
|
142
166
|
}
|
|
143
167
|
updateOverlayRef(node);
|
|
144
168
|
},
|
|
169
|
+
"data-anchor-position": cssAnchorPositioning,
|
|
170
|
+
"data-side": cssAnchorPositioning ? side : position_0 === null || position_0 === void 0 ? void 0 : position_0.anchorSide,
|
|
145
171
|
children: [showXIcon ? /*#__PURE__*/jsx("div", {
|
|
146
172
|
className: classes.ResponsiveCloseButtonContainer,
|
|
147
173
|
children: /*#__PURE__*/jsx(IconButton, {
|
|
@@ -164,6 +190,13 @@ const AnchoredOverlay = ({
|
|
|
164
190
|
}) : null, children]
|
|
165
191
|
}) : null]
|
|
166
192
|
});
|
|
193
|
+
if (cssAnchorPositioning) {
|
|
194
|
+
return /*#__PURE__*/jsx("div", {
|
|
195
|
+
className: classes.Wrapper,
|
|
196
|
+
children: innerContent
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
return innerContent;
|
|
167
200
|
};
|
|
168
201
|
function assignRef(ref, value) {
|
|
169
202
|
if (typeof ref === 'function') {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import './AnchoredOverlay-
|
|
1
|
+
import './AnchoredOverlay-0f6f45b5.css';
|
|
2
2
|
|
|
3
|
-
var classes = {"ResponsiveCloseButtonContainer":"prc-AnchoredOverlay-ResponsiveCloseButtonContainer-nuium","ResponsiveCloseButton":"prc-AnchoredOverlay-ResponsiveCloseButton-z-2rx"};
|
|
3
|
+
var classes = {"ResponsiveCloseButtonContainer":"prc-AnchoredOverlay-ResponsiveCloseButtonContainer-nuium","ResponsiveCloseButton":"prc-AnchoredOverlay-ResponsiveCloseButton-z-2rx","Wrapper":"prc-AnchoredOverlay-Wrapper-w6jU3","Anchor":"prc-AnchoredOverlay-Anchor-DWRfK","AnchoredOverlay":"prc-AnchoredOverlay-AnchoredOverlay-fYg9Z"};
|
|
4
4
|
|
|
5
5
|
export { classes as default };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { To } from 'history';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { type PolymorphicProps } from '../utils/modern-polymorphic';
|
|
3
4
|
export type BreadcrumbsProps = React.PropsWithChildren<{
|
|
4
5
|
/**
|
|
5
6
|
* Optional class name for the breadcrumbs container.
|
|
@@ -27,24 +28,38 @@ declare function Breadcrumbs({ className, children, style, overflow, variant }:
|
|
|
27
28
|
declare namespace Breadcrumbs {
|
|
28
29
|
var displayName: string;
|
|
29
30
|
}
|
|
30
|
-
type
|
|
31
|
-
type StyledBreadcrumbsItemProps<As extends React.ElementType> = {
|
|
32
|
-
as?: As;
|
|
31
|
+
type StyledBreadcrumbsItemProps<As extends React.ElementType = 'a'> = PolymorphicProps<As, 'a', {
|
|
33
32
|
to?: To;
|
|
34
33
|
selected?: boolean;
|
|
35
|
-
|
|
36
|
-
style?: React.CSSProperties;
|
|
37
|
-
} & DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? 'a' : As>, 'as'>;
|
|
34
|
+
}>;
|
|
38
35
|
export type BreadcrumbsItemProps<As extends React.ElementType = 'a'> = StyledBreadcrumbsItemProps<As>;
|
|
39
36
|
declare const _default: typeof Breadcrumbs & {
|
|
40
|
-
Item:
|
|
37
|
+
Item: (<As extends React.ElementType = "a">(props: (React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As> & {
|
|
38
|
+
to?: To;
|
|
39
|
+
selected?: boolean;
|
|
40
|
+
} extends infer T ? T extends React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As> & {
|
|
41
|
+
to?: To;
|
|
42
|
+
selected?: boolean;
|
|
43
|
+
} ? T extends unknown ? Omit<T, "as"> : never : never : never) & {
|
|
44
|
+
as?: As | undefined;
|
|
45
|
+
} & React.RefAttributes<any>) => React.ReactNode) & {
|
|
46
|
+
displayName: string;
|
|
47
|
+
};
|
|
41
48
|
};
|
|
42
49
|
export default _default;
|
|
43
50
|
/**
|
|
44
51
|
* @deprecated Use the `Breadcrumbs` component instead (i.e. `<Breadcrumb>` → `<Breadcrumbs>`)
|
|
45
52
|
*/
|
|
46
53
|
export declare const Breadcrumb: typeof Breadcrumbs & {
|
|
47
|
-
Item:
|
|
54
|
+
Item: <As extends React.ElementType = "a">(props: (React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As> & {
|
|
55
|
+
to?: To;
|
|
56
|
+
selected?: boolean;
|
|
57
|
+
} extends infer T ? T extends React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As> & {
|
|
58
|
+
to?: To;
|
|
59
|
+
selected?: boolean;
|
|
60
|
+
} ? T extends unknown ? Omit<T, "as"> : never : never : never) & {
|
|
61
|
+
as?: As | undefined;
|
|
62
|
+
} & React.RefAttributes<any>) => React.ReactNode;
|
|
48
63
|
};
|
|
49
64
|
/**
|
|
50
65
|
* @deprecated Use the `BreadcrumbsProps` type instead
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Breadcrumbs.d.ts","sourceRoot":"","sources":["../../src/Breadcrumbs/Breadcrumbs.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,EAAE,EAAC,MAAM,SAAS,CAAA;AAC/B,OAAO,KAA6E,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"Breadcrumbs.d.ts","sourceRoot":"","sources":["../../src/Breadcrumbs/Breadcrumbs.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,EAAE,EAAC,MAAM,SAAS,CAAA;AAC/B,OAAO,KAA6E,MAAM,OAAO,CAAA;AAWjG,OAAO,EAAC,KAAK,gBAAgB,EAAkB,MAAM,6BAA6B,CAAA;AAElF,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,iBAAiB,CAAC;IACrD;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,gBAAgB,CAAA;IAC7C;;;;OAIG;IACH,OAAO,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAA;IAC/B;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;CAC5B,CAAC,CAAA;AA8GF,iBAAS,WAAW,CAAC,EAAC,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAiB,EAAE,OAAkB,EAAC,EAAE,gBAAgB,qBA+MzG;kBA/MQ,WAAW;;;AA2NpB,KAAK,0BAA0B,CAAC,EAAE,SAAS,KAAK,CAAC,WAAW,GAAG,GAAG,IAAI,gBAAgB,CACpF,EAAE,EACF,GAAG,EACH;IACE,EAAE,CAAC,EAAE,EAAE,CAAA;IACP,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CACF,CAAA;AAsBD,MAAM,MAAM,oBAAoB,CAAC,EAAE,SAAS,KAAK,CAAC,WAAW,GAAG,GAAG,IAAI,0BAA0B,CAAC,EAAE,CAAC,CAAA;;YAnBlG,EAAE,SAAS,KAAK,CAAC,WAAW;aANtB,EAAE;mBACI,OAAO;;aADb,EAAE;mBACI,OAAO;;;;;;;AA2BtB,wBAAiF;AAEjF;;GAEG;AACH,eAAO,MAAM,UAAU;WA3BpB,EAAE,SAAS,KAAK,CAAC,WAAW;aANtB,EAAE;mBACI,OAAO;;aADb,EAAE;mBACI,OAAO;;;;CAgCuD,CAAA;AAE7E;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,gBAAgB,CAAA;AAE9C;;GAEG;AACH,MAAM,MAAM,mBAAmB,CAAC,EAAE,SAAS,KAAK,CAAC,WAAW,GAAG,GAAG,IAAI,oBAAoB,CAAC,EAAE,CAAC,CAAA"}
|
|
@@ -8,6 +8,7 @@ import { KebabHorizontalIcon } from '@primer/octicons-react';
|
|
|
8
8
|
import { useResizeObserver } from '../hooks/useResizeObserver.js';
|
|
9
9
|
import { useOnEscapePress } from '../hooks/useOnEscapePress.js';
|
|
10
10
|
import { useOnOutsideClick } from '../hooks/useOnOutsideClick.js';
|
|
11
|
+
import { fixedForwardRef } from '../utils/modern-polymorphic.js';
|
|
11
12
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
12
13
|
import { useFeatureFlag } from '../FeatureFlags/useFeatureFlag.js';
|
|
13
14
|
import Details from '../Details/Details.js';
|
|
@@ -399,69 +400,26 @@ const ItemSeparator = () => {
|
|
|
399
400
|
}
|
|
400
401
|
return t0;
|
|
401
402
|
};
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
...rest
|
|
417
|
-
} = props);
|
|
418
|
-
$[0] = props;
|
|
419
|
-
$[1] = className;
|
|
420
|
-
$[2] = rest;
|
|
421
|
-
$[3] = selected;
|
|
422
|
-
$[4] = t0;
|
|
423
|
-
} else {
|
|
424
|
-
className = $[1];
|
|
425
|
-
rest = $[2];
|
|
426
|
-
selected = $[3];
|
|
427
|
-
t0 = $[4];
|
|
428
|
-
}
|
|
429
|
-
const Component = t0 === undefined ? "a" : t0;
|
|
430
|
-
const t1 = selected && "selected";
|
|
431
|
-
let t2;
|
|
432
|
-
if ($[5] !== className || $[6] !== t1) {
|
|
433
|
-
t2 = clsx(className, classes.Item, t1);
|
|
434
|
-
$[5] = className;
|
|
435
|
-
$[6] = t1;
|
|
436
|
-
$[7] = t2;
|
|
437
|
-
} else {
|
|
438
|
-
t2 = $[7];
|
|
439
|
-
}
|
|
440
|
-
const t3 = selected ? "page" : undefined;
|
|
441
|
-
let t4;
|
|
442
|
-
if ($[8] !== Component || $[9] !== ref || $[10] !== rest || $[11] !== t2 || $[12] !== t3) {
|
|
443
|
-
t4 = /*#__PURE__*/jsx(Component, {
|
|
444
|
-
className: t2,
|
|
445
|
-
"aria-current": t3,
|
|
446
|
-
ref: ref,
|
|
447
|
-
...rest
|
|
448
|
-
});
|
|
449
|
-
$[8] = Component;
|
|
450
|
-
$[9] = ref;
|
|
451
|
-
$[10] = rest;
|
|
452
|
-
$[11] = t2;
|
|
453
|
-
$[12] = t3;
|
|
454
|
-
$[13] = t4;
|
|
455
|
-
} else {
|
|
456
|
-
t4 = $[13];
|
|
457
|
-
}
|
|
458
|
-
return t4;
|
|
459
|
-
}
|
|
460
|
-
BreadcrumbsItemComponent.displayName = 'Breadcrumbs.Item';
|
|
461
|
-
const BreadcrumbsItem = /*#__PURE__*/React.forwardRef(BreadcrumbsItemComponent);
|
|
403
|
+
const BreadcrumbsItem = fixedForwardRef((props, ref) => {
|
|
404
|
+
const {
|
|
405
|
+
as: Component = 'a',
|
|
406
|
+
selected,
|
|
407
|
+
className,
|
|
408
|
+
...rest
|
|
409
|
+
} = props;
|
|
410
|
+
return /*#__PURE__*/jsx(Component, {
|
|
411
|
+
className: clsx(className, classes.Item, selected && 'selected'),
|
|
412
|
+
"aria-current": selected ? 'page' : undefined,
|
|
413
|
+
ref: ref,
|
|
414
|
+
...rest
|
|
415
|
+
});
|
|
416
|
+
});
|
|
462
417
|
Breadcrumbs.displayName = 'Breadcrumbs';
|
|
418
|
+
const BreadcrumbsItemWithDisplayName = Object.assign(BreadcrumbsItem, {
|
|
419
|
+
displayName: 'Breadcrumbs.Item'
|
|
420
|
+
});
|
|
463
421
|
var Breadcrumbs_default = Object.assign(Breadcrumbs, {
|
|
464
|
-
Item:
|
|
422
|
+
Item: BreadcrumbsItemWithDisplayName
|
|
465
423
|
});
|
|
466
424
|
|
|
467
425
|
/**
|
|
@@ -479,11 +437,15 @@ const Breadcrumb = Object.assign(Breadcrumbs, {
|
|
|
479
437
|
* @deprecated Use the `BreadcrumbsItemProps` type instead
|
|
480
438
|
*/
|
|
481
439
|
function _temp(item, index) {
|
|
482
|
-
const
|
|
483
|
-
|
|
484
|
-
|
|
440
|
+
const {
|
|
441
|
+
children,
|
|
442
|
+
selected,
|
|
443
|
+
as: Component,
|
|
444
|
+
...itemProps
|
|
445
|
+
} = item.props;
|
|
485
446
|
return /*#__PURE__*/jsx(ActionList.LinkItem, {
|
|
486
|
-
|
|
447
|
+
as: Component,
|
|
448
|
+
...itemProps,
|
|
487
449
|
"aria-current": selected ? "page" : undefined,
|
|
488
450
|
children: children
|
|
489
451
|
}, index);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultFeatureFlags.d.ts","sourceRoot":"","sources":["../../src/FeatureFlags/DefaultFeatureFlags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAA;AAEnD,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"DefaultFeatureFlags.d.ts","sourceRoot":"","sources":["../../src/FeatureFlags/DefaultFeatureFlags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAA;AAEnD,eAAO,MAAM,mBAAmB,kBAS9B,CAAA"}
|
|
@@ -2,6 +2,7 @@ import { FeatureFlagScope } from './FeatureFlagScope.js';
|
|
|
2
2
|
|
|
3
3
|
const DefaultFeatureFlags = FeatureFlagScope.create({
|
|
4
4
|
primer_react_breadcrumbs_overflow_menu: false,
|
|
5
|
+
primer_react_css_anchor_positioning: false,
|
|
5
6
|
primer_react_css_has_selector_perf: false,
|
|
6
7
|
primer_react_select_panel_fullscreen_on_narrow: false,
|
|
7
8
|
primer_react_select_panel_order_selected_at_top: false,
|
|
@@ -2,16 +2,17 @@ import { type Icon } from '@primer/octicons-react';
|
|
|
2
2
|
import type { ForwardRefComponent as PolymorphicForwardRefComponent } from '../utils/polymorphic';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import type { ActionListTrailingActionProps, ActionListDividerProps, ActionListLeadingVisualProps, ActionListTrailingVisualProps, ActionListGroupHeadingProps } from '../ActionList';
|
|
5
|
+
import { type PolymorphicProps } from '../utils/modern-polymorphic';
|
|
5
6
|
export type NavListProps = {
|
|
6
7
|
children: React.ReactNode;
|
|
7
8
|
} & React.ComponentProps<'nav'>;
|
|
8
|
-
export type NavListItemProps = {
|
|
9
|
+
export type NavListItemProps<As extends React.ElementType = React.ElementType> = PolymorphicProps<As, 'a', {
|
|
9
10
|
children: React.ReactNode;
|
|
10
11
|
defaultOpen?: boolean;
|
|
11
12
|
href?: string;
|
|
12
13
|
'aria-current'?: 'page' | 'step' | 'location' | 'date' | 'time' | 'true' | 'false' | boolean;
|
|
13
14
|
inactiveText?: string;
|
|
14
|
-
}
|
|
15
|
+
}>;
|
|
15
16
|
export type NavListSubNavProps = {
|
|
16
17
|
children: React.ReactNode;
|
|
17
18
|
};
|
|
@@ -40,7 +41,23 @@ export declare const GroupExpand: React.ForwardRefExoticComponent<NavListGroupEx
|
|
|
40
41
|
export type NavListGroupHeadingProps = ActionListGroupHeadingProps;
|
|
41
42
|
export declare const NavList: React.ForwardRefExoticComponent<Omit<NavListProps, "ref"> & React.RefAttributes<HTMLElement>> & {
|
|
42
43
|
Description: import("../utils/types").FCWithSlotMarker<React.PropsWithChildren<import("..").ActionListDescriptionProps>>;
|
|
43
|
-
Item:
|
|
44
|
+
Item: (<As extends React.ElementType = "a">(props: (React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As> & {
|
|
45
|
+
children: React.ReactNode;
|
|
46
|
+
defaultOpen?: boolean;
|
|
47
|
+
href?: string;
|
|
48
|
+
'aria-current'?: "page" | "step" | "location" | "date" | "time" | "true" | "false" | boolean;
|
|
49
|
+
inactiveText?: string;
|
|
50
|
+
} extends infer T ? T extends React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As> & {
|
|
51
|
+
children: React.ReactNode;
|
|
52
|
+
defaultOpen?: boolean;
|
|
53
|
+
href?: string;
|
|
54
|
+
'aria-current'?: "page" | "step" | "location" | "date" | "time" | "true" | "false" | boolean;
|
|
55
|
+
inactiveText?: string;
|
|
56
|
+
} ? T extends unknown ? Omit<T, "as"> : never : never : never) & {
|
|
57
|
+
as?: As | undefined;
|
|
58
|
+
} & React.RefAttributes<unknown>) => React.ReactNode) & {
|
|
59
|
+
displayName: string;
|
|
60
|
+
};
|
|
44
61
|
SubNav: PolymorphicForwardRefComponent<"ul", NavListSubNavProps>;
|
|
45
62
|
LeadingVisual: import("../utils/types").FCWithSlotMarker<React.PropsWithChildren<import("../ActionList/Visuals").VisualProps>>;
|
|
46
63
|
TrailingVisual: import("../utils/types").FCWithSlotMarker<React.PropsWithChildren<import("../ActionList/Visuals").VisualProps>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavList.d.ts","sourceRoot":"","sources":["../../src/NavList/NavList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,IAAI,EAAC,MAAM,wBAAwB,CAAA;AAC3E,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAC/F,OAAO,KAAuB,MAAM,OAAO,CAAA;AAE3C,OAAO,KAAK,EACV,6BAA6B,EAC7B,sBAAsB,EACtB,4BAA4B,EAC5B,6BAA6B,EAC7B,2BAA2B,EAC5B,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"NavList.d.ts","sourceRoot":"","sources":["../../src/NavList/NavList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,IAAI,EAAC,MAAM,wBAAwB,CAAA;AAC3E,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAC/F,OAAO,KAAuB,MAAM,OAAO,CAAA;AAE3C,OAAO,KAAK,EACV,6BAA6B,EAC7B,sBAAsB,EACtB,4BAA4B,EAC5B,6BAA6B,EAC7B,2BAA2B,EAC5B,MAAM,eAAe,CAAA;AAUtB,OAAO,EAAkB,KAAK,gBAAgB,EAAC,MAAM,6BAA6B,CAAA;AAKlF,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAA;AAqB/B,MAAM,MAAM,gBAAgB,CAAC,EAAE,SAAS,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,WA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AAE,SAAS,KAAK,KAAK,CAAC,SAAS,CAAA;CAClD,CAAA;AAED,eAAO,MAAM,WAAW,mGAgFvB,CAAA;AAKD,MAAM,MAAM,wBAAwB,GAAG,2BAA2B,CAAA;AAqBlE,eAAO,MAAM,OAAO;;YAnVjB,EAAE,SAAS,KAAK,CAAC,WAAW;kBATjB,KAAK,CAAC,SAAS;sBACX,OAAO;eACd,MAAM;yBACI,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO;uBAC7E,MAAM;;kBAJX,KAAK,CAAC,SAAS;sBACX,OAAO;eACd,MAAM;yBACI,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO;uBAC7E,MAAM;;;;;;;;;;;;;;CAmWvB,CAAA"}
|
package/dist/NavList/NavList.js
CHANGED
|
@@ -11,6 +11,7 @@ import classes from '../ActionList/ActionList.module.css.js';
|
|
|
11
11
|
import navListClasses from './NavList.module.css.js';
|
|
12
12
|
import { flushSync } from 'react-dom';
|
|
13
13
|
import { isSlot } from '../utils/is-slot.js';
|
|
14
|
+
import { fixedForwardRef } from '../utils/modern-polymorphic.js';
|
|
14
15
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
15
16
|
|
|
16
17
|
const Root = /*#__PURE__*/React.forwardRef((t0, ref) => {
|
|
@@ -72,128 +73,59 @@ Root.displayName = 'NavList';
|
|
|
72
73
|
// ----------------------------------------------------------------------------
|
|
73
74
|
// NavList.Item
|
|
74
75
|
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
({
|
|
83
|
-
"aria-current": ariaCurrent,
|
|
84
|
-
children,
|
|
85
|
-
defaultOpen,
|
|
86
|
-
...props
|
|
87
|
-
} = t0);
|
|
88
|
-
$[0] = t0;
|
|
89
|
-
$[1] = ariaCurrent;
|
|
90
|
-
$[2] = children;
|
|
91
|
-
$[3] = defaultOpen;
|
|
92
|
-
$[4] = props;
|
|
93
|
-
} else {
|
|
94
|
-
ariaCurrent = $[1];
|
|
95
|
-
children = $[2];
|
|
96
|
-
defaultOpen = $[3];
|
|
97
|
-
props = $[4];
|
|
98
|
-
}
|
|
76
|
+
const ItemComponent = fixedForwardRef(({
|
|
77
|
+
'aria-current': ariaCurrent,
|
|
78
|
+
children,
|
|
79
|
+
defaultOpen,
|
|
80
|
+
as: Component,
|
|
81
|
+
...props
|
|
82
|
+
}, ref) => {
|
|
99
83
|
const {
|
|
100
84
|
depth
|
|
101
85
|
} = React.useContext(SubNavContext);
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
$[7] = childrenWithoutSubNavOrTrailingAction;
|
|
123
|
-
$[8] = subNav;
|
|
124
|
-
$[9] = t1;
|
|
125
|
-
} else {
|
|
126
|
-
childrenWithoutSubNavOrTrailingAction = $[7];
|
|
127
|
-
subNav = $[8];
|
|
128
|
-
t1 = $[9];
|
|
129
|
-
}
|
|
130
|
-
if (t1) {
|
|
131
|
-
let t2;
|
|
132
|
-
if ($[12] !== depth) {
|
|
133
|
-
t2 = {
|
|
134
|
-
"--subitem-depth": depth
|
|
135
|
-
};
|
|
136
|
-
$[12] = depth;
|
|
137
|
-
$[13] = t2;
|
|
138
|
-
} else {
|
|
139
|
-
t2 = $[13];
|
|
140
|
-
}
|
|
141
|
-
const t3 = t2;
|
|
142
|
-
let t4;
|
|
143
|
-
if ($[14] !== childrenWithoutSubNavOrTrailingAction || $[15] !== defaultOpen || $[16] !== depth || $[17] !== subNav || $[18] !== t3) {
|
|
144
|
-
t4 = /*#__PURE__*/jsx(ItemWithSubNav, {
|
|
145
|
-
subNav: subNav,
|
|
146
|
-
depth: depth,
|
|
147
|
-
defaultOpen: defaultOpen,
|
|
148
|
-
style: t3,
|
|
149
|
-
children: childrenWithoutSubNavOrTrailingAction
|
|
150
|
-
});
|
|
151
|
-
$[14] = childrenWithoutSubNavOrTrailingAction;
|
|
152
|
-
$[15] = defaultOpen;
|
|
153
|
-
$[16] = depth;
|
|
154
|
-
$[17] = subNav;
|
|
155
|
-
$[18] = t3;
|
|
156
|
-
$[19] = t4;
|
|
157
|
-
} else {
|
|
158
|
-
t4 = $[19];
|
|
159
|
-
}
|
|
160
|
-
return t4;
|
|
161
|
-
}
|
|
162
|
-
const t2 = Boolean(ariaCurrent) && ariaCurrent !== "false";
|
|
163
|
-
let t3;
|
|
164
|
-
if ($[20] !== depth) {
|
|
165
|
-
t3 = {
|
|
166
|
-
"--subitem-depth": depth
|
|
167
|
-
};
|
|
168
|
-
$[20] = depth;
|
|
169
|
-
$[21] = t3;
|
|
170
|
-
} else {
|
|
171
|
-
t3 = $[21];
|
|
172
|
-
}
|
|
173
|
-
const t4 = t3;
|
|
174
|
-
let t5;
|
|
175
|
-
if ($[22] !== ariaCurrent || $[23] !== children || $[24] !== props || $[25] !== ref || $[26] !== t2 || $[27] !== t4) {
|
|
176
|
-
t5 = /*#__PURE__*/jsx(ActionList.LinkItem, {
|
|
177
|
-
ref: ref,
|
|
178
|
-
"aria-current": ariaCurrent,
|
|
179
|
-
active: t2,
|
|
180
|
-
style: t4,
|
|
181
|
-
...props,
|
|
182
|
-
children: children
|
|
86
|
+
|
|
87
|
+
// Get SubNav from children
|
|
88
|
+
const subNav = React.Children.toArray(children).find(child => /*#__PURE__*/isValidElement(child) && (child.type === SubNav || isSlot(child, SubNav)));
|
|
89
|
+
|
|
90
|
+
// Get children without SubNav or TrailingAction
|
|
91
|
+
const childrenWithoutSubNavOrTrailingAction = React.Children.toArray(children).filter(child => /*#__PURE__*/isValidElement(child) ? child.type !== SubNav && child.type !== TrailingAction && !isSlot(child, SubNav) && !isSlot(child, TrailingAction) : true);
|
|
92
|
+
if (! /*#__PURE__*/isValidElement(subNav) && defaultOpen)
|
|
93
|
+
// eslint-disable-next-line no-console
|
|
94
|
+
console.error('NavList.Item must have a NavList.SubNav to use defaultOpen.');
|
|
95
|
+
|
|
96
|
+
// Render ItemWithSubNav if SubNav is present
|
|
97
|
+
if (subNav && /*#__PURE__*/isValidElement(subNav)) {
|
|
98
|
+
return /*#__PURE__*/jsx(ItemWithSubNav, {
|
|
99
|
+
subNav: subNav,
|
|
100
|
+
depth: depth,
|
|
101
|
+
defaultOpen: defaultOpen,
|
|
102
|
+
style: {
|
|
103
|
+
'--subitem-depth': depth
|
|
104
|
+
},
|
|
105
|
+
children: childrenWithoutSubNavOrTrailingAction
|
|
183
106
|
});
|
|
184
|
-
$[22] = ariaCurrent;
|
|
185
|
-
$[23] = children;
|
|
186
|
-
$[24] = props;
|
|
187
|
-
$[25] = ref;
|
|
188
|
-
$[26] = t2;
|
|
189
|
-
$[27] = t4;
|
|
190
|
-
$[28] = t5;
|
|
191
|
-
} else {
|
|
192
|
-
t5 = $[28];
|
|
193
107
|
}
|
|
194
|
-
|
|
108
|
+
|
|
109
|
+
// Type safety for the polymorphic `as` prop is enforced at the
|
|
110
|
+
// Item boundary via fixedForwardRef. Internally we widen
|
|
111
|
+
// LinkItem's type so TypeScript doesn't re-check the generic
|
|
112
|
+
// constraint across two polymorphic layers.
|
|
113
|
+
const InternalLinkItem = ActionList.LinkItem;
|
|
114
|
+
return /*#__PURE__*/jsx(InternalLinkItem, {
|
|
115
|
+
ref: ref,
|
|
116
|
+
as: Component,
|
|
117
|
+
"aria-current": ariaCurrent,
|
|
118
|
+
active: Boolean(ariaCurrent) && ariaCurrent !== 'false',
|
|
119
|
+
style: {
|
|
120
|
+
'--subitem-depth': depth
|
|
121
|
+
},
|
|
122
|
+
...props,
|
|
123
|
+
children: children
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
const Item = Object.assign(ItemComponent, {
|
|
127
|
+
displayName: 'NavList.Item'
|
|
195
128
|
});
|
|
196
|
-
Item.displayName = 'NavList.Item';
|
|
197
129
|
|
|
198
130
|
// ----------------------------------------------------------------------------
|
|
199
131
|
// ItemWithSubNav (internal)
|
|
@@ -259,7 +191,7 @@ function ItemWithSubNav(t0) {
|
|
|
259
191
|
const t4 = !isOpen && containsCurrentItem;
|
|
260
192
|
let t5;
|
|
261
193
|
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
262
|
-
t5 = () => setIsOpen(
|
|
194
|
+
t5 = () => setIsOpen(_temp);
|
|
263
195
|
$[8] = t5;
|
|
264
196
|
} else {
|
|
265
197
|
t5 = $[8];
|
|
@@ -341,7 +273,7 @@ function ItemWithSubNav(t0) {
|
|
|
341
273
|
|
|
342
274
|
// ----------------------------------------------------------------------------
|
|
343
275
|
// NavList.SubNav
|
|
344
|
-
function
|
|
276
|
+
function _temp(open) {
|
|
345
277
|
return !open;
|
|
346
278
|
}
|
|
347
279
|
const SubNavContext = /*#__PURE__*/React.createContext({
|
|
@@ -696,11 +628,5 @@ const NavList = Object.assign(Root, {
|
|
|
696
628
|
GroupExpand,
|
|
697
629
|
GroupHeading
|
|
698
630
|
});
|
|
699
|
-
function _temp(child) {
|
|
700
|
-
return /*#__PURE__*/isValidElement(child) && (child.type === SubNav || isSlot(child, SubNav));
|
|
701
|
-
}
|
|
702
|
-
function _temp2(child_0) {
|
|
703
|
-
return /*#__PURE__*/isValidElement(child_0) ? child_0.type !== SubNav && child_0.type !== TrailingAction && !isSlot(child_0, SubNav) && !isSlot(child_0, TrailingAction) : true;
|
|
704
|
-
}
|
|
705
631
|
|
|
706
632
|
export { GroupExpand, NavList };
|
|
@@ -0,0 +1,2 @@
|
|
|
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);box-shadow:var(--shadow-floating-small,var(--color-overlay-shadow));height:auto;max-height:100vh;max-width:calc(100vw - 2rem);min-width:192px;overflow:auto;position:absolute;width:auto}.prc-Overlay-Overlay-jfs-T:not([data-anchor-position]):not([data-variant=modal]),.prc-Overlay-Overlay-jfs-T[data-anchor-position=false]{bottom:var(--bottom,auto);right:var(--right,auto)}@media screen and (max-width:calc(48rem - 0.02px)){[data-responsive=fullscreen]:is(.prc-Overlay-Overlay-jfs-T[data-anchor-position=false],.prc-Overlay-Overlay-jfs-T:not([data-anchor-position]):not([data-variant=modal])):not([data-variant]){left:0;top:0}}:is(.prc-Overlay-Overlay-jfs-T[data-anchor-position=false],.prc-Overlay-Overlay-jfs-T:not([data-anchor-position]):not([data-variant=modal])):not([data-variant]){left:var(--left,auto);top:var(--top,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;padding-bottom:env(safe-area-inset-bottom);position:fixed;top:0;width:100vw}@supports (height:100dvh){.prc-Overlay-Overlay-jfs-T:where([data-responsive=fullscreen]){height:100dvh}}}@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-2e0ce8db.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Overlay.d.ts","sourceRoot":"","sources":["../../src/Overlay/Overlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,qBAAqB,EAAe,MAAM,OAAO,CAAA;AAC9D,OAAO,KAA0B,MAAM,OAAO,CAAA;AAE9C,OAAO,KAAK,EAAC,QAAQ,EAAE,KAAK,EAAC,MAAM,gBAAgB,CAAA;AACnD,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,UAAU,CAAA;AAI/C,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAA;AACjD,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"Overlay.d.ts","sourceRoot":"","sources":["../../src/Overlay/Overlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,qBAAqB,EAAe,MAAM,OAAO,CAAA;AAC9D,OAAO,KAA0B,MAAM,OAAO,CAAA;AAE9C,OAAO,KAAK,EAAC,QAAQ,EAAE,KAAK,EAAC,MAAM,gBAAgB,CAAA;AACnD,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,UAAU,CAAA;AAI/C,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAA;AACjD,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAK/F,KAAK,kBAAkB,GAAG;IACxB,KAAK,CAAC,EAAE,MAAM,OAAO,QAAQ,CAAA;IAC7B,MAAM,CAAC,EAAE,MAAM,OAAO,SAAS,CAAA;IAC/B,SAAS,CAAC,EAAE,MAAM,IAAI,CAA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UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EAAE,CAAA;IACvD,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IACrD,cAAc,EAAE,CAAC,CAAC,EAAE,iBAAiB,KAAK,IAAI,CAAA;IAC9C,QAAQ,EAAE,CAAC,CAAC,EAAE,aAAa,KAAK,IAAI,CAAA;IACpC,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,cAAc,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;CACpD,CAAA;AAED,KAAK,oBAAoB,GAAG,KAAK,CAAC,eAAe,EAAE,cAAc,CAAC,CAAA;AAElE;;;;;;;;;;;;;;;GAeG;AACH,QAAA,MAAM,OAAO,EAsFR,8BAA8B,CAAC,KAAK,EAAE,oBAAoB,CAAC,CAAA;AAEhE,MAAM,MAAM,YAAY,GAAG,qBAAqB,CAAC,OAAO,OAAO,CAAC,CAAA;AAEhE,eAAe,OAAO,CAAA"}
|
package/dist/Overlay/Overlay.js
CHANGED
|
@@ -6,6 +6,7 @@ import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.
|
|
|
6
6
|
import classes from './Overlay.module.css.js';
|
|
7
7
|
import { clsx } from 'clsx';
|
|
8
8
|
import { jsx } from 'react/jsx-runtime';
|
|
9
|
+
import { useFeatureFlag } from '../FeatureFlags/useFeatureFlag.js';
|
|
9
10
|
import { useOverlay } from '../hooks/useOverlay.js';
|
|
10
11
|
|
|
11
12
|
const heightMap = {
|
|
@@ -195,6 +196,7 @@ const Overlay = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
|
195
196
|
const role = t3 === undefined ? "none" : t3;
|
|
196
197
|
const visibility = t4 === undefined ? "visible" : t4;
|
|
197
198
|
const width = t5 === undefined ? "auto" : t5;
|
|
199
|
+
const cssAnchorPositioning = useFeatureFlag("primer_react_css_anchor_positioning");
|
|
198
200
|
const overlayRef = useRef(null);
|
|
199
201
|
useRefObjectAsForwardedRef(forwardedRef, overlayRef);
|
|
200
202
|
let t6;
|
|
@@ -295,14 +297,18 @@ const Overlay = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
|
295
297
|
} else {
|
|
296
298
|
t12 = $[41];
|
|
297
299
|
}
|
|
300
|
+
const overlayContent = t12;
|
|
301
|
+
if (cssAnchorPositioning) {
|
|
302
|
+
return overlayContent;
|
|
303
|
+
}
|
|
298
304
|
let t13;
|
|
299
|
-
if ($[42] !==
|
|
305
|
+
if ($[42] !== overlayContent || $[43] !== portalContainerName) {
|
|
300
306
|
t13 = /*#__PURE__*/jsx(Portal, {
|
|
301
307
|
containerName: portalContainerName,
|
|
302
|
-
children:
|
|
308
|
+
children: overlayContent
|
|
303
309
|
});
|
|
304
|
-
$[42] =
|
|
305
|
-
$[43] =
|
|
310
|
+
$[42] = overlayContent;
|
|
311
|
+
$[43] = portalContainerName;
|
|
306
312
|
$[44] = t13;
|
|
307
313
|
} else {
|
|
308
314
|
t13 = $[44];
|
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-20260318115733",
|
|
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",
|
|
@@ -78,6 +78,7 @@
|
|
|
78
78
|
"@github/relative-time-element": "^4.5.0",
|
|
79
79
|
"@github/tab-container-element": "^4.8.2",
|
|
80
80
|
"@lit-labs/react": "1.2.1",
|
|
81
|
+
"@oddbird/css-anchor-positioning": "^0.9.0",
|
|
81
82
|
"@oddbird/popover-polyfill": "^0.5.2",
|
|
82
83
|
"@primer/behaviors": "^1.10.2",
|
|
83
84
|
"@primer/live-region-element": "^0.7.1",
|
|
@@ -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}}
|
|
2
|
-
/*# sourceMappingURL=AnchoredOverlay-73c1b2d1.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","file":"AnchoredOverlay-73c1b2d1.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"]}
|
|
@@ -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:auto;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;padding-bottom:env(safe-area-inset-bottom);position:fixed;top:0;width:100vw}@supports (height:100dvh){.prc-Overlay-Overlay-jfs-T:where([data-responsive=fullscreen]){height:100dvh}}}@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-dbaa6b8c.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,aAAc,CANd,iBAAkB,CAelB,uBAAyB,CAJzB,mBAAqB,CATrB,UAqLF,CApKE,iCACE,YACF,CAEA,8BAxBF,2BA0BI,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-dbaa6b8c.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 /* 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 /* 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"]}
|