Skip to content

Remove floating-ui exports to improve bundlesize #957

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

Merged
merged 2 commits into from
Feb 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bundlesize.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
"files": [
{
"path": "./dist/react-tooltip.cjs.min.js",
"maxSize": "14.5 kB"
"maxSize": "13.5 kB"
},
{
"path": "./dist/react-tooltip.esm.min.js",
"maxSize": "14.5 kB"
"maxSize": "13.5 kB"
},
{
"path": "./dist/react-tooltip.umd.min.js",
"maxSize": "14.5 kB"
"maxSize": "13.5 kB"
}
]
}
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import { TooltipController as Tooltip } from 'components/TooltipController'
import { IPosition } from 'components/Tooltip/TooltipTypes.d'
import { useState } from 'react'
import { inline, offset } from '@floating-ui/dom'
import styles from './styles.module.css'
import { inline, offset } from './index'

function App() {
const [anchorId, setAnchorId] = useState('button')
Expand Down
9 changes: 6 additions & 3 deletions src/components/Tooltip/TooltipTypes.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import type { ElementType, ReactNode, CSSProperties } from 'react'
import type { Middleware } from '@floating-ui/dom'

export type { Middleware }

export type PlacesType = 'top' | 'right' | 'bottom' | 'left'

Expand All @@ -28,6 +25,12 @@ export type DataAttribute =
| 'delay-hide'
| 'float'

/**
* @description floating-ui middleware
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type Middleware = any

export interface IPosition {
x: number
y: number
Expand Down
1 change: 0 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import type {
import type { ITooltipController } from './components/TooltipController/TooltipControllerTypes'
import type { ITooltipWrapper } from './components/TooltipProvider/TooltipProviderTypes'

export { offset, inline, shift, flip, autoPlacement, size } from '@floating-ui/dom'
export { TooltipController as Tooltip } from './components/TooltipController'
export { TooltipProvider, TooltipWrapper } from './components/TooltipProvider'
export type {
Expand Down