Skip to content

Commit 97d074b

Browse files
committed
feat(FilterPicker): add component * 6
1 parent ad503e7 commit 97d074b

File tree

2 files changed

+32
-11
lines changed

2 files changed

+32
-11
lines changed

src/components/fields/FilterListBox/FilterListBox.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ export const FilterListBox = forwardRef(function FilterListBox<
182182
footer,
183183
headerStyles,
184184
footerStyles,
185+
listBoxStyles,
185186
children,
186187
onEscape,
187188
...otherProps
@@ -651,7 +652,10 @@ export const FilterListBox = forwardRef(function FilterListBox<
651652
{...focusProps}
652653
>
653654
{header ? (
654-
<StyledHeader role="presentation" styles={headerStyles}>
655+
<StyledHeader
656+
role="presentation"
657+
styles={{ border: false, ...headerStyles }}
658+
>
655659
{header}
656660
</StyledHeader>
657661
) : (
@@ -688,7 +692,7 @@ export const FilterListBox = forwardRef(function FilterListBox<
688692
footerStyles={footerStyles}
689693
onSelectionChange={handleSelectionChange}
690694
{...modAttrs({ ...mods, focused: false })}
691-
styles={{ border: '#clear', radius: '1r bottom' }}
695+
styles={{ border: false, ...listBoxStyles }}
692696
>
693697
{enhancedChildren as any}
694698
</ListBox>

src/components/fields/FilterPicker/FilterPicker.stories.tsx

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { userEvent, within } from '@storybook/test';
2+
13
import { EditIcon, FilterIcon, RightIcon } from '../../../icons';
24
import { Button } from '../../actions/Button/Button';
35
import { Badge } from '../../content/Badge/Badge';
@@ -52,6 +54,11 @@ export const Default: Story = {
5254
searchPlaceholder: 'Search options...',
5355
width: 'max 30x',
5456
},
57+
play: async ({ canvasElement }) => {
58+
const canvas = within(canvasElement);
59+
const trigger = canvas.getByRole('button');
60+
await userEvent.click(trigger);
61+
},
5562
render: (args) => (
5663
<FilterPicker {...args}>
5764
<FilterPicker.Section title="Fruits">
@@ -114,6 +121,11 @@ export const CustomLabel: Story = {
114121
return `${selectedKeys.length} of 12 selected`;
115122
},
116123
},
124+
play: async ({ canvasElement }) => {
125+
const canvas = within(canvasElement);
126+
const trigger = canvas.getByRole('button');
127+
await userEvent.click(trigger);
128+
},
117129
render: (args) => (
118130
<FilterPicker {...args}>
119131
<FilterPicker.Section title="Fruits">
@@ -170,11 +182,16 @@ export const WithHeaderAndFooter: Story = {
170182
searchPlaceholder: 'Search languages...',
171183
width: 'max 30x',
172184
},
185+
play: async ({ canvasElement }) => {
186+
const canvas = within(canvasElement);
187+
const trigger = canvas.getByRole('button');
188+
await userEvent.click(trigger);
189+
},
173190
render: (args) => (
174191
<FilterPicker
175192
{...args}
176193
header={
177-
<Space gap="1x" placeContent="space-between" flow="row">
194+
<>
178195
<Space gap="1x" flow="row" placeItems="center">
179196
<Title level={6}>Programming Languages</Title>
180197
<Badge type="purple">12</Badge>
@@ -185,22 +202,17 @@ export const WithHeaderAndFooter: Story = {
185202
icon={<FilterIcon />}
186203
aria-label="Filter languages"
187204
/>
188-
</Space>
205+
</>
189206
}
190207
footer={
191-
<Space
192-
gap="1x"
193-
placeContent="space-between"
194-
flow="row"
195-
placeItems="center"
196-
>
208+
<>
197209
<Text color="#dark.50" preset="t4">
198210
Popular languages shown
199211
</Text>
200212
<Button type="link" size="small" rightIcon={<RightIcon />}>
201213
View all
202214
</Button>
203-
</Space>
215+
</>
204216
}
205217
>
206218
<FilterPicker.Section title="Frontend">
@@ -258,6 +270,11 @@ export const SingleIcon: Story = {
258270
icon: <EditIcon />,
259271
rightIcon: null,
260272
},
273+
play: async ({ canvasElement }) => {
274+
const canvas = within(canvasElement);
275+
const trigger = canvas.getByRole('button');
276+
await userEvent.click(trigger);
277+
},
261278
render: (args) => (
262279
<FilterPicker {...args}>
263280
<FilterPicker.Section title="Fruits">

0 commit comments

Comments
 (0)