@primer/react 0.0.0-20260409214120 → 0.0.0-20260410005014
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -3
- package/dist/Breadcrumbs/{Breadcrumbs-a44d6835.css → Breadcrumbs-dbfc9d95.css} +2 -2
- package/dist/Breadcrumbs/Breadcrumbs-dbfc9d95.css.map +1 -0
- package/dist/Breadcrumbs/Breadcrumbs.d.ts +1 -8
- package/dist/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.js +15 -26
- package/dist/Breadcrumbs/Breadcrumbs.module.css.js +1 -1
- package/package.json +1 -1
- package/dist/Breadcrumbs/Breadcrumbs-a44d6835.css.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-20260410005014
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
7
|
- [#7723](https://github.com/primer/react/pull/7723) [`ec6c88f`](https://github.com/primer/react/commit/ec6c88fe3eb3ef349500617c90378712f802376d) Thanks [@liuliu-dev](https://github.com/liuliu-dev)! - Add Card component with subcomponents: Card.Icon, Card.Image, Card.Heading, Card.Description, Card.Menu, and Card.Metadata
|
|
8
8
|
|
|
9
|
-
- [#7735](https://github.com/primer/react/pull/7735) [`b12d9f5`](https://github.com/primer/react/commit/b12d9f5e05cec248f1d38bf402cd2a592678b69c) Thanks [@liuliu-dev](https://github.com/liuliu-dev)! - Breadcrumbs: Add `visibleItemsOnNarrow` prop to control how many breadcrumb items are shown on narrow viewports (defaults to showing only the previous item as a back link).
|
|
10
|
-
|
|
11
9
|
### Patch Changes
|
|
12
10
|
|
|
13
11
|
- [#7738](https://github.com/primer/react/pull/7738) [`f5f2869`](https://github.com/primer/react/commit/f5f28691d9e5c9f8495e8c592635d2b616f7cb49) Thanks [@francinelucca](https://github.com/francinelucca)! - ActionMenu, Table: Fix component mutation issue where `Object.assign` was modifying original `@primer/react` components. Now uses wrapper components to avoid side effects.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
.prc-Breadcrumbs-BreadcrumbsBase-3Gb-B{display:flex;justify-content:space-between;width:100%}.prc-Breadcrumbs-BreadcrumbsList-BKjpe{margin-bottom:0;margin-top:0;padding-left:0}:is([data-overflow=menu],[data-overflow=menu-with-root]) .prc-Breadcrumbs-BreadcrumbsList-BKjpe{display:flex;flex-direction:row;white-space:nowrap}.prc-Breadcrumbs-ItemSeparator-kjXqh{align-self:center;color:var(--fgColor-muted,var(--color-fg-muted));display:flex;justify-content:center;-webkit-user-select:none;user-select:none;white-space:nowrap}.prc-Breadcrumbs-ItemWrapper-k0NLn{list-style:none}.prc-Breadcrumbs-ItemWrapper-k0NLn,.prc-Breadcrumbs-ItemWrapper-k0NLn:after{display:inline-block;font-size:var(--text-body-size-medium,.875rem)}.prc-Breadcrumbs-ItemWrapper-k0NLn:after{border-right:.1em solid var(--fgColor-muted,var(--color-fg-muted));content:"";height:.8em;margin:0 .5em;transform:rotate(15deg) translateY(.0625em)}.prc-Breadcrumbs-ItemWrapper-k0NLn:first-child{margin-left:0}.prc-Breadcrumbs-ItemWrapper-k0NLn:last-child:after{content:none}.prc-Breadcrumbs-Item-jcraJ{display:inline-block;font-size:var(--text-body-size-medium,.875rem)}.prc-Breadcrumbs-Item-jcraJ:focus-visible{border-radius:var(--borderRadius-small,.1875rem);box-shadow:none;outline:2px solid var(--focus-outlineColor,var(--color-accent-fg));outline-offset:2px}[data-variant=normal] .prc-Breadcrumbs-Item-jcraJ{color:var(--fgColor-link,var(--color-accent-fg));-webkit-text-decoration:none;text-decoration:none}:is([data-variant=normal] .prc-Breadcrumbs-Item-jcraJ):not([aria-current]):hover{-webkit-text-decoration:underline;text-decoration:underline}:is([data-variant=normal] .prc-Breadcrumbs-Item-jcraJ):focus-visible{-webkit-text-decoration:none;text-decoration:none}[aria-current]:is([data-variant=normal] .prc-Breadcrumbs-Item-jcraJ){color:var(--fgColor-default,var(--color-fg-default))}[data-variant=spacious] .prc-Breadcrumbs-Item-jcraJ{border-radius:var(--borderRadius-medium,.375rem);color:var(--fgColor-default,var(--color-fg-default));padding-block:var(--base-size-4,.25rem);padding-inline:var(--base-size-6,.375rem);-webkit-text-decoration:none;text-decoration:none}:is([data-variant=spacious] .prc-Breadcrumbs-Item-jcraJ):hover{background:var(--control-transparent-bgColor-hover,var(--color-action-list-item-default-hover-bg));-webkit-text-decoration:none;text-decoration:none}[aria-current]:is([data-variant=spacious] .prc-Breadcrumbs-Item-jcraJ){font-weight:var(--base-text-weight-semibold,600)}.prc-Breadcrumbs-BreadcrumbsItem-L-Xrs{align-items:center;display:inline-grid;flex:0 99999 auto;grid-auto-flow:column;list-style:none;min-width:auto;white-space:nowrap}.prc-Breadcrumbs-BreadcrumbsItem-L-Xrs:has(.prc-Breadcrumbs-MenuOverlay--ayLx){white-space:normal}.prc-Breadcrumbs-BreadcrumbsItem-L-Xrs:first-child{margin-left:0}.prc-Breadcrumbs-BreadcrumbsItem-L-Xrs:last-child .prc-Breadcrumbs-ItemSeparator-kjXqh{display:none}.prc-Breadcrumbs-BreadcrumbsItem-L-Xrs .prc-Breadcrumbs-MenuDetails-JOGTj{display:inline-block;position:relative}:is(.prc-Breadcrumbs-BreadcrumbsItem-L-Xrs .prc-Breadcrumbs-MenuDetails-JOGTj) summary{cursor:pointer;list-style:none}:is(:is(.prc-Breadcrumbs-BreadcrumbsItem-L-Xrs .prc-Breadcrumbs-MenuDetails-JOGTj) summary)::-webkit-details-marker{display:none}.prc-Breadcrumbs-BreadcrumbsItem-L-Xrs .prc-Breadcrumbs-MenuOverlay--ayLx{background-color:var(--overlay-bgColor,var(--color-canvas-overlay));border-radius:var(--borderRadius-large,.75rem);box-shadow:var(--shadow-floating-small,var(--color-overlay-shadow));max-height:100vh;max-width:var(--overlay-width-small,20rem);min-width:var(--overlay-width-xsmall,12rem);overflow:hidden;position:absolute;top:calc(var(--overlay-offset,.25rem) + var(--control-small-size,1.75rem));z-index:1}@media (prefers-reduced-motion:no-preference){.prc-Breadcrumbs-BreadcrumbsItem-L-Xrs .prc-Breadcrumbs-MenuOverlay--ayLx{animation:prc-Breadcrumbs-overlay-appear-CSLnF .2s cubic-bezier(.33,1,.68,1)}}
|
|
2
|
-
/*# sourceMappingURL=Breadcrumbs-
|
|
1
|
+
.prc-Breadcrumbs-BreadcrumbsBase-3Gb-B{display:flex;justify-content:space-between;width:100%}.prc-Breadcrumbs-BreadcrumbsList-BKjpe{margin-bottom:0;margin-top:0;padding-left:0}:is([data-overflow=menu],[data-overflow=menu-with-root]) .prc-Breadcrumbs-BreadcrumbsList-BKjpe{display:flex;flex-direction:row;white-space:nowrap}.prc-Breadcrumbs-ItemSeparator-kjXqh{align-self:center;color:var(--fgColor-muted,var(--color-fg-muted));display:flex;justify-content:center;-webkit-user-select:none;user-select:none;white-space:nowrap}.prc-Breadcrumbs-ItemWrapper-k0NLn{list-style:none}.prc-Breadcrumbs-ItemWrapper-k0NLn,.prc-Breadcrumbs-ItemWrapper-k0NLn:after{display:inline-block;font-size:var(--text-body-size-medium,.875rem)}.prc-Breadcrumbs-ItemWrapper-k0NLn:after{border-right:.1em solid var(--fgColor-muted,var(--color-fg-muted));content:"";height:.8em;margin:0 .5em;transform:rotate(15deg) translateY(.0625em)}.prc-Breadcrumbs-ItemWrapper-k0NLn:first-child{margin-left:0}.prc-Breadcrumbs-ItemWrapper-k0NLn:last-child:after{content:none}.prc-Breadcrumbs-Item-jcraJ{display:inline-block;font-size:var(--text-body-size-medium,.875rem)}.prc-Breadcrumbs-Item-jcraJ:focus-visible{border-radius:var(--borderRadius-small,.1875rem);box-shadow:none;outline:2px solid var(--focus-outlineColor,var(--color-accent-fg));outline-offset:2px}[data-variant=normal] .prc-Breadcrumbs-Item-jcraJ{color:var(--fgColor-link,var(--color-accent-fg));-webkit-text-decoration:none;text-decoration:none}:is([data-variant=normal] .prc-Breadcrumbs-Item-jcraJ):not([aria-current]):hover{-webkit-text-decoration:underline;text-decoration:underline}:is([data-variant=normal] .prc-Breadcrumbs-Item-jcraJ):focus-visible{-webkit-text-decoration:none;text-decoration:none}[aria-current]:is([data-variant=normal] .prc-Breadcrumbs-Item-jcraJ){color:var(--fgColor-default,var(--color-fg-default))}[data-variant=spacious] .prc-Breadcrumbs-Item-jcraJ{border-radius:var(--borderRadius-medium,.375rem);color:var(--fgColor-default,var(--color-fg-default));padding-block:var(--base-size-4,.25rem);padding-inline:var(--base-size-6,.375rem);-webkit-text-decoration:none;text-decoration:none}:is([data-variant=spacious] .prc-Breadcrumbs-Item-jcraJ):hover{background:var(--control-transparent-bgColor-hover,var(--color-action-list-item-default-hover-bg));-webkit-text-decoration:none;text-decoration:none}[aria-current]:is([data-variant=spacious] .prc-Breadcrumbs-Item-jcraJ){font-weight:var(--base-text-weight-semibold,600)}.prc-Breadcrumbs-BreadcrumbsItem-L-Xrs{align-items:center;display:inline-grid;flex:0 99999 auto;grid-auto-flow:column;list-style:none;min-width:auto;white-space:nowrap}.prc-Breadcrumbs-BreadcrumbsItem-L-Xrs:has(.prc-Breadcrumbs-MenuOverlay--ayLx){white-space:normal}.prc-Breadcrumbs-BreadcrumbsItem-L-Xrs:first-child{margin-left:0}.prc-Breadcrumbs-BreadcrumbsItem-L-Xrs:last-child .prc-Breadcrumbs-ItemSeparator-kjXqh{display:none}.prc-Breadcrumbs-BreadcrumbsItem-L-Xrs .prc-Breadcrumbs-MenuDetails-JOGTj{display:inline-block;position:relative}:is(.prc-Breadcrumbs-BreadcrumbsItem-L-Xrs .prc-Breadcrumbs-MenuDetails-JOGTj) summary{cursor:pointer;list-style:none}:is(:is(.prc-Breadcrumbs-BreadcrumbsItem-L-Xrs .prc-Breadcrumbs-MenuDetails-JOGTj) summary)::-webkit-details-marker{display:none}.prc-Breadcrumbs-BreadcrumbsItem-L-Xrs .prc-Breadcrumbs-MenuOverlay--ayLx{background-color:var(--overlay-bgColor,var(--color-canvas-overlay));border-radius:var(--borderRadius-large,.75rem);box-shadow:var(--shadow-floating-small,var(--color-overlay-shadow));max-height:100vh;max-width:var(--overlay-width-small,20rem);min-width:var(--overlay-width-xsmall,12rem);overflow:hidden;position:absolute;top:calc(var(--overlay-offset,.25rem) + var(--control-small-size,1.75rem));z-index:1}@media (prefers-reduced-motion:no-preference){.prc-Breadcrumbs-BreadcrumbsItem-L-Xrs .prc-Breadcrumbs-MenuOverlay--ayLx{animation:prc-Breadcrumbs-overlay-appear-CSLnF .2s cubic-bezier(.33,1,.68,1)}}
|
|
2
|
+
/*# sourceMappingURL=Breadcrumbs-dbfc9d95.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/Breadcrumbs/Breadcrumbs.module.css.js","../../postcss-preset-primer/src/mixins/focusOutline.css"],"names":[],"mappings":"AAAA,uCACE,YAAa,CACb,6BAA8B,CAC9B,UACF,CAEA,uCAGE,eAAgB,CADhB,YAAa,CADb,cAGF,CAIE,gGAEE,YAAa,CACb,kBAAmB,CAFnB,kBAGF,CAGF,qCAGE,iBAAkB,CAFlB,gDAA2B,CAC3B,YAAa,CAEb,sBAAuB,CAEvB,wBAAiB,CAAjB,gBAAiB,CADjB,kBAEF,CAEA,mCAGE,eAuBF,CArBE,4EAJA,oBAAqB,CACrB,8CAaA,CAVA,yCAQE,kEAA8C,CAF9C,UAAW,CAJX,WAAa,CAEb,aAAe,CAKf,2CACF,CAEA,+CACE,aACF,CAGE,oDACE,YACF,CAIJ,4BACE,oBAAqB,CACrB,8CAOF,CALE,0CACE,gDAAwC,CC5D1C,eAAgB,CAFhB,kEAAgC,CAChC,kBDgEA,CAIA,kDACE,gDAA0B,CAC1B,4BAAqB,CAArB,oBAeF,CAZI,iFACE,iCAA0B,CAA1B,yBACF,CAGF,qEACE,4BAAqB,CAArB,oBACF,CAEA,qEACE,oDACF,CAKF,oDAKE,gDAAyC,CAJzC,oDAA6B,CAG7B,uCAAiC,CADjC,yCAAkC,CADlC,4BAAqB,CAArB,oBAaF,CARE,+DACE,kGAAoD,CACpD,4BAAqB,CAArB,oBACF,CAEA,uEACE,gDACF,CAIJ,uCAGE,kBAAmB,CAFnB,mBAAoB,CAGpB,iBAAkB,CAFlB,qBAAsB,CAKtB,eAAgB,CAFhB,cAAe,CACf,kBAiDF,CA7CE,+EACE,kBACF,CAEA,mDACE,aACF,CAGE,uFACE,YACF,CAGF,0EAEE,oBAAqB,CADrB,iBAWF,CARE,uFAEE,cAAe,CADf,eAMF,CAHE,oHACE,YACF,CAIJ,0EAKE,mEAAwC,CADxC,8CAAwC,CADxC,mEAAwC,CAIxC,gBAAiB,CACjB,0CAAqC,CAFrC,2CAAsC,CAGtC,eAAgB,CARhB,iBAAkB,CAUlB,0EAA4D,CAT5D,SAcF,CAHE,8CAbF,0EAcI,4EAEJ,CADE","file":"Breadcrumbs-dbfc9d95.css","sourcesContent":[".BreadcrumbsBase {\n display: flex;\n justify-content: space-between;\n width: 100%;\n}\n\n.BreadcrumbsList {\n padding-left: 0;\n margin-top: 0;\n margin-bottom: 0;\n}\n\n[data-overflow='menu'],\n[data-overflow='menu-with-root'] {\n & .BreadcrumbsList {\n white-space: nowrap;\n display: flex;\n flex-direction: row;\n }\n}\n\n.ItemSeparator {\n color: var(--fgColor-muted);\n display: flex;\n align-self: center;\n justify-content: center;\n white-space: nowrap;\n user-select: none;\n}\n\n.ItemWrapper {\n display: inline-block;\n font-size: var(--text-body-size-medium);\n list-style: none;\n\n &::after {\n display: inline-block;\n height: 0.8em;\n /* stylelint-disable-next-line primer/spacing */\n margin: 0 0.5em;\n font-size: var(--text-body-size-medium);\n content: '';\n /* stylelint-disable-next-line primer/borders, primer/colors */\n border-right: 0.1em solid var(--fgColor-muted);\n transform: rotate(15deg) translateY(0.0625em);\n }\n\n &:first-child {\n margin-left: 0;\n }\n\n &:last-child {\n &::after {\n content: none;\n }\n }\n}\n\n.Item {\n display: inline-block;\n font-size: var(--text-body-size-medium);\n\n &:focus-visible {\n border-radius: var(--borderRadius-small);\n\n @mixin focusOutline 2px;\n }\n}\n\n[data-variant='normal'] {\n & .Item {\n color: var(--fgColor-link);\n text-decoration: none;\n\n &:not([aria-current]) {\n &:hover {\n text-decoration: underline;\n }\n }\n\n &:focus-visible {\n text-decoration: none;\n }\n\n &[aria-current] {\n color: var(--fgColor-default);\n }\n }\n}\n\n[data-variant='spacious'] {\n & .Item {\n color: var(--fgColor-default);\n text-decoration: none;\n padding-inline: var(--base-size-6);\n padding-block: var(--base-size-4);\n border-radius: var(--borderRadius-medium);\n\n &:hover {\n background: var(--control-transparent-bgColor-hover);\n text-decoration: none;\n }\n\n &[aria-current] {\n font-weight: var(--base-text-weight-semibold);\n }\n }\n}\n\n.BreadcrumbsItem {\n display: inline-grid;\n grid-auto-flow: column;\n align-items: center;\n flex: 0 99999 auto;\n min-width: auto;\n white-space: nowrap;\n list-style: none;\n\n /* allow menu items to wrap line */\n &:has(.MenuOverlay) {\n white-space: normal;\n }\n\n &:first-child {\n margin-left: 0;\n }\n\n &:last-child {\n .ItemSeparator {\n display: none;\n }\n }\n\n .MenuDetails {\n position: relative;\n display: inline-block;\n\n & summary {\n list-style: none;\n cursor: pointer;\n\n &::-webkit-details-marker {\n display: none;\n }\n }\n }\n\n .MenuOverlay {\n position: absolute;\n z-index: 1;\n box-shadow: var(--shadow-floating-small);\n border-radius: var(--borderRadius-large);\n background-color: var(--overlay-bgColor);\n min-width: var(--overlay-width-xsmall);\n max-height: 100vh;\n max-width: var(--overlay-width-small);\n overflow: hidden;\n /* stylelint-disable-next-line primer/spacing */\n top: calc(var(--overlay-offset) + var(--control-small-size));\n\n @media (prefers-reduced-motion: no-preference) {\n animation: overlay-appear 200ms cubic-bezier(0.33, 1, 0.68, 1);\n }\n }\n}\n","@define-mixin focusOutline $outlineOffset: -2px, $outlineColor: var(--focus-outlineColor) {\n outline: 2px solid $outlineColor;\n outline-offset: $outlineOffset;\n box-shadow: none;\n}\n"]}
|
|
@@ -23,15 +23,8 @@ export type BreadcrumbsProps = React.PropsWithChildren<{
|
|
|
23
23
|
* Allows passing of CSS custom properties to the breadcrumbs container.
|
|
24
24
|
*/
|
|
25
25
|
style?: React.CSSProperties;
|
|
26
|
-
/**
|
|
27
|
-
* The number of breadcrumb items to keep visible on narrow viewports.
|
|
28
|
-
* On small screens, only the N items immediately before the current page
|
|
29
|
-
* are shown (as back-navigation links). The current page itself is hidden.
|
|
30
|
-
* @default 1
|
|
31
|
-
*/
|
|
32
|
-
visibleItemsOnNarrow?: number;
|
|
33
26
|
}>;
|
|
34
|
-
declare function Breadcrumbs({ className, children, style, overflow, variant
|
|
27
|
+
declare function Breadcrumbs({ className, children, style, overflow, variant }: BreadcrumbsProps): React.JSX.Element;
|
|
35
28
|
declare namespace Breadcrumbs {
|
|
36
29
|
var displayName: string;
|
|
37
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Breadcrumbs.d.ts","sourceRoot":"","sources":["../../src/Breadcrumbs/Breadcrumbs.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,EAAE,EAAC,MAAM,SAAS,CAAA;AAC/B,OAAO,KAA6E,MAAM,OAAO,CAAA;AAWjG,OAAO,EAAC,KAAK,gBAAgB,EAAkB,MAAM,6BAA6B,CAAA;AAElF,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,iBAAiB,CAAC;IACrD;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,gBAAgB,CAAA;IAC7C;;;;OAIG;IACH,OAAO,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAA;IAC/B;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"Breadcrumbs.d.ts","sourceRoot":"","sources":["../../src/Breadcrumbs/Breadcrumbs.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,EAAE,EAAC,MAAM,SAAS,CAAA;AAC/B,OAAO,KAA6E,MAAM,OAAO,CAAA;AAWjG,OAAO,EAAC,KAAK,gBAAgB,EAAkB,MAAM,6BAA6B,CAAA;AAElF,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,iBAAiB,CAAC;IACrD;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,gBAAgB,CAAA;IAC7C;;;;OAIG;IACH,OAAO,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAA;IAC/B;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;CAC5B,CAAC,CAAA;AA8GF,iBAAS,WAAW,CAAC,EAAC,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAiB,EAAE,OAAkB,EAAC,EAAE,gBAAgB,qBA+MzG;kBA/MQ,WAAW;;;AA2NpB,KAAK,0BAA0B,CAAC,EAAE,SAAS,KAAK,CAAC,WAAW,GAAG,GAAG,IAAI,gBAAgB,CACpF,EAAE,EACF,GAAG,EACH;IACE,EAAE,CAAC,EAAE,EAAE,CAAA;IACP,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CACF,CAAA;AAsBD,MAAM,MAAM,oBAAoB,CAAC,EAAE,SAAS,KAAK,CAAC,WAAW,GAAG,GAAG,IAAI,0BAA0B,CAAC,EAAE,CAAC,CAAA;;YAnBlG,EAAE,SAAS,KAAK,CAAC,WAAW;aANtB,EAAE;mBACI,OAAO;;aADb,EAAE;mBACI,OAAO;;;;;;;AA2BtB,wBAAiF;AAEjF;;GAEG;AACH,eAAO,MAAM,UAAU;WA3BpB,EAAE,SAAS,KAAK,CAAC,WAAW;aANtB,EAAE;mBACI,OAAO;;aADb,EAAE;mBACI,OAAO;;;;CAgCuD,CAAA;AAE7E;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,gBAAgB,CAAA;AAE9C;;GAEG;AACH,MAAM,MAAM,mBAAmB,CAAC,EAAE,SAAS,KAAK,CAAC,WAAW,GAAG,GAAG,IAAI,oBAAoB,CAAC,EAAE,CAAC,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { c } from 'react-compiler-runtime';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
|
-
import React, { useRef,
|
|
3
|
+
import React, { useRef, useCallback, useState, useMemo, useEffect } from 'react';
|
|
4
4
|
import classes from './Breadcrumbs.module.css.js';
|
|
5
5
|
import { ActionList } from '../ActionList/index.js';
|
|
6
6
|
import { IconButton } from '../Button/IconButton.js';
|
|
@@ -206,34 +206,19 @@ const getValidChildren = children => {
|
|
|
206
206
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
207
207
|
return React.Children.toArray(children).filter(child => /*#__PURE__*/React.isValidElement(child));
|
|
208
208
|
};
|
|
209
|
-
function wrapItemsWithNarrowAttrs(children, visibleCountOnNarrow) {
|
|
210
|
-
const validChildren = React.Children.toArray(children).filter(child => /*#__PURE__*/React.isValidElement(child));
|
|
211
|
-
return validChildren.map((child, index) => {
|
|
212
|
-
const applyNarrow = validChildren.length > 1;
|
|
213
|
-
const isLast = index === validChildren.length - 1;
|
|
214
|
-
const isVisibleOnNarrow = applyNarrow && index >= validChildren.length - 1 - visibleCountOnNarrow && !isLast;
|
|
215
|
-
const isLastVisibleOnNarrow = applyNarrow && index === validChildren.length - 2;
|
|
216
|
-
return /*#__PURE__*/jsx("li", {
|
|
217
|
-
className: classes.ItemWrapper,
|
|
218
|
-
"data-narrow-hidden": isVisibleOnNarrow ? undefined : applyNarrow ? '' : undefined,
|
|
219
|
-
"data-narrow-last": isLastVisibleOnNarrow ? '' : undefined,
|
|
220
|
-
children: child
|
|
221
|
-
}, index);
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
209
|
function Breadcrumbs({
|
|
225
210
|
className,
|
|
226
211
|
children,
|
|
227
212
|
style,
|
|
228
213
|
overflow = 'wrap',
|
|
229
|
-
variant = 'normal'
|
|
230
|
-
visibleItemsOnNarrow = 1
|
|
214
|
+
variant = 'normal'
|
|
231
215
|
}) {
|
|
232
216
|
const overflowMenuEnabled = useFeatureFlag('primer_react_breadcrumbs_overflow_menu');
|
|
217
|
+
const wrappedChildren = React.Children.map(children, child => /*#__PURE__*/jsx("li", {
|
|
218
|
+
className: classes.ItemWrapper,
|
|
219
|
+
children: child
|
|
220
|
+
}));
|
|
233
221
|
const containerRef = useRef(null);
|
|
234
|
-
const childArray = useMemo(() => getValidChildren(children), [children]);
|
|
235
|
-
const visibleCountOnNarrow = Math.max(1, Math.min(visibleItemsOnNarrow, childArray.length - 1));
|
|
236
|
-
const wrappedChildren = wrapItemsWithNarrowAttrs(children, visibleCountOnNarrow);
|
|
237
222
|
const measureMenuButton = useCallback(element => {
|
|
238
223
|
if (element) {
|
|
239
224
|
const iconButtonElement = element.querySelector('button[data-component="IconButton"]');
|
|
@@ -246,6 +231,7 @@ function Breadcrumbs({
|
|
|
246
231
|
}, []);
|
|
247
232
|
const hideRoot = !(overflow === 'menu-with-root');
|
|
248
233
|
const [effectiveHideRoot, setEffectiveHideRoot] = useState(hideRoot);
|
|
234
|
+
const childArray = useMemo(() => getValidChildren(children), [children]);
|
|
249
235
|
const rootItem = childArray[0];
|
|
250
236
|
|
|
251
237
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -262,7 +248,7 @@ function Breadcrumbs({
|
|
|
262
248
|
const listElement = (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.querySelector('ol');
|
|
263
249
|
if (overflowMenuEnabled && listElement && listElement.children.length > 0 && listElement.children.length === childArray.length) {
|
|
264
250
|
const listElementArray = Array.from(listElement.children);
|
|
265
|
-
const widths = listElementArray.map(
|
|
251
|
+
const widths = listElementArray.map(child_0 => child_0.offsetWidth);
|
|
266
252
|
setChildArrayWidths(widths);
|
|
267
253
|
setRootItemWidth(listElementArray[0].offsetWidth);
|
|
268
254
|
}
|
|
@@ -335,7 +321,10 @@ function Breadcrumbs({
|
|
|
335
321
|
const finalChildren = React.useMemo(() => {
|
|
336
322
|
if (overflowMenuEnabled) {
|
|
337
323
|
if (overflow === 'wrap' || menuItems.length === 0) {
|
|
338
|
-
return
|
|
324
|
+
return React.Children.map(children, child_1 => /*#__PURE__*/jsx("li", {
|
|
325
|
+
className: classes.ItemWrapper,
|
|
326
|
+
children: child_1
|
|
327
|
+
}));
|
|
339
328
|
}
|
|
340
329
|
let effectiveMenuItems = [...menuItems];
|
|
341
330
|
// In 'menu-with-root' mode, include the root item inside the menu even if it's visible in the breadcrumbs
|
|
@@ -350,9 +339,9 @@ function Breadcrumbs({
|
|
|
350
339
|
"aria-label": `${effectiveMenuItems.length} more breadcrumb items`
|
|
351
340
|
}), /*#__PURE__*/jsx(ItemSeparator, {})]
|
|
352
341
|
}, "breadcrumbs-menu");
|
|
353
|
-
const visibleElements = visibleItems.map((
|
|
342
|
+
const visibleElements = visibleItems.map((child_2, index) => /*#__PURE__*/jsxs("li", {
|
|
354
343
|
className: classes.BreadcrumbsItem,
|
|
355
|
-
children: [
|
|
344
|
+
children: [child_2, /*#__PURE__*/jsx(ItemSeparator, {})]
|
|
356
345
|
}, `visible + ${index}`));
|
|
357
346
|
const rootElement = /*#__PURE__*/jsxs("li", {
|
|
358
347
|
className: classes.BreadcrumbsItem,
|
|
@@ -366,7 +355,7 @@ function Breadcrumbs({
|
|
|
366
355
|
return [rootElement, menuElement, ...visibleElements];
|
|
367
356
|
}
|
|
368
357
|
}
|
|
369
|
-
}, [overflowMenuEnabled, overflow, menuItems, effectiveHideRoot, measureMenuButton, visibleItems, rootItem, children
|
|
358
|
+
}, [overflowMenuEnabled, overflow, menuItems, effectiveHideRoot, measureMenuButton, visibleItems, rootItem, children]);
|
|
370
359
|
return overflowMenuEnabled ? /*#__PURE__*/jsx("nav", {
|
|
371
360
|
className: clsx(className, classes.BreadcrumbsBase),
|
|
372
361
|
"aria-label": "Breadcrumbs",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import './Breadcrumbs-
|
|
1
|
+
import './Breadcrumbs-dbfc9d95.css';
|
|
2
2
|
|
|
3
3
|
var classes = {"BreadcrumbsBase":"prc-Breadcrumbs-BreadcrumbsBase-3Gb-B","BreadcrumbsList":"prc-Breadcrumbs-BreadcrumbsList-BKjpe","ItemSeparator":"prc-Breadcrumbs-ItemSeparator-kjXqh","ItemWrapper":"prc-Breadcrumbs-ItemWrapper-k0NLn","Item":"prc-Breadcrumbs-Item-jcraJ","BreadcrumbsItem":"prc-Breadcrumbs-BreadcrumbsItem-L-Xrs","MenuOverlay":"prc-Breadcrumbs-MenuOverlay--ayLx","MenuDetails":"prc-Breadcrumbs-MenuDetails-JOGTj","overlay-appear":"prc-Breadcrumbs-overlay-appear-CSLnF"};
|
|
4
4
|
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/Breadcrumbs/Breadcrumbs.module.css.js","../../postcss-preset-primer/src/mixins/focusOutline.css"],"names":[],"mappings":"AAAA,uCACE,YAAa,CACb,6BAA8B,CAC9B,UACF,CAEA,uCAGE,eAAgB,CADhB,YAAa,CADb,cAGF,CAIE,gGAEE,YAAa,CACb,kBAAmB,CAFnB,kBAGF,CAGF,qCAGE,iBAAkB,CAFlB,gDAA2B,CAC3B,YAAa,CAEb,sBAAuB,CAEvB,wBAAiB,CAAjB,gBAAiB,CADjB,kBAEF,CAEA,mCAGE,eAuBF,CArBE,4EAJA,oBAAqB,CACrB,8CAaA,CAVA,yCAQE,kEAA8C,CAF9C,UAAW,CAJX,WAAa,CAEb,aAAe,CAKf,2CACF,CAEA,+CACE,aACF,CAGE,oDACE,YACF,CAIJ,4BACE,oBAAqB,CACrB,8CAOF,CALE,0CACE,gDAAwC,CC5D1C,eAAgB,CAFhB,kEAAgC,CAChC,kBDgEA,CAIA,kDACE,gDAA0B,CAC1B,4BAAqB,CAArB,oBAeF,CAZI,iFACE,iCAA0B,CAA1B,yBACF,CAGF,qEACE,4BAAqB,CAArB,oBACF,CAEA,qEACE,oDACF,CAKF,oDAKE,gDAAyC,CAJzC,oDAA6B,CAG7B,uCAAiC,CADjC,yCAAkC,CADlC,4BAAqB,CAArB,oBAaF,CARE,+DACE,kGAAoD,CACpD,4BAAqB,CAArB,oBACF,CAEA,uEACE,gDACF,CAIJ,uCAGE,kBAAmB,CAFnB,mBAAoB,CAGpB,iBAAkB,CAFlB,qBAAsB,CAKtB,eAAgB,CAFhB,cAAe,CACf,kBAiDF,CA7CE,+EACE,kBACF,CAEA,mDACE,aACF,CAGE,uFACE,YACF,CAGF,0EAEE,oBAAqB,CADrB,iBAWF,CARE,uFAEE,cAAe,CADf,eAMF,CAHE,oHACE,YACF,CAIJ,0EAKE,mEAAwC,CADxC,8CAAwC,CADxC,mEAAwC,CAIxC,gBAAiB,CACjB,0CAAqC,CAFrC,2CAAsC,CAGtC,eAAgB,CARhB,iBAAkB,CAUlB,0EAA4D,CAT5D,SAcF,CAHE,8CAbF,0EAcI,4EAEJ,CADE,CAKJ,uCACE,uDACE,YACF,CAIE,2DACE,YACF,CAEJ","file":"Breadcrumbs-a44d6835.css","sourcesContent":[".BreadcrumbsBase {\n display: flex;\n justify-content: space-between;\n width: 100%;\n}\n\n.BreadcrumbsList {\n padding-left: 0;\n margin-top: 0;\n margin-bottom: 0;\n}\n\n[data-overflow='menu'],\n[data-overflow='menu-with-root'] {\n & .BreadcrumbsList {\n white-space: nowrap;\n display: flex;\n flex-direction: row;\n }\n}\n\n.ItemSeparator {\n color: var(--fgColor-muted);\n display: flex;\n align-self: center;\n justify-content: center;\n white-space: nowrap;\n user-select: none;\n}\n\n.ItemWrapper {\n display: inline-block;\n font-size: var(--text-body-size-medium);\n list-style: none;\n\n &::after {\n display: inline-block;\n height: 0.8em;\n /* stylelint-disable-next-line primer/spacing */\n margin: 0 0.5em;\n font-size: var(--text-body-size-medium);\n content: '';\n /* stylelint-disable-next-line primer/borders, primer/colors */\n border-right: 0.1em solid var(--fgColor-muted);\n transform: rotate(15deg) translateY(0.0625em);\n }\n\n &:first-child {\n margin-left: 0;\n }\n\n &:last-child {\n &::after {\n content: none;\n }\n }\n}\n\n.Item {\n display: inline-block;\n font-size: var(--text-body-size-medium);\n\n &:focus-visible {\n border-radius: var(--borderRadius-small);\n\n @mixin focusOutline 2px;\n }\n}\n\n[data-variant='normal'] {\n & .Item {\n color: var(--fgColor-link);\n text-decoration: none;\n\n &:not([aria-current]) {\n &:hover {\n text-decoration: underline;\n }\n }\n\n &:focus-visible {\n text-decoration: none;\n }\n\n &[aria-current] {\n color: var(--fgColor-default);\n }\n }\n}\n\n[data-variant='spacious'] {\n & .Item {\n color: var(--fgColor-default);\n text-decoration: none;\n padding-inline: var(--base-size-6);\n padding-block: var(--base-size-4);\n border-radius: var(--borderRadius-medium);\n\n &:hover {\n background: var(--control-transparent-bgColor-hover);\n text-decoration: none;\n }\n\n &[aria-current] {\n font-weight: var(--base-text-weight-semibold);\n }\n }\n}\n\n.BreadcrumbsItem {\n display: inline-grid;\n grid-auto-flow: column;\n align-items: center;\n flex: 0 99999 auto;\n min-width: auto;\n white-space: nowrap;\n list-style: none;\n\n /* allow menu items to wrap line */\n &:has(.MenuOverlay) {\n white-space: normal;\n }\n\n &:first-child {\n margin-left: 0;\n }\n\n &:last-child {\n .ItemSeparator {\n display: none;\n }\n }\n\n .MenuDetails {\n position: relative;\n display: inline-block;\n\n & summary {\n list-style: none;\n cursor: pointer;\n\n &::-webkit-details-marker {\n display: none;\n }\n }\n }\n\n .MenuOverlay {\n position: absolute;\n z-index: 1;\n box-shadow: var(--shadow-floating-small);\n border-radius: var(--borderRadius-large);\n background-color: var(--overlay-bgColor);\n min-width: var(--overlay-width-xsmall);\n max-height: 100vh;\n max-width: var(--overlay-width-small);\n overflow: hidden;\n /* stylelint-disable-next-line primer/spacing */\n top: calc(var(--overlay-offset) + var(--control-small-size));\n\n @media (prefers-reduced-motion: no-preference) {\n animation: overlay-appear 200ms cubic-bezier(0.33, 1, 0.68, 1);\n }\n }\n}\n\n/* On narrow viewports, hide breadcrumb items marked for narrow hiding */\n@media screen and (max-width: 543.98px) {\n .ItemWrapper[data-narrow-hidden] {\n display: none;\n }\n\n /* Hide the trailing separator on the last visible item on narrow */\n .ItemWrapper[data-narrow-last] {\n &::after {\n content: none;\n }\n }\n}\n","@define-mixin focusOutline $outlineOffset: -2px, $outlineColor: var(--focus-outlineColor) {\n outline: 2px solid $outlineColor;\n outline-offset: $outlineOffset;\n box-shadow: none;\n}\n"]}
|