• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

zendeskgarden / react-components / 11298062083

11 Oct 2024 07:16PM UTC coverage: 95.904%. First build
11298062083

Pull #1941

github

web-flow
Merge 44948d1fe into aae638ccb
Pull Request #1941: chore(deps): update non-major shared dependencies

3322 of 3685 branches covered (90.15%)

Branch coverage included in aggregate %.

9908 of 10110 relevant lines covered (98.0%)

242.63 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

71.43
/packages/modals/src/styled/StyledTooltipDialog.ts
1
/**
2
 * Copyright Zendesk, Inc.
3
 *
4
 * Use of this source code is governed under the Apache License, Version 2.0
5
 * found at http://www.apache.org/licenses/LICENSE-2.0.
6
 */
7

8
import styled, { DefaultTheme, ThemeProps } from 'styled-components';
16✔
9
import { Placement } from '@floating-ui/react-dom';
10
import {
11
  arrowStyles,
12
  retrieveComponentStyles,
13
  getArrowPosition
14
} from '@zendeskgarden/react-theming';
16✔
15
import { StyledTooltipDialogClose } from '../styled/StyledTooltipDialogClose';
16✔
16
import { TransitionStatus } from 'react-transition-group';
17
import { ITooltipDialogProps } from '../types';
18

19
const COMPONENT_ID = 'modals.tooltip_dialog';
16✔
20

21
export interface IStyledTooltipDialogProps
22
  extends Pick<ITooltipDialogProps, 'hasArrow' | 'isAnimated'> {
23
  placement: Placement;
24
  transitionState?: TransitionStatus;
25
}
26

27
const sizeStyles = (props: ThemeProps<DefaultTheme>) => `
104✔
28
  padding: ${props.theme.space.base * 5}px;
29
  width: 400px;
30
  
31
  &:has(${StyledTooltipDialogClose}) > :first-child {
32
    padding-${props.theme.rtl ? 'left' : 'right'}: ${props.theme.space.base * 8}px;
104✔
33
  }
34
`;
35

36
export const StyledTooltipDialog = styled.div.attrs<IStyledTooltipDialogProps>(props => ({
104✔
37
  'data-garden-id': COMPONENT_ID,
38
  'data-garden-version': PACKAGE_VERSION,
39
  className: props.isAnimated && 'is-animated'
104!
40
}))<IStyledTooltipDialogProps>`
41
  ${props => {
42
    const computedArrowStyles = arrowStyles(getArrowPosition(props.theme, props.placement), {
104✔
43
      size: `${props.theme.space.base * 2}px`,
44
      inset: '1px',
45
      animationModifier: '.is-animated'
46
    });
47

48
    if (props.isAnimated) {
104!
49
      return props.hasArrow && props.transitionState === 'entered' && computedArrowStyles;
×
50
    }
51

52
    return props.hasArrow && computedArrowStyles;
104✔
53
  }};
54

55
  ${sizeStyles}
56

57
  ${props => retrieveComponentStyles(COMPONENT_ID, props)};
104✔
58
`;
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc