Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/css-layers-navigation-composites.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': patch
---

LabelGroup, NavList, SegmentedControl, TreeView, UnderlineNav: Add CSS layer support for component styles
88 changes: 45 additions & 43 deletions packages/react/src/LabelGroup/LabelGroup.module.css
Original file line number Diff line number Diff line change
@@ -1,52 +1,54 @@
.Container {
display: flex;
flex-wrap: nowrap;
gap: var(--base-size-4);
/* stylelint-disable-next-line primer/typography */
line-height: 1;
max-width: 100%;
overflow: hidden;
@layer primer.components.LabelGroup {
.Container {
display: flex;
flex-wrap: nowrap;
gap: var(--base-size-4);
/* stylelint-disable-next-line primer/typography */
line-height: 1;
max-width: 100%;
overflow: hidden;

&:where([data-overflow='inline']) {
flex-wrap: wrap;
}
&:where([data-overflow='inline']) {
flex-wrap: wrap;
}

&:where([data-list]) {
padding-inline-start: 0;
margin-block-start: 0;
margin-block-end: 0;
list-style-type: none;
&:where([data-list]) {
padding-inline-start: 0;
margin-block-start: 0;
margin-block-end: 0;
list-style-type: none;
}
}
}

.ItemWrapper {
display: flex;
align-items: center;
/* This min-height matches the height of the expand/collapse button.
Without it, the labels/tokens will do a slight layout shift when expanded.
This is because the height of the first row will match the token sizes,
but the height of the second row will be the height of the collapse button.
*/
min-height: 28px;
}
.ItemWrapper {
display: flex;
align-items: center;
/* This min-height matches the height of the expand/collapse button.
Without it, the labels/tokens will do a slight layout shift when expanded.
This is because the height of the first row will match the token sizes,
but the height of the second row will be the height of the collapse button.
*/
min-height: 28px;
}

.ItemWrapper--hidden {
order: 9999;
pointer-events: none;
visibility: hidden;
}
.ItemWrapper--hidden {
order: 9999;
pointer-events: none;
visibility: hidden;
}

.OverlayContainer {
align-items: flex-start;
display: flex;
}
.OverlayContainer {
align-items: flex-start;
display: flex;
}

.OverlayInner {
display: flex;
flex-wrap: wrap;
gap: var(--base-size-4);
}
.OverlayInner {
display: flex;
flex-wrap: wrap;
gap: var(--base-size-4);
}

.CloseButton {
flex-shrink: 0;
.CloseButton {
flex-shrink: 0;
}
}
14 changes: 8 additions & 6 deletions packages/react/src/NavList/NavList.module.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
.GroupHeading > a {
color: var(--fgColor-default);
text-decoration: inherit;
}
@layer primer.components.NavList {
.GroupHeading > a {
color: var(--fgColor-default);
text-decoration: inherit;
}

.GroupHeading > a:hover {
text-decoration: underline;
.GroupHeading > a:hover {
text-decoration: underline;
}
}
Loading
Loading