@tecsinapse/cortex-core 1.3.0-beta.4 → 1.3.0-beta.6
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/badge/badge.js +1 -1
- package/dist/cjs/components/button/button.js +3 -3
- package/dist/cjs/components/common/common.js +1 -1
- package/dist/cjs/components/divider/divider.js +1 -1
- package/dist/cjs/components/hint/hint.js +1 -1
- package/dist/cjs/components/input/input.js +8 -8
- package/dist/cjs/components/popover/popover.js +1 -1
- package/dist/cjs/components/select/select.js +2 -2
- package/dist/cjs/components/snackbar/snackbar.js +1 -1
- package/dist/cjs/components/tag/tag.js +2 -2
- package/dist/cjs/components/toggle/toggle.js +2 -2
- package/dist/cjs/components/tooltip/tooltip.js +2 -2
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/provider/DarkThemeContext.js +15 -5
- package/dist/cjs/tokens/definitions.js +4 -2
- package/dist/esm/components/badge/badge.js +1 -1
- package/dist/esm/components/button/button.js +3 -3
- package/dist/esm/components/common/common.js +1 -1
- package/dist/esm/components/divider/divider.js +1 -1
- package/dist/esm/components/hint/hint.js +1 -1
- package/dist/esm/components/input/input.js +8 -8
- package/dist/esm/components/popover/popover.js +1 -1
- package/dist/esm/components/select/select.js +2 -2
- package/dist/esm/components/snackbar/snackbar.js +1 -1
- package/dist/esm/components/tag/tag.js +2 -2
- package/dist/esm/components/toggle/toggle.js +2 -2
- package/dist/esm/components/tooltip/tooltip.js +2 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/provider/DarkThemeContext.js +16 -6
- package/dist/esm/tokens/definitions.js +4 -2
- package/dist/types/components/divider/divider.d.ts +1 -1
- package/dist/types/components/input/input.d.ts +2 -2
- package/dist/types/components/popover/popover.d.ts +1 -1
- package/dist/types/components/toggle/toggle.d.ts +2 -2
- package/dist/types/components/tooltip/tooltip.d.ts +2 -2
- package/dist/types/preset/index.d.ts +1 -0
- package/dist/types/provider/DarkThemeContext.d.ts +5 -3
- package/dist/types/tokens/definitions.d.ts +2 -0
- package/package.json +2 -2
|
@@ -7,7 +7,7 @@ const buttonStyles = tailwindVariants.tv({
|
|
|
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",
|
|
10
|
-
secondary: "bg-
|
|
10
|
+
secondary: "bg-content-low disabled:bg-content-minimal active:bg-content-medium hover:bg-content-medium hover:border-content-medium ",
|
|
11
11
|
success: "bg-success-medium disabled:bg-success-light hover:bg-success-dark hover:border-success-dark",
|
|
12
12
|
info: " bg-info-medium disabled:bg-info-light hover:bg-info-dark hover:border-info-dark ",
|
|
13
13
|
warning: " bg-warning-medium disabled:bg-warning-light hover:bg-warning-dark hover:border-warning-dark",
|
|
@@ -35,7 +35,7 @@ const buttonStyles = tailwindVariants.tv({
|
|
|
35
35
|
{
|
|
36
36
|
intent: "secondary",
|
|
37
37
|
variant: "outline",
|
|
38
|
-
className: "text-
|
|
38
|
+
className: "text-content-low disabled:text-content-minimal border border-content-low disabled:border-content-minimal"
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
41
|
intent: "success",
|
|
@@ -65,7 +65,7 @@ const buttonStyles = tailwindVariants.tv({
|
|
|
65
65
|
{
|
|
66
66
|
intent: "secondary",
|
|
67
67
|
variant: "text",
|
|
68
|
-
className: "text-
|
|
68
|
+
className: "text-content-low disabled:text-content-minimal"
|
|
69
69
|
},
|
|
70
70
|
{
|
|
71
71
|
intent: "success",
|
|
@@ -6,7 +6,7 @@ const overlay = tailwindVariants.tv({
|
|
|
6
6
|
base: "fixed",
|
|
7
7
|
variants: {
|
|
8
8
|
show: {
|
|
9
|
-
true: "z-backdrop bg-
|
|
9
|
+
true: "z-backdrop bg-surface-inverse/50 h-full w-full left-0 top-0 transition cursor-pointer",
|
|
10
10
|
false: "invisible"
|
|
11
11
|
}
|
|
12
12
|
}
|
|
@@ -6,7 +6,7 @@ const hintStyles = tailwindVariants.tv({
|
|
|
6
6
|
base: "text-label font-bold flex items-center",
|
|
7
7
|
variants: {
|
|
8
8
|
intent: {
|
|
9
|
-
default: "text-
|
|
9
|
+
default: "text-content-low",
|
|
10
10
|
success: "text-success-medium",
|
|
11
11
|
warning: "text-warning-medium",
|
|
12
12
|
error: "text-error-medium"
|
|
@@ -9,9 +9,9 @@ const inputBaseStyles = tailwindVariants.tv({
|
|
|
9
9
|
intent: {
|
|
10
10
|
default: [
|
|
11
11
|
"input-secondary",
|
|
12
|
-
"border-
|
|
13
|
-
"focus-within:border-
|
|
14
|
-
"focus-within:outline-
|
|
12
|
+
"border-content-minimal",
|
|
13
|
+
"focus-within:border-content-medium",
|
|
14
|
+
"focus-within:outline-content-medium"
|
|
15
15
|
],
|
|
16
16
|
success: [
|
|
17
17
|
"input-success",
|
|
@@ -38,13 +38,13 @@ const inputBaseStyles = tailwindVariants.tv({
|
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
const labelBaseStyles = tailwindVariants.tv({
|
|
41
|
-
base: "absolute duration-300 -translate-y-2 scale-[0.72] top-2.5 z-10 origin-[0] peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-0 peer-focus:scale-[0.72] peer-focus:-translate-y-2 peer-focus:top-2.5 font-bold text-base peer-disabled:text-
|
|
41
|
+
base: "absolute duration-300 -translate-y-2 scale-[0.72] top-2.5 z-10 origin-[0] peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-0 peer-focus:scale-[0.72] peer-focus:-translate-y-2 peer-focus:top-2.5 font-bold text-base peer-disabled:text-content-minimal select-none w-max peer-autofill:scale-[0.72] peer-autofill:-translate-y-2 peer-autofill:top-2.5",
|
|
42
42
|
variants: {
|
|
43
43
|
intent: {
|
|
44
44
|
default: [
|
|
45
|
-
"text-
|
|
46
|
-
"peer-focus:text-
|
|
47
|
-
"peer-placeholder-shown:text-
|
|
45
|
+
"text-content-low",
|
|
46
|
+
"peer-focus:text-content-low",
|
|
47
|
+
"peer-placeholder-shown:text-content-low"
|
|
48
48
|
],
|
|
49
49
|
success: ["text-success-medium"],
|
|
50
50
|
warning: ["text-warning-medium"],
|
|
@@ -63,7 +63,7 @@ const labelStyle = ({ intent, placeholder, className }) => labelBaseStyles({
|
|
|
63
63
|
});
|
|
64
64
|
const inputBox = (placeholder, label2, className) => clsx.clsx(
|
|
65
65
|
className,
|
|
66
|
-
"peer relative outline-none placeholder:text-base placeholder:text-
|
|
66
|
+
"peer relative outline-none placeholder:text-base placeholder:text-content-low placeholder-shown:top-0 disabled:placeholder:text-content-minimal disabled:text-content-minimal bg-transparent",
|
|
67
67
|
{
|
|
68
68
|
"focus:top-1.5": !placeholder && !!label2,
|
|
69
69
|
"top-1.5": !!label2
|
|
@@ -6,7 +6,7 @@ const popoverContainer = tailwindVariants.tv({
|
|
|
6
6
|
base: "group relative inline-block"
|
|
7
7
|
});
|
|
8
8
|
const popoverStyles = tailwindVariants.tv({
|
|
9
|
-
base: "border border-gray-200 bg-
|
|
9
|
+
base: "border border-gray-200 bg-surface-inverse text-white p-4 rounded-md shadow-lg z-50"
|
|
10
10
|
});
|
|
11
11
|
const popover = (props) => popoverStyles(props);
|
|
12
12
|
|
|
@@ -15,8 +15,8 @@ const option = tailwindVariants.tv({
|
|
|
15
15
|
});
|
|
16
16
|
const selectVariants = tailwindVariants.tv({
|
|
17
17
|
slots: {
|
|
18
|
-
button: "disabled:pointer-events-none disabled:text-
|
|
19
|
-
groupedTitle: "font-bold text-
|
|
18
|
+
button: "disabled:pointer-events-none disabled:text-content-minimal flex w-full justify-between items-center bg-surface-overlay relative min-h-[44px] h-auto flex px-centi py-1.5 text-base font-bold items-center border border-content-minimal rounded-mili",
|
|
19
|
+
groupedTitle: "font-bold text-content-low mx-centi",
|
|
20
20
|
list: "list-none p-0"
|
|
21
21
|
},
|
|
22
22
|
variants: {
|
|
@@ -7,7 +7,7 @@ const snackbarStyles = tailwindVariants.tv({
|
|
|
7
7
|
variants: {
|
|
8
8
|
intent: {
|
|
9
9
|
default: "bg-primary-xlight text-primary-medium",
|
|
10
|
-
secondary: "bg-
|
|
10
|
+
secondary: "bg-content-inverse text-content-low",
|
|
11
11
|
success: "bg-success-xlight text-success-medium",
|
|
12
12
|
error: "bg-error-xlight text-error-medium",
|
|
13
13
|
info: "bg-info-xlight text-info-medium",
|
|
@@ -16,12 +16,12 @@ const tagStyles = myTV({
|
|
|
16
16
|
variants: {
|
|
17
17
|
intent: {
|
|
18
18
|
primary: "bg-primary-medium text-white",
|
|
19
|
-
secondary: "bg-
|
|
19
|
+
secondary: "bg-content-low text-white",
|
|
20
20
|
info: "bg-info-medium text-white",
|
|
21
21
|
success: "bg-success-medium text-white",
|
|
22
22
|
warning: "bg-warning-medium text-white",
|
|
23
23
|
error: "bg-error-medium text-white",
|
|
24
|
-
white: "bg-surface-overlay text-
|
|
24
|
+
white: "bg-surface-overlay text-content-low"
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
defaultVariants: {
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
var tailwindVariants = require('tailwind-variants');
|
|
4
4
|
|
|
5
5
|
const toggleStyles = tailwindVariants.tv({
|
|
6
|
-
base: "peer h-[22px] w-[40px] rounded-full bg-
|
|
6
|
+
base: "peer h-[22px] w-[40px] rounded-full bg-content-minimal after:absolute after:left-micro after:top-[3px] after:h-deca after:w-deca after:rounded-full after:border after:border-white after:bg-surface-overlay after:transition-all after:content-[''] peer-checked:after:translate-x-full peer-checked:after:border-white peer-focus:outline-none",
|
|
7
7
|
variants: {
|
|
8
8
|
intent: {
|
|
9
9
|
primary: "peer-focus:primary-medium peer-checked:bg-primary-medium",
|
|
10
|
-
secondary: "peer-focus:secondary-medium peer-checked:bg-
|
|
10
|
+
secondary: "peer-focus:secondary-medium peer-checked:bg-content-low",
|
|
11
11
|
info: "peer-focus:info-medium peer-checked:bg-info-medium",
|
|
12
12
|
success: "peer-focus:success-medium peer-checked:bg-success-medium",
|
|
13
13
|
warning: "peer-focus:warning-medium peer-checked:bg-warning-medium",
|
|
@@ -6,7 +6,7 @@ const tooltipContainer = tailwindVariants.tv({
|
|
|
6
6
|
base: "group relative inline-block"
|
|
7
7
|
});
|
|
8
8
|
const arrowTooltipStyles = tailwindVariants.tv({
|
|
9
|
-
base: 'after:content-[""] after:absolute after:border-
|
|
9
|
+
base: 'after:content-[""] after:absolute after:border-content-medium',
|
|
10
10
|
variants: {
|
|
11
11
|
position: {
|
|
12
12
|
top: "after:left-[50%] after:-ml-[5px] after:top-[100%] after:border-x-8 after:border-x-transparent after:border-t-[8px]",
|
|
@@ -15,7 +15,7 @@ const arrowTooltipStyles = tailwindVariants.tv({
|
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
const tooltipStyles = tailwindVariants.tv({
|
|
18
|
-
base: "h-8 mt-deca w-max h-fit invisible group-hover:visible opacity-0 group-hover:opacity-100 bg-
|
|
18
|
+
base: "h-8 mt-deca w-max h-fit invisible group-hover:visible opacity-0 group-hover:opacity-100 bg-content-medium text-white px-centi py-micro rounded-mili absolute",
|
|
19
19
|
variants: {
|
|
20
20
|
position: {
|
|
21
21
|
bottom: [
|
package/dist/cjs/index.js
CHANGED
|
@@ -76,5 +76,5 @@ exports.spacing = definitions.spacing;
|
|
|
76
76
|
exports.textColor = definitions.textColor;
|
|
77
77
|
exports.zIndex = definitions.zIndex;
|
|
78
78
|
exports.updateThemeColors = index$1.updateThemeColors;
|
|
79
|
-
exports.
|
|
79
|
+
exports.DarkThemeProvider = DarkThemeContext.DarkThemeProvider;
|
|
80
80
|
exports.useDarkTheme = DarkThemeContext.useDarkTheme;
|
|
@@ -4,8 +4,8 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
4
4
|
var react = require('react');
|
|
5
5
|
var definitions = require('../tokens/definitions.js');
|
|
6
6
|
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const DarkThemeContext = react.createContext(null);
|
|
8
|
+
const DarkThemeProvider = ({ children }) => {
|
|
9
9
|
const [theme, setTheme] = react.useState("light");
|
|
10
10
|
react.useEffect(() => {
|
|
11
11
|
const style = document.documentElement.style;
|
|
@@ -15,6 +15,7 @@ const ThemeProvider = ({ children }) => {
|
|
|
15
15
|
style.setProperty("--color-surface-base", definitions.darkColors.surface.base);
|
|
16
16
|
style.setProperty("--color-surface-raised", definitions.darkColors.surface.raised);
|
|
17
17
|
style.setProperty("--color-surface-overlay", definitions.darkColors.surface.overlay);
|
|
18
|
+
style.setProperty("--color-surface-inverse", definitions.darkColors.surface.inverse);
|
|
18
19
|
style.setProperty("--color-content-high", definitions.darkColors.content.high);
|
|
19
20
|
style.setProperty("--color-content-medium", definitions.darkColors.content.medium);
|
|
20
21
|
style.setProperty("--color-content-low", definitions.darkColors.content.low);
|
|
@@ -26,6 +27,7 @@ const ThemeProvider = ({ children }) => {
|
|
|
26
27
|
style.setProperty("--color-surface-base", definitions.colors.surface.base);
|
|
27
28
|
style.setProperty("--color-surface-raised", definitions.colors.surface.raised);
|
|
28
29
|
style.setProperty("--color-surface-overlay", definitions.colors.surface.overlay);
|
|
30
|
+
style.setProperty("--color-surface-inverse", definitions.colors.surface.inverse);
|
|
29
31
|
style.setProperty("--color-content-high", definitions.colors.content.high);
|
|
30
32
|
style.setProperty("--color-content-medium", definitions.colors.content.medium);
|
|
31
33
|
style.setProperty("--color-content-low", definitions.colors.content.low);
|
|
@@ -34,13 +36,21 @@ const ThemeProvider = ({ children }) => {
|
|
|
34
36
|
}
|
|
35
37
|
}, [theme]);
|
|
36
38
|
const toggleTheme = () => setTheme((t) => t === "light" ? "dark" : "light");
|
|
37
|
-
|
|
39
|
+
const isDark = react.useMemo(() => theme === "dark", [theme]);
|
|
40
|
+
const systemTheme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
41
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
42
|
+
DarkThemeContext.Provider,
|
|
43
|
+
{
|
|
44
|
+
value: { theme, setTheme, toggleTheme, isDark, systemTheme },
|
|
45
|
+
children
|
|
46
|
+
}
|
|
47
|
+
);
|
|
38
48
|
};
|
|
39
49
|
const useDarkTheme = () => {
|
|
40
|
-
const ctx = react.useContext(
|
|
50
|
+
const ctx = react.useContext(DarkThemeContext);
|
|
41
51
|
if (!ctx) throw new Error("useTheme must be used inside ThemeProvider");
|
|
42
52
|
return ctx;
|
|
43
53
|
};
|
|
44
54
|
|
|
45
|
-
exports.
|
|
55
|
+
exports.DarkThemeProvider = DarkThemeProvider;
|
|
46
56
|
exports.useDarkTheme = useDarkTheme;
|
|
@@ -8,7 +8,8 @@ const darkColors = {
|
|
|
8
8
|
surface: {
|
|
9
9
|
base: "#1e1e1e",
|
|
10
10
|
raised: "#252526",
|
|
11
|
-
overlay: "#2d2d30"
|
|
11
|
+
overlay: "#2d2d30",
|
|
12
|
+
inverse: "#fff"
|
|
12
13
|
},
|
|
13
14
|
content: {
|
|
14
15
|
high: "#f8f7f7",
|
|
@@ -57,7 +58,8 @@ const colors = {
|
|
|
57
58
|
surface: {
|
|
58
59
|
base: "var(--color-surface-base, #f8f7f7)",
|
|
59
60
|
raised: "var(--color-surface-raised, #fbfbfb)",
|
|
60
|
-
overlay: "var(--color-surface-overlay, #ffffff)"
|
|
61
|
+
overlay: "var(--color-surface-overlay, #ffffff)",
|
|
62
|
+
inverse: "var(--color-surface-inverse, #000000)"
|
|
61
63
|
},
|
|
62
64
|
content: {
|
|
63
65
|
high: "var(--color-content-high, #353231)",
|
|
@@ -5,7 +5,7 @@ const buttonStyles = tv({
|
|
|
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",
|
|
8
|
-
secondary: "bg-
|
|
8
|
+
secondary: "bg-content-low disabled:bg-content-minimal active:bg-content-medium hover:bg-content-medium hover:border-content-medium ",
|
|
9
9
|
success: "bg-success-medium disabled:bg-success-light hover:bg-success-dark hover:border-success-dark",
|
|
10
10
|
info: " bg-info-medium disabled:bg-info-light hover:bg-info-dark hover:border-info-dark ",
|
|
11
11
|
warning: " bg-warning-medium disabled:bg-warning-light hover:bg-warning-dark hover:border-warning-dark",
|
|
@@ -33,7 +33,7 @@ const buttonStyles = tv({
|
|
|
33
33
|
{
|
|
34
34
|
intent: "secondary",
|
|
35
35
|
variant: "outline",
|
|
36
|
-
className: "text-
|
|
36
|
+
className: "text-content-low disabled:text-content-minimal border border-content-low disabled:border-content-minimal"
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
intent: "success",
|
|
@@ -63,7 +63,7 @@ const buttonStyles = tv({
|
|
|
63
63
|
{
|
|
64
64
|
intent: "secondary",
|
|
65
65
|
variant: "text",
|
|
66
|
-
className: "text-
|
|
66
|
+
className: "text-content-low disabled:text-content-minimal"
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
69
|
intent: "success",
|
|
@@ -4,7 +4,7 @@ const overlay = tv({
|
|
|
4
4
|
base: "fixed",
|
|
5
5
|
variants: {
|
|
6
6
|
show: {
|
|
7
|
-
true: "z-backdrop bg-
|
|
7
|
+
true: "z-backdrop bg-surface-inverse/50 h-full w-full left-0 top-0 transition cursor-pointer",
|
|
8
8
|
false: "invisible"
|
|
9
9
|
}
|
|
10
10
|
}
|
|
@@ -7,9 +7,9 @@ const inputBaseStyles = tv({
|
|
|
7
7
|
intent: {
|
|
8
8
|
default: [
|
|
9
9
|
"input-secondary",
|
|
10
|
-
"border-
|
|
11
|
-
"focus-within:border-
|
|
12
|
-
"focus-within:outline-
|
|
10
|
+
"border-content-minimal",
|
|
11
|
+
"focus-within:border-content-medium",
|
|
12
|
+
"focus-within:outline-content-medium"
|
|
13
13
|
],
|
|
14
14
|
success: [
|
|
15
15
|
"input-success",
|
|
@@ -36,13 +36,13 @@ const inputBaseStyles = tv({
|
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
38
|
const labelBaseStyles = tv({
|
|
39
|
-
base: "absolute duration-300 -translate-y-2 scale-[0.72] top-2.5 z-10 origin-[0] peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-0 peer-focus:scale-[0.72] peer-focus:-translate-y-2 peer-focus:top-2.5 font-bold text-base peer-disabled:text-
|
|
39
|
+
base: "absolute duration-300 -translate-y-2 scale-[0.72] top-2.5 z-10 origin-[0] peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-0 peer-focus:scale-[0.72] peer-focus:-translate-y-2 peer-focus:top-2.5 font-bold text-base peer-disabled:text-content-minimal select-none w-max peer-autofill:scale-[0.72] peer-autofill:-translate-y-2 peer-autofill:top-2.5",
|
|
40
40
|
variants: {
|
|
41
41
|
intent: {
|
|
42
42
|
default: [
|
|
43
|
-
"text-
|
|
44
|
-
"peer-focus:text-
|
|
45
|
-
"peer-placeholder-shown:text-
|
|
43
|
+
"text-content-low",
|
|
44
|
+
"peer-focus:text-content-low",
|
|
45
|
+
"peer-placeholder-shown:text-content-low"
|
|
46
46
|
],
|
|
47
47
|
success: ["text-success-medium"],
|
|
48
48
|
warning: ["text-warning-medium"],
|
|
@@ -61,7 +61,7 @@ const labelStyle = ({ intent, placeholder, className }) => labelBaseStyles({
|
|
|
61
61
|
});
|
|
62
62
|
const inputBox = (placeholder, label2, className) => clsx(
|
|
63
63
|
className,
|
|
64
|
-
"peer relative outline-none placeholder:text-base placeholder:text-
|
|
64
|
+
"peer relative outline-none placeholder:text-base placeholder:text-content-low placeholder-shown:top-0 disabled:placeholder:text-content-minimal disabled:text-content-minimal bg-transparent",
|
|
65
65
|
{
|
|
66
66
|
"focus:top-1.5": !placeholder && !!label2,
|
|
67
67
|
"top-1.5": !!label2
|
|
@@ -4,7 +4,7 @@ const popoverContainer = tv({
|
|
|
4
4
|
base: "group relative inline-block"
|
|
5
5
|
});
|
|
6
6
|
const popoverStyles = tv({
|
|
7
|
-
base: "border border-gray-200 bg-
|
|
7
|
+
base: "border border-gray-200 bg-surface-inverse text-white p-4 rounded-md shadow-lg z-50"
|
|
8
8
|
});
|
|
9
9
|
const popover = (props) => popoverStyles(props);
|
|
10
10
|
|
|
@@ -13,8 +13,8 @@ const option = tv({
|
|
|
13
13
|
});
|
|
14
14
|
const selectVariants = tv({
|
|
15
15
|
slots: {
|
|
16
|
-
button: "disabled:pointer-events-none disabled:text-
|
|
17
|
-
groupedTitle: "font-bold text-
|
|
16
|
+
button: "disabled:pointer-events-none disabled:text-content-minimal flex w-full justify-between items-center bg-surface-overlay relative min-h-[44px] h-auto flex px-centi py-1.5 text-base font-bold items-center border border-content-minimal rounded-mili",
|
|
17
|
+
groupedTitle: "font-bold text-content-low mx-centi",
|
|
18
18
|
list: "list-none p-0"
|
|
19
19
|
},
|
|
20
20
|
variants: {
|
|
@@ -5,7 +5,7 @@ const snackbarStyles = tv({
|
|
|
5
5
|
variants: {
|
|
6
6
|
intent: {
|
|
7
7
|
default: "bg-primary-xlight text-primary-medium",
|
|
8
|
-
secondary: "bg-
|
|
8
|
+
secondary: "bg-content-inverse text-content-low",
|
|
9
9
|
success: "bg-success-xlight text-success-medium",
|
|
10
10
|
error: "bg-error-xlight text-error-medium",
|
|
11
11
|
info: "bg-info-xlight text-info-medium",
|
|
@@ -14,12 +14,12 @@ const tagStyles = myTV({
|
|
|
14
14
|
variants: {
|
|
15
15
|
intent: {
|
|
16
16
|
primary: "bg-primary-medium text-white",
|
|
17
|
-
secondary: "bg-
|
|
17
|
+
secondary: "bg-content-low text-white",
|
|
18
18
|
info: "bg-info-medium text-white",
|
|
19
19
|
success: "bg-success-medium text-white",
|
|
20
20
|
warning: "bg-warning-medium text-white",
|
|
21
21
|
error: "bg-error-medium text-white",
|
|
22
|
-
white: "bg-surface-overlay text-
|
|
22
|
+
white: "bg-surface-overlay text-content-low"
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
defaultVariants: {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { tv } from 'tailwind-variants';
|
|
2
2
|
|
|
3
3
|
const toggleStyles = tv({
|
|
4
|
-
base: "peer h-[22px] w-[40px] rounded-full bg-
|
|
4
|
+
base: "peer h-[22px] w-[40px] rounded-full bg-content-minimal after:absolute after:left-micro after:top-[3px] after:h-deca after:w-deca after:rounded-full after:border after:border-white after:bg-surface-overlay after:transition-all after:content-[''] peer-checked:after:translate-x-full peer-checked:after:border-white peer-focus:outline-none",
|
|
5
5
|
variants: {
|
|
6
6
|
intent: {
|
|
7
7
|
primary: "peer-focus:primary-medium peer-checked:bg-primary-medium",
|
|
8
|
-
secondary: "peer-focus:secondary-medium peer-checked:bg-
|
|
8
|
+
secondary: "peer-focus:secondary-medium peer-checked:bg-content-low",
|
|
9
9
|
info: "peer-focus:info-medium peer-checked:bg-info-medium",
|
|
10
10
|
success: "peer-focus:success-medium peer-checked:bg-success-medium",
|
|
11
11
|
warning: "peer-focus:warning-medium peer-checked:bg-warning-medium",
|
|
@@ -4,7 +4,7 @@ const tooltipContainer = tv({
|
|
|
4
4
|
base: "group relative inline-block"
|
|
5
5
|
});
|
|
6
6
|
const arrowTooltipStyles = tv({
|
|
7
|
-
base: 'after:content-[""] after:absolute after:border-
|
|
7
|
+
base: 'after:content-[""] after:absolute after:border-content-medium',
|
|
8
8
|
variants: {
|
|
9
9
|
position: {
|
|
10
10
|
top: "after:left-[50%] after:-ml-[5px] after:top-[100%] after:border-x-8 after:border-x-transparent after:border-t-[8px]",
|
|
@@ -13,7 +13,7 @@ const arrowTooltipStyles = tv({
|
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
15
|
const tooltipStyles = tv({
|
|
16
|
-
base: "h-8 mt-deca w-max h-fit invisible group-hover:visible opacity-0 group-hover:opacity-100 bg-
|
|
16
|
+
base: "h-8 mt-deca w-max h-fit invisible group-hover:visible opacity-0 group-hover:opacity-100 bg-content-medium text-white px-centi py-micro rounded-mili absolute",
|
|
17
17
|
variants: {
|
|
18
18
|
position: {
|
|
19
19
|
bottom: [
|
package/dist/esm/index.js
CHANGED
|
@@ -20,4 +20,4 @@ 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, darkColors, fontFamily, fontSize, spacing, textColor, zIndex } from './tokens/definitions.js';
|
|
22
22
|
export { updateThemeColors } from './utils/index.js';
|
|
23
|
-
export {
|
|
23
|
+
export { DarkThemeProvider, useDarkTheme } from './provider/DarkThemeContext.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { createContext, useState, useEffect, useContext } from 'react';
|
|
2
|
+
import { createContext, useState, useEffect, useMemo, useContext } from 'react';
|
|
3
3
|
import { darkColors, colors, textColor } from '../tokens/definitions.js';
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
const DarkThemeContext = createContext(null);
|
|
6
|
+
const DarkThemeProvider = ({ children }) => {
|
|
7
7
|
const [theme, setTheme] = useState("light");
|
|
8
8
|
useEffect(() => {
|
|
9
9
|
const style = document.documentElement.style;
|
|
@@ -13,6 +13,7 @@ const ThemeProvider = ({ children }) => {
|
|
|
13
13
|
style.setProperty("--color-surface-base", darkColors.surface.base);
|
|
14
14
|
style.setProperty("--color-surface-raised", darkColors.surface.raised);
|
|
15
15
|
style.setProperty("--color-surface-overlay", darkColors.surface.overlay);
|
|
16
|
+
style.setProperty("--color-surface-inverse", darkColors.surface.inverse);
|
|
16
17
|
style.setProperty("--color-content-high", darkColors.content.high);
|
|
17
18
|
style.setProperty("--color-content-medium", darkColors.content.medium);
|
|
18
19
|
style.setProperty("--color-content-low", darkColors.content.low);
|
|
@@ -24,6 +25,7 @@ const ThemeProvider = ({ children }) => {
|
|
|
24
25
|
style.setProperty("--color-surface-base", colors.surface.base);
|
|
25
26
|
style.setProperty("--color-surface-raised", colors.surface.raised);
|
|
26
27
|
style.setProperty("--color-surface-overlay", colors.surface.overlay);
|
|
28
|
+
style.setProperty("--color-surface-inverse", colors.surface.inverse);
|
|
27
29
|
style.setProperty("--color-content-high", colors.content.high);
|
|
28
30
|
style.setProperty("--color-content-medium", colors.content.medium);
|
|
29
31
|
style.setProperty("--color-content-low", colors.content.low);
|
|
@@ -32,12 +34,20 @@ const ThemeProvider = ({ children }) => {
|
|
|
32
34
|
}
|
|
33
35
|
}, [theme]);
|
|
34
36
|
const toggleTheme = () => setTheme((t) => t === "light" ? "dark" : "light");
|
|
35
|
-
|
|
37
|
+
const isDark = useMemo(() => theme === "dark", [theme]);
|
|
38
|
+
const systemTheme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
39
|
+
return /* @__PURE__ */ jsx(
|
|
40
|
+
DarkThemeContext.Provider,
|
|
41
|
+
{
|
|
42
|
+
value: { theme, setTheme, toggleTheme, isDark, systemTheme },
|
|
43
|
+
children
|
|
44
|
+
}
|
|
45
|
+
);
|
|
36
46
|
};
|
|
37
47
|
const useDarkTheme = () => {
|
|
38
|
-
const ctx = useContext(
|
|
48
|
+
const ctx = useContext(DarkThemeContext);
|
|
39
49
|
if (!ctx) throw new Error("useTheme must be used inside ThemeProvider");
|
|
40
50
|
return ctx;
|
|
41
51
|
};
|
|
42
52
|
|
|
43
|
-
export {
|
|
53
|
+
export { DarkThemeProvider, useDarkTheme };
|
|
@@ -6,7 +6,8 @@ const darkColors = {
|
|
|
6
6
|
surface: {
|
|
7
7
|
base: "#1e1e1e",
|
|
8
8
|
raised: "#252526",
|
|
9
|
-
overlay: "#2d2d30"
|
|
9
|
+
overlay: "#2d2d30",
|
|
10
|
+
inverse: "#fff"
|
|
10
11
|
},
|
|
11
12
|
content: {
|
|
12
13
|
high: "#f8f7f7",
|
|
@@ -55,7 +56,8 @@ const colors = {
|
|
|
55
56
|
surface: {
|
|
56
57
|
base: "var(--color-surface-base, #f8f7f7)",
|
|
57
58
|
raised: "var(--color-surface-raised, #fbfbfb)",
|
|
58
|
-
overlay: "var(--color-surface-overlay, #ffffff)"
|
|
59
|
+
overlay: "var(--color-surface-overlay, #ffffff)",
|
|
60
|
+
inverse: "var(--color-surface-inverse, #000000)"
|
|
59
61
|
},
|
|
60
62
|
content: {
|
|
61
63
|
high: "var(--color-content-high, #353231)",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const divider: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, "border-solid border-t border-
|
|
1
|
+
export declare const divider: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, "border-solid border-t border-content-minimal w-full", {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, "border-solid border-t border-content-minimal w-full", unknown, unknown, undefined>>;
|
|
@@ -28,7 +28,7 @@ declare const labelBaseStyles: import("tailwind-variants").TVReturnType<{
|
|
|
28
28
|
warning: string[];
|
|
29
29
|
error: string[];
|
|
30
30
|
};
|
|
31
|
-
}, undefined, "absolute duration-300 -translate-y-2 scale-[0.72] top-2.5 z-10 origin-[0] peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-0 peer-focus:scale-[0.72] peer-focus:-translate-y-2 peer-focus:top-2.5 font-bold text-base peer-disabled:text-
|
|
31
|
+
}, undefined, "absolute duration-300 -translate-y-2 scale-[0.72] top-2.5 z-10 origin-[0] peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-0 peer-focus:scale-[0.72] peer-focus:-translate-y-2 peer-focus:top-2.5 font-bold text-base peer-disabled:text-content-minimal select-none w-max peer-autofill:scale-[0.72] peer-autofill:-translate-y-2 peer-autofill:top-2.5", {
|
|
32
32
|
intent: {
|
|
33
33
|
default: string[];
|
|
34
34
|
success: string[];
|
|
@@ -42,7 +42,7 @@ declare const labelBaseStyles: import("tailwind-variants").TVReturnType<{
|
|
|
42
42
|
warning: string[];
|
|
43
43
|
error: string[];
|
|
44
44
|
};
|
|
45
|
-
}, undefined, "absolute duration-300 -translate-y-2 scale-[0.72] top-2.5 z-10 origin-[0] peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-0 peer-focus:scale-[0.72] peer-focus:-translate-y-2 peer-focus:top-2.5 font-bold text-base peer-disabled:text-
|
|
45
|
+
}, undefined, "absolute duration-300 -translate-y-2 scale-[0.72] top-2.5 z-10 origin-[0] peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-0 peer-focus:scale-[0.72] peer-focus:-translate-y-2 peer-focus:top-2.5 font-bold text-base peer-disabled:text-content-minimal select-none w-max peer-autofill:scale-[0.72] peer-autofill:-translate-y-2 peer-autofill:top-2.5", unknown, unknown, undefined>>;
|
|
46
46
|
export interface LabelVariants extends VariantProps<typeof labelBaseStyles> {
|
|
47
47
|
className?: string;
|
|
48
48
|
placeholder?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ClassProp, VariantProps } from 'tailwind-variants';
|
|
2
2
|
export declare const popoverContainer: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, "group relative inline-block", {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, "group relative inline-block", unknown, unknown, undefined>>;
|
|
3
|
-
export declare const popoverStyles: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, "border border-gray-200 bg-
|
|
3
|
+
export declare const popoverStyles: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, "border border-gray-200 bg-surface-inverse text-white p-4 rounded-md shadow-lg z-50", {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, "border border-gray-200 bg-surface-inverse text-white p-4 rounded-md shadow-lg z-50", unknown, unknown, undefined>>;
|
|
4
4
|
export type popoverVariants = VariantProps<typeof popoverStyles> & ClassProp;
|
|
5
5
|
export declare const popover: (props: popoverVariants) => string;
|
|
@@ -8,7 +8,7 @@ declare const toggleStyles: import("tailwind-variants").TVReturnType<{
|
|
|
8
8
|
warning: string;
|
|
9
9
|
error: string;
|
|
10
10
|
};
|
|
11
|
-
}, undefined, "peer h-[22px] w-[40px] rounded-full bg-
|
|
11
|
+
}, undefined, "peer h-[22px] w-[40px] rounded-full bg-content-minimal after:absolute after:left-micro after:top-[3px] after:h-deca after:w-deca after:rounded-full after:border after:border-white after:bg-surface-overlay after:transition-all after:content-[''] peer-checked:after:translate-x-full peer-checked:after:border-white peer-focus:outline-none", {
|
|
12
12
|
intent: {
|
|
13
13
|
primary: string;
|
|
14
14
|
secondary: string;
|
|
@@ -26,7 +26,7 @@ declare const toggleStyles: import("tailwind-variants").TVReturnType<{
|
|
|
26
26
|
warning: string;
|
|
27
27
|
error: string;
|
|
28
28
|
};
|
|
29
|
-
}, undefined, "peer h-[22px] w-[40px] rounded-full bg-
|
|
29
|
+
}, undefined, "peer h-[22px] w-[40px] rounded-full bg-content-minimal after:absolute after:left-micro after:top-[3px] after:h-deca after:w-deca after:rounded-full after:border after:border-white after:bg-surface-overlay after:transition-all after:content-[''] peer-checked:after:translate-x-full peer-checked:after:border-white peer-focus:outline-none", unknown, unknown, undefined>>;
|
|
30
30
|
export declare const styleLabelElement: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, "relative inline-flex cursor-pointer items-center", {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, "relative inline-flex cursor-pointer items-center", unknown, unknown, undefined>>;
|
|
31
31
|
export declare const styleInputElement: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, "peer sr-only", {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, "peer sr-only", unknown, unknown, undefined>>;
|
|
32
32
|
type ToggleVariants = VariantProps<typeof toggleStyles> & ClassProp;
|
|
@@ -5,7 +5,7 @@ declare const tooltipStyles: import("tailwind-variants").TVReturnType<{
|
|
|
5
5
|
bottom: string[];
|
|
6
6
|
top: string[];
|
|
7
7
|
};
|
|
8
|
-
}, undefined, "h-8 mt-deca w-max h-fit invisible group-hover:visible opacity-0 group-hover:opacity-100 bg-
|
|
8
|
+
}, undefined, "h-8 mt-deca w-max h-fit invisible group-hover:visible opacity-0 group-hover:opacity-100 bg-content-medium text-white px-centi py-micro rounded-mili absolute", {
|
|
9
9
|
position: {
|
|
10
10
|
bottom: string[];
|
|
11
11
|
top: string[];
|
|
@@ -15,7 +15,7 @@ declare const tooltipStyles: import("tailwind-variants").TVReturnType<{
|
|
|
15
15
|
bottom: string[];
|
|
16
16
|
top: string[];
|
|
17
17
|
};
|
|
18
|
-
}, undefined, "h-8 mt-deca w-max h-fit invisible group-hover:visible opacity-0 group-hover:opacity-100 bg-
|
|
18
|
+
}, undefined, "h-8 mt-deca w-max h-fit invisible group-hover:visible opacity-0 group-hover:opacity-100 bg-content-medium text-white px-centi py-micro rounded-mili absolute", unknown, unknown, undefined>>;
|
|
19
19
|
export type TooltipVariants = VariantProps<typeof tooltipStyles> & ClassProp;
|
|
20
20
|
export declare const tooltip: (props: TooltipVariants) => string;
|
|
21
21
|
export {};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
type Theme = 'light' | 'dark';
|
|
3
|
-
interface
|
|
3
|
+
interface DarkThemeContextValue {
|
|
4
4
|
theme: Theme;
|
|
5
5
|
setTheme: (theme: Theme) => void;
|
|
6
6
|
toggleTheme: () => void;
|
|
7
|
+
isDark: boolean;
|
|
8
|
+
systemTheme: 'dark' | 'light';
|
|
7
9
|
}
|
|
8
|
-
export declare const
|
|
10
|
+
export declare const DarkThemeProvider: ({ children }: {
|
|
9
11
|
children: ReactNode;
|
|
10
12
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export declare const useDarkTheme: () =>
|
|
13
|
+
export declare const useDarkTheme: () => DarkThemeContextValue;
|
|
12
14
|
export {};
|
|
@@ -7,6 +7,7 @@ declare const darkColors: {
|
|
|
7
7
|
base: string;
|
|
8
8
|
raised: string;
|
|
9
9
|
overlay: string;
|
|
10
|
+
inverse: string;
|
|
10
11
|
};
|
|
11
12
|
content: {
|
|
12
13
|
high: string;
|
|
@@ -56,6 +57,7 @@ declare const colors: {
|
|
|
56
57
|
base: string;
|
|
57
58
|
raised: string;
|
|
58
59
|
overlay: string;
|
|
60
|
+
inverse: string;
|
|
59
61
|
};
|
|
60
62
|
content: {
|
|
61
63
|
high: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tecsinapse/cortex-core",
|
|
3
|
-
"version": "1.3.0-beta.
|
|
3
|
+
"version": "1.3.0-beta.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Core library for tailwindcss based design",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"tailwindcss": ">=3.3.0"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "0c43136aeff2c19f5dfe1f410b4566dec107097b"
|
|
35
35
|
}
|