@anywayseo/tools 2.1.0 → 2.2.2

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 (29) hide show
  1. package/dist/components/base/pulse-button/index.d.ts +1 -0
  2. package/dist/components/base/pulse-button/utils.d.ts +4 -0
  3. package/dist/components/index.cjs +1 -1
  4. package/dist/components/index.mjs +1 -1
  5. package/dist/components/layout/footer/navigation/index.d.ts +2 -2
  6. package/dist/components/layout/header/navigation/desktop/nav-list/index.d.ts +5 -0
  7. package/dist/components/layout/header/navigation/mobile/nav-list/index.d.ts +8 -0
  8. package/dist/components/layout/header/navigation/nav-link/index.d.ts +4 -0
  9. package/dist/components/layout/header/navigation/types.d.ts +2 -2
  10. package/dist/{index-CHSIkTv7.mjs → index-BOs_12nr.mjs} +110 -86
  11. package/dist/{index-CnohyDGd.js → index-BkW3HmFj.js} +108 -84
  12. package/dist/index.cjs +1 -1
  13. package/dist/index.mjs +1 -1
  14. package/dist/types/components/bonus-card/index.d.ts +1 -1
  15. package/dist/types/components/game-card/index.d.ts +1 -1
  16. package/dist/types/components/index.d.ts +1 -0
  17. package/dist/types/components/navigation/index.d.ts +13 -0
  18. package/dist/types/index.d.ts +1 -2
  19. package/dist/types/site/index.d.ts +3 -3
  20. package/package.json +2 -1
  21. package/dist/components/layout/header/navigation/desktop/item/index.d.ts +0 -5
  22. package/dist/components/layout/header/navigation/mobile/item/index.d.ts +0 -5
  23. package/dist/types/navigation/index.d.ts +0 -9
  24. /package/dist/types/{models → content}/author/index.d.ts +0 -0
  25. /package/dist/types/{models → content}/bonus/index.d.ts +0 -0
  26. /package/dist/types/{models → content}/feature/index.d.ts +0 -0
  27. /package/dist/types/{models → content}/game/index.d.ts +0 -0
  28. /package/dist/types/{models → content}/index.d.ts +0 -0
  29. /package/dist/types/{models → content}/link/index.d.ts +0 -0
@@ -2,6 +2,7 @@ import { FC } from 'react';
2
2
  import { BoxPositionProps } from '../../../types';
3
3
  type PulseButtonProps = {
4
4
  label: string;
5
+ colorScheme?: 'dark' | 'light';
5
6
  onClick: VoidFunction;
6
7
  } & BoxPositionProps;
7
8
  declare const PulseButton: FC<PulseButtonProps>;
@@ -0,0 +1,4 @@
1
+ export declare const ColorMap: {
2
+ readonly light: "gray.200";
3
+ readonly dark: "gray.700";
4
+ };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("../index-CnohyDGd.js");
3
+ const index = require("../index-BkW3HmFj.js");
4
4
  exports.Author = index.Author;
5
5
  exports.BonusCard = index.BonusCard;
6
6
  exports.Center = index.Center;
@@ -1,4 +1,4 @@
1
- import { A, B, g, C, h, E, F, a, b, G, c, d, i, H, L, j, e, P, k, S, T, f } from "../index-CHSIkTv7.mjs";
1
+ import { A, B, g, C, h, E, F, a, b, G, c, d, i, H, L, j, e, P, k, S, T, f } from "../index-BOs_12nr.mjs";
2
2
  export {
3
3
  A as Author,
4
4
  B as BonusCard,
@@ -1,7 +1,7 @@
1
1
  import { FC } from 'react';
2
- import { INavigationItem } from '../../../../types';
2
+ import { INavItem } from '../../../../types';
3
3
  type NavigationProps = {
4
- menu: INavigationItem[];
4
+ menu: INavItem[];
5
5
  };
6
6
  declare const Navigation: FC<NavigationProps>;
7
7
  export default Navigation;
@@ -0,0 +1,5 @@
1
+ import { FC } from 'react';
2
+ import { INavItem } from '../../../../../../types';
3
+ type NavListProps = INavItem;
4
+ declare const NavList: FC<NavListProps>;
5
+ export default NavList;
@@ -0,0 +1,8 @@
1
+ import { FC } from 'react';
2
+ import { INavItem } from '../../../../../../types';
3
+ type NavListProps = INavItem & {
4
+ isExpanded: boolean;
5
+ onExpand: (id: INavItem['path']) => void;
6
+ };
7
+ declare const NavList: FC<NavListProps>;
8
+ export default NavList;
@@ -0,0 +1,4 @@
1
+ import { INavItem } from '../../../../../types';
2
+ type NavLinkProps = Omit<INavItem, 'children'>;
3
+ declare const NavLink: import('react').ForwardRefExoticComponent<NavLinkProps & import('react').RefAttributes<HTMLAnchorElement>>;
4
+ export default NavLink;
@@ -1,4 +1,4 @@
1
- import { INavigationItem } from '../../../../types';
1
+ import { INavItem } from '../../../../types';
2
2
  export type NavigationProps = {
3
- menu: INavigationItem[];
3
+ menu: INavItem[];
4
4
  };
@@ -1,12 +1,12 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import { Center as Center$1, Box, Collapse, Text, Button, Flex, Stack, Image, SimpleGrid, Link, Card, CardHeader, Heading, CardBody, Popover, PopoverTrigger, PopoverContent, PopoverBody, CardFooter, useToast, useColorModeValue, VStack, FormControl, FormLabel, InputGroup, InputLeftElement, Input, Textarea, Accordion, AccordionItem, AccordionButton, AccordionIcon, AccordionPanel, LinkBox, LinkOverlay, IconButton, AbsoluteCenter, Spinner, useDisclosure, Divider, Circle, Container as Container$1, Icon, useBreakpointValue, List as List$1, ListItem, ListIcon, TableContainer, Table as Table$1, Thead, Tr, Th, Tbody, Td, TableCaption, Tabs as Tabs$1, TabList, Tab, TabPanels, TabPanel } from "@chakra-ui/react";
2
+ import { Center as Center$1, Box, Collapse, Text, Button, Flex, Stack, Image, SimpleGrid, Link, Card, CardHeader, Heading, CardBody, Popover, PopoverTrigger, PopoverContent, PopoverBody, CardFooter, useToast, useColorModeValue, VStack, FormControl, FormLabel, InputGroup, InputLeftElement, Input, Textarea, Accordion, AccordionItem, AccordionButton, AccordionIcon, AccordionPanel, LinkBox, LinkOverlay, IconButton, AbsoluteCenter, Spinner, useDisclosure, Divider, Circle, Container as Container$1, List as List$1, ListItem, Icon, ListIcon, TableContainer, Table as Table$1, Thead, Tr, Th, Tbody, Td, TableCaption, Tabs as Tabs$1, TabList, Tab, TabPanels, TabPanel } from "@chakra-ui/react";
3
3
  import { useTranslation } from "react-i18next";
4
4
  import { A as Animation, b as formatNumber, c as getCurrencySymbol, f as formatDate, d as getDomain, g as getCurrentYear, a as getCurrentMonth } from "./index-j8Vo42fz.mjs";
5
5
  import { a as GameCharacteristic } from "./index-DxLcykuT.mjs";
6
6
  import "@ctrl/tinycolor";
7
7
  import "@mdx-js/react";
8
8
  import { u as useSiteContext } from "./index-BNb-P8a6.mjs";
9
- import { useRef, useState, useLayoutEffect, Fragment as Fragment$1, useEffect, useMemo } from "react";
9
+ import { useRef, useState, useLayoutEffect, Fragment as Fragment$1, forwardRef, useEffect, useMemo } from "react";
10
10
  import { EmailIcon, StarIcon, CloseIcon, ExternalLinkIcon, ChevronRightIcon, ChevronDownIcon, HamburgerIcon, ChevronUpIcon, WarningIcon, CheckCircleIcon } from "@chakra-ui/icons";
11
11
  import { u as usePrimaryColors } from "./index-xuSxvz5z.mjs";
12
12
  import { t } from "i18next";
@@ -85,12 +85,16 @@ const LinkButton = ({ label, url, width = "auto", ...boxProps }) => {
85
85
  }
86
86
  );
87
87
  };
88
- const PulseButton = ({ label, onClick }) => {
88
+ const ColorMap = {
89
+ light: "gray.200",
90
+ dark: "gray.700"
91
+ };
92
+ const PulseButton = ({ label, colorScheme = "light", onClick }) => {
89
93
  return /* @__PURE__ */ jsx(
90
94
  Button,
91
95
  {
92
96
  size: { base: "sm", md: "lg" },
93
- color: "gray.200",
97
+ color: ColorMap[colorScheme],
94
98
  bgColor: "brand.500",
95
99
  animation: `${Animation.pulse} 2s infinite linear`,
96
100
  _hover: { bgColor: "brand.200", color: "gray.700" },
@@ -544,18 +548,18 @@ const Navigation$1 = ({ menu }) => {
544
548
  spacing: 4,
545
549
  justifyItems: { base: "flex-start", md: "center" },
546
550
  justifyContent: "space-between",
547
- children: menu.map(({ url, title }) => /* @__PURE__ */ jsx(
551
+ children: menu.map(({ path, label }) => /* @__PURE__ */ jsx(
548
552
  Text,
549
553
  {
550
554
  as: Link$1,
551
- to: url,
555
+ to: path,
552
556
  fontSize: "md",
553
557
  fontWeight: "semibold",
554
558
  colorScheme: "gray",
555
559
  _hover: { textDecoration: "none", color: "brand.400" },
556
- children: title
560
+ children: label
557
561
  },
558
- url
562
+ path
559
563
  ))
560
564
  }
561
565
  );
@@ -583,114 +587,134 @@ const Footer = () => {
583
587
  const Brand = ({ brand }) => {
584
588
  return /* @__PURE__ */ jsx(Link$1, { to: "/", children: brand });
585
589
  };
586
- const DesktopNavItem = ({ title, url, children }) => {
590
+ const NavLink = forwardRef(({ path, label }, ref) => {
591
+ return /* @__PURE__ */ jsx(
592
+ Text,
593
+ {
594
+ ref,
595
+ as: Link$1,
596
+ to: path,
597
+ p: 2,
598
+ fontWeight: "semibold",
599
+ _hover: { textDecoration: "none", color: "brand.400" },
600
+ children: label
601
+ }
602
+ );
603
+ });
604
+ NavLink.displayName = "NavLink";
605
+ const NavList$1 = ({ path, label, children }) => {
587
606
  const background = useColorModeValue("white", "gray.800");
588
607
  const backgroundHover = useColorModeValue("brand.50", "gray.900");
589
608
  return /* @__PURE__ */ jsxs(Popover, { trigger: "hover", placement: "bottom-start", children: [
590
609
  /* @__PURE__ */ jsx(PopoverTrigger, { children: /* @__PURE__ */ jsx(
591
610
  Text,
592
611
  {
593
- as: Link$1,
594
- to: url,
595
612
  p: 2,
596
- fontSize: "sm",
597
- fontWeight: 500,
613
+ fontWeight: "semibold",
614
+ cursor: "pointer",
615
+ tabIndex: 0,
598
616
  _hover: { textDecoration: "none", color: "brand.400" },
599
- children: title
617
+ children: label
600
618
  }
601
619
  ) }),
602
- !!children && /* @__PURE__ */ jsx(PopoverContent, { p: 2, border: 0, minW: "sm", rounded: "xl", boxShadow: "xl", bg: background, children: /* @__PURE__ */ jsx(Stack, { as: "ul", p: 0, children: children.map((child) => /* @__PURE__ */ jsx(
603
- Box,
620
+ /* @__PURE__ */ jsx(PopoverContent, { p: 2, border: 0, minW: "sm", rounded: "xl", boxShadow: "xl", bg: background, children: /* @__PURE__ */ jsx(List$1, { spacing: 2, p: 0, children: children == null ? void 0 : children.map((child) => /* @__PURE__ */ jsx(ListItem, { rounded: "md", _hover: { bg: backgroundHover }, children: /* @__PURE__ */ jsxs(Flex, { as: Link$1, to: `${path}${child.path}`, p: 2, role: "group", children: [
621
+ /* @__PURE__ */ jsx(Text, { fontWeight: 500, transition: "all .3s ease", _groupHover: { color: "brand.400" }, children: child.label }),
622
+ /* @__PURE__ */ jsx(
623
+ Flex,
624
+ {
625
+ flex: 1,
626
+ justify: "flex-end",
627
+ align: "center",
628
+ opacity: 0,
629
+ transition: "all .3s ease",
630
+ transform: "translateX(-10px)",
631
+ _groupHover: { opacity: 1, transform: "translateX(0)" },
632
+ children: /* @__PURE__ */ jsx(Icon, { as: ChevronRightIcon, color: "brand.400", w: 5, h: 5 })
633
+ }
634
+ )
635
+ ] }) }, child.path)) }) })
636
+ ] });
637
+ };
638
+ const DesktopNavigation = ({ menu }) => {
639
+ return /* @__PURE__ */ jsx(Flex, { as: "ul", role: "list", gap: 2, p: 0, display: { base: "none", md: "flex" }, children: menu.map((item, index) => {
640
+ var _a;
641
+ return /* @__PURE__ */ jsx(Flex, { as: "li", role: "listitem", children: ((_a = item.children) == null ? void 0 : _a.length) ? /* @__PURE__ */ jsx(NavList$1, { ...item }) : /* @__PURE__ */ jsx(NavLink, { ...item }) }, item.path || index);
642
+ }) });
643
+ };
644
+ const NavList = ({ path, label, children, isExpanded, onExpand }) => {
645
+ function handleClick() {
646
+ onExpand(path);
647
+ }
648
+ return /* @__PURE__ */ jsxs(Stack, { w: "full", children: [
649
+ /* @__PURE__ */ jsxs(
650
+ Flex,
604
651
  {
605
- as: "li",
606
- role: "group",
607
- display: "block",
652
+ as: "button",
608
653
  p: 2,
609
- cursor: "pointer",
610
- rounded: "md",
611
- _hover: { bg: backgroundHover },
612
- children: /* @__PURE__ */ jsxs(Stack, { direction: "row", children: [
613
- /* @__PURE__ */ jsxs(Box, { children: [
614
- /* @__PURE__ */ jsx(Text, { fontWeight: 500, transition: "all .3s ease", _groupHover: { color: "brand.400" }, children: child.title }),
615
- !!child.subtitle && /* @__PURE__ */ jsx(Text, { fontSize: "sm", children: child.subtitle })
616
- ] }),
654
+ pe: 1,
655
+ align: "center",
656
+ justifyContent: "space-between",
657
+ _hover: { textDecoration: "none", color: "brand.400" },
658
+ onClick: handleClick,
659
+ children: [
660
+ /* @__PURE__ */ jsx(Text, { isTruncated: true, fontWeight: 600, children: label }),
617
661
  /* @__PURE__ */ jsx(
618
- Flex,
662
+ ChevronDownIcon,
619
663
  {
620
- flex: 1,
621
- justify: "flex-end",
622
- align: "center",
623
- opacity: 0,
624
- transition: "all .3s ease",
625
- transform: "translateX(-10px)",
626
- _groupHover: { opacity: 1, transform: "translateX(0)" },
627
- children: /* @__PURE__ */ jsx(Icon, { as: ChevronRightIcon, color: "brand.400", w: 5, h: 5 })
664
+ w: 24,
665
+ h: 24,
666
+ transform: isExpanded ? "rotate(180deg)" : "",
667
+ transition: "all .25s ease-in-out"
628
668
  }
629
669
  )
630
- ] })
631
- },
632
- child.url
633
- )) }) })
634
- ] });
635
- };
636
- const DesktopNavigation = ({ menu }) => {
637
- return /* @__PURE__ */ jsx(Flex, { as: "ul", direction: "row", gap: 4, p: 0, children: menu.map((item) => /* @__PURE__ */ jsx(Flex, { as: "li", children: /* @__PURE__ */ jsx(DesktopNavItem, { ...item }) }, item.url)) });
638
- };
639
- const MobileNavItem = ({ title, children, url }) => {
640
- const { isOpen, onToggle } = useDisclosure();
641
- return /* @__PURE__ */ jsxs(Stack, { w: "100%", p: 2, children: [
642
- /* @__PURE__ */ jsxs(Flex, { align: "center", gap: 2, justify: "space-between", children: [
643
- /* @__PURE__ */ jsx(Text, { as: Link$1, to: url, isTruncated: true, fontWeight: 600, children: title }),
644
- !!children && /* @__PURE__ */ jsx(Flex, { as: "button", onClick: onToggle, children: /* @__PURE__ */ jsx(
645
- Icon,
646
- {
647
- as: ChevronDownIcon,
648
- w: 6,
649
- h: 6,
650
- transform: isOpen ? "rotate(180deg)" : "",
651
- transition: "all .25s ease-in-out"
652
- }
653
- ) })
654
- ] }),
655
- /* @__PURE__ */ jsx(Collapse, { in: isOpen, animateOpacity: true, children: /* @__PURE__ */ jsx(
656
- Stack,
657
- {
658
- as: "ul",
659
- pl: 2,
660
- borderLeft: 1,
661
- borderStyle: "solid",
662
- borderColor: useColorModeValue("gray.200", "gray.700"),
663
- children: !!children && children.map((child) => /* @__PURE__ */ jsx(Flex, { as: "li", children: /* @__PURE__ */ jsx(Text, { as: Link$1, to: `${url}${child.url}`, py: 2, children: child.title }) }, child.url))
670
+ ]
664
671
  }
665
- ) })
672
+ ),
673
+ /* @__PURE__ */ jsx(Collapse, { in: isExpanded, transition: { enter: { ease: "easeIn" }, exit: { duration: 0.2 } }, children: /* @__PURE__ */ jsx(List$1, { ml: 2, pl: 0, borderLeft: 1, borderStyle: "solid", borderColor: useColorModeValue("gray.200", "gray.700"), children: children == null ? void 0 : children.map((child) => /* @__PURE__ */ jsx(Flex, { as: "li", role: "listitem", children: /* @__PURE__ */ jsx(Text, { as: Link$1, to: `${path}${child.path}`, p: 2, fontSize: "sm", children: child.label }) }, child.path)) }) })
666
674
  ] });
667
675
  };
668
676
  const MobileNavigation = ({ menu }) => {
677
+ const [selected, setSelected] = useState(null);
669
678
  const { isOpen, onToggle } = useDisclosure();
670
- const background = useColorModeValue("white", "gray.800");
671
- return menu.length ? /* @__PURE__ */ jsxs(Box, { children: [
679
+ const background = useColorModeValue("gray.50", "gray.900");
680
+ function handleExpand(id) {
681
+ setSelected((prev) => prev === id ? null : id);
682
+ }
683
+ function handleClick() {
684
+ setSelected(null);
685
+ onToggle();
686
+ }
687
+ return /* @__PURE__ */ jsxs(Box, { display: { base: "block", md: "none" }, children: [
672
688
  /* @__PURE__ */ jsx(
673
689
  IconButton,
674
690
  {
675
- icon: isOpen ? /* @__PURE__ */ jsx(CloseIcon, { w: 3, h: 3 }) : /* @__PURE__ */ jsx(HamburgerIcon, {}),
676
- size: "md",
691
+ icon: isOpen ? /* @__PURE__ */ jsx(CloseIcon, { w: 12, h: 12 }) : /* @__PURE__ */ jsx(HamburgerIcon, { w: 18, h: 18 }),
692
+ size: "sm",
677
693
  variant: "ghost",
678
- "aria-label": "Toggle Navigation",
679
- onClick: onToggle
694
+ "aria-label": `${isOpen ? "Close" : "Open"} navigation menu`,
695
+ "aria-expanded": isOpen,
696
+ onClick: handleClick
680
697
  }
681
698
  ),
682
- /* @__PURE__ */ jsx(Collapse, { in: isOpen, animateOpacity: true, children: /* @__PURE__ */ jsx(Box, { position: "absolute", top: 14, right: 0, w: "100vw", px: 2, children: /* @__PURE__ */ jsx(Stack, { as: "ul", spacing: 2, p: 2, w: "100%", borderRadius: "md", boxShadow: "md", bg: background, children: menu.map((item) => /* @__PURE__ */ jsx(Flex, { as: "li", children: /* @__PURE__ */ jsx(MobileNavItem, { ...item }) }, item.url)) }) }) })
683
- ] }) : null;
699
+ /* @__PURE__ */ jsx(Collapse, { in: isOpen, animateOpacity: true, children: /* @__PURE__ */ jsx(Box, { position: "absolute", top: 16, left: 0, right: 0, w: "100vw", px: 2, children: /* @__PURE__ */ jsx(List$1, { spacing: 2, p: 2, w: "full", borderRadius: "md", boxShadow: "md", bg: background, children: menu.map((item, index) => {
700
+ var _a;
701
+ return /* @__PURE__ */ jsx(Flex, { as: "li", role: "listitem", children: ((_a = item.children) == null ? void 0 : _a.length) ? /* @__PURE__ */ jsx(NavList, { ...item, isExpanded: item.path === selected, onExpand: handleExpand }) : /* @__PURE__ */ jsx(NavLink, { ...item }) }, item.path || index);
702
+ }) }) }) })
703
+ ] });
684
704
  };
685
705
  const Navigation = ({ menu }) => {
686
- const isDesktop = useBreakpointValue({ base: false, md: true });
687
- return isDesktop ? /* @__PURE__ */ jsx(DesktopNavigation, { menu }) : /* @__PURE__ */ jsx(MobileNavigation, { menu });
706
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
707
+ /* @__PURE__ */ jsx(DesktopNavigation, { menu }),
708
+ /* @__PURE__ */ jsx(MobileNavigation, { menu })
709
+ ] });
688
710
  };
689
711
  const Header = () => {
690
712
  var _a, _b;
691
713
  const { configs } = useSiteContext();
692
714
  const navigation = ((_a = configs == null ? void 0 : configs.header) == null ? void 0 : _a.navigation) ?? [];
693
715
  const toolbar = (_b = configs == null ? void 0 : configs.header) == null ? void 0 : _b.toolbar;
716
+ const hasToolbar = !!toolbar;
717
+ const hasNavigation = navigation.length;
694
718
  return /* @__PURE__ */ jsx(
695
719
  Box,
696
720
  {
@@ -701,20 +725,20 @@ const Header = () => {
701
725
  color: useColorModeValue("gray.700", "gray.200"),
702
726
  boxShadow: "sm",
703
727
  zIndex: 100,
704
- children: /* @__PURE__ */ jsx(Container, { children: /* @__PURE__ */ jsxs(Flex, { as: "nav", gap: 2, py: 1, children: [
728
+ children: /* @__PURE__ */ jsx(Container, { children: /* @__PURE__ */ jsxs(Flex, { as: "nav", gap: 2, py: 2, children: [
705
729
  /* @__PURE__ */ jsx(Brand, { brand: /* @__PURE__ */ jsx(Logo, {}) }),
706
- (!!navigation.length || !!toolbar) && /* @__PURE__ */ jsxs(
730
+ (hasNavigation || hasToolbar) && /* @__PURE__ */ jsxs(
707
731
  Flex,
708
732
  {
709
733
  as: "section",
710
734
  flex: 1,
711
735
  flexDir: { base: "row-reverse", md: "row" },
712
- justifyContent: { base: "flex-end", md: "flex-start" },
736
+ justifyContent: "end",
713
737
  align: "center",
714
738
  gap: 2,
715
739
  children: [
716
- !!navigation.length && /* @__PURE__ */ jsx(Flex, { flex: { base: 0, md: 1 }, children: /* @__PURE__ */ jsx(Navigation, { menu: navigation }) }),
717
- !!toolbar && /* @__PURE__ */ jsx(Flex, { gap: 2, flex: { base: 1, md: 0 }, justifyContent: "flex-end", children: toolbar })
740
+ hasNavigation && /* @__PURE__ */ jsx(Flex, { flex: { base: 0, md: 1 }, children: /* @__PURE__ */ jsx(Navigation, { menu: navigation }) }),
741
+ hasToolbar && /* @__PURE__ */ jsx(Flex, { gap: 2, flex: { base: 1, md: 0 }, justifyContent: "flex-end", children: toolbar })
718
742
  ]
719
743
  }
720
744
  )
@@ -86,12 +86,16 @@ const LinkButton = ({ label, url, width = "auto", ...boxProps }) => {
86
86
  }
87
87
  );
88
88
  };
89
- const PulseButton = ({ label, onClick }) => {
89
+ const ColorMap = {
90
+ light: "gray.200",
91
+ dark: "gray.700"
92
+ };
93
+ const PulseButton = ({ label, colorScheme = "light", onClick }) => {
90
94
  return /* @__PURE__ */ jsxRuntime.jsx(
91
95
  react.Button,
92
96
  {
93
97
  size: { base: "sm", md: "lg" },
94
- color: "gray.200",
98
+ color: ColorMap[colorScheme],
95
99
  bgColor: "brand.500",
96
100
  animation: `${index$1.Animation.pulse} 2s infinite linear`,
97
101
  _hover: { bgColor: "brand.200", color: "gray.700" },
@@ -545,18 +549,18 @@ const Navigation$1 = ({ menu }) => {
545
549
  spacing: 4,
546
550
  justifyItems: { base: "flex-start", md: "center" },
547
551
  justifyContent: "space-between",
548
- children: menu.map(({ url, title }) => /* @__PURE__ */ jsxRuntime.jsx(
552
+ children: menu.map(({ path, label }) => /* @__PURE__ */ jsxRuntime.jsx(
549
553
  react.Text,
550
554
  {
551
555
  as: gatsby.Link,
552
- to: url,
556
+ to: path,
553
557
  fontSize: "md",
554
558
  fontWeight: "semibold",
555
559
  colorScheme: "gray",
556
560
  _hover: { textDecoration: "none", color: "brand.400" },
557
- children: title
561
+ children: label
558
562
  },
559
- url
563
+ path
560
564
  ))
561
565
  }
562
566
  );
@@ -584,114 +588,134 @@ const Footer = () => {
584
588
  const Brand = ({ brand }) => {
585
589
  return /* @__PURE__ */ jsxRuntime.jsx(gatsby.Link, { to: "/", children: brand });
586
590
  };
587
- const DesktopNavItem = ({ title, url, children }) => {
591
+ const NavLink = react$1.forwardRef(({ path, label }, ref) => {
592
+ return /* @__PURE__ */ jsxRuntime.jsx(
593
+ react.Text,
594
+ {
595
+ ref,
596
+ as: gatsby.Link,
597
+ to: path,
598
+ p: 2,
599
+ fontWeight: "semibold",
600
+ _hover: { textDecoration: "none", color: "brand.400" },
601
+ children: label
602
+ }
603
+ );
604
+ });
605
+ NavLink.displayName = "NavLink";
606
+ const NavList$1 = ({ path, label, children }) => {
588
607
  const background = react.useColorModeValue("white", "gray.800");
589
608
  const backgroundHover = react.useColorModeValue("brand.50", "gray.900");
590
609
  return /* @__PURE__ */ jsxRuntime.jsxs(react.Popover, { trigger: "hover", placement: "bottom-start", children: [
591
610
  /* @__PURE__ */ jsxRuntime.jsx(react.PopoverTrigger, { children: /* @__PURE__ */ jsxRuntime.jsx(
592
611
  react.Text,
593
612
  {
594
- as: gatsby.Link,
595
- to: url,
596
613
  p: 2,
597
- fontSize: "sm",
598
- fontWeight: 500,
614
+ fontWeight: "semibold",
615
+ cursor: "pointer",
616
+ tabIndex: 0,
599
617
  _hover: { textDecoration: "none", color: "brand.400" },
600
- children: title
618
+ children: label
601
619
  }
602
620
  ) }),
603
- !!children && /* @__PURE__ */ jsxRuntime.jsx(react.PopoverContent, { p: 2, border: 0, minW: "sm", rounded: "xl", boxShadow: "xl", bg: background, children: /* @__PURE__ */ jsxRuntime.jsx(react.Stack, { as: "ul", p: 0, children: children.map((child) => /* @__PURE__ */ jsxRuntime.jsx(
604
- react.Box,
621
+ /* @__PURE__ */ jsxRuntime.jsx(react.PopoverContent, { p: 2, border: 0, minW: "sm", rounded: "xl", boxShadow: "xl", bg: background, children: /* @__PURE__ */ jsxRuntime.jsx(react.List, { spacing: 2, p: 0, children: children == null ? void 0 : children.map((child) => /* @__PURE__ */ jsxRuntime.jsx(react.ListItem, { rounded: "md", _hover: { bg: backgroundHover }, children: /* @__PURE__ */ jsxRuntime.jsxs(react.Flex, { as: gatsby.Link, to: `${path}${child.path}`, p: 2, role: "group", children: [
622
+ /* @__PURE__ */ jsxRuntime.jsx(react.Text, { fontWeight: 500, transition: "all .3s ease", _groupHover: { color: "brand.400" }, children: child.label }),
623
+ /* @__PURE__ */ jsxRuntime.jsx(
624
+ react.Flex,
625
+ {
626
+ flex: 1,
627
+ justify: "flex-end",
628
+ align: "center",
629
+ opacity: 0,
630
+ transition: "all .3s ease",
631
+ transform: "translateX(-10px)",
632
+ _groupHover: { opacity: 1, transform: "translateX(0)" },
633
+ children: /* @__PURE__ */ jsxRuntime.jsx(react.Icon, { as: icons.ChevronRightIcon, color: "brand.400", w: 5, h: 5 })
634
+ }
635
+ )
636
+ ] }) }, child.path)) }) })
637
+ ] });
638
+ };
639
+ const DesktopNavigation = ({ menu }) => {
640
+ return /* @__PURE__ */ jsxRuntime.jsx(react.Flex, { as: "ul", role: "list", gap: 2, p: 0, display: { base: "none", md: "flex" }, children: menu.map((item, index2) => {
641
+ var _a;
642
+ return /* @__PURE__ */ jsxRuntime.jsx(react.Flex, { as: "li", role: "listitem", children: ((_a = item.children) == null ? void 0 : _a.length) ? /* @__PURE__ */ jsxRuntime.jsx(NavList$1, { ...item }) : /* @__PURE__ */ jsxRuntime.jsx(NavLink, { ...item }) }, item.path || index2);
643
+ }) });
644
+ };
645
+ const NavList = ({ path, label, children, isExpanded, onExpand }) => {
646
+ function handleClick() {
647
+ onExpand(path);
648
+ }
649
+ return /* @__PURE__ */ jsxRuntime.jsxs(react.Stack, { w: "full", children: [
650
+ /* @__PURE__ */ jsxRuntime.jsxs(
651
+ react.Flex,
605
652
  {
606
- as: "li",
607
- role: "group",
608
- display: "block",
653
+ as: "button",
609
654
  p: 2,
610
- cursor: "pointer",
611
- rounded: "md",
612
- _hover: { bg: backgroundHover },
613
- children: /* @__PURE__ */ jsxRuntime.jsxs(react.Stack, { direction: "row", children: [
614
- /* @__PURE__ */ jsxRuntime.jsxs(react.Box, { children: [
615
- /* @__PURE__ */ jsxRuntime.jsx(react.Text, { fontWeight: 500, transition: "all .3s ease", _groupHover: { color: "brand.400" }, children: child.title }),
616
- !!child.subtitle && /* @__PURE__ */ jsxRuntime.jsx(react.Text, { fontSize: "sm", children: child.subtitle })
617
- ] }),
655
+ pe: 1,
656
+ align: "center",
657
+ justifyContent: "space-between",
658
+ _hover: { textDecoration: "none", color: "brand.400" },
659
+ onClick: handleClick,
660
+ children: [
661
+ /* @__PURE__ */ jsxRuntime.jsx(react.Text, { isTruncated: true, fontWeight: 600, children: label }),
618
662
  /* @__PURE__ */ jsxRuntime.jsx(
619
- react.Flex,
663
+ icons.ChevronDownIcon,
620
664
  {
621
- flex: 1,
622
- justify: "flex-end",
623
- align: "center",
624
- opacity: 0,
625
- transition: "all .3s ease",
626
- transform: "translateX(-10px)",
627
- _groupHover: { opacity: 1, transform: "translateX(0)" },
628
- children: /* @__PURE__ */ jsxRuntime.jsx(react.Icon, { as: icons.ChevronRightIcon, color: "brand.400", w: 5, h: 5 })
665
+ w: 24,
666
+ h: 24,
667
+ transform: isExpanded ? "rotate(180deg)" : "",
668
+ transition: "all .25s ease-in-out"
629
669
  }
630
670
  )
631
- ] })
632
- },
633
- child.url
634
- )) }) })
635
- ] });
636
- };
637
- const DesktopNavigation = ({ menu }) => {
638
- return /* @__PURE__ */ jsxRuntime.jsx(react.Flex, { as: "ul", direction: "row", gap: 4, p: 0, children: menu.map((item) => /* @__PURE__ */ jsxRuntime.jsx(react.Flex, { as: "li", children: /* @__PURE__ */ jsxRuntime.jsx(DesktopNavItem, { ...item }) }, item.url)) });
639
- };
640
- const MobileNavItem = ({ title, children, url }) => {
641
- const { isOpen, onToggle } = react.useDisclosure();
642
- return /* @__PURE__ */ jsxRuntime.jsxs(react.Stack, { w: "100%", p: 2, children: [
643
- /* @__PURE__ */ jsxRuntime.jsxs(react.Flex, { align: "center", gap: 2, justify: "space-between", children: [
644
- /* @__PURE__ */ jsxRuntime.jsx(react.Text, { as: gatsby.Link, to: url, isTruncated: true, fontWeight: 600, children: title }),
645
- !!children && /* @__PURE__ */ jsxRuntime.jsx(react.Flex, { as: "button", onClick: onToggle, children: /* @__PURE__ */ jsxRuntime.jsx(
646
- react.Icon,
647
- {
648
- as: icons.ChevronDownIcon,
649
- w: 6,
650
- h: 6,
651
- transform: isOpen ? "rotate(180deg)" : "",
652
- transition: "all .25s ease-in-out"
653
- }
654
- ) })
655
- ] }),
656
- /* @__PURE__ */ jsxRuntime.jsx(react.Collapse, { in: isOpen, animateOpacity: true, children: /* @__PURE__ */ jsxRuntime.jsx(
657
- react.Stack,
658
- {
659
- as: "ul",
660
- pl: 2,
661
- borderLeft: 1,
662
- borderStyle: "solid",
663
- borderColor: react.useColorModeValue("gray.200", "gray.700"),
664
- children: !!children && children.map((child) => /* @__PURE__ */ jsxRuntime.jsx(react.Flex, { as: "li", children: /* @__PURE__ */ jsxRuntime.jsx(react.Text, { as: gatsby.Link, to: `${url}${child.url}`, py: 2, children: child.title }) }, child.url))
671
+ ]
665
672
  }
666
- ) })
673
+ ),
674
+ /* @__PURE__ */ jsxRuntime.jsx(react.Collapse, { in: isExpanded, transition: { enter: { ease: "easeIn" }, exit: { duration: 0.2 } }, children: /* @__PURE__ */ jsxRuntime.jsx(react.List, { ml: 2, pl: 0, borderLeft: 1, borderStyle: "solid", borderColor: react.useColorModeValue("gray.200", "gray.700"), children: children == null ? void 0 : children.map((child) => /* @__PURE__ */ jsxRuntime.jsx(react.Flex, { as: "li", role: "listitem", children: /* @__PURE__ */ jsxRuntime.jsx(react.Text, { as: gatsby.Link, to: `${path}${child.path}`, p: 2, fontSize: "sm", children: child.label }) }, child.path)) }) })
667
675
  ] });
668
676
  };
669
677
  const MobileNavigation = ({ menu }) => {
678
+ const [selected, setSelected] = react$1.useState(null);
670
679
  const { isOpen, onToggle } = react.useDisclosure();
671
- const background = react.useColorModeValue("white", "gray.800");
672
- return menu.length ? /* @__PURE__ */ jsxRuntime.jsxs(react.Box, { children: [
680
+ const background = react.useColorModeValue("gray.50", "gray.900");
681
+ function handleExpand(id) {
682
+ setSelected((prev) => prev === id ? null : id);
683
+ }
684
+ function handleClick() {
685
+ setSelected(null);
686
+ onToggle();
687
+ }
688
+ return /* @__PURE__ */ jsxRuntime.jsxs(react.Box, { display: { base: "block", md: "none" }, children: [
673
689
  /* @__PURE__ */ jsxRuntime.jsx(
674
690
  react.IconButton,
675
691
  {
676
- icon: isOpen ? /* @__PURE__ */ jsxRuntime.jsx(icons.CloseIcon, { w: 3, h: 3 }) : /* @__PURE__ */ jsxRuntime.jsx(icons.HamburgerIcon, {}),
677
- size: "md",
692
+ icon: isOpen ? /* @__PURE__ */ jsxRuntime.jsx(icons.CloseIcon, { w: 12, h: 12 }) : /* @__PURE__ */ jsxRuntime.jsx(icons.HamburgerIcon, { w: 18, h: 18 }),
693
+ size: "sm",
678
694
  variant: "ghost",
679
- "aria-label": "Toggle Navigation",
680
- onClick: onToggle
695
+ "aria-label": `${isOpen ? "Close" : "Open"} navigation menu`,
696
+ "aria-expanded": isOpen,
697
+ onClick: handleClick
681
698
  }
682
699
  ),
683
- /* @__PURE__ */ jsxRuntime.jsx(react.Collapse, { in: isOpen, animateOpacity: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.Box, { position: "absolute", top: 14, right: 0, w: "100vw", px: 2, children: /* @__PURE__ */ jsxRuntime.jsx(react.Stack, { as: "ul", spacing: 2, p: 2, w: "100%", borderRadius: "md", boxShadow: "md", bg: background, children: menu.map((item) => /* @__PURE__ */ jsxRuntime.jsx(react.Flex, { as: "li", children: /* @__PURE__ */ jsxRuntime.jsx(MobileNavItem, { ...item }) }, item.url)) }) }) })
684
- ] }) : null;
700
+ /* @__PURE__ */ jsxRuntime.jsx(react.Collapse, { in: isOpen, animateOpacity: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.Box, { position: "absolute", top: 16, left: 0, right: 0, w: "100vw", px: 2, children: /* @__PURE__ */ jsxRuntime.jsx(react.List, { spacing: 2, p: 2, w: "full", borderRadius: "md", boxShadow: "md", bg: background, children: menu.map((item, index2) => {
701
+ var _a;
702
+ return /* @__PURE__ */ jsxRuntime.jsx(react.Flex, { as: "li", role: "listitem", children: ((_a = item.children) == null ? void 0 : _a.length) ? /* @__PURE__ */ jsxRuntime.jsx(NavList, { ...item, isExpanded: item.path === selected, onExpand: handleExpand }) : /* @__PURE__ */ jsxRuntime.jsx(NavLink, { ...item }) }, item.path || index2);
703
+ }) }) }) })
704
+ ] });
685
705
  };
686
706
  const Navigation = ({ menu }) => {
687
- const isDesktop = react.useBreakpointValue({ base: false, md: true });
688
- return isDesktop ? /* @__PURE__ */ jsxRuntime.jsx(DesktopNavigation, { menu }) : /* @__PURE__ */ jsxRuntime.jsx(MobileNavigation, { menu });
707
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
708
+ /* @__PURE__ */ jsxRuntime.jsx(DesktopNavigation, { menu }),
709
+ /* @__PURE__ */ jsxRuntime.jsx(MobileNavigation, { menu })
710
+ ] });
689
711
  };
690
712
  const Header = () => {
691
713
  var _a, _b;
692
714
  const { configs } = index.useSiteContext();
693
715
  const navigation = ((_a = configs == null ? void 0 : configs.header) == null ? void 0 : _a.navigation) ?? [];
694
716
  const toolbar = (_b = configs == null ? void 0 : configs.header) == null ? void 0 : _b.toolbar;
717
+ const hasToolbar = !!toolbar;
718
+ const hasNavigation = navigation.length;
695
719
  return /* @__PURE__ */ jsxRuntime.jsx(
696
720
  react.Box,
697
721
  {
@@ -702,20 +726,20 @@ const Header = () => {
702
726
  color: react.useColorModeValue("gray.700", "gray.200"),
703
727
  boxShadow: "sm",
704
728
  zIndex: 100,
705
- children: /* @__PURE__ */ jsxRuntime.jsx(Container, { children: /* @__PURE__ */ jsxRuntime.jsxs(react.Flex, { as: "nav", gap: 2, py: 1, children: [
729
+ children: /* @__PURE__ */ jsxRuntime.jsx(Container, { children: /* @__PURE__ */ jsxRuntime.jsxs(react.Flex, { as: "nav", gap: 2, py: 2, children: [
706
730
  /* @__PURE__ */ jsxRuntime.jsx(Brand, { brand: /* @__PURE__ */ jsxRuntime.jsx(Logo, {}) }),
707
- (!!navigation.length || !!toolbar) && /* @__PURE__ */ jsxRuntime.jsxs(
731
+ (hasNavigation || hasToolbar) && /* @__PURE__ */ jsxRuntime.jsxs(
708
732
  react.Flex,
709
733
  {
710
734
  as: "section",
711
735
  flex: 1,
712
736
  flexDir: { base: "row-reverse", md: "row" },
713
- justifyContent: { base: "flex-end", md: "flex-start" },
737
+ justifyContent: "end",
714
738
  align: "center",
715
739
  gap: 2,
716
740
  children: [
717
- !!navigation.length && /* @__PURE__ */ jsxRuntime.jsx(react.Flex, { flex: { base: 0, md: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(Navigation, { menu: navigation }) }),
718
- !!toolbar && /* @__PURE__ */ jsxRuntime.jsx(react.Flex, { gap: 2, flex: { base: 1, md: 0 }, justifyContent: "flex-end", children: toolbar })
741
+ hasNavigation && /* @__PURE__ */ jsxRuntime.jsx(react.Flex, { flex: { base: 0, md: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(Navigation, { menu: navigation }) }),
742
+ hasToolbar && /* @__PURE__ */ jsxRuntime.jsx(react.Flex, { gap: 2, flex: { base: 1, md: 0 }, justifyContent: "flex-end", children: toolbar })
719
743
  ]
720
744
  }
721
745
  )
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./index-CnohyDGd.js");
3
+ const index = require("./index-BkW3HmFj.js");
4
4
  const index$1 = require("./index-IpSV-c71.js");
5
5
  const i18n$1 = require("./index-DCIXk-YH.js");
6
6
  const index$2 = require("./index-BWuTDC6H.js");
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { A, B, g, C, h, E, F, a, b, G, c, d, i, H, L, j, e, P, k, S, T, f } from "./index-CHSIkTv7.mjs";
1
+ import { A, B, g, C, h, E, F, a, b, G, c, d, i, H, L, j, e, P, k, S, T, f } from "./index-BOs_12nr.mjs";
2
2
  import { u } from "./index-xuSxvz5z.mjs";
3
3
  import { a as a2, G as G2, r } from "./index-DxLcykuT.mjs";
4
4
  import { M } from "./index-wbMOJRW_.mjs";
@@ -1,5 +1,5 @@
1
1
  import { ReactElement } from 'react';
2
- import { IBonus, ILink } from '../../models';
2
+ import { IBonus, ILink } from '../../content';
3
3
  type TextContent = string | ReactElement;
4
4
  export interface IBonusCard extends IBonus {
5
5
  link: ILink;
@@ -1,5 +1,5 @@
1
1
  import { ReactElement } from 'react';
2
- import { IGame, ILink } from '../../models';
2
+ import { IGame, ILink } from '../../content';
3
3
  export interface IGameCard extends IGame {
4
4
  link?: ILink['url'];
5
5
  image?: string | ReactElement;
@@ -5,5 +5,6 @@ export * from './game-card';
5
5
  export * from './game-info';
6
6
  export * from './how-to';
7
7
  export * from './image';
8
+ export * from './navigation';
8
9
  export * from './pros-cons';
9
10
  export * from './tabs';
@@ -0,0 +1,13 @@
1
+ type Path = `/${string}`;
2
+ type EmptyPath = '';
3
+ type IndexPath = '/';
4
+ export interface INavItem<P extends Path = Path> {
5
+ path: P | EmptyPath;
6
+ label: string;
7
+ children?: ISubNavItem[];
8
+ }
9
+ export interface ISubNavItem<P extends Path = Path> {
10
+ path: P | IndexPath;
11
+ label: string;
12
+ }
13
+ export {};
@@ -1,6 +1,5 @@
1
1
  export * from './components';
2
+ export * from './content';
2
3
  export * from './i18n';
3
- export * from './models';
4
- export * from './navigation';
5
4
  export * from './site';
6
5
  export * from './theme';
@@ -1,6 +1,6 @@
1
1
  import { ReactElement, ReactNode } from 'react';
2
+ import { INavItem } from '../components';
2
3
  import { Currency, LanguageCode } from '../i18n';
3
- import { INavigationItem } from '../navigation';
4
4
  type ImageUrl = string;
5
5
  type ImageComponent = ReactElement;
6
6
  type Image = ImageUrl | ImageComponent;
@@ -12,11 +12,11 @@ export interface ISiteAssets {
12
12
  };
13
13
  }
14
14
  interface ISiteHeaderConfig {
15
- navigation?: INavigationItem[];
15
+ navigation?: INavItem[];
16
16
  toolbar?: ReactNode;
17
17
  }
18
18
  interface ISiteFooterConfig {
19
- navigation?: INavigationItem[];
19
+ navigation?: INavItem[];
20
20
  }
21
21
  export interface ISiteConfigs {
22
22
  header?: ISiteHeaderConfig;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@anywayseo/tools",
3
3
  "description": "Shared UI Components and Modules",
4
- "version": "2.1.0",
4
+ "version": "2.2.2",
5
5
  "keywords": [
6
6
  "react",
7
7
  "ui",
@@ -68,6 +68,7 @@
68
68
  "build": "tsc -b && vite build",
69
69
  "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
70
70
  "prepack": "npm run build",
71
+ "preversion": "tsc -b && npm run lint",
71
72
  "bump:patch": "npm version patch",
72
73
  "bump:minor": "npm version minor",
73
74
  "bump:major": "npm version major",
@@ -1,5 +0,0 @@
1
- import { FC } from 'react';
2
- import { INavigationItem } from '../../../../../../types';
3
- type DesktopNavItemProps = INavigationItem;
4
- declare const DesktopNavItem: FC<DesktopNavItemProps>;
5
- export default DesktopNavItem;
@@ -1,5 +0,0 @@
1
- import { FC } from 'react';
2
- import { INavigationItem } from '../../../../../../types';
3
- type MobileNavItemProps = INavigationItem;
4
- declare const MobileNavItem: FC<MobileNavItemProps>;
5
- export default MobileNavItem;
@@ -1,9 +0,0 @@
1
- interface ISubNavigationItem extends Omit<INavigationItem, 'children'> {
2
- subtitle?: string;
3
- }
4
- export interface INavigationItem {
5
- url: string;
6
- title: string;
7
- children?: ISubNavigationItem[];
8
- }
9
- export {};
File without changes
File without changes
File without changes
File without changes