@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.
- package/dist/src/components/floating/floating_component_base.d.ts +41 -0
- package/dist/src/components/floating/floating_component_base.d.ts.map +1 -0
- package/dist/src/components/floating/floating_component_base.js +151 -0
- package/dist/src/components/floating/floating_component_base.js.map +1 -0
- package/dist/src/components/floating/index.d.ts +2 -0
- package/dist/src/components/floating/index.d.ts.map +1 -1
- package/dist/src/components/floating/index.js +2 -0
- package/dist/src/components/floating/index.js.map +1 -1
- package/dist/src/components/floating/tooltip.d.ts +35 -0
- package/dist/src/components/floating/tooltip.d.ts.map +1 -0
- package/dist/src/components/floating/tooltip.js +56 -0
- package/dist/src/components/floating/tooltip.js.map +1 -0
- package/dist/src/components/floating/tooltip_content.d.ts +5 -0
- package/dist/src/components/floating/tooltip_content.d.ts.map +1 -0
- package/dist/src/components/floating/tooltip_content.js +51 -0
- package/dist/src/components/floating/tooltip_content.js.map +1 -0
- package/dist/src/components/index.d.ts +1 -0
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +1 -0
- package/dist/src/components/index.js.map +1 -1
- package/dist/src/components/shortcut.d.ts +9 -0
- package/dist/src/components/shortcut.d.ts.map +1 -0
- package/dist/src/components/shortcut.js +28 -0
- package/dist/src/components/shortcut.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/components/floating/floating_component_base.tsx +263 -0
- package/src/components/floating/index.ts +2 -0
- package/src/components/floating/tooltip.stories.jsx +128 -0
- package/src/components/floating/tooltip.tsx +120 -0
- package/src/components/floating/tooltip_content.tsx +80 -0
- package/src/components/index.ts +1 -0
- package/src/components/shortcut.stories.jsx +57 -0
- package/src/components/shortcut.tsx +54 -0
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
const darkColors = css`
|
|
21
|
+
background-color: ${theme.colorPalette.dark.neutral800};
|
|
22
|
+
border: 1px solid ${theme.colorPalette.dark.neutral700};
|
|
23
|
+
color: ${theme.colorPalette.dark.neutral400};
|
|
24
|
+
`;
|
|
25
|
+
|
|
26
|
+
const StyledShortcut = styled(Text)<{ $dark?: boolean }>`
|
|
27
|
+
min-width: 10px; /* 20 - paddings - borders */
|
|
28
|
+
height: 14px; /* 20 - paddings - borders */
|
|
29
|
+
display: inline-flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
justify-content: center;
|
|
32
|
+
border-radius: ${theme.radius.radius4};
|
|
33
|
+
padding: ${theme.space.space2} ${theme.space.space4};
|
|
34
|
+
${({ $dark }) => ($dark ? darkColors : adaptiveColors)}
|
|
35
|
+
`;
|
|
36
|
+
|
|
37
|
+
export const Shortcut = ({
|
|
38
|
+
as,
|
|
39
|
+
className,
|
|
40
|
+
children,
|
|
41
|
+
dark = false,
|
|
42
|
+
}: ShortcutProps) => {
|
|
43
|
+
return (
|
|
44
|
+
<StyledShortcut
|
|
45
|
+
forwardedAs={as}
|
|
46
|
+
className={className}
|
|
47
|
+
$dark={dark}
|
|
48
|
+
type='code'
|
|
49
|
+
size='small'
|
|
50
|
+
weight='medium'>
|
|
51
|
+
{children}
|
|
52
|
+
</StyledShortcut>
|
|
53
|
+
);
|
|
54
|
+
};
|