kamotive_ui 1.2.0 → 1.2.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.
Files changed (91) hide show
  1. package/dist/Icons/ChevronDown/ChevronDown10.d.ts +6 -0
  2. package/dist/Icons/ChevronDown/ChevronDown10.js +5 -0
  3. package/dist/Icons/ChevronUp/ChevronUp10.d.ts +6 -0
  4. package/dist/Icons/ChevronUp/ChevronUp10.js +5 -0
  5. package/dist/Icons/IconAccount/IconAccount10.d.ts +6 -0
  6. package/dist/Icons/IconAccount/IconAccount10.js +5 -0
  7. package/dist/Icons/IconAlarm/IconAlarm10.d.ts +6 -0
  8. package/dist/Icons/IconAlarm/IconAlarm10.js +5 -0
  9. package/dist/Icons/IconBank/IconBank10.d.ts +6 -0
  10. package/dist/Icons/IconBank/IconBank10.js +5 -0
  11. package/dist/Icons/IconBell/IconBell10.d.ts +6 -0
  12. package/dist/Icons/IconBell/IconBell10.js +5 -0
  13. package/dist/Icons/IconBriefcase/IconBriefcase10.d.ts +6 -0
  14. package/dist/Icons/IconBriefcase/IconBriefcase10.js +5 -0
  15. package/dist/Icons/IconCalendar/IconCalendar10.d.ts +6 -0
  16. package/dist/Icons/IconCalendar/IconCalendar10.js +5 -0
  17. package/dist/Icons/IconCheck/IconCheck10.d.ts +6 -0
  18. package/dist/Icons/IconCheck/IconCheck10.js +5 -0
  19. package/dist/Icons/IconClose/IconClose10.d.ts +6 -0
  20. package/dist/Icons/IconClose/IconClose10.js +5 -0
  21. package/dist/Icons/IconColorPicker/IconColorPicker10.d.ts +7 -0
  22. package/dist/Icons/IconColorPicker/IconColorPicker10.js +5 -0
  23. package/dist/Icons/IconError/IconError10.d.ts +6 -0
  24. package/dist/Icons/IconError/IconError10.js +5 -0
  25. package/dist/Icons/IconEyeOff/IconEyeOff10.d.ts +6 -0
  26. package/dist/Icons/IconEyeOff/IconEyeOff10.js +5 -0
  27. package/dist/Icons/IconInfo/IconInfo10.d.ts +6 -0
  28. package/dist/Icons/IconInfo/IconInfo10.js +5 -0
  29. package/dist/Icons/IconSuccess/IconSuccess10.d.ts +6 -0
  30. package/dist/Icons/IconSuccess/IconSuccess10.js +5 -0
  31. package/dist/Icons/IconWarning/IconWarning10.d.ts +6 -0
  32. package/dist/Icons/IconWarning/IconWarning10.js +5 -0
  33. package/dist/Icons/index.d.ts +16 -0
  34. package/dist/Icons/index.js +16 -0
  35. package/dist/Intro/Welcome.d.ts +2 -0
  36. package/dist/Intro/Welcome.js +7 -0
  37. package/dist/Intro/Welcome.module.css +19 -0
  38. package/dist/colors.css +78 -0
  39. package/dist/components/Button/Button.d.ts +6 -0
  40. package/dist/components/Button/Button.js +49 -0
  41. package/dist/components/Button/Button.module.css +343 -0
  42. package/dist/components/Checkbox/Checkbox.d.ts +3 -0
  43. package/dist/components/Checkbox/Checkbox.js +13 -0
  44. package/dist/components/Checkbox/Checkbox.module.css +78 -0
  45. package/dist/components/ColorPicker/ColorPicker.d.ts +7 -0
  46. package/dist/components/ColorPicker/ColorPicker.js +115 -0
  47. package/dist/components/ColorPicker/ColorPicker.module.css +266 -0
  48. package/dist/components/Dropdown/Dropdown.d.ts +14 -0
  49. package/dist/components/Dropdown/Dropdown.js +114 -0
  50. package/dist/components/Dropdown/Dropdown.module.css +207 -0
  51. package/dist/components/Input/Input.d.ts +6 -0
  52. package/dist/components/Input/Input.js +37 -0
  53. package/dist/components/Input/Input.module.css +176 -0
  54. package/dist/components/ProgressBar/ProgressBar.d.ts +6 -0
  55. package/dist/components/ProgressBar/ProgressBar.js +41 -0
  56. package/dist/components/ProgressBar/ProgressBar.module.css +56 -0
  57. package/dist/components/ProgressLoader/ProgressLoader.d.ts +3 -0
  58. package/dist/components/ProgressLoader/ProgressLoader.js +71 -0
  59. package/dist/components/ProgressLoader/ProgressLoader.module.css +26 -0
  60. package/dist/components/RadioButton/RadioButton.d.ts +3 -0
  61. package/dist/components/RadioButton/RadioButton.js +13 -0
  62. package/dist/components/RadioButton/RadioButton.module.css +80 -0
  63. package/dist/components/SettingTag/SettingTag.d.ts +3 -0
  64. package/dist/components/SettingTag/SettingTag.js +15 -0
  65. package/dist/components/SettingTag/SettingTag.module.css +16 -0
  66. package/dist/components/Snackbar/Snackbar.d.ts +26 -0
  67. package/dist/components/Snackbar/Snackbar.js +55 -0
  68. package/dist/components/Snackbar/Snackbar.module.css +61 -0
  69. package/dist/components/Snackbar/enums.d.ts +9 -0
  70. package/dist/components/Snackbar/enums.js +10 -0
  71. package/dist/components/Tab/Tab.d.ts +3 -0
  72. package/dist/components/Tab/Tab.js +14 -0
  73. package/dist/components/Tab/Tab.module.css +45 -0
  74. package/dist/components/Tabs/Tabs.d.ts +3 -0
  75. package/dist/components/Tabs/Tabs.js +19 -0
  76. package/dist/components/Tabs/Tabs.module.css +55 -0
  77. package/dist/components/Tag/Tag.d.ts +3 -0
  78. package/dist/components/Tag/Tag.js +23 -0
  79. package/dist/components/Tag/Tag.module.css +145 -0
  80. package/dist/components/ToggleButton/ToggleButton.d.ts +3 -0
  81. package/dist/components/ToggleButton/ToggleButton.js +13 -0
  82. package/dist/components/ToggleButton/ToggleButton.module.css +75 -0
  83. package/dist/components/Typography/Typography.d.ts +6 -0
  84. package/dist/components/Typography/Typography.js +25 -0
  85. package/dist/components/Typography/Typography.module.css +264 -0
  86. package/dist/components/Typography/enums.d.ts +24 -0
  87. package/dist/components/Typography/enums.js +25 -0
  88. package/dist/fonts.css +35 -0
  89. package/dist/index.d.ts +16 -0
  90. package/dist/index.js +16 -0
  91. package/package.json +1 -1
@@ -0,0 +1,176 @@
1
+ .story--wrapper-iput {
2
+ background-color: var(--white);
3
+ padding: 30px;
4
+ border-radius: 10px;
5
+ width: 900px;
6
+ }
7
+
8
+ .wrapper {
9
+ font-family: 'Raleway';
10
+ font-style: normal;
11
+ /* font-weight: 400; */
12
+ position: relative;
13
+ }
14
+ .wrapper--left {
15
+ display: flex;
16
+ flex-direction: row;
17
+ gap: 20px;
18
+ align-items: center;
19
+ }
20
+
21
+ .wrapper--input {
22
+ position: relative;
23
+ }
24
+ .inputText {
25
+ font-family: 'Raleway';
26
+ font-style: normal;
27
+ font-weight: 400;
28
+ position: relative;
29
+ font-size: 12px;
30
+ line-height: 14px;
31
+ color: var(--text-dark);
32
+ width: 203px;
33
+ /* width: 20%; */
34
+ padding: 10px;
35
+ outline: none;
36
+ border: 1px solid var(--grey-light);
37
+ border-radius: 10px;
38
+ /* width: fit-content; */
39
+ }
40
+ /* Стили при наведении мыши */
41
+ .input:hover {
42
+ border: 1px solid #0d9aff00;
43
+ box-shadow: 0px 0px 2px var(--blue-main);
44
+ }
45
+
46
+ /* Стили при клике */
47
+ .input:focus,
48
+ .input:active {
49
+ border-color: var(--blue-main);
50
+ box-shadow: none;
51
+ color: var(--text-dark);
52
+ /* box-shadow: 0 0 2px var(--blue-main); */
53
+ }
54
+
55
+ .textarea {
56
+ min-height: 90px;
57
+ display: inline-block;
58
+ overflow: auto;
59
+ resize: none;
60
+ padding: 8px 16px;
61
+ }
62
+ .resize {
63
+ resize: both;
64
+ }
65
+ .inputText.lg {
66
+ height: 40px;
67
+ /* height: 25px; */
68
+ }
69
+ .inputText.md {
70
+ height: 35px;
71
+ /* height: 20px; */
72
+ }
73
+ .inputText.sm {
74
+ /* height: 30px; */
75
+ height: 25px;
76
+ }
77
+
78
+ .filled {
79
+ border-color: var(--blue-main);
80
+ box-shadow: none;
81
+ color: var(--text-dark);
82
+ }
83
+
84
+ /* Стили для placeholder */
85
+ .input::placeholder {
86
+ color: var(--text-grey);
87
+ font-size: 12px;
88
+ line-height: 14px;
89
+ }
90
+ .input:focus::placeholder {
91
+ color: var(--text-light);
92
+ }
93
+
94
+ .label {
95
+ line-height: 14px;
96
+ font-weight: 400;
97
+ transition: 0.3ms ease-out;
98
+ /* color: var(--text-grey); */
99
+ }
100
+ .label--default {
101
+ font-size: 12px;
102
+ position: absolute;
103
+ top: -20px;
104
+ cursor: text;
105
+ white-space: nowrap;
106
+ overflow: hidden;
107
+ text-overflow: ellipsis;
108
+ max-width: calc(100% - 32px);
109
+ color: var(--text-grey);
110
+ }
111
+ .label--left {
112
+ font-size: 13px;
113
+ color: var(--text-dark);
114
+ }
115
+
116
+ /* Стили для input с ошибкой */
117
+ .input--error {
118
+ border-color: var(--error-main);
119
+ color: var(--error-main);
120
+ }
121
+ .input--error:hover,
122
+ .input--error:focus {
123
+ border-color: var(--error-secondary);
124
+ box-shadow: none;
125
+ color: var(--error-secondary);
126
+ }
127
+
128
+ .helperText {
129
+ font-size: 12px;
130
+ line-height: 14px;
131
+ position: absolute;
132
+ left: 0px;
133
+ /* top: 110%; */
134
+ bottom: -20px;
135
+ cursor: text;
136
+ transition: 0.3ms ease-out;
137
+ max-width: calc(100% - 32px);
138
+ white-space: nowrap;
139
+ overflow: hidden;
140
+ text-overflow: ellipsis;
141
+ color: var(--error-main);
142
+ }
143
+
144
+ /* Стили для disabled */
145
+ .input:disabled {
146
+ background-color: rgba(120, 120, 128, 0.08);
147
+ color: var(--text-grey);
148
+ cursor: not-allowed;
149
+ border: none;
150
+ box-shadow: none;
151
+ }
152
+
153
+ /* Стили для Read Only */
154
+ .readOnly {
155
+ background-color: rgba(120, 120, 128, 0.08);
156
+ color: var(--text-dark);
157
+ border: none;
158
+ }
159
+ .readOnly:hover {
160
+ box-shadow: none;
161
+ border: none;
162
+ }
163
+
164
+ /* Стили для Иконок */
165
+ .input--withIcon {
166
+ padding-left: 35px;
167
+ top: 5%;
168
+ }
169
+
170
+ .icon {
171
+ position: absolute;
172
+ z-index: 1;
173
+ top: 25%;;
174
+ left: 10px;
175
+ }
176
+
@@ -0,0 +1,6 @@
1
+ import { FC } from 'react';
2
+ import { ProgressBarProps } from 'kamotive_ui';
3
+ /**
4
+ * Компонент ProgressBar отображает прогресс в виде заполненной полосы.
5
+ */
6
+ export declare const ProgressBar: FC<ProgressBarProps>;
@@ -0,0 +1,41 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { Typography } from '../Typography/Typography';
3
+ import styles from './ProgressBar.module.css';
4
+ import classNames from 'classnames';
5
+ /**
6
+ * Компонент ProgressBar отображает прогресс в виде заполненной полосы.
7
+ */
8
+ export const ProgressBar = ({ value = 0, max = 100, size = 'md', showValue = true, animated = false, }) => {
9
+ const [percent, setPercent] = useState(value);
10
+ const validPercentage = Math.min(Math.max(value, 0), max);
11
+ const progressBarClasses = classNames(styles['progress-bar'], size, {
12
+ 'progress-bar--animated': animated,
13
+ 'progress-bar--static': !animated,
14
+ });
15
+ useEffect(() => {
16
+ if (animated) {
17
+ const targetPercent = validPercentage;
18
+ const animationDuration = 8000; // Длительность анимации в миллисекундах
19
+ const stepTime = 100; // Интервал обновления в миллисекундах
20
+ const totalSteps = animationDuration / stepTime;
21
+ const increment = targetPercent / totalSteps;
22
+ let currentPercent = 0;
23
+ const intervalId = setInterval(() => {
24
+ currentPercent = Math.min(currentPercent + increment, targetPercent);
25
+ setPercent(Math.round(currentPercent));
26
+ if (currentPercent >= targetPercent) {
27
+ clearInterval(intervalId);
28
+ }
29
+ }, stepTime);
30
+ return () => clearInterval(intervalId);
31
+ }
32
+ else {
33
+ setPercent(validPercentage);
34
+ }
35
+ }, [animated, validPercentage]);
36
+ return (React.createElement("div", { className: styles["progress-bar--wrapper"] },
37
+ React.createElement("progress", { id: "linear-progress", className: progressBarClasses, value: percent, max: max }),
38
+ React.createElement("label", { htmlFor: "progress", className: styles["progress-bar-percentage"] }, showValue && (React.createElement(Typography, { variant: "Subheading3", color: '#9CA0A7', style: { fontWeight: '300' }, className: styles["progress-bar-percentage"] },
39
+ percent,
40
+ "%")))));
41
+ };
@@ -0,0 +1,56 @@
1
+ .story--wrapper-progressbar {
2
+ background-color: var(--white);
3
+ padding: 30px;
4
+ border-radius: 10px;
5
+ width: 900px;
6
+ }
7
+ .progress-bar--default-story {
8
+ display: flex;
9
+ flex-direction: column;
10
+ gap: 30px;
11
+ }
12
+ .progress-bar--wrapper {
13
+ display: flex;
14
+ gap: 40px;
15
+ }
16
+
17
+ .progress-bar {
18
+ border: none;
19
+ border-radius: 11px;
20
+ width: 330px;
21
+ }
22
+ .progress-bar.sm {
23
+ /* width: 20px; */
24
+ height: 4px;
25
+ }
26
+ .progress-bar.md {
27
+ /* width: 25vw; */
28
+ height: 6px;
29
+ }
30
+ .progress-bar.lg {
31
+ /* width: 30vw; */
32
+ height: 8px;
33
+ }
34
+
35
+ .progress-bar::-webkit-progress-bar {
36
+ background-color: var(--grey-light);
37
+ border-radius: 11px;
38
+ }
39
+ .progress-bar::-webkit-progress-value {
40
+ background-color: var(--blue-main);
41
+ border-radius: 11px;
42
+ }
43
+
44
+ .progress-bar--animated {
45
+ transition: all 8s ease-in-out;
46
+ }
47
+ .progress-bar--static {
48
+ transition: none;
49
+ }
50
+ .progress-bar-percentage {
51
+ /* position: absolute; */
52
+ /* top: 50%; */
53
+ left: 50%;
54
+ transform: translate(-50%, -50%);
55
+ }
56
+
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { ProgressLoaderProps } from 'kamotive_ui';
3
+ export declare const ProgressLoader: FC<ProgressLoaderProps>;
@@ -0,0 +1,71 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { Typography } from '../Typography/Typography';
3
+ import styles from './ProgressLoader.module.css';
4
+ import classNames from 'classnames';
5
+ /**
6
+ * Компонент ProgressLoader отображает прогресс загрузки.
7
+ */
8
+ const spinnerSizes = { xl: 89, lg: 56, md: 40, sm: 34 };
9
+ const animationDuration = 4000; // Длительность анимации в миллисекундах
10
+ const stepTime = 100; // Интервал обновления в миллисекундах
11
+ export const ProgressLoader = ({ value = 0, size = 'xl', showValue = true, animated = false, }) => {
12
+ const [percent, setPercent] = useState(value);
13
+ const spinnerSize = typeof size === 'string' ? spinnerSizes[size] : size;
14
+ const validPercentage = Math.min(Math.max(value, 0), 100);
15
+ const fillPercentage = validPercentage / 100;
16
+ // Константы и расчеты для SVG
17
+ const viewBoxSize = 100;
18
+ const desiredStrokeWidth = size === 'xl' || size === 'lg' ? 5 : 4; // Желаемая толщина линии в пикселях
19
+ const strokeWidth = (desiredStrokeWidth * viewBoxSize) / spinnerSize;
20
+ const radius = (viewBoxSize - strokeWidth) / 2;
21
+ const center = viewBoxSize / 2;
22
+ //const fillPercentage = Math.min(1, Math.max(0, value / 100));
23
+ const circumference = 2 * Math.PI * radius;
24
+ const dashArray = circumference;
25
+ const dashOffset = circumference * (1 - fillPercentage);
26
+ const progressLoaderWrapperClasses = classNames(styles['progress-loader-wrapper'], size);
27
+ const getTypographySize = () => {
28
+ switch (size) {
29
+ case 'md':
30
+ return '12px';
31
+ case 'lg':
32
+ return '16px';
33
+ case 'xl':
34
+ return '24px';
35
+ }
36
+ };
37
+ useEffect(() => {
38
+ if (animated) {
39
+ const targetPercent = validPercentage;
40
+ const totalSteps = animationDuration / stepTime;
41
+ const increment = targetPercent / totalSteps;
42
+ let currentPercent = 0;
43
+ const intervalId = setInterval(() => {
44
+ currentPercent = Math.min(currentPercent + increment, targetPercent);
45
+ setPercent(Math.round(currentPercent));
46
+ if (currentPercent >= targetPercent) {
47
+ clearInterval(intervalId);
48
+ }
49
+ }, stepTime);
50
+ return () => clearInterval(intervalId);
51
+ }
52
+ else {
53
+ setPercent(validPercentage);
54
+ }
55
+ }, [animated, validPercentage]);
56
+ return (React.createElement("div", { className: progressLoaderWrapperClasses, style: { width: spinnerSize, height: spinnerSize } },
57
+ React.createElement("svg", { id: "svg1", viewBox: `0 0 ${viewBoxSize} ${viewBoxSize}`, className: styles["progress-loader"] },
58
+ React.createElement("circle", { cx: center, cy: center, r: radius, stroke: "#e5e5ea", strokeWidth: strokeWidth, fill: "none", style: { strokeLinecap: 'round' } }),
59
+ React.createElement("circle", { cx: center, cy: center, r: radius, stroke: 'var(--blue-main)', strokeWidth: strokeWidth, fill: "none", style: {
60
+ strokeDasharray: `${dashArray}`,
61
+ strokeDashoffset: `${dashOffset}`,
62
+ strokeLinecap: 'round',
63
+ transform: 'rotate(-90deg)',
64
+ transformOrigin: '50% 50%',
65
+ //transition: animated ? 'stroke-dashoffset 0.5s ease-in-out' : 'none',
66
+ } }, animated && (React.createElement("animate", { attributeName: "stroke-dashoffset", dur: `${animationDuration / 1000}`, values: `${circumference}; ${percent / 100}`, fill: "freeze" })))),
67
+ showValue && size !== 'sm' && (React.createElement("div", { className: styles["progress-percentage"] },
68
+ React.createElement(Typography, { variant: "Subheading2", color: '#9CA0A7', style: { fontSize: getTypographySize(), fontWeight: '300' }, className: styles["progress-percentage"] },
69
+ percent,
70
+ "%")))));
71
+ };
@@ -0,0 +1,26 @@
1
+ .story--wrapper-progress-loader {
2
+ background-color: var(--white);
3
+ padding: 30px;
4
+ border-radius: 10px;
5
+ width: 900px;
6
+ }
7
+ .progress-loader-wrapper {
8
+ display: flex;
9
+ align-items: center;
10
+ justify-content: center;
11
+ position: relative;
12
+ }
13
+ .progress-loader--default-story {
14
+ display: flex;
15
+ gap: 30px;
16
+ }
17
+ .progress-loader {
18
+ width: 100px;
19
+ height: 100px;
20
+ }
21
+ .progress-percentage {
22
+ position: absolute;
23
+ /* top: 50%; */
24
+ left: 50%;
25
+ transform: translate(-50%, -50%);
26
+ }
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { RadioProps } from 'kamotive_ui';
3
+ export declare const RadioButton: FC<RadioProps>;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import styles from './RadioButton.module.css';
3
+ import classNames from 'classnames';
4
+ export const RadioButton = ({ value, label, checked, onChange, disabled = false, size = 'sm' }) => {
5
+ const handleChange = (e) => {
6
+ if (onChange) {
7
+ onChange(e);
8
+ }
9
+ };
10
+ return (React.createElement("label", { className: styles["radio"] },
11
+ React.createElement("input", { type: "radio", checked: checked, value: value, onChange: handleChange, disabled: disabled, className: classNames(styles['input'], size) }),
12
+ label));
13
+ };
@@ -0,0 +1,80 @@
1
+ .story--wrapper-radio {
2
+ background-color: var(--white);
3
+ padding: 30px;
4
+ border-radius: 10px;
5
+ }
6
+
7
+ .radio {
8
+ display: flex;
9
+ align-items: center;
10
+ justify-content: left;
11
+ gap: 5px;
12
+
13
+ font-family: 'Raleway';
14
+ font-style: normal;
15
+ font-weight: 400;
16
+ font-size: 14px;
17
+ line-height: 16px;
18
+ color: var(--text-dark);
19
+ }
20
+
21
+ .radio.sm {
22
+ width: 12px;
23
+ height: 12px;
24
+ }
25
+
26
+ .radio.md {
27
+ width: 16px;
28
+ height: 16px;
29
+ }
30
+
31
+ .input[type="radio"] {
32
+ -webkit-appearance: none;
33
+ appearance: none;
34
+ display: inline-block;
35
+ padding: 6px;
36
+
37
+ border: 1px solid var(--icons-active);
38
+ border-radius: 50%;
39
+ background-color: var(--white);
40
+ background-clip: content-box;
41
+ position: relative;
42
+ cursor: pointer;
43
+ margin: 0px;
44
+ }
45
+
46
+ .input[type="radio"]:hover,
47
+ .input[type="radio"]:checked:hover {
48
+ border-color: var(--blue-main);
49
+ }
50
+
51
+ .input[type="radio"]:checked:hover::after {
52
+ background-color: var(--blue-main);
53
+ }
54
+
55
+ .input[type="radio"]:checked {
56
+ border-color: var(--icons-medium);
57
+ }
58
+
59
+ /* Круг*/
60
+ .input[type="radio"]:checked::after {
61
+ content: '';
62
+ position: absolute;
63
+ left: 50%;
64
+ top: 50%;
65
+ transform: translate(-50%, -50%);
66
+ width: 50%;
67
+ height: 50%;
68
+ border-radius: 50%;
69
+ background-color: var(--icons-medium);
70
+ }
71
+
72
+ .input[type="radio"]:disabled,
73
+ .input[type="radio"]:disabled:checked {
74
+ border-color: var(--icons-light);
75
+ cursor: not-allowed;
76
+ box-shadow: none;
77
+ }
78
+ .input[type="radio"]:disabled:checked:after {
79
+ background-color: var(--icons-light);
80
+ }
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { SettingTagProps } from 'kamotive_ui';
3
+ export declare const SettingTag: React.FC<SettingTagProps>;
@@ -0,0 +1,15 @@
1
+ import React, { useState } from 'react';
2
+ import { Tag } from '../Tag/Tag';
3
+ import ColorPicker from '../ColorPicker/ColorPicker';
4
+ import styles from './SettingTag.module.css';
5
+ export const SettingTag = ({ label, color, onChange }) => {
6
+ const [isHovered, setIsHovered] = useState(false);
7
+ const colorsOptions = ['red', 'orange', 'yellow', 'green', 'purple', 'indigo', 'blue', 'teal', 'pink'];
8
+ return (React.createElement("div", { style: { display: 'flex', gap: '10px', flexDirection: 'row', alignItems: 'center' } },
9
+ React.createElement(Tag, { label: label, color: color }),
10
+ !isHovered ? (React.createElement("div", { className: styles['circle'], onMouseEnter: () => setIsHovered(true), style: {
11
+ width: 10,
12
+ height: 10,
13
+ backgroundColor: (color === null || color === void 0 ? void 0 : color.startsWith('#')) ? color : `var(--${color})`,
14
+ } })) : (React.createElement(ColorPicker, { mainColor: color, onChange: onChange, recentColors: isHovered ? colorsOptions : [], setIsHovered: setIsHovered }))));
15
+ };
@@ -0,0 +1,16 @@
1
+ .story--wrapper-tag {
2
+ background-color: var(--white);
3
+ padding: 30px;
4
+ border-radius: 10px;
5
+ width: 300px;
6
+ height: 300px;
7
+ }
8
+
9
+
10
+ .circle {
11
+ border-radius: 50%;
12
+ cursor: pointer;
13
+ transition: transform 0.2s ease;
14
+ position: relative;
15
+ }
16
+
@@ -0,0 +1,26 @@
1
+ import React, { FC } from 'react';
2
+ import { SnackbarProps } from 'kamotive_ui';
3
+ /**
4
+ * @description Snackbar компонент для отображения всплывающих уведомлений
5
+ * @component
6
+ @param {ReactNode} children - Содержимое уведомления
7
+ @param {'success' | 'error' | 'warning' | 'info'} type - Тип уведомления, определяющий его стиль и иконку
8
+ @param {number} duration - Время в миллисекундах, через которое уведомление исчезнет (по умолчанию 10000)
9
+ @param {boolean} icon - Флаг отображения иконки (по умолчанию true)
10
+ @param {() => void} onClose - Callback функция, вызываемая при закрытии уведомления
11
+ @example
12
+ Операция выполнена успешно
13
+ @returns {JSX.Element | null} Возвращает компонент уведомления или null если оно скрыто */
14
+ export declare const icons: {
15
+ success: React.JSX.Element;
16
+ error: React.JSX.Element;
17
+ warning: React.JSX.Element;
18
+ info: React.JSX.Element;
19
+ };
20
+ export declare const title: {
21
+ success: string;
22
+ error: string;
23
+ warning: string;
24
+ info: string;
25
+ };
26
+ export declare const Snackbar: FC<SnackbarProps>;
@@ -0,0 +1,55 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { IconClose10, IconError10, IconInfo10, IconSuccess10, IconWarning10 } from '../../Icons';
3
+ import { Typography } from '../Typography/Typography';
4
+ import styles from './Snackbar.module.css';
5
+ import classNames from 'classnames';
6
+ /**
7
+ * @description Snackbar компонент для отображения всплывающих уведомлений
8
+ * @component
9
+ @param {ReactNode} children - Содержимое уведомления
10
+ @param {'success' | 'error' | 'warning' | 'info'} type - Тип уведомления, определяющий его стиль и иконку
11
+ @param {number} duration - Время в миллисекундах, через которое уведомление исчезнет (по умолчанию 10000)
12
+ @param {boolean} icon - Флаг отображения иконки (по умолчанию true)
13
+ @param {() => void} onClose - Callback функция, вызываемая при закрытии уведомления
14
+ @example
15
+ Операция выполнена успешно
16
+ @returns {JSX.Element | null} Возвращает компонент уведомления или null если оно скрыто */
17
+ export const icons = {
18
+ success: React.createElement(IconSuccess10, { htmlColor: "#34c759" }),
19
+ error: React.createElement(IconError10, { htmlColor: "#ff3b30" }),
20
+ warning: React.createElement(IconWarning10, { htmlColor: "#ff9500" }),
21
+ info: React.createElement(IconInfo10, { htmlColor: "#6F6F6F" }),
22
+ };
23
+ export const title = {
24
+ success: 'Успешно',
25
+ error: 'Ошибка',
26
+ warning: 'Внимание',
27
+ info: 'Информация',
28
+ };
29
+ export const Snackbar = ({ children, type, duration = 10000, icon = true, onClose }) => {
30
+ const [isVisible, setIsVisible] = useState(true);
31
+ useEffect(() => {
32
+ if (duration > 0) {
33
+ const timer = setTimeout(() => {
34
+ setIsVisible(false);
35
+ onClose === null || onClose === void 0 ? void 0 : onClose();
36
+ }, duration);
37
+ return () => clearTimeout(timer);
38
+ }
39
+ }, [duration, onClose]);
40
+ const handleClose = () => {
41
+ setIsVisible(false);
42
+ onClose === null || onClose === void 0 ? void 0 : onClose();
43
+ };
44
+ if (!isVisible)
45
+ return null;
46
+ const snackbarClasses = classNames(styles['snackbar-wrapper'], type ? `snackbar--${type}` : '');
47
+ return (React.createElement("div", { className: snackbarClasses },
48
+ React.createElement("div", { className: styles['snackbar-textAndIcon'] },
49
+ icon && icons[type],
50
+ React.createElement("div", { className: styles['snackbar-text'] },
51
+ React.createElement(Typography, { variant: "Body2-Medium", color: 'var(--text-dark)' }, title[type]),
52
+ React.createElement(Typography, { variant: "Caption", color: 'var(--text-btn-light)' }, children))),
53
+ React.createElement("button", { className: styles['button'], onClick: handleClose },
54
+ React.createElement(IconClose10, { htmlColor: 'var(--text-btn-light)' }))));
55
+ };
@@ -0,0 +1,61 @@
1
+ .story--wrapper-snackbar {
2
+ background-color: var(--white);
3
+ padding: 30px;
4
+ border-radius: 10px;
5
+ width: 300px;
6
+ height: 300px;
7
+ }
8
+ .snackbar-wrapper {
9
+ display: flex;
10
+ justify-content: space-between;
11
+ align-items: flex-start;
12
+ padding: 10px 25px;
13
+ gap: 20px;
14
+ box-sizing: border-box;
15
+ position: relative;
16
+ min-width: 340px;
17
+ max-width: 500px;
18
+
19
+ border-radius: 15px;
20
+ box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);
21
+ min-height: 48px;
22
+ }
23
+ .snackbar-textAndIcon {
24
+ gap: 10px;
25
+ display: grid;
26
+ grid-template-columns: auto 1fr;
27
+ }
28
+ .snackbar-textAndIcon svg {
29
+ padding-top: 5px;
30
+ }
31
+ .snackbar-text {
32
+ display: flex;
33
+ flex-direction: column;
34
+ width: 100%;
35
+ }
36
+ .snackbar--success {
37
+ background-color: rgba(52, 199, 89, 0.15);
38
+ }
39
+ .snackbar--error {
40
+ background-color: rgba(255, 59, 48, 0.15);
41
+ }
42
+ .snackbar--warning {
43
+ background-color: rgba(255, 204, 0, 0.15);
44
+ }
45
+ .snackbar--info {
46
+ background-color: var(--white);
47
+ border: 1px solid #f2f2f7;
48
+ }
49
+ .button {
50
+ border: none;
51
+ background-color: transparent;
52
+ display: flex;
53
+ justify-content: end;
54
+ align-items: center;
55
+ padding: 5px;
56
+ margin-top: 3px;
57
+ }
58
+ .button:hover {
59
+ background: rgba(130, 130, 134, 0.15);
60
+ border-radius: 2px;
61
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @type {enum} ESnackbarTypes
3
+ */
4
+ export declare enum ESnackbarTypes {
5
+ success = "success",
6
+ error = "error",
7
+ warning = "warning",
8
+ info = "info"
9
+ }