Skip to content

Refactor tooltip style contract#707

Open
comfrt1k wants to merge 3 commits into
masterfrom
refactor/tooltip-container-style-contract
Open

Refactor tooltip style contract#707
comfrt1k wants to merge 3 commits into
masterfrom
refactor/tooltip-container-style-contract

Conversation

@comfrt1k

Copy link
Copy Markdown
Contributor

Таска

Как проверять

  1. Контекст: Storybook
    Действие: открыть Tooltip в текущей версии и версии master, сравнить поведение и внешний вид дефолтного варианта
    Ожидаемый результат: Tooltip выглядит и ведёт себя так же, как в master; открытие, закрытие, arrow, animated и floating-позиционирование работают без регрессий

  2. Контекст: использование @atls-ui-parts/tooltip как библиотечного компонента без кастомного container
    Действие: передать пользовательские стили в Tooltip через публичный API компонента для дефолтного container
    Ожидаемый результат: Tooltip принимает пользовательские стили без замены container; внутренние классы дефолтного container не перетираются; arrow, animated, open и позиционирование сохраняются; дефолтный Tooltip выглядит и ведёт себя так же, как в master

Пруфы

Details
2026-06-10.03.19.02.mov

@TorinAsakura

Copy link
Copy Markdown
Member

@codex

Comment on lines 9 to 14
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 },
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

тут нарушение контракта явное

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

топонимическая редупликация

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ui-parts/tooltip/stories/story-tooltip.tsx и ui-parts/tooltip/stories/tooltip.stories.tsx…ничего не понимаю

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

Comment on lines +35 to +36
const containerAppearance = appearance ?? defaultAppearance
const containerShape = shape ?? defaultShape

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Прокидывание пользовательских стилей в Tooltip без кастомного container

2 participants