Skip to content
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

feat(tooltip): add withTransition prop #1565

Merged
merged 1 commit into from
Feb 7, 2025
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
5 changes: 5 additions & 0 deletions .changeset/tall-elephants-trade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@alfalab/core-components-tooltip': minor
---

Добавлено свойство withTransition
2 changes: 2 additions & 0 deletions packages/tooltip/src/desktop/Component.desktop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export const TooltipDesktop: FC<TooltipDesktopProps> = ({
colors = 'default',
useAnchorWidth,
onTargetClick,
withTransition = true,
}) => {
const [visible, setVisible] = useState(!!forcedOpen);
const [target, setTarget] = useState<HTMLElement | null>(null);
Expand Down Expand Up @@ -238,6 +239,7 @@ export const TooltipDesktop: FC<TooltipDesktopProps> = ({
preventOverflow={preventOverflow}
availableHeight={availableHeight}
useAnchorWidth={useAnchorWidth}
withTransition={withTransition}
>
<div {...getContentProps()}>{content}</div>
</Popover>
Expand Down
1 change: 1 addition & 0 deletions packages/tooltip/src/docs/Component.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export const tooltip_desktop: Story = {
onOpenDelay={number('onOpenDelay (in ms)', 300)}
view={select('view', ['tooltip', 'hint'], 'tooltip')}
colors={select('colors', ['default', 'inverted'], 'default')}
withTransition={select('withTransition', [true, false], true)}
dataTestId='test-id'
>
{isPreview ? (
Expand Down
5 changes: 5 additions & 0 deletions packages/tooltip/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ export type TooltipDesktopProps = {
*/
useAnchorWidth?: boolean;

/**
* Показывать тултип с анимацией
*/
withTransition?: boolean;

/**
* Тэг для target обертки
* @default div
Expand Down
Loading