@primer/react 0.0.0-20260522201814 → 0.0.0-20260523120913

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.
Files changed (30) hide show
  1. package/CHANGELOG.md +13 -3
  2. package/dist/AnchoredOverlay/AnchoredOverlay-d483d670.css +2 -0
  3. package/dist/AnchoredOverlay/AnchoredOverlay-d483d670.css.map +1 -0
  4. package/dist/AnchoredOverlay/AnchoredOverlay.module.css.js +1 -1
  5. package/dist/Avatar/{Avatar-bd06a936.css → Avatar-61b19061.css} +2 -2
  6. package/dist/Avatar/Avatar-61b19061.css.map +1 -0
  7. package/dist/Avatar/Avatar.d.ts +0 -8
  8. package/dist/Avatar/Avatar.d.ts.map +1 -1
  9. package/dist/Avatar/Avatar.js +59 -116
  10. package/dist/Avatar/Avatar.module.css.js +2 -2
  11. package/dist/Overlay/{Overlay-95cfd3c7.css → Overlay-214d10dd.css} +2 -2
  12. package/dist/Overlay/Overlay-214d10dd.css.map +1 -0
  13. package/dist/Overlay/Overlay.module.css.js +1 -1
  14. package/dist/UnderlineNav/UnderlineNav.d.ts +0 -2
  15. package/dist/UnderlineNav/UnderlineNav.d.ts.map +1 -1
  16. package/dist/UnderlineNav/UnderlineNav.js +263 -123
  17. package/dist/UnderlineNav/UnderlineNavContext.d.ts +1 -10
  18. package/dist/UnderlineNav/UnderlineNavContext.d.ts.map +1 -1
  19. package/dist/UnderlineNav/UnderlineNavContext.js +0 -2
  20. package/dist/UnderlineNav/UnderlineNavItem.d.ts +3 -1
  21. package/dist/UnderlineNav/UnderlineNavItem.d.ts.map +1 -1
  22. package/dist/UnderlineNav/UnderlineNavItem.js +7 -22
  23. package/dist/UnderlineNav/types.d.ts +1 -5
  24. package/dist/UnderlineNav/types.d.ts.map +1 -1
  25. package/generated/components.json +0 -20
  26. package/package.json +1 -1
  27. package/dist/AnchoredOverlay/AnchoredOverlay-ec9e15fc.css +0 -2
  28. package/dist/AnchoredOverlay/AnchoredOverlay-ec9e15fc.css.map +0 -1
  29. package/dist/Avatar/Avatar-bd06a936.css.map +0 -1
  30. package/dist/Overlay/Overlay-95cfd3c7.css.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,19 +1,29 @@
1
1
  # @primer/react
2
2
 
3
- ## 0.0.0-20260522201814
3
+ ## 0.0.0-20260523120913
4
4
 
5
5
  ### Minor Changes
6
6
 
7
- - [#7870](https://github.com/primer/react/pull/7870) [`fc23ca1`](https://github.com/primer/react/commit/fc23ca17e4a954f350c2fde11130ddcac02a5dba) Thanks [@liuliu-dev](https://github.com/liuliu-dev)! - Avatar: Add `srcTransformer` prop to transform the image URL before rendering, and `statusIcon` slot to render an overlay icon at the bottom-right of the avatar
8
-
9
7
  - [#7852](https://github.com/primer/react/pull/7852) [`5504680`](https://github.com/primer/react/commit/5504680614bacc2ce3eecaaa55d10887e6fb152d) Thanks [@liuliu-dev](https://github.com/liuliu-dev)! - Card: Add `data-component` attributes to `Card` and its subcomponents (`Icon`, `Image`, `Heading`, `Description`, `Metadata`, `Menu`). Add an `as` prop (`'div' | 'section'`) so standalone Cards can render as a labelled region landmark; `as="section"` requires `aria-label` or `aria-labelledby`. `Card` now requires `children`. Also improves docs and stories.
10
8
 
11
9
  ### Patch Changes
12
10
 
11
+ - [#7858](https://github.com/primer/react/pull/7858) [`1ce2906`](https://github.com/primer/react/commit/1ce2906d1816ba443eacfede67d496d074b8d2fb) Thanks [@TylerJDev](https://github.com/TylerJDev)! - AnchoredOverlay: Add additional fallbacks for CSS Anchor Positioning
12
+
13
13
  - [#7843](https://github.com/primer/react/pull/7843) [`fc571fd`](https://github.com/primer/react/commit/fc571fd8c3899f19a1dd9e77b8a22f6528d776e2) Thanks [@joshblack](https://github.com/joshblack)! - Update useMergedRefs so that in React 18 no warning is emitted
14
14
 
15
15
  - Fake entry to force publishing
16
16
 
17
+ - [#7875](https://github.com/primer/react/pull/7875) [`1fcc071`](https://github.com/primer/react/commit/1fcc071865a6b9b06988a84864f20a3faa9d523d) Thanks [@mattcosta7](https://github.com/mattcosta7)! - UnderlineNav: Re-architect item measurement to remove a cascading render on
18
+ mount. Each `UnderlineNav.Item` no longer dispatches measurement setState calls
19
+ back into its parent via context; `UnderlineNav` now walks its rendered items
20
+ in a single layout effect and stores widths in refs. Overflow state is
21
+ consolidated into one `useState` object (one commit per change), the context
22
+ value is memoized, `UnderlineNav.Item` is wrapped in `React.memo`, and the
23
+ external-`aria-current` swap was moved out of render-phase setState into a
24
+ layout effect. Behavior is unchanged for consumers, but the initial mount and
25
+ overflow-state transitions produce far fewer per-item renders.
26
+
17
27
  ## 38.24.0
18
28
 
19
29
  ### Minor Changes
@@ -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-AnchoredOverlay-fYg9Z{position-try-fallbacks:flip-block,flip-inline,flip-block flip-inline,--inline-end-center,--inline-start-center,--fit-block-bottom,--fit-block-top;position-visibility:anchors-visible;position:fixed!important;z-index:100}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[popover]{border:0;inset:auto;margin:0;max-width:none;padding:0}.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-bottom][data-align=left]{left:auto;right:calc(anchor(right) - var(--anchored-overlay-anchor-offset-left))}@media screen and (max-width:calc(48rem - 0.02px)){.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-bottom][data-align=left][data-responsive=fullscreen]{right:auto}}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-bottom][data-align=right]{left:calc(anchor(left) - var(--anchored-overlay-anchor-offset-right))}@media screen and (max-width:calc(48rem - 0.02px)){.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-bottom][data-align=right][data-responsive=fullscreen]{left:auto}}.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-top][data-align=left]{left:auto;right:anchor(right)}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-top][data-align=right]{left:calc(anchor(left) - var(--anchored-overlay-anchor-offset-right))}@media screen and (max-width:calc(48rem - 0.02px)){.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-top][data-align=right][data-responsive=fullscreen]{left:auto}}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-left]{margin-right:var(--base-size-4,.25rem);right:anchor(left);top:var(--anchored-overlay-top-override,anchor(top));position-try-fallbacks:flip-inline,flip-block,flip-start,--outside-left-to-bottom}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-right]{left:anchor(right);margin-left:var(--base-size-4,.25rem);top:var(--anchored-overlay-top-override,anchor(top));position-try-fallbacks:flip-inline,flip-block,flip-start,--outside-right-to-bottom}@position-try --outside-left-to-bottom{margin:0;right:anchor(right);top:calc(anchor(bottom) + var(--base-size-4,.25rem));width:auto}@position-try --outside-right-to-bottom{left:anchor(left);margin:0;top:calc(anchor(bottom) + var(--base-size-4,.25rem));width:auto}@position-try --inline-end-center{align-self:anchor-center;bottom:auto;left:anchor(right);margin-left:var(--base-size-4,.25rem);top:auto}@position-try --inline-start-center{align-self:anchor-center;bottom:auto;left:auto;margin-right:var(--base-size-4,.25rem);right:anchor(left);top:auto}@position-try --fit-block-bottom{bottom:var(--base-size-8,.5rem);height:auto;max-height:none;top:calc(anchor(bottom) + var(--base-size-4,.25rem))}@position-try --fit-block-top{bottom:calc(100vh - anchor(top) + var(--base-size-4,.25rem));height:auto;max-height:none;top:var(--base-size-8,.5rem)}
2
+ /*# sourceMappingURL=AnchoredOverlay-d483d670.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,2CACE,iJAOiB,CACjB,mCAAoC,CAEpC,wBAA0B,CAD1B,WAgFF,CA7EE,oDAIE,QAAS,CAHT,UAAW,CACX,QAAS,CAGT,cAAe,CAFf,SAGF,CAEA,qEAGE,iBAAkB,CADlB,oDAuBF,CApBE,sFACE,SAAU,CACV,sEAOF,CAJI,mDADF,kHAEI,UAEJ,CADE,CAIJ,uFACE,qEAOF,CAJI,mDADF,mHAEI,SAEJ,CADE,CAKN,kEAEE,kBAAmB,CACnB,iBAAkB,CAFlB,uCAkBF,CAdE,mFACE,SAAU,CACV,mBACF,CAEA,oFACE,qEAOF,CAJI,mDADF,gHAEI,SAEJ,CADE,CAKN,mEAWE,sCAAgC,CAVhC,kBAAmB,CASnB,oDAAsD,CAEtD,iFACF,CAEA,oEACE,kBAAmB,CAEnB,qCAA+B,CAD/B,oDAAsD,CAEtD,kFACF,CAGF,uCAGE,QAAS,CAFT,mBAAoB,CACpB,oDAA8C,CAE9C,UACF,CAEA,wCACE,iBAAkB,CAElB,QAAS,CADT,oDAA8C,CAE9C,UACF,CAEA,kCAKE,wBAAyB,CAFzB,WAAY,CAFZ,kBAAmB,CAGnB,qCAA+B,CAF/B,QAIF,CAEA,oCAME,wBAAyB,CAFzB,WAAY,CAFZ,SAAU,CAGV,sCAAgC,CAJhC,kBAAmB,CAEnB,QAIF,CAEA,iCAEE,+BAA0B,CAC1B,WAAY,CACZ,eAAgB,CAHhB,oDAIF,CAEA,8BAEE,4DAAsD,CACtD,WAAY,CACZ,eAAgB,CAHhB,4BAIF","file":"AnchoredOverlay-d483d670.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.AnchoredOverlay {\n position-try-fallbacks:\n flip-block,\n flip-inline,\n flip-block flip-inline,\n --inline-end-center,\n --inline-start-center,\n --fit-block-bottom,\n --fit-block-top;\n position-visibility: anchors-visible;\n z-index: 100;\n position: fixed !important;\n\n &[popover] {\n inset: auto;\n margin: 0;\n padding: 0;\n border: 0;\n max-width: none;\n }\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 &[data-align='left'] {\n left: auto;\n right: calc(anchor(right) - var(--anchored-overlay-anchor-offset-left));\n /* stylelint-disable max-nesting-depth */\n &[data-responsive='fullscreen'] {\n @media screen and (--viewportRange-narrow) {\n right: auto;\n }\n }\n }\n\n &[data-align='right'] {\n left: calc(anchor(left) - var(--anchored-overlay-anchor-offset-right));\n\n &[data-responsive='fullscreen'] {\n @media screen and (--viewportRange-narrow) {\n left: auto;\n }\n }\n }\n }\n\n &[data-side='outside-top'] {\n margin-bottom: var(--base-size-4);\n bottom: anchor(top);\n left: anchor(left);\n\n &[data-align='left'] {\n left: auto;\n right: anchor(right);\n }\n\n &[data-align='right'] {\n left: calc(anchor(left) - var(--anchored-overlay-anchor-offset-right));\n\n &[data-responsive='fullscreen'] {\n @media screen and (--viewportRange-narrow) {\n left: auto;\n }\n }\n }\n }\n\n &[data-side='outside-left'] {\n right: anchor(left);\n /* Falls back to `anchor(top)` when JS hasn't overridden it. JS sets the\n override when the overlay's bottom would overflow the viewport so we\n can lift it up to keep the bottom edge on screen, mirroring the JS\n anchored-positioning code path.\n\n This override only applies when CSS cannot find space using the default position -\n or any of its defined fallbacks.\n */\n top: var(--anchored-overlay-top-override, anchor(top));\n margin-right: var(--base-size-4);\n position-try-fallbacks: flip-inline, flip-block, flip-start, --outside-left-to-bottom;\n }\n\n &[data-side='outside-right'] {\n left: anchor(right);\n top: var(--anchored-overlay-top-override, anchor(top));\n margin-left: var(--base-size-4);\n position-try-fallbacks: flip-inline, flip-block, flip-start, --outside-right-to-bottom;\n }\n}\n\n@position-try --outside-left-to-bottom {\n right: anchor(right);\n top: calc(anchor(bottom) + var(--base-size-4));\n margin: 0;\n width: auto;\n}\n\n@position-try --outside-right-to-bottom {\n left: anchor(left);\n top: calc(anchor(bottom) + var(--base-size-4));\n margin: 0;\n width: auto;\n}\n\n@position-try --inline-end-center {\n left: anchor(right);\n top: auto;\n bottom: auto;\n margin-left: var(--base-size-4);\n align-self: anchor-center;\n}\n\n@position-try --inline-start-center {\n right: anchor(left);\n left: auto;\n top: auto;\n bottom: auto;\n margin-right: var(--base-size-4);\n align-self: anchor-center;\n}\n\n@position-try --fit-block-bottom {\n top: calc(anchor(bottom) + var(--base-size-4));\n bottom: var(--base-size-8);\n height: auto;\n max-height: none;\n}\n\n@position-try --fit-block-top {\n top: var(--base-size-8);\n bottom: calc(100vh - anchor(top) + var(--base-size-4));\n height: auto;\n max-height: none;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import './AnchoredOverlay-ec9e15fc.css';
1
+ import './AnchoredOverlay-d483d670.css';
2
2
 
3
3
  var classes = {"ResponsiveCloseButtonContainer":"prc-AnchoredOverlay-ResponsiveCloseButtonContainer-nuium","ResponsiveCloseButton":"prc-AnchoredOverlay-ResponsiveCloseButton-z-2rx","AnchoredOverlay":"prc-AnchoredOverlay-AnchoredOverlay-fYg9Z"};
4
4
 
@@ -1,2 +1,2 @@
1
- :where(.prc-Avatar-Avatar-0xaUi){border-radius:50%;box-shadow:0 0 0 1px var(--avatar-borderColor,#1f232826);display:inline-block;height:var(--avatarSize-regular);line-height:1;overflow:hidden;vertical-align:middle;width:var(--avatarSize-regular)}:where(.prc-Avatar-Avatar-0xaUi):where([data-square]){border-radius:clamp(4px,calc(var(--avatarSize-regular) - 24px),var(--borderRadius-medium,.375rem))}@media screen and (max-width:calc(48rem - 0.02px)){:where(.prc-Avatar-Avatar-0xaUi):where([data-responsive]){height:var(--avatarSize-narrow);width:var(--avatarSize-narrow)}}@media screen and (min-width:48rem){:where(.prc-Avatar-Avatar-0xaUi):where([data-responsive]){height:var(--avatarSize-regular);width:var(--avatarSize-regular)}}@media screen and (min-width:87.5rem){:where(.prc-Avatar-Avatar-0xaUi):where([data-responsive]){height:var(--avatarSize-wide);width:var(--avatarSize-wide)}}.prc-Avatar-AvatarContainer-2hYo7{display:inline-flex;position:relative;vertical-align:middle}.prc-Avatar-StatusIcon-K6btp{background-color:var(--bgColor-default,var(--color-canvas-default));border-radius:100px;bottom:calc(var(--base-size-4,.25rem)*-1);box-shadow:0 0 0 2px var(--bgColor-default,var(--color-canvas-default));display:flex;line-height:1;position:absolute;right:calc(var(--base-size-4,.25rem)*-1)}
2
- /*# sourceMappingURL=Avatar-bd06a936.css.map */
1
+ :where(.prc-Avatar-Avatar-0xaUi){border-radius:50%;box-shadow:0 0 0 1px var(--avatar-borderColor,#1f232826);display:inline-block;height:var(--avatarSize-regular);line-height:1;overflow:hidden;vertical-align:middle;width:var(--avatarSize-regular)}:where(.prc-Avatar-Avatar-0xaUi):where([data-square]){border-radius:clamp(4px,calc(var(--avatarSize-regular) - 24px),var(--borderRadius-medium,.375rem))}@media screen and (max-width:calc(48rem - 0.02px)){:where(.prc-Avatar-Avatar-0xaUi):where([data-responsive]){height:var(--avatarSize-narrow);width:var(--avatarSize-narrow)}}@media screen and (min-width:48rem){:where(.prc-Avatar-Avatar-0xaUi):where([data-responsive]){height:var(--avatarSize-regular);width:var(--avatarSize-regular)}}@media screen and (min-width:87.5rem){:where(.prc-Avatar-Avatar-0xaUi):where([data-responsive]){height:var(--avatarSize-wide);width:var(--avatarSize-wide)}}
2
+ /*# sourceMappingURL=Avatar-61b19061.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/Avatar/Avatar.module.css.js"],"names":[],"mappings":"AAAA,iCAQE,iBAAkB,CAElB,wDAA+C,CAT/C,oBAAqB,CAErB,gCAAiC,CAGjC,aAAc,CAFd,eAAgB,CAGhB,qBAAsB,CALtB,+BA+BF,CArBE,sDAEE,kGACF,CAGE,mDADF,0DAGI,+BAAgC,CADhC,8BAaJ,CAXE,CAEA,oCANF,0DAQI,gCAAiC,CADjC,+BAQJ,CANE,CAEA,sCAXF,0DAaI,6BAA8B,CAD9B,4BAGJ,CADE","file":"Avatar-61b19061.css","sourcesContent":[":where(.Avatar) {\n display: inline-block;\n width: var(--avatarSize-regular);\n height: var(--avatarSize-regular);\n overflow: hidden; /* Ensure page layout in Firefox should images fail to load */\n /* stylelint-disable-next-line primer/typography */\n line-height: 1;\n vertical-align: middle;\n border-radius: 50%;\n /* stylelint-disable-next-line primer/box-shadow */\n box-shadow: 0 0 0 1px var(--avatar-borderColor);\n\n &:where([data-square]) {\n /* stylelint-disable-next-line primer/borders */\n border-radius: clamp(4px, calc(var(--avatarSize-regular) - 24px), var(--borderRadius-medium));\n }\n\n &:where([data-responsive]) {\n @media screen and (--viewportRange-narrow) {\n width: var(--avatarSize-narrow);\n height: var(--avatarSize-narrow);\n }\n\n @media screen and (--viewportRange-regular) {\n width: var(--avatarSize-regular);\n height: var(--avatarSize-regular);\n }\n\n @media screen and (--viewportRange-wide) {\n width: var(--avatarSize-wide);\n height: var(--avatarSize-wide);\n }\n }\n}\n"]}
@@ -8,10 +8,6 @@ export type AvatarProps = {
8
8
  square?: boolean;
9
9
  /** URL of the avatar image. */
10
10
  src: string;
11
- /** Transforms the `src` URL before rendering. Receives the original `src` and the resolved numeric `size`. */
12
- srcTransformer?: (src: string, size: number) => string;
13
- /** Renders a status icon overlay positioned at the bottom-right of the avatar. */
14
- statusIcon?: React.ReactNode;
15
11
  /** Provide alt text when the Avatar is used without the user's name next to it. */
16
12
  alt?: string;
17
13
  /** Additional class name. */
@@ -24,10 +20,6 @@ declare const Avatar: React.ForwardRefExoticComponent<{
24
20
  square?: boolean;
25
21
  /** URL of the avatar image. */
26
22
  src: string;
27
- /** Transforms the `src` URL before rendering. Receives the original `src` and the resolved numeric `size`. */
28
- srcTransformer?: (src: string, size: number) => string;
29
- /** Renders a status icon overlay positioned at the bottom-right of the avatar. */
30
- statusIcon?: React.ReactNode;
31
23
  /** Provide alt text when the Avatar is used without the user's name next to it. */
32
24
  alt?: string;
33
25
  /** Additional class name. */
@@ -1 +1 @@
1
- {"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../src/Avatar/Avatar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,6BAA6B,CAAA;AAIhE,eAAO,MAAM,mBAAmB,KAAK,CAAA;AAErC,MAAM,MAAM,WAAW,GAAG;IACxB,+CAA+C;IAC/C,IAAI,CAAC,EAAE,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC,CAAA;IACvC,+FAA+F;IAC/F,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,+BAA+B;IAC/B,GAAG,EAAE,MAAM,CAAA;IACX,8GAA8G;IAC9G,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;IACtD,kFAAkF;IAClF,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC5B,mFAAmF;IACnF,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,GAAG,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAA;AAEzC,QAAA,MAAM,MAAM;IAhBV,+CAA+C;WACxC,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC;IACvC,+FAA+F;aACtF,OAAO;IAChB,+BAA+B;SAC1B,MAAM;IACX,8GAA8G;qBAC7F,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM;IACtD,kFAAkF;iBACrE,KAAK,CAAC,SAAS;IAC5B,mFAAmF;UAC7E,MAAM;IACZ,6BAA6B;gBACjB,MAAM;8IAsDlB,CAAA;AAMF,eAAe,MAAM,CAAA"}
1
+ {"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../src/Avatar/Avatar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,6BAA6B,CAAA;AAIhE,eAAO,MAAM,mBAAmB,KAAK,CAAA;AAErC,MAAM,MAAM,WAAW,GAAG;IACxB,+CAA+C;IAC/C,IAAI,CAAC,EAAE,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC,CAAA;IACvC,+FAA+F;IAC/F,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,+BAA+B;IAC/B,GAAG,EAAE,MAAM,CAAA;IACX,mFAAmF;IACnF,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,GAAG,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAA;AAEzC,QAAA,MAAM,MAAM;IAZV,+CAA+C;WACxC,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC;IACvC,+FAA+F;aACtF,OAAO;IAChB,+BAA+B;SAC1B,MAAM;IACX,mFAAmF;UAC7E,MAAM;IACZ,6BAA6B;gBACjB,MAAM;8IAuClB,CAAA;AAMF,eAAe,MAAM,CAAA"}
@@ -3,17 +3,13 @@ import { clsx } from 'clsx';
3
3
  import React from 'react';
4
4
  import { isResponsiveValue } from '../hooks/useResponsiveValue.js';
5
5
  import classes from './Avatar.module.css.js';
6
- import { jsx, jsxs } from 'react/jsx-runtime';
6
+ import { jsx } from 'react/jsx-runtime';
7
7
 
8
8
  const DEFAULT_AVATAR_SIZE = 20;
9
9
  const Avatar = /*#__PURE__*/React.forwardRef(function Avatar(t0, ref) {
10
- var _regular;
11
- const $ = c(43);
10
+ const $ = c(29);
12
11
  let className;
13
12
  let rest;
14
- let src;
15
- let srcTransformer;
16
- let statusIcon;
17
13
  let style;
18
14
  let t1;
19
15
  let t2;
@@ -25,55 +21,46 @@ const Avatar = /*#__PURE__*/React.forwardRef(function Avatar(t0, ref) {
25
21
  square: t3,
26
22
  className,
27
23
  style,
28
- src,
29
- srcTransformer,
30
- statusIcon,
31
24
  ...rest
32
25
  } = t0);
33
26
  $[0] = t0;
34
27
  $[1] = className;
35
28
  $[2] = rest;
36
- $[3] = src;
37
- $[4] = srcTransformer;
38
- $[5] = statusIcon;
39
- $[6] = style;
40
- $[7] = t1;
41
- $[8] = t2;
42
- $[9] = t3;
29
+ $[3] = style;
30
+ $[4] = t1;
31
+ $[5] = t2;
32
+ $[6] = t3;
43
33
  } else {
44
34
  className = $[1];
45
35
  rest = $[2];
46
- src = $[3];
47
- srcTransformer = $[4];
48
- statusIcon = $[5];
49
- style = $[6];
50
- t1 = $[7];
51
- t2 = $[8];
52
- t3 = $[9];
36
+ style = $[3];
37
+ t1 = $[4];
38
+ t2 = $[5];
39
+ t3 = $[6];
53
40
  }
54
41
  const alt = t1 === undefined ? "" : t1;
55
42
  const size = t2 === undefined ? DEFAULT_AVATAR_SIZE : t2;
56
43
  const square = t3 === undefined ? false : t3;
57
44
  let t4;
58
- if ($[10] !== size) {
45
+ if ($[7] !== size) {
59
46
  t4 = isResponsiveValue(size);
60
- $[10] = size;
61
- $[11] = t4;
47
+ $[7] = size;
48
+ $[8] = t4;
62
49
  } else {
63
- t4 = $[11];
50
+ t4 = $[8];
64
51
  }
65
52
  const isResponsive = t4;
66
53
  let cssSizeVars;
67
- if ($[12] !== isResponsive || $[13] !== size) {
54
+ if ($[9] !== isResponsive || $[10] !== size) {
68
55
  cssSizeVars = {};
69
56
  if (isResponsive) {
70
57
  let t5;
71
- if ($[15] !== size) {
58
+ if ($[12] !== size) {
72
59
  t5 = Object.entries(size);
73
- $[15] = size;
74
- $[16] = t5;
60
+ $[12] = size;
61
+ $[13] = t5;
75
62
  } else {
76
- t5 = $[16];
63
+ t5 = $[13];
77
64
  }
78
65
  for (const [key, value] of t5) {
79
66
  cssSizeVars[`--avatarSize-${key}`] = `${value}px`;
@@ -81,108 +68,64 @@ const Avatar = /*#__PURE__*/React.forwardRef(function Avatar(t0, ref) {
81
68
  } else {
82
69
  cssSizeVars["--avatarSize-regular"] = `${size}px`;
83
70
  }
84
- $[12] = isResponsive;
85
- $[13] = size;
86
- $[14] = cssSizeVars;
71
+ $[9] = isResponsive;
72
+ $[10] = size;
73
+ $[11] = cssSizeVars;
87
74
  } else {
88
- cssSizeVars = $[14];
75
+ cssSizeVars = $[11];
89
76
  }
90
- const resolvedSize = isResponsive ? (_regular = size.regular) !== null && _regular !== void 0 ? _regular : DEFAULT_AVATAR_SIZE : size;
91
77
  let t5;
92
- if ($[17] !== resolvedSize || $[18] !== src || $[19] !== srcTransformer) {
93
- t5 = srcTransformer ? srcTransformer(src, resolvedSize) : src;
94
- $[17] = resolvedSize;
95
- $[18] = src;
96
- $[19] = srcTransformer;
97
- $[20] = t5;
98
- } else {
99
- t5 = $[20];
100
- }
101
- const resolvedSrc = t5;
102
- let t6;
103
- if ($[21] !== className) {
104
- t6 = clsx(className, classes.Avatar);
105
- $[21] = className;
106
- $[22] = t6;
78
+ if ($[14] !== className) {
79
+ t5 = clsx(className, classes.Avatar);
80
+ $[14] = className;
81
+ $[15] = t5;
107
82
  } else {
108
- t6 = $[22];
83
+ t5 = $[15];
109
84
  }
110
- const t7 = isResponsive ? "" : undefined;
111
- const t8 = square ? "" : undefined;
85
+ const t6 = isResponsive ? "" : undefined;
86
+ const t7 = square ? "" : undefined;
87
+ const t8 = isResponsive ? undefined : size;
112
88
  const t9 = isResponsive ? undefined : size;
113
- const t10 = isResponsive ? undefined : size;
114
- let t11;
115
- if ($[23] !== cssSizeVars || $[24] !== style) {
116
- t11 = style ? {
89
+ let t10;
90
+ if ($[16] !== cssSizeVars || $[17] !== style) {
91
+ t10 = style ? {
117
92
  ...cssSizeVars,
118
93
  ...style
119
94
  } : cssSizeVars;
120
- $[23] = cssSizeVars;
121
- $[24] = style;
122
- $[25] = t11;
95
+ $[16] = cssSizeVars;
96
+ $[17] = style;
97
+ $[18] = t10;
123
98
  } else {
124
- t11 = $[25];
99
+ t10 = $[18];
125
100
  }
126
- let t12;
127
- if ($[26] !== alt || $[27] !== ref || $[28] !== resolvedSrc || $[29] !== rest || $[30] !== t10 || $[31] !== t11 || $[32] !== t6 || $[33] !== t7 || $[34] !== t8 || $[35] !== t9) {
128
- t12 = /*#__PURE__*/jsx("img", {
101
+ let t11;
102
+ if ($[19] !== alt || $[20] !== ref || $[21] !== rest || $[22] !== t10 || $[23] !== t5 || $[24] !== t6 || $[25] !== t7 || $[26] !== t8 || $[27] !== t9) {
103
+ t11 = /*#__PURE__*/jsx("img", {
129
104
  "data-component": "Avatar",
130
- className: t6,
105
+ className: t5,
131
106
  ref: ref,
132
107
  alt: alt,
133
- src: resolvedSrc,
134
- "data-responsive": t7,
135
- "data-square": t8,
136
- width: t9,
137
- height: t10,
138
- style: t11,
108
+ "data-responsive": t6,
109
+ "data-square": t7,
110
+ width: t8,
111
+ height: t9,
112
+ style: t10,
139
113
  ...rest
140
114
  });
141
- $[26] = alt;
142
- $[27] = ref;
143
- $[28] = resolvedSrc;
144
- $[29] = rest;
145
- $[30] = t10;
146
- $[31] = t11;
147
- $[32] = t6;
148
- $[33] = t7;
149
- $[34] = t8;
150
- $[35] = t9;
151
- $[36] = t12;
115
+ $[19] = alt;
116
+ $[20] = ref;
117
+ $[21] = rest;
118
+ $[22] = t10;
119
+ $[23] = t5;
120
+ $[24] = t6;
121
+ $[25] = t7;
122
+ $[26] = t8;
123
+ $[27] = t9;
124
+ $[28] = t11;
152
125
  } else {
153
- t12 = $[36];
154
- }
155
- const img = t12;
156
- if (statusIcon) {
157
- const t13 = cssSizeVars;
158
- let t14;
159
- if ($[37] !== statusIcon) {
160
- t14 = /*#__PURE__*/jsx("span", {
161
- className: classes.StatusIcon,
162
- children: statusIcon
163
- });
164
- $[37] = statusIcon;
165
- $[38] = t14;
166
- } else {
167
- t14 = $[38];
168
- }
169
- let t15;
170
- if ($[39] !== img || $[40] !== t13 || $[41] !== t14) {
171
- t15 = /*#__PURE__*/jsxs("div", {
172
- className: classes.AvatarContainer,
173
- style: t13,
174
- children: [img, t14]
175
- });
176
- $[39] = img;
177
- $[40] = t13;
178
- $[41] = t14;
179
- $[42] = t15;
180
- } else {
181
- t15 = $[42];
182
- }
183
- return t15;
126
+ t11 = $[28];
184
127
  }
185
- return img;
128
+ return t11;
186
129
  });
187
130
  if (process.env.NODE_ENV !== "production") {
188
131
  Avatar.displayName = 'Avatar';
@@ -1,5 +1,5 @@
1
- import './Avatar-bd06a936.css';
1
+ import './Avatar-61b19061.css';
2
2
 
3
- var classes = {"Avatar":"prc-Avatar-Avatar-0xaUi","AvatarContainer":"prc-Avatar-AvatarContainer-2hYo7","StatusIcon":"prc-Avatar-StatusIcon-K6btp"};
3
+ var classes = {"Avatar":"prc-Avatar-Avatar-0xaUi"};
4
4
 
5
5
  export { classes as default };
@@ -1,2 +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,#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);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:min(192px,100vh)}@supports (height:100dvh){.prc-Overlay-Overlay-jfs-T:where([data-max-height-xsmall]){max-height:min(192px,100dvh)}}.prc-Overlay-Overlay-jfs-T:where([data-max-height-small]){max-height:min(256px,100vh)}@supports (height:100dvh){.prc-Overlay-Overlay-jfs-T:where([data-max-height-small]){max-height:min(256px,100dvh)}}.prc-Overlay-Overlay-jfs-T:where([data-max-height-medium]){max-height:min(320px,100vh)}@supports (height:100dvh){.prc-Overlay-Overlay-jfs-T:where([data-max-height-medium]){max-height:min(320px,100dvh)}}.prc-Overlay-Overlay-jfs-T:where([data-max-height-large]){max-height:min(432px,100vh)}@supports (height:100dvh){.prc-Overlay-Overlay-jfs-T:where([data-max-height-large]){max-height:min(432px,100dvh)}}.prc-Overlay-Overlay-jfs-T:where([data-max-height-xlarge]){max-height:min(600px,100vh)}@supports (height:100dvh){.prc-Overlay-Overlay-jfs-T:where([data-max-height-xlarge]){max-height:min(600px,100dvh)}}.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]),.prc-Overlay-Overlay-jfs-T[data-responsive=fullscreen][data-anchor-position=true]{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]),.prc-Overlay-Overlay-jfs-T[data-responsive=fullscreen][data-anchor-position=true]{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-95cfd3c7.css.map */
1
+ @keyframes prc-Overlay-overlay-appear-JpFey{0%{opacity:0}to{opacity:1}}.prc-Overlay-Overlay-jfs-T{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);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:min(192px,100vh)}@supports (height:100dvh){.prc-Overlay-Overlay-jfs-T:where([data-max-height-xsmall]){max-height:min(192px,100dvh)}}.prc-Overlay-Overlay-jfs-T:where([data-max-height-small]){max-height:min(256px,100vh)}@supports (height:100dvh){.prc-Overlay-Overlay-jfs-T:where([data-max-height-small]){max-height:min(256px,100dvh)}}.prc-Overlay-Overlay-jfs-T:where([data-max-height-medium]){max-height:min(320px,100vh)}@supports (height:100dvh){.prc-Overlay-Overlay-jfs-T:where([data-max-height-medium]){max-height:min(320px,100dvh)}}.prc-Overlay-Overlay-jfs-T:where([data-max-height-large]){max-height:min(432px,100vh)}@supports (height:100dvh){.prc-Overlay-Overlay-jfs-T:where([data-max-height-large]){max-height:min(432px,100dvh)}}.prc-Overlay-Overlay-jfs-T:where([data-max-height-xlarge]){max-height:min(600px,100vh)}@supports (height:100dvh){.prc-Overlay-Overlay-jfs-T:where([data-max-height-xlarge]){max-height:min(600px,100dvh)}}.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]),.prc-Overlay-Overlay-jfs-T[data-component=AnchoredOverlay][data-responsive=fullscreen][data-anchor-position=true],.prc-Overlay-Overlay-jfs-T[data-responsive=fullscreen][data-anchor-position=true]{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]),.prc-Overlay-Overlay-jfs-T[data-component=AnchoredOverlay][data-responsive=fullscreen][data-anchor-position=true],.prc-Overlay-Overlay-jfs-T[data-responsive=fullscreen][data-anchor-position=true]{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-214d10dd.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,4CAAwC,CACxC,8CAAwC,CACxC,4GAAwC,CALxC,WAAY,CACZ,gBAAiB,CAJjB,4BAA6B,CAE7B,eAAgB,CAGhB,aAAc,CANd,iBAAkB,CAElB,UA0NF,CAjNE,wIAKE,yBAA2B,CAF3B,uBAkBF,CAZI,mDADF,6LAGI,MAAO,CADP,KAGJ,CADE,CAGF,iKAIE,qBAAuB,CAFvB,mBAGF,CAGF,iCACE,YACF,CAEA,8BAvCF,2BAyCI,6BAoLJ,CAnLE,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,2BAKF,CAHE,0BAHF,2DAII,4BAEJ,CADE,CAGF,0DACE,2BAKF,CAHE,0BAHF,0DAII,4BAEJ,CADE,CAGF,2DACE,2BAKF,CAHE,0BAHF,2DAII,4BAEJ,CADE,CAGF,0DACE,2BAKF,CAHE,0BAHF,0DAII,4BAEJ,CADE,CAGF,2DACE,2BAKF,CAHE,0BAHF,2DAII,4BAEJ,CADE,CAGF,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,CAKE,mDAHF,mQAYI,mBAAoB,CAHpB,YAAa,CAHb,MAAO,CAKP,QAAS,CADT,eAAgB,CAFhB,cAAe,CAMf,0CAA2C,CAV3C,cAAe,CACf,KAAM,CAEN,WAcJ,CALI,0BAhBJ,mQAkBM,aAGN,CAFI,CACF,CAGF,0BAEE,4DACE,aACF,CACF,CAGF,8CACE,2BACE,wEACF,CACF","file":"Overlay-214d10dd.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: min(192px, 100vh);\n\n @supports (height: 100dvh) {\n max-height: min(192px, 100dvh);\n }\n }\n\n &:where([data-max-height-small]) {\n max-height: min(256px, 100vh);\n\n @supports (height: 100dvh) {\n max-height: min(256px, 100dvh);\n }\n }\n\n &:where([data-max-height-medium]) {\n max-height: min(320px, 100vh);\n\n @supports (height: 100dvh) {\n max-height: min(320px, 100dvh);\n }\n }\n\n &:where([data-max-height-large]) {\n max-height: min(432px, 100vh);\n\n @supports (height: 100dvh) {\n max-height: min(432px, 100dvh);\n }\n }\n\n &:where([data-max-height-xlarge]) {\n max-height: min(600px, 100vh);\n\n @supports (height: 100dvh) {\n max-height: min(600px, 100dvh);\n }\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 &[data-responsive='fullscreen'][data-anchor-position='true'],\n &[data-component='AnchoredOverlay'][data-responsive='fullscreen'][data-anchor-position='true'] {\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,4 +1,4 @@
1
- import './Overlay-95cfd3c7.css';
1
+ import './Overlay-214d10dd.css';
2
2
 
3
3
  var classes = {"Overlay":"prc-Overlay-Overlay-jfs-T","overlay-appear":"prc-Overlay-overlay-appear-JpFey"};
4
4
 
@@ -15,7 +15,5 @@ export type UnderlineNavProps = {
15
15
  */
16
16
  variant?: 'inset' | 'flush';
17
17
  };
18
- export declare const MORE_BTN_WIDTH = 86;
19
- export declare const getValidChildren: (children: React.ReactNode) => React.ReactElement<any>[];
20
18
  export declare const UnderlineNav: React.ForwardRefExoticComponent<UnderlineNavProps & React.RefAttributes<unknown>>;
21
19
  //# sourceMappingURL=UnderlineNav.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UnderlineNav.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/UnderlineNav.tsx"],"names":[],"mappings":"AACA,OAAO,KAA6D,MAAM,OAAO,CAAA;AAmBjF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,YAAY,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,CAAA;IACjD,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAA;CAC5B,CAAA;AAGD,eAAO,MAAM,cAAc,KAAK,CAAA;AAwEhC,eAAO,MAAM,gBAAgB,GAAI,UAAU,KAAK,CAAC,SAAS,KAEgC,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,EAChH,CAAA;AAgCD,eAAO,MAAM,YAAY,mFA8SxB,CAAA"}
1
+ {"version":3,"file":"UnderlineNav.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/UnderlineNav.tsx"],"names":[],"mappings":"AACA,OAAO,KAAsE,MAAM,OAAO,CAAA;AAoB1F,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,YAAY,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,CAAA;IACjD,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAA;CAC5B,CAAA;AAkHD,eAAO,MAAM,YAAY,mFA+ZxB,CAAA"}
@@ -1,8 +1,9 @@
1
- import React, { forwardRef, useRef, useState, useEffect, useCallback } from 'react';
1
+ import React, { forwardRef, useRef, useState, useEffect, useCallback, useMemo } from 'react';
2
2
  import { UnderlineNavContext } from './UnderlineNavContext.js';
3
3
  import { useResizeObserver } from '../hooks/useResizeObserver.js';
4
+ import useIsomorphicLayoutEffect from '../utils/useIsomorphicLayoutEffect.js';
4
5
  import VisuallyHidden from '../_VisuallyHidden.js';
5
- import { dividerStyles, baseMenuMinWidth, menuItemStyles } from './styles.js';
6
+ import { baseMenuMinWidth, dividerStyles, menuItemStyles } from './styles.js';
6
7
  import { UnderlineWrapper, UnderlineItemList, LoadingCounter, GAP } from '../internal/components/UnderlineTabbedInterface.js';
7
8
  import { TriangleDownIcon } from '@primer/octicons-react';
8
9
  import { useOnEscapePress } from '../hooks/useOnEscapePress.js';
@@ -21,19 +22,19 @@ import CounterLabel from '../CounterLabel/CounterLabel.js';
21
22
  const MORE_BTN_WIDTH = 86;
22
23
  // The height is needed to make sure we don't have a layout shift when the more button is the only item in the nav.
23
24
  const MORE_BTN_HEIGHT = 45;
24
- const overflowEffect = (navWidth, moreMenuWidth, childArray, childWidthArray, noIconChildWidthArray, updateListAndMenu) => {
25
+ const computeOverflow = (navWidth, moreMenuWidth, childArray, childWidths, noIconChildWidths) => {
25
26
  let iconsVisible = true;
26
- if (childWidthArray.length === 0) {
27
- updateListAndMenu({
27
+ if (childWidths.size === 0) {
28
+ return {
28
29
  items: childArray,
29
- menuItems: []
30
- }, iconsVisible, false);
31
- return;
30
+ menuItems: [],
31
+ iconsVisible
32
+ };
32
33
  }
33
- const numberOfItemsPossible = calculatePossibleItems(childWidthArray, navWidth);
34
- const numberOfItemsWithoutIconPossible = calculatePossibleItems(noIconChildWidthArray, navWidth);
34
+ const numberOfItemsPossible = calculatePossibleItems(childArray, childWidths, navWidth);
35
+ const numberOfItemsWithoutIconPossible = calculatePossibleItems(childArray, noIconChildWidths, navWidth);
35
36
  // We need to take more menu width into account when calculating the number of items possible
36
- const numberOfItemsPossibleWithMoreMenu = calculatePossibleItems(noIconChildWidthArray, navWidth, moreMenuWidth || MORE_BTN_WIDTH);
37
+ const numberOfItemsPossibleWithMoreMenu = calculatePossibleItems(childArray, noIconChildWidths, navWidth, moreMenuWidth || MORE_BTN_WIDTH);
37
38
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
38
39
  const items = [];
39
40
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -76,26 +77,27 @@ const overflowEffect = (navWidth, moreMenuWidth, childArray, childWidthArray, no
76
77
  }
77
78
  }
78
79
  }
79
- updateListAndMenu({
80
+ return {
80
81
  items,
81
- menuItems
82
- }, iconsVisible, true);
82
+ menuItems,
83
+ iconsVisible
84
+ };
83
85
  };
84
86
  const getValidChildren = children => {
85
87
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
86
88
  return React.Children.toArray(children).filter(child => /*#__PURE__*/React.isValidElement(child));
87
89
  };
88
- const calculatePossibleItems = (childWidthArray, navWidth, moreMenuWidth = 0) => {
90
+ const calculatePossibleItems = (childArray, widthMap, navWidth, moreMenuWidth = 0) => {
89
91
  const widthToFit = navWidth - moreMenuWidth;
90
- let breakpoint = childWidthArray.length; // assume all items will fit
92
+ let breakpoint = childArray.length; // assume all items will fit
91
93
  let sumsOfChildWidth = 0;
92
- for (const [index, childWidth] of childWidthArray.entries()) {
93
- sumsOfChildWidth = sumsOfChildWidth + childWidth.width + GAP;
94
+ for (const [index, child] of childArray.entries()) {
95
+ var _widthMap$get;
96
+ const width = (_widthMap$get = widthMap.get(String(child.key))) !== null && _widthMap$get !== void 0 ? _widthMap$get : 0;
97
+ sumsOfChildWidth = sumsOfChildWidth + width + GAP;
94
98
  if (sumsOfChildWidth > widthToFit) {
95
99
  breakpoint = index;
96
100
  break;
97
- } else {
98
- continue;
99
101
  }
100
102
  }
101
103
  return breakpoint;
@@ -122,7 +124,6 @@ const UnderlineNav = /*#__PURE__*/forwardRef(({
122
124
  className,
123
125
  children
124
126
  }, forwardedRef) => {
125
- var _listRef$current2;
126
127
  const backupRef = useRef(null);
127
128
  const navRef = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : backupRef;
128
129
  const listRef = useRef(null);
@@ -131,32 +132,70 @@ const UnderlineNav = /*#__PURE__*/forwardRef(({
131
132
  const containerRef = React.useRef(null);
132
133
  const disclosureWidgetId = useId();
133
134
  const [isWidgetOpen, setIsWidgetOpen] = useState(false);
134
- const [iconsVisible, setIconsVisible] = useState(true);
135
- const [childWidthArray, setChildWidthArray] = useState([]);
136
- const [noIconChildWidthArray, setNoIconChildWidthArray] = useState([]);
137
- // Track whether the initial overflow calculation is complete to prevent CLS
138
- const [isOverflowMeasured, setIsOverflowMeasured] = useState(false);
135
+ // Measurement results are stored in refs because only `computeOverflow` reads them;
136
+ // they should not trigger re-renders. Keyed by `String(element.key)` so lookups
137
+ // are O(1) and survive non-string item children.
138
+ const childWidthsRef = useRef(new Map());
139
+ const noIconChildWidthsRef = useRef(new Map());
139
140
  const validChildren = getValidChildren(children);
141
+ // Stable signature of the children list — when it changes we re-run the
142
+ // measurement pass with all items rendered (with icons) in the list. The
143
+ // delimiter is U+0000 (NUL) because React rejects NUL inside element keys,
144
+ // so consumer-provided keys cannot collide with the separator.
145
+ const childrenKey = validChildren.map(c => String(c.key)).join('\u0000');
146
+
147
+ // Single consolidated overflow state. Bundling `items`, `menuItems`,
148
+ // `iconsVisible`, `measured`, and `childrenKey` together means every
149
+ // overflow update — measurement, swap, resize, or children-change reset —
150
+ // is exactly one setState call (one commit), instead of fanning out to
151
+ // multiple back-to-back commits.
140
152
 
141
- // Responsive props object manages which items are in the list and which items are in the menu.
142
- const [responsiveProps, setResponsiveProps] = useState({
153
+ const [overflowState, setOverflowState] = useState(() => ({
143
154
  items: validChildren,
144
- menuItems: []
145
- });
155
+ menuItems: [],
156
+ iconsVisible: true,
157
+ measured: false,
158
+ childrenKey
159
+ }));
160
+
161
+ // Derived-state reset: when the children list changes, push everything back into
162
+ // the list (with icons) so the next layout effect can measure all items in one
163
+ // pass. This is React's recommended "store information from previous renders"
164
+ // pattern — calling setState during render lets React discard the in-progress
165
+ // render and re-render immediately with the reset state, before paint.
166
+ if (overflowState.childrenKey !== childrenKey) {
167
+ setOverflowState({
168
+ items: validChildren,
169
+ menuItems: [],
170
+ iconsVisible: true,
171
+ measured: false,
172
+ childrenKey
173
+ });
174
+ }
175
+
176
+ // Build a key-indexed view of validChildren once per render so the listItems /
177
+ // menuItems prop-refresh below is O(N) instead of O(N^2) via Array.prototype.find.
178
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
179
+ const validChildrenByKey = new Map();
180
+ for (const c of validChildren) validChildrenByKey.set(String(c.key), c);
181
+ const {
182
+ iconsVisible,
183
+ measured: isOverflowMeasured
184
+ } = overflowState;
146
185
 
147
186
  // Make sure to have the fresh props data for list items when children are changed (keeping aria-current up-to-date)
148
- const listItems = responsiveProps.items.map(item => {
149
- var _validChildren$find;
150
- return (_validChildren$find = validChildren.find(child => child.key === item.key)) !== null && _validChildren$find !== void 0 ? _validChildren$find : item;
187
+ const listItems = overflowState.items.map(item => {
188
+ var _validChildrenByKey$g;
189
+ return (_validChildrenByKey$g = validChildrenByKey.get(String(item.key))) !== null && _validChildrenByKey$g !== void 0 ? _validChildrenByKey$g : item;
151
190
  });
152
191
 
153
192
  // Make sure to have the fresh props data for menu items when children are changed (keeping aria-current up-to-date)
154
- const menuItems = responsiveProps.menuItems.map(menuItem => {
155
- var _validChildren$find2;
156
- return (_validChildren$find2 = validChildren.find(child => child.key === menuItem.key)) !== null && _validChildren$find2 !== void 0 ? _validChildren$find2 : menuItem;
193
+ const menuItems = overflowState.menuItems.map(item => {
194
+ var _validChildrenByKey$g2;
195
+ return (_validChildrenByKey$g2 = validChildrenByKey.get(String(item.key))) !== null && _validChildrenByKey$g2 !== void 0 ? _validChildrenByKey$g2 : item;
157
196
  });
158
197
  // This is the case where the viewport is too narrow to show any list item with the more menu. In this case, we only show the dropdown
159
- const onlyMenuVisible = responsiveProps.items.length === 0;
198
+ const onlyMenuVisible = overflowState.items.length === 0;
160
199
  if (process.env.NODE_ENV !== "production") {
161
200
  // Practically, this is not a conditional hook, it is just making sure this hook runs only on DEV not PROD.
162
201
  // eslint-disable-next-line react-hooks/rules-of-hooks
@@ -169,66 +208,145 @@ const UnderlineNav = /*#__PURE__*/forwardRef(({
169
208
  !ariaLabel ? process.env.NODE_ENV !== "production" ? invariant(false, 'Use the `aria-label` prop to provide an accessible label for assistive technology') : invariant(false) : void 0;
170
209
  });
171
210
  }
172
- function getItemsWidth(itemText) {
173
- var _noIconChildWidthArra, _noIconChildWidthArra2;
174
- return (_noIconChildWidthArra = (_noIconChildWidthArra2 = noIconChildWidthArray.find(item => item.text === itemText)) === null || _noIconChildWidthArra2 === void 0 ? void 0 : _noIconChildWidthArra2.width) !== null && _noIconChildWidthArra !== void 0 ? _noIconChildWidthArra : 0;
175
- }
176
- const swapMenuItemWithListItem = (prospectiveListItem, indexOfProspectiveListItem, event, callback) => {
211
+
212
+ // Returns the measured "no icon" width for an item, looking up by element key.
213
+ // Previously this was a text-based lookup, which silently returned 0 when an
214
+ // item's children weren't a plain string and caused the swap math to degenerate.
215
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
216
+ const getItemNoIconWidth = item => {
217
+ var _noIconChildWidthsRef;
218
+ return (_noIconChildWidthsRef = noIconChildWidthsRef.current.get(String(item.key))) !== null && _noIconChildWidthsRef !== void 0 ? _noIconChildWidthsRef : 0;
219
+ };
220
+
221
+ // Pure: returns the {items, menuItems} that result from promoting
222
+ // `prospectiveListItem` (currently at position `indexOfProspectiveListItem`
223
+ // in `currentMenuItems`) into `currentItems`. Does not call setState.
224
+ const computeSwap = (currentItems, currentMenuItems, prospectiveListItem, indexOfProspectiveListItem) => {
177
225
  var _navRef$current$getBo, _navRef$current, _listRef$current$getB, _listRef$current;
178
- // get the selected menu item's width
179
- const widthToFitIntoList = getItemsWidth(prospectiveListItem.props.children);
180
- // Check if there is any empty space on the right side of the list
226
+ const widthToFitIntoList = getItemNoIconWidth(prospectiveListItem);
181
227
  const availableSpace = ((_navRef$current$getBo = (_navRef$current = navRef.current) === null || _navRef$current === void 0 ? void 0 : _navRef$current.getBoundingClientRect().width) !== null && _navRef$current$getBo !== void 0 ? _navRef$current$getBo : 0) - ((_listRef$current$getB = (_listRef$current = listRef.current) === null || _listRef$current === void 0 ? void 0 : _listRef$current.getBoundingClientRect().width) !== null && _listRef$current$getB !== void 0 ? _listRef$current$getB : 0);
182
228
 
183
- // Calculate how many items need to be pulled in to the menu to make room for the selected menu item
184
- // I.e. if we need to pull 2 items in (index 0 and index 1), breakpoint (index) will return 1.
185
- const index = getBreakpointForItemSwapping(widthToFitIntoList, availableSpace);
186
- const indexToSliceAt = responsiveProps.items.length - 1 - index;
187
- // Form the new list of items
188
- const itemsLeftInList = [...responsiveProps.items].slice(0, indexToSliceAt);
189
- const updatedItemList = [...itemsLeftInList, prospectiveListItem];
190
- // Form the new menu items
191
- const itemsToAddToMenu = [...responsiveProps.items].slice(indexToSliceAt);
192
- const updatedMenuItems = [...menuItems];
193
- // Add itemsToAddToMenu array's items to the menu at the index of the prospectiveListItem and remove 1 count of items (prospectiveListItem)
194
- updatedMenuItems.splice(indexOfProspectiveListItem, 1, ...itemsToAddToMenu);
195
- callback({
196
- items: updatedItemList,
197
- menuItems: updatedMenuItems
198
- }, false, true);
199
- };
200
- // How many items do we need to pull in to the menu to make room for the selected menu item.
201
- function getBreakpointForItemSwapping(widthToFitIntoList, availableSpace) {
229
+ // How many items at the end of the list have to move to the menu to make
230
+ // room for the promoted item.
202
231
  let widthToSwap = 0;
203
232
  let breakpoint = 0;
204
- for (const [index, item] of [...responsiveProps.items].reverse().entries()) {
205
- widthToSwap += getItemsWidth(item.props.children);
233
+ for (const [index, item] of [...currentItems].reverse().entries()) {
234
+ widthToSwap += getItemNoIconWidth(item);
206
235
  if (widthToFitIntoList < widthToSwap + availableSpace) {
207
236
  breakpoint = index;
208
237
  break;
209
238
  }
210
239
  }
211
- return breakpoint;
212
- }
213
- const updateListAndMenu = useCallback((props, displayIcons, overflowMeasured) => {
214
- setResponsiveProps(props);
215
- setIconsVisible(displayIcons);
216
- if (overflowMeasured) {
217
- setIsOverflowMeasured(true);
240
+ const indexToSliceAt = currentItems.length - 1 - breakpoint;
241
+ const itemsLeftInList = currentItems.slice(0, indexToSliceAt);
242
+ const updatedItemList = [...itemsLeftInList, prospectiveListItem];
243
+ const itemsToAddToMenu = currentItems.slice(indexToSliceAt);
244
+ const updatedMenuItems = [...currentMenuItems];
245
+ updatedMenuItems.splice(indexOfProspectiveListItem, 1, ...itemsToAddToMenu);
246
+ return {
247
+ items: updatedItemList,
248
+ menuItems: updatedMenuItems
249
+ };
250
+ };
251
+ const swapMenuItemWithListItem = (prospectiveListItem, indexOfProspectiveListItem) => {
252
+ const swap = computeSwap(overflowState.items, menuItems, prospectiveListItem, indexOfProspectiveListItem);
253
+ setOverflowState(prev => ({
254
+ items: swap.items,
255
+ menuItems: swap.menuItems,
256
+ iconsVisible: false,
257
+ measured: true,
258
+ childrenKey: prev.childrenKey
259
+ }));
260
+ };
261
+
262
+ // Single combined layout effect that performs measurement (when needed) and
263
+ // the external-aria-current promotion (when needed), then commits at most
264
+ // one setOverflowState per pass. Replaces the previous two effects (each of
265
+ // which produced its own commit) and removes the render-phase setState that
266
+ // the original component used to do the same swap from inside menuItems.map.
267
+ //
268
+ // Why no deps array: the swap branch depends on `aria-current` which lives
269
+ // on item props (not on `overflowState`); a deps-driven effect would not
270
+ // notice prop-only changes without rebuilding a signature. The body
271
+ // short-circuits cheaply on every render where neither pass needs to run.
272
+ useIsomorphicLayoutEffect(() => {
273
+ var _next;
274
+ const listEl = listRef.current;
275
+ const navEl = navRef.current;
276
+ if (!listEl || !navEl) return;
277
+ let next = null;
278
+
279
+ // Pass 1: measurement (runs once after each remeasure trigger).
280
+ if (!isOverflowMeasured) {
281
+ var _moreMenuRef$current$, _moreMenuRef$current;
282
+ const widths = new Map();
283
+ const noIconWidths = new Map();
284
+ const itemEls = listEl.querySelectorAll('[data-underlinenav-item="true"]');
285
+
286
+ // The N-th [data-underlinenav-item] element corresponds to validChildren[N]
287
+ // because the measurement pass runs only when all items are in the list,
288
+ // in render order. Pair them up positionally so we can key widths by the
289
+ // element's React key.
290
+ const upToBoundary = Math.min(itemEls.length, validChildren.length);
291
+ for (let index = 0; index < upToBoundary; index++) {
292
+ const liEl = itemEls[index];
293
+ const linkEl = liEl.querySelector('a, button');
294
+ if (!linkEl) continue;
295
+ const child = validChildren[index];
296
+ const key = String(child.key);
297
+ const domRect = linkEl.getBoundingClientRect();
298
+ const iconEl = linkEl.querySelector('[data-component="icon"]');
299
+ let iconWidthWithMargin = 0;
300
+ if (iconEl) {
301
+ const style = getComputedStyle(iconEl);
302
+ iconWidthWithMargin = iconEl.getBoundingClientRect().width + (parseFloat(style.marginRight) || 0) + (parseFloat(style.marginLeft) || 0);
303
+ }
304
+ widths.set(key, domRect.width);
305
+ noIconWidths.set(key, domRect.width - iconWidthWithMargin);
306
+ }
307
+ childWidthsRef.current = widths;
308
+ noIconChildWidthsRef.current = noIconWidths;
309
+ const navWidth = navEl.getBoundingClientRect().width;
310
+ if (navWidth === 0) return;
311
+ const moreMenuWidth = (_moreMenuRef$current$ = (_moreMenuRef$current = moreMenuRef.current) === null || _moreMenuRef$current === void 0 ? void 0 : _moreMenuRef$current.getBoundingClientRect().width) !== null && _moreMenuRef$current$ !== void 0 ? _moreMenuRef$current$ : 0;
312
+ const result = computeOverflow(navWidth, moreMenuWidth, validChildren, widths, noIconWidths);
313
+ next = {
314
+ items: result.items,
315
+ menuItems: result.menuItems,
316
+ iconsVisible: result.iconsVisible,
317
+ measured: true,
318
+ childrenKey: overflowState.childrenKey
319
+ };
218
320
  }
219
- }, []);
220
- const setChildrenWidth = useCallback(size => {
221
- setChildWidthArray(arr => {
222
- const newArr = [...arr, size];
223
- return newArr;
224
- });
225
- }, []);
226
- const setNoIconChildrenWidth = useCallback(size => {
227
- setNoIconChildWidthArray(arr => {
228
- const newArr = [...arr, size];
229
- return newArr;
230
- });
231
- }, []);
321
+
322
+ // Pass 2: external-aria-current promotion. Operates on the freshest
323
+ // (post-measurement) items so it can fold into the same setState.
324
+ const considered = (_next = next) !== null && _next !== void 0 ? _next : overflowState;
325
+ if (considered.measured && considered.items.length > 0) {
326
+ // Look at FRESH props (current aria-current) by remapping through
327
+ // validChildrenByKey (O(1) per lookup; the previous .find() pattern was
328
+ // O(N) and ran inside a .map() — quadratic on every commit).
329
+ const freshMenuItems = considered.menuItems.map(item => {
330
+ var _validChildrenByKey$g3;
331
+ return (_validChildrenByKey$g3 = validChildrenByKey.get(String(item.key))) !== null && _validChildrenByKey$g3 !== void 0 ? _validChildrenByKey$g3 : item;
332
+ });
333
+ const indexOfCurrent = freshMenuItems.findIndex(item => {
334
+ const c = item.props['aria-current'];
335
+ return Boolean(c) && c !== 'false';
336
+ });
337
+ if (indexOfCurrent !== -1) {
338
+ const swap = computeSwap(considered.items, freshMenuItems, freshMenuItems[indexOfCurrent], indexOfCurrent);
339
+ next = {
340
+ items: swap.items,
341
+ menuItems: swap.menuItems,
342
+ iconsVisible: false,
343
+ measured: true,
344
+ childrenKey: considered.childrenKey
345
+ };
346
+ }
347
+ }
348
+ if (next) setOverflowState(next);
349
+ });
232
350
  const closeOverlay = React.useCallback(() => {
233
351
  setIsWidgetOpen(false);
234
352
  }, [setIsWidgetOpen]);
@@ -255,36 +373,66 @@ const UnderlineNav = /*#__PURE__*/forwardRef(({
255
373
  ignoreClickRefs: [moreMenuBtnRef]
256
374
  });
257
375
  useResizeObserver(resizeObserverEntries => {
258
- var _moreMenuRef$current$, _moreMenuRef$current;
376
+ var _moreMenuRef$current$2, _moreMenuRef$current2;
259
377
  const navWidth = resizeObserverEntries[0].contentRect.width;
260
- const moreMenuWidth = (_moreMenuRef$current$ = (_moreMenuRef$current = moreMenuRef.current) === null || _moreMenuRef$current === void 0 ? void 0 : _moreMenuRef$current.getBoundingClientRect().width) !== null && _moreMenuRef$current$ !== void 0 ? _moreMenuRef$current$ : 0;
261
- navWidth !== 0 && overflowEffect(navWidth, moreMenuWidth, validChildren, childWidthArray, noIconChildWidthArray, updateListAndMenu);
378
+ if (navWidth === 0) return;
379
+ const moreMenuWidth = (_moreMenuRef$current$2 = (_moreMenuRef$current2 = moreMenuRef.current) === null || _moreMenuRef$current2 === void 0 ? void 0 : _moreMenuRef$current2.getBoundingClientRect().width) !== null && _moreMenuRef$current$2 !== void 0 ? _moreMenuRef$current$2 : 0;
380
+ const result = computeOverflow(navWidth, moreMenuWidth, validChildren, childWidthsRef.current, noIconChildWidthsRef.current);
381
+ setOverflowState(prev => ({
382
+ items: result.items,
383
+ menuItems: result.menuItems,
384
+ iconsVisible: result.iconsVisible,
385
+ measured: childWidthsRef.current.size > 0 || prev.measured,
386
+ childrenKey: prev.childrenKey
387
+ }));
262
388
  }, navRef);
263
389
 
264
- // Compute menuInlineStyles if needed
265
- let menuInlineStyles = {
266
- ...baseMenuInlineStyles
267
- };
268
- if (containerRef.current && listRef.current) {
390
+ // Menu anchor position. `undefined` means "use the default right: 0 from
391
+ // baseMenuInlineStyles" (the list is wide enough that no anchoring is
392
+ // needed). A number means the menu is anchored to that `left` coordinate,
393
+ // overriding right.
394
+ //
395
+ // This used to be computed inline during render by reading
396
+ // containerRef.current / listRef.current — refs are mutable and unsafe to
397
+ // read during render under concurrent rendering (the first render saw null
398
+ // refs and fell through to the unanchored fallback; subsequent renders
399
+ // anchored differently, producing a perceptible reflow).
400
+ const [menuAnchorLeft, setMenuAnchorLeft] = useState(undefined);
401
+ useIsomorphicLayoutEffect(() => {
402
+ const container = containerRef.current;
403
+ const list = listRef.current;
404
+ if (!container || !list) return;
405
+ if (list.clientWidth >= baseMenuMinWidth) {
406
+ if (menuAnchorLeft !== undefined) setMenuAnchorLeft(undefined);
407
+ return;
408
+ }
269
409
  const {
270
410
  left
271
- } = getAnchoredPosition(containerRef.current, listRef.current, {
411
+ } = getAnchoredPosition(container, list, {
272
412
  align: 'start',
273
413
  side: 'outside-bottom'
274
414
  });
275
- menuInlineStyles = {
276
- ...baseMenuInlineStyles,
277
- right: undefined,
278
- left
279
- };
280
- }
415
+ if (menuAnchorLeft !== left) setMenuAnchorLeft(left);
416
+ }, [isWidgetOpen, isOverflowMeasured, menuItems.length, menuAnchorLeft]);
417
+
418
+ // Stable context value: a fresh object literal here would re-render every
419
+ // consumer (UnderlineNav.Item) on every parent re-render, undoing the
420
+ // React.memo on UnderlineNavItem.
421
+ const contextValue = useMemo(() => ({
422
+ loadingCounters,
423
+ iconsVisible
424
+ }), [loadingCounters, iconsVisible]);
425
+ const menuStyle = menuAnchorLeft !== undefined ? {
426
+ ...baseMenuInlineStyles,
427
+ right: undefined,
428
+ left: menuAnchorLeft,
429
+ display: isWidgetOpen ? 'block' : 'none'
430
+ } : {
431
+ ...baseMenuInlineStyles,
432
+ display: isWidgetOpen ? 'block' : 'none'
433
+ };
281
434
  return /*#__PURE__*/jsxs(UnderlineNavContext.Provider, {
282
- value: {
283
- setChildrenWidth,
284
- setNoIconChildrenWidth,
285
- loadingCounters,
286
- iconsVisible
287
- },
435
+ value: contextValue,
288
436
  children: [ariaLabel && /*#__PURE__*/jsx(VisuallyHidden, {
289
437
  as: "h2",
290
438
  children: `${ariaLabel} navigation`
@@ -331,31 +479,23 @@ const UnderlineNav = /*#__PURE__*/forwardRef(({
331
479
  selectionVariant: "single",
332
480
  ref: containerRef,
333
481
  id: disclosureWidgetId,
334
- style: {
335
- ...((_listRef$current2 = listRef.current) !== null && _listRef$current2 !== void 0 && _listRef$current2.clientWidth && listRef.current.clientWidth >= baseMenuMinWidth ? baseMenuInlineStyles : menuInlineStyles),
336
- display: isWidgetOpen ? 'block' : 'none'
337
- },
482
+ style: menuStyle,
338
483
  children: menuItems.map((menuItem, index) => {
339
484
  const {
340
485
  children: menuItemChildren,
341
486
  counter,
342
- 'aria-current': ariaCurrent,
487
+ // Stripped from the spread below; the swap effect reads aria-current
488
+ // directly from item.props (not via these destructured locals).
489
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
490
+ 'aria-current': _ariaCurrent,
343
491
  onSelect,
344
492
  ...menuItemProps
345
493
  } = menuItem.props;
346
-
347
- // This logic is used to pop the selected item out of the menu and into the list when the navigation is control externally
348
- if (Boolean(ariaCurrent) && ariaCurrent !== 'false') {
349
- const event = new MouseEvent('click');
350
- !onlyMenuVisible && swapMenuItemWithListItem(menuItem, index,
351
- // @ts-ignore - not a big deal because it is internally creating an event but ask help
352
- event, updateListAndMenu);
353
- }
354
494
  return /*#__PURE__*/jsx(ActionList.LinkItem, {
355
495
  style: menuItemStyles,
356
496
  onClick: event => {
357
497
  // When there are no items in the list, do not run the swap function as we want to keep everything in the menu.
358
- !onlyMenuVisible && swapMenuItemWithListItem(menuItem, index, event, updateListAndMenu);
498
+ !onlyMenuVisible && swapMenuItemWithListItem(menuItem, index);
359
499
  closeOverlay();
360
500
  focusOnMoreMenuBtn();
361
501
  // fire onSelect event that comes from the UnderlineNav.Item (if it is defined)
@@ -371,7 +511,7 @@ const UnderlineNav = /*#__PURE__*/forwardRef(({
371
511
  })
372
512
  })]
373
513
  })
374
- }, menuItemChildren);
514
+ }, String(menuItem.key));
375
515
  })
376
516
  })]
377
517
  })]
@@ -381,4 +521,4 @@ const UnderlineNav = /*#__PURE__*/forwardRef(({
381
521
  });
382
522
  UnderlineNav.displayName = 'UnderlineNav';
383
523
 
384
- export { MORE_BTN_WIDTH, UnderlineNav, getValidChildren };
524
+ export { UnderlineNav };
@@ -1,13 +1,4 @@
1
- import type React from 'react';
2
- export declare const UnderlineNavContext: React.Context<{
3
- setChildrenWidth: React.Dispatch<{
4
- text: string;
5
- width: number;
6
- }>;
7
- setNoIconChildrenWidth: React.Dispatch<{
8
- text: string;
9
- width: number;
10
- }>;
1
+ export declare const UnderlineNavContext: import("react").Context<{
11
2
  loadingCounters: boolean;
12
3
  iconsVisible: boolean;
13
4
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"UnderlineNavContext.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/UnderlineNavContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,eAAO,MAAM,mBAAmB;sBACZ,KAAK,CAAC,QAAQ,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,CAAC;4BACvC,KAAK,CAAC,QAAQ,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,CAAC;qBACpD,OAAO;kBACV,OAAO;EAMrB,CAAA"}
1
+ {"version":3,"file":"UnderlineNavContext.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/UnderlineNavContext.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB;qBACb,OAAO;kBACV,OAAO;EAIrB,CAAA"}
@@ -1,8 +1,6 @@
1
1
  import { createContext } from 'react';
2
2
 
3
3
  const UnderlineNavContext = /*#__PURE__*/createContext({
4
- setChildrenWidth: () => null,
5
- setNoIconChildrenWidth: () => null,
6
4
  loadingCounters: false,
7
5
  iconsVisible: true
8
6
  });
@@ -43,5 +43,7 @@ export type UnderlineNavItemProps = {
43
43
  */
44
44
  counter?: number | string;
45
45
  } & LinkProps;
46
- export declare const UnderlineNavItem: PolymorphicForwardRefComponent<"a", UnderlineNavItemProps>;
46
+ declare const UnderlineNavItemImpl: PolymorphicForwardRefComponent<"a", UnderlineNavItemProps>;
47
+ export declare const UnderlineNavItem: typeof UnderlineNavItemImpl;
48
+ export {};
47
49
  //# sourceMappingURL=UnderlineNavItem.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UnderlineNavItem.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/UnderlineNavItem.tsx"],"names":[],"mappings":"AACA,OAAO,KAAuC,MAAM,OAAO,CAAA;AAC3D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAA;AACrD,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAO/F,MAAM,MAAM,SAAS,GAAG;IACtB,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;CACjF,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAE1B;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;IAExG;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAA;IAE5F;;;OAGG;IAEH,IAAI,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;IAEnE;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,YAAY,CAAA;IAElC;;QAEI;IACJ,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,GAAG,GAAG,CAAA;IAE5B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAC1B,GAAG,SAAS,CAAA;AAEb,eAAO,MAAM,gBAAgB,EAgFxB,8BAA8B,CAAC,GAAG,EAAE,qBAAqB,CAAC,CAAA"}
1
+ {"version":3,"file":"UnderlineNavItem.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/UnderlineNavItem.tsx"],"names":[],"mappings":"AACA,OAAO,KAAuC,MAAM,OAAO,CAAA;AAC3D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAA;AACrD,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAM/F,MAAM,MAAM,SAAS,GAAG;IACtB,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;CACjF,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAE1B;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;IAExG;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAA;IAE5F;;;OAGG;IAEH,IAAI,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;IAEnE;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,YAAY,CAAA;IAElC;;QAEI;IACJ,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,GAAG,GAAG,CAAA;IAE5B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAC1B,GAAG,SAAS,CAAA;AAEb,QAAA,MAAM,oBAAoB,EAwDrB,8BAA8B,CAAC,GAAG,EAAE,qBAAqB,CAAC,CAAA;AAK/D,eAAO,MAAM,gBAAgB,EAAkD,OAAO,oBAAoB,CAAA"}
@@ -1,11 +1,10 @@
1
1
  import React, { forwardRef, useRef, useContext } from 'react';
2
2
  import { UnderlineNavContext } from './UnderlineNavContext.js';
3
- import useIsomorphicLayoutEffect from '../utils/useIsomorphicLayoutEffect.js';
4
3
  import { UnderlineItem } from '../internal/components/UnderlineTabbedInterface.js';
5
4
  import classes from './UnderlineNavItem.module.css.js';
6
5
  import { jsx } from 'react/jsx-runtime';
7
6
 
8
- const UnderlineNavItem = /*#__PURE__*/forwardRef(({
7
+ const UnderlineNavItemImpl = /*#__PURE__*/forwardRef(({
9
8
  as: Component = 'a',
10
9
  href = '#',
11
10
  children,
@@ -19,28 +18,9 @@ const UnderlineNavItem = /*#__PURE__*/forwardRef(({
19
18
  const backupRef = useRef(null);
20
19
  const ref = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : backupRef;
21
20
  const {
22
- setChildrenWidth,
23
- setNoIconChildrenWidth,
24
21
  loadingCounters,
25
22
  iconsVisible
26
23
  } = useContext(UnderlineNavContext);
27
- useIsomorphicLayoutEffect(() => {
28
- if (ref.current) {
29
- const domRect = ref.current.getBoundingClientRect();
30
- const icon = Array.from(ref.current.children).find(child => child.getAttribute('data-component') === 'icon');
31
- const content = Array.from(ref.current.children).find(child => child.getAttribute('data-component') === 'text');
32
- const text = content.textContent;
33
- const iconWidthWithMargin = icon ? icon.getBoundingClientRect().width + Number(getComputedStyle(icon).marginRight.slice(0, -2)) + Number(getComputedStyle(icon).marginLeft.slice(0, -2)) : 0;
34
- setChildrenWidth({
35
- text,
36
- width: domRect.width
37
- });
38
- setNoIconChildrenWidth({
39
- text,
40
- width: domRect.width - iconWidthWithMargin
41
- });
42
- }
43
- }, [ref, setChildrenWidth, setNoIconChildrenWidth]);
44
24
  const keyDownHandler = React.useCallback(event => {
45
25
  if ((event.key === ' ' || event.key === 'Enter') && !event.defaultPrevented && typeof onSelect === 'function') {
46
26
  onSelect(event);
@@ -53,6 +33,7 @@ const UnderlineNavItem = /*#__PURE__*/forwardRef(({
53
33
  }, [onSelect]);
54
34
  return /*#__PURE__*/jsx("li", {
55
35
  className: classes.UnderlineNavItem,
36
+ "data-underlinenav-item": "true",
56
37
  children: /*#__PURE__*/jsx(UnderlineItem, {
57
38
  ref: ref,
58
39
  as: Component,
@@ -69,6 +50,10 @@ const UnderlineNavItem = /*#__PURE__*/forwardRef(({
69
50
  })
70
51
  });
71
52
  });
72
- UnderlineNavItem.displayName = 'UnderlineNavItem';
53
+ UnderlineNavItemImpl.displayName = 'UnderlineNavItem';
54
+
55
+ // Memoized so that re-renders of UnderlineNav (e.g. when overflow state changes)
56
+ // do not re-render every item when the consumer-provided children haven't changed.
57
+ const UnderlineNavItem = /*#__PURE__*/React.memo(UnderlineNavItemImpl);
73
58
 
74
59
  export { UnderlineNavItem };
@@ -1,8 +1,4 @@
1
- export type ChildSize = {
2
- text: string;
3
- width: number;
4
- };
5
- export type ChildWidthArray = Array<ChildSize>;
1
+ export type ChildWidthMap = Map<string, number>;
6
2
  export type ResponsiveProps = {
7
3
  items: Array<React.ReactElement<any>>;
8
4
  menuItems: Array<React.ReactElement<any>>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AACD,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,SAAS,CAAC,CAAA;AAC9C,MAAM,MAAM,eAAe,GAAG;IAE5B,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAA;IAErC,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAA;CAC1C,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/types.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,aAAa,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAE/C,MAAM,MAAM,eAAe,GAAG;IAE5B,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAA;IAErC,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAA;CAC1C,CAAA"}
@@ -1187,14 +1187,6 @@
1187
1187
  {
1188
1188
  "id": "components-avatar-features--size-responsive",
1189
1189
  "code": "() => (\n <div>\n <Avatar\n size={{\n narrow: 4,\n regular: 8,\n wide: 12,\n }}\n alt=\"mona\"\n src=\"https://avatars.githubusercontent.com/u/7143434?v=4\"\n />\n <Avatar\n size={{\n narrow: 8,\n regular: 12,\n wide: 16,\n }}\n alt=\"mona\"\n src=\"https://avatars.githubusercontent.com/u/7143434?v=4\"\n />\n <Avatar\n size={{\n narrow: 12,\n regular: 16,\n wide: 20,\n }}\n alt=\"mona\"\n src=\"https://avatars.githubusercontent.com/u/7143434?v=4\"\n />\n <Avatar\n size={{\n narrow: 16,\n regular: 20,\n wide: 24,\n }}\n alt=\"mona\"\n src=\"https://avatars.githubusercontent.com/u/7143434?v=4\"\n />\n <Avatar\n size={{\n narrow: 20,\n regular: 24,\n wide: 28,\n }}\n alt=\"mona\"\n src=\"https://avatars.githubusercontent.com/u/7143434?v=4\"\n />\n <Avatar\n size={{\n narrow: 24,\n regular: 28,\n wide: 32,\n }}\n alt=\"mona\"\n src=\"https://avatars.githubusercontent.com/u/7143434?v=4\"\n />\n <Avatar\n size={{\n narrow: 28,\n regular: 32,\n wide: 40,\n }}\n alt=\"mona\"\n src=\"https://avatars.githubusercontent.com/u/7143434?v=4\"\n />\n <Avatar\n size={{\n narrow: 32,\n regular: 40,\n wide: 48,\n }}\n alt=\"mona\"\n src=\"https://avatars.githubusercontent.com/u/7143434?v=4\"\n />\n <Avatar\n size={{\n narrow: 40,\n regular: 48,\n wide: 56,\n }}\n alt=\"mona\"\n src=\"https://avatars.githubusercontent.com/u/7143434?v=4\"\n />\n <Avatar\n size={{\n narrow: 48,\n regular: 56,\n wide: 64,\n }}\n alt=\"mona\"\n src=\"https://avatars.githubusercontent.com/u/7143434?v=4\"\n />\n </div>\n)"
1190
- },
1191
- {
1192
- "id": "components-avatar-features--src-transformer",
1193
- "code": "() => (\n <Avatar\n size={32}\n alt=\"mona\"\n src=\"https://avatars.githubusercontent.com/u/7143434?v=4\"\n srcTransformer={(src, size) => `${src}&s=${size * 2}`}\n />\n)"
1194
- },
1195
- {
1196
- "id": "components-avatar-features--status-icon",
1197
- "code": "() => (\n <Avatar\n size={20}\n alt=\"status avatar\"\n src=\"https://avatars.githubusercontent.com/u/7143434?v=4\"\n statusIcon={<XCircleFillIcon size={12} fill=\"var(--fgColor-success)\" />}\n />\n)"
1198
1190
  }
1199
1191
  ],
1200
1192
  "importPath": "@primer/react",
@@ -1223,18 +1215,6 @@
1223
1215
  "required": false,
1224
1216
  "description": "URL of the avatar image.",
1225
1217
  "defaultValue": ""
1226
- },
1227
- {
1228
- "name": "srcTransformer",
1229
- "type": "(src: string, size: number) => string",
1230
- "required": false,
1231
- "description": "Optional function to transform the src URL before rendering. Receives the original src and the resolved numeric size in CSS pixels. Useful for appending query parameters for HiDPI/Retina support."
1232
- },
1233
- {
1234
- "name": "statusIcon",
1235
- "type": "React.ReactNode",
1236
- "required": false,
1237
- "description": "Renders a status icon overlay positioned at the bottom-right of the avatar."
1238
1218
  }
1239
1219
  ],
1240
1220
  "subcomponents": []
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "0.0.0-20260522201814",
4
+ "version": "0.0.0-20260523120913",
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,2 +0,0 @@
1
- .prc-AnchoredOverlay-ResponsiveCloseButtonContainer-nuium{position:relative}.prc-AnchoredOverlay-ResponsiveCloseButton-z-2rx{display:none;position:absolute;right:var(--base-size-8,.5rem);top:var(--base-size-8,.5rem)}@media screen and (max-width:calc(48rem - 0.02px)){.prc-AnchoredOverlay-ResponsiveCloseButton-z-2rx{display:inline-grid}}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z{position-try-fallbacks:flip-block,flip-inline,flip-block flip-inline;position-visibility:anchors-visible;position:fixed!important;z-index:100}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[popover]{border:0;inset:auto;margin:0;max-width:none;padding:0}.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-bottom][data-align=left]{left:auto;right:calc(anchor(right) - var(--anchored-overlay-anchor-offset-left))}.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-top][data-align=left]{left:auto;right:anchor(right)}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-left]{margin-right:var(--base-size-4,.25rem);right:anchor(left);top:var(--anchored-overlay-top-override,anchor(top));position-try-fallbacks:flip-inline,flip-block,flip-start,--outside-left-to-bottom}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-right]{left:anchor(right);margin-left:var(--base-size-4,.25rem);top:var(--anchored-overlay-top-override,anchor(top));position-try-fallbacks:flip-inline,flip-block,flip-start,--outside-right-to-bottom}@position-try --outside-left-to-bottom{margin:0;right:anchor(right);top:calc(anchor(bottom) + var(--base-size-4,.25rem));width:auto}@position-try --outside-right-to-bottom{left:anchor(left);margin:0;top:calc(anchor(bottom) + var(--base-size-4,.25rem));width:auto}
2
- /*# sourceMappingURL=AnchoredOverlay-ec9e15fc.css.map */
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/AnchoredOverlay/AnchoredOverlay.module.css.js"],"names":[],"mappings":"AAAA,0DACE,iBACF,CAEA,iDAIE,YAAa,CAHb,iBAAkB,CAElB,8BAAyB,CADzB,4BAOF,CAHE,mDANF,iDAOI,mBAEJ,CADE,CAGF,2CACE,oEAGwB,CACxB,mCAAoC,CAEpC,wBAA0B,CAD1B,WAsDF,CAnDE,oDAIE,QAAS,CAHT,UAAW,CACX,QAAS,CAGT,cAAe,CAFf,SAGF,CAEA,qEAGE,iBAAkB,CADlB,oDAOF,CAJE,sFACE,SAAU,CACV,sEACF,CAGF,kEAEE,kBAAmB,CACnB,iBAAkB,CAFlB,uCAQF,CAJE,mFACE,SAAU,CACV,mBACF,CAGF,mEAWE,sCAAgC,CAVhC,kBAAmB,CASnB,oDAAsD,CAEtD,iFACF,CAEA,oEACE,kBAAmB,CAEnB,qCAA+B,CAD/B,oDAAsD,CAEtD,kFACF,CAGF,uCAGE,QAAS,CAFT,mBAAoB,CACpB,oDAA8C,CAE9C,UACF,CAEA,wCACE,iBAAkB,CAElB,QAAS,CADT,oDAA8C,CAE9C,UACF","file":"AnchoredOverlay-ec9e15fc.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.AnchoredOverlay {\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 !important;\n\n &[popover] {\n inset: auto;\n margin: 0;\n padding: 0;\n border: 0;\n max-width: none;\n }\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 &[data-align='left'] {\n left: auto;\n right: calc(anchor(right) - var(--anchored-overlay-anchor-offset-left));\n }\n }\n\n &[data-side='outside-top'] {\n margin-bottom: var(--base-size-4);\n bottom: anchor(top);\n left: anchor(left);\n\n &[data-align='left'] {\n left: auto;\n right: anchor(right);\n }\n }\n\n &[data-side='outside-left'] {\n right: anchor(left);\n /* Falls back to `anchor(top)` when JS hasn't overridden it. JS sets the\n override when the overlay's bottom would overflow the viewport so we\n can lift it up to keep the bottom edge on screen, mirroring the JS\n anchored-positioning code path.\n\n This override only applies when CSS cannot find space using the default position -\n or any of its defined fallbacks.\n */\n top: var(--anchored-overlay-top-override, anchor(top));\n margin-right: var(--base-size-4);\n position-try-fallbacks: flip-inline, flip-block, flip-start, --outside-left-to-bottom;\n }\n\n &[data-side='outside-right'] {\n left: anchor(right);\n top: var(--anchored-overlay-top-override, anchor(top));\n margin-left: var(--base-size-4);\n position-try-fallbacks: flip-inline, flip-block, flip-start, --outside-right-to-bottom;\n }\n}\n\n@position-try --outside-left-to-bottom {\n right: anchor(right);\n top: calc(anchor(bottom) + var(--base-size-4));\n margin: 0;\n width: auto;\n}\n\n@position-try --outside-right-to-bottom {\n left: anchor(left);\n top: calc(anchor(bottom) + var(--base-size-4));\n margin: 0;\n width: auto;\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/Avatar/Avatar.module.css.js"],"names":[],"mappings":"AAAA,iCAQE,iBAAkB,CAElB,wDAA+C,CAT/C,oBAAqB,CAErB,gCAAiC,CAGjC,aAAc,CAFd,eAAgB,CAGhB,qBAAsB,CALtB,+BA+BF,CArBE,sDAEE,kGACF,CAGE,mDADF,0DAGI,+BAAgC,CADhC,8BAaJ,CAXE,CAEA,oCANF,0DAQI,gCAAiC,CADjC,+BAQJ,CANE,CAEA,sCAXF,0DAaI,6BAA8B,CAD9B,4BAGJ,CADE,CAIJ,kCAEE,mBAAoB,CADpB,iBAAkB,CAElB,qBACF,CAEA,6BASE,mEAAqE,CAHrE,mBAAoB,CAHpB,yCAAqC,CAKrC,uEAAyE,CAJzE,YAAa,CAOb,aAAc,CAVd,iBAAkB,CAClB,wCAUF","file":"Avatar-bd06a936.css","sourcesContent":[":where(.Avatar) {\n display: inline-block;\n width: var(--avatarSize-regular);\n height: var(--avatarSize-regular);\n overflow: hidden; /* Ensure page layout in Firefox should images fail to load */\n /* stylelint-disable-next-line primer/typography */\n line-height: 1;\n vertical-align: middle;\n border-radius: 50%;\n /* stylelint-disable-next-line primer/box-shadow */\n box-shadow: 0 0 0 1px var(--avatar-borderColor);\n\n &:where([data-square]) {\n /* stylelint-disable-next-line primer/borders */\n border-radius: clamp(4px, calc(var(--avatarSize-regular) - 24px), var(--borderRadius-medium));\n }\n\n &:where([data-responsive]) {\n @media screen and (--viewportRange-narrow) {\n width: var(--avatarSize-narrow);\n height: var(--avatarSize-narrow);\n }\n\n @media screen and (--viewportRange-regular) {\n width: var(--avatarSize-regular);\n height: var(--avatarSize-regular);\n }\n\n @media screen and (--viewportRange-wide) {\n width: var(--avatarSize-wide);\n height: var(--avatarSize-wide);\n }\n }\n}\n\n.AvatarContainer {\n position: relative;\n display: inline-flex;\n vertical-align: middle;\n}\n\n.StatusIcon {\n position: absolute;\n right: calc(-1 * var(--base-size-4));\n bottom: calc(-1 * var(--base-size-4));\n display: flex;\n /* stylelint-disable-next-line primer/borders */\n border-radius: 100px;\n /* stylelint-disable-next-line primer/box-shadow */\n box-shadow: 0 0 0 2px var(--bgColor-default, var(--color-canvas-default));\n background-color: var(--bgColor-default, var(--color-canvas-default));\n /* stylelint-disable-next-line primer/typography */\n line-height: 1;\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/Overlay/Overlay.module.css.js"],"names":[],"mappings":"AAAA,4CACE,GACE,SACF,CAEA,GACE,SACF,CACF,CAEA,2BAQE,4CAAwC,CACxC,8CAAwC,CACxC,4GAAwC,CALxC,WAAY,CACZ,gBAAiB,CAJjB,4BAA6B,CAE7B,eAAgB,CAGhB,aAAc,CANd,iBAAkB,CAElB,UAyNF,CAhNE,wIAKE,yBAA2B,CAF3B,uBAkBF,CAZI,mDADF,6LAGI,MAAO,CADP,KAGJ,CADE,CAGF,iKAIE,qBAAuB,CAFvB,mBAGF,CAGF,iCACE,YACF,CAEA,8BAvCF,2BAyCI,6BAmLJ,CAlLE,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,2BAKF,CAHE,0BAHF,2DAII,4BAEJ,CADE,CAGF,0DACE,2BAKF,CAHE,0BAHF,0DAII,4BAEJ,CADE,CAGF,2DACE,2BAKF,CAHE,0BAHF,2DAII,4BAEJ,CADE,CAGF,0DACE,2BAKF,CAHE,0BAHF,0DAII,4BAEJ,CADE,CAGF,2DACE,2BAKF,CAHE,0BAHF,2DAII,4BAEJ,CADE,CAGF,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,CAIE,mDAFF,iJAWI,mBAAoB,CAHpB,YAAa,CAHb,MAAO,CAKP,QAAS,CADT,eAAgB,CAFhB,cAAe,CAMf,0CAA2C,CAV3C,cAAe,CACf,KAAM,CAEN,WAcJ,CALI,0BAfJ,iJAiBM,aAGN,CAFI,CACF,CAGF,0BAEE,4DACE,aACF,CACF,CAGF,8CACE,2BACE,wEACF,CACF","file":"Overlay-95cfd3c7.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: min(192px, 100vh);\n\n @supports (height: 100dvh) {\n max-height: min(192px, 100dvh);\n }\n }\n\n &:where([data-max-height-small]) {\n max-height: min(256px, 100vh);\n\n @supports (height: 100dvh) {\n max-height: min(256px, 100dvh);\n }\n }\n\n &:where([data-max-height-medium]) {\n max-height: min(320px, 100vh);\n\n @supports (height: 100dvh) {\n max-height: min(320px, 100dvh);\n }\n }\n\n &:where([data-max-height-large]) {\n max-height: min(432px, 100vh);\n\n @supports (height: 100dvh) {\n max-height: min(432px, 100dvh);\n }\n }\n\n &:where([data-max-height-xlarge]) {\n max-height: min(600px, 100vh);\n\n @supports (height: 100dvh) {\n max-height: min(600px, 100dvh);\n }\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 &[data-responsive='fullscreen'][data-anchor-position='true'] {\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"]}