@windrun-huaiin/base-ui 6.0.3 → 7.1.0

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,3 +1,4 @@
1
+ /* eslint-disable */
1
2
  "use client";
2
3
  var __defProp = Object.defineProperty;
3
4
  var __defProps = Object.defineProperties;
@@ -1563,115 +1564,9 @@ function NotFoundPage({ siteIcon }) {
1563
1564
  ] });
1564
1565
  }
1565
1566
 
1566
- // src/components/language-detector.tsx
1567
- import { useLocale, useTranslations } from "next-intl";
1568
- import { useRouter } from "next/navigation";
1569
- import { useEffect as useEffect2, useState as useState2 } from "react";
1570
- import { jsx as jsx34, jsxs as jsxs11 } from "react/jsx-runtime";
1571
- function LanguageDetector({ i18nConfig }) {
1572
- const [show, setShow] = useState2(false);
1573
- const [detectedLocale, setDetectedLocale] = useState2(null);
1574
- const currentLocale = useLocale();
1575
- const router = useRouter();
1576
- const t = useTranslations("languageDetection");
1577
- const LANGUAGE_PREFERENCE_KEY = `${i18nConfig.detector.storagePrefix}-${i18nConfig.detector.storageKey}`;
1578
- useEffect2(() => {
1579
- const browserLang = navigator.language.split("-")[0];
1580
- const savedPreference = localStorage.getItem(LANGUAGE_PREFERENCE_KEY);
1581
- const preference = savedPreference ? JSON.parse(savedPreference) : null;
1582
- const shouldShowDetector = () => {
1583
- if (!preference) return true;
1584
- if (preference.locale === currentLocale) return false;
1585
- if (preference.status === "rejected" && preference.locale === browserLang) return false;
1586
- if (preference.status === "accepted" && preference.locale === currentLocale) return false;
1587
- const expirationMs = i18nConfig.detector.expirationDays * 24 * 60 * 60 * 1e3;
1588
- if (Date.now() - preference.timestamp < expirationMs) return false;
1589
- return true;
1590
- };
1591
- if (i18nConfig.locales.includes(browserLang) && browserLang !== currentLocale && shouldShowDetector()) {
1592
- setDetectedLocale(browserLang);
1593
- setShow(true);
1594
- const timer = setTimeout(() => {
1595
- console.log("[LanguageDetector] Auto closing after timeout");
1596
- setShow(false);
1597
- savePreference(browserLang, "rejected");
1598
- }, i18nConfig.detector.autoCloseTimeout);
1599
- return () => clearTimeout(timer);
1600
- }
1601
- }, [currentLocale]);
1602
- const savePreference = (locale, status) => {
1603
- const preference = {
1604
- locale,
1605
- status,
1606
- timestamp: Date.now()
1607
- };
1608
- localStorage.setItem(LANGUAGE_PREFERENCE_KEY, JSON.stringify(preference));
1609
- };
1610
- const handleLanguageChange = () => {
1611
- if (detectedLocale) {
1612
- savePreference(detectedLocale, "accepted");
1613
- const pathname = window.location.pathname;
1614
- const newPathname = pathname.replace(`/${currentLocale}`, `/${detectedLocale}`);
1615
- router.push(newPathname);
1616
- setShow(false);
1617
- }
1618
- };
1619
- const handleClose = () => {
1620
- if (detectedLocale) {
1621
- savePreference(detectedLocale, "rejected");
1622
- }
1623
- setShow(false);
1624
- };
1625
- if (!detectedLocale || !show) return null;
1626
- return /* @__PURE__ */ jsx34("div", { className: "fixed top-16 right-4 z-40 w-[420px]", children: /* @__PURE__ */ jsx34("div", { className: `shadow-lg rounded-lg transition-all duration-300 ${show ? "translate-x-0 opacity-100" : "translate-x-full opacity-0"}
1627
- bg-linear-to-r from-purple-100/95 via-white/95 to-purple-100/95 backdrop-blur-xs
1628
- animate-gradient-x`, children: /* @__PURE__ */ jsxs11("div", { className: "relative px-6 py-4 overflow-hidden", children: [
1629
- /* @__PURE__ */ jsxs11("div", { className: "relative z-10 flex flex-col gap-3", children: [
1630
- /* @__PURE__ */ jsxs11("div", { className: "flex items-start justify-between gap-4", children: [
1631
- /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-1.5", children: [
1632
- /* @__PURE__ */ jsx34("h3", { className: "text-lg font-semibold text-gray-900", children: t("title") }),
1633
- /* @__PURE__ */ jsxs11("p", { className: "text-base text-gray-600", children: [
1634
- t("description"),
1635
- " ",
1636
- /* @__PURE__ */ jsx34("span", { className: "text-purple-500 font-semibold", children: detectedLocale === "zh" ? "\u4E2D\u6587" : "English" }),
1637
- "?"
1638
- ] })
1639
- ] }),
1640
- /* @__PURE__ */ jsx34(
1641
- "button",
1642
- {
1643
- onClick: handleClose,
1644
- className: "text-gray-500 hover:text-gray-700",
1645
- children: /* @__PURE__ */ jsx34(globalLucideIcons.X, { className: "h-5 w-5" })
1646
- }
1647
- )
1648
- ] }),
1649
- /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-3", children: [
1650
- /* @__PURE__ */ jsx34(
1651
- "button",
1652
- {
1653
- onClick: handleClose,
1654
- className: "flex-1 px-4 py-2 text-base bg-gray-100 text-gray-600 rounded-md hover:bg-gray-200",
1655
- children: t("close")
1656
- }
1657
- ),
1658
- /* @__PURE__ */ jsx34(
1659
- "button",
1660
- {
1661
- onClick: handleLanguageChange,
1662
- className: "flex-1 px-4 py-2 text-base bg-purple-500 text-white rounded-md hover:bg-purple-600",
1663
- children: t("changeAction")
1664
- }
1665
- )
1666
- ] })
1667
- ] }),
1668
- /* @__PURE__ */ jsx34("div", { className: "absolute inset-0 bg-linear-to-r from-transparent via-purple-200/30 to-transparent animate-shimmer" })
1669
- ] }) }) });
1670
- }
1671
-
1672
1567
  // src/components/language-switcher.tsx
1673
- import { usePathname, useRouter as useRouter2 } from "next/navigation";
1674
- import { useLocale as useLocale2 } from "next-intl";
1568
+ import { usePathname, useRouter } from "next/navigation";
1569
+ import { useLocale } from "next-intl";
1675
1570
 
1676
1571
  // src/ui/dropdown-menu.tsx
1677
1572
  import * as React33 from "react";
@@ -1685,12 +1580,12 @@ function cn(...inputs) {
1685
1580
  }
1686
1581
 
1687
1582
  // src/ui/dropdown-menu.tsx
1688
- import { jsx as jsx35, jsxs as jsxs12 } from "react/jsx-runtime";
1583
+ import { jsx as jsx34, jsxs as jsxs11 } from "react/jsx-runtime";
1689
1584
  var DropdownMenu = DropdownMenuPrimitive.Root;
1690
1585
  var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
1691
1586
  var DropdownMenuSubTrigger = React33.forwardRef((_a, ref) => {
1692
1587
  var _b = _a, { className, inset, children } = _b, props = __objRest(_b, ["className", "inset", "children"]);
1693
- return /* @__PURE__ */ jsxs12(
1588
+ return /* @__PURE__ */ jsxs11(
1694
1589
  DropdownMenuPrimitive.SubTrigger,
1695
1590
  __spreadProps(__spreadValues({
1696
1591
  ref,
@@ -1702,7 +1597,7 @@ var DropdownMenuSubTrigger = React33.forwardRef((_a, ref) => {
1702
1597
  }, props), {
1703
1598
  children: [
1704
1599
  children,
1705
- /* @__PURE__ */ jsx35(globalLucideIcons.ChevronRight, { className: "ml-auto" })
1600
+ /* @__PURE__ */ jsx34(globalLucideIcons.ChevronRight, { className: "ml-auto" })
1706
1601
  ]
1707
1602
  })
1708
1603
  );
@@ -1710,7 +1605,7 @@ var DropdownMenuSubTrigger = React33.forwardRef((_a, ref) => {
1710
1605
  DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
1711
1606
  var DropdownMenuSubContent = React33.forwardRef((_a, ref) => {
1712
1607
  var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
1713
- return /* @__PURE__ */ jsx35(
1608
+ return /* @__PURE__ */ jsx34(
1714
1609
  DropdownMenuPrimitive.SubContent,
1715
1610
  __spreadValues({
1716
1611
  ref,
@@ -1724,7 +1619,7 @@ var DropdownMenuSubContent = React33.forwardRef((_a, ref) => {
1724
1619
  DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
1725
1620
  var DropdownMenuContent = React33.forwardRef((_a, ref) => {
1726
1621
  var _b = _a, { className, sideOffset = 4 } = _b, props = __objRest(_b, ["className", "sideOffset"]);
1727
- return /* @__PURE__ */ jsx35(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx35(
1622
+ return /* @__PURE__ */ jsx34(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx34(
1728
1623
  DropdownMenuPrimitive.Content,
1729
1624
  __spreadValues({
1730
1625
  ref,
@@ -1739,7 +1634,7 @@ var DropdownMenuContent = React33.forwardRef((_a, ref) => {
1739
1634
  DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
1740
1635
  var DropdownMenuItem = React33.forwardRef((_a, ref) => {
1741
1636
  var _b = _a, { className, inset } = _b, props = __objRest(_b, ["className", "inset"]);
1742
- return /* @__PURE__ */ jsx35(
1637
+ return /* @__PURE__ */ jsx34(
1743
1638
  DropdownMenuPrimitive.Item,
1744
1639
  __spreadValues({
1745
1640
  ref,
@@ -1754,7 +1649,7 @@ var DropdownMenuItem = React33.forwardRef((_a, ref) => {
1754
1649
  DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
1755
1650
  var DropdownMenuCheckboxItem = React33.forwardRef((_a, ref) => {
1756
1651
  var _b = _a, { className, children, checked } = _b, props = __objRest(_b, ["className", "children", "checked"]);
1757
- return /* @__PURE__ */ jsxs12(
1652
+ return /* @__PURE__ */ jsxs11(
1758
1653
  DropdownMenuPrimitive.CheckboxItem,
1759
1654
  __spreadProps(__spreadValues({
1760
1655
  ref,
@@ -1765,7 +1660,7 @@ var DropdownMenuCheckboxItem = React33.forwardRef((_a, ref) => {
1765
1660
  checked
1766
1661
  }, props), {
1767
1662
  children: [
1768
- /* @__PURE__ */ jsx35("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx35(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx35(globalLucideIcons.Check, { className: "h-4 w-4" }) }) }),
1663
+ /* @__PURE__ */ jsx34("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx34(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx34(globalLucideIcons.Check, { className: "h-4 w-4" }) }) }),
1769
1664
  children
1770
1665
  ]
1771
1666
  })
@@ -1774,7 +1669,7 @@ var DropdownMenuCheckboxItem = React33.forwardRef((_a, ref) => {
1774
1669
  DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
1775
1670
  var DropdownMenuRadioItem = React33.forwardRef((_a, ref) => {
1776
1671
  var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
1777
- return /* @__PURE__ */ jsxs12(
1672
+ return /* @__PURE__ */ jsxs11(
1778
1673
  DropdownMenuPrimitive.RadioItem,
1779
1674
  __spreadProps(__spreadValues({
1780
1675
  ref,
@@ -1784,7 +1679,7 @@ var DropdownMenuRadioItem = React33.forwardRef((_a, ref) => {
1784
1679
  )
1785
1680
  }, props), {
1786
1681
  children: [
1787
- /* @__PURE__ */ jsx35("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx35(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx35(globalLucideIcons.Circle, { className: "h-2 w-2 fill-current" }) }) }),
1682
+ /* @__PURE__ */ jsx34("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx34(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx34(globalLucideIcons.Circle, { className: "h-2 w-2 fill-current" }) }) }),
1788
1683
  children
1789
1684
  ]
1790
1685
  })
@@ -1793,7 +1688,7 @@ var DropdownMenuRadioItem = React33.forwardRef((_a, ref) => {
1793
1688
  DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
1794
1689
  var DropdownMenuLabel = React33.forwardRef((_a, ref) => {
1795
1690
  var _b = _a, { className, inset } = _b, props = __objRest(_b, ["className", "inset"]);
1796
- return /* @__PURE__ */ jsx35(
1691
+ return /* @__PURE__ */ jsx34(
1797
1692
  DropdownMenuPrimitive.Label,
1798
1693
  __spreadValues({
1799
1694
  ref,
@@ -1808,7 +1703,7 @@ var DropdownMenuLabel = React33.forwardRef((_a, ref) => {
1808
1703
  DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
1809
1704
  var DropdownMenuSeparator = React33.forwardRef((_a, ref) => {
1810
1705
  var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
1811
- return /* @__PURE__ */ jsx35(
1706
+ return /* @__PURE__ */ jsx34(
1812
1707
  DropdownMenuPrimitive.Separator,
1813
1708
  __spreadValues({
1814
1709
  ref,
@@ -1823,7 +1718,7 @@ var DropdownMenuShortcut = (_a) => {
1823
1718
  } = _b, props = __objRest(_b, [
1824
1719
  "className"
1825
1720
  ]);
1826
- return /* @__PURE__ */ jsx35(
1721
+ return /* @__PURE__ */ jsx34(
1827
1722
  "span",
1828
1723
  __spreadValues({
1829
1724
  className: cn("ml-auto text-xs tracking-widest opacity-60", className)
@@ -1834,11 +1729,11 @@ DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
1834
1729
 
1835
1730
  // src/ui/language-button.tsx
1836
1731
  import * as React34 from "react";
1837
- import { jsx as jsx36 } from "react/jsx-runtime";
1732
+ import { jsx as jsx35 } from "react/jsx-runtime";
1838
1733
  var LanguageButton = React34.forwardRef(
1839
1734
  (_a, ref) => {
1840
1735
  var _b = _a, { className, variant = "default", size = "default" } = _b, props = __objRest(_b, ["className", "variant", "size"]);
1841
- return /* @__PURE__ */ jsx36(
1736
+ return /* @__PURE__ */ jsx35(
1842
1737
  "button",
1843
1738
  __spreadValues({
1844
1739
  className: cn(
@@ -1861,32 +1756,32 @@ var LanguageButton = React34.forwardRef(
1861
1756
  LanguageButton.displayName = "Button";
1862
1757
 
1863
1758
  // src/components/language-switcher.tsx
1864
- import { jsx as jsx37, jsxs as jsxs13 } from "react/jsx-runtime";
1759
+ import { jsx as jsx36, jsxs as jsxs12 } from "react/jsx-runtime";
1865
1760
  function LanguageSwitcher({ locales, localeLabels }) {
1866
- const locale = useLocale2();
1867
- const router = useRouter2();
1761
+ const locale = useLocale();
1762
+ const router = useRouter();
1868
1763
  const pathname = usePathname();
1869
1764
  const handleLocaleChange = (newLocale) => {
1870
1765
  const newPathname = pathname.replace(`/${locale}`, `/${newLocale}`);
1871
1766
  router.push(newPathname);
1872
1767
  };
1873
- return /* @__PURE__ */ jsxs13(DropdownMenu, { children: [
1874
- /* @__PURE__ */ jsx37(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx37(
1768
+ return /* @__PURE__ */ jsxs12(DropdownMenu, { children: [
1769
+ /* @__PURE__ */ jsx36(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx36(
1875
1770
  LanguageButton,
1876
1771
  {
1877
1772
  variant: "ghost",
1878
1773
  size: "icon",
1879
1774
  className: "bg-linear-to-r from-purple-400 to-pink-600 hover:from-purple-500 hover:to-pink-700 text-white transform hover:scale-110 transition-all duration-300",
1880
- children: /* @__PURE__ */ jsx37(globalLucideIcons.Globe, { className: "h-5 w-5" })
1775
+ children: /* @__PURE__ */ jsx36(globalLucideIcons.Globe, { className: "h-5 w-5" })
1881
1776
  }
1882
1777
  ) }),
1883
- /* @__PURE__ */ jsx37(
1778
+ /* @__PURE__ */ jsx36(
1884
1779
  DropdownMenuContent,
1885
1780
  {
1886
1781
  align: "end",
1887
1782
  sideOffset: 5,
1888
1783
  className: "bg-white/90 dark:bg-gray-800/90 border-purple-100 dark:border-purple-800 w-[200px] p-2 backdrop-blur-xs translate-x-[50px]",
1889
- children: /* @__PURE__ */ jsx37("div", { className: "grid grid-cols-2 gap-1", children: locales.map((loc) => /* @__PURE__ */ jsx37(
1784
+ children: /* @__PURE__ */ jsx36("div", { className: "grid grid-cols-2 gap-1", children: locales.map((loc) => /* @__PURE__ */ jsx36(
1890
1785
  DropdownMenuItem,
1891
1786
  {
1892
1787
  className: `
@@ -1905,75 +1800,9 @@ function LanguageSwitcher({ locales, localeLabels }) {
1905
1800
  )
1906
1801
  ] });
1907
1802
  }
1908
-
1909
- // src/components/script/google-analytics-script.tsx
1910
- import Script from "next/script";
1911
- import { Fragment, jsx as jsx38, jsxs as jsxs14 } from "react/jsx-runtime";
1912
- var googleAnalyticsId = process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS_ID;
1913
- function GoogleAnalyticsScript() {
1914
- if (process.env.NODE_ENV !== "production") {
1915
- return null;
1916
- }
1917
- return /* @__PURE__ */ jsxs14(Fragment, { children: [
1918
- /* @__PURE__ */ jsx38(
1919
- Script,
1920
- {
1921
- strategy: "afterInteractive",
1922
- src: `https://www.googletagmanager.com/gtag/js?id=${googleAnalyticsId}`
1923
- }
1924
- ),
1925
- /* @__PURE__ */ jsx38(
1926
- Script,
1927
- {
1928
- id: "google-analytics",
1929
- strategy: "afterInteractive",
1930
- dangerouslySetInnerHTML: {
1931
- __html: `
1932
- window.dataLayer = window.dataLayer || [];
1933
- function gtag(){dataLayer.push(arguments);}
1934
- gtag('js', new Date());
1935
- gtag('config', '${googleAnalyticsId}');
1936
- `
1937
- }
1938
- }
1939
- )
1940
- ] });
1941
- }
1942
- function useGoogleAnalytics() {
1943
- const trackEvent = (event, data) => {
1944
- if (typeof window === "undefined" || !window.gtag) {
1945
- return;
1946
- }
1947
- window.gtag("event", event, data);
1948
- };
1949
- return {
1950
- trackEvent
1951
- };
1952
- }
1953
-
1954
- // src/components/script/microsoft-clarity-script.tsx
1955
- import Script2 from "next/script";
1956
- import { jsx as jsx39 } from "react/jsx-runtime";
1957
- var microsoftClarityId = process.env.NEXT_PUBLIC_MICROSOFT_CLARITY_ID;
1958
- function MicrosoftClarityScript() {
1959
- if (process.env.NODE_ENV !== "production") {
1960
- return null;
1961
- }
1962
- return /* @__PURE__ */ jsx39(Script2, { id: "microsoft-clarity", strategy: "afterInteractive", children: `
1963
- (function(c,l,a,r,i,t,y){
1964
- c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
1965
- t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
1966
- y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
1967
- })(window, document, "clarity", "script", "${microsoftClarityId}");
1968
- ` });
1969
- }
1970
1803
  export {
1971
- GoogleAnalyticsScript,
1972
- LanguageDetector,
1973
1804
  LanguageSwitcher,
1974
- MicrosoftClarityScript,
1975
- NotFoundPage,
1976
- useGoogleAnalytics
1805
+ NotFoundPage
1977
1806
  };
1978
1807
  /**
1979
1808
  * @license