@apify/ui-library 1.93.0 → 1.93.1-featimprovetooltip-7e1224.59

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 (38) hide show
  1. package/dist/src/components/floating/floating_component_base.d.ts +40 -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 +109 -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 +36 -0
  10. package/dist/src/components/floating/tooltip.d.ts.map +1 -0
  11. package/dist/src/components/floating/tooltip.js +65 -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 +65 -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 +29 -0
  24. package/dist/src/components/shortcut.js.map +1 -0
  25. package/dist/src/ui_dependency_provider.d.ts +2 -0
  26. package/dist/src/ui_dependency_provider.d.ts.map +1 -1
  27. package/dist/src/ui_dependency_provider.js.map +1 -1
  28. package/dist/tsconfig.build.tsbuildinfo +1 -1
  29. package/package.json +2 -2
  30. package/src/components/floating/floating_component_base.tsx +199 -0
  31. package/src/components/floating/index.ts +2 -0
  32. package/src/components/floating/tooltip.stories.jsx +131 -0
  33. package/src/components/floating/tooltip.tsx +137 -0
  34. package/src/components/floating/tooltip_content.tsx +103 -0
  35. package/src/components/index.ts +1 -0
  36. package/src/components/shortcut.stories.jsx +58 -0
  37. package/src/components/shortcut.tsx +55 -0
  38. package/src/ui_dependency_provider.tsx +3 -0
@@ -0,0 +1,55 @@
1
+ import styled, { css } from 'styled-components';
2
+
3
+ import { theme } from '../design_system/theme.js';
4
+ import { Text } from './text/index.js';
5
+
6
+ interface ShortcutProps {
7
+ as?: keyof JSX.IntrinsicElements;
8
+ className?: string;
9
+ children: React.ReactNode;
10
+ /* If true, always use dark mode colors */
11
+ dark?: boolean;
12
+ }
13
+
14
+ const adaptiveColors = css`
15
+ background-color: ${theme.color.neutral.backgroundSubtle};
16
+ border: 1px solid ${theme.color.neutral.border};
17
+ color: ${theme.color.neutral.textSubtle};
18
+ `;
19
+
20
+ /* Tooltips with shortcuts use dark mode styles */
21
+ const darkColors = css`
22
+ background-color: ${theme.colorPalette.dark.neutral800};
23
+ border: 1px solid ${theme.colorPalette.dark.neutral700};
24
+ color: ${theme.colorPalette.dark.neutral400};
25
+ `;
26
+
27
+ const StyledShortcut = styled(Text)<{ $dark?: boolean }>`
28
+ min-width: 20px;
29
+ height: 20px;
30
+ display: inline-flex;
31
+ align-items: center;
32
+ justify-content: center;
33
+ border-radius: ${theme.radius.radius4};
34
+ padding: ${theme.space.space2} ${theme.space.space4};
35
+ ${({ $dark }) => ($dark ? darkColors : adaptiveColors)}
36
+ `;
37
+
38
+ export const Shortcut = ({
39
+ as,
40
+ className,
41
+ children,
42
+ dark = false,
43
+ }: ShortcutProps) => {
44
+ return (
45
+ <StyledShortcut
46
+ forwardedAs={as}
47
+ className={className}
48
+ $dark={dark}
49
+ type='code'
50
+ size='small'
51
+ weight='medium'>
52
+ {children}
53
+ </StyledShortcut>
54
+ );
55
+ };
@@ -1,4 +1,5 @@
1
1
  import type React from 'react';
2
+ import type { ReactNode } from 'react';
2
3
  import { createContext, useContext } from 'react';
3
4
 
4
5
  import type { UiThemeOption } from './design_system/theme.js';
@@ -32,6 +33,8 @@ export interface UiDependencies {
32
33
  uiTheme?: UiThemeOption, // Optional - as we can just fallback to light theme on the web
33
34
  // TODO: Make required once we add it on the web
34
35
  generateProxyImageUrl?: (url: string, options: ImageProxyOptions) => string
36
+ // Sanitize HTML for tooltips with SafeHtml component
37
+ tooltipSafeHtml: (content: ReactNode | string) => ReactNode,
35
38
  }
36
39
 
37
40
  interface UiDependencyProviderProps {