@tydavidson/design-system 1.1.15 → 1.1.17
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.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +68 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +69 -12
- package/dist/index.mjs.map +1 -1
- package/dist/themes/index.d.mts +13 -50
- package/dist/themes/index.d.ts +13 -50
- package/dist/themes/index.js +68 -14
- package/dist/themes/index.js.map +1 -1
- package/dist/themes/index.mjs +69 -12
- package/dist/themes/index.mjs.map +1 -1
- package/docs/troubleshooting.md +147 -99
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
3
3
|
import React__default from 'react';
|
4
4
|
import { VariantProps } from 'class-variance-authority';
|
5
5
|
import { ThemeColor } from './themes/index.mjs';
|
6
|
-
export { ClientThemeProvider, ClientThemeToggle, ComponentVariant,
|
6
|
+
export { ClientThemeProvider, ClientThemeToggle, ComponentVariant, ThemeProvider, ThemeProviderNoSSR, getColorVariantClasses, isDarkTheme, mapColorToShadcnVariant, mapVariantToShadcnVariant, useThemeServer } from './themes/index.mjs';
|
7
7
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
8
8
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
9
9
|
import * as TogglePrimitive from '@radix-ui/react-toggle';
|
package/dist/index.d.ts
CHANGED
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
3
3
|
import React__default from 'react';
|
4
4
|
import { VariantProps } from 'class-variance-authority';
|
5
5
|
import { ThemeColor } from './themes/index.js';
|
6
|
-
export { ClientThemeProvider, ClientThemeToggle, ComponentVariant,
|
6
|
+
export { ClientThemeProvider, ClientThemeToggle, ComponentVariant, ThemeProvider, ThemeProviderNoSSR, getColorVariantClasses, isDarkTheme, mapColorToShadcnVariant, mapVariantToShadcnVariant, useThemeServer } from './themes/index.js';
|
7
7
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
8
8
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
9
9
|
import * as TogglePrimitive from '@radix-ui/react-toggle';
|
package/dist/index.js
CHANGED
@@ -84,11 +84,6 @@ function useThemeServer() {
|
|
84
84
|
isDark: false
|
85
85
|
};
|
86
86
|
}
|
87
|
-
function ThemeContextProvider({
|
88
|
-
children
|
89
|
-
}) {
|
90
|
-
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
91
|
-
}
|
92
87
|
function useTheme() {
|
93
88
|
const [themeData, setThemeData] = React2__namespace.useState({
|
94
89
|
theme: "system",
|
@@ -149,12 +144,43 @@ function ThemeToggle({
|
|
149
144
|
size = "md",
|
150
145
|
...props
|
151
146
|
}) {
|
147
|
+
if (typeof window === "undefined") {
|
148
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
149
|
+
"button",
|
150
|
+
{
|
151
|
+
type: "button",
|
152
|
+
className: cn(
|
153
|
+
"inline-flex items-center justify-center rounded-md border border-input bg-background",
|
154
|
+
size === "sm" ? "h-8 w-8" : size === "lg" ? "h-12 w-12" : "h-10 w-10",
|
155
|
+
className
|
156
|
+
),
|
157
|
+
"aria-label": "Toggle theme",
|
158
|
+
...props,
|
159
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(iconsReact.IconSun, { size: size === "sm" ? 16 : size === "lg" ? 24 : 20, stroke: 1.5 })
|
160
|
+
}
|
161
|
+
);
|
162
|
+
}
|
152
163
|
const { theme, setTheme, resolvedTheme } = useTheme();
|
153
164
|
const [mounted, setMounted] = React2__namespace.useState(false);
|
154
165
|
React2__namespace.useEffect(() => {
|
155
166
|
setMounted(true);
|
156
167
|
}, []);
|
157
|
-
if (!mounted)
|
168
|
+
if (!mounted) {
|
169
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
170
|
+
"button",
|
171
|
+
{
|
172
|
+
type: "button",
|
173
|
+
className: cn(
|
174
|
+
"inline-flex items-center justify-center rounded-md border border-input bg-background",
|
175
|
+
size === "sm" ? "h-8 w-8" : size === "lg" ? "h-12 w-12" : "h-10 w-10",
|
176
|
+
className
|
177
|
+
),
|
178
|
+
"aria-label": "Toggle theme",
|
179
|
+
...props,
|
180
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(iconsReact.IconSun, { size: size === "sm" ? 16 : size === "lg" ? 24 : 20, stroke: 1.5 })
|
181
|
+
}
|
182
|
+
);
|
183
|
+
}
|
158
184
|
const toggleTheme = () => {
|
159
185
|
setTheme(resolvedTheme === "dark" ? "light" : "dark");
|
160
186
|
};
|
@@ -1899,10 +1925,6 @@ function ThemeProviderNoSSR({
|
|
1899
1925
|
}
|
1900
1926
|
return /* @__PURE__ */ jsxRuntime.jsx(ThemeProvider, { ...props, children });
|
1901
1927
|
}
|
1902
|
-
|
1903
|
-
// src/themes/index.ts
|
1904
|
-
init_theme_context();
|
1905
|
-
init_theme_toggle2();
|
1906
1928
|
function ClientThemeProvider({
|
1907
1929
|
children,
|
1908
1930
|
...props
|
@@ -1926,11 +1948,46 @@ function ClientThemeToggle(props) {
|
|
1926
1948
|
});
|
1927
1949
|
}, []);
|
1928
1950
|
if (!mounted || !ThemeToggleComponent) {
|
1929
|
-
return
|
1951
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
1952
|
+
"button",
|
1953
|
+
{
|
1954
|
+
type: "button",
|
1955
|
+
className: "inline-flex items-center justify-center rounded-md border border-input bg-background h-10 w-10",
|
1956
|
+
"aria-label": "Toggle theme",
|
1957
|
+
...props,
|
1958
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
1959
|
+
"svg",
|
1960
|
+
{
|
1961
|
+
width: "20",
|
1962
|
+
height: "20",
|
1963
|
+
viewBox: "0 0 24 24",
|
1964
|
+
fill: "none",
|
1965
|
+
stroke: "currentColor",
|
1966
|
+
strokeWidth: "2",
|
1967
|
+
strokeLinecap: "round",
|
1968
|
+
strokeLinejoin: "round",
|
1969
|
+
children: [
|
1970
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "4" }),
|
1971
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 2v2" }),
|
1972
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 20v2" }),
|
1973
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "m4.93 4.93 1.41 1.41" }),
|
1974
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "m17.66 17.66 1.41 1.41" }),
|
1975
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2 12h2" }),
|
1976
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M20 12h2" }),
|
1977
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "m6.34 17.66-1.41 1.41" }),
|
1978
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "m19.07 4.93-1.41 1.41" })
|
1979
|
+
]
|
1980
|
+
}
|
1981
|
+
)
|
1982
|
+
}
|
1983
|
+
);
|
1930
1984
|
}
|
1931
1985
|
return /* @__PURE__ */ jsxRuntime.jsx(ThemeToggleComponent, { ...props });
|
1932
1986
|
}
|
1933
1987
|
|
1988
|
+
// src/themes/index.ts
|
1989
|
+
init_theme_context();
|
1990
|
+
|
1934
1991
|
// src/lib/theme-utils.ts
|
1935
1992
|
var mapColorToShadcnVariant = (color) => {
|
1936
1993
|
switch (color) {
|
@@ -2065,10 +2122,8 @@ exports.SheetTitle = SheetTitle;
|
|
2065
2122
|
exports.SheetTrigger = SheetTrigger;
|
2066
2123
|
exports.Slider = Slider;
|
2067
2124
|
exports.Text = Text;
|
2068
|
-
exports.ThemeContextProvider = ThemeContextProvider;
|
2069
2125
|
exports.ThemeProvider = ThemeProvider;
|
2070
2126
|
exports.ThemeProviderNoSSR = ThemeProviderNoSSR;
|
2071
|
-
exports.ThemeToggle = ThemeToggle;
|
2072
2127
|
exports.Toggle = Toggle;
|
2073
2128
|
exports.ToggleGroup = ToggleGroup;
|
2074
2129
|
exports.ToggleGroupItem = ToggleGroupItem;
|
@@ -2087,7 +2142,6 @@ exports.shadows = shadows;
|
|
2087
2142
|
exports.spacing = spacing;
|
2088
2143
|
exports.tokens = tokens;
|
2089
2144
|
exports.typography = typography;
|
2090
|
-
exports.useTheme = useTheme;
|
2091
2145
|
exports.useThemeServer = useThemeServer;
|
2092
2146
|
//# sourceMappingURL=index.js.map
|
2093
2147
|
//# sourceMappingURL=index.js.map
|