base-ui icon indicating copy to clipboard operation
base-ui copied to clipboard

[tooltip] Optional `TrackCursorAxis` component

Open atomiks opened this issue 6 months ago • 4 comments

Closes #1792

Component providers seem to be the cleanest solution for optional features.

All Tooltip features + React

Before (03472e5) 251.13 kB │ gzip: 81.10 kB
After            249.23 kB │ gzip: 80.47 kB

None of the useClientPoint cost is added by default now. There is small overhead from reading the context and setting up the ref. Not sure if this particular feature is worth extracting from a prop though (it would likely be worth it for additional features like truncation and inline() middleware logic however)

Usage example before/after:

<Tooltip.Root trackCursorAxis="both">
  ...
</Tooltip.Root>
<Tooltip.Root>
  <Tooltip.TrackCursorAxis value="both">
    ...
  </Tooltip.TrackCursorAxis>
</Tooltip.Root>

atomiks avatar May 23 '25 06:05 atomiks

Open in StackBlitz

npm i https://pkg.pr.new/@base-ui-components/react@1963

commit: dcc9391

pkg-pr-new[bot] avatar May 23 '25 06:05 pkg-pr-new[bot]

Deploy Preview for base-ui ready!

Name Link
Latest commit bf7dec8636d31abc2ba1f1f9433f549dde7d5f1a
Latest deploy log https://app.netlify.com/projects/base-ui/deploys/68300fe4d1bfe600083347bc
Deploy Preview https://deploy-preview-1963--base-ui.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

netlify[bot] avatar May 23 '25 06:05 netlify[bot]

Deploy Preview for base-ui ready!

Name Link
Latest commit dcc93910e6f47253898c9bfe1cb8a66a9f15b0c3
Latest deploy log https://app.netlify.com/projects/base-ui/deploys/68392b3f4f27d800089805ef
Deploy Preview https://deploy-preview-1963--base-ui.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

netlify[bot] avatar May 23 '25 06:05 netlify[bot]

Bundle size report

Total Size Change:${\tiny{\color{red}▲}}$+955B(+0.07%) - Total Gzip Change:${\tiny{\color{red}▲}}$+303B(+0.06%) Files: 41 total (0 added, 0 removed, 2 changed)

@base-ui-components/react/tooltipparsed:${\tiny{\color{red}▲}}$+483B(+0.76%) gzip:${\tiny{\color{red}▲}}$+157B(+0.73%) @base-ui-components/reactparsed:${\tiny{\color{red}▲}}$+472B(+0.15%) gzip:${\tiny{\color{red}▲}}$+146B(+0.16%)

Details of bundle changes

Generated by :no_entry_sign: dangerJS against dcc93910e6f47253898c9bfe1cb8a66a9f15b0c3

mui-bot avatar May 30 '25 03:05 mui-bot