Skip to content

Conversation

@bsunderhus
Copy link
Contributor

Current Behavior

Currently types by trigger API are quite loose, on some cases such as on getTriggerChild method a generic type would be required to ensure typings.

New Behavior

Makes types stricter providing a well defined TriggerProps types ensuring that helper methods such as getTriggerChild can properly infer types without the requirement of generics being necessarily provided.

@bsunderhus bsunderhus self-assigned this Oct 3, 2022
@github-actions github-actions bot added this to the October Project Cycle Q4 2022 milestone Oct 3, 2022
@fabricteam
Copy link
Collaborator

fabricteam commented Oct 3, 2022

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
189.209 kB
52.401 kB
188.815 kB
52.287 kB
-394 B
-114 B
react-dialog
Dialog (including children components)
82.438 kB
24.444 kB
82.465 kB
24.447 kB
27 B
3 B
react-menu
Menu (including children components)
116.771 kB
35.786 kB
116.558 kB
35.725 kB
-213 B
-61 B
react-menu
Menu (including selectable components)
119.84 kB
36.296 kB
119.627 kB
36.246 kB
-213 B
-50 B
react-popover
Popover
102.929 kB
31.542 kB
102.756 kB
31.5 kB
-173 B
-42 B
react-tooltip
Tooltip
41.541 kB
14.646 kB
41.566 kB
14.644 kB
25 B
-2 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
global-context
createContext
533 B
341 B
global-context
createContextSelector
554 B
348 B
react-accordion
Accordion (including children components)
79.037 kB
24.059 kB
react-alert
Alert
84.117 kB
21.07 kB
react-avatar
Avatar
48.828 kB
13.842 kB
react-avatar
AvatarGroup
14.95 kB
5.989 kB
react-avatar
AvatarGroupItem
68.796 kB
19.182 kB
react-badge
Badge
22.6 kB
7.205 kB
react-badge
CounterBadge
23.49 kB
7.489 kB
react-badge
PresenceBadge
24.05 kB
7.067 kB
react-button
Button
36.278 kB
9.636 kB
react-button
CompoundButton
43.303 kB
10.852 kB
react-button
MenuButton
38.972 kB
10.536 kB
react-button
SplitButton
46.418 kB
11.916 kB
react-button
ToggleButton
52.145 kB
11.108 kB
react-card
Card - All
67.17 kB
19.281 kB
react-card
Card
62.852 kB
18.198 kB
react-card
CardFooter
8.561 kB
3.601 kB
react-card
CardHeader
9.604 kB
3.94 kB
react-card
CardPreview
8.662 kB
3.656 kB
react-combobox
Combobox (including child components)
74.642 kB
24.19 kB
react-combobox
Dropdown (including child components)
74.242 kB
24.089 kB
react-components
react-components: FluentProvider & webLightTheme
33.4 kB
11.008 kB
react-divider
Divider
16.459 kB
5.902 kB
react-image
Image
10.78 kB
4.264 kB
react-input
Input
23.762 kB
7.706 kB
react-label
Label
9.338 kB
3.86 kB
react-link
Link
11.806 kB
4.868 kB
react-overflow
hooks only
10.685 kB
4.104 kB
react-persona
Persona
53.946 kB
15.225 kB
react-portal
Portal
10.582 kB
3.875 kB
react-portal-compat
PortalCompatProvider
5.857 kB
1.978 kB
react-positioning
usePositioning
19.7 kB
7.404 kB
react-progress
Progress
13.44 kB
5.247 kB
react-provider
FluentProvider
15.761 kB
5.885 kB
react-radio
Radio
36.39 kB
12.103 kB
react-radio
RadioGroup
14.248 kB
5.7 kB
react-select
Select
20.846 kB
7.346 kB
react-slider
Slider
31.759 kB
10.064 kB
react-spinbutton
SpinButton
44.102 kB
12.425 kB
react-spinner
Spinner
19.977 kB
6.438 kB
react-switch
Switch
33.342 kB
10.557 kB
react-text
Text - Default
11.782 kB
4.605 kB
react-text
Text - Wrappers
15.092 kB
5.044 kB
react-textarea
Textarea
25.018 kB
8.133 kB
react-utilities
SSRProvider
180 B
159 B
🤖 This report was generated against 0afe50e55c572348c93928dd9883cef537bb8101

@codesandbox-ci
Copy link

codesandbox-ci bot commented Oct 3, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 796bbc3:

Sandbox Source
@fluentui/react 8 starter Configuration
@fluentui/react-components 9 starter Configuration

@size-auditor
Copy link

size-auditor bot commented Oct 3, 2022

Asset size changes

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

Baseline commit: 0afe50e55c572348c93928dd9883cef537bb8101 (build)

@fabricteam
Copy link
Collaborator

fabricteam commented Oct 3, 2022

Perf Analysis (@fluentui/react-components)

No significant results to display.

All results

Scenario Render type Master Ticks PR Ticks Iterations Status
Avatar mount 1301 1268 5000
Button mount 921 928 5000
FluentProvider mount 1500 1479 5000
FluentProviderWithTheme mount 577 577 10
FluentProviderWithTheme virtual-rerender 546 539 10
FluentProviderWithTheme virtual-rerender-with-unmount 579 561 10
MakeStyles mount 1953 1955 50000
SpinButton mount 2379 2335 5000

@bsunderhus bsunderhus marked this pull request as ready for review October 3, 2022 20:55
@bsunderhus bsunderhus requested review from a team, behowell and khmakoto as code owners October 3, 2022 20:55
@bsunderhus bsunderhus force-pushed the feat(react-utilities)--improve-trigger-types branch from 7a2fc1a to 7823757 Compare October 4, 2022 06:53
@bsunderhus bsunderhus requested a review from khmakoto October 4, 2022 06:55
@bsunderhus bsunderhus force-pushed the feat(react-utilities)--improve-trigger-types branch from 7823757 to 796bbc3 Compare October 4, 2022 07:35
@bsunderhus bsunderhus enabled auto-merge (squash) October 4, 2022 08:44
import { useModalAttributes } from '@fluentui/react-tabster';
import { applyTriggerPropsToChildren, getTriggerChild, useEventCallback } from '@fluentui/react-utilities';
import { DialogTriggerChildProps, DialogTriggerProps, DialogTriggerState } from './DialogTrigger.types';
import { DialogTriggerProps, DialogTriggerState } from './DialogTrigger.types';
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
import { DialogTriggerProps, DialogTriggerState } from './DialogTrigger.types';
import type { DialogTriggerProps, DialogTriggerState } from './DialogTrigger.types';

import { usePopoverContext_unstable } from '../../popoverContext';
import type { PopoverTriggerChildProps, PopoverTriggerProps, PopoverTriggerState } from './PopoverTrigger.types';
import type { PopoverTriggerProps, PopoverTriggerState } from './PopoverTrigger.types';
import { useARIAButtonProps } from '@fluentui/react-aria';
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
import { useARIAButtonProps } from '@fluentui/react-aria';
import type { useARIAButtonProps } from '@fluentui/react-aria';

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll follow up on those, thx @khmakoto!

@bsunderhus bsunderhus merged commit 17c5fe7 into microsoft:master Oct 4, 2022
marcosmoura added a commit to marcosmoura/fluentui that referenced this pull request Oct 5, 2022
* master: (62 commits)
  chore(migrate-converged): add functionality to execute various v9 package file restructuring tasks (microsoft#24458)
  chore(react-dialog): updates stories (microsoft#25070)
  refactor Progress to remove label and description slots (microsoft#25067)
  fix(SplitButton): Remove borders from hover and pressed state in primary split buttons (microsoft#25059)
  chore(react-persona): Add vr, conformance, and unit tests (microsoft#25007)
  (docs): update Icon docs with examples (microsoft#24768)
  Split button/primary hc fix (microsoft#25066)
  chore(react-utilities): restricts trigger API types (microsoft#25044)
  Add utilities export @fluentui/style-utilities v8 (microsoft#25065)
  chore: migrate whole repo to webpack 5 (microsoft#24542)
  applying package updates
  BREAKING: refactor `useTable` to be composable (microsoft#24947)
  Added shims to shim packages (microsoft#25048)
  Add Progress SPEC (microsoft#24418)
  applying package updates
  chore(react-persona): Add bundle-size command for bundle-size fixtures (microsoft#25055)
  fix(Button): Remove margin added to buttons by Safari (microsoft#25052)
  fix: Menu triggers no longer take focus when they are mounted (microsoft#25016)
  chore: deletes react-trigger package (microsoft#25042)
  Fixed a minor typo: immmediately => immediately (microsoft#25036)
  ...
NotWoods pushed a commit to NotWoods/fluentui that referenced this pull request Nov 18, 2022
ling1726 added a commit to ling1726/fluentui that referenced this pull request Sep 26, 2023
Fixes regression from microsoft#28530

The `contextMenuProps` aren't really for just the context menu but
common props for all menus fter the
refactor in microsoft#25044. We should probably revisit the menu trigger code and
clean it up but this fix is more urgent
ling1726 added a commit that referenced this pull request Sep 26, 2023
* fix: Context menu close should restore focus

Fixes regression from #28530

The `contextMenuProps` aren't really for just the context menu but
common props for all menus fter the
refactor in #25044. We should probably revisit the menu trigger code and
clean it up but this fix is more urgent

* changefile

* revert

* revert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants