@tydavidson/design-system 1.1.13 → 1.1.15
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/index.js +105 -94
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +101 -94
- package/dist/index.mjs.map +1 -1
- package/dist/themes/index.d.mts +10 -15
- package/dist/themes/index.d.ts +10 -15
- package/dist/themes/index.js +105 -94
- package/dist/themes/index.js.map +1 -1
- package/dist/themes/index.mjs +101 -94
- package/dist/themes/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -44,68 +44,20 @@ var init_utils = __esm({
|
|
44
44
|
"src/lib/utils.ts"() {
|
45
45
|
}
|
46
46
|
});
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
// Will need additional classes
|
62
|
-
default:
|
63
|
-
return "default";
|
64
|
-
}
|
65
|
-
};
|
66
|
-
mapVariantToShadcnVariant = (variant) => {
|
67
|
-
switch (variant) {
|
68
|
-
case "primary":
|
69
|
-
return "default";
|
70
|
-
case "secondary":
|
71
|
-
return "outline";
|
72
|
-
case "tertiary":
|
73
|
-
return "ghost";
|
74
|
-
default:
|
75
|
-
return "default";
|
76
|
-
}
|
77
|
-
};
|
78
|
-
getColorVariantClasses = (color, variant) => {
|
79
|
-
const colorVariantMap = {
|
80
|
-
primary: {
|
81
|
-
brand: "bg-brand-600 hover:bg-brand-700 text-white focus-visible:ring-brand-500",
|
82
|
-
error: "bg-error-600 hover:bg-error-700 text-white focus-visible:ring-error-500",
|
83
|
-
warning: "bg-warning-600 hover:bg-warning-700 text-white focus-visible:ring-warning-500",
|
84
|
-
success: "bg-success-600 hover:bg-success-700 text-white focus-visible:ring-success-500"
|
85
|
-
},
|
86
|
-
secondary: {
|
87
|
-
brand: "border-brand-300 text-brand-700 hover:bg-brand-50 focus-visible:ring-brand-500",
|
88
|
-
error: "border-error-300 text-error-700 hover:bg-error-50 focus-visible:ring-error-500",
|
89
|
-
warning: "border-warning-300 text-warning-700 hover:bg-warning-50 focus-visible:ring-warning-500",
|
90
|
-
success: "border-success-300 text-success-700 hover:bg-success-50 focus-visible:ring-success-500"
|
91
|
-
},
|
92
|
-
tertiary: {
|
93
|
-
brand: "text-brand-700 hover:bg-brand-50 focus-visible:ring-brand-500",
|
94
|
-
error: "text-error-700 hover:bg-error-50 focus-visible:ring-error-500",
|
95
|
-
warning: "text-warning-700 hover:bg-warning-50 focus-visible:ring-warning-500",
|
96
|
-
success: "text-success-700 hover:bg-success-50 focus-visible:ring-success-500"
|
97
|
-
}
|
98
|
-
};
|
99
|
-
return colorVariantMap[variant]?.[color] || "";
|
100
|
-
};
|
101
|
-
isDarkTheme = (theme, systemTheme) => {
|
102
|
-
if (theme === "system") {
|
103
|
-
return systemTheme === "dark";
|
104
|
-
}
|
105
|
-
return theme === "dark";
|
106
|
-
};
|
107
|
-
}
|
108
|
-
});
|
47
|
+
function useThemeServer() {
|
48
|
+
return {
|
49
|
+
theme: "system",
|
50
|
+
setTheme: (theme) => {
|
51
|
+
},
|
52
|
+
resolvedTheme: "light",
|
53
|
+
isDark: false
|
54
|
+
};
|
55
|
+
}
|
56
|
+
function ThemeContextProvider({
|
57
|
+
children
|
58
|
+
}) {
|
59
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
60
|
+
}
|
109
61
|
function useTheme() {
|
110
62
|
const [themeData, setThemeData] = React2.useState({
|
111
63
|
theme: "system",
|
@@ -116,47 +68,48 @@ function useTheme() {
|
|
116
68
|
});
|
117
69
|
const [mounted, setMounted] = React2.useState(false);
|
118
70
|
React2.useEffect(() => {
|
119
|
-
|
120
|
-
|
121
|
-
const
|
71
|
+
if (typeof window === "undefined") return;
|
72
|
+
import('next-themes').then((nextThemes) => {
|
73
|
+
const themeManager = {
|
74
|
+
getTheme: () => {
|
75
|
+
if (typeof window !== "undefined") {
|
76
|
+
const savedTheme = localStorage.getItem("theme");
|
77
|
+
if (savedTheme) return savedTheme;
|
78
|
+
if (window.matchMedia("(prefers-color-scheme: dark)").matches) {
|
79
|
+
return "dark";
|
80
|
+
}
|
81
|
+
}
|
82
|
+
return "light";
|
83
|
+
},
|
84
|
+
setTheme: (theme) => {
|
85
|
+
if (typeof window !== "undefined") {
|
86
|
+
localStorage.setItem("theme", theme);
|
87
|
+
document.documentElement.classList.toggle("dark", theme === "dark");
|
88
|
+
setThemeData((prev) => ({
|
89
|
+
...prev,
|
90
|
+
theme,
|
91
|
+
resolvedTheme: theme,
|
92
|
+
isDark: theme === "dark"
|
93
|
+
}));
|
94
|
+
}
|
95
|
+
}
|
96
|
+
};
|
97
|
+
const currentTheme = themeManager.getTheme();
|
98
|
+
const isDark = currentTheme === "dark";
|
122
99
|
setThemeData({
|
123
|
-
theme:
|
124
|
-
setTheme,
|
125
|
-
resolvedTheme:
|
100
|
+
theme: currentTheme,
|
101
|
+
setTheme: themeManager.setTheme,
|
102
|
+
resolvedTheme: currentTheme,
|
126
103
|
isDark
|
127
104
|
});
|
128
105
|
setMounted(true);
|
129
106
|
});
|
130
107
|
}, []);
|
131
|
-
if (!mounted) {
|
132
|
-
return {
|
133
|
-
theme: "system",
|
134
|
-
setTheme: (theme) => {
|
135
|
-
},
|
136
|
-
resolvedTheme: "light",
|
137
|
-
isDark: false
|
138
|
-
};
|
139
|
-
}
|
140
108
|
return themeData;
|
141
109
|
}
|
142
|
-
function useThemeServer() {
|
143
|
-
return {
|
144
|
-
theme: "system",
|
145
|
-
setTheme: (theme) => {
|
146
|
-
},
|
147
|
-
resolvedTheme: "light",
|
148
|
-
isDark: false
|
149
|
-
};
|
150
|
-
}
|
151
|
-
function ThemeContextProvider({
|
152
|
-
children
|
153
|
-
}) {
|
154
|
-
return /* @__PURE__ */ jsx(Fragment, { children });
|
155
|
-
}
|
156
110
|
var init_theme_context = __esm({
|
157
111
|
"src/themes/theme-context.tsx"() {
|
158
112
|
"use client";
|
159
|
-
init_theme_utils();
|
160
113
|
}
|
161
114
|
});
|
162
115
|
function ThemeToggle({
|
@@ -1947,8 +1900,62 @@ function ClientThemeToggle(props) {
|
|
1947
1900
|
return /* @__PURE__ */ jsx(ThemeToggleComponent, { ...props });
|
1948
1901
|
}
|
1949
1902
|
|
1950
|
-
// src/
|
1951
|
-
|
1903
|
+
// src/lib/theme-utils.ts
|
1904
|
+
var mapColorToShadcnVariant = (color) => {
|
1905
|
+
switch (color) {
|
1906
|
+
case "brand":
|
1907
|
+
return "default";
|
1908
|
+
case "error":
|
1909
|
+
return "destructive";
|
1910
|
+
case "warning":
|
1911
|
+
case "success":
|
1912
|
+
return "secondary";
|
1913
|
+
// Will need additional classes
|
1914
|
+
default:
|
1915
|
+
return "default";
|
1916
|
+
}
|
1917
|
+
};
|
1918
|
+
var mapVariantToShadcnVariant = (variant) => {
|
1919
|
+
switch (variant) {
|
1920
|
+
case "primary":
|
1921
|
+
return "default";
|
1922
|
+
case "secondary":
|
1923
|
+
return "outline";
|
1924
|
+
case "tertiary":
|
1925
|
+
return "ghost";
|
1926
|
+
default:
|
1927
|
+
return "default";
|
1928
|
+
}
|
1929
|
+
};
|
1930
|
+
var getColorVariantClasses = (color, variant) => {
|
1931
|
+
const colorVariantMap = {
|
1932
|
+
primary: {
|
1933
|
+
brand: "bg-brand-600 hover:bg-brand-700 text-white focus-visible:ring-brand-500",
|
1934
|
+
error: "bg-error-600 hover:bg-error-700 text-white focus-visible:ring-error-500",
|
1935
|
+
warning: "bg-warning-600 hover:bg-warning-700 text-white focus-visible:ring-warning-500",
|
1936
|
+
success: "bg-success-600 hover:bg-success-700 text-white focus-visible:ring-success-500"
|
1937
|
+
},
|
1938
|
+
secondary: {
|
1939
|
+
brand: "border-brand-300 text-brand-700 hover:bg-brand-50 focus-visible:ring-brand-500",
|
1940
|
+
error: "border-error-300 text-error-700 hover:bg-error-50 focus-visible:ring-error-500",
|
1941
|
+
warning: "border-warning-300 text-warning-700 hover:bg-warning-50 focus-visible:ring-warning-500",
|
1942
|
+
success: "border-success-300 text-success-700 hover:bg-success-50 focus-visible:ring-success-500"
|
1943
|
+
},
|
1944
|
+
tertiary: {
|
1945
|
+
brand: "text-brand-700 hover:bg-brand-50 focus-visible:ring-brand-500",
|
1946
|
+
error: "text-error-700 hover:bg-error-50 focus-visible:ring-error-500",
|
1947
|
+
warning: "text-warning-700 hover:bg-warning-50 focus-visible:ring-warning-500",
|
1948
|
+
success: "text-success-700 hover:bg-success-50 focus-visible:ring-success-500"
|
1949
|
+
}
|
1950
|
+
};
|
1951
|
+
return colorVariantMap[variant]?.[color] || "";
|
1952
|
+
};
|
1953
|
+
var isDarkTheme = (theme, systemTheme) => {
|
1954
|
+
if (theme === "system") {
|
1955
|
+
return systemTheme === "dark";
|
1956
|
+
}
|
1957
|
+
return theme === "dark";
|
1958
|
+
};
|
1952
1959
|
|
1953
1960
|
export { Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, ClientThemeProvider, ClientThemeToggle, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, EmailButton, EmailCaption, EmailContainer, EmailFooter, EmailHeader, EmailHeading, EmailLayout, EmailMuted, EmailText, Heading, HoverCard, HoverCardContent, HoverCardTrigger, Input, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Slider, Text, ThemeContextProvider, ThemeProvider, ThemeProviderNoSSR, ThemeToggle, Toggle, ToggleGroup, ToggleGroupItem, buttonVariants, cn, colors, filterDOMProps, generateId, getColorVariantClasses, isDarkTheme, isNotNullOrUndefined, mapColorToShadcnVariant, mapVariantToShadcnVariant, radius, shadows, spacing, tokens, typography, useTheme, useThemeServer };
|
1954
1961
|
//# sourceMappingURL=index.mjs.map
|