@manuscripts/style-guide 2.1.1 → 2.1.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.
@@ -58,6 +58,7 @@ exports.NestedSubmenusContainer = (0, styled_components_1.default)(exports.Subme
58
58
  position: absolute;
59
59
  top: 0;
60
60
  left: 100%;
61
+ overflow: visible;
61
62
  `;
62
63
  const Separator = styled_components_1.default.div `
63
64
  height: 0;
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useMenus = void 0;
4
4
  const react_1 = require("react");
5
5
  const menus_1 = require("../lib/menus");
6
- const initialPointer = [-1, -1, -1];
6
+ const initialPointer = [-1, -1, -1, -1];
7
7
  const transformPointer = (depth, index) => (pointer) => pointer.map((pointerPart, i) => {
8
8
  if (i === depth) {
9
9
  return index;
@@ -14,7 +14,8 @@ const transformPointer = (depth, index) => (pointer) => pointer.map((pointerPart
14
14
  return pointerPart;
15
15
  });
16
16
  const isPart = (pointer, position) => {
17
- const limit = position.length < 3 ? position.length : 3;
17
+ const max = initialPointer.length;
18
+ const limit = position.length < max ? position.length : max;
18
19
  for (let i = 0; i < limit; i++) {
19
20
  if (position[i] !== pointer[i]) {
20
21
  return false;
@@ -60,7 +61,7 @@ const useMenus = (menus) => {
60
61
  }
61
62
  if (menu.run) {
62
63
  menu.run();
63
- setPointer([-1, -1, -1]);
64
+ setPointer(initialPointer);
64
65
  }
65
66
  else if (menu.submenu) {
66
67
  const depth = indices.length - 1;
@@ -72,7 +73,7 @@ const useMenus = (menus) => {
72
73
  (0, react_1.useEffect)(() => {
73
74
  const handleClickOutside = (event) => {
74
75
  if (ref.current && !ref.current.contains(event.target)) {
75
- setPointer([-1, -1, -1]);
76
+ setPointer(initialPointer);
76
77
  }
77
78
  };
78
79
  document.addEventListener('click', handleClickOutside);
@@ -52,6 +52,7 @@ export const NestedSubmenusContainer = styled(SubmenusContainer) `
52
52
  position: absolute;
53
53
  top: 0;
54
54
  left: 100%;
55
+ overflow: visible;
55
56
  `;
56
57
  const Separator = styled.div `
57
58
  height: 0;
@@ -1,6 +1,6 @@
1
1
  import { useCallback, useEffect, useRef, useState } from 'react';
2
2
  import { isMenuSeparator, } from '../lib/menus';
3
- const initialPointer = [-1, -1, -1];
3
+ const initialPointer = [-1, -1, -1, -1];
4
4
  const transformPointer = (depth, index) => (pointer) => pointer.map((pointerPart, i) => {
5
5
  if (i === depth) {
6
6
  return index;
@@ -11,7 +11,8 @@ const transformPointer = (depth, index) => (pointer) => pointer.map((pointerPart
11
11
  return pointerPart;
12
12
  });
13
13
  const isPart = (pointer, position) => {
14
- const limit = position.length < 3 ? position.length : 3;
14
+ const max = initialPointer.length;
15
+ const limit = position.length < max ? position.length : max;
15
16
  for (let i = 0; i < limit; i++) {
16
17
  if (position[i] !== pointer[i]) {
17
18
  return false;
@@ -57,7 +58,7 @@ export const useMenus = (menus) => {
57
58
  }
58
59
  if (menu.run) {
59
60
  menu.run();
60
- setPointer([-1, -1, -1]);
61
+ setPointer(initialPointer);
61
62
  }
62
63
  else if (menu.submenu) {
63
64
  const depth = indices.length - 1;
@@ -69,7 +70,7 @@ export const useMenus = (menus) => {
69
70
  useEffect(() => {
70
71
  const handleClickOutside = (event) => {
71
72
  if (ref.current && !ref.current.contains(event.target)) {
72
- setPointer([-1, -1, -1]);
73
+ setPointer(initialPointer);
73
74
  }
74
75
  };
75
76
  document.addEventListener('click', handleClickOutside);
@@ -41,4 +41,4 @@ export type MenuSeparator = {
41
41
  role: 'separator';
42
42
  };
43
43
  export declare const isMenuSeparator: (menu: any) => menu is MenuSeparator;
44
- export type MenuPointer = [number, number, number];
44
+ export type MenuPointer = [number, number, number, number];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@manuscripts/style-guide",
3
3
  "description": "Shared components for Manuscripts applications",
4
- "version": "2.1.1",
4
+ "version": "2.1.2",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-style-guide",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",