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/cold-parrots-trade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": patch
---

ActionList: With inline descriptions, long titles and descriptions no longer wrap. Description is truncated to keep in a single row.
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: 4 additions & 0 deletions e2e/components/SelectPanel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ const scenarios = matrix({
id: 'components-selectpanel-dev--with-css',
name: 'With Css',
},
{
id: 'components-selectpanel-examples--with-long-titles',
name: 'With Long Titles',
},
],
})

Expand Down
5 changes: 5 additions & 0 deletions packages/react/src/ActionList/ActionList.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,7 @@ default block */
font-weight: var(--base-text-weight-semibold);
/* stylelint-disable-next-line declaration-property-value-keyword-no-deprecated */
word-break: break-word;
flex-shrink: 0;
}

/* inline */
Expand All @@ -640,6 +641,7 @@ default block */

& .ItemLabel {
word-break: normal;
flex-shrink: 0;
}

&:has([data-truncate='true']) {
Expand All @@ -654,6 +656,9 @@ default block */
/* line-height: calc(var(--control-medium-lineBoxHeight) - var(--base-size-2)); */
/* stylelint-disable-next-line primer/typography */
line-height: 16px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
}
Expand Down
48 changes: 48 additions & 0 deletions packages/react/src/SelectPanel/SelectPanel.examples.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import styles from './SelectPanel.examples.stories.module.css'
import {useVirtualizer, type VirtualItem} from '@tanstack/react-virtual'
import Checkbox from '../Checkbox'
import Label from '../Label'
import Avatar from '../Avatar'

const meta: Meta<typeof SelectPanel> = {
title: 'Components/SelectPanel/Examples',
Expand Down Expand Up @@ -731,3 +732,50 @@ export const Virtualized = () => {
</form>
)
}

const longNamedUsers: ItemInput[] = [
{login: 'pksjce', name: 'Pavithra Kodmad'},
{login: 'colebemis', name: 'Cole Bemis'},
{login: 'mperrotti', name: 'Mike Perrotti'},
{login: 'langermank', name: 'Katie Langerman'},
{login: 'siddharthkp', name: 'Siddharth Kshetrapal'},
{login: 'siddharthkp', name: 'Siddharth NoMiddleName Kshetrapal'},
{login: 'siddharth-kshetrapal', name: 'Siddharth Kshetrapal'},
{login: 'siddharth-kshetrapal', name: 'Siddharth NoMiddleName Kshetrapal'},
].map(user => ({
...user,
id: user.login,
text: user.login,
description: user.name,
leadingVisual: () => <Avatar src="https://github.com/primer.png" size={16} />,
}))

export const WithLongTitles = () => {
const [selected, setSelected] = useState<ItemInput[]>([])
const [filter, setFilter] = useState('')
const filteredItems = longNamedUsers.filter(item => item.text?.toLowerCase().startsWith(filter.toLowerCase()))

const [open, setOpen] = useState(false)

return (
<FormControl>
<FormControl.Label>Assignees</FormControl.Label>
<SelectPanel
title="Select assignees"
placeholder="Select assignees" // button text when no items are selected
renderAnchor={({children, ...anchorProps}) => (
<Button trailingAction={TriangleDownIcon} {...anchorProps} aria-haspopup="dialog">
{children}
</Button>
)}
open={open}
onOpenChange={setOpen}
items={filteredItems}
selected={selected}
onSelectedChange={setSelected}
onFilterChange={setFilter}
width="medium"
/>
</FormControl>
)
}
Loading