@clickhouse/click-ui 0.0.2 → 0.0.4
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/click-ui.es.js +15975 -0
- package/dist/click-ui.umd.js +442 -0
- package/package.json +13 -4
- package/.eslintrc.cjs +0 -33
- package/.github/workflows/deployment.yml +0 -34
- package/.prettierrc +0 -14
- package/.storybook/main.ts +0 -19
- package/.storybook/manager.ts +0 -11
- package/.storybook/preview-head.html +0 -2
- package/.storybook/preview.tsx +0 -76
- package/.storybook/theme.ts +0 -16
- package/build-tokens.js +0 -131
- package/index.html +0 -17
- package/jest.config.ts +0 -11
- package/src/App.css +0 -1
- package/src/App.module.css +0 -235
- package/src/App.tsx +0 -217
- package/src/assets/RightArrow/RightArrow.tsx +0 -17
- package/src/assets/S3Logo/S3Logo.tsx +0 -31
- package/src/assets/react.svg +0 -1
- package/src/components/Accordion/Accordion.stories.tsx +0 -28
- package/src/components/Accordion/Accordion.test.tsx +0 -46
- package/src/components/Accordion/Accordion.tsx +0 -119
- package/src/components/Alert/Alert.stories.tsx +0 -14
- package/src/components/Alert/Alert.test.tsx +0 -27
- package/src/components/Alert/Alert.tsx +0 -130
- package/src/components/Avatar/Avatar.stories.tsx +0 -13
- package/src/components/Avatar/Avatar.tsx +0 -64
- package/src/components/Badge/Badge.stories.ts +0 -30
- package/src/components/Badge/Badge.test.tsx +0 -16
- package/src/components/Badge/Badge.tsx +0 -78
- package/src/components/BigStat/BigStat.stories.ts +0 -20
- package/src/components/BigStat/BigStat.tsx +0 -49
- package/src/components/Button/Button.stories.ts +0 -26
- package/src/components/Button/Button.test.tsx +0 -32
- package/src/components/Button/Button.tsx +0 -115
- package/src/components/ButtonGroup/ButtonGroup.stories.ts +0 -14
- package/src/components/ButtonGroup/ButtonGroup.tsx +0 -78
- package/src/components/Card/Card.stories.ts +0 -19
- package/src/components/Card/Card.tsx +0 -107
- package/src/components/Checkbox/Checkbox.stories.tsx +0 -35
- package/src/components/Checkbox/Checkbox.test.tsx +0 -41
- package/src/components/Checkbox/Checkbox.tsx +0 -89
- package/src/components/ContextMenu/ContextMenu.stories.tsx +0 -73
- package/src/components/ContextMenu/ContextMenu.test.tsx +0 -152
- package/src/components/ContextMenu/ContextMenu.tsx +0 -155
- package/src/components/Dropdown/Dropdown.stories.tsx +0 -64
- package/src/components/Dropdown/Dropdown.test.tsx +0 -141
- package/src/components/Dropdown/Dropdown.tsx +0 -149
- package/src/components/FormField/Label.stories.tsx +0 -39
- package/src/components/FormField/Label.tsx +0 -47
- package/src/components/FormField/Select.stories.tsx +0 -48
- package/src/components/FormField/Select.test.tsx +0 -216
- package/src/components/FormField/Select.tsx +0 -574
- package/src/components/FormField/SelectContext.tsx +0 -101
- package/src/components/FormField/commonElement.tsx +0 -42
- package/src/components/GenericMenu.tsx +0 -114
- package/src/components/HoverCard/HoverCard.stories.tsx +0 -64
- package/src/components/HoverCard/HoverCard.test.tsx +0 -85
- package/src/components/HoverCard/HoverCard.tsx +0 -65
- package/src/components/Icon/Icon.stories.ts +0 -15
- package/src/components/Icon/Icon.tsx +0 -238
- package/src/components/Icon/types.ts +0 -95
- package/src/components/IconButton/IconButton.stories.ts +0 -34
- package/src/components/IconButton/IconButton.test.tsx +0 -32
- package/src/components/IconButton/IconButton.tsx +0 -83
- package/src/components/Panel/Panel.stories.tsx +0 -25
- package/src/components/Panel/Panel.tsx +0 -33
- package/src/components/Popover/Popover.stories.tsx +0 -67
- package/src/components/Popover/Popover.test.tsx +0 -46
- package/src/components/Popover/Popover.tsx +0 -115
- package/src/components/RadioGroup/RadioGroup.stories.tsx +0 -43
- package/src/components/RadioGroup/RadioGroup.test.tsx +0 -59
- package/src/components/RadioGroup/RadioGroup.tsx +0 -149
- package/src/components/Separator/Separator.stories.tsx +0 -24
- package/src/components/Separator/Separator.tsx +0 -29
- package/src/components/SidebarNavigationItem/SidebarNavigationItem.stories.tsx +0 -28
- package/src/components/SidebarNavigationItem/SidebarNavigationItem.tsx +0 -112
- package/src/components/Spacer/Spacer.stories.tsx +0 -20
- package/src/components/Spacer/Spacer.tsx +0 -15
- package/src/components/Switch/Switch.stories.ts +0 -14
- package/src/components/Switch/Switch.tsx +0 -107
- package/src/components/Table/Table.stories.tsx +0 -29
- package/src/components/Table/Table.tsx +0 -109
- package/src/components/Tabs/Tabs.stories.tsx +0 -36
- package/src/components/Tabs/Tabs.test.tsx +0 -86
- package/src/components/Tabs/Tabs.tsx +0 -82
- package/src/components/Tooltip/Tooltip.stories.tsx +0 -68
- package/src/components/Tooltip/Tooltip.test.tsx +0 -44
- package/src/components/Tooltip/Tooltip.tsx +0 -67
- package/src/components/Typography/Text/Text.stories.tsx +0 -22
- package/src/components/Typography/Text/Text.test.tsx +0 -16
- package/src/components/Typography/Text/Text.tsx +0 -30
- package/src/components/Typography/Title/Title.stories.tsx +0 -31
- package/src/components/Typography/Title/Title.test.tsx +0 -16
- package/src/components/Typography/Title/Title.tsx +0 -36
- package/src/components/icons/Activity.tsx +0 -30
- package/src/components/icons/ArrowDown.tsx +0 -22
- package/src/components/icons/ArrowRight.tsx +0 -22
- package/src/components/icons/ArrowTriangle.tsx +0 -36
- package/src/components/icons/ArrowUp.tsx +0 -22
- package/src/components/icons/Backups.tsx +0 -29
- package/src/components/icons/Blog.tsx +0 -38
- package/src/components/icons/Book.tsx +0 -30
- package/src/components/icons/Brackets.tsx +0 -22
- package/src/components/icons/Briefcase.tsx +0 -30
- package/src/components/icons/Building.tsx +0 -30
- package/src/components/icons/BurgerMenu.tsx +0 -22
- package/src/components/icons/Cards.tsx +0 -30
- package/src/components/icons/CellTower.tsx +0 -21
- package/src/components/icons/ChatIcon.tsx +0 -22
- package/src/components/icons/CheckIcon.tsx +0 -21
- package/src/components/icons/CheckInCircle.tsx +0 -39
- package/src/components/icons/ChevronDown.tsx +0 -20
- package/src/components/icons/ChevronLeft.tsx +0 -22
- package/src/components/icons/ChevronRight.tsx +0 -20
- package/src/components/icons/ChevronUp.tsx +0 -22
- package/src/components/icons/Clock.tsx +0 -37
- package/src/components/icons/Cloud.tsx +0 -23
- package/src/components/icons/Code.tsx +0 -22
- package/src/components/icons/CodeInSquare.tsx +0 -30
- package/src/components/icons/Connect.tsx +0 -22
- package/src/components/icons/ConnectAlt.tsx +0 -30
- package/src/components/icons/Console.tsx +0 -30
- package/src/components/icons/Copy.tsx +0 -33
- package/src/components/icons/CrossIcon.tsx +0 -29
- package/src/components/icons/Data.tsx +0 -36
- package/src/components/icons/DatabaseIcon.tsx +0 -31
- package/src/components/icons/Disk.tsx +0 -30
- package/src/components/icons/Display.tsx +0 -30
- package/src/components/icons/Document.tsx +0 -30
- package/src/components/icons/DotsHorizontal.tsx +0 -36
- package/src/components/icons/DotsVertical.tsx +0 -33
- package/src/components/icons/Email.tsx +0 -33
- package/src/components/icons/Empty.tsx +0 -14
- package/src/components/icons/FilterIcon.tsx +0 -37
- package/src/components/icons/Fire.tsx +0 -23
- package/src/components/icons/Flags/EuropeanUnion.tsx +0 -174
- package/src/components/icons/Flags/Germany.tsx +0 -25
- package/src/components/icons/Flags/India.tsx +0 -48
- package/src/components/icons/Flags/Ireland.tsx +0 -32
- package/src/components/icons/Flags/Netherlands.tsx +0 -29
- package/src/components/icons/Flags/Singapore.tsx +0 -43
- package/src/components/icons/Flags/UnitedKingdom.tsx +0 -32
- package/src/components/icons/Flags/UnitedStates.tsx +0 -26
- package/src/components/icons/Flags/index.tsx +0 -46
- package/src/components/icons/Folder.tsx +0 -20
- package/src/components/icons/Gift.tsx +0 -21
- package/src/components/icons/HistoryIcon.tsx +0 -28
- package/src/components/icons/Home.tsx +0 -29
- package/src/components/icons/Http.tsx +0 -22
- package/src/components/icons/Icons.mdx +0 -39
- package/src/components/icons/InfoInCircleIcon.tsx +0 -37
- package/src/components/icons/InformationIcon.tsx +0 -34
- package/src/components/icons/InsertRowIcon.tsx +0 -34
- package/src/components/icons/Integrations.tsx +0 -29
- package/src/components/icons/LightBulb.tsx +0 -40
- package/src/components/icons/Lightening.tsx +0 -30
- package/src/components/icons/Loading.tsx +0 -57
- package/src/components/icons/Metrics.tsx +0 -38
- package/src/components/icons/MetricsAlt.tsx +0 -30
- package/src/components/icons/Payment.tsx +0 -23
- package/src/components/icons/Payments/Amex.tsx +0 -44
- package/src/components/icons/Payments/MasterCard.tsx +0 -48
- package/src/components/icons/Payments/Paypal.tsx +0 -41
- package/src/components/icons/Payments/Visa.tsx +0 -36
- package/src/components/icons/Payments/index.tsx +0 -30
- package/src/components/icons/Pencil.tsx +0 -30
- package/src/components/icons/PieChart.tsx +0 -30
- package/src/components/icons/Play.tsx +0 -30
- package/src/components/icons/Plus.tsx +0 -22
- package/src/components/icons/Popout.tsx +0 -22
- package/src/components/icons/PopoverArrow.tsx +0 -22
- package/src/components/icons/Question.tsx +0 -30
- package/src/components/icons/Refresh.tsx +0 -29
- package/src/components/icons/Search.tsx +0 -22
- package/src/components/icons/Secure.tsx +0 -30
- package/src/components/icons/Services.tsx +0 -23
- package/src/components/icons/Settings.tsx +0 -22
- package/src/components/icons/Share.tsx +0 -29
- package/src/components/icons/SlideIn.tsx +0 -28
- package/src/components/icons/SlideOut.tsx +0 -28
- package/src/components/icons/SortAltIcon.tsx +0 -22
- package/src/components/icons/SortIcon.tsx +0 -24
- package/src/components/icons/Sparkle.tsx +0 -23
- package/src/components/icons/Speaker.tsx +0 -30
- package/src/components/icons/Speed.tsx +0 -29
- package/src/components/icons/Star.tsx +0 -23
- package/src/components/icons/Support.tsx +0 -37
- package/src/components/icons/Table.tsx +0 -30
- package/src/components/icons/Taxi.tsx +0 -120
- package/src/components/icons/Trash.tsx +0 -22
- package/src/components/icons/Upload.tsx +0 -29
- package/src/components/icons/Url.tsx +0 -22
- package/src/components/icons/UserIcon.tsx +0 -17
- package/src/components/icons/UsersIcon.tsx +0 -43
- package/src/components/icons/WarningIcon.tsx +0 -30
- package/src/components/index.ts +0 -35
- package/src/components/types.ts +0 -1
- package/src/index.css +0 -9
- package/src/index.ts +0 -2
- package/src/main.tsx +0 -11
- package/src/stories/assets/code-brackets.svg +0 -1
- package/src/stories/assets/colors.svg +0 -1
- package/src/stories/assets/comments.svg +0 -1
- package/src/stories/assets/direction.svg +0 -1
- package/src/stories/assets/flow.svg +0 -1
- package/src/stories/assets/plugin.svg +0 -1
- package/src/stories/assets/repo.svg +0 -1
- package/src/stories/assets/stackalt.svg +0 -1
- package/src/styles/Home.module.css +0 -235
- package/src/styles/globals.css +0 -111
- package/src/styles/types.ts +0 -2089
- package/src/styles/variables.classic.css +0 -16
- package/src/styles/variables.classic.json +0 -202
- package/src/styles/variables.css +0 -763
- package/src/styles/variables.dark.css +0 -135
- package/src/styles/variables.dark.json +0 -894
- package/src/styles/variables.json +0 -2087
- package/src/styles/variables.light.css +0 -203
- package/src/styles/variables.light.json +0 -949
- package/src/theme/index.ts +0 -22
- package/src/theme/theme.tsx +0 -28
- package/src/vite-env.d.ts +0 -1
- package/tokens/themes/$metadata.json +0 -9
- package/tokens/themes/$themes.json +0 -3657
- package/tokens/themes/classic.json +0 -550
- package/tokens/themes/component.json +0 -2252
- package/tokens/themes/dark.json +0 -2563
- package/tokens/themes/light.json +0 -2645
- package/tokens/themes/primitives.json +0 -947
- package/tsconfig.json +0 -27
- package/tsconfig.node.json +0 -10
- package/vite.config.ts +0 -40
- /package/{public → dist}/favicon.ico +0 -0
- /package/{public → dist}/logo.svg +0 -0
- /package/{public → dist}/vite.svg +0 -0
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
2
|
-
|
|
3
|
-
export const GenericMenuPanel = styled.div<{
|
|
4
|
-
type: "popover" | "dropdown-menu" | "context-menu";
|
|
5
|
-
$showArrow?: boolean;
|
|
6
|
-
}>`
|
|
7
|
-
outline: none;
|
|
8
|
-
max-width: var(--radix-${({ type }) => type}-content-available-width);
|
|
9
|
-
max-height: var(--radix-${({ type }) => type}-content-available-height);
|
|
10
|
-
overflow: hidden;
|
|
11
|
-
display: flex;
|
|
12
|
-
align-items: flex-start;
|
|
13
|
-
|
|
14
|
-
${({ theme }) => `
|
|
15
|
-
border: 1px solid ${theme.click.genericMenu.panel.color.stroke.default};
|
|
16
|
-
background: ${theme.click.genericMenu.panel.color.background.default};
|
|
17
|
-
box-shadow: ${theme.click.genericMenu.panel.shadow.default};
|
|
18
|
-
border-radius: ${theme.click.genericMenu.panel.radii.all};
|
|
19
|
-
`};
|
|
20
|
-
${({ $showArrow }) =>
|
|
21
|
-
$showArrow
|
|
22
|
-
? `
|
|
23
|
-
&[data-side="bottom"] {
|
|
24
|
-
margin-top: -1px;
|
|
25
|
-
}
|
|
26
|
-
&[data-side="top"] {
|
|
27
|
-
margin-bottom: 1px;
|
|
28
|
-
}
|
|
29
|
-
&[data-side="left"] {
|
|
30
|
-
margin-right: -1px;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
&[data-side="right"] {
|
|
34
|
-
margin-left: -1px;
|
|
35
|
-
}
|
|
36
|
-
`
|
|
37
|
-
: ""};
|
|
38
|
-
`;
|
|
39
|
-
|
|
40
|
-
export const GenericPopoverMenuPanel = styled.div<{
|
|
41
|
-
$type: "popover" | "hover-card";
|
|
42
|
-
$showArrow?: boolean;
|
|
43
|
-
}>`
|
|
44
|
-
outline: none;
|
|
45
|
-
max-width: var(--radix-${({ $type }) => $type}-content-available-width);
|
|
46
|
-
max-height: var(--radix-${({ $type }) => $type}-content-available-height);
|
|
47
|
-
overflow: hidden;
|
|
48
|
-
display: flex;
|
|
49
|
-
flex-direction: column;
|
|
50
|
-
align-items: flex-start;
|
|
51
|
-
z-index: 1;
|
|
52
|
-
|
|
53
|
-
${({ theme }) => `
|
|
54
|
-
border: 1px solid ${theme.click.popover.color.panel.stroke.default};
|
|
55
|
-
background: ${theme.click.popover.color.panel.background.default};
|
|
56
|
-
padding: ${theme.click.popover.space.y} ${theme.click.popover.space.x};
|
|
57
|
-
border-radius: ${theme.click.popover.radii.all};
|
|
58
|
-
box-shadow: ${theme.click.popover.shadow.default};
|
|
59
|
-
`}
|
|
60
|
-
${({ $showArrow }) => ($showArrow ? "margin: -1px 0;" : "")};
|
|
61
|
-
`;
|
|
62
|
-
|
|
63
|
-
export const Arrow = styled.svg`
|
|
64
|
-
filter: drop-shadow(rgba(0, 0, 0, 0.1) 0px 4px 6px);
|
|
65
|
-
${({ theme }) => `
|
|
66
|
-
fill: ${theme.click.genericMenu.panel.color.background.default};
|
|
67
|
-
stroke: ${theme.click.genericMenu.panel.color.stroke.default};
|
|
68
|
-
`};
|
|
69
|
-
`;
|
|
70
|
-
|
|
71
|
-
export const GenericMenuItem = styled.div`
|
|
72
|
-
display: flex;
|
|
73
|
-
width: -webkit-fill-available;
|
|
74
|
-
align-items: center;
|
|
75
|
-
justify-content: space-between;
|
|
76
|
-
cursor: default;
|
|
77
|
-
overflow: hidden;
|
|
78
|
-
white-space: nowrap;
|
|
79
|
-
text-overflow: ellipsis;
|
|
80
|
-
outline: none;
|
|
81
|
-
&[aria-selected] {
|
|
82
|
-
outline: none;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
${({ theme }) => `
|
|
86
|
-
padding: ${theme.click.genericMenu.item.space.y} ${theme.click.genericMenu.item.space.x};
|
|
87
|
-
gap: ${theme.click.genericMenu.item.space.gap};
|
|
88
|
-
font: ${theme.click.genericMenu.item.typography.label.default};
|
|
89
|
-
background: ${theme.click.genericMenu.item.color.background.default};
|
|
90
|
-
color: ${theme.click.genericMenu.item.color.text.default};
|
|
91
|
-
&[data-highlighted] {
|
|
92
|
-
font: ${theme.click.genericMenu.item.typography.label.hover};
|
|
93
|
-
background: ${theme.click.genericMenu.item.color.background.hover};
|
|
94
|
-
color:${theme.click.genericMenu.item.color.text.hover};
|
|
95
|
-
cursor: pointer;
|
|
96
|
-
}
|
|
97
|
-
&[data-state="open"] {
|
|
98
|
-
background:${theme.click.genericMenu.item.color.background.active};
|
|
99
|
-
color:${theme.click.genericMenu.item.color.text.active};
|
|
100
|
-
font: ${theme.click.genericMenu.item.typography.label.active};
|
|
101
|
-
}
|
|
102
|
-
&[data-disabled] {
|
|
103
|
-
background:${theme.click.genericMenu.item.color.background.disabled};
|
|
104
|
-
color:${theme.click.genericMenu.item.color.text.disabled};
|
|
105
|
-
font: ${theme.click.genericMenu.item.typography.label.disabled};
|
|
106
|
-
pointer-events: none;
|
|
107
|
-
}
|
|
108
|
-
`};
|
|
109
|
-
position: relative;
|
|
110
|
-
&:hover .dropdown-arrow,
|
|
111
|
-
&[data-state="open"] .dropdown-arrow {
|
|
112
|
-
left: 0.5rem;
|
|
113
|
-
}
|
|
114
|
-
`;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { Checkbox } from "..";
|
|
2
|
-
import { Title } from "../Typography/Title/Title";
|
|
3
|
-
import { HoverCard } from "./HoverCard";
|
|
4
|
-
|
|
5
|
-
const HoverCardComponent = ({
|
|
6
|
-
open,
|
|
7
|
-
showArrow,
|
|
8
|
-
forceMount,
|
|
9
|
-
title,
|
|
10
|
-
openDelay,
|
|
11
|
-
closeDelay,
|
|
12
|
-
}: {
|
|
13
|
-
open: "default" | "open" | "closed";
|
|
14
|
-
showArrow: boolean;
|
|
15
|
-
forceMount?: boolean;
|
|
16
|
-
title?: string;
|
|
17
|
-
openDelay?: number;
|
|
18
|
-
closeDelay?: number;
|
|
19
|
-
}) => (
|
|
20
|
-
<HoverCard
|
|
21
|
-
open={open === "default" ? undefined : open === "open"}
|
|
22
|
-
openDelay={openDelay}
|
|
23
|
-
closeDelay={closeDelay}
|
|
24
|
-
>
|
|
25
|
-
<HoverCard.Trigger>Hover Here</HoverCard.Trigger>
|
|
26
|
-
<HoverCard.Content
|
|
27
|
-
showArrow={showArrow}
|
|
28
|
-
forceMount={forceMount ? true : undefined}
|
|
29
|
-
title={title}
|
|
30
|
-
>
|
|
31
|
-
<Title
|
|
32
|
-
color="default"
|
|
33
|
-
size="sm"
|
|
34
|
-
type="h5"
|
|
35
|
-
>
|
|
36
|
-
Hover Title
|
|
37
|
-
</Title>
|
|
38
|
-
<div>
|
|
39
|
-
Click on the input element below
|
|
40
|
-
<Checkbox />
|
|
41
|
-
<div>This is a sample data to experiment the popover</div>
|
|
42
|
-
</div>
|
|
43
|
-
</HoverCard.Content>
|
|
44
|
-
</HoverCard>
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
export default {
|
|
48
|
-
component: HoverCardComponent,
|
|
49
|
-
title: "Display/HoverCard",
|
|
50
|
-
tags: ["form-field", "hover-card", "autodocs"],
|
|
51
|
-
argTypes: {
|
|
52
|
-
open: { control: "radio", options: ["default", "open", "closed"] },
|
|
53
|
-
showArrow: { control: "boolean" },
|
|
54
|
-
forceMount: { control: "boolean" },
|
|
55
|
-
openDelay: { control: "number" },
|
|
56
|
-
closeDelay: { control: "number" },
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export const Playground = {
|
|
61
|
-
args: {
|
|
62
|
-
open: "default",
|
|
63
|
-
},
|
|
64
|
-
};
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { ThemeProvider } from "styled-components";
|
|
2
|
-
import "@testing-library/jest-dom";
|
|
3
|
-
import { themes } from "../../theme";
|
|
4
|
-
import { HoverCardProps } from "@radix-ui/react-hover-card";
|
|
5
|
-
import { Checkbox, HoverCard } from "@/components";
|
|
6
|
-
import { render, fireEvent, waitFor } from "@testing-library/react";
|
|
7
|
-
// import userEvent from "@testing-library/user-event";
|
|
8
|
-
|
|
9
|
-
describe("HoverCard", () => {
|
|
10
|
-
const renderHoverCard = (props: HoverCardProps) =>
|
|
11
|
-
render(
|
|
12
|
-
<ThemeProvider theme={themes.dark}>
|
|
13
|
-
<HoverCard
|
|
14
|
-
openDelay={0}
|
|
15
|
-
closeDelay={0}
|
|
16
|
-
{...props}
|
|
17
|
-
>
|
|
18
|
-
<HoverCard.Trigger>Hover Here</HoverCard.Trigger>
|
|
19
|
-
<HoverCard.Content data-testid="popover-panel">
|
|
20
|
-
<div>
|
|
21
|
-
Click on the input element below
|
|
22
|
-
<Checkbox />
|
|
23
|
-
<div>This is a sample data to experiment the hoverCard</div>
|
|
24
|
-
</div>
|
|
25
|
-
</HoverCard.Content>
|
|
26
|
-
</HoverCard>
|
|
27
|
-
</ThemeProvider>
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
it("should open hover card on hover", async () => {
|
|
31
|
-
const { getByText } = renderHoverCard({});
|
|
32
|
-
const hoverCardTrigger = getByText("Hover Here");
|
|
33
|
-
expect(hoverCardTrigger).not.toBeNull();
|
|
34
|
-
fireEvent.pointerEnter(hoverCardTrigger);
|
|
35
|
-
await waitFor(() => {
|
|
36
|
-
expect(getByText("Click on the input element below")).not.toBeNull();
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it("should not close hoverCard on clicking the checkbox", async () => {
|
|
41
|
-
const { getByTestId, getByText } = renderHoverCard({});
|
|
42
|
-
const hoverCardTrigger = getByText("Hover Here");
|
|
43
|
-
expect(hoverCardTrigger).not.toBeNull();
|
|
44
|
-
fireEvent.pointerOver(hoverCardTrigger);
|
|
45
|
-
|
|
46
|
-
await waitFor(() => {
|
|
47
|
-
expect(getByText("Click on the input element below")).not.toBeNull();
|
|
48
|
-
});
|
|
49
|
-
const checkbox = getByTestId("checkbox");
|
|
50
|
-
fireEvent.click(checkbox);
|
|
51
|
-
expect(getByText("Click on the input element below")).not.toBeNull();
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it("should close hover card on pointerLeave", async () => {
|
|
55
|
-
const { getByText, queryByText } = renderHoverCard({});
|
|
56
|
-
const hoverCardTrigger = getByText("Hover Here");
|
|
57
|
-
expect(hoverCardTrigger).not.toBeNull();
|
|
58
|
-
fireEvent.pointerOver(hoverCardTrigger);
|
|
59
|
-
|
|
60
|
-
await waitFor(() => {
|
|
61
|
-
expect(getByText("Click on the input element below")).not.toBeNull();
|
|
62
|
-
});
|
|
63
|
-
fireEvent.pointerLeave(hoverCardTrigger);
|
|
64
|
-
await waitFor(() => {
|
|
65
|
-
expect(queryByText("Click on the input element below")).not.toBeInTheDocument();
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it("should not close hover card on pointerLeave and focus ", async () => {
|
|
70
|
-
const { getByText, queryByText, getByTestId } = renderHoverCard({});
|
|
71
|
-
const hoverCardTrigger = getByText("Hover Here");
|
|
72
|
-
expect(hoverCardTrigger).not.toBeNull();
|
|
73
|
-
fireEvent.pointerOver(hoverCardTrigger);
|
|
74
|
-
|
|
75
|
-
await waitFor(() => {
|
|
76
|
-
expect(getByText("Click on the input element below")).not.toBeNull();
|
|
77
|
-
});
|
|
78
|
-
const checkbox = getByTestId("checkbox");
|
|
79
|
-
fireEvent.click(checkbox);
|
|
80
|
-
fireEvent.pointerLeave(getByTestId("popover-panel"));
|
|
81
|
-
await waitFor(() => {
|
|
82
|
-
expect(queryByText("Click on the input element below")).not.toBeInTheDocument();
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
});
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import * as RadixHoverCard from "@radix-ui/react-hover-card";
|
|
2
|
-
import { Arrow, GenericPopoverMenuPanel } from "../GenericMenu";
|
|
3
|
-
import styled from "styled-components";
|
|
4
|
-
import { ReactNode } from "react";
|
|
5
|
-
import PopoverArrow from "../icons/PopoverArrow";
|
|
6
|
-
|
|
7
|
-
export const HoverCard = ({ children, ...props }: RadixHoverCard.HoverCardProps) => {
|
|
8
|
-
return <RadixHoverCard.Root {...props}>{children}</RadixHoverCard.Root>;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const Trigger = styled(RadixHoverCard.Trigger)`
|
|
12
|
-
width: fit-content;
|
|
13
|
-
`;
|
|
14
|
-
|
|
15
|
-
const HoverCardTrigger = ({
|
|
16
|
-
children,
|
|
17
|
-
...props
|
|
18
|
-
}: RadixHoverCard.HoverCardTriggerProps) => {
|
|
19
|
-
return <Trigger {...props}>{children}</Trigger>;
|
|
20
|
-
};
|
|
21
|
-
HoverCardTrigger.displayName = "HoverCardTrigger";
|
|
22
|
-
HoverCard.Trigger = HoverCardTrigger;
|
|
23
|
-
|
|
24
|
-
interface HoverCardContentProps extends RadixHoverCard.HoverCardContentProps {
|
|
25
|
-
showArrow?: boolean;
|
|
26
|
-
forceMount?: true;
|
|
27
|
-
container?: HTMLElement | null;
|
|
28
|
-
children: ReactNode;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const HoverCardContent = ({
|
|
32
|
-
children,
|
|
33
|
-
showArrow,
|
|
34
|
-
forceMount,
|
|
35
|
-
container,
|
|
36
|
-
...props
|
|
37
|
-
}: HoverCardContentProps) => {
|
|
38
|
-
return (
|
|
39
|
-
<RadixHoverCard.Portal
|
|
40
|
-
forceMount={forceMount}
|
|
41
|
-
container={container}
|
|
42
|
-
>
|
|
43
|
-
<GenericPopoverMenuPanel
|
|
44
|
-
as={RadixHoverCard.Content}
|
|
45
|
-
$type="hover-card"
|
|
46
|
-
$showArrow={showArrow}
|
|
47
|
-
{...props}
|
|
48
|
-
>
|
|
49
|
-
{showArrow && (
|
|
50
|
-
<Arrow
|
|
51
|
-
asChild
|
|
52
|
-
as={RadixHoverCard.Arrow}
|
|
53
|
-
width={15}
|
|
54
|
-
height={10}
|
|
55
|
-
>
|
|
56
|
-
<PopoverArrow />
|
|
57
|
-
</Arrow>
|
|
58
|
-
)}
|
|
59
|
-
{children}
|
|
60
|
-
</GenericPopoverMenuPanel>
|
|
61
|
-
</RadixHoverCard.Portal>
|
|
62
|
-
);
|
|
63
|
-
};
|
|
64
|
-
HoverCardContent.displayName = "HoverCardContent";
|
|
65
|
-
HoverCard.Content = HoverCardContent;
|
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
import { ElementType, ReactElement } from "react";
|
|
2
|
-
import { UsersIcon } from "../icons/UsersIcon";
|
|
3
|
-
import styled from "styled-components";
|
|
4
|
-
import { UserIcon } from "../icons/UserIcon";
|
|
5
|
-
import ChatIcon from "../icons/ChatIcon";
|
|
6
|
-
import DatabaseIcon from "../icons/DatabaseIcon";
|
|
7
|
-
import FilterIcon from "../icons/FilterIcon";
|
|
8
|
-
import HistoryIcon from "../icons/HistoryIcon";
|
|
9
|
-
import InsertRowIcon from "../icons/InsertRowIcon";
|
|
10
|
-
import SortAltIcon from "../icons/SortAltIcon";
|
|
11
|
-
import SortIcon from "../icons/SortIcon";
|
|
12
|
-
import { IconProps } from "./types";
|
|
13
|
-
import { ChevronRight } from "../icons/ChevronRight";
|
|
14
|
-
import { ChevronDown } from "../icons/ChevronDown";
|
|
15
|
-
import ArrowDown from "@/components/icons/ArrowDown";
|
|
16
|
-
import InfoInCircleIcon from "@/components/icons/InfoInCircleIcon";
|
|
17
|
-
import CheckIcon from "@/components/icons/CheckIcon";
|
|
18
|
-
import InformationIcon from "@/components/icons/InformationIcon";
|
|
19
|
-
import WarningIcon from "@/components/icons/WarningIcon";
|
|
20
|
-
import CrossIcon from "@/components/icons/CrossIcon";
|
|
21
|
-
import ChevronUp from "../icons/ChevronUp";
|
|
22
|
-
import Activity from "../icons/Activity";
|
|
23
|
-
import ArrowRight from "../icons/ArrowRight";
|
|
24
|
-
import ArrowTriangle from "../icons/ArrowTriangle";
|
|
25
|
-
import ArrowUp from "../icons/ArrowUp";
|
|
26
|
-
import BackUps from "../icons/Backups";
|
|
27
|
-
import Blog from "../icons/Blog";
|
|
28
|
-
import Book from "../icons/Book";
|
|
29
|
-
import Brackets from "../icons/Brackets";
|
|
30
|
-
import Briefcase from "../icons/Briefcase";
|
|
31
|
-
import Building from "../icons/Building";
|
|
32
|
-
import BurgerMenu from "../icons/BurgerMenu";
|
|
33
|
-
import Cards from "../icons/Cards";
|
|
34
|
-
import CellTower from "../icons/CellTower";
|
|
35
|
-
import CheckInCircle from "../icons/CheckInCircle";
|
|
36
|
-
import ChevronLeft from "../icons/ChevronLeft";
|
|
37
|
-
import Clock from "../icons/Clock";
|
|
38
|
-
import Cloud from "../icons/Cloud";
|
|
39
|
-
import Code from "../icons/Code";
|
|
40
|
-
import CodeInSquare from "../icons/CodeInSquare";
|
|
41
|
-
import Connect from "../icons/Connect";
|
|
42
|
-
import ConnectAlt from "../icons/ConnectAlt";
|
|
43
|
-
import Console from "../icons/Console";
|
|
44
|
-
import Copy from "../icons/Copy";
|
|
45
|
-
import Data from "../icons/Data";
|
|
46
|
-
import Disk from "../icons/Disk";
|
|
47
|
-
import Display from "../icons/Display";
|
|
48
|
-
import Document from "../icons/Document";
|
|
49
|
-
import DotsVertical from "../icons/DotsVertical";
|
|
50
|
-
import DotsHorizontal from "../icons/DotsHorizontal";
|
|
51
|
-
import Email from "../icons/Email";
|
|
52
|
-
import Empty from "../icons/Empty";
|
|
53
|
-
import Fire from "../icons/Fire";
|
|
54
|
-
import Folder from "../icons/Folder";
|
|
55
|
-
import Gift from "../icons/Gift";
|
|
56
|
-
import Home from "../icons/Home";
|
|
57
|
-
import Http from "../icons/Http";
|
|
58
|
-
import Integrations from "../icons/Integrations";
|
|
59
|
-
import LightBulb from "../icons/LightBulb";
|
|
60
|
-
import Lightening from "../icons/Lightening";
|
|
61
|
-
import Loading from "../icons/Loading";
|
|
62
|
-
import Metrics from "../icons/Metrics";
|
|
63
|
-
import MetricsAlt from "../icons/MetricsAlt";
|
|
64
|
-
import Payment from "../icons/Payment";
|
|
65
|
-
import Pencil from "../icons/Pencil";
|
|
66
|
-
import PieChart from "../icons/PieChart";
|
|
67
|
-
import Play from "../icons/Play";
|
|
68
|
-
import Plus from "../icons/Plus";
|
|
69
|
-
import Popout from "../icons/Popout";
|
|
70
|
-
import Question from "../icons/Question";
|
|
71
|
-
import Refresh from "../icons/Refresh";
|
|
72
|
-
import Search from "../icons/Search";
|
|
73
|
-
import Secure from "../icons/Secure";
|
|
74
|
-
import Services from "../icons/Services";
|
|
75
|
-
import Settings from "../icons/Settings";
|
|
76
|
-
import Share from "../icons/Share";
|
|
77
|
-
import SlideIn from "../icons/SlideIn";
|
|
78
|
-
import SlideOut from "../icons/SlideOut";
|
|
79
|
-
import Sparkle from "../icons/Sparkle";
|
|
80
|
-
import Speaker from "../icons/Speaker";
|
|
81
|
-
import Speed from "../icons/Speed";
|
|
82
|
-
import Star from "../icons/Star";
|
|
83
|
-
import Support from "../icons/Support";
|
|
84
|
-
import Table from "../icons/Table";
|
|
85
|
-
import Taxi from "../icons/Taxi";
|
|
86
|
-
import Trash from "../icons/Trash";
|
|
87
|
-
import Upload from "../icons/Upload";
|
|
88
|
-
import Url from "../icons/Url";
|
|
89
|
-
|
|
90
|
-
export const ICONS_MAP = {
|
|
91
|
-
activity: Activity,
|
|
92
|
-
"arrow-down": ArrowDown,
|
|
93
|
-
"arrow-right": ArrowRight,
|
|
94
|
-
"arrow-triangle": ArrowTriangle,
|
|
95
|
-
"arrow-up": ArrowUp,
|
|
96
|
-
backups: BackUps,
|
|
97
|
-
blog: Blog,
|
|
98
|
-
book: Book,
|
|
99
|
-
brackets: Brackets,
|
|
100
|
-
briefcase: Briefcase,
|
|
101
|
-
building: Building,
|
|
102
|
-
"burger-menu": BurgerMenu,
|
|
103
|
-
cards: Cards,
|
|
104
|
-
"cell-tower": CellTower,
|
|
105
|
-
chat: ChatIcon,
|
|
106
|
-
check: CheckIcon,
|
|
107
|
-
"check-in-circle": CheckInCircle,
|
|
108
|
-
"chevron-down": ChevronDown,
|
|
109
|
-
"chevron-left": ChevronLeft,
|
|
110
|
-
"chevron-right": ChevronRight,
|
|
111
|
-
"chevron-up": ChevronUp,
|
|
112
|
-
clock: Clock,
|
|
113
|
-
cloud: Cloud,
|
|
114
|
-
code: Code,
|
|
115
|
-
"code-in-square": CodeInSquare,
|
|
116
|
-
connect: Connect,
|
|
117
|
-
"connect-alt": ConnectAlt,
|
|
118
|
-
console: Console,
|
|
119
|
-
copy: Copy,
|
|
120
|
-
cross: CrossIcon,
|
|
121
|
-
data: Data,
|
|
122
|
-
database: DatabaseIcon,
|
|
123
|
-
disk: Disk,
|
|
124
|
-
display: Display,
|
|
125
|
-
document: Document,
|
|
126
|
-
"dots-horizontal": DotsHorizontal,
|
|
127
|
-
"dots-vertical": DotsVertical,
|
|
128
|
-
email: Email,
|
|
129
|
-
empty: Empty,
|
|
130
|
-
filter: FilterIcon,
|
|
131
|
-
fire: Fire,
|
|
132
|
-
folder: Folder,
|
|
133
|
-
gift: Gift,
|
|
134
|
-
history: HistoryIcon,
|
|
135
|
-
home: Home,
|
|
136
|
-
http: Http,
|
|
137
|
-
"info-in-circle": InfoInCircleIcon,
|
|
138
|
-
information: InformationIcon,
|
|
139
|
-
"insert-row": InsertRowIcon,
|
|
140
|
-
integrations: Integrations,
|
|
141
|
-
"light-bulb": LightBulb,
|
|
142
|
-
lightening: Lightening,
|
|
143
|
-
loading: Loading,
|
|
144
|
-
metrics: Metrics,
|
|
145
|
-
"metrics-alt": MetricsAlt,
|
|
146
|
-
payment: Payment,
|
|
147
|
-
pencil: Pencil,
|
|
148
|
-
"pie-chart": PieChart,
|
|
149
|
-
play: Play,
|
|
150
|
-
plus: Plus,
|
|
151
|
-
popout: Popout,
|
|
152
|
-
question: Question,
|
|
153
|
-
refresh: Refresh,
|
|
154
|
-
search: Search,
|
|
155
|
-
secure: Secure,
|
|
156
|
-
services: Services,
|
|
157
|
-
settings: Settings,
|
|
158
|
-
share: Share,
|
|
159
|
-
"slide-in": SlideIn,
|
|
160
|
-
"slide-out": SlideOut,
|
|
161
|
-
"sort-alt": SortAltIcon,
|
|
162
|
-
sort: SortIcon,
|
|
163
|
-
sparkle: Sparkle,
|
|
164
|
-
speaker: Speaker,
|
|
165
|
-
speed: Speed,
|
|
166
|
-
star: Star,
|
|
167
|
-
support: Support,
|
|
168
|
-
table: Table,
|
|
169
|
-
taxi: Taxi,
|
|
170
|
-
trash: Trash,
|
|
171
|
-
upload: Upload,
|
|
172
|
-
url: Url,
|
|
173
|
-
user: UserIcon,
|
|
174
|
-
users: UsersIcon,
|
|
175
|
-
warning: WarningIcon,
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
const SVGIcon = ({ name, ...delegated }: IconProps) => {
|
|
179
|
-
const Component = ICONS_MAP[name];
|
|
180
|
-
|
|
181
|
-
if (!Component) {
|
|
182
|
-
return null;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
return <Component {...delegated} />;
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
const withStylesWrapper =
|
|
189
|
-
(IconComponent: ElementType) =>
|
|
190
|
-
({ color, width, height, className, size, ...props }: IconProps): ReactElement =>
|
|
191
|
-
(
|
|
192
|
-
<SvgWrapper
|
|
193
|
-
color={color}
|
|
194
|
-
width={width}
|
|
195
|
-
height={height}
|
|
196
|
-
size={size}
|
|
197
|
-
className={className}
|
|
198
|
-
>
|
|
199
|
-
<IconComponent {...props} />
|
|
200
|
-
</SvgWrapper>
|
|
201
|
-
);
|
|
202
|
-
|
|
203
|
-
const SvgWrapper = styled.div<Partial<IconProps>>`
|
|
204
|
-
display: flex;
|
|
205
|
-
align-items: center;
|
|
206
|
-
|
|
207
|
-
& path[stroke] {
|
|
208
|
-
stroke: ${(props) => props.color || "currentColor"};
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
& path[fill] {
|
|
212
|
-
fill: ${(props) => props.color || "currentColor"};
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
& svg {
|
|
216
|
-
width: ${(props) =>
|
|
217
|
-
props.width ||
|
|
218
|
-
props.theme.click.image[props.size || "medium"].size.width ||
|
|
219
|
-
"24px"};
|
|
220
|
-
height: ${(props) =>
|
|
221
|
-
props.height ||
|
|
222
|
-
props.theme.click.image[props.size || "medium"].size.height ||
|
|
223
|
-
"24px"};
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
& svg[stroke] {
|
|
227
|
-
stroke: ${(props) => props.color || "currentColor"};
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
& svg[fill]:not([fill="none"]) {
|
|
231
|
-
fill: ${(props) => props.color || "currentColor"};
|
|
232
|
-
}
|
|
233
|
-
`;
|
|
234
|
-
|
|
235
|
-
const Icon = withStylesWrapper(SVGIcon);
|
|
236
|
-
const IconToExport = styled(Icon)``;
|
|
237
|
-
|
|
238
|
-
export { IconToExport as Icon };
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { SVGAttributes } from "react";
|
|
2
|
-
|
|
3
|
-
export type IconSize = "small" | "medium" | "large";
|
|
4
|
-
export type IconName =
|
|
5
|
-
| "activity"
|
|
6
|
-
| "arrow-down"
|
|
7
|
-
| "arrow-right"
|
|
8
|
-
| "arrow-triangle"
|
|
9
|
-
| "arrow-up"
|
|
10
|
-
| "backups"
|
|
11
|
-
| "blog"
|
|
12
|
-
| "book"
|
|
13
|
-
| "brackets"
|
|
14
|
-
| "briefcase"
|
|
15
|
-
| "building"
|
|
16
|
-
| "burger-menu"
|
|
17
|
-
| "cards"
|
|
18
|
-
| "cell-tower"
|
|
19
|
-
| "chat"
|
|
20
|
-
| "check"
|
|
21
|
-
| "check-in-circle"
|
|
22
|
-
| "chevron-down"
|
|
23
|
-
| "chevron-left"
|
|
24
|
-
| "chevron-right"
|
|
25
|
-
| "chevron-up"
|
|
26
|
-
| "clock"
|
|
27
|
-
| "cloud"
|
|
28
|
-
| "code"
|
|
29
|
-
| "code-in-square"
|
|
30
|
-
| "connect"
|
|
31
|
-
| "connect-alt"
|
|
32
|
-
| "console"
|
|
33
|
-
| "copy"
|
|
34
|
-
| "cross"
|
|
35
|
-
| "data"
|
|
36
|
-
| "database"
|
|
37
|
-
| "disk"
|
|
38
|
-
| "display"
|
|
39
|
-
| "document"
|
|
40
|
-
| "dots-horizontal"
|
|
41
|
-
| "dots-vertical"
|
|
42
|
-
| "email"
|
|
43
|
-
| "empty"
|
|
44
|
-
| "filter"
|
|
45
|
-
| "fire"
|
|
46
|
-
| "folder"
|
|
47
|
-
| "gift"
|
|
48
|
-
| "history"
|
|
49
|
-
| "home"
|
|
50
|
-
| "http"
|
|
51
|
-
| "info-in-circle"
|
|
52
|
-
| "information"
|
|
53
|
-
| "insert-row"
|
|
54
|
-
| "integrations"
|
|
55
|
-
| "light-bulb"
|
|
56
|
-
| "lightening"
|
|
57
|
-
| "loading"
|
|
58
|
-
| "metrics"
|
|
59
|
-
| "metrics-alt"
|
|
60
|
-
| "payment"
|
|
61
|
-
| "pencil"
|
|
62
|
-
| "pie-chart"
|
|
63
|
-
| "play"
|
|
64
|
-
| "plus"
|
|
65
|
-
| "popout"
|
|
66
|
-
| "question"
|
|
67
|
-
| "refresh"
|
|
68
|
-
| "search"
|
|
69
|
-
| "secure"
|
|
70
|
-
| "services"
|
|
71
|
-
| "settings"
|
|
72
|
-
| "share"
|
|
73
|
-
| "slide-in"
|
|
74
|
-
| "slide-out"
|
|
75
|
-
| "sort-alt"
|
|
76
|
-
| "sort"
|
|
77
|
-
| "sparkle"
|
|
78
|
-
| "speaker"
|
|
79
|
-
| "speed"
|
|
80
|
-
| "star"
|
|
81
|
-
| "support"
|
|
82
|
-
| "table"
|
|
83
|
-
| "taxi"
|
|
84
|
-
| "trash"
|
|
85
|
-
| "upload"
|
|
86
|
-
| "url"
|
|
87
|
-
| "user"
|
|
88
|
-
| "users"
|
|
89
|
-
| "warning";
|
|
90
|
-
|
|
91
|
-
export interface IconProps extends SVGAttributes<HTMLOrSVGElement> {
|
|
92
|
-
name: IconName;
|
|
93
|
-
color?: string;
|
|
94
|
-
size?: IconSize;
|
|
95
|
-
}
|