@tecsinapse/cortex-core 1.2.1-beta.2 → 1.3.0-beta.0
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/components/button/button.js +1 -1
- package/dist/cjs/components/tag/tag.js +1 -1
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/tokens/definitions.js +4 -4
- package/dist/cjs/utils/index.js +10 -7
- package/dist/esm/components/button/button.js +1 -1
- package/dist/esm/components/tag/tag.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/tokens/definitions.js +4 -4
- package/dist/esm/utils/index.js +10 -8
- package/dist/types/components/button/button.d.ts +2 -2
- package/dist/types/utils/index.d.ts +1 -0
- package/package.json +2 -3
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var tailwindVariants = require('tailwind-variants');
|
|
4
4
|
|
|
5
5
|
const buttonStyles = tailwindVariants.tv({
|
|
6
|
-
base: "text-base h-fit font-bold disabled:text-
|
|
6
|
+
base: "text-base h-fit font-bold disabled:text-white enabled:active:scale-95 transform transition hover:text-white text-white cursor-pointer items-center flex justify-center",
|
|
7
7
|
variants: {
|
|
8
8
|
intent: {
|
|
9
9
|
primary: "bg-primary-medium disabled:bg-primary-light active:bg-primary-dark enabled:hover:border-primary-dark hover:bg-primary-dark",
|
|
@@ -15,7 +15,7 @@ const tagStyles = myTV({
|
|
|
15
15
|
base: "rounded-micro px-micro py-nano w-fit font-bold text-label items-center flex gap-1",
|
|
16
16
|
variants: {
|
|
17
17
|
intent: {
|
|
18
|
-
primary: "bg-primary-medium text-
|
|
18
|
+
primary: "bg-primary-medium text-white",
|
|
19
19
|
secondary: "bg-secondary-medium text-white",
|
|
20
20
|
info: "bg-info-medium text-white",
|
|
21
21
|
success: "bg-success-medium text-white",
|
package/dist/cjs/index.js
CHANGED
|
@@ -73,4 +73,5 @@ exports.fontSize = definitions.fontSize;
|
|
|
73
73
|
exports.spacing = definitions.spacing;
|
|
74
74
|
exports.textColor = definitions.textColor;
|
|
75
75
|
exports.zIndex = definitions.zIndex;
|
|
76
|
+
exports.setDarkMode = index$1.setDarkMode;
|
|
76
77
|
exports.updateThemeColors = index$1.updateThemeColors;
|
|
@@ -44,7 +44,7 @@ const colors = {
|
|
|
44
44
|
xdark: "#58240e"
|
|
45
45
|
},
|
|
46
46
|
miscellaneous: {
|
|
47
|
-
body: "#f8f7f7"
|
|
47
|
+
body: "var(--color-body, #f8f7f7)"
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
const spacing = {
|
|
@@ -153,9 +153,9 @@ const fontFamily = {
|
|
|
153
153
|
mono: "Consolas, monaco, monospace"
|
|
154
154
|
};
|
|
155
155
|
const textColor = {
|
|
156
|
-
light: "
|
|
157
|
-
medium: "
|
|
158
|
-
dark: "
|
|
156
|
+
light: "#fff",
|
|
157
|
+
medium: "#85807a",
|
|
158
|
+
dark: "#353231",
|
|
159
159
|
orange: "#f89907"
|
|
160
160
|
};
|
|
161
161
|
const zIndex = {
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var polished = require('polished');
|
|
4
|
-
|
|
5
3
|
const updateThemeColors = (theme) => {
|
|
6
4
|
const root = document.documentElement;
|
|
7
5
|
Object.entries(theme).forEach(([colorName, colorShades]) => {
|
|
@@ -9,13 +7,18 @@ const updateThemeColors = (theme) => {
|
|
|
9
7
|
Object.entries(colorShades).forEach(([shade, hexValue]) => {
|
|
10
8
|
if (!hexValue) return;
|
|
11
9
|
root.style.setProperty(`--color-${colorName}-${shade}`, hexValue);
|
|
12
|
-
if (colorName === "primary" && shade === "medium") {
|
|
13
|
-
if (polished.getContrast(hexValue, "#fff") < 4.5) {
|
|
14
|
-
root.style.setProperty("--color-text-light", polished.readableColor(hexValue));
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
10
|
});
|
|
18
11
|
});
|
|
19
12
|
};
|
|
13
|
+
const setDarkMode = () => {
|
|
14
|
+
const style = document.documentElement.style;
|
|
15
|
+
const isDark = style.getPropertyValue("--color-body") !== "#f8f7f7";
|
|
16
|
+
if (!isDark) {
|
|
17
|
+
style.setProperty("--color-body", "#1e1e1e");
|
|
18
|
+
} else {
|
|
19
|
+
style.setProperty("--color-body", "#f8f7f7");
|
|
20
|
+
}
|
|
21
|
+
};
|
|
20
22
|
|
|
23
|
+
exports.setDarkMode = setDarkMode;
|
|
21
24
|
exports.updateThemeColors = updateThemeColors;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { tv } from 'tailwind-variants';
|
|
2
2
|
|
|
3
3
|
const buttonStyles = tv({
|
|
4
|
-
base: "text-base h-fit font-bold disabled:text-
|
|
4
|
+
base: "text-base h-fit font-bold disabled:text-white enabled:active:scale-95 transform transition hover:text-white text-white cursor-pointer items-center flex justify-center",
|
|
5
5
|
variants: {
|
|
6
6
|
intent: {
|
|
7
7
|
primary: "bg-primary-medium disabled:bg-primary-light active:bg-primary-dark enabled:hover:border-primary-dark hover:bg-primary-dark",
|
|
@@ -13,7 +13,7 @@ const tagStyles = myTV({
|
|
|
13
13
|
base: "rounded-micro px-micro py-nano w-fit font-bold text-label items-center flex gap-1",
|
|
14
14
|
variants: {
|
|
15
15
|
intent: {
|
|
16
|
-
primary: "bg-primary-medium text-
|
|
16
|
+
primary: "bg-primary-medium text-white",
|
|
17
17
|
secondary: "bg-secondary-medium text-white",
|
|
18
18
|
info: "bg-info-medium text-white",
|
|
19
19
|
success: "bg-success-medium text-white",
|
package/dist/esm/index.js
CHANGED
|
@@ -19,4 +19,4 @@ export { tooltip, tooltipContainer } from './components/tooltip/tooltip.js';
|
|
|
19
19
|
export { manager } from './components/manager/manager.js';
|
|
20
20
|
export { default as preset } from './preset/index.js';
|
|
21
21
|
export { borderColor, borderRadius, borderWidth, boxShadow, colors, fontFamily, fontSize, spacing, textColor, zIndex } from './tokens/definitions.js';
|
|
22
|
-
export { updateThemeColors } from './utils/index.js';
|
|
22
|
+
export { setDarkMode, updateThemeColors } from './utils/index.js';
|
|
@@ -42,7 +42,7 @@ const colors = {
|
|
|
42
42
|
xdark: "#58240e"
|
|
43
43
|
},
|
|
44
44
|
miscellaneous: {
|
|
45
|
-
body: "#f8f7f7"
|
|
45
|
+
body: "var(--color-body, #f8f7f7)"
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
const spacing = {
|
|
@@ -151,9 +151,9 @@ const fontFamily = {
|
|
|
151
151
|
mono: "Consolas, monaco, monospace"
|
|
152
152
|
};
|
|
153
153
|
const textColor = {
|
|
154
|
-
light: "
|
|
155
|
-
medium: "
|
|
156
|
-
dark: "
|
|
154
|
+
light: "#fff",
|
|
155
|
+
medium: "#85807a",
|
|
156
|
+
dark: "#353231",
|
|
157
157
|
orange: "#f89907"
|
|
158
158
|
};
|
|
159
159
|
const zIndex = {
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { getContrast, readableColor } from 'polished';
|
|
2
|
-
|
|
3
1
|
const updateThemeColors = (theme) => {
|
|
4
2
|
const root = document.documentElement;
|
|
5
3
|
Object.entries(theme).forEach(([colorName, colorShades]) => {
|
|
@@ -7,13 +5,17 @@ const updateThemeColors = (theme) => {
|
|
|
7
5
|
Object.entries(colorShades).forEach(([shade, hexValue]) => {
|
|
8
6
|
if (!hexValue) return;
|
|
9
7
|
root.style.setProperty(`--color-${colorName}-${shade}`, hexValue);
|
|
10
|
-
if (colorName === "primary" && shade === "medium") {
|
|
11
|
-
if (getContrast(hexValue, "#fff") < 4.5) {
|
|
12
|
-
root.style.setProperty("--color-text-light", readableColor(hexValue));
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
8
|
});
|
|
16
9
|
});
|
|
17
10
|
};
|
|
11
|
+
const setDarkMode = () => {
|
|
12
|
+
const style = document.documentElement.style;
|
|
13
|
+
const isDark = style.getPropertyValue("--color-body") !== "#f8f7f7";
|
|
14
|
+
if (!isDark) {
|
|
15
|
+
style.setProperty("--color-body", "#1e1e1e");
|
|
16
|
+
} else {
|
|
17
|
+
style.setProperty("--color-body", "#f8f7f7");
|
|
18
|
+
}
|
|
19
|
+
};
|
|
18
20
|
|
|
19
|
-
export { updateThemeColors };
|
|
21
|
+
export { setDarkMode, updateThemeColors };
|
|
@@ -20,7 +20,7 @@ export declare const buttonStyles: import("tailwind-variants").TVReturnType<{
|
|
|
20
20
|
circle: string;
|
|
21
21
|
base: string;
|
|
22
22
|
};
|
|
23
|
-
}, undefined, "text-base h-fit font-bold disabled:text-
|
|
23
|
+
}, undefined, "text-base h-fit font-bold disabled:text-white enabled:active:scale-95 transform transition hover:text-white text-white cursor-pointer items-center flex justify-center", {
|
|
24
24
|
intent: {
|
|
25
25
|
primary: string;
|
|
26
26
|
secondary: string;
|
|
@@ -62,7 +62,7 @@ export declare const buttonStyles: import("tailwind-variants").TVReturnType<{
|
|
|
62
62
|
circle: string;
|
|
63
63
|
base: string;
|
|
64
64
|
};
|
|
65
|
-
}, undefined, "text-base h-fit font-bold disabled:text-
|
|
65
|
+
}, undefined, "text-base h-fit font-bold disabled:text-white enabled:active:scale-95 transform transition hover:text-white text-white cursor-pointer items-center flex justify-center", unknown, unknown, undefined>>;
|
|
66
66
|
export type ButtonVariants = VariantProps<typeof buttonStyles> & {
|
|
67
67
|
className?: string;
|
|
68
68
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tecsinapse/cortex-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0-beta.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Core library for tailwindcss based design",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"clsx": "2.1.1",
|
|
20
|
-
"polished": "^4.3.1",
|
|
21
20
|
"tailwind-variants": "1.0.0"
|
|
22
21
|
},
|
|
23
22
|
"repository": {
|
|
@@ -32,5 +31,5 @@
|
|
|
32
31
|
"peerDependencies": {
|
|
33
32
|
"tailwindcss": ">=3.3.0"
|
|
34
33
|
},
|
|
35
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "c267542fbb45c9c598be530f2c2d4211365a816e"
|
|
36
35
|
}
|