@cyber-harbour/ui 1.0.62 → 1.0.64
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 +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +129 -127
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +192 -190
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/Core/Button/Button.tsx +16 -5
- package/src/Core/Pagination/Pagination.tsx +18 -13
- package/src/Theme/themes/dark.ts +9 -0
- package/src/Theme/themes/light.ts +9 -0
- package/src/Theme/types.ts +9 -0
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
|
}
|
|
@@ -94,12 +94,15 @@ type StyledButtonProps = {
|
|
|
94
94
|
$current?: boolean;
|
|
95
95
|
};
|
|
96
96
|
|
|
97
|
-
const StyledList = styled.div
|
|
97
|
+
const StyledList = styled.div(
|
|
98
|
+
({ theme }) => `
|
|
98
99
|
list-style: none;
|
|
99
100
|
padding: 0;
|
|
100
101
|
display: flex;
|
|
101
|
-
|
|
102
|
-
|
|
102
|
+
flex-wrap: wrap;
|
|
103
|
+
gap: ${theme.pagination.gap};
|
|
104
|
+
`
|
|
105
|
+
);
|
|
103
106
|
const Button = styled.button<StyledButtonProps>(
|
|
104
107
|
({ theme, $current }) => `
|
|
105
108
|
font-family: ${theme.typography.fontFamily};
|
|
@@ -107,18 +110,18 @@ const Button = styled.button<StyledButtonProps>(
|
|
|
107
110
|
color: ${$current ? theme.colors.background : theme.colors.text.main};
|
|
108
111
|
border: none;
|
|
109
112
|
cursor: pointer;
|
|
110
|
-
padding-block:
|
|
111
|
-
padding-inline:
|
|
112
|
-
border-radius:
|
|
113
|
-
font-size:
|
|
113
|
+
padding-block: ${theme.pagination.paddingBlock};
|
|
114
|
+
padding-inline: ${theme.pagination.paddingInline};
|
|
115
|
+
border-radius: ${theme.pagination.borderRadius};
|
|
116
|
+
font-size: ${theme.pagination.fontSize};
|
|
114
117
|
font-weight: 400;
|
|
115
118
|
display: flex;
|
|
116
119
|
align-items: center;
|
|
117
120
|
justify-content: center;
|
|
118
|
-
height:
|
|
121
|
+
height: ${theme.pagination.height};
|
|
119
122
|
svg {
|
|
120
|
-
width:
|
|
121
|
-
height:
|
|
123
|
+
width: ${theme.pagination.iconSize};
|
|
124
|
+
height: ${theme.pagination.iconSize};
|
|
122
125
|
}
|
|
123
126
|
&:hover {
|
|
124
127
|
background-color: ${theme.colors.primary.light};
|
|
@@ -126,9 +129,11 @@ const Button = styled.button<StyledButtonProps>(
|
|
|
126
129
|
transition: background-color 0.3s ease-in-out;
|
|
127
130
|
`
|
|
128
131
|
);
|
|
129
|
-
const FlexGroup = styled.div
|
|
132
|
+
const FlexGroup = styled.div(
|
|
133
|
+
({ theme }) => `
|
|
130
134
|
display: flex;
|
|
131
135
|
align-items: center;
|
|
132
136
|
justify-content: flex-end;
|
|
133
|
-
gap:
|
|
134
|
-
|
|
137
|
+
gap: ${theme.pagination.gap};
|
|
138
|
+
`
|
|
139
|
+
);
|
package/src/Theme/themes/dark.ts
CHANGED
|
@@ -976,6 +976,15 @@ export const darkThemePx: Theme = {
|
|
|
976
976
|
color: '#99989C',
|
|
977
977
|
background: '#1E2226',
|
|
978
978
|
},
|
|
979
|
+
pagination: {
|
|
980
|
+
fontSize: 14,
|
|
981
|
+
paddingBlock: 4,
|
|
982
|
+
paddingInline: 8,
|
|
983
|
+
borderRadius: 3,
|
|
984
|
+
gap: 6,
|
|
985
|
+
height: 26,
|
|
986
|
+
iconSize: 8,
|
|
987
|
+
},
|
|
979
988
|
};
|
|
980
989
|
|
|
981
990
|
export const darkTheme = convertPaletteToRem(darkThemePx, darkThemePx.baseSize) as DefaultTheme;
|
|
@@ -975,6 +975,15 @@ export const lightThemePx: Theme = {
|
|
|
975
975
|
color: '#535353',
|
|
976
976
|
background: '#EBEBEB',
|
|
977
977
|
},
|
|
978
|
+
pagination: {
|
|
979
|
+
fontSize: 14,
|
|
980
|
+
paddingBlock: 4,
|
|
981
|
+
paddingInline: 8,
|
|
982
|
+
borderRadius: 3,
|
|
983
|
+
gap: 6,
|
|
984
|
+
height: 26,
|
|
985
|
+
iconSize: 8,
|
|
986
|
+
},
|
|
978
987
|
};
|
|
979
988
|
|
|
980
989
|
export const lightTheme = convertPaletteToRem(lightThemePx, lightThemePx.baseSize) as DefaultTheme;
|
package/src/Theme/types.ts
CHANGED
|
@@ -319,6 +319,15 @@ export type Theme = {
|
|
|
319
319
|
color: string;
|
|
320
320
|
background: string;
|
|
321
321
|
};
|
|
322
|
+
pagination: {
|
|
323
|
+
fontSize: string | number;
|
|
324
|
+
paddingBlock: string | number;
|
|
325
|
+
paddingInline: string | number;
|
|
326
|
+
borderRadius: string | number;
|
|
327
|
+
gap: string | number;
|
|
328
|
+
height: string | number;
|
|
329
|
+
iconSize: string | number;
|
|
330
|
+
};
|
|
322
331
|
};
|
|
323
332
|
|
|
324
333
|
//TODO check and refactoring
|