@primer/react 38.46.0-rc.648c4ab09 → 38.46.0-rc.9cfae8e69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -8,12 +8,16 @@
8
8
 
9
9
  ### Patch Changes
10
10
 
11
+ - [#8683](https://github.com/primer/react/pull/8683) [`32d5061`](https://github.com/primer/react/commit/32d50618c58cceddf66d83716ac9742c2134b790) Thanks [@mattcosta7](https://github.com/mattcosta7)! - Breadcrumbs: Improve the performance of `overflow="menu"` and `"menu-with-root"` on mount, resize and navigation. Server-rendered markup now applies the collapse rules before hydration, and the overflow menu trigger is a `<button>`.
12
+
11
13
  - [#8679](https://github.com/primer/react/pull/8679) [`dbf2ac1`](https://github.com/primer/react/commit/dbf2ac1d758a0aae69f37ad1bd789480ce58ff4c) Thanks [@llastflowers](https://github.com/llastflowers)! - Breadcrumbs: Close the overflow menu when Escape is pressed while its tooltip is open.
12
14
 
13
15
  - [#8628](https://github.com/primer/react/pull/8628) [`41f29c8`](https://github.com/primer/react/commit/41f29c845663936043618af29dcb71de4c9384b2) Thanks [@joshblack](https://github.com/joshblack)! - SkeletonAvatar, SkeletonText: Preserve the requested size and shape regardless of stylesheet load order
14
16
 
15
17
  - [#8562](https://github.com/primer/react/pull/8562) [`ee46232`](https://github.com/primer/react/commit/ee46232fafa24701415b21eed60cca68e589cf1c) Thanks [@joshblack](https://github.com/joshblack)! - useOnEscapePress, useOnOutsideClick: Improve performance when callbacks change between renders.
16
18
 
19
+ - [#8609](https://github.com/primer/react/pull/8609) [`da90227`](https://github.com/primer/react/commit/da9022741a8109195480d7e6ccdf80cd723d6199) Thanks [@tay1orjones](https://github.com/tay1orjones)! - ActionList.LinkItem, NavList.Item: Preserve keyboard focus and running child animations when links rerender.
20
+
17
21
  ## 38.45.0
18
22
 
19
23
  ### Minor Changes
@@ -1,43 +1,110 @@
1
+ import { c } from "../utils/react-compiler-runtime.js";
1
2
  import { fixedForwardRef } from "../utils/modern-polymorphic.js";
2
3
  import { Tooltip } from "../TooltipV2/Tooltip.js";
3
4
  import { Item } from "./Item.js";
4
5
  import Link from "../Link/Link.js";
6
+ import React from "react";
5
7
  import { jsx } from "react/jsx-runtime";
6
8
  //#region src/ActionList/LinkItem.tsx
7
- const LinkItemComponent = fixedForwardRef(({ active, inactiveText, variant, size, as: Component, className, _PrivateTooltipText, ...props }, forwardedRef) => {
8
- return /* @__PURE__ */ jsx(Item, {
9
- className,
10
- active,
11
- inactiveText,
12
- "data-inactive": inactiveText ? true : void 0,
13
- variant,
14
- size,
15
- _PrivateItemWrapper: ({ children, onClick, ...rest }) => {
16
- const clickHandler = (event) => {
17
- onClick && onClick(event);
18
- props.onClick && props.onClick(event);
19
- };
20
- if (inactiveText) return /* @__PURE__ */ jsx("span", {
9
+ const LinkItemWrapperContext = /*#__PURE__*/ React.createContext(null);
10
+ const LinkItemWrapper = (t0) => {
11
+ const $ = c(21);
12
+ let children;
13
+ let onClick;
14
+ let rest;
15
+ if ($[0] !== t0) {
16
+ ({children, onClick, ...rest} = t0);
17
+ $[0] = t0;
18
+ $[1] = children;
19
+ $[2] = onClick;
20
+ $[3] = rest;
21
+ } else {
22
+ children = $[1];
23
+ onClick = $[2];
24
+ rest = $[3];
25
+ }
26
+ const context = React.useContext(LinkItemWrapperContext);
27
+ if (!context) throw new Error("LinkItemWrapper must be rendered within ActionList.LinkItem");
28
+ const { Component, linkProps, inactiveText, forwardedRef, tooltipText } = context;
29
+ let t1;
30
+ if ($[4] !== linkProps || $[5] !== onClick) {
31
+ t1 = (event) => {
32
+ onClick && onClick(event);
33
+ linkProps.onClick && linkProps.onClick(event);
34
+ };
35
+ $[4] = linkProps;
36
+ $[5] = onClick;
37
+ $[6] = t1;
38
+ } else t1 = $[6];
39
+ const clickHandler = t1;
40
+ if (inactiveText) {
41
+ let t2;
42
+ if ($[7] !== children || $[8] !== rest) {
43
+ t2 = /* @__PURE__ */ jsx("span", {
21
44
  ...rest,
22
45
  children
23
46
  });
24
- const link = /* @__PURE__ */ jsx(Link, {
25
- as: Component,
26
- ...rest,
27
- ...props,
28
- onClick: clickHandler,
29
- ref: _PrivateTooltipText ? void 0 : forwardedRef,
30
- children
31
- });
32
- return _PrivateTooltipText ? /* @__PURE__ */ jsx(Tooltip, {
33
- ref: forwardedRef,
34
- text: _PrivateTooltipText,
35
- direction: "e",
36
- delay: "medium",
37
- children: link
38
- }) : link;
47
+ $[7] = children;
48
+ $[8] = rest;
49
+ $[9] = t2;
50
+ } else t2 = $[9];
51
+ return t2;
52
+ }
53
+ const t2 = tooltipText ? void 0 : forwardedRef;
54
+ let t3;
55
+ if ($[10] !== Component || $[11] !== children || $[12] !== clickHandler || $[13] !== linkProps || $[14] !== rest || $[15] !== t2) {
56
+ t3 = /* @__PURE__ */ jsx(Link, {
57
+ as: Component,
58
+ ...rest,
59
+ ...linkProps,
60
+ onClick: clickHandler,
61
+ ref: t2,
62
+ children
63
+ });
64
+ $[10] = Component;
65
+ $[11] = children;
66
+ $[12] = clickHandler;
67
+ $[13] = linkProps;
68
+ $[14] = rest;
69
+ $[15] = t2;
70
+ $[16] = t3;
71
+ } else t3 = $[16];
72
+ const link = t3;
73
+ let t4;
74
+ if ($[17] !== forwardedRef || $[18] !== link || $[19] !== tooltipText) {
75
+ t4 = tooltipText ? /* @__PURE__ */ jsx(Tooltip, {
76
+ ref: forwardedRef,
77
+ text: tooltipText,
78
+ direction: "e",
79
+ delay: "medium",
80
+ children: link
81
+ }) : link;
82
+ $[17] = forwardedRef;
83
+ $[18] = link;
84
+ $[19] = tooltipText;
85
+ $[20] = t4;
86
+ } else t4 = $[20];
87
+ return t4;
88
+ };
89
+ const LinkItemComponent = fixedForwardRef(({ active, inactiveText, variant, size, as: Component, className, _PrivateTooltipText, ...props }, forwardedRef) => {
90
+ return /* @__PURE__ */ jsx(LinkItemWrapperContext.Provider, {
91
+ value: {
92
+ Component,
93
+ linkProps: props,
94
+ inactiveText,
95
+ forwardedRef,
96
+ tooltipText: _PrivateTooltipText
39
97
  },
40
- children: props.children
98
+ children: /* @__PURE__ */ jsx(Item, {
99
+ className,
100
+ active,
101
+ inactiveText,
102
+ "data-inactive": inactiveText ? true : void 0,
103
+ variant,
104
+ size,
105
+ _PrivateItemWrapper: LinkItemWrapper,
106
+ children: props.children
107
+ })
41
108
  });
42
109
  });
43
110
  const LinkItem = Object.assign(LinkItemComponent, {
@@ -1,2 +1,2 @@
1
- .prc-Breadcrumbs-BreadcrumbsBase-3Gb-B{display:flex;justify-content:space-between;width:100%}.prc-Breadcrumbs-BreadcrumbsList-BKjpe{margin-bottom:0;margin-top:0;padding-left:0}[data-overflow=menu-with-root] .prc-Breadcrumbs-BreadcrumbsList-BKjpe,[data-overflow=menu] .prc-Breadcrumbs-BreadcrumbsList-BKjpe{display:flex;flex-direction:row;white-space:nowrap}.prc-Breadcrumbs-ItemSeparator-kjXqh{align-self:center;color:var(--fgColor-muted,#59636e);display:flex;justify-content:center;-webkit-user-select:none;user-select:none;white-space:nowrap}.prc-Breadcrumbs-ItemWrapper-k0NLn{list-style:none}.prc-Breadcrumbs-ItemWrapper-k0NLn,.prc-Breadcrumbs-ItemWrapper-k0NLn:after{display:inline-block;font-size:var(--text-body-size-medium,.875rem)}.prc-Breadcrumbs-ItemWrapper-k0NLn:after{border-right:.1em solid var(--fgColor-muted,#59636e);content:"";height:.8em;margin:0 .5em;transform:rotate(15deg) translateY(.0625em)}.prc-Breadcrumbs-ItemWrapper-k0NLn:first-child{margin-left:0}.prc-Breadcrumbs-ItemWrapper-k0NLn:last-child:after{content:none}.prc-Breadcrumbs-Item-jcraJ{display:inline-block;font-size:var(--text-body-size-medium,.875rem)}.prc-Breadcrumbs-Item-jcraJ:focus-visible{border-radius:var(--borderRadius-small,.1875rem);box-shadow:none;outline:2px solid var(--focus-outline-color,var(--focus-outlineColor,#0969da));outline-offset:2px}[data-variant=normal] .prc-Breadcrumbs-Item-jcraJ{color:var(--fgColor-link,#0969da);-webkit-text-decoration:none;text-decoration:none}[data-variant=normal] .prc-Breadcrumbs-Item-jcraJ:not([aria-current]):hover{-webkit-text-decoration:underline;text-decoration:underline}[data-variant=normal] .prc-Breadcrumbs-Item-jcraJ:focus-visible{-webkit-text-decoration:none;text-decoration:none}[data-variant=normal] .prc-Breadcrumbs-Item-jcraJ[aria-current]{color:var(--fgColor-default,#1f2328)}[data-variant=spacious] .prc-Breadcrumbs-Item-jcraJ{border-radius:var(--borderRadius-medium,.375rem);color:var(--fgColor-default,#1f2328);padding-block:var(--base-size-4,.25rem);padding-inline:var(--base-size-6,.375rem);-webkit-text-decoration:none;text-decoration:none}[data-variant=spacious] .prc-Breadcrumbs-Item-jcraJ:hover{background:var(--control-transparent-bgColor-hover,#818b981a);-webkit-text-decoration:none;text-decoration:none}[data-variant=spacious] .prc-Breadcrumbs-Item-jcraJ[aria-current]{font-weight:var(--base-text-weight-semibold,600)}.prc-Breadcrumbs-BreadcrumbsItem-L-Xrs{align-items:center;display:inline-grid;flex:0 99999 auto;grid-auto-flow:column;list-style:none;min-width:auto;white-space:nowrap}.prc-Breadcrumbs-BreadcrumbsItem-L-Xrs[data-overflow-menu]{white-space:normal}.prc-Breadcrumbs-BreadcrumbsItem-L-Xrs:first-child{margin-left:0}.prc-Breadcrumbs-BreadcrumbsItem-L-Xrs:last-child .prc-Breadcrumbs-ItemSeparator-kjXqh{display:none}.prc-Breadcrumbs-BreadcrumbsItem-L-Xrs .prc-Breadcrumbs-MenuDetails-JOGTj{display:inline-block;position:relative}.prc-Breadcrumbs-BreadcrumbsItem-L-Xrs .prc-Breadcrumbs-MenuDetails-JOGTj summary{cursor:pointer;list-style:none}.prc-Breadcrumbs-BreadcrumbsItem-L-Xrs .prc-Breadcrumbs-MenuDetails-JOGTj summary::-webkit-details-marker{display:none}.prc-Breadcrumbs-BreadcrumbsItem-L-Xrs .prc-Breadcrumbs-MenuOverlay--ayLx{background-color:var(--overlay-bgColor,#fff);border-radius:var(--borderRadius-large,.75rem);box-shadow:var(--shadow-floating-small,0 0 0 1px #d1d9e080,0 6px 12px -3px #25292e0a,0 6px 18px 0 #25292e1f);max-height:100vh;max-width:var(--overlay-width-small,20rem);min-width:var(--overlay-width-xsmall,12rem);overflow:hidden;position:absolute;top:calc(var(--overlay-offset,.25rem) + var(--control-small-size,1.75rem));z-index:1}@media (prefers-reduced-motion:no-preference){.prc-Breadcrumbs-BreadcrumbsItem-L-Xrs .prc-Breadcrumbs-MenuOverlay--ayLx{animation:prc-Breadcrumbs-overlay-appear-CSLnF .2s cubic-bezier(.33,1,.68,1)}}
2
- /*# sourceMappingURL=Breadcrumbs-16d81430.css.map */
1
+ .prc-Breadcrumbs-BreadcrumbsBase-3Gb-B{display:flex;justify-content:space-between;width:100%}.prc-Breadcrumbs-BreadcrumbsList-BKjpe{margin-bottom:0;margin-top:0;padding-left:0}[data-overflow=menu-with-root] .prc-Breadcrumbs-BreadcrumbsList-BKjpe,[data-overflow=menu] .prc-Breadcrumbs-BreadcrumbsList-BKjpe{display:flex;flex-direction:row;white-space:nowrap}.prc-Breadcrumbs-ItemSeparator-kjXqh{align-self:center;color:var(--fgColor-muted,#59636e);display:flex;justify-content:center;-webkit-user-select:none;user-select:none;white-space:nowrap}.prc-Breadcrumbs-ItemWrapper-k0NLn{list-style:none}.prc-Breadcrumbs-ItemWrapper-k0NLn,.prc-Breadcrumbs-ItemWrapper-k0NLn:after{display:inline-block;font-size:var(--text-body-size-medium,.875rem)}.prc-Breadcrumbs-ItemWrapper-k0NLn:after{border-right:.1em solid var(--fgColor-muted,#59636e);content:"";height:.8em;margin:0 .5em;transform:rotate(15deg) translateY(.0625em)}.prc-Breadcrumbs-ItemWrapper-k0NLn:first-child{margin-left:0}.prc-Breadcrumbs-ItemWrapper-k0NLn:last-child:after{content:none}.prc-Breadcrumbs-Item-jcraJ{display:inline-block;font-size:var(--text-body-size-medium,.875rem)}.prc-Breadcrumbs-Item-jcraJ:focus-visible{border-radius:var(--borderRadius-small,.1875rem);box-shadow:none;outline:2px solid var(--focus-outline-color,var(--focus-outlineColor,#0969da));outline-offset:2px}[data-variant=normal] .prc-Breadcrumbs-Item-jcraJ{color:var(--fgColor-link,#0969da);-webkit-text-decoration:none;text-decoration:none}[data-variant=normal] .prc-Breadcrumbs-Item-jcraJ:not([aria-current]):hover{-webkit-text-decoration:underline;text-decoration:underline}[data-variant=normal] .prc-Breadcrumbs-Item-jcraJ:focus-visible{-webkit-text-decoration:none;text-decoration:none}[data-variant=normal] .prc-Breadcrumbs-Item-jcraJ[aria-current]{color:var(--fgColor-default,#1f2328)}[data-variant=spacious] .prc-Breadcrumbs-Item-jcraJ{border-radius:var(--borderRadius-medium,.375rem);color:var(--fgColor-default,#1f2328);padding-block:var(--base-size-4,.25rem);padding-inline:var(--base-size-6,.375rem);-webkit-text-decoration:none;text-decoration:none}[data-variant=spacious] .prc-Breadcrumbs-Item-jcraJ:hover{background:var(--control-transparent-bgColor-hover,#818b981a);-webkit-text-decoration:none;text-decoration:none}[data-variant=spacious] .prc-Breadcrumbs-Item-jcraJ[aria-current]{font-weight:var(--base-text-weight-semibold,600)}.prc-Breadcrumbs-BreadcrumbsItem-L-Xrs{align-items:center;display:inline-grid;flex:0 99999 auto;grid-auto-flow:column;list-style:none;min-width:auto;white-space:nowrap}.prc-Breadcrumbs-BreadcrumbsItem-L-Xrs[data-overflow-menu]{white-space:normal}.prc-Breadcrumbs-BreadcrumbsItem-L-Xrs:first-child{margin-left:0}.prc-Breadcrumbs-BreadcrumbsItem-L-Xrs:last-child .prc-Breadcrumbs-ItemSeparator-kjXqh{display:none}.prc-Breadcrumbs-BreadcrumbsItem-L-Xrs .prc-Breadcrumbs-MenuDetails-JOGTj{display:inline-block;position:relative}.prc-Breadcrumbs-BreadcrumbsItem-L-Xrs .prc-Breadcrumbs-MenuDetails-JOGTj summary{cursor:pointer;list-style:none}.prc-Breadcrumbs-BreadcrumbsItem-L-Xrs .prc-Breadcrumbs-MenuDetails-JOGTj summary::-webkit-details-marker{display:none}.prc-Breadcrumbs-BreadcrumbsItem-L-Xrs .prc-Breadcrumbs-MenuOverlay--ayLx{background-color:var(--overlay-bgColor,#fff);border-radius:var(--borderRadius-large,.75rem);box-shadow:var(--shadow-floating-small,0 0 0 1px #d1d9e080,0 6px 12px -3px #25292e0a,0 6px 18px 0 #25292e1f);max-height:100vh;max-width:var(--overlay-width-small,20rem);min-width:var(--overlay-width-xsmall,12rem);overflow:hidden;position:absolute;top:calc(var(--overlay-offset,.25rem) + var(--control-small-size,1.75rem));z-index:1}@media (prefers-reduced-motion:no-preference){.prc-Breadcrumbs-BreadcrumbsItem-L-Xrs .prc-Breadcrumbs-MenuOverlay--ayLx{animation:prc-Breadcrumbs-overlay-appear-CSLnF .2s cubic-bezier(.33,1,.68,1)}}.prc-Breadcrumbs-BreadcrumbsItem-L-Xrs[data-collapsed]{flex:none;grid-auto-columns:max-content;height:0;overflow:hidden;pointer-events:none;visibility:hidden;width:0}.prc-Breadcrumbs-BreadcrumbsItem-L-Xrs[hidden]{display:none}.prc-Breadcrumbs-BreadcrumbsBase-3Gb-B:where([data-overflow^=menu]:not([data-hydrated]))>.prc-Breadcrumbs-BreadcrumbsList-BKjpe{flex:1 1 auto;min-width:0;overflow:hidden;scroll-snap-type:x mandatory}.prc-Breadcrumbs-BreadcrumbsBase-3Gb-B:where([data-overflow^=menu]:not([data-hydrated]))>.prc-Breadcrumbs-BreadcrumbsList-BKjpe>:last-child{scroll-snap-align:end}.prc-Breadcrumbs-BreadcrumbsBase-3Gb-B:where([data-overflow^=menu]:not([data-hydrated]))>.prc-Breadcrumbs-BreadcrumbsList-BKjpe:focus-within{flex-wrap:wrap}@media (max-width:543.98px){.prc-Breadcrumbs-BreadcrumbsBase-3Gb-B:where([data-overflow=menu]:not([data-hydrated]))>.prc-Breadcrumbs-BreadcrumbsList-BKjpe[data-narrow-collapse]>:not([data-overflow-menu],:last-child){display:none}.prc-Breadcrumbs-BreadcrumbsBase-3Gb-B:where([data-overflow=menu]:not([data-hydrated]))>.prc-Breadcrumbs-BreadcrumbsList-BKjpe[data-narrow-collapse]>[hidden]{display:inline-grid}}
2
+ /*# sourceMappingURL=Breadcrumbs-6c9aadcf.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/Breadcrumbs/Breadcrumbs.module.css.js","../../postcss-preset-primer/src/mixins/focusOutline.css"],"names":[],"mappings":"AAAA,uCACE,YAAa,CACb,6BAA8B,CAC9B,UACF,CAEA,uCAGE,eAAgB,CADhB,YAAa,CADb,cAGF,CAIE,kIAEE,YAAa,CACb,kBAAmB,CAFnB,kBAGF,CAGF,qCAGE,iBAAkB,CAFlB,kCAA2B,CAC3B,YAAa,CAEb,sBAAuB,CAEvB,wBAAiB,CAAjB,gBAAiB,CADjB,kBAEF,CAEA,mCAGE,eAuBF,CArBE,4EAJA,oBAAqB,CACrB,8CAaA,CAVA,yCAQE,oDAA8C,CAF9C,UAAW,CAJX,WAAa,CAEb,aAAe,CAKf,2CACF,CAEA,+CACE,aACF,CAGE,oDACE,YACF,CAIJ,4BACE,oBAAqB,CACrB,8CAOF,CALE,0CACE,gDAAwC,CC5D1C,eAAgB,CAFhB,8EAAgC,CAChC,kBDgEA,CAIA,kDACE,iCAA0B,CAC1B,4BAAqB,CAArB,oBAeF,CAZI,4EACE,iCAA0B,CAA1B,yBACF,CAGF,gEACE,4BAAqB,CAArB,oBACF,CAEA,gEACE,oCACF,CAKF,oDAKE,gDAAyC,CAJzC,oCAA6B,CAG7B,uCAAiC,CADjC,yCAAkC,CADlC,4BAAqB,CAArB,oBAaF,CARE,0DACE,6DAAoD,CACpD,4BAAqB,CAArB,oBACF,CAEA,kEACE,gDACF,CAIJ,uCAGE,kBAAmB,CAFnB,mBAAoB,CAGpB,iBAAkB,CAFlB,qBAAsB,CAKtB,eAAgB,CAFhB,cAAe,CACf,kBAmDF,CA7CE,2DACE,kBACF,CAEA,mDACE,aACF,CAGE,uFACE,YACF,CAGF,0EAEE,oBAAqB,CADrB,iBAWF,CARE,kFAEE,cAAe,CADf,eAMF,CAHE,0GACE,YACF,CAIJ,0EAKE,4CAAwC,CADxC,8CAAwC,CADxC,4GAAwC,CAIxC,gBAAiB,CACjB,0CAAqC,CAFrC,2CAAsC,CAGtC,eAAgB,CARhB,iBAAkB,CAUlB,0EAA4D,CAT5D,SAcF,CAHE,8CAbF,0EAcI,4EAEJ,CADE,CAUJ,uDAEE,SAAU,CADV,6BAA8B,CAG9B,QAAS,CACT,eAAgB,CAEhB,mBAAoB,CADpB,iBAAkB,CAHlB,OAKF,CAIA,+CACE,YACF,CAaA,gIAEE,aAAc,CADd,WAAY,CAEZ,eAAgB,CAChB,4BASF,CAPE,4IACE,qBACF,CAEA,6IACE,cACF,CAMF,4BAEI,4LACE,YACF,CAEA,8JACE,mBACF,CAEJ","file":"Breadcrumbs-6c9aadcf.css","sourcesContent":[".BreadcrumbsBase {\n display: flex;\n justify-content: space-between;\n width: 100%;\n}\n\n.BreadcrumbsList {\n padding-left: 0;\n margin-top: 0;\n margin-bottom: 0;\n}\n\n[data-overflow='menu'],\n[data-overflow='menu-with-root'] {\n & .BreadcrumbsList {\n white-space: nowrap;\n display: flex;\n flex-direction: row;\n }\n}\n\n.ItemSeparator {\n color: var(--fgColor-muted);\n display: flex;\n align-self: center;\n justify-content: center;\n white-space: nowrap;\n user-select: none;\n}\n\n.ItemWrapper {\n display: inline-block;\n font-size: var(--text-body-size-medium);\n list-style: none;\n\n &::after {\n display: inline-block;\n height: 0.8em;\n /* stylelint-disable-next-line primer/spacing */\n margin: 0 0.5em;\n font-size: var(--text-body-size-medium);\n content: '';\n /* stylelint-disable-next-line primer/borders, primer/colors */\n border-right: 0.1em solid var(--fgColor-muted);\n transform: rotate(15deg) translateY(0.0625em);\n }\n\n &:first-child {\n margin-left: 0;\n }\n\n &:last-child {\n &::after {\n content: none;\n }\n }\n}\n\n.Item {\n display: inline-block;\n font-size: var(--text-body-size-medium);\n\n &:focus-visible {\n border-radius: var(--borderRadius-small);\n\n @mixin focusOutline 2px;\n }\n}\n\n[data-variant='normal'] {\n & .Item {\n color: var(--fgColor-link);\n text-decoration: none;\n\n &:not([aria-current]) {\n &:hover {\n text-decoration: underline;\n }\n }\n\n &:focus-visible {\n text-decoration: none;\n }\n\n &[aria-current] {\n color: var(--fgColor-default);\n }\n }\n}\n\n[data-variant='spacious'] {\n & .Item {\n color: var(--fgColor-default);\n text-decoration: none;\n padding-inline: var(--base-size-6);\n padding-block: var(--base-size-4);\n border-radius: var(--borderRadius-medium);\n\n &:hover {\n background: var(--control-transparent-bgColor-hover);\n text-decoration: none;\n }\n\n &[aria-current] {\n font-weight: var(--base-text-weight-semibold);\n }\n }\n}\n\n.BreadcrumbsItem {\n display: inline-grid;\n grid-auto-flow: column;\n align-items: center;\n flex: 0 99999 auto;\n min-width: auto;\n white-space: nowrap;\n list-style: none;\n\n /* allow menu items to wrap line */\n /* The overflow-menu item is marked in React (`data-overflow-menu`) instead of using\n `:has(.MenuOverlay)`, avoiding Safari's `:has()` invalidation cost. */\n &[data-overflow-menu] {\n white-space: normal;\n }\n\n &:first-child {\n margin-left: 0;\n }\n\n &:last-child {\n .ItemSeparator {\n display: none;\n }\n }\n\n .MenuDetails {\n position: relative;\n display: inline-block;\n\n & summary {\n list-style: none;\n cursor: pointer;\n\n &::-webkit-details-marker {\n display: none;\n }\n }\n }\n\n .MenuOverlay {\n position: absolute;\n z-index: 1;\n box-shadow: var(--shadow-floating-small);\n border-radius: var(--borderRadius-large);\n background-color: var(--overlay-bgColor);\n min-width: var(--overlay-width-xsmall);\n max-height: 100vh;\n max-width: var(--overlay-width-small);\n overflow: hidden;\n /* stylelint-disable-next-line primer/spacing */\n top: calc(var(--overlay-offset) + var(--control-small-size));\n\n @media (prefers-reduced-motion: no-preference) {\n animation: overlay-appear 200ms cubic-bezier(0.33, 1, 0.68, 1);\n }\n }\n}\n\n/* A collapsed crumb that can reappear at wider sizes. It stays mounted, so it never remounts\n and can still be measured. It stays in flow as a zero-size item: out-of-flow (absolute)\n boxes made resize layout measurably slower. The grid track is sized to the content, not to\n the zero-width item, so the crumb keeps its natural width whatever its `min-width` is.\n Without that it would shrink to its minimum, measure narrower than it is when shown, and\n the fit would flip between the two. */\n.BreadcrumbsItem[data-collapsed] {\n grid-auto-columns: max-content;\n flex: none;\n width: 0;\n height: 0;\n overflow: hidden;\n visibility: hidden;\n pointer-events: none;\n}\n\n/* The overflow menu is rendered but hidden while nothing is collapsed, so the pre-hydration\n narrow rule below can show it. */\n.BreadcrumbsItem[hidden] {\n display: none;\n}\n\n/*\n * Before hydration, CSS approximates the rules JS applies once it can measure. JS sets\n * `data-hydrated` (never rendered by React) in its first layout effect, before measuring,\n * so none of this applies afterwards or costs anything at runtime.\n *\n * Crumbs that don't fit are clipped at the start, so the leaf stays visible and nothing\n * paints outside the nav. Browsers don't scroll a partially visible focus target into view, so\n * while a crumb has focus the list wraps and every crumb is fully visible. It is start-aligned\n * because content that overflows the start edge can't be scrolled to, and snaps to the leaf\n * initially.\n */\n.BreadcrumbsBase:where([data-overflow^='menu']:not([data-hydrated])) > .BreadcrumbsList {\n min-width: 0;\n flex: 1 1 auto;\n overflow: hidden;\n scroll-snap-type: x mandatory;\n\n & > :last-child {\n scroll-snap-align: end;\n }\n\n &:focus-within {\n flex-wrap: wrap;\n }\n}\n\n/* The narrow rule uses the container width. A viewport query never shows the narrow layout\n when JS wouldn't, unless the nav is wider than the viewport. A container query would be\n exact, but its size containment collapses content-sized containers to 0px. */\n@media (max-width: 543.98px) {\n .BreadcrumbsBase:where([data-overflow='menu']:not([data-hydrated])) > .BreadcrumbsList[data-narrow-collapse] {\n & > :not(:last-child, [data-overflow-menu]) {\n display: none;\n }\n\n & > [hidden] {\n display: inline-grid;\n }\n }\n}\n","@define-mixin focusOutline $outlineOffset: -2px, $outlineColor: var(--focus-outline-color, var(--focus-outlineColor)) {\n outline: 2px solid $outlineColor;\n outline-offset: $outlineOffset;\n box-shadow: none;\n}\n"]}
@@ -7,447 +7,467 @@ import { fixedForwardRef } from "../utils/modern-polymorphic.js";
7
7
  import { IconButton } from "../Button/IconButton.js";
8
8
  import { ActionList } from "../ActionList/index.js";
9
9
  import Breadcrumbs_module_css_default from "./Breadcrumbs.module.css.js";
10
- import Details from "../Details/Details.js";
11
10
  import React, { useRef, useState } from "react";
12
11
  import { jsx, jsxs } from "react/jsx-runtime";
13
12
  import { clsx } from "clsx";
14
13
  import { KebabHorizontalIcon } from "@primer/octicons-react";
15
14
  //#region src/Breadcrumbs/Breadcrumbs.tsx
16
- const BreadcrumbsList = (t0) => {
17
- const $ = c(2);
18
- const { children } = t0;
15
+ const MENU_BUTTON_WIDTH = 32;
16
+ const SEPARATOR_ICON_WIDTH = 16;
17
+ const NARROW_WIDTH = 544;
18
+ const INITIAL_FIT = {
19
+ extra: 0,
20
+ rootCollapsed: false,
21
+ narrow: false
22
+ };
23
+ function minVisible(withRoot, narrow, itemCount) {
24
+ if (withRoot) return 3;
25
+ return narrow && itemCount > 2 ? 1 : 4;
26
+ }
27
+ function countRule(withRoot, narrow, itemCount) {
28
+ return Math.max(0, itemCount - minVisible(withRoot, narrow, itemCount));
29
+ }
30
+ const INITIAL_SEPARATORS = {
31
+ plain: SEPARATOR_ICON_WIDTH,
32
+ collapsed: SEPARATOR_ICON_WIDTH
33
+ };
34
+ function computeFit(widths, separators, available, withRoot) {
35
+ const itemCount = widths.length;
36
+ if (available <= 0 || itemCount === 0) return INITIAL_FIT;
37
+ const narrow = available < NARROW_WIDTH;
38
+ const min = minVisible(withRoot, narrow, itemCount);
39
+ const rootWidth = withRoot ? widths[0] + separators.collapsed : 0;
40
+ const menuCount = (collapsed) => Math.max(0, collapsed - (withRoot ? 1 : 0));
41
+ let tailWidth = widths.reduce((sum, width) => sum + width + separators.collapsed, 0);
42
+ const total = widths.reduce((sum, width) => sum + width, 0);
43
+ const width = (collapsed) => menuCount(collapsed) === 0 ? total + separators.plain * (itemCount - 1) : rootWidth + tailWidth + MENU_BUTTON_WIDTH;
44
+ let collapsed = 0;
45
+ let rootCollapsed = false;
46
+ while (width(collapsed) > available || itemCount - collapsed > min) {
47
+ tailWidth -= widths[collapsed] + separators.collapsed;
48
+ collapsed += 1;
49
+ if (itemCount - collapsed === 1 && width(collapsed) > available) {
50
+ rootCollapsed = withRoot;
51
+ break;
52
+ }
53
+ }
54
+ return {
55
+ extra: collapsed - countRule(withRoot, narrow, itemCount),
56
+ rootCollapsed,
57
+ narrow
58
+ };
59
+ }
60
+ function getContentWidth(nav) {
61
+ const { paddingLeft, paddingRight } = getComputedStyle(nav);
62
+ return nav.clientWidth - parseFloat(paddingLeft) - parseFloat(paddingRight);
63
+ }
64
+ const sameFit = (a, b) => a.extra === b.extra && a.rootCollapsed === b.rootCollapsed && a.narrow === b.narrow;
65
+ function getValidChildren(children) {
66
+ return React.Children.toArray(children).filter((child) => /*#__PURE__*/ React.isValidElement(child));
67
+ }
68
+ function OverflowMenu(t0) {
69
+ const $ = c(15);
70
+ const { items, open, setOpen } = t0;
71
+ const buttonRef = useRef(null);
19
72
  let t1;
20
- if ($[0] !== children) {
21
- t1 = /* @__PURE__ */ jsx("ol", {
22
- className: Breadcrumbs_module_css_default.BreadcrumbsList,
23
- children
24
- });
25
- $[0] = children;
73
+ if ($[0] !== setOpen) {
74
+ t1 = () => setOpen(false);
75
+ $[0] = setOpen;
26
76
  $[1] = t1;
27
77
  } else t1 = $[1];
28
- return t1;
29
- };
30
- const BreadcrumbsMenuItem = /*#__PURE__*/ React.forwardRef((t0, menuRefCallback) => {
31
- const $ = c(25);
32
- let ariaLabel;
33
- let items;
34
- let rest;
35
- if ($[0] !== t0) {
36
- ({items, "aria-label": ariaLabel, ...rest} = t0);
37
- $[0] = t0;
38
- $[1] = ariaLabel;
39
- $[2] = items;
40
- $[3] = rest;
41
- } else {
42
- ariaLabel = $[1];
43
- items = $[2];
44
- rest = $[3];
45
- }
46
- const [isOpen, setIsOpen] = useState(false);
47
- const detailsRef = useRef(null);
48
- const menuButtonRef = useRef(null);
49
- const menuContainerRef = useRef(null);
78
+ const close = t1;
79
+ const t2 = `${items.length} more breadcrumb items`;
80
+ let t3;
81
+ if ($[2] !== setOpen) {
82
+ t3 = () => setOpen(_temp);
83
+ $[2] = setOpen;
84
+ $[3] = t3;
85
+ } else t3 = $[3];
86
+ let t4;
87
+ if ($[4] !== open || $[5] !== t2 || $[6] !== t3) {
88
+ t4 = /* @__PURE__ */ jsx(IconButton, {
89
+ ref: buttonRef,
90
+ "aria-label": t2,
91
+ "aria-haspopup": "true",
92
+ "aria-expanded": open,
93
+ onClick: t3,
94
+ variant: "invisible",
95
+ size: "small",
96
+ icon: KebabHorizontalIcon,
97
+ tooltipDirection: "e"
98
+ });
99
+ $[4] = open;
100
+ $[5] = t2;
101
+ $[6] = t3;
102
+ $[7] = t4;
103
+ } else t4 = $[7];
104
+ let t5;
105
+ if ($[8] !== close || $[9] !== items || $[10] !== open) {
106
+ t5 = open ? /* @__PURE__ */ jsx(OverflowMenuOverlay, {
107
+ items,
108
+ close,
109
+ buttonRef
110
+ }) : null;
111
+ $[8] = close;
112
+ $[9] = items;
113
+ $[10] = open;
114
+ $[11] = t5;
115
+ } else t5 = $[11];
116
+ let t6;
117
+ if ($[12] !== t4 || $[13] !== t5) {
118
+ t6 = /* @__PURE__ */ jsxs("div", {
119
+ className: Breadcrumbs_module_css_default.MenuDetails,
120
+ "data-component": "Breadcrumbs.MenuItem",
121
+ children: [t4, t5]
122
+ });
123
+ $[12] = t4;
124
+ $[13] = t5;
125
+ $[14] = t6;
126
+ } else t6 = $[14];
127
+ return t6;
128
+ }
129
+ function _temp(value) {
130
+ return !value;
131
+ }
132
+ function OverflowMenuOverlay(t0) {
133
+ const $ = c(13);
134
+ const { items, close, buttonRef } = t0;
135
+ const containerRef = useRef(null);
50
136
  let t1;
51
- if ($[4] !== menuRefCallback) {
52
- t1 = (element) => {
53
- detailsRef.current = element;
54
- if (typeof menuRefCallback === "function") menuRefCallback(element);
55
- };
56
- $[4] = menuRefCallback;
57
- $[5] = t1;
58
- } else t1 = $[5];
59
- const detailsRefCallback = t1;
60
137
  let t2;
61
- if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
62
- t2 = (event) => {
138
+ if ($[0] !== buttonRef || $[1] !== close) {
139
+ t1 = (event) => {
140
+ var _buttonRef$current;
63
141
  event.preventDefault();
64
- if (detailsRef.current) {
65
- const newOpenState = !detailsRef.current.open;
66
- detailsRef.current.open = newOpenState;
67
- setIsOpen(newOpenState);
68
- }
142
+ close();
143
+ (_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 || _buttonRef$current.focus();
69
144
  };
70
- $[6] = t2;
71
- } else t2 = $[6];
72
- const handleSummaryClick = t2;
145
+ t2 = [close, buttonRef];
146
+ $[0] = buttonRef;
147
+ $[1] = close;
148
+ $[2] = t1;
149
+ $[3] = t2;
150
+ } else {
151
+ t1 = $[2];
152
+ t2 = $[3];
153
+ }
154
+ useOnEscapePress(t1, t2);
73
155
  let t3;
74
- if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
75
- t3 = () => {
76
- if (detailsRef.current) {
77
- detailsRef.current.open = false;
78
- setIsOpen(false);
79
- }
80
- };
81
- $[7] = t3;
82
- } else t3 = $[7];
83
- const closeOverlay = t3;
156
+ if ($[4] !== buttonRef) {
157
+ t3 = [buttonRef];
158
+ $[4] = buttonRef;
159
+ $[5] = t3;
160
+ } else t3 = $[5];
84
161
  let t4;
85
- if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
86
- t4 = () => {
87
- var _menuButtonRef$curren;
88
- (_menuButtonRef$curren = menuButtonRef.current) === null || _menuButtonRef$curren === void 0 || _menuButtonRef$curren.focus();
162
+ if ($[6] !== close || $[7] !== t3) {
163
+ t4 = {
164
+ onClickOutside: close,
165
+ containerRef,
166
+ ignoreClickRefs: t3
89
167
  };
168
+ $[6] = close;
169
+ $[7] = t3;
90
170
  $[8] = t4;
91
171
  } else t4 = $[8];
92
- const focusOnMenuButton = t4;
172
+ useOnOutsideClick(t4);
93
173
  let t5;
94
- let t6;
95
- if ($[9] !== isOpen) {
96
- t5 = (event_0) => {
97
- if (isOpen) {
98
- event_0.preventDefault();
99
- closeOverlay();
100
- focusOnMenuButton();
101
- }
102
- };
103
- t6 = [isOpen];
104
- $[9] = isOpen;
174
+ if ($[9] !== items) {
175
+ t5 = items.map(_temp2);
176
+ $[9] = items;
105
177
  $[10] = t5;
106
- $[11] = t6;
107
- } else {
108
- t5 = $[10];
109
- t6 = $[11];
110
- }
111
- useOnEscapePress(t5, t6);
112
- let t7;
113
- if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
114
- t7 = {
115
- onClickOutside: closeOverlay,
116
- containerRef: menuContainerRef,
117
- ignoreClickRefs: [menuButtonRef]
118
- };
119
- $[12] = t7;
120
- } else t7 = $[12];
121
- useOnOutsideClick(t7);
122
- const t8 = ariaLabel || `${items.length} more breadcrumb items`;
123
- const t9 = isOpen ? "true" : "false";
124
- let t10;
125
- if ($[13] !== rest || $[14] !== t8 || $[15] !== t9) {
126
- t10 = /* @__PURE__ */ jsx(IconButton, {
127
- as: "summary",
128
- role: "button",
129
- ref: menuButtonRef,
130
- "aria-label": t8,
131
- "aria-haspopup": "true",
132
- "aria-expanded": t9,
133
- onClick: handleSummaryClick,
134
- variant: "invisible",
135
- size: "small",
136
- icon: KebabHorizontalIcon,
137
- tooltipDirection: "e",
138
- ...rest
139
- });
140
- $[13] = rest;
141
- $[14] = t8;
142
- $[15] = t9;
143
- $[16] = t10;
144
- } else t10 = $[16];
145
- let t11;
146
- if ($[17] !== items) {
147
- t11 = items.map(_temp);
148
- $[17] = items;
149
- $[18] = t11;
150
- } else t11 = $[18];
151
- let t12;
152
- if ($[19] !== t11) {
153
- t12 = /* @__PURE__ */ jsx("div", {
154
- ref: menuContainerRef,
178
+ } else t5 = $[10];
179
+ let t6;
180
+ if ($[11] !== t5) {
181
+ t6 = /* @__PURE__ */ jsx("div", {
182
+ ref: containerRef,
155
183
  className: Breadcrumbs_module_css_default.MenuOverlay,
156
- children: /* @__PURE__ */ jsx(ActionList, { children: t11 })
184
+ children: /* @__PURE__ */ jsx(ActionList, { children: t5 })
157
185
  });
158
- $[19] = t11;
159
- $[20] = t12;
160
- } else t12 = $[20];
161
- let t13;
162
- if ($[21] !== detailsRefCallback || $[22] !== t10 || $[23] !== t12) {
163
- t13 = /* @__PURE__ */ jsxs(Details, {
164
- ref: detailsRefCallback,
165
- className: Breadcrumbs_module_css_default.MenuDetails,
166
- "data-component": "Breadcrumbs.MenuItem",
167
- children: [t10, t12]
168
- });
169
- $[21] = detailsRefCallback;
170
- $[22] = t10;
171
- $[23] = t12;
172
- $[24] = t13;
173
- } else t13 = $[24];
174
- return t13;
175
- });
176
- BreadcrumbsMenuItem.displayName = "Breadcrumbs.MenuItem";
177
- const getValidChildren = (children) => {
178
- return React.Children.toArray(children).filter((child) => /*#__PURE__*/ React.isValidElement(child));
179
- };
180
- const MENU_BUTTON_FALLBACK_WIDTH = 32;
181
- const CONTAINER_FALLBACK_WIDTH = 800;
182
- function calculateOverflow({ availableWidth, itemCount, childArrayWidths, menuButtonWidth, overflow, hideRoot }) {
183
- var _childArrayWidths$;
184
- let eHideRoot = hideRoot;
185
- const rootItemWidth = (_childArrayWidths$ = childArrayWidths[0]) !== null && _childArrayWidths$ !== void 0 ? _childArrayWidths$ : 0;
186
- const isNarrow = availableWidth < 544;
187
- let MIN_VISIBLE_ITEMS = 4;
188
- if (!eHideRoot) MIN_VISIBLE_ITEMS = 3;
189
- else if (isNarrow && itemCount > 2) MIN_VISIBLE_ITEMS = 1;
190
- const calculateVisibleItemsWidth = (w) => {
191
- const widths = w.reduce((sum, width) => sum + width + 16, 0);
192
- return !eHideRoot ? rootItemWidth + widths : widths;
193
- };
194
- let currentVisibleItemWidths = [...childArrayWidths];
195
- let menuItemCount = 0;
196
- if (availableWidth > 0 && currentVisibleItemWidths.length > 0) {
197
- let visibleItemsWidthTotal = calculateVisibleItemsWidth(currentVisibleItemWidths);
198
- while ((overflow === "menu" || overflow === "menu-with-root") && (visibleItemsWidthTotal > availableWidth || currentVisibleItemWidths.length > MIN_VISIBLE_ITEMS)) {
199
- menuItemCount += 1;
200
- currentVisibleItemWidths = currentVisibleItemWidths.slice(1);
201
- visibleItemsWidthTotal = calculateVisibleItemsWidth(currentVisibleItemWidths) + menuButtonWidth;
202
- if (currentVisibleItemWidths.length === 1 && visibleItemsWidthTotal > availableWidth) {
203
- eHideRoot = true;
204
- break;
205
- } else eHideRoot = hideRoot;
206
- }
207
- }
208
- return {
209
- menuItemCount,
210
- effectiveHideRoot: eHideRoot
211
- };
186
+ $[11] = t5;
187
+ $[12] = t6;
188
+ } else t6 = $[12];
189
+ return t6;
190
+ }
191
+ function _temp2(item) {
192
+ const { children, selected, as: Component, ...itemProps } = item.props;
193
+ return /* @__PURE__ */ jsx(ActionList.LinkItem, {
194
+ as: Component,
195
+ ...itemProps,
196
+ "aria-current": selected ? "page" : void 0,
197
+ children
198
+ }, item.key);
212
199
  }
213
200
  function Breadcrumbs(t0) {
214
- const $ = c(48);
201
+ const $ = c(60);
215
202
  const { className, children, style, overflow: t1, variant: t2 } = t0;
216
203
  const overflow = t1 === void 0 ? "wrap" : t1;
217
204
  const variant = t2 === void 0 ? "normal" : t2;
218
- const containerRef = useRef(null);
219
- const hideRoot = !(overflow === "menu-with-root");
205
+ const navRef = useRef(null);
220
206
  let t3;
221
- if ($[0] !== children) {
222
- t3 = getValidChildren(children);
223
- $[0] = children;
224
- $[1] = t3;
225
- } else t3 = $[1];
226
- const childArray = t3;
227
- const rootItem = childArray[0];
228
- const [childArrayWidths, setChildArrayWidths] = useState(_temp2);
229
- const [containerWidth, setContainerWidth] = useState(null);
230
- const [menuButtonWidth, setMenuButtonWidth] = useState(MENU_BUTTON_FALLBACK_WIDTH);
207
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
208
+ t3 = /* @__PURE__ */ new Map();
209
+ $[0] = t3;
210
+ } else t3 = $[0];
211
+ const widthsRef = useRef(t3);
212
+ const [fit, setFit] = useState(INITIAL_FIT);
213
+ const fitRef = useRef(INITIAL_FIT);
214
+ const separatorsRef = useRef(INITIAL_SEPARATORS);
215
+ const [menuOpen, setMenuOpen] = useState(false);
216
+ const collapsible = overflow !== "wrap";
217
+ const withRoot = overflow === "menu-with-root";
231
218
  let t4;
232
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
233
- t4 = (element) => {
234
- if (element) {
235
- const iconButtonElement = element.querySelector("button[data-component=\"IconButton\"]");
236
- if (iconButtonElement) {
237
- const measuredWidth = iconButtonElement.offsetWidth;
238
- setMenuButtonWidth((prev) => prev === measuredWidth ? prev : measuredWidth);
239
- }
240
- }
241
- };
219
+ if ($[1] !== children) {
220
+ t4 = getValidChildren(children);
221
+ $[1] = children;
242
222
  $[2] = t4;
243
223
  } else t4 = $[2];
244
- const measureMenuButton = t4;
224
+ const items = t4;
225
+ const itemCount = items.length;
245
226
  let t5;
246
- if ($[3] !== childArray.length || $[4] !== overflow) {
247
- t5 = () => {
248
- if (overflow === "wrap") return;
249
- const containerElement = containerRef.current;
250
- if (!containerElement) return;
251
- const measuredContainerWidth = containerElement.offsetWidth;
252
- setContainerWidth((prev_0) => prev_0 === measuredContainerWidth ? prev_0 : measuredContainerWidth);
253
- const listElement = containerElement.querySelector("ol");
254
- if (listElement && listElement.children.length > 0 && listElement.children.length === childArray.length) {
255
- const widths = Array.from(listElement.children).map(_temp3);
256
- setChildArrayWidths(widths);
257
- }
227
+ if ($[3] !== items || $[4] !== withRoot) {
228
+ t5 = (available) => {
229
+ const next = computeFit(items.map((item) => {
230
+ var _widthsRef$current$ge, _item$key;
231
+ return (_widthsRef$current$ge = widthsRef.current.get((_item$key = item.key) !== null && _item$key !== void 0 ? _item$key : "")) !== null && _widthsRef$current$ge !== void 0 ? _widthsRef$current$ge : 0;
232
+ }), separatorsRef.current, available, withRoot);
233
+ if (sameFit(fitRef.current, next)) return;
234
+ fitRef.current = next;
235
+ setFit(next);
258
236
  };
259
- $[3] = childArray.length;
260
- $[4] = overflow;
237
+ $[3] = items;
238
+ $[4] = withRoot;
261
239
  $[5] = t5;
262
240
  } else t5 = $[5];
241
+ const updateFit = t5;
263
242
  let t6;
264
- if ($[6] !== childArray || $[7] !== overflow) {
265
- t6 = [childArray, overflow];
266
- $[6] = childArray;
267
- $[7] = overflow;
243
+ if ($[6] !== items || $[7] !== updateFit) {
244
+ t6 = (nav, available_0) => {
245
+ const previous = widthsRef.current;
246
+ const widths_0 = /* @__PURE__ */ new Map();
247
+ let separators = separatorsRef.current;
248
+ for (const item_0 of items) {
249
+ var _item_0$key;
250
+ const width = previous.get((_item_0$key = item_0.key) !== null && _item_0$key !== void 0 ? _item_0$key : "");
251
+ if (width !== void 0) {
252
+ var _item_0$key2;
253
+ widths_0.set((_item_0$key2 = item_0.key) !== null && _item_0$key2 !== void 0 ? _item_0$key2 : "", width);
254
+ }
255
+ }
256
+ for (const li of nav.querySelectorAll(":scope > ol > li[data-index]")) {
257
+ var _items$Number;
258
+ const key = (_items$Number = items[Number(li.getAttribute("data-index"))]) === null || _items$Number === void 0 ? void 0 : _items$Number.key;
259
+ const crumb = li.firstElementChild;
260
+ if (key == null || !crumb) continue;
261
+ const crumbWidth = crumb.getBoundingClientRect().width;
262
+ widths_0.set(key, crumbWidth);
263
+ if (li.nextElementSibling && !li.hasAttribute("data-collapsed")) {
264
+ const separator = li.getBoundingClientRect().width - crumbWidth;
265
+ const kind = li.classList.contains(Breadcrumbs_module_css_default.ItemWrapper) ? "plain" : "collapsed";
266
+ if (separators[kind] !== separator) separators = {
267
+ ...separators,
268
+ [kind]: separator
269
+ };
270
+ }
271
+ }
272
+ separatorsRef.current = separators;
273
+ widthsRef.current = widths_0;
274
+ updateFit(available_0);
275
+ };
276
+ $[6] = items;
277
+ $[7] = updateFit;
268
278
  $[8] = t6;
269
279
  } else t6 = $[8];
270
- useIsomorphicLayoutEffect(t5, t6);
280
+ const measure = t6;
281
+ const hiddenRef = useRef(false);
271
282
  let t7;
272
- if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
273
- t7 = (entries) => {
274
- if (entries[0]) {
275
- const width = Math.round(entries[0].contentRect.width);
276
- setContainerWidth((prev_1) => prev_1 === width ? prev_1 : width);
277
- }
283
+ if ($[9] !== collapsible || $[10] !== measure) {
284
+ t7 = () => {
285
+ const nav_0 = navRef.current;
286
+ if (!collapsible || !nav_0) return;
287
+ if (!nav_0.hasAttribute("data-hydrated")) nav_0.setAttribute("data-hydrated", "");
288
+ const available_1 = getContentWidth(nav_0);
289
+ hiddenRef.current = available_1 <= 0;
290
+ if (!hiddenRef.current) measure(nav_0, available_1);
278
291
  };
279
- $[9] = t7;
280
- } else t7 = $[9];
292
+ $[9] = collapsible;
293
+ $[10] = measure;
294
+ $[11] = t7;
295
+ } else t7 = $[11];
281
296
  let t8;
282
- if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
283
- t8 = [];
284
- $[10] = t8;
285
- } else t8 = $[10];
286
- useResizeObserver(t7, containerRef, t8, overflow !== "wrap");
297
+ if ($[12] !== collapsible || $[13] !== fit || $[14] !== measure || $[15] !== menuOpen) {
298
+ t8 = [
299
+ collapsible,
300
+ fit,
301
+ menuOpen,
302
+ measure
303
+ ];
304
+ $[12] = collapsible;
305
+ $[13] = fit;
306
+ $[14] = measure;
307
+ $[15] = menuOpen;
308
+ $[16] = t8;
309
+ } else t8 = $[16];
310
+ useIsomorphicLayoutEffect(t7, t8);
287
311
  let t9;
288
- bb0: {
289
- if (overflow === "wrap" || childArrayWidths.length !== childArray.length) {
290
- let t10;
291
- if ($[11] !== hideRoot) {
292
- t10 = {
293
- menuItemCount: 0,
294
- effectiveHideRoot: hideRoot
295
- };
296
- $[11] = hideRoot;
297
- $[12] = t10;
298
- } else t10 = $[12];
299
- t9 = t10;
300
- break bb0;
301
- }
302
- const t10 = containerWidth !== null && containerWidth !== void 0 ? containerWidth : CONTAINER_FALLBACK_WIDTH;
303
- let t11;
304
- if ($[13] !== childArray.length || $[14] !== childArrayWidths || $[15] !== hideRoot || $[16] !== menuButtonWidth || $[17] !== overflow || $[18] !== t10) {
305
- t11 = calculateOverflow({
306
- availableWidth: t10,
307
- itemCount: childArray.length,
308
- childArrayWidths,
309
- menuButtonWidth,
310
- overflow,
311
- hideRoot
312
- });
313
- $[13] = childArray.length;
314
- $[14] = childArrayWidths;
315
- $[15] = hideRoot;
316
- $[16] = menuButtonWidth;
317
- $[17] = overflow;
318
- $[18] = t10;
319
- $[19] = t11;
320
- } else t11 = $[19];
321
- t9 = t11;
322
- }
323
- const { menuItemCount, effectiveHideRoot } = t9;
312
+ if ($[17] !== measure || $[18] !== updateFit) {
313
+ t9 = () => {
314
+ const nav_1 = navRef.current;
315
+ if (!nav_1) return;
316
+ const available_2 = getContentWidth(nav_1);
317
+ if (available_2 <= 0) hiddenRef.current = true;
318
+ else if (hiddenRef.current) {
319
+ hiddenRef.current = false;
320
+ measure(nav_1, available_2);
321
+ } else updateFit(available_2);
322
+ };
323
+ $[17] = measure;
324
+ $[18] = updateFit;
325
+ $[19] = t9;
326
+ } else t9 = $[19];
324
327
  let t10;
325
- if ($[20] !== childArray || $[21] !== children || $[22] !== effectiveHideRoot || $[23] !== menuItemCount || $[24] !== overflow || $[25] !== rootItem) {
326
- bb1: {
327
- if (overflow === "wrap" || menuItemCount === 0) {
328
- let t11;
329
- if ($[27] !== children) {
330
- t11 = React.Children.map(children, _temp4);
331
- $[27] = children;
332
- $[28] = t11;
333
- } else t11 = $[28];
334
- t10 = t11;
335
- break bb1;
328
+ if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
329
+ t10 = [];
330
+ $[20] = t10;
331
+ } else t10 = $[20];
332
+ useResizeObserver(t9, navRef, t10, collapsible);
333
+ let content;
334
+ if (!collapsible) {
335
+ if (menuOpen) setMenuOpen(false);
336
+ let t11;
337
+ if ($[21] !== children) {
338
+ t11 = React.Children.map(children, _temp3);
339
+ $[21] = children;
340
+ $[22] = t11;
341
+ } else t11 = $[22];
342
+ content = t11;
343
+ } else {
344
+ const collapsed = Math.min(Math.max(itemCount - 1, 0), countRule(withRoot, fit.narrow, itemCount) + fit.extra);
345
+ const rootVisible = withRoot && !(collapsed > 0 && fit.rootCollapsed);
346
+ let t11;
347
+ if ($[23] !== collapsed || $[24] !== items || $[25] !== rootVisible) {
348
+ t11 = items.slice(rootVisible ? 1 : 0, collapsed);
349
+ $[23] = collapsed;
350
+ $[24] = items;
351
+ $[25] = rootVisible;
352
+ $[26] = t11;
353
+ } else t11 = $[26];
354
+ const menuItems = t11;
355
+ if (menuOpen && menuItems.length === 0) setMenuOpen(false);
356
+ const plain = menuItems.length === 0;
357
+ const alwaysCollapsed = countRule(withRoot, false, itemCount);
358
+ let listItems;
359
+ if ($[27] !== alwaysCollapsed || $[28] !== collapsed || $[29] !== itemCount || $[30] !== items || $[31] !== menuItems || $[32] !== menuOpen || $[33] !== plain || $[34] !== rootVisible || $[35] !== withRoot) {
360
+ listItems = [];
361
+ for (const [index, item_1] of items.entries()) {
362
+ const isRoot = withRoot && index === 0;
363
+ const isCollapsed = index < collapsed && !(isRoot && rootVisible);
364
+ if (isCollapsed && index < alwaysCollapsed && !isRoot) continue;
365
+ const rendered = !isCollapsed || !menuOpen;
366
+ listItems.push(/* @__PURE__ */ jsxs("li", {
367
+ className: plain ? Breadcrumbs_module_css_default.ItemWrapper : Breadcrumbs_module_css_default.BreadcrumbsItem,
368
+ "data-index": rendered ? index : void 0,
369
+ "data-collapsed": isCollapsed ? "" : void 0,
370
+ children: [rendered ? item_1 : null, plain ? null : /* @__PURE__ */ jsx(ItemSeparator, {})]
371
+ }, item_1.key));
336
372
  }
337
- const menuItems = childArray.slice(0, menuItemCount);
338
- const visibleItems = childArray.slice(menuItemCount);
339
- const effectiveMenuItems = effectiveHideRoot ? menuItems : menuItems.slice(1);
340
- const t11 = `${effectiveMenuItems.length} more breadcrumb items`;
341
- let t12;
342
- if ($[29] !== effectiveMenuItems || $[30] !== t11) {
343
- t12 = /* @__PURE__ */ jsx(BreadcrumbsMenuItem, {
344
- ref: measureMenuButton,
345
- items: effectiveMenuItems,
346
- "aria-label": t11
347
- });
348
- $[29] = effectiveMenuItems;
349
- $[30] = t11;
350
- $[31] = t12;
351
- } else t12 = $[31];
352
- let t13;
353
- if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
354
- t13 = /* @__PURE__ */ jsx(ItemSeparator, {});
355
- $[32] = t13;
356
- } else t13 = $[32];
357
- let t14;
358
- if ($[33] !== t12) {
359
- t14 = /* @__PURE__ */ jsxs("li", {
360
- className: Breadcrumbs_module_css_default.BreadcrumbsItem,
361
- "data-overflow-menu": "",
362
- children: [t12, t13]
363
- }, "breadcrumbs-menu");
364
- $[33] = t12;
365
- $[34] = t14;
366
- } else t14 = $[34];
367
- const menuElement = t14;
368
- const visibleElements = visibleItems.map(_temp5);
369
- let t15;
370
- if ($[35] === Symbol.for("react.memo_cache_sentinel")) {
371
- t15 = /* @__PURE__ */ jsx(ItemSeparator, {});
372
- $[35] = t15;
373
- } else t15 = $[35];
374
- let t16;
375
- if ($[36] !== rootItem) {
376
- t16 = /* @__PURE__ */ jsxs("li", {
377
- className: Breadcrumbs_module_css_default.BreadcrumbsItem,
378
- children: [rootItem, t15]
379
- }, "rootElement");
380
- $[36] = rootItem;
381
- $[37] = t16;
382
- } else t16 = $[37];
383
- const rootElement = t16;
384
- if (effectiveHideRoot) t10 = [menuElement, ...visibleElements];
385
- else t10 = [
386
- rootElement,
387
- menuElement,
388
- ...visibleElements
389
- ];
390
- }
391
- $[20] = childArray;
392
- $[21] = children;
393
- $[22] = effectiveHideRoot;
394
- $[23] = menuItemCount;
395
- $[24] = overflow;
396
- $[25] = rootItem;
397
- $[26] = t10;
398
- } else t10 = $[26];
399
- const finalChildren = t10;
373
+ if (!plain || !withRoot && itemCount > 2) {
374
+ let t12;
375
+ if ($[37] !== itemCount || $[38] !== items || $[39] !== menuItems || $[40] !== plain) {
376
+ t12 = plain ? items.slice(0, itemCount - 1) : menuItems;
377
+ $[37] = itemCount;
378
+ $[38] = items;
379
+ $[39] = menuItems;
380
+ $[40] = plain;
381
+ $[41] = t12;
382
+ } else t12 = $[41];
383
+ let t13;
384
+ if ($[42] !== menuOpen || $[43] !== t12) {
385
+ t13 = /* @__PURE__ */ jsx(OverflowMenu, {
386
+ items: t12,
387
+ open: menuOpen,
388
+ setOpen: setMenuOpen
389
+ });
390
+ $[42] = menuOpen;
391
+ $[43] = t12;
392
+ $[44] = t13;
393
+ } else t13 = $[44];
394
+ let t14;
395
+ if ($[45] === Symbol.for("react.memo_cache_sentinel")) {
396
+ t14 = /* @__PURE__ */ jsx(ItemSeparator, {});
397
+ $[45] = t14;
398
+ } else t14 = $[45];
399
+ let t15;
400
+ if ($[46] !== plain || $[47] !== t13) {
401
+ t15 = /* @__PURE__ */ jsxs("li", {
402
+ className: Breadcrumbs_module_css_default.BreadcrumbsItem,
403
+ "data-overflow-menu": "",
404
+ hidden: plain,
405
+ children: [t13, t14]
406
+ }, "breadcrumbs-menu");
407
+ $[46] = plain;
408
+ $[47] = t13;
409
+ $[48] = t15;
410
+ } else t15 = $[48];
411
+ listItems.splice(withRoot && rootVisible ? 1 : 0, 0, t15);
412
+ }
413
+ $[27] = alwaysCollapsed;
414
+ $[28] = collapsed;
415
+ $[29] = itemCount;
416
+ $[30] = items;
417
+ $[31] = menuItems;
418
+ $[32] = menuOpen;
419
+ $[33] = plain;
420
+ $[34] = rootVisible;
421
+ $[35] = withRoot;
422
+ $[36] = listItems;
423
+ } else listItems = $[36];
424
+ content = listItems;
425
+ }
400
426
  let t11;
401
- if ($[38] !== className) {
427
+ if ($[49] !== className) {
402
428
  t11 = clsx(className, Breadcrumbs_module_css_default.BreadcrumbsBase);
403
- $[38] = className;
404
- $[39] = t11;
405
- } else t11 = $[39];
406
- let t12;
407
- if ($[40] !== finalChildren) {
408
- t12 = /* @__PURE__ */ jsx(BreadcrumbsList, { children: finalChildren });
409
- $[40] = finalChildren;
410
- $[41] = t12;
411
- } else t12 = $[41];
429
+ $[49] = className;
430
+ $[50] = t11;
431
+ } else t11 = $[50];
432
+ const t12 = collapsible && overflow === "menu" && itemCount > 2 ? "" : void 0;
412
433
  let t13;
413
- if ($[42] !== overflow || $[43] !== style || $[44] !== t11 || $[45] !== t12 || $[46] !== variant) {
414
- t13 = /* @__PURE__ */ jsx("nav", {
434
+ if ($[51] !== content || $[52] !== t12) {
435
+ t13 = /* @__PURE__ */ jsx("ol", {
436
+ className: Breadcrumbs_module_css_default.BreadcrumbsList,
437
+ "data-narrow-collapse": t12,
438
+ children: content
439
+ });
440
+ $[51] = content;
441
+ $[52] = t12;
442
+ $[53] = t13;
443
+ } else t13 = $[53];
444
+ let t14;
445
+ if ($[54] !== overflow || $[55] !== style || $[56] !== t11 || $[57] !== t13 || $[58] !== variant) {
446
+ t14 = /* @__PURE__ */ jsx("nav", {
415
447
  className: t11,
416
448
  "aria-label": "Breadcrumbs",
417
449
  style,
418
- ref: containerRef,
450
+ ref: navRef,
419
451
  "data-overflow": overflow,
420
452
  "data-variant": variant,
421
453
  "data-component": "Breadcrumbs",
422
- children: t12
454
+ children: t13
423
455
  });
424
- $[42] = overflow;
425
- $[43] = style;
426
- $[44] = t11;
427
- $[45] = t12;
428
- $[46] = variant;
429
- $[47] = t13;
430
- } else t13 = $[47];
431
- return t13;
456
+ $[54] = overflow;
457
+ $[55] = style;
458
+ $[56] = t11;
459
+ $[57] = t13;
460
+ $[58] = variant;
461
+ $[59] = t14;
462
+ } else t14 = $[59];
463
+ return t14;
432
464
  }
433
- function _temp5(child_1, index) {
434
- return /* @__PURE__ */ jsxs("li", {
435
- className: Breadcrumbs_module_css_default.BreadcrumbsItem,
436
- children: [child_1, /* @__PURE__ */ jsx(ItemSeparator, {})]
437
- }, `visible + ${index}`);
438
- }
439
- function _temp4(child_0) {
465
+ function _temp3(child) {
440
466
  return /* @__PURE__ */ jsx("li", {
441
467
  className: Breadcrumbs_module_css_default.ItemWrapper,
442
- children: child_0
468
+ children: child
443
469
  });
444
470
  }
445
- function _temp3(child) {
446
- return child.offsetWidth;
447
- }
448
- function _temp2() {
449
- return [];
450
- }
451
471
  const ItemSeparator = () => {
452
472
  const $ = c(1);
453
473
  let t0;
@@ -487,14 +507,5 @@ var Breadcrumbs_default = Object.assign(Breadcrumbs, { Item: BreadcrumbsItemWith
487
507
  * @deprecated Use the `Breadcrumbs` component instead (i.e. `<Breadcrumb>` → `<Breadcrumbs>`)
488
508
  */
489
509
  const Breadcrumb = Object.assign(Breadcrumbs, { Item: BreadcrumbsItem });
490
- function _temp(item, index) {
491
- const { children, selected, as: Component, ...itemProps } = item.props;
492
- return /* @__PURE__ */ jsx(ActionList.LinkItem, {
493
- as: Component,
494
- ...itemProps,
495
- "aria-current": selected ? "page" : void 0,
496
- children
497
- }, index);
498
- }
499
510
  //#endregion
500
511
  export { Breadcrumb, Breadcrumbs_default as default };
@@ -1,4 +1,4 @@
1
- import "./Breadcrumbs-16d81430.css";
1
+ import "./Breadcrumbs-6c9aadcf.css";
2
2
  //#region src/Breadcrumbs/Breadcrumbs.module.css.js
3
3
  var Breadcrumbs_module_css_default = {
4
4
  "BreadcrumbsBase": "prc-Breadcrumbs-BreadcrumbsBase-3Gb-B",
package/dist/index.js CHANGED
@@ -59,7 +59,6 @@ import Avatar from "./Avatar/Avatar.js";
59
59
  import AvatarStack from "./AvatarStack/AvatarStack.js";
60
60
  import { Banner } from "./Banner/index.js";
61
61
  import BranchName_default from "./BranchName/BranchName.js";
62
- import Details from "./Details/Details.js";
63
62
  import Breadcrumbs_default, { Breadcrumb } from "./Breadcrumbs/Breadcrumbs.js";
64
63
  import ButtonGroup from "./ButtonGroup/ButtonGroup.js";
65
64
  import { Stack } from "./Stack/index.js";
@@ -74,6 +73,7 @@ import Textarea from "./Textarea/Textarea.js";
74
73
  import FormControl_default from "./FormControl/FormControl.js";
75
74
  import CheckboxGroup_default from "./CheckboxGroup/CheckboxGroup.js";
76
75
  import CircleBadge_default from "./CircleBadge/CircleBadge.js";
76
+ import Details from "./Details/Details.js";
77
77
  import Flash from "./Flash/Flash.js";
78
78
  import Header_default from "./Header/Header.js";
79
79
  import Label_default from "./Label/index.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "38.46.0-rc.648c4ab09",
4
+ "version": "38.46.0-rc.9cfae8e69",
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",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/Breadcrumbs/Breadcrumbs.module.css.js","../../postcss-preset-primer/src/mixins/focusOutline.css"],"names":[],"mappings":"AAAA,uCACE,YAAa,CACb,6BAA8B,CAC9B,UACF,CAEA,uCAGE,eAAgB,CADhB,YAAa,CADb,cAGF,CAIE,kIAEE,YAAa,CACb,kBAAmB,CAFnB,kBAGF,CAGF,qCAGE,iBAAkB,CAFlB,kCAA2B,CAC3B,YAAa,CAEb,sBAAuB,CAEvB,wBAAiB,CAAjB,gBAAiB,CADjB,kBAEF,CAEA,mCAGE,eAuBF,CArBE,4EAJA,oBAAqB,CACrB,8CAaA,CAVA,yCAQE,oDAA8C,CAF9C,UAAW,CAJX,WAAa,CAEb,aAAe,CAKf,2CACF,CAEA,+CACE,aACF,CAGE,oDACE,YACF,CAIJ,4BACE,oBAAqB,CACrB,8CAOF,CALE,0CACE,gDAAwC,CC5D1C,eAAgB,CAFhB,8EAAgC,CAChC,kBDgEA,CAIA,kDACE,iCAA0B,CAC1B,4BAAqB,CAArB,oBAeF,CAZI,4EACE,iCAA0B,CAA1B,yBACF,CAGF,gEACE,4BAAqB,CAArB,oBACF,CAEA,gEACE,oCACF,CAKF,oDAKE,gDAAyC,CAJzC,oCAA6B,CAG7B,uCAAiC,CADjC,yCAAkC,CADlC,4BAAqB,CAArB,oBAaF,CARE,0DACE,6DAAoD,CACpD,4BAAqB,CAArB,oBACF,CAEA,kEACE,gDACF,CAIJ,uCAGE,kBAAmB,CAFnB,mBAAoB,CAGpB,iBAAkB,CAFlB,qBAAsB,CAKtB,eAAgB,CAFhB,cAAe,CACf,kBAmDF,CA7CE,2DACE,kBACF,CAEA,mDACE,aACF,CAGE,uFACE,YACF,CAGF,0EAEE,oBAAqB,CADrB,iBAWF,CARE,kFAEE,cAAe,CADf,eAMF,CAHE,0GACE,YACF,CAIJ,0EAKE,4CAAwC,CADxC,8CAAwC,CADxC,4GAAwC,CAIxC,gBAAiB,CACjB,0CAAqC,CAFrC,2CAAsC,CAGtC,eAAgB,CARhB,iBAAkB,CAUlB,0EAA4D,CAT5D,SAcF,CAHE,8CAbF,0EAcI,4EAEJ,CADE","file":"Breadcrumbs-16d81430.css","sourcesContent":[".BreadcrumbsBase {\n display: flex;\n justify-content: space-between;\n width: 100%;\n}\n\n.BreadcrumbsList {\n padding-left: 0;\n margin-top: 0;\n margin-bottom: 0;\n}\n\n[data-overflow='menu'],\n[data-overflow='menu-with-root'] {\n & .BreadcrumbsList {\n white-space: nowrap;\n display: flex;\n flex-direction: row;\n }\n}\n\n.ItemSeparator {\n color: var(--fgColor-muted);\n display: flex;\n align-self: center;\n justify-content: center;\n white-space: nowrap;\n user-select: none;\n}\n\n.ItemWrapper {\n display: inline-block;\n font-size: var(--text-body-size-medium);\n list-style: none;\n\n &::after {\n display: inline-block;\n height: 0.8em;\n /* stylelint-disable-next-line primer/spacing */\n margin: 0 0.5em;\n font-size: var(--text-body-size-medium);\n content: '';\n /* stylelint-disable-next-line primer/borders, primer/colors */\n border-right: 0.1em solid var(--fgColor-muted);\n transform: rotate(15deg) translateY(0.0625em);\n }\n\n &:first-child {\n margin-left: 0;\n }\n\n &:last-child {\n &::after {\n content: none;\n }\n }\n}\n\n.Item {\n display: inline-block;\n font-size: var(--text-body-size-medium);\n\n &:focus-visible {\n border-radius: var(--borderRadius-small);\n\n @mixin focusOutline 2px;\n }\n}\n\n[data-variant='normal'] {\n & .Item {\n color: var(--fgColor-link);\n text-decoration: none;\n\n &:not([aria-current]) {\n &:hover {\n text-decoration: underline;\n }\n }\n\n &:focus-visible {\n text-decoration: none;\n }\n\n &[aria-current] {\n color: var(--fgColor-default);\n }\n }\n}\n\n[data-variant='spacious'] {\n & .Item {\n color: var(--fgColor-default);\n text-decoration: none;\n padding-inline: var(--base-size-6);\n padding-block: var(--base-size-4);\n border-radius: var(--borderRadius-medium);\n\n &:hover {\n background: var(--control-transparent-bgColor-hover);\n text-decoration: none;\n }\n\n &[aria-current] {\n font-weight: var(--base-text-weight-semibold);\n }\n }\n}\n\n.BreadcrumbsItem {\n display: inline-grid;\n grid-auto-flow: column;\n align-items: center;\n flex: 0 99999 auto;\n min-width: auto;\n white-space: nowrap;\n list-style: none;\n\n /* allow menu items to wrap line */\n /* The overflow-menu item is marked in React (`data-overflow-menu`) instead of using\n `:has(.MenuOverlay)`, avoiding Safari's `:has()` invalidation cost. */\n &[data-overflow-menu] {\n white-space: normal;\n }\n\n &:first-child {\n margin-left: 0;\n }\n\n &:last-child {\n .ItemSeparator {\n display: none;\n }\n }\n\n .MenuDetails {\n position: relative;\n display: inline-block;\n\n & summary {\n list-style: none;\n cursor: pointer;\n\n &::-webkit-details-marker {\n display: none;\n }\n }\n }\n\n .MenuOverlay {\n position: absolute;\n z-index: 1;\n box-shadow: var(--shadow-floating-small);\n border-radius: var(--borderRadius-large);\n background-color: var(--overlay-bgColor);\n min-width: var(--overlay-width-xsmall);\n max-height: 100vh;\n max-width: var(--overlay-width-small);\n overflow: hidden;\n /* stylelint-disable-next-line primer/spacing */\n top: calc(var(--overlay-offset) + var(--control-small-size));\n\n @media (prefers-reduced-motion: no-preference) {\n animation: overlay-appear 200ms cubic-bezier(0.33, 1, 0.68, 1);\n }\n }\n}\n","@define-mixin focusOutline $outlineOffset: -2px, $outlineColor: var(--focus-outline-color, var(--focus-outlineColor)) {\n outline: 2px solid $outlineColor;\n outline-offset: $outlineOffset;\n box-shadow: none;\n}\n"]}