Refactor tooltip style contract#707
Conversation
| export const animateProps: MotionProps = { | ||
| initial: { opacity: 0, scale: 0.8 }, | ||
| animate: { opacity: 1, scale: 1 }, | ||
| exit: { opacity: 0, scale: 0.8 }, | ||
| transition: { type: 'spring', damping: 30, stiffness: 500 }, | ||
| } |
There was a problem hiding this comment.
тут нарушение контракта явное
There was a problem hiding this comment.
топонимическая редупликация
There was a problem hiding this comment.
ui-parts/tooltip/stories/story-tooltip.tsx и ui-parts/tooltip/stories/tooltip.stories.tsx…ничего не понимаю
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5a67941938
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| const containerDefaultAppearanceStyles = style({ | ||
| color: vars.colors.white, | ||
| backgroundColor: vars.colors.blackThreeQuarters, |
There was a problem hiding this comment.
Keep default tooltip styles standalone
When @atls-ui-parts/tooltip is consumed outside the repo Storybook decorators, nothing sets id={globalThemeId} for @atls-ui-parts/theme (repo-wide search only found this in ui-parts/design/src/preview.tsx and ui/design/src/preview.tsx). These default values therefore compile to CSS variables scoped under #atls-ui-parts-theme and resolve as invalid in a standalone app, so the default tooltip loses its dark background/color and related shape tokens; before this change the same defaults were literal CSS values and worked without a theme container.
Useful? React with 👍 / 👎.
|
|
||
| import { style } from '@vanilla-extract/css' | ||
|
|
||
| import { vars } from '@atls-ui-parts/theme' |
There was a problem hiding this comment.
Avoid importing page-wide globals from Tooltip
Whenever a consumer imports @atls-ui-parts/tooltip, this new dependency import loads @atls-ui-parts/theme; that package's theme.css.ts imports global.css, which emits globalStyle rules for html, body, and #__next (margin/padding reset, overflowX: hidden, etc.). A leaf tooltip component should not mutate the host document, because embedding it in an existing app can unexpectedly change page layout even when the app did not opt into the theme globals.
Useful? React with 👍 / 👎.
| const containerAppearance = appearance ?? defaultAppearance | ||
| const containerShape = shape ?? defaultShape |
There was a problem hiding this comment.
Merge custom style slots with defaults
When consumers use the new public API to style the default container, e.g. appearance={{ container: customClass }} or shape={{ container: customClass }}, this replaces the corresponding default class instead of appending to it. That means a class meant to tweak just one property drops the built-in defaults from the old container (color/background/shadow for appearance, or padding/radius/z-index for shape), which violates the issue requirement that the default container preserve its internal styles while accepting a user class.
Useful? React with 👍 / 👎.
Таска
Как проверять
Контекст: Storybook
Действие: открыть Tooltip в текущей версии и версии master, сравнить поведение и внешний вид дефолтного варианта
Ожидаемый результат: Tooltip выглядит и ведёт себя так же, как в master; открытие, закрытие, arrow, animated и floating-позиционирование работают без регрессий
Контекст: использование
@atls-ui-parts/tooltipкак библиотечного компонента без кастомногоcontainerДействие: передать пользовательские стили в Tooltip через публичный API компонента для дефолтного container
Ожидаемый результат: Tooltip принимает пользовательские стили без замены container; внутренние классы дефолтного container не перетираются; arrow, animated, open и позиционирование сохраняются; дефолтный Tooltip выглядит и ведёт себя так же, как в master
Пруфы
Details
2026-06-10.03.19.02.mov