@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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/themes/theme-context.tsx","../../src/lib/utils.ts","../../src/components/ui/theme-toggle/theme-toggle.tsx","../../src/components/ui/theme-toggle/index.ts","../../src/themes/theme-provider.tsx","../../src/themes/index.ts","../../src/themes/client-wrapper.tsx","../../src/lib/theme-utils.ts"],"names":["jsx","Fragment","React2","React3","init_theme_toggle","React4","ThemeToggle"],"mappings":";;;;;;;;;;;;;;;AAQO,SAAS,cAAA,GAAiB;AAC/B,EAAA,OAAO;AAAA,IACL,KAAA,EAAO,QAAA;AAAA,IACP,QAAA,EAAU,CAAC,KAAA,KAAkB;AAAA,IAAC,CAAA;AAAA,IAC9B,aAAA,EAAe,OAAA;AAAA,IACf,MAAA,EAAQ;AAAA,GACV;AACF;AAMO,SAAS,oBAAA,CAAqB;AAAA,EACnC;AACF,CAAA,EAEG;AAED,EAAA,uBAAOA,GAAAA,CAAAC,QAAAA,EAAA,EAAG,QAAA,EAAS,CAAA;AACrB;AAMO,SAAS,QAAA,GAAW;AAEzB,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAUC,KAAA,CAAA,QAAA,CAAS;AAAA,IAC/C,KAAA,EAAO,QAAA;AAAA,IACP,QAAA,EAAU,CAAC,KAAA,KAAkB;AAAA,IAAC,CAAA;AAAA,IAC9B,aAAA,EAAe,OAAA;AAAA,IACf,MAAA,EAAQ;AAAA,GACT,CAAA;AACD,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAUA,eAAS,KAAK,CAAA;AAElD,EAAMA,gBAAU,MAAM;AAEpB,IAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AAGnC,IAAA,OAAO,aAAa,CAAA,CAAE,IAAA,CAAK,CAAC,UAAA,KAAe;AAEzC,MAAA,MAAM,YAAA,GAAe;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A;AAAW,MAAA,OAAO,SAAA;AAAA,IACvB,KAAK,WAAA;AAAa,MAAA,OAAO,SAAA;AAAA,IACzB,KAAK,UAAA;AAAY,MAAA,OAAO,OAAA;AAAA,IACxB;AAAS,MAAA,OAAO,SAAA;AAAA;AAEpB;AASO,IAAM,sBAAA,GAAyB,CACpC,KAAA,EACA,OAAA,KACW;AACX,EAAA,MAAM,eAAA,GAAwE;AAAA,IAC5E,OAAA,EAAS;AAAA,MACP,KAAA,EAAO,yEAAA;AAAA,MACP,KAAA,EAAO,yEAAA;AAAA,MACP,OAAA,EAAS,+EAAA;AAAA,MACT,OAAA,EAAS;AAAA,KACX;AAAA,IACA,SAAA,EAAW;AAAA,MACT,KAAA,EAAO,gFAAA;AAAA,MACP,KAAA,EAAO,gFAAA;AAAA,MACP,OAAA,EAAS,wFAAA;AAAA,MACT,OAAA,EAAS;AAAA,KACX;AAAA,IACA,QAAA,EAAU;AAAA,MACR,KAAA,EAAO,+DAAA;AAAA,MACP,KAAA,EAAO,+DAAA;AAAA,MACP,OAAA,EAAS,qEAAA;AAAA,MACT,OAAA,EAAS;AAAA;AACX,GACF;AAEA,EAAA,OAAO,eAAA,CAAgB,OAAO,CAAA,GAAI,KAAK,CAAA,IAAK,EAAA;AAC9C;AASO,IAAM,WAAA,GAAc,CAAC,KAAA,EAA2B,WAAA,KAA6C;AAClG,EAAA,IAAI,UAAU,QAAA,EAAU;AACtB,IAAA,OAAO,WAAA,KAAgB,MAAA;AAAA,EACzB;AACA,EAAA,OAAO,KAAA,KAAU,MAAA;AACnB","file":"index.mjs","sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\n\n/**\n * Server-safe theme hook that can be used in Server Components\n * Returns default theme values without accessing client-side APIs\n */\nexport function useThemeServer() {\n return {\n theme: \"system\",\n setTheme: (theme: string) => {},\n resolvedTheme: \"light\",\n isDark: false,\n };\n}\n\n/**\n * @deprecated Use ThemeProvider from './theme-provider' instead\n * This component is kept for backward compatibility but is no longer needed\n */\nexport function ThemeContextProvider({ \n children \n}: { \n children: React.ReactNode \n}) {\n // This is now a no-op wrapper for backward compatibility\n return <>{children}</>;\n}\n\n/**\n * @deprecated Use useTheme from next-themes directly or use the ThemeProvider\n * This hook is kept for backward compatibility but is no longer needed\n */\nexport function useTheme() {\n // Import next-themes dynamically to avoid SSR issues\n const [themeData, setThemeData] = React.useState({\n theme: \"system\",\n setTheme: (theme: string) => {},\n resolvedTheme: \"light\",\n isDark: false,\n });\n const [mounted, setMounted] = React.useState(false);\n\n React.useEffect(() => {\n // Only run on client side\n if (typeof window === 'undefined') return;\n\n // Import next-themes and use it properly\n import('next-themes').then((nextThemes) => {\n // Create a simple theme manager that doesn't violate hook rules\n const themeManager = {\n getTheme: () => {\n // Get theme from localStorage or system preference\n if (typeof window !== 'undefined') {\n const savedTheme = localStorage.getItem('theme');\n if (savedTheme) return savedTheme;\n \n // Check system preference\n if (window.matchMedia('(prefers-color-scheme: dark)').matches) {\n return 'dark';\n }\n }\n return 'light';\n },\n setTheme: (theme: string) => {\n if (typeof window !== 'undefined') {\n localStorage.setItem('theme', theme);\n document.documentElement.classList.toggle('dark', theme === 'dark');\n // Trigger a re-render\n setThemeData(prev => ({\n ...prev,\n theme,\n resolvedTheme: theme,\n isDark: theme === 'dark'\n }));\n }\n }\n };\n\n const currentTheme = themeManager.getTheme();\n const isDark = currentTheme === 'dark';\n \n setThemeData({\n theme: currentTheme,\n setTheme: themeManager.setTheme,\n resolvedTheme: currentTheme,\n isDark,\n });\n setMounted(true);\n });\n }, []);\n\n return themeData;\n}","import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\n/**\n * Combines multiple class values into a single className string\n * with proper Tailwind CSS class merging.\n * \n * @param inputs - Class values to merge\n * @returns Merged className string\n */\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\n/**\n * Utility function to generate a unique ID.\n * Useful for ensuring unique IDs for form elements.\n * \n * @param prefix - Optional prefix for the ID\n * @returns A unique ID string\n */\nexport function generateId(prefix = 'id'): string {\n const randomId = Math.random().toString(36).substring(2, 9);\n return `${prefix}-${randomId}`;\n}\n\n/**\n * Type guard to check if a value is not null or undefined\n * \n * @param value - Value to check\n * @returns True if value is not null or undefined\n */\nexport function isNotNullOrUndefined<T>(value: T | null | undefined): value is T {\n return value !== null && value !== undefined;\n}\n\n/**\n * Returns only the props that are safe to spread onto a DOM element\n * by filtering out custom props\n * \n * @param props - The props object\n * @param propNames - Names of custom props to filter out\n * @returns Object with only DOM-safe props\n */\nexport function filterDOMProps<T extends Record<string, any>, K extends keyof T>(\n props: T, \n propNames: K[]\n): Omit<T, K> {\n const result = { ...props };\n propNames.forEach(name => delete result[name]);\n return result;\n}","\"use client\"\n\nimport * as React from \"react\"\nimport { useTheme } from \"../../../themes/theme-context\"\nimport { cn } from \"../../../lib/utils\"\nimport { IconMoon, IconSun } from \"@tabler/icons-react\"\n\n/**\n * Props for the ThemeToggle component\n */\nexport interface ThemeToggleProps extends React.HTMLAttributes<HTMLButtonElement> {\n /**\n * Variant of the toggle\n * @default 'icon'\n */\n variant?: 'icon' | 'switch' | 'button';\n \n /**\n * Size of the toggle\n * @default 'md'\n */\n size?: 'sm' | 'md' | 'lg';\n}\n\n/**\n * ThemeToggle component to switch between light and dark themes\n */\nexport function ThemeToggle({ \n className, \n variant = 'icon', \n size = 'md',\n ...props \n}: ThemeToggleProps) {\n const { theme, setTheme, resolvedTheme } = useTheme()\n const [mounted, setMounted] = React.useState(false)\n\n // Handle hydration mismatch\n React.useEffect(() => {\n setMounted(true)\n }, [])\n\n // Only render on client to prevent hydration mismatch\n if (!mounted) return null;\n\n // Toggle between light and dark\n const toggleTheme = () => {\n setTheme(resolvedTheme === \"dark\" ? \"light\" : \"dark\")\n }\n\n // Size mapping for Tabler icons\n const iconSize = {\n sm: 16,\n md: 20,\n lg: 24,\n }\n\n // Size classes for button\n const sizeClasses = {\n sm: 'h-8 w-8',\n md: 'h-10 w-10',\n lg: 'h-12 w-12',\n }\n\n // Text size classes\n const textSizeClasses = {\n sm: 'text-xs',\n md: 'text-sm',\n lg: 'text-base',\n }\n\n // Variant specific rendering\n if (variant === 'icon') {\n return (\n <button\n type=\"button\"\n onClick={toggleTheme}\n className={cn(\n \"inline-flex items-center justify-center rounded-md border border-input bg-background hover:bg-accent hover:text-accent-foreground\",\n sizeClasses[size],\n className\n )}\n aria-label=\"Toggle theme\"\n {...props}\n >\n {resolvedTheme === \"dark\" ? (\n <IconSun size={iconSize[size]} stroke={1.5} />\n ) : (\n <IconMoon size={iconSize[size]} stroke={1.5} />\n )}\n </button>\n )\n }\n \n // Button variant\n if (variant === 'button') {\n return (\n <button\n type=\"button\"\n onClick={toggleTheme}\n className={cn(\n \"inline-flex items-center justify-center rounded-md border border-input bg-background px-4 py-2\",\n textSizeClasses[size],\n \"hover:bg-accent hover:text-accent-foreground\",\n className\n )}\n aria-label=\"Toggle theme\"\n {...props}\n >\n {resolvedTheme === \"dark\" ? \"Light Mode\" : \"Dark Mode\"}\n </button>\n )\n }\n \n // Switch variant\n return (\n <button\n type=\"button\"\n onClick={toggleTheme}\n className={cn(\n \"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\",\n textSizeClasses[size],\n resolvedTheme === \"dark\" \n ? \"bg-accent text-accent-foreground hover:bg-accent/80\" \n : \"bg-muted text-muted-foreground hover:bg-muted/80\",\n className\n )}\n aria-label=\"Toggle theme\"\n {...props}\n >\n {resolvedTheme === \"dark\" ? (\n <span className=\"flex items-center\">\n <IconSun size={iconSize[size]} stroke={1.5} className=\"mr-2\" />\n Light\n </span>\n ) : (\n <span className=\"flex items-center\">\n <IconMoon size={iconSize[size]} stroke={1.5} className=\"mr-2\" />\n Dark\n </span>\n )}\n </button>\n )\n}","export * from './theme-toggle';","\"use client\"\n\nimport * as React from \"react\"\nimport type { ThemeProviderProps } from \"next-themes/dist/types\"\n\n/**\n * ThemeProvider component for handling theme state\n * \n * This wraps the next-themes provider with sensible defaults\n * for handling light/dark themes and system preferences\n * \n * IMPORTANT: This component must be used in a Client Component context.\n * For Server Components, use the NoSSR wrapper or dynamic imports.\n */\nexport function ThemeProvider({ \n children, \n ...props \n}: ThemeProviderProps) {\n const [NextThemesProvider, setNextThemesProvider] = React.useState<any>(undefined);\n const [mounted, setMounted] = React.useState(false);\n\n React.useEffect(() => {\n // Only import next-themes on the client side\n import('next-themes').then(({ ThemeProvider: Provider }) => {\n setNextThemesProvider(() => Provider);\n setMounted(true);\n });\n }, []);\n\n // Return children without theme provider during SSR or before mounting\n if (!mounted || !NextThemesProvider) {\n return <>{children}</>;\n }\n\n return (\n <NextThemesProvider\n attribute=\"class\"\n defaultTheme=\"system\"\n enableSystem\n disableTransitionOnChange\n {...props}\n >\n {children}\n </NextThemesProvider>\n )\n}\n\n/**\n * NoSSR wrapper for theme provider to prevent SSR issues\n * Use this when you need to ensure the theme provider only renders on the client\n */\nexport function ThemeProviderNoSSR({ \n children, \n ...props \n}: ThemeProviderProps) {\n const [mounted, setMounted] = React.useState(false);\n\n React.useEffect(() => {\n setMounted(true);\n }, []);\n\n if (!mounted) {\n return <>{children}</>;\n }\n\n return (\n <ThemeProvider {...props}>\n {children}\n </ThemeProvider>\n );\n}","// Theme system exports\nexport { ThemeProvider, ThemeProviderNoSSR } from './theme-provider';\nexport { ThemeContextProvider, useTheme, useThemeServer } from './theme-context';\nexport { ThemeToggle } from '../components/ui/theme-toggle/index';\n\n// Client-only wrappers for Server Component compatibility\nexport { ClientThemeProvider, ClientThemeToggle } from './client-wrapper';\n\n// Re-export theme utilities\nexport { isDarkTheme, mapColorToShadcnVariant, mapVariantToShadcnVariant, getColorVariantClasses } from '../lib/theme-utils';\n\n// Export types\nexport type { ThemeColor, ComponentVariant } from '../lib/theme-utils';\n","\"use client\"\n\nimport * as React from \"react\"\nimport { ThemeProvider } from \"./theme-provider\"\nimport type { ThemeProviderProps } from \"next-themes/dist/types\"\n\n/**\n * Client-only theme provider wrapper\n * This component ensures theme functionality only runs on the client side\n * without using next/dynamic which causes Server Component issues\n */\nexport function ClientThemeProvider({ \n children, \n ...props \n}: ThemeProviderProps) {\n const [mounted, setMounted] = React.useState(false);\n\n React.useEffect(() => {\n setMounted(true);\n }, []);\n\n // During SSR or before mounting, render children without theme provider\n if (!mounted) {\n return <>{children}</>;\n }\n\n // Once mounted, render with theme provider\n return (\n <ThemeProvider {...props}>\n {children}\n </ThemeProvider>\n );\n}\n\n/**\n * Client-only theme toggle wrapper\n * This component ensures theme toggle only renders on the client side\n */\nexport function ClientThemeToggle(props: any) {\n const [mounted, setMounted] = React.useState(false);\n const [ThemeToggleComponent, setThemeToggleComponent] = React.useState<any>(undefined);\n\n React.useEffect(() => {\n setMounted(true);\n // Use dynamic import instead of require for ESM compatibility\n import(\"../components/ui/theme-toggle\").then(({ ThemeToggle }) => {\n setThemeToggleComponent(() => ThemeToggle);\n });\n }, []);\n\n // During SSR or before mounting, render nothing\n if (!mounted || !ThemeToggleComponent) {\n return null;\n }\n\n // Once mounted, render the theme toggle\n return <ThemeToggleComponent {...props} />;\n} ","/**\n * Utility functions for theme handling\n */\n\n/**\n * Supported color theme values\n */\nexport type ThemeColor = 'brand' | 'error' | 'warning' | 'success';\n\n/**\n * Supported component variant types\n */\nexport type ComponentVariant = 'primary' | 'secondary' | 'tertiary';\n\n/**\n * Map design system colors to shadcn variants\n * \n * @param color - The design system color\n * @returns The corresponding shadcn variant\n */\nexport const mapColorToShadcnVariant = (color: ThemeColor) => {\n switch (color) {\n case 'brand': return 'default';\n case 'error': return 'destructive';\n case 'warning':\n case 'success':\n return 'secondary'; // Will need additional classes\n default: return 'default';\n }\n};\n\n/**\n * Map design system variants to shadcn variants\n * \n * @param variant - The design system variant\n * @returns The corresponding shadcn variant\n */\nexport const mapVariantToShadcnVariant = (variant: ComponentVariant) => {\n switch (variant) {\n case 'primary': return 'default';\n case 'secondary': return 'outline';\n case 'tertiary': return 'ghost';\n default: return 'default';\n }\n};\n\n/**\n * Generate Tailwind classes for color/variant combinations\n * \n * @param color - The design system color\n * @param variant - The design system variant\n * @returns String of Tailwind classes\n */\nexport const getColorVariantClasses = (\n color: ThemeColor, \n variant: ComponentVariant\n): string => {\n const colorVariantMap: Record<ComponentVariant, Record<ThemeColor, string>> = {\n primary: {\n brand: 'bg-brand-600 hover:bg-brand-700 text-white focus-visible:ring-brand-500',\n error: 'bg-error-600 hover:bg-error-700 text-white focus-visible:ring-error-500',\n warning: 'bg-warning-600 hover:bg-warning-700 text-white focus-visible:ring-warning-500',\n success: 'bg-success-600 hover:bg-success-700 text-white focus-visible:ring-success-500',\n },\n secondary: {\n brand: 'border-brand-300 text-brand-700 hover:bg-brand-50 focus-visible:ring-brand-500',\n error: 'border-error-300 text-error-700 hover:bg-error-50 focus-visible:ring-error-500',\n warning: 'border-warning-300 text-warning-700 hover:bg-warning-50 focus-visible:ring-warning-500',\n success: 'border-success-300 text-success-700 hover:bg-success-50 focus-visible:ring-success-500',\n },\n tertiary: {\n brand: 'text-brand-700 hover:bg-brand-50 focus-visible:ring-brand-500',\n error: 'text-error-700 hover:bg-error-50 focus-visible:ring-error-500',\n warning: 'text-warning-700 hover:bg-warning-50 focus-visible:ring-warning-500',\n success: 'text-success-700 hover:bg-success-50 focus-visible:ring-success-500',\n }\n };\n\n return colorVariantMap[variant]?.[color] || '';\n};\n\n/**\n * Determine if the current theme is dark\n * \n * @param theme - The current theme\n * @param systemTheme - The system theme\n * @returns True if the theme is dark\n */\nexport const isDarkTheme = (theme: string | undefined, systemTheme: string | undefined): boolean => {\n if (theme === 'system') {\n return systemTheme === 'dark';\n }\n return theme === 'dark';\n};"]}
1
+ {"version":3,"sources":["../../src/themes/theme-context.tsx","../../src/lib/utils.ts","../../src/components/ui/theme-toggle/theme-toggle.tsx","../../src/components/ui/theme-toggle/index.ts","../../src/themes/theme-provider.tsx","../../src/themes/client-wrapper.tsx","../../src/themes/index.ts","../../src/lib/theme-utils.ts"],"names":["React2","jsx","React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MACT,OAAA,EAAS;AAAA;AACX,GACF;AAEA,EAAA,OAAO,eAAA,CAAgB,OAAO,CAAA,GAAI,KAAK,CAAA,IAAK,EAAA;AAC9C;AASO,IAAM,WAAA,GAAc,CAAC,KAAA,EAA2B,WAAA,KAA6C;AAClG,EAAA,IAAI,UAAU,QAAA,EAAU;AACtB,IAAA,OAAO,WAAA,KAAgB,MAAA;AAAA,EACzB;AACA,EAAA,OAAO,KAAA,KAAU,MAAA;AACnB","file":"index.mjs","sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\n\n/**\n * Server-safe theme hook that can be used in Server Components\n * Returns default theme values without accessing client-side APIs\n */\nexport function useThemeServer() {\n return {\n theme: \"system\",\n setTheme: (theme: string) => {},\n resolvedTheme: \"light\",\n isDark: false,\n };\n}\n\n/**\n * @deprecated Use ThemeProvider from './theme-provider' instead\n * This component is kept for backward compatibility but is no longer needed\n */\nexport function ThemeContextProvider({ \n children \n}: { \n children: React.ReactNode \n}) {\n // This is now a no-op wrapper for backward compatibility\n return <>{children}</>;\n}\n\n/**\n * @deprecated Use useTheme from next-themes directly or use the ThemeProvider\n * This hook is kept for backward compatibility but is no longer needed\n */\nexport function useTheme() {\n // Import next-themes dynamically to avoid SSR issues\n const [themeData, setThemeData] = React.useState({\n theme: \"system\",\n setTheme: (theme: string) => {},\n resolvedTheme: \"light\",\n isDark: false,\n });\n const [mounted, setMounted] = React.useState(false);\n\n React.useEffect(() => {\n // Only run on client side\n if (typeof window === 'undefined') return;\n\n // Import next-themes and use it properly\n import('next-themes').then((nextThemes) => {\n // Create a simple theme manager that doesn't violate hook rules\n const themeManager = {\n getTheme: () => {\n // Get theme from localStorage or system preference\n if (typeof window !== 'undefined') {\n const savedTheme = localStorage.getItem('theme');\n if (savedTheme) return savedTheme;\n \n // Check system preference\n if (window.matchMedia('(prefers-color-scheme: dark)').matches) {\n return 'dark';\n }\n }\n return 'light';\n },\n setTheme: (theme: string) => {\n if (typeof window !== 'undefined') {\n localStorage.setItem('theme', theme);\n document.documentElement.classList.toggle('dark', theme === 'dark');\n // Trigger a re-render\n setThemeData(prev => ({\n ...prev,\n theme,\n resolvedTheme: theme,\n isDark: theme === 'dark'\n }));\n }\n }\n };\n\n const currentTheme = themeManager.getTheme();\n const isDark = currentTheme === 'dark';\n \n setThemeData({\n theme: currentTheme,\n setTheme: themeManager.setTheme,\n resolvedTheme: currentTheme,\n isDark,\n });\n setMounted(true);\n });\n }, []);\n\n return themeData;\n}","import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\n/**\n * Combines multiple class values into a single className string\n * with proper Tailwind CSS class merging.\n * \n * @param inputs - Class values to merge\n * @returns Merged className string\n */\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\n/**\n * Utility function to generate a unique ID.\n * Useful for ensuring unique IDs for form elements.\n * \n * @param prefix - Optional prefix for the ID\n * @returns A unique ID string\n */\nexport function generateId(prefix = 'id'): string {\n const randomId = Math.random().toString(36).substring(2, 9);\n return `${prefix}-${randomId}`;\n}\n\n/**\n * Type guard to check if a value is not null or undefined\n * \n * @param value - Value to check\n * @returns True if value is not null or undefined\n */\nexport function isNotNullOrUndefined<T>(value: T | null | undefined): value is T {\n return value !== null && value !== undefined;\n}\n\n/**\n * Returns only the props that are safe to spread onto a DOM element\n * by filtering out custom props\n * \n * @param props - The props object\n * @param propNames - Names of custom props to filter out\n * @returns Object with only DOM-safe props\n */\nexport function filterDOMProps<T extends Record<string, any>, K extends keyof T>(\n props: T, \n propNames: K[]\n): Omit<T, K> {\n const result = { ...props };\n propNames.forEach(name => delete result[name]);\n return result;\n}","\"use client\"\n\nimport * as React from \"react\"\nimport { useTheme } from \"../../../themes/theme-context\"\nimport { cn } from \"../../../lib/utils\"\nimport { IconMoon, IconSun } from \"@tabler/icons-react\"\n\n/**\n * Props for the ThemeToggle component\n */\nexport interface ThemeToggleProps extends React.HTMLAttributes<HTMLButtonElement> {\n /**\n * Variant of the toggle\n * @default 'icon'\n */\n variant?: 'icon' | 'switch' | 'button';\n \n /**\n * Size of the toggle\n * @default 'md'\n */\n size?: 'sm' | 'md' | 'lg';\n}\n\n/**\n * ThemeToggle component to switch between light and dark themes\n * \n * IMPORTANT: This component uses React hooks and must only be used in Client Components.\n * For Server Components, use ClientThemeToggle from the themes package instead.\n */\nexport function ThemeToggle({ \n className, \n variant = 'icon', \n size = 'md',\n ...props \n}: ThemeToggleProps) {\n // Additional Server Component protection\n if (typeof window === 'undefined') {\n // Return a placeholder during SSR to prevent hydration issues\n return (\n <button\n type=\"button\"\n className={cn(\n \"inline-flex items-center justify-center rounded-md border border-input bg-background\",\n size === 'sm' ? 'h-8 w-8' : size === 'lg' ? 'h-12 w-12' : 'h-10 w-10',\n className\n )}\n aria-label=\"Toggle theme\"\n {...props}\n >\n <IconSun size={size === 'sm' ? 16 : size === 'lg' ? 24 : 20} stroke={1.5} />\n </button>\n );\n }\n\n const { theme, setTheme, resolvedTheme } = useTheme()\n const [mounted, setMounted] = React.useState(false)\n\n // Handle hydration mismatch\n React.useEffect(() => {\n setMounted(true)\n }, [])\n\n // Only render on client to prevent hydration mismatch\n if (!mounted) {\n return (\n <button\n type=\"button\"\n className={cn(\n \"inline-flex items-center justify-center rounded-md border border-input bg-background\",\n size === 'sm' ? 'h-8 w-8' : size === 'lg' ? 'h-12 w-12' : 'h-10 w-10',\n className\n )}\n aria-label=\"Toggle theme\"\n {...props}\n >\n <IconSun size={size === 'sm' ? 16 : size === 'lg' ? 24 : 20} stroke={1.5} />\n </button>\n );\n }\n\n // Toggle between light and dark\n const toggleTheme = () => {\n setTheme(resolvedTheme === \"dark\" ? \"light\" : \"dark\")\n }\n\n // Size mapping for Tabler icons\n const iconSize = {\n sm: 16,\n md: 20,\n lg: 24,\n }\n\n // Size classes for button\n const sizeClasses = {\n sm: 'h-8 w-8',\n md: 'h-10 w-10',\n lg: 'h-12 w-12',\n }\n\n // Text size classes\n const textSizeClasses = {\n sm: 'text-xs',\n md: 'text-sm',\n lg: 'text-base',\n }\n\n // Variant specific rendering\n if (variant === 'icon') {\n return (\n <button\n type=\"button\"\n onClick={toggleTheme}\n className={cn(\n \"inline-flex items-center justify-center rounded-md border border-input bg-background hover:bg-accent hover:text-accent-foreground\",\n sizeClasses[size],\n className\n )}\n aria-label=\"Toggle theme\"\n {...props}\n >\n {resolvedTheme === \"dark\" ? (\n <IconSun size={iconSize[size]} stroke={1.5} />\n ) : (\n <IconMoon size={iconSize[size]} stroke={1.5} />\n )}\n </button>\n )\n }\n \n // Button variant\n if (variant === 'button') {\n return (\n <button\n type=\"button\"\n onClick={toggleTheme}\n className={cn(\n \"inline-flex items-center justify-center rounded-md border border-input bg-background px-4 py-2\",\n textSizeClasses[size],\n \"hover:bg-accent hover:text-accent-foreground\",\n className\n )}\n aria-label=\"Toggle theme\"\n {...props}\n >\n {resolvedTheme === \"dark\" ? \"Light Mode\" : \"Dark Mode\"}\n </button>\n )\n }\n\n // Default variant (switch-like)\n return (\n <button\n type=\"button\"\n onClick={toggleTheme}\n className={cn(\n \"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\",\n textSizeClasses[size],\n resolvedTheme === \"dark\"\n ? \"bg-accent text-accent-foreground hover:bg-accent/80\"\n : \"bg-muted text-muted-foreground hover:bg-muted/80\",\n className\n )}\n aria-label=\"Toggle theme\"\n {...props}\n >\n {resolvedTheme === \"dark\" ? (\n <span className=\"flex items-center\">\n <IconSun size={iconSize[size]} stroke={1.5} className=\"mr-2\" />\n Light\n </span>\n ) : (\n <span className=\"flex items-center\">\n <IconMoon size={iconSize[size]} stroke={1.5} className=\"mr-2\" />\n Dark\n </span>\n )}\n </button>\n )\n}","export * from './theme-toggle';","\"use client\"\n\nimport * as React from \"react\"\nimport type { ThemeProviderProps } from \"next-themes/dist/types\"\n\n/**\n * ThemeProvider component for handling theme state\n * \n * This wraps the next-themes provider with sensible defaults\n * for handling light/dark themes and system preferences\n * \n * IMPORTANT: This component must be used in a Client Component context.\n * For Server Components, use the NoSSR wrapper or dynamic imports.\n */\nexport function ThemeProvider({ \n children, \n ...props \n}: ThemeProviderProps) {\n const [NextThemesProvider, setNextThemesProvider] = React.useState<any>(undefined);\n const [mounted, setMounted] = React.useState(false);\n\n React.useEffect(() => {\n // Only import next-themes on the client side\n import('next-themes').then(({ ThemeProvider: Provider }) => {\n setNextThemesProvider(() => Provider);\n setMounted(true);\n });\n }, []);\n\n // Return children without theme provider during SSR or before mounting\n if (!mounted || !NextThemesProvider) {\n return <>{children}</>;\n }\n\n return (\n <NextThemesProvider\n attribute=\"class\"\n defaultTheme=\"system\"\n enableSystem\n disableTransitionOnChange\n {...props}\n >\n {children}\n </NextThemesProvider>\n )\n}\n\n/**\n * NoSSR wrapper for theme provider to prevent SSR issues\n * Use this when you need to ensure the theme provider only renders on the client\n */\nexport function ThemeProviderNoSSR({ \n children, \n ...props \n}: ThemeProviderProps) {\n const [mounted, setMounted] = React.useState(false);\n\n React.useEffect(() => {\n setMounted(true);\n }, []);\n\n if (!mounted) {\n return <>{children}</>;\n }\n\n return (\n <ThemeProvider {...props}>\n {children}\n </ThemeProvider>\n );\n}","\"use client\"\n\nimport * as React from \"react\"\nimport { ThemeProvider } from \"./theme-provider\"\nimport type { ThemeProviderProps } from \"next-themes/dist/types\"\n\n/**\n * Client-only theme provider wrapper\n * This component ensures theme functionality only runs on the client side\n * without using next/dynamic which causes Server Component issues\n */\nexport function ClientThemeProvider({ \n children, \n ...props \n}: ThemeProviderProps) {\n const [mounted, setMounted] = React.useState(false);\n\n React.useEffect(() => {\n setMounted(true);\n }, []);\n\n // During SSR or before mounting, render children without theme provider\n if (!mounted) {\n return <>{children}</>;\n }\n\n // Once mounted, render with theme provider\n return (\n <ThemeProvider {...props}>\n {children}\n </ThemeProvider>\n );\n}\n\n/**\n * Client-only theme toggle wrapper\n * This component ensures theme toggle only renders on the client side\n * and provides a safe fallback for Server Components\n */\nexport function ClientThemeToggle(props: any) {\n const [mounted, setMounted] = React.useState(false);\n const [ThemeToggleComponent, setThemeToggleComponent] = React.useState<any>(undefined);\n\n React.useEffect(() => {\n setMounted(true);\n import(\"../components/ui/theme-toggle\").then(({ ThemeToggle }) => {\n setThemeToggleComponent(() => ThemeToggle);\n });\n }, []);\n\n // During SSR or before mounting, render a placeholder\n if (!mounted || !ThemeToggleComponent) {\n return (\n <button\n type=\"button\"\n className=\"inline-flex items-center justify-center rounded-md border border-input bg-background h-10 w-10\"\n aria-label=\"Toggle theme\"\n {...props}\n >\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"4\" />\n <path d=\"M12 2v2\" />\n <path d=\"M12 20v2\" />\n <path d=\"m4.93 4.93 1.41 1.41\" />\n <path d=\"m17.66 17.66 1.41 1.41\" />\n <path d=\"M2 12h2\" />\n <path d=\"M20 12h2\" />\n <path d=\"m6.34 17.66-1.41 1.41\" />\n <path d=\"m19.07 4.93-1.41 1.41\" />\n </svg>\n </button>\n );\n }\n\n return <ThemeToggleComponent {...props} />;\n} ","// Theme system exports\nexport { ThemeProvider, ThemeProviderNoSSR } from './theme-provider';\n\n// Client-only wrappers for Server Component compatibility\nexport { ClientThemeProvider, ClientThemeToggle } from './client-wrapper';\n\n// Server-safe theme hook\nexport { useThemeServer } from './theme-context';\n\n// Re-export theme utilities\nexport { isDarkTheme, mapColorToShadcnVariant, mapVariantToShadcnVariant, getColorVariantClasses } from '../lib/theme-utils';\n\n// Export types\nexport type { ThemeColor, ComponentVariant } from '../lib/theme-utils';\n\n// NOTE: ThemeToggle and useTheme are NOT exported to prevent Server Component issues\n// Use ClientThemeToggle and useThemeServer instead for Server Component compatibility\n","/**\n * Utility functions for theme handling\n */\n\n/**\n * Supported color theme values\n */\nexport type ThemeColor = 'brand' | 'error' | 'warning' | 'success';\n\n/**\n * Supported component variant types\n */\nexport type ComponentVariant = 'primary' | 'secondary' | 'tertiary';\n\n/**\n * Map design system colors to shadcn variants\n * \n * @param color - The design system color\n * @returns The corresponding shadcn variant\n */\nexport const mapColorToShadcnVariant = (color: ThemeColor) => {\n switch (color) {\n case 'brand': return 'default';\n case 'error': return 'destructive';\n case 'warning':\n case 'success':\n return 'secondary'; // Will need additional classes\n default: return 'default';\n }\n};\n\n/**\n * Map design system variants to shadcn variants\n * \n * @param variant - The design system variant\n * @returns The corresponding shadcn variant\n */\nexport const mapVariantToShadcnVariant = (variant: ComponentVariant) => {\n switch (variant) {\n case 'primary': return 'default';\n case 'secondary': return 'outline';\n case 'tertiary': return 'ghost';\n default: return 'default';\n }\n};\n\n/**\n * Generate Tailwind classes for color/variant combinations\n * \n * @param color - The design system color\n * @param variant - The design system variant\n * @returns String of Tailwind classes\n */\nexport const getColorVariantClasses = (\n color: ThemeColor, \n variant: ComponentVariant\n): string => {\n const colorVariantMap: Record<ComponentVariant, Record<ThemeColor, string>> = {\n primary: {\n brand: 'bg-brand-600 hover:bg-brand-700 text-white focus-visible:ring-brand-500',\n error: 'bg-error-600 hover:bg-error-700 text-white focus-visible:ring-error-500',\n warning: 'bg-warning-600 hover:bg-warning-700 text-white focus-visible:ring-warning-500',\n success: 'bg-success-600 hover:bg-success-700 text-white focus-visible:ring-success-500',\n },\n secondary: {\n brand: 'border-brand-300 text-brand-700 hover:bg-brand-50 focus-visible:ring-brand-500',\n error: 'border-error-300 text-error-700 hover:bg-error-50 focus-visible:ring-error-500',\n warning: 'border-warning-300 text-warning-700 hover:bg-warning-50 focus-visible:ring-warning-500',\n success: 'border-success-300 text-success-700 hover:bg-success-50 focus-visible:ring-success-500',\n },\n tertiary: {\n brand: 'text-brand-700 hover:bg-brand-50 focus-visible:ring-brand-500',\n error: 'text-error-700 hover:bg-error-50 focus-visible:ring-error-500',\n warning: 'text-warning-700 hover:bg-warning-50 focus-visible:ring-warning-500',\n success: 'text-success-700 hover:bg-success-50 focus-visible:ring-success-500',\n }\n };\n\n return colorVariantMap[variant]?.[color] || '';\n};\n\n/**\n * Determine if the current theme is dark\n * \n * @param theme - The current theme\n * @param systemTheme - The system theme\n * @returns True if the theme is dark\n */\nexport const isDarkTheme = (theme: string | undefined, systemTheme: string | undefined): boolean => {\n if (theme === 'system') {\n return systemTheme === 'dark';\n }\n return theme === 'dark';\n};"]}
@@ -1,148 +1,196 @@
1
1
  # Troubleshooting Guide
2
2
 
3
- Quick solutions for common issues when using the Float Design System.
3
+ This guide helps you resolve common issues when using the Float Design System.
4
4
 
5
- ## 🚨 Critical Issues
5
+ ## Quick Reference
6
6
 
7
- ### "Module not found" errors
7
+ | Issue | Solution | Version |
8
+ |-------|----------|---------|
9
+ | React Context errors in Next.js App Router | Use `ClientThemeProvider` and `ClientThemeToggle` | 1.1.9+ |
10
+ | Invalid hook call errors | Use `ClientThemeToggle` instead of `ThemeToggle` | 1.1.15+ |
11
+ | Server Component compatibility issues | Use Server Component safe components | 1.1.15+ |
8
12
 
9
- **Problem**: Can't import from `@tydavidson/design-system/themes`
13
+ ## Common Issues and Solutions
10
14
 
11
- **Solution**:
12
- 1. Ensure you're using version 1.1.4 or later
13
- 2. Clear your node_modules and reinstall: `rm -rf node_modules package-lock.json && npm install`
14
-
15
- ### React Context errors in Next.js App Router
15
+ ### 1. React Context Errors in Next.js App Router
16
16
 
17
- **Problem**: `Error: useTheme must be used within a ThemeContextProvider` or `createContext is not a function`
17
+ **Problem**: Server-side rendering doesn't match client-side rendering.
18
18
 
19
- **Solution**:
20
- 1. Use version 1.1.9 or later (Server Component compatibility added)
21
- 2. Use `ClientThemeProvider` instead of `ThemeProvider` in your root layout
22
- 3. For Server Components, use `useThemeServer` instead of `useTheme`
23
- 4. For theme toggles in Server Components, use `ClientThemeToggle`
19
+ **Solution**:
20
+ - Add `suppressHydrationWarning` to your `<html>` element
21
+ - Use the `mounted` pattern for client-only components:
24
22
 
25
23
  ```tsx
26
- // app/layout.tsx - Use ClientThemeProvider
27
- import { ClientThemeProvider } from '@tydavidson/design-system/themes';
28
-
29
- export default function RootLayout({ children }) {
30
- return (
31
- <html lang="en" suppressHydrationWarning>
32
- <body>
33
- <ClientThemeProvider>
34
- {children}
35
- </ClientThemeProvider>
36
- </body>
37
- </html>
38
- );
24
+ function ClientOnlyComponent() {
25
+ const [mounted, setMounted] = useState(false);
26
+
27
+ useEffect(() => {
28
+ setMounted(true);
29
+ }, []);
30
+
31
+ if (!mounted) return null;
32
+
33
+ return <ThemeToggle />;
39
34
  }
40
35
  ```
41
36
 
42
- ### Hydration mismatch errors
37
+ ### 2. Invalid Hook Call Errors
43
38
 
44
- **Problem**: Server and client rendering don't match
39
+ **Problem**: `Error: Invalid hook call. Hooks can only be called inside of the body of a function component.`
40
+
41
+ **Root Cause**: The design system was trying to use React hooks in invalid contexts.
42
+
43
+ **Solution**:
44
+ - Use `ClientThemeToggle` instead of `ThemeToggle` in Server Components
45
+ - Use `ClientThemeProvider` instead of `ThemeProvider` in Server Components
46
+ - All components that use hooks are now properly protected
45
47
 
46
- **Solution**:
47
48
  ```tsx
48
- // Add to your root layout
49
- <html lang="en" suppressHydrationWarning>
50
- ```
49
+ // Correct - Server Component safe
50
+ import { ClientThemeToggle } from '@tydavidson/design-system/themes';
51
51
 
52
- ## 🟡 Common Issues
52
+ export default function ServerComponent() {
53
+ return <ClientThemeToggle />;
54
+ }
53
55
 
54
- ### Theme colors not working
56
+ // Incorrect - May cause hook errors
57
+ import { ThemeToggle } from '@tydavidson/design-system/themes';
55
58
 
56
- **Problem**: Components appear in default colors instead of theme colors
59
+ export default function ServerComponent() {
60
+ return <ThemeToggle />; // This could cause issues
61
+ }
62
+ ```
57
63
 
58
- **Solutions**:
59
- 1. Import the CSS: `import '@tydavidson/design-system/themes/theme.css'`
60
- 2. Configure Tailwind with the color tokens (see setup guide)
61
- 3. Check that CSS variables are set on `:root`
64
+ ### 3. Server Component Compatibility Issues
62
65
 
63
- ### Icons not displaying
66
+ **Problem**: Components using React hooks in Server Component context.
64
67
 
65
- **Problem**: Icons show as empty boxes or don't render
68
+ **Solution**:
69
+ - Use Server Component safe components
70
+ - All exported components are now properly protected
71
+ - Components return safe placeholders during SSR
66
72
 
67
- **Solution**:
68
- ```bash
69
- npm install @tabler/icons-react
70
- ```
73
+ **Server Component Safe Components:**
74
+ - `ClientThemeProvider` - Safe theme provider for Server Components
75
+ - `ClientThemeToggle` - Safe theme toggle for Server Components
76
+ - `useThemeServer` - Server-safe theme hook
71
77
 
72
- ### TypeScript errors
78
+ **Client Component Only Components:**
79
+ - `ThemeToggle` - Only use in Client Components
80
+ - `ThemeProvider` - Only use in Client Components
81
+ - `useTheme` - Only use in Client Components
73
82
 
74
- **Problem**: TypeScript can't find types
83
+ ### 4. CSS Variables Not Working
75
84
 
76
- **Solutions**:
77
- 1. The package includes types - no additional @types package needed
78
- 2. Check your `tsconfig.json` includes `node_modules`
79
- 3. Restart your TypeScript server
85
+ **Problem**: Theme colors aren't applying correctly.
80
86
 
81
- ### Bundle size too large
87
+ **Solution**:
88
+ - Ensure CSS variables are properly imported
89
+ - Check that the theme provider is wrapping your app
90
+ - Verify Tailwind CSS is configured correctly
82
91
 
83
- **Problem**: Design system is making your bundle huge
92
+ ```tsx
93
+ // Make sure to import the CSS
94
+ import '@tydavidson/design-system/src/themes/theme.css';
95
+ ```
84
96
 
85
- **Solutions**:
86
- 1. Use tree-shaking - only import what you need
87
- 2. Icon libraries are external (won't be bundled)
88
- 3. Use dynamic imports for large components
97
+ ### 5. Hydration Mismatch Errors
89
98
 
90
- ## 🔧 Quick Fixes
99
+ **Problem**: Server and client rendering don't match.
91
100
 
92
- ### Missing peer dependencies
101
+ **Solution**:
102
+ - Use `suppressHydrationWarning` on the `<html>` element
103
+ - Use client-only components for theme-dependent UI
104
+ - Ensure consistent initial state between server and client
93
105
 
94
- ```bash
95
- npm install react react-dom next-themes @tabler/icons-react
106
+ ```tsx
107
+ // In your root layout
108
+ <html suppressHydrationWarning>
109
+ <body>
110
+ <ThemeProvider>
111
+ {children}
112
+ </ThemeProvider>
113
+ </body>
114
+ </html>
96
115
  ```
97
116
 
98
- ### CSS not loading
117
+ ### 6. Module Resolution Issues
99
118
 
100
- Add to your main CSS file or layout:
101
- ```css
102
- @import '@tydavidson/design-system/themes/theme.css';
103
- ```
119
+ **Problem**: Can't import components or themes.
104
120
 
105
- ### Tailwind not recognizing classes
121
+ **Solution**:
122
+ - Check that you're using the correct import paths
123
+ - Ensure the package is properly installed
124
+ - Verify TypeScript configuration
106
125
 
107
- Update your `tailwind.config.js`:
108
- ```js
109
- content: [
110
- "./src/**/*.{js,ts,jsx,tsx}",
111
- "./node_modules/@tydavidson/design-system/dist/**/*.{js,mjs}",
112
- ],
126
+ ```tsx
127
+ // Correct import paths
128
+ import { Button } from '@tydavidson/design-system';
129
+ import { ClientThemeToggle } from '@tydavidson/design-system/themes';
113
130
  ```
114
131
 
115
- ### Theme provider not working
132
+ ## Server Component Best Practices
133
+
134
+ ### Using Theme System in Server Components
116
135
 
117
- Make sure you're using the correct import:
136
+ **For Server Components:**
118
137
  ```tsx
119
- import { ThemeProvider } from '@tydavidson/design-system/themes';
120
- // NOT ThemeContextProvider (deprecated)
138
+ import { useThemeServer, ClientThemeToggle } from '@tydavidson/design-system/themes';
139
+
140
+ export default function ServerComponent() {
141
+ const { theme, isDark } = useThemeServer();
142
+
143
+ return (
144
+ <div className={isDark ? 'dark' : 'light'}>
145
+ <h1>Current theme: {theme}</h1>
146
+ <ClientThemeToggle />
147
+ </div>
148
+ );
149
+ }
121
150
  ```
122
151
 
123
- ## 📋 Checklist
152
+ **For Client Components:**
153
+ ```tsx
154
+ 'use client';
155
+ import { useTheme, ThemeToggle } from '@tydavidson/design-system/themes';
156
+
157
+ export default function ClientComponent() {
158
+ const { theme, setTheme, isDark } = useTheme();
159
+
160
+ return (
161
+ <div>
162
+ <button onClick={() => setTheme('dark')}>
163
+ Switch to Dark Mode
164
+ </button>
165
+ <ThemeToggle />
166
+ </div>
167
+ );
168
+ }
169
+ ```
170
+
171
+ ### Component Safety Guidelines
172
+
173
+ 1. **Always use `ClientThemeToggle` in Server Components**
174
+ 2. **Use `ClientThemeProvider` for Server Component layouts**
175
+ 3. **Use `useThemeServer` for Server Component theme detection**
176
+ 4. **Mark components that use hooks with `'use client'`**
177
+ 5. **Use proper SSR protection for browser APIs**
124
178
 
125
- Before reporting an issue, verify:
179
+ ## Version Compatibility
126
180
 
127
- - [ ] Using latest version (1.1.4+)
128
- - [ ] All peer dependencies installed
129
- - [ ] CSS imported correctly
130
- - [ ] Tailwind configured with color tokens
131
- - [ ] ThemeProvider wrapping your app
132
- - [ ] `suppressHydrationWarning` on html element
133
- - [ ] No conflicting CSS frameworks
181
+ | Next.js Version | Design System Version | Notes |
182
+ |----------------|----------------------|-------|
183
+ | 13+ (App Router) | 1.1.15+ | Full Server Component support |
184
+ | 12+ (Pages Router) | 1.1.0+ | Basic compatibility |
185
+ | < 12 | Not supported | Use newer Next.js version |
134
186
 
135
- ## 🆘 Still Having Issues?
187
+ ## Getting Help
136
188
 
137
- 1. Check the browser console for specific error messages
138
- 2. Verify your setup matches the [setup guide](./setup-guide.md)
139
- 3. Try the [theme usage examples](./theme-usage.md)
140
- 4. Check if the issue is in the consuming project, not the design system
189
+ If you're still experiencing issues:
141
190
 
142
- ## Version History
191
+ 1. Check the [Setup Guide](./setup-guide.md) for proper installation
192
+ 2. Review the [Theme Usage Guide](./theme-usage.md) for theme system details
193
+ 3. Ensure you're using the latest version of the design system
194
+ 4. Check that all dependencies are compatible
143
195
 
144
- - **1.1.4**: Fixed React context compatibility with Next.js App Router
145
- - **1.1.3**: Added ESM exports for Next.js compatibility
146
- - **1.1.2**: Fixed internal module resolution issues
147
- - **1.1.1**: Fixed import path issues
148
- - **1.1.0**: Added theme system exports
196
+ For additional support, please check the project documentation or create an issue in the repository.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tydavidson/design-system",
3
- "version": "1.1.15",
3
+ "version": "1.1.17",
4
4
  "description": "Float Design System with email components and theme system",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",