Skip to content

Commit cb5e79c

Browse files
committed
add(select-inputs): add popup header to select input containers
1 parent 9507057 commit cb5e79c

6 files changed

Lines changed: 32 additions & 0 deletions

File tree

src/components/SelectInputContainer/index.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ export type SelectInputContainerProps<
8383
grouped?: false;
8484
groupLabelSelector?: undefined;
8585
groupKeySelector?: undefined;
86+
popupHeader?: React.ReactNode;
87+
popupHeaderClassName?: string;
8688
});
8789

8890
const emptyList: unknown[] = [];
@@ -105,6 +107,8 @@ function SelectInputContainer<OK extends OptionKey, N extends string, O extends
105107
inputSectionClassName,
106108
label,
107109
labelContainerClassName,
110+
popupHeader,
111+
popupHeaderClassName,
108112
name,
109113
onOptionClick,
110114
searchText,
@@ -370,6 +374,9 @@ function SelectInputContainer<OK extends OptionKey, N extends string, O extends
370374
optionsPopupContentClassName,
371375
)}
372376
>
377+
<div className={_cs(styles.popupHeader, popupHeaderClassName)}>
378+
{popupHeader}
379+
</div>
373380
{popup}
374381
<EmptyOptions
375382
filtered={optionsFiltered}

src/components/SelectInputContainer/styles.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
padding-top: calc(var(--tui-spacing-large) - var(--tui-spacing-medium));
33
padding-bottom: calc(var(--tui-spacing-large) - var(--tui-spacing-medium));
44

5+
.popup-header {
6+
flex-grow: 1;
7+
padding: calc(var(--tui-spacing-large) - var(--tui-spacing-small));
8+
}
9+
510
.popup-content {
611
display: flex;
712
flex-direction: column;

src/stories/MultiSelectInput.stories.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ Default.args = {
7070
value: ['1', '3'],
7171
};
7272

73+
export const WithPopupHeader = Template.bind({});
74+
WithPopupHeader.args = {
75+
popupHeader: 'Veggiesss',
76+
};
77+
7378
export const Disabled = Template.bind({});
7479
Disabled.args = {
7580
value: ['1', '3'],

src/stories/SearchMultiSelectInput.stories.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,11 @@ Default.args = {
212212
value: ['1', '3'],
213213
};
214214

215+
export const WithPopupHeader = Template.bind({});
216+
WithPopupHeader.args = {
217+
popupHeader: 'Fruitsss',
218+
};
219+
215220
export const Disabled = Template.bind({});
216221
Disabled.args = {
217222
value: ['1', '3'],

src/stories/SearchSelectInput.stories.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,11 @@ Default.args = {
194194
value: '1',
195195
};
196196

197+
export const WithPopupHeader = Template.bind({});
198+
WithPopupHeader.args = {
199+
popupHeader: 'Fruitsss',
200+
};
201+
197202
export const WithActions = Template.bind({});
198203
WithActions.args = {
199204
actionsSelector: () => (

src/stories/SelectInput.stories.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ const Template: Story<SelectInputProps<string, string, Option, { containerClassN
4646
);
4747
};
4848

49+
export const WithPopupHeader = Template.bind({});
50+
WithPopupHeader.args = {
51+
popupHeader: 'Fruitsss',
52+
};
53+
4954
export const WithActions = Template.bind({});
5055
WithActions.args = {
5156
actionsSelector: () => (

0 commit comments

Comments
 (0)