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.
- package/dist/Icons/ChevronDown/ChevronDown10.d.ts +6 -0
- package/dist/Icons/ChevronDown/ChevronDown10.js +5 -0
- package/dist/Icons/ChevronUp/ChevronUp10.d.ts +6 -0
- package/dist/Icons/ChevronUp/ChevronUp10.js +5 -0
- package/dist/Icons/IconAccount/IconAccount10.d.ts +6 -0
- package/dist/Icons/IconAccount/IconAccount10.js +5 -0
- package/dist/Icons/IconAlarm/IconAlarm10.d.ts +6 -0
- package/dist/Icons/IconAlarm/IconAlarm10.js +5 -0
- package/dist/Icons/IconBank/IconBank10.d.ts +6 -0
- package/dist/Icons/IconBank/IconBank10.js +5 -0
- package/dist/Icons/IconBell/IconBell10.d.ts +6 -0
- package/dist/Icons/IconBell/IconBell10.js +5 -0
- package/dist/Icons/IconBriefcase/IconBriefcase10.d.ts +6 -0
- package/dist/Icons/IconBriefcase/IconBriefcase10.js +5 -0
- package/dist/Icons/IconCalendar/IconCalendar10.d.ts +6 -0
- package/dist/Icons/IconCalendar/IconCalendar10.js +5 -0
- package/dist/Icons/IconCheck/IconCheck10.d.ts +6 -0
- package/dist/Icons/IconCheck/IconCheck10.js +5 -0
- package/dist/Icons/IconClose/IconClose10.d.ts +6 -0
- package/dist/Icons/IconClose/IconClose10.js +5 -0
- package/dist/Icons/IconColorPicker/IconColorPicker10.d.ts +7 -0
- package/dist/Icons/IconColorPicker/IconColorPicker10.js +5 -0
- package/dist/Icons/IconError/IconError10.d.ts +6 -0
- package/dist/Icons/IconError/IconError10.js +5 -0
- package/dist/Icons/IconEyeOff/IconEyeOff10.d.ts +6 -0
- package/dist/Icons/IconEyeOff/IconEyeOff10.js +5 -0
- package/dist/Icons/IconInfo/IconInfo10.d.ts +6 -0
- package/dist/Icons/IconInfo/IconInfo10.js +5 -0
- package/dist/Icons/IconSuccess/IconSuccess10.d.ts +6 -0
- package/dist/Icons/IconSuccess/IconSuccess10.js +5 -0
- package/dist/Icons/IconWarning/IconWarning10.d.ts +6 -0
- package/dist/Icons/IconWarning/IconWarning10.js +5 -0
- package/dist/Icons/index.d.ts +16 -0
- package/dist/Icons/index.js +16 -0
- package/dist/Intro/Welcome.d.ts +2 -0
- package/dist/Intro/Welcome.js +7 -0
- package/dist/Intro/Welcome.module.css +19 -0
- package/dist/colors.css +78 -0
- package/dist/components/Button/Button.d.ts +6 -0
- package/dist/components/Button/Button.js +49 -0
- package/dist/components/Button/Button.module.css +343 -0
- package/dist/components/Checkbox/Checkbox.d.ts +3 -0
- package/dist/components/Checkbox/Checkbox.js +13 -0
- package/dist/components/Checkbox/Checkbox.module.css +78 -0
- package/dist/components/ColorPicker/ColorPicker.d.ts +7 -0
- package/dist/components/ColorPicker/ColorPicker.js +115 -0
- package/dist/components/ColorPicker/ColorPicker.module.css +266 -0
- package/dist/components/Dropdown/Dropdown.d.ts +14 -0
- package/dist/components/Dropdown/Dropdown.js +114 -0
- package/dist/components/Dropdown/Dropdown.module.css +207 -0
- package/dist/components/Input/Input.d.ts +6 -0
- package/dist/components/Input/Input.js +37 -0
- package/dist/components/Input/Input.module.css +176 -0
- package/dist/components/ProgressBar/ProgressBar.d.ts +6 -0
- package/dist/components/ProgressBar/ProgressBar.js +41 -0
- package/dist/components/ProgressBar/ProgressBar.module.css +56 -0
- package/dist/components/ProgressLoader/ProgressLoader.d.ts +3 -0
- package/dist/components/ProgressLoader/ProgressLoader.js +71 -0
- package/dist/components/ProgressLoader/ProgressLoader.module.css +26 -0
- package/dist/components/RadioButton/RadioButton.d.ts +3 -0
- package/dist/components/RadioButton/RadioButton.js +13 -0
- package/dist/components/RadioButton/RadioButton.module.css +80 -0
- package/dist/components/SettingTag/SettingTag.d.ts +3 -0
- package/dist/components/SettingTag/SettingTag.js +15 -0
- package/dist/components/SettingTag/SettingTag.module.css +16 -0
- package/dist/components/Snackbar/Snackbar.d.ts +26 -0
- package/dist/components/Snackbar/Snackbar.js +55 -0
- package/dist/components/Snackbar/Snackbar.module.css +61 -0
- package/dist/components/Snackbar/enums.d.ts +9 -0
- package/dist/components/Snackbar/enums.js +10 -0
- package/dist/components/Tab/Tab.d.ts +3 -0
- package/dist/components/Tab/Tab.js +14 -0
- package/dist/components/Tab/Tab.module.css +45 -0
- package/dist/components/Tabs/Tabs.d.ts +3 -0
- package/dist/components/Tabs/Tabs.js +19 -0
- package/dist/components/Tabs/Tabs.module.css +55 -0
- package/dist/components/Tag/Tag.d.ts +3 -0
- package/dist/components/Tag/Tag.js +23 -0
- package/dist/components/Tag/Tag.module.css +145 -0
- package/dist/components/ToggleButton/ToggleButton.d.ts +3 -0
- package/dist/components/ToggleButton/ToggleButton.js +13 -0
- package/dist/components/ToggleButton/ToggleButton.module.css +75 -0
- package/dist/components/Typography/Typography.d.ts +6 -0
- package/dist/components/Typography/Typography.js +25 -0
- package/dist/components/Typography/Typography.module.css +264 -0
- package/dist/components/Typography/enums.d.ts +24 -0
- package/dist/components/Typography/enums.js +25 -0
- package/dist/fonts.css +35 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +16 -0
- package/package.json +1 -1
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
.story--wrapper-btn {
|
|
2
|
+
background-color: var(--white);
|
|
3
|
+
padding: 30px;
|
|
4
|
+
border-radius: 10px;
|
|
5
|
+
width: 900px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.button {
|
|
9
|
+
font-family: 'Raleway';
|
|
10
|
+
font-style: normal;
|
|
11
|
+
font-weight: 400;
|
|
12
|
+
line-height: 16.5px;
|
|
13
|
+
border-radius: 10px;
|
|
14
|
+
padding: 5px 10px;
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
padding: 0.5em 1.5em;
|
|
17
|
+
width: fit-content;
|
|
18
|
+
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* Стили для дефолтных кнопок */
|
|
22
|
+
/* синяя */
|
|
23
|
+
.button--fill-default {
|
|
24
|
+
background-color: var(--blue-main);
|
|
25
|
+
color: var(--white);
|
|
26
|
+
border: none;
|
|
27
|
+
}
|
|
28
|
+
.button--fill-default:hover {
|
|
29
|
+
background-color: var(--blue-secondary);
|
|
30
|
+
color: var(--white);
|
|
31
|
+
border: none;
|
|
32
|
+
}
|
|
33
|
+
.button--fill-default:active {
|
|
34
|
+
background-color: var(--blue-dark);
|
|
35
|
+
color: var(--white);
|
|
36
|
+
border: none;
|
|
37
|
+
}
|
|
38
|
+
.button--fill-default:disabled {
|
|
39
|
+
background-color: var(--blue-disabled);
|
|
40
|
+
color: var(--white);
|
|
41
|
+
border: none;
|
|
42
|
+
cursor: not-allowed;
|
|
43
|
+
}
|
|
44
|
+
/* ошибка */
|
|
45
|
+
.button--fill-error {
|
|
46
|
+
background-color: var(--error-main);
|
|
47
|
+
color: var(--white);
|
|
48
|
+
border: none;
|
|
49
|
+
}
|
|
50
|
+
.button--fill-error:hover {
|
|
51
|
+
background-color: var(--error-secondary);
|
|
52
|
+
color: var(--white);
|
|
53
|
+
border: none;
|
|
54
|
+
}
|
|
55
|
+
.button--fill-error:active {
|
|
56
|
+
background-color: var(--error-dark);
|
|
57
|
+
color: var(--white);
|
|
58
|
+
border: none;
|
|
59
|
+
}
|
|
60
|
+
.button--fill-error:disabled {
|
|
61
|
+
background-color: var(--error-disabled);
|
|
62
|
+
color: var(--white);
|
|
63
|
+
border: none;
|
|
64
|
+
cursor: not-allowed;
|
|
65
|
+
}
|
|
66
|
+
/* success */
|
|
67
|
+
.button--fill-success {
|
|
68
|
+
background-color: var(--success-main);
|
|
69
|
+
color: var(--white);
|
|
70
|
+
border: none;
|
|
71
|
+
}
|
|
72
|
+
.button--fill-success:hover {
|
|
73
|
+
background-color: var(--success-secondary);
|
|
74
|
+
color: var(--white);
|
|
75
|
+
border: none;
|
|
76
|
+
}
|
|
77
|
+
.button--fill-success:active {
|
|
78
|
+
background-color: var(--success-dark);
|
|
79
|
+
color: var(--white);
|
|
80
|
+
border: none;
|
|
81
|
+
}
|
|
82
|
+
.button--fill-success:disabled {
|
|
83
|
+
background-color: var(--success-disabled);
|
|
84
|
+
color: var(--white);
|
|
85
|
+
border: none;
|
|
86
|
+
cursor: not-allowed;
|
|
87
|
+
}
|
|
88
|
+
/* warning */
|
|
89
|
+
.button--fill-warning {
|
|
90
|
+
background-color: var(--warning-main);
|
|
91
|
+
color: var(--white);
|
|
92
|
+
border: none;
|
|
93
|
+
}
|
|
94
|
+
.button--fill-warning:hover {
|
|
95
|
+
background-color: var(--warning-secondary);
|
|
96
|
+
color: var(--white);
|
|
97
|
+
border: none;
|
|
98
|
+
}
|
|
99
|
+
.button--fill-warning:active {
|
|
100
|
+
background-color: var(--warning-dark);
|
|
101
|
+
color: var(--white);
|
|
102
|
+
border: none;
|
|
103
|
+
}
|
|
104
|
+
.button--fill-warning:disabled {
|
|
105
|
+
background-color: var(--warning-disabled);
|
|
106
|
+
color: var(--white);
|
|
107
|
+
border: none;
|
|
108
|
+
cursor: not-allowed;
|
|
109
|
+
}
|
|
110
|
+
/* info */
|
|
111
|
+
.button--fill-info {
|
|
112
|
+
background-color: var(--info-main);
|
|
113
|
+
color: var(--text-btn);
|
|
114
|
+
border: none;
|
|
115
|
+
}
|
|
116
|
+
.button--fill-info:hover {
|
|
117
|
+
background-color: var(--info-secondary);
|
|
118
|
+
color: var(--text-btn);
|
|
119
|
+
border: none;
|
|
120
|
+
}
|
|
121
|
+
.button--fill-info:active {
|
|
122
|
+
background-color: var(--info-dark);
|
|
123
|
+
color: var(--text-btn);
|
|
124
|
+
border: none;
|
|
125
|
+
}
|
|
126
|
+
.button--fill-info:disabled {
|
|
127
|
+
background-color: var(--info-main);
|
|
128
|
+
color: var(--text-btn-light);
|
|
129
|
+
border: none;
|
|
130
|
+
cursor: not-allowed;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/* Стили для outline кнопок */
|
|
134
|
+
/* синяя */
|
|
135
|
+
.button--outline-default {
|
|
136
|
+
background-color: transparent;
|
|
137
|
+
color: var(--blue-main);
|
|
138
|
+
border: 1px solid var(--blue-main);
|
|
139
|
+
}
|
|
140
|
+
.button--outline-default:hover {
|
|
141
|
+
background-color: rgba(13, 153, 255, 0.07);
|
|
142
|
+
color: var(--blue-main);
|
|
143
|
+
border: 1px solid var(--blue-main);
|
|
144
|
+
}
|
|
145
|
+
.button--outline-default:active {
|
|
146
|
+
background-color: rgba(13, 153, 255, 0.15);
|
|
147
|
+
color: var(--blue-main);
|
|
148
|
+
border: 1px solid var(--blue-main);
|
|
149
|
+
}
|
|
150
|
+
.button--outline-default:disabled {
|
|
151
|
+
background-color: transparent;
|
|
152
|
+
color: var(--blue-disabled);
|
|
153
|
+
border: 1px solid var(--blue-disabled);
|
|
154
|
+
cursor: not-allowed;
|
|
155
|
+
}
|
|
156
|
+
/* ошибка */
|
|
157
|
+
.button--outline-error {
|
|
158
|
+
background-color: transparent;
|
|
159
|
+
color: var(--error-main);
|
|
160
|
+
border: 1px solid var(--error-main);
|
|
161
|
+
}
|
|
162
|
+
.button--outline-error:hover {
|
|
163
|
+
background-color: rgba(255, 59, 48, 0.07);
|
|
164
|
+
color: var(--error-main);
|
|
165
|
+
border: 1px solid var(--error-main);
|
|
166
|
+
}
|
|
167
|
+
.button--outline-error:active {
|
|
168
|
+
background-color: rgba(255, 59, 48, 0.15);
|
|
169
|
+
color: var(--error-main);
|
|
170
|
+
border: 1px solid var(--error-main);
|
|
171
|
+
}
|
|
172
|
+
.button--outline-error:disabled {
|
|
173
|
+
background-color: transparent;
|
|
174
|
+
color: var(--error-disabled);
|
|
175
|
+
border: 1px solid var(--error-disabled);
|
|
176
|
+
cursor: not-allowed;
|
|
177
|
+
}
|
|
178
|
+
/* success */
|
|
179
|
+
.button--outline-success {
|
|
180
|
+
background-color: transparent;
|
|
181
|
+
color: var(--success-main);
|
|
182
|
+
border: 1px solid var(--success-main);
|
|
183
|
+
}
|
|
184
|
+
.button--outline-success:hover {
|
|
185
|
+
background-color: rgba(52, 199, 89, 0.07);
|
|
186
|
+
color: var(--success-secondary);
|
|
187
|
+
border: 1px solid var(--success-secondary);
|
|
188
|
+
}
|
|
189
|
+
.button--outline-success:active {
|
|
190
|
+
background-color: rgba(52, 199, 89, 0.15);
|
|
191
|
+
color: var(--success-dark);
|
|
192
|
+
border: 1px solid var(--success-dark);
|
|
193
|
+
}
|
|
194
|
+
.button--outline-success:disabled {
|
|
195
|
+
background-color: transparent;
|
|
196
|
+
color: var(--success-disabled);
|
|
197
|
+
border: 1px solid var(--success-disabled);
|
|
198
|
+
cursor: not-allowed;
|
|
199
|
+
}
|
|
200
|
+
/* warning */
|
|
201
|
+
.button--outline-warning {
|
|
202
|
+
background-color: transparent;
|
|
203
|
+
color: var(--warning-main);
|
|
204
|
+
border: 1px solid var(--warning-main);
|
|
205
|
+
}
|
|
206
|
+
.button--outline-warning:hover {
|
|
207
|
+
background-color: rgba(255, 149, 0, 0.07);
|
|
208
|
+
color: var(--warning-secondary);
|
|
209
|
+
border: 1px solid var(--warning-secondary);
|
|
210
|
+
}
|
|
211
|
+
.button--outline-warning:active {
|
|
212
|
+
background-color: rgba(255, 149, 0, 0.15);
|
|
213
|
+
color: var(--warning-dark);
|
|
214
|
+
border: 1px solid var(--warning-dark);
|
|
215
|
+
}
|
|
216
|
+
.button--outline-warning:disabled {
|
|
217
|
+
background-color: transparent;
|
|
218
|
+
color: var(--warning-disabled);
|
|
219
|
+
border: 1px solid var(--warning-disabled);
|
|
220
|
+
cursor: not-allowed;
|
|
221
|
+
}
|
|
222
|
+
/* info */
|
|
223
|
+
.button--outline-info {
|
|
224
|
+
background-color: transparent;
|
|
225
|
+
color: var(--text-btn);
|
|
226
|
+
border: 1px solid var(--text-btn);
|
|
227
|
+
}
|
|
228
|
+
.button--outline-info:hover {
|
|
229
|
+
background-color: rgba(111, 111, 111, 0.07);
|
|
230
|
+
color: var(--text-btn);
|
|
231
|
+
border: 1px solid var(--text-btn);
|
|
232
|
+
}
|
|
233
|
+
.button--outline-info:active {
|
|
234
|
+
background-color: rgba(111, 111, 111, 0.15);
|
|
235
|
+
color: var(--text-btn);
|
|
236
|
+
border: 1px solid var(--text-btn);
|
|
237
|
+
}
|
|
238
|
+
.button--outline-info:disabled {
|
|
239
|
+
background-color: transparent;
|
|
240
|
+
color: var(--text-btn-light);
|
|
241
|
+
border: 1px solid var(--text-btn-light);
|
|
242
|
+
cursor: not-allowed;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/* Стили для текстовых/ссылок */
|
|
246
|
+
.button--link-default {
|
|
247
|
+
color: var(--blue-main);
|
|
248
|
+
border: none;
|
|
249
|
+
background-color: rgba(255, 255, 255, 0);
|
|
250
|
+
}
|
|
251
|
+
.button--link-default:hover {
|
|
252
|
+
text-decoration: underline;
|
|
253
|
+
}
|
|
254
|
+
.button--link-default:disabled {
|
|
255
|
+
color: var(--blue-disabled);
|
|
256
|
+
border: none;
|
|
257
|
+
background-color: rgba(255, 255, 255, 0);
|
|
258
|
+
cursor: not-allowed;
|
|
259
|
+
}
|
|
260
|
+
.button--link-error {
|
|
261
|
+
color: var(--error-main);
|
|
262
|
+
border: none;
|
|
263
|
+
background-color: rgba(255, 255, 255, 0);
|
|
264
|
+
}
|
|
265
|
+
.button--link-error:hover {
|
|
266
|
+
text-decoration: underline;
|
|
267
|
+
}
|
|
268
|
+
.button--link-error:disabled {
|
|
269
|
+
color: var(--error-disabled);
|
|
270
|
+
border: none;
|
|
271
|
+
background-color: rgba(255, 255, 255, 0);
|
|
272
|
+
cursor: not-allowed;
|
|
273
|
+
}
|
|
274
|
+
.button--link-success {
|
|
275
|
+
color: var(--success-main);
|
|
276
|
+
border: none;
|
|
277
|
+
background-color: rgba(255, 255, 255, 0);
|
|
278
|
+
}
|
|
279
|
+
.button--link-success:hover {
|
|
280
|
+
text-decoration: underline;
|
|
281
|
+
}
|
|
282
|
+
.button--link-success:disabled {
|
|
283
|
+
color: var(--success-disabled);
|
|
284
|
+
border: none;
|
|
285
|
+
background-color: rgba(255, 255, 255, 0);
|
|
286
|
+
cursor: not-allowed;
|
|
287
|
+
}
|
|
288
|
+
.button--link-warning {
|
|
289
|
+
color: var(--warning-main);
|
|
290
|
+
border: none;
|
|
291
|
+
background-color: rgba(255, 255, 255, 0);
|
|
292
|
+
}
|
|
293
|
+
.button--link-warning:hover {
|
|
294
|
+
text-decoration: underline;
|
|
295
|
+
}
|
|
296
|
+
.button--link-warning:disabled {
|
|
297
|
+
color: var(--warning-disabled);
|
|
298
|
+
border: none;
|
|
299
|
+
background-color: rgba(255, 255, 255, 0);
|
|
300
|
+
cursor: not-allowed;
|
|
301
|
+
}
|
|
302
|
+
.button--link-info {
|
|
303
|
+
color: var(--text-btn);
|
|
304
|
+
border: none;
|
|
305
|
+
background-color: rgba(255, 255, 255, 0);
|
|
306
|
+
}
|
|
307
|
+
.button--link-info:hover {
|
|
308
|
+
text-decoration: underline;
|
|
309
|
+
}
|
|
310
|
+
.button--link-info:disabled {
|
|
311
|
+
color: var(--text-btn-light);
|
|
312
|
+
border: none;
|
|
313
|
+
background-color: rgba(255, 255, 255, 0);
|
|
314
|
+
cursor: not-allowed;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/* Размеры кнопок */
|
|
318
|
+
.button--sm {
|
|
319
|
+
/* font-size: 0.8rem; */
|
|
320
|
+
font-size: 12px;
|
|
321
|
+
}
|
|
322
|
+
.button--md {
|
|
323
|
+
/* font-size: 1rem; */
|
|
324
|
+
font-size: 14px;
|
|
325
|
+
}
|
|
326
|
+
.button--lg {
|
|
327
|
+
/* font-size: 1.2rem; */
|
|
328
|
+
font-size: 16px;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/* Стили кнопок иконка/без иконки/ссылка */
|
|
332
|
+
.button--default {
|
|
333
|
+
display: flex;
|
|
334
|
+
align-items: center;
|
|
335
|
+
gap: 5px;
|
|
336
|
+
padding: 0.5em 1em 0.5em 0.7em;
|
|
337
|
+
}
|
|
338
|
+
.button--text {
|
|
339
|
+
padding: 0.5em 1em;
|
|
340
|
+
}
|
|
341
|
+
.button--icon {
|
|
342
|
+
padding: 0.5em 0.7em;
|
|
343
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styles from './Checkbox.module.css';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
export const Checkbox = ({ checked, onChange, disabled = false, size = 'sm', label }) => {
|
|
5
|
+
const handleChange = (e) => {
|
|
6
|
+
if (onChange) {
|
|
7
|
+
onChange(e);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
return (React.createElement("label", { className: styles["checkbox"] },
|
|
11
|
+
React.createElement("input", { type: "checkbox", checked: checked, onChange: handleChange, disabled: disabled, className: classNames('input', size) }),
|
|
12
|
+
label));
|
|
13
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
.story--wrapper-checkbox {
|
|
2
|
+
background-color: var(--white);
|
|
3
|
+
padding: 30px;
|
|
4
|
+
border-radius: 10px;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.checkbox {
|
|
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
|
+
.checkbox.sm {
|
|
22
|
+
width: 12px;
|
|
23
|
+
height: 12px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.checkbox.md {
|
|
27
|
+
width: 16px;
|
|
28
|
+
height: 16px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.input[type="checkbox"] {
|
|
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: 3px;
|
|
39
|
+
background-color: var(--white);
|
|
40
|
+
background-clip: content-box;
|
|
41
|
+
position: relative;
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.input[type="checkbox"]:hover,
|
|
47
|
+
.input[type="checkbox"]:checked:hover,
|
|
48
|
+
.input[type="checkbox"]:checked:hover::after {
|
|
49
|
+
border-color: var(--blue-main);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.input[type="checkbox"]:checked {
|
|
53
|
+
border-color: var(--icons-medium);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.input[type="checkbox"]:checked::after {
|
|
57
|
+
/* Стрелка*/
|
|
58
|
+
content: '';
|
|
59
|
+
position: absolute;
|
|
60
|
+
left: 50%;
|
|
61
|
+
top: 50%;
|
|
62
|
+
transform: translate(-50%, -60%) rotate(45deg);
|
|
63
|
+
width: 40%;
|
|
64
|
+
height: 75%;
|
|
65
|
+
|
|
66
|
+
border: solid var(--icons-medium);
|
|
67
|
+
border-width: 0 2px 2px 0;
|
|
68
|
+
background-color: none;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.input[type="checkbox"]:disabled,
|
|
72
|
+
.input[type="checkbox"]:disabled:checked,
|
|
73
|
+
.input[type="checkbox"]:disabled:checked:after {
|
|
74
|
+
background-color: var(--white);
|
|
75
|
+
border-color: var(--icons-light);
|
|
76
|
+
cursor: not-allowed;
|
|
77
|
+
box-shadow: none;
|
|
78
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import styles from './ColorPicker.module.css';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { Chrome } from '@uiw/react-color';
|
|
5
|
+
import EditableInput from '@uiw/react-color-editable-input';
|
|
6
|
+
import { GithubPlacement } from '@uiw/react-color-github';
|
|
7
|
+
import { IconColorPicker10 } from '../../Icons';
|
|
8
|
+
/**
|
|
9
|
+
* Компонент ColorPicker представляет собой элемент управления для выбора цвета.
|
|
10
|
+
*/
|
|
11
|
+
export const ColorPicker = ({ color = '#ffffff', mainColor, recentColors, setIsHovered, width = 10, height = 10, autoOpen = false, onChange, }) => {
|
|
12
|
+
const [colorValue, setColorValue] = useState(mainColor);
|
|
13
|
+
const [selectedColor, setSelectedColor] = useState(color);
|
|
14
|
+
const [isColorChanged, setIsColorChanged] = useState(false);
|
|
15
|
+
const [isOpen, setIsOpen] = useState(autoOpen);
|
|
16
|
+
const [popoverPosition, setPopoverPosition] = useState('bottom');
|
|
17
|
+
const circleRef = useRef(null);
|
|
18
|
+
const popoverRef = useRef(null);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
// Обработчик клика вне компонента развертывания выбора цвета
|
|
21
|
+
const handleClickOutside = (event) => {
|
|
22
|
+
if (isOpen &&
|
|
23
|
+
popoverRef.current &&
|
|
24
|
+
circleRef.current &&
|
|
25
|
+
!popoverRef.current.contains(event.target) &&
|
|
26
|
+
!circleRef.current.contains(event.target)) {
|
|
27
|
+
setIsOpen(false);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
if (isOpen && circleRef.current && popoverRef.current) {
|
|
31
|
+
const circle = circleRef.current.getBoundingClientRect();
|
|
32
|
+
const popover = popoverRef.current.getBoundingClientRect();
|
|
33
|
+
const viewport = {
|
|
34
|
+
top: 0,
|
|
35
|
+
bottom: window.innerHeight
|
|
36
|
+
};
|
|
37
|
+
// Проверяем, достаточно ли места снизу
|
|
38
|
+
const bottomSpace = viewport.bottom - circle.bottom;
|
|
39
|
+
const topSpace = circle.top - viewport.top;
|
|
40
|
+
// Если снизу недостаточно места и сверху места больше, размещаем сверху
|
|
41
|
+
if (bottomSpace < popover.height && topSpace > bottomSpace) {
|
|
42
|
+
setPopoverPosition('top');
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
setPopoverPosition('bottom');
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
!autoOpen && document.addEventListener('mousedown', handleClickOutside);
|
|
49
|
+
return () => {
|
|
50
|
+
!autoOpen && document.removeEventListener('mousedown', handleClickOutside);
|
|
51
|
+
};
|
|
52
|
+
}, [isOpen]);
|
|
53
|
+
const mainColorClasses = classNames(styles['circle'], {
|
|
54
|
+
'mainColor': mainColor,
|
|
55
|
+
});
|
|
56
|
+
const colorCircleDefaultClasses = classNames(styles['circle'], {
|
|
57
|
+
'colorCircleDefault': color === '#ffffff' && !isColorChanged || isColorChanged && selectedColor !== colorValue
|
|
58
|
+
});
|
|
59
|
+
const popoverClassess = classNames(styles['popover'], {
|
|
60
|
+
[`popover--${popoverPosition}`]: true,
|
|
61
|
+
});
|
|
62
|
+
// Функция для преобразования HEXA в HEX
|
|
63
|
+
const hexaToHex = (hexa = 'fff') => {
|
|
64
|
+
const cleanHex = hexa.replace('#', '');
|
|
65
|
+
if (cleanHex.length >= 8) {
|
|
66
|
+
return `#${cleanHex.slice(0, 6)}`;
|
|
67
|
+
}
|
|
68
|
+
if (cleanHex.length === 6) {
|
|
69
|
+
return `#${cleanHex}`;
|
|
70
|
+
}
|
|
71
|
+
if (cleanHex.length === 3) {
|
|
72
|
+
return `#${cleanHex[0]}${cleanHex[0]}${cleanHex[1]}${cleanHex[1]}${cleanHex[2]}${cleanHex[2]}`;
|
|
73
|
+
}
|
|
74
|
+
if (cleanHex.length < 6) {
|
|
75
|
+
return `#${cleanHex + '0'.repeat(6 - cleanHex.length)}`;
|
|
76
|
+
}
|
|
77
|
+
return '#ffffff';
|
|
78
|
+
};
|
|
79
|
+
const colorChangeHandler = (color) => {
|
|
80
|
+
const newColor = typeof color === 'string' ? color : color.hexa;
|
|
81
|
+
setIsColorChanged(true);
|
|
82
|
+
setColorValue(newColor);
|
|
83
|
+
setSelectedColor(newColor);
|
|
84
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newColor);
|
|
85
|
+
};
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
setSelectedColor(color);
|
|
88
|
+
}, [color]);
|
|
89
|
+
return (React.createElement("div", { className: (mainColor || recentColors) ? 'colorPickerWrapper' : '', onMouseLeave: () => setIsHovered && setIsHovered(false) },
|
|
90
|
+
mainColor && React.createElement("div", { className: mainColorClasses, style: {
|
|
91
|
+
width: `${width}px`,
|
|
92
|
+
height: `${height}px`,
|
|
93
|
+
backgroundColor: (colorValue === null || colorValue === void 0 ? void 0 : colorValue.startsWith('#')) ? colorValue : `var(--${colorValue})`,
|
|
94
|
+
}, onClick: () => setIsHovered && setIsHovered(false) }),
|
|
95
|
+
recentColors && recentColors.map((color, index) => (React.createElement("div", { key: index, className: "circle", style: {
|
|
96
|
+
width: `${width}px`,
|
|
97
|
+
height: `${height}px`,
|
|
98
|
+
backgroundColor: color.startsWith('#') ? color : `var(--${color})`,
|
|
99
|
+
}, onClick: () => colorChangeHandler(color) }))),
|
|
100
|
+
React.createElement("div", { className: "colorPicker" },
|
|
101
|
+
React.createElement("div", { ref: circleRef, className: colorCircleDefaultClasses, onClick: () => setIsOpen(!isOpen), style: {
|
|
102
|
+
width: `${width}px`,
|
|
103
|
+
height: `${height}px`,
|
|
104
|
+
backgroundColor: selectedColor.startsWith('#') ? selectedColor : `var(--${selectedColor})`,
|
|
105
|
+
} }),
|
|
106
|
+
isOpen && (React.createElement("div", { ref: popoverRef, className: popoverClassess },
|
|
107
|
+
isOpen && React.createElement(IconColorPicker10, { className: "colorPickerIcon", htmlColor: 'var(--white)' }),
|
|
108
|
+
React.createElement(Chrome, { color: selectedColor, placement: GithubPlacement.Right, onChange: colorChangeHandler, className: "customChrome", showEyeDropper: false }),
|
|
109
|
+
React.createElement("div", { className: "hex", style: { padding: '0 10px 0 20px' } },
|
|
110
|
+
React.createElement(EditableInput, { value: hexaToHex(selectedColor), style: { width: 68, alignItems: 'flex-start' }, onChange: (e, color) => {
|
|
111
|
+
const formattedColor = hexaToHex(color.toString());
|
|
112
|
+
colorChangeHandler(formattedColor);
|
|
113
|
+
} })))))));
|
|
114
|
+
};
|
|
115
|
+
export default ColorPicker;
|