@anywayseo/tools 2.2.2 → 2.2.4

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,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("../index-BkW3HmFj.js");
3
+ const index = require("../index-DWa1ea5F.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-BOs_12nr.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-COCjNsCL.mjs";
2
2
  export {
3
3
  A as Author,
4
4
  B as BonusCard,
@@ -2,7 +2,7 @@ import { FC } from 'react';
2
2
  import { INavItem } from '../../../../../../types';
3
3
  type NavListProps = INavItem & {
4
4
  isExpanded: boolean;
5
- onExpand: (id: INavItem['path']) => void;
5
+ onExpand: VoidFunction;
6
6
  };
7
7
  declare const NavList: FC<NavListProps>;
8
8
  export default NavList;
@@ -617,7 +617,7 @@ const NavList$1 = ({ path, label, children }) => {
617
617
  children: label
618
618
  }
619
619
  ) }),
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: [
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, index) => /* @__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
621
  /* @__PURE__ */ jsx(Text, { fontWeight: 500, transition: "all .3s ease", _groupHover: { color: "brand.400" }, children: child.label }),
622
622
  /* @__PURE__ */ jsx(
623
623
  Flex,
@@ -632,37 +632,35 @@ const NavList$1 = ({ path, label, children }) => {
632
632
  children: /* @__PURE__ */ jsx(Icon, { as: ChevronRightIcon, color: "brand.400", w: 5, h: 5 })
633
633
  }
634
634
  )
635
- ] }) }, child.path)) }) })
635
+ ] }) }, index)) }) })
636
636
  ] });
637
637
  };
638
638
  const DesktopNavigation = ({ menu }) => {
639
639
  return /* @__PURE__ */ jsx(Flex, { as: "ul", role: "list", gap: 2, p: 0, display: { base: "none", md: "flex" }, children: menu.map((item, index) => {
640
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);
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 }) }, index);
642
642
  }) });
643
643
  };
644
+ const CHEVRON_DOWN_ICON_SIZE = "1.5rem";
644
645
  const NavList = ({ path, label, children, isExpanded, onExpand }) => {
645
- function handleClick() {
646
- onExpand(path);
647
- }
648
- return /* @__PURE__ */ jsxs(Stack, { w: "full", children: [
646
+ return /* @__PURE__ */ jsxs(Stack, { flex: 1, children: [
649
647
  /* @__PURE__ */ jsxs(
650
648
  Flex,
651
649
  {
652
650
  as: "button",
653
651
  p: 2,
654
- pe: 1,
652
+ pr: "3px",
655
653
  align: "center",
656
654
  justifyContent: "space-between",
657
655
  _hover: { textDecoration: "none", color: "brand.400" },
658
- onClick: handleClick,
656
+ onClick: onExpand,
659
657
  children: [
660
658
  /* @__PURE__ */ jsx(Text, { isTruncated: true, fontWeight: 600, children: label }),
661
659
  /* @__PURE__ */ jsx(
662
660
  ChevronDownIcon,
663
661
  {
664
- w: 24,
665
- h: 24,
662
+ w: CHEVRON_DOWN_ICON_SIZE,
663
+ h: CHEVRON_DOWN_ICON_SIZE,
666
664
  transform: isExpanded ? "rotate(180deg)" : "",
667
665
  transition: "all .25s ease-in-out"
668
666
  }
@@ -670,25 +668,29 @@ const NavList = ({ path, label, children, isExpanded, onExpand }) => {
670
668
  ]
671
669
  }
672
670
  ),
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)) }) })
671
+ /* @__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, index) => /* @__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 }) }, index)) }) })
674
672
  ] });
675
673
  };
674
+ const CLOSE_ICON_SIZE = "0.75rem";
675
+ const HAMBURGER_ICON_SIZE = "1rem";
676
676
  const MobileNavigation = ({ menu }) => {
677
- const [selected, setSelected] = useState(null);
677
+ const [expanded, setExpanded] = useState(null);
678
678
  const { isOpen, onToggle } = useDisclosure();
679
679
  const background = useColorModeValue("gray.50", "gray.900");
680
- function handleExpand(id) {
681
- setSelected((prev) => prev === id ? null : id);
680
+ function handleExpand(index) {
681
+ return () => {
682
+ setExpanded((prev) => prev === index ? null : index);
683
+ };
682
684
  }
683
685
  function handleClick() {
684
- setSelected(null);
686
+ setExpanded(null);
685
687
  onToggle();
686
688
  }
687
689
  return /* @__PURE__ */ jsxs(Box, { display: { base: "block", md: "none" }, children: [
688
690
  /* @__PURE__ */ jsx(
689
691
  IconButton,
690
692
  {
691
- icon: isOpen ? /* @__PURE__ */ jsx(CloseIcon, { w: 12, h: 12 }) : /* @__PURE__ */ jsx(HamburgerIcon, { w: 18, h: 18 }),
693
+ icon: isOpen ? /* @__PURE__ */ jsx(CloseIcon, { w: CLOSE_ICON_SIZE, h: CLOSE_ICON_SIZE }) : /* @__PURE__ */ jsx(HamburgerIcon, { w: HAMBURGER_ICON_SIZE, h: HAMBURGER_ICON_SIZE }),
692
694
  size: "sm",
693
695
  variant: "ghost",
694
696
  "aria-label": `${isOpen ? "Close" : "Open"} navigation menu`,
@@ -696,10 +698,22 @@ const MobileNavigation = ({ menu }) => {
696
698
  onClick: handleClick
697
699
  }
698
700
  ),
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
- }) }) }) })
701
+ /* @__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(
702
+ List$1,
703
+ {
704
+ spacing: 2,
705
+ p: 2,
706
+ boxShadow: "md",
707
+ borderWidth: "1px",
708
+ borderColor: useColorModeValue("gray.200", "gray.700"),
709
+ borderRadius: "md",
710
+ bg: background,
711
+ children: menu.map((item, index) => {
712
+ var _a;
713
+ return /* @__PURE__ */ jsx(Flex, { as: "li", role: "listitem", children: ((_a = item.children) == null ? void 0 : _a.length) ? /* @__PURE__ */ jsx(NavList, { ...item, isExpanded: index === expanded, onExpand: handleExpand(index) }) : /* @__PURE__ */ jsx(NavLink, { ...item }) }, index);
714
+ })
715
+ }
716
+ ) }) })
703
717
  ] });
704
718
  };
705
719
  const Navigation = ({ menu }) => {
@@ -618,7 +618,7 @@ const NavList$1 = ({ path, label, children }) => {
618
618
  children: label
619
619
  }
620
620
  ) }),
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: [
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, index2) => /* @__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
622
  /* @__PURE__ */ jsxRuntime.jsx(react.Text, { fontWeight: 500, transition: "all .3s ease", _groupHover: { color: "brand.400" }, children: child.label }),
623
623
  /* @__PURE__ */ jsxRuntime.jsx(
624
624
  react.Flex,
@@ -633,37 +633,35 @@ const NavList$1 = ({ path, label, children }) => {
633
633
  children: /* @__PURE__ */ jsxRuntime.jsx(react.Icon, { as: icons.ChevronRightIcon, color: "brand.400", w: 5, h: 5 })
634
634
  }
635
635
  )
636
- ] }) }, child.path)) }) })
636
+ ] }) }, index2)) }) })
637
637
  ] });
638
638
  };
639
639
  const DesktopNavigation = ({ menu }) => {
640
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
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);
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 }) }, index2);
643
643
  }) });
644
644
  };
645
+ const CHEVRON_DOWN_ICON_SIZE = "1.5rem";
645
646
  const NavList = ({ path, label, children, isExpanded, onExpand }) => {
646
- function handleClick() {
647
- onExpand(path);
648
- }
649
- return /* @__PURE__ */ jsxRuntime.jsxs(react.Stack, { w: "full", children: [
647
+ return /* @__PURE__ */ jsxRuntime.jsxs(react.Stack, { flex: 1, children: [
650
648
  /* @__PURE__ */ jsxRuntime.jsxs(
651
649
  react.Flex,
652
650
  {
653
651
  as: "button",
654
652
  p: 2,
655
- pe: 1,
653
+ pr: "3px",
656
654
  align: "center",
657
655
  justifyContent: "space-between",
658
656
  _hover: { textDecoration: "none", color: "brand.400" },
659
- onClick: handleClick,
657
+ onClick: onExpand,
660
658
  children: [
661
659
  /* @__PURE__ */ jsxRuntime.jsx(react.Text, { isTruncated: true, fontWeight: 600, children: label }),
662
660
  /* @__PURE__ */ jsxRuntime.jsx(
663
661
  icons.ChevronDownIcon,
664
662
  {
665
- w: 24,
666
- h: 24,
663
+ w: CHEVRON_DOWN_ICON_SIZE,
664
+ h: CHEVRON_DOWN_ICON_SIZE,
667
665
  transform: isExpanded ? "rotate(180deg)" : "",
668
666
  transition: "all .25s ease-in-out"
669
667
  }
@@ -671,25 +669,29 @@ const NavList = ({ path, label, children, isExpanded, onExpand }) => {
671
669
  ]
672
670
  }
673
671
  ),
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)) }) })
672
+ /* @__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, index2) => /* @__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 }) }, index2)) }) })
675
673
  ] });
676
674
  };
675
+ const CLOSE_ICON_SIZE = "0.75rem";
676
+ const HAMBURGER_ICON_SIZE = "1rem";
677
677
  const MobileNavigation = ({ menu }) => {
678
- const [selected, setSelected] = react$1.useState(null);
678
+ const [expanded, setExpanded] = react$1.useState(null);
679
679
  const { isOpen, onToggle } = react.useDisclosure();
680
680
  const background = react.useColorModeValue("gray.50", "gray.900");
681
- function handleExpand(id) {
682
- setSelected((prev) => prev === id ? null : id);
681
+ function handleExpand(index2) {
682
+ return () => {
683
+ setExpanded((prev) => prev === index2 ? null : index2);
684
+ };
683
685
  }
684
686
  function handleClick() {
685
- setSelected(null);
687
+ setExpanded(null);
686
688
  onToggle();
687
689
  }
688
690
  return /* @__PURE__ */ jsxRuntime.jsxs(react.Box, { display: { base: "block", md: "none" }, children: [
689
691
  /* @__PURE__ */ jsxRuntime.jsx(
690
692
  react.IconButton,
691
693
  {
692
- icon: isOpen ? /* @__PURE__ */ jsxRuntime.jsx(icons.CloseIcon, { w: 12, h: 12 }) : /* @__PURE__ */ jsxRuntime.jsx(icons.HamburgerIcon, { w: 18, h: 18 }),
694
+ icon: isOpen ? /* @__PURE__ */ jsxRuntime.jsx(icons.CloseIcon, { w: CLOSE_ICON_SIZE, h: CLOSE_ICON_SIZE }) : /* @__PURE__ */ jsxRuntime.jsx(icons.HamburgerIcon, { w: HAMBURGER_ICON_SIZE, h: HAMBURGER_ICON_SIZE }),
693
695
  size: "sm",
694
696
  variant: "ghost",
695
697
  "aria-label": `${isOpen ? "Close" : "Open"} navigation menu`,
@@ -697,10 +699,22 @@ const MobileNavigation = ({ menu }) => {
697
699
  onClick: handleClick
698
700
  }
699
701
  ),
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
- }) }) }) })
702
+ /* @__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(
703
+ react.List,
704
+ {
705
+ spacing: 2,
706
+ p: 2,
707
+ boxShadow: "md",
708
+ borderWidth: "1px",
709
+ borderColor: react.useColorModeValue("gray.200", "gray.700"),
710
+ borderRadius: "md",
711
+ bg: background,
712
+ children: menu.map((item, index2) => {
713
+ var _a;
714
+ 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: index2 === expanded, onExpand: handleExpand(index2) }) : /* @__PURE__ */ jsxRuntime.jsx(NavLink, { ...item }) }, index2);
715
+ })
716
+ }
717
+ ) }) })
704
718
  ] });
705
719
  };
706
720
  const Navigation = ({ menu }) => {
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-BkW3HmFj.js");
3
+ const index = require("./index-DWa1ea5F.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-BOs_12nr.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-COCjNsCL.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";
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.2.2",
4
+ "version": "2.2.4",
5
5
  "keywords": [
6
6
  "react",
7
7
  "ui",