@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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cyber-harbour/ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.76",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -11,6 +11,13 @@
|
|
|
11
11
|
"require": "./dist/index.js"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
|
+
"bin": {
|
|
15
|
+
"switch-ui-lib": "./bin/switch-ui-lib.js"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"bin"
|
|
20
|
+
],
|
|
14
21
|
"private": false,
|
|
15
22
|
"scripts": {
|
|
16
23
|
"dev": "tsup --config tsup.dev.config.ts",
|
|
@@ -20,7 +27,8 @@
|
|
|
20
27
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
21
28
|
"storybook": "storybook dev -p 6006",
|
|
22
29
|
"build-storybook": "storybook build",
|
|
23
|
-
"publish": "npm publish --access public"
|
|
30
|
+
"publish": "npm publish --access public",
|
|
31
|
+
"switch-ui-lib": "node ./bin/switch-ui-lib.js"
|
|
24
32
|
},
|
|
25
33
|
"keywords": [],
|
|
26
34
|
"author": "",
|
|
@@ -29,7 +37,9 @@
|
|
|
29
37
|
"dependencies": {
|
|
30
38
|
"@types/react-dom": "^19.1.6",
|
|
31
39
|
"d3": "^7.9.0",
|
|
40
|
+
"dotenv": "^16.6.1",
|
|
32
41
|
"lodash.clonedeep": "^4.5.0",
|
|
42
|
+
"prompts": "^2.4.2",
|
|
33
43
|
"react-content-loader": "^7.0.2",
|
|
34
44
|
"react-force-graph-2d": "^1.27.1",
|
|
35
45
|
"react-tiny-popover": "^8.1.6",
|
package/.env.example
DELETED
|
File without changes
|
package/src/Core/Alert/Alert.tsx
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
import {
|
|
4
|
-
FabricComponent,
|
|
5
|
-
StyledFabricComponent,
|
|
6
|
-
createComponent,
|
|
7
|
-
createStyledComponent,
|
|
8
|
-
generatePropertySpaceStyle,
|
|
9
|
-
} from '../../Theme';
|
|
10
|
-
import { AlertIcon } from '../IconComponents';
|
|
11
|
-
|
|
12
|
-
type AlertProps = FabricComponent<{
|
|
13
|
-
title?: any;
|
|
14
|
-
note?: any;
|
|
15
|
-
}> &
|
|
16
|
-
Omit<React.HTMLAttributes<HTMLDivElement>, 'children'>;
|
|
17
|
-
|
|
18
|
-
export const Alert = createComponent<AlertProps>(({ title, note, ...props }) => {
|
|
19
|
-
return (
|
|
20
|
-
<StyledContainer {...props}>
|
|
21
|
-
<IconWrapper>
|
|
22
|
-
<AlertIcon />
|
|
23
|
-
</IconWrapper>
|
|
24
|
-
<div>
|
|
25
|
-
{!!title && <Title>{title}</Title>}
|
|
26
|
-
{!!note && <Note>{note}</Note>}
|
|
27
|
-
</div>
|
|
28
|
-
</StyledContainer>
|
|
29
|
-
);
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
const IconWrapper = styled.div(
|
|
33
|
-
({ theme: { alert } }) => `
|
|
34
|
-
flex-shrink: 0;
|
|
35
|
-
color: ${alert.color.icon};
|
|
36
|
-
padding-top: ${alert.icon.paddingTop};
|
|
37
|
-
svg {
|
|
38
|
-
width: ${alert.icon.width};
|
|
39
|
-
height: ${alert.icon.height};
|
|
40
|
-
display: block;
|
|
41
|
-
}
|
|
42
|
-
`
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
const Title = styled.h3(
|
|
46
|
-
({ theme: { alert } }) => `
|
|
47
|
-
margin: 0;
|
|
48
|
-
padding: 0;
|
|
49
|
-
font-size: ${alert.fontSize};
|
|
50
|
-
line-height: 1.2;
|
|
51
|
-
font-weight: 700;
|
|
52
|
-
color: ${alert.color.text};
|
|
53
|
-
&:not(:last-child) {
|
|
54
|
-
margin-bottom: 8px;
|
|
55
|
-
}
|
|
56
|
-
`
|
|
57
|
-
);
|
|
58
|
-
const Note = styled.p(
|
|
59
|
-
({ theme: { alert } }) => `
|
|
60
|
-
margin: 0;
|
|
61
|
-
padding: 0;
|
|
62
|
-
word-break: break-word;
|
|
63
|
-
font-size: ${alert.fontSize};
|
|
64
|
-
color: ${alert.color.text};
|
|
65
|
-
line-height: 1.5;
|
|
66
|
-
`
|
|
67
|
-
);
|
|
68
|
-
|
|
69
|
-
const StyledContainer = createStyledComponent(
|
|
70
|
-
styled.div<StyledFabricComponent>(
|
|
71
|
-
({ theme, py = theme.alert.paddingBlock, pl = theme.alert.paddingLeft, pr = theme.alert.paddingRight }) => {
|
|
72
|
-
return `
|
|
73
|
-
display: flex;
|
|
74
|
-
align-items: flex-start;
|
|
75
|
-
justify-content: flex-start;
|
|
76
|
-
flex-wrap: nowrap;
|
|
77
|
-
gap: ${theme.alert.gap};
|
|
78
|
-
background-color: ${theme.alert.color.background};
|
|
79
|
-
border-radius: ${theme.alert.borderRadius};
|
|
80
|
-
${generatePropertySpaceStyle(theme, 'padding-block', py)};
|
|
81
|
-
${generatePropertySpaceStyle(theme, 'padding-right', pr)};
|
|
82
|
-
${generatePropertySpaceStyle(theme, 'padding-left', pl)};
|
|
83
|
-
`;
|
|
84
|
-
}
|
|
85
|
-
),
|
|
86
|
-
{ ignoreStyles: ['padding-block', 'padding-right', 'padding-left'] }
|
|
87
|
-
);
|
package/src/Core/Alert/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Alert';
|
package/src/Core/Box/Box.tsx
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ColorVariant,
|
|
3
|
-
createComponent,
|
|
4
|
-
createStyledComponent,
|
|
5
|
-
FabricComponent,
|
|
6
|
-
generatePropertySpaceStyle,
|
|
7
|
-
resolveThemeColor,
|
|
8
|
-
StyledFabricComponent,
|
|
9
|
-
} from '../../Theme';
|
|
10
|
-
import { styled } from 'styled-components';
|
|
11
|
-
|
|
12
|
-
type BoxProps = {
|
|
13
|
-
children?: any;
|
|
14
|
-
element?: 'div' | 'section';
|
|
15
|
-
hasBorder?: boolean;
|
|
16
|
-
color?: ColorVariant | string;
|
|
17
|
-
} & React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
|
|
18
|
-
|
|
19
|
-
export const Box = createComponent<BoxProps>(
|
|
20
|
-
({ children, element = 'div', hasBorder = true, color, ...props }): any => {
|
|
21
|
-
return (
|
|
22
|
-
<StyledBox as={element} $hasBorder={hasBorder} $color={color} {...props}>
|
|
23
|
-
{children}
|
|
24
|
-
</StyledBox>
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
type StyledProps = { $hasBorder: boolean; $color?: string };
|
|
30
|
-
|
|
31
|
-
const StyledBox = createStyledComponent(
|
|
32
|
-
styled('div')<StyledFabricComponent<StyledProps>>(
|
|
33
|
-
({ theme, $hasBorder, $color, px = theme.box.padding, py = theme.box.padding }) => `
|
|
34
|
-
${generatePropertySpaceStyle(theme, 'padding-inline', px)}
|
|
35
|
-
${generatePropertySpaceStyle(theme, 'padding-block', py)}
|
|
36
|
-
border-radius: ${theme.box.borderRadius};
|
|
37
|
-
background-color: ${theme.box.background};
|
|
38
|
-
border-width: ${$hasBorder ? theme.box.border.width : 0};
|
|
39
|
-
border-style: ${theme.box.border.style};
|
|
40
|
-
border-color: ${resolveThemeColor(theme, $color) || theme.box.border.color};
|
|
41
|
-
`
|
|
42
|
-
),
|
|
43
|
-
{
|
|
44
|
-
ignoreStyles: ['padding-inline', 'padding-block'],
|
|
45
|
-
}
|
|
46
|
-
);
|
package/src/Core/Box/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Box';
|
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import styled, { CSSProperties } from 'styled-components';
|
|
3
|
-
import {
|
|
4
|
-
ButtonVariant,
|
|
5
|
-
ButtonSize,
|
|
6
|
-
ButtonColor,
|
|
7
|
-
getButtonStyles,
|
|
8
|
-
getButtonSizeStyles,
|
|
9
|
-
ButtonElementStyle,
|
|
10
|
-
createComponent,
|
|
11
|
-
generatePropertySpaceStyle,
|
|
12
|
-
createStyledComponent,
|
|
13
|
-
StyledFabricComponent,
|
|
14
|
-
pxToRem,
|
|
15
|
-
} from '../../Theme';
|
|
16
|
-
|
|
17
|
-
type BaseButtonProps = {
|
|
18
|
-
children?: any;
|
|
19
|
-
variant?: ButtonVariant;
|
|
20
|
-
color?: ButtonColor;
|
|
21
|
-
size?: ButtonSize;
|
|
22
|
-
disabled?: boolean;
|
|
23
|
-
fullWidth?: boolean;
|
|
24
|
-
className?: string;
|
|
25
|
-
icon?: any;
|
|
26
|
-
iconPosition?: 'left' | 'right';
|
|
27
|
-
iconVariant?: 'filled' | 'empty';
|
|
28
|
-
minWidth?: number;
|
|
29
|
-
whiteSpace?: CSSProperties['whiteSpace'];
|
|
30
|
-
};
|
|
31
|
-
export type ButtonProps = (
|
|
32
|
-
| Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'children' | 'media'>
|
|
33
|
-
| Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'media'>
|
|
34
|
-
) &
|
|
35
|
-
BaseButtonProps;
|
|
36
|
-
|
|
37
|
-
const getCss = (styles: ButtonElementStyle) => `
|
|
38
|
-
background: ${styles.background};
|
|
39
|
-
color: ${styles.text};
|
|
40
|
-
border-color: ${styles.border};
|
|
41
|
-
box-shadow: ${styles.boxShadow};
|
|
42
|
-
`;
|
|
43
|
-
|
|
44
|
-
const getIconStyles = (styles: ButtonElementStyle) =>
|
|
45
|
-
styles.filledIcon
|
|
46
|
-
? `
|
|
47
|
-
color: ${styles.filledIcon.color};
|
|
48
|
-
background: ${styles.filledIcon.background};
|
|
49
|
-
`
|
|
50
|
-
: '';
|
|
51
|
-
|
|
52
|
-
// Створюємо стилізований компонент, що використовує уніфіковану палітру
|
|
53
|
-
const ButtonTextContainer = styled.div<{ $whiteSpace: CSSProperties['whiteSpace'] }>(
|
|
54
|
-
({ $whiteSpace }) => `
|
|
55
|
-
text-overflow: ellipsis;
|
|
56
|
-
overflow: hidden;
|
|
57
|
-
white-space: ${$whiteSpace};
|
|
58
|
-
user-select: text;
|
|
59
|
-
`
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
const StyledIconWrapper = styled.span`
|
|
63
|
-
display: inline-flex;
|
|
64
|
-
align-items: center;
|
|
65
|
-
justify-content: center;
|
|
66
|
-
`;
|
|
67
|
-
|
|
68
|
-
type StyledButtonProps = {
|
|
69
|
-
$variant: ButtonVariant;
|
|
70
|
-
$color: ButtonColor;
|
|
71
|
-
$size: ButtonSize;
|
|
72
|
-
$disabled: boolean;
|
|
73
|
-
$fullWidth: boolean;
|
|
74
|
-
$iconPosition: 'left' | 'right';
|
|
75
|
-
$iconVariant: 'filled' | 'empty';
|
|
76
|
-
$minWidth?: number;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
const StyledButton = createStyledComponent(
|
|
80
|
-
styled.button<StyledFabricComponent<StyledButtonProps>>(
|
|
81
|
-
({
|
|
82
|
-
$variant,
|
|
83
|
-
$color,
|
|
84
|
-
$size,
|
|
85
|
-
$disabled,
|
|
86
|
-
$fullWidth,
|
|
87
|
-
$iconPosition,
|
|
88
|
-
$iconVariant,
|
|
89
|
-
$minWidth,
|
|
90
|
-
theme,
|
|
91
|
-
px = $variant !== 'empty' ? theme.button.sizes[$size].paddingInline : 0,
|
|
92
|
-
py = $variant !== 'empty' ? theme.button.sizes[$size].paddingBlock : 0,
|
|
93
|
-
}) => {
|
|
94
|
-
const sizes = getButtonSizeStyles(theme, $size);
|
|
95
|
-
return `
|
|
96
|
-
${getCss(getButtonStyles(theme, $variant, $color, 'default'))}
|
|
97
|
-
font-size: ${sizes.fontSize};
|
|
98
|
-
gap: ${sizes.gap};
|
|
99
|
-
${generatePropertySpaceStyle(theme, 'padding-block', py)};
|
|
100
|
-
${generatePropertySpaceStyle(theme, 'padding-inline', px)};
|
|
101
|
-
border-radius: ${sizes.borderRadius};
|
|
102
|
-
border-width: ${sizes.borderWidth};
|
|
103
|
-
border-style: solid;
|
|
104
|
-
max-width: 100%;
|
|
105
|
-
width: ${$fullWidth ? '100%' : 'auto'};
|
|
106
|
-
cursor: ${$disabled ? 'not-allowed' : 'pointer'};
|
|
107
|
-
font-weight: 500;
|
|
108
|
-
display: inline-flex;
|
|
109
|
-
align-items: center;
|
|
110
|
-
justify-content: center;
|
|
111
|
-
text-decoration: none;
|
|
112
|
-
transition: all 0.2s ease;
|
|
113
|
-
outline: none;
|
|
114
|
-
user-select: text;
|
|
115
|
-
${typeof $minWidth === 'number' ? `min-width: ${pxToRem($minWidth, theme.baseSize)};` : ''}
|
|
116
|
-
|
|
117
|
-
${$iconPosition === 'right' ? 'flex-direction: row-reverse;' : ''}
|
|
118
|
-
|
|
119
|
-
&:hover {
|
|
120
|
-
${getCss(getButtonStyles(theme, $variant, $color, 'hover'))}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
&:active {
|
|
124
|
-
${getCss(getButtonStyles(theme, $variant, $color, 'active'))}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
&:disabled {
|
|
128
|
-
${getCss(getButtonStyles(theme, $variant, $color, 'disabled'))}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
${StyledIconWrapper} svg {
|
|
132
|
-
width: ${sizes.iconSize};
|
|
133
|
-
height: ${sizes.iconSize};
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
${
|
|
137
|
-
$iconVariant === 'filled'
|
|
138
|
-
? `
|
|
139
|
-
${StyledIconWrapper} {
|
|
140
|
-
width: 24px;
|
|
141
|
-
height: 24px;
|
|
142
|
-
border-radius: ${sizes.borderRadius};
|
|
143
|
-
transition: all 0.2s ease;
|
|
144
|
-
${getIconStyles(getButtonStyles(theme, $variant, $color, 'default'))}
|
|
145
|
-
}
|
|
146
|
-
&:hover {
|
|
147
|
-
${StyledIconWrapper} {
|
|
148
|
-
${getIconStyles(getButtonStyles(theme, $variant, $color, 'hover'))}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
&:active {
|
|
153
|
-
${StyledIconWrapper} {
|
|
154
|
-
${getIconStyles(getButtonStyles(theme, $variant, $color, 'active'))}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
&:disabled {
|
|
159
|
-
${StyledIconWrapper} {
|
|
160
|
-
${getIconStyles(getButtonStyles(theme, $variant, $color, 'disabled'))}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
`
|
|
164
|
-
: ``
|
|
165
|
-
}
|
|
166
|
-
`;
|
|
167
|
-
}
|
|
168
|
-
)
|
|
169
|
-
);
|
|
170
|
-
|
|
171
|
-
export const Button = createComponent<ButtonProps>(
|
|
172
|
-
({
|
|
173
|
-
children,
|
|
174
|
-
variant = 'fill',
|
|
175
|
-
color = 'primary',
|
|
176
|
-
size = 'medium',
|
|
177
|
-
disabled = false,
|
|
178
|
-
fullWidth = false,
|
|
179
|
-
className,
|
|
180
|
-
icon,
|
|
181
|
-
iconPosition = 'left',
|
|
182
|
-
iconVariant = 'empty',
|
|
183
|
-
whiteSpace = 'nowrap',
|
|
184
|
-
minWidth,
|
|
185
|
-
...props
|
|
186
|
-
}) => {
|
|
187
|
-
return (
|
|
188
|
-
// @ts-ignore
|
|
189
|
-
<StyledButton
|
|
190
|
-
as={'href' in props ? 'a' : 'button'}
|
|
191
|
-
$variant={variant}
|
|
192
|
-
$color={color}
|
|
193
|
-
$size={size}
|
|
194
|
-
$disabled={disabled}
|
|
195
|
-
$fullWidth={fullWidth}
|
|
196
|
-
$iconPosition={iconPosition}
|
|
197
|
-
$iconVariant={iconVariant}
|
|
198
|
-
$minWidth={minWidth}
|
|
199
|
-
disabled={disabled}
|
|
200
|
-
className={className}
|
|
201
|
-
{...props}
|
|
202
|
-
>
|
|
203
|
-
{!!icon && <StyledIconWrapper>{icon}</StyledIconWrapper>}
|
|
204
|
-
{!!children && <ButtonTextContainer $whiteSpace={whiteSpace}>{children}</ButtonTextContainer>}
|
|
205
|
-
</StyledButton>
|
|
206
|
-
);
|
|
207
|
-
}
|
|
208
|
-
);
|
package/src/Core/Button/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Button';
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
import { createComponent, createStyledComponent, destructSpaceProps, pxToRem } from '../../Theme';
|
|
4
|
-
|
|
5
|
-
type CheckboxProps = {
|
|
6
|
-
label?: any;
|
|
7
|
-
} & Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type'>;
|
|
8
|
-
|
|
9
|
-
export const Checkbox = createComponent<CheckboxProps>(({ label, className, disabled, ...props }) => {
|
|
10
|
-
const spaceProps = destructSpaceProps(props);
|
|
11
|
-
return (
|
|
12
|
-
<StyledCheckbox className={className} $disabled={disabled} {...spaceProps}>
|
|
13
|
-
<HiddenInput type="checkbox" disabled={disabled} {...props} />
|
|
14
|
-
<CustomCheckbox />
|
|
15
|
-
{!!label && <LabelText>{label}</LabelText>}
|
|
16
|
-
</StyledCheckbox>
|
|
17
|
-
);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
const CustomCheckbox = styled.div(
|
|
21
|
-
({ theme }) => `
|
|
22
|
-
width: ${pxToRem(15)};
|
|
23
|
-
height: ${pxToRem(15)};
|
|
24
|
-
border-radius: ${pxToRem(2)};
|
|
25
|
-
border: 1px solid ${theme.colors.stroke.main};
|
|
26
|
-
background-color: ${theme.colors.background};
|
|
27
|
-
transition: all 0.2s ease;
|
|
28
|
-
`
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
const LabelText = styled.span(
|
|
32
|
-
({ theme }) => `
|
|
33
|
-
margin-left: ${pxToRem(5)};
|
|
34
|
-
font-size: ${theme.typography.variants.h3.fontSize};
|
|
35
|
-
color: ${theme.colors.text.main};
|
|
36
|
-
`
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
const HiddenInput = styled.input`
|
|
40
|
-
border: 0;
|
|
41
|
-
clip: rect(0 0 0 0);
|
|
42
|
-
height: 1px;
|
|
43
|
-
width: 1px;
|
|
44
|
-
margin: -1px;
|
|
45
|
-
overflow: hidden;
|
|
46
|
-
padding: 0;
|
|
47
|
-
position: absolute;
|
|
48
|
-
`;
|
|
49
|
-
|
|
50
|
-
const StyledCheckbox = createStyledComponent(
|
|
51
|
-
styled.label<{ $disabled?: boolean }>(({ theme, $disabled }) => {
|
|
52
|
-
return `
|
|
53
|
-
position: relative;
|
|
54
|
-
display: flex;
|
|
55
|
-
align-items: center;
|
|
56
|
-
cursor: ${$disabled ? 'not-allowed' : 'pointer'};
|
|
57
|
-
|
|
58
|
-
&:hover {
|
|
59
|
-
${HiddenInput}:not(:disabled) + ${CustomCheckbox} {
|
|
60
|
-
border-color: ${theme.colors.primary.main};
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
${HiddenInput}:checked + ${CustomCheckbox} {
|
|
65
|
-
background-color: ${theme.colors.primary.main};
|
|
66
|
-
border-color: ${theme.colors.primary.main};
|
|
67
|
-
}
|
|
68
|
-
${HiddenInput}:disabled + ${CustomCheckbox} {
|
|
69
|
-
background-color: ${theme.colors.disable};
|
|
70
|
-
}
|
|
71
|
-
`;
|
|
72
|
-
})
|
|
73
|
-
);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Checkbox';
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import ReactContentLoader, { IContentLoaderProps } from 'react-content-loader';
|
|
2
|
-
import { useTheme } from 'styled-components';
|
|
3
|
-
|
|
4
|
-
export interface ContentLoaderProps extends Omit<IContentLoaderProps, 'backgroundColor' | 'foregroundColor'> {
|
|
5
|
-
children?: any;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export const ContentLoader = (props: ContentLoaderProps) => {
|
|
9
|
-
const {
|
|
10
|
-
contentLoader: { foreground, background },
|
|
11
|
-
} = useTheme();
|
|
12
|
-
return <ReactContentLoader {...props} backgroundColor={background} foregroundColor={foreground} />;
|
|
13
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './ContentLoader';
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import { ButtonSize, getButtonSizeStyles } from '../../Theme';
|
|
2
|
-
import { useLayoutEffect, useRef, useState } from 'react';
|
|
3
|
-
import { Popover, PopoverAlign, PopoverPosition } from 'react-tiny-popover';
|
|
4
|
-
import { styled, useTheme } from 'styled-components';
|
|
5
|
-
import { ChevronDownIcon, ChevronUpIcon } from '../IconComponents';
|
|
6
|
-
|
|
7
|
-
interface ContextMenuProps {
|
|
8
|
-
isOpen: boolean;
|
|
9
|
-
onClick: () => void;
|
|
10
|
-
onClickOutside: (e: MouseEvent) => void;
|
|
11
|
-
size?: ButtonSize;
|
|
12
|
-
disabled?: boolean;
|
|
13
|
-
fullWidth?: boolean;
|
|
14
|
-
className?: string;
|
|
15
|
-
children?: any;
|
|
16
|
-
anchor?: any;
|
|
17
|
-
positions?: PopoverPosition[] | PopoverPosition;
|
|
18
|
-
align?: PopoverAlign;
|
|
19
|
-
hasBorder?: boolean;
|
|
20
|
-
maxHeight?: number;
|
|
21
|
-
matchAnchorWidth?: boolean;
|
|
22
|
-
anchorIcon?: any;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export const ContextMenu = ({
|
|
26
|
-
isOpen,
|
|
27
|
-
onClickOutside,
|
|
28
|
-
onClick,
|
|
29
|
-
anchor,
|
|
30
|
-
size = 'medium',
|
|
31
|
-
disabled,
|
|
32
|
-
fullWidth,
|
|
33
|
-
className,
|
|
34
|
-
positions = ['bottom'],
|
|
35
|
-
align = 'start',
|
|
36
|
-
children,
|
|
37
|
-
hasBorder = true,
|
|
38
|
-
maxHeight = 500,
|
|
39
|
-
matchAnchorWidth = false,
|
|
40
|
-
anchorIcon,
|
|
41
|
-
}: ContextMenuProps) => {
|
|
42
|
-
const [anchorWidth, setAnchorWidth] = useState<number>(0);
|
|
43
|
-
const buttonRef = useRef<HTMLButtonElement | null>(null);
|
|
44
|
-
|
|
45
|
-
const theme = useTheme();
|
|
46
|
-
useLayoutEffect(() => {
|
|
47
|
-
if (buttonRef.current) {
|
|
48
|
-
setAnchorWidth(buttonRef.current.offsetWidth);
|
|
49
|
-
}
|
|
50
|
-
}, [matchAnchorWidth]);
|
|
51
|
-
|
|
52
|
-
return (
|
|
53
|
-
<Popover
|
|
54
|
-
padding={theme.contextMenu.padding}
|
|
55
|
-
isOpen={isOpen}
|
|
56
|
-
positions={positions}
|
|
57
|
-
align={align}
|
|
58
|
-
onClickOutside={onClickOutside}
|
|
59
|
-
content={children}
|
|
60
|
-
ref={buttonRef}
|
|
61
|
-
containerStyle={{
|
|
62
|
-
backgroundColor: theme.colors.background,
|
|
63
|
-
border: `1px solid ${theme.colors.stroke.light}`,
|
|
64
|
-
boxShadow: '0px 0px 10px 0px rgba(0, 0, 0, 0.25)',
|
|
65
|
-
borderRadius: '5px',
|
|
66
|
-
overflow: 'auto',
|
|
67
|
-
maxHeight: `${maxHeight}px`,
|
|
68
|
-
zIndex: `${9999}`,
|
|
69
|
-
width: anchorWidth && matchAnchorWidth ? `${anchorWidth}px` : undefined,
|
|
70
|
-
}}
|
|
71
|
-
containerClassName="cb-ui-context-menu"
|
|
72
|
-
>
|
|
73
|
-
<StyledButton
|
|
74
|
-
onClick={onClick}
|
|
75
|
-
$disabled={disabled}
|
|
76
|
-
$fullWidth={fullWidth}
|
|
77
|
-
$size={size}
|
|
78
|
-
className={className}
|
|
79
|
-
type="button"
|
|
80
|
-
disabled={disabled}
|
|
81
|
-
$hasBorder={hasBorder}
|
|
82
|
-
>
|
|
83
|
-
<StyledAnchor>{anchor}</StyledAnchor>
|
|
84
|
-
{anchorIcon ||
|
|
85
|
-
(isOpen ? (
|
|
86
|
-
<ChevronUpIcon width={theme.contextMenu.icon.size} height={theme.contextMenu.icon.size} />
|
|
87
|
-
) : (
|
|
88
|
-
<ChevronDownIcon width={theme.contextMenu.icon.size} height={theme.contextMenu.icon.size} />
|
|
89
|
-
))}
|
|
90
|
-
</StyledButton>
|
|
91
|
-
</Popover>
|
|
92
|
-
);
|
|
93
|
-
};
|
|
94
|
-
const StyledAnchor = styled.div`
|
|
95
|
-
flex-grow: 1;
|
|
96
|
-
text-align: start;
|
|
97
|
-
`;
|
|
98
|
-
// Створюємо стилізований компонент, що використовує уніфіковану палітру
|
|
99
|
-
const StyledButton = styled.button<{
|
|
100
|
-
$size: ButtonSize;
|
|
101
|
-
$disabled?: boolean;
|
|
102
|
-
$fullWidth?: boolean;
|
|
103
|
-
$hasBorder: boolean;
|
|
104
|
-
}>`
|
|
105
|
-
${({ $size, $disabled, $fullWidth, theme, $hasBorder }) => {
|
|
106
|
-
const sizes = getButtonSizeStyles(theme, $size);
|
|
107
|
-
return `
|
|
108
|
-
background: ${theme.contextMenu.button.default.background};
|
|
109
|
-
color: ${theme.contextMenu.button.default.text};
|
|
110
|
-
border-color: ${$hasBorder ? theme.contextMenu.button.default.border : 'transparent'};
|
|
111
|
-
box-shadow: ${theme.contextMenu.button.default.boxShadow};
|
|
112
|
-
font-size: ${sizes.fontSize};
|
|
113
|
-
gap: ${sizes.gap};
|
|
114
|
-
padding-block: ${sizes.paddingBlock};
|
|
115
|
-
padding-inline: ${sizes.paddingInline};
|
|
116
|
-
border-radius: ${sizes.borderRadius};
|
|
117
|
-
border-width: ${sizes.borderWidth};
|
|
118
|
-
border-style: solid;
|
|
119
|
-
width: ${$fullWidth ? '100%' : 'auto'};
|
|
120
|
-
cursor: ${$disabled ? 'not-allowed' : 'pointer'};
|
|
121
|
-
font-weight: 500;
|
|
122
|
-
display: inline-flex;
|
|
123
|
-
align-items: center;
|
|
124
|
-
justify-content: ${$fullWidth ? 'space-between' : 'center'};
|
|
125
|
-
text-decoration: none;
|
|
126
|
-
transition: all 0.2s ease;
|
|
127
|
-
outline: none;
|
|
128
|
-
flex-direction: row;
|
|
129
|
-
|
|
130
|
-
&:hover {
|
|
131
|
-
background: ${theme.contextMenu.button.hover.background};
|
|
132
|
-
color: ${theme.contextMenu.button.hover.text};
|
|
133
|
-
border-color: ${$hasBorder ? theme.contextMenu.button.hover.border : 'transparent'};
|
|
134
|
-
box-shadow: ${theme.contextMenu.button.hover.boxShadow};
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
&:active {
|
|
138
|
-
background: ${theme.contextMenu.button.active.background};
|
|
139
|
-
color: ${theme.contextMenu.button.active.text};
|
|
140
|
-
border-color: ${$hasBorder ? theme.contextMenu.button.active.border : 'transparent'};
|
|
141
|
-
box-shadow: ${theme.contextMenu.button.active.boxShadow};
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
&:disabled {
|
|
145
|
-
background: ${theme.contextMenu.button.disabled.background};
|
|
146
|
-
color: ${theme.contextMenu.button.disabled.text};
|
|
147
|
-
border-color: ${$hasBorder ? theme.contextMenu.button.disabled.border : 'transparent'};
|
|
148
|
-
box-shadow: ${theme.contextMenu.button.disabled.boxShadow};
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
`;
|
|
152
|
-
}}
|
|
153
|
-
`;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { styled } from 'styled-components';
|
|
2
|
-
|
|
3
|
-
interface StyledProps {}
|
|
4
|
-
|
|
5
|
-
export const ContextMenuDelimiter = styled.div<StyledProps>(
|
|
6
|
-
({ theme }) => `
|
|
7
|
-
margin-inline: ${theme.contextMenu.delimeter.marginInline};
|
|
8
|
-
margin-block: ${theme.contextMenu.delimeter.marginBlock};
|
|
9
|
-
border-top-width: ${theme.contextMenu.delimeter.thickness};
|
|
10
|
-
border-top-style: ${theme.contextMenu.delimeter.style};
|
|
11
|
-
border-top-color: ${theme.contextMenu.delimeter.color};
|
|
12
|
-
`
|
|
13
|
-
);
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
|
|
3
|
-
export const useContextMenuControl = () => {
|
|
4
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
5
|
-
|
|
6
|
-
const toggleMenu = () => {
|
|
7
|
-
setIsOpen((prev) => !prev);
|
|
8
|
-
};
|
|
9
|
-
const closeMenu = () => {
|
|
10
|
-
setIsOpen(false);
|
|
11
|
-
};
|
|
12
|
-
const openMenu = () => {
|
|
13
|
-
setIsOpen(true);
|
|
14
|
-
};
|
|
15
|
-
return {
|
|
16
|
-
isOpen,
|
|
17
|
-
toggleMenu,
|
|
18
|
-
closeMenu,
|
|
19
|
-
openMenu,
|
|
20
|
-
};
|
|
21
|
-
};
|