@cyber-harbour/ui 1.0.28 → 1.0.30
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 +0 -6
- package/dist/index.d.mts +99 -11
- package/dist/index.d.ts +99 -11
- package/dist/index.js +169 -87
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +169 -87
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/Core/Box/Box.tsx +7 -2
- package/src/Core/Button/Button.tsx +73 -9
- package/src/Core/Flex/FlexContainer.tsx +2 -0
- package/src/Core/Flex/FlexItem.tsx +1 -0
- package/src/Core/IconComponents/MaximizeIcon.tsx +28 -0
- package/src/Core/IconComponents/SearchIcon.tsx +14 -0
- package/src/Core/IconComponents/index.ts +2 -0
- package/src/Core/Line/Line.tsx +24 -0
- package/src/Core/Line/index.ts +1 -0
- package/src/Core/Typography/Typography.tsx +7 -5
- package/src/Core/Typography/index.ts +1 -2
- package/src/Core/index.ts +1 -0
- package/src/FullscreenCard/FullscreenCard.tsx +30 -0
- package/src/FullscreenCard/index.ts +1 -0
- package/src/Layouts/Container/Container.tsx +18 -0
- package/src/Layouts/Container/index.ts +1 -0
- package/src/Layouts/index.ts +1 -0
- package/src/Theme/ThemeProvider.tsx +14 -5
- package/src/Theme/componentFabric.ts +70 -0
- package/src/Theme/index.ts +1 -0
- package/src/Theme/theme.ts +21 -1
- package/src/Theme/types.ts +9 -1
- package/src/index.ts +1 -0
- package/tsconfig.paths.json +1 -7
- package/tsup.config.ts +0 -7
package/package.json
CHANGED
package/src/Core/Box/Box.tsx
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
import { createComponent, FabricComponent } from '../../Theme';
|
|
1
2
|
import { styled } from 'styled-components';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
type BoxProps = FabricComponent<{
|
|
5
|
+
children: any;
|
|
6
|
+
}>;
|
|
7
|
+
|
|
8
|
+
export const Box = styled(createComponent<BoxProps>('div'))(
|
|
4
9
|
({ theme }) => `
|
|
5
10
|
padding: ${theme.box.padding};
|
|
6
|
-
border-radius: ${theme.box.
|
|
11
|
+
border-radius: ${theme.box.borderRadius};
|
|
7
12
|
background-color: ${theme.box.background};
|
|
8
13
|
border-width: ${theme.box.border.width};
|
|
9
14
|
border-style: ${theme.box.border.style};
|
|
@@ -7,9 +7,11 @@ import {
|
|
|
7
7
|
getButtonStyles,
|
|
8
8
|
getButtonSizeStyles,
|
|
9
9
|
ButtonElementStyle,
|
|
10
|
+
createComponent,
|
|
11
|
+
FabricComponent,
|
|
10
12
|
} from '../../Theme';
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
type BaseButtonProps = FabricComponent<{
|
|
13
15
|
children?: any;
|
|
14
16
|
variant?: ButtonVariant;
|
|
15
17
|
color?: ButtonColor;
|
|
@@ -19,7 +21,8 @@ interface BaseButtonProps {
|
|
|
19
21
|
className?: string;
|
|
20
22
|
icon?: any;
|
|
21
23
|
iconPosition?: 'left' | 'right';
|
|
22
|
-
|
|
24
|
+
iconVariant?: 'filled' | 'empty';
|
|
25
|
+
}>;
|
|
23
26
|
|
|
24
27
|
export type ButtonProps = (
|
|
25
28
|
| Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'children'>
|
|
@@ -34,26 +37,54 @@ const getCss = (styles: ButtonElementStyle) => `
|
|
|
34
37
|
box-shadow: ${styles.boxShadow};
|
|
35
38
|
`;
|
|
36
39
|
|
|
40
|
+
const getIconStyles = (styles: ButtonElementStyle) =>
|
|
41
|
+
styles.filledIcon
|
|
42
|
+
? `
|
|
43
|
+
color: ${styles.filledIcon.color};
|
|
44
|
+
background: ${styles.filledIcon.background};
|
|
45
|
+
`
|
|
46
|
+
: '';
|
|
47
|
+
|
|
37
48
|
// Створюємо стилізований компонент, що використовує уніфіковану палітру
|
|
38
|
-
const
|
|
49
|
+
const ButtonTextContainer = styled.div`
|
|
50
|
+
text-overflow: ellipsis;
|
|
51
|
+
overflow: hidden;
|
|
52
|
+
white-space: nowrap;
|
|
53
|
+
`;
|
|
54
|
+
|
|
55
|
+
const StyledIconWrapper = styled.span`
|
|
56
|
+
display: inline-flex;
|
|
57
|
+
align-items: center;
|
|
58
|
+
justify-content: center;
|
|
59
|
+
`;
|
|
60
|
+
|
|
61
|
+
const StyledButton = styled(createComponent('button'))<{
|
|
39
62
|
$variant: ButtonVariant;
|
|
40
63
|
$color: ButtonColor;
|
|
41
64
|
$size: ButtonSize;
|
|
42
65
|
$disabled: boolean;
|
|
43
66
|
$fullWidth: boolean;
|
|
44
67
|
$iconPosition: 'left' | 'right';
|
|
68
|
+
$iconVariant: 'filled' | 'empty';
|
|
45
69
|
}>`
|
|
46
|
-
${({ $variant, $color, $size, $disabled, $fullWidth, $iconPosition, theme }) => {
|
|
70
|
+
${({ $variant, $color, $size, $disabled, $fullWidth, $iconPosition, $iconVariant, theme, ...props }) => {
|
|
47
71
|
const sizes = getButtonSizeStyles(theme, $size);
|
|
48
72
|
return `
|
|
49
73
|
${getCss(getButtonStyles(theme, $variant, $color, 'default'))}
|
|
50
74
|
font-size: ${sizes.fontSize};
|
|
51
75
|
gap: ${sizes.gap};
|
|
52
|
-
|
|
53
|
-
|
|
76
|
+
${
|
|
77
|
+
$variant !== 'empty'
|
|
78
|
+
? `
|
|
79
|
+
${!props.py ? `padding-block: ${sizes.paddingBlock};` : ''}
|
|
80
|
+
${!props.px ? `padding-inline: ${sizes.paddingInline};` : ''}
|
|
81
|
+
`
|
|
82
|
+
: ''
|
|
83
|
+
}
|
|
54
84
|
border-radius: ${sizes.borderRadius};
|
|
55
85
|
border-width: ${sizes.borderWidth};
|
|
56
86
|
border-style: solid;
|
|
87
|
+
max-width: 100%;
|
|
57
88
|
width: ${$fullWidth ? '100%' : 'auto'};
|
|
58
89
|
cursor: ${$disabled ? 'not-allowed' : 'pointer'};
|
|
59
90
|
font-weight: 500;
|
|
@@ -78,10 +109,41 @@ const StyledButton = styled.button<{
|
|
|
78
109
|
${getCss(getButtonStyles(theme, $variant, $color, 'disabled'))}
|
|
79
110
|
}
|
|
80
111
|
|
|
81
|
-
svg {
|
|
112
|
+
${StyledIconWrapper} svg {
|
|
82
113
|
width: ${sizes.iconSize};
|
|
83
114
|
height: ${sizes.iconSize};
|
|
84
115
|
}
|
|
116
|
+
|
|
117
|
+
${
|
|
118
|
+
$iconVariant === 'filled'
|
|
119
|
+
? `
|
|
120
|
+
${StyledIconWrapper} {
|
|
121
|
+
width: 24px;
|
|
122
|
+
height: 24px;
|
|
123
|
+
border-radius: ${sizes.borderRadius};
|
|
124
|
+
transition: all 0.2s ease;
|
|
125
|
+
${getIconStyles(getButtonStyles(theme, $variant, $color, 'default'))}
|
|
126
|
+
}
|
|
127
|
+
&:hover {
|
|
128
|
+
${StyledIconWrapper} {
|
|
129
|
+
${getIconStyles(getButtonStyles(theme, $variant, $color, 'hover'))}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
&:active {
|
|
134
|
+
${StyledIconWrapper} {
|
|
135
|
+
${getIconStyles(getButtonStyles(theme, $variant, $color, 'active'))}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
&:disabled {
|
|
140
|
+
${StyledIconWrapper} {
|
|
141
|
+
${getIconStyles(getButtonStyles(theme, $variant, $color, 'disabled'))}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
`
|
|
145
|
+
: ``
|
|
146
|
+
}
|
|
85
147
|
`;
|
|
86
148
|
}}
|
|
87
149
|
`;
|
|
@@ -96,6 +158,7 @@ export const Button = ({
|
|
|
96
158
|
className,
|
|
97
159
|
icon,
|
|
98
160
|
iconPosition = 'left',
|
|
161
|
+
iconVariant = 'empty',
|
|
99
162
|
...props
|
|
100
163
|
}: ButtonProps) => {
|
|
101
164
|
return (
|
|
@@ -107,12 +170,13 @@ export const Button = ({
|
|
|
107
170
|
$disabled={disabled}
|
|
108
171
|
$fullWidth={fullWidth}
|
|
109
172
|
$iconPosition={iconPosition}
|
|
173
|
+
$iconVariant={iconVariant}
|
|
110
174
|
disabled={disabled}
|
|
111
175
|
className={className}
|
|
112
176
|
{...props}
|
|
113
177
|
>
|
|
114
|
-
{icon}
|
|
115
|
-
<
|
|
178
|
+
{!!icon && <StyledIconWrapper>{icon}</StyledIconWrapper>}
|
|
179
|
+
{!!children && <ButtonTextContainer>{children}</ButtonTextContainer>}
|
|
116
180
|
</StyledButton>
|
|
117
181
|
);
|
|
118
182
|
};
|
|
@@ -69,6 +69,8 @@ interface StyledFlexContainerProps {
|
|
|
69
69
|
const StyledFlexContainer = styled.div<StyledFlexContainerProps>`
|
|
70
70
|
${({ $direction, $wrap, $justify, $align, $alignContent, $gap, $rowGap, $columnGap }) => `
|
|
71
71
|
display: flex;
|
|
72
|
+
width: 100%;
|
|
73
|
+
min-width: 0;
|
|
72
74
|
flex-direction: ${$direction};
|
|
73
75
|
flex-wrap: ${$wrap};
|
|
74
76
|
justify-content: ${$justify};
|
|
@@ -55,6 +55,7 @@ interface StyledFlexItemProps {
|
|
|
55
55
|
|
|
56
56
|
const StyledFlexItem = styled.div<StyledFlexItemProps>`
|
|
57
57
|
${({ $grow, $shrink, $basis, $align, $order }) => `
|
|
58
|
+
min-width: 0;
|
|
58
59
|
${$grow !== undefined ? `flex-grow: ${$grow};` : ''}
|
|
59
60
|
${$shrink !== undefined ? `flex-shrink: ${$shrink};` : ''}
|
|
60
61
|
${$basis !== undefined ? `flex-basis: ${typeof $basis === 'number' ? `${$basis}px` : $basis};` : ''}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SVGProps } from 'react';
|
|
2
|
+
|
|
3
|
+
interface MaximizeIconProps extends SVGProps<SVGSVGElement> {
|
|
4
|
+
fill?: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const MaximizeIcon = ({ fill = 'currentColor', ...props }: MaximizeIconProps) => {
|
|
8
|
+
return (
|
|
9
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
|
|
10
|
+
<path
|
|
11
|
+
d="M14 6.5C13.7267 6.5 13.5 6.27333 13.5 6V2.5H10C9.72667 2.5 9.5 2.27333 9.5 2C9.5 1.72667 9.72667 1.5 10 1.5H14C14.2733 1.5 14.5 1.72667 14.5 2V6C14.5 6.27333 14.2733 6.5 14 6.5Z"
|
|
12
|
+
fill={fill}
|
|
13
|
+
/>
|
|
14
|
+
<path
|
|
15
|
+
d="M6 14.5H2C1.72667 14.5 1.5 14.2733 1.5 14V10C1.5 9.72667 1.72667 9.5 2 9.5C2.27333 9.5 2.5 9.72667 2.5 10V13.5H6C6.27333 13.5 6.5 13.7267 6.5 14C6.5 14.2733 6.27333 14.5 6 14.5Z"
|
|
16
|
+
fill={fill}
|
|
17
|
+
/>
|
|
18
|
+
<path
|
|
19
|
+
d="M8.9998 7.50224C8.87313 7.50224 8.74646 7.45557 8.64646 7.35557C8.45313 7.16224 8.45313 6.84224 8.64646 6.64891L13.6465 1.64891C13.8398 1.45557 14.1598 1.45557 14.3531 1.64891C14.5465 1.84224 14.5465 2.16224 14.3531 2.35557L9.35313 7.35557C9.25313 7.45557 9.12646 7.50224 8.9998 7.50224Z"
|
|
20
|
+
fill={fill}
|
|
21
|
+
/>
|
|
22
|
+
<path
|
|
23
|
+
d="M1.9998 14.5022C1.87313 14.5022 1.74646 14.4556 1.64646 14.3556C1.45313 14.1622 1.45313 13.8422 1.64646 13.6489L6.64646 8.64891C6.8398 8.45557 7.1598 8.45557 7.35313 8.64891C7.54646 8.84224 7.54646 9.16224 7.35313 9.35557L2.35313 14.3556C2.25313 14.4556 2.12646 14.5022 1.9998 14.5022Z"
|
|
24
|
+
fill={fill}
|
|
25
|
+
/>
|
|
26
|
+
</svg>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SVGProps } from 'react';
|
|
2
|
+
|
|
3
|
+
interface SearchIconProps extends SVGProps<SVGSVGElement> {
|
|
4
|
+
stroke?: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const SearchIcon = ({ stroke = 'currentColor', ...props }: SearchIconProps) => {
|
|
8
|
+
return (
|
|
9
|
+
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
|
|
10
|
+
<ellipse cx="5.80004" cy="5.80062" rx="4.80004" ry="4.80062" stroke={stroke} />
|
|
11
|
+
<path d="M9.00012 9.80078L13.0002 12.9997" stroke={stroke} strokeLinecap="round" strokeLinejoin="round" />
|
|
12
|
+
</svg>
|
|
13
|
+
);
|
|
14
|
+
};
|
|
@@ -28,6 +28,7 @@ export { PrintIcon } from './PrintIcon';
|
|
|
28
28
|
export { Profiler2Icon } from './Profiler2Icon';
|
|
29
29
|
export { ProfilerIcon } from './ProfilerIcon';
|
|
30
30
|
export { SandBoxIcon } from './SandBoxIcon';
|
|
31
|
+
export { SearchIcon } from './SearchIcon';
|
|
31
32
|
export { StatisticIcon } from './StatisticIcon';
|
|
32
33
|
export { SunIcon } from './SunIcon';
|
|
33
34
|
export { UpRightArrowCircleIcon } from './UpRightArrowCircleIcon';
|
|
@@ -41,3 +42,4 @@ export { UsersIcon } from './Users';
|
|
|
41
42
|
export { InfoCircleFilledIcon } from './InfoCircleFilled';
|
|
42
43
|
export { UnfoldIcon } from './Unfold';
|
|
43
44
|
export { CrossIcon } from './Cross';
|
|
45
|
+
export { MaximizeIcon } from './MaximizeIcon';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createComponent, FabricComponent, pxToRem } from '../../Theme';
|
|
2
|
+
import { styled } from 'styled-components';
|
|
3
|
+
|
|
4
|
+
type LineProps = FabricComponent<
|
|
5
|
+
{
|
|
6
|
+
direction?: 'horizontal' | 'vertical';
|
|
7
|
+
} & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, 'children'>
|
|
8
|
+
>;
|
|
9
|
+
|
|
10
|
+
export const Line = ({ direction = 'horizontal', ...props }: LineProps) => {
|
|
11
|
+
return <StyledLine {...props} $direction={direction} />;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
interface StyledLineProps {
|
|
15
|
+
$direction: 'horizontal' | 'vertical';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const StyledLine = styled(createComponent('div'))<StyledLineProps>(
|
|
19
|
+
({ theme, $direction }) => `
|
|
20
|
+
width: ${$direction === 'horizontal' ? '100%' : theme.line.size};
|
|
21
|
+
height: ${$direction === 'vertical' ? '100%' : theme.line.size};
|
|
22
|
+
background-color: ${theme.line.color};
|
|
23
|
+
`
|
|
24
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Line';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
|
-
import { CSSProperties, ElementType
|
|
3
|
-
import { ColorVariant, TypographyVariant } from '../../Theme';
|
|
2
|
+
import { CSSProperties, ElementType } from 'react';
|
|
3
|
+
import { ColorVariant, createComponent, FabricComponent, TypographyVariant } from '../../Theme';
|
|
4
4
|
import { resolveThemeColor } from '../../Theme/utils';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
type TypographyProps = FabricComponent<{
|
|
7
7
|
style?: CSSProperties;
|
|
8
8
|
variant?: TypographyVariant;
|
|
9
9
|
element?: ElementType;
|
|
@@ -12,10 +12,10 @@ export interface TypographyProps {
|
|
|
12
12
|
fontStyle?: CSSProperties['fontStyle'];
|
|
13
13
|
color?: ColorVariant | string;
|
|
14
14
|
className?: string;
|
|
15
|
-
}
|
|
15
|
+
}>;
|
|
16
16
|
|
|
17
17
|
// Create a styled component that can be dynamically rendered as different HTML elements
|
|
18
|
-
const StyledTypography = styled
|
|
18
|
+
const StyledTypography = styled(createComponent('div'))<{
|
|
19
19
|
$variant: TypographyVariant;
|
|
20
20
|
$weight?: CSSProperties['fontWeight'];
|
|
21
21
|
$style?: CSSProperties['fontStyle'];
|
|
@@ -40,6 +40,7 @@ export const Typography = ({
|
|
|
40
40
|
color,
|
|
41
41
|
className,
|
|
42
42
|
style,
|
|
43
|
+
...props
|
|
43
44
|
}: TypographyProps) => {
|
|
44
45
|
// Determine which HTML element to render based on the variant if not explicitly specified
|
|
45
46
|
const Element = element || (variant.startsWith('h') ? variant : 'p');
|
|
@@ -53,6 +54,7 @@ export const Typography = ({
|
|
|
53
54
|
$color={color}
|
|
54
55
|
className={className}
|
|
55
56
|
style={style}
|
|
57
|
+
{...props}
|
|
56
58
|
>
|
|
57
59
|
{children}
|
|
58
60
|
</StyledTypography>
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export type { TypographyProps } from './Typography';
|
|
1
|
+
export * from './Typography';
|
package/src/Core/index.ts
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
interface FullscreenCardProps {
|
|
4
|
+
children: any;
|
|
5
|
+
position: 'absolute' | 'fixed';
|
|
6
|
+
isActive: boolean;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const FullscreenCard = ({ isActive, position, ...props }: FullscreenCardProps) => {
|
|
10
|
+
return <StyledContainer $isActive={isActive} $position={position} {...props} />;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const StyledContainer = styled.div<{ $isActive: boolean; $position: 'absolute' | 'fixed' }>(
|
|
14
|
+
({ $isActive, $position }) => `
|
|
15
|
+
${
|
|
16
|
+
$isActive
|
|
17
|
+
? `
|
|
18
|
+
position: ${$position};
|
|
19
|
+
top: 0;
|
|
20
|
+
left: 0;
|
|
21
|
+
height: 100%;
|
|
22
|
+
width: 100%;
|
|
23
|
+
z-index: 1000;
|
|
24
|
+
`
|
|
25
|
+
: ''
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
min-width: 0;
|
|
29
|
+
`
|
|
30
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './FullscreenCard';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createComponent, FabricComponent, pxToRem } from '../../Theme';
|
|
2
|
+
import { styled } from 'styled-components';
|
|
3
|
+
|
|
4
|
+
type ContainerProps = FabricComponent<{
|
|
5
|
+
children: any;
|
|
6
|
+
maxWidth?: string | number;
|
|
7
|
+
}>;
|
|
8
|
+
|
|
9
|
+
export const Container = ({ ...props }: ContainerProps) => {
|
|
10
|
+
return <StyledContainer {...props} />;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const StyledContainer = styled(createComponent<ContainerProps>('div'))`
|
|
14
|
+
padding-inline: ${pxToRem(20)};
|
|
15
|
+
width: 100%;
|
|
16
|
+
min-width: 0;
|
|
17
|
+
max-width: ${({ maxWidth }) => (typeof maxWidth === 'number' ? pxToRem(maxWidth) : maxWidth || '100%')};
|
|
18
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Container';
|
package/src/Layouts/index.ts
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
|
-
import { ThemeProvider as ThemeProviderStyled } from 'styled-components';
|
|
1
|
+
import { StyleSheetManager, ThemeProvider as ThemeProviderStyled, WebTarget } from 'styled-components';
|
|
2
2
|
import { lightTheme } from './theme';
|
|
3
3
|
import { GlobalStyle } from './GlobalStyle';
|
|
4
4
|
|
|
5
5
|
export const ThemeProvider = ({ children }: { children: any }) => {
|
|
6
6
|
return (
|
|
7
|
-
<
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
<StyleSheetManager shouldForwardProp={shouldForwardProp}>
|
|
8
|
+
<ThemeProviderStyled theme={lightTheme}>
|
|
9
|
+
<GlobalStyle />
|
|
10
|
+
{children}
|
|
11
|
+
</ThemeProviderStyled>
|
|
12
|
+
</StyleSheetManager>
|
|
11
13
|
);
|
|
12
14
|
};
|
|
15
|
+
|
|
16
|
+
function shouldForwardProp(propName: any, target: WebTarget) {
|
|
17
|
+
if (typeof target === 'string') {
|
|
18
|
+
return !['m', 'mt', 'mr', 'mb', 'ml', 'mx', 'my', 'p', 'pt', 'pr', 'pb', 'pl', 'px', 'py'].includes(propName);
|
|
19
|
+
}
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import styled, { css, WebTarget } from 'styled-components';
|
|
2
|
+
|
|
3
|
+
type MarginProps = {
|
|
4
|
+
m?: string | number; // margin
|
|
5
|
+
mt?: string | number; // margin-top
|
|
6
|
+
mr?: string | number; // margin-right
|
|
7
|
+
mb?: string | number; // margin-bottom
|
|
8
|
+
ml?: string | number; // margin-left
|
|
9
|
+
mx?: string | number; // margin-left + margin-right
|
|
10
|
+
my?: string | number; // margin-top + margin-bottom
|
|
11
|
+
p?: string | number; // padding
|
|
12
|
+
pt?: string | number; // padding-top
|
|
13
|
+
pr?: string | number; // padding-right
|
|
14
|
+
pb?: string | number; // padding-bottom
|
|
15
|
+
pl?: string | number; // padding-left
|
|
16
|
+
px?: string | number; // padding-left + padding-right
|
|
17
|
+
py?: string | number; // padding-top + padding-bottom
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type FabricComponent<T = object> = T & MarginProps;
|
|
21
|
+
|
|
22
|
+
const marginStyles = css<FabricComponent>((props) => {
|
|
23
|
+
return `
|
|
24
|
+
${props.m ? `margin: ${typeof props.m === 'number' ? `${props.m}px` : props.m};` : ''}
|
|
25
|
+
${props.mt ? `margin-top: ${typeof props.mt === 'number' ? `${props.mt}px` : props.mt};` : ''}
|
|
26
|
+
${props.mr ? `margin-right: ${typeof props.mr === 'number' ? `${props.mr}px` : props.mr};` : ''}
|
|
27
|
+
${props.mb ? `margin-bottom: ${typeof props.mb === 'number' ? `${props.mb}px` : props.mb};` : ''}
|
|
28
|
+
${props.ml ? `margin-left: ${typeof props.ml === 'number' ? `${props.ml}px` : props.ml};` : ''}
|
|
29
|
+
${
|
|
30
|
+
props.mx
|
|
31
|
+
? `margin-left: ${typeof props.mx === 'number' ? `${props.mx}px` : props.mx}; margin-right: ${
|
|
32
|
+
typeof props.mx === 'number' ? `${props.mx}px` : props.mx
|
|
33
|
+
};`
|
|
34
|
+
: ''
|
|
35
|
+
}
|
|
36
|
+
${
|
|
37
|
+
props.my
|
|
38
|
+
? `margin-top: ${typeof props.my === 'number' ? `${props.my}px` : props.my}; margin-bottom: ${
|
|
39
|
+
typeof props.my === 'number' ? `${props.my}px` : props.my
|
|
40
|
+
};`
|
|
41
|
+
: ''
|
|
42
|
+
}
|
|
43
|
+
${props.p ? `padding: ${typeof props.p === 'number' ? `${props.p}px` : props.p};` : ''}
|
|
44
|
+
${props.pt ? `padding-top: ${typeof props.pt === 'number' ? `${props.pt}px` : props.pt};` : ''}
|
|
45
|
+
${props.pr ? `padding-right: ${typeof props.pr === 'number' ? `${props.pr}px` : props.pr};` : ''}
|
|
46
|
+
${props.pb ? `padding-bottom: ${typeof props.pb === 'number' ? `${props.pb}px` : props.pb};` : ''}
|
|
47
|
+
${props.pl ? `padding-left: ${typeof props.pl === 'number' ? `${props.pl}px` : props.pl};` : ''}
|
|
48
|
+
${
|
|
49
|
+
props.px
|
|
50
|
+
? `padding-left: ${typeof props.px === 'number' ? `${props.px}px` : props.px}; padding-right: ${
|
|
51
|
+
typeof props.px === 'number' ? `${props.px}px` : props.px
|
|
52
|
+
};`
|
|
53
|
+
: ''
|
|
54
|
+
}
|
|
55
|
+
${
|
|
56
|
+
props.py
|
|
57
|
+
? `padding-top: ${typeof props.py === 'number' ? `${props.py}px` : props.py}; padding-bottom: ${
|
|
58
|
+
typeof props.py === 'number' ? `${props.py}px` : props.py
|
|
59
|
+
};`
|
|
60
|
+
: ''
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
`;
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
export const createComponent = <T = object>(element: WebTarget) => {
|
|
67
|
+
return styled(element)<FabricComponent<T>>`
|
|
68
|
+
${marginStyles};
|
|
69
|
+
`;
|
|
70
|
+
};
|
package/src/Theme/index.ts
CHANGED
package/src/Theme/theme.ts
CHANGED
|
@@ -74,6 +74,10 @@ export const lightThemePx: Theme = {
|
|
|
74
74
|
popover: 1060,
|
|
75
75
|
tooltip: 1070,
|
|
76
76
|
},
|
|
77
|
+
line: {
|
|
78
|
+
size: 1,
|
|
79
|
+
color: '#EBEBEB',
|
|
80
|
+
},
|
|
77
81
|
button: {
|
|
78
82
|
// Варіанти кнопок з кольорами
|
|
79
83
|
fill: {
|
|
@@ -332,24 +336,40 @@ export const lightThemePx: Theme = {
|
|
|
332
336
|
text: '#0042EC',
|
|
333
337
|
border: 'transparent',
|
|
334
338
|
boxShadow: 'none',
|
|
339
|
+
filledIcon: {
|
|
340
|
+
background: '#E5ECFD',
|
|
341
|
+
color: '#0042EC',
|
|
342
|
+
},
|
|
335
343
|
},
|
|
336
344
|
hover: {
|
|
337
345
|
background: 'transparent',
|
|
338
346
|
text: '#80A0F5',
|
|
339
347
|
border: 'transparent',
|
|
340
348
|
boxShadow: 'none',
|
|
349
|
+
filledIcon: {
|
|
350
|
+
background: '#0042EC',
|
|
351
|
+
color: '#ffffff',
|
|
352
|
+
},
|
|
341
353
|
},
|
|
342
354
|
active: {
|
|
343
355
|
background: 'transparent',
|
|
344
356
|
text: '#80A0F5',
|
|
345
357
|
border: 'transparent',
|
|
346
358
|
boxShadow: 'none',
|
|
359
|
+
filledIcon: {
|
|
360
|
+
background: '#0042EC',
|
|
361
|
+
color: '#ffffff',
|
|
362
|
+
},
|
|
347
363
|
},
|
|
348
364
|
disabled: {
|
|
349
365
|
background: 'transparent',
|
|
350
366
|
text: '#99989C',
|
|
351
367
|
border: 'transparent',
|
|
352
368
|
boxShadow: 'none',
|
|
369
|
+
filledIcon: {
|
|
370
|
+
background: '#BEBEBE',
|
|
371
|
+
color: '#99989C',
|
|
372
|
+
},
|
|
353
373
|
},
|
|
354
374
|
},
|
|
355
375
|
//default as secondary
|
|
@@ -635,8 +655,8 @@ export const lightThemePx: Theme = {
|
|
|
635
655
|
},
|
|
636
656
|
box: {
|
|
637
657
|
padding: 20,
|
|
658
|
+
borderRadius: 8,
|
|
638
659
|
border: {
|
|
639
|
-
radius: 8,
|
|
640
660
|
width: 1,
|
|
641
661
|
style: 'solid',
|
|
642
662
|
color: '#EBEBEB',
|
package/src/Theme/types.ts
CHANGED
|
@@ -19,6 +19,10 @@ export type ButtonElementStyle = {
|
|
|
19
19
|
text: string;
|
|
20
20
|
border: string;
|
|
21
21
|
boxShadow: string;
|
|
22
|
+
filledIcon?: {
|
|
23
|
+
background: string;
|
|
24
|
+
color: string;
|
|
25
|
+
};
|
|
22
26
|
};
|
|
23
27
|
|
|
24
28
|
// Тип для розмірів кнопок
|
|
@@ -81,6 +85,10 @@ export type Theme = {
|
|
|
81
85
|
warning: string;
|
|
82
86
|
info: string;
|
|
83
87
|
};
|
|
88
|
+
line: {
|
|
89
|
+
size: string | number;
|
|
90
|
+
color: string;
|
|
91
|
+
};
|
|
84
92
|
typography: {
|
|
85
93
|
fontFamily: string;
|
|
86
94
|
lineHeight: number;
|
|
@@ -188,8 +196,8 @@ export type Theme = {
|
|
|
188
196
|
box: {
|
|
189
197
|
padding: number | string;
|
|
190
198
|
background: string;
|
|
199
|
+
borderRadius: number | string;
|
|
191
200
|
border: {
|
|
192
|
-
radius: number | string;
|
|
193
201
|
width: number | string;
|
|
194
202
|
style: string;
|
|
195
203
|
color: string;
|
package/src/index.ts
CHANGED
package/tsconfig.paths.json
CHANGED
package/tsup.config.ts
CHANGED
|
@@ -21,13 +21,6 @@ export default defineConfig({
|
|
|
21
21
|
esbuildOptions(options) {
|
|
22
22
|
options.drop = ['console', 'debugger'];
|
|
23
23
|
options.pure = ['console.log', 'console.info', 'console.debug', 'console.warn'];
|
|
24
|
-
// Налаштування розв'язання шляхів для esbuild
|
|
25
|
-
options.alias = {
|
|
26
|
-
'@': resolve(__dirname, './src'),
|
|
27
|
-
'@core': resolve(__dirname, './src/Core'),
|
|
28
|
-
'@theme': resolve(__dirname, './src/Theme'),
|
|
29
|
-
'@layouts': resolve(__dirname, './src/Layouts'),
|
|
30
|
-
};
|
|
31
24
|
},
|
|
32
25
|
shims: true,
|
|
33
26
|
keepNames: true,
|