Skip to content

Commit 95c23ac

Browse files
authored
update SelectPanel default empty state message (#6373)
1 parent 82e9237 commit 95c23ac

File tree

6 files changed

+13
-12
lines changed

6 files changed

+13
-12
lines changed

.changeset/curvy-badgers-care.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@primer/react": patch
3+
---
4+
5+
update SelectPanel default empty state message to be more generic
Loading

packages/react/src/SelectPanel/SelectPanel.docs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@
164164
{
165165
"name": "message",
166166
"type": "{title: string | React.ReactElement; variant: 'empty' | 'error' | 'warning'; body: React.ReactNode;}",
167-
"defaultValue": "A default empty message is provided by default if this option is not supplied",
167+
"defaultValue": "A default empty message is provided if this option is not configured. Supply a custom empty message to override the default.",
168168
"description": "Message to display in the panel in case of error or empty results"
169169
},
170170
{

packages/react/src/SelectPanel/SelectPanel.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ export const Default = () => {
9292
filteredItems.length === 0
9393
? {
9494
variant: 'empty',
95-
title: `No language found for \`${filter}\``,
96-
body: 'Adjust your search term to find other languages',
95+
title: 'No items available',
96+
body: '',
9797
}
9898
: undefined
9999
}

packages/react/src/SelectPanel/SelectPanel.test.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -765,9 +765,7 @@ for (const useModernActionList of [false, true]) {
765765

766766
jest.runAllTimers()
767767
await waitFor(async () => {
768-
expect(getLiveRegion().getMessage('polite')).toBe(
769-
"You haven't created any items yet. Please add or create new items to populate the list.",
770-
)
768+
expect(getLiveRegion().getMessage('polite')).toBe('No items available. ')
771769
})
772770
jest.useRealTimers()
773771
})
@@ -849,8 +847,7 @@ for (const useModernActionList of [false, true]) {
849847
expect(screen.getAllByRole('option')).toHaveLength(3)
850848

851849
await user.type(document.activeElement!, 'something')
852-
expect(screen.getByText("You haven't created any items yet")).toBeVisible()
853-
expect(screen.getByText('Please add or create new items to populate the list.')).toBeVisible()
850+
expect(screen.getByText('No items available')).toBeVisible()
854851
})
855852

856853
it('should display the default empty state message when there is no item after the initial load (No custom message is provided)', async () => {
@@ -860,8 +857,7 @@ for (const useModernActionList of [false, true]) {
860857

861858
await waitFor(async () => {
862859
await user.click(screen.getByText('Select items'))
863-
expect(screen.getByText("You haven't created any items yet")).toBeVisible()
864-
expect(screen.getByText('Please add or create new items to populate the list.')).toBeVisible()
860+
expect(screen.getByText('No items available')).toBeVisible()
865861
})
866862
})
867863
it('should display the custom empty state message when there is no matching item after filtering', async () => {

packages/react/src/SelectPanel/SelectPanel.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ import type {ButtonProps, LinkButtonProps} from '../Button/types'
3131
const SHORT_DELAY_MS = 500
3232
const LONG_DELAY_MS = 1000
3333
const EMPTY_MESSAGE = {
34-
title: "You haven't created any items yet",
35-
description: 'Please add or create new items to populate the list.',
34+
title: 'No items available',
35+
description: '',
3636
}
3737

3838
const DefaultEmptyMessage = (

0 commit comments

Comments
 (0)