-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(Dropdown): expose items list header slot #12493
feat(Dropdown): expose items list header slot #12493
Conversation
Asset size changesSize Auditor did not detect a change in bundle size for any component! Baseline commit: a2a4dc7f9849a742927e209c6aa827e7c3f231b6 (build) |
Perf AnalysisNo significant results to display. All results
Perf Analysis (Fluent)Perf comparison
Perf tests with no regressions
|
@@ -159,7 +161,7 @@ export interface DropdownProps extends UIComponentProps<DropdownProps, DropdownS | |||
multiple?: boolean; | |||
|
|||
/** A message to be displayed in the list when the dropdown has no items. */ | |||
noResultsMessage?: ShorthandValue<ListItemProps>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't that be a breaking change for consumers since ListItemProps
and DropdownItemProps
have different interfaces?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -181,6 +181,10 @@ const dropdownStyles: ComponentSlotStylesPrepared<DropdownPropsAndState, Dropdow | |||
fontWeight: 'bold', | |||
}), | |||
|
|||
itemsListFooterMessage: ({ variables: v }): ICSSInJSStyle => ({ | |||
backgroundColor: v.listItemBackgroundColor, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please could you add a separate variable for footer, for easier customisation?
packages/fluentui/CHANGELOG.md
Outdated
@@ -60,6 +61,7 @@ Removed types: `TeamsSvgIconSpec`, `ThemeIconSpec`, `SvgIconSpec`, `SvgIconSpecW | |||
- Add `borderRadius` variables to `Card` component @pompomon ([#12552](https://github.com/microsoft/fluentui/pull/12552)) | |||
- Add `CustomerHubIcon`, `OcrOffIcon`, `OcrOnIcon` and `ContactGroupCallIcon` icons @mnajdova ([#12571](https://github.com/microsoft/fluentui/pull/12571)) | |||
- Add `SwitchCameraIcon`, `PanoramaOffIcon`, `AttendeeIcon` and `GroupVideoCallGridIcon`. Updated `PanoramaIcon`. @TanelVari ([#12566](https://github.com/microsoft/fluentui/pull/12566)) | |||
- Add `footerMessage` slot for `Dropdown` @silviuavram ([#12493](https://github.com/microsoft/fluentui/pull/12493)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Add `footerMessage` slot for `Dropdown` @silviuavram ([#12493](https://github.com/microsoft/fluentui/pull/12493)) | |
- Add `headerMessage` slot for `Dropdown` @silviuavram ([#12493](https://github.com/microsoft/fluentui/pull/12493)) |
@@ -146,14 +145,17 @@ export interface DropdownProps extends UIComponentProps<DropdownProps, DropdownS | |||
/** Used when comparing two items in multiple selection. Default comparison is by the header prop. */ | |||
itemToValue?: (item: ShorthandValue<DropdownItemProps>) => any; | |||
|
|||
/** A message to be displayed in the list footer. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/** A message to be displayed in the list footer. */ | |
/** A message to be displayed in the list header. */ |
* add slot for footer * add example to docsite * rename the method * improvements on the example * change component types to DropdownItem * add tests for all footer messages * changelog * wrap text if needed in dropdown item * add breaking change in changelog * rename itemsListFooterMessage to footerMessage * add separate variables for footer messages * move footer to header * delete back dropdown variables from dark theme * adapt the unit tests * change some description from footer to header (cherry picked from commit 40d42e1)
* add slot for footer * add example to docsite * rename the method * improvements on the example * change component types to DropdownItem * add tests for all footer messages * changelog * wrap text if needed in dropdown item * add breaking change in changelog * rename itemsListFooterMessage to footerMessage * add separate variables for footer messages * move footer to header * delete back dropdown variables from dark theme * adapt the unit tests * change some description from footer to header
Pull request checklist
$ yarn change
Description of changes
Give users the ability to add
headerMessage
shorthand in order to be able to add a message to be displayed in the list of items, before the items themselves.In the newly added docsite example, created an external search workflow. When there are no items returned from the search query filtering, we show a single item, which on select will perform an external search, with a loading status. Then we generate items based on the new search query. In this external search scenario we use the
headerMessage
to display the information and also use the getA11yStatusMessage to provide the same information to screen readers.BREAKING CHANGE: Replace
ListItemProps
withDropdownItemProps
for shorthand propsnoResultsMessage
andloadingMessage
.To migrate, change these signatures from
ShorthandValue<ListItemProps>
toShorthandValue<DropdownItemProps>
and make sure you are using props only available toDropdownItemProps
.Microsoft Reviewers: Open in CodeFlow