Skip to content

Commit 89beaa0

Browse files
authored
Merge pull request #822 from atls/feat/redesign-tooltip
Feat/redesign tooltip
2 parents a5984af + 8daf5bb commit 89beaa0

55 files changed

Lines changed: 496 additions & 355 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.pnp.cjs‎

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import type { TooltipProps } from '@atls-ui-parts/tooltip'
22
import type { ReactNode } from 'react'
33

4-
import { Box } from '@ui/layout'
54
import { Tooltip as BaseTooltip } from '@atls-ui-parts/tooltip'
65

7-
import { baseContainerStyles } from './styles.css.js'
8-
96
export const Tooltip = ({ children, ...props }: TooltipProps): ReactNode => (
10-
<BaseTooltip {...props} container={<Box className={baseContainerStyles} />}>
7+
<BaseTooltip {...props}>
118
{children}
129
</BaseTooltip>
1310
)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
export * from './component.js'
2-
export type { TooltipProps, ArrowProps } from '@atls-ui-parts/tooltip'
2+
export type { TooltipProps, TooltipShape, TooltipAppearance } from '@atls-ui-parts/tooltip'

‎generators/components/src/templates/tooltip/styles.css.ts.hbs‎

Lines changed: 0 additions & 17 deletions
This file was deleted.

‎ui-parts/tooltip/package.json‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@
1313
"postpack": "rm -rf dist"
1414
},
1515
"dependencies": {
16-
"@atls-ui-parts/condition": "workspace:*",
1716
"@atls-ui-parts/theme": "workspace:*",
17+
"@atls-ui/theme": "workspace:*",
1818
"@atls-utils/use-float": "workspace:*",
19-
"@floating-ui/react": "0.27.8",
20-
"framer-motion": "12.43.0"
19+
"@floating-ui/react": "0.27.8"
2120
},
2221
"devDependencies": {
2322
"@atls-ui-parts/layout": "workspace:*",
Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
import type { ReactNode } from 'react'
1+
import type { ReactNode } from 'react'
22

3-
import type { ArrowProps } from './interfaces.js'
3+
import type { ArrowProps } from './interfaces.js'
44

5-
import { FloatingArrow } from '@floating-ui/react'
5+
import { FloatingArrow } from '@floating-ui/react'
66

7-
import { Condition } from '@atls-ui-parts/condition'
7+
import { arrowAppearanceStyles } from './styles/appearance/styles.css.js'
88

9-
export const Arrow = ({ ref, context, arrow = true }: ArrowProps): ReactNode => (
10-
<Condition match={!!arrow}>
11-
<FloatingArrow
12-
ref={ref}
13-
context={context}
14-
width={12}
15-
fill='rgba(0, 0, 0, 0.75)'
16-
{...(typeof arrow === 'boolean' ? {} : arrow)}
17-
/>
18-
</Condition>
9+
export const Arrow = ({ context, arrowRef, shape }: ArrowProps): ReactNode => (
10+
<FloatingArrow
11+
ref={arrowRef}
12+
className={arrowAppearanceStyles}
13+
context={context}
14+
fill='currentColor'
15+
height={shape.height}
16+
width={shape.width}
17+
/>
1918
)

‎ui-parts/tooltip/src/arrow/index.ts‎

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import type { FloatingArrowProps } from '@floating-ui/react'
2-
import type { UseFloatingReturn } from '@floating-ui/react'
3-
import type { RefObject } from 'react'
1+
import type { UseFloatReturn } from '@atls-utils/use-float'
2+
3+
import type { ArrowShape } from './styles/shape/interfaces.js'
44

55
export interface ArrowProps {
6-
ref: RefObject<SVGSVGElement | null>
7-
arrow?: Omit<FloatingArrowProps, 'context'> | boolean
8-
context: UseFloatingReturn['context']
6+
context: UseFloatReturn['context']
7+
arrowRef: UseFloatReturn['arrowRef']
8+
shape: ArrowShape
99
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export interface ArrowAppearance {
2+
color: string
3+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { createThemeContract } from '@vanilla-extract/css'
2+
import { style } from '@vanilla-extract/css'
3+
4+
export const arrowAppearanceVariables = createThemeContract({ color: null })
5+
export const arrowAppearanceStyles = style({ fill: arrowAppearanceVariables.color })

0 commit comments

Comments
 (0)