@manuscripts/style-guide 2.0.36-LEAN-4311.0 → 2.0.36-LEAN-4311.1

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.
@@ -32,6 +32,7 @@ const MenuHeading = styled_components_1.default.div `
32
32
  `;
33
33
  const MenuContainer = styled_components_1.default.div `
34
34
  position: relative;
35
+ background: pink;
35
36
 
36
37
  & ${MenuHeading} {
37
38
  background-color: ${(props) => props.theme.colors.background.secondary};
@@ -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,7 @@ 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 limit = position.length < 4 ? position.length : 4;
18
18
  for (let i = 0; i < limit; i++) {
19
19
  if (position[i] !== pointer[i]) {
20
20
  return false;
@@ -60,7 +60,7 @@ const useMenus = (menus) => {
60
60
  }
61
61
  if (menu.run) {
62
62
  menu.run();
63
- setPointer([-1, -1, -1]);
63
+ setPointer(initialPointer);
64
64
  }
65
65
  else if (menu.submenu) {
66
66
  const depth = indices.length - 1;
@@ -72,7 +72,7 @@ const useMenus = (menus) => {
72
72
  (0, react_1.useEffect)(() => {
73
73
  const handleClickOutside = (event) => {
74
74
  if (ref.current && !ref.current.contains(event.target)) {
75
- setPointer([-1, -1, -1]);
75
+ setPointer(initialPointer);
76
76
  }
77
77
  };
78
78
  document.addEventListener('click', handleClickOutside);
@@ -26,6 +26,7 @@ const MenuHeading = styled.div `
26
26
  `;
27
27
  const MenuContainer = styled.div `
28
28
  position: relative;
29
+ background: pink;
29
30
 
30
31
  & ${MenuHeading} {
31
32
  background-color: ${(props) => props.theme.colors.background.secondary};
@@ -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,7 @@ 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 limit = position.length < 4 ? position.length : 4;
15
15
  for (let i = 0; i < limit; i++) {
16
16
  if (position[i] !== pointer[i]) {
17
17
  return false;
@@ -57,7 +57,7 @@ export const useMenus = (menus) => {
57
57
  }
58
58
  if (menu.run) {
59
59
  menu.run();
60
- setPointer([-1, -1, -1]);
60
+ setPointer(initialPointer);
61
61
  }
62
62
  else if (menu.submenu) {
63
63
  const depth = indices.length - 1;
@@ -69,7 +69,7 @@ export const useMenus = (menus) => {
69
69
  useEffect(() => {
70
70
  const handleClickOutside = (event) => {
71
71
  if (ref.current && !ref.current.contains(event.target)) {
72
- setPointer([-1, -1, -1]);
72
+ setPointer(initialPointer);
73
73
  }
74
74
  };
75
75
  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.0.36-LEAN-4311.0",
4
+ "version": "2.0.36-LEAN-4311.1",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-style-guide",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",