@manuscripts/body-editor 3.12.2 → 3.12.4

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 (65) hide show
  1. package/dist/cjs/components/affiliations/AffiliationItem.js +7 -11
  2. package/dist/cjs/components/affiliations/AffiliationList.js +3 -5
  3. package/dist/cjs/components/affiliations/AffiliationsModal.js +13 -4
  4. package/dist/cjs/components/authors/AuthorList.js +4 -2
  5. package/dist/cjs/components/authors/AuthorsModal.js +10 -3
  6. package/dist/cjs/components/authors/DraggableAuthor.js +7 -11
  7. package/dist/cjs/components/awards/AwardForm.js +108 -100
  8. package/dist/cjs/components/hooks/use-debounce.js +15 -0
  9. package/dist/cjs/components/modal-drawer/GenericDrawerGroup.js +1 -0
  10. package/dist/cjs/components/references/CitationEditor.js +6 -7
  11. package/dist/cjs/components/references/ImportBibliographyForm.js +12 -3
  12. package/dist/cjs/components/references/ReferenceForm/PersonDropDown.js +1 -1
  13. package/dist/cjs/components/references/ReferenceForm/styled-components.js +12 -3
  14. package/dist/cjs/components/references/ReferenceSearch.js +2 -2
  15. package/dist/cjs/components/references/ReferenceSearchResults.js +58 -11
  16. package/dist/cjs/components/references/ReferenceSearchSection.js +3 -11
  17. package/dist/cjs/components/references/ReferencesModal.js +5 -4
  18. package/dist/cjs/components/toolbar/InsertTableDialog.js +11 -3
  19. package/dist/cjs/components/views/CrossReferenceItems.js +8 -14
  20. package/dist/cjs/components/views/FootnotesSelector.js +6 -6
  21. package/dist/cjs/components/views/InsertSpecialCharacter.js +24 -10
  22. package/dist/cjs/components/views/LinkForm.js +8 -1
  23. package/dist/cjs/lib/popper.js +4 -2
  24. package/dist/cjs/versions.js +1 -1
  25. package/dist/cjs/views/cross_reference_editable.js +1 -0
  26. package/dist/cjs/views/equation_editable.js +6 -0
  27. package/dist/cjs/views/footnote.js +6 -6
  28. package/dist/cjs/views/inline_equation_editable.js +6 -0
  29. package/dist/cjs/views/inline_footnote.js +1 -0
  30. package/dist/es/components/affiliations/AffiliationItem.js +8 -12
  31. package/dist/es/components/affiliations/AffiliationList.js +3 -5
  32. package/dist/es/components/affiliations/AffiliationsModal.js +14 -5
  33. package/dist/es/components/authors/AuthorList.js +4 -2
  34. package/dist/es/components/authors/AuthorsModal.js +11 -4
  35. package/dist/es/components/authors/DraggableAuthor.js +8 -12
  36. package/dist/es/components/awards/AwardForm.js +110 -102
  37. package/dist/es/components/hooks/use-debounce.js +15 -1
  38. package/dist/es/components/modal-drawer/GenericDrawerGroup.js +2 -1
  39. package/dist/es/components/references/CitationEditor.js +7 -8
  40. package/dist/es/components/references/ImportBibliographyForm.js +14 -5
  41. package/dist/es/components/references/ReferenceForm/PersonDropDown.js +1 -1
  42. package/dist/es/components/references/ReferenceForm/styled-components.js +13 -4
  43. package/dist/es/components/references/ReferenceSearch.js +3 -3
  44. package/dist/es/components/references/ReferenceSearchResults.js +26 -12
  45. package/dist/es/components/references/ReferenceSearchSection.js +4 -12
  46. package/dist/es/components/references/ReferencesModal.js +6 -5
  47. package/dist/es/components/toolbar/InsertTableDialog.js +11 -3
  48. package/dist/es/components/views/CrossReferenceItems.js +9 -15
  49. package/dist/es/components/views/FootnotesSelector.js +7 -7
  50. package/dist/es/components/views/InsertSpecialCharacter.js +25 -11
  51. package/dist/es/components/views/LinkForm.js +9 -2
  52. package/dist/es/lib/popper.js +4 -2
  53. package/dist/es/versions.js +1 -1
  54. package/dist/es/views/cross_reference_editable.js +1 -0
  55. package/dist/es/views/equation_editable.js +6 -0
  56. package/dist/es/views/footnote.js +6 -6
  57. package/dist/es/views/inline_equation_editable.js +6 -0
  58. package/dist/es/views/inline_footnote.js +1 -0
  59. package/dist/types/components/hooks/use-debounce.d.ts +1 -0
  60. package/dist/types/components/references/ReferenceForm/styled-components.d.ts +11 -1
  61. package/dist/types/components/references/ReferenceSearchResults.d.ts +20 -2
  62. package/dist/types/versions.d.ts +1 -1
  63. package/dist/types/views/footnote.d.ts +2 -2
  64. package/package.json +2 -2
  65. package/styles/popper.css +2 -0
@@ -14,13 +14,46 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
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
+ })();
17
50
  var __importDefault = (this && this.__importDefault) || function (mod) {
18
51
  return (mod && mod.__esModule) ? mod : { "default": mod };
19
52
  };
20
53
  Object.defineProperty(exports, "__esModule", { value: true });
21
54
  exports.ReferenceSearchResults = exports.ReferenceSearchResult = exports.ReferenceSearchResultsContainer = void 0;
22
55
  const style_guide_1 = require("@manuscripts/style-guide");
23
- const react_1 = __importDefault(require("react"));
56
+ const react_1 = __importStar(require("react"));
24
57
  const styled_components_1 = __importDefault(require("styled-components"));
25
58
  const ReferenceLine_1 = require("./ReferenceLine");
26
59
  const StatusIcon = styled_components_1.default.div `
@@ -42,12 +75,14 @@ const MoreButton = (0, styled_components_1.default)(style_guide_1.SecondaryButto
42
75
  margin-left: ${(props) => props.theme.grid.unit * 4}px;
43
76
  color: ${(props) => props.theme.colors.button.default.color.default};
44
77
  `;
45
- exports.ReferenceSearchResultsContainer = styled_components_1.default.div `
46
- padding: 0 ${(props) => props.theme.grid.unit * 4}px;
78
+ exports.ReferenceSearchResultsContainer = (0, style_guide_1.withListNavigation)(styled_components_1.default.div `
79
+ padding: ${(props) => props.theme.grid.unit * 2}px
80
+ ${(props) => props.theme.grid.unit * 4}px;
47
81
  flex: 1;
48
82
  overflow-y: auto;
49
- `;
50
- exports.ReferenceSearchResult = styled_components_1.default.div `
83
+ outline: none;
84
+ `);
85
+ exports.ReferenceSearchResult = (0, style_guide_1.withNavigableListItem)(styled_components_1.default.div `
51
86
  cursor: pointer;
52
87
  padding: ${(props) => props.theme.grid.unit * 2}px 0;
53
88
  display: flex;
@@ -55,10 +90,22 @@ exports.ReferenceSearchResult = styled_components_1.default.div `
55
90
  &:not(:last-of-type) {
56
91
  border-bottom: 1px solid #f6f6f6;
57
92
  }
58
- `;
59
- const ReferenceSearchResults = ({ items, total, isSelected, onSelect, onShowMore }) => (react_1.default.createElement(exports.ReferenceSearchResultsContainer, null,
60
- items.map((item) => (react_1.default.createElement(exports.ReferenceSearchResult, { onClick: () => onSelect(item), key: item.id, "data-cy": `${isSelected(item) ? 'selected-reference' : 'reference'}` },
61
- react_1.default.createElement(StatusIcon, null, isSelected(item) ? (react_1.default.createElement(style_guide_1.AddedIcon, { width: 24, height: 24 })) : (react_1.default.createElement(style_guide_1.AddIcon, { width: 24, height: 24 }))),
62
- react_1.default.createElement(ReferenceLine_1.ReferenceLine, { item: item })))),
63
- items.length < 25 && total > items.length ? (react_1.default.createElement(MoreButton, { onClick: onShowMore, "data-cy": 'more-button' }, "Show more")) : undefined));
93
+ `);
94
+ const ReferenceSearchResults = ({ items, total, isSelected, onSelect, onShowMore }) => {
95
+ const list = (0, react_1.useRef)(null);
96
+ const onExpandReferenceList = () => {
97
+ const element = list.current;
98
+ if (element) {
99
+ element.setAttribute('tabindex', '0');
100
+ element.focus();
101
+ element.setAttribute('tabindex', '-1');
102
+ }
103
+ onShowMore();
104
+ };
105
+ return (react_1.default.createElement(exports.ReferenceSearchResultsContainer, { ref: list },
106
+ items.map((item) => (react_1.default.createElement(exports.ReferenceSearchResult, { onClick: () => onSelect(item), key: item.id, "data-cy": `${isSelected(item) ? 'selected-reference' : 'reference'}` },
107
+ react_1.default.createElement(StatusIcon, null, isSelected(item) ? (react_1.default.createElement(style_guide_1.AddedIcon, { width: 24, height: 24 })) : (react_1.default.createElement(style_guide_1.AddIcon, { width: 24, height: 24 }))),
108
+ react_1.default.createElement(ReferenceLine_1.ReferenceLine, { item: item })))),
109
+ items.length < 25 && total > items.length ? (react_1.default.createElement(MoreButton, { onClick: onExpandReferenceList, "data-cy": 'more-button' }, "Show more")) : undefined));
110
+ };
64
111
  exports.ReferenceSearchResults = ReferenceSearchResults;
@@ -57,19 +57,11 @@ const react_1 = __importStar(require("react"));
57
57
  const styled_components_1 = __importDefault(require("styled-components"));
58
58
  const ReferenceSearchResults_1 = require("./ReferenceSearchResults");
59
59
  const ReferenceSearchResultsPlaceholder_1 = require("./ReferenceSearchResultsPlaceholder");
60
- const SearchSourceLabel = styled_components_1.default.div `
61
- margin: 0 ${(props) => props.theme.grid.unit * 4}px
60
+ const SearchSourceLabel = (0, styled_components_1.default)(style_guide_1.IconTextButton) `
61
+ margin: ${(props) => props.theme.grid.unit * 2}px
62
+ ${(props) => props.theme.grid.unit * 4}px
62
63
  ${(props) => props.theme.grid.unit * 2}px;
63
64
  color: ${(props) => props.theme.colors.text.secondary};
64
- cursor: pointer;
65
-
66
- display: flex;
67
- align-items: center;
68
-
69
- .icon {
70
- margin-left: 8px;
71
- margin-right: 13px;
72
- }
73
65
 
74
66
  &:hover {
75
67
  color: ${(props) => props.theme.colors.text.muted};
@@ -52,10 +52,11 @@ const ReferencesSidebar = (0, styled_components_1.default)(style_guide_1.ModalSi
52
52
  const ReferencesSidebarContent = (0, styled_components_1.default)(style_guide_1.SidebarContent) `
53
53
  overflow-y: auto;
54
54
  `;
55
- const ReferencesInnerWrapper = styled_components_1.default.div `
55
+ const ReferencesInnerWrapper = (0, style_guide_1.withListNavigation)(styled_components_1.default.div `
56
56
  width: 100%;
57
- `;
58
- const ReferenceButton = styled_components_1.default.div `
57
+ padding: 12px 0;
58
+ `);
59
+ const ReferenceButton = (0, style_guide_1.withNavigableListItem)(styled_components_1.default.div `
59
60
  cursor: pointer;
60
61
  display: flex;
61
62
  justify-content: flex-start;
@@ -82,7 +83,7 @@ const ReferenceButton = styled_components_1.default.div `
82
83
  padding: ${(props) => props.theme.grid.unit * 2}px;
83
84
  border-radius: 6px;
84
85
  }
85
- `;
86
+ `);
86
87
  const IconContainer = styled_components_1.default.div `
87
88
  padding-right: ${(props) => props.theme.grid.unit * 5}px;
88
89
  position: relative;
@@ -77,7 +77,15 @@ const OptionWrapper = styled_components_1.default.div `
77
77
  padding-top: ${(props) => props.theme.grid.unit * 2}px;
78
78
  padding-bottom: ${(props) => props.theme.grid.unit * 2}px;
79
79
 
80
- background-color: ${(props) => props.focused ? props.theme.colors.background.fifth : 'transparent'};
80
+ background-color: ${(props) => {
81
+ if (props.selected) {
82
+ return props.theme.colors.background.selected;
83
+ }
84
+ if (props.focused) {
85
+ return props.theme.colors.background.fifth;
86
+ }
87
+ return 'transparent';
88
+ }};
81
89
 
82
90
  &:hover {
83
91
  background-color: ${(props) => props.theme.colors.background.fifth};
@@ -98,8 +106,8 @@ const InsertTableDialog = ({ state, dispatch, }) => {
98
106
  value: index + 1,
99
107
  label: `${index + 1}`,
100
108
  }));
101
- const OptionComponent = ({ innerProps, data, }) => {
102
- return (react_1.default.createElement(OptionWrapper, { ...innerProps, ref: null }, data.label));
109
+ const OptionComponent = ({ innerProps, data, innerRef, isFocused, isSelected, }) => {
110
+ return (react_1.default.createElement(OptionWrapper, { ...innerProps, ref: innerRef, focused: isFocused, selected: isSelected }, data.label));
103
111
  };
104
112
  const actions = {
105
113
  primary: {
@@ -55,27 +55,26 @@ exports.CrossReferenceItems = void 0;
55
55
  const style_guide_1 = require("@manuscripts/style-guide");
56
56
  const react_1 = __importStar(require("react"));
57
57
  const styled_components_1 = __importDefault(require("styled-components"));
58
- const Container = styled_components_1.default.div `
58
+ const Container = (0, style_guide_1.withFocusTrap)(styled_components_1.default.div `
59
59
  padding: ${(props) => props.theme.grid.unit * 3}px
60
60
  ${(props) => props.theme.grid.unit * 4}px;
61
61
  display: flex;
62
62
  flex-direction: column;
63
63
  max-height: 60vh;
64
64
  overflow: hidden;
65
- `;
65
+ `);
66
66
  const Actions = styled_components_1.default.div `
67
67
  display: flex;
68
68
  align-items: center;
69
69
  justify-content: flex-end;
70
70
  flex-shrink: 0;
71
71
  `;
72
- const Items = styled_components_1.default.div `
72
+ const Items = (0, style_guide_1.withListNavigation)(styled_components_1.default.div `
73
73
  flex: 1;
74
74
  overflow-y: auto;
75
- margin: ${(props) => props.theme.grid.unit * 4}px 0;
76
- `;
77
- const CrossReferenceItem = styled_components_1.default.div `
78
- position: relative;
75
+ padding: ${(props) => props.theme.grid.unit * 3}px;
76
+ `);
77
+ const CrossReferenceItem = (0, style_guide_1.withNavigableListItem)(styled_components_1.default.div `
79
78
  cursor: pointer;
80
79
  padding: ${(props) => props.theme.grid.unit * 4}px;
81
80
  background-color: ${(props) => props.isSelected
@@ -87,17 +86,12 @@ const CrossReferenceItem = styled_components_1.default.div `
87
86
  ? props.theme.colors.brand.medium
88
87
  : props.theme.colors.border.secondary};
89
88
  border-width: 1px 0;
90
- margin-top: -1px;
91
89
  z-index: ${(props) => (props.isSelected ? '1' : '0')};
92
90
 
93
- &:first-child {
94
- margin-top: 0;
95
- }
96
-
97
91
  &:hover {
98
92
  background-color: ${(props) => props.theme.colors.background.selected};
99
93
  }
100
- `;
94
+ `);
101
95
  const Label = styled_components_1.default.span `
102
96
  color: ${(props) => props.theme.colors.text.primary};
103
97
  `;
@@ -144,7 +138,7 @@ const CrossReferenceItems = ({ targets, handleSelect, handleCancel, currentTarge
144
138
  }, [currentTargetId]);
145
139
  return (react_1.default.createElement(Container, null,
146
140
  react_1.default.createElement(Heading, null, "Insert Cross-reference"),
147
- react_1.default.createElement(Items, null, targets.length ? (targets.map((target) => (react_1.default.createElement(CrossReferenceItem, { key: target.id, isSelected: selectedItem === target.id, onMouseDown: () => setSelectedItem(target.id) },
141
+ react_1.default.createElement(Items, null, targets.length ? (targets.map((target) => (react_1.default.createElement(CrossReferenceItem, { key: target.id, isSelected: selectedItem === target.id, onClick: () => setSelectedItem(target.id) },
148
142
  react_1.default.createElement(DefaultLabelWrapper, null,
149
143
  react_1.default.createElement(Label, null, target.label),
150
144
  react_1.default.createElement(Caption, null, target.caption && ': ' + trimmedCaption(target.caption, 200))),
@@ -68,10 +68,10 @@ const Actions = (0, styled_components_1.default)(style_guide_1.ButtonGroup) `
68
68
  justify-content: space-between;
69
69
  padding: ${(props) => props.theme.grid.unit * 4}px;
70
70
  `;
71
- const Container = styled_components_1.default.div `
71
+ const Container = (0, style_guide_1.withFocusTrap)(styled_components_1.default.div `
72
72
  flex: 1;
73
73
  font-family: ${(props) => props.theme.font.family.sans};
74
- `;
74
+ `);
75
75
  const AddNewFootnote = (0, styled_components_1.default)(style_guide_1.ButtonGroup) `
76
76
  button {
77
77
  margin-right: ${(props) => props.theme.grid.unit * 8}px;
@@ -153,17 +153,17 @@ const Separator = styled_components_1.default.div `
153
153
  border-bottom: 1px solid #e2e2e2;
154
154
  margin: 4px 0;
155
155
  `;
156
- const NotesListContainer = styled_components_1.default.div `
156
+ const NotesListContainer = (0, style_guide_1.withListNavigation)(styled_components_1.default.div `
157
157
  padding: ${(props) => props.theme.grid.unit * 6}px
158
158
  ${(props) => props.theme.grid.unit * 5}px;
159
159
  flex: 1;
160
160
  overflow-y: auto;
161
- `;
162
- const FootnoteItemContainer = styled_components_1.default.div `
161
+ `);
162
+ const FootnoteItemContainer = (0, style_guide_1.withNavigableListItem)(styled_components_1.default.div `
163
163
  cursor: pointer;
164
164
  padding: ${(props) => props.theme.grid.unit * 2}px 0;
165
165
  display: flex;
166
- `;
166
+ `);
167
167
  const StatusIcon = styled_components_1.default.div `
168
168
  flex-shrink: 1;
169
169
  margin-right: ${(props) => props.theme.grid.unit * 3}px;
@@ -78,8 +78,8 @@ const InsertSpecialCharacterDialog = ({ view }) => {
78
78
  react_1.default.createElement(ButtonsContainer, null,
79
79
  react_1.default.createElement(style_guide_1.PrimaryButton, { onClick: handleClose }, "Close")))))));
80
80
  };
81
- const OptionComponent = ({ innerProps, data, }) => {
82
- return (react_1.default.createElement(OptionWrapper, { ...innerProps, ref: null }, data.label));
81
+ const OptionComponent = ({ innerProps, innerRef, data, isFocused, isSelected, }) => {
82
+ return (react_1.default.createElement(OptionWrapper, { ...innerProps, ref: innerRef, focused: isFocused, selected: isSelected }, data.label));
83
83
  };
84
84
  const Container = (0, styled_components_1.default)(style_guide_1.ModalContainer) `
85
85
  padding: 8px;
@@ -103,7 +103,15 @@ const OptionWrapper = styled_components_1.default.div `
103
103
  padding-top: ${(props) => props.theme.grid.unit * 2}px;
104
104
  padding-bottom: ${(props) => props.theme.grid.unit * 2}px;
105
105
 
106
- background-color: ${(props) => props.focused ? props.theme.colors.background.fifth : 'transparent'};
106
+ background-color: ${(props) => {
107
+ if (props.selected) {
108
+ return props.theme.colors.background.selected;
109
+ }
110
+ if (props.focused) {
111
+ return props.theme.colors.background.fifth;
112
+ }
113
+ return 'transparent';
114
+ }};
107
115
 
108
116
  &:hover {
109
117
  background-color: ${(props) => props.theme.colors.background.fifth};
@@ -113,19 +121,20 @@ const CharactersSetContainer = styled_components_1.default.div `
113
121
  flex: 1;
114
122
  overflow-y: scroll;
115
123
  margin: 18px 0;
116
- border: 1px solid #ddd;
124
+ padding: 8px;
117
125
  `;
118
- const CharactersSet = (0, styled_components_1.default)(style_guide_1.IconButtonGroup) `
126
+ const CharactersSet = (0, style_guide_1.withListNavigation)((0, styled_components_1.default)(style_guide_1.IconButtonGroup) `
119
127
  display: grid;
120
128
  grid-template-columns: repeat(auto-fit, minmax(28px, max-content));
121
- height: ${(props) => props.theme.grid.unit * 8}px;
122
- `;
123
- const Character = (0, styled_components_1.default)(style_guide_1.IconButton) `
129
+ border: 1px solid #ddd;
130
+ `);
131
+ const Character = (0, style_guide_1.withNavigableListItem)((0, styled_components_1.default)(style_guide_1.IconButton) `
124
132
  border-bottom: 1px solid #ddd;
125
133
  border-right: 1px solid #ddd;
126
134
  border-radius: unset;
127
135
 
128
- :hover {
136
+ :hover,
137
+ :focus {
129
138
  background-color: #f0f0f0 !important;
130
139
  }
131
140
 
@@ -135,7 +144,12 @@ const Character = (0, styled_components_1.default)(style_guide_1.IconButton) `
135
144
  border-bottom: 1px solid #ddd !important;
136
145
  border-right: 1px solid #ddd !important;
137
146
  }
138
- `;
147
+
148
+ &&:not([disabled]):focus-visible {
149
+ outline: 1px solid ${(props) => props.theme.colors.outline.focus};
150
+ outline-offset: 2px;
151
+ }
152
+ `);
139
153
  const openInsertSpecialCharacterDialog = (view) => {
140
154
  if (!view) {
141
155
  return;
@@ -83,6 +83,7 @@ const RemoveButton = (0, styled_components_1.default)(style_guide_1.SecondaryBut
83
83
  exports.Open = styled_components_1.default.a `
84
84
  display: inline-block;
85
85
  margin-left: ${(props) => props.theme.grid.unit * 2}px;
86
+ margin-top: 4px;
86
87
  text-transform: uppercase;
87
88
  color: inherit;
88
89
  font-size: ${(props) => props.theme.font.size.small};
@@ -92,7 +93,13 @@ exports.Open = styled_components_1.default.a `
92
93
  content: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAQElEQVR42qXKwQkAIAxDUUdxtO6/RBQkQZvSi8I/pL4BoGw/XPkh4XigPmsUgh0626AjRsgxHTkUThsG2T/sIlzdTsp52kSS1wAAAABJRU5ErkJggg==);
93
94
  margin-left: 4px;
94
95
  }
96
+
97
+ &&:not([disabled]):focus-visible {
98
+ outline: 2px solid ${(props) => props.theme.colors.outline.focus};
99
+ outline-offset: 3px;
100
+ }
95
101
  `;
102
+ const Form = (0, style_guide_1.withFocusTrap)(styled_components_1.default.form ``);
96
103
  const LinkForm = ({ onCancel, onRemove, onSave, value, }) => {
97
104
  const [href, setHref] = (0, react_1.useState)(value.href);
98
105
  const [text, setText] = (0, react_1.useState)(value.text);
@@ -132,7 +139,7 @@ const LinkForm = ({ onCancel, onRemove, onSave, value, }) => {
132
139
  onSave({ href, text, title });
133
140
  }
134
141
  }, [href, text, title, onSave, validate]);
135
- return (react_1.default.createElement("form", { onSubmit: handleSubmit, noValidate: true },
142
+ return (react_1.default.createElement(Form, { onSubmit: handleSubmit, noValidate: true },
136
143
  react_1.default.createElement(style_guide_1.FormContainer, null,
137
144
  react_1.default.createElement(style_guide_1.FormRow, null,
138
145
  react_1.default.createElement("div", { style: { display: 'flex', alignItems: 'center', gap: '8px' } },
@@ -40,11 +40,13 @@ class PopperManager {
40
40
  this.triggerElement.focus();
41
41
  }
42
42
  };
43
+ const isMenu = contents.classList.contains('context-menu') ||
44
+ contents.classList.contains('menu');
43
45
  (0, navigation_utils_1.createKeyboardInteraction)({
44
46
  container,
45
47
  additionalKeys: {
46
48
  Escape: closeAndRestoreFocus,
47
- Tab: closeAndRestoreFocus,
49
+ Tab: isMenu ? closeAndRestoreFocus : undefined,
48
50
  },
49
51
  });
50
52
  if (showArrow) {
@@ -116,7 +118,7 @@ class PopperManager {
116
118
  return;
117
119
  }
118
120
  if (autoFocus) {
119
- const button = container.querySelector('button:not([disabled])');
121
+ const button = container.querySelector('button:not([disabled]), [tabindex]:not([tabindex="-1"])');
120
122
  button?.focus();
121
123
  }
122
124
  }
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MATHJAX_VERSION = exports.VERSION = void 0;
4
- exports.VERSION = '3.12.2';
4
+ exports.VERSION = '3.12.4';
5
5
  exports.MATHJAX_VERSION = '3.2.2';
@@ -45,6 +45,7 @@ class CrossReferenceEditableView extends cross_reference_1.CrossReferenceView {
45
45
  currentCustomLabel: this.node.attrs.label,
46
46
  };
47
47
  this.popperContainer = (0, ReactSubView_1.default)(this.props, CrossReferenceItems_1.CrossReferenceItems, componentProps, this.node, this.getPos, this.view, ['cross-reference-editor']);
48
+ this.popperContainer.setAttribute('tabindex', '0');
48
49
  this.props.popper.show(this.dom, this.popperContainer, 'auto');
49
50
  };
50
51
  this.destroy = () => {
@@ -66,6 +66,12 @@ class EquationEditableView extends equation_1.EquationView {
66
66
  mode: 'stex',
67
67
  placeholder,
68
68
  autofocus: true,
69
+ extraKeys: {
70
+ Esc: () => {
71
+ this.props.popper.destroy();
72
+ this.view.focus();
73
+ },
74
+ },
69
75
  });
70
76
  input.on('changes', async () => {
71
77
  const contents = input.getValue();
@@ -41,15 +41,15 @@ class FootnoteView extends base_node_view_1.BaseNodeView {
41
41
  this.dom.tabIndex = 0;
42
42
  this.contentDOM = document.createElement('div');
43
43
  this.contentDOM.classList.add('footnote-text');
44
- this.dom.addEventListener('mousedown', this.handleClick);
45
- this.dom.addEventListener('keydown', (0, navigation_utils_1.handleEnterKey)(this.handleClick));
44
+ this.dom.addEventListener('mousedown', (e) => this.handleClick(e, false));
45
+ this.dom.addEventListener('keydown', (0, navigation_utils_1.handleEnterKey)((e) => this.handleClick(e, true)));
46
46
  this.updateContents();
47
47
  };
48
- this.handleClick = (event) => {
48
+ this.handleClick = (event, fromKeyboard = false) => {
49
49
  const element = event.target;
50
50
  const item = element.closest('.footnote');
51
51
  if (item) {
52
- this.showContextMenu(item);
52
+ this.showContextMenu(item, fromKeyboard);
53
53
  }
54
54
  };
55
55
  this.handleMarkerClick = (e) => {
@@ -140,7 +140,7 @@ class FootnoteView extends base_node_view_1.BaseNodeView {
140
140
  const fn = (0, footnotes_1.getFootnotesElementState)(this.view.state, id);
141
141
  return { id, fn };
142
142
  }
143
- showContextMenu(element) {
143
+ showContextMenu(element, autoFocus) {
144
144
  this.props.popper.destroy();
145
145
  const can = this.props.getCapabilities();
146
146
  const { id, fn } = this.getFootnoteState();
@@ -162,7 +162,7 @@ class FootnoteView extends base_node_view_1.BaseNodeView {
162
162
  });
163
163
  }
164
164
  this.contextMenu = (0, ReactSubView_1.default)(this.props, style_guide_1.ContextMenu, componentProps, this.node, this.getPos, this.view, ['context-menu', 'footnote-context-menu']);
165
- this.props.popper.show(element, this.contextMenu, 'right-start');
165
+ this.props.popper.show(element, this.contextMenu, 'right-start', true, [], autoFocus);
166
166
  }
167
167
  }
168
168
  exports.FootnoteView = FootnoteView;
@@ -66,6 +66,12 @@ class InlineEquationEditableView extends inline_equation_1.InlineEquationView {
66
66
  mode: 'stex',
67
67
  placeholder,
68
68
  autofocus: true,
69
+ extraKeys: {
70
+ Esc: () => {
71
+ this.props.popper.destroy();
72
+ this.view.focus();
73
+ },
74
+ },
69
75
  });
70
76
  input.on('changes', async () => {
71
77
  const contents = input.getValue();
@@ -104,6 +104,7 @@ class InlineFootnoteView extends base_node_view_1.BaseNodeView {
104
104
  onInsert: this.handleInsert,
105
105
  };
106
106
  this.popperContainer = (0, ReactSubView_1.default)(this.props, FootnotesSelector_1.FootnotesSelector, props, this.node, this.getPos, this.view, ['footnote-editor']);
107
+ this.popperContainer.setAttribute('tabindex', '0');
107
108
  this.props.popper.show(this.dom, this.popperContainer, 'auto', false);
108
109
  };
109
110
  this.initialise = () => {
@@ -1,7 +1,7 @@
1
- import { AffiliationIcon, CrclTickAnimation, DeleteIcon, } from '@manuscripts/style-guide';
1
+ import { AffiliationIcon, CrclTickAnimation, DeleteIcon, SecondaryIconButton, withNavigableListItem, } from '@manuscripts/style-guide';
2
2
  import React, { useRef } from 'react';
3
3
  import styled from 'styled-components';
4
- const AffiliationContainer = styled.div `
4
+ const AffiliationContainer = withNavigableListItem(styled.div `
5
5
  padding: ${(props) => props.theme.grid.unit * 2}px 0
6
6
  ${(props) => props.theme.grid.unit * 2}px;
7
7
  display: flex;
@@ -19,7 +19,7 @@ const AffiliationContainer = styled.div `
19
19
  &.active {
20
20
  border-color: ${(props) => props.theme.colors.border.primary};
21
21
  }
22
- `;
22
+ `);
23
23
  const AffiliationName = styled.div `
24
24
  margin-left: 12px;
25
25
  flex: 1;
@@ -43,15 +43,11 @@ const AffiliationBox = styled.div `
43
43
  flex-direction: column;
44
44
  margin-left: 4px;
45
45
  `;
46
- const RemoveButton = styled.div `
47
- display: flex;
48
- align-items: center;
49
- margin-right: 8px;
46
+ const RemoveButton = styled(SecondaryIconButton) `
50
47
  svg {
51
- cursor: pointer;
52
- }
53
- .icon_element {
54
- fill: #6e6e6e;
48
+ path[fill='white'] {
49
+ fill: white;
50
+ }
55
51
  }
56
52
  `;
57
53
  export const AffiliationItem = ({ affiliation, isSelected, onClick, onDelete, showSuccessIcon, }) => {
@@ -75,6 +71,6 @@ export const AffiliationItem = ({ affiliation, isSelected, onClick, onDelete, sh
75
71
  affiliation.country ? ', ' : '')),
76
72
  affiliation.country && React.createElement(React.Fragment, null, affiliation.country))),
77
73
  showSuccessIcon && (React.createElement(CrclTickAnimation, { size: 36, style: { position: 'absolute', left: '10px' } })),
78
- isSelected && (React.createElement(RemoveButton, { onClick: () => onDelete(), "data-tooltip-content": "Delete" },
74
+ isSelected && (React.createElement(RemoveButton, { size: 13, onClick: () => onDelete(), "data-tooltip-content": "Delete" },
79
75
  React.createElement(DeleteIcon, { fill: '#6E6E6E' })))));
80
76
  };
@@ -16,18 +16,16 @@
16
16
  import React from 'react';
17
17
  import styled from 'styled-components';
18
18
  import { AffiliationItem } from './AffiliationItem';
19
- const AffiliationListContainer = styled.div `
19
+ import { withListNavigation } from '@manuscripts/style-guide';
20
+ const AffiliationListContainer = withListNavigation(styled.div `
20
21
  flex: 1;
21
22
  overflow-y: visible;
22
- margin-left: 16px;
23
- `;
23
+ `);
24
24
  const AffiliationListTitle = styled.h2 `
25
25
  color: #6e6e6e;
26
26
  font-size: 18px;
27
27
  font-weight: 400;
28
28
  line-height: 24px;
29
- margin-left: 14px;
30
- margin-top: 20px;
31
29
  `;
32
30
  export const AffiliationList = ({ affiliation, affiliations, onSelect, onDelete, lastSavedAffiliationId, }) => {
33
31
  return (React.createElement(React.Fragment, null,
@@ -1,4 +1,4 @@
1
- import { AddIcon, AddUserIcon, AffiliationPlaceholderIcon, CloseButton, InspectorTab, InspectorTabList, InspectorTabPanel, InspectorTabPanels, InspectorTabs, ModalBody, ModalContainer, ModalHeader, ModalSidebar, ModalSidebarHeader, ModalSidebarTitle, ScrollableModalContent, SidebarContent, StyledModal, } from '@manuscripts/style-guide';
1
+ import { AddIcon, AddUserIcon, AffiliationPlaceholderIcon, CloseButton, InspectorTab, InspectorTabList, InspectorTabPanel, InspectorTabPanels, InspectorTabs, outlineStyle, ModalBody, ModalContainer, ModalHeader, ModalSidebar, ModalSidebarHeader, ModalSidebarTitle, ScrollableModalContent, SidebarContent, StyledModal, } from '@manuscripts/style-guide';
2
2
  import { generateNodeID, schema } from '@manuscripts/transform';
3
3
  import { isEqual } from 'lodash';
4
4
  import React, { useCallback, useEffect, useReducer, useRef, useState, } from 'react';
@@ -328,7 +328,9 @@ export const AffiliationsModal = ({ authors: $authors, affiliations: $affiliatio
328
328
  React.createElement(AffiliationList, { affiliation: selection, affiliations: affiliations, onSelect: handleSelect, onDelete: handleShowDeleteDialog, lastSavedAffiliationId: savedAffiliationId }))),
329
329
  React.createElement(ScrollableModalContent, { "data-cy": "affiliations-modal-content" }, selection ? (React.createElement(React.Fragment, null,
330
330
  React.createElement(AffiliationTabs, null,
331
- React.createElement(ModalFormActions, { type: 'affiliation', form: 'affiliation-form', onDelete: handleDeleteAffiliation, showingDeleteDialog: showingDeleteDialog, showDeleteDialog: handleShowDeleteDialog, newEntity: newAffiliation, isDisableSave: isDisableSave }),
331
+ React.createElement(ModalFormActions, { type: 'affiliation', form: 'affiliation-form', onDelete: handleDeleteAffiliation, showingDeleteDialog: showingDeleteDialog &&
332
+ !(showConfirmationDialog ||
333
+ showRequiredFieldConfirmationDialog), showDeleteDialog: handleShowDeleteDialog, newEntity: newAffiliation, isDisableSave: isDisableSave }),
332
334
  React.createElement(InspectorTabList, null,
333
335
  React.createElement(InspectorTab, null, "Details"),
334
336
  React.createElement(InspectorTab, null, "Authors")),
@@ -363,9 +365,15 @@ function createEmptyAffiliation(priority) {
363
365
  };
364
366
  }
365
367
  const StyledSidebarContent = styled(SidebarContent) `
366
- padding: 0;
368
+ padding: 8px;
367
369
  `;
368
- const AddAffiliationButton = styled.div `
370
+ const AddAffiliationButton = styled.button `
371
+ background: none;
372
+ border: none;
373
+ margin: 0;
374
+ font: inherit;
375
+ color: inherit;
376
+ width: 100%;
369
377
  display: flex;
370
378
  align-items: center;
371
379
  padding: 12px 8px 12px 12px;
@@ -376,6 +384,7 @@ const AddAffiliationButton = styled.div `
376
384
  border-left: 0;
377
385
  border-right: 0;
378
386
  }
387
+ ${outlineStyle}
379
388
  `;
380
389
  const ActionTitle = styled.div `
381
390
  padding-left: ${(props) => props.theme.grid.unit * 2}px;
@@ -383,7 +392,7 @@ const ActionTitle = styled.div `
383
392
  const AffiliationTabs = styled(InspectorTabs) `
384
393
  position: relative;
385
394
  `;
386
- const AffiliationTabPanel = styled(InspectorTabPanel).attrs({ unmount: false }) `
395
+ const AffiliationTabPanel = styled(InspectorTabPanel).attrs({ tabIndex: -1, unmount: false }) `
387
396
  margin-top: ${(props) => props.theme.grid.unit * 4}px;
388
397
  `;
389
398
  const StyledModalBody = styled(ModalBody) `
@@ -18,10 +18,12 @@ import { DndProvider } from 'react-dnd';
18
18
  import { HTML5Backend } from 'react-dnd-html5-backend';
19
19
  import styled from 'styled-components';
20
20
  import { DraggableAuthor } from './DraggableAuthor';
21
- const AuthorListContainer = styled.div `
21
+ import { withListNavigation } from '@manuscripts/style-guide';
22
+ const AuthorListContainer = withListNavigation(styled.div `
22
23
  flex: 1;
23
24
  overflow-y: visible;
24
- `;
25
+ padding: 0 6px;
26
+ `);
25
27
  const AuthorListTitle = styled.h2 `
26
28
  color: #6e6e6e;
27
29
  font-size: 18px;