@yuhuanowo/yunui 0.2.14 → 0.2.15

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/styles/yunui.css CHANGED
@@ -1017,6 +1017,19 @@ select.input option,
1017
1017
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.03);
1018
1018
  }
1019
1019
 
1020
+ /* iOS Safari auto-zooms the page when focusing a form field whose font-size is
1021
+ < 16px (our inputs use text-sm = 14px). On touch devices only, floor text
1022
+ fields at 16px so the page doesn't jump on focus. Desktop keeps the 14px look.
1023
+ The stacked :not() attribute selectors out-specify the `text-sm` utility, so
1024
+ no !important is needed; non-text controls are excluded. */
1025
+ @media (hover: none) and (pointer: coarse) {
1026
+ input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),
1027
+ textarea,
1028
+ select {
1029
+ font-size: 16px;
1030
+ }
1031
+ }
1032
+
1020
1033
  .input-glass {
1021
1034
  background: var(--bg-glass);
1022
1035
  backdrop-filter: blur(8px);
@@ -1652,6 +1665,56 @@ select.input option,
1652
1665
  opacity: 1;
1653
1666
  }
1654
1667
 
1668
+ /* Radix-driven states — let the SAME .dropdown-item drive @radix-ui Select /
1669
+ DropdownMenu rows (keyboard `data-highlighted`, selected `data-state=checked`),
1670
+ so hand-rolled and Radix dropdowns share one look. Hand-rolled lists can also
1671
+ set `data-highlighted` for keyboard highlight and `.active` for the selection. */
1672
+ .dropdown-item[data-highlighted] {
1673
+ color: var(--text-primary);
1674
+ background: rgba(0, 0, 0, 0.03);
1675
+ outline: none;
1676
+ }
1677
+
1678
+ .dropdown-item[data-highlighted]::before {
1679
+ transform: translateY(-50%) translateX(0);
1680
+ opacity: 0.3;
1681
+ }
1682
+
1683
+ .dropdown-item[data-state="checked"] {
1684
+ color: var(--text-primary);
1685
+ font-weight: 500;
1686
+ }
1687
+
1688
+ .dropdown-item[data-state="checked"]::before {
1689
+ transform: translateY(-50%) translateX(0);
1690
+ opacity: 1;
1691
+ height: 18px;
1692
+ }
1693
+
1694
+ .dark .dropdown-item[data-highlighted],
1695
+ .true-black .dropdown-item[data-highlighted] {
1696
+ background: var(--accent-subtle);
1697
+ color: var(--text-primary);
1698
+ }
1699
+
1700
+ .dark .dropdown-item[data-highlighted]::before,
1701
+ .true-black .dropdown-item[data-highlighted]::before {
1702
+ background: var(--text-primary);
1703
+ opacity: 0.4;
1704
+ }
1705
+
1706
+ .dark .dropdown-item[data-state="checked"],
1707
+ .true-black .dropdown-item[data-state="checked"] {
1708
+ color: var(--text-primary);
1709
+ font-weight: 600;
1710
+ }
1711
+
1712
+ .dark .dropdown-item[data-state="checked"]::before,
1713
+ .true-black .dropdown-item[data-state="checked"]::before {
1714
+ background: var(--text-primary);
1715
+ opacity: 1;
1716
+ }
1717
+
1655
1718
  /* Input dark mode fixes */
1656
1719
  .dark .input:focus,
1657
1720
  .true-black .input:focus {
@@ -2560,6 +2623,45 @@ html {
2560
2623
  }
2561
2624
  }
2562
2625
 
2626
+ /* =====================================================
2627
+ THEME EFFECTS — token-driven, so they restyle automatically with the active
2628
+ brand/accent palette (and any YUNUI_THEME_PRESETS combo). Drive a whole hero
2629
+ or CTA off the current theme with one class.
2630
+ ===================================================== */
2631
+
2632
+ /* Diagonal brand → accent gradient fill. */
2633
+ .bg-brand-gradient {
2634
+ background-image: linear-gradient(135deg, var(--brand-solid-strong), var(--accent-solid-strong));
2635
+ }
2636
+
2637
+ /* Same gradient, clipped to text — for headlines that pick up the theme. */
2638
+ .text-brand-gradient {
2639
+ background-image: linear-gradient(120deg, var(--brand-solid-strong), var(--accent-solid-strong));
2640
+ -webkit-background-clip: text;
2641
+ background-clip: text;
2642
+ color: transparent;
2643
+ }
2644
+
2645
+ /* Soft brand glow (a hairline ring + diffuse shadow), tuned via alpha tokens. */
2646
+ .glow-brand {
2647
+ box-shadow: 0 0 0 1px var(--brand-alpha-weak), 0 10px 34px -8px var(--brand-alpha-medium);
2648
+ }
2649
+ .glow-accent {
2650
+ box-shadow: 0 0 0 1px var(--accent-alpha-weak), 0 10px 34px -8px var(--accent-alpha-medium);
2651
+ }
2652
+
2653
+ /* Slowly drifting brand→accent sheen for hero surfaces (pauses on reduced-motion). */
2654
+ .bg-brand-sheen {
2655
+ background-image: linear-gradient(110deg, var(--brand-solid-strong), var(--accent-solid-strong), var(--brand-solid-strong));
2656
+ background-size: 200% 100%;
2657
+ animation: yunui-sheen 6s linear infinite;
2658
+ }
2659
+ @keyframes yunui-sheen {
2660
+ to {
2661
+ background-position: -200% 0;
2662
+ }
2663
+ }
2664
+
2563
2665
  /* Reduced-motion reset — when the user asks for less motion, neutralize all
2564
2666
  animations/transitions (skeleton shimmer, marquee, shimmer buttons, pulses,
2565
2667
  typing cursors, particles, framer-motion, Radix data-state animations…).
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/lib/cn.ts","../src/primitives/theme-toggle.tsx"],"names":[],"mappings":";;;;;;;;AAOO,SAAS,MAAM,MAAA,EAAsB;AAC1C,EAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAC,CAAA;AAC7B;ACQO,SAAS,WAAA,CAAY,EAAE,OAAA,GAAU,MAAA,EAAQ,QAAQ,OAAA,EAAS,SAAA,GAAY,IAAG,EAAqB;AACjG,EAAA,MAAM,EAAE,KAAA,EAAO,QAAA,EAAS,GAAI,QAAA,EAAS;AACrC,EAAA,MAAM,CAAA,GAAI,QAAA,EAAS,CAAE,IAAA,CAAK,cAAc,CAAA;AACxC,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAU,eAAS,KAAK,CAAA;AAClD,EAAA,MAAM,CAAC,MAAA,EAAQ,SAAS,CAAA,GAAU,eAAS,KAAK,CAAA;AAChD,EAAA,MAAM,YAAA,GAAqB,aAAuB,IAAI,CAAA;AAEtD,EAAM,gBAAU,MAAM;AAClB,IAAA,UAAA,CAAW,IAAI,CAAA;AAAA,EACnB,CAAA,EAAG,EAAE,CAAA;AAGL,EAAM,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A,EAAA,EAAI,SAAA,EAAW,CAAA,SAAA,EAAY,UAAU,MAAA,GAAS,QAAA,GAAW,SAAS,CAAA,qLAAA,CAAA,EAC/D,8BAAC,KAAA,EAAA,EAAI,SAAA,EAAU,OACV,QAAA,EAAA,MAAA,CAAO,GAAA,CAAI,CAAC,SAAA,qBACT,IAAA;AAAA,MAAC,QAAA;AAAA,MAAA;AAAA,QAEG,SAAS,MAAM;AACX,UAAA,QAAA,CAAS,UAAU,KAAK,CAAA;AACxB,UAAA,SAAA,CAAU,KAAK,CAAA;AAAA,QACnB,CAAA;AAAA,QACA,WAAW,CAAA,+BAAA,EACP,KAAA,KAAU,SAAA,CAAU,KAAA,GAAQ,WAAW,EAC3C,CAAA,CAAA;AAAA,QAEC,QAAA,EAAA;AAAA,UAAA,SAAA,CAAU,IAAA;AAAA,0BACX,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,QAAA,EAAU,oBAAU,KAAA,EAAM;AAAA;AAAA,OAAA;AAAA,MAVrC,SAAA,CAAU;AAAA,KAYtB,GACL,CAAA,EACJ;AAAA,GAAA,EAER,CAAA;AAER","file":"chunk-GHO4RCDR.js","sourcesContent":["import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\n/**\n * Merge class names with Tailwind-aware conflict resolution.\n * `cn(\"px-4\", \"px-8\")` → `\"px-8\"`.\n */\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { Moon, Sun, Monitor, Droplet } from \"lucide-react\"\nimport { useTheme } from \"next-themes\"\nimport { useYunUI } from \"../adapters/context\"\n\ninterface ThemeToggleProps {\n /** Visual variant: `icon` (default, icon-only) or `pill`. */\n variant?: \"icon\" | \"pill\";\n /** Dropdown alignment: `left` or `right` (default). */\n align?: \"left\" | \"right\";\n /** Additional className */\n className?: string;\n}\n\n/** Theme switcher dropdown (light / dark / true-black / system) backed by next-themes. */\nexport function ThemeToggle({ variant = \"icon\", align = \"right\", className = \"\" }: ThemeToggleProps) {\n const { theme, setTheme } = useTheme()\n const t = useYunUI().useT(\"common.theme\")\n const [mounted, setMounted] = React.useState(false)\n const [isOpen, setIsOpen] = React.useState(false)\n const containerRef = React.useRef<HTMLDivElement>(null)\n\n React.useEffect(() => {\n setMounted(true)\n }, [])\n\n // Close on outside click\n React.useEffect(() => {\n const handleClickOutside = (e: MouseEvent) => {\n if (containerRef.current && !containerRef.current.contains(e.target as Node)) {\n setIsOpen(false)\n }\n }\n document.addEventListener(\"mousedown\", handleClickOutside)\n return () => document.removeEventListener(\"mousedown\", handleClickOutside)\n }, [])\n\n const themes = [\n { value: \"light\", label: t(\"light\"), icon: <Sun size={14} /> },\n { value: \"dark\", label: t(\"zincDark\"), icon: <Moon size={14} /> },\n { value: \"true-black\", label: t(\"trueBlack\"), icon: <Droplet size={14} fill=\"currentColor\" /> },\n { value: \"system\", label: t(\"system\"), icon: <Monitor size={14} /> },\n ]\n\n if (!mounted) {\n return (\n <div className={className}>\n {variant === \"pill\" ? (\n <div className=\"h-8 w-16 rounded-full bg-(--bg-elevated) border border-(--border-hairline)\" />\n ) : (\n <div className=\"w-9 h-9 rounded-lg\" />\n )}\n </div>\n )\n }\n\n return (\n <div ref={containerRef} className={`relative ${className}`}>\n {/* Trigger */}\n {variant === \"pill\" ? (\n <button\n onClick={() => setIsOpen(!isOpen)}\n className=\"flex items-center gap-1.5 h-9 px-3 rounded-full text-sm font-medium transition-all bg-(--bg-elevated) hover:bg-(--bg-elevated)/80 border border-(--border-hairline) text-(--text-secondary) hover:text-(--text-primary) outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\"\n aria-label={t(\"toggle\")}\n >\n <Sun size={14} className=\"rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0\" />\n <Moon size={14} className=\"absolute rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100\" />\n </button>\n ) : (\n <button\n onClick={() => setIsOpen(!isOpen)}\n className=\"w-9 h-9 rounded-lg flex items-center justify-center hover:bg-foreground/5 transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\"\n aria-label={t(\"toggle\")}\n >\n <Sun className=\"h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0 absolute\" />\n <Moon className=\"h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100\" />\n <span className=\"sr-only\">{t(\"toggle\")}</span>\n </button>\n )}\n\n {/* Dropdown */}\n {isOpen && (\n <div className={`absolute ${align === \"left\" ? \"left-0\" : \"right-0\"} top-full mt-2 z-50 rounded-2xl border border-border bg-background/60 backdrop-blur-2xl text-popover-foreground shadow-lg shadow-black/5 animate-in fade-in-0 zoom-in-95 duration-200`}>\n <div className=\"p-1\">\n {themes.map((themeItem) => (\n <button\n key={themeItem.value}\n onClick={() => {\n setTheme(themeItem.value)\n setIsOpen(false)\n }}\n className={`dropdown-item w-full text-left ${\n theme === themeItem.value ? \"active\" : \"\"\n }`}\n >\n {themeItem.icon}\n <span className=\"flex-1\">{themeItem.label}</span>\n </button>\n ))}\n </div>\n </div>\n )}\n </div>\n )\n}\n"]}