@windrun-huaiin/base-ui 3.2.4 → 3.3.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,4 +1,3 @@
1
- "use client";
2
1
  var __defProp = Object.defineProperty;
3
2
  var __defProps = Object.defineProperties;
4
3
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
@@ -1301,6 +1300,7 @@ var wrappedBuiltinIconsPart = tempWrappedBuiltinIcons;
1301
1300
  var globalLucideIcons = __spreadValues(__spreadValues({}, styledLimitedIconsPart), wrappedBuiltinIconsPart);
1302
1301
  var DEFAULT_FALLBACK_ICON = "BTC";
1303
1302
  function getGlobalIcon(iconKey, createElement) {
1303
+ var _a;
1304
1304
  if (!iconKey) {
1305
1305
  if (createElement) {
1306
1306
  return void 0;
@@ -1309,7 +1309,7 @@ function getGlobalIcon(iconKey, createElement) {
1309
1309
  }
1310
1310
  const Icon = globalLucideIcons[iconKey];
1311
1311
  if (!Icon) {
1312
- if (process.env.NODE_ENV !== "production") {
1312
+ if (typeof process !== "undefined" && ((_a = process.env) == null ? void 0 : _a.NODE_ENV) !== "production") {
1313
1313
  console.warn(
1314
1314
  `[global-icon] iconKey "${iconKey}" is not defined in globalIcons, will use default "${String(DEFAULT_FALLBACK_ICON)}" icon, please check!`
1315
1315
  );
@@ -1330,572 +1330,11 @@ function getIconElement(icon) {
1330
1330
  }
1331
1331
  var DefaultSiteIcon = () => /* @__PURE__ */ jsx29(globalLucideIcons.Zap, { className: `h-8 w-8 rounded-full p-1 shadow-lg ring-0.5 border border-purple-500 ring-purple-500/20 ${themeIconColor}` });
1332
1332
  var NotFoundIcon = () => /* @__PURE__ */ jsx29(globalLucideIcons.SquareTerminal, { className: `h-8 w-8 rounded-full p-1 shadow-lg ring-0.5 border border-purple-500 ring-purple-500/20 ${themeIconColor}` });
1333
-
1334
- // ../lib/src/utils.ts
1335
- import { clsx } from "clsx";
1336
- import { twMerge } from "tailwind-merge";
1337
- function cn(...inputs) {
1338
- return twMerge(clsx(inputs));
1339
- }
1340
-
1341
- // src/lib/icon-context.tsx
1342
- import { createContext, useContext } from "react";
1343
- import { jsx as jsx30 } from "react/jsx-runtime";
1344
- var IconConfigContext = createContext(null);
1345
- function useIconConfig() {
1346
- const config = useContext(IconConfigContext);
1347
- if (config === null) {
1348
- throw new Error(
1349
- '[SiteIcon] IconConfigProvider not found. Please wrap your app with <IconConfigProvider config={{ siteIcon: "YourIcon" }}>.'
1350
- );
1351
- }
1352
- return config;
1353
- }
1354
- function useIconConfigSafe(iconKey) {
1355
- try {
1356
- const config = useIconConfig();
1357
- return config[iconKey];
1358
- } catch (e) {
1359
- return void 0;
1360
- }
1361
- }
1362
-
1363
- // src/lib/site-icon.tsx
1364
- import { jsx as jsx31 } from "react/jsx-runtime";
1365
- function SiteIcon(_a) {
1366
- var _b = _a, {
1367
- size = 24,
1368
- className
1369
- } = _b, props = __objRest(_b, [
1370
- "size",
1371
- "className"
1372
- ]);
1373
- const configuredIcon = useIconConfigSafe("siteIcon");
1374
- if (configuredIcon === void 0) {
1375
- throw new Error(
1376
- '[SiteIcon] Site icon is not configured. Please use <IconConfigProvider config={{ siteIcon: YourCustomIcon }}> or <IconConfigProvider config={{ siteIcon: "IconKeyName" }}> to set a custom site icon to avoid legal risks.'
1377
- );
1378
- }
1379
- if (typeof configuredIcon === "string") {
1380
- if (configuredIcon === "") {
1381
- const DefaultIcon = globalLucideIcons["Download"];
1382
- return /* @__PURE__ */ jsx31(DefaultIcon, __spreadValues({ size, className: cn(themeIconColor, className) }, props));
1383
- }
1384
- const IconComponent = globalLucideIcons[configuredIcon];
1385
- if (!IconComponent) {
1386
- throw new Error(`[SiteIcon] Icon key "${configuredIcon}" not found in globalLucideIcons.`);
1387
- }
1388
- return /* @__PURE__ */ jsx31(IconComponent, __spreadValues({ size, className: cn(themeIconColor, className) }, props));
1389
- } else {
1390
- const CustomIcon = configuredIcon;
1391
- const hasColorClass = className && /text-\w+/.test(className);
1392
- const finalClassName = hasColorClass ? className : cn(themeIconColor, className);
1393
- return /* @__PURE__ */ jsx31(CustomIcon, __spreadValues({ size, className: finalClassName }, props));
1394
- }
1395
- }
1396
-
1397
- // src/components/404-page.tsx
1398
- import { useEffect, useState } from "react";
1399
- import { jsx as jsx32, jsxs as jsxs7 } from "react/jsx-runtime";
1400
- function NotFoundPage() {
1401
- const [glitchText, setGlitchText] = useState("404");
1402
- useEffect(() => {
1403
- const glitchChars = ["4", "0", "4", "?", "#", "!", "*", "&", "%", "$"];
1404
- const interval = setInterval(() => {
1405
- if (Math.random() < 0.5) {
1406
- setGlitchText("404");
1407
- } else {
1408
- const randomChars = Array.from(
1409
- { length: 3 },
1410
- () => glitchChars[Math.floor(Math.random() * glitchChars.length)]
1411
- ).join("");
1412
- setGlitchText(randomChars);
1413
- }
1414
- }, 600);
1415
- return () => clearInterval(interval);
1416
- }, []);
1417
- return /* @__PURE__ */ jsxs7("div", { className: "flex flex-col items-center justify-center min-h-[75vh] w-full px-4 py-8", children: [
1418
- /* @__PURE__ */ jsxs7("div", { className: "text-center space-y-8 max-w-2xl", children: [
1419
- /* @__PURE__ */ jsxs7("div", { className: "relative flex justify-center", children: [
1420
- /* @__PURE__ */ jsx32(
1421
- "h1",
1422
- {
1423
- className: "text-8xl md:text-9xl font-bold bg-gradient-to-r from-purple-600 via-pink-500 to-purple-700 bg-clip-text text-transparent select-none",
1424
- style: {
1425
- fontFamily: "Montserrat, monospace",
1426
- textShadow: "0 0 30px rgba(172, 98, 253, 0.3)",
1427
- letterSpacing: "0.1em"
1428
- },
1429
- children: glitchText
1430
- }
1431
- ),
1432
- /* @__PURE__ */ jsx32("div", { className: "absolute inset-0 pointer-events-none", children: /* @__PURE__ */ jsx32("div", { className: "h-full w-full bg-gradient-to-b from-transparent via-purple-500/10 to-transparent animate-pulse" }) })
1433
- ] }),
1434
- /* @__PURE__ */ jsxs7("div", { className: "space-y-4", children: [
1435
- /* @__PURE__ */ jsx32("h2", { className: "text-2xl md:text-3xl font-semibold text-foreground", children: "Page Not Found" }),
1436
- /* @__PURE__ */ jsx32("p", { className: "text-lg text-muted-foreground max-w-md mx-auto leading-relaxed", children: "The page you're looking for doesn't exist" })
1437
- ] }),
1438
- /* @__PURE__ */ jsxs7("div", { className: "flex justify-center items-center gap-8 pt-8 opacity-60", children: [
1439
- /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
1440
- /* @__PURE__ */ jsx32(SiteIcon, {}),
1441
- /* @__PURE__ */ jsx32("span", { children: "Woops!" })
1442
- ] }),
1443
- /* @__PURE__ */ jsx32("div", { className: "w-1 h-1 bg-purple-500 rounded-full animate-ping" }),
1444
- /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
1445
- /* @__PURE__ */ jsx32(NotFoundIcon, {}),
1446
- /* @__PURE__ */ jsx32("span", { children: "Error Code: 404" })
1447
- ] })
1448
- ] })
1449
- ] }),
1450
- /* @__PURE__ */ jsxs7("div", { className: "fixed inset-0 pointer-events-none overflow-hidden -z-10", children: [
1451
- /* @__PURE__ */ jsx32(
1452
- "div",
1453
- {
1454
- className: "absolute inset-0 opacity-[0.02] dark:opacity-[0.05]",
1455
- style: {
1456
- backgroundImage: `
1457
- linear-gradient(rgba(172, 98, 253, 0.1) 1px, transparent 1px),
1458
- linear-gradient(90deg, rgba(172, 98, 253, 0.1) 1px, transparent 1px)
1459
- `,
1460
- backgroundSize: "50px 50px"
1461
- }
1462
- }
1463
- ),
1464
- Array.from({ length: 6 }).map((_, i) => /* @__PURE__ */ jsx32(
1465
- "div",
1466
- {
1467
- className: "absolute w-2 h-2 bg-purple-500/20 rounded-full animate-bounce",
1468
- style: {
1469
- left: `${20 + i * 15}%`,
1470
- top: `${30 + i % 3 * 20}%`,
1471
- animationDelay: `${i * 0.5}s`,
1472
- animationDuration: `${2 + i * 0.3}s`
1473
- }
1474
- },
1475
- i
1476
- ))
1477
- ] })
1478
- ] });
1479
- }
1480
-
1481
- // src/components/go-to-top.tsx
1482
- import { useState as useState2, useEffect as useEffect2 } from "react";
1483
- import { Fragment, jsx as jsx33 } from "react/jsx-runtime";
1484
-
1485
- // src/components/language-detector.tsx
1486
- import { useLocale, useTranslations } from "next-intl";
1487
- import { useRouter } from "next/navigation";
1488
- import { useEffect as useEffect3, useState as useState3 } from "react";
1489
- import { jsx as jsx34, jsxs as jsxs8 } from "react/jsx-runtime";
1490
- function LanguageDetector({ i18nConfig }) {
1491
- const [show, setShow] = useState3(false);
1492
- const [detectedLocale, setDetectedLocale] = useState3(null);
1493
- const currentLocale = useLocale();
1494
- const router = useRouter();
1495
- const t = useTranslations("languageDetection");
1496
- const LANGUAGE_PREFERENCE_KEY = `${i18nConfig.detector.storagePrefix}-${i18nConfig.detector.storageKey}`;
1497
- useEffect3(() => {
1498
- const browserLang = navigator.language.split("-")[0];
1499
- const savedPreference = localStorage.getItem(LANGUAGE_PREFERENCE_KEY);
1500
- const preference = savedPreference ? JSON.parse(savedPreference) : null;
1501
- const shouldShowDetector = () => {
1502
- if (!preference) return true;
1503
- if (preference.locale === currentLocale) return false;
1504
- if (preference.status === "rejected" && preference.locale === browserLang) return false;
1505
- if (preference.status === "accepted" && preference.locale === currentLocale) return false;
1506
- const expirationMs = i18nConfig.detector.expirationDays * 24 * 60 * 60 * 1e3;
1507
- if (Date.now() - preference.timestamp < expirationMs) return false;
1508
- return true;
1509
- };
1510
- if (i18nConfig.locales.includes(browserLang) && browserLang !== currentLocale && shouldShowDetector()) {
1511
- setDetectedLocale(browserLang);
1512
- setShow(true);
1513
- const timer = setTimeout(() => {
1514
- console.log("[LanguageDetector] Auto closing after timeout");
1515
- setShow(false);
1516
- savePreference(browserLang, "rejected");
1517
- }, i18nConfig.detector.autoCloseTimeout);
1518
- return () => clearTimeout(timer);
1519
- }
1520
- }, [currentLocale]);
1521
- const savePreference = (locale, status) => {
1522
- const preference = {
1523
- locale,
1524
- status,
1525
- timestamp: Date.now()
1526
- };
1527
- localStorage.setItem(LANGUAGE_PREFERENCE_KEY, JSON.stringify(preference));
1528
- };
1529
- const handleLanguageChange = () => {
1530
- if (detectedLocale) {
1531
- savePreference(detectedLocale, "accepted");
1532
- const pathname = window.location.pathname;
1533
- const newPathname = pathname.replace(`/${currentLocale}`, `/${detectedLocale}`);
1534
- router.push(newPathname);
1535
- setShow(false);
1536
- }
1537
- };
1538
- const handleClose = () => {
1539
- if (detectedLocale) {
1540
- savePreference(detectedLocale, "rejected");
1541
- }
1542
- setShow(false);
1543
- };
1544
- if (!detectedLocale || !show) return null;
1545
- 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"}
1546
- bg-linear-to-r from-purple-100/95 via-white/95 to-purple-100/95 backdrop-blur-xs
1547
- animate-gradient-x`, children: /* @__PURE__ */ jsxs8("div", { className: "relative px-6 py-4 overflow-hidden", children: [
1548
- /* @__PURE__ */ jsxs8("div", { className: "relative z-10 flex flex-col gap-3", children: [
1549
- /* @__PURE__ */ jsxs8("div", { className: "flex items-start justify-between gap-4", children: [
1550
- /* @__PURE__ */ jsxs8("div", { className: "flex flex-col gap-1.5", children: [
1551
- /* @__PURE__ */ jsx34("h3", { className: "text-lg font-semibold text-gray-900", children: t("title") }),
1552
- /* @__PURE__ */ jsxs8("p", { className: "text-base text-gray-600", children: [
1553
- t("description"),
1554
- " ",
1555
- /* @__PURE__ */ jsx34("span", { className: "text-purple-500 font-semibold", children: detectedLocale === "zh" ? "\u4E2D\u6587" : "English" }),
1556
- "?"
1557
- ] })
1558
- ] }),
1559
- /* @__PURE__ */ jsx34(
1560
- "button",
1561
- {
1562
- onClick: handleClose,
1563
- className: "text-gray-500 hover:text-gray-700",
1564
- children: /* @__PURE__ */ jsx34(globalLucideIcons.X, { className: "h-5 w-5" })
1565
- }
1566
- )
1567
- ] }),
1568
- /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-3", children: [
1569
- /* @__PURE__ */ jsx34(
1570
- "button",
1571
- {
1572
- onClick: handleClose,
1573
- className: "flex-1 px-4 py-2 text-base bg-gray-100 text-gray-600 rounded-md hover:bg-gray-200",
1574
- children: t("close")
1575
- }
1576
- ),
1577
- /* @__PURE__ */ jsx34(
1578
- "button",
1579
- {
1580
- onClick: handleLanguageChange,
1581
- className: "flex-1 px-4 py-2 text-base bg-purple-500 text-white rounded-md hover:bg-purple-600",
1582
- children: t("changeAction")
1583
- }
1584
- )
1585
- ] })
1586
- ] }),
1587
- /* @__PURE__ */ jsx34("div", { className: "absolute inset-0 bg-linear-to-r from-transparent via-purple-200/30 to-transparent animate-shimmer" })
1588
- ] }) }) });
1589
- }
1590
-
1591
- // src/components/language-switcher.tsx
1592
- import { usePathname, useRouter as useRouter2 } from "next/navigation";
1593
- import { useLocale as useLocale2 } from "next-intl";
1594
-
1595
- // src/ui/dropdown-menu.tsx
1596
- import * as React30 from "react";
1597
- import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
1598
- import { jsx as jsx35, jsxs as jsxs9 } from "react/jsx-runtime";
1599
- var DropdownMenu = DropdownMenuPrimitive.Root;
1600
- var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
1601
- var DropdownMenuSubTrigger = React30.forwardRef((_a, ref) => {
1602
- var _b = _a, { className, inset, children } = _b, props = __objRest(_b, ["className", "inset", "children"]);
1603
- return /* @__PURE__ */ jsxs9(
1604
- DropdownMenuPrimitive.SubTrigger,
1605
- __spreadProps(__spreadValues({
1606
- ref,
1607
- className: cn(
1608
- "flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-hidden focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
1609
- inset && "pl-8",
1610
- className
1611
- )
1612
- }, props), {
1613
- children: [
1614
- children,
1615
- /* @__PURE__ */ jsx35(globalLucideIcons.ChevronRight, { className: "ml-auto" })
1616
- ]
1617
- })
1618
- );
1619
- });
1620
- DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
1621
- var DropdownMenuSubContent = React30.forwardRef((_a, ref) => {
1622
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
1623
- return /* @__PURE__ */ jsx35(
1624
- DropdownMenuPrimitive.SubContent,
1625
- __spreadValues({
1626
- ref,
1627
- className: cn(
1628
- "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
1629
- className
1630
- )
1631
- }, props)
1632
- );
1633
- });
1634
- DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
1635
- var DropdownMenuContent = React30.forwardRef((_a, ref) => {
1636
- var _b = _a, { className, sideOffset = 4 } = _b, props = __objRest(_b, ["className", "sideOffset"]);
1637
- return /* @__PURE__ */ jsx35(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx35(
1638
- DropdownMenuPrimitive.Content,
1639
- __spreadValues({
1640
- ref,
1641
- sideOffset,
1642
- className: cn(
1643
- "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
1644
- className
1645
- )
1646
- }, props)
1647
- ) });
1648
- });
1649
- DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
1650
- var DropdownMenuItem = React30.forwardRef((_a, ref) => {
1651
- var _b = _a, { className, inset } = _b, props = __objRest(_b, ["className", "inset"]);
1652
- return /* @__PURE__ */ jsx35(
1653
- DropdownMenuPrimitive.Item,
1654
- __spreadValues({
1655
- ref,
1656
- className: cn(
1657
- "relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden transition-colors focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
1658
- inset && "pl-8",
1659
- className
1660
- )
1661
- }, props)
1662
- );
1663
- });
1664
- DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
1665
- var DropdownMenuCheckboxItem = React30.forwardRef((_a, ref) => {
1666
- var _b = _a, { className, children, checked } = _b, props = __objRest(_b, ["className", "children", "checked"]);
1667
- return /* @__PURE__ */ jsxs9(
1668
- DropdownMenuPrimitive.CheckboxItem,
1669
- __spreadProps(__spreadValues({
1670
- ref,
1671
- className: cn(
1672
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-hidden transition-colors focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50",
1673
- className
1674
- ),
1675
- checked
1676
- }, props), {
1677
- children: [
1678
- /* @__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" }) }) }),
1679
- children
1680
- ]
1681
- })
1682
- );
1683
- });
1684
- DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
1685
- var DropdownMenuRadioItem = React30.forwardRef((_a, ref) => {
1686
- var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
1687
- return /* @__PURE__ */ jsxs9(
1688
- DropdownMenuPrimitive.RadioItem,
1689
- __spreadProps(__spreadValues({
1690
- ref,
1691
- className: cn(
1692
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-hidden transition-colors focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50",
1693
- className
1694
- )
1695
- }, props), {
1696
- children: [
1697
- /* @__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" }) }) }),
1698
- children
1699
- ]
1700
- })
1701
- );
1702
- });
1703
- DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
1704
- var DropdownMenuLabel = React30.forwardRef((_a, ref) => {
1705
- var _b = _a, { className, inset } = _b, props = __objRest(_b, ["className", "inset"]);
1706
- return /* @__PURE__ */ jsx35(
1707
- DropdownMenuPrimitive.Label,
1708
- __spreadValues({
1709
- ref,
1710
- className: cn(
1711
- "px-2 py-1.5 text-sm font-semibold",
1712
- inset && "pl-8",
1713
- className
1714
- )
1715
- }, props)
1716
- );
1717
- });
1718
- DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
1719
- var DropdownMenuSeparator = React30.forwardRef((_a, ref) => {
1720
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
1721
- return /* @__PURE__ */ jsx35(
1722
- DropdownMenuPrimitive.Separator,
1723
- __spreadValues({
1724
- ref,
1725
- className: cn("-mx-1 my-1 h-px bg-muted", className)
1726
- }, props)
1727
- );
1728
- });
1729
- DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
1730
- var DropdownMenuShortcut = (_a) => {
1731
- var _b = _a, {
1732
- className
1733
- } = _b, props = __objRest(_b, [
1734
- "className"
1735
- ]);
1736
- return /* @__PURE__ */ jsx35(
1737
- "span",
1738
- __spreadValues({
1739
- className: cn("ml-auto text-xs tracking-widest opacity-60", className)
1740
- }, props)
1741
- );
1742
- };
1743
- DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
1744
-
1745
- // src/ui/language-button.tsx
1746
- import * as React31 from "react";
1747
- import { jsx as jsx36 } from "react/jsx-runtime";
1748
- var LanguageButton = React31.forwardRef(
1749
- (_a, ref) => {
1750
- var _b = _a, { className, variant = "default", size = "default" } = _b, props = __objRest(_b, ["className", "variant", "size"]);
1751
- return /* @__PURE__ */ jsx36(
1752
- "button",
1753
- __spreadValues({
1754
- className: cn(
1755
- "inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none ring-offset-background",
1756
- {
1757
- "bg-primary text-primary-foreground hover:bg-primary/90": variant === "default",
1758
- "hover:bg-accent hover:text-accent-foreground": variant === "ghost",
1759
- "h-10 px-4 py-2": size === "default",
1760
- "h-9 px-3": size === "sm",
1761
- "h-11 px-8": size === "lg",
1762
- "h-10 w-10": size === "icon"
1763
- },
1764
- className
1765
- ),
1766
- ref
1767
- }, props)
1768
- );
1769
- }
1770
- );
1771
- LanguageButton.displayName = "Button";
1772
-
1773
- // src/components/language-switcher.tsx
1774
- import { jsx as jsx37, jsxs as jsxs10 } from "react/jsx-runtime";
1775
- function LanguageSwitcher({ locales, localeLabels }) {
1776
- const locale = useLocale2();
1777
- const router = useRouter2();
1778
- const pathname = usePathname();
1779
- const handleLocaleChange = (newLocale) => {
1780
- const newPathname = pathname.replace(`/${locale}`, `/${newLocale}`);
1781
- router.push(newPathname);
1782
- };
1783
- return /* @__PURE__ */ jsxs10(DropdownMenu, { children: [
1784
- /* @__PURE__ */ jsx37(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx37(
1785
- LanguageButton,
1786
- {
1787
- variant: "ghost",
1788
- size: "icon",
1789
- 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",
1790
- children: /* @__PURE__ */ jsx37(globalLucideIcons.Globe, { className: "h-5 w-5" })
1791
- }
1792
- ) }),
1793
- /* @__PURE__ */ jsx37(
1794
- DropdownMenuContent,
1795
- {
1796
- align: "end",
1797
- sideOffset: 5,
1798
- 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]",
1799
- children: /* @__PURE__ */ jsx37("div", { className: "grid grid-cols-2 gap-1", children: locales.map((loc) => /* @__PURE__ */ jsx37(
1800
- DropdownMenuItem,
1801
- {
1802
- className: `
1803
- px-2 py-2 text-sm cursor-pointer text-center justify-center
1804
- transition-all duration-300 ease-in-out
1805
- hover:scale-105 hover:shadow-md
1806
- rounded-md whitespace-nowrap
1807
- ${locale === loc ? "bg-linear-to-r from-purple-400 to-pink-600 text-white font-medium shadow-lg scale-105" : "hover:bg-linear-to-r hover:from-purple-400/10 hover:to-pink-600/10 hover:text-transparent hover:bg-clip-text"}
1808
- `,
1809
- onClick: () => handleLocaleChange(loc),
1810
- children: localeLabels[loc]
1811
- },
1812
- loc
1813
- )) })
1814
- }
1815
- )
1816
- ] });
1817
- }
1818
-
1819
- // src/components/script/google-analytics-script.tsx
1820
- import Script from "next/script";
1821
- import { Fragment as Fragment2, jsx as jsx38, jsxs as jsxs11 } from "react/jsx-runtime";
1822
- var googleAnalyticsId = process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS_ID;
1823
- function GoogleAnalyticsScript() {
1824
- if (process.env.NODE_ENV !== "production") {
1825
- return null;
1826
- }
1827
- return /* @__PURE__ */ jsxs11(Fragment2, { children: [
1828
- /* @__PURE__ */ jsx38(
1829
- Script,
1830
- {
1831
- strategy: "afterInteractive",
1832
- src: `https://www.googletagmanager.com/gtag/js?id=${googleAnalyticsId}`
1833
- }
1834
- ),
1835
- /* @__PURE__ */ jsx38(
1836
- Script,
1837
- {
1838
- id: "google-analytics",
1839
- strategy: "afterInteractive",
1840
- dangerouslySetInnerHTML: {
1841
- __html: `
1842
- window.dataLayer = window.dataLayer || [];
1843
- function gtag(){dataLayer.push(arguments);}
1844
- gtag('js', new Date());
1845
- gtag('config', '${googleAnalyticsId}');
1846
- `
1847
- }
1848
- }
1849
- )
1850
- ] });
1851
- }
1852
- function useGoogleAnalytics() {
1853
- const trackEvent = (event, data) => {
1854
- if (typeof window === "undefined" || !window.gtag) {
1855
- return;
1856
- }
1857
- window.gtag("event", event, data);
1858
- };
1859
- return {
1860
- trackEvent
1861
- };
1862
- }
1863
-
1864
- // src/components/script/microsoft-clarity-script.tsx
1865
- import Script2 from "next/script";
1866
- import { jsx as jsx39 } from "react/jsx-runtime";
1867
- var microsoftClarityId = process.env.NEXT_PUBLIC_MICROSOFT_CLARITY_ID;
1868
- function MicrosoftClarityScript() {
1869
- if (process.env.NODE_ENV !== "production") {
1870
- return null;
1871
- }
1872
- return /* @__PURE__ */ jsx39(Script2, { id: "microsoft-clarity", strategy: "afterInteractive", children: `
1873
- (function(c,l,a,r,i,t,y){
1874
- c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
1875
- t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
1876
- y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
1877
- })(window, document, "clarity", "script", "${microsoftClarityId}");
1878
- ` });
1879
- }
1880
1333
  export {
1881
1334
  DefaultSiteIcon,
1882
- GoogleAnalyticsScript,
1883
- LanguageDetector,
1884
- LanguageSwitcher,
1885
- MicrosoftClarityScript,
1886
1335
  NotFoundIcon,
1887
- NotFoundPage,
1888
1336
  getGlobalIcon,
1889
1337
  getIconElement,
1890
- globalLucideIcons,
1891
- useGoogleAnalytics
1338
+ globalLucideIcons
1892
1339
  };
1893
- /**
1894
- * @license
1895
- * MIT License
1896
- * Copyright (c) 2025 D8ger
1897
- *
1898
- * This source code is licensed under the MIT license found in the
1899
- * LICENSE file in the root directory of this source tree.
1900
- */
1901
1340
  //# sourceMappingURL=index.mjs.map