Skip to content

Fix extra padding on SelectPanel with groups #5869

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
Apr 30, 2025
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
aaf2213
Fix extra padding on SelectPanel with groups
hectahertz Apr 3, 2025
6fd029c
Add changeset
hectahertz Apr 3, 2025
3619723
test(vrt): update snapshots
hectahertz Apr 3, 2025
1e15f2d
test(vrt): update snapshots
hectahertz Apr 3, 2025
f094cca
chore(AvatarStack): Remove the CSS modules feature flag from the Avat…
jonrohan Apr 4, 2025
e753496
Improve docs
hectahertz Apr 4, 2025
eb79cd6
Merge branch 'main' into hectahertz/fix-padding-selectpanel-groups
hectahertz Apr 4, 2025
7195406
test(vrt): update snapshots
hectahertz Apr 4, 2025
c5c69e7
Merge branch 'main' of github.com:primer/react into hectahertz/fix-pa…
francinelucca Apr 25, 2025
fd58467
use variant horizontal-inset when groups are present
francinelucca Apr 25, 2025
d2b4c3c
Merge branch 'main' into hectahertz/fix-padding-selectpanel-groups
francinelucca Apr 25, 2025
beaf255
test(vrt): update snapshots
francinelucca Apr 25, 2025
425dc2d
Revert "test(vrt): update snapshots"
francinelucca Apr 25, 2025
fd01610
Revert "test(vrt): update snapshots"
francinelucca Apr 25, 2025
e0fa86a
fix
francinelucca Apr 25, 2025
f8e265d
Merge branch 'hectahertz/fix-padding-selectpanel-groups' of github.co…
francinelucca Apr 25, 2025
22b3602
Revert "test(vrt): update snapshots"
francinelucca Apr 25, 2025
999b6ed
Revert "test(vrt): update snapshots"
francinelucca Apr 25, 2025
483aa89
Revert "test(vrt): update snapshots"
francinelucca Apr 25, 2025
0ae1b25
Revert "test(vrt): update snapshots"
francinelucca Apr 25, 2025
4bb0fab
Merge branch 'main' into hectahertz/fix-padding-selectpanel-groups
francinelucca Apr 25, 2025
629ce25
test(vrt): update snapshots
francinelucca Apr 25, 2025
e85e0e3
Delete results.json
francinelucca Apr 25, 2025
3ee082c
Merge branch 'main' into hectahertz/fix-padding-selectpanel-groups
francinelucca Apr 25, 2025
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/fresh-lights-wink.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': patch
---

Fix extra padding on SelectPanel with groups
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions packages/react/src/ActionList/ActionList.docs.json
Original file line number Diff line number Diff line change
@@ -15,9 +15,9 @@
},
{
"name": "variant",
"type": "'inset' | 'full'",
"type": "'inset' | 'horizontal-inset' | 'full'",
"defaultValue": "'inset'",
"description": "`inset` children are offset (vertically and horizontally) from list edges. `full` children are flush (vertically and horizontally) with list edges"
"description": "`inset` children are offset (vertically and/or horizontally) from list edges. `full` children are flush (vertically and horizontally) with list edges"
},
{
"name": "selectionVariant",
2 changes: 2 additions & 0 deletions packages/react/src/ActionList/ActionList.module.css
Original file line number Diff line number Diff line change
@@ -13,7 +13,9 @@

&:where([data-variant='inset']) {
padding-block: var(--base-size-8);
}

&:where([data-variant='inset'], [data-variant='horizontal-inset']) {
/* this is only to match default experience */
& .ActionListItem {
margin-inline: var(--base-size-8);
2 changes: 1 addition & 1 deletion packages/react/src/ActionList/ActionList.stories.tsx
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@ Playground.argTypes = {
control: {
type: 'radio',
},
options: ['inset', 'full'],
options: ['inset', 'horizontal-inset', 'full'],
},
selectionVariant: {
control: {
2 changes: 1 addition & 1 deletion packages/react/src/ActionList/Heading.module.css
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
margin-inline-start: var(--base-size-8);
}

&:where([data-list-variant='inset']) {
&:where([data-list-variant='inset'], [data-list-variant='horizontal-inset']) {
/* stylelint-disable-next-line primer/spacing */
margin-inline-start: calc(var(--control-medium-paddingInline-condensed) + var(--base-size-8));
}
4 changes: 2 additions & 2 deletions packages/react/src/ActionList/Item.tsx
Original file line number Diff line number Diff line change
@@ -193,7 +193,7 @@ export const Item = React.forwardRef<HTMLLIElement, ActionListItemProps>(
paddingY: '6px', // custom value off the scale
lineHeight: '16px',
minHeight: 5,
marginX: listVariant === 'inset' ? 2 : 0,
marginX: listVariant === 'inset' || listVariant === 'horizontal-inset' ? 2 : 0,
borderRadius: 2,
transition: 'background 33.333ms linear',
color: getVariantStyles(variant, disabled, inactive || loading).color,
@@ -217,7 +217,7 @@ export const Item = React.forwardRef<HTMLLIElement, ActionListItemProps>(
appearance: 'none',
background: 'unset',
border: 'unset',
width: listVariant === 'inset' ? 'calc(100% - 16px)' : '100%',
width: listVariant === 'inset' || listVariant === 'horizontal-inset' ? 'calc(100% - 16px)' : '100%',
fontFamily: 'unset',
textAlign: 'unset',
marginY: 'unset',
2 changes: 1 addition & 1 deletion packages/react/src/ActionList/shared.ts
Original file line number Diff line number Diff line change
@@ -120,7 +120,7 @@ export type ActionListProps = React.PropsWithChildren<{
/**
* `inset` children are offset (vertically and horizontally) from `List`’s edges, `full` children are flush (vertically and horizontally) with `List` edges
*/
variant?: 'inset' | 'full'
variant?: 'inset' | 'horizontal-inset' | 'full'
/**
* Whether multiple Items or a single Item can be selected.
*/
1 change: 1 addition & 0 deletions packages/react/src/SelectPanel/SelectPanel.tsx
Original file line number Diff line number Diff line change
@@ -608,6 +608,7 @@ function Panel({
onInputRefChanged={onInputRefChanged}
placeholderText={placeholderText}
{...listProps}
variant={listProps.groupMetadata?.length ? 'horizontal-inset' : 'inset'}
role="listbox"
// browsers give aria-labelledby precedence over aria-label so we need to make sure
// we don't accidentally override props.aria-label
2 changes: 1 addition & 1 deletion packages/react/src/deprecated/ActionList/List.tsx
Original file line number Diff line number Diff line change
@@ -62,7 +62,7 @@ export interface ListPropsBase {
* - `"inset"` - `List` children are offset (vertically and horizontally) from `List`’s edges
* - `"full"` - `List` children are flush (vertically and horizontally) with `List` edges
*/
variant?: 'inset' | 'full'
variant?: 'inset' | 'horizontal-inset' | 'full'

/**
* For `Item`s which can be selected, whether `multiple` `Item`s or a `single` `Item` can be selected