Skip to content
Merged
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
9 changes: 9 additions & 0 deletions src/components/SelectInputContainer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ export type SelectInputContainerProps<
optionsPending?: boolean;
optionsFiltered?: boolean;
optionsPopupClassName?: string;
popupHeader?: React.ReactNode;
popupHeaderClassName?: string;
persistentOptionPopup?: boolean;
placeholder?: string;
valueDisplay: string;
Expand Down Expand Up @@ -105,6 +107,8 @@ function SelectInputContainer<OK extends OptionKey, N extends string, O extends
inputSectionClassName,
label,
labelContainerClassName,
popupHeader,
popupHeaderClassName,
name,
onOptionClick,
searchText,
Expand Down Expand Up @@ -370,6 +374,11 @@ function SelectInputContainer<OK extends OptionKey, N extends string, O extends
optionsPopupContentClassName,
)}
>
{popupHeader && (
<div className={_cs(styles.popupHeader, popupHeaderClassName)}>
{popupHeader}
</div>
)}
{popup}
<EmptyOptions
filtered={optionsFiltered}
Expand Down
5 changes: 5 additions & 0 deletions src/components/SelectInputContainer/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
padding-top: calc(var(--tui-spacing-large) - var(--tui-spacing-medium));
padding-bottom: calc(var(--tui-spacing-large) - var(--tui-spacing-medium));

.popup-header {
flex-grow: 1;
flex-shrink: 0;
}

.popup-content {
display: flex;
flex-direction: column;
Expand Down
5 changes: 5 additions & 0 deletions src/stories/MultiSelectInput.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ Default.args = {
value: ['1', '3'],
};

export const WithPopupHeader = Template.bind({});
WithPopupHeader.args = {
popupHeader: 'Veggiesss',
};

export const Disabled = Template.bind({});
Disabled.args = {
value: ['1', '3'],
Expand Down
5 changes: 5 additions & 0 deletions src/stories/SearchMultiSelectInput.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@ Default.args = {
value: ['1', '3'],
};

export const WithPopupHeader = Template.bind({});
WithPopupHeader.args = {
popupHeader: 'Fruitsss',
};

export const Disabled = Template.bind({});
Disabled.args = {
value: ['1', '3'],
Expand Down
5 changes: 5 additions & 0 deletions src/stories/SearchSelectInput.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ Default.args = {
value: '1',
};

export const WithPopupHeader = Template.bind({});
WithPopupHeader.args = {
popupHeader: 'Fruitsss',
};

export const WithActions = Template.bind({});
WithActions.args = {
actionsSelector: () => (
Expand Down
30 changes: 30 additions & 0 deletions src/stories/SelectInput.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import { Story } from '@storybook/react/types-6-0';
import { useArgs } from '@storybook/client-api';
import { IoOpenOutline } from 'react-icons/io5';
import SelectInput, { SelectInputProps } from '#components/SelectInput';
import {
Tabs,
Tab,
TabList,
} from '#components/Tabs';

export default {
title: 'Input/SelectInput',
Expand Down Expand Up @@ -46,6 +51,31 @@ const Template: Story<SelectInputProps<string, string, Option, { containerClassN
);
};

export const WithPopupHeader = Template.bind({});
WithPopupHeader.args = {
popupHeader: (
<Tabs
value="green"
onChange={() => 'green'}
>
<TabList>
<Tab
name="green"
style={{ flexGrow: 1 }}
>
Green
</Tab>
<Tab
name="yellow"
style={{ flexGrow: 1 }}
>
Yellow
</Tab>
</TabList>
</Tabs>
),
};

export const WithActions = Template.bind({});
WithActions.args = {
actionsSelector: () => (
Expand Down