shadcn-glass-ui 1.0.9 → 1.0.11

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.
Files changed (38) hide show
  1. package/CHANGELOG.md +46 -16
  2. package/README.md +78 -15
  3. package/dist/components.cjs +4 -4
  4. package/dist/components.js +1 -1
  5. package/dist/hooks.cjs +2 -2
  6. package/dist/index.cjs +5 -5
  7. package/dist/index.js +1 -1
  8. package/dist/r/alert-glass.json +1 -1
  9. package/dist/r/badge-glass.json +1 -1
  10. package/dist/r/button-glass.json +1 -1
  11. package/dist/r/checkbox-glass.json +1 -1
  12. package/dist/r/dropdown-glass.json +1 -1
  13. package/dist/r/glass-card.json +1 -1
  14. package/dist/r/input-glass.json +1 -1
  15. package/dist/r/language-bar-glass.json +1 -1
  16. package/dist/r/modal-glass.json +1 -1
  17. package/dist/r/popover-glass.json +1 -1
  18. package/dist/r/progress-glass.json +1 -1
  19. package/dist/r/registry.json +0 -2
  20. package/dist/r/segmented-control-glass.json +1 -1
  21. package/dist/r/tabs-glass.json +1 -1
  22. package/dist/r/tooltip-glass.json +1 -1
  23. package/dist/shadcn-glass-ui.css +1 -1
  24. package/dist/{theme-context-BcTQdqsj.cjs → theme-context-XtasSxRT.cjs} +2 -2
  25. package/dist/{theme-context-BcTQdqsj.cjs.map → theme-context-XtasSxRT.cjs.map} +1 -1
  26. package/dist/themes.cjs +1 -1
  27. package/dist/{trust-score-card-glass-Dq28n8en.cjs → trust-score-card-glass-CNcQveNY.cjs} +19 -15
  28. package/dist/{trust-score-card-glass-Dq28n8en.cjs.map → trust-score-card-glass-CNcQveNY.cjs.map} +1 -1
  29. package/dist/{trust-score-card-glass-CHzWGuko.js → trust-score-card-glass-CowcDyxH.js} +16 -12
  30. package/dist/{trust-score-card-glass-CHzWGuko.js.map → trust-score-card-glass-CowcDyxH.js.map} +1 -1
  31. package/dist/{use-focus-CH8KNgcY.cjs → use-focus-BbpE2qGq.cjs} +2 -2
  32. package/dist/{use-focus-CH8KNgcY.cjs.map → use-focus-BbpE2qGq.cjs.map} +1 -1
  33. package/dist/{use-wallpaper-tint-DNecAf46.cjs → use-wallpaper-tint-CIqtoETa.cjs} +2 -2
  34. package/dist/{use-wallpaper-tint-DNecAf46.cjs.map → use-wallpaper-tint-CIqtoETa.cjs.map} +1 -1
  35. package/dist/{utils-3cDWhVvH.cjs → utils-CriE74ig.cjs} +2 -2
  36. package/dist/{utils-3cDWhVvH.cjs.map → utils-CriE74ig.cjs.map} +1 -1
  37. package/dist/utils.cjs +1 -1
  38. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- const require_trust_score_card_glass = require("./trust-score-card-glass-Dq28n8en.cjs");
1
+ const require_trust_score_card_glass = require("./trust-score-card-glass-CNcQveNY.cjs");
2
2
  let react = require("react");
3
3
  let lucide_react = require("lucide-react");
4
4
  let react_jsx_runtime = require("react/jsx-runtime");
@@ -99,4 +99,4 @@ Object.defineProperty(exports, "useTheme", {
99
99
  }
100
100
  });
101
101
 
102
- //# sourceMappingURL=theme-context-BcTQdqsj.cjs.map
102
+ //# sourceMappingURL=theme-context-XtasSxRT.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"theme-context-BcTQdqsj.cjs","names":["THEMES: readonly Theme[]","THEME_CONFIG: Record<Theme, ThemeConfig>","DEFAULT_THEME: Theme","value: ThemeContextValue"],"sources":["../src/lib/theme-context.tsx"],"sourcesContent":["// ========================================\n// THEME SYSTEM\n// Multi-theme support with CSS variables\n// ========================================\n\nimport {\n createContext,\n useContext,\n useState,\n useEffect,\n useCallback,\n type ReactNode,\n} from \"react\";\nimport { Sun, Moon, Palette, type LucideIcon } from \"lucide-react\";\n\n// ========================================\n// TYPES\n// ========================================\n\nexport type Theme = \"light\" | \"aurora\" | \"glass\";\n\n/** @deprecated Use Theme instead */\nexport type ThemeName = Theme;\n\nexport interface ThemeConfig {\n readonly label: string;\n readonly icon: LucideIcon;\n}\n\nexport interface ThemeContextValue {\n readonly theme: Theme;\n readonly setTheme: (theme: Theme) => void;\n readonly cycleTheme: () => void;\n}\n\n// ========================================\n// CONSTANTS\n// ========================================\n\nexport const THEMES: readonly Theme[] = [\"light\", \"aurora\", \"glass\"] as const;\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport const THEME_CONFIG: Record<Theme, ThemeConfig> = {\n light: { label: \"Light\", icon: Sun },\n aurora: { label: \"Aurora\", icon: Moon },\n glass: { label: \"Glass\", icon: Palette },\n} as const;\n\nconst STORAGE_KEY = \"glass-ui-theme\";\nconst DEFAULT_THEME: Theme = \"glass\";\n\n// ========================================\n// CONTEXT\n// ========================================\n\nconst ThemeContext = createContext<ThemeContextValue | null>(null);\n\n// ========================================\n// PROVIDER\n// ========================================\n\ninterface ThemeProviderProps {\n readonly children: ReactNode;\n readonly defaultTheme?: Theme;\n readonly storageKey?: string;\n}\n\nexport function ThemeProvider({\n children,\n defaultTheme = DEFAULT_THEME,\n storageKey = STORAGE_KEY,\n}: ThemeProviderProps) {\n const [theme, setThemeState] = useState<Theme>(() => {\n if (typeof window === \"undefined\") {\n return defaultTheme;\n }\n\n const stored = localStorage.getItem(storageKey);\n if (stored && THEMES.includes(stored as Theme)) {\n return stored as Theme;\n }\n\n return defaultTheme;\n });\n\n // Apply theme to document\n useEffect(() => {\n const root = document.documentElement;\n root.setAttribute(\"data-theme\", theme);\n localStorage.setItem(storageKey, theme);\n }, [theme, storageKey]);\n\n const setTheme = useCallback((newTheme: Theme) => {\n if (THEMES.includes(newTheme)) {\n setThemeState(newTheme);\n }\n }, []);\n\n const cycleTheme = useCallback(() => {\n setThemeState((current) => {\n const currentIndex = THEMES.indexOf(current);\n const nextIndex = (currentIndex + 1) % THEMES.length;\n return THEMES[nextIndex];\n });\n }, []);\n\n const value: ThemeContextValue = {\n theme,\n setTheme,\n cycleTheme,\n };\n\n return (\n <ThemeContext.Provider value={value}>\n {children}\n </ThemeContext.Provider>\n );\n}\n\n// ========================================\n// HOOK\n// ========================================\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport function useTheme(): ThemeContextValue {\n const context = useContext(ThemeContext);\n\n if (!context) {\n throw new Error(\"useTheme must be used within a ThemeProvider\");\n }\n\n return context;\n}\n\n// ========================================\n// UTILITIES\n// ========================================\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport function getNextTheme(current: Theme): Theme {\n const currentIndex = THEMES.indexOf(current);\n const nextIndex = (currentIndex + 1) % THEMES.length;\n return THEMES[nextIndex];\n}\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport function getThemeConfig(theme: Theme): ThemeConfig {\n return THEME_CONFIG[theme];\n}\n"],"mappings":";;;;AAuCA,MAAaA,SAA2B;CAAC;CAAS;CAAU;CAAQ;AAGpE,MAAaC,eAA2C;CACtD,OAAO;EAAE,OAAO;EAAS,MAAM,aAAA;EAAK;CACpC,QAAQ;EAAE,OAAO;EAAU,MAAM,aAAA;EAAM;CACvC,OAAO;EAAE,OAAO;EAAS,MAAM,aAAA;EAAS;CACzC;AAED,IAAM,cAAc;AACpB,IAAMC,gBAAuB;AAM7B,IAAM,gBAAA,GAAA,MAAA,eAAuD,KAAK;AAYlE,SAAgB,cAAc,EAC5B,UACA,eAAe,eACf,aAAa,eACQ;CACrB,MAAM,CAAC,OAAO,kBAAA,GAAA,MAAA,gBAAuC;AACnD,MAAI,OAAO,WAAW,YACpB,QAAO;EAGT,MAAM,SAAS,aAAa,QAAQ,WAAW;AAC/C,MAAI,UAAU,OAAO,SAAS,OAAgB,CAC5C,QAAO;AAGT,SAAO;GACP;AAGF,EAAA,GAAA,MAAA,iBAAgB;AACD,WAAS,gBACjB,aAAa,cAAc,MAAM;AACtC,eAAa,QAAQ,YAAY,MAAM;IACtC,CAAC,OAAO,WAAW,CAAC;CAgBvB,MAAMC,QAA2B;EAC/B;EACA,WAAA,GAAA,MAAA,cAhB4B,aAAoB;AAChD,OAAI,OAAO,SAAS,SAAS,CAC3B,eAAc,SAAS;KAExB,EAAE,CAAC;EAaJ,aAAA,GAAA,MAAA,mBAXmC;AACnC,kBAAe,YAAY;AAGzB,WAAO,QAFc,OAAO,QAAQ,QAAQ,GACV,KAAK,OAAO;KAE9C;KACD,EAAE,CAAC;EAML;AAED,QACE,iBAAA,GAAA,kBAAA,KAAC,aAAa,UAAA;EAAgB;EAC3B;GACqB;;AAS5B,SAAgB,WAA8B;CAC5C,MAAM,WAAA,GAAA,MAAA,YAAqB,aAAa;AAExC,KAAI,CAAC,QACH,OAAM,IAAI,MAAM,+CAA+C;AAGjE,QAAO;;AAQT,SAAgB,aAAa,SAAuB;AAGlD,QAAO,QAFc,OAAO,QAAQ,QAAQ,GACV,KAAK,OAAO;;AAKhD,SAAgB,eAAe,OAA2B;AACxD,QAAO,aAAa"}
1
+ {"version":3,"file":"theme-context-XtasSxRT.cjs","names":["THEMES: readonly Theme[]","THEME_CONFIG: Record<Theme, ThemeConfig>","DEFAULT_THEME: Theme","value: ThemeContextValue"],"sources":["../src/lib/theme-context.tsx"],"sourcesContent":["// ========================================\n// THEME SYSTEM\n// Multi-theme support with CSS variables\n// ========================================\n\nimport {\n createContext,\n useContext,\n useState,\n useEffect,\n useCallback,\n type ReactNode,\n} from \"react\";\nimport { Sun, Moon, Palette, type LucideIcon } from \"lucide-react\";\n\n// ========================================\n// TYPES\n// ========================================\n\nexport type Theme = \"light\" | \"aurora\" | \"glass\";\n\n/** @deprecated Use Theme instead */\nexport type ThemeName = Theme;\n\nexport interface ThemeConfig {\n readonly label: string;\n readonly icon: LucideIcon;\n}\n\nexport interface ThemeContextValue {\n readonly theme: Theme;\n readonly setTheme: (theme: Theme) => void;\n readonly cycleTheme: () => void;\n}\n\n// ========================================\n// CONSTANTS\n// ========================================\n\nexport const THEMES: readonly Theme[] = [\"light\", \"aurora\", \"glass\"] as const;\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport const THEME_CONFIG: Record<Theme, ThemeConfig> = {\n light: { label: \"Light\", icon: Sun },\n aurora: { label: \"Aurora\", icon: Moon },\n glass: { label: \"Glass\", icon: Palette },\n} as const;\n\nconst STORAGE_KEY = \"glass-ui-theme\";\nconst DEFAULT_THEME: Theme = \"glass\";\n\n// ========================================\n// CONTEXT\n// ========================================\n\nconst ThemeContext = createContext<ThemeContextValue | null>(null);\n\n// ========================================\n// PROVIDER\n// ========================================\n\ninterface ThemeProviderProps {\n readonly children: ReactNode;\n readonly defaultTheme?: Theme;\n readonly storageKey?: string;\n}\n\nexport function ThemeProvider({\n children,\n defaultTheme = DEFAULT_THEME,\n storageKey = STORAGE_KEY,\n}: ThemeProviderProps) {\n const [theme, setThemeState] = useState<Theme>(() => {\n if (typeof window === \"undefined\") {\n return defaultTheme;\n }\n\n const stored = localStorage.getItem(storageKey);\n if (stored && THEMES.includes(stored as Theme)) {\n return stored as Theme;\n }\n\n return defaultTheme;\n });\n\n // Apply theme to document\n useEffect(() => {\n const root = document.documentElement;\n root.setAttribute(\"data-theme\", theme);\n localStorage.setItem(storageKey, theme);\n }, [theme, storageKey]);\n\n const setTheme = useCallback((newTheme: Theme) => {\n if (THEMES.includes(newTheme)) {\n setThemeState(newTheme);\n }\n }, []);\n\n const cycleTheme = useCallback(() => {\n setThemeState((current) => {\n const currentIndex = THEMES.indexOf(current);\n const nextIndex = (currentIndex + 1) % THEMES.length;\n return THEMES[nextIndex];\n });\n }, []);\n\n const value: ThemeContextValue = {\n theme,\n setTheme,\n cycleTheme,\n };\n\n return (\n <ThemeContext.Provider value={value}>\n {children}\n </ThemeContext.Provider>\n );\n}\n\n// ========================================\n// HOOK\n// ========================================\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport function useTheme(): ThemeContextValue {\n const context = useContext(ThemeContext);\n\n if (!context) {\n throw new Error(\"useTheme must be used within a ThemeProvider\");\n }\n\n return context;\n}\n\n// ========================================\n// UTILITIES\n// ========================================\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport function getNextTheme(current: Theme): Theme {\n const currentIndex = THEMES.indexOf(current);\n const nextIndex = (currentIndex + 1) % THEMES.length;\n return THEMES[nextIndex];\n}\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport function getThemeConfig(theme: Theme): ThemeConfig {\n return THEME_CONFIG[theme];\n}\n"],"mappings":";;;;AAuCA,MAAaA,SAA2B;CAAC;CAAS;CAAU;CAAQ;AAGpE,MAAaC,eAA2C;CACtD,OAAO;EAAE,OAAO;EAAS,MAAM,aAAA;EAAK;CACpC,QAAQ;EAAE,OAAO;EAAU,MAAM,aAAA;EAAM;CACvC,OAAO;EAAE,OAAO;EAAS,MAAM,aAAA;EAAS;CACzC;AAED,IAAM,cAAc;AACpB,IAAMC,gBAAuB;AAM7B,IAAM,gBAAA,GAAA,MAAA,eAAuD,KAAK;AAYlE,SAAgB,cAAc,EAC5B,UACA,eAAe,eACf,aAAa,eACQ;CACrB,MAAM,CAAC,OAAO,kBAAA,GAAA,MAAA,gBAAuC;AACnD,MAAI,OAAO,WAAW,YACpB,QAAO;EAGT,MAAM,SAAS,aAAa,QAAQ,WAAW;AAC/C,MAAI,UAAU,OAAO,SAAS,OAAgB,CAC5C,QAAO;AAGT,SAAO;GACP;AAGF,EAAA,GAAA,MAAA,iBAAgB;AACD,WAAS,gBACjB,aAAa,cAAc,MAAM;AACtC,eAAa,QAAQ,YAAY,MAAM;IACtC,CAAC,OAAO,WAAW,CAAC;CAgBvB,MAAMC,QAA2B;EAC/B;EACA,WAAA,GAAA,MAAA,cAhB4B,aAAoB;AAChD,OAAI,OAAO,SAAS,SAAS,CAC3B,eAAc,SAAS;KAExB,EAAE,CAAC;EAaJ,aAAA,GAAA,MAAA,mBAXmC;AACnC,kBAAe,YAAY;AAGzB,WAAO,QAFc,OAAO,QAAQ,QAAQ,GACV,KAAK,OAAO;KAE9C;KACD,EAAE,CAAC;EAML;AAED,QACE,iBAAA,GAAA,kBAAA,KAAC,aAAa,UAAA;EAAgB;EAC3B;GACqB;;AAS5B,SAAgB,WAA8B;CAC5C,MAAM,WAAA,GAAA,MAAA,YAAqB,aAAa;AAExC,KAAI,CAAC,QACH,OAAM,IAAI,MAAM,+CAA+C;AAGjE,QAAO;;AAQT,SAAgB,aAAa,SAAuB;AAGlD,QAAO,QAFc,OAAO,QAAQ,QAAQ,GACV,KAAK,OAAO;;AAKhD,SAAgB,eAAe,OAA2B;AACxD,QAAO,aAAa"}
package/dist/themes.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_theme_context = require("./theme-context-BcTQdqsj.cjs");
1
+ const require_theme_context = require("./theme-context-XtasSxRT.cjs");
2
2
  exports.THEMES = require_theme_context.THEMES;
3
3
  exports.THEME_CONFIG = require_theme_context.THEME_CONFIG;
4
4
  exports.ThemeProvider = require_theme_context.ThemeProvider;
@@ -18,9 +18,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
18
18
  value: mod,
19
19
  enumerable: true
20
20
  }) : target, mod));
21
- const require_utils = require("./utils-3cDWhVvH.cjs");
22
- const require_use_focus = require("./use-focus-CH8KNgcY.cjs");
23
- const require_theme_context = require("./theme-context-BcTQdqsj.cjs");
21
+ const require_utils = require("./utils-CriE74ig.cjs");
22
+ const require_use_focus = require("./use-focus-BbpE2qGq.cjs");
23
+ const require_theme_context = require("./theme-context-XtasSxRT.cjs");
24
24
  let react = require("react");
25
25
  react = __toESM(react);
26
26
  let lucide_react = require("lucide-react");
@@ -5492,7 +5492,7 @@ const PopoverGlass = react.forwardRef(({ trigger, children, side = "bottom", ali
5492
5492
  side,
5493
5493
  align,
5494
5494
  sideOffset,
5495
- className: require_utils.cn("z-[50003] rounded-2xl p-4", "animate-in fade-in-0 zoom-in-95 duration-200", "data-[side=bottom]:slide-in-from-top-2", "data-[side=top]:slide-in-from-bottom-2", "data-[side=right]:slide-in-from-left-2", "data-[side=left]:slide-in-from-right-2", "outline-none", className),
5495
+ className: require_utils.cn("z-[50003] rounded-2xl", "animate-in fade-in-0 zoom-in-95 duration-200", "data-[side=bottom]:slide-in-from-top-2", "data-[side=top]:slide-in-from-bottom-2", "data-[side=right]:slide-in-from-left-2", "data-[side=left]:slide-in-from-right-2", "outline-none", className),
5496
5496
  style: popoverStyles,
5497
5497
  role: "dialog",
5498
5498
  "aria-modal": "false",
@@ -6277,9 +6277,10 @@ var defaultLangColors = {
6277
6277
  Ruby: "bg-red-600",
6278
6278
  PHP: "bg-indigo-500"
6279
6279
  };
6280
- const LanguageBarGlass = (0, react.forwardRef)(({ languages, showLegend = true, className, ...props }, ref) => {
6280
+ const LanguageBarGlass = (0, react.forwardRef)(({ languages = [], showLegend = true, className, ...props }, ref) => {
6281
6281
  const [hoveredLang, setHoveredLang] = (0, react.useState)(null);
6282
6282
  const barStyles = { boxShadow: "var(--rainbow-glow)" };
6283
+ if (!languages || languages.length === 0) return null;
6283
6284
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6284
6285
  ref,
6285
6286
  className: require_utils.cn("w-full", className),
@@ -6393,8 +6394,8 @@ const progressSizes = (0, class_variance_authority.cva)("rounded-full overflow-h
6393
6394
  } },
6394
6395
  defaultVariants: { size: "md" }
6395
6396
  });
6396
- var getGradientColors = (gradient) => {
6397
- return {
6397
+ var getGradientColors = (gradient = "violet") => {
6398
+ const gradients = {
6398
6399
  violet: {
6399
6400
  from: "#8b5cf6",
6400
6401
  to: "#a855f7",
@@ -6425,9 +6426,10 @@ var getGradientColors = (gradient) => {
6425
6426
  to: "#fb7185",
6426
6427
  glowVar: "--progress-glow-rose"
6427
6428
  }
6428
- }[gradient];
6429
+ };
6430
+ return gradients[gradient] || gradients.violet;
6429
6431
  };
6430
- const ProgressGlass = (0, react.forwardRef)(({ className, size: size$3 = "md", value, gradient = "violet", showLabel, ...props }, ref) => {
6432
+ const ProgressGlass = (0, react.forwardRef)(({ className, size: size$3 = "md", value = 0, gradient = "violet", showLabel, ...props }, ref) => {
6431
6433
  const clampedValue = Math.min(100, Math.max(0, value));
6432
6434
  const gradientColors = getGradientColors(gradient);
6433
6435
  const trackStyles = { background: "var(--progress-bg)" };
@@ -6499,14 +6501,16 @@ const RainbowProgressGlass = (0, react.forwardRef)(({ value, size: size$3 = "lg"
6499
6501
  });
6500
6502
  });
6501
6503
  RainbowProgressGlass.displayName = "RainbowProgressGlass";
6502
- const SegmentedControlGlass = (0, react.forwardRef)(({ options: options$1, value, onChange, className, ...props }, ref) => {
6504
+ const SegmentedControlGlass = (0, react.forwardRef)(({ options: options$1 = [], value, onChange, className, ...props }, ref) => {
6505
+ const containerStyles = {
6506
+ border: "1px solid var(--segmented-container-border)",
6507
+ background: "var(--segmented-container-bg)"
6508
+ };
6509
+ if (!options$1 || options$1.length === 0) return null;
6503
6510
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
6504
6511
  ref,
6505
6512
  className: require_utils.cn("flex rounded-xl overflow-hidden", className),
6506
- style: {
6507
- border: "1px solid var(--segmented-container-border)",
6508
- background: "var(--segmented-container-bg)"
6509
- },
6513
+ style: containerStyles,
6510
6514
  role: "tablist",
6511
6515
  ...props,
6512
6516
  children: options$1.map((opt) => {
@@ -8224,4 +8228,4 @@ Object.defineProperty(exports, "tooltipPositions", {
8224
8228
  }
8225
8229
  });
8226
8230
 
8227
- //# sourceMappingURL=trust-score-card-glass-Dq28n8en.cjs.map
8231
+ //# sourceMappingURL=trust-score-card-glass-CNcQveNY.cjs.map