@apify/ui-library 1.138.2-featpublictasks-2f3d3c.52 → 1.138.3

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 (91) hide show
  1. package/dist/src/components/chip.d.ts.map +1 -1
  2. package/dist/src/components/chip.js +2 -25
  3. package/dist/src/components/chip.js.map +1 -1
  4. package/dist/src/components/collapsible_card/collapsible_card.d.ts +2 -3
  5. package/dist/src/components/collapsible_card/collapsible_card.d.ts.map +1 -1
  6. package/dist/src/components/collapsible_card/collapsible_card.js +2 -2
  7. package/dist/src/components/collapsible_card/collapsible_card.js.map +1 -1
  8. package/dist/src/components/floating/floating_component_base.d.ts +1 -72
  9. package/dist/src/components/floating/floating_component_base.d.ts.map +1 -1
  10. package/dist/src/components/floating/floating_component_base.js +36 -66
  11. package/dist/src/components/floating/floating_component_base.js.map +1 -1
  12. package/dist/src/components/floating/tooltip.d.ts +3 -10
  13. package/dist/src/components/floating/tooltip.d.ts.map +1 -1
  14. package/dist/src/components/floating/tooltip.js +20 -24
  15. package/dist/src/components/floating/tooltip.js.map +1 -1
  16. package/dist/src/components/index.d.ts +0 -2
  17. package/dist/src/components/index.d.ts.map +1 -1
  18. package/dist/src/components/index.js +0 -2
  19. package/dist/src/components/index.js.map +1 -1
  20. package/dist/tsconfig.build.tsbuildinfo +1 -1
  21. package/package.json +4 -4
  22. package/src/components/chip.tsx +1 -27
  23. package/src/components/collapsible_card/collapsible_card.tsx +4 -6
  24. package/src/components/floating/floating_component_base.tsx +47 -89
  25. package/src/components/floating/tooltip.tsx +25 -53
  26. package/src/components/index.ts +0 -2
  27. package/dist/src/components/actor_example/actor_example.utils.d.ts +0 -17
  28. package/dist/src/components/actor_example/actor_example.utils.d.ts.map +0 -1
  29. package/dist/src/components/actor_example/actor_example.utils.js +0 -41
  30. package/dist/src/components/actor_example/actor_example.utils.js.map +0 -1
  31. package/dist/src/components/actor_example/actor_example_avatar.d.ts +0 -13
  32. package/dist/src/components/actor_example/actor_example_avatar.d.ts.map +0 -1
  33. package/dist/src/components/actor_example/actor_example_avatar.js +0 -34
  34. package/dist/src/components/actor_example/actor_example_avatar.js.map +0 -1
  35. package/dist/src/components/actor_example/actor_example_card.d.ts +0 -28
  36. package/dist/src/components/actor_example/actor_example_card.d.ts.map +0 -1
  37. package/dist/src/components/actor_example/actor_example_card.js +0 -79
  38. package/dist/src/components/actor_example/actor_example_card.js.map +0 -1
  39. package/dist/src/components/actor_example/actor_example_preview.d.ts +0 -28
  40. package/dist/src/components/actor_example/actor_example_preview.d.ts.map +0 -1
  41. package/dist/src/components/actor_example/actor_example_preview.js +0 -208
  42. package/dist/src/components/actor_example/actor_example_preview.js.map +0 -1
  43. package/dist/src/components/actor_example/actor_example_run_button.d.ts +0 -33
  44. package/dist/src/components/actor_example/actor_example_run_button.d.ts.map +0 -1
  45. package/dist/src/components/actor_example/actor_example_run_button.js +0 -12
  46. package/dist/src/components/actor_example/actor_example_run_button.js.map +0 -1
  47. package/dist/src/components/actor_example/actor_example_schema.d.ts +0 -20
  48. package/dist/src/components/actor_example/actor_example_schema.d.ts.map +0 -1
  49. package/dist/src/components/actor_example/actor_example_schema.js +0 -27
  50. package/dist/src/components/actor_example/actor_example_schema.js.map +0 -1
  51. package/dist/src/components/actor_example/actor_example_schema_field.d.ts +0 -19
  52. package/dist/src/components/actor_example/actor_example_schema_field.d.ts.map +0 -1
  53. package/dist/src/components/actor_example/actor_example_schema_field.js +0 -33
  54. package/dist/src/components/actor_example/actor_example_schema_field.js.map +0 -1
  55. package/dist/src/components/actor_example/actor_example_schema_field_badge.d.ts +0 -9
  56. package/dist/src/components/actor_example/actor_example_schema_field_badge.d.ts.map +0 -1
  57. package/dist/src/components/actor_example/actor_example_schema_field_badge.js +0 -48
  58. package/dist/src/components/actor_example/actor_example_schema_field_badge.js.map +0 -1
  59. package/dist/src/components/actor_example/actor_example_schema_legend.d.ts +0 -10
  60. package/dist/src/components/actor_example/actor_example_schema_legend.d.ts.map +0 -1
  61. package/dist/src/components/actor_example/actor_example_schema_legend.js +0 -29
  62. package/dist/src/components/actor_example/actor_example_schema_legend.js.map +0 -1
  63. package/dist/src/components/actor_example/actor_example_schema_property.d.ts +0 -24
  64. package/dist/src/components/actor_example/actor_example_schema_property.d.ts.map +0 -1
  65. package/dist/src/components/actor_example/actor_example_schema_property.js +0 -122
  66. package/dist/src/components/actor_example/actor_example_schema_property.js.map +0 -1
  67. package/dist/src/components/actor_example/index.d.ts +0 -11
  68. package/dist/src/components/actor_example/index.d.ts.map +0 -1
  69. package/dist/src/components/actor_example/index.js +0 -11
  70. package/dist/src/components/actor_example/index.js.map +0 -1
  71. package/dist/src/components/browser_window/browser_window.d.ts +0 -20
  72. package/dist/src/components/browser_window/browser_window.d.ts.map +0 -1
  73. package/dist/src/components/browser_window/browser_window.js +0 -72
  74. package/dist/src/components/browser_window/browser_window.js.map +0 -1
  75. package/dist/src/components/browser_window/index.d.ts +0 -2
  76. package/dist/src/components/browser_window/index.d.ts.map +0 -1
  77. package/dist/src/components/browser_window/index.js +0 -2
  78. package/dist/src/components/browser_window/index.js.map +0 -1
  79. package/src/components/actor_example/actor_example.utils.ts +0 -52
  80. package/src/components/actor_example/actor_example_avatar.tsx +0 -69
  81. package/src/components/actor_example/actor_example_card.tsx +0 -149
  82. package/src/components/actor_example/actor_example_preview.tsx +0 -295
  83. package/src/components/actor_example/actor_example_run_button.tsx +0 -61
  84. package/src/components/actor_example/actor_example_schema.tsx +0 -60
  85. package/src/components/actor_example/actor_example_schema_field.tsx +0 -87
  86. package/src/components/actor_example/actor_example_schema_field_badge.tsx +0 -66
  87. package/src/components/actor_example/actor_example_schema_legend.tsx +0 -49
  88. package/src/components/actor_example/actor_example_schema_property.tsx +0 -242
  89. package/src/components/actor_example/index.ts +0 -10
  90. package/src/components/browser_window/browser_window.tsx +0 -106
  91. package/src/components/browser_window/index.ts +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apify/ui-library",
3
- "version": "1.138.2-featpublictasks-2f3d3c.52+68e3cd48a51",
3
+ "version": "1.138.3",
4
4
  "description": "React UI library used by apify.com",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -27,7 +27,7 @@
27
27
  "It's not nice, but helps us to get around the problem of multiple react instances."
28
28
  ],
29
29
  "dependencies": {
30
- "@apify/ui-icons": "^1.38.2-featpublictasks-2f3d3c.52+68e3cd48a51",
30
+ "@apify/ui-icons": "^1.38.1",
31
31
  "@floating-ui/react": "^0.27.19",
32
32
  "@floating-ui/react-dom": "^2.1.8",
33
33
  "@radix-ui/react-checkbox": "^1.3.3",
@@ -58,7 +58,7 @@
58
58
  "styled-components": "^6.1.19"
59
59
  },
60
60
  "devDependencies": {
61
- "@apify-packages/types": "^3.353.2-featpublictasks-2f3d3c.52+68e3cd48a51",
61
+ "@apify-packages/types": "^3.353.3",
62
62
  "@storybook/react-vite": "^10.3.5",
63
63
  "@types/hast": "^3.0.4",
64
64
  "@types/lodash": "^4.14.200",
@@ -72,5 +72,5 @@
72
72
  "src",
73
73
  "style"
74
74
  ],
75
- "gitHead": "68e3cd48a5189a18f916ad456f1f15d2767d3382"
75
+ "gitHead": "e0a71e5f378976ee3b84a9be8fe75ba712d42ac1"
76
76
  }
@@ -80,34 +80,9 @@ const chipTypeStyle = {
80
80
  `,
81
81
  } satisfies Record<CHIP_TYPES, unknown>;
82
82
 
83
- const chipTypeHoverStyle = {
84
- [CHIP_TYPES.DEFAULT]: css`
85
- background: ${theme.color.neutral.chipBackgroundHover};
86
- `,
87
- [CHIP_TYPES.PRIMARY]: css`
88
- background: ${theme.color.primary.chipBackgroundHover};
89
- `,
90
- [CHIP_TYPES.SUCCESS]: css`
91
- background: ${theme.color.success.chipBackgroundHover};
92
- `,
93
- [CHIP_TYPES.WARNING]: css`
94
- background: ${theme.color.warning.chipBackgroundHover};
95
- `,
96
- [CHIP_TYPES.DANGER]: css`
97
- background: ${theme.color.danger.chipBackgroundHover};
98
- `,
99
- } satisfies Record<CHIP_TYPES, unknown>;
100
-
101
83
  const StyledChip = styled.span<{ size: CHIP_SIZES; type: CHIP_TYPES; clickable: boolean }>`
102
84
  ${({ size }) => chipSizeStyle[size]};
103
85
  ${({ type }) => chipTypeStyle[type]};
104
- ${({ type, clickable }) =>
105
- clickable &&
106
- css`
107
- &:hover {
108
- ${chipTypeHoverStyle[type]};
109
- }
110
- `};
111
86
  /* Static styles */
112
87
  width: fit-content;
113
88
  display: flex;
@@ -136,7 +111,6 @@ export const Chip = forwardRef(
136
111
  {
137
112
  type = CHIP_TYPES.DEFAULT,
138
113
  size = CHIP_SIZES.MEDIUM,
139
- clickable = false,
140
114
  icon,
141
115
  children,
142
116
  className,
@@ -144,7 +118,7 @@ export const Chip = forwardRef(
144
118
  }: ChipProps,
145
119
  ref,
146
120
  ) => {
147
- const otherProps = { ...passThroughProps, type, size, clickable, className: clsx(className, classNames.BODY) };
121
+ const otherProps = { ...passThroughProps, type, size, className: clsx(className, classNames.BODY) };
148
122
 
149
123
  return (
150
124
  <StyledChip ref={ref} {...otherProps}>
@@ -1,6 +1,6 @@
1
1
  import * as Collapsible from '@radix-ui/react-collapsible';
2
2
  import clsx from 'clsx';
3
- import { type ReactNode, useState } from 'react';
3
+ import { type FC, type ReactNode, useState } from 'react';
4
4
  import styled, { css } from 'styled-components';
5
5
 
6
6
  import { ChevronDownIcon } from '@apify/ui-icons';
@@ -27,7 +27,6 @@ export type CollapsibleCardProps = {
27
27
  header: ReactNode;
28
28
  children: ReactNode;
29
29
  isExpanded?: boolean;
30
- isExpandedDefault?: boolean;
31
30
  onIsExpandedChanged?: (expanded: boolean) => void;
32
31
  noChevron?: boolean;
33
32
  noDivider?: boolean;
@@ -111,11 +110,10 @@ const CollapsibleContent = styled(Collapsible.Content)<{ $noDivider?: boolean }>
111
110
  ${({ $noDivider }) => ($noDivider ? '' : `border-top: 1px solid ${theme.color.neutral.border};`)}
112
111
  `;
113
112
 
114
- export const CollapsibleCard = ({
113
+ export const CollapsibleCard: FC<CollapsibleCardProps> = ({
115
114
  header,
116
115
  children,
117
116
  isExpanded,
118
- isExpandedDefault = false,
119
117
  onIsExpandedChanged,
120
118
  noChevron,
121
119
  noDivider,
@@ -126,9 +124,9 @@ export const CollapsibleCard = ({
126
124
  isHeaderGreyOnHover,
127
125
  as: Element,
128
126
  ...rest
129
- }: CollapsibleCardProps) => {
127
+ }) => {
130
128
  const isUncontrolled = isExpanded === undefined;
131
- const [isOpen, setOpen] = useState(isExpandedDefault);
129
+ const [isOpen, setOpen] = useState(false);
132
130
 
133
131
  let onHeaderClick;
134
132
  if (isUncontrolled) onHeaderClick = () => setOpen((prevIsOpen) => !prevIsOpen);
@@ -44,81 +44,6 @@ export const FLOATING_PLACEMENT = {
44
44
 
45
45
  export type FloatingPlacement = (typeof FLOATING_PLACEMENT)[keyof typeof FLOATING_PLACEMENT];
46
46
 
47
- type UseFloatingPopupOptions = {
48
- open: boolean;
49
- onOpenChange?: (open: boolean) => void;
50
- placement?: FloatingPlacement;
51
- strategy?: Strategy;
52
- autoPlacements?: FloatingPlacement[];
53
- offsetPx?: number;
54
- };
55
-
56
- /**
57
- * Shared `useFloating` + `useTransitionStyles` setup for popup-style components (`Tooltip`,
58
- * `Popover`, the inner positioning of `FloatingComponentBase`). Owns the middleware stack
59
- * (`offset` / `flip` | `autoPlacement` / `shift` / `hide`) and the side-aware in/out animation,
60
- * so individual consumers don't duplicate these.
61
- *
62
- * Returns the full `useFloating` result plus `isMounted` and `transitionStyles` from
63
- * `useTransitionStyles` — destructure what each consumer needs.
64
- */
65
- export const useFloatingPopup = ({
66
- open,
67
- onOpenChange,
68
- placement = FLOATING_PLACEMENT.TOP,
69
- strategy = 'fixed',
70
- autoPlacements,
71
- offsetPx = 10,
72
- }: UseFloatingPopupOptions) => {
73
- const floating = useFloating({
74
- open,
75
- onOpenChange,
76
- placement,
77
- strategy,
78
- whileElementsMounted: autoUpdate,
79
- middleware: [
80
- offset(offsetPx),
81
- autoPlacements?.length ? autoPlacement({ allowedPlacements: autoPlacements }) : flip(),
82
- shift({ padding: 5 }),
83
- hide({ strategy: 'referenceHidden' }),
84
- ],
85
- });
86
-
87
- const { isMounted, styles: transitionStyles } = useTransitionStyles(floating.context, {
88
- initial: ({ side }) => {
89
- switch (side) {
90
- case 'top':
91
- return { opacity: 0, scale: '0.9', transform: 'translateY(10px)' };
92
- case 'bottom':
93
- return { opacity: 0, scale: '0.9', transform: 'translateY(-10px)' };
94
- case 'left':
95
- return { opacity: 0, scale: '0.9', transform: 'translateX(10px)' };
96
- case 'right':
97
- return { opacity: 0, scale: '0.9', transform: 'translateX(-10px)' };
98
- default:
99
- return {};
100
- }
101
- },
102
- });
103
-
104
- return { ...floating, isMounted, transitionStyles };
105
- };
106
-
107
- /**
108
- * Builds the inline `style` object floating-ui consumers spread onto their popup wrapper:
109
- * positioning (`position`/`top`/`left`), `width: 'max-content'`, the `referenceHidden`
110
- * visibility toggle, and the in/out transition styles. Centralized so Tooltip / Popover /
111
- * `FloatingComponentBase` don't redeclare it.
112
- */
113
- export const getFloatingPopupStyle = (floating: ReturnType<typeof useFloatingPopup>): CSSProperties => ({
114
- position: floating.strategy,
115
- top: floating.y ?? 0,
116
- left: floating.x ?? 0,
117
- width: 'max-content',
118
- visibility: floating.middlewareData.hide?.referenceHidden ? 'hidden' : 'visible',
119
- ...floating.transitionStyles,
120
- });
121
-
122
47
  interface FloatingComponentWrapProps {
123
48
  showInPortal?: boolean;
124
49
  className?: string;
@@ -142,12 +67,7 @@ export interface FloatingComponentBaseProps {
142
67
  showInPortal?: boolean;
143
68
  }
144
69
 
145
- /**
146
- * Base styling for any popup that renders via floating-ui (Tooltip, Popover, …). Tooltip extends
147
- * this via `styled(...)` to layer on its dark theme + tighter padding without re-declaring the
148
- * shared rules.
149
- */
150
- export const FloatingComponentWrapper = styled.span`
70
+ const FloatingComponentWrapStyled = styled.span`
151
71
  padding: ${theme.space.space16};
152
72
  ${theme.typography.shared.mobile.bodyM};
153
73
  border-radius: 0.8rem;
@@ -180,7 +100,7 @@ const StyledPopoverBox = styled.div`
180
100
 
181
101
  const FloatingComponentWrap = forwardRef<HTMLSpanElement, FloatingComponentWrapProps>((props, ref) => {
182
102
  const { showInPortal, ...rest } = props;
183
- const component = <FloatingComponentWrapper {...rest} ref={ref} />;
103
+ const component = <FloatingComponentWrapStyled {...rest} ref={ref} />;
184
104
  if (showInPortal) {
185
105
  return <FloatingPortal>{component}</FloatingPortal>;
186
106
  }
@@ -207,12 +127,43 @@ export const FloatingComponentBase = ({
207
127
  CloseButtonComponent,
208
128
  showInPortal = false,
209
129
  }: FloatingComponentBaseProps) => {
210
- const floating = useFloatingPopup({
130
+ const {
131
+ x,
132
+ y,
133
+ refs: { setReference, setFloating },
134
+ strategy: effectiveStrategy,
135
+ middlewareData: { hide: refHidden },
136
+ context,
137
+ } = useFloating({
211
138
  open: isOpen,
212
139
  placement,
213
140
  strategy,
214
- autoPlacements,
215
- offsetPx,
141
+ whileElementsMounted: autoUpdate,
142
+ middleware: [
143
+ offset(offsetPx),
144
+ autoPlacements?.length ? autoPlacement({ allowedPlacements: autoPlacements }) : flip(),
145
+ shift({ padding: 5 }),
146
+ hide({
147
+ strategy: 'referenceHidden',
148
+ }),
149
+ ],
150
+ });
151
+
152
+ const { isMounted, styles } = useTransitionStyles(context, {
153
+ initial: ({ side }) => {
154
+ switch (side) {
155
+ case 'top':
156
+ return { opacity: 0, scale: '0.9', transform: 'translateY(10px)' };
157
+ case 'bottom':
158
+ return { opacity: 0, scale: '0.9', transform: 'translateY(-10px)' };
159
+ case 'left':
160
+ return { opacity: 0, scale: '0.9', transform: 'translateX(10px)' };
161
+ case 'right':
162
+ return { opacity: 0, scale: '0.9', transform: 'translateX(-10px)' };
163
+ default:
164
+ return {};
165
+ }
166
+ },
216
167
  });
217
168
 
218
169
  if (!content) return <span>{children}</span>;
@@ -220,14 +171,21 @@ export const FloatingComponentBase = ({
220
171
  return (
221
172
  <>
222
173
  {/* Adding className to children for easier identifying in DevTools */}
223
- <ChildrenWrap className={clsx(classNames.CHILDREN, contentWrapClassName)} ref={floating.refs.setReference}>
174
+ <ChildrenWrap className={clsx(classNames.CHILDREN, contentWrapClassName)} ref={setReference}>
224
175
  {children}
225
176
  </ChildrenWrap>
226
- {floating.isMounted && (
177
+ {isMounted && (
227
178
  <FloatingComponentWrap
228
179
  className={className}
229
- ref={floating.refs.setFloating}
230
- style={getFloatingPopupStyle(floating)}
180
+ ref={setFloating}
181
+ style={{
182
+ position: effectiveStrategy,
183
+ top: y ?? 0,
184
+ left: x ?? 0,
185
+ width: 'max-content',
186
+ visibility: refHidden?.referenceHidden ? 'hidden' : 'visible',
187
+ ...styles,
188
+ }}
231
189
  onClick={(e) => e.stopPropagation()}
232
190
  showInPortal={showInPortal}
233
191
  >
@@ -1,15 +1,10 @@
1
- import { FloatingPortal, useHover, useInteractions } from '@floating-ui/react';
1
+ import { useFloating, useHover, useInteractions } from '@floating-ui/react';
2
2
  import { type ComponentType, type ElementType, forwardRef, type ReactNode, useState } from 'react';
3
3
  import styled, { css } from 'styled-components';
4
4
 
5
5
  import { theme } from '../../design_system/theme.js';
6
6
  import { useSharedUiDependencies } from '../../ui_dependency_provider.js';
7
- import {
8
- type FloatingComponentBaseProps,
9
- FloatingComponentWrapper,
10
- getFloatingPopupStyle,
11
- useFloatingPopup,
12
- } from './floating_component_base.js';
7
+ import { FloatingComponentBase, type FloatingComponentBaseProps } from './floating_component_base.js';
13
8
  import { TooltipContent } from './tooltip_content.js';
14
9
 
15
10
  export const TOOLTIP_TEXT_ALIGNS = {
@@ -29,10 +24,7 @@ export const TOOLTIP_SIZES = {
29
24
 
30
25
  export type TooltipSize = (typeof TOOLTIP_SIZES)[keyof typeof TOOLTIP_SIZES];
31
26
 
32
- export interface TooltipProps extends Omit<
33
- FloatingComponentBaseProps,
34
- 'isOpen' | 'size' | 'triggerRef' | 'CloseButtonComponent'
35
- > {
27
+ export interface TooltipProps extends Omit<FloatingComponentBaseProps, 'isOpen' | 'size'> {
36
28
  as?: ElementType;
37
29
  className?: string;
38
30
  delayShow?: number;
@@ -51,7 +43,7 @@ interface WithTooltipProps {
51
43
  // Using a styled component to get access to the `as` prop
52
44
  const TooltipFocusArea = styled.span``;
53
45
 
54
- const TooltipPopup = styled(FloatingComponentWrapper)<{ $isDarkTheme?: boolean }>`
46
+ const StyledFloatingComponentBase = styled(FloatingComponentBase)<{ $isDarkTheme?: boolean }>`
55
47
  color: ${theme.colorPalette.dark.neutral0};
56
48
  background-color: ${theme.colorPalette.dark.neutral900};
57
49
  padding: ${theme.space.space8};
@@ -73,14 +65,7 @@ const TooltipPopup = styled(FloatingComponentWrapper)<{ $isDarkTheme?: boolean }
73
65
  `;
74
66
 
75
67
  /**
76
- * Tooltip appears on hover, for onclick use Popover.
77
- *
78
- * Reference (the trigger wrapper) and floating (the popup) are rendered as separate DOM subtrees
79
- * — the popup is portaled (or rendered as a sibling fragment when `showInPortal={false}`), never
80
- * nested inside the trigger. floating-ui's `useHover` resolves open/close state by tracking the
81
- * cursor across distinct reference and floating elements; nesting them causes their bounding
82
- * rects to overlap and the state machine flips unpredictably (see floating-ui docs on the
83
- * reference/floating element separation requirement).
68
+ * Tooltip appears on hover, for onclick use Popover
84
69
  */
85
70
  export const Tooltip = ({
86
71
  as,
@@ -92,61 +77,48 @@ export const Tooltip = ({
92
77
  subtleText,
93
78
  size = TOOLTIP_SIZES.SMALL,
94
79
  textAlign = TOOLTIP_TEXT_ALIGNS.LEFT,
95
- placement,
96
- autoPlacements,
97
- strategy,
98
- offsetPx,
99
- contentWrapClassName,
100
- showInPortal = false,
101
- content,
102
- children,
80
+ ...rest
103
81
  }: TooltipProps): ReactNode => {
104
82
  const { uiTheme, tooltipSafeHtml } = useSharedUiDependencies();
105
83
  const [open, setOpen] = useState(false);
106
84
 
107
- const floating = useFloatingPopup({
85
+ const { refs, context } = useFloating({
108
86
  open,
109
87
  onOpenChange: setOpen,
110
- placement,
111
- strategy,
112
- autoPlacements,
113
- offsetPx,
114
88
  });
115
89
 
116
- const hover = useHover(floating.context, {
117
- delay: { open: delayShow, close: delayHide },
90
+ const hover = useHover(context, {
91
+ delay: {
92
+ open: delayShow,
93
+ close: delayHide,
94
+ },
118
95
  });
119
96
 
120
97
  const { getReferenceProps, getFloatingProps } = useInteractions([hover]);
121
98
 
122
- if (!content && !shortcuts?.length && !imageUrl && !subtleText) return children;
99
+ if (!rest.content && !shortcuts?.length && !imageUrl && !subtleText) return rest.children;
123
100
 
124
- const popup = (
125
- <TooltipPopup
126
- ref={floating.refs.setFloating}
127
- className={contentWrapClassName}
128
- $isDarkTheme={uiTheme === 'DARK'}
129
- style={getFloatingPopupStyle(floating)}
130
- {...getFloatingProps()}
131
- >
101
+ const tooltipProps = {
102
+ isOpen: open,
103
+ ...rest,
104
+ content: (
132
105
  <TooltipContent
133
- content={tooltipSafeHtml(content)}
106
+ content={tooltipSafeHtml(rest.content)}
134
107
  shortcuts={shortcuts}
135
108
  imageUrl={imageUrl}
136
109
  subtleText={subtleText}
137
110
  size={size}
138
111
  textAlign={textAlign}
139
112
  />
140
- </TooltipPopup>
141
- );
113
+ ),
114
+ };
142
115
 
143
116
  return (
144
- <>
145
- <TooltipFocusArea as={as} className={className} ref={floating.refs.setReference} {...getReferenceProps()}>
146
- {children}
147
- </TooltipFocusArea>
148
- {floating.isMounted && (showInPortal ? <FloatingPortal>{popup}</FloatingPortal> : popup)}
149
- </>
117
+ <TooltipFocusArea as={as} className={className} ref={refs.setReference} {...getReferenceProps()}>
118
+ <div ref={refs.setFloating} {...getFloatingProps()}>
119
+ <StyledFloatingComponentBase {...tooltipProps} $isDarkTheme={uiTheme === 'DARK'} />
120
+ </div>
121
+ </TooltipFocusArea>
150
122
  );
151
123
  };
152
124
 
@@ -27,8 +27,6 @@ export * from './icon_button.js';
27
27
  export * from './spinner.js';
28
28
  export * from './store/index.js';
29
29
  export * from './checkbox/index.js';
30
- export * from './actor_example/index.js';
31
- export * from './browser_window/index.js';
32
30
  export * from './collapsible_card/index.js';
33
31
  export * from './select/index.js';
34
32
  export * from './switch/index.js';
@@ -1,17 +0,0 @@
1
- import type { IconComponent } from '@apify/ui-icons';
2
- import type { ActorExampleSchemaFieldType } from '@apify-packages/types';
3
- export type ActorExampleSchemaPropertyConfig = {
4
- Icon: IconComponent;
5
- title: string;
6
- backgroundColor: string;
7
- textColor: string;
8
- };
9
- /**
10
- * Per-type display config used by the schema field components (badge icon, hover tooltip,
11
- * background/text colors). The `var(--actor-schema-field-*)` references are declared on the
12
- * `ActorExampleSchemaFieldBadgeWrapper` styled component itself (with a dark-mode override via
13
- * `html[data-theme='dark'] &`), so the vars are scoped to the badge — no globals are injected.
14
- */
15
- export declare const actorExampleSchemaPropertyMap: Record<ActorExampleSchemaFieldType, ActorExampleSchemaPropertyConfig>;
16
- export declare const actorExampleSchemaPropertyDefaultIcon: ({ size, className, title, titleId, ...props }: import("@apify/ui-icons").IconProps) => React.JSX.Element;
17
- //# sourceMappingURL=actor_example.utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"actor_example.utils.d.ts","sourceRoot":"","sources":["../../../../src/components/actor_example/actor_example.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGrD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAEzE,MAAM,MAAM,gCAAgC,GAAG;IAC3C,IAAI,EAAE,aAAa,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,EAAE,MAAM,CAAC,2BAA2B,EAAE,gCAAgC,CA+B/G,CAAC;AAEF,eAAO,MAAM,qCAAqC,2GAAU,CAAC"}
@@ -1,41 +0,0 @@
1
- import { AnyIcon, BooleanIcon, MenuIcon, NumberIcon, ObjectIcon, TextIcon } from '@apify/ui-icons';
2
- /**
3
- * Per-type display config used by the schema field components (badge icon, hover tooltip,
4
- * background/text colors). The `var(--actor-schema-field-*)` references are declared on the
5
- * `ActorExampleSchemaFieldBadgeWrapper` styled component itself (with a dark-mode override via
6
- * `html[data-theme='dark'] &`), so the vars are scoped to the badge — no globals are injected.
7
- */
8
- export const actorExampleSchemaPropertyMap = {
9
- string: {
10
- Icon: TextIcon,
11
- title: 'Text',
12
- backgroundColor: 'var(--actor-schema-field-string-background)',
13
- textColor: 'var(--actor-schema-field-string-text)',
14
- },
15
- number: {
16
- Icon: NumberIcon,
17
- title: 'Number',
18
- backgroundColor: 'var(--actor-schema-field-number-background)',
19
- textColor: 'var(--actor-schema-field-number-text)',
20
- },
21
- boolean: {
22
- Icon: BooleanIcon,
23
- title: 'Boolean',
24
- backgroundColor: 'var(--actor-schema-field-boolean-background)',
25
- textColor: 'var(--actor-schema-field-boolean-text)',
26
- },
27
- array: {
28
- Icon: MenuIcon,
29
- title: 'List',
30
- backgroundColor: 'var(--actor-schema-field-array-background)',
31
- textColor: 'var(--actor-schema-field-array-text)',
32
- },
33
- object: {
34
- Icon: ObjectIcon,
35
- title: 'Object',
36
- backgroundColor: 'var(--actor-schema-field-object-background)',
37
- textColor: 'var(--actor-schema-field-object-text)',
38
- },
39
- };
40
- export const actorExampleSchemaPropertyDefaultIcon = AnyIcon;
41
- //# sourceMappingURL=actor_example.utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"actor_example.utils.js","sourceRoot":"","sources":["../../../../src/components/actor_example/actor_example.utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAWnG;;;;;GAKG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAA0E;IAChH,MAAM,EAAE;QACJ,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,MAAM;QACb,eAAe,EAAE,6CAA6C;QAC9D,SAAS,EAAE,uCAAuC;KACrD;IACD,MAAM,EAAE;QACJ,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,QAAQ;QACf,eAAe,EAAE,6CAA6C;QAC9D,SAAS,EAAE,uCAAuC;KACrD;IACD,OAAO,EAAE;QACL,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,SAAS;QAChB,eAAe,EAAE,8CAA8C;QAC/D,SAAS,EAAE,wCAAwC;KACtD;IACD,KAAK,EAAE;QACH,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,MAAM;QACb,eAAe,EAAE,4CAA4C;QAC7D,SAAS,EAAE,sCAAsC;KACpD;IACD,MAAM,EAAE;QACJ,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,QAAQ;QACf,eAAe,EAAE,6CAA6C;QAC9D,SAAS,EAAE,uCAAuC;KACrD;CACJ,CAAC;AAEF,MAAM,CAAC,MAAM,qCAAqC,GAAG,OAAO,CAAC"}
@@ -1,13 +0,0 @@
1
- export declare const actorExampleAvatarClassNames: {
2
- ROOT: string;
3
- };
4
- export type ActorExampleAvatarProps = {
5
- title?: string;
6
- name: string;
7
- pictureUrl?: string;
8
- fallbackPictureUrl: string;
9
- size?: number;
10
- className?: string;
11
- };
12
- export declare const ActorExampleAvatar: ({ title, name, pictureUrl, fallbackPictureUrl, size, className, }: ActorExampleAvatarProps) => import("react/jsx-runtime").JSX.Element;
13
- //# sourceMappingURL=actor_example_avatar.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"actor_example_avatar.d.ts","sourceRoot":"","sources":["../../../../src/components/actor_example/actor_example_avatar.tsx"],"names":[],"mappings":"AASA,eAAO,MAAM,4BAA4B;;CAExC,CAAC;AAOF,MAAM,MAAM,uBAAuB,GAAG;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,mEAOhC,uBAAuB,4CAkCzB,CAAC"}
@@ -1,34 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { clsx } from 'clsx';
3
- import { useCallback, useMemo } from 'react';
4
- import styled from 'styled-components';
5
- import { useSharedUiDependencies } from '../../ui_dependency_provider.js';
6
- const DEFAULT_SIZE = 36;
7
- export const actorExampleAvatarClassNames = {
8
- ROOT: 'actor-example-avatar',
9
- };
10
- const ActorExampleAvatarWrapper = styled.img `
11
- flex-shrink: 0;
12
- object-fit: cover;
13
- `;
14
- export const ActorExampleAvatar = ({ title, name, pictureUrl, fallbackPictureUrl, size = DEFAULT_SIZE, className, }) => {
15
- const { generateProxyImageUrl } = useSharedUiDependencies();
16
- // Mirrors apify-web's `<Image defaultSrc=…>` behaviour: if the primary src fails to load,
17
- // swap in the fallback so the `<img>` element is always present.
18
- const handlePictureError = useCallback((event) => {
19
- if (!event.currentTarget.src.endsWith(fallbackPictureUrl)) {
20
- // eslint-disable-next-line no-param-reassign
21
- event.currentTarget.src = fallbackPictureUrl;
22
- // eslint-disable-next-line no-param-reassign
23
- event.currentTarget.srcset = fallbackPictureUrl;
24
- }
25
- }, [fallbackPictureUrl]);
26
- const proxyPictureUrl = useMemo(() => {
27
- if (!generateProxyImageUrl || !pictureUrl)
28
- return pictureUrl;
29
- return generateProxyImageUrl(pictureUrl, { resize: { height: size * 2, width: size * 2 } });
30
- }, [pictureUrl, generateProxyImageUrl, size]);
31
- const src = proxyPictureUrl || fallbackPictureUrl;
32
- return (_jsx(ActorExampleAvatarWrapper, { src: src, alt: title ?? name, width: size, height: size, className: clsx(actorExampleAvatarClassNames.ROOT, className), onError: handlePictureError }));
33
- };
34
- //# sourceMappingURL=actor_example_avatar.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"actor_example_avatar.js","sourceRoot":"","sources":["../../../../src/components/actor_example/actor_example_avatar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAE1E,MAAM,YAAY,GAAG,EAAE,CAAC;AAExB,MAAM,CAAC,MAAM,4BAA4B,GAAG;IACxC,IAAI,EAAE,sBAAsB;CAC/B,CAAC;AAEF,MAAM,yBAAyB,GAAG,MAAM,CAAC,GAAG,CAAA;;;CAG3C,CAAC;AAWF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EAC/B,KAAK,EACL,IAAI,EACJ,UAAU,EACV,kBAAkB,EAClB,IAAI,GAAG,YAAY,EACnB,SAAS,GACa,EAAE,EAAE;IAC1B,MAAM,EAAE,qBAAqB,EAAE,GAAG,uBAAuB,EAAE,CAAC;IAE5D,0FAA0F;IAC1F,iEAAiE;IACjE,MAAM,kBAAkB,GAAG,WAAW,CAClC,CAAC,KAA6C,EAAE,EAAE;QAC9C,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC;YACxD,6CAA6C;YAC7C,KAAK,CAAC,aAAa,CAAC,GAAG,GAAG,kBAAkB,CAAC;YAC7C,6CAA6C;YAC7C,KAAK,CAAC,aAAa,CAAC,MAAM,GAAG,kBAAkB,CAAC;QACpD,CAAC;IACL,CAAC,EACD,CAAC,kBAAkB,CAAC,CACvB,CAAC;IAEF,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,EAAE;QACjC,IAAI,CAAC,qBAAqB,IAAI,CAAC,UAAU;YAAE,OAAO,UAAU,CAAC;QAC7D,OAAO,qBAAqB,CAAC,UAAU,EAAE,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,GAAG,CAAC,EAAE,KAAK,EAAE,IAAI,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;IAChG,CAAC,EAAE,CAAC,UAAU,EAAE,qBAAqB,EAAE,IAAI,CAAC,CAAC,CAAC;IAE9C,MAAM,GAAG,GAAG,eAAe,IAAI,kBAAkB,CAAC;IAElD,OAAO,CACH,KAAC,yBAAyB,IACtB,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,KAAK,IAAI,IAAI,EAClB,KAAK,EAAE,IAAI,EACX,MAAM,EAAE,IAAI,EACZ,SAAS,EAAE,IAAI,CAAC,4BAA4B,CAAC,IAAI,EAAE,SAAS,CAAC,EAC7D,OAAO,EAAE,kBAAkB,GAC7B,CACL,CAAC;AACN,CAAC,CAAC"}
@@ -1,28 +0,0 @@
1
- export declare const actorExampleCardClassNames: {
2
- ROOT: string;
3
- CONTENT: string;
4
- BADGE: string;
5
- TITLE: string;
6
- FOOTER: string;
7
- RUN_BUTTON: string;
8
- DETAIL_BUTTON: string;
9
- };
10
- export type ActorExampleCardProps = {
11
- title: string;
12
- badge?: string;
13
- /** Owning actor's id — flows into the run button's analytics event. */
14
- actorId: string;
15
- runUrl: string;
16
- runLabel: string;
17
- /**
18
- * Tracking element id for the run button (e.g. `actorInfo.examples.run`). The card's
19
- * `title` is forwarded as `cardTitle` automatically.
20
- */
21
- runTrackingElement: string;
22
- detailUrl?: string;
23
- detailLabel: string;
24
- detailOpensInNewTab?: boolean;
25
- className?: string;
26
- };
27
- export declare const ActorExampleCard: ({ title, badge, actorId, runUrl, runLabel, runTrackingElement, detailUrl, detailLabel, detailOpensInNewTab, className, }: ActorExampleCardProps) => import("react/jsx-runtime").JSX.Element;
28
- //# sourceMappingURL=actor_example_card.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"actor_example_card.d.ts","sourceRoot":"","sources":["../../../../src/components/actor_example/actor_example_card.tsx"],"names":[],"mappings":"AAYA,eAAO,MAAM,0BAA0B;;;;;;;;CAQtC,CAAC;AA6DF,MAAM,MAAM,qBAAqB,GAAG;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uEAAuE;IACvE,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,0HAW9B,qBAAqB,4CAsCvB,CAAC"}