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
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Armtek UIKit
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
.material_icon {
|
|
4
|
+
font-family: 'Material Symbols Outlined';
|
|
5
|
+
font-weight: normal;
|
|
6
|
+
font-style: normal;
|
|
7
|
+
font-size: 24px;
|
|
8
|
+
line-height: 1;
|
|
9
|
+
letter-spacing: normal;
|
|
10
|
+
text-transform: none;
|
|
11
|
+
display: inline-block;
|
|
12
|
+
white-space: nowrap;
|
|
13
|
+
word-wrap: normal;
|
|
14
|
+
direction: ltr;
|
|
15
|
+
-webkit-font-feature-settings: 'liga';
|
|
16
|
+
-webkit-font-smoothing: antialiased;
|
|
17
|
+
&_solid {
|
|
18
|
+
font-weight: 700;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
@import url('https://fonts.googleapis.com/css?family=Roboto:wght@400;500;700&display=swap');
|
|
2
|
+
|
|
3
|
+
body{
|
|
4
|
+
font-family: 'Roboto';
|
|
5
|
+
}
|
|
6
|
+
::-webkit-scrollbar {
|
|
7
|
+
width: 4px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
::-webkit-scrollbar-track {
|
|
11
|
+
background: transparent;
|
|
12
|
+
}
|
|
13
|
+
::-webkit-scrollbar-thumb {
|
|
14
|
+
background-color: #DFE2E6;
|
|
15
|
+
border-radius: 0px;
|
|
16
|
+
}
|
|
17
|
+
* {
|
|
18
|
+
box-sizing: border-box;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@font-face {
|
|
22
|
+
font-family: 'Material Symbols Outlined';
|
|
23
|
+
font-style: normal;
|
|
24
|
+
font-weight: 400;
|
|
25
|
+
src: url(https://fonts.gstatic.com/s/materialsymbolsoutlined/v133/kJF1BvYX7BgnkSrUwT8OhrdQw4oELdPIeeII9v6oDMzByHX9rA6RzaxHMPdY43zj-jCxv3fzvRNU22ZXGJpEpjC_1v-p_4MrImHCIJIZrDCvHOej.woff2) format('woff2');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* fallback */
|
|
29
|
+
@font-face {
|
|
30
|
+
font-family: 'Material Symbols Outlined';
|
|
31
|
+
font-style: normal;
|
|
32
|
+
font-weight: 700;
|
|
33
|
+
src: url(https://fonts.gstatic.com/s/materialsymbolsoutlined/v134/kJF1BvYX7BgnkSrUwT8OhrdQw4oELdPIeeII9v6oDMzByHX9rA6RzazHD_dY43zj-jCxv3fzvRNU22ZXGJpEpjC_1p-p_4MrImHCIJIZrDBIG-ej.woff2) format('woff2');
|
|
34
|
+
}
|
|
35
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Alert from '../ui/Alert/Alert';
|
|
2
|
+
import Avatar from '../ui/Avatar/Avatar';
|
|
3
|
+
import AvatarGroup from '../ui/Avatar/AvatarGroup';
|
|
4
|
+
import Badge from '../ui/Badge/Badge';
|
|
5
|
+
import Button from '../ui/Button/Button';
|
|
6
|
+
import ButtonIcon from '../ui/Button/ButtonIcon';
|
|
7
|
+
import Card from '../ui/Card/Card';
|
|
8
|
+
import Chip from '../ui/Chip/Chip';
|
|
9
|
+
import ListItem from '../ui/List/ListItem';
|
|
10
|
+
import Loader from '../ui/Loader/Loader';
|
|
11
|
+
import Logo from '../ui/Logo/Logo';
|
|
12
|
+
import Slider from '../ui/Slider/Slider';
|
|
13
|
+
import Status from '../ui/Status/Status';
|
|
14
|
+
import Stepper from '../ui/Stepper/Stepper';
|
|
15
|
+
import Tooltip from '../ui/Tooltip/Tooltip';
|
|
16
|
+
export { Alert, Avatar, AvatarGroup, Badge, Button, ButtonIcon, Card, Chip, ListItem, Loader, Logo, Slider, Status, Stepper, Tooltip, };
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
//@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');
|
|
2
|
+
//@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200');
|
|
3
|
+
|
|
4
|
+
@import "fonts.scss";
|
|
5
|
+
|
|
6
|
+
$font-family: 'Roboto';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
$size-elarge: 56px;
|
|
10
|
+
$size-large: 42px;
|
|
11
|
+
$size-medium: 36px;
|
|
12
|
+
$size-small: 30px;
|
|
13
|
+
$size-step: 8px;
|
|
14
|
+
|
|
15
|
+
$radius: 4px;
|
|
16
|
+
|
|
17
|
+
$color-primary: #0D46FF;
|
|
18
|
+
$color-primary-dark: #0B3CD9;
|
|
19
|
+
$color-primary-light: #0B3CD9;
|
|
20
|
+
$color-blue-800: #406DFF;
|
|
21
|
+
$color-blue-A100: #D9E2FF;
|
|
22
|
+
$color-blue-50: #F2F5FF;
|
|
23
|
+
|
|
24
|
+
$color-info: #0D46FF;
|
|
25
|
+
$color-info-dark: #0B3CD9;
|
|
26
|
+
|
|
27
|
+
$color-secondary: #FF7F00;
|
|
28
|
+
$color-secondary-dark: #D96C00;
|
|
29
|
+
$color-secondary-light: #FFA140;
|
|
30
|
+
$color-orange-800: #FF9426;
|
|
31
|
+
$color-orange-400: #FFC68C;
|
|
32
|
+
$color-orange-300: #FFD3A6;
|
|
33
|
+
$color-orange-100: #FFE6CC;
|
|
34
|
+
$color-orange-50: #FFF8F0;
|
|
35
|
+
|
|
36
|
+
$color-neutral: #4D5359;
|
|
37
|
+
$color-neutral-dark: #40454A;
|
|
38
|
+
$color-neutral-light: #9AA4AE;
|
|
39
|
+
$color-gray-900: #212529;
|
|
40
|
+
$color-gray-800: #40454A;
|
|
41
|
+
$color-gray-700: #4D5359;
|
|
42
|
+
$color-gray-600: #6C757D;
|
|
43
|
+
$color-gray-500: #9AA4AE;
|
|
44
|
+
$color-gray-400: #B1BCC6;
|
|
45
|
+
$color-gray-300: #D3DAE1;
|
|
46
|
+
$color-gray-200: #DFE2E6;
|
|
47
|
+
$color-gray-100: #E9ECEF;
|
|
48
|
+
$color-gray-50: #F8F9FA;
|
|
49
|
+
|
|
50
|
+
$color-greent-50: #F2FFFB;
|
|
51
|
+
|
|
52
|
+
$color-success: #0BD998;
|
|
53
|
+
$color-success-dark: #08996B;
|
|
54
|
+
$color-error: #FF3342;
|
|
55
|
+
$color-error-dark: #CC2935;
|
|
56
|
+
$color-warning: #FFC61A;
|
|
57
|
+
$color-warning-dark: #F7B519;
|
|
58
|
+
|
|
59
|
+
$color-red-50: #FFF0F1;
|
|
60
|
+
|
|
61
|
+
$box-shadow: 0px 8px 10px 0px rgba(0, 0, 0, 0.1);
|
|
62
|
+
|
|
63
|
+
@mixin transition($time: 0.5s, $target: all, $animation: ease) {
|
|
64
|
+
transition: $time $target $animation;
|
|
65
|
+
}
|
|
66
|
+
@mixin flex($justifyContent: flex-start, $alignItems: center) {
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: $alignItems;
|
|
69
|
+
justify-content: $justifyContent;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
//@font-face {
|
|
74
|
+
// font-family: 'Material Symbols Outlined';
|
|
75
|
+
// font-style: normal;
|
|
76
|
+
// font-weight: 400;
|
|
77
|
+
// src: url(https://fonts.gstatic.com/s/materialsymbolsoutlined/v133/kJF1BvYX7BgnkSrUwT8OhrdQw4oELdPIeeII9v6oDMzByHX9rA6RzaxHMPdY43zj-jCxv3fzvRNU22ZXGJpEpjC_1v-p_4MrImHCIJIZrDCvHOej.woff2) format('woff2');
|
|
78
|
+
//}
|
|
79
|
+
|
|
80
|
+
//.material_icon {
|
|
81
|
+
// font-family: 'Material Symbols Outlined';
|
|
82
|
+
// font-weight: normal;
|
|
83
|
+
// font-style: normal;
|
|
84
|
+
// font-size: 24px;
|
|
85
|
+
// line-height: 1;
|
|
86
|
+
// letter-spacing: normal;
|
|
87
|
+
// text-transform: none;
|
|
88
|
+
// display: inline-block;
|
|
89
|
+
// white-space: nowrap;
|
|
90
|
+
// word-wrap: normal;
|
|
91
|
+
// direction: ltr;
|
|
92
|
+
// -webkit-font-feature-settings: 'liga';
|
|
93
|
+
// -webkit-font-smoothing: antialiased;
|
|
94
|
+
// &_filled{
|
|
95
|
+
// font-variation-settings:
|
|
96
|
+
// 'FILL' 1
|
|
97
|
+
// }
|
|
98
|
+
//}
|
|
99
|
+
// .material-symbols-outlined {
|
|
100
|
+
// font-variation-settings:
|
|
101
|
+
// 'FILL' 1,
|
|
102
|
+
// 'wght' 400,
|
|
103
|
+
// 'GRAD' 0,
|
|
104
|
+
// 'opsz' 24
|
|
105
|
+
// }
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
.text_error{
|
|
109
|
+
color: $color-error-dark;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.text_success{
|
|
113
|
+
color: $color-success;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
.adornmentContainer{
|
|
118
|
+
display: flex;
|
|
119
|
+
}
|
|
120
|
+
.adornmentContainer_end{
|
|
121
|
+
margin-left: auto;
|
|
122
|
+
}
|
|
123
|
+
.adornment_end{
|
|
124
|
+
& + * {
|
|
125
|
+
margin-left: $size-step;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
.adornment_start{
|
|
129
|
+
& + * {
|
|
130
|
+
margin-left: $size-step;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export { default as Button } from './ui/Button/Button';
|
|
2
|
+
export { default as ButtonIcon } from './ui/Button/ButtonIcon';
|
|
3
|
+
export type { ButtonProps } from './ui/Button/Button';
|
|
4
|
+
export { default as Alert } from './ui/Alert/Alert';
|
|
5
|
+
export type { AlertProps } from './ui/Alert/Alert';
|
|
6
|
+
export { default as Avatar } from './ui/Avatar/Avatar';
|
|
7
|
+
export type { AvatarProps } from './ui/Avatar/Avatar';
|
|
8
|
+
export { default as AvatarGroup } from './ui/Avatar/AvatarGroup';
|
|
9
|
+
export type { AvatarGroupProps } from './ui/Avatar/AvatarGroup';
|
|
10
|
+
export { default as Badge } from './ui/Badge/Badge';
|
|
11
|
+
export type { BadgeProps } from './ui/Badge/Badge';
|
|
12
|
+
export { default as Card } from './ui/Card/Card';
|
|
13
|
+
export type { CardProps } from './ui/Card/Card';
|
|
14
|
+
export { default as Chip } from './ui/Chip/Chip';
|
|
15
|
+
export type { ChipProps } from './ui/Chip/Chip';
|
|
16
|
+
export { default as ListItem } from './ui/List/ListItem';
|
|
17
|
+
export type { ListItemProps } from './ui/List/ListItem';
|
|
18
|
+
export { default as Loader } from './ui/Loader/Loader';
|
|
19
|
+
export type { LoaderProps } from './ui/Loader/Loader';
|
|
20
|
+
export { default as Logo } from './ui/Logo/Logo';
|
|
21
|
+
export type { LogoProps } from './ui/Logo/Logo';
|
|
22
|
+
export { default as Slider } from './ui/Slider/Slider';
|
|
23
|
+
export type { SliderProps } from './ui/Slider/Slider';
|
|
24
|
+
export { default as Status } from './ui/Status/Status';
|
|
25
|
+
export type { StatusProps } from './ui/Status/Status';
|
|
26
|
+
export { default as Stepper } from './ui/Stepper/Stepper';
|
|
27
|
+
export type { StepperProps } from './ui/Stepper/Stepper';
|
|
28
|
+
export { default as Tooltip } from './ui/Tooltip/Tooltip';
|
|
29
|
+
export type { TooltipProps } from './ui/Tooltip/Tooltip';
|
package/lib/cjs/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports.Tooltip = exports.Stepper = exports.Status = exports.Slider = exports.Logo = exports.Loader = exports.ListItem = exports.Chip = exports.Card = exports.ButtonIcon = exports.Button = exports.Badge = exports.AvatarGroup = exports.Avatar = exports.Alert = void 0;
|
|
6
|
+
var _Button = _interopRequireDefault(require("./ui/Button/Button"));
|
|
7
|
+
exports.Button = _Button.default;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports.default = void 0;
|
|
6
|
+
var _react = require("react");
|
|
7
|
+
const useClickOutside = callback => {
|
|
8
|
+
const ref = (0, _react.useRef)(null);
|
|
9
|
+
(0, _react.useEffect)(() => {
|
|
10
|
+
function handleClickOutside(event) {
|
|
11
|
+
if (ref.current && !ref.current.contains(event.target)) callback();
|
|
12
|
+
}
|
|
13
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
14
|
+
return () => {
|
|
15
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
16
|
+
};
|
|
17
|
+
}, [ref]);
|
|
18
|
+
return ref;
|
|
19
|
+
};
|
|
20
|
+
var _default = useClickOutside;
|
|
21
|
+
exports.default = _default;
|
|
22
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare class DateClass {
|
|
2
|
+
date: Date;
|
|
3
|
+
constructor(date: Date);
|
|
4
|
+
format(form: string): string;
|
|
5
|
+
static isValid(dateStr: string, format?: string): boolean;
|
|
6
|
+
static parseDate(dateStr: string, format?: string): Date | null;
|
|
7
|
+
static toDate(dateStr: string): Date | null;
|
|
8
|
+
static getDisplayValue(value: number): string;
|
|
9
|
+
private getStrMonth;
|
|
10
|
+
}
|
|
11
|
+
export declare const DateService: (date: Date) => DateClass;
|
|
12
|
+
export default DateClass;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = exports.DateService = void 0;
|
|
5
|
+
class DateClass {
|
|
6
|
+
constructor(date) {
|
|
7
|
+
this.date = date;
|
|
8
|
+
}
|
|
9
|
+
format(form) {
|
|
10
|
+
let strDate = form;
|
|
11
|
+
if (strDate.includes('DD')) strDate = strDate.replace('dd', DateClass.getDisplayValue(this.date.getDate()));
|
|
12
|
+
if (strDate.includes('MM')) strDate = strDate.replace('MM', this.getStrMonth());
|
|
13
|
+
if (strDate.includes('YYYY')) strDate = strDate.replace('yyyy', String(this.date.getFullYear()));
|
|
14
|
+
if (strDate.includes('HH')) strDate = strDate.replace('HH', DateClass.getDisplayValue(this.date.getHours()));
|
|
15
|
+
if (strDate.includes('mm')) strDate = strDate.replace('mm', DateClass.getDisplayValue(this.date.getMinutes()));
|
|
16
|
+
return strDate;
|
|
17
|
+
}
|
|
18
|
+
static isValid(dateStr, format) {
|
|
19
|
+
return !!this.parseDate(dateStr, format);
|
|
20
|
+
}
|
|
21
|
+
static parseDate(dateStr, format) {
|
|
22
|
+
let match = dateStr.match(/(\d{2})[.-/](\d{2})[.-/](\d{4})/);
|
|
23
|
+
if (match && match[1] && match[2] && match[3]) {
|
|
24
|
+
if (new Date(`${match[3]}-${match[2]}-${match[1]}`).getTime() === new Date(`${match[3]}-${match[2]}-${match[1]}`).getTime()) {
|
|
25
|
+
let result = new Date(`${match[3]}-${match[2]}-${match[1]}`);
|
|
26
|
+
result.setHours(1, 0, 0, 0);
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
static toDate(dateStr) {
|
|
33
|
+
return this.parseDate(dateStr);
|
|
34
|
+
}
|
|
35
|
+
static getDisplayValue(value) {
|
|
36
|
+
return value < 10 ? '0' + String(value) : String(value);
|
|
37
|
+
}
|
|
38
|
+
getStrMonth() {
|
|
39
|
+
let m = this.date.getMonth() + 1;
|
|
40
|
+
return DateClass.getDisplayValue(m);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const DateService = date => {
|
|
44
|
+
return new DateClass(date);
|
|
45
|
+
};
|
|
46
|
+
exports.DateService = DateService;
|
|
47
|
+
var _default = DateClass;
|
|
48
|
+
exports.default = _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type ShapeType = 'square' | 'circle';
|
|
2
|
+
export type SizeType = 'small' | 'medium' | 'large' | 'extraLarge';
|
|
3
|
+
export type VariantType = 'contained' | 'outlined' | 'transparent';
|
|
4
|
+
export type ColorStatusType = 'success' | 'error' | 'warning' | 'info';
|
|
5
|
+
export type ColorThemeType = 'black' | 'white';
|
|
6
|
+
export type ColorType = 'primary' | 'secondary' | 'neutral';
|
|
7
|
+
export type OptionType = {
|
|
8
|
+
text: string;
|
|
9
|
+
value?: string;
|
|
10
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ColorStatusType, ColorType, SizeType, VariantType } from '../types/theme';
|
|
2
|
+
export declare const getVariants: (except?: string[]) => Record<VariantType, string>;
|
|
3
|
+
export declare const getColors: () => Record<ColorType, string>;
|
|
4
|
+
export declare const getStatusColors: () => Record<ColorStatusType, string>;
|
|
5
|
+
export declare const getSizes: (except?: string[]) => Record<SizeType, string>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.getVariants = exports.getStatusColors = exports.getSizes = exports.getColors = void 0;
|
|
5
|
+
const getVariants = except => {
|
|
6
|
+
let variants = {
|
|
7
|
+
contained: 'Заливка',
|
|
8
|
+
outlined: 'С границами',
|
|
9
|
+
transparent: 'Прозрачный'
|
|
10
|
+
};
|
|
11
|
+
if (except) variants = filter(variants, except);
|
|
12
|
+
return variants;
|
|
13
|
+
};
|
|
14
|
+
exports.getVariants = getVariants;
|
|
15
|
+
const getColors = () => {
|
|
16
|
+
return {
|
|
17
|
+
primary: 'Основной',
|
|
18
|
+
secondary: 'Второстепенный',
|
|
19
|
+
neutral: 'Нейтральный'
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
exports.getColors = getColors;
|
|
23
|
+
const getStatusColors = () => {
|
|
24
|
+
return {
|
|
25
|
+
info: 'Инфо',
|
|
26
|
+
error: 'Ошибка',
|
|
27
|
+
success: 'Успех',
|
|
28
|
+
warning: 'Уведомление'
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
exports.getStatusColors = getStatusColors;
|
|
32
|
+
const getSizes = except => {
|
|
33
|
+
let sizes = {
|
|
34
|
+
small: 'Маленький',
|
|
35
|
+
medium: 'Средний',
|
|
36
|
+
large: 'Большой',
|
|
37
|
+
extraLarge: 'Огромный'
|
|
38
|
+
};
|
|
39
|
+
if (except) sizes = filter(sizes, except);
|
|
40
|
+
return sizes;
|
|
41
|
+
};
|
|
42
|
+
exports.getSizes = getSizes;
|
|
43
|
+
const filter = (obj, arr) => {
|
|
44
|
+
return Object.entries(obj).filter(item => !arr.includes(item[0])).reduce((prev, current) => {
|
|
45
|
+
prev[current[0]] = current[1];
|
|
46
|
+
return prev;
|
|
47
|
+
}, {});
|
|
48
|
+
};
|
|
@@ -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,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports.default = void 0;
|
|
6
|
+
var _ButtonModule = _interopRequireDefault(require("./Button.module.scss"));
|
|
7
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
8
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
+
_interopRequireDefault(require("./style.css"))
|
|
10
|
+
const Button = props => {
|
|
11
|
+
let {
|
|
12
|
+
size = 'extraLarge',
|
|
13
|
+
color = 'primary',
|
|
14
|
+
variant = 'contained',
|
|
15
|
+
endAdornment,
|
|
16
|
+
startAdornment,
|
|
17
|
+
children,
|
|
18
|
+
className,
|
|
19
|
+
group,
|
|
20
|
+
as,
|
|
21
|
+
...restProps
|
|
22
|
+
} = props;
|
|
23
|
+
let Component = as || 'button';
|
|
24
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
25
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(Component, {
|
|
26
|
+
...restProps,
|
|
27
|
+
className: (0, _clsx.default)('button', 'button_' + size, 'button_' + variant, 'button_' + color, className, {
|
|
28
|
+
['button_grouped_' + group]: group
|
|
29
|
+
}),
|
|
30
|
+
children: [startAdornment && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
31
|
+
className: (0, _clsx.default)('button__adornment', 'button__adornment_start'),
|
|
32
|
+
children: startAdornment
|
|
33
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
34
|
+
children: children
|
|
35
|
+
}), endAdornment && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
36
|
+
className: (0, _clsx.default)('button__adornment', 'button__adornment_end'),
|
|
37
|
+
children: endAdornment
|
|
38
|
+
})]
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
var _default = Button;
|
|
43
|
+
exports.default = _default;
|
|
44
|
+
module.exports = exports.default;
|