@cyber-harbour/ui 1.0.74 → 1.0.76
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/README.md +76 -0
- package/bin/switch-ui-lib.js +196 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +90 -90
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -26
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -2
- package/.env.example +0 -0
- package/src/Core/Alert/Alert.tsx +0 -87
- package/src/Core/Alert/index.ts +0 -1
- package/src/Core/Box/Box.tsx +0 -46
- package/src/Core/Box/index.ts +0 -1
- package/src/Core/Button/Button.tsx +0 -208
- package/src/Core/Button/index.ts +0 -1
- package/src/Core/Checkbox/Checkbox.tsx +0 -73
- package/src/Core/Checkbox/index.ts +0 -1
- package/src/Core/ContentLoader/ContentLoader.tsx +0 -13
- package/src/Core/ContentLoader/index.ts +0 -1
- package/src/Core/ContextMenu/ContextMenu.tsx +0 -153
- package/src/Core/ContextMenu/ContextMenuDelimiter.tsx +0 -13
- package/src/Core/ContextMenu/index.ts +0 -3
- package/src/Core/ContextMenu/useContextMenuControl.ts +0 -21
- package/src/Core/Drawer/Drawer.tsx +0 -118
- package/src/Core/Drawer/index.ts +0 -1
- package/src/Core/EmptyData/EmptyData.tsx +0 -44
- package/src/Core/EmptyData/index.ts +0 -1
- package/src/Core/Flex/FlexContainer.tsx +0 -94
- package/src/Core/Flex/FlexItem.tsx +0 -58
- package/src/Core/Flex/index.ts +0 -4
- package/src/Core/Header/Header.tsx +0 -37
- package/src/Core/Header/HeaderDelimeter.tsx +0 -12
- package/src/Core/Header/HeaderSection.tsx +0 -37
- package/src/Core/Header/index.ts +0 -3
- package/src/Core/IconComponents/AlertIcon.tsx +0 -18
- package/src/Core/IconComponents/AndroidIcon.tsx +0 -28
- package/src/Core/IconComponents/ApiIcon.tsx +0 -26
- package/src/Core/IconComponents/ArrowCircleTopRightIcon.tsx +0 -27
- package/src/Core/IconComponents/ArrowRightIcon.tsx +0 -23
- package/src/Core/IconComponents/BallsMenu.tsx +0 -15
- package/src/Core/IconComponents/BugReportIcon.tsx +0 -16
- package/src/Core/IconComponents/BusIcon.tsx +0 -24
- package/src/Core/IconComponents/CalendarIcon.tsx +0 -26
- package/src/Core/IconComponents/CarIcon.tsx +0 -16
- package/src/Core/IconComponents/Check.tsx +0 -16
- package/src/Core/IconComponents/ChevronDown.tsx +0 -18
- package/src/Core/IconComponents/ChevronLeftIcon.tsx +0 -23
- package/src/Core/IconComponents/ChevronRightIcon.tsx +0 -23
- package/src/Core/IconComponents/ChevronUp.tsx +0 -18
- package/src/Core/IconComponents/CloseCircleIcon.tsx +0 -24
- package/src/Core/IconComponents/ClosedLockIcon.tsx +0 -22
- package/src/Core/IconComponents/Cross.tsx +0 -16
- package/src/Core/IconComponents/DataSetsIcon.tsx +0 -26
- package/src/Core/IconComponents/DeepSearchIcon.tsx +0 -16
- package/src/Core/IconComponents/DisabledVisibleIcon.tsx +0 -26
- package/src/Core/IconComponents/DocsIcon.tsx +0 -26
- package/src/Core/IconComponents/DownloadIcon.tsx +0 -26
- package/src/Core/IconComponents/EditUserIcon.tsx +0 -26
- package/src/Core/IconComponents/EnableVisibleIcon.tsx +0 -22
- package/src/Core/IconComponents/EnterArrowLeftIcon.tsx +0 -16
- package/src/Core/IconComponents/FileIcon.tsx +0 -16
- package/src/Core/IconComponents/FiltersIcon.tsx +0 -38
- package/src/Core/IconComponents/FlashIcon.tsx +0 -16
- package/src/Core/IconComponents/FolderAlertIcon.tsx +0 -32
- package/src/Core/IconComponents/FolderInfoIcon.tsx +0 -28
- package/src/Core/IconComponents/HomepageIcon.tsx +0 -16
- package/src/Core/IconComponents/InfoCircleFilled.tsx +0 -18
- package/src/Core/IconComponents/InfoCircleIcon.tsx +0 -23
- package/src/Core/IconComponents/IosIcon.tsx +0 -20
- package/src/Core/IconComponents/MapRadarIcon.tsx +0 -22
- package/src/Core/IconComponents/MaximizeIcon.tsx +0 -28
- package/src/Core/IconComponents/MicrosoftIcon.tsx +0 -28
- package/src/Core/IconComponents/MoonIcon.tsx +0 -16
- package/src/Core/IconComponents/OpenLockIcon.tsx +0 -30
- package/src/Core/IconComponents/OrganizationIcon.tsx +0 -26
- package/src/Core/IconComponents/PassportIcon.tsx +0 -796
- package/src/Core/IconComponents/PasswordFinderIcon.tsx +0 -22
- package/src/Core/IconComponents/PencilIcon.tsx +0 -16
- package/src/Core/IconComponents/PhonebookIcon.tsx +0 -22
- package/src/Core/IconComponents/PlaneIcon.tsx +0 -17
- package/src/Core/IconComponents/Plus.tsx +0 -20
- package/src/Core/IconComponents/PointIcon.tsx +0 -16
- package/src/Core/IconComponents/PrintIcon.tsx +0 -16
- package/src/Core/IconComponents/Profiler2Icon.tsx +0 -30
- package/src/Core/IconComponents/ProfilerIcon.tsx +0 -22
- package/src/Core/IconComponents/RelationIcon.tsx +0 -28
- package/src/Core/IconComponents/RelationPointsIcon.tsx +0 -36
- package/src/Core/IconComponents/RotateLeftIcon.tsx +0 -24
- package/src/Core/IconComponents/RotateRightIcon.tsx +0 -24
- package/src/Core/IconComponents/SandBoxIcon.tsx +0 -16
- package/src/Core/IconComponents/SearchIcon.tsx +0 -14
- package/src/Core/IconComponents/ShipIcon.tsx +0 -32
- package/src/Core/IconComponents/StatisticIcon.tsx +0 -26
- package/src/Core/IconComponents/SunIcon.tsx +0 -49
- package/src/Core/IconComponents/Unfold.tsx +0 -20
- package/src/Core/IconComponents/UpRightArrowCircleIcon.tsx +0 -22
- package/src/Core/IconComponents/UserInCircle.tsx +0 -24
- package/src/Core/IconComponents/Users.tsx +0 -36
- package/src/Core/IconComponents/VectorIcon.tsx +0 -17
- package/src/Core/IconComponents/WayIcon.tsx +0 -24
- package/src/Core/IconComponents/index.ts +0 -66
- package/src/Core/Input/Input.tsx +0 -245
- package/src/Core/Input/index.ts +0 -1
- package/src/Core/Label/Label.tsx +0 -139
- package/src/Core/Label/index.ts +0 -1
- package/src/Core/Line/Line.tsx +0 -26
- package/src/Core/Line/index.ts +0 -1
- package/src/Core/LinerProgress/LinerProgress.tsx +0 -47
- package/src/Core/LinerProgress/index.ts +0 -1
- package/src/Core/ListMenu/ListMenu.tsx +0 -31
- package/src/Core/ListMenu/ListMenuItem.tsx +0 -105
- package/src/Core/ListMenu/ListMenuSection.tsx +0 -54
- package/src/Core/ListMenu/index.ts +0 -3
- package/src/Core/Modal/Modal.tsx +0 -116
- package/src/Core/Modal/index.ts +0 -1
- package/src/Core/Overlay/Overlay.tsx +0 -94
- package/src/Core/Overlay/index.ts +0 -1
- package/src/Core/Pagination/Pagination.tsx +0 -139
- package/src/Core/Pagination/index.ts +0 -1
- package/src/Core/RowActionsMenu/RowActionsMenu.tsx +0 -153
- package/src/Core/RowActionsMenu/index.ts +0 -1
- package/src/Core/Select/Select.tsx +0 -197
- package/src/Core/Select/index.ts +0 -1
- package/src/Core/Sidebar/Sidebar.tsx +0 -80
- package/src/Core/Sidebar/SidebarContext.tsx +0 -13
- package/src/Core/Sidebar/SidebarDelimeter.tsx +0 -35
- package/src/Core/Sidebar/SidebarItem.tsx +0 -137
- package/src/Core/Sidebar/SidebarSection.tsx +0 -31
- package/src/Core/Sidebar/index.ts +0 -5
- package/src/Core/Switch/Switch.tsx +0 -71
- package/src/Core/Switch/index.ts +0 -1
- package/src/Core/Table/Cell.tsx +0 -42
- package/src/Core/Table/Row.tsx +0 -3
- package/src/Core/Table/Table.tsx +0 -94
- package/src/Core/Table/index.ts +0 -1
- package/src/Core/Tag/Tag.tsx +0 -144
- package/src/Core/Tag/index.ts +0 -1
- package/src/Core/Tooltip/Tooltip.tsx +0 -103
- package/src/Core/Tooltip/index.ts +0 -1
- package/src/Core/Typography/Typography.tsx +0 -70
- package/src/Core/Typography/index.ts +0 -1
- package/src/Core/index.ts +0 -27
- package/src/FullscreenCard/FullscreenCard.tsx +0 -56
- package/src/FullscreenCard/index.ts +0 -1
- package/src/Graph2D/Graph2D.tsx +0 -1837
- package/src/Graph2D/GraphLoader.tsx +0 -68
- package/src/Graph2D/icons/eye_light.png +0 -0
- package/src/Graph2D/icons/eye_light_hover.png +0 -0
- package/src/Graph2D/icons/group_light.png +0 -0
- package/src/Graph2D/icons/group_light_hover.png +0 -0
- package/src/Graph2D/index.ts +0 -2
- package/src/Graph2D/json_test.json +0 -44444
- package/src/Graph2D/types.ts +0 -122
- package/src/Layouts/Container/Container.tsx +0 -33
- package/src/Layouts/Container/index.ts +0 -1
- package/src/Layouts/PageLayout/PageLayout.tsx +0 -63
- package/src/Layouts/PageLayout/index.ts +0 -1
- package/src/Layouts/index.ts +0 -2
- package/src/Theme/Breakpoint.tsx +0 -50
- package/src/Theme/GlobalStyle.tsx +0 -18
- package/src/Theme/ThemeProvider.tsx +0 -30
- package/src/Theme/componentFabric.tsx +0 -159
- package/src/Theme/index.ts +0 -8
- package/src/Theme/styled.d.ts +0 -7
- package/src/Theme/themes/config.ts +0 -41
- package/src/Theme/themes/dark.ts +0 -1005
- package/src/Theme/themes/index.ts +0 -2
- package/src/Theme/themes/light.ts +0 -1004
- package/src/Theme/types.ts +0 -362
- package/src/Theme/useTheme.tsx +0 -7
- package/src/Theme/utils.ts +0 -205
- package/src/custom.d.ts +0 -19
- package/src/index.ts +0 -5
- package/src/utils.ts +0 -30
- package/tsconfig.paths.json +0 -5
- package/tsup.config.ts +0 -30
- package/tsup.dev.config.ts +0 -10
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
import { styled } from 'styled-components';
|
|
3
|
-
|
|
4
|
-
export type ListMenuItemBase = {
|
|
5
|
-
active?: boolean;
|
|
6
|
-
label?: string;
|
|
7
|
-
count?: number;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export type ListMenuItemAnchorProps = {
|
|
11
|
-
href: string;
|
|
12
|
-
onClick?: (e: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void;
|
|
13
|
-
target?: '_blank' | '_self' | '_parent' | '_top';
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export type ListMenuItemButtonProps = {
|
|
17
|
-
type?: 'button' | 'reset' | 'submit';
|
|
18
|
-
onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export type ListMenuItemProps = ListMenuItemBase & (ListMenuItemAnchorProps | ListMenuItemButtonProps);
|
|
22
|
-
|
|
23
|
-
type StyledProps = {
|
|
24
|
-
$active: ListMenuItemProps['active'];
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export const ListMenuItem = ({ active, label, count, ...props }: ListMenuItemProps) => {
|
|
28
|
-
const Element = 'href' in props ? 'a' : 'button';
|
|
29
|
-
return (
|
|
30
|
-
<StyledItem $active={active}>
|
|
31
|
-
<StyledLink as={'href' in props ? 'a' : 'button'} $active={active} {...props}>
|
|
32
|
-
{label}
|
|
33
|
-
{typeof count === 'number' && <StyledCount $active={active}>{count}</StyledCount>}
|
|
34
|
-
</StyledLink>
|
|
35
|
-
</StyledItem>
|
|
36
|
-
);
|
|
37
|
-
};
|
|
38
|
-
const StyledItem = styled.li<StyledProps>(
|
|
39
|
-
({ theme, $active }) => `
|
|
40
|
-
position: relative;
|
|
41
|
-
display: flex;
|
|
42
|
-
align-items: center;
|
|
43
|
-
justify-content: flex-start;
|
|
44
|
-
width: 100%;
|
|
45
|
-
&:not(:last-child) {
|
|
46
|
-
margin-bottom: 4px;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
::before {
|
|
50
|
-
content: '';
|
|
51
|
-
position: absolute;
|
|
52
|
-
top: 0;
|
|
53
|
-
left: 0;
|
|
54
|
-
width: 2px;
|
|
55
|
-
height: ${$active ? '100%' : 0};
|
|
56
|
-
border-radius: 2px;
|
|
57
|
-
transform: translateX(-25%);
|
|
58
|
-
background-color: ${$active ? theme.colors.primary.main : 'transparent'};
|
|
59
|
-
transition: background-color 0.3s ease-in-out, height 0.3s ease-in-out;
|
|
60
|
-
}
|
|
61
|
-
`
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
const StyledLink = styled.a<StyledProps>(
|
|
65
|
-
({ theme, $active }) => `
|
|
66
|
-
display: inline-block;
|
|
67
|
-
|
|
68
|
-
padding: 8px 10px;
|
|
69
|
-
border: none;
|
|
70
|
-
outline: none;
|
|
71
|
-
cursor: pointer;
|
|
72
|
-
text-decoration: none;
|
|
73
|
-
background-color: transparent;
|
|
74
|
-
border-radius: 8px;
|
|
75
|
-
|
|
76
|
-
width: 100%;
|
|
77
|
-
overflow: hidden;
|
|
78
|
-
text-overflow: ellipsis;
|
|
79
|
-
white-space: nowrap;
|
|
80
|
-
|
|
81
|
-
font-family: Inter;
|
|
82
|
-
font-weight: 500;
|
|
83
|
-
font-size: 14px;
|
|
84
|
-
line-height: 1.5;
|
|
85
|
-
text-align: left;
|
|
86
|
-
color: ${$active ? theme.colors.primary.main : theme.colors.text.main};
|
|
87
|
-
|
|
88
|
-
transition: background-color 0.3s ease-in-out, color 0.3s ease-in-out;
|
|
89
|
-
|
|
90
|
-
&:hover {
|
|
91
|
-
color: ${theme.colors.primary.main};
|
|
92
|
-
}`
|
|
93
|
-
);
|
|
94
|
-
|
|
95
|
-
const StyledCount = styled.span<StyledProps>(
|
|
96
|
-
({ theme, $active }) => `
|
|
97
|
-
margin-left: 8px;
|
|
98
|
-
padding: 2px 4px;
|
|
99
|
-
border-radius: 4px;
|
|
100
|
-
background-color: ${$active ? theme.colors.primary.lightest2 : theme.colors.stroke.lighter};
|
|
101
|
-
color: inherit;
|
|
102
|
-
line-height: 1.5;
|
|
103
|
-
transition: background-color 0.3s ease-in-out, color 0.3s ease-in-out;
|
|
104
|
-
`
|
|
105
|
-
);
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { styled } from 'styled-components';
|
|
3
|
-
|
|
4
|
-
export interface ListMenuSectionProps {
|
|
5
|
-
items: any;
|
|
6
|
-
title?: string;
|
|
7
|
-
}
|
|
8
|
-
export const ListMenuSection = ({ title, items }: ListMenuSectionProps) => {
|
|
9
|
-
return (
|
|
10
|
-
<li>
|
|
11
|
-
{!!title && <StyledTitle>{title}</StyledTitle>}
|
|
12
|
-
<StyledList>{items}</StyledList>
|
|
13
|
-
</li>
|
|
14
|
-
);
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const StyledTitle = styled.h2(
|
|
18
|
-
({ theme }) => `
|
|
19
|
-
margin: 0 0 15px 0;
|
|
20
|
-
width: 100%;
|
|
21
|
-
padding: 0;
|
|
22
|
-
overflow: hidden;
|
|
23
|
-
text-overflow: ellipsis;
|
|
24
|
-
white-space: nowrap;
|
|
25
|
-
|
|
26
|
-
font-family: Inter;
|
|
27
|
-
font-weight: 600;
|
|
28
|
-
font-size: 14px;
|
|
29
|
-
line-height: 1;
|
|
30
|
-
letter-spacing: 0.03em;
|
|
31
|
-
text-align: left;
|
|
32
|
-
text-transform: uppercase;
|
|
33
|
-
color: ${theme.colors.text.lighter};
|
|
34
|
-
`
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
const StyledList = styled.ul(
|
|
38
|
-
({ theme }) => `
|
|
39
|
-
margin: 0;
|
|
40
|
-
padding: 0;
|
|
41
|
-
width: 180px;
|
|
42
|
-
list-style: none;
|
|
43
|
-
position: relative;
|
|
44
|
-
&::before {
|
|
45
|
-
content: "";
|
|
46
|
-
position: absolute;
|
|
47
|
-
top: 0;
|
|
48
|
-
left: 0;
|
|
49
|
-
width: 1px;
|
|
50
|
-
height: 100%;
|
|
51
|
-
background-color: ${theme.colors.stroke.light};
|
|
52
|
-
}
|
|
53
|
-
`
|
|
54
|
-
);
|
package/src/Core/Modal/Modal.tsx
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
import { Overlay } from '../Overlay';
|
|
3
|
-
import { createStyledComponent, FabricComponent, generatePropertySpaceStyle, propToRem, pxToRem } from '../../Theme';
|
|
4
|
-
|
|
5
|
-
type ModalProps = {
|
|
6
|
-
onClose: () => void;
|
|
7
|
-
width?: number;
|
|
8
|
-
children: any;
|
|
9
|
-
isNested?: boolean;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
interface ModalChildrenProps extends FabricComponent<Omit<React.HTMLAttributes<HTMLDivElement>, 'children'>> {
|
|
13
|
-
children: any;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const Modal = ({ children, onClose, isNested = false, width }: ModalProps) => {
|
|
17
|
-
return (
|
|
18
|
-
<Overlay onOutsideClick={onClose} isLocked={!isNested}>
|
|
19
|
-
<StyledContainer $width={width}>{children}</StyledContainer>
|
|
20
|
-
</Overlay>
|
|
21
|
-
);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const ModalHeader = createStyledComponent<ModalChildrenProps>(
|
|
25
|
-
styled.div(({ theme, p = theme.modal.padding, px, pl, pr }) => {
|
|
26
|
-
const left = pl || px || p;
|
|
27
|
-
const right = pr || px || p;
|
|
28
|
-
return `
|
|
29
|
-
grid-area: modal-header;
|
|
30
|
-
position: relative;
|
|
31
|
-
&::after {
|
|
32
|
-
content: '';
|
|
33
|
-
position: absolute;
|
|
34
|
-
bottom: 0;
|
|
35
|
-
left: ${typeof left === 'string' ? left : pxToRem(left)};
|
|
36
|
-
right: ${typeof right === 'string' ? right : pxToRem(right)};
|
|
37
|
-
height: ${pxToRem(1)};
|
|
38
|
-
background-color: ${theme.modal.borderColor};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
${generatePropertySpaceStyle(theme, 'padding', p)};
|
|
42
|
-
`;
|
|
43
|
-
}),
|
|
44
|
-
{
|
|
45
|
-
ignoreStyles: ['padding'],
|
|
46
|
-
}
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
export const ModalBody = createStyledComponent<ModalChildrenProps>(
|
|
50
|
-
styled.div(
|
|
51
|
-
({ theme, p = theme.modal.padding }) => `
|
|
52
|
-
grid-area: modal-body;
|
|
53
|
-
max-height: 100%;
|
|
54
|
-
overflow-y: auto;
|
|
55
|
-
${generatePropertySpaceStyle(theme, 'padding', p)};
|
|
56
|
-
`
|
|
57
|
-
),
|
|
58
|
-
{
|
|
59
|
-
ignoreStyles: ['padding'],
|
|
60
|
-
}
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
export const ModalFooter = createStyledComponent<ModalChildrenProps>(
|
|
64
|
-
styled.div(({ theme, p = theme.modal.padding, px, pl, pr }) => {
|
|
65
|
-
const left = pl || px || p;
|
|
66
|
-
const right = pr || px || p;
|
|
67
|
-
return `
|
|
68
|
-
grid-area: modal-footer;
|
|
69
|
-
position: relative;
|
|
70
|
-
&::after {
|
|
71
|
-
content: '';
|
|
72
|
-
position: absolute;
|
|
73
|
-
top: ${pxToRem(1)};
|
|
74
|
-
left: ${typeof left === 'string' ? left : pxToRem(left)};
|
|
75
|
-
right: ${typeof right === 'string' ? right : pxToRem(right)};
|
|
76
|
-
height: ${pxToRem(1)};
|
|
77
|
-
background-color: ${theme.modal.borderColor};
|
|
78
|
-
}
|
|
79
|
-
${generatePropertySpaceStyle(theme, 'padding', p)};
|
|
80
|
-
`;
|
|
81
|
-
}),
|
|
82
|
-
{
|
|
83
|
-
ignoreStyles: ['padding'],
|
|
84
|
-
}
|
|
85
|
-
);
|
|
86
|
-
|
|
87
|
-
const StyledContainer = styled.div<{ $width?: number }>(
|
|
88
|
-
({ theme, $width = theme.modal.width }) => `
|
|
89
|
-
display: grid;
|
|
90
|
-
grid-template-areas:
|
|
91
|
-
"modal-header"
|
|
92
|
-
"modal-body"
|
|
93
|
-
"modal-footer";
|
|
94
|
-
grid-template-rows: auto 1fr auto;
|
|
95
|
-
position: absolute;
|
|
96
|
-
z-index:${theme.zIndex.modal};
|
|
97
|
-
top: 0;
|
|
98
|
-
left: 0;
|
|
99
|
-
width: 100%;
|
|
100
|
-
height: 100%;
|
|
101
|
-
overflow: hidden;
|
|
102
|
-
background-color: ${theme.modal.background};
|
|
103
|
-
@media (min-width: ${theme.breakpoints.m}px) {
|
|
104
|
-
top: 50%;
|
|
105
|
-
left: 50%;
|
|
106
|
-
transform: translate(-50%, -50%);
|
|
107
|
-
height: auto;
|
|
108
|
-
max-height: 90dvh;
|
|
109
|
-
width: ${propToRem($width, theme.baseSize)};
|
|
110
|
-
max-width: 90vw;
|
|
111
|
-
border: 1px solid ${theme.modal.borderColor};
|
|
112
|
-
box-shadow: ${theme.modal.shadow};
|
|
113
|
-
border-radius: ${theme.modal.borderRadius};
|
|
114
|
-
}
|
|
115
|
-
`
|
|
116
|
-
);
|
package/src/Core/Modal/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Modal';
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { createPortal } from 'react-dom';
|
|
2
|
-
import { styled } from 'styled-components';
|
|
3
|
-
import { useBodyScrollLock } from '../../utils';
|
|
4
|
-
import { createComponent, createStyledComponent, generatePropertySpaceStyle, StyledFabricComponent } from '../../Theme';
|
|
5
|
-
|
|
6
|
-
type Position = 'start' | 'center' | 'end';
|
|
7
|
-
|
|
8
|
-
export type OverlayProps = {
|
|
9
|
-
children: any;
|
|
10
|
-
onOutsideClick?: () => void;
|
|
11
|
-
append?: any;
|
|
12
|
-
appendPosition?: Position;
|
|
13
|
-
prepend?: any;
|
|
14
|
-
prependPosition?: Position;
|
|
15
|
-
isLocked?: boolean;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const Overlay = createComponent<OverlayProps>(
|
|
19
|
-
({ children, onOutsideClick, prepend, append, prependPosition, appendPosition, isLocked = true, ...props }) => {
|
|
20
|
-
useBodyScrollLock(isLocked);
|
|
21
|
-
return createPortal(
|
|
22
|
-
<Container
|
|
23
|
-
{...props}
|
|
24
|
-
className="cb-ui-backdrop"
|
|
25
|
-
onClick={(e) => {
|
|
26
|
-
if (e.target === e.currentTarget && onOutsideClick) {
|
|
27
|
-
onOutsideClick();
|
|
28
|
-
}
|
|
29
|
-
}}
|
|
30
|
-
>
|
|
31
|
-
{!!prepend && <PrependWrapper $position={prependPosition}>{prepend}</PrependWrapper>}
|
|
32
|
-
<StyledWrapper>{children}</StyledWrapper>
|
|
33
|
-
{!!append && <AppendWrapper $position={appendPosition}>{append}</AppendWrapper>}
|
|
34
|
-
</Container>,
|
|
35
|
-
document.body
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
const PrependWrapper = styled.div<{ $position?: Position }>(
|
|
41
|
-
({ theme, $position = 'end' }) => `
|
|
42
|
-
position: absolute;
|
|
43
|
-
top: ${theme.overlay.gap};
|
|
44
|
-
z-index: ${theme.zIndex.backdrop};
|
|
45
|
-
${
|
|
46
|
-
$position === 'end'
|
|
47
|
-
? `right: ${theme.overlay.gap};`
|
|
48
|
-
: $position === 'start'
|
|
49
|
-
? `left: ${theme.overlay.gap};`
|
|
50
|
-
: 'left: 50%; transform: translateX(-50%);'
|
|
51
|
-
}
|
|
52
|
-
`
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
const AppendWrapper = styled.div<{ $position?: Position }>(
|
|
56
|
-
({ theme, $position = 'center' }) => `
|
|
57
|
-
position: absolute;
|
|
58
|
-
bottom: ${theme.overlay.gap};
|
|
59
|
-
z-index: ${theme.zIndex.backdrop};
|
|
60
|
-
${
|
|
61
|
-
$position === 'end'
|
|
62
|
-
? `right: ${theme.overlay.gap};`
|
|
63
|
-
: $position === 'start'
|
|
64
|
-
? `left: ${theme.overlay.gap};`
|
|
65
|
-
: 'left: 50%; transform: translateX(-50%);'
|
|
66
|
-
}
|
|
67
|
-
`
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
const StyledWrapper = styled.div`
|
|
71
|
-
max-width: 100%;
|
|
72
|
-
max-height: 100%;
|
|
73
|
-
overflow: hidden;
|
|
74
|
-
`;
|
|
75
|
-
|
|
76
|
-
const Container = createStyledComponent(
|
|
77
|
-
styled.div<StyledFabricComponent>(
|
|
78
|
-
({ theme, py = theme.overlay.paddingBlock }) => `
|
|
79
|
-
position: fixed;
|
|
80
|
-
${generatePropertySpaceStyle(theme, 'padding-block', py)};
|
|
81
|
-
top: 0;
|
|
82
|
-
bottom: 0;
|
|
83
|
-
left: 0;
|
|
84
|
-
right: 0;
|
|
85
|
-
min-width: 0;
|
|
86
|
-
display: flex;
|
|
87
|
-
align-items: center;
|
|
88
|
-
justify-content: center;
|
|
89
|
-
background: ${theme.overlay.background};
|
|
90
|
-
z-index: ${theme.zIndex.backdrop};
|
|
91
|
-
|
|
92
|
-
`
|
|
93
|
-
)
|
|
94
|
-
);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Overlay';
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import { FC, useCallback, useMemo } from 'react';
|
|
2
|
-
import { styled } from 'styled-components';
|
|
3
|
-
import { ChevronRightIcon } from '../IconComponents';
|
|
4
|
-
import { ChevronLeftIcon } from '../IconComponents';
|
|
5
|
-
|
|
6
|
-
export interface PaginationProps {
|
|
7
|
-
total_items: number;
|
|
8
|
-
limit: number;
|
|
9
|
-
offset: number;
|
|
10
|
-
onChangePage: (offset: number) => void;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const PAGINATION_LIMIT = 9;
|
|
14
|
-
const DIFF = 2;
|
|
15
|
-
const VISIBLE_GROUPE = 5;
|
|
16
|
-
const STEP = 1;
|
|
17
|
-
const ELLIPSIS = '...';
|
|
18
|
-
|
|
19
|
-
export const Pagination = ({ total_items, limit, offset, onChangePage }: PaginationProps) => {
|
|
20
|
-
const currentPage = useMemo(() => (offset ? offset / limit + 1 : 1), [limit, offset]);
|
|
21
|
-
const pages = Math.ceil(total_items / limit);
|
|
22
|
-
const paginationItems: (number | string)[] = useMemo(() => {
|
|
23
|
-
const items = [];
|
|
24
|
-
if (pages <= PAGINATION_LIMIT) {
|
|
25
|
-
for (let i = 1; i <= pages; i += 1) {
|
|
26
|
-
items.push(i);
|
|
27
|
-
}
|
|
28
|
-
} else {
|
|
29
|
-
const firstPage = 1;
|
|
30
|
-
const lastPage = pages;
|
|
31
|
-
items.push(firstPage);
|
|
32
|
-
if (currentPage <= VISIBLE_GROUPE) {
|
|
33
|
-
for (let i = 2; i <= VISIBLE_GROUPE + 2; i += 1) {
|
|
34
|
-
items.push(i);
|
|
35
|
-
}
|
|
36
|
-
items.push(ELLIPSIS, lastPage);
|
|
37
|
-
} else if (currentPage > VISIBLE_GROUPE && currentPage < lastPage - VISIBLE_GROUPE) {
|
|
38
|
-
items.push(ELLIPSIS);
|
|
39
|
-
for (let i = currentPage - DIFF; i <= currentPage + DIFF; i += 1) {
|
|
40
|
-
items.push(i);
|
|
41
|
-
}
|
|
42
|
-
items.push(ELLIPSIS, lastPage);
|
|
43
|
-
} else {
|
|
44
|
-
items.push(ELLIPSIS);
|
|
45
|
-
for (let i = lastPage - VISIBLE_GROUPE - 1; i <= lastPage; i += 1) {
|
|
46
|
-
items.push(i);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return items;
|
|
51
|
-
}, [currentPage, pages]);
|
|
52
|
-
|
|
53
|
-
const isDisabled = useCallback(
|
|
54
|
-
(page: number | string) => typeof page === 'string' || page === currentPage,
|
|
55
|
-
[currentPage]
|
|
56
|
-
);
|
|
57
|
-
const onPaginationClick = useCallback(
|
|
58
|
-
(page: number | string) => {
|
|
59
|
-
if (isDisabled(page)) return;
|
|
60
|
-
onChangePage(page as number);
|
|
61
|
-
},
|
|
62
|
-
[onChangePage, isDisabled]
|
|
63
|
-
);
|
|
64
|
-
return (
|
|
65
|
-
<FlexGroup>
|
|
66
|
-
<Button
|
|
67
|
-
aria-label="previous page"
|
|
68
|
-
onClick={() => onPaginationClick(currentPage - STEP)}
|
|
69
|
-
disabled={currentPage === 1}
|
|
70
|
-
>
|
|
71
|
-
<ChevronLeftIcon />
|
|
72
|
-
</Button>
|
|
73
|
-
<StyledList>
|
|
74
|
-
{paginationItems.map((page, idx) => (
|
|
75
|
-
<li key={`pagination-${page}-${idx}`}>
|
|
76
|
-
<Button $current={page === currentPage} onClick={() => onPaginationClick(page)}>
|
|
77
|
-
{page}
|
|
78
|
-
</Button>
|
|
79
|
-
</li>
|
|
80
|
-
))}
|
|
81
|
-
</StyledList>
|
|
82
|
-
<Button
|
|
83
|
-
aria-label="next page"
|
|
84
|
-
onClick={() => onPaginationClick(currentPage + STEP)}
|
|
85
|
-
disabled={!total_items || currentPage === pages}
|
|
86
|
-
>
|
|
87
|
-
<ChevronRightIcon />
|
|
88
|
-
</Button>
|
|
89
|
-
</FlexGroup>
|
|
90
|
-
);
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
type StyledButtonProps = {
|
|
94
|
-
$current?: boolean;
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
const StyledList = styled.div(
|
|
98
|
-
({ theme }) => `
|
|
99
|
-
list-style: none;
|
|
100
|
-
padding: 0;
|
|
101
|
-
display: flex;
|
|
102
|
-
flex-wrap: wrap;
|
|
103
|
-
gap: ${theme.pagination.gap};
|
|
104
|
-
`
|
|
105
|
-
);
|
|
106
|
-
const Button = styled.button<StyledButtonProps>(
|
|
107
|
-
({ theme, $current }) => `
|
|
108
|
-
font-family: ${theme.typography.fontFamily};
|
|
109
|
-
background-color: ${$current ? theme.colors.primary.main : theme.colors.background};
|
|
110
|
-
color: ${$current ? theme.colors.background : theme.colors.text.main};
|
|
111
|
-
border: none;
|
|
112
|
-
cursor: pointer;
|
|
113
|
-
padding-block: ${theme.pagination.paddingBlock};
|
|
114
|
-
padding-inline: ${theme.pagination.paddingInline};
|
|
115
|
-
border-radius: ${theme.pagination.borderRadius};
|
|
116
|
-
font-size: ${theme.pagination.fontSize};
|
|
117
|
-
font-weight: 400;
|
|
118
|
-
display: flex;
|
|
119
|
-
align-items: center;
|
|
120
|
-
justify-content: center;
|
|
121
|
-
height: ${theme.pagination.height};
|
|
122
|
-
svg {
|
|
123
|
-
width: ${theme.pagination.iconSize};
|
|
124
|
-
height: ${theme.pagination.iconSize};
|
|
125
|
-
}
|
|
126
|
-
&:hover {
|
|
127
|
-
background-color: ${theme.colors.primary.light};
|
|
128
|
-
}
|
|
129
|
-
transition: background-color 0.3s ease-in-out;
|
|
130
|
-
`
|
|
131
|
-
);
|
|
132
|
-
const FlexGroup = styled.div(
|
|
133
|
-
({ theme }) => `
|
|
134
|
-
display: flex;
|
|
135
|
-
align-items: center;
|
|
136
|
-
justify-content: flex-end;
|
|
137
|
-
gap: ${theme.pagination.gap};
|
|
138
|
-
`
|
|
139
|
-
);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Pagination';
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import { ButtonColor, ButtonSize, getButtonSizeStyles } from '../../Theme';
|
|
2
|
-
import { useRef } from 'react';
|
|
3
|
-
import { Popover, PopoverAlign, PopoverPosition } from 'react-tiny-popover';
|
|
4
|
-
import { styled, useTheme } from 'styled-components';
|
|
5
|
-
import { BallsMenu } from '../IconComponents';
|
|
6
|
-
import { useContextMenuControl } from '../ContextMenu';
|
|
7
|
-
import { Button } from '../Button';
|
|
8
|
-
|
|
9
|
-
export type Action = {
|
|
10
|
-
label: string;
|
|
11
|
-
onClick: () => void;
|
|
12
|
-
color: ButtonColor;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
interface RowActionsMenuProps {
|
|
16
|
-
items: Action[];
|
|
17
|
-
size?: ButtonSize;
|
|
18
|
-
disabled?: boolean;
|
|
19
|
-
className?: string;
|
|
20
|
-
positions?: PopoverPosition[] | PopoverPosition;
|
|
21
|
-
align?: PopoverAlign;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export const RowActionsMenu = ({
|
|
25
|
-
size = 'small',
|
|
26
|
-
disabled,
|
|
27
|
-
className,
|
|
28
|
-
positions = ['bottom'],
|
|
29
|
-
align = 'end',
|
|
30
|
-
items,
|
|
31
|
-
}: RowActionsMenuProps) => {
|
|
32
|
-
const buttonRef = useRef<HTMLButtonElement | null>(null);
|
|
33
|
-
const { isOpen, closeMenu, toggleMenu } = useContextMenuControl();
|
|
34
|
-
|
|
35
|
-
const theme = useTheme();
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<Popover
|
|
39
|
-
padding={theme.contextMenu.padding}
|
|
40
|
-
isOpen={isOpen}
|
|
41
|
-
positions={positions}
|
|
42
|
-
align={align}
|
|
43
|
-
onClickOutside={closeMenu}
|
|
44
|
-
content={
|
|
45
|
-
<ContentWrapper>
|
|
46
|
-
{items.map(({ label, onClick, color }, idx) => (
|
|
47
|
-
<Button
|
|
48
|
-
variant="empty"
|
|
49
|
-
key={`row-action-${idx}`}
|
|
50
|
-
color={color}
|
|
51
|
-
fullWidth
|
|
52
|
-
size={size}
|
|
53
|
-
py={10}
|
|
54
|
-
px={5}
|
|
55
|
-
onClick={() => {
|
|
56
|
-
onClick();
|
|
57
|
-
closeMenu();
|
|
58
|
-
}}
|
|
59
|
-
>
|
|
60
|
-
{label}
|
|
61
|
-
</Button>
|
|
62
|
-
))}
|
|
63
|
-
</ContentWrapper>
|
|
64
|
-
}
|
|
65
|
-
containerStyle={{
|
|
66
|
-
backgroundColor: theme.colors.background,
|
|
67
|
-
border: `1px solid ${theme.colors.stroke.light}`,
|
|
68
|
-
boxShadow: '0px 0px 10px 0px rgba(0, 0, 0, 0.25)',
|
|
69
|
-
borderRadius: '5px',
|
|
70
|
-
zIndex: `${9999}`,
|
|
71
|
-
}}
|
|
72
|
-
>
|
|
73
|
-
<StyledButton
|
|
74
|
-
ref={buttonRef}
|
|
75
|
-
onClick={toggleMenu}
|
|
76
|
-
$disabled={disabled}
|
|
77
|
-
$size={size}
|
|
78
|
-
className={className}
|
|
79
|
-
type="button"
|
|
80
|
-
disabled={disabled}
|
|
81
|
-
>
|
|
82
|
-
<BallsMenu width={theme.rowActionsMenu.icon.size} height={theme.rowActionsMenu.icon.size} />
|
|
83
|
-
</StyledButton>
|
|
84
|
-
</Popover>
|
|
85
|
-
);
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
const StyledButton = styled.button<{
|
|
89
|
-
$size: ButtonSize;
|
|
90
|
-
$disabled?: boolean;
|
|
91
|
-
}>`
|
|
92
|
-
${({ $size, $disabled, theme }) => {
|
|
93
|
-
const sizes = getButtonSizeStyles(theme, $size);
|
|
94
|
-
return `
|
|
95
|
-
background: ${theme.rowActionsMenu.button.default.background};
|
|
96
|
-
color: ${theme.rowActionsMenu.button.default.text};
|
|
97
|
-
border: none;
|
|
98
|
-
font-size: ${sizes.fontSize};
|
|
99
|
-
gap: ${sizes.gap};
|
|
100
|
-
padding: 4px;
|
|
101
|
-
border-radius: ${sizes.borderRadius};
|
|
102
|
-
width: auto;
|
|
103
|
-
cursor: ${$disabled ? 'not-allowed' : 'pointer'};
|
|
104
|
-
font-weight: 500;
|
|
105
|
-
display: inline-flex;
|
|
106
|
-
justify-content: center;
|
|
107
|
-
align-items: center;
|
|
108
|
-
text-decoration: none;
|
|
109
|
-
transition: all 0.2s ease;
|
|
110
|
-
outline: none;
|
|
111
|
-
|
|
112
|
-
&:hover {
|
|
113
|
-
background: ${theme.rowActionsMenu.button.hover.background};
|
|
114
|
-
color: ${theme.rowActionsMenu.button.hover.text};
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
&:active {
|
|
118
|
-
background: ${theme.rowActionsMenu.button.active.background};
|
|
119
|
-
color: ${theme.rowActionsMenu.button.active.text};
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
&:disabled {
|
|
123
|
-
background: ${theme.rowActionsMenu.button.disabled.background};
|
|
124
|
-
color: ${theme.rowActionsMenu.button.disabled.text};
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
`;
|
|
128
|
-
}}
|
|
129
|
-
`;
|
|
130
|
-
const ContentWrapper = styled.div(
|
|
131
|
-
({ theme }) => `
|
|
132
|
-
padding: 5px 10px;
|
|
133
|
-
display: flex;
|
|
134
|
-
flex-direction: column;
|
|
135
|
-
button {
|
|
136
|
-
min-width: 110px;
|
|
137
|
-
justify-content: flex-start;
|
|
138
|
-
font-weight: 400;
|
|
139
|
-
}
|
|
140
|
-
button:not(:last-of-type) {
|
|
141
|
-
position: relative;
|
|
142
|
-
::after {
|
|
143
|
-
position: absolute;
|
|
144
|
-
content: '';
|
|
145
|
-
bottom: 0;
|
|
146
|
-
left: 5px;
|
|
147
|
-
right: 5px;
|
|
148
|
-
height: 1px;
|
|
149
|
-
background-color: ${theme.rowActionsMenu.delimiterColor};
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
`
|
|
153
|
-
);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './RowActionsMenu';
|