@primer/react 0.0.0-20260311174534 → 0.0.0-20260311175839

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 (44) hide show
  1. package/CHANGELOG.md +10 -6
  2. package/dist/Banner/Banner-b3871000.css +2 -0
  3. package/dist/Banner/Banner-b3871000.css.map +1 -0
  4. package/dist/Banner/Banner.module.css.js +1 -1
  5. package/dist/Overlay/{Overlay-15519c09.css → Overlay-dbaa6b8c.css} +2 -2
  6. package/dist/Overlay/Overlay-dbaa6b8c.css.map +1 -0
  7. package/dist/Overlay/Overlay.module.css.js +1 -1
  8. package/dist/UnderlineNav/UnderlineNav-4344d9b0.css +2 -0
  9. package/dist/UnderlineNav/UnderlineNav-4344d9b0.css.map +1 -0
  10. package/dist/UnderlineNav/UnderlineNav.d.ts +3 -1
  11. package/dist/UnderlineNav/UnderlineNav.d.ts.map +1 -1
  12. package/dist/UnderlineNav/UnderlineNav.js +342 -40
  13. package/dist/UnderlineNav/UnderlineNav.module.css.js +2 -2
  14. package/dist/UnderlineNav/UnderlineNavContext.d.ts +11 -1
  15. package/dist/UnderlineNav/UnderlineNavContext.d.ts.map +1 -1
  16. package/dist/UnderlineNav/UnderlineNavContext.js +4 -1
  17. package/dist/UnderlineNav/UnderlineNavItem.d.ts +0 -6
  18. package/dist/UnderlineNav/UnderlineNavItem.d.ts.map +1 -1
  19. package/dist/UnderlineNav/UnderlineNavItem.js +37 -40
  20. package/dist/UnderlineNav/index.d.ts +1 -1
  21. package/dist/UnderlineNav/styles.d.ts +16 -0
  22. package/dist/UnderlineNav/styles.d.ts.map +1 -0
  23. package/dist/UnderlineNav/styles.js +19 -0
  24. package/dist/experimental/UnderlinePanels/UnderlinePanels-e4b325b9.css +2 -0
  25. package/dist/experimental/UnderlinePanels/UnderlinePanels-e4b325b9.css.map +1 -0
  26. package/dist/experimental/UnderlinePanels/UnderlinePanels.js +1 -1
  27. package/dist/experimental/UnderlinePanels/UnderlinePanels.module.css.js +1 -1
  28. package/dist/internal/components/UnderlineTabbedInterface-4197ee28.css +2 -0
  29. package/dist/internal/components/UnderlineTabbedInterface-4197ee28.css.map +1 -0
  30. package/dist/internal/components/UnderlineTabbedInterface.d.ts +1 -0
  31. package/dist/internal/components/UnderlineTabbedInterface.d.ts.map +1 -1
  32. package/dist/internal/components/UnderlineTabbedInterface.js +60 -66
  33. package/dist/internal/components/UnderlineTabbedInterface.module.css.js +1 -1
  34. package/generated/components.json +3 -3
  35. package/package.json +1 -1
  36. package/dist/Banner/Banner-f672cdf9.css +0 -2
  37. package/dist/Banner/Banner-f672cdf9.css.map +0 -1
  38. package/dist/Overlay/Overlay-15519c09.css.map +0 -1
  39. package/dist/UnderlineNav/UnderlineNav-4c80468c.css +0 -2
  40. package/dist/UnderlineNav/UnderlineNav-4c80468c.css.map +0 -1
  41. package/dist/experimental/UnderlinePanels/UnderlinePanels-162f9aed.css +0 -2
  42. package/dist/experimental/UnderlinePanels/UnderlinePanels-162f9aed.css.map +0 -1
  43. package/dist/internal/components/UnderlineTabbedInterface-7317470b.css +0 -2
  44. package/dist/internal/components/UnderlineTabbedInterface-7317470b.css.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,22 +1,26 @@
1
1
  # @primer/react
2
2
 
3
- ## 0.0.0-20260311174534
3
+ ## 0.0.0-20260311175839
4
+
5
+ ### Patch Changes
6
+
7
+ - Fake entry to force publishing
8
+
9
+ - [#7625](https://github.com/primer/react/pull/7625) [`2e8c707`](https://github.com/primer/react/commit/2e8c70702d5096551049c29c8e79749bf63a919f) Thanks [@liuliu-dev](https://github.com/liuliu-dev)! - Banner: stack inline actions vertically on narrow viewports.
10
+
11
+ ## 38.15.0
4
12
 
5
13
  ### Minor Changes
6
14
 
7
15
  - [#7524](https://github.com/primer/react/pull/7524) [`f7bdd1c`](https://github.com/primer/react/commit/f7bdd1c04f8cbb17b6a913ba55f7d0855c8eebf1) Thanks [@francinelucca](https://github.com/francinelucca)! - chore: always render ActionMenu in viewport when inside Dialog under feature flag
8
16
 
9
- - [#7622](https://github.com/primer/react/pull/7622) [`4d8d5e6`](https://github.com/primer/react/commit/4d8d5e6b9b0b1d394d19154369f9c37eabe7cb87) Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - Removes `UnderlineNav` dynamic overflow functionality, replacing with simple scroll container to simplify logic, improve performance, and remove layout shifts, especially when using server-side rendering.
10
-
11
17
  - [#7594](https://github.com/primer/react/pull/7594) [`1e54bdf`](https://github.com/primer/react/commit/1e54bdf72c9466f23c567cfdc73b7b5c243782a4) Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - Add `align` and `style` props to Dialog component
12
18
 
13
19
  ### Patch Changes
14
20
 
15
21
  - [#7529](https://github.com/primer/react/pull/7529) [`7e108fe`](https://github.com/primer/react/commit/7e108fea1a9f92ce22f46ff1d55bfe4753d89ad8) Thanks [@liuliu-dev](https://github.com/liuliu-dev)! - Add keyboard-accessible tooltip for truncated ActionList.Description
16
22
 
17
- - Fake entry to force publishing
18
-
19
- - [#7585](https://github.com/primer/react/pull/7585) [`dea0dd0`](https://github.com/primer/react/commit/dea0dd0c6dcff6890a620f0708f1f28472a4fb98) Thanks [@iansan5653](https://github.com/iansan5653)! - - Fixes a bug where `ActionBar` menu items would be out of order if new items were mounted after the initial render
23
+ - [#7585](https://github.com/primer/react/pull/7585) [`3dd2c78`](https://github.com/primer/react/commit/3dd2c78f768ad560ee0f37947af2c17ca8d7938c) Thanks [@iansan5653](https://github.com/iansan5653)! - - Fixes a bug where `ActionBar` menu items would be out of order if new items were mounted after the initial render
20
24
 
21
25
  - Improves initial render performance for `ActionBar`
22
26
 
@@ -0,0 +1,2 @@
1
+ .prc-Banner-Banner-IPLJ2{align-items:start;background-color:var(--banner-bgColor);border:var(--borderWidth-thin,.0625rem) solid var(--banner-borderColor);border-radius:var(--borderRadius-medium,.375rem);display:grid;grid-template-columns:auto minmax(0,1fr) auto;padding:var(--base-size-8,.5rem)}@supports (container-type:inline-size){.prc-Banner-Banner-IPLJ2[data-actions-layout=default]{container:banner/inline-size}}.prc-Banner-Banner-IPLJ2[data-actions-layout=stacked] .prc-Banner-BannerContainer-T-Siu{flex-direction:column}.prc-Banner-Banner-IPLJ2[data-actions-layout=stacked] .prc-Banner-BannerActions-gvCLf :where([data-primary-action=trailing]){display:none}.prc-Banner-Banner-IPLJ2[data-actions-layout=stacked] .prc-Banner-BannerActions-gvCLf :where([data-primary-action=leading]){display:flex}.prc-Banner-Banner-IPLJ2[data-actions-layout=inline] .prc-Banner-BannerContainer-T-Siu{flex-wrap:nowrap}.prc-Banner-Banner-IPLJ2[data-actions-layout=inline] .prc-Banner-BannerActions-gvCLf{flex:0 0 auto}.prc-Banner-Banner-IPLJ2[data-actions-layout=inline] .prc-Banner-BannerActions-gvCLf :where([data-primary-action=trailing]){display:flex}.prc-Banner-Banner-IPLJ2[data-actions-layout=inline] .prc-Banner-BannerActions-gvCLf :where([data-primary-action=leading]){display:none}@media screen and (max-width:calc(48rem - 0.02px)){.prc-Banner-Banner-IPLJ2[data-actions-layout=inline] .prc-Banner-BannerContainer-T-Siu{flex-direction:column}.prc-Banner-Banner-IPLJ2[data-actions-layout=inline] .prc-Banner-BannerActions-gvCLf :where([data-primary-action=trailing]){display:none}.prc-Banner-Banner-IPLJ2[data-actions-layout=inline] .prc-Banner-BannerActions-gvCLf :where([data-primary-action=leading]){display:flex}}.prc-Banner-Banner-IPLJ2[data-layout=compact]{padding:var(--base-size-4,.25rem)}.prc-Banner-Banner-IPLJ2[data-flush]{border-left:none;border-radius:0;border-right:none}.prc-Banner-Banner-IPLJ2[data-variant=critical]{--banner-bgColor:var(--bgColor-danger-muted,var(--color-danger-subtle));--banner-borderColor:var(--borderColor-danger-muted,var(--color-danger-muted));--banner-icon-fgColor:var(--fgColor-danger,var(--color-danger-fg))}.prc-Banner-Banner-IPLJ2[data-variant=info]{--banner-bgColor:var(--bgColor-accent-muted,var(--color-accent-subtle));--banner-borderColor:var(--borderColor-accent-muted,var(--color-accent-muted));--banner-icon-fgColor:var(--fgColor-accent,var(--color-accent-fg))}.prc-Banner-Banner-IPLJ2[data-variant=success]{--banner-bgColor:var(--bgColor-success-muted,var(--color-success-subtle));--banner-borderColor:var(--borderColor-success-muted,var(--color-success-muted));--banner-icon-fgColor:var(--fgColor-success,var(--color-success-fg))}.prc-Banner-Banner-IPLJ2[data-variant=upsell]{--banner-bgColor:var(--bgColor-upsell-muted,#fbefff);--banner-borderColor:var(--borderColor-upsell-muted,#c297ff66);--banner-icon-fgColor:var(--fgColor-upsell,#8250df)}.prc-Banner-Banner-IPLJ2[data-variant=warning]{--banner-bgColor:var(--bgColor-attention-muted,var(--color-attention-subtle));--banner-borderColor:var(--borderColor-attention-muted,var(--color-attention-muted));--banner-icon-fgColor:var(--fgColor-attention,var(--color-attention-fg))}.prc-Banner-BannerContainer-T-Siu{align-items:start;column-gap:var(--base-size-4,.25rem);font-size:var(--text-body-size-medium,.875rem);line-height:var(--text-body-lineHeight-medium,1.5);row-gap:var(--base-size-4,.25rem)}.prc-Banner-Banner-IPLJ2 :where(.prc-Banner-BannerContainer-T-Siu){display:flex;flex-wrap:wrap;justify-content:space-between}.prc-Banner-Banner-IPLJ2[data-dismissible]:not([data-title-hidden],[data-actions-layout=inline]) .prc-Banner-BannerContainer-T-Siu{display:grid;grid-template-columns:auto;grid-template-rows:auto}.prc-Banner-BannerContent-LraS2{display:grid;grid-column-start:1;margin-block:var(--base-size-8,.5rem);row-gap:var(--base-size-4,.25rem)}.prc-Banner-Banner-IPLJ2[data-title-hidden]:not(:has(.prc-Banner-BannerActions-gvCLf)) .prc-Banner-BannerContent-LraS2{margin-block:var(--base-size-6,.375rem)}@media screen and (min-width:544px){.prc-Banner-BannerContent-LraS2{flex:1 1 0%}}.prc-Banner-BannerTitle-T4z0L{font-size:inherit;font-weight:var(--base-text-weight-semibold,600);margin:0}.prc-Banner-BannerIcon-o4ayx{display:grid;padding:var(--base-size-8,.5rem);place-items:center}.prc-Banner-BannerIcon-o4ayx svg{color:var(--banner-icon-fgColor);height:var(--base-size-20,1.25rem);fill:var(--banner-icon-fgColor)}.prc-Banner-Banner-IPLJ2[data-title-hidden]:not(:has(.prc-Banner-BannerActions-gvCLf)) .prc-Banner-BannerIcon-o4ayx svg{height:var(--base-size-16,1rem)}.prc-Banner-BannerDismiss-b12FL{display:grid;margin-inline-start:var(--base-size-4,.25rem);padding:var(--base-size-8,.5rem);place-items:center}:where(.prc-Banner-Banner-IPLJ2):has(.prc-Banner-BannerActions-gvCLf) .prc-Banner-BannerDismiss-b12FL{margin-block:var(--base-size-2,.125rem)}.prc-Banner-BannerDismiss-b12FL svg{color:var(--banner-icon-fgColor)}.prc-Banner-BannerActionsContainer-PdBu1{align-items:center;column-gap:var(--base-size-12,.75rem);display:flex;margin-block:var(--base-size-2,.125rem)}.prc-Banner-BannerActions-gvCLf :where([data-primary-action=trailing]){display:none}.prc-Banner-Banner-IPLJ2[data-dismissible]:not([data-title-hidden],[data-actions-layout=inline]) .prc-Banner-BannerActions-gvCLf{margin-block-end:var(--base-size-6,.375rem)}.prc-Banner-Banner-IPLJ2[data-dismissible]:not([data-title-hidden],[data-actions-layout=inline]) .prc-Banner-BannerActionsContainer-PdBu1[data-primary-action=trailing]{display:none}.prc-Banner-Banner-IPLJ2[data-dismissible]:not([data-title-hidden],[data-actions-layout=inline]) .prc-Banner-BannerActionsContainer-PdBu1[data-primary-action=leading]{display:flex}@container banner (max-width: 500px){.prc-Banner-BannerContainer-T-Siu{display:grid}.prc-Banner-BannerContainer-T-Siu:has(.prc-Banner-BannerActionsContainer-PdBu1){grid-template-rows:auto auto}.prc-Banner-BannerActions-gvCLf{margin-block-end:var(--base-size-6,.375rem)}.prc-Banner-BannerActions-gvCLf [data-primary-action=trailing]{display:none}.prc-Banner-BannerActions-gvCLf [data-primary-action=leading]{display:flex}}@container banner (min-width: 500px){.prc-Banner-BannerContainer-T-Siu{display:grid;grid-template-columns:auto auto}:where(.prc-Banner-Banner-IPLJ2):not([data-dismissible]) :where(.prc-Banner-BannerActionsContainer-PdBu1[data-primary-action=trailing]) :where([data-variant=link]:only-child){padding-inline:0 var(--base-size-12,.75rem)}.prc-Banner-BannerActions-gvCLf [data-primary-action=trailing]{display:flex;min-height:var(--base-size-32,2rem)}.prc-Banner-BannerActions-gvCLf [data-primary-action=leading]{display:none}}
2
+ /*# sourceMappingURL=Banner-b3871000.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/Banner/Banner.module.css.js"],"names":[],"mappings":"AAAA,yBASE,iBAAkB,CALlB,sCAAuC,CAEvC,uEAA+D,CAC/D,gDAAyC,CANzC,YAAa,CAOb,6CAA+C,CAN/C,gCAoGF,CA1FI,uCADF,sDAEI,4BAEJ,CADE,CAIA,wFACE,qBACF,CAEA,6HACE,YACF,CAEA,4HACE,YACF,CAIA,uFACE,gBACF,CAEA,qFACE,aACF,CAEA,4HACE,YACF,CAEA,2HACE,YACF,CAEA,mDACE,uFACE,qBACF,CAEA,4HACE,YACF,CAEA,2HACE,YACF,CACF,CAGF,8CACE,iCACF,CAEA,qCACE,gBAAiB,CAEjB,eAAgB,CADhB,iBAEF,CAEA,gDACE,uEAA6C,CAC7C,8EAAqD,CACrD,kEACF,CAEA,4CACE,uEAA6C,CAC7C,8EAAqD,CACrD,kEACF,CAEA,+CACE,yEAA8C,CAC9C,gFAAsD,CACtD,oEACF,CAEA,8CACE,oDAA6C,CAC7C,8DAAqD,CACrD,mDACF,CAEA,+CACE,6EAAgD,CAChD,oFAAwD,CACxD,wEACF,CAKF,kCAEE,iBAAkB,CAGlB,oCAA8B,CAJ9B,8CAAuC,CAEvC,kDAA+C,CAC/C,iCAEF,CAEA,mEACE,YAAa,CACb,cAAe,CACf,6BACF,CAEA,mIACE,YAAa,CACb,0BAA2B,CAC3B,uBACF,CAIA,gCACE,YAAa,CAEb,mBAAoB,CACpB,qCAAgC,CAFhC,iCAGF,CAEA,uHACE,uCACF,CAEA,oCACE,gCACE,WACF,CACF,CAEA,8BAEE,iBAAkB,CAClB,gDAA6C,CAF7C,QAGF,CAIA,6BACE,YAAa,CAEb,gCAA2B,CAD3B,kBAEF,CAEA,iCAIE,gCAAiC,CAFjC,kCAA2B,CAI3B,+BACF,CAGA,wHACE,+BACF,CAIA,gCACE,YAAa,CAGb,6CAAuC,CADvC,gCAA2B,CAD3B,kBAGF,CAEA,sGACE,uCACF,CAEA,oCAEE,gCACF,CAIA,yCAGE,kBAAmB,CADnB,qCAA+B,CAD/B,YAAa,CAGb,uCACF,CAEA,uEACE,YACF,CAEA,iIACE,2CACF,CAGA,wKAEE,YACF,CAGA,uKAEE,YACF,CAIA,qCACE,kCACE,YACF,CAEA,gFACE,4BACF,CAEA,gCACE,2CACF,CAEA,+DACE,YACF,CAEA,8DACE,YACF,CACF,CAEA,qCACE,kCACE,YAAa,CACb,+BACF,CAEA,+KAGE,2CACF,CAEA,+DACE,YAAa,CACb,mCACF,CAEA,8DACE,YACF,CACF","file":"Banner-b3871000.css","sourcesContent":[".Banner {\n display: grid;\n padding: var(--base-size-8);\n /* stylelint-disable-next-line primer/colors */\n background-color: var(--banner-bgColor);\n /* stylelint-disable-next-line primer/colors */\n border: var(--borderWidth-thin) solid var(--banner-borderColor);\n border-radius: var(--borderRadius-medium);\n grid-template-columns: auto minmax(0, 1fr) auto;\n align-items: start;\n\n &[data-actions-layout='default'] {\n @supports (container-type: inline-size) {\n container: banner / inline-size;\n }\n }\n\n &[data-actions-layout='stacked'] {\n & .BannerContainer {\n flex-direction: column;\n }\n\n & .BannerActions :where([data-primary-action='trailing']) {\n display: none;\n }\n\n & .BannerActions :where([data-primary-action='leading']) {\n display: flex;\n }\n }\n\n &[data-actions-layout='inline'] {\n & .BannerContainer {\n flex-wrap: nowrap;\n }\n\n & .BannerActions {\n flex: 0 0 auto;\n }\n\n & .BannerActions :where([data-primary-action='trailing']) {\n display: flex;\n }\n\n & .BannerActions :where([data-primary-action='leading']) {\n display: none;\n }\n\n @media screen and (--viewportRange-narrow) {\n & .BannerContainer {\n flex-direction: column;\n }\n\n & .BannerActions :where([data-primary-action='trailing']) {\n display: none;\n }\n\n & .BannerActions :where([data-primary-action='leading']) {\n display: flex;\n }\n }\n }\n\n &[data-layout='compact'] {\n padding: var(--base-size-4);\n }\n\n &[data-flush] {\n border-left: none;\n border-right: none;\n border-radius: 0;\n }\n\n &[data-variant='critical'] {\n --banner-bgColor: var(--bgColor-danger-muted);\n --banner-borderColor: var(--borderColor-danger-muted);\n --banner-icon-fgColor: var(--fgColor-danger);\n }\n\n &[data-variant='info'] {\n --banner-bgColor: var(--bgColor-accent-muted);\n --banner-borderColor: var(--borderColor-accent-muted);\n --banner-icon-fgColor: var(--fgColor-accent);\n }\n\n &[data-variant='success'] {\n --banner-bgColor: var(--bgColor-success-muted);\n --banner-borderColor: var(--borderColor-success-muted);\n --banner-icon-fgColor: var(--fgColor-success);\n }\n\n &[data-variant='upsell'] {\n --banner-bgColor: var(--bgColor-upsell-muted);\n --banner-borderColor: var(--borderColor-upsell-muted);\n --banner-icon-fgColor: var(--fgColor-upsell);\n }\n\n &[data-variant='warning'] {\n --banner-bgColor: var(--bgColor-attention-muted);\n --banner-borderColor: var(--borderColor-attention-muted);\n --banner-icon-fgColor: var(--fgColor-attention);\n }\n}\n\n/* BannerContainer -------------------------------------------------------- */\n\n.BannerContainer {\n font-size: var(--text-body-size-medium);\n align-items: start;\n line-height: var(--text-body-lineHeight-medium);\n row-gap: var(--base-size-4);\n column-gap: var(--base-size-4);\n}\n\n.Banner :where(.BannerContainer) {\n display: flex;\n flex-wrap: wrap;\n justify-content: space-between;\n}\n\n.Banner[data-dismissible]:not([data-title-hidden], [data-actions-layout='inline']) .BannerContainer {\n display: grid;\n grid-template-columns: auto;\n grid-template-rows: auto;\n}\n\n/* BannerContent ---------------------------------------------------------- */\n\n.BannerContent {\n display: grid;\n row-gap: var(--base-size-4);\n grid-column-start: 1;\n margin-block: var(--base-size-8);\n}\n\n.Banner[data-title-hidden]:not(:has(.BannerActions)) .BannerContent {\n margin-block: var(--base-size-6);\n}\n\n@media screen and (min-width: 544px) {\n .BannerContent {\n flex: 1 1 0%;\n }\n}\n\n.BannerTitle {\n margin: 0;\n font-size: inherit;\n font-weight: var(--base-text-weight-semibold);\n}\n\n/* BannerIcon ------------------------------------------------------------- */\n\n.BannerIcon {\n display: grid;\n place-items: center;\n padding: var(--base-size-8);\n}\n\n.BannerIcon svg {\n /* 20px is the line box height of the trailing action buttons */\n height: var(--base-size-20);\n /* stylelint-disable-next-line primer/colors */\n color: var(--banner-icon-fgColor);\n /* stylelint-disable-next-line primer/colors */\n fill: var(--banner-icon-fgColor);\n}\n\n/* stylelint-disable-next-line selector-max-specificity */\n.Banner[data-title-hidden]:not(:has(.BannerActions)) .BannerIcon svg {\n height: var(--base-size-16);\n}\n\n/* BannerDismiss ---------------------------------------------------------- */\n\n.BannerDismiss {\n display: grid;\n place-items: center;\n padding: var(--base-size-8);\n margin-inline-start: var(--base-size-4);\n}\n\n:where(.Banner):has(.BannerActions) .BannerDismiss {\n margin-block: var(--base-size-2);\n}\n\n.BannerDismiss svg {\n /* stylelint-disable-next-line primer/colors */\n color: var(--banner-icon-fgColor);\n}\n\n/* BannerActions ---------------------------------------------------------- */\n\n.BannerActionsContainer {\n display: flex;\n column-gap: var(--base-size-12);\n align-items: center;\n margin-block: var(--base-size-2);\n}\n\n.BannerActions :where([data-primary-action='trailing']) {\n display: none;\n}\n\n.Banner[data-dismissible]:not([data-title-hidden], [data-actions-layout='inline']) .BannerActions {\n margin-block-end: var(--base-size-6);\n}\n\n/* stylelint-disable-next-line selector-max-specificity */\n.Banner[data-dismissible]:not([data-title-hidden], [data-actions-layout='inline'])\n .BannerActionsContainer[data-primary-action='trailing'] {\n display: none;\n}\n\n/* stylelint-disable-next-line selector-max-specificity */\n.Banner[data-dismissible]:not([data-title-hidden], [data-actions-layout='inline'])\n .BannerActionsContainer[data-primary-action='leading'] {\n display: flex;\n}\n\n/* Layout ------------------------------------------------------------------- */\n\n@container banner (max-width: 500px) {\n .BannerContainer {\n display: grid;\n }\n\n .BannerContainer:has(.BannerActionsContainer) {\n grid-template-rows: auto auto;\n }\n\n .BannerActions {\n margin-block-end: var(--base-size-6);\n }\n\n .BannerActions [data-primary-action='trailing'] {\n display: none;\n }\n\n .BannerActions [data-primary-action='leading'] {\n display: flex;\n }\n}\n\n@container banner (min-width: 500px) {\n .BannerContainer {\n display: grid;\n grid-template-columns: auto auto;\n }\n\n :where(.Banner):not([data-dismissible])\n :where(.BannerActionsContainer[data-primary-action='trailing'])\n :where([data-variant='link']:only-child) {\n padding-inline: 0 var(--base-size-12);\n }\n\n .BannerActions [data-primary-action='trailing'] {\n display: flex;\n min-height: var(--base-size-32, 2rem);\n }\n\n .BannerActions [data-primary-action='leading'] {\n display: none;\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import './Banner-f672cdf9.css';
1
+ import './Banner-b3871000.css';
2
2
 
3
3
  var classes = {"Banner":"prc-Banner-Banner-IPLJ2","BannerContainer":"prc-Banner-BannerContainer-T-Siu","BannerActions":"prc-Banner-BannerActions-gvCLf","BannerContent":"prc-Banner-BannerContent-LraS2","BannerTitle":"prc-Banner-BannerTitle-T4z0L","BannerIcon":"prc-Banner-BannerIcon-o4ayx","BannerDismiss":"prc-Banner-BannerDismiss-b12FL","BannerActionsContainer":"prc-Banner-BannerActionsContainer-PdBu1"};
4
4
 
@@ -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,var(--color-canvas-overlay));border-radius:var(--borderRadius-large,.75rem);bottom:var(--bottom,auto);box-shadow:var(--shadow-floating-small,var(--color-overlay-shadow));height:auto;left:var(--left,auto);max-height:100vh;max-width:calc(100vw - 2rem);min-width:192px;overflow:auto;position:absolute;right:var(--right,auto);top:var(--top,auto);width:auto}.prc-Overlay-Overlay-jfs-T:focus{outline:none}@media (forced-colors:active){.prc-Overlay-Overlay-jfs-T{outline:1px solid transparent}}.prc-Overlay-Overlay-jfs-T:where([data-reflow-container=true]){max-width:calc(100vw - 2rem)}.prc-Overlay-Overlay-jfs-T:where([data-overflow-auto]){overflow:auto}.prc-Overlay-Overlay-jfs-T:where([data-overflow-hidden]){overflow:hidden}.prc-Overlay-Overlay-jfs-T:where([data-overflow-scroll]){overflow:scroll}.prc-Overlay-Overlay-jfs-T:where([data-overflow-visible]){overflow:visible}.prc-Overlay-Overlay-jfs-T:where([data-height-xsmall]){height:192px}.prc-Overlay-Overlay-jfs-T:where([data-height-small]){height:256px}.prc-Overlay-Overlay-jfs-T:where([data-height-medium]){height:320px}.prc-Overlay-Overlay-jfs-T:where([data-height-large]){height:432px}.prc-Overlay-Overlay-jfs-T:where([data-height-xlarge]){height:600px}.prc-Overlay-Overlay-jfs-T:where([data-height-auto]),.prc-Overlay-Overlay-jfs-T:where([data-height-initial]){height:auto}.prc-Overlay-Overlay-jfs-T:where([data-height-fit-content]){height:-moz-fit-content;height:fit-content}.prc-Overlay-Overlay-jfs-T:where([data-max-height-xsmall]){max-height:192px}.prc-Overlay-Overlay-jfs-T:where([data-max-height-small]){max-height:256px}.prc-Overlay-Overlay-jfs-T:where([data-max-height-medium]){max-height:320px}.prc-Overlay-Overlay-jfs-T:where([data-max-height-large]){max-height:432px}.prc-Overlay-Overlay-jfs-T:where([data-max-height-xlarge]){max-height:600px}.prc-Overlay-Overlay-jfs-T:where([data-max-height-fit-content]){max-height:-moz-fit-content;max-height:fit-content}.prc-Overlay-Overlay-jfs-T:where([data-width-small]){width:256px}.prc-Overlay-Overlay-jfs-T:where([data-width-medium]){width:320px}.prc-Overlay-Overlay-jfs-T:where([data-width-large]){width:480px}.prc-Overlay-Overlay-jfs-T:where([data-width-xlarge]){width:640px}.prc-Overlay-Overlay-jfs-T:where([data-width-xxlarge]){width:960px}.prc-Overlay-Overlay-jfs-T:where([data-width-auto]){width:auto}.prc-Overlay-Overlay-jfs-T:where([data-max-width-small]){max-width:256px}.prc-Overlay-Overlay-jfs-T:where([data-max-width-medium]){max-width:320px}.prc-Overlay-Overlay-jfs-T:where([data-max-width-large]){max-width:480px}.prc-Overlay-Overlay-jfs-T:where([data-max-width-xlarge]){max-width:640px}.prc-Overlay-Overlay-jfs-T:where([data-max-width-xxlarge]){max-width:960px}.prc-Overlay-Overlay-jfs-T:where([data-visibility-visible]){visibility:visible}.prc-Overlay-Overlay-jfs-T:where([data-visibility-hidden]){visibility:hidden}@media screen and (max-width:calc(48rem - 0.02px)){.prc-Overlay-Overlay-jfs-T:where([data-responsive=fullscreen]){border-radius:unset;height:100vh;left:0;margin:0;max-height:none;max-width:none;position:fixed;top:0;width:100vw}}@supports (height:100dvh){.prc-Overlay-Overlay-jfs-T:where([data-variant=fullscreen]){height:100dvh}}@media (prefers-reduced-motion:no-preference){.prc-Overlay-Overlay-jfs-T{animation:prc-Overlay-overlay-appear-JpFey .2s cubic-bezier(.33,1,.68,1)}}
2
- /*# sourceMappingURL=Overlay-15519c09.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,var(--color-canvas-overlay));border-radius:var(--borderRadius-large,.75rem);bottom:var(--bottom,auto);box-shadow:var(--shadow-floating-small,var(--color-overlay-shadow));height:auto;left:var(--left,auto);max-height:100vh;max-width:calc(100vw - 2rem);min-width:192px;overflow:auto;position:absolute;right:var(--right,auto);top:var(--top,auto);width:auto}.prc-Overlay-Overlay-jfs-T:focus{outline:none}@media (forced-colors:active){.prc-Overlay-Overlay-jfs-T{outline:1px solid transparent}}.prc-Overlay-Overlay-jfs-T:where([data-reflow-container=true]){max-width:calc(100vw - 2rem)}.prc-Overlay-Overlay-jfs-T:where([data-overflow-auto]){overflow:auto}.prc-Overlay-Overlay-jfs-T:where([data-overflow-hidden]){overflow:hidden}.prc-Overlay-Overlay-jfs-T:where([data-overflow-scroll]){overflow:scroll}.prc-Overlay-Overlay-jfs-T:where([data-overflow-visible]){overflow:visible}.prc-Overlay-Overlay-jfs-T:where([data-height-xsmall]){height:192px}.prc-Overlay-Overlay-jfs-T:where([data-height-small]){height:256px}.prc-Overlay-Overlay-jfs-T:where([data-height-medium]){height:320px}.prc-Overlay-Overlay-jfs-T:where([data-height-large]){height:432px}.prc-Overlay-Overlay-jfs-T:where([data-height-xlarge]){height:600px}.prc-Overlay-Overlay-jfs-T:where([data-height-auto]),.prc-Overlay-Overlay-jfs-T:where([data-height-initial]){height:auto}.prc-Overlay-Overlay-jfs-T:where([data-height-fit-content]){height:-moz-fit-content;height:fit-content}.prc-Overlay-Overlay-jfs-T:where([data-max-height-xsmall]){max-height:192px}.prc-Overlay-Overlay-jfs-T:where([data-max-height-small]){max-height:256px}.prc-Overlay-Overlay-jfs-T:where([data-max-height-medium]){max-height:320px}.prc-Overlay-Overlay-jfs-T:where([data-max-height-large]){max-height:432px}.prc-Overlay-Overlay-jfs-T:where([data-max-height-xlarge]){max-height:600px}.prc-Overlay-Overlay-jfs-T:where([data-max-height-fit-content]){max-height:-moz-fit-content;max-height:fit-content}.prc-Overlay-Overlay-jfs-T:where([data-width-small]){width:256px}.prc-Overlay-Overlay-jfs-T:where([data-width-medium]){width:320px}.prc-Overlay-Overlay-jfs-T:where([data-width-large]){width:480px}.prc-Overlay-Overlay-jfs-T:where([data-width-xlarge]){width:640px}.prc-Overlay-Overlay-jfs-T:where([data-width-xxlarge]){width:960px}.prc-Overlay-Overlay-jfs-T:where([data-width-auto]){width:auto}.prc-Overlay-Overlay-jfs-T:where([data-max-width-small]){max-width:256px}.prc-Overlay-Overlay-jfs-T:where([data-max-width-medium]){max-width:320px}.prc-Overlay-Overlay-jfs-T:where([data-max-width-large]){max-width:480px}.prc-Overlay-Overlay-jfs-T:where([data-max-width-xlarge]){max-width:640px}.prc-Overlay-Overlay-jfs-T:where([data-max-width-xxlarge]){max-width:960px}.prc-Overlay-Overlay-jfs-T:where([data-visibility-visible]){visibility:visible}.prc-Overlay-Overlay-jfs-T:where([data-visibility-hidden]){visibility:hidden}@media screen and (max-width:calc(48rem - 0.02px)){.prc-Overlay-Overlay-jfs-T:where([data-responsive=fullscreen]){border-radius:unset;height:100vh;left:0;margin:0;max-height:none;max-width:none;padding-bottom:env(safe-area-inset-bottom);position:fixed;top:0;width:100vw}@supports (height:100dvh){.prc-Overlay-Overlay-jfs-T:where([data-responsive=fullscreen]){height:100dvh}}}@supports (height:100dvh){.prc-Overlay-Overlay-jfs-T:where([data-variant=fullscreen]){height:100dvh}}@media (prefers-reduced-motion:no-preference){.prc-Overlay-Overlay-jfs-T{animation:prc-Overlay-overlay-appear-JpFey .2s cubic-bezier(.33,1,.68,1)}}
2
+ /*# sourceMappingURL=Overlay-dbaa6b8c.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/Overlay/Overlay.module.css.js"],"names":[],"mappings":"AAAA,4CACE,GACE,SACF,CAEA,GACE,SACF,CACF,CAEA,2BAQE,mEAAwC,CACxC,8CAAwC,CASxC,yBAA2B,CAR3B,mEAAwC,CALxC,WAAY,CASZ,qBAAuB,CARvB,gBAAiB,CAJjB,4BAA6B,CAE7B,eAAgB,CAGhB,aAAc,CANd,iBAAkB,CAelB,uBAAyB,CAJzB,mBAAqB,CATrB,UAqLF,CApKE,iCACE,YACF,CAEA,8BAxBF,2BA0BI,6BA8JJ,CA7JE,CAEA,+DACE,4BACF,CAEA,uDACE,aACF,CAEA,yDACE,eACF,CAEA,yDACE,eACF,CAEA,0DACE,gBACF,CAEA,uDACE,YACF,CAEA,sDACE,YACF,CAEA,uDACE,YACF,CAEA,sDACE,YACF,CAEA,uDACE,YACF,CAEA,6GAEE,WACF,CAEA,4DACE,uBAAmB,CAAnB,kBACF,CAEA,2DACE,gBACF,CAEA,0DACE,gBACF,CAEA,2DACE,gBACF,CAEA,0DACE,gBACF,CAEA,2DACE,gBACF,CAEA,gEACE,2BAAuB,CAAvB,sBACF,CAEA,qDACE,WACF,CAEA,sDACE,WACF,CAEA,qDAEE,WACF,CAEA,sDAEE,WACF,CAEA,uDAEE,WACF,CAEA,oDACE,UACF,CAEA,yDACE,eACF,CAEA,0DACE,eACF,CAEA,yDACE,eACF,CAEA,0DACE,eACF,CAEA,2DACE,eACF,CAEA,4DACE,kBACF,CAEA,2DACE,iBACF,CAGE,mDADF,+DAUI,mBAAoB,CAHpB,YAAa,CAHb,MAAO,CAKP,QAAS,CADT,eAAgB,CAFhB,cAAe,CAMf,0CAA2C,CAV3C,cAAe,CACf,KAAM,CAEN,WAcJ,CALI,0BAdJ,+DAgBM,aAGN,CAFI,CACF,CAGF,0BAEE,4DACE,aACF,CACF,CAGF,8CACE,2BACE,wEACF,CACF","file":"Overlay-dbaa6b8c.css","sourcesContent":["@keyframes overlay-appear {\n 0% {\n opacity: 0;\n }\n\n 100% {\n opacity: 1;\n }\n}\n\n.Overlay {\n position: absolute;\n max-width: calc(100vw - 2rem);\n width: auto;\n min-width: 192px;\n height: auto;\n max-height: 100vh;\n overflow: auto;\n background-color: var(--overlay-bgColor);\n border-radius: var(--borderRadius-large);\n box-shadow: var(--shadow-floating-small);\n /* stylelint-disable-next-line primer/spacing */\n top: var(--top, auto);\n /* stylelint-disable-next-line primer/spacing */\n left: var(--left, auto);\n /* stylelint-disable-next-line primer/spacing */\n right: var(--right, auto);\n /* stylelint-disable-next-line primer/spacing */\n bottom: var(--bottom, auto);\n\n &:focus {\n outline: none;\n }\n\n @media (forced-colors: active) {\n /* Support for Windows high contrast https://sarahmhigley.com/writing/whcm-quick-tips */\n outline: solid 1px transparent;\n }\n\n &:where([data-reflow-container='true']) {\n max-width: calc(100vw - 2rem);\n }\n\n &:where([data-overflow-auto]) {\n overflow: auto;\n }\n\n &:where([data-overflow-hidden]) {\n overflow: hidden;\n }\n\n &:where([data-overflow-scroll]) {\n overflow: scroll;\n }\n\n &:where([data-overflow-visible]) {\n overflow: visible;\n }\n\n &:where([data-height-xsmall]) {\n height: 192px;\n }\n\n &:where([data-height-small]) {\n height: 256px;\n }\n\n &:where([data-height-medium]) {\n height: 320px;\n }\n\n &:where([data-height-large]) {\n height: 432px;\n }\n\n &:where([data-height-xlarge]) {\n height: 600px;\n }\n\n &:where([data-height-auto]),\n &:where([data-height-initial]) {\n height: auto;\n }\n\n &:where([data-height-fit-content]) {\n height: fit-content;\n }\n\n &:where([data-max-height-xsmall]) {\n max-height: 192px;\n }\n\n &:where([data-max-height-small]) {\n max-height: 256px;\n }\n\n &:where([data-max-height-medium]) {\n max-height: 320px;\n }\n\n &:where([data-max-height-large]) {\n max-height: 432px;\n }\n\n &:where([data-max-height-xlarge]) {\n max-height: 600px;\n }\n\n &:where([data-max-height-fit-content]) {\n max-height: fit-content;\n }\n\n &:where([data-width-small]) {\n width: 256px;\n }\n\n &:where([data-width-medium]) {\n width: 320px;\n }\n\n &:where([data-width-large]) {\n /* stylelint-disable-next-line primer/responsive-widths */\n width: 480px;\n }\n\n &:where([data-width-xlarge]) {\n /* stylelint-disable-next-line primer/responsive-widths */\n width: 640px;\n }\n\n &:where([data-width-xxlarge]) {\n /* stylelint-disable-next-line primer/responsive-widths */\n width: 960px;\n }\n\n &:where([data-width-auto]) {\n width: auto;\n }\n\n &:where([data-max-width-small]) {\n max-width: 256px;\n }\n\n &:where([data-max-width-medium]) {\n max-width: 320px;\n }\n\n &:where([data-max-width-large]) {\n max-width: 480px;\n }\n\n &:where([data-max-width-xlarge]) {\n max-width: 640px;\n }\n\n &:where([data-max-width-xxlarge]) {\n max-width: 960px;\n }\n\n &:where([data-visibility-visible]) {\n visibility: visible;\n }\n\n &:where([data-visibility-hidden]) {\n visibility: hidden;\n }\n\n &:where([data-responsive='fullscreen']) {\n @media screen and (--viewportRange-narrow) {\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n max-width: none;\n height: 100vh;\n max-height: none;\n margin: 0;\n border-radius: unset;\n /* stylelint-disable-next-line primer/spacing */\n padding-bottom: env(safe-area-inset-bottom);\n\n @supports (height: 100dvh) {\n /* fix for mobile safari (100vh clips the screen with the toolbar) */\n height: 100dvh;\n }\n }\n }\n\n @supports (height: 100dvh) {\n /* fix for mobile safari (100vh clips the screen with the toolbar) */\n &:where([data-variant='fullscreen']) {\n height: 100dvh;\n }\n }\n}\n\n@media (prefers-reduced-motion: no-preference) {\n .Overlay {\n animation: overlay-appear 200ms cubic-bezier(0.33, 1, 0.68, 1);\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import './Overlay-15519c09.css';
1
+ import './Overlay-dbaa6b8c.css';
2
2
 
3
3
  var classes = {"Overlay":"prc-Overlay-Overlay-jfs-T","overlay-appear":"prc-Overlay-overlay-appear-JpFey"};
4
4
 
@@ -0,0 +1,2 @@
1
+ .prc-UnderlineNav-MenuItemContent-3J7gB{align-items:center;display:flex;justify-content:space-between}.prc-UnderlineNav-MoreButton-Y8soj{background:transparent;border:0;box-shadow:none;font-weight:var(--base-text-weight-normal,400);margin:0;padding:var(--base-size-4,.25rem) var(--base-size-8,.5rem)}.prc-UnderlineNav-MoreButton-Y8soj>[data-component=trailingVisual]{margin-left:0}
2
+ /*# sourceMappingURL=UnderlineNav-4344d9b0.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/UnderlineNav/UnderlineNav.module.css.js"],"names":[],"mappings":"AAAA,wCAEE,kBAAmB,CADnB,YAAa,CAEb,6BACF,CAGA,mCAGE,sBAAuB,CADvB,QAAS,CAGT,eAAgB,CADhB,8CAA2C,CAH3C,QAAS,CAQT,0DAKF,CAHE,mEACE,aACF","file":"UnderlineNav-4344d9b0.css","sourcesContent":[".MenuItemContent {\n display: flex;\n align-items: center;\n justify-content: space-between;\n}\n\n/* More button styles migrated from styles.ts (was moreBtnStyles) */\n.MoreButton {\n margin: 0; /* reset Safari extra margin */\n border: 0;\n background: transparent;\n font-weight: var(--base-text-weight-normal);\n box-shadow: none;\n padding-top: var(--base-size-4);\n padding-bottom: var(--base-size-4);\n padding-left: var(--base-size-8);\n padding-right: var(--base-size-8);\n\n & > [data-component='trailingVisual'] {\n margin-left: 0;\n }\n}\n"]}
@@ -15,5 +15,7 @@ export type UnderlineNavProps = {
15
15
  */
16
16
  variant?: 'inset' | 'flush';
17
17
  };
18
- export declare const UnderlineNav: React.ForwardRefExoticComponent<UnderlineNavProps & React.RefAttributes<HTMLElement>>;
18
+ export declare const MORE_BTN_WIDTH = 86;
19
+ export declare const getValidChildren: (children: React.ReactNode) => React.ReactElement<any>[];
20
+ export declare const UnderlineNav: React.ForwardRefExoticComponent<UnderlineNavProps & React.RefAttributes<unknown>>;
19
21
  //# sourceMappingURL=UnderlineNav.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UnderlineNav.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/UnderlineNav.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgD,MAAM,OAAO,CAAA;AAOpE,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;AAOD,eAAO,MAAM,YAAY,uFA0ExB,CAAA"}
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,15 +1,119 @@
1
- import React, { forwardRef, useEffect, useState, useRef } from 'react';
1
+ import React, { forwardRef, useRef, useState, useEffect, useCallback } from 'react';
2
+ import { UnderlineNavContext } from './UnderlineNavContext.js';
3
+ import { useResizeObserver } from '../hooks/useResizeObserver.js';
2
4
  import VisuallyHidden from '../_VisuallyHidden.js';
3
- import { UnderlineWrapper, UnderlineItemList } from '../internal/components/UnderlineTabbedInterface.js';
5
+ import { dividerStyles, baseMenuMinWidth, menuItemStyles } from './styles.js';
6
+ import { UnderlineWrapper, UnderlineItemList, LoadingCounter, GAP } from '../internal/components/UnderlineTabbedInterface.js';
7
+ import { TriangleDownIcon } from '@primer/octicons-react';
8
+ import { useOnEscapePress } from '../hooks/useOnEscapePress.js';
9
+ import { useOnOutsideClick } from '../hooks/useOnOutsideClick.js';
10
+ import { useId } from '../hooks/useId.js';
11
+ import { ActionList } from '../ActionList/index.js';
4
12
  import { invariant } from '../utils/invariant.js';
5
13
  import classes from './UnderlineNav.module.css.js';
6
- import { UnderlineNavContext } from './UnderlineNavContext.js';
7
- import { jsxs, jsx } from 'react/jsx-runtime';
14
+ import { getAnchoredPosition } from '@primer/behaviors';
15
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
16
+ import { ButtonComponent } from '../Button/Button.js';
17
+ import CounterLabel from '../CounterLabel/CounterLabel.js';
18
+
19
+ // When page is loaded, we don't have ref for the more button as it is not on the DOM yet.
20
+ // However, we need to calculate number of possible items when the more button present as well. So using the width of the more button as a constant.
21
+ const MORE_BTN_WIDTH = 86;
22
+ // 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
+ const MORE_BTN_HEIGHT = 45;
24
+ const overflowEffect = (navWidth, moreMenuWidth, childArray, childWidthArray, noIconChildWidthArray, updateListAndMenu) => {
25
+ let iconsVisible = true;
26
+ if (childWidthArray.length === 0) {
27
+ updateListAndMenu({
28
+ items: childArray,
29
+ menuItems: []
30
+ }, iconsVisible, false);
31
+ return;
32
+ }
33
+ const numberOfItemsPossible = calculatePossibleItems(childWidthArray, navWidth);
34
+ const numberOfItemsWithoutIconPossible = calculatePossibleItems(noIconChildWidthArray, navWidth);
35
+ // 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
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
38
+ const items = [];
39
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
40
+ const menuItems = [];
41
+
42
+ // First, we check if we can fit all the items with their icons
43
+ if (childArray.length <= numberOfItemsPossible) {
44
+ items.push(...childArray);
45
+ } else if (childArray.length <= numberOfItemsWithoutIconPossible) {
46
+ // if we can't fit all the items with their icons, we check if we can fit all the items without their icons
47
+ iconsVisible = false;
48
+ items.push(...childArray);
49
+ } else {
50
+ // if we can't fit all the items without their icons, we keep the icons hidden and show the ones that doesn't fit into the list in the overflow menu
51
+ iconsVisible = false;
8
52
 
53
+ /* Below is an accessibility requirement. Never show only one item in the overflow menu.
54
+ * If there is only one item left to display in the overflow menu according to the calculation,
55
+ * we need to pull another item from the list into the overflow menu.
56
+ */
57
+ const numberOfItemsInMenu = childArray.length - numberOfItemsPossibleWithMoreMenu;
58
+ const numberOfListItems = numberOfItemsInMenu === 1 ? numberOfItemsPossibleWithMoreMenu - 1 : numberOfItemsPossibleWithMoreMenu;
59
+ for (const [index, child] of childArray.entries()) {
60
+ if (index < numberOfListItems) {
61
+ items.push(child);
62
+ } else {
63
+ const ariaCurrent = child.props['aria-current'];
64
+ const isCurrent = Boolean(ariaCurrent) && ariaCurrent !== 'false';
65
+ // We need to make sure to keep the selected item always visible.
66
+ // To do that, we swap the selected item with the last item in the list to make it visible. (When there is at least 1 item in the list to swap.)
67
+ if (isCurrent && numberOfListItems > 0) {
68
+ // If selected item couldn't make in to the list, we swap it with the last item in the list.
69
+ const indexToReplaceAt = numberOfListItems - 1; // because we are replacing the last item in the list
70
+ // splice method modifies the array by removing 1 item here at the given index and replace it with the "child" element then returns the removed item.
71
+ const propsectiveAction = items.splice(indexToReplaceAt, 1, child)[0];
72
+ menuItems.push(propsectiveAction);
73
+ } else {
74
+ menuItems.push(child);
75
+ }
76
+ }
77
+ }
78
+ }
79
+ updateListAndMenu({
80
+ items,
81
+ menuItems
82
+ }, iconsVisible, true);
83
+ };
9
84
  const getValidChildren = children => {
10
85
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
86
  return React.Children.toArray(children).filter(child => /*#__PURE__*/React.isValidElement(child));
12
87
  };
88
+ const calculatePossibleItems = (childWidthArray, navWidth, moreMenuWidth = 0) => {
89
+ const widthToFit = navWidth - moreMenuWidth;
90
+ let breakpoint = childWidthArray.length; // assume all items will fit
91
+ let sumsOfChildWidth = 0;
92
+ for (const [index, childWidth] of childWidthArray.entries()) {
93
+ sumsOfChildWidth = sumsOfChildWidth + childWidth.width + GAP;
94
+ if (sumsOfChildWidth > widthToFit) {
95
+ breakpoint = index;
96
+ break;
97
+ } else {
98
+ continue;
99
+ }
100
+ }
101
+ return breakpoint;
102
+ };
103
+
104
+ // Inline styles converted from baseMenuStyles for use as CSSProperties
105
+ const baseMenuInlineStyles = {
106
+ position: 'absolute',
107
+ zIndex: 1,
108
+ top: '90%',
109
+ boxShadow: '0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24)',
110
+ borderRadius: 12,
111
+ background: 'var(--overlay-bgColor)',
112
+ listStyle: 'none',
113
+ minWidth: `${baseMenuMinWidth}px`,
114
+ maxWidth: '640px',
115
+ right: 0
116
+ };
13
117
  const UnderlineNav = /*#__PURE__*/forwardRef(({
14
118
  as = 'nav',
15
119
  'aria-label': ariaLabel,
@@ -18,9 +122,42 @@ const UnderlineNav = /*#__PURE__*/forwardRef(({
18
122
  className,
19
123
  children
20
124
  }, forwardedRef) => {
21
- if (process.env.NODE_ENV !== "production") {
22
- const validChildren = getValidChildren(children);
125
+ var _listRef$current2;
126
+ const backupRef = useRef(null);
127
+ const navRef = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : backupRef;
128
+ const listRef = useRef(null);
129
+ const moreMenuRef = useRef(null);
130
+ const moreMenuBtnRef = useRef(null);
131
+ const containerRef = React.useRef(null);
132
+ const disclosureWidgetId = useId();
133
+ 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);
139
+ const validChildren = getValidChildren(children);
23
140
 
141
+ // Responsive props object manages which items are in the list and which items are in the menu.
142
+ const [responsiveProps, setResponsiveProps] = useState({
143
+ items: validChildren,
144
+ menuItems: []
145
+ });
146
+
147
+ // 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;
151
+ });
152
+
153
+ // 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;
157
+ });
158
+ // 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;
160
+ if (process.env.NODE_ENV !== "production") {
24
161
  // Practically, this is not a conditional hook, it is just making sure this hook runs only on DEV not PROD.
25
162
  // eslint-disable-next-line react-hooks/rules-of-hooks
26
163
  useEffect(() => {
@@ -32,51 +169,216 @@ const UnderlineNav = /*#__PURE__*/forwardRef(({
32
169
  !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;
33
170
  });
34
171
  }
35
- const [hideIcons, setHideIcons] = useState(false);
36
- const scrollContainer = useRef(null);
37
- useEffect(() => {
38
- if (hideIcons || !scrollContainer.current) return;
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) => {
177
+ 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
181
+ 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);
39
182
 
40
- // Putting the resizeobserver on the list ensures it runs if the contents change;
41
- // the container is fullwidth but the list is elastic
42
- const list = scrollContainer.current.querySelector('ul');
43
- if (!list) return;
44
- const observer = new ResizeObserver(() => {
45
- if (scrollContainer.current.scrollWidth > scrollContainer.current.clientWidth) setHideIcons(true);
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) {
202
+ let widthToSwap = 0;
203
+ let breakpoint = 0;
204
+ for (const [index, item] of [...responsiveProps.items].reverse().entries()) {
205
+ widthToSwap += getItemsWidth(item.props.children);
206
+ if (widthToFitIntoList < widthToSwap + availableSpace) {
207
+ breakpoint = index;
208
+ break;
209
+ }
210
+ }
211
+ return breakpoint;
212
+ }
213
+ const updateListAndMenu = useCallback((props, displayIcons, overflowMeasured) => {
214
+ setResponsiveProps(props);
215
+ setIconsVisible(displayIcons);
216
+ if (overflowMeasured) {
217
+ setIsOverflowMeasured(true);
218
+ }
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;
46
230
  });
47
- observer.observe(list);
48
- return () => observer.disconnect();
49
- }, [hideIcons]);
231
+ }, []);
232
+ const closeOverlay = React.useCallback(() => {
233
+ setIsWidgetOpen(false);
234
+ }, [setIsWidgetOpen]);
235
+ const focusOnMoreMenuBtn = React.useCallback(() => {
236
+ var _moreMenuBtnRef$curre;
237
+ (_moreMenuBtnRef$curre = moreMenuBtnRef.current) === null || _moreMenuBtnRef$curre === void 0 ? void 0 : _moreMenuBtnRef$curre.focus();
238
+ }, []);
239
+ const onAnchorClick = useCallback(event => {
240
+ if (event.defaultPrevented || event.button !== 0) {
241
+ return;
242
+ }
243
+ setIsWidgetOpen(isWidgetOpen => !isWidgetOpen);
244
+ }, []);
245
+ useOnEscapePress(event => {
246
+ if (isWidgetOpen) {
247
+ event.preventDefault();
248
+ closeOverlay();
249
+ focusOnMoreMenuBtn();
250
+ }
251
+ }, [isWidgetOpen]);
252
+ useOnOutsideClick({
253
+ onClickOutside: closeOverlay,
254
+ containerRef,
255
+ ignoreClickRefs: [moreMenuBtnRef]
256
+ });
257
+ useResizeObserver(resizeObserverEntries => {
258
+ var _moreMenuRef$current$, _moreMenuRef$current;
259
+ 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);
262
+ }, navRef);
263
+
264
+ // Compute menuInlineStyles if needed
265
+ let menuInlineStyles = {
266
+ ...baseMenuInlineStyles
267
+ };
268
+ if (containerRef.current && listRef.current) {
269
+ const {
270
+ left
271
+ } = getAnchoredPosition(containerRef.current, listRef.current, {
272
+ align: 'start',
273
+ side: 'outside-bottom'
274
+ });
275
+ menuInlineStyles = {
276
+ ...baseMenuInlineStyles,
277
+ right: undefined,
278
+ left
279
+ };
280
+ }
50
281
  return /*#__PURE__*/jsxs(UnderlineNavContext.Provider, {
51
282
  value: {
52
- loadingCounters
283
+ setChildrenWidth,
284
+ setNoIconChildrenWidth,
285
+ loadingCounters,
286
+ iconsVisible
53
287
  },
54
288
  children: [ariaLabel && /*#__PURE__*/jsx(VisuallyHidden, {
55
289
  as: "h2",
56
290
  children: `${ariaLabel} navigation`
57
- }), /*#__PURE__*/jsx("div", {
58
- className: classes.ScrollContainer,
59
- "data-hide-icons": hideIcons,
60
- ref: scrollContainer,
61
- "data-component": "underlinenav-scrollcontainer",
62
- children: /*#__PURE__*/jsx(UnderlineWrapper, {
63
- as: as,
64
- "aria-label": ariaLabel,
65
- className: className,
66
- ref: forwardedRef,
67
- "data-variant": variant,
68
- "data-overflow-mode": "wrap",
69
- style: {
70
- minWidth: 'fit-content'
71
- },
72
- children: /*#__PURE__*/jsx(UnderlineItemList, {
73
- role: "list",
74
- children: children
75
- })
291
+ }), /*#__PURE__*/jsx(UnderlineWrapper, {
292
+ as: as,
293
+ "aria-label": ariaLabel,
294
+ className: className,
295
+ ref: navRef,
296
+ "data-variant": variant,
297
+ "data-overflow-measured": isOverflowMeasured ? 'true' : 'false',
298
+ children: /*#__PURE__*/jsxs(UnderlineItemList, {
299
+ ref: listRef,
300
+ role: "list",
301
+ children: [listItems, menuItems.length > 0 && /*#__PURE__*/jsxs("li", {
302
+ ref: moreMenuRef,
303
+ style: {
304
+ display: 'flex',
305
+ alignItems: 'center',
306
+ height: `${MORE_BTN_HEIGHT}px`
307
+ },
308
+ children: [!onlyMenuVisible && /*#__PURE__*/jsx("div", {
309
+ style: dividerStyles
310
+ }), /*#__PURE__*/jsx(ButtonComponent, {
311
+ ref: moreMenuBtnRef,
312
+ className: classes.MoreButton,
313
+ "aria-controls": disclosureWidgetId,
314
+ "aria-expanded": isWidgetOpen,
315
+ onClick: onAnchorClick,
316
+ trailingAction: TriangleDownIcon,
317
+ children: /*#__PURE__*/jsx("span", {
318
+ children: onlyMenuVisible ? /*#__PURE__*/jsxs(Fragment, {
319
+ children: [/*#__PURE__*/jsxs(VisuallyHidden, {
320
+ as: "span",
321
+ children: [`${ariaLabel}`, "\xA0"]
322
+ }), "Menu"]
323
+ }) : /*#__PURE__*/jsxs(Fragment, {
324
+ children: ["More", /*#__PURE__*/jsxs(VisuallyHidden, {
325
+ as: "span",
326
+ children: ["\xA0", `${ariaLabel} items`]
327
+ })]
328
+ })
329
+ })
330
+ }), /*#__PURE__*/jsx(ActionList, {
331
+ selectionVariant: "single",
332
+ ref: containerRef,
333
+ 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
+ },
338
+ children: menuItems.map((menuItem, index) => {
339
+ const {
340
+ children: menuItemChildren,
341
+ counter,
342
+ 'aria-current': ariaCurrent,
343
+ onSelect,
344
+ ...menuItemProps
345
+ } = 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
+ return /*#__PURE__*/jsx(ActionList.LinkItem, {
355
+ style: menuItemStyles,
356
+ onClick: event => {
357
+ // 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);
359
+ closeOverlay();
360
+ focusOnMoreMenuBtn();
361
+ // fire onSelect event that comes from the UnderlineNav.Item (if it is defined)
362
+ typeof onSelect === 'function' && onSelect(event);
363
+ },
364
+ ...menuItemProps,
365
+ children: /*#__PURE__*/jsxs("span", {
366
+ className: classes.MenuItemContent,
367
+ children: [menuItemChildren, loadingCounters ? /*#__PURE__*/jsx(LoadingCounter, {}) : counter !== undefined && /*#__PURE__*/jsx("span", {
368
+ "data-component": "counter",
369
+ children: /*#__PURE__*/jsx(CounterLabel, {
370
+ children: counter
371
+ })
372
+ })]
373
+ })
374
+ }, menuItemChildren);
375
+ })
376
+ })]
377
+ })]
76
378
  })
77
379
  })]
78
380
  });
79
381
  });
80
382
  UnderlineNav.displayName = 'UnderlineNav';
81
383
 
82
- export { UnderlineNav };
384
+ export { MORE_BTN_WIDTH, UnderlineNav, getValidChildren };
@@ -1,5 +1,5 @@
1
- import './UnderlineNav-4c80468c.css';
1
+ import './UnderlineNav-4344d9b0.css';
2
2
 
3
- var classes = {"ScrollContainer":"prc-UnderlineNav-ScrollContainer-kBvfS","detect-overflow":"prc-UnderlineNav-detect-overflow-6HuSH"};
3
+ var classes = {"MenuItemContent":"prc-UnderlineNav-MenuItemContent-3J7gB","MoreButton":"prc-UnderlineNav-MoreButton-Y8soj"};
4
4
 
5
5
  export { classes as default };
@@ -1,4 +1,14 @@
1
- export declare const UnderlineNavContext: import("react").Context<{
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
+ }>;
2
11
  loadingCounters: boolean;
12
+ iconsVisible: boolean;
3
13
  }>;
4
14
  //# sourceMappingURL=UnderlineNavContext.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UnderlineNavContext.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/UnderlineNavContext.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB;qBACb,OAAO;EAGxB,CAAA"}
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,7 +1,10 @@
1
1
  import { createContext } from 'react';
2
2
 
3
3
  const UnderlineNavContext = /*#__PURE__*/createContext({
4
- loadingCounters: false
4
+ setChildrenWidth: () => null,
5
+ setNoIconChildrenWidth: () => null,
6
+ loadingCounters: false,
7
+ iconsVisible: true
5
8
  });
6
9
 
7
10
  export { UnderlineNavContext };
@@ -43,11 +43,5 @@ export type UnderlineNavItemProps = {
43
43
  */
44
44
  counter?: number | string;
45
45
  } & LinkProps;
46
- /** Registry of currently-overflowing underline items. If an item is not overflowing, its value will be `null`. */
47
- export declare const UnderlineNavItemsRegistry: {
48
- Provider: ({ children, setRegistry }: import("../utils/descendant-registry").ProviderProps<UnderlineNavItemProps | null>) => React.JSX.Element;
49
- useRegistryState: () => [ReadonlyMap<string, UnderlineNavItemProps | null> | undefined, React.Dispatch<React.SetStateAction<ReadonlyMap<string, UnderlineNavItemProps | null> | undefined>>];
50
- useRegisterDescendant: (value: UnderlineNavItemProps | null) => string;
51
- };
52
46
  export declare const UnderlineNavItem: PolymorphicForwardRefComponent<"a", UnderlineNavItemProps>;
53
47
  //# sourceMappingURL=UnderlineNavItem.d.ts.map