@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.mjs CHANGED
@@ -53,11 +53,6 @@ function useThemeServer() {
53
53
  isDark: false
54
54
  };
55
55
  }
56
- function ThemeContextProvider({
57
- children
58
- }) {
59
- return /* @__PURE__ */ jsx(Fragment, { children });
60
- }
61
56
  function useTheme() {
62
57
  const [themeData, setThemeData] = React2.useState({
63
58
  theme: "system",
@@ -118,12 +113,43 @@ function ThemeToggle({
118
113
  size = "md",
119
114
  ...props
120
115
  }) {
116
+ if (typeof window === "undefined") {
117
+ return /* @__PURE__ */ jsx(
118
+ "button",
119
+ {
120
+ type: "button",
121
+ className: cn(
122
+ "inline-flex items-center justify-center rounded-md border border-input bg-background",
123
+ size === "sm" ? "h-8 w-8" : size === "lg" ? "h-12 w-12" : "h-10 w-10",
124
+ className
125
+ ),
126
+ "aria-label": "Toggle theme",
127
+ ...props,
128
+ children: /* @__PURE__ */ jsx(IconSun, { size: size === "sm" ? 16 : size === "lg" ? 24 : 20, stroke: 1.5 })
129
+ }
130
+ );
131
+ }
121
132
  const { theme, setTheme, resolvedTheme } = useTheme();
122
133
  const [mounted, setMounted] = React2.useState(false);
123
134
  React2.useEffect(() => {
124
135
  setMounted(true);
125
136
  }, []);
126
- if (!mounted) return null;
137
+ if (!mounted) {
138
+ return /* @__PURE__ */ jsx(
139
+ "button",
140
+ {
141
+ type: "button",
142
+ className: cn(
143
+ "inline-flex items-center justify-center rounded-md border border-input bg-background",
144
+ size === "sm" ? "h-8 w-8" : size === "lg" ? "h-12 w-12" : "h-10 w-10",
145
+ className
146
+ ),
147
+ "aria-label": "Toggle theme",
148
+ ...props,
149
+ children: /* @__PURE__ */ jsx(IconSun, { size: size === "sm" ? 16 : size === "lg" ? 24 : 20, stroke: 1.5 })
150
+ }
151
+ );
152
+ }
127
153
  const toggleTheme = () => {
128
154
  setTheme(resolvedTheme === "dark" ? "light" : "dark");
129
155
  };
@@ -1868,10 +1894,6 @@ function ThemeProviderNoSSR({
1868
1894
  }
1869
1895
  return /* @__PURE__ */ jsx(ThemeProvider, { ...props, children });
1870
1896
  }
1871
-
1872
- // src/themes/index.ts
1873
- init_theme_context();
1874
- init_theme_toggle2();
1875
1897
  function ClientThemeProvider({
1876
1898
  children,
1877
1899
  ...props
@@ -1895,11 +1917,46 @@ function ClientThemeToggle(props) {
1895
1917
  });
1896
1918
  }, []);
1897
1919
  if (!mounted || !ThemeToggleComponent) {
1898
- return null;
1920
+ return /* @__PURE__ */ jsx(
1921
+ "button",
1922
+ {
1923
+ type: "button",
1924
+ className: "inline-flex items-center justify-center rounded-md border border-input bg-background h-10 w-10",
1925
+ "aria-label": "Toggle theme",
1926
+ ...props,
1927
+ children: /* @__PURE__ */ jsxs(
1928
+ "svg",
1929
+ {
1930
+ width: "20",
1931
+ height: "20",
1932
+ viewBox: "0 0 24 24",
1933
+ fill: "none",
1934
+ stroke: "currentColor",
1935
+ strokeWidth: "2",
1936
+ strokeLinecap: "round",
1937
+ strokeLinejoin: "round",
1938
+ children: [
1939
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "4" }),
1940
+ /* @__PURE__ */ jsx("path", { d: "M12 2v2" }),
1941
+ /* @__PURE__ */ jsx("path", { d: "M12 20v2" }),
1942
+ /* @__PURE__ */ jsx("path", { d: "m4.93 4.93 1.41 1.41" }),
1943
+ /* @__PURE__ */ jsx("path", { d: "m17.66 17.66 1.41 1.41" }),
1944
+ /* @__PURE__ */ jsx("path", { d: "M2 12h2" }),
1945
+ /* @__PURE__ */ jsx("path", { d: "M20 12h2" }),
1946
+ /* @__PURE__ */ jsx("path", { d: "m6.34 17.66-1.41 1.41" }),
1947
+ /* @__PURE__ */ jsx("path", { d: "m19.07 4.93-1.41 1.41" })
1948
+ ]
1949
+ }
1950
+ )
1951
+ }
1952
+ );
1899
1953
  }
1900
1954
  return /* @__PURE__ */ jsx(ThemeToggleComponent, { ...props });
1901
1955
  }
1902
1956
 
1957
+ // src/themes/index.ts
1958
+ init_theme_context();
1959
+
1903
1960
  // src/lib/theme-utils.ts
1904
1961
  var mapColorToShadcnVariant = (color) => {
1905
1962
  switch (color) {
@@ -1957,6 +2014,6 @@ var isDarkTheme = (theme, systemTheme) => {
1957
2014
  return theme === "dark";
1958
2015
  };
1959
2016
 
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 };
2017
+ 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, ThemeProvider, ThemeProviderNoSSR, Toggle, ToggleGroup, ToggleGroupItem, buttonVariants, cn, colors, filterDOMProps, generateId, getColorVariantClasses, isDarkTheme, isNotNullOrUndefined, mapColorToShadcnVariant, mapVariantToShadcnVariant, radius, shadows, spacing, tokens, typography, useThemeServer };
1961
2018
  //# sourceMappingURL=index.mjs.map
1962
2019
  //# sourceMappingURL=index.mjs.map