@apify/ui-library 1.92.0 → 1.92.1-featimprovetooltip-7e1224.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/src/components/floating/floating_component_base.d.ts +41 -0
  2. package/dist/src/components/floating/floating_component_base.d.ts.map +1 -0
  3. package/dist/src/components/floating/floating_component_base.js +151 -0
  4. package/dist/src/components/floating/floating_component_base.js.map +1 -0
  5. package/dist/src/components/floating/index.d.ts +2 -0
  6. package/dist/src/components/floating/index.d.ts.map +1 -1
  7. package/dist/src/components/floating/index.js +2 -0
  8. package/dist/src/components/floating/index.js.map +1 -1
  9. package/dist/src/components/floating/tooltip.d.ts +35 -0
  10. package/dist/src/components/floating/tooltip.d.ts.map +1 -0
  11. package/dist/src/components/floating/tooltip.js +56 -0
  12. package/dist/src/components/floating/tooltip.js.map +1 -0
  13. package/dist/src/components/floating/tooltip_content.d.ts +5 -0
  14. package/dist/src/components/floating/tooltip_content.d.ts.map +1 -0
  15. package/dist/src/components/floating/tooltip_content.js +51 -0
  16. package/dist/src/components/floating/tooltip_content.js.map +1 -0
  17. package/dist/src/components/index.d.ts +1 -0
  18. package/dist/src/components/index.d.ts.map +1 -1
  19. package/dist/src/components/index.js +1 -0
  20. package/dist/src/components/index.js.map +1 -1
  21. package/dist/src/components/shortcut.d.ts +9 -0
  22. package/dist/src/components/shortcut.d.ts.map +1 -0
  23. package/dist/src/components/shortcut.js +28 -0
  24. package/dist/src/components/shortcut.js.map +1 -0
  25. package/dist/tsconfig.build.tsbuildinfo +1 -1
  26. package/package.json +2 -2
  27. package/src/components/floating/floating_component_base.tsx +263 -0
  28. package/src/components/floating/index.ts +2 -0
  29. package/src/components/floating/tooltip.stories.jsx +128 -0
  30. package/src/components/floating/tooltip.tsx +120 -0
  31. package/src/components/floating/tooltip_content.tsx +80 -0
  32. package/src/components/index.ts +1 -0
  33. package/src/components/shortcut.stories.jsx +57 -0
  34. package/src/components/shortcut.tsx +54 -0
@@ -0,0 +1,41 @@
1
+ import { type Strategy } from '@floating-ui/react';
2
+ import { type ComponentType, type ReactNode, type RefObject } from 'react';
3
+ export declare const classNames: {
4
+ ARROW: string;
5
+ CHILDREN: string;
6
+ };
7
+ export declare const FLOATING_PLACEMENT: {
8
+ readonly TOP: "top";
9
+ readonly TOP_START: "top-start";
10
+ readonly TOP_END: "top-end";
11
+ readonly RIGHT: "right";
12
+ readonly RIGHT_START: "right-start";
13
+ readonly RIGHT_END: "right-end";
14
+ readonly BOTTOM: "bottom";
15
+ readonly BOTTOM_START: "bottom-start";
16
+ readonly BOTTOM_END: "bottom-end";
17
+ readonly LEFT: "left";
18
+ readonly LEFT_START: "left-start";
19
+ readonly LEFT_END: "left-end";
20
+ };
21
+ export type FloatingPlacement = typeof FLOATING_PLACEMENT[keyof typeof FLOATING_PLACEMENT];
22
+ export interface FloatingComponentBaseProps {
23
+ placement?: FloatingPlacement;
24
+ autoPlacements?: FloatingPlacement[];
25
+ strategy?: Strategy;
26
+ content?: ReactNode | string;
27
+ children?: ReactNode;
28
+ isOpen?: boolean;
29
+ triggerRef?: RefObject<HTMLDivElement>;
30
+ className?: string;
31
+ offsetPx?: number;
32
+ contentWrapClassName?: string;
33
+ CloseButtonComponent?: ComponentType;
34
+ showInPortal?: boolean;
35
+ }
36
+ /**
37
+ * This is just the base component for Tooltips and Popovers.
38
+ * Don't use this - use Tooltip/HelpPopover instead.
39
+ */
40
+ export declare const FloatingComponentBase: ({ placement, autoPlacements, strategy, content, children, isOpen, triggerRef, className, offsetPx, contentWrapClassName, CloseButtonComponent, showInPortal, }: FloatingComponentBaseProps) => import("react/jsx-runtime").JSX.Element;
41
+ //# sourceMappingURL=floating_component_base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"floating_component_base.d.ts","sourceRoot":"","sources":["../../../../src/components/floating/floating_component_base.tsx"],"names":[],"mappings":"AAAA,OAAO,EASH,KAAK,QAAQ,EAEhB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,KAAK,aAAa,EAAmD,KAAK,SAAS,EAAE,KAAK,SAAS,EAAmB,MAAM,OAAO,CAAC;AAK7I,eAAO,MAAM,UAAU;;;CAGtB,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;CAarB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,OAAO,kBAAkB,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAqB3F,MAAM,WAAW,0BAA0B;IACvC,SAAS,CAAC,EAAE,iBAAiB,CAAC;IAC9B,cAAc,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACrC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,OAAO,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IAC7B,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,oBAAoB,CAAC,EAAE,aAAa,CAAC;IACrC,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B;AA8ED;;;GAGG;AACH,eAAO,MAAM,qBAAqB,mKAa/B,0BAA0B,4CA+F5B,CAAC"}
@@ -0,0 +1,151 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { arrow, autoPlacement, autoUpdate, flip, FloatingPortal, hide, offset, shift, useFloating, } from '@floating-ui/react';
3
+ import clsx from 'clsx';
4
+ import { forwardRef, useMemo, useRef } from 'react';
5
+ import styled, { keyframes } from 'styled-components';
6
+ import { theme } from '../../design_system/theme.js';
7
+ export const classNames = {
8
+ ARROW: 'FloatingComponent-arrow',
9
+ CHILDREN: 'FloatingComponent-children',
10
+ };
11
+ export const FLOATING_PLACEMENT = {
12
+ TOP: 'top',
13
+ TOP_START: 'top-start',
14
+ TOP_END: 'top-end',
15
+ RIGHT: 'right',
16
+ RIGHT_START: 'right-start',
17
+ RIGHT_END: 'right-end',
18
+ BOTTOM: 'bottom',
19
+ BOTTOM_START: 'bottom-start',
20
+ BOTTOM_END: 'bottom-end',
21
+ LEFT: 'left',
22
+ LEFT_START: 'left-start',
23
+ LEFT_END: 'left-end',
24
+ };
25
+ const fadeIn = keyframes `
26
+ from {
27
+ opacity: 0;
28
+ }
29
+ to {
30
+ opacity: 1;
31
+ }
32
+ `;
33
+ const FadeIn = styled.div `
34
+ @media (prefers-reduced-motion: no-preference) {
35
+ animation-name: ${fadeIn};
36
+ animation-fill-mode: backwards;
37
+ animation-duration: ${(props) => `${props.duration || 240}ms`};
38
+ animation-delay: ${(props) => `${props.delay || 0}ms`};
39
+ }
40
+
41
+ min-height: ${({ $minHeight }) => $minHeight || 'unset'};
42
+ `;
43
+ const FloatingComponentWrapStyled = styled.span `
44
+ box-shadow: ${theme.shadow.shadow2};
45
+ padding: ${theme.space.space16};
46
+ ${theme.typography.shared.mobile.bodyM};
47
+ border-radius: 0.8rem;
48
+ z-index: 999;
49
+ white-space: normal;
50
+ word-break: break-word;
51
+ cursor: default;
52
+ text-align: left;
53
+
54
+ .${classNames.ARROW} {
55
+ position: absolute;
56
+ background-color: inherit;
57
+ border: inherit;
58
+ width: 10px;
59
+ height: 10px;
60
+ transform: ${({ arrowRotationDegs }) => `rotate(${arrowRotationDegs}deg)`} ;
61
+ z-index:-1;
62
+ }
63
+
64
+ @media ${theme.device.tablet} {
65
+ ${theme.typography.shared.tablet.bodyM};
66
+ }
67
+
68
+ @media ${theme.device.desktop} {
69
+ ${theme.typography.shared.desktop.bodyM};
70
+ }
71
+ `;
72
+ const ChildrenWrap = styled.div `
73
+ .${classNames.CHILDREN} {
74
+ width: fit-content;
75
+ }
76
+ `;
77
+ const StyledPopoverBox = styled.div `
78
+ display: flex;
79
+ align-items: center;
80
+ gap: ${theme.space.space4};
81
+ button {
82
+ color: inherit;
83
+ }
84
+ `;
85
+ const FloatingComponentWrap = forwardRef((props, ref) => {
86
+ const { showInPortal, ...rest } = props;
87
+ const component = _jsx(FloatingComponentWrapStyled, { ...rest, ref: ref });
88
+ if (showInPortal) {
89
+ return _jsx(FloatingPortal, { children: component });
90
+ }
91
+ return component;
92
+ });
93
+ FloatingComponentWrap.displayName = 'FloatingComponentWrap';
94
+ /**
95
+ * This is just the base component for Tooltips and Popovers.
96
+ * Don't use this - use Tooltip/HelpPopover instead.
97
+ */
98
+ export const FloatingComponentBase = ({ placement = FLOATING_PLACEMENT.TOP, autoPlacements, strategy = 'fixed', content, children, isOpen = false, triggerRef, className, offsetPx = 10, contentWrapClassName, CloseButtonComponent, showInPortal = false, }) => {
99
+ const arrowRef = useRef(null);
100
+ const { x, y, refs: { setReference, setFloating }, placement: effectivePlacement, strategy: effectiveStrategy, middlewareData: { arrow: { x: arrowX, y: arrowY } = {}, hide: refHidden, }, } = useFloating({
101
+ placement,
102
+ strategy,
103
+ whileElementsMounted: autoUpdate,
104
+ middleware: [
105
+ offset(offsetPx),
106
+ autoPlacements?.length ? autoPlacement({ allowedPlacements: autoPlacements }) : flip(),
107
+ shift({ padding: 5 }),
108
+ arrow({ element: arrowRef, padding: 9 }),
109
+ hide({
110
+ strategy: 'referenceHidden',
111
+ }),
112
+ ],
113
+ });
114
+ const arrowStyle = useMemo(() => {
115
+ const staticSide = {
116
+ top: 'bottom',
117
+ right: 'left',
118
+ bottom: 'top',
119
+ left: 'right',
120
+ }[effectivePlacement.split('-')[0]];
121
+ let borderNone = { borderLeft: 0, borderTop: 0 };
122
+ if (staticSide === 'bottom')
123
+ borderNone = { borderRight: 0, borderBottom: 0 };
124
+ if (staticSide === 'right')
125
+ borderNone = { borderLeft: 0, borderBottom: 0 };
126
+ if (staticSide === 'left')
127
+ borderNone = { borderRight: 0, borderTop: 0 };
128
+ const style = {
129
+ left: arrowX != null ? `${arrowX}px` : '',
130
+ top: arrowY != null ? `${arrowY}px` : '',
131
+ ...borderNone,
132
+ };
133
+ if (staticSide) {
134
+ style[staticSide] = '-6px';
135
+ }
136
+ return style;
137
+ }, [arrowX, arrowY, effectivePlacement]);
138
+ const arrowRotationDegs = effectivePlacement.includes(FLOATING_PLACEMENT.TOP) || effectivePlacement.includes(FLOATING_PLACEMENT.BOTTOM) ? 225 : 45;
139
+ if (!content)
140
+ return _jsx("span", { children: children });
141
+ return (_jsxs(_Fragment, { children: [_jsx(ChildrenWrap, { className: clsx(classNames.CHILDREN, contentWrapClassName), ref: setReference, children: children }), isOpen && (_jsxs(FloatingComponentWrap, { arrowRotationDegs: arrowRotationDegs, className: className, ref: setFloating, style: {
142
+ position: effectiveStrategy,
143
+ top: y ?? 0,
144
+ left: x ?? 0,
145
+ width: 'max-content',
146
+ visibility: refHidden?.referenceHidden ? 'hidden' : 'visible',
147
+ }, onClick: (e) => e.stopPropagation(), showInPortal: showInPortal, children: [_jsx(FadeIn, { delay: 60, ref: triggerRef, children: CloseButtonComponent
148
+ ? _jsxs(StyledPopoverBox, { children: [content, _jsx(CloseButtonComponent, {})] })
149
+ : content }), _jsx("div", { ref: arrowRef, className: classNames.ARROW, style: arrowStyle })] }))] }));
150
+ };
151
+ //# sourceMappingURL=floating_component_base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"floating_component_base.js","sourceRoot":"","sources":["../../../../src/components/floating/floating_component_base.tsx"],"names":[],"mappings":";AAAA,OAAO,EACH,KAAK,EACL,aAAa,EACb,UAAU,EACV,IAAI,EACJ,cAAc,EACd,IAAI,EACJ,MAAM,EACN,KAAK,EAEL,WAAW,GACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAA0C,UAAU,EAAmD,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC7I,OAAO,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,mBAAmB,CA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AS;iBAChE,EACD,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,EAAE,EACnC,YAAY,EAAE,YAAY,aAE1B,KAAC,MAAM,IAAC,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,UAAU,YAC7B,oBAAoB;4BACjB,CAAC,CAAC,MAAC,gBAAgB,eACd,OAAO,EACR,KAAC,oBAAoB,KAAG,IACT;4BACnB,CAAC,CAAC,OAAO,GACR,EACT,cACI,GAAG,EAAE,QAAQ,EACb,SAAS,EAAE,UAAU,CAAC,KAAK,EAC3B,KAAK,EAAE,UAAU,GACnB,IACkB,CAC3B,IACF,CACN,CAAC;AACN,CAAC,CAAC"}
@@ -1,4 +1,6 @@
1
1
  export * from './menu.js';
2
2
  export * from './menu_components.js';
3
3
  export * from './menu_common.js';
4
+ export * from './tooltip.js';
5
+ export { FLOATING_PLACEMENT, type FloatingPlacement } from './floating_component_base.js';
4
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/floating/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/floating/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,KAAK,iBAAiB,EAAE,MAAM,8BAA8B,CAAC"}
@@ -1,4 +1,6 @@
1
1
  export * from './menu.js';
2
2
  export * from './menu_components.js';
3
3
  export * from './menu_common.js';
4
+ export * from './tooltip.js';
5
+ export { FLOATING_PLACEMENT } from './floating_component_base.js';
4
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/floating/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/floating/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAA0B,MAAM,8BAA8B,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { type ComponentType } from 'react';
2
+ import { type FloatingComponentBaseProps } from './floating_component_base.js';
3
+ export declare const TOOLTIP_SIZES: {
4
+ readonly XSMALL: "xsmall";
5
+ readonly SMALL: "small";
6
+ readonly MEDIUM: "medium";
7
+ readonly LARGE: "large";
8
+ readonly XLARGE: "xlarge";
9
+ };
10
+ export type TooltipSize = typeof TOOLTIP_SIZES[keyof typeof TOOLTIP_SIZES];
11
+ interface PersistentTooltipProps {
12
+ isOpenOverride?: boolean;
13
+ CloseButtonComponent?: ComponentType;
14
+ }
15
+ export interface TooltipProps extends Omit<FloatingComponentBaseProps, 'isOpen' | 'size'> {
16
+ as?: keyof JSX.IntrinsicElements | ComponentType<unknown>;
17
+ className?: string;
18
+ persistent?: PersistentTooltipProps;
19
+ delayShow?: number;
20
+ delayHide?: number;
21
+ shortcuts?: string[];
22
+ imageUrl?: string;
23
+ subtleText?: string;
24
+ size?: TooltipSize;
25
+ }
26
+ interface WithTooltipProps {
27
+ tooltipProps?: TooltipProps;
28
+ }
29
+ /**
30
+ * Tooltip appears on hover, for onclick use Popover
31
+ */
32
+ export declare const Tooltip: ({ as, className, persistent, delayShow, delayHide, shortcuts, imageUrl, subtleText, size, ...rest }: TooltipProps) => import("react/jsx-runtime").JSX.Element;
33
+ export declare function withTooltip<T extends Record<string, unknown> = Record<string, unknown>>(Component: ComponentType<T>): import("react").ForwardRefExoticComponent<import("react").PropsWithoutRef<T & WithTooltipProps> & import("react").RefAttributes<HTMLElement>>;
34
+ export {};
35
+ //# sourceMappingURL=tooltip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../../src/components/floating/tooltip.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,aAAa,EAAwB,MAAM,OAAO,CAAC;AAIjE,OAAO,EAAyB,KAAK,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAGtG,eAAO,MAAM,aAAa;;;;;;CAMhB,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,OAAO,aAAa,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAE3E,UAAU,sBAAsB;IAC5B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,oBAAoB,CAAC,EAAE,aAAa,CAAC;CACxC;AAED,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,0BAA0B,EAAE,QAAQ,GAAG,MAAM,CAAC;IACrF,EAAE,CAAC,EAAE,MAAM,GAAG,CAAC,iBAAiB,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,sBAAsB,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,UAAU,gBAAgB;IACtB,YAAY,CAAC,EAAE,YAAY,CAAC;CAC/B;AAYD;;GAEG;AACH,eAAO,MAAM,OAAO,wGAWjB,YAAY,4CAuCd,CAAC;AAEF,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,iJAWnH"}
@@ -0,0 +1,56 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useFloating, useHover, useInteractions, } from '@floating-ui/react';
3
+ import { forwardRef, useState } from 'react';
4
+ import styled from 'styled-components';
5
+ import { theme } from '../../design_system/theme.js';
6
+ import { FloatingComponentBase } from './floating_component_base.js';
7
+ import { TooltipContent } from './tooltip_content.js';
8
+ export const TOOLTIP_SIZES = {
9
+ XSMALL: 'xsmall',
10
+ SMALL: 'small',
11
+ MEDIUM: 'medium',
12
+ LARGE: 'large', /* Previously WIDE */
13
+ XLARGE: 'xlarge', /* Previously WIDER */
14
+ };
15
+ // Using a styled component to get access to the `as` prop
16
+ const TooltipFocusArea = styled.span ``;
17
+ const StyledFloatingComponentBase = styled(FloatingComponentBase) `
18
+ color: ${theme.colorPalette.dark.neutral0};
19
+ background-color: ${theme.colorPalette.dark.neutral900};
20
+ border: 1px solid ${theme.color.neutral.smallTooltipBorder};
21
+ padding: ${theme.space.space8};
22
+ `;
23
+ /**
24
+ * Tooltip appears on hover, for onclick use Popover
25
+ */
26
+ export const Tooltip = ({ as, className, persistent, delayShow = 500, delayHide = 50, shortcuts = [], imageUrl, subtleText, size = TOOLTIP_SIZES.SMALL, ...rest }) => {
27
+ const { isOpenOverride, CloseButtonComponent } = persistent || {};
28
+ const [open, setOpen] = useState(false);
29
+ const { refs, context } = useFloating({
30
+ open,
31
+ onOpenChange: setOpen,
32
+ });
33
+ const hover = useHover(context, {
34
+ delay: {
35
+ open: delayShow,
36
+ close: delayHide,
37
+ },
38
+ });
39
+ const { getReferenceProps, getFloatingProps } = useInteractions([hover]);
40
+ const tooltipProps = {
41
+ ...rest,
42
+ isOpen: isOpenOverride !== undefined ? isOpenOverride : open,
43
+ content: _jsx(TooltipContent, { content: rest.content, shortcuts: shortcuts, imageUrl: imageUrl, subtleText: subtleText, size: size }),
44
+ };
45
+ return (_jsx(TooltipFocusArea, { as: as, className: className, ref: refs.setReference, ...getReferenceProps(), children: _jsx("div", { ref: refs.setFloating, ...getFloatingProps(), children: _jsx(StyledFloatingComponentBase, { ...tooltipProps, CloseButtonComponent: CloseButtonComponent }) }) }));
46
+ };
47
+ export function withTooltip(Component) {
48
+ const Enhanced = forwardRef(({ tooltipProps, ...rest }, ref) => {
49
+ if (!tooltipProps)
50
+ return _jsx(Component, { ...rest, ref: ref });
51
+ return _jsx(Tooltip, { ...tooltipProps, children: _jsx(Component, { ...rest, ref: ref }) });
52
+ });
53
+ Enhanced.displayName = `WithTooltip:${Component.displayName || Component.name}`;
54
+ return Enhanced;
55
+ }
56
+ //# sourceMappingURL=tooltip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tooltip.js","sourceRoot":"","sources":["../../../../src/components/floating/tooltip.tsx"],"names":[],"mappings":";AAAA,OAAO,EACH,WAAW,EACX,QAAQ,EACR,eAAe,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAsB,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAmC,MAAM,8BAA8B,CAAC;AACtG,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,CAAC,MAAM,aAAa,GAAG;IACzB,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,OAAO,EAAE,qBAAqB;IACrC,MAAM,EAAE,QAAQ,EAAE,sBAAsB;CAClC,CAAC;AAyBX,0DAA0D;AAC1D,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAA,EAAE,CAAC;AAEvC,MAAM,2BAA2B,GAAG,MAAM,CAAC,qBAAqB,C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AE,IAAI,EAAE,IAAI,GAAI;KACnI,CAAC;IAEF,OAAO,CACH,KAAC,gBAAgB,IACb,EAAE,EAAE,EAAiC,EACrC,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,IAAI,CAAC,YAAY,KAClB,iBAAiB,EAAE,YAEvB,cACI,GAAG,EAAE,IAAI,CAAC,WAAW,KACjB,gBAAgB,EAAE,YAEtB,KAAC,2BAA2B,OAAK,YAAY,EAAE,oBAAoB,EAAE,oBAAoB,GAAI,GAC3F,GACS,CACtB,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,UAAU,WAAW,CAA8D,SAA2B;IAChH,MAAM,QAAQ,GAAG,UAAU,CAAoC,CAAC,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,EAAE,GAAG,EAAE,EAAE;QAC9F,IAAI,CAAC,YAAY;YAAE,OAAO,KAAC,SAAS,OAAM,IAAqB,EAAE,GAAG,EAAE,GAAG,GAAI,CAAC;QAC9E,OAAO,KAAC,OAAO,OAAK,YAAY,YAC5B,KAAC,SAAS,OAAM,IAAqB,EAAE,GAAG,EAAE,GAAG,GAAI,GAC7C,CAAC;IACf,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,WAAW,GAAG,eAAe,SAAS,CAAC,WAAW,IAAI,SAAS,CAAC,IAAI,EAAE,CAAC;IAEhF,OAAO,QAAQ,CAAC;AACpB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { type TooltipProps } from './tooltip.js';
2
+ type ContentProps = Pick<TooltipProps, 'content' | 'shortcuts' | 'imageUrl' | 'subtleText' | 'size'>;
3
+ export declare const TooltipContent: ({ content, shortcuts, imageUrl, subtleText, size }: ContentProps) => import("react/jsx-runtime").JSX.Element;
4
+ export {};
5
+ //# sourceMappingURL=tooltip_content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tooltip_content.d.ts","sourceRoot":"","sources":["../../../../src/components/floating/tooltip_content.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAiB,KAAK,YAAY,EAAoB,MAAM,cAAc,CAAC;AAElF,KAAK,YAAY,GAAG,IAAI,CAAC,YAAY,EAAE,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,YAAY,GAAG,MAAM,CAAC,CAAC;AA8CrG,eAAO,MAAM,cAAc,uDAAmF,YAAY,4CA2BzH,CAAC"}
@@ -0,0 +1,51 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import styled, { css } from 'styled-components';
3
+ import { theme } from '../../design_system/theme.js';
4
+ import { Shortcut } from '../shortcut.js';
5
+ import { TOOLTIP_SIZES } from './tooltip.js';
6
+ const TOOLTIP_SIZES_VALUES = {
7
+ xsmall: '24rem',
8
+ small: '32rem',
9
+ medium: '40rem',
10
+ large: '48rem',
11
+ xlarge: '64rem',
12
+ };
13
+ const StyledContent = styled.div `
14
+ display: flex;
15
+ flex-direction: column;
16
+ gap: ${theme.space.space8};
17
+ /* Size - (tooltip padding + border) * 2 */
18
+ max-width: ${({ $size }) => css `calc(${TOOLTIP_SIZES_VALUES[$size]} - (${theme.space.space8} + 1px) * 2)`};
19
+
20
+ .Tooltip-image {
21
+ max-width: 100%;
22
+ max-height: 150px;
23
+ border-radius: 4px;
24
+ object-fit: contain;
25
+ }
26
+
27
+ .Tooltip-textContent {
28
+ display: flex;
29
+ flex-direction: column;
30
+ gap: ${theme.space.space8};
31
+
32
+ /* When there is no child with subtleText class */
33
+ &:not(:has(.Tooltip-subtleText)){
34
+ flex-direction: row;
35
+ flex-wrap: wrap;
36
+ }
37
+
38
+ .Tooltip-subtleText {
39
+ color: ${theme.colorPalette.dark.neutral500};
40
+ }
41
+
42
+ .Tooltip-shortcutContainer{
43
+ display: flex;
44
+ gap: ${theme.space.space4};
45
+ }
46
+ }
47
+ `;
48
+ export const TooltipContent = ({ content, shortcuts = [], imageUrl, subtleText, size = TOOLTIP_SIZES.SMALL }) => {
49
+ return (_jsxs(StyledContent, { "$size": size, children: [imageUrl && (_jsx("img", { src: imageUrl, alt: "", className: "Tooltip-image" })), _jsxs("div", { className: "Tooltip-textContent", children: [content, subtleText && (_jsx("div", { className: "Tooltip-subtleText", children: subtleText })), shortcuts.length > 0 && (_jsx("div", { className: 'Tooltip-shortcutContainer', children: shortcuts.map((shortcut, index) => (_jsx(Shortcut, { dark: true, children: shortcut }, `${shortcut}-${index}`))) }))] })] }));
50
+ };
51
+ //# sourceMappingURL=tooltip_content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tooltip_content.js","sourceRoot":"","sources":["../../../../src/components/floating/tooltip_content.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAuC,MAAM,cAAc,CAAC;AAIlF,MAAM,oBAAoB,GAAgC;IACtD,MAAM,EAAE,OAAO;IACf,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,OAAO;IACf,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,OAAO;CAClB,CAAC;AAEF,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAwB;;;WAG7C,KAAK,CAAC,KAAK,CAAC,MAAM;;iBAEZ,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA,QAAQ,oBAAoB,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,cAAc;;;;;;;;;;;;eAY9F,KAAK,CAAC,KAAK,CAAC,MAAM;;;;;;;;;qBASZ,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU;;;;;mBAKpC,KAAK,CAAC,KAAK,CAAC,MAAM;;;CAGpC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAAE,OAAO,EAAE,SAAS,GAAG,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,GAAG,aAAa,CAAC,KAAK,EAAgB,EAAE,EAAE;IAC1H,OAAO,CACH,MAAC,aAAa,aAAQ,IAAI,aACrB,QAAQ,IAAI,CACT,cACI,GAAG,EAAE,QAAQ,EACb,GAAG,EAAC,EAAE,EACN,SAAS,EAAC,eAAe,GAC3B,CACL,EACD,eAAK,SAAS,EAAC,qBAAqB,aAC/B,OAAO,EACP,UAAU,IAAI,CACX,cAAK,SAAS,EAAC,oBAAoB,YAC9B,UAAU,GACT,CACT,EACA,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,CACrB,cAAK,SAAS,EAAC,2BAA2B,YACrC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,CAAC,CAChC,KAAC,QAAQ,IAA8B,IAAI,kBAAE,QAAQ,IAAtC,GAAG,QAAQ,IAAI,KAAK,EAAE,CAA4B,CACpE,CAAC,GACA,CACT,IACC,IACM,CACnB,CAAC;AACN,CAAC,CAAC"}
@@ -20,4 +20,5 @@ export * from './rating.js';
20
20
  export * from './badge.js';
21
21
  export * from './tag.js';
22
22
  export * from './tabs/index.js';
23
+ export * from './shortcut.js';
23
24
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,0BAA0B,CAAC;AACzC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,0BAA0B,CAAC;AACzC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC"}
@@ -20,4 +20,5 @@ export * from './rating.js';
20
20
  export * from './badge.js';
21
21
  export * from './tag.js';
22
22
  export * from './tabs/index.js';
23
+ export * from './shortcut.js';
23
24
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,0BAA0B,CAAC;AACzC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,0BAA0B,CAAC;AACzC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC"}
@@ -0,0 +1,9 @@
1
+ interface ShortcutProps {
2
+ as?: keyof JSX.IntrinsicElements;
3
+ className?: string;
4
+ children: React.ReactNode;
5
+ dark?: boolean;
6
+ }
7
+ export declare const Shortcut: ({ as, className, children, dark, }: ShortcutProps) => import("react/jsx-runtime").JSX.Element;
8
+ export {};
9
+ //# sourceMappingURL=shortcut.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shortcut.d.ts","sourceRoot":"","sources":["../../../src/components/shortcut.tsx"],"names":[],"mappings":"AAKA,UAAU,aAAa;IACnB,EAAE,CAAC,EAAE,MAAM,GAAG,CAAC,iBAAiB,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAE1B,IAAI,CAAC,EAAE,OAAO,CAAC;CAClB;AAyBD,eAAO,MAAM,QAAQ,uCAKlB,aAAa,4CAYf,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import styled, { css } from 'styled-components';
3
+ import { theme } from '../design_system/theme.js';
4
+ import { Text } from './text/index.js';
5
+ const adaptiveColors = css `
6
+ background-color: ${theme.color.neutral.backgroundSubtle};
7
+ border: 1px solid ${theme.color.neutral.border};
8
+ color: ${theme.color.neutral.textSubtle};
9
+ `;
10
+ const darkColors = css `
11
+ background-color: ${theme.colorPalette.dark.neutral800};
12
+ border: 1px solid ${theme.colorPalette.dark.neutral700};
13
+ color: ${theme.colorPalette.dark.neutral400};
14
+ `;
15
+ const StyledShortcut = styled(Text) `
16
+ min-width: 10px; /* 20 - paddings - borders */
17
+ height: 14px; /* 20 - paddings - borders */
18
+ display: inline-flex;
19
+ align-items: center;
20
+ justify-content: center;
21
+ border-radius: ${theme.radius.radius4};
22
+ padding: ${theme.space.space2} ${theme.space.space4};
23
+ ${({ $dark }) => ($dark ? darkColors : adaptiveColors)}
24
+ `;
25
+ export const Shortcut = ({ as, className, children, dark = false, }) => {
26
+ return (_jsx(StyledShortcut, { forwardedAs: as, className: className, "$dark": dark, type: 'code', size: 'small', weight: 'medium', children: children }));
27
+ };
28
+ //# sourceMappingURL=shortcut.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":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