Skip to content
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

Merged
merged 16 commits into from
Apr 14, 2020
Merged

feat(Dropdown): expose items list header slot #12493

merged 16 commits into from
Apr 14, 2020

Conversation

silviuaavram
Copy link
Contributor

@silviuaavram silviuaavram commented Apr 1, 2020

Pull request checklist

  • Addresses an existing issue: Fixes #0000
  • Include a change request file using $ 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 with DropdownItemProps for shorthand props noResultsMessage and loadingMessage.

To migrate, change these signatures from ShorthandValue<ListItemProps> to ShorthandValue<DropdownItemProps> and make sure you are using props only available to DropdownItemProps.

Microsoft Reviewers: Open in CodeFlow

@size-auditor
Copy link

size-auditor bot commented Apr 1, 2020

Asset size changes

Size Auditor did not detect a change in bundle size for any component!

Baseline commit: a2a4dc7f9849a742927e209c6aa827e7c3f231b6 (build)

@msft-github-bot
Copy link
Contributor

msft-github-bot commented Apr 1, 2020

Perf Analysis

No significant results to display.

All results

Scenario Master Ticks PR Ticks Iterations Status
BaseButton 736 716 5000
Checkbox 1690 1664 5000
CheckboxBase 1332 1336 5000
ChoiceGroup 4892 4931 5000
ComboBox 913 907 1000
CommandBar 6919 6982 1000
DefaultButton 966 965 5000
DetailsRow 3130 3157 5000
DetailsRow (fast icons) 3138 3087 5000
DetailsRow without styles 2934 2847 5000
Dialog 1357 1344 1000
DocumentCardTitle with truncation 1553 1556 1000
Dropdown 2622 2780 5000
FocusZone 1519 1517 5000
IconButton 1499 1512 5000
Label 436 432 5000
Link 411 402 5000
MenuButton 1291 1279 5000
Nav 2859 2881 1000
Panel 1320 1305 1000
Persona 749 734 1000
Pivot 1200 1151 1000
PrimaryButton 1085 1074 5000
SearchBox 1306 1352 5000
Slider 1650 1681 5000
Spinner 351 345 5000
SplitButton 2789 2800 5000
Stack 431 404 5000
Stack with Intrinsic children 1031 1019 5000
Stack with Text children 3687 3684 5000
TagPicker 2428 2510 5000
Text 340 325 5000
TextField 1584 1562 5000
Toggle 762 784 5000
button 51 55 5000

Perf Analysis (Fluent)

Perf comparison
Status Scenario Fluent TPI Fabric TPI Ratio Iterations Ticks
🔧 Avatar.Fluent 0.55 0.46 1.2:1 2000 1101
🦄 Button.Fluent 0.09 0.17 0.53:1 5000 461
🔧 Checkbox.Fluent 0.72 0.37 1.95:1 1000 717
🔧 Dialog.Fluent 0.39 0.19 2.05:1 5000 1933
🔧 Dropdown.Fluent 3.85 0.45 8.56:1 1000 3848
🔧 Icon.Fluent 0.13 0.05 2.6:1 5000 628
🎯 Image.Fluent 0.07 0.1 0.7:1 5000 346
🔧 Slider.Fluent 1.61 0.4 4.03:1 1000 1606
🔧 Text.Fluent 0.07 0.02 3.5:1 5000 345
🦄 Tooltip.Fluent 0.12 17.15 0.01:1 5000 587

🔧 Needs work     🎯 On target     🦄 Amazing

Perf tests with no regressions
Scenario Current PR Ticks Baseline Ticks Ratio
Text.Fluent 345 317 1.09:1
ChatWithPopoverPerf.default 642 602 1.07:1
DropdownMinimalPerf.default 4084 3830 1.07:1
HeaderMinimalPerf.default 550 526 1.05:1
PortalMinimalPerf.default 289 275 1.05:1
FlexMinimalPerf.default 277 266 1.04:1
LabelMinimalPerf.default 404 387 1.04:1
LayoutMinimalPerf.default 652 624 1.04:1
ListMinimalPerf.default 446 429 1.04:1
SegmentMinimalPerf.default 1084 1047 1.04:1
TreeWith60ListItems.default 241 232 1.04:1
Button.Fluent 461 445 1.04:1
CardMinimalPerf.default 379 367 1.03:1
ChatDuplicateMessagesPerf.default 432 419 1.03:1
ChatMinimalPerf.default 603 588 1.03:1
DropdownManyItemsPerf.default 1532 1487 1.03:1
LoaderMinimalPerf.default 1119 1090 1.03:1
MenuButtonMinimalPerf.default 1566 1523 1.03:1
RefMinimalPerf.default 194 188 1.03:1
AttachmentSlotsPerf.default 2664 2607 1.02:1
BoxMinimalPerf.default 300 295 1.02:1
PopupMinimalPerf.default 243 239 1.02:1
Avatar.Fluent 1101 1081 1.02:1
Slider.Fluent 1606 1568 1.02:1
DividerMinimalPerf.default 951 941 1.01:1
EmbedMinimalPerf.default 5570 5531 1.01:1
GridMinimalPerf.default 844 832 1.01:1
HeaderSlotsPerf.default 1636 1626 1.01:1
HierarchicalTreeMinimalPerf.default 1017 1004 1.01:1
ItemLayoutMinimalPerf.default 2074 2054 1.01:1
RadioGroupMinimalPerf.default 516 510 1.01:1
StatusMinimalPerf.default 640 632 1.01:1
ToolbarMinimalPerf.default 1082 1071 1.01:1
Dialog.Fluent 1933 1922 1.01:1
Dropdown.Fluent 3848 3824 1.01:1
Image.Fluent 346 343 1.01:1
CheckboxMinimalPerf.default 3322 3335 1:1
DialogMinimalPerf.default 1947 1952 1:1
ListNestedPerf.default 972 975 1:1
ReactionMinimalPerf.default 2499 2497 1:1
SplitButtonMinimalPerf.default 3590 3599 1:1
IconMinimalPerf.default 643 643 1:1
TableMinimalPerf.default 646 647 1:1
CustomToolbarPrototype.default 3806 3796 1:1
AccordionMinimalPerf.default 230 233 0.99:1
ImageMinimalPerf.default 346 348 0.99:1
ProviderMergeThemesPerf.default 1496 1516 0.99:1
SliderMinimalPerf.default 1558 1566 0.99:1
TextAreaMinimalPerf.default 3135 3169 0.99:1
TooltipMinimalPerf.default 844 854 0.99:1
VideoMinimalPerf.default 877 890 0.99:1
Checkbox.Fluent 717 722 0.99:1
AnimationMinimalPerf.default 628 640 0.98:1
InputMinimalPerf.default 1070 1087 0.98:1
ListCommonPerf.default 1029 1046 0.98:1
ListWith60ListItems.default 1242 1265 0.98:1
MenuMinimalPerf.default 1977 2008 0.98:1
TreeMinimalPerf.default 1159 1185 0.98:1
ButtonSlotsPerf.default 594 615 0.97:1
ProviderMinimalPerf.default 620 638 0.97:1
Tooltip.Fluent 587 606 0.97:1
AlertMinimalPerf.default 578 605 0.96:1
CarouselMinimalPerf.default 619 646 0.96:1
FormMinimalPerf.default 888 928 0.96:1
TextMinimalPerf.default 331 344 0.96:1
AttachmentMinimalPerf.default 140 147 0.95:1
AvatarMinimalPerf.default 551 581 0.95:1
Icon.Fluent 628 664 0.95:1
ButtonMinimalPerf.default 134 142 0.94:1

@@ -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>;
Copy link
Contributor

@pompomon pompomon Apr 2, 2020

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?

Copy link
Contributor

@pompomon pompomon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
Looks like some styles are missing, please could you take a look at that?

@@ -181,6 +181,10 @@ const dropdownStyles: ComponentSlotStylesPrepared<DropdownPropsAndState, Dropdow
fontWeight: 'bold',
}),

itemsListFooterMessage: ({ variables: v }): ICSSInJSStyle => ({
backgroundColor: v.listItemBackgroundColor,
Copy link
Contributor

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?

@silviuaavram silviuaavram changed the title feat(Dropdown): expose items list footer slot feat(Dropdown): expose items list header slot Apr 8, 2020
@@ -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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- 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. */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/** A message to be displayed in the list footer. */
/** A message to be displayed in the list header. */

@silviuaavram silviuaavram merged commit 40d42e1 into microsoft:master Apr 14, 2020
@silviuaavram silviuaavram deleted the feat/dropdown-list-footer branch April 14, 2020 11:51
silviuaavram added a commit that referenced this pull request Apr 15, 2020
* 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)
DuanShaolong pushed a commit to DuanShaolong/fluentui that referenced this pull request Apr 27, 2020
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fluent UI react-northstar (v0) Work related to Fluent UI V0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants