@rovula/ui 0.0.30 → 0.0.32
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/cjs/bundle.css +1173 -243
- package/dist/cjs/bundle.js +2 -2
- package/dist/cjs/bundle.js.map +1 -1
- package/dist/cjs/types/components/Dropdown/Dropdown.d.ts +12 -2
- package/dist/cjs/types/components/Dropdown/Dropdown.stories.d.ts +12 -2
- package/dist/cjs/types/components/InputFilter/InputFilter.d.ts +63 -4
- package/dist/cjs/types/components/InputFilter/InputFilter.stories.d.ts +54 -18
- package/dist/cjs/types/components/InputFilter/InputFilter.styles.d.ts +1 -0
- package/dist/cjs/types/components/Search/Search.stories.d.ts +7 -1
- package/dist/cjs/types/stories/ColorPreview.d.ts +9 -5
- package/dist/cjs/types/utils/colors.d.ts +1 -0
- package/dist/components/ActionButton/ActionButton.stories.js +1 -1
- package/dist/components/Checkbox/Checkbox.js +3 -3
- package/dist/components/Checkbox/Checkbox.stories.js +1 -1
- package/dist/components/Dropdown/Dropdown.js +12 -8
- package/dist/components/Dropdown/Dropdown.styles.js +1 -1
- package/dist/components/InputFilter/InputFilter.js +118 -12
- package/dist/components/InputFilter/InputFilter.stories.js +5 -4
- package/dist/components/InputFilter/InputFilter.styles.js +9 -4
- package/dist/components/RadioGroup/RadioGroup.js +5 -2
- package/dist/components/RadioGroup/RadioGroup.stories.js +1 -1
- package/dist/components/Search/Search.stories.js +2 -1
- package/dist/components/Text/Text.stories.js +5 -1
- package/dist/components/TextInput/TextInput.js +2 -1
- package/dist/components/TextInput/TextInput.styles.js +10 -9
- package/dist/esm/bundle.css +1173 -243
- package/dist/esm/bundle.js +2 -2
- package/dist/esm/bundle.js.map +1 -1
- package/dist/esm/types/components/Dropdown/Dropdown.d.ts +12 -2
- package/dist/esm/types/components/Dropdown/Dropdown.stories.d.ts +12 -2
- package/dist/esm/types/components/InputFilter/InputFilter.d.ts +63 -4
- package/dist/esm/types/components/InputFilter/InputFilter.stories.d.ts +54 -18
- package/dist/esm/types/components/InputFilter/InputFilter.styles.d.ts +1 -0
- package/dist/esm/types/components/Search/Search.stories.d.ts +7 -1
- package/dist/esm/types/stories/ColorPreview.d.ts +9 -5
- package/dist/esm/types/utils/colors.d.ts +1 -0
- package/dist/index.d.ts +83 -14
- package/dist/src/theme/global.css +1526 -348
- package/dist/stories/ColorGroupPreview.js +282 -472
- package/dist/stories/ColorPreview.js +76 -6
- package/dist/theme/main-preset.js +8 -0
- package/dist/theme/plugins/utilities/typography.js +3 -0
- package/dist/theme/presets/colors.js +18 -0
- package/dist/theme/themes/xspector/color.css +13 -0
- package/dist/theme/themes/xspector/components/action-button.css +44 -42
- package/dist/theme/themes/xspector/state.css +1 -1
- package/dist/theme/tokens/color.css +13 -0
- package/dist/theme/tokens/components/action-button.css +42 -55
- package/dist/utils/colors.js +31 -0
- package/package.json +1 -1
- package/src/components/ActionButton/ActionButton.stories.tsx +1 -1
- package/src/components/Checkbox/Checkbox.stories.tsx +1 -1
- package/src/components/Checkbox/Checkbox.tsx +4 -4
- package/src/components/Dropdown/Dropdown.styles.ts +1 -1
- package/src/components/Dropdown/Dropdown.tsx +22 -8
- package/src/components/InputFilter/InputFilter.stories.tsx +9 -8
- package/src/components/InputFilter/InputFilter.styles.ts +9 -4
- package/src/components/InputFilter/InputFilter.tsx +301 -42
- package/src/components/RadioGroup/RadioGroup.stories.tsx +1 -1
- package/src/components/RadioGroup/RadioGroup.tsx +7 -9
- package/src/components/Search/Search.stories.tsx +2 -1
- package/src/components/Text/Text.stories.tsx +5 -1
- package/src/components/TextInput/TextInput.styles.ts +10 -9
- package/src/components/TextInput/TextInput.tsx +11 -10
- package/src/stories/ColorGroupPreview.tsx +394 -486
- package/src/stories/ColorPreview.tsx +122 -33
- package/src/theme/main-preset.js +8 -0
- package/src/theme/plugins/utilities/typography.js +3 -0
- package/src/theme/presets/colors.js +18 -0
- package/src/theme/themes/xspector/color.css +13 -0
- package/src/theme/themes/xspector/components/action-button.css +44 -42
- package/src/theme/themes/xspector/state.css +1 -1
- package/src/theme/tokens/color.css +13 -0
- package/src/theme/tokens/components/action-button.css +42 -55
- package/src/utils/colors.ts +33 -0
|
@@ -1,45 +1,134 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { srgbToHex } from "@/utils/colors";
|
|
2
|
+
import React, { useEffect, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { Popover, PopoverContent, PopoverTrigger } from "..";
|
|
2
4
|
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
export const ColorBox = ({ className }: { className: string }) => {
|
|
6
|
+
const boxRef = useRef<HTMLDivElement>(null);
|
|
7
|
+
const [hex, setHex] = useState("");
|
|
8
|
+
const [isOpen, setOpen] = useState(false);
|
|
9
|
+
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (boxRef.current) {
|
|
12
|
+
const bgColor = window.getComputedStyle(boxRef.current).backgroundColor;
|
|
13
|
+
const hexColor = srgbToHex(bgColor);
|
|
14
|
+
|
|
15
|
+
setHex(hexColor);
|
|
16
|
+
}
|
|
17
|
+
}, []);
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
let time: NodeJS.Timeout | undefined;
|
|
21
|
+
|
|
22
|
+
if (isOpen) {
|
|
23
|
+
setTimeout(() => {
|
|
24
|
+
setOpen(false);
|
|
25
|
+
}, 1000);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return () => {
|
|
29
|
+
if (time) {
|
|
30
|
+
clearTimeout(time);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}, [isOpen]);
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<div className="flex flex-1 flex-col gap-1">
|
|
37
|
+
<Popover open={isOpen}>
|
|
38
|
+
<PopoverTrigger
|
|
39
|
+
onClick={() => {
|
|
40
|
+
if (className) {
|
|
41
|
+
navigator.clipboard
|
|
42
|
+
.writeText(className)
|
|
43
|
+
.then(() => {
|
|
44
|
+
console.log("ClassName copied to clipboard");
|
|
45
|
+
})
|
|
46
|
+
.catch((err) => {
|
|
47
|
+
console.error("Failed to copy className: ", err);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
setOpen(true);
|
|
51
|
+
}}
|
|
52
|
+
>
|
|
53
|
+
<div
|
|
54
|
+
ref={boxRef}
|
|
55
|
+
className={`${className} h-12 rounded border shadow`}
|
|
56
|
+
/>
|
|
57
|
+
</PopoverTrigger>
|
|
58
|
+
<PopoverContent className="p-3 w-fit min-w-fit">
|
|
59
|
+
Copied to clipboard
|
|
60
|
+
</PopoverContent>
|
|
61
|
+
</Popover>
|
|
62
|
+
<div className="text-gray-500 flex flex-col justify-center items-center">
|
|
63
|
+
<div style={{ fontSize: 12, whiteSpace: "pre" }}>{className}</div>
|
|
16
64
|
<div
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
65
|
+
style={{
|
|
66
|
+
fontSize: 12,
|
|
67
|
+
textTransform: "uppercase",
|
|
68
|
+
whiteSpace: "pre",
|
|
69
|
+
}}
|
|
20
70
|
>
|
|
21
|
-
|
|
71
|
+
{hex || "Loading..."}
|
|
22
72
|
</div>
|
|
23
73
|
</div>
|
|
24
|
-
|
|
25
|
-
|
|
74
|
+
</div>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const ColorItems = ({
|
|
79
|
+
title,
|
|
80
|
+
subTitle,
|
|
81
|
+
colors,
|
|
82
|
+
col = -1,
|
|
83
|
+
}: {
|
|
84
|
+
title?: string;
|
|
85
|
+
subTitle?: string;
|
|
86
|
+
colors: string[];
|
|
87
|
+
col?: number;
|
|
88
|
+
}) => {
|
|
89
|
+
const gridColumnsClass = useMemo(() => {
|
|
90
|
+
if (col !== undefined) {
|
|
91
|
+
switch (col) {
|
|
92
|
+
case 1:
|
|
93
|
+
return "grid grid-cols-1";
|
|
94
|
+
case 2:
|
|
95
|
+
return "grid grid-cols-2";
|
|
96
|
+
case 3:
|
|
97
|
+
return "grid grid-cols-3";
|
|
98
|
+
case 4:
|
|
99
|
+
return "grid grid-cols-4";
|
|
100
|
+
case 5:
|
|
101
|
+
return "grid grid-cols-5";
|
|
102
|
+
case 6:
|
|
103
|
+
return "grid grid-cols-6";
|
|
104
|
+
case 7:
|
|
105
|
+
return "grid grid-cols-7";
|
|
106
|
+
case 8:
|
|
107
|
+
return "grid grid-cols-8";
|
|
108
|
+
case 9:
|
|
109
|
+
return "grid grid-cols-9";
|
|
110
|
+
case 10:
|
|
111
|
+
return "grid grid-cols-10";
|
|
112
|
+
default:
|
|
113
|
+
return colors.length >= 8 ? "grid grid-cols-4" : `flex `;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}, [col]);
|
|
26
117
|
|
|
27
118
|
return (
|
|
28
|
-
<div className=" flex-
|
|
29
|
-
<div
|
|
119
|
+
<div className="flex flex-wrap flex-col">
|
|
120
|
+
{title && <div style={{ fontSize: 16, fontWeight: "600" }}>{title}</div>}
|
|
121
|
+
{subTitle && (
|
|
122
|
+
<div style={{ fontSize: 14, fontWeight: "600" }}>{subTitle}</div>
|
|
123
|
+
)}
|
|
30
124
|
<div
|
|
31
|
-
className={
|
|
32
|
-
|
|
33
|
-
}
|
|
125
|
+
className={` gap-2 mt-3 ${gridColumnsClass}`}
|
|
126
|
+
style={{ marginTop: 12 }}
|
|
34
127
|
>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
style={{ fontSize: "8px" }}
|
|
39
|
-
>
|
|
40
|
-
{colorCode}
|
|
41
|
-
</div>
|
|
128
|
+
{colors.map((color) => (
|
|
129
|
+
<ColorBox key={color} className={color} />
|
|
130
|
+
))}
|
|
42
131
|
</div>
|
|
43
132
|
</div>
|
|
44
133
|
);
|
|
45
|
-
}
|
|
134
|
+
};
|
package/src/theme/main-preset.js
CHANGED
|
@@ -204,6 +204,14 @@ module.exports = {
|
|
|
204
204
|
fontFamily: "var(--small8-family, 'Poppins')",
|
|
205
205
|
},
|
|
206
206
|
],
|
|
207
|
+
small9: [
|
|
208
|
+
"var(--small9-size, 8px)",
|
|
209
|
+
{
|
|
210
|
+
lineHeight: "var(--small9-line-height, 10px)",
|
|
211
|
+
fontWeight: "var(--small9-weight, 400)",
|
|
212
|
+
fontFamily: "var(--small9-family, 'Poppins')",
|
|
213
|
+
},
|
|
214
|
+
],
|
|
207
215
|
label1: [
|
|
208
216
|
"var(--label-label1-size, 12px)",
|
|
209
217
|
{
|
|
@@ -71,6 +71,24 @@ module.exports = {
|
|
|
71
71
|
"input-label-bg": withColorMixin("--input-color-label-bg"),
|
|
72
72
|
"input-error": withColorMixin("--input-color-error"),
|
|
73
73
|
|
|
74
|
+
"function-default-solid": withColorMixin("--function-default-solid"),
|
|
75
|
+
"function-default-hover": withColorMixin("--function-default-hover"),
|
|
76
|
+
"function-default-hover-bg": withColorMixin(
|
|
77
|
+
"--function-default-hover-bg"
|
|
78
|
+
),
|
|
79
|
+
"function-default-stroke": withColorMixin("--function-default-stroke"),
|
|
80
|
+
"function-default-icon": withColorMixin("--function-default-icon"),
|
|
81
|
+
"function-default-outline": withColorMixin(
|
|
82
|
+
"--function-default-outline-icon"
|
|
83
|
+
),
|
|
84
|
+
"function-active-solid": withColorMixin("--function-active-solid"),
|
|
85
|
+
"function-active-hover": withColorMixin("--function-active-hover"),
|
|
86
|
+
"function-active-hover-bg": withColorMixin(
|
|
87
|
+
"--function-active-hover-bg"
|
|
88
|
+
),
|
|
89
|
+
"function-active-stroke": withColorMixin("--function-active-stroke"),
|
|
90
|
+
"function-active-icon": withColorMixin("--function-active-icon"),
|
|
91
|
+
|
|
74
92
|
"base-bg": withColorMixin("--base-color-bg"),
|
|
75
93
|
"base-bg2": withColorMixin("--base-color-bg2"),
|
|
76
94
|
"base-bg3": withColorMixin("--base-color-bg3"),
|
|
@@ -11,6 +11,19 @@
|
|
|
11
11
|
--input-color-label-bg: #2d2e30;
|
|
12
12
|
--input-color-error: #ff4d35;
|
|
13
13
|
|
|
14
|
+
/* Function button */
|
|
15
|
+
--function-default-solid: #ececec;
|
|
16
|
+
--function-default-hover: #fafafa;
|
|
17
|
+
--function-default-hover-bg: rgba(250 250 250 / 0.08);
|
|
18
|
+
--function-default-stroke: rgba(158 158 158 / 0.24);
|
|
19
|
+
--function-default-icon: #212b36;
|
|
20
|
+
--function-default-outline-icon: #9e9e9e;
|
|
21
|
+
--function-active-solid: #b1a400;
|
|
22
|
+
--function-active-hover: #ddcd00;
|
|
23
|
+
--function-active-hover-bg: rgba(221 205 0 / 0.08);
|
|
24
|
+
--function-active-stroke: rgba(177 164 0 / 0.48);
|
|
25
|
+
--function-active-icon: #212b36;
|
|
26
|
+
|
|
14
27
|
--text-dark: #212b36;
|
|
15
28
|
--text-medium: #637381;
|
|
16
29
|
--text-light: #919eab;
|
|
@@ -12,34 +12,34 @@
|
|
|
12
12
|
/* ------------------------------------------------------------------ */
|
|
13
13
|
|
|
14
14
|
/* Default State */
|
|
15
|
-
--action-button-solid-default-bg: var(--
|
|
16
|
-
--action-button-solid-default-border: var(--
|
|
17
|
-
--action-button-solid-default-text: var(--
|
|
15
|
+
--action-button-solid-default-bg: var(--function-default-solid);
|
|
16
|
+
--action-button-solid-default-border: var(--function-default-solid);
|
|
17
|
+
--action-button-solid-default-text: var(--function-default-icon);
|
|
18
18
|
|
|
19
19
|
/* Hover State */
|
|
20
|
-
--action-button-solid-hover-bg: var(--
|
|
21
|
-
--action-button-solid-hover-border: var(--
|
|
22
|
-
--action-button-solid-hover-text: var(--
|
|
20
|
+
--action-button-solid-hover-bg: var(--function-default-hover);
|
|
21
|
+
--action-button-solid-hover-border: var(--function-default-hover);
|
|
22
|
+
--action-button-solid-hover-text: var(--function-default-icon);
|
|
23
23
|
|
|
24
24
|
/* Pressed State */
|
|
25
|
-
--action-button-solid-pressed-bg: var(--
|
|
26
|
-
--action-button-solid-pressed-border: var(--
|
|
27
|
-
--action-button-solid-pressed-text: var(--
|
|
25
|
+
--action-button-solid-pressed-bg: var(--function-default-solid);
|
|
26
|
+
--action-button-solid-pressed-border: var(--function-default-solid);
|
|
27
|
+
--action-button-solid-pressed-text: var(--function-default-icon);
|
|
28
28
|
|
|
29
29
|
/* Active State */
|
|
30
|
-
--action-button-solid-active-bg: var(--
|
|
31
|
-
--action-button-solid-active-border: var(--
|
|
32
|
-
--action-button-solid-active-text: var(--
|
|
30
|
+
--action-button-solid-active-bg: var(--function-active-solid);
|
|
31
|
+
--action-button-solid-active-border: var(--function-active-solid);
|
|
32
|
+
--action-button-solid-active-text: var(--function-active-icon);
|
|
33
33
|
|
|
34
34
|
/* Active Hover State */
|
|
35
|
-
--action-button-solid-active-hover-bg: var(--
|
|
36
|
-
--action-button-solid-active-hover-border: var(--
|
|
37
|
-
--action-button-solid-active-hover-text: var(--
|
|
35
|
+
--action-button-solid-active-hover-bg: var(--function-active-hover);
|
|
36
|
+
--action-button-solid-active-hover-border: var(--function-active-hover);
|
|
37
|
+
--action-button-solid-active-hover-text: var(--function-active-icon);
|
|
38
38
|
|
|
39
39
|
/* Active Pressed State */
|
|
40
|
-
--action-button-solid-active-pressed-bg: var(--
|
|
41
|
-
--action-button-solid-active-pressed-border: var(--
|
|
42
|
-
--action-button-solid-active-pressed-text: var(--
|
|
40
|
+
--action-button-solid-active-pressed-bg: var(--function-active-solid);
|
|
41
|
+
--action-button-solid-active-pressed-border: var(--function-active-solid);
|
|
42
|
+
--action-button-solid-active-pressed-text: var(--function-active-icon);
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
/* ------------------------------------------------------------------ */
|
|
@@ -47,52 +47,54 @@
|
|
|
47
47
|
/* ------------------------------------------------------------------ */
|
|
48
48
|
|
|
49
49
|
/* Default State */
|
|
50
|
-
--action-button-outline-default-border: var(--
|
|
51
|
-
--action-button-outline-default-text: var(--
|
|
50
|
+
--action-button-outline-default-border: var(--function-default-stroke);
|
|
51
|
+
--action-button-outline-default-text: var(--function-default-outline-icon);
|
|
52
52
|
|
|
53
53
|
/* Hover State */
|
|
54
|
-
--action-button-outline-hover-bg:
|
|
55
|
-
--action-button-outline-hover-border: var(--
|
|
56
|
-
--action-button-outline-hover-text: var(--
|
|
54
|
+
--action-button-outline-hover-bg: var(--function-default-hover-bg);
|
|
55
|
+
--action-button-outline-hover-border: var(--function-default-hover);
|
|
56
|
+
--action-button-outline-hover-text: var(--function-default-hover);
|
|
57
57
|
|
|
58
58
|
/* Pressed State */
|
|
59
|
-
--action-button-outline-pressed-bg: var(--
|
|
60
|
-
--action-button-outline-pressed-border: var(--
|
|
61
|
-
--action-button-outline-pressed-text: var(--
|
|
59
|
+
--action-button-outline-pressed-bg: var(--function-default-hover-bg);
|
|
60
|
+
--action-button-outline-pressed-border: var(--function-default-stroke);
|
|
61
|
+
--action-button-outline-pressed-text: var(--function-default-outline-icon);
|
|
62
62
|
|
|
63
63
|
/* Active State */
|
|
64
|
-
--action-button-outline-active-border: var(--
|
|
65
|
-
--action-button-outline-active-text: var(--
|
|
64
|
+
--action-button-outline-active-border: var(--function-active-stroke);
|
|
65
|
+
--action-button-outline-active-text: var(--function-active-solid);
|
|
66
66
|
|
|
67
67
|
/* Active Hover State */
|
|
68
|
-
--action-button-outline-active-hover-bg: var(--
|
|
69
|
-
--action-button-outline-active-hover-border: var(--
|
|
70
|
-
--action-button-outline-active-hover-text: var(--
|
|
68
|
+
--action-button-outline-active-hover-bg: var(--function-active-hover-bg);;
|
|
69
|
+
--action-button-outline-active-hover-border: var(--function-active-hover);
|
|
70
|
+
--action-button-outline-active-hover-text: var(--function-active-hover);
|
|
71
71
|
|
|
72
72
|
/* Active Pressed State */
|
|
73
|
-
--action-button-outline-active-pressed-bg: var(--
|
|
74
|
-
--action-button-outline-active-pressed-border: var(--
|
|
75
|
-
--action-button-outline-active-pressed-text: var(--
|
|
73
|
+
--action-button-outline-active-pressed-bg: var(--function-active-hover-bg);;
|
|
74
|
+
--action-button-outline-active-pressed-border: var(--function-active-stroke);
|
|
75
|
+
--action-button-outline-active-pressed-text: var(--function-active-solid);
|
|
76
76
|
|
|
77
77
|
/* ------------------------------------------------------------------ */
|
|
78
78
|
/* Icon Mode Tokens */
|
|
79
79
|
/* ------------------------------------------------------------------ */
|
|
80
80
|
|
|
81
81
|
/* Default State */
|
|
82
|
-
--action-button-icon-default-text: var(--
|
|
82
|
+
--action-button-icon-default-text: var(--function-default-outline-icon);
|
|
83
83
|
|
|
84
84
|
/* Hover State */
|
|
85
|
-
--action-button-icon-hover-bg: var(--
|
|
86
|
-
--action-button-icon-hover-text: var(--
|
|
85
|
+
--action-button-icon-hover-bg: var(--function-default-hover-bg);
|
|
86
|
+
--action-button-icon-hover-text: var(--function-default-hover);
|
|
87
87
|
|
|
88
88
|
/* Pressed State */
|
|
89
|
-
--action-button-icon-pressed-text: var(--
|
|
89
|
+
--action-button-icon-pressed-text: var(--function-default-outline-icon);
|
|
90
90
|
|
|
91
91
|
/* Active State */
|
|
92
|
-
--action-button-icon-active-text: var(--
|
|
92
|
+
--action-button-icon-active-text: var(--function-active-solid);
|
|
93
93
|
|
|
94
94
|
/* Active Hover State */
|
|
95
|
-
--action-button-icon-active-hover-bg:
|
|
96
|
-
--action-button-icon-active-hover-text: var(--
|
|
97
|
-
|
|
95
|
+
--action-button-icon-active-hover-bg: var(--function-active-hover-bg);
|
|
96
|
+
--action-button-icon-active-hover-text: var(--function-active-hover);
|
|
97
|
+
|
|
98
|
+
/* Active Pressed State */
|
|
99
|
+
--action-button-icon-active-pressed-text: var(--function-active-solid);
|
|
98
100
|
}
|
|
@@ -11,6 +11,19 @@
|
|
|
11
11
|
--input-color-label-bg: #ffffff;/* #2d2e30; */
|
|
12
12
|
--input-color-error: #ed2f15;
|
|
13
13
|
|
|
14
|
+
/* Function button */
|
|
15
|
+
--function-default-solid: #1e3249;
|
|
16
|
+
--function-default-hover: #35475b;
|
|
17
|
+
--function-default-hover-bg: rgba(30 50 73 / 0.08);
|
|
18
|
+
--function-default-stroke: rgba(30 50 73 / 0.48);
|
|
19
|
+
--function-default-icon: #ffffff;
|
|
20
|
+
--function-default-outline-icon: #1e3249;
|
|
21
|
+
--function-active-solid: #9b8f00;
|
|
22
|
+
--function-active-hover: #b1a400;
|
|
23
|
+
--function-active-hover-bg: rgba(221 205 0 / 0.08);
|
|
24
|
+
--function-active-stroke: rgba(177 164 0 / 0.48);
|
|
25
|
+
--function-active-icon: #ffffff;
|
|
26
|
+
|
|
14
27
|
--text-dark: #18283a;
|
|
15
28
|
--text-medium: #4b5b6d;
|
|
16
29
|
--text-light: #8e98a4;
|
|
@@ -11,48 +11,35 @@
|
|
|
11
11
|
/* Solid Mode Tokens */
|
|
12
12
|
/* ------------------------------------------------------------------ */
|
|
13
13
|
|
|
14
|
-
/* TODO */
|
|
15
|
-
--function-default-solid: #ececec;
|
|
16
|
-
--function-default-hover: #fafafa;
|
|
17
|
-
--function-default-hover-bg: rgba(250 250 250 / 0.08);
|
|
18
|
-
--function-default-stroke: rgba(158 158 158 / 0.24);
|
|
19
|
-
--function-default-icon: #212b36;
|
|
20
|
-
--function-default-outline-icon: #9e9e9e;
|
|
21
|
-
--function-active-solid: #b1a400;
|
|
22
|
-
--function-active-hover: #ddcd00;
|
|
23
|
-
--function-active-hover-bg: rgba(221 205 0 / 0.08);
|
|
24
|
-
--function-active-stroke: rgba(177 164 0 / 0.48);
|
|
25
|
-
--function-active-icon: #212b36;
|
|
26
|
-
|
|
27
14
|
/* Default State */
|
|
28
|
-
--action-button-solid-default-bg: var(--
|
|
29
|
-
--action-button-solid-default-border: var(--
|
|
30
|
-
--action-button-solid-default-text: var(--
|
|
15
|
+
--action-button-solid-default-bg: var(--function-default-solid);
|
|
16
|
+
--action-button-solid-default-border: var(--function-default-solid);
|
|
17
|
+
--action-button-solid-default-text: var(--function-default-icon);
|
|
31
18
|
|
|
32
19
|
/* Hover State */
|
|
33
|
-
--action-button-solid-hover-bg: var(--
|
|
34
|
-
--action-button-solid-hover-border: var(--
|
|
35
|
-
--action-button-solid-hover-text: var(--
|
|
20
|
+
--action-button-solid-hover-bg: var(--function-default-hover);
|
|
21
|
+
--action-button-solid-hover-border: var(--function-default-hover);
|
|
22
|
+
--action-button-solid-hover-text: var(--function-default-icon);
|
|
36
23
|
|
|
37
24
|
/* Pressed State */
|
|
38
|
-
--action-button-solid-pressed-bg: var(--
|
|
39
|
-
--action-button-solid-pressed-border: var(--
|
|
40
|
-
--action-button-solid-pressed-text: var(--
|
|
25
|
+
--action-button-solid-pressed-bg: var(--function-default-solid);
|
|
26
|
+
--action-button-solid-pressed-border: var(--function-default-solid);
|
|
27
|
+
--action-button-solid-pressed-text: var(--function-default-icon);
|
|
41
28
|
|
|
42
29
|
/* Active State */
|
|
43
|
-
--action-button-solid-active-bg: var(--
|
|
44
|
-
--action-button-solid-active-border: var(--
|
|
45
|
-
--action-button-solid-active-text: var(--
|
|
30
|
+
--action-button-solid-active-bg: var(--function-active-solid);
|
|
31
|
+
--action-button-solid-active-border: var(--function-active-solid);
|
|
32
|
+
--action-button-solid-active-text: var(--function-active-icon);
|
|
46
33
|
|
|
47
34
|
/* Active Hover State */
|
|
48
|
-
--action-button-solid-active-hover-bg: var(--
|
|
49
|
-
--action-button-solid-active-hover-border: var(--
|
|
50
|
-
--action-button-solid-active-hover-text: var(--
|
|
35
|
+
--action-button-solid-active-hover-bg: var(--function-active-hover);
|
|
36
|
+
--action-button-solid-active-hover-border: var(--function-active-hover);
|
|
37
|
+
--action-button-solid-active-hover-text: var(--function-active-icon);
|
|
51
38
|
|
|
52
39
|
/* Active Pressed State */
|
|
53
|
-
--action-button-solid-active-pressed-bg: var(--
|
|
54
|
-
--action-button-solid-active-pressed-border: var(--
|
|
55
|
-
--action-button-solid-active-pressed-text: var(--
|
|
40
|
+
--action-button-solid-active-pressed-bg: var(--function-active-solid);
|
|
41
|
+
--action-button-solid-active-pressed-border: var(--function-active-solid);
|
|
42
|
+
--action-button-solid-active-pressed-text: var(--function-active-icon);
|
|
56
43
|
|
|
57
44
|
/* Disabled State */
|
|
58
45
|
--action-button-solid-disabled-bg: var(--state-color-disable-solid);
|
|
@@ -66,33 +53,33 @@
|
|
|
66
53
|
|
|
67
54
|
/* Default State */
|
|
68
55
|
--action-button-outline-default-bg: transparent;
|
|
69
|
-
--action-button-outline-default-border: var(--
|
|
70
|
-
--action-button-outline-default-text: var(--
|
|
56
|
+
--action-button-outline-default-border: var(--function-default-stroke);
|
|
57
|
+
--action-button-outline-default-text: var(--function-default-outline-icon);
|
|
71
58
|
|
|
72
59
|
/* Hover State */
|
|
73
|
-
--action-button-outline-hover-bg:
|
|
74
|
-
--action-button-outline-hover-border: var(--
|
|
75
|
-
--action-button-outline-hover-text: var(--
|
|
60
|
+
--action-button-outline-hover-bg: var(--function-default-hover-bg);
|
|
61
|
+
--action-button-outline-hover-border: var(--function-default-hover);
|
|
62
|
+
--action-button-outline-hover-text: var(--function-default-hover);
|
|
76
63
|
|
|
77
64
|
/* Pressed State */
|
|
78
|
-
--action-button-outline-pressed-bg: var(--
|
|
79
|
-
--action-button-outline-pressed-border: var(--
|
|
80
|
-
--action-button-outline-pressed-text: var(--
|
|
65
|
+
--action-button-outline-pressed-bg: var(--function-default-hover-bg);
|
|
66
|
+
--action-button-outline-pressed-border: var(--function-default-stroke);
|
|
67
|
+
--action-button-outline-pressed-text: var(--function-default-outline-icon);
|
|
81
68
|
|
|
82
69
|
/* Active State */
|
|
83
70
|
--action-button-outline-active-bg: transparent;
|
|
84
|
-
--action-button-outline-active-border: var(--
|
|
85
|
-
--action-button-outline-active-text: var(--
|
|
71
|
+
--action-button-outline-active-border: var(--function-active-stroke);
|
|
72
|
+
--action-button-outline-active-text: var(--function-active-solid);
|
|
86
73
|
|
|
87
74
|
/* Active Hover State */
|
|
88
|
-
--action-button-outline-active-hover-bg: var(--
|
|
89
|
-
--action-button-outline-active-hover-border: var(--
|
|
90
|
-
--action-button-outline-active-hover-text: var(--
|
|
75
|
+
--action-button-outline-active-hover-bg: var(--function-active-hover-bg);;
|
|
76
|
+
--action-button-outline-active-hover-border: var(--function-active-hover);
|
|
77
|
+
--action-button-outline-active-hover-text: var(--function-active-hover);
|
|
91
78
|
|
|
92
79
|
/* Active Pressed State */
|
|
93
|
-
--action-button-outline-active-pressed-bg: var(--
|
|
94
|
-
--action-button-outline-active-pressed-border: var(--
|
|
95
|
-
--action-button-outline-active-pressed-text: var(--
|
|
80
|
+
--action-button-outline-active-pressed-bg: var(--function-active-hover-bg);;
|
|
81
|
+
--action-button-outline-active-pressed-border: var(--function-active-stroke);
|
|
82
|
+
--action-button-outline-active-pressed-text: var(--function-active-solid);
|
|
96
83
|
|
|
97
84
|
/* Disabled State */
|
|
98
85
|
--action-button-outline-disabled-bg: transparent;
|
|
@@ -106,32 +93,32 @@
|
|
|
106
93
|
/* Default State */
|
|
107
94
|
--action-button-icon-default-bg: transparent;
|
|
108
95
|
--action-button-icon-default-border: transparent;
|
|
109
|
-
--action-button-icon-default-text: var(--
|
|
96
|
+
--action-button-icon-default-text: var(--function-default-outline-icon);
|
|
110
97
|
|
|
111
98
|
/* Hover State */
|
|
112
|
-
--action-button-icon-hover-bg: var(--
|
|
99
|
+
--action-button-icon-hover-bg: var(--function-default-hover-bg);
|
|
113
100
|
--action-button-icon-hover-border: transparent;
|
|
114
|
-
--action-button-icon-hover-text: var(--
|
|
101
|
+
--action-button-icon-hover-text: var(--function-default-hover);
|
|
115
102
|
|
|
116
103
|
/* Pressed State */
|
|
117
104
|
--action-button-icon-pressed-bg: transparent;
|
|
118
105
|
--action-button-icon-pressed-border: transparent;
|
|
119
|
-
--action-button-icon-pressed-text: var(--
|
|
106
|
+
--action-button-icon-pressed-text: var(--function-default-outline-icon);
|
|
120
107
|
|
|
121
108
|
/* Active State */
|
|
122
109
|
--action-button-icon-active-bg: transparent;
|
|
123
110
|
--action-button-icon-active-border: transparent;
|
|
124
|
-
--action-button-icon-active-text: var(--
|
|
111
|
+
--action-button-icon-active-text: var(--function-active-solid);
|
|
125
112
|
|
|
126
113
|
/* Active Hover State */
|
|
127
|
-
--action-button-icon-active-hover-bg:
|
|
114
|
+
--action-button-icon-active-hover-bg: var(--function-active-hover-bg);
|
|
128
115
|
--action-button-icon-active-hover-border: transparent;
|
|
129
|
-
--action-button-icon-active-hover-text: var(--
|
|
116
|
+
--action-button-icon-active-hover-text: var(--function-active-hover);
|
|
130
117
|
|
|
131
118
|
/* Active Pressed State */
|
|
132
119
|
--action-button-icon-active-pressed-bg: transparent;
|
|
133
120
|
--action-button-icon-active-pressed-border: transparent;
|
|
134
|
-
--action-button-icon-active-pressed-text: var(--
|
|
121
|
+
--action-button-icon-active-pressed-text: var(--function-active-solid);
|
|
135
122
|
|
|
136
123
|
/* Disabled State */
|
|
137
124
|
--action-button-icon-disabled-bg: transparent;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export const srgbToHex = (color: string) => {
|
|
2
|
+
if (color.startsWith("color(")) {
|
|
3
|
+
const rgbValues = color.match(/([\d.]+)/g);
|
|
4
|
+
|
|
5
|
+
if (rgbValues && rgbValues.length >= 3) {
|
|
6
|
+
const [r, g, b] = rgbValues
|
|
7
|
+
.slice(0, 3)
|
|
8
|
+
.map((x) => Math.round(parseFloat(x) * 255));
|
|
9
|
+
let hex = `#${[r, g, b]
|
|
10
|
+
.map((x) => ("0" + x.toString(16)).slice(-2))
|
|
11
|
+
.join("")}`;
|
|
12
|
+
|
|
13
|
+
if (rgbValues.length === 4) {
|
|
14
|
+
const alpha = Math.round(parseFloat(rgbValues[3]) * 255);
|
|
15
|
+
hex += ("0" + alpha.toString(16)).slice(-2);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return hex;
|
|
19
|
+
}
|
|
20
|
+
} else if (color.startsWith("#")) {
|
|
21
|
+
return color;
|
|
22
|
+
} else {
|
|
23
|
+
const rgbValues = color.match(/\d+/g);
|
|
24
|
+
if (rgbValues && rgbValues.length >= 3) {
|
|
25
|
+
return `#${rgbValues
|
|
26
|
+
.slice(0, 3)
|
|
27
|
+
.map((x) => ("0" + parseInt(x).toString(16)).slice(-2))
|
|
28
|
+
.join("")}`;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return color;
|
|
33
|
+
};
|