@manamerge/mana-atomic-ui 1.0.192 → 1.0.194

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.
package/dist/index.js CHANGED
@@ -772,9 +772,26 @@ const NavLinks = styled.div `
772
772
  flex-direction: column;
773
773
  text-align: right;
774
774
  align-items: flex-end;
775
- display: ${({ isOpen }) => (isOpen ? "flex" : "none")};
775
+ display: flex;
776
+
776
777
  width: 100%;
777
778
 
779
+ overflow: hidden;
780
+ transition:
781
+ max-height 0.55s ease,
782
+ opacity 0.55s ease,
783
+ transform 0.55s ease;
784
+
785
+ max-height: ${({ isOpen }) => (isOpen ? "400px" : "0px")};
786
+ opacity: ${({ isOpen }) => (isOpen ? 1 : 0)};
787
+ transform: ${({ isOpen }) => isOpen ? "translateY(0)" : "translateY(-10px)"};
788
+
789
+ @media (min-width: 768px) {
790
+ max-height: none;
791
+ opacity: 1;
792
+ transform: none;
793
+ }
794
+
778
795
  ${({ theme, moleculeVariant }) => {
779
796
  var _a, _b, _c, _d;
780
797
  const thisTheme = ((_d = (_c = (_b = (_a = theme === null || theme === void 0 ? void 0 : theme.navigation) === null || _a === void 0 ? void 0 : _a[moleculeVariant]) === null || _b === void 0 ? void 0 : _b.navLinks) === null || _c === void 0 ? void 0 : _c.responsive) === null || _d === void 0 ? void 0 : _d.largeMobileUp) || {};
@@ -849,12 +866,26 @@ const Navigation = ({ moleculeVariant = "primary", logo, onLogoClick, iconBurger
849
866
  const location = useLocation();
850
867
  const currentPath = location.pathname;
851
868
  const [isOpen, setIsOpen] = useState(false);
869
+ const navRef = useRef(null);
870
+ useEffect(() => {
871
+ const handleClickOutside = (event) => {
872
+ if (isOpen &&
873
+ navRef.current &&
874
+ !navRef.current.contains(event.target)) {
875
+ setIsOpen(false);
876
+ }
877
+ };
878
+ document.addEventListener("mousedown", handleClickOutside);
879
+ return () => {
880
+ document.removeEventListener("mousedown", handleClickOutside);
881
+ };
882
+ }, [isOpen]);
852
883
  const handleToggle = () => {
853
884
  setIsOpen(!isOpen);
854
885
  };
855
886
  const compVariant = `Navigation-${moleculeVariant}`;
856
- return (jsxs(NavBar, Object.assign({ className: classNames(compVariant), moleculeVariant: compVariant }, { children: [logo && (jsx(AtomIcon$3, { moleculeVariant: compVariant, svg: logo, onClick: onLogoClick, onKeyDown: onLogoClick, "aria-label": "Logo", tabIndex: 0, role: "button" })), jsxs("div", Object.assign({ style: { width: "100%" } }, { children: [jsx(BurgerWrapper, { children: jsx(AtomIcon$3, { moleculeVariant: compVariant, svg: iconBurger, onClick: handleToggle, onKeyDown: handleToggle, "aria-pressed": isOpen, "aria-label": "Burger", tabIndex: 0, role: "button" }) }), jsx(NavLinks, Object.assign({ isOpen: isOpen, moleculeVariant: compVariant }, { children: tabs.length > 0
857
- ? tabs.map((tab) => (jsx(StyledLink$1, Object.assign({ moleculeVariant: compVariant, to: tab.to, currentPath: tab.to === currentPath }, { children: tab.label }), tab.label)))
887
+ return (jsxs(NavBar, Object.assign({ className: classNames(compVariant), moleculeVariant: compVariant, ref: navRef }, { children: [logo && (jsx(AtomIcon$3, { moleculeVariant: compVariant, svg: logo, onClick: onLogoClick, onKeyDown: onLogoClick, "aria-label": "Logo", tabIndex: 0, role: "button" })), jsxs("div", Object.assign({ style: { width: "100%" } }, { children: [jsx(BurgerWrapper, { children: jsx(AtomIcon$3, { moleculeVariant: compVariant, svg: iconBurger, onClick: handleToggle, onKeyDown: handleToggle, "aria-pressed": isOpen, "aria-label": "Burger", tabIndex: 0, role: "button" }) }), jsx(NavLinks, Object.assign({ isOpen: isOpen, moleculeVariant: compVariant }, { children: tabs.length > 0
888
+ ? tabs.map((tab) => (jsx(StyledLink$1, Object.assign({ moleculeVariant: compVariant, to: tab.to, currentPath: tab.to === currentPath, onClick: () => setIsOpen(false) }, { children: tab.label }), tab.label)))
858
889
  : "no tabs available" }))] }))] })));
859
890
  };
860
891
 
@@ -1454,6 +1485,7 @@ const AccordionTitle = styled.button `
1454
1485
  const thisTheme = ((_a = theme === null || theme === void 0 ? void 0 : theme.accordion) === null || _a === void 0 ? void 0 : _a[moleculeVariant]) || {};
1455
1486
  return css `
1456
1487
  all: unset;
1488
+ user-select: text;
1457
1489
  width: 100%;
1458
1490
  display: ${(thisTheme === null || thisTheme === void 0 ? void 0 : thisTheme.display) || "flex"};
1459
1491
  align-items: ${(thisTheme === null || thisTheme === void 0 ? void 0 : thisTheme.alignItems) || "center"};
@@ -1502,13 +1534,16 @@ const AtomHeading = styled(Heading).attrs(({ theme, moleculeVariant }) => {
1502
1534
  });
1503
1535
  }) ``;
1504
1536
  const AtomIcon = styled(Icon).attrs(({ theme, moleculeVariant }) => {
1505
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
1537
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
1506
1538
  return ({
1507
1539
  variant: (_c = (_b = (_a = theme === null || theme === void 0 ? void 0 : theme.accordion) === null || _a === void 0 ? void 0 : _a[moleculeVariant]) === null || _b === void 0 ? void 0 : _b.atomIcon) === null || _c === void 0 ? void 0 : _c.variant,
1508
1540
  size: (_f = (_e = (_d = theme === null || theme === void 0 ? void 0 : theme.accordion) === null || _d === void 0 ? void 0 : _d[moleculeVariant]) === null || _e === void 0 ? void 0 : _e.atomIcon) === null || _f === void 0 ? void 0 : _f.size,
1509
1541
  color: (_j = (_h = (_g = theme === null || theme === void 0 ? void 0 : theme.accordion) === null || _g === void 0 ? void 0 : _g[moleculeVariant]) === null || _h === void 0 ? void 0 : _h.atomIcon) === null || _j === void 0 ? void 0 : _j.color,
1510
1542
  fill: (_m = (_l = (_k = theme === null || theme === void 0 ? void 0 : theme.accordion) === null || _k === void 0 ? void 0 : _k[moleculeVariant]) === null || _l === void 0 ? void 0 : _l.atomIcon) === null || _m === void 0 ? void 0 : _m.fill,
1511
- stroke: (_q = (_p = (_o = theme === null || theme === void 0 ? void 0 : theme.accordion) === null || _o === void 0 ? void 0 : _o[moleculeVariant]) === null || _p === void 0 ? void 0 : _p.atomIcon) === null || _q === void 0 ? void 0 : _q.stroke
1543
+ stroke: (_q = (_p = (_o = theme === null || theme === void 0 ? void 0 : theme.accordion) === null || _o === void 0 ? void 0 : _o[moleculeVariant]) === null || _p === void 0 ? void 0 : _p.atomIcon) === null || _q === void 0 ? void 0 : _q.stroke,
1544
+ hoverColor: (_u = (_t = (_s = (_r = theme === null || theme === void 0 ? void 0 : theme.accordion) === null || _r === void 0 ? void 0 : _r[moleculeVariant]) === null || _s === void 0 ? void 0 : _s.atomIcon) === null || _t === void 0 ? void 0 : _t.hover) === null || _u === void 0 ? void 0 : _u.color,
1545
+ hoverFill: (_y = (_x = (_w = (_v = theme === null || theme === void 0 ? void 0 : theme.accordion) === null || _v === void 0 ? void 0 : _v[moleculeVariant]) === null || _w === void 0 ? void 0 : _w.atomIcon) === null || _x === void 0 ? void 0 : _x.hover) === null || _y === void 0 ? void 0 : _y.fill,
1546
+ hoverStroke: (_2 = (_1 = (_0 = (_z = theme === null || theme === void 0 ? void 0 : theme.accordion) === null || _z === void 0 ? void 0 : _z[moleculeVariant]) === null || _0 === void 0 ? void 0 : _0.atomIcon) === null || _1 === void 0 ? void 0 : _1.hover) === null || _2 === void 0 ? void 0 : _2.stroke
1512
1547
  });
1513
1548
  }) `
1514
1549
  min-width: fit-content;