@cyber-harbour/ui 1.0.61 → 1.0.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +37 -2
- package/dist/index.d.ts +37 -2
- package/dist/index.js +166 -158
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +217 -209
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/Core/Button/Button.tsx +16 -5
- package/src/Core/IconComponents/FlashIcon.tsx +16 -0
- package/src/Core/IconComponents/UserInCircle.tsx +24 -0
- package/src/Core/IconComponents/index.ts +2 -0
- package/src/Core/Tag/Tag.tsx +11 -3
- package/src/Core/Tooltip/Tooltip.tsx +12 -2
- package/src/FullscreenCard/FullscreenCard.tsx +21 -26
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
2
|
+
import styled, { CSSProperties } from 'styled-components';
|
|
3
3
|
import {
|
|
4
4
|
ButtonVariant,
|
|
5
5
|
ButtonSize,
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
generatePropertySpaceStyle,
|
|
12
12
|
createStyledComponent,
|
|
13
13
|
StyledFabricComponent,
|
|
14
|
+
pxToRem,
|
|
14
15
|
} from '../../Theme';
|
|
15
16
|
|
|
16
17
|
type BaseButtonProps = {
|
|
@@ -24,6 +25,8 @@ type BaseButtonProps = {
|
|
|
24
25
|
icon?: any;
|
|
25
26
|
iconPosition?: 'left' | 'right';
|
|
26
27
|
iconVariant?: 'filled' | 'empty';
|
|
28
|
+
minWidth?: number;
|
|
29
|
+
whiteSpace?: CSSProperties['whiteSpace'];
|
|
27
30
|
};
|
|
28
31
|
export type ButtonProps = (
|
|
29
32
|
| Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'children' | 'media'>
|
|
@@ -47,12 +50,14 @@ const getIconStyles = (styles: ButtonElementStyle) =>
|
|
|
47
50
|
: '';
|
|
48
51
|
|
|
49
52
|
// Створюємо стилізований компонент, що використовує уніфіковану палітру
|
|
50
|
-
const ButtonTextContainer = styled.div
|
|
53
|
+
const ButtonTextContainer = styled.div<{ $whiteSpace: CSSProperties['whiteSpace'] }>(
|
|
54
|
+
({ $whiteSpace }) => `
|
|
51
55
|
text-overflow: ellipsis;
|
|
52
56
|
overflow: hidden;
|
|
53
|
-
white-space:
|
|
57
|
+
white-space: ${$whiteSpace};
|
|
54
58
|
user-select: text;
|
|
55
|
-
|
|
59
|
+
`
|
|
60
|
+
);
|
|
56
61
|
|
|
57
62
|
const StyledIconWrapper = styled.span`
|
|
58
63
|
display: inline-flex;
|
|
@@ -68,6 +73,7 @@ type StyledButtonProps = {
|
|
|
68
73
|
$fullWidth: boolean;
|
|
69
74
|
$iconPosition: 'left' | 'right';
|
|
70
75
|
$iconVariant: 'filled' | 'empty';
|
|
76
|
+
$minWidth?: number;
|
|
71
77
|
};
|
|
72
78
|
|
|
73
79
|
const StyledButton = createStyledComponent(
|
|
@@ -80,6 +86,7 @@ const StyledButton = createStyledComponent(
|
|
|
80
86
|
$fullWidth,
|
|
81
87
|
$iconPosition,
|
|
82
88
|
$iconVariant,
|
|
89
|
+
$minWidth,
|
|
83
90
|
theme,
|
|
84
91
|
px = $variant !== 'empty' ? theme.button.sizes[$size].paddingInline : 0,
|
|
85
92
|
py = $variant !== 'empty' ? theme.button.sizes[$size].paddingBlock : 0,
|
|
@@ -105,6 +112,7 @@ const StyledButton = createStyledComponent(
|
|
|
105
112
|
transition: all 0.2s ease;
|
|
106
113
|
outline: none;
|
|
107
114
|
user-select: text;
|
|
115
|
+
${typeof $minWidth === 'number' ? `min-width: ${pxToRem($minWidth, theme.baseSize)};` : ''}
|
|
108
116
|
|
|
109
117
|
${$iconPosition === 'right' ? 'flex-direction: row-reverse;' : ''}
|
|
110
118
|
|
|
@@ -172,6 +180,8 @@ export const Button = createComponent<ButtonProps>(
|
|
|
172
180
|
icon,
|
|
173
181
|
iconPosition = 'left',
|
|
174
182
|
iconVariant = 'empty',
|
|
183
|
+
whiteSpace = 'nowrap',
|
|
184
|
+
minWidth,
|
|
175
185
|
...props
|
|
176
186
|
}) => {
|
|
177
187
|
return (
|
|
@@ -185,12 +195,13 @@ export const Button = createComponent<ButtonProps>(
|
|
|
185
195
|
$fullWidth={fullWidth}
|
|
186
196
|
$iconPosition={iconPosition}
|
|
187
197
|
$iconVariant={iconVariant}
|
|
198
|
+
$minWidth={minWidth}
|
|
188
199
|
disabled={disabled}
|
|
189
200
|
className={className}
|
|
190
201
|
{...props}
|
|
191
202
|
>
|
|
192
203
|
{!!icon && <StyledIconWrapper>{icon}</StyledIconWrapper>}
|
|
193
|
-
{!!children && <ButtonTextContainer>{children}</ButtonTextContainer>}
|
|
204
|
+
{!!children && <ButtonTextContainer $whiteSpace={whiteSpace}>{children}</ButtonTextContainer>}
|
|
194
205
|
</StyledButton>
|
|
195
206
|
);
|
|
196
207
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SVGProps } from 'react';
|
|
2
|
+
|
|
3
|
+
interface FlashIconProps extends SVGProps<SVGSVGElement> {
|
|
4
|
+
fill?: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const FlashIcon = ({ fill = 'currentColor', ...props }: FlashIconProps) => {
|
|
8
|
+
return (
|
|
9
|
+
<svg viewBox="0 0 12 16" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
|
|
10
|
+
<path
|
|
11
|
+
d="M 7.6660156,0.65234375 C 7.4133949,0.5557327 7.1358962,0.60336238 6.9023437,0.72070312 6.6687913,0.83804387 6.4563704,1.0238164 6.2421875,1.2714844 a 0.40004001,0.40004001 0 0 0 -0.00195,0 L 1.0390625,7.2910156 a 0.40004001,0.40004001 0 0 0 -0.00195,0.00195 C 0.66831145,7.7258208 0.48003352,8.2197174 0.67773437,8.6640625 0.87543523,9.1084076 1.3750452,9.296875 1.9394531,9.296875 h 1.7246094 v 4.638672 c 0,0.329424 0.040225,0.610814 0.1386719,0.853516 0.098447,0.242701 0.2727646,0.461984 0.5253906,0.558593 0.252626,0.09661 0.5301197,0.04899 0.7636719,-0.06836 0.2335521,-0.117352 0.4479278,-0.303095 0.6621093,-0.550781 L 10.955078,8.7109375 v -0.00195 C 11.327713,8.2797425 11.519652,7.7831519 11.322266,7.3378906 11.124617,6.8920374 10.622895,6.703125 10.054688,6.703125 H 8.3320313 V 2.0644531 c 0,-0.3294234 -0.040224,-0.6108149 -0.1386719,-0.8535156 C 8.0949118,0.96823685 7.9186363,0.7489548 7.6660156,0.65234375 Z M 7.3808594,1.4003906 c -9.672e-4,-3.699e-4 0.027688,0.00625 0.070312,0.1113281 0.042624,0.1050814 0.080078,0.2942094 0.080078,0.5527344 v 5.0390625 a 0.40004001,0.40004001 0 0 0 0.4003906,0.4003906 h 2.1230474 c 0.400591,0 0.518333,0.1158494 0.537109,0.1582032 0.01878,0.042354 0.02525,0.218143 -0.240234,0.5234375 a 0.40004001,0.40004001 0 0 0 -0.002,0 L 5.1484375,14.205078 c -0.167163,0.193313 -0.3178234,0.310037 -0.4160156,0.359375 -0.098192,0.04934 -0.1201131,0.03478 -0.1191407,0.03516 9.725e-4,3.72e-4 -0.027688,-0.0062 -0.070312,-0.111328 -0.042625,-0.105082 -0.080078,-0.294209 -0.080078,-0.552734 V 8.8964844 A 0.40004001,0.40004001 0 0 0 4.0625,8.4960938 H 1.9394531 c -0.3975381,0 -0.5125133,-0.1141382 -0.53125,-0.15625 C 1.3894664,8.2977319 1.3831449,8.1196241 1.6464844,7.8105469 L 6.8457031,1.7949219 C 7.0128648,1.6016263 7.1635269,1.4848801 7.2617187,1.4355469 7.3599106,1.3862136 7.3818266,1.4007605 7.3808594,1.4003906 Z"
|
|
12
|
+
fill={fill}
|
|
13
|
+
/>
|
|
14
|
+
</svg>
|
|
15
|
+
);
|
|
16
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SVGProps } from 'react';
|
|
2
|
+
|
|
3
|
+
interface UserInCircleIconProps extends SVGProps<SVGSVGElement> {
|
|
4
|
+
fill?: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const UserInCircleIcon = ({ fill = 'currentColor', ...props }: UserInCircleIconProps) => {
|
|
8
|
+
return (
|
|
9
|
+
<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
|
|
10
|
+
<path
|
|
11
|
+
d="M8.08031 9.02292C8.06698 9.02292 8.04698 9.02292 8.03365 9.02292C8.01365 9.02292 7.98698 9.02292 7.96698 9.02292C6.45365 8.97625 5.32031 7.79625 5.32031 6.34292C5.32031 4.86292 6.52698 3.65625 8.00698 3.65625C9.48698 3.65625 10.6936 4.86292 10.6936 6.34292C10.687 7.80292 9.54698 8.97625 8.10031 9.02292C8.08698 9.02292 8.08698 9.02292 8.08031 9.02292ZM8.00031 4.64958C7.06698 4.64958 6.31365 5.40958 6.31365 6.33625C6.31365 7.24958 7.02698 7.98958 7.93365 8.02292C7.95365 8.01625 8.02031 8.01625 8.08698 8.02292C8.98031 7.97625 9.68031 7.24292 9.68698 6.33625C9.68698 5.40958 8.93365 4.64958 8.00031 4.64958Z"
|
|
12
|
+
fill={fill}
|
|
13
|
+
/>
|
|
14
|
+
<path
|
|
15
|
+
d="M7.99924 15.1669C6.20591 15.1669 4.49257 14.5002 3.16591 13.2869C3.04591 13.1802 2.99257 13.0202 3.00591 12.8669C3.09257 12.0735 3.58591 11.3335 4.40591 10.7869C6.39257 9.46687 9.61257 9.46687 11.5926 10.7869C12.4126 11.3402 12.9059 12.0735 12.9926 12.8669C13.0126 13.0269 12.9526 13.1802 12.8326 13.2869C11.5059 14.5002 9.79257 15.1669 7.99924 15.1669ZM4.05257 12.7335C5.15924 13.6602 6.55257 14.1669 7.99924 14.1669C9.44591 14.1669 10.8392 13.6602 11.9459 12.7335C11.8259 12.3269 11.5059 11.9335 11.0326 11.6135C9.39257 10.5202 6.61257 10.5202 4.95924 11.6135C4.48591 11.9335 4.17257 12.3269 4.05257 12.7335Z"
|
|
16
|
+
fill={fill}
|
|
17
|
+
/>
|
|
18
|
+
<path
|
|
19
|
+
d="M8.00065 15.1654C4.04732 15.1654 0.833984 11.952 0.833984 7.9987C0.833984 4.04536 4.04732 0.832031 8.00065 0.832031C11.954 0.832031 15.1673 4.04536 15.1673 7.9987C15.1673 11.952 11.954 15.1654 8.00065 15.1654ZM8.00065 1.83203C4.60065 1.83203 1.83398 4.5987 1.83398 7.9987C1.83398 11.3987 4.60065 14.1654 8.00065 14.1654C11.4007 14.1654 14.1673 11.3987 14.1673 7.9987C14.1673 4.5987 11.4007 1.83203 8.00065 1.83203Z"
|
|
20
|
+
fill={fill}
|
|
21
|
+
/>
|
|
22
|
+
</svg>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
@@ -59,3 +59,5 @@ export { RelationPointsIcon } from './RelationPointsIcon';
|
|
|
59
59
|
export { PassportIcon } from './PassportIcon';
|
|
60
60
|
export { PointIcon } from './PointIcon';
|
|
61
61
|
export { PencilIcon } from './PencilIcon';
|
|
62
|
+
export { UserInCircleIcon } from './UserInCircle';
|
|
63
|
+
export { FlashIcon } from './FlashIcon';
|
package/src/Core/Tag/Tag.tsx
CHANGED
|
@@ -57,17 +57,25 @@ type StyledProps = {
|
|
|
57
57
|
$clickable: boolean;
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
-
const Content = styled.span
|
|
60
|
+
const Content = styled.span(
|
|
61
|
+
({ theme }) => `
|
|
61
62
|
display: inline-flex;
|
|
63
|
+
flex-wrap: wrap;
|
|
62
64
|
align-items: center;
|
|
63
|
-
justify-content:
|
|
65
|
+
justify-content: flex-start;
|
|
64
66
|
min-width: 0;
|
|
67
|
+
word-break: break-word;
|
|
65
68
|
|
|
66
69
|
font-size: 14px;
|
|
67
70
|
line-height: 16px;
|
|
68
|
-
|
|
71
|
+
@media (min-width: ${theme.breakpoints.m}) {
|
|
72
|
+
justify-content: center;
|
|
73
|
+
}
|
|
74
|
+
`
|
|
75
|
+
);
|
|
69
76
|
|
|
70
77
|
const DeleteButton = styled.button`
|
|
78
|
+
align-self: flex-start;
|
|
71
79
|
border: none;
|
|
72
80
|
outline: none;
|
|
73
81
|
background-color: transparent;
|
|
@@ -23,16 +23,21 @@ export const Tooltip = createComponent<TooltipProps>(
|
|
|
23
23
|
if (content) setIsOpen(true);
|
|
24
24
|
}, [content]);
|
|
25
25
|
|
|
26
|
-
const
|
|
26
|
+
const handleClose = useCallback(() => {
|
|
27
27
|
setIsOpen(false);
|
|
28
28
|
}, []);
|
|
29
29
|
|
|
30
|
+
const handleClickOrTouch = useCallback(() => {
|
|
31
|
+
if (content) setIsOpen((prev) => !prev);
|
|
32
|
+
}, [content]);
|
|
33
|
+
|
|
30
34
|
return (
|
|
31
35
|
<Popover
|
|
32
36
|
padding={offset}
|
|
33
37
|
positions={positions}
|
|
34
38
|
isOpen={isOpen}
|
|
35
39
|
align={align}
|
|
40
|
+
onClickOutside={handleClose}
|
|
36
41
|
content={
|
|
37
42
|
!!content && (
|
|
38
43
|
<StyledContent className={className} $position={position} $offset={offset}>
|
|
@@ -44,7 +49,12 @@ export const Tooltip = createComponent<TooltipProps>(
|
|
|
44
49
|
zIndex: `${9999}`,
|
|
45
50
|
}}
|
|
46
51
|
>
|
|
47
|
-
<StyledAnchor
|
|
52
|
+
<StyledAnchor
|
|
53
|
+
onMouseEnter={handleMouseEnter}
|
|
54
|
+
onMouseLeave={handleClose}
|
|
55
|
+
className={anchorClassName}
|
|
56
|
+
onTouchStart={handleClickOrTouch}
|
|
57
|
+
>
|
|
48
58
|
{children}
|
|
49
59
|
</StyledAnchor>
|
|
50
60
|
</Popover>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
|
-
import { pxToRem } from '../Theme';
|
|
2
|
+
import { createComponent, pxToRem } from '../Theme';
|
|
3
3
|
|
|
4
4
|
interface FullscreenCardProps {
|
|
5
5
|
children: any;
|
|
@@ -12,27 +12,21 @@ interface FullscreenCardProps {
|
|
|
12
12
|
bottom?: number;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export const FullscreenCard = (
|
|
16
|
-
isActive,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
$right={right}
|
|
31
|
-
$bottom={bottom}
|
|
32
|
-
{...props}
|
|
33
|
-
/>
|
|
34
|
-
);
|
|
35
|
-
};
|
|
15
|
+
export const FullscreenCard = createComponent<FullscreenCardProps>(
|
|
16
|
+
({ isActive, position, top = 0, left = 0, right, bottom, ...props }) => {
|
|
17
|
+
return (
|
|
18
|
+
<StyledContainer
|
|
19
|
+
$isActive={isActive}
|
|
20
|
+
$position={position}
|
|
21
|
+
$top={top}
|
|
22
|
+
$left={left}
|
|
23
|
+
$right={right}
|
|
24
|
+
$bottom={bottom}
|
|
25
|
+
{...props}
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
);
|
|
36
30
|
|
|
37
31
|
const StyledContainer = styled.div<{
|
|
38
32
|
$isActive: boolean;
|
|
@@ -48,10 +42,11 @@ ${
|
|
|
48
42
|
? `
|
|
49
43
|
position: ${$position};
|
|
50
44
|
z-index: 1000;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
45
|
+
${typeof $top === 'number' ? `top: ${pxToRem($top, theme.baseSize)};` : ''}
|
|
46
|
+
${typeof $left === 'number' ? `left: ${pxToRem($left, theme.baseSize)};` : ''}
|
|
47
|
+
${typeof $right === 'number' ? `right: ${pxToRem($right, theme.baseSize)};` : ''}
|
|
48
|
+
${typeof $bottom === 'number' ? `bottom: ${pxToRem($bottom, theme.baseSize)};` : ''}
|
|
49
|
+
|
|
55
50
|
`
|
|
56
51
|
: ''
|
|
57
52
|
}
|