@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,197 +0,0 @@
|
|
|
1
|
-
import { useCallback, useMemo, useState } from 'react';
|
|
2
|
-
import { PopoverAlign, PopoverPosition } from 'react-tiny-popover';
|
|
3
|
-
import { ContextMenu } from '../ContextMenu';
|
|
4
|
-
import { ButtonSize, getButtonSizeStyles } from '../../Theme';
|
|
5
|
-
import { styled } from 'styled-components';
|
|
6
|
-
|
|
7
|
-
type SelectBaseProps<T extends string | number> = {
|
|
8
|
-
selected?: T;
|
|
9
|
-
options: { value: T; inputDisplay?: string }[];
|
|
10
|
-
onSelect: (id: T) => void;
|
|
11
|
-
placeholder: string;
|
|
12
|
-
disabled?: boolean;
|
|
13
|
-
positions?: PopoverPosition[] | PopoverPosition;
|
|
14
|
-
align?: PopoverAlign;
|
|
15
|
-
size?: ButtonSize;
|
|
16
|
-
hasBorder?: boolean;
|
|
17
|
-
maxHeight?: number;
|
|
18
|
-
matchAnchorWidth?: boolean;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
type SelectDefaultProps = {
|
|
22
|
-
isSearchable?: false;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
type SelectSearchableProps = {
|
|
26
|
-
isSearchable: true;
|
|
27
|
-
noOptionsMessage: string;
|
|
28
|
-
inputPlaceholder: string;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
type SelectProps<T extends string | number> = SelectBaseProps<T> & (SelectSearchableProps | SelectDefaultProps);
|
|
32
|
-
|
|
33
|
-
export const Select = <T extends string | number>({
|
|
34
|
-
options,
|
|
35
|
-
selected,
|
|
36
|
-
onSelect,
|
|
37
|
-
placeholder,
|
|
38
|
-
disabled = false,
|
|
39
|
-
positions = ['bottom'],
|
|
40
|
-
align = 'start',
|
|
41
|
-
size = 'small',
|
|
42
|
-
hasBorder = true,
|
|
43
|
-
maxHeight,
|
|
44
|
-
matchAnchorWidth = true,
|
|
45
|
-
isSearchable = false,
|
|
46
|
-
...props
|
|
47
|
-
}: SelectProps<T>) => {
|
|
48
|
-
const [isOpen, setIsOpen] = useState<boolean>(false);
|
|
49
|
-
const [searchValue, setSearchValue] = useState<string>('');
|
|
50
|
-
|
|
51
|
-
const visibleOptions = useMemo(() => {
|
|
52
|
-
if (!isSearchable) return options;
|
|
53
|
-
|
|
54
|
-
const normalizedValue = searchValue?.trim().toLocaleLowerCase() || '';
|
|
55
|
-
return options.filter(({ value, inputDisplay }) =>
|
|
56
|
-
String(inputDisplay || value)
|
|
57
|
-
.toLocaleLowerCase()
|
|
58
|
-
.includes(normalizedValue)
|
|
59
|
-
);
|
|
60
|
-
}, [options, searchValue, isSearchable]);
|
|
61
|
-
|
|
62
|
-
const handleToggle = useCallback(() => {
|
|
63
|
-
if (!disabled) setIsOpen((prev) => !prev);
|
|
64
|
-
}, []);
|
|
65
|
-
|
|
66
|
-
const noOptionsMessage = 'noOptionsMessage' in props ? props.noOptionsMessage : '';
|
|
67
|
-
const inputPlaceholder = 'inputPlaceholder' in props ? props.inputPlaceholder : '';
|
|
68
|
-
|
|
69
|
-
return (
|
|
70
|
-
<ContextMenu
|
|
71
|
-
isOpen={isOpen}
|
|
72
|
-
onClickOutside={() => setIsOpen(false)}
|
|
73
|
-
onClick={handleToggle}
|
|
74
|
-
disabled={disabled}
|
|
75
|
-
anchor={
|
|
76
|
-
isSearchable && isOpen ? (
|
|
77
|
-
<StyledSearchInput
|
|
78
|
-
type="text"
|
|
79
|
-
value={searchValue}
|
|
80
|
-
onChange={(e) => setSearchValue(e.target.value)}
|
|
81
|
-
placeholder={inputPlaceholder}
|
|
82
|
-
autoFocus
|
|
83
|
-
onClick={(e) => e.stopPropagation()}
|
|
84
|
-
$size={size}
|
|
85
|
-
/>
|
|
86
|
-
) : !selected ? (
|
|
87
|
-
placeholder
|
|
88
|
-
) : (
|
|
89
|
-
options.find((option) => option.value === selected)?.inputDisplay || selected
|
|
90
|
-
)
|
|
91
|
-
}
|
|
92
|
-
fullWidth
|
|
93
|
-
positions={positions}
|
|
94
|
-
align={align}
|
|
95
|
-
size={size}
|
|
96
|
-
hasBorder={hasBorder}
|
|
97
|
-
maxHeight={maxHeight}
|
|
98
|
-
matchAnchorWidth={matchAnchorWidth}
|
|
99
|
-
>
|
|
100
|
-
<StyledWrapper>
|
|
101
|
-
{visibleOptions.map((item) => (
|
|
102
|
-
<StyledItem
|
|
103
|
-
onClick={() => {
|
|
104
|
-
onSelect(item.value);
|
|
105
|
-
if (isSearchable) setSearchValue('');
|
|
106
|
-
setIsOpen(false);
|
|
107
|
-
}}
|
|
108
|
-
type="button"
|
|
109
|
-
$selected={item.value === selected}
|
|
110
|
-
key={item.value}
|
|
111
|
-
disabled={disabled}
|
|
112
|
-
$size={size}
|
|
113
|
-
>
|
|
114
|
-
{item.inputDisplay || item.value}
|
|
115
|
-
</StyledItem>
|
|
116
|
-
))}
|
|
117
|
-
{!visibleOptions.length && <NoMatchMessage $size={size}>{noOptionsMessage}</NoMatchMessage>}
|
|
118
|
-
</StyledWrapper>
|
|
119
|
-
</ContextMenu>
|
|
120
|
-
);
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
const StyledSearchInput = styled.input<{ $size: ButtonSize }>(
|
|
124
|
-
({ theme, $size }) => `
|
|
125
|
-
outline: none;
|
|
126
|
-
border: none;
|
|
127
|
-
padding: 0;
|
|
128
|
-
background: transparent;
|
|
129
|
-
width: 100%;
|
|
130
|
-
font-size: ${theme.button.sizes[$size].fontSize};
|
|
131
|
-
color: ${theme.colors.text.main};
|
|
132
|
-
`
|
|
133
|
-
);
|
|
134
|
-
|
|
135
|
-
const NoMatchMessage = styled.p<{ $size: ButtonSize }>(
|
|
136
|
-
({ theme, $size }) => `
|
|
137
|
-
padding-block: ${theme.select.padding};
|
|
138
|
-
padding-inline: ${theme.button.sizes[$size].paddingInline};
|
|
139
|
-
font-size: ${theme.button.sizes[$size].fontSize};
|
|
140
|
-
color: ${theme.colors.text.main};
|
|
141
|
-
white-space: pre-line;
|
|
142
|
-
word-break: break-word;
|
|
143
|
-
`
|
|
144
|
-
);
|
|
145
|
-
const StyledItem = styled.button<{ $size: ButtonSize; $selected: boolean }>`
|
|
146
|
-
${({ theme, $size, $selected }) => {
|
|
147
|
-
const sizes = getButtonSizeStyles(theme, $size);
|
|
148
|
-
return `
|
|
149
|
-
background: ${theme.select.item.default.background};
|
|
150
|
-
color: ${theme.select.item.default.text};
|
|
151
|
-
font-size: ${sizes.fontSize};
|
|
152
|
-
gap: ${sizes.gap};
|
|
153
|
-
padding-block: ${theme.select.padding};
|
|
154
|
-
padding-inline: ${sizes.paddingInline};
|
|
155
|
-
border-radius: ${sizes.borderRadius};
|
|
156
|
-
border-width: ${sizes.borderWidth};
|
|
157
|
-
border: none;
|
|
158
|
-
width: 100%;
|
|
159
|
-
cursor: pointer;
|
|
160
|
-
font-weight: 400;
|
|
161
|
-
display: inline-flex;
|
|
162
|
-
align-items: center;
|
|
163
|
-
justify-content: flex-start;
|
|
164
|
-
text-decoration: none;
|
|
165
|
-
transition: all 0.2s ease;
|
|
166
|
-
outline: none;
|
|
167
|
-
flex-direction: row;
|
|
168
|
-
|
|
169
|
-
&:hover {
|
|
170
|
-
background-color: ${theme.select.item.hover.background};
|
|
171
|
-
color: ${theme.select.item.hover.text};
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
${
|
|
175
|
-
$selected &&
|
|
176
|
-
`background: ${theme.select.item.active.background};
|
|
177
|
-
color: ${theme.select.item.active.text};`
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
&:disabled {
|
|
181
|
-
background: ${theme.select.item.disabled.background};
|
|
182
|
-
color: ${theme.select.item.disabled.text};
|
|
183
|
-
cursor: not-allowed;
|
|
184
|
-
}
|
|
185
|
-
`;
|
|
186
|
-
}}
|
|
187
|
-
`;
|
|
188
|
-
|
|
189
|
-
const StyledWrapper = styled.div(
|
|
190
|
-
({ theme }) => `
|
|
191
|
-
padding-block: ${theme.select.paddingBlock};
|
|
192
|
-
padding-inline: ${theme.select.paddingInline};
|
|
193
|
-
${StyledItem}:not(:last-of-type) {
|
|
194
|
-
margin-bottom: ${theme.select.margin};
|
|
195
|
-
}
|
|
196
|
-
`
|
|
197
|
-
);
|
package/src/Core/Select/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Select';
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { styled } from 'styled-components';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { SidebarContext } from './SidebarContext';
|
|
4
|
-
import { createComponent } from '../../Theme';
|
|
5
|
-
|
|
6
|
-
export interface SidebarProps {
|
|
7
|
-
defaultCollapsed?: boolean;
|
|
8
|
-
children: any;
|
|
9
|
-
canGrow: boolean;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
interface StyledProps {
|
|
13
|
-
$collapsed: boolean;
|
|
14
|
-
$canGrow: boolean;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export const Sidebar = createComponent<SidebarProps>(({ defaultCollapsed, canGrow, children }) => {
|
|
18
|
-
const [collapsed, setCollapsed] = React.useState(!!defaultCollapsed);
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<StyledContainer $collapsed={collapsed} $canGrow={canGrow}>
|
|
22
|
-
<SidebarContext.Provider
|
|
23
|
-
value={{
|
|
24
|
-
collapsed,
|
|
25
|
-
setCollapsed,
|
|
26
|
-
canGrow,
|
|
27
|
-
}}
|
|
28
|
-
>
|
|
29
|
-
{children}
|
|
30
|
-
</SidebarContext.Provider>
|
|
31
|
-
</StyledContainer>
|
|
32
|
-
);
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
const StyledContainer = styled.aside<StyledProps>(
|
|
36
|
-
({ theme, $collapsed, $canGrow }) => `
|
|
37
|
-
display: flex;
|
|
38
|
-
flex-direction: column;
|
|
39
|
-
justify-content: space-between;
|
|
40
|
-
gap: 20px;
|
|
41
|
-
position: sticky;
|
|
42
|
-
z-index: 1000;
|
|
43
|
-
top: 0;
|
|
44
|
-
width: ${theme.sidebar.width};
|
|
45
|
-
padding: 12px;
|
|
46
|
-
height: 100%;
|
|
47
|
-
overflow: hidden auto;
|
|
48
|
-
border-right: 1px solid ${theme.sidebar.border};
|
|
49
|
-
background: ${theme.sidebar.background};
|
|
50
|
-
${
|
|
51
|
-
$collapsed || !$canGrow
|
|
52
|
-
? `
|
|
53
|
-
width: 65px;
|
|
54
|
-
`
|
|
55
|
-
: ''
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
&:before {
|
|
59
|
-
content: '';
|
|
60
|
-
display: block;
|
|
61
|
-
position: absolute;
|
|
62
|
-
top: 0;
|
|
63
|
-
left: 0;
|
|
64
|
-
width: 100%;
|
|
65
|
-
height: 25dvh;
|
|
66
|
-
transform: translateY(-100%);
|
|
67
|
-
background: ${theme.sidebar.background};
|
|
68
|
-
border-right: 1px solid ${theme.sidebar.border};
|
|
69
|
-
|
|
70
|
-
width: ${theme.sidebar.width};
|
|
71
|
-
${
|
|
72
|
-
$collapsed || !$canGrow
|
|
73
|
-
? `
|
|
74
|
-
width: 65px;
|
|
75
|
-
`
|
|
76
|
-
: ''
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
`
|
|
80
|
-
);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { createContext } from 'react';
|
|
2
|
-
|
|
3
|
-
interface SidebarContext {
|
|
4
|
-
collapsed: boolean;
|
|
5
|
-
setCollapsed: React.Dispatch<React.SetStateAction<boolean>>;
|
|
6
|
-
canGrow: boolean;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const SidebarContext = createContext<SidebarContext>({
|
|
10
|
-
collapsed: false,
|
|
11
|
-
setCollapsed: () => {},
|
|
12
|
-
canGrow: false,
|
|
13
|
-
});
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { useContext } from 'react';
|
|
2
|
-
import { SidebarContext } from './SidebarContext';
|
|
3
|
-
import { styled } from 'styled-components';
|
|
4
|
-
|
|
5
|
-
type StyledProps = {
|
|
6
|
-
$collapsed: boolean;
|
|
7
|
-
$canGrow: boolean;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export const SidebarDelimeter = () => {
|
|
11
|
-
const { collapsed, canGrow } = useContext(SidebarContext);
|
|
12
|
-
return <StyledDelimeter $collapsed={collapsed} $canGrow={canGrow} />;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const StyledDelimeter = styled.div<StyledProps>(
|
|
16
|
-
({ $collapsed, $canGrow, theme }) => `
|
|
17
|
-
min-width: 32px;
|
|
18
|
-
width: 0;
|
|
19
|
-
|
|
20
|
-
border-bottom: 1px dashed ${theme.sidebar.delimeter.color};
|
|
21
|
-
margin-block: 8px;
|
|
22
|
-
margin-left: 4px;
|
|
23
|
-
|
|
24
|
-
${
|
|
25
|
-
!$collapsed &&
|
|
26
|
-
$canGrow &&
|
|
27
|
-
`
|
|
28
|
-
& {
|
|
29
|
-
width: 100%;
|
|
30
|
-
margin-left: 0;
|
|
31
|
-
}
|
|
32
|
-
`
|
|
33
|
-
}
|
|
34
|
-
`
|
|
35
|
-
);
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { SVGProps, useContext } from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
import { SidebarContext } from './SidebarContext';
|
|
4
|
-
|
|
5
|
-
interface SidebarItemBase {
|
|
6
|
-
active?: boolean;
|
|
7
|
-
icon?: React.ComponentType<SVGProps<SVGSVGElement>>;
|
|
8
|
-
label?: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
interface SidebarItemAnchor {
|
|
12
|
-
href: string;
|
|
13
|
-
onClick?: (e: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void;
|
|
14
|
-
target?: '_blank' | '_self' | '_parent' | '_top';
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
type StyledProps = {
|
|
18
|
-
$active: SidebarItemBase['active'];
|
|
19
|
-
$collapsed: boolean;
|
|
20
|
-
$canGrow: boolean;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
interface SidebarItemButton {
|
|
24
|
-
type?: 'button' | 'reset' | 'submit';
|
|
25
|
-
onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export type SidebarItemProps = SidebarItemBase & (SidebarItemAnchor | SidebarItemButton);
|
|
29
|
-
|
|
30
|
-
export const SidebarItem = ({ active, icon: Icon, label, ...props }: SidebarItemProps) => {
|
|
31
|
-
const { collapsed, canGrow } = useContext(SidebarContext);
|
|
32
|
-
|
|
33
|
-
const isAnchor = 'href' in props;
|
|
34
|
-
|
|
35
|
-
return (
|
|
36
|
-
<StyledItem
|
|
37
|
-
title={collapsed ? label : ''}
|
|
38
|
-
as={isAnchor ? 'a' : 'button'}
|
|
39
|
-
$collapsed={collapsed}
|
|
40
|
-
$active={active}
|
|
41
|
-
$canGrow={canGrow}
|
|
42
|
-
{...props}
|
|
43
|
-
>
|
|
44
|
-
{Icon && <Icon aria-label={label} width={16} height={16} />}
|
|
45
|
-
<StyledText $collapsed={collapsed} $active={active} $canGrow={canGrow}>
|
|
46
|
-
{label}
|
|
47
|
-
</StyledText>
|
|
48
|
-
</StyledItem>
|
|
49
|
-
);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const StyledText = styled.span<StyledProps>(
|
|
53
|
-
({ $collapsed, $canGrow }) => `
|
|
54
|
-
margin-top: 2px;
|
|
55
|
-
overflow: hidden;
|
|
56
|
-
white-space: nowrap;
|
|
57
|
-
text-overflow: ellipsis;
|
|
58
|
-
width: 100%;
|
|
59
|
-
text-align: left;
|
|
60
|
-
display: inline-block;
|
|
61
|
-
font-weight: 500;
|
|
62
|
-
font-size: 14px;
|
|
63
|
-
line-height: 1.49;
|
|
64
|
-
font-family: Inter;
|
|
65
|
-
|
|
66
|
-
${
|
|
67
|
-
$collapsed || !$canGrow
|
|
68
|
-
? `
|
|
69
|
-
& {
|
|
70
|
-
width: 0;
|
|
71
|
-
}
|
|
72
|
-
`
|
|
73
|
-
: ''
|
|
74
|
-
}
|
|
75
|
-
`
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
const StyledItem = styled.a<StyledProps>(
|
|
79
|
-
({ $active, $collapsed, $canGrow, theme }) => `
|
|
80
|
-
display: flex;
|
|
81
|
-
align-items: center;
|
|
82
|
-
gap: 12px;
|
|
83
|
-
padding-inline: 12px;
|
|
84
|
-
height: 40px;
|
|
85
|
-
min-width: 40px;
|
|
86
|
-
border: none;
|
|
87
|
-
cursor: pointer;
|
|
88
|
-
text-decoration: none;
|
|
89
|
-
border-radius: 8px;
|
|
90
|
-
color: ${theme.sidebar.text.default};
|
|
91
|
-
background: ${theme.sidebar.item.default.background};
|
|
92
|
-
transition: background 0.3s ease-in-out, color 0.3s ease-in-out;
|
|
93
|
-
position: relative;
|
|
94
|
-
${
|
|
95
|
-
$active
|
|
96
|
-
? `
|
|
97
|
-
background: ${theme.sidebar.item.active.background};
|
|
98
|
-
color: ${theme.sidebar.text.active};
|
|
99
|
-
`
|
|
100
|
-
: ''
|
|
101
|
-
}
|
|
102
|
-
${$collapsed || !$canGrow ? `gap: 0;` : ''}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
&:hover {
|
|
107
|
-
background: ${theme.sidebar.item.hover.background};
|
|
108
|
-
color: ${theme.sidebar.text.hover};
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
&:before {
|
|
112
|
-
content: '';
|
|
113
|
-
position: absolute;
|
|
114
|
-
left: -12px;
|
|
115
|
-
top: 0;
|
|
116
|
-
height: 100%;
|
|
117
|
-
width: 0px;
|
|
118
|
-
border-top-right-radius: 5px;
|
|
119
|
-
border-bottom-right-radius: 5px;
|
|
120
|
-
background: rgba(0, 0, 0, 0);
|
|
121
|
-
transition: background 0.4s ease-in-out, width 0.3s ease-in-out;
|
|
122
|
-
${
|
|
123
|
-
$active
|
|
124
|
-
? `
|
|
125
|
-
background: ${theme.sidebar.text.active};
|
|
126
|
-
width: 5px;
|
|
127
|
-
`
|
|
128
|
-
: ''
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
svg {
|
|
133
|
-
flex-shrink: 0;
|
|
134
|
-
fill: currentColor;
|
|
135
|
-
}
|
|
136
|
-
`
|
|
137
|
-
);
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { CSSProperties, styled } from 'styled-components';
|
|
2
|
-
|
|
3
|
-
export interface SidebarSectionProps {
|
|
4
|
-
grow?: number;
|
|
5
|
-
shrink?: number;
|
|
6
|
-
basis?: CSSProperties['flexBasis'];
|
|
7
|
-
items: React.ReactElement[];
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const SidebarSection = ({ grow, shrink, basis, items }: SidebarSectionProps) => {
|
|
11
|
-
return (
|
|
12
|
-
<StyledSection $grow={grow} $shrink={shrink} $basis={basis}>
|
|
13
|
-
{items}
|
|
14
|
-
</StyledSection>
|
|
15
|
-
);
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
interface StyledProps {
|
|
19
|
-
$grow?: number;
|
|
20
|
-
$shrink?: number;
|
|
21
|
-
$basis?: CSSProperties['flexBasis'];
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const StyledSection = styled.div<StyledProps>(
|
|
25
|
-
({ $grow = 0, $shrink = 1, $basis = '100%' }) => `
|
|
26
|
-
flex: ${$grow} ${$shrink} ${$basis};
|
|
27
|
-
display: flex;
|
|
28
|
-
flex-direction: column;
|
|
29
|
-
gap: 1px;
|
|
30
|
-
`
|
|
31
|
-
);
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { InputHTMLAttributes } from 'react';
|
|
2
|
-
import { createComponent, createStyledComponent, destructSpaceProps, FabricComponent, pxToRem } from '../../Theme';
|
|
3
|
-
import { styled } from 'styled-components';
|
|
4
|
-
|
|
5
|
-
type SwitchProps = FabricComponent<Omit<InputHTMLAttributes<HTMLInputElement>, 'type'>>;
|
|
6
|
-
|
|
7
|
-
export const Switch = createComponent<SwitchProps>(({ className, ...props }) => {
|
|
8
|
-
const spaceProps = destructSpaceProps(props);
|
|
9
|
-
return (
|
|
10
|
-
<StyledLabel className={className} {...spaceProps}>
|
|
11
|
-
<HiddenInput type="checkbox" {...props} />
|
|
12
|
-
<StyledSwitch />
|
|
13
|
-
</StyledLabel>
|
|
14
|
-
);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
const StyledSwitch = styled.span(
|
|
18
|
-
({ theme }) => `
|
|
19
|
-
position: relative;
|
|
20
|
-
cursor: pointer;
|
|
21
|
-
display: inline-block;
|
|
22
|
-
width: ${pxToRem(41, theme.baseSize)};
|
|
23
|
-
height: ${pxToRem(21, theme.baseSize)};
|
|
24
|
-
border-radius: ${pxToRem(15, theme.baseSize)};
|
|
25
|
-
background-color: ${theme.switch.default.background};
|
|
26
|
-
&::before {
|
|
27
|
-
position: absolute;
|
|
28
|
-
display: block;
|
|
29
|
-
top: 50%;
|
|
30
|
-
transform: translateY(-50%);
|
|
31
|
-
height: ${pxToRem(15, theme.baseSize)};
|
|
32
|
-
width: ${pxToRem(15, theme.baseSize)};
|
|
33
|
-
border-radius: 50%;
|
|
34
|
-
background-color: ${theme.switch.default.color};
|
|
35
|
-
content: '';
|
|
36
|
-
}
|
|
37
|
-
`
|
|
38
|
-
);
|
|
39
|
-
const HiddenInput = styled.input(
|
|
40
|
-
({ theme }) => `
|
|
41
|
-
appearance: none;
|
|
42
|
-
border: none;
|
|
43
|
-
outline: none;
|
|
44
|
-
position: absolute;
|
|
45
|
-
height: 1px;
|
|
46
|
-
width: 1px;
|
|
47
|
-
margin: -1px;
|
|
48
|
-
top: 0;
|
|
49
|
-
left: 0;
|
|
50
|
-
&:not(:checked) + ${StyledSwitch}::before {
|
|
51
|
-
left: ${pxToRem(3, theme.baseSize)};
|
|
52
|
-
}
|
|
53
|
-
&:checked + ${StyledSwitch} {
|
|
54
|
-
background-color: ${theme.switch.checked.background};
|
|
55
|
-
&::before {
|
|
56
|
-
right: ${pxToRem(3, theme.baseSize)};
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
&:disabled + ${StyledSwitch} {
|
|
60
|
-
background-color: ${theme.switch.disabled.background};
|
|
61
|
-
cursor: not-allowed;
|
|
62
|
-
}
|
|
63
|
-
`
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
const StyledLabel = createStyledComponent(
|
|
67
|
-
styled.label`
|
|
68
|
-
position: relative;
|
|
69
|
-
display: inline-block;
|
|
70
|
-
`
|
|
71
|
-
);
|
package/src/Core/Switch/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Switch';
|
package/src/Core/Table/Cell.tsx
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { styled } from 'styled-components';
|
|
2
|
-
|
|
3
|
-
export const HeadCell = styled.th(
|
|
4
|
-
({ theme }) => `
|
|
5
|
-
padding-top: 15px;
|
|
6
|
-
padding-bottom: 10px;
|
|
7
|
-
padding-right: 15px;
|
|
8
|
-
:not(:first-of-type) {
|
|
9
|
-
padding-left: 15px;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
border-bottom: 1px solid ${theme.colors.stroke.light};
|
|
13
|
-
|
|
14
|
-
font-family: ${theme.typography.fontFamily};
|
|
15
|
-
font-weight: 500;
|
|
16
|
-
font-size: 14px;
|
|
17
|
-
text-wrap: nowrap;
|
|
18
|
-
text-align: left;
|
|
19
|
-
line-height: 1.5;
|
|
20
|
-
color: ${theme.colors.text.main};
|
|
21
|
-
`
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
export const Cell = styled.td(
|
|
25
|
-
({ theme }) => `
|
|
26
|
-
padding-block: 15px;
|
|
27
|
-
padding-right: 15px;
|
|
28
|
-
:not(:first-of-type) {
|
|
29
|
-
padding-left: 15px;
|
|
30
|
-
}
|
|
31
|
-
border-bottom: 1px solid ${theme.colors.stroke.light};
|
|
32
|
-
|
|
33
|
-
vertical-align: middle;
|
|
34
|
-
font-family: ${theme.typography.fontFamily};
|
|
35
|
-
font-weight: 500;
|
|
36
|
-
font-size: 14px;
|
|
37
|
-
text-wrap: nowrap;
|
|
38
|
-
text-align: left;
|
|
39
|
-
line-height: 1.5;
|
|
40
|
-
color: ${theme.colors.text.main};
|
|
41
|
-
`
|
|
42
|
-
);
|
package/src/Core/Table/Row.tsx
DELETED