Skip to content

feat(react-drawer): expose drawer base hooks#36042

Merged
dmytrokirpa merged 5 commits into
masterfrom
drawer-base-hooks
Apr 29, 2026
Merged

feat(react-drawer): expose drawer base hooks#36042
dmytrokirpa merged 5 commits into
masterfrom
drawer-base-hooks

Conversation

@dmytrokirpa
Copy link
Copy Markdown
Contributor

@dmytrokirpa dmytrokirpa commented Apr 25, 2026

This pull request introduces a minor feature update to the @fluentui/react-drawer package, focusing on improving extensibility and type safety by exporting new base hooks and types, and refactoring how drawer size is handled. The changes make it easier for consumers to access and use base drawer logic and types, and clarify the separation between base and size-related properties. Additional tests ensure that the new size handling works as expected.

@dmytrokirpa dmytrokirpa requested review from a team and mainframev as code owners April 25, 2026 07:57
@dmytrokirpa dmytrokirpa marked this pull request as draft April 25, 2026 07:59
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 25, 2026

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-components
react-components: entire library
1.302 MB
325.523 kB
1.303 MB
325.567 kB
147 B
44 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-components
react-components: Button, FluentProvider & webLightTheme
70.415 kB
19.963 kB
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
237.729 kB
68.993 kB
react-components
react-components: FluentProvider & webLightTheme
43.63 kB
14.026 kB
react-portal-compat
PortalCompatProvider
8.386 kB
2.624 kB
react-timepicker-compat
TimePicker
109.674 kB
36.193 kB
🤖 This report was generated against 033fe4348f570727fbe70fb70bd93ede0a3110f5

@github-actions
Copy link
Copy Markdown

Pull request demo site: URL

@dmytrokirpa dmytrokirpa self-assigned this Apr 28, 2026
@dmytrokirpa dmytrokirpa marked this pull request as ready for review April 28, 2026 07:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds new public “base” hooks/types to @fluentui/react-drawer and refactors drawer sizing into a dedicated DrawerSizeProps type to improve extensibility and type safety.

Changes:

  • Export new base APIs (useDrawerBase_unstable, DrawerBase* types, DrawerSize* types, useDrawerHeaderTitleBase_unstable).
  • Refactor size handling out of DrawerBaseProps into DrawerSizeProps and update internal typing accordingly.
  • Add unit tests validating size/defaulting behavior and state shape.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/react-components/react-drawer/library/src/shared/useDrawerDefaultProps.ts Updates defaulting helper to use DrawerSizeProps for size.
packages/react-components/react-drawer/library/src/shared/useDrawerBaseStyles.styles.ts Adjusts styling helper typing to require size via DrawerSizeProps.
packages/react-components/react-drawer/library/src/shared/useDrawerBase.ts Introduces new base hook returning only behavior defaults.
packages/react-components/react-drawer/library/src/shared/useDrawerBase.test.ts Adds tests for new base hook and updated defaulting behavior.
packages/react-components/react-drawer/library/src/shared/drawerMotions.ts Refactors motion param types and duration map to use DrawerSizeProps.
packages/react-components/react-drawer/library/src/shared/DrawerSize.types.ts Adds new shared DrawerSize/DrawerSizeProps types.
packages/react-components/react-drawer/library/src/shared/DrawerBase.types.ts Removes size from DrawerBaseProps and introduces DrawerBaseDefaultedProps.
packages/react-components/react-drawer/library/src/index.ts Exports new public hooks/types from the package entrypoint.
packages/react-components/react-drawer/library/src/components/OverlayDrawer/OverlayDrawer.types.ts Updates OverlayDrawer props/state to include DrawerSizeProps.
packages/react-components/react-drawer/library/src/components/OverlayDrawer/OverlayDrawer.test.tsx Adds test asserting size is preserved in hook state.
packages/react-components/react-drawer/library/src/components/InlineDrawer/useInlineDrawer.ts Adds useInlineDrawerBase_unstable and updates imports/types.
packages/react-components/react-drawer/library/src/components/InlineDrawer/renderInlineDrawer.tsx Changes rendering to conditionally wrap with surfaceMotion.
packages/react-components/react-drawer/library/src/components/InlineDrawer/InlineDrawer.types.ts Adds base slots/state types and includes DrawerSizeProps in props/state.
packages/react-components/react-drawer/library/src/components/InlineDrawer/InlineDrawer.test.tsx Adds test asserting size is preserved in hook state.
packages/react-components/react-drawer/library/src/components/DrawerHeaderTitle/useDrawerHeaderTitle.ts Extracts a new useDrawerHeaderTitleBase_unstable hook.
packages/react-components/react-drawer/library/src/components/DrawerHeaderTitle/index.ts Exports useDrawerHeaderTitleBase_unstable.
packages/react-components/react-drawer/library/src/DrawerHeaderTitle.ts Re-exports the new base hook from the barrel.
packages/react-components/react-drawer/library/etc/react-drawer.api.md Updates extracted public API to include new exports and refactored types.
change/@fluentui-react-drawer-2c8d4430-a744-43ff-8fd5-3e4b4f6c3a7a.json Beachball change file for the new minor feature.

Comment thread packages/react-components/react-drawer/library/src/shared/DrawerSize.types.ts Outdated
@dmytrokirpa dmytrokirpa enabled auto-merge (squash) April 29, 2026 18:58
@dmytrokirpa dmytrokirpa merged commit 5a5a37c into master Apr 29, 2026
15 checks passed
@dmytrokirpa dmytrokirpa deleted the drawer-base-hooks branch May 23, 2026 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants