@tydavidson/design-system 1.1.17 → 1.1.19

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
@@ -1,11 +1,11 @@
1
- import { clsx } from 'clsx';
2
- import { twMerge } from 'tailwind-merge';
3
1
  import * as React2 from 'react';
4
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
- import { IconCheck, IconPointFilled, IconChevronRight, IconX, IconSearch, IconSun, IconMoon } from '@tabler/icons-react';
6
2
  import { Slot } from '@radix-ui/react-slot';
7
3
  import { cva } from 'class-variance-authority';
4
+ import { clsx } from 'clsx';
5
+ import { twMerge } from 'tailwind-merge';
6
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
8
7
  import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
8
+ import { IconCheck, IconPointFilled, IconChevronRight, IconX, IconSearch } from '@tabler/icons-react';
9
9
  import * as TogglePrimitive from '@radix-ui/react-toggle';
10
10
  import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';
11
11
  import * as SliderPrimitive from '@radix-ui/react-slider';
@@ -16,15 +16,7 @@ import { Command as Command$1 } from 'cmdk';
16
16
  import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
17
17
  import * as ContextMenuPrimitive from '@radix-ui/react-context-menu';
18
18
 
19
- var __defProp = Object.defineProperty;
20
- var __getOwnPropNames = Object.getOwnPropertyNames;
21
- var __esm = (fn, res) => function __init() {
22
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
23
- };
24
- var __export = (target, all) => {
25
- for (var name in all)
26
- __defProp(target, name, { get: all[name], enumerable: true });
27
- };
19
+ // src/components/ui/button.tsx
28
20
  function cn(...inputs) {
29
21
  return twMerge(clsx(inputs));
30
22
  }
@@ -40,213 +32,6 @@ function filterDOMProps(props, propNames) {
40
32
  propNames.forEach((name) => delete result[name]);
41
33
  return result;
42
34
  }
43
- var init_utils = __esm({
44
- "src/lib/utils.ts"() {
45
- }
46
- });
47
- function useThemeServer() {
48
- return {
49
- theme: "system",
50
- setTheme: (theme) => {
51
- },
52
- resolvedTheme: "light",
53
- isDark: false
54
- };
55
- }
56
- function useTheme() {
57
- const [themeData, setThemeData] = React2.useState({
58
- theme: "system",
59
- setTheme: (theme) => {
60
- },
61
- resolvedTheme: "light",
62
- isDark: false
63
- });
64
- const [mounted, setMounted] = React2.useState(false);
65
- React2.useEffect(() => {
66
- if (typeof window === "undefined") return;
67
- import('next-themes').then((nextThemes) => {
68
- const themeManager = {
69
- getTheme: () => {
70
- if (typeof window !== "undefined") {
71
- const savedTheme = localStorage.getItem("theme");
72
- if (savedTheme) return savedTheme;
73
- if (window.matchMedia("(prefers-color-scheme: dark)").matches) {
74
- return "dark";
75
- }
76
- }
77
- return "light";
78
- },
79
- setTheme: (theme) => {
80
- if (typeof window !== "undefined") {
81
- localStorage.setItem("theme", theme);
82
- document.documentElement.classList.toggle("dark", theme === "dark");
83
- setThemeData((prev) => ({
84
- ...prev,
85
- theme,
86
- resolvedTheme: theme,
87
- isDark: theme === "dark"
88
- }));
89
- }
90
- }
91
- };
92
- const currentTheme = themeManager.getTheme();
93
- const isDark = currentTheme === "dark";
94
- setThemeData({
95
- theme: currentTheme,
96
- setTheme: themeManager.setTheme,
97
- resolvedTheme: currentTheme,
98
- isDark
99
- });
100
- setMounted(true);
101
- });
102
- }, []);
103
- return themeData;
104
- }
105
- var init_theme_context = __esm({
106
- "src/themes/theme-context.tsx"() {
107
- "use client";
108
- }
109
- });
110
- function ThemeToggle({
111
- className,
112
- variant = "icon",
113
- size = "md",
114
- ...props
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
- }
132
- const { theme, setTheme, resolvedTheme } = useTheme();
133
- const [mounted, setMounted] = React2.useState(false);
134
- React2.useEffect(() => {
135
- setMounted(true);
136
- }, []);
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
- }
153
- const toggleTheme = () => {
154
- setTheme(resolvedTheme === "dark" ? "light" : "dark");
155
- };
156
- const iconSize = {
157
- sm: 16,
158
- md: 20,
159
- lg: 24
160
- };
161
- const sizeClasses = {
162
- sm: "h-8 w-8",
163
- md: "h-10 w-10",
164
- lg: "h-12 w-12"
165
- };
166
- const textSizeClasses = {
167
- sm: "text-xs",
168
- md: "text-sm",
169
- lg: "text-base"
170
- };
171
- if (variant === "icon") {
172
- return /* @__PURE__ */ jsx(
173
- "button",
174
- {
175
- type: "button",
176
- onClick: toggleTheme,
177
- className: cn(
178
- "inline-flex items-center justify-center rounded-md border border-input bg-background hover:bg-accent hover:text-accent-foreground",
179
- sizeClasses[size],
180
- className
181
- ),
182
- "aria-label": "Toggle theme",
183
- ...props,
184
- children: resolvedTheme === "dark" ? /* @__PURE__ */ jsx(IconSun, { size: iconSize[size], stroke: 1.5 }) : /* @__PURE__ */ jsx(IconMoon, { size: iconSize[size], stroke: 1.5 })
185
- }
186
- );
187
- }
188
- if (variant === "button") {
189
- return /* @__PURE__ */ jsx(
190
- "button",
191
- {
192
- type: "button",
193
- onClick: toggleTheme,
194
- className: cn(
195
- "inline-flex items-center justify-center rounded-md border border-input bg-background px-4 py-2",
196
- textSizeClasses[size],
197
- "hover:bg-accent hover:text-accent-foreground",
198
- className
199
- ),
200
- "aria-label": "Toggle theme",
201
- ...props,
202
- children: resolvedTheme === "dark" ? "Light Mode" : "Dark Mode"
203
- }
204
- );
205
- }
206
- return /* @__PURE__ */ jsx(
207
- "button",
208
- {
209
- type: "button",
210
- onClick: toggleTheme,
211
- className: cn(
212
- "inline-flex items-center justify-center rounded-md px-3 py-2 font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
213
- textSizeClasses[size],
214
- resolvedTheme === "dark" ? "bg-accent text-accent-foreground hover:bg-accent/80" : "bg-muted text-muted-foreground hover:bg-muted/80",
215
- className
216
- ),
217
- "aria-label": "Toggle theme",
218
- ...props,
219
- children: resolvedTheme === "dark" ? /* @__PURE__ */ jsxs("span", { className: "flex items-center", children: [
220
- /* @__PURE__ */ jsx(IconSun, { size: iconSize[size], stroke: 1.5, className: "mr-2" }),
221
- "Light"
222
- ] }) : /* @__PURE__ */ jsxs("span", { className: "flex items-center", children: [
223
- /* @__PURE__ */ jsx(IconMoon, { size: iconSize[size], stroke: 1.5, className: "mr-2" }),
224
- "Dark"
225
- ] })
226
- }
227
- );
228
- }
229
- var init_theme_toggle = __esm({
230
- "src/components/ui/theme-toggle/theme-toggle.tsx"() {
231
- "use client";
232
- init_theme_context();
233
- init_utils();
234
- }
235
- });
236
-
237
- // src/components/ui/theme-toggle/index.ts
238
- var theme_toggle_exports = {};
239
- __export(theme_toggle_exports, {
240
- ThemeToggle: () => ThemeToggle
241
- });
242
- var init_theme_toggle2 = __esm({
243
- "src/components/ui/theme-toggle/index.ts"() {
244
- init_theme_toggle();
245
- }
246
- });
247
-
248
- // src/components/ui/button.tsx
249
- init_utils();
250
35
  var buttonVariants = cva(
251
36
  "float-button inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-[4px] text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
252
37
  {
@@ -351,9 +136,6 @@ var Button = React2.forwardRef(
351
136
  }
352
137
  );
353
138
  Button.displayName = "Button";
354
-
355
- // src/components/ui/dropdown-menu/dropdown-menu.tsx
356
- init_utils();
357
139
  var DropdownMenuRoot = DropdownMenuPrimitive.Root;
358
140
  var DropdownMenuTrigger = React2.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(
359
141
  DropdownMenuPrimitive.Trigger,
@@ -535,9 +317,6 @@ var DropdownMenu = {
535
317
  SubContent: DropdownMenuSubContent,
536
318
  SubTrigger: DropdownMenuSubTrigger
537
319
  };
538
-
539
- // src/components/typography/heading/heading.tsx
540
- init_utils();
541
320
  var Heading = React2.forwardRef(
542
321
  ({
543
322
  level = 1,
@@ -606,9 +385,6 @@ var Heading = React2.forwardRef(
606
385
  }
607
386
  );
608
387
  Heading.displayName = "Heading";
609
-
610
- // src/components/typography/text/text.tsx
611
- init_utils();
612
388
  var Text = React2.forwardRef(
613
389
  ({
614
390
  size = "md",
@@ -661,9 +437,6 @@ var Text = React2.forwardRef(
661
437
  }
662
438
  );
663
439
  Text.displayName = "Text";
664
-
665
- // src/components/ui/toggle.tsx
666
- init_utils();
667
440
  var Toggle = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
668
441
  TogglePrimitive.Root,
669
442
  {
@@ -676,9 +449,6 @@ var Toggle = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
676
449
  }
677
450
  ));
678
451
  Toggle.displayName = TogglePrimitive.Root.displayName;
679
-
680
- // src/components/ui/toggle-group.tsx
681
- init_utils();
682
452
  var ToggleGroup = React2.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(
683
453
  ToggleGroupPrimitive.Root,
684
454
  {
@@ -701,9 +471,6 @@ var ToggleGroupItem = React2.forwardRef(({ className, ...props }, ref) => /* @__
701
471
  }
702
472
  ));
703
473
  ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName;
704
-
705
- // src/components/ui/slider.tsx
706
- init_utils();
707
474
  var Slider = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs(
708
475
  SliderPrimitive.Root,
709
476
  {
@@ -720,9 +487,6 @@ var Slider = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
720
487
  }
721
488
  ));
722
489
  Slider.displayName = SliderPrimitive.Root.displayName;
723
-
724
- // src/components/ui/popover.tsx
725
- init_utils();
726
490
  var Popover = PopoverPrimitive.Root;
727
491
  var PopoverTrigger = PopoverPrimitive.Trigger;
728
492
  var PopoverAnchor = PopoverPrimitive.Anchor;
@@ -740,9 +504,6 @@ var PopoverContent = React2.forwardRef(({ className, align = "center", sideOffse
740
504
  }
741
505
  ) }));
742
506
  PopoverContent.displayName = PopoverPrimitive.Content.displayName;
743
-
744
- // src/components/ui/hover-card.tsx
745
- init_utils();
746
507
  var HoverCard = HoverCardPrimitive.Root;
747
508
  var HoverCardTrigger = HoverCardPrimitive.Trigger;
748
509
  var HoverCardContent = React2.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(
@@ -759,9 +520,6 @@ var HoverCardContent = React2.forwardRef(({ className, align = "center", sideOff
759
520
  }
760
521
  ));
761
522
  HoverCardContent.displayName = HoverCardPrimitive.Content.displayName;
762
-
763
- // src/components/ui/sheet.tsx
764
- init_utils();
765
523
  var Sheet = SheetPrimitive.Root;
766
524
  var SheetTrigger = SheetPrimitive.Trigger;
767
525
  var SheetClose = SheetPrimitive.Close;
@@ -855,12 +613,6 @@ var SheetDescription = React2.forwardRef(({ className, ...props }, ref) => /* @_
855
613
  }
856
614
  ));
857
615
  SheetDescription.displayName = SheetPrimitive.Description.displayName;
858
-
859
- // src/components/ui/command.tsx
860
- init_utils();
861
-
862
- // src/components/ui/dialog.tsx
863
- init_utils();
864
616
  var Dialog = SheetPrimitive.Root;
865
617
  var DialogTrigger = SheetPrimitive.Trigger;
866
618
  var DialogPortal = SheetPrimitive.Portal;
@@ -1048,9 +800,6 @@ CommandShortcut.displayName = "CommandShortcut";
1048
800
  var Collapsible = CollapsiblePrimitive.Root;
1049
801
  var CollapsibleTrigger2 = CollapsiblePrimitive.CollapsibleTrigger;
1050
802
  var CollapsibleContent2 = CollapsiblePrimitive.CollapsibleContent;
1051
-
1052
- // src/components/ui/context-menu.tsx
1053
- init_utils();
1054
803
  var ContextMenu = ContextMenuPrimitive.Root;
1055
804
  var ContextMenuTrigger = ContextMenuPrimitive.Trigger;
1056
805
  var ContextMenuGroup = ContextMenuPrimitive.Group;
@@ -1470,9 +1219,6 @@ var EmailFooter = ({ children }) => /* @__PURE__ */ jsx("div", { style: {
1470
1219
  /* @__PURE__ */ jsx("div", { children: "SoHo, New York" })
1471
1220
  ] })
1472
1221
  ] }) });
1473
-
1474
- // src/components/ui/card.tsx
1475
- init_utils();
1476
1222
  var Card = React2.forwardRef(
1477
1223
  ({ className, variant = "default", ...props }, ref) => {
1478
1224
  const variantClasses = {
@@ -1555,9 +1301,6 @@ var CardFooter = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE_
1555
1301
  }
1556
1302
  ));
1557
1303
  CardFooter.displayName = "CardFooter";
1558
-
1559
- // src/components/ui/input.tsx
1560
- init_utils();
1561
1304
  var Input = React2.forwardRef(
1562
1305
  ({ className, type, ...props }, ref) => {
1563
1306
  return /* @__PURE__ */ jsx(
@@ -1580,9 +1323,6 @@ var Input = React2.forwardRef(
1580
1323
  );
1581
1324
  Input.displayName = "Input";
1582
1325
 
1583
- // src/index.ts
1584
- init_utils();
1585
-
1586
1326
  // src/tokens/colors.ts
1587
1327
  var colors = {
1588
1328
  // Base colors
@@ -1909,14 +1649,25 @@ function ClientThemeProvider({
1909
1649
  }
1910
1650
  function ClientThemeToggle(props) {
1911
1651
  const [mounted, setMounted] = React2.useState(false);
1912
- const [ThemeToggleComponent, setThemeToggleComponent] = React2.useState(void 0);
1652
+ const [isDark, setIsDark] = React2.useState(false);
1913
1653
  React2.useEffect(() => {
1914
1654
  setMounted(true);
1915
- Promise.resolve().then(() => (init_theme_toggle2(), theme_toggle_exports)).then(({ ThemeToggle: ThemeToggle2 }) => {
1916
- setThemeToggleComponent(() => ThemeToggle2);
1917
- });
1655
+ if (typeof window !== "undefined") {
1656
+ const savedTheme = localStorage.getItem("theme");
1657
+ const systemPrefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
1658
+ const currentTheme = savedTheme || (systemPrefersDark ? "dark" : "light");
1659
+ setIsDark(currentTheme === "dark");
1660
+ }
1918
1661
  }, []);
1919
- if (!mounted || !ThemeToggleComponent) {
1662
+ const toggleTheme = () => {
1663
+ if (typeof window !== "undefined") {
1664
+ const newTheme = isDark ? "light" : "dark";
1665
+ localStorage.setItem("theme", newTheme);
1666
+ document.documentElement.classList.toggle("dark", newTheme === "dark");
1667
+ setIsDark(newTheme === "dark");
1668
+ }
1669
+ };
1670
+ if (!mounted) {
1920
1671
  return /* @__PURE__ */ jsx(
1921
1672
  "button",
1922
1673
  {
@@ -1951,11 +1702,63 @@ function ClientThemeToggle(props) {
1951
1702
  }
1952
1703
  );
1953
1704
  }
1954
- return /* @__PURE__ */ jsx(ThemeToggleComponent, { ...props });
1705
+ return /* @__PURE__ */ jsx(
1706
+ "button",
1707
+ {
1708
+ type: "button",
1709
+ onClick: toggleTheme,
1710
+ className: "inline-flex items-center justify-center rounded-md border border-input bg-background hover:bg-accent hover:text-accent-foreground h-10 w-10",
1711
+ "aria-label": "Toggle theme",
1712
+ ...props,
1713
+ children: isDark ? /* @__PURE__ */ jsxs(
1714
+ "svg",
1715
+ {
1716
+ width: "20",
1717
+ height: "20",
1718
+ viewBox: "0 0 24 24",
1719
+ fill: "none",
1720
+ stroke: "currentColor",
1721
+ strokeWidth: "2",
1722
+ strokeLinecap: "round",
1723
+ strokeLinejoin: "round",
1724
+ children: [
1725
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "4" }),
1726
+ /* @__PURE__ */ jsx("path", { d: "M12 2v2" }),
1727
+ /* @__PURE__ */ jsx("path", { d: "M12 20v2" }),
1728
+ /* @__PURE__ */ jsx("path", { d: "m4.93 4.93 1.41 1.41" }),
1729
+ /* @__PURE__ */ jsx("path", { d: "m17.66 17.66 1.41 1.41" }),
1730
+ /* @__PURE__ */ jsx("path", { d: "M2 12h2" }),
1731
+ /* @__PURE__ */ jsx("path", { d: "M20 12h2" }),
1732
+ /* @__PURE__ */ jsx("path", { d: "m6.34 17.66-1.41 1.41" }),
1733
+ /* @__PURE__ */ jsx("path", { d: "m19.07 4.93-1.41 1.41" })
1734
+ ]
1735
+ }
1736
+ ) : /* @__PURE__ */ jsx(
1737
+ "svg",
1738
+ {
1739
+ width: "20",
1740
+ height: "20",
1741
+ viewBox: "0 0 24 24",
1742
+ fill: "none",
1743
+ stroke: "currentColor",
1744
+ strokeWidth: "2",
1745
+ strokeLinecap: "round",
1746
+ strokeLinejoin: "round",
1747
+ children: /* @__PURE__ */ jsx("path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z" })
1748
+ }
1749
+ )
1750
+ }
1751
+ );
1752
+ }
1753
+ function useThemeServer() {
1754
+ return {
1755
+ theme: "system",
1756
+ setTheme: (theme) => {
1757
+ },
1758
+ resolvedTheme: "light",
1759
+ isDark: false
1760
+ };
1955
1761
  }
1956
-
1957
- // src/themes/index.ts
1958
- init_theme_context();
1959
1762
 
1960
1763
  // src/lib/theme-utils.ts
1961
1764
  var mapColorToShadcnVariant = (color) => {