@manuscripts/style-guide 3.4.1 → 3.4.3

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.
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ /*!
3
+ * © 2026 Atypon Systems LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.butteryYellow = exports.wheatYellow = exports.zestOrange = exports.peppermintGreen = exports.springGreen = exports.killarneyGreen = exports.darkRed = exports.chablisRed = exports.mandysRed = exports.punchRed = exports.graphBlue1 = exports.focusBlue = exports.powderBlue = exports.aliceBlue = exports.jellyBeanBlue = exports.white = exports.alabasterGrey = exports.seashellGrey = exports.mercuryGrey = exports.greyLight = exports.greyMutedText = exports.greyMuted = exports.greyDark = exports.black = exports.manuscriptsSecondary = exports.manuscriptsXLight2 = exports.manuscriptsXLight = exports.manuscriptsLight = exports.manuscriptsIcons = exports.manuscriptsBlue = exports.manuscriptsBlueDark = void 0;
19
+ exports.manuscriptsBlueDark = '#0b6bb8';
20
+ exports.manuscriptsBlue = '#0d79d0';
21
+ exports.manuscriptsIcons = '#1a9bc7';
22
+ exports.manuscriptsLight = '#bce7f6';
23
+ exports.manuscriptsXLight = '#ddf3fa';
24
+ exports.manuscriptsXLight2 = '#f5fbfc';
25
+ exports.manuscriptsSecondary = '#ffbd26';
26
+ exports.black = '#000';
27
+ exports.greyDark = '#353535';
28
+ exports.greyMuted = '#6e6e6e';
29
+ exports.greyMutedText = '#c9c9c9';
30
+ exports.greyLight = '#c9c9c9';
31
+ exports.mercuryGrey = '#e2e2e2';
32
+ exports.seashellGrey = '#f2f2f2';
33
+ exports.alabasterGrey = '#fafafa';
34
+ exports.white = '#fff';
35
+ exports.jellyBeanBlue = '#2781a1';
36
+ exports.aliceBlue = '#f2fbfc';
37
+ exports.powderBlue = '#ddf3fa';
38
+ exports.focusBlue = '#3DADFF';
39
+ exports.graphBlue1 = '#20AEDF';
40
+ exports.punchRed = '#f35143';
41
+ exports.mandysRed = '#f5c1b7';
42
+ exports.chablisRed = '#fff1f0';
43
+ exports.darkRed = '#c74237';
44
+ exports.killarneyGreen = '#36b260';
45
+ exports.springGreen = '#b2c0ac';
46
+ exports.peppermintGreen = '#dff0d7';
47
+ exports.zestOrange = '#fe8f1f';
48
+ exports.wheatYellow = '#ffe0b2';
49
+ exports.butteryYellow = '#fffcdb';
@@ -34,7 +34,7 @@ const MenuContainer = styled_components_1.default.div `
34
34
  }
35
35
  }
36
36
  `;
37
- const Menus = ({ menus, innerRef, handleClick, closeAll, }) => {
37
+ const Menus = ({ menus, innerRef, handleClick, close, }) => {
38
38
  const menuHeadingsRef = (0, react_1.useRef)([]);
39
39
  (0, react_1.useEffect)(() => {
40
40
  menuHeadingsRef.current.forEach((heading, index) => {
@@ -71,7 +71,7 @@ const Menus = ({ menus, innerRef, handleClick, closeAll, }) => {
71
71
  case 'Escape': {
72
72
  event.preventDefault();
73
73
  event.stopPropagation();
74
- closeAll();
74
+ close();
75
75
  break;
76
76
  }
77
77
  case 'ArrowDown': {
@@ -96,7 +96,7 @@ const Menus = ({ menus, innerRef, handleClick, closeAll, }) => {
96
96
  e.preventDefault();
97
97
  handleClick([index]);
98
98
  }, isOpen: menu.isOpen, children: (0, jsx_runtime_1.jsx)(Submenu_1.Text, { children: menu.label }) }), menu.isEnabled && menu.isOpen && menu.submenu && ((0, jsx_runtime_1.jsx)(Submenu_1.SubmenusContainerWrapper, { children: (0, jsx_runtime_1.jsx)(Submenu_1.SubmenusContainer, { "data-submenu-container": true, tabIndex: -1, children: menu.submenu.map((submenu, sindex) => {
99
- return ((0, jsx_runtime_1.jsx)(Submenu_1.Submenu, { menu: submenu, handleClick: (i) => handleClick([index, sindex, ...i]), closeAll: closeAll }, `${index}-${sindex}`));
99
+ return ((0, jsx_runtime_1.jsx)(Submenu_1.Submenu, { menu: submenu, handleClick: (i) => handleClick([index, sindex, ...i]), close: close }, `${index}-${sindex}`));
100
100
  }) }) }))] }, `menu-${index}`));
101
101
  }) }));
102
102
  };
@@ -83,7 +83,7 @@ const Container = styled_components_1.default.div `
83
83
  }
84
84
  `;
85
85
  const activeContent = (menu) => (menu.isActive ? '✓' : '');
86
- const SubmenuLabel = ({ menu, handleClick, closeAll, }) => {
86
+ const SubmenuLabel = ({ menu, handleClick, close, }) => {
87
87
  if ((0, menus_1.isMenuSeparator)(menu)) {
88
88
  return null;
89
89
  }
@@ -132,17 +132,21 @@ const SubmenuLabel = ({ menu, handleClick, closeAll, }) => {
132
132
  case 'ArrowLeft': {
133
133
  const parentContainer = submenuContainer?.parentElement?.closest('[data-submenu-container]');
134
134
  if (parentContainer) {
135
+ if (menu.position) {
136
+ const currentDepth = menu.position.length - 2;
137
+ close(currentDepth);
138
+ }
135
139
  const parentLabel = parentContainer.querySelector(':scope > [data-submenu-item]');
136
140
  parentLabel?.focus();
137
141
  }
138
142
  else {
139
143
  focusMenuHeading();
140
- closeAll();
144
+ close();
141
145
  }
142
146
  break;
143
147
  }
144
148
  case 'Escape': {
145
- closeAll();
149
+ close();
146
150
  focusMenuHeading();
147
151
  break;
148
152
  }
@@ -160,16 +164,16 @@ const SubmenuLabel = ({ menu, handleClick, closeAll, }) => {
160
164
  }, onKeyDown: handleKeyDown, children: [(0, jsx_runtime_1.jsx)(Active, { children: activeContent(menu) }), (0, jsx_runtime_1.jsx)(exports.Text, { children: menu.label }), menu.submenu && (0, jsx_runtime_1.jsx)(Arrow, {}), menu.shortcut && (0, jsx_runtime_1.jsx)(Shortcut_1.Shortcut, { shortcut: menu.shortcut })] }));
161
165
  };
162
166
  exports.SubmenuLabel = SubmenuLabel;
163
- const Submenu = ({ menu, handleClick, closeAll, }) => {
167
+ const Submenu = ({ menu, handleClick, close, }) => {
164
168
  if ((0, menus_1.isMenuSeparator)(menu)) {
165
169
  return (0, jsx_runtime_1.jsx)(Separator, {});
166
170
  }
167
171
  if (menu.component) {
168
- return (0, jsx_runtime_1.jsx)(menu.component, { menu: menu, handleClick: handleClick, closeAll: closeAll });
172
+ return ((0, jsx_runtime_1.jsx)(menu.component, { menu: menu, handleClick: handleClick, close: close }));
169
173
  }
170
174
  if (!menu.submenu) {
171
- return ((0, jsx_runtime_1.jsx)(exports.SubmenuLabel, { menu: menu, handleClick: handleClick, closeAll: closeAll }));
175
+ return (0, jsx_runtime_1.jsx)(exports.SubmenuLabel, { menu: menu, handleClick: handleClick, close: close });
172
176
  }
173
- return ((0, jsx_runtime_1.jsxs)(exports.SubmenuContainer, { "data-cy": 'submenu', children: [(0, jsx_runtime_1.jsx)(exports.SubmenuLabel, { menu: menu, handleClick: handleClick, closeAll: closeAll }), menu.submenu && menu.isOpen && ((0, jsx_runtime_1.jsx)(exports.NestedSubmenusContainer, { "data-submenu-container": true, children: menu.submenu.map((submenu, index) => ((0, jsx_runtime_1.jsx)(exports.Submenu, { menu: submenu, handleClick: (i) => handleClick([index, ...i]), closeAll: closeAll }, `menu-${index}`))) }))] }));
177
+ return ((0, jsx_runtime_1.jsxs)(exports.SubmenuContainer, { "data-cy": 'submenu', children: [(0, jsx_runtime_1.jsx)(exports.SubmenuLabel, { menu: menu, handleClick: handleClick, close: close }), menu.submenu && menu.isOpen && ((0, jsx_runtime_1.jsx)(exports.NestedSubmenusContainer, { "data-submenu-container": true, children: menu.submenu.map((submenu, index) => ((0, jsx_runtime_1.jsx)(exports.Submenu, { menu: submenu, handleClick: (i) => handleClick([index, ...i]), close: close }, `menu-${index}`))) }))] }));
174
178
  };
175
179
  exports.Submenu = Submenu;
@@ -0,0 +1,235 @@
1
+ "use strict";
2
+ /*!
3
+ * © 2026 Atypon Systems LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ var desc = Object.getOwnPropertyDescriptor(m, k);
20
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
21
+ desc = { enumerable: true, get: function() { return m[k]; } };
22
+ }
23
+ Object.defineProperty(o, k2, desc);
24
+ }) : (function(o, m, k, k2) {
25
+ if (k2 === undefined) k2 = k;
26
+ o[k2] = m[k];
27
+ }));
28
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
29
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
30
+ }) : function(o, v) {
31
+ o["default"] = v;
32
+ });
33
+ var __importStar = (this && this.__importStar) || (function () {
34
+ var ownKeys = function(o) {
35
+ ownKeys = Object.getOwnPropertyNames || function (o) {
36
+ var ar = [];
37
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
38
+ return ar;
39
+ };
40
+ return ownKeys(o);
41
+ };
42
+ return function (mod) {
43
+ if (mod && mod.__esModule) return mod;
44
+ var result = {};
45
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
46
+ __setModuleDefault(result, mod);
47
+ return result;
48
+ };
49
+ })();
50
+ Object.defineProperty(exports, "__esModule", { value: true });
51
+ exports.defaultTheme = void 0;
52
+ const colors = __importStar(require("./colors"));
53
+ const fontFamily = '"Lato", sans-serif';
54
+ exports.defaultTheme = {
55
+ name: 'Manuscripts',
56
+ colors: {
57
+ background: {
58
+ primary: colors.white,
59
+ secondary: colors.alabasterGrey,
60
+ tertiary: colors.mercuryGrey,
61
+ fifth: colors.manuscriptsXLight2,
62
+ dark: 'rgba(0,0,0,0.5)',
63
+ error: colors.mandysRed,
64
+ info: colors.manuscriptsXLight2,
65
+ success: colors.peppermintGreen,
66
+ warning: colors.wheatYellow,
67
+ selected: colors.aliceBlue,
68
+ muted: colors.greyMuted,
69
+ tracked: {
70
+ active: colors.graphBlue1,
71
+ default: colors.greyLight,
72
+ hover: colors.greyLight,
73
+ },
74
+ },
75
+ border: {
76
+ error: colors.mandysRed,
77
+ info: colors.manuscriptsBlue,
78
+ success: colors.springGreen,
79
+ warning: colors.wheatYellow,
80
+ primary: colors.manuscriptsLight,
81
+ secondary: colors.mercuryGrey,
82
+ tertiary: colors.seashellGrey,
83
+ muted: colors.greyLight,
84
+ field: {
85
+ active: colors.manuscriptsLight,
86
+ default: colors.mercuryGrey,
87
+ hover: colors.manuscriptsLight,
88
+ },
89
+ tracked: {
90
+ active: colors.graphBlue1,
91
+ default: colors.greyLight,
92
+ hover: colors.greyLight,
93
+ },
94
+ },
95
+ brand: {
96
+ dark: colors.manuscriptsBlueDark,
97
+ medium: colors.manuscriptsIcons,
98
+ default: colors.manuscriptsBlue,
99
+ light: colors.manuscriptsLight,
100
+ xlight: colors.manuscriptsXLight,
101
+ secondary: colors.manuscriptsSecondary,
102
+ },
103
+ button: {
104
+ default: {
105
+ background: {
106
+ active: 'transparent',
107
+ default: 'transparent',
108
+ hover: colors.manuscriptsXLight2,
109
+ },
110
+ border: {
111
+ active: 'transparent',
112
+ default: 'transparent',
113
+ hover: colors.manuscriptsXLight2,
114
+ },
115
+ color: {
116
+ active: colors.manuscriptsBlue,
117
+ default: colors.manuscriptsBlue,
118
+ hover: colors.manuscriptsBlue,
119
+ },
120
+ },
121
+ primary: {
122
+ background: {
123
+ active: colors.manuscriptsBlueDark,
124
+ default: colors.manuscriptsBlue,
125
+ hover: colors.manuscriptsBlueDark,
126
+ },
127
+ border: {
128
+ active: colors.manuscriptsBlueDark,
129
+ default: colors.manuscriptsBlue,
130
+ hover: colors.manuscriptsBlueDark,
131
+ },
132
+ color: {
133
+ active: colors.white,
134
+ default: colors.white,
135
+ hover: colors.white,
136
+ },
137
+ },
138
+ secondary: {
139
+ background: {
140
+ active: colors.white,
141
+ default: colors.white,
142
+ hover: colors.white,
143
+ },
144
+ border: {
145
+ active: colors.mercuryGrey,
146
+ default: colors.mercuryGrey,
147
+ hover: colors.mercuryGrey,
148
+ },
149
+ color: {
150
+ active: colors.manuscriptsBlue,
151
+ default: colors.greyDark,
152
+ hover: colors.manuscriptsBlue,
153
+ },
154
+ },
155
+ error: {
156
+ background: {
157
+ active: colors.punchRed,
158
+ default: colors.punchRed,
159
+ hover: colors.darkRed,
160
+ },
161
+ border: {
162
+ active: colors.punchRed,
163
+ default: colors.punchRed,
164
+ hover: colors.darkRed,
165
+ },
166
+ color: {
167
+ active: colors.white,
168
+ default: colors.white,
169
+ hover: colors.white,
170
+ },
171
+ },
172
+ },
173
+ text: {
174
+ primary: colors.greyDark,
175
+ secondary: colors.greyMuted,
176
+ tertiary: colors.manuscriptsBlue,
177
+ muted: colors.greyLight,
178
+ onDark: colors.white,
179
+ onLight: colors.greyMuted,
180
+ error: colors.punchRed,
181
+ info: colors.jellyBeanBlue,
182
+ success: colors.killarneyGreen,
183
+ warning: colors.zestOrange,
184
+ },
185
+ outline: {
186
+ focus: colors.focusBlue,
187
+ },
188
+ },
189
+ font: {
190
+ family: {
191
+ sans: fontFamily,
192
+ serif: 'serif',
193
+ Lato: 'Lato',
194
+ },
195
+ size: {
196
+ xlarge: '20px',
197
+ large: '18px',
198
+ medium: '16px',
199
+ normal: '14px',
200
+ small: '12px',
201
+ },
202
+ lineHeight: {
203
+ large: '24px',
204
+ normal: '16px',
205
+ small: '14px',
206
+ },
207
+ weight: {
208
+ xbold: 900,
209
+ bold: 700,
210
+ semibold: 600,
211
+ medium: 500,
212
+ normal: 400,
213
+ light: 300,
214
+ xlight: 200,
215
+ },
216
+ },
217
+ grid: {
218
+ radius: {
219
+ default: '8px',
220
+ small: '4px',
221
+ rounder: '16px',
222
+ },
223
+ unit: 4,
224
+ mobile: 360,
225
+ tablet: 768,
226
+ smallDesktop: 1024,
227
+ desktop: 1280,
228
+ largeDesktop: 1920,
229
+ editorMaxWidth: 960,
230
+ },
231
+ shadow: {
232
+ boxShadow: '0 0 10px 0 rgba(0, 0, 0, 0.05)',
233
+ dropShadow: '0 4px 9px 0 rgba(84, 83, 83, 0.3)',
234
+ },
235
+ };
@@ -31,6 +31,7 @@ const getSubmenuState = (specs, pointer, position) => {
31
31
  const current = [...position, index];
32
32
  return {
33
33
  ...spec,
34
+ position: current,
34
35
  submenu: spec.submenu && getSubmenuState(spec.submenu, pointer, current),
35
36
  isOpen: isPart(pointer, current),
36
37
  };
@@ -41,6 +42,7 @@ const getMenuState = (specs, pointer) => {
41
42
  const position = [index];
42
43
  return {
43
44
  ...spec,
45
+ position,
44
46
  submenu: spec.submenu && getSubmenuState(spec.submenu, pointer, position),
45
47
  isOpen: isPart(pointer, position),
46
48
  };
@@ -89,13 +91,13 @@ const useMenus = (menus) => {
89
91
  document.removeEventListener('click', handleClickOutside);
90
92
  };
91
93
  }, []);
92
- const closeAll = (0, react_1.useCallback)(() => {
93
- setPointer(initialPointer);
94
+ const close = (0, react_1.useCallback)((depth) => {
95
+ setPointer(depth === undefined ? initialPointer : transformPointer(depth, -1));
94
96
  }, []);
95
97
  return {
96
98
  menus: state,
97
99
  handleClick,
98
- closeAll,
100
+ close,
99
101
  ref,
100
102
  };
101
103
  };
package/dist/cjs/index.js CHANGED
@@ -25,11 +25,36 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
25
25
  if (k2 === undefined) k2 = k;
26
26
  o[k2] = m[k];
27
27
  }));
28
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
29
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
30
+ }) : function(o, v) {
31
+ o["default"] = v;
32
+ });
33
+ var __importStar = (this && this.__importStar) || (function () {
34
+ var ownKeys = function(o) {
35
+ ownKeys = Object.getOwnPropertyNames || function (o) {
36
+ var ar = [];
37
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
38
+ return ar;
39
+ };
40
+ return ownKeys(o);
41
+ };
42
+ return function (mod) {
43
+ if (mod && mod.__esModule) return mod;
44
+ var result = {};
45
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
46
+ __setModuleDefault(result, mod);
47
+ return result;
48
+ };
49
+ })();
28
50
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
29
51
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
30
52
  };
31
53
  Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.useDeepCompareCallback = exports.useDeepCompareMemo = exports.ToggleIcon = exports.ToggleHeader = void 0;
54
+ exports.useDeepCompareCallback = exports.useDeepCompareMemo = exports.ToggleIcon = exports.ToggleHeader = exports.colors = exports.defaultTheme = void 0;
55
+ var defaultTheme_1 = require("./defaultTheme");
56
+ Object.defineProperty(exports, "defaultTheme", { enumerable: true, get: function () { return defaultTheme_1.defaultTheme; } });
57
+ exports.colors = __importStar(require("./colors"));
33
58
  __exportStar(require("./components/AlertMessage"), exports);
34
59
  __exportStar(require("./components/Message"), exports);
35
60
  __exportStar(require("./components/Button"), exports);
@@ -0,0 +1,46 @@
1
+ /*!
2
+ * © 2026 Atypon Systems LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export const manuscriptsBlueDark = '#0b6bb8';
17
+ export const manuscriptsBlue = '#0d79d0';
18
+ export const manuscriptsIcons = '#1a9bc7';
19
+ export const manuscriptsLight = '#bce7f6';
20
+ export const manuscriptsXLight = '#ddf3fa';
21
+ export const manuscriptsXLight2 = '#f5fbfc';
22
+ export const manuscriptsSecondary = '#ffbd26';
23
+ export const black = '#000';
24
+ export const greyDark = '#353535';
25
+ export const greyMuted = '#6e6e6e';
26
+ export const greyMutedText = '#c9c9c9';
27
+ export const greyLight = '#c9c9c9';
28
+ export const mercuryGrey = '#e2e2e2';
29
+ export const seashellGrey = '#f2f2f2';
30
+ export const alabasterGrey = '#fafafa';
31
+ export const white = '#fff';
32
+ export const jellyBeanBlue = '#2781a1';
33
+ export const aliceBlue = '#f2fbfc';
34
+ export const powderBlue = '#ddf3fa';
35
+ export const focusBlue = '#3DADFF';
36
+ export const graphBlue1 = '#20AEDF';
37
+ export const punchRed = '#f35143';
38
+ export const mandysRed = '#f5c1b7';
39
+ export const chablisRed = '#fff1f0';
40
+ export const darkRed = '#c74237';
41
+ export const killarneyGreen = '#36b260';
42
+ export const springGreen = '#b2c0ac';
43
+ export const peppermintGreen = '#dff0d7';
44
+ export const zestOrange = '#fe8f1f';
45
+ export const wheatYellow = '#ffe0b2';
46
+ export const butteryYellow = '#fffcdb';
@@ -28,7 +28,7 @@ const MenuContainer = styled.div `
28
28
  }
29
29
  }
30
30
  `;
31
- export const Menus = ({ menus, innerRef, handleClick, closeAll, }) => {
31
+ export const Menus = ({ menus, innerRef, handleClick, close, }) => {
32
32
  const menuHeadingsRef = useRef([]);
33
33
  useEffect(() => {
34
34
  menuHeadingsRef.current.forEach((heading, index) => {
@@ -65,7 +65,7 @@ export const Menus = ({ menus, innerRef, handleClick, closeAll, }) => {
65
65
  case 'Escape': {
66
66
  event.preventDefault();
67
67
  event.stopPropagation();
68
- closeAll();
68
+ close();
69
69
  break;
70
70
  }
71
71
  case 'ArrowDown': {
@@ -90,7 +90,7 @@ export const Menus = ({ menus, innerRef, handleClick, closeAll, }) => {
90
90
  e.preventDefault();
91
91
  handleClick([index]);
92
92
  }, isOpen: menu.isOpen, children: _jsx(Text, { children: menu.label }) }), menu.isEnabled && menu.isOpen && menu.submenu && (_jsx(SubmenusContainerWrapper, { children: _jsx(SubmenusContainer, { "data-submenu-container": true, tabIndex: -1, children: menu.submenu.map((submenu, sindex) => {
93
- return (_jsx(Submenu, { menu: submenu, handleClick: (i) => handleClick([index, sindex, ...i]), closeAll: closeAll }, `${index}-${sindex}`));
93
+ return (_jsx(Submenu, { menu: submenu, handleClick: (i) => handleClick([index, sindex, ...i]), close: close }, `${index}-${sindex}`));
94
94
  }) }) }))] }, `menu-${index}`));
95
95
  }) }));
96
96
  };
@@ -77,7 +77,7 @@ const Container = styled.div `
77
77
  }
78
78
  `;
79
79
  const activeContent = (menu) => (menu.isActive ? '✓' : '');
80
- export const SubmenuLabel = ({ menu, handleClick, closeAll, }) => {
80
+ export const SubmenuLabel = ({ menu, handleClick, close, }) => {
81
81
  if (isMenuSeparator(menu)) {
82
82
  return null;
83
83
  }
@@ -126,17 +126,21 @@ export const SubmenuLabel = ({ menu, handleClick, closeAll, }) => {
126
126
  case 'ArrowLeft': {
127
127
  const parentContainer = submenuContainer?.parentElement?.closest('[data-submenu-container]');
128
128
  if (parentContainer) {
129
+ if (menu.position) {
130
+ const currentDepth = menu.position.length - 2;
131
+ close(currentDepth);
132
+ }
129
133
  const parentLabel = parentContainer.querySelector(':scope > [data-submenu-item]');
130
134
  parentLabel?.focus();
131
135
  }
132
136
  else {
133
137
  focusMenuHeading();
134
- closeAll();
138
+ close();
135
139
  }
136
140
  break;
137
141
  }
138
142
  case 'Escape': {
139
- closeAll();
143
+ close();
140
144
  focusMenuHeading();
141
145
  break;
142
146
  }
@@ -153,15 +157,15 @@ export const SubmenuLabel = ({ menu, handleClick, closeAll, }) => {
153
157
  handleClick([]);
154
158
  }, onKeyDown: handleKeyDown, children: [_jsx(Active, { children: activeContent(menu) }), _jsx(Text, { children: menu.label }), menu.submenu && _jsx(Arrow, {}), menu.shortcut && _jsx(Shortcut, { shortcut: menu.shortcut })] }));
155
159
  };
156
- export const Submenu = ({ menu, handleClick, closeAll, }) => {
160
+ export const Submenu = ({ menu, handleClick, close, }) => {
157
161
  if (isMenuSeparator(menu)) {
158
162
  return _jsx(Separator, {});
159
163
  }
160
164
  if (menu.component) {
161
- return _jsx(menu.component, { menu: menu, handleClick: handleClick, closeAll: closeAll });
165
+ return (_jsx(menu.component, { menu: menu, handleClick: handleClick, close: close }));
162
166
  }
163
167
  if (!menu.submenu) {
164
- return (_jsx(SubmenuLabel, { menu: menu, handleClick: handleClick, closeAll: closeAll }));
168
+ return _jsx(SubmenuLabel, { menu: menu, handleClick: handleClick, close: close });
165
169
  }
166
- return (_jsxs(SubmenuContainer, { "data-cy": 'submenu', children: [_jsx(SubmenuLabel, { menu: menu, handleClick: handleClick, closeAll: closeAll }), menu.submenu && menu.isOpen && (_jsx(NestedSubmenusContainer, { "data-submenu-container": true, children: menu.submenu.map((submenu, index) => (_jsx(Submenu, { menu: submenu, handleClick: (i) => handleClick([index, ...i]), closeAll: closeAll }, `menu-${index}`))) }))] }));
170
+ return (_jsxs(SubmenuContainer, { "data-cy": 'submenu', children: [_jsx(SubmenuLabel, { menu: menu, handleClick: handleClick, close: close }), menu.submenu && menu.isOpen && (_jsx(NestedSubmenusContainer, { "data-submenu-container": true, children: menu.submenu.map((submenu, index) => (_jsx(Submenu, { menu: submenu, handleClick: (i) => handleClick([index, ...i]), close: close }, `menu-${index}`))) }))] }));
167
171
  };
@@ -0,0 +1,199 @@
1
+ /*!
2
+ * © 2026 Atypon Systems LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import * as colors from './colors';
17
+ const fontFamily = '"Lato", sans-serif';
18
+ export const defaultTheme = {
19
+ name: 'Manuscripts',
20
+ colors: {
21
+ background: {
22
+ primary: colors.white,
23
+ secondary: colors.alabasterGrey,
24
+ tertiary: colors.mercuryGrey,
25
+ fifth: colors.manuscriptsXLight2,
26
+ dark: 'rgba(0,0,0,0.5)',
27
+ error: colors.mandysRed,
28
+ info: colors.manuscriptsXLight2,
29
+ success: colors.peppermintGreen,
30
+ warning: colors.wheatYellow,
31
+ selected: colors.aliceBlue,
32
+ muted: colors.greyMuted,
33
+ tracked: {
34
+ active: colors.graphBlue1,
35
+ default: colors.greyLight,
36
+ hover: colors.greyLight,
37
+ },
38
+ },
39
+ border: {
40
+ error: colors.mandysRed,
41
+ info: colors.manuscriptsBlue,
42
+ success: colors.springGreen,
43
+ warning: colors.wheatYellow,
44
+ primary: colors.manuscriptsLight,
45
+ secondary: colors.mercuryGrey,
46
+ tertiary: colors.seashellGrey,
47
+ muted: colors.greyLight,
48
+ field: {
49
+ active: colors.manuscriptsLight,
50
+ default: colors.mercuryGrey,
51
+ hover: colors.manuscriptsLight,
52
+ },
53
+ tracked: {
54
+ active: colors.graphBlue1,
55
+ default: colors.greyLight,
56
+ hover: colors.greyLight,
57
+ },
58
+ },
59
+ brand: {
60
+ dark: colors.manuscriptsBlueDark,
61
+ medium: colors.manuscriptsIcons,
62
+ default: colors.manuscriptsBlue,
63
+ light: colors.manuscriptsLight,
64
+ xlight: colors.manuscriptsXLight,
65
+ secondary: colors.manuscriptsSecondary,
66
+ },
67
+ button: {
68
+ default: {
69
+ background: {
70
+ active: 'transparent',
71
+ default: 'transparent',
72
+ hover: colors.manuscriptsXLight2,
73
+ },
74
+ border: {
75
+ active: 'transparent',
76
+ default: 'transparent',
77
+ hover: colors.manuscriptsXLight2,
78
+ },
79
+ color: {
80
+ active: colors.manuscriptsBlue,
81
+ default: colors.manuscriptsBlue,
82
+ hover: colors.manuscriptsBlue,
83
+ },
84
+ },
85
+ primary: {
86
+ background: {
87
+ active: colors.manuscriptsBlueDark,
88
+ default: colors.manuscriptsBlue,
89
+ hover: colors.manuscriptsBlueDark,
90
+ },
91
+ border: {
92
+ active: colors.manuscriptsBlueDark,
93
+ default: colors.manuscriptsBlue,
94
+ hover: colors.manuscriptsBlueDark,
95
+ },
96
+ color: {
97
+ active: colors.white,
98
+ default: colors.white,
99
+ hover: colors.white,
100
+ },
101
+ },
102
+ secondary: {
103
+ background: {
104
+ active: colors.white,
105
+ default: colors.white,
106
+ hover: colors.white,
107
+ },
108
+ border: {
109
+ active: colors.mercuryGrey,
110
+ default: colors.mercuryGrey,
111
+ hover: colors.mercuryGrey,
112
+ },
113
+ color: {
114
+ active: colors.manuscriptsBlue,
115
+ default: colors.greyDark,
116
+ hover: colors.manuscriptsBlue,
117
+ },
118
+ },
119
+ error: {
120
+ background: {
121
+ active: colors.punchRed,
122
+ default: colors.punchRed,
123
+ hover: colors.darkRed,
124
+ },
125
+ border: {
126
+ active: colors.punchRed,
127
+ default: colors.punchRed,
128
+ hover: colors.darkRed,
129
+ },
130
+ color: {
131
+ active: colors.white,
132
+ default: colors.white,
133
+ hover: colors.white,
134
+ },
135
+ },
136
+ },
137
+ text: {
138
+ primary: colors.greyDark,
139
+ secondary: colors.greyMuted,
140
+ tertiary: colors.manuscriptsBlue,
141
+ muted: colors.greyLight,
142
+ onDark: colors.white,
143
+ onLight: colors.greyMuted,
144
+ error: colors.punchRed,
145
+ info: colors.jellyBeanBlue,
146
+ success: colors.killarneyGreen,
147
+ warning: colors.zestOrange,
148
+ },
149
+ outline: {
150
+ focus: colors.focusBlue,
151
+ },
152
+ },
153
+ font: {
154
+ family: {
155
+ sans: fontFamily,
156
+ serif: 'serif',
157
+ Lato: 'Lato',
158
+ },
159
+ size: {
160
+ xlarge: '20px',
161
+ large: '18px',
162
+ medium: '16px',
163
+ normal: '14px',
164
+ small: '12px',
165
+ },
166
+ lineHeight: {
167
+ large: '24px',
168
+ normal: '16px',
169
+ small: '14px',
170
+ },
171
+ weight: {
172
+ xbold: 900,
173
+ bold: 700,
174
+ semibold: 600,
175
+ medium: 500,
176
+ normal: 400,
177
+ light: 300,
178
+ xlight: 200,
179
+ },
180
+ },
181
+ grid: {
182
+ radius: {
183
+ default: '8px',
184
+ small: '4px',
185
+ rounder: '16px',
186
+ },
187
+ unit: 4,
188
+ mobile: 360,
189
+ tablet: 768,
190
+ smallDesktop: 1024,
191
+ desktop: 1280,
192
+ largeDesktop: 1920,
193
+ editorMaxWidth: 960,
194
+ },
195
+ shadow: {
196
+ boxShadow: '0 0 10px 0 rgba(0, 0, 0, 0.05)',
197
+ dropShadow: '0 4px 9px 0 rgba(84, 83, 83, 0.3)',
198
+ },
199
+ };
@@ -28,6 +28,7 @@ const getSubmenuState = (specs, pointer, position) => {
28
28
  const current = [...position, index];
29
29
  return {
30
30
  ...spec,
31
+ position: current,
31
32
  submenu: spec.submenu && getSubmenuState(spec.submenu, pointer, current),
32
33
  isOpen: isPart(pointer, current),
33
34
  };
@@ -38,6 +39,7 @@ const getMenuState = (specs, pointer) => {
38
39
  const position = [index];
39
40
  return {
40
41
  ...spec,
42
+ position,
41
43
  submenu: spec.submenu && getSubmenuState(spec.submenu, pointer, position),
42
44
  isOpen: isPart(pointer, position),
43
45
  };
@@ -86,13 +88,13 @@ export const useMenus = (menus) => {
86
88
  document.removeEventListener('click', handleClickOutside);
87
89
  };
88
90
  }, []);
89
- const closeAll = useCallback(() => {
90
- setPointer(initialPointer);
91
+ const close = useCallback((depth) => {
92
+ setPointer(depth === undefined ? initialPointer : transformPointer(depth, -1));
91
93
  }, []);
92
94
  return {
93
95
  menus: state,
94
96
  handleClick,
95
- closeAll,
97
+ close,
96
98
  ref,
97
99
  };
98
100
  };
package/dist/es/index.js CHANGED
@@ -13,6 +13,8 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ export { defaultTheme } from './defaultTheme';
17
+ export * as colors from './colors';
16
18
  export * from './components/AlertMessage';
17
19
  export * from './components/Message';
18
20
  export * from './components/Button';
@@ -0,0 +1,46 @@
1
+ /*!
2
+ * © 2026 Atypon Systems LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export declare const manuscriptsBlueDark = "#0b6bb8";
17
+ export declare const manuscriptsBlue = "#0d79d0";
18
+ export declare const manuscriptsIcons = "#1a9bc7";
19
+ export declare const manuscriptsLight = "#bce7f6";
20
+ export declare const manuscriptsXLight = "#ddf3fa";
21
+ export declare const manuscriptsXLight2 = "#f5fbfc";
22
+ export declare const manuscriptsSecondary = "#ffbd26";
23
+ export declare const black = "#000";
24
+ export declare const greyDark = "#353535";
25
+ export declare const greyMuted = "#6e6e6e";
26
+ export declare const greyMutedText = "#c9c9c9";
27
+ export declare const greyLight = "#c9c9c9";
28
+ export declare const mercuryGrey = "#e2e2e2";
29
+ export declare const seashellGrey = "#f2f2f2";
30
+ export declare const alabasterGrey = "#fafafa";
31
+ export declare const white = "#fff";
32
+ export declare const jellyBeanBlue = "#2781a1";
33
+ export declare const aliceBlue = "#f2fbfc";
34
+ export declare const powderBlue = "#ddf3fa";
35
+ export declare const focusBlue = "#3DADFF";
36
+ export declare const graphBlue1 = "#20AEDF";
37
+ export declare const punchRed = "#f35143";
38
+ export declare const mandysRed = "#f5c1b7";
39
+ export declare const chablisRed = "#fff1f0";
40
+ export declare const darkRed = "#c74237";
41
+ export declare const killarneyGreen = "#36b260";
42
+ export declare const springGreen = "#b2c0ac";
43
+ export declare const peppermintGreen = "#dff0d7";
44
+ export declare const zestOrange = "#fe8f1f";
45
+ export declare const wheatYellow = "#ffe0b2";
46
+ export declare const butteryYellow = "#fffcdb";
@@ -19,7 +19,7 @@ interface MenusProps {
19
19
  menus: Menu[];
20
20
  innerRef: Ref<HTMLDivElement>;
21
21
  handleClick: (position: number[]) => void;
22
- closeAll: () => void;
22
+ close: (depth?: number) => void;
23
23
  }
24
24
  export declare const Menus: React.FC<MenusProps>;
25
25
  export {};
@@ -23,7 +23,7 @@ export declare const NestedSubmenusContainer: import("styled-components").Styled
23
23
  export interface SubmenuProps {
24
24
  menu: Menu | MenuSeparator;
25
25
  handleClick: (position: number[]) => void;
26
- closeAll: () => void;
26
+ close: (depth?: number) => void;
27
27
  }
28
28
  export declare const SubmenuLabel: React.FC<SubmenuProps>;
29
29
  export declare const Submenu: React.FC<SubmenuProps>;
@@ -0,0 +1,17 @@
1
+ /*!
2
+ * © 2026 Atypon Systems LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { Theme } from './theme';
17
+ export declare const defaultTheme: Theme;
@@ -2,6 +2,6 @@ import { Menu, MenuSpec } from '../lib/menus';
2
2
  export declare const useMenus: (menus: MenuSpec[]) => {
3
3
  menus: Menu[];
4
4
  handleClick: (indices: number[]) => void;
5
- closeAll: () => void;
5
+ close: (depth?: number) => void;
6
6
  ref: import("react").RefObject<HTMLDivElement | null>;
7
7
  };
@@ -14,6 +14,8 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export { Theme } from './theme';
17
+ export { defaultTheme } from './defaultTheme';
18
+ export * as colors from './colors';
17
19
  export * from './components/AlertMessage';
18
20
  export * from './components/Message';
19
21
  export * from './components/Button';
@@ -21,7 +21,7 @@ export interface MenuShortcut {
21
21
  export interface MenuComponentProps {
22
22
  menu: Menu;
23
23
  handleClick: (position: number[]) => void;
24
- closeAll: () => void;
24
+ close: (depth?: number) => void;
25
25
  }
26
26
  export interface MenuSpec {
27
27
  id: string;
@@ -38,6 +38,7 @@ export interface MenuSpec {
38
38
  export interface Menu extends MenuSpec {
39
39
  isOpen: boolean;
40
40
  submenu?: (Menu | MenuSeparator)[];
41
+ position?: number[];
41
42
  }
42
43
  export type MenuSeparator = {
43
44
  role: 'separator';
@@ -82,10 +82,12 @@ interface Background {
82
82
  dark: string;
83
83
  selected: string;
84
84
  tracked: States;
85
+ muted: string;
85
86
  }
86
87
  interface Border {
87
88
  field: States;
88
89
  tracked: States;
90
+ muted: string;
89
91
  }
90
92
  interface Brand {
91
93
  dark: string;
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": "3.4.1",
4
+ "version": "3.4.3",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-style-guide",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",