@via-profit/ui-kit 0.1.8 → 0.2.1-alpha.3
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/Accordion/index.d.ts +4 -4
- package/Autocomplete/AutocompleteContainer.d.ts +34 -7
- package/Autocomplete/AutocompleteContainer.js +28 -24
- package/Autocomplete/AutocompleteItem.d.ts +1 -1
- package/Autocomplete/AutocompleteTextField.d.ts +3 -0
- package/Autocomplete/AutocompleteTextField.js +63 -1
- package/Autocomplete/OverrideMenuList.d.ts +4 -0
- package/Autocomplete/OverrideMenuList.js +39 -0
- package/Autocomplete/context.d.ts +9 -1
- package/Autocomplete/context.js +15 -1
- package/Autocomplete/index.js +9 -10
- package/Autocomplete2/Autocomplete2.d.ts +12 -0
- package/Autocomplete2/Autocomplete2.js +83 -0
- package/Autocomplete2/Autocomplete2TextField.d.ts +7 -0
- package/Autocomplete2/Autocomplete2TextField.js +39 -0
- package/Autocomplete2/index.d.ts +2 -0
- package/Autocomplete2/index.js +7 -0
- package/Avatar/AvatarBase.d.ts +4 -4
- package/Avatar/index.js +1 -1
- package/Badge/BadgeBase.d.ts +4 -4
- package/Badge/BadgeDeleteButton.js +6 -6
- package/Badge/BadgeOutlined.js +2 -2
- package/Badge/BadgeStandard.js +1 -1
- package/Button/ButtonBase.d.ts +3 -3
- package/Button/ButtonOutlined.js +1 -1
- package/Button/ButtonPlain.js +1 -1
- package/Button/ButtonStandard.js +4 -11
- package/Calendar/CalendarCell.js +22 -4
- package/Calendar/CalendarComponent.d.ts +226 -0
- package/Calendar/CalendarComponent.js +572 -0
- package/Calendar/CalendarControlButton.js +16 -9
- package/Calendar/CalendarDayBadge.js +1 -1
- package/Calendar/CalendarEmptyCell.d.ts +2 -2
- package/Calendar/CalendarEmptyCell.js +8 -3
- package/Calendar/CalendarHeading.js +2 -1
- package/Calendar/CalendarMonthCell.js +0 -5
- package/Calendar/CalendarSubheading.js +3 -2
- package/Calendar/CalendarWeekDayCell.d.ts +10 -0
- package/Calendar/CalendarWeekDayCell.js +32 -0
- package/Calendar/CalendarWeekDayWeekNumber.d.ts +7 -0
- package/Calendar/CalendarWeekDayWeekNumber.js +38 -0
- package/Calendar/CalendarWeekRow.d.ts +2 -2
- package/Calendar/CalendarWeekRow.js +2 -1
- package/Calendar/CalendarWeekRowButton.d.ts +13 -0
- package/Calendar/CalendarWeekRowButton.js +31 -0
- package/Calendar/CalendarYearCell.js +5 -5
- package/Calendar/CalendarYearsSelector.d.ts +39 -1
- package/Calendar/CalendarYearsSelector.js +52 -16
- package/Calendar/IconChevronDown.d.ts +3 -0
- package/Calendar/IconChevronDown.js +31 -0
- package/Calendar/index.d.ts +7 -220
- package/Calendar/index.js +19 -274
- package/Calendar/use-calendar.d.ts +1 -1
- package/Calendar/use-calendar.js +102 -155
- package/Color/Color.d.ts +138 -0
- package/Color/Color.js +324 -0
- package/Color/ColorGenerator.d.ts +29 -0
- package/Color/ColorGenerator.js +141 -0
- package/Color/ColorParser.d.ts +20 -0
- package/Color/ColorParser.js +284 -0
- package/Color/index.d.ts +4 -122
- package/Color/index.js +18 -473
- package/DatePicker/index.d.ts +2 -17
- package/DatePicker/index.js +47 -61
- package/DatePicker/useDatePickerFormat.js +5 -5
- package/ErrorBoundary/Fallback.d.ts +3 -0
- package/ErrorBoundary/Fallback.js +51 -0
- package/ErrorBoundary/RenderError.d.ts +6 -0
- package/ErrorBoundary/RenderError.js +80 -0
- package/ErrorBoundary/index.d.ts +7 -11
- package/ErrorBoundary/index.js +4 -51
- package/Highlighted/index.d.ts +3 -3
- package/LoadingIndicator/Spinner.d.ts +5 -3
- package/LoadingIndicator/Spinner.js +61 -32
- package/LoadingIndicator/index.d.ts +3 -3
- package/LoadingIndicator/index.js +15 -2
- package/MaskedField/index.d.ts +1 -1
- package/MaskedField/index.js +11 -10
- package/Menu/AutoHeightWrapper.d.ts +6 -0
- package/Menu/AutoHeightWrapper.js +43 -0
- package/Menu/MeasuredItem.d.ts +10 -0
- package/Menu/MeasuredItem.js +51 -0
- package/Menu/MenuContainer.d.ts +53 -20
- package/Menu/MenuContainer.js +18 -11
- package/Menu/MenuItem.d.ts +24 -7
- package/Menu/MenuItem.js +13 -6
- package/Menu/MenuList.d.ts +4 -2
- package/Menu/MenuList.js +26 -6
- package/Menu/VirtualizedItem.d.ts +22 -0
- package/Menu/VirtualizedItem.js +69 -0
- package/Menu/VirtualizedList.d.ts +18 -0
- package/Menu/VirtualizedList.js +28 -0
- package/Menu/VirtualizedListComponent.d.ts +20 -0
- package/Menu/VirtualizedListComponent.js +305 -0
- package/Menu/index.d.ts +3 -1
- package/Menu/index.js +4 -7
- package/Modal/BaseModal/RenderModal.d.ts +3 -3
- package/Modal/BaseModal/index.d.ts +3 -3
- package/Modal/ConfirmBox/index.d.ts +5 -5
- package/Modal/Drawer/index.d.ts +5 -5
- package/Modal/MessageBox/index.d.ts +5 -5
- package/Popper/Popper.d.ts +148 -0
- package/Popper/Popper.js +113 -0
- package/Popper/PopperContainer.d.ts +2 -0
- package/Popper/PopperContainer.js +3 -6
- package/Popper/index.d.ts +5 -22
- package/Popper/index.js +18 -264
- package/Popper/usePopprer.d.ts +110 -0
- package/Popper/usePopprer.js +505 -0
- package/Selectbox/SelectboxButton.d.ts +5 -0
- package/Selectbox/SelectboxButton.js +48 -8
- package/Selectbox/SelectboxButtonWrapper.d.ts +2 -0
- package/Selectbox/SelectboxButtonWrapper.js +1 -17
- package/Selectbox/SelectboxMenu.d.ts +12 -0
- package/Selectbox/SelectboxMenu.js +50 -0
- package/Selectbox/index.d.ts +13 -13
- package/Selectbox/index.js +115 -97
- package/Surface/index.d.ts +5 -5
- package/Surface/index.js +1 -1
- package/Swiper/Swiper.d.ts +44 -0
- package/Swiper/Swiper.js +139 -0
- package/Swiper/SwiperContainer.d.ts +7 -0
- package/Swiper/SwiperContainer.js +14 -0
- package/Swiper/SwiperSlide.d.ts +7 -0
- package/Swiper/SwiperSlide.js +55 -0
- package/Swiper/SwiperTrack.d.ts +14 -0
- package/Swiper/SwiperTrack.js +58 -0
- package/Swiper/SwiperWrapper.d.ts +14 -0
- package/Swiper/SwiperWrapper.js +60 -0
- package/Swiper/index.d.ts +7 -0
- package/Swiper/index.js +26 -0
- package/Switch/SwitchDot.js +1 -1
- package/Switch/SwitchTrack.js +1 -1
- package/Switch/index.d.ts +8 -8
- package/TextArea/index.d.ts +7 -7
- package/TextField/TextFieldContainer.d.ts +2 -2
- package/TextField/TextFieldContainer.js +5 -3
- package/TextField/TextFieldErrorText.d.ts +2 -2
- package/TextField/TextFieldErrorText.js +5 -4
- package/TextField/TextFieldIconWrapper.d.ts +3 -3
- package/TextField/TextFieldIconWrapper.js +5 -3
- package/TextField/TextFieldInput.d.ts +2 -2
- package/TextField/TextFieldInput.js +6 -4
- package/TextField/TextFieldInputWrapper.d.ts +2 -2
- package/TextField/TextFieldInputWrapper.js +5 -3
- package/TextField/TextFieldLabel.d.ts +2 -2
- package/TextField/TextFieldLabel.js +5 -3
- package/TextField/TextFieldLabelAsterisk.d.ts +2 -2
- package/TextField/TextFieldLabelAsterisk.js +5 -3
- package/TextField/index.d.ts +15 -8
- package/TextField/index.js +49 -22
- package/ThemeProvider/createTheme.js +2 -2
- package/package.json +1 -1
- package/Calendar/reducer.d.ts +0 -14
- package/Calendar/reducer.js +0 -26
- /package/Calendar/{IconChevronRight.d.ts → CalendarIconNext.d.ts} +0 -0
- /package/Calendar/{IconChevronRight.js → CalendarIconNext.js} +0 -0
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ColorParser = void 0;
|
|
4
|
+
class ColorParser {
|
|
5
|
+
/**
|
|
6
|
+
* Парсит строковое представление цвета в объект ParsedColor
|
|
7
|
+
* @throws {Error} Если не удается распарсить цвет
|
|
8
|
+
*/
|
|
9
|
+
static parse(value) {
|
|
10
|
+
if (!value) {
|
|
11
|
+
throw new Error(`Invalid color value: ${value}`);
|
|
12
|
+
}
|
|
13
|
+
const inputColor = value.trim().toLowerCase();
|
|
14
|
+
// Проверка на именованный цвет
|
|
15
|
+
if (this.webColors[inputColor]) {
|
|
16
|
+
return this.parse(this.webColors[inputColor]);
|
|
17
|
+
}
|
|
18
|
+
// HEX форматы
|
|
19
|
+
if (inputColor.startsWith('#')) {
|
|
20
|
+
return this.parseHex(inputColor);
|
|
21
|
+
}
|
|
22
|
+
// RGB/RGBA форматы
|
|
23
|
+
if (inputColor.startsWith('rgb')) {
|
|
24
|
+
return this.parseRgb(inputColor);
|
|
25
|
+
}
|
|
26
|
+
// HSL/HSLA форматы
|
|
27
|
+
if (inputColor.startsWith('hsl')) {
|
|
28
|
+
return this.parseHsl(inputColor);
|
|
29
|
+
}
|
|
30
|
+
throw new Error(`Unsupported color format: ${value}`);
|
|
31
|
+
}
|
|
32
|
+
static parseHex(hex) {
|
|
33
|
+
const cleanHex = hex.replace(/[^0-9a-f]/g, '');
|
|
34
|
+
// Поддержка форматов с альфа-каналом
|
|
35
|
+
if (cleanHex.length === 8) {
|
|
36
|
+
// RRGGBBAA
|
|
37
|
+
return {
|
|
38
|
+
r: parseInt(cleanHex.substring(0, 2), 16),
|
|
39
|
+
g: parseInt(cleanHex.substring(2, 4), 16),
|
|
40
|
+
b: parseInt(cleanHex.substring(4, 6), 16),
|
|
41
|
+
a: Math.round((parseInt(cleanHex.substring(6, 8), 16) / 255) * 100) / 100,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
if (cleanHex.length === 6) {
|
|
45
|
+
// RRGGBB
|
|
46
|
+
return {
|
|
47
|
+
r: parseInt(cleanHex.substring(0, 2), 16),
|
|
48
|
+
g: parseInt(cleanHex.substring(2, 4), 16),
|
|
49
|
+
b: parseInt(cleanHex.substring(4, 6), 16),
|
|
50
|
+
a: 1,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
if (cleanHex.length === 4) {
|
|
54
|
+
// RGBA (4 символа)
|
|
55
|
+
return {
|
|
56
|
+
r: parseInt(cleanHex[0] + cleanHex[0], 16),
|
|
57
|
+
g: parseInt(cleanHex[1] + cleanHex[1], 16),
|
|
58
|
+
b: parseInt(cleanHex[2] + cleanHex[2], 16),
|
|
59
|
+
a: Math.round((parseInt(cleanHex[3] + cleanHex[3], 16) / 255) * 100) / 100,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
if (cleanHex.length === 3) {
|
|
63
|
+
// RGB
|
|
64
|
+
return {
|
|
65
|
+
r: parseInt(cleanHex[0] + cleanHex[0], 16),
|
|
66
|
+
g: parseInt(cleanHex[1] + cleanHex[1], 16),
|
|
67
|
+
b: parseInt(cleanHex[2] + cleanHex[2], 16),
|
|
68
|
+
a: 1,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
throw new Error(`Invalid HEX color: ${hex}`);
|
|
72
|
+
}
|
|
73
|
+
static parseRgb(rgb) {
|
|
74
|
+
const matches = rgb.match(/[\d.]+/g);
|
|
75
|
+
if (!matches || matches.length < 3) {
|
|
76
|
+
throw new Error(`Invalid RGB color: ${rgb}`);
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
r: this.clamp(parseInt(matches[0], 10), 0, 255),
|
|
80
|
+
g: this.clamp(parseInt(matches[1], 10), 0, 255),
|
|
81
|
+
b: this.clamp(parseInt(matches[2], 10), 0, 255),
|
|
82
|
+
a: matches[3] ? this.clamp(parseFloat(matches[3]), 0, 1) : 1,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
static parseHsl(hsl) {
|
|
86
|
+
const matches = hsl.match(/[\d.]+/g);
|
|
87
|
+
if (!matches || matches.length < 3) {
|
|
88
|
+
throw new Error(`Invalid HSL color: ${hsl}`);
|
|
89
|
+
}
|
|
90
|
+
const h = parseFloat(matches[0]) / 360;
|
|
91
|
+
const s = parseFloat(matches[1]) / 100;
|
|
92
|
+
const l = parseFloat(matches[2]) / 100;
|
|
93
|
+
const a = matches[3] ? this.clamp(parseFloat(matches[3]), 0, 1) : 1;
|
|
94
|
+
const rgb = this.hslToRgb(h, s, l);
|
|
95
|
+
return {
|
|
96
|
+
r: rgb[0],
|
|
97
|
+
g: rgb[1],
|
|
98
|
+
b: rgb[2],
|
|
99
|
+
a,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
static hslToRgb(h, s, l) {
|
|
103
|
+
let r, g, b;
|
|
104
|
+
if (s === 0) {
|
|
105
|
+
r = g = b = l;
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
const hue2rgb = (p, q, t) => {
|
|
109
|
+
if (t < 0)
|
|
110
|
+
t += 1;
|
|
111
|
+
if (t > 1)
|
|
112
|
+
t -= 1;
|
|
113
|
+
if (t < 1 / 6)
|
|
114
|
+
return p + (q - p) * 6 * t;
|
|
115
|
+
if (t < 1 / 2)
|
|
116
|
+
return q;
|
|
117
|
+
if (t < 2 / 3)
|
|
118
|
+
return p + (q - p) * (2 / 3 - t) * 6;
|
|
119
|
+
return p;
|
|
120
|
+
};
|
|
121
|
+
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
122
|
+
const p = 2 * l - q;
|
|
123
|
+
r = hue2rgb(p, q, h + 1 / 3);
|
|
124
|
+
g = hue2rgb(p, q, h);
|
|
125
|
+
b = hue2rgb(p, q, h - 1 / 3);
|
|
126
|
+
}
|
|
127
|
+
return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)];
|
|
128
|
+
}
|
|
129
|
+
static clamp(value, min, max) {
|
|
130
|
+
return Math.max(min, Math.min(max, value));
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
exports.ColorParser = ColorParser;
|
|
134
|
+
ColorParser.webColors = {
|
|
135
|
+
aliceblue: '#F0F8FF',
|
|
136
|
+
antiquewhite: '#FAEBD7',
|
|
137
|
+
aqua: '#00FFFF',
|
|
138
|
+
aquamarine: '#7FFFD4',
|
|
139
|
+
azure: '#F0FFFF',
|
|
140
|
+
beige: '#F5F5DC',
|
|
141
|
+
bisque: '#FFE4C4',
|
|
142
|
+
black: '#000000',
|
|
143
|
+
blanchedalmond: '#FFEBCD',
|
|
144
|
+
blue: '#0000FF',
|
|
145
|
+
blueviolet: '#8A2BE2',
|
|
146
|
+
brown: '#A52A2A',
|
|
147
|
+
burlywood: '#DEB887',
|
|
148
|
+
cadetblue: '#5F9EA0',
|
|
149
|
+
chartreuse: '#7FFF00',
|
|
150
|
+
chocolate: '#D2691E',
|
|
151
|
+
coral: '#FF7F50',
|
|
152
|
+
cornflowerblue: '#6495ED',
|
|
153
|
+
cornsilk: '#FFF8DC',
|
|
154
|
+
crimson: '#DC143C',
|
|
155
|
+
cyan: '#00FFFF',
|
|
156
|
+
darkblue: '#00008B',
|
|
157
|
+
darkcyan: '#008B8B',
|
|
158
|
+
darkgoldenrod: '#B8860B',
|
|
159
|
+
darkgray: '#A9A9A9',
|
|
160
|
+
darkgrey: '#A9A9A9',
|
|
161
|
+
darkgreen: '#006400',
|
|
162
|
+
darkkhaki: '#BDB76B',
|
|
163
|
+
darkmagenta: '#8B008B',
|
|
164
|
+
darkolivegreen: '#556B2F',
|
|
165
|
+
darkorange: '#FF8C00',
|
|
166
|
+
darkorchid: '#9932CC',
|
|
167
|
+
darkred: '#8B0000',
|
|
168
|
+
darksalmon: '#E9967A',
|
|
169
|
+
darkseagreen: '#8FBC8F',
|
|
170
|
+
darkslateblue: '#483D8B',
|
|
171
|
+
darkslategray: '#2F4F4F',
|
|
172
|
+
darkslategrey: '#2F4F4F',
|
|
173
|
+
darkturquoise: '#00CED1',
|
|
174
|
+
darkviolet: '#9400D3',
|
|
175
|
+
deeppink: '#FF1493',
|
|
176
|
+
deepskyblue: '#00BFFF',
|
|
177
|
+
dimgray: '#696969',
|
|
178
|
+
dimgrey: '#696969',
|
|
179
|
+
dodgerblue: '#1E90FF',
|
|
180
|
+
firebrick: '#B22222',
|
|
181
|
+
floralwhite: '#FFFAF0',
|
|
182
|
+
forestgreen: '#228B22',
|
|
183
|
+
fuchsia: '#FF00FF',
|
|
184
|
+
gainsboro: '#DCDCDC',
|
|
185
|
+
ghostwhite: '#F8F8FF',
|
|
186
|
+
gold: '#FFD700',
|
|
187
|
+
goldenrod: '#DAA520',
|
|
188
|
+
gray: '#808080',
|
|
189
|
+
grey: '#808080',
|
|
190
|
+
green: '#008000',
|
|
191
|
+
greenyellow: '#ADFF2F',
|
|
192
|
+
honeydew: '#F0FFF0',
|
|
193
|
+
hotpink: '#FF69B4',
|
|
194
|
+
indianred: '#CD5C5C',
|
|
195
|
+
indigo: '#4B0082',
|
|
196
|
+
ivory: '#FFFFF0',
|
|
197
|
+
khaki: '#F0E68C',
|
|
198
|
+
lavender: '#E6E6FA',
|
|
199
|
+
lavenderblush: '#FFF0F5',
|
|
200
|
+
lawngreen: '#7CFC00',
|
|
201
|
+
lemonchiffon: '#FFFACD',
|
|
202
|
+
lightblue: '#ADD8E6',
|
|
203
|
+
lightcoral: '#F08080',
|
|
204
|
+
lightcyan: '#E0FFFF',
|
|
205
|
+
lightgoldenrodyellow: '#FAFAD2',
|
|
206
|
+
lightgray: '#D3D3D3',
|
|
207
|
+
lightgrey: '#D3D3D3',
|
|
208
|
+
lightgreen: '#90EE90',
|
|
209
|
+
lightpink: '#FFB6C1',
|
|
210
|
+
lightsalmon: '#FFA07A',
|
|
211
|
+
lightseagreen: '#20B2AA',
|
|
212
|
+
lightskyblue: '#87CEFA',
|
|
213
|
+
lightslategray: '#778899',
|
|
214
|
+
lightslategrey: '#778899',
|
|
215
|
+
lightsteelblue: '#B0C4DE',
|
|
216
|
+
lightyellow: '#FFFFE0',
|
|
217
|
+
lime: '#00FF00',
|
|
218
|
+
limegreen: '#32CD32',
|
|
219
|
+
linen: '#FAF0E6',
|
|
220
|
+
magenta: '#FF00FF',
|
|
221
|
+
maroon: '#800000',
|
|
222
|
+
mediumaquamarine: '#66CDAA',
|
|
223
|
+
mediumblue: '#0000CD',
|
|
224
|
+
mediumorchid: '#BA55D3',
|
|
225
|
+
mediumpurple: '#9370DB',
|
|
226
|
+
mediumseagreen: '#3CB371',
|
|
227
|
+
mediumslateblue: '#7B68EE',
|
|
228
|
+
mediumspringgreen: '#00FA9A',
|
|
229
|
+
mediumturquoise: '#48D1CC',
|
|
230
|
+
mediumvioletred: '#C71585',
|
|
231
|
+
midnightblue: '#191970',
|
|
232
|
+
mintcream: '#F5FFFA',
|
|
233
|
+
mistyrose: '#FFE4E1',
|
|
234
|
+
moccasin: '#FFE4B5',
|
|
235
|
+
navajowhite: '#FFDEAD',
|
|
236
|
+
navy: '#000080',
|
|
237
|
+
oldlace: '#FDF5E6',
|
|
238
|
+
olive: '#808000',
|
|
239
|
+
olivedrab: '#6B8E23',
|
|
240
|
+
orange: '#FFA500',
|
|
241
|
+
orangered: '#FF4500',
|
|
242
|
+
orchid: '#DA70D6',
|
|
243
|
+
palegoldenrod: '#EEE8AA',
|
|
244
|
+
palegreen: '#98FB98',
|
|
245
|
+
paleturquoise: '#AFEEEE',
|
|
246
|
+
palevioletred: '#DB7093',
|
|
247
|
+
papayawhip: '#FFEFD5',
|
|
248
|
+
peachpuff: '#FFDAB9',
|
|
249
|
+
peru: '#CD853F',
|
|
250
|
+
pink: '#FFC0CB',
|
|
251
|
+
plum: '#DDA0DD',
|
|
252
|
+
powderblue: '#B0E0E6',
|
|
253
|
+
purple: '#800080',
|
|
254
|
+
rebeccapurple: '#663399',
|
|
255
|
+
red: '#FF0000',
|
|
256
|
+
rosybrown: '#BC8F8F',
|
|
257
|
+
royalblue: '#4169E1',
|
|
258
|
+
saddlebrown: '#8B4513',
|
|
259
|
+
salmon: '#FA8072',
|
|
260
|
+
sandybrown: '#F4A460',
|
|
261
|
+
seagreen: '#2E8B57',
|
|
262
|
+
seashell: '#FFF5EE',
|
|
263
|
+
sienna: '#A0522D',
|
|
264
|
+
silver: '#C0C0C0',
|
|
265
|
+
skyblue: '#87CEEB',
|
|
266
|
+
slateblue: '#6A5ACD',
|
|
267
|
+
slategray: '#708090',
|
|
268
|
+
slategrey: '#708090',
|
|
269
|
+
snow: '#FFFAFA',
|
|
270
|
+
springgreen: '#00FF7F',
|
|
271
|
+
steelblue: '#4682B4',
|
|
272
|
+
tan: '#D2B48C',
|
|
273
|
+
teal: '#008080',
|
|
274
|
+
thistle: '#D8BFD8',
|
|
275
|
+
tomato: '#FF6347',
|
|
276
|
+
turquoise: '#40E0D0',
|
|
277
|
+
violet: '#EE82EE',
|
|
278
|
+
wheat: '#F5DEB3',
|
|
279
|
+
white: '#FFFFFF',
|
|
280
|
+
whitesmoke: '#F5F5F5',
|
|
281
|
+
yellow: '#FFFF00',
|
|
282
|
+
yellowgreen: '#9ACD32',
|
|
283
|
+
};
|
|
284
|
+
exports.default = ColorParser;
|
package/Color/index.d.ts
CHANGED
|
@@ -1,123 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
a: number;
|
|
6
|
-
};
|
|
7
|
-
declare class Color {
|
|
8
|
-
#private;
|
|
9
|
-
constructor(value: string | Color);
|
|
10
|
-
/**
|
|
11
|
-
* Lightens the current color by the \
|
|
12
|
-
* transmitted number of conventional units.\
|
|
13
|
-
* \
|
|
14
|
-
* Example:
|
|
15
|
-
* ```tsx
|
|
16
|
-
* const color = theme.colors
|
|
17
|
-
* .accentPrimary
|
|
18
|
-
* .lighten(60)
|
|
19
|
-
* .toString();
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
*/
|
|
23
|
-
lighten(decimal: number): this;
|
|
24
|
-
/**
|
|
25
|
-
* Darkens the current color by\
|
|
26
|
-
* the transmitted number of conventional units.
|
|
27
|
-
* \
|
|
28
|
-
* Example:
|
|
29
|
-
* ```tsx
|
|
30
|
-
* const color = theme.colors
|
|
31
|
-
* .accentPrimary
|
|
32
|
-
* .darken(60)
|
|
33
|
-
* .toString();
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
darken(decimal: number): this;
|
|
37
|
-
/**
|
|
38
|
-
* Applies transparency (alpha channel) to the current color\
|
|
39
|
-
* Takes as an argument a number from 0 to 1
|
|
40
|
-
* \
|
|
41
|
-
* Example:
|
|
42
|
-
* ```tsx
|
|
43
|
-
* const color = theme.colors
|
|
44
|
-
* .accentPrimary
|
|
45
|
-
* .alpha(0.5)
|
|
46
|
-
* .toString();
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
alpha(decimal: number): this;
|
|
50
|
-
/**
|
|
51
|
-
* Returns color luminance value
|
|
52
|
-
*/
|
|
53
|
-
getLuminance(): number;
|
|
54
|
-
/**
|
|
55
|
-
* Returns the contrast level between the\
|
|
56
|
-
* current and transmitted colors
|
|
57
|
-
* \
|
|
58
|
-
* Example:
|
|
59
|
-
* ```tsx
|
|
60
|
-
* const { colors } = themes;
|
|
61
|
-
* const contrast = colors
|
|
62
|
-
* .accentPrimary
|
|
63
|
-
* .getContrast(color.textPrimary.rgbString());
|
|
64
|
-
*
|
|
65
|
-
* if (contrast > 5) {
|
|
66
|
-
* return color.textPrimary.toString();
|
|
67
|
-
* } else {
|
|
68
|
-
* return color.textSecondary.toString()
|
|
69
|
-
* }
|
|
70
|
-
* ```
|
|
71
|
-
*/
|
|
72
|
-
getContrast(rgb2: string | Color): number;
|
|
73
|
-
/**
|
|
74
|
-
* Lighten or darknest color to lum steps
|
|
75
|
-
* lum - 0-25
|
|
76
|
-
*/
|
|
77
|
-
private shade;
|
|
78
|
-
luminance(lum: number): this;
|
|
79
|
-
static stringToHashCode(str: string): number;
|
|
80
|
-
/**
|
|
81
|
-
* Convert the integer value to a string color value
|
|
82
|
-
*/
|
|
83
|
-
static intToRGB(i: number): string;
|
|
84
|
-
/**
|
|
85
|
-
* Convert GUID string value to a color string
|
|
86
|
-
*/
|
|
87
|
-
static uuidToColor(uuid: string): string;
|
|
88
|
-
/**
|
|
89
|
-
* Returns the current color as separate rgb channels
|
|
90
|
-
*/
|
|
91
|
-
rgb(): {
|
|
92
|
-
r: number;
|
|
93
|
-
g: number;
|
|
94
|
-
b: number;
|
|
95
|
-
a: number;
|
|
96
|
-
};
|
|
97
|
-
/**
|
|
98
|
-
* Returns the current color as an rgba string
|
|
99
|
-
*/
|
|
100
|
-
toString(): string;
|
|
101
|
-
/**
|
|
102
|
-
* Returns the current color as an rgba string
|
|
103
|
-
*/
|
|
104
|
-
rgbString(): string;
|
|
105
|
-
/**
|
|
106
|
-
* Returns the current color as a hex string
|
|
107
|
-
*/
|
|
108
|
-
hexString(): string;
|
|
109
|
-
/**
|
|
110
|
-
* Parse the transmitted color and returns its\
|
|
111
|
-
* representation as separate rgba channels
|
|
112
|
-
*/
|
|
113
|
-
static parseColor(value: string): ParsedColor;
|
|
114
|
-
/**
|
|
115
|
-
* Decodes the transmitted color value in hsl format to rgba
|
|
116
|
-
*/
|
|
117
|
-
static hslToRgb(value: string): ParsedColor;
|
|
118
|
-
/**
|
|
119
|
-
* Returns color code by web color name
|
|
120
|
-
*/
|
|
121
|
-
static getHextByWebColor(value: string): string;
|
|
122
|
-
}
|
|
1
|
+
import { Color } from './Color';
|
|
2
|
+
export * from './Color';
|
|
3
|
+
export * from './ColorParser';
|
|
4
|
+
export * from './ColorGenerator';
|
|
123
5
|
export default Color;
|