@synerise/ds-app-menu 1.2.9 → 1.2.10

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 (42) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/AppMenu.d.ts +3 -3
  3. package/dist/AppMenu.js +34 -39
  4. package/dist/AppMenu.styles.d.ts +3 -3
  5. package/dist/AppMenu.styles.js +11 -14
  6. package/dist/AppMenu.types.d.ts +1 -1
  7. package/dist/AppMenu.types.js +1 -1
  8. package/dist/Item/Icon/Icon.d.ts +1 -1
  9. package/dist/Item/Icon/Icon.js +15 -14
  10. package/dist/Item/Icon/Icon.styles.d.ts +1 -1
  11. package/dist/Item/Icon/Icon.styles.js +7 -6
  12. package/dist/Item/Item.d.ts +1 -1
  13. package/dist/Item/Item.js +27 -31
  14. package/dist/Item/Item.styles.d.ts +2 -2
  15. package/dist/Item/Item.styles.js +9 -7
  16. package/dist/MenuContext/MenuContext.d.ts +1 -1
  17. package/dist/MenuContext/MenuContext.js +5 -3
  18. package/dist/NavigableItems/NavigableItems.d.ts +1 -1
  19. package/dist/NavigableItems/NavigableItems.js +44 -60
  20. package/dist/NavigableItems/NavigableItems.styles.d.ts +1 -1
  21. package/dist/NavigableItems/NavigableItems.styles.js +8 -5
  22. package/dist/SubMenu/Item/Item.d.ts +3 -3
  23. package/dist/SubMenu/Item/Item.js +15 -16
  24. package/dist/SubMenu/Item/Item.styles.d.ts +2 -2
  25. package/dist/SubMenu/Item/Item.styles.js +9 -9
  26. package/dist/SubMenu/Item/Item.types.d.ts +1 -1
  27. package/dist/SubMenu/Item/Item.types.js +1 -1
  28. package/dist/SubMenu/SubMenu.d.ts +2 -2
  29. package/dist/SubMenu/SubMenu.js +16 -16
  30. package/dist/SubMenu/SubMenu.styles.d.ts +3 -3
  31. package/dist/SubMenu/SubMenu.styles.js +12 -17
  32. package/dist/SubMenu/SubMenu.types.d.ts +2 -2
  33. package/dist/SubMenu/SubMenu.types.js +1 -1
  34. package/dist/SubMenu/SubMenuContext/SubMenuContext.d.ts +2 -2
  35. package/dist/SubMenu/SubMenuContext/SubMenuContext.js +5 -3
  36. package/dist/SubMenu/SubMenuContext/SubMenuContext.types.js +1 -1
  37. package/dist/hooks/useMenu.js +9 -6
  38. package/dist/hooks/useSubMenu.js +9 -6
  39. package/dist/index.js +8 -3
  40. package/dist/modules.d.js +1 -1
  41. package/dist/modules.d.ts +0 -0
  42. package/package.json +8 -8
package/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.2.10](https://github.com/Synerise/synerise-design/compare/@synerise/ds-app-menu@1.2.9...@synerise/ds-app-menu@1.2.10) (2026-03-24)
7
+
8
+ **Note:** Version bump only for package @synerise/ds-app-menu
9
+
6
10
  ## [1.2.9](https://github.com/Synerise/synerise-design/compare/@synerise/ds-app-menu@1.2.8...@synerise/ds-app-menu@1.2.9) (2026-03-20)
7
11
 
8
12
  **Note:** Version bump only for package @synerise/ds-app-menu
package/dist/AppMenu.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import React from 'react';
2
- import { type AppMenuProps } from './AppMenu.types';
1
+ import { default as React } from 'react';
2
+ import { AppMenuProps } from './AppMenu.types';
3
3
  declare const AppMenu: {
4
4
  ({ className, children, footer, activeItem: activeId, top, }: AppMenuProps): React.JSX.Element;
5
- SubMenu: React.FC<import("./SubMenu/SubMenu.types").SubMenuProps> & import("./SubMenu/SubMenu.types").SubComponents;
5
+ SubMenu: React.FC<import('./SubMenu/SubMenu.types').SubMenuProps> & import('./SubMenu/SubMenu.types').SubComponents;
6
6
  Item: {
7
7
  ({ children, subMenu, id, name, className }: {
8
8
  subMenu?: React.ReactElement;
package/dist/AppMenu.js CHANGED
@@ -1,45 +1,40 @@
1
- import React from 'react';
2
- import { useOnClickOutside } from '@synerise/ds-utils';
3
- import * as S from './AppMenu.styles';
4
- import Item from './Item/Item';
5
- import MenuContext from './MenuContext/MenuContext';
6
- import NavigableItems from './NavigableItems/NavigableItems';
7
- import SubMenu from './SubMenu/SubMenu';
8
- var AppMenu = function AppMenu(_ref) {
9
- var className = _ref.className,
10
- children = _ref.children,
11
- footer = _ref.footer,
12
- activeId = _ref.activeItem,
13
- _ref$top = _ref.top,
14
- top = _ref$top === void 0 ? 0 : _ref$top;
15
- var _React$useState = React.useState(false),
16
- isOpened = _React$useState[0],
17
- setOpened = _React$useState[1];
18
- var _React$useState2 = React.useState(activeId),
19
- activeItem = _React$useState2[0],
20
- setActiveItem = _React$useState2[1];
21
- var ref = React.useRef(null);
22
- useOnClickOutside(ref, function () {
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import React from "react";
3
+ import { useOnClickOutside } from "@synerise/ds-utils";
4
+ import { MenuWrapper, ItemsWrapper, ItemsDivider } from "./AppMenu.styles.js";
5
+ import Item from "./Item/Item.js";
6
+ import MenuContext from "./MenuContext/MenuContext.js";
7
+ import NavigableItems from "./NavigableItems/NavigableItems.js";
8
+ import SubMenu from "./SubMenu/SubMenu.js";
9
+ const AppMenu = ({
10
+ className,
11
+ children,
12
+ footer,
13
+ activeItem: activeId,
14
+ top = 0
15
+ }) => {
16
+ const [isOpened, setOpened] = React.useState(false);
17
+ const [activeItem, setActiveItem] = React.useState(activeId);
18
+ const ref = React.useRef(null);
19
+ useOnClickOutside(ref, () => {
23
20
  setOpened(false);
24
21
  setActiveItem(activeId);
25
22
  });
26
- return /*#__PURE__*/React.createElement(S.MenuWrapper, {
27
- className: (className || '') + " menu " + (isOpened ? 'menu--opened' : '') + " ds-app-menu",
28
- ref: ref,
29
- top: top
30
- }, /*#__PURE__*/React.createElement(S.ItemsWrapper, null, /*#__PURE__*/React.createElement(MenuContext.Provider, {
31
- value: {
32
- isOpened: isOpened,
33
- setOpened: setOpened,
34
- activeItem: activeItem,
35
- setActiveItem: setActiveItem
36
- }
37
- }, /*#__PURE__*/React.createElement(NavigableItems, {
38
- onHideMenu: function onHideMenu() {
39
- return setOpened(false);
40
- }
41
- }, children), footer && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(S.ItemsDivider, null), footer))));
23
+ return /* @__PURE__ */ jsx(MenuWrapper, { className: `${className || ""} menu ${isOpened ? "menu--opened" : ""} ds-app-menu`, ref, top, children: /* @__PURE__ */ jsx(ItemsWrapper, { children: /* @__PURE__ */ jsxs(MenuContext.Provider, { value: {
24
+ isOpened,
25
+ setOpened,
26
+ activeItem,
27
+ setActiveItem
28
+ }, children: [
29
+ /* @__PURE__ */ jsx(NavigableItems, { onHideMenu: () => setOpened(false), children }),
30
+ footer && /* @__PURE__ */ jsxs(Fragment, { children: [
31
+ /* @__PURE__ */ jsx(ItemsDivider, {}),
32
+ footer
33
+ ] })
34
+ ] }) }) });
42
35
  };
43
36
  AppMenu.SubMenu = SubMenu;
44
37
  AppMenu.Item = Item;
45
- export default AppMenu;
38
+ export {
39
+ AppMenu as default
40
+ };
@@ -1,5 +1,5 @@
1
- export declare const MenuWrapper: import("styled-components").StyledComponent<"div", any, {
1
+ export declare const MenuWrapper: import('styled-components').StyledComponent<"div", any, {
2
2
  top: number;
3
3
  }, never>;
4
- export declare const ItemsWrapper: import("styled-components").StyledComponent<"ul", any, {}, never>;
5
- export declare const ItemsDivider: import("styled-components").StyledComponent<"div", any, {}, never>;
4
+ export declare const ItemsWrapper: import('styled-components').StyledComponent<"ul", any, {}, never>;
5
+ export declare const ItemsDivider: import('styled-components').StyledComponent<"div", any, {}, never>;
@@ -1,21 +1,18 @@
1
- import styled from 'styled-components';
2
- export var MenuWrapper = styled.div.withConfig({
1
+ import styled from "styled-components";
2
+ const MenuWrapper = /* @__PURE__ */ styled.div.withConfig({
3
3
  displayName: "AppMenustyles__MenuWrapper",
4
4
  componentId: "sc-3a0k9p-0"
5
- })(["background:", ";height:calc(100% - ", "px);position:fixed;left:0;top:", "px;width:60px;box-shadow:0 4px 12px 0 rgba(35,41,54,0.04);display:flex;flex-flow:column;align-items:center;padding-top:12px;transition:all 0.25s cubic-bezier(0.95,0.17,0.27,0.79);transition-delay:0.25s;overflow:hidden;&.menu--opened{transition-delay:0s;width:322px;}"], function (props) {
6
- return props.theme.palette.white;
7
- }, function (props) {
8
- return props.top;
9
- }, function (props) {
10
- return props.top;
11
- });
12
- export var ItemsWrapper = styled.ul.withConfig({
5
+ })(["background:", ";height:calc(100% - ", "px);position:fixed;left:0;top:", "px;width:60px;box-shadow:0 4px 12px 0 rgba(35,41,54,0.04);display:flex;flex-flow:column;align-items:center;padding-top:12px;transition:all 0.25s cubic-bezier(0.95,0.17,0.27,0.79);transition-delay:0.25s;overflow:hidden;&.menu--opened{transition-delay:0s;width:322px;}"], (props) => props.theme.palette.white, (props) => props.top, (props) => props.top);
6
+ const ItemsWrapper = /* @__PURE__ */ styled.ul.withConfig({
13
7
  displayName: "AppMenustyles__ItemsWrapper",
14
8
  componentId: "sc-3a0k9p-1"
15
9
  })(["padding:12px 0 0;margin:0;height:100%;position:absolute;left:0;top:0;width:60px;display:flex;flex-flow:column;align-items:center;z-index:2;list-style:none;"]);
16
- export var ItemsDivider = styled.div.withConfig({
10
+ const ItemsDivider = /* @__PURE__ */ styled.div.withConfig({
17
11
  displayName: "AppMenustyles__ItemsDivider",
18
12
  componentId: "sc-3a0k9p-2"
19
- })(["width:40px;border-bottom:1px solid ", ";flex:1 1 auto;"], function (props) {
20
- return props.theme.palette['grey-100'];
21
- });
13
+ })(["width:40px;border-bottom:1px solid ", ";flex:1 1 auto;"], (props) => props.theme.palette["grey-100"]);
14
+ export {
15
+ ItemsDivider,
16
+ ItemsWrapper,
17
+ MenuWrapper
18
+ };
@@ -1,4 +1,4 @@
1
- import { type ReactNode, type ReactNodeArray } from 'react';
1
+ import { ReactNode, ReactNodeArray } from 'react';
2
2
  export type AppMenuProps = {
3
3
  className?: string;
4
4
  activeItem: string;
@@ -1 +1 @@
1
- export {};
1
+
@@ -1,4 +1,4 @@
1
- import React, { type ReactNode } from 'react';
1
+ import { default as React, ReactNode } from 'react';
2
2
  type AppMenuIconProps = {
3
3
  active: ReactNode;
4
4
  inActive: ReactNode;
@@ -1,15 +1,16 @@
1
- import React from 'react';
2
- import IconComponent from '@synerise/ds-icon';
3
- import * as S from './Icon.styles';
4
- export var AppMenuIcon = function AppMenuIcon(_ref) {
5
- var active = _ref.active,
6
- inActive = _ref.inActive;
7
- return /*#__PURE__*/React.createElement(S.Wrapper, null, /*#__PURE__*/React.createElement(IconComponent, {
8
- className: "item__icon item__icon--active",
9
- component: active
10
- }), /*#__PURE__*/React.createElement(IconComponent, {
11
- className: "item__icon item__icon--in-active",
12
- component: inActive
13
- }));
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import IconComponent from "@synerise/ds-icon";
3
+ import { Wrapper } from "./Icon.styles.js";
4
+ const AppMenuIcon = ({
5
+ active,
6
+ inActive
7
+ }) => {
8
+ return /* @__PURE__ */ jsxs(Wrapper, { children: [
9
+ /* @__PURE__ */ jsx(IconComponent, { className: "item__icon item__icon--active", component: active }),
10
+ /* @__PURE__ */ jsx(IconComponent, { className: "item__icon item__icon--in-active", component: inActive })
11
+ ] });
12
+ };
13
+ export {
14
+ AppMenuIcon,
15
+ AppMenuIcon as default
14
16
  };
15
- export default AppMenuIcon;
@@ -1,2 +1,2 @@
1
- export declare const Wrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
1
+ export declare const Wrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
2
2
  export default Wrapper;
@@ -1,8 +1,9 @@
1
- import styled from 'styled-components';
2
- export var Wrapper = styled.div.withConfig({
1
+ import styled from "styled-components";
2
+ const Wrapper = /* @__PURE__ */ styled.div.withConfig({
3
3
  displayName: "Iconstyles__Wrapper",
4
4
  componentId: "sc-1gdlsp-0"
5
- })(["position:relative;height:24px;width:24px;color:", ";.item__icon{position:absolute;transition:opacity 0.3s ease-in-out;}"], function (props) {
6
- return props.theme.palette['grey-600'];
7
- });
8
- export default Wrapper;
5
+ })(["position:relative;height:24px;width:24px;color:", ";.item__icon{position:absolute;transition:opacity 0.3s ease-in-out;}"], (props) => props.theme.palette["grey-600"]);
6
+ export {
7
+ Wrapper,
8
+ Wrapper as default
9
+ };
@@ -1,4 +1,4 @@
1
- import React, { type PropsWithChildren, type ReactElement } from 'react';
1
+ import { default as React, PropsWithChildren, ReactElement } from 'react';
2
2
  type ItemProps = PropsWithChildren<{
3
3
  subMenu?: ReactElement;
4
4
  id: string;
package/dist/Item/Item.js CHANGED
@@ -1,19 +1,20 @@
1
- import React from 'react';
2
- import Tooltip from '@synerise/ds-tooltip';
3
- import SubMenuContext from '../SubMenu/SubMenuContext/SubMenuContext';
4
- import { useMenu } from '../hooks/useMenu';
5
- import Icon from './Icon/Icon';
6
- import * as S from './Item.styles';
7
- var Item = function Item(_ref) {
8
- var children = _ref.children,
9
- subMenu = _ref.subMenu,
10
- id = _ref.id,
11
- name = _ref.name,
12
- className = _ref.className;
13
- var menuContext = useMenu();
14
- var isActive = menuContext.activeItem === id;
15
- var isActiveSubMenu = isActive && menuContext.isOpened;
16
- var handleOpen = function handleOpen() {
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import Tooltip from "@synerise/ds-tooltip";
3
+ import SubMenuContext from "../SubMenu/SubMenuContext/SubMenuContext.js";
4
+ import { useMenu } from "../hooks/useMenu.js";
5
+ import { AppMenuIcon } from "./Icon/Icon.js";
6
+ import { ItemWrapper, ItemLink } from "./Item.styles.js";
7
+ const Item = ({
8
+ children,
9
+ subMenu,
10
+ id,
11
+ name,
12
+ className
13
+ }) => {
14
+ const menuContext = useMenu();
15
+ const isActive = menuContext.activeItem === id;
16
+ const isActiveSubMenu = isActive && menuContext.isOpened;
17
+ const handleOpen = () => {
17
18
  if (isActive) {
18
19
  menuContext.setOpened(!!subMenu && !menuContext.isOpened);
19
20
  } else {
@@ -21,21 +22,16 @@ var Item = function Item(_ref) {
21
22
  menuContext.setActiveItem(id);
22
23
  }
23
24
  };
24
- return /*#__PURE__*/React.createElement(S.ItemWrapper, {
25
- className: className
26
- }, /*#__PURE__*/React.createElement(Tooltip, {
27
- placement: "right",
28
- title: isActive && menuContext.isOpened ? '' : name
29
- }, /*#__PURE__*/React.createElement(S.ItemLink, {
30
- className: "menu__item " + (isActive ? 'menu__item--active' : ''),
31
- onClick: handleOpen
32
- }, children)), subMenu && id && /*#__PURE__*/React.createElement(SubMenuContext.Provider, {
33
- value: {
34
- id: id,
25
+ return /* @__PURE__ */ jsxs(ItemWrapper, { className, children: [
26
+ /* @__PURE__ */ jsx(Tooltip, { placement: "right", title: isActive && menuContext.isOpened ? "" : name, children: /* @__PURE__ */ jsx(ItemLink, { className: `menu__item ${isActive ? "menu__item--active" : ""}`, onClick: handleOpen, children }) }),
27
+ subMenu && id && /* @__PURE__ */ jsx(SubMenuContext.Provider, { value: {
28
+ id,
35
29
  isActive: isActiveSubMenu,
36
30
  setOpened: menuContext.setOpened
37
- }
38
- }, subMenu));
31
+ }, children: subMenu })
32
+ ] });
33
+ };
34
+ Item.Icon = AppMenuIcon;
35
+ export {
36
+ Item as default
39
37
  };
40
- Item.Icon = Icon;
41
- export default Item;
@@ -1,3 +1,3 @@
1
- export declare const ItemLink: import("styled-components").StyledComponent<"div", any, {}, never>;
2
- export declare const ItemWrapper: import("styled-components").StyledComponent<"li", any, {}, never>;
1
+ export declare const ItemLink: import('styled-components').StyledComponent<"div", any, {}, never>;
2
+ export declare const ItemWrapper: import('styled-components').StyledComponent<"li", any, {}, never>;
3
3
  export default ItemWrapper;
@@ -1,12 +1,14 @@
1
- import styled from 'styled-components';
2
- export var ItemLink = styled.div.withConfig({
1
+ import styled from "styled-components";
2
+ const ItemLink = /* @__PURE__ */ styled.div.withConfig({
3
3
  displayName: "Itemstyles__ItemLink",
4
4
  componentId: "sc-1hq0xvl-0"
5
- })(["position:relative;display:flex;align-items:center;align-content:center;justify-content:center;height:40px;width:40px;padding:8px;margin:12px 0;cursor:pointer;border-radius:50%;transition:all 0.3s ease-in-out;.item__icon--active{opacity:0;}.item__icon--in-active{opacity:1;}&:hover,&.menu__item--active{.item__icon--active{opacity:1;}.item__icon--in-active{opacity:0;}}&:hover{background:", ";}> a{position:absolute;display:flex;align-items:center;justify-content:center;width:100%;height:100%;}"], function (props) {
6
- return props.theme.palette['grey-050'];
7
- });
8
- export var ItemWrapper = styled.li.withConfig({
5
+ })(["position:relative;display:flex;align-items:center;align-content:center;justify-content:center;height:40px;width:40px;padding:8px;margin:12px 0;cursor:pointer;border-radius:50%;transition:all 0.3s ease-in-out;.item__icon--active{opacity:0;}.item__icon--in-active{opacity:1;}&:hover,&.menu__item--active{.item__icon--active{opacity:1;}.item__icon--in-active{opacity:0;}}&:hover{background:", ";}> a{position:absolute;display:flex;align-items:center;justify-content:center;width:100%;height:100%;}"], (props) => props.theme.palette["grey-050"]);
6
+ const ItemWrapper = /* @__PURE__ */ styled.li.withConfig({
9
7
  displayName: "Itemstyles__ItemWrapper",
10
8
  componentId: "sc-1hq0xvl-1"
11
9
  })(["display:flex;align-items:center;padding:0;margin:0;height:64px;&:first-child{", "{margin-top:8px;}}"], ItemLink);
12
- export default ItemWrapper;
10
+ export {
11
+ ItemLink,
12
+ ItemWrapper,
13
+ ItemWrapper as default
14
+ };
@@ -4,5 +4,5 @@ type MenuContextType = {
4
4
  setOpened: (opened: boolean) => void;
5
5
  setActiveItem: (subMenu: string) => void;
6
6
  } | undefined;
7
- declare const MenuContext: import("react").Context<MenuContextType>;
7
+ declare const MenuContext: import('react').Context<MenuContextType>;
8
8
  export default MenuContext;
@@ -1,3 +1,5 @@
1
- import { createContext } from 'react';
2
- var MenuContext = /*#__PURE__*/createContext(undefined);
3
- export default MenuContext;
1
+ import { createContext } from "react";
2
+ const MenuContext = createContext(void 0);
3
+ export {
4
+ MenuContext as default
5
+ };
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { default as React } from 'react';
2
2
  type NavigableItemsProps = {
3
3
  onHideMenu: () => void;
4
4
  children: React.ReactNodeArray;
@@ -1,35 +1,30 @@
1
- import React from 'react';
2
- import Icon, { AngleDownS, AngleUpS } from '@synerise/ds-icon';
3
- import * as ItemStyles from '../Item/Item.styles';
4
- import * as S from './NavigableItems.styles';
5
- var itemHeight = 64;
6
- var animationTime = 100;
7
- var NavigableItems = function NavigableItems(_ref) {
8
- var children = _ref.children,
9
- onHideMenu = _ref.onHideMenu;
10
- var ref = React.useRef(null);
11
- var _React$useState = React.useState(Infinity),
12
- itemsCapacity = _React$useState[0],
13
- setItemsCapacity = _React$useState[1];
14
- var _React$useState2 = React.useState(0),
15
- currentIndex = _React$useState2[0],
16
- setIndex = _React$useState2[1];
17
- var isNavigateTopVisible = currentIndex > 0;
18
- var isNavigateBottomVisible = currentIndex + itemsCapacity <= children.length;
19
- var _React$useState3 = React.useState(''),
20
- animationInProgress = _React$useState3[0],
21
- setAnimationInProgress = _React$useState3[1];
22
- var _React$useState4 = React.useState(0),
23
- lastHeight = _React$useState4[0],
24
- setLastHeight = _React$useState4[1];
25
- var countCapacity = React.useCallback(function () {
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import React from "react";
3
+ import IconComponent, { AngleUpS, AngleDownS } from "@synerise/ds-icon";
4
+ import { ItemWrapper, ItemLink } from "../Item/Item.styles.js";
5
+ import { Wrapper } from "./NavigableItems.styles.js";
6
+ const itemHeight = 64;
7
+ const animationTime = 100;
8
+ const NavigableItems = ({
9
+ children,
10
+ onHideMenu
11
+ }) => {
12
+ const ref = React.useRef(null);
13
+ const [itemsCapacity, setItemsCapacity] = React.useState(Infinity);
14
+ const [currentIndex, setIndex] = React.useState(0);
15
+ const isNavigateTopVisible = currentIndex > 0;
16
+ const isNavigateBottomVisible = currentIndex + itemsCapacity <= children.length;
17
+ const [animationInProgress, setAnimationInProgress] = React.useState("");
18
+ const [lastHeight, setLastHeight] = React.useState(0);
19
+ const countCapacity = React.useCallback(() => {
26
20
  if (ref.current) {
27
- var _ref$current$getBound = ref.current.getBoundingClientRect(),
28
- height = _ref$current$getBound.height;
21
+ const {
22
+ height
23
+ } = ref.current.getBoundingClientRect();
29
24
  if (height > 0) {
30
25
  setLastHeight(height);
31
26
  }
32
- var itemsHeight = children.length * itemHeight;
27
+ const itemsHeight = children.length * itemHeight;
33
28
  setIndex(0);
34
29
  if (itemsHeight > height) {
35
30
  setItemsCapacity(Math.floor((height || lastHeight) / itemHeight));
@@ -38,49 +33,38 @@ var NavigableItems = function NavigableItems(_ref) {
38
33
  }
39
34
  }
40
35
  }, [children.length, ref, lastHeight, setLastHeight]);
41
- React.useEffect(function () {
42
- window.addEventListener('resize', countCapacity);
43
- return function () {
44
- return window.removeEventListener('resize', countCapacity);
45
- };
36
+ React.useEffect(() => {
37
+ window.addEventListener("resize", countCapacity);
38
+ return () => window.removeEventListener("resize", countCapacity);
46
39
  }, [countCapacity]);
47
- React.useEffect(function () {
40
+ React.useEffect(() => {
48
41
  countCapacity();
49
42
  }, [countCapacity]);
50
- var handelNavigateBottom = function handelNavigateBottom() {
51
- setAnimationInProgress('bottom');
52
- setTimeout(function () {
53
- setAnimationInProgress('');
43
+ const handelNavigateBottom = () => {
44
+ setAnimationInProgress("bottom");
45
+ setTimeout(() => {
46
+ setAnimationInProgress("");
54
47
  setIndex(currentIndex ? currentIndex + 1 : currentIndex + 2);
55
48
  onHideMenu();
56
49
  }, animationTime);
57
50
  };
58
- var handleNavigateTop = function handleNavigateTop() {
59
- setAnimationInProgress('top');
60
- setTimeout(function () {
61
- setAnimationInProgress('');
51
+ const handleNavigateTop = () => {
52
+ setAnimationInProgress("top");
53
+ setTimeout(() => {
54
+ setAnimationInProgress("");
62
55
  setIndex(currentIndex === 2 ? 0 : currentIndex - 1);
63
56
  onHideMenu();
64
57
  }, animationTime);
65
58
  };
66
59
  if (itemsCapacity < children.length) {
67
- return /*#__PURE__*/React.createElement(S.Wrapper, {
68
- ref: ref,
69
- className: "animation--" + animationInProgress
70
- }, isNavigateTopVisible && /*#__PURE__*/React.createElement(ItemStyles.ItemWrapper, {
71
- onClick: handleNavigateTop,
72
- className: "nav-button nav-button--top"
73
- }, /*#__PURE__*/React.createElement(ItemStyles.ItemLink, null, /*#__PURE__*/React.createElement(Icon, {
74
- component: /*#__PURE__*/React.createElement(AngleUpS, null)
75
- }))), React.Children.toArray(children).splice(currentIndex, itemsCapacity - (isNavigateBottomVisible && isNavigateTopVisible ? 2 : 1)), isNavigateBottomVisible && /*#__PURE__*/React.createElement(ItemStyles.ItemWrapper, {
76
- onClick: handelNavigateBottom,
77
- className: "nav-button nav-button--bottom"
78
- }, /*#__PURE__*/React.createElement(ItemStyles.ItemLink, null, /*#__PURE__*/React.createElement(Icon, {
79
- component: /*#__PURE__*/React.createElement(AngleDownS, null)
80
- }))));
60
+ return /* @__PURE__ */ jsxs(Wrapper, { ref, className: `animation--${animationInProgress}`, children: [
61
+ isNavigateTopVisible && /* @__PURE__ */ jsx(ItemWrapper, { onClick: handleNavigateTop, className: "nav-button nav-button--top", children: /* @__PURE__ */ jsx(ItemLink, { children: /* @__PURE__ */ jsx(IconComponent, { component: /* @__PURE__ */ jsx(AngleUpS, {}) }) }) }),
62
+ React.Children.toArray(children).splice(currentIndex, itemsCapacity - (isNavigateBottomVisible && isNavigateTopVisible ? 2 : 1)),
63
+ isNavigateBottomVisible && /* @__PURE__ */ jsx(ItemWrapper, { onClick: handelNavigateBottom, className: "nav-button nav-button--bottom", children: /* @__PURE__ */ jsx(ItemLink, { children: /* @__PURE__ */ jsx(IconComponent, { component: /* @__PURE__ */ jsx(AngleDownS, {}) }) }) })
64
+ ] });
81
65
  }
82
- return /*#__PURE__*/React.createElement(S.Wrapper, {
83
- ref: ref
84
- }, children);
66
+ return /* @__PURE__ */ jsx(Wrapper, { ref, children });
67
+ };
68
+ export {
69
+ NavigableItems as default
85
70
  };
86
- export default NavigableItems;
@@ -1,2 +1,2 @@
1
- export declare const Wrapper: import("styled-components").StyledComponent<"ul", any, {}, never>;
1
+ export declare const Wrapper: import('styled-components').StyledComponent<"ul", any, {}, never>;
2
2
  export default Wrapper;
@@ -1,8 +1,11 @@
1
- import styled, { keyframes } from 'styled-components';
2
- var bottom = keyframes(["from{top:0px;}to{top:-48px;}"]);
3
- var top = keyframes(["from{top:0px;}to{top:48px;}"]);
4
- export var Wrapper = styled.ul.withConfig({
1
+ import styled, { keyframes } from "styled-components";
2
+ const bottom = /* @__PURE__ */ keyframes(["from{top:0px;}to{top:-48px;}"]);
3
+ const top = /* @__PURE__ */ keyframes(["from{top:0px;}to{top:48px;}"]);
4
+ const Wrapper = /* @__PURE__ */ styled.ul.withConfig({
5
5
  displayName: "NavigableItemsstyles__Wrapper",
6
6
  componentId: "sc-1gjk7hm-0"
7
7
  })(["margin:0;padding:0;flex:1 1 auto;overflow:hidden;&.animation--bottom{> *:not(.nav-button){position:relative;animation:", " 0.1s ease-in-out forwards;}}&.animation--top{> *:not(.nav-button){position:relative;animation:", " 0.1s ease-in-out forwards;}}"], bottom, top);
8
- export default Wrapper;
8
+ export {
9
+ Wrapper,
10
+ Wrapper as default
11
+ };
@@ -1,7 +1,7 @@
1
- import React from 'react';
2
- import { type ItemProps } from './Item.types';
1
+ import { default as React } from 'react';
2
+ import { ItemProps } from './Item.types';
3
3
  declare const Item: {
4
4
  ({ children, active }: ItemProps): React.JSX.Element;
5
- Action: import("styled-components").StyledComponent<"span", any, {}, never>;
5
+ Action: import('styled-components').StyledComponent<"span", any, {}, never>;
6
6
  };
7
7
  export default Item;
@@ -1,19 +1,18 @@
1
- import React from 'react';
2
- import SubMenuContext from '../SubMenuContext/SubMenuContext';
3
- import * as S from './Item.styles';
4
- var Item = function Item(_ref) {
5
- var children = _ref.children,
6
- active = _ref.active;
7
- var subMenuContext = React.useContext(SubMenuContext);
1
+ import { jsx } from "react/jsx-runtime";
2
+ import React from "react";
3
+ import SubMenuContext from "../SubMenuContext/SubMenuContext.js";
4
+ import { Wrapper, ItemAction } from "./Item.styles.js";
5
+ const Item = ({
6
+ children,
7
+ active
8
+ }) => {
9
+ const subMenuContext = React.useContext(SubMenuContext);
8
10
  if (!subMenuContext) {
9
- throw new Error('Cannot use SubMenu.Item outside SubMenuContext');
11
+ throw new Error("Cannot use SubMenu.Item outside SubMenuContext");
10
12
  }
11
- return /*#__PURE__*/React.createElement(S.Wrapper, {
12
- className: "sub-menu__item " + (active ? 'sub-menu__item--active' : ''),
13
- onClick: function onClick() {
14
- return subMenuContext.setOpened(false);
15
- }
16
- }, children);
13
+ return /* @__PURE__ */ jsx(Wrapper, { className: `sub-menu__item ${active ? "sub-menu__item--active" : ""}`, onClick: () => subMenuContext.setOpened(false), children });
14
+ };
15
+ Item.Action = ItemAction;
16
+ export {
17
+ Item as default
17
18
  };
18
- Item.Action = S.ItemAction;
19
- export default Item;
@@ -1,2 +1,2 @@
1
- export declare const ItemAction: import("styled-components").StyledComponent<"span", any, {}, never>;
2
- export declare const Wrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
1
+ export declare const ItemAction: import('styled-components').StyledComponent<"span", any, {}, never>;
2
+ export declare const Wrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
@@ -1,14 +1,14 @@
1
- import styled from 'styled-components';
2
- import { macro } from '@synerise/ds-typography';
3
- export var ItemAction = styled.span.withConfig({
1
+ import styled from "styled-components";
2
+ import { macro } from "@synerise/ds-typography";
3
+ const ItemAction = /* @__PURE__ */ styled.span.withConfig({
4
4
  displayName: "Itemstyles__ItemAction",
5
5
  componentId: "sc-15s98w8-0"
6
6
  })(["margin-top:-4px;margin-right:-4px;float:right;opacity:0;transition:opacity 0.3s ease-in-out;"]);
7
- export var Wrapper = styled.div.withConfig({
7
+ const Wrapper = /* @__PURE__ */ styled.div.withConfig({
8
8
  displayName: "Itemstyles__Wrapper",
9
9
  componentId: "sc-15s98w8-1"
10
- })(["", ";width:100%;padding:8px 12px;margin:0 0 1px;border-radius:3px;transition:all 0.3s ease-in-out;cursor:pointer;&:hover,&.sub-menu__item--active{background:", ";color:", ";opacity:1;", "{opacity:1;}}"], macro.h200, function (props) {
11
- return props.theme.palette['grey-050'];
12
- }, function (props) {
13
- return props.theme.palette['blue-600'];
14
- }, ItemAction);
10
+ })(["", ";width:100%;padding:8px 12px;margin:0 0 1px;border-radius:3px;transition:all 0.3s ease-in-out;cursor:pointer;&:hover,&.sub-menu__item--active{background:", ";color:", ";opacity:1;", "{opacity:1;}}"], macro.h200, (props) => props.theme.palette["grey-050"], (props) => props.theme.palette["blue-600"], ItemAction);
11
+ export {
12
+ ItemAction,
13
+ Wrapper
14
+ };
@@ -1,4 +1,4 @@
1
- import { type ReactNode } from 'react';
1
+ import { ReactNode } from 'react';
2
2
  import type * as S from './Item.styles';
3
3
  export type ItemProps = {
4
4
  active?: boolean;
@@ -1 +1 @@
1
- export {};
1
+
@@ -1,4 +1,4 @@
1
- import React from 'react';
2
- import { type SubComponents, type SubMenuProps } from './SubMenu.types';
1
+ import { default as React } from 'react';
2
+ import { SubComponents, SubMenuProps } from './SubMenu.types';
3
3
  declare const SubMenu: React.FC<SubMenuProps> & SubComponents;
4
4
  export default SubMenu;
@@ -1,18 +1,18 @@
1
- import React from 'react';
2
- import { useSubMenu } from '../hooks/useSubMenu';
3
- import Item from './Item/Item';
4
- import * as S from './SubMenu.styles';
5
- var SubMenu = function SubMenu(_ref) {
6
- var children = _ref.children,
7
- className = _ref.className,
8
- style = _ref.style;
9
- var subMenuContext = useSubMenu();
10
- return /*#__PURE__*/React.createElement(S.MenuGroupWrapper, {
11
- className: "menu__sub-menu " + (className || '') + " " + (subMenuContext.isActive ? 'menu__sub-menu--active' : ''),
12
- style: style
13
- }, children);
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useSubMenu } from "../hooks/useSubMenu.js";
3
+ import Item from "./Item/Item.js";
4
+ import { MenuGroupWrapper, MenuGroupTitle, MenuGroupSubTitle } from "./SubMenu.styles.js";
5
+ const SubMenu = ({
6
+ children,
7
+ className,
8
+ style
9
+ }) => {
10
+ const subMenuContext = useSubMenu();
11
+ return /* @__PURE__ */ jsx(MenuGroupWrapper, { className: `menu__sub-menu ${className || ""} ${subMenuContext.isActive ? "menu__sub-menu--active" : ""}`, style, children });
14
12
  };
15
- SubMenu.Title = S.MenuGroupTitle;
16
- SubMenu.SubTitle = S.MenuGroupSubTitle;
13
+ SubMenu.Title = MenuGroupTitle;
14
+ SubMenu.SubTitle = MenuGroupSubTitle;
17
15
  SubMenu.Item = Item;
18
- export default SubMenu;
16
+ export {
17
+ SubMenu as default
18
+ };
@@ -1,3 +1,3 @@
1
- export declare const MenuGroupWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
2
- export declare const MenuGroupTitle: import("styled-components").StyledComponent<"h3", any, {}, never>;
3
- export declare const MenuGroupSubTitle: import("styled-components").StyledComponent<"h4", any, {}, never>;
1
+ export declare const MenuGroupWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
2
+ export declare const MenuGroupTitle: import('styled-components').StyledComponent<"h3", any, {}, never>;
3
+ export declare const MenuGroupSubTitle: import('styled-components').StyledComponent<"h4", any, {}, never>;
@@ -1,24 +1,19 @@
1
- import styled, { css } from 'styled-components';
2
- import { macro } from '@synerise/ds-typography';
3
- export var MenuGroupWrapper = styled.div.withConfig({
1
+ import styled, { css } from "styled-components";
2
+ import { macro } from "@synerise/ds-typography";
3
+ const MenuGroupWrapper = /* @__PURE__ */ styled.div.withConfig({
4
4
  displayName: "SubMenustyles__MenuGroupWrapper",
5
5
  componentId: "sc-dperxu-0"
6
- })(["background:", ";width:262px;position:absolute;left:61px;top:0px;height:100%;border-left:1px solid ", ";padding:12px;opacity:0;visibility:hidden;transition:opacity 0.2s ease-in-out;transition-delay:0.1s;overflow-y:auto;display:flex;flex-flow:column;&.menu__sub-menu--active{visibility:visible;opacity:1;> *{opacity:1;top:0px !important;}}a:hover{text-decoration:none;}> *{opacity:0;transition:all 0.3s ease-in-out;position:relative;top:-10px;}", " &:hover{> *{transition-delay:0s;}}"], function (props) {
7
- return props.theme.palette.white;
8
- }, function (props) {
9
- return props.theme.palette['grey-100'];
10
- }, [].concat(Array(100).keys()).map(function (k) {
11
- return css(["> *:nth-child(", "){transition-delay:", "s;}"], k, 0.1 + k * 10 / 500);
12
- }));
13
- export var MenuGroupTitle = styled.h3.withConfig({
6
+ })(["background:", ";width:262px;position:absolute;left:61px;top:0px;height:100%;border-left:1px solid ", ";padding:12px;opacity:0;visibility:hidden;transition:opacity 0.2s ease-in-out;transition-delay:0.1s;overflow-y:auto;display:flex;flex-flow:column;&.menu__sub-menu--active{visibility:visible;opacity:1;> *{opacity:1;top:0px !important;}}a:hover{text-decoration:none;}> *{opacity:0;transition:all 0.3s ease-in-out;position:relative;top:-10px;}", " &:hover{> *{transition-delay:0s;}}"], (props) => props.theme.palette.white, (props) => props.theme.palette["grey-100"], [...Array(100).keys()].map((k) => css(["> *:nth-child(", "){transition-delay:", "s;}"], k, 0.1 + k * 10 / 500)));
7
+ const MenuGroupTitle = /* @__PURE__ */ styled.h3.withConfig({
14
8
  displayName: "SubMenustyles__MenuGroupTitle",
15
9
  componentId: "sc-dperxu-1"
16
10
  })(["", ";letter-spacing:-0.1px;padding:14px 12px 8px;"], macro.h600);
17
- export var MenuGroupSubTitle = styled.h4.withConfig({
11
+ const MenuGroupSubTitle = /* @__PURE__ */ styled.h4.withConfig({
18
12
  displayName: "SubMenustyles__MenuGroupSubTitle",
19
13
  componentId: "sc-dperxu-2"
20
- })(["", ";letter-spacing:0.1px;color:", ";border-top:1px dashed ", ";margin:12px 12px 12px;padding-top:12px;text-transform:uppercase;"], macro.h100, function (props) {
21
- return props.theme.palette['grey-500'];
22
- }, function (props) {
23
- return props.theme.palette['grey-200'];
24
- });
14
+ })(["", ";letter-spacing:0.1px;color:", ";border-top:1px dashed ", ";margin:12px 12px 12px;padding-top:12px;text-transform:uppercase;"], macro.h100, (props) => props.theme.palette["grey-500"], (props) => props.theme.palette["grey-200"]);
15
+ export {
16
+ MenuGroupSubTitle,
17
+ MenuGroupTitle,
18
+ MenuGroupWrapper
19
+ };
@@ -1,5 +1,5 @@
1
- import { type CSSProperties, type ReactNode } from 'react';
2
- import type Item from './Item/Item';
1
+ import { CSSProperties, ReactNode } from 'react';
2
+ import { default as Item } from './Item/Item';
3
3
  import type * as S from './SubMenu.styles';
4
4
  export type SubMenuProps = {
5
5
  className?: string;
@@ -1 +1 @@
1
- export {};
1
+
@@ -1,3 +1,3 @@
1
- import { type SubMenuContextType } from './SubMenuContext.types';
2
- declare const SubMenuContext: import("react").Context<SubMenuContextType>;
1
+ import { SubMenuContextType } from './SubMenuContext.types';
2
+ declare const SubMenuContext: import('react').Context<SubMenuContextType>;
3
3
  export default SubMenuContext;
@@ -1,3 +1,5 @@
1
- import { createContext } from 'react';
2
- var SubMenuContext = /*#__PURE__*/createContext(undefined);
3
- export default SubMenuContext;
1
+ import { createContext } from "react";
2
+ const SubMenuContext = createContext(void 0);
3
+ export {
4
+ SubMenuContext as default
5
+ };
@@ -1 +1 @@
1
- export {};
1
+
@@ -1,9 +1,12 @@
1
- import { useContext } from 'react';
2
- import MenuContext from '../MenuContext/MenuContext';
3
- export var useMenu = function useMenu() {
4
- var menuContext = useContext(MenuContext);
1
+ import { useContext } from "react";
2
+ import MenuContext from "../MenuContext/MenuContext.js";
3
+ const useMenu = () => {
4
+ const menuContext = useContext(MenuContext);
5
5
  if (!menuContext) {
6
- throw new Error('Cannot use useMenu hook outside MenuContext');
6
+ throw new Error("Cannot use useMenu hook outside MenuContext");
7
7
  }
8
8
  return menuContext;
9
- };
9
+ };
10
+ export {
11
+ useMenu
12
+ };
@@ -1,9 +1,12 @@
1
- import { useContext } from 'react';
2
- import SubMenuContext from '../SubMenu/SubMenuContext/SubMenuContext';
3
- export var useSubMenu = function useSubMenu() {
4
- var subMenuContext = useContext(SubMenuContext);
1
+ import { useContext } from "react";
2
+ import SubMenuContext from "../SubMenu/SubMenuContext/SubMenuContext.js";
3
+ const useSubMenu = () => {
4
+ const subMenuContext = useContext(SubMenuContext);
5
5
  if (!subMenuContext) {
6
- throw new Error('Cannot use useMenu hook outside MenuContext');
6
+ throw new Error("Cannot use useMenu hook outside MenuContext");
7
7
  }
8
8
  return subMenuContext;
9
- };
9
+ };
10
+ export {
11
+ useSubMenu
12
+ };
package/dist/index.js CHANGED
@@ -1,3 +1,8 @@
1
- export { default } from './AppMenu';
2
- export { useMenu } from './hooks/useMenu';
3
- export { useSubMenu } from './hooks/useSubMenu';
1
+ import { default as default2 } from "./AppMenu.js";
2
+ import { useMenu } from "./hooks/useMenu.js";
3
+ import { useSubMenu } from "./hooks/useSubMenu.js";
4
+ export {
5
+ default2 as default,
6
+ useMenu,
7
+ useSubMenu
8
+ };
package/dist/modules.d.js CHANGED
@@ -1 +1 @@
1
- import '@testing-library/jest-dom';
1
+ import "@testing-library/jest-dom";
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-app-menu",
3
- "version": "1.2.9",
3
+ "version": "1.2.10",
4
4
  "description": "AppMenu UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -16,10 +16,10 @@
16
16
  "access": "public"
17
17
  },
18
18
  "scripts": {
19
- "build": "pnpm run build:js && pnpm run build:css && pnpm run defs",
19
+ "build": "vite build",
20
20
  "build:css": "node ../../../scripts/style/less.js",
21
21
  "build:js": "babel --delete-dir-on-start --root-mode upward src --out-dir dist --extensions '.js,.ts,.tsx'",
22
- "build:watch": "pnpm run build:js -- --watch",
22
+ "build:watch": "vite build --watch",
23
23
  "defs": "tsc --declaration --outDir dist/ --emitDeclarationOnly",
24
24
  "pack:ci": "pnpm pack --pack-destination ../../storybook/storybook-static/static",
25
25
  "prepublish": "pnpm run build",
@@ -35,10 +35,10 @@
35
35
  ],
36
36
  "types": "dist/index.d.ts",
37
37
  "dependencies": {
38
- "@synerise/ds-icon": "^1.15.0",
39
- "@synerise/ds-tooltip": "^1.4.9",
40
- "@synerise/ds-typography": "^1.1.12",
41
- "@synerise/ds-utils": "^1.7.0"
38
+ "@synerise/ds-icon": "^1.15.1",
39
+ "@synerise/ds-tooltip": "^1.4.10",
40
+ "@synerise/ds-typography": "^1.1.13",
41
+ "@synerise/ds-utils": "^1.7.1"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "@synerise/ds-core": "*",
@@ -46,5 +46,5 @@
46
46
  "styled-components": "^5.3.3",
47
47
  "vitest": "4"
48
48
  },
49
- "gitHead": "8efc031fa688c0b87c7b3915bae93546bb63bcac"
49
+ "gitHead": "e4ecca8944fc9b41c1b9d59c8bcad5e5e2013225"
50
50
  }