@anywayseo/tools 2.2.3 → 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-B-J8fcfm.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-CAcPXV4F.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,20 +632,17 @@ 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
644
  const CHEVRON_DOWN_ICON_SIZE = "1.5rem";
645
645
  const NavList = ({ path, label, children, isExpanded, onExpand }) => {
646
- function handleClick() {
647
- onExpand(path);
648
- }
649
646
  return /* @__PURE__ */ jsxs(Stack, { flex: 1, children: [
650
647
  /* @__PURE__ */ jsxs(
651
648
  Flex,
@@ -656,7 +653,7 @@ const NavList = ({ path, label, children, isExpanded, onExpand }) => {
656
653
  align: "center",
657
654
  justifyContent: "space-between",
658
655
  _hover: { textDecoration: "none", color: "brand.400" },
659
- onClick: handleClick,
656
+ onClick: onExpand,
660
657
  children: [
661
658
  /* @__PURE__ */ jsx(Text, { isTruncated: true, fontWeight: 600, children: label }),
662
659
  /* @__PURE__ */ jsx(
@@ -671,20 +668,22 @@ const NavList = ({ path, label, children, isExpanded, onExpand }) => {
671
668
  ]
672
669
  }
673
670
  ),
674
- /* @__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)) }) })
675
672
  ] });
676
673
  };
677
674
  const CLOSE_ICON_SIZE = "0.75rem";
678
675
  const HAMBURGER_ICON_SIZE = "1rem";
679
676
  const MobileNavigation = ({ menu }) => {
680
- const [selected, setSelected] = useState(null);
677
+ const [expanded, setExpanded] = useState(null);
681
678
  const { isOpen, onToggle } = useDisclosure();
682
679
  const background = useColorModeValue("gray.50", "gray.900");
683
- function handleExpand(id) {
684
- setSelected((prev) => prev === id ? null : id);
680
+ function handleExpand(index) {
681
+ return () => {
682
+ setExpanded((prev) => prev === index ? null : index);
683
+ };
685
684
  }
686
685
  function handleClick() {
687
- setSelected(null);
686
+ setExpanded(null);
688
687
  onToggle();
689
688
  }
690
689
  return /* @__PURE__ */ jsxs(Box, { display: { base: "block", md: "none" }, children: [
@@ -711,7 +710,7 @@ const MobileNavigation = ({ menu }) => {
711
710
  bg: background,
712
711
  children: menu.map((item, index) => {
713
712
  var _a;
714
- 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);
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);
715
714
  })
716
715
  }
717
716
  ) }) })
@@ -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,20 +633,17 @@ 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
645
  const CHEVRON_DOWN_ICON_SIZE = "1.5rem";
646
646
  const NavList = ({ path, label, children, isExpanded, onExpand }) => {
647
- function handleClick() {
648
- onExpand(path);
649
- }
650
647
  return /* @__PURE__ */ jsxRuntime.jsxs(react.Stack, { flex: 1, children: [
651
648
  /* @__PURE__ */ jsxRuntime.jsxs(
652
649
  react.Flex,
@@ -657,7 +654,7 @@ const NavList = ({ path, label, children, isExpanded, onExpand }) => {
657
654
  align: "center",
658
655
  justifyContent: "space-between",
659
656
  _hover: { textDecoration: "none", color: "brand.400" },
660
- onClick: handleClick,
657
+ onClick: onExpand,
661
658
  children: [
662
659
  /* @__PURE__ */ jsxRuntime.jsx(react.Text, { isTruncated: true, fontWeight: 600, children: label }),
663
660
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -672,20 +669,22 @@ const NavList = ({ path, label, children, isExpanded, onExpand }) => {
672
669
  ]
673
670
  }
674
671
  ),
675
- /* @__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)) }) })
676
673
  ] });
677
674
  };
678
675
  const CLOSE_ICON_SIZE = "0.75rem";
679
676
  const HAMBURGER_ICON_SIZE = "1rem";
680
677
  const MobileNavigation = ({ menu }) => {
681
- const [selected, setSelected] = react$1.useState(null);
678
+ const [expanded, setExpanded] = react$1.useState(null);
682
679
  const { isOpen, onToggle } = react.useDisclosure();
683
680
  const background = react.useColorModeValue("gray.50", "gray.900");
684
- function handleExpand(id) {
685
- setSelected((prev) => prev === id ? null : id);
681
+ function handleExpand(index2) {
682
+ return () => {
683
+ setExpanded((prev) => prev === index2 ? null : index2);
684
+ };
686
685
  }
687
686
  function handleClick() {
688
- setSelected(null);
687
+ setExpanded(null);
689
688
  onToggle();
690
689
  }
691
690
  return /* @__PURE__ */ jsxRuntime.jsxs(react.Box, { display: { base: "block", md: "none" }, children: [
@@ -712,7 +711,7 @@ const MobileNavigation = ({ menu }) => {
712
711
  bg: background,
713
712
  children: menu.map((item, index2) => {
714
713
  var _a;
715
- 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);
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);
716
715
  })
717
716
  }
718
717
  ) }) })
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-B-J8fcfm.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-CAcPXV4F.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.3",
4
+ "version": "2.2.4",
5
5
  "keywords": [
6
6
  "react",
7
7
  "ui",