armtek-uikit-react 1.0.2
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 +1 -0
- package/lib/Button/package.json +7 -0
- package/lib/cjs/assets/fonts.scss +20 -0
- package/lib/cjs/assets/global.css +35 -0
- package/lib/cjs/assets/index.d.ts +16 -0
- package/lib/cjs/assets/styles.scss +132 -0
- package/lib/cjs/index.d.ts +29 -0
- package/lib/cjs/index.js +7 -0
- package/lib/cjs/shared/hooks/useClickOutside.d.ts +3 -0
- package/lib/cjs/shared/hooks/useClickOutside.js +22 -0
- package/lib/cjs/shared/services/DateService.d.ts +12 -0
- package/lib/cjs/shared/services/DateService.js +48 -0
- package/lib/cjs/shared/types/theme.d.ts +10 -0
- package/lib/cjs/shared/types/theme.js +3 -0
- package/lib/cjs/shared/utils/helpers.d.ts +5 -0
- package/lib/cjs/shared/utils/helpers.js +48 -0
- package/lib/cjs/ui/Button/Button.d.ts +15 -0
- package/lib/cjs/ui/Button/Button.js +44 -0
- package/lib/cjs/ui/Button/Button.module.scss +298 -0
- package/lib/cjs/ui/Button/ButtonGroup.d.ts +6 -0
- package/lib/cjs/ui/Button/ButtonGroup.js +26 -0
- package/lib/cjs/ui/Button/ButtonIcon.d.ts +3 -0
- package/lib/cjs/ui/Button/ButtonIcon.js +21 -0
- package/lib/cjs/ui/Button/style.css +299 -0
- package/lib/dist/armtek-uikit-react-index.js +1335 -0
- package/lib/dist/armtek-uikit-react-index.min.js +2 -0
- package/lib/dist/armtek-uikit-react-index.min.js.LICENSE.txt +15 -0
- package/lib/esm/assets/fonts.scss +20 -0
- package/lib/esm/assets/global.css +35 -0
- package/lib/esm/assets/index.d.ts +16 -0
- package/lib/esm/assets/styles.scss +132 -0
- package/lib/esm/index.d.ts +29 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/shared/hooks/useClickOutside.d.ts +3 -0
- package/lib/esm/shared/hooks/useClickOutside.js +17 -0
- package/lib/esm/shared/services/DateService.d.ts +12 -0
- package/lib/esm/shared/services/DateService.js +42 -0
- package/lib/esm/shared/types/theme.d.ts +10 -0
- package/lib/esm/shared/types/theme.js +1 -0
- package/lib/esm/shared/utils/helpers.d.ts +5 -0
- package/lib/esm/shared/utils/helpers.js +40 -0
- package/lib/esm/ui/Button/Button.d.ts +15 -0
- package/lib/esm/ui/Button/Button.js +38 -0
- package/lib/esm/ui/Button/Button.module.scss +298 -0
- package/lib/esm/ui/Button/ButtonGroup.d.ts +6 -0
- package/lib/esm/ui/Button/ButtonGroup.js +20 -0
- package/lib/esm/ui/Button/ButtonIcon.d.ts +3 -0
- package/lib/esm/ui/Button/ButtonIcon.js +15 -0
- package/lib/esm/ui/Button/style.css +299 -0
- package/package.json +94 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export const getVariants = except => {
|
|
2
|
+
let variants = {
|
|
3
|
+
contained: 'Заливка',
|
|
4
|
+
outlined: 'С границами',
|
|
5
|
+
transparent: 'Прозрачный'
|
|
6
|
+
};
|
|
7
|
+
if (except) variants = filter(variants, except);
|
|
8
|
+
return variants;
|
|
9
|
+
};
|
|
10
|
+
export const getColors = () => {
|
|
11
|
+
return {
|
|
12
|
+
primary: 'Основной',
|
|
13
|
+
secondary: 'Второстепенный',
|
|
14
|
+
neutral: 'Нейтральный'
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export const getStatusColors = () => {
|
|
18
|
+
return {
|
|
19
|
+
info: 'Инфо',
|
|
20
|
+
error: 'Ошибка',
|
|
21
|
+
success: 'Успех',
|
|
22
|
+
warning: 'Уведомление'
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export const getSizes = except => {
|
|
26
|
+
let sizes = {
|
|
27
|
+
small: 'Маленький',
|
|
28
|
+
medium: 'Средний',
|
|
29
|
+
large: 'Большой',
|
|
30
|
+
extraLarge: 'Огромный'
|
|
31
|
+
};
|
|
32
|
+
if (except) sizes = filter(sizes, except);
|
|
33
|
+
return sizes;
|
|
34
|
+
};
|
|
35
|
+
const filter = (obj, arr) => {
|
|
36
|
+
return Object.entries(obj).filter(item => !arr.includes(item[0])).reduce((prev, current) => {
|
|
37
|
+
prev[current[0]] = current[1];
|
|
38
|
+
return prev;
|
|
39
|
+
}, {});
|
|
40
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, ElementType, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { ColorThemeType, ColorType, SizeType, VariantType } from '../../shared/types/theme';
|
|
3
|
+
type OwnProps<T extends ElementType = ElementType> = {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
size?: SizeType;
|
|
6
|
+
color?: ColorType | Exclude<ColorThemeType, 'white'>;
|
|
7
|
+
variant?: VariantType;
|
|
8
|
+
startAdornment?: string | ReactNode;
|
|
9
|
+
endAdornment?: string | ReactNode;
|
|
10
|
+
group?: 'inline' | 'column';
|
|
11
|
+
as?: T;
|
|
12
|
+
};
|
|
13
|
+
export type ButtonProps<T extends ElementType = ElementType<HTMLAttributes<HTMLButtonElement>>> = OwnProps<T> & Omit<ComponentPropsWithoutRef<T>, keyof OwnProps>;
|
|
14
|
+
declare const Button: <T extends ElementType>(props: ButtonProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export default Button;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import './style.css'
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
6
|
+
const Button = props => {
|
|
7
|
+
let {
|
|
8
|
+
size = 'extraLarge',
|
|
9
|
+
color = 'primary',
|
|
10
|
+
variant = 'contained',
|
|
11
|
+
endAdornment,
|
|
12
|
+
startAdornment,
|
|
13
|
+
children,
|
|
14
|
+
className,
|
|
15
|
+
group,
|
|
16
|
+
as,
|
|
17
|
+
...restProps
|
|
18
|
+
} = props;
|
|
19
|
+
let Component = as || 'button';
|
|
20
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
21
|
+
children: /*#__PURE__*/_jsxs(Component, {
|
|
22
|
+
...restProps,
|
|
23
|
+
className: clsx('button', 'button_' + size, 'button_' + variant, 'button_' + color, className, {
|
|
24
|
+
['button_grouped_' + group]: group
|
|
25
|
+
}),
|
|
26
|
+
children: [startAdornment && /*#__PURE__*/_jsx("div", {
|
|
27
|
+
className: clsx('button__adornment', 'button__adornment_start'),
|
|
28
|
+
children: startAdornment
|
|
29
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
30
|
+
children: children
|
|
31
|
+
}), endAdornment && /*#__PURE__*/_jsx("div", {
|
|
32
|
+
className: clsx('button__adornment', 'button__adornment_end'),
|
|
33
|
+
children: endAdornment
|
|
34
|
+
})]
|
|
35
|
+
})
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
export default Button;
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
@import "../../assets/styles";
|
|
2
|
+
|
|
3
|
+
.button{
|
|
4
|
+
outline: none;
|
|
5
|
+
border:1px solid transparent;
|
|
6
|
+
border-radius: $radius;
|
|
7
|
+
text-transform: uppercase;
|
|
8
|
+
padding: $size-step calc(3 * $size-step);
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
@include transition(0.3s);
|
|
11
|
+
font-weight: 500;
|
|
12
|
+
font-size: 16px;
|
|
13
|
+
height: $size-elarge;
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
&:disabled{
|
|
18
|
+
cursor: initial;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
.button_contained {
|
|
22
|
+
&.button_primary{
|
|
23
|
+
color: #fff;
|
|
24
|
+
background: $color-primary;
|
|
25
|
+
&:hover{
|
|
26
|
+
background: $color-primary-dark;
|
|
27
|
+
}
|
|
28
|
+
&:active{
|
|
29
|
+
background: $color-blue-800;
|
|
30
|
+
}
|
|
31
|
+
&:disabled{
|
|
32
|
+
background: $color-primary-light;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
&.button_secondary {
|
|
36
|
+
background: $color-secondary;
|
|
37
|
+
color: #fff;
|
|
38
|
+
&:hover{
|
|
39
|
+
background: $color-secondary-dark;
|
|
40
|
+
}
|
|
41
|
+
&:active{
|
|
42
|
+
background: $color-orange-800;
|
|
43
|
+
}
|
|
44
|
+
&:disabled{
|
|
45
|
+
background: $color-secondary-light;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
&.button_neutral {
|
|
49
|
+
background: $color-neutral;
|
|
50
|
+
&:hover{
|
|
51
|
+
background: $color-neutral-dark;
|
|
52
|
+
}
|
|
53
|
+
&:active{
|
|
54
|
+
background: $color-gray-600;
|
|
55
|
+
}
|
|
56
|
+
&:disabled{
|
|
57
|
+
background: $color-secondary-light;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
&.button_black {
|
|
61
|
+
background: $color-gray-900;
|
|
62
|
+
&:hover{
|
|
63
|
+
background: $color-neutral-dark;
|
|
64
|
+
}
|
|
65
|
+
&:active{
|
|
66
|
+
background: $color-gray-600;
|
|
67
|
+
}
|
|
68
|
+
&:disabled{
|
|
69
|
+
background: $color-secondary-light;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
.button_outlined {
|
|
74
|
+
background: transparent;
|
|
75
|
+
&.button_primary{
|
|
76
|
+
|
|
77
|
+
color: $color-primary;
|
|
78
|
+
border-color: $color-primary;
|
|
79
|
+
background: transparent;
|
|
80
|
+
&:hover{
|
|
81
|
+
background: rgba($color-primary, 0.1);
|
|
82
|
+
}
|
|
83
|
+
&:active{
|
|
84
|
+
background: $color-blue-A100;
|
|
85
|
+
}
|
|
86
|
+
&:disabled{
|
|
87
|
+
color: $color-primary-light;
|
|
88
|
+
border-color: $color-primary-light;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
&.button_secondary {
|
|
92
|
+
border-color: $color-secondary;
|
|
93
|
+
color: $color-secondary;
|
|
94
|
+
&:hover{
|
|
95
|
+
background: rgba($color-secondary, 0.1);
|
|
96
|
+
}
|
|
97
|
+
&:active{
|
|
98
|
+
background: $color-orange-100;
|
|
99
|
+
}
|
|
100
|
+
&:disabled{
|
|
101
|
+
color: $color-primary-light;
|
|
102
|
+
border-color: $color-primary-light;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
&.button_neutral,
|
|
106
|
+
&.button_black {
|
|
107
|
+
border-color: $color-gray-900;
|
|
108
|
+
color: $color-gray-900;
|
|
109
|
+
&:hover{
|
|
110
|
+
background: rgba($color-neutral, 0.1);
|
|
111
|
+
}
|
|
112
|
+
&:active{
|
|
113
|
+
background: $color-gray-300;
|
|
114
|
+
}
|
|
115
|
+
&:disabled{
|
|
116
|
+
color: $color-neutral-light;
|
|
117
|
+
border-color: $color-neutral-light;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
.button_transparent {
|
|
122
|
+
background: transparent;
|
|
123
|
+
&.button_primary{
|
|
124
|
+
color: $color-primary;
|
|
125
|
+
background: transparent;
|
|
126
|
+
&:hover{
|
|
127
|
+
background: rgba($color-primary, 0.1);
|
|
128
|
+
}
|
|
129
|
+
&:active{
|
|
130
|
+
background: $color-blue-A100;
|
|
131
|
+
}
|
|
132
|
+
&:disabled{
|
|
133
|
+
color: $color-primary-light;
|
|
134
|
+
background: none;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
&.button_secondary {
|
|
138
|
+
color: $color-secondary;
|
|
139
|
+
&:hover{
|
|
140
|
+
background: rgba($color-secondary, 0.1);
|
|
141
|
+
}
|
|
142
|
+
&:active{
|
|
143
|
+
background: $color-orange-100;
|
|
144
|
+
}
|
|
145
|
+
&:disabled{
|
|
146
|
+
color: $color-primary-light;
|
|
147
|
+
background: none;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
&.button_neutral,
|
|
151
|
+
&.button_black {
|
|
152
|
+
color: $color-gray-900;
|
|
153
|
+
&:hover{
|
|
154
|
+
background: rgba($color-neutral, 0.1);
|
|
155
|
+
}
|
|
156
|
+
&:active{
|
|
157
|
+
background: $color-gray-300;
|
|
158
|
+
}
|
|
159
|
+
&:disabled{
|
|
160
|
+
color: $color-neutral-light;
|
|
161
|
+
background: none;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.button__adornment{
|
|
167
|
+
font-size: inherit;
|
|
168
|
+
}
|
|
169
|
+
.button__adornment_end{
|
|
170
|
+
margin-left: $size-step;
|
|
171
|
+
}
|
|
172
|
+
.button__adornment_start{
|
|
173
|
+
margin-right: $size-step;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.button_large{
|
|
177
|
+
height: $size-large;
|
|
178
|
+
font-size: 15px;
|
|
179
|
+
}
|
|
180
|
+
.button_medium{
|
|
181
|
+
height: $size-medium;
|
|
182
|
+
font-size: 14px;
|
|
183
|
+
}
|
|
184
|
+
.button_small{
|
|
185
|
+
height: $size-small;
|
|
186
|
+
font-size: 13px;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.button_icon{
|
|
190
|
+
padding: $size-step;
|
|
191
|
+
width: $size-elarge;
|
|
192
|
+
border-radius: 50%;
|
|
193
|
+
display: flex;
|
|
194
|
+
align-items: center;
|
|
195
|
+
justify-content: center;
|
|
196
|
+
font-size: 30px;
|
|
197
|
+
&.button_large{
|
|
198
|
+
width: $size-large;
|
|
199
|
+
font-size: 24px;
|
|
200
|
+
}
|
|
201
|
+
&.button_medium{
|
|
202
|
+
width: $size-medium;
|
|
203
|
+
font-size: 20px;
|
|
204
|
+
}
|
|
205
|
+
&.button_small{
|
|
206
|
+
width: $size-small;
|
|
207
|
+
padding: calc($size-step / 2);
|
|
208
|
+
font-size: 16px;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.button_group{
|
|
213
|
+
display: flex;
|
|
214
|
+
align-items: center;
|
|
215
|
+
}
|
|
216
|
+
.button_group_inline{
|
|
217
|
+
flex-direction: row;
|
|
218
|
+
}
|
|
219
|
+
.button_group_column{
|
|
220
|
+
flex-direction: column;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.button_grouped_inline{
|
|
224
|
+
border-radius: 0;
|
|
225
|
+
&:first-child{
|
|
226
|
+
border-top-left-radius: $radius;
|
|
227
|
+
border-bottom-left-radius: $radius;
|
|
228
|
+
}
|
|
229
|
+
&:last-child{
|
|
230
|
+
border-top-right-radius: $radius;
|
|
231
|
+
border-bottom-right-radius: $radius;
|
|
232
|
+
}
|
|
233
|
+
&.button_contained{
|
|
234
|
+
&.button_primary + *{
|
|
235
|
+
border-left-color: $color-info-dark;
|
|
236
|
+
}
|
|
237
|
+
&.button_secondary + *{
|
|
238
|
+
border-left-color: $color-primary-dark;
|
|
239
|
+
}
|
|
240
|
+
&.button_neutral + *{
|
|
241
|
+
border-left-color: $color-neutral-dark;
|
|
242
|
+
}
|
|
243
|
+
&.button_black + *{
|
|
244
|
+
border-left-color: $color-neutral-dark;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
&.button_outlined{
|
|
248
|
+
&.button_primary + *{
|
|
249
|
+
border-left-color: $color-info-dark;
|
|
250
|
+
}
|
|
251
|
+
&.button_primary:not(:last-child){
|
|
252
|
+
border-right: 0;
|
|
253
|
+
}
|
|
254
|
+
&.button_secondary + *{
|
|
255
|
+
border-left-color: $color-secondary;
|
|
256
|
+
}
|
|
257
|
+
&.button_secondary:not(:last-child){
|
|
258
|
+
border-right: 0;
|
|
259
|
+
}
|
|
260
|
+
&.button_neutral + *{
|
|
261
|
+
border-left-color: $color-neutral;
|
|
262
|
+
}
|
|
263
|
+
&.button_neutral:not(:last-child){
|
|
264
|
+
border-right: 0;
|
|
265
|
+
}
|
|
266
|
+
&.button_black + *{
|
|
267
|
+
border-left-color: $color-neutral;
|
|
268
|
+
}
|
|
269
|
+
&.button_black:not(:last-child){
|
|
270
|
+
border-right: 0;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
&.button_transparent{
|
|
274
|
+
&.button_primary + *{
|
|
275
|
+
border-left-color: $color-gray-200;
|
|
276
|
+
}
|
|
277
|
+
&.button_secondary + *{
|
|
278
|
+
border-left-color: $color-gray-200;
|
|
279
|
+
}
|
|
280
|
+
&.button_neutral + *{
|
|
281
|
+
border-left-color: $color-gray-200;
|
|
282
|
+
}
|
|
283
|
+
&.button_black + *{
|
|
284
|
+
border-left-color: $color-gray-200;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
.button_grouped_column{
|
|
289
|
+
border-radius: 0;
|
|
290
|
+
&:first-child{
|
|
291
|
+
border-top-left-radius: $radius;
|
|
292
|
+
border-top-right-radius: $radius;
|
|
293
|
+
}
|
|
294
|
+
&:last-child{
|
|
295
|
+
border-bottom-left-radius: $radius;
|
|
296
|
+
border-bottom-right-radius: $radius;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import css from './Button.module.scss';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
5
|
+
const ButtonGroup = props => {
|
|
6
|
+
let {
|
|
7
|
+
orientation = 'inline',
|
|
8
|
+
className,
|
|
9
|
+
children,
|
|
10
|
+
...restProps
|
|
11
|
+
} = props;
|
|
12
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
13
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
14
|
+
...restProps,
|
|
15
|
+
className: clsx(css.button_group, css['button_group_' + orientation], className),
|
|
16
|
+
children: children
|
|
17
|
+
})
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
export default ButtonGroup;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import Button from './Button';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import css from './Button.module.scss';
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
6
|
+
const ButtonIcon = props => {
|
|
7
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
8
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
9
|
+
...props,
|
|
10
|
+
className: clsx(css.button_icon, props.className),
|
|
11
|
+
children: props.children
|
|
12
|
+
})
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
export default ButtonIcon;
|