@manuscripts/style-guide 1.5.0-LEAN-3180 → 1.5.0-LEAN-3180-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.
@@ -14,13 +14,35 @@
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 (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
17
40
  var __importDefault = (this && this.__importDefault) || function (mod) {
18
41
  return (mod && mod.__esModule) ? mod : { "default": mod };
19
42
  };
20
43
  Object.defineProperty(exports, "__esModule", { value: true });
21
44
  exports.CitationViewer = exports.CitedItem = exports.CitedItems = void 0;
22
- const addons_1 = require("@storybook/addons");
23
- const react_1 = __importDefault(require("react"));
45
+ const react_1 = __importStar(require("react"));
24
46
  const styled_components_1 = __importDefault(require("styled-components"));
25
47
  const ReferenceLine_1 = require("./ReferenceLine");
26
48
  exports.CitedItems = styled_components_1.default.div `
@@ -39,7 +61,7 @@ exports.CitedItem = styled_components_1.default.div `
39
61
  }
40
62
  `;
41
63
  const CitationViewer = ({ rids, items, }) => {
42
- const cited = (0, addons_1.useMemo)(() => {
64
+ const cited = (0, react_1.useMemo)(() => {
43
65
  return rids.flatMap((rid) => items.filter((i) => i._id === rid));
44
66
  }, [rids, items]);
45
67
  return (react_1.default.createElement(exports.CitedItems, null, cited.map((item) => (react_1.default.createElement(ReferenceLine_1.ReferenceLine, { key: item._id, item: item })))));
@@ -230,16 +230,25 @@ const ChangeHandlingForm = (props) => {
230
230
  }, [props.onChange, values]);
231
231
  return react_1.default.createElement(exports.FlexForm, null, props.children);
232
232
  };
233
- const ReferenceForm = ({ values, showDelete, handleChange: onChange, handleDelete, handleCancel, handleSave, }) => {
234
- const ref = (0, react_1.useRef)(null);
233
+ const ReferenceForm = ({ values, showDelete, handleChange, handleDelete, handleCancel, handleSave, actionsRef, }) => {
234
+ const fieldsRef = (0, react_1.useRef)(null);
235
235
  (0, react_1.useEffect)(() => {
236
- if (ref.current) {
237
- ref.current.scrollTop = 0;
236
+ if (fieldsRef.current) {
237
+ fieldsRef.current.scrollTop = 0;
238
238
  }
239
239
  }, [values]);
240
+ const formRef = (0, react_1.useRef)(null);
240
241
  const [showDeleteDialog, setShowDeleteDialog] = (0, react_1.useState)(false);
241
- return (react_1.default.createElement(formik_1.Formik, { initialValues: values, onSubmit: handleSave, enableReinitialize: true }, ({ values, setFieldValue, handleChange }) => {
242
- return (react_1.default.createElement(ChangeHandlingForm, { onChange: onChange },
242
+ if (actionsRef && !actionsRef.current) {
243
+ actionsRef.current = {
244
+ reset: () => {
245
+ var _a;
246
+ (_a = formRef.current) === null || _a === void 0 ? void 0 : _a.resetForm();
247
+ },
248
+ };
249
+ }
250
+ return (react_1.default.createElement(formik_1.Formik, { initialValues: values, onSubmit: handleSave, enableReinitialize: true, innerRef: formRef }, (formik) => {
251
+ return (react_1.default.createElement(ChangeHandlingForm, { onChange: handleChange },
243
252
  react_1.default.createElement(Dialog_1.Dialog, { isOpen: showDeleteDialog, category: Dialog_1.Category.confirmation, header: "Delete Reference", message: "Are you sure you want to delete this reference from the list?", actions: {
244
253
  secondary: {
245
254
  action: () => {
@@ -255,16 +264,16 @@ const ReferenceForm = ({ values, showDelete, handleChange: onChange, handleDelet
255
264
  } }),
256
265
  react_1.default.createElement(Actions, null,
257
266
  react_1.default.createElement(Button_1.ButtonGroup, null,
258
- react_1.default.createElement(Button_1.IconButton, { defaultColor: true, as: "a", href: `https://doi.org/${values.DOI}`, target: '_blank' },
267
+ react_1.default.createElement(Button_1.IconButton, { defaultColor: true, as: "a", href: `https://doi.org/${formik.values.DOI}`, target: '_blank' },
259
268
  react_1.default.createElement(link_icon_1.LinkIcon, null)),
260
269
  react_1.default.createElement("div", { "data-tip": true, "data-for": 'delete-button' },
261
- react_1.default.createElement(DeleteButton, { defaultColor: true, disabled: !showDelete, onClick: handleDelete },
270
+ react_1.default.createElement(DeleteButton, { defaultColor: true, disabled: !showDelete, onClick: () => setShowDeleteDialog(true) },
262
271
  react_1.default.createElement(delete_icon_1.DeleteIcon, null)),
263
272
  react_1.default.createElement(react_tooltip_1.default, { disable: showDelete, id: 'delete-button', place: "bottom", effect: "solid", offset: { top: 15 }, className: "tooltip" }, "Unable to delete because the item is used in the document"))),
264
273
  react_1.default.createElement(Button_1.ButtonGroup, null,
265
274
  react_1.default.createElement(Button_1.SecondaryButton, { onClick: handleCancel }, "Cancel"),
266
275
  react_1.default.createElement(Button_1.PrimaryButton, { type: "submit" }, "Save"))),
267
- react_1.default.createElement(exports.FormFields, { ref: ref },
276
+ react_1.default.createElement(exports.FormFields, { ref: fieldsRef },
268
277
  react_1.default.createElement(exports.FormField, null,
269
278
  react_1.default.createElement(exports.LabelContainer, null,
270
279
  react_1.default.createElement(Label, { htmlFor: 'citation-item-type' }, "Type")),
@@ -282,25 +291,25 @@ const ReferenceForm = ({ values, showDelete, handleChange: onChange, handleDelet
282
291
  isNew: true,
283
292
  })) },
284
293
  react_1.default.createElement(AddAuthor_1.default, { height: 17, width: 17 }))),
285
- react_1.default.createElement("div", null, values.author &&
286
- values.author.map((author, index) => (react_1.default.createElement(AuthorDropDown, { key: index, index: index, author: author, remove: remove, handleChange: handleChange })))))) }),
294
+ react_1.default.createElement("div", null, formik.values.author &&
295
+ formik.values.author.map((author, index) => (react_1.default.createElement(AuthorDropDown, { key: index, index: index, author: author, remove: remove, handleChange: formik.handleChange })))))) }),
287
296
  react_1.default.createElement(exports.FormField, null,
288
297
  react_1.default.createElement(exports.LabelContainer, null,
289
298
  react_1.default.createElement(Label, { htmlFor: "issued['date-parts'][0][0]" }, "Year")),
290
299
  react_1.default.createElement(YearField, { name: "issued['date-parts'][0][0]", type: 'number', step: 1, onChange: (event) => {
291
300
  const { value } = event.target;
292
301
  if (value) {
293
- if (values.issued) {
294
- setFieldValue("issued['date-parts'][0][0]", Number(value));
302
+ if (formik.values.issued) {
303
+ formik.setFieldValue("issued['date-parts'][0][0]", Number(value));
295
304
  }
296
305
  else {
297
- setFieldValue('issued', (0, transform_1.buildBibliographicDate)({
306
+ formik.setFieldValue('issued', (0, transform_1.buildBibliographicDate)({
298
307
  'date-parts': [[Number(value)]],
299
308
  }));
300
309
  }
301
310
  }
302
311
  else {
303
- setFieldValue('issued', '');
312
+ formik.setFieldValue('issued', '');
304
313
  }
305
314
  } })),
306
315
  react_1.default.createElement(exports.FormField, null,
@@ -162,8 +162,10 @@ const ReferencesModal = ({ isOpen, handleCancel, items, item, citationCounts, ha
162
162
  setStartIndex(Math.max(newLast - dropLimit, startIndex));
163
163
  }
164
164
  }, [triggers, items]);
165
+ const actionsRef = (0, react_1.useRef)();
165
166
  const reset = () => {
166
- setValues(undefined);
167
+ var _a;
168
+ (_a = actionsRef.current) === null || _a === void 0 ? void 0 : _a.reset();
167
169
  setConfirm(false);
168
170
  };
169
171
  const save = (0, react_1.useCallback)((values) => {
@@ -172,7 +174,8 @@ const ReferencesModal = ({ isOpen, handleCancel, items, item, citationCounts, ha
172
174
  }
173
175
  const item = Object.assign(Object.assign({}, selection), values);
174
176
  handleSave(item);
175
- reset();
177
+ setSelection(item);
178
+ setConfirm(false);
176
179
  }, [selection, handleSave]);
177
180
  const handleItemClick = (0, react_1.useCallback)((item) => {
178
181
  if (values && selection && !(0, lodash_1.isEqual)(values, (0, exports.normalize)(selection))) {
@@ -212,6 +215,6 @@ const ReferencesModal = ({ isOpen, handleCancel, items, item, citationCounts, ha
212
215
  react_1.default.createElement(CitationCount, { className: citationCounts.get(item._id) ? '' : 'unused' }, citationCounts.get(item._id) || 0),
213
216
  react_1.default.createElement(react_tooltip_1.default, { disable: (citationCounts.get(item._id) || 0) < 1, id: "citation-count", place: "bottom", effect: "solid", offset: { top: 40 }, className: "tooltip" }, "Number of times used in the document")),
214
217
  react_1.default.createElement(ReferenceLine_1.ReferenceLine, { item: item }))))))),
215
- react_1.default.createElement(StyledModal_1.ScrollableModalContent, null, selection && (react_1.default.createElement(ReferenceForm_1.ReferenceForm, { values: (0, exports.normalize)(selection), showDelete: !citationCounts.get(selection._id), handleChange: handleChange, handleCancel: handleCancel, handleDelete: () => handleDelete(selection), handleSave: save })))))));
218
+ react_1.default.createElement(StyledModal_1.ScrollableModalContent, null, selection && (react_1.default.createElement(ReferenceForm_1.ReferenceForm, { values: (0, exports.normalize)(selection), showDelete: !citationCounts.get(selection._id), handleChange: handleChange, handleCancel: handleCancel, handleDelete: () => handleDelete(selection), handleSave: save, actionsRef: actionsRef })))))));
216
219
  };
217
220
  exports.ReferencesModal = ReferencesModal;
@@ -13,8 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { useMemo } from '@storybook/addons';
17
- import React from 'react';
16
+ import React, { useMemo } from 'react';
18
17
  import styled from 'styled-components';
19
18
  import { ReferenceLine } from './ReferenceLine';
20
19
  export const CitedItems = styled.div `
@@ -18,7 +18,7 @@ import Trashcan from '@manuscripts/assets/react/AnnotationRemove';
18
18
  import ArrowDownBlue from '@manuscripts/assets/react/ArrowDownBlue';
19
19
  import { buildBibliographicDate, buildBibliographicName, } from '@manuscripts/transform';
20
20
  import { Field, FieldArray, Form, Formik, useFormikContext, } from 'formik';
21
- import React, { useEffect, useRef, useState } from 'react';
21
+ import React, { useEffect, useRef, useState, } from 'react';
22
22
  import ReactTooltip from 'react-tooltip';
23
23
  import styled from 'styled-components';
24
24
  import { ButtonGroup, IconButton, PrimaryButton, SecondaryButton, } from '../Button';
@@ -201,16 +201,25 @@ const ChangeHandlingForm = (props) => {
201
201
  }, [props.onChange, values]);
202
202
  return React.createElement(FlexForm, null, props.children);
203
203
  };
204
- export const ReferenceForm = ({ values, showDelete, handleChange: onChange, handleDelete, handleCancel, handleSave, }) => {
205
- const ref = useRef(null);
204
+ export const ReferenceForm = ({ values, showDelete, handleChange, handleDelete, handleCancel, handleSave, actionsRef, }) => {
205
+ const fieldsRef = useRef(null);
206
206
  useEffect(() => {
207
- if (ref.current) {
208
- ref.current.scrollTop = 0;
207
+ if (fieldsRef.current) {
208
+ fieldsRef.current.scrollTop = 0;
209
209
  }
210
210
  }, [values]);
211
+ const formRef = useRef(null);
211
212
  const [showDeleteDialog, setShowDeleteDialog] = useState(false);
212
- return (React.createElement(Formik, { initialValues: values, onSubmit: handleSave, enableReinitialize: true }, ({ values, setFieldValue, handleChange }) => {
213
- return (React.createElement(ChangeHandlingForm, { onChange: onChange },
213
+ if (actionsRef && !actionsRef.current) {
214
+ actionsRef.current = {
215
+ reset: () => {
216
+ var _a;
217
+ (_a = formRef.current) === null || _a === void 0 ? void 0 : _a.resetForm();
218
+ },
219
+ };
220
+ }
221
+ return (React.createElement(Formik, { initialValues: values, onSubmit: handleSave, enableReinitialize: true, innerRef: formRef }, (formik) => {
222
+ return (React.createElement(ChangeHandlingForm, { onChange: handleChange },
214
223
  React.createElement(Dialog, { isOpen: showDeleteDialog, category: Category.confirmation, header: "Delete Reference", message: "Are you sure you want to delete this reference from the list?", actions: {
215
224
  secondary: {
216
225
  action: () => {
@@ -226,16 +235,16 @@ export const ReferenceForm = ({ values, showDelete, handleChange: onChange, hand
226
235
  } }),
227
236
  React.createElement(Actions, null,
228
237
  React.createElement(ButtonGroup, null,
229
- React.createElement(IconButton, { defaultColor: true, as: "a", href: `https://doi.org/${values.DOI}`, target: '_blank' },
238
+ React.createElement(IconButton, { defaultColor: true, as: "a", href: `https://doi.org/${formik.values.DOI}`, target: '_blank' },
230
239
  React.createElement(LinkIcon, null)),
231
240
  React.createElement("div", { "data-tip": true, "data-for": 'delete-button' },
232
- React.createElement(DeleteButton, { defaultColor: true, disabled: !showDelete, onClick: handleDelete },
241
+ React.createElement(DeleteButton, { defaultColor: true, disabled: !showDelete, onClick: () => setShowDeleteDialog(true) },
233
242
  React.createElement(DeleteIcon, null)),
234
243
  React.createElement(ReactTooltip, { disable: showDelete, id: 'delete-button', place: "bottom", effect: "solid", offset: { top: 15 }, className: "tooltip" }, "Unable to delete because the item is used in the document"))),
235
244
  React.createElement(ButtonGroup, null,
236
245
  React.createElement(SecondaryButton, { onClick: handleCancel }, "Cancel"),
237
246
  React.createElement(PrimaryButton, { type: "submit" }, "Save"))),
238
- React.createElement(FormFields, { ref: ref },
247
+ React.createElement(FormFields, { ref: fieldsRef },
239
248
  React.createElement(FormField, null,
240
249
  React.createElement(LabelContainer, null,
241
250
  React.createElement(Label, { htmlFor: 'citation-item-type' }, "Type")),
@@ -253,25 +262,25 @@ export const ReferenceForm = ({ values, showDelete, handleChange: onChange, hand
253
262
  isNew: true,
254
263
  })) },
255
264
  React.createElement(AddAuthor, { height: 17, width: 17 }))),
256
- React.createElement("div", null, values.author &&
257
- values.author.map((author, index) => (React.createElement(AuthorDropDown, { key: index, index: index, author: author, remove: remove, handleChange: handleChange })))))) }),
265
+ React.createElement("div", null, formik.values.author &&
266
+ formik.values.author.map((author, index) => (React.createElement(AuthorDropDown, { key: index, index: index, author: author, remove: remove, handleChange: formik.handleChange })))))) }),
258
267
  React.createElement(FormField, null,
259
268
  React.createElement(LabelContainer, null,
260
269
  React.createElement(Label, { htmlFor: "issued['date-parts'][0][0]" }, "Year")),
261
270
  React.createElement(YearField, { name: "issued['date-parts'][0][0]", type: 'number', step: 1, onChange: (event) => {
262
271
  const { value } = event.target;
263
272
  if (value) {
264
- if (values.issued) {
265
- setFieldValue("issued['date-parts'][0][0]", Number(value));
273
+ if (formik.values.issued) {
274
+ formik.setFieldValue("issued['date-parts'][0][0]", Number(value));
266
275
  }
267
276
  else {
268
- setFieldValue('issued', buildBibliographicDate({
277
+ formik.setFieldValue('issued', buildBibliographicDate({
269
278
  'date-parts': [[Number(value)]],
270
279
  }));
271
280
  }
272
281
  }
273
282
  else {
274
- setFieldValue('issued', '');
283
+ formik.setFieldValue('issued', '');
275
284
  }
276
285
  } })),
277
286
  React.createElement(FormField, null,
@@ -7,7 +7,7 @@ import { useScrollDetection } from '../../hooks/use-scroll-detection';
7
7
  import { Category, Dialog } from '../Dialog';
8
8
  import { SidebarContent } from '../Sidebar';
9
9
  import { CloseButton, ModalBody, ModalContainer, ModalHeader, ModalSidebar, ModalSidebarHeader, ModalSidebarTitle, ScrollableModalContent, StyledModal, } from '../StyledModal';
10
- import { ReferenceForm } from './ReferenceForm';
10
+ import { ReferenceForm, } from './ReferenceForm';
11
11
  import { ReferenceLine } from './ReferenceLine';
12
12
  const ReferencesModalContainer = styled(ModalContainer) `
13
13
  min-width: 960px;
@@ -132,8 +132,10 @@ export const ReferencesModal = ({ isOpen, handleCancel, items, item, citationCou
132
132
  setStartIndex(Math.max(newLast - dropLimit, startIndex));
133
133
  }
134
134
  }, [triggers, items]);
135
+ const actionsRef = useRef();
135
136
  const reset = () => {
136
- setValues(undefined);
137
+ var _a;
138
+ (_a = actionsRef.current) === null || _a === void 0 ? void 0 : _a.reset();
137
139
  setConfirm(false);
138
140
  };
139
141
  const save = useCallback((values) => {
@@ -142,7 +144,8 @@ export const ReferencesModal = ({ isOpen, handleCancel, items, item, citationCou
142
144
  }
143
145
  const item = Object.assign(Object.assign({}, selection), values);
144
146
  handleSave(item);
145
- reset();
147
+ setSelection(item);
148
+ setConfirm(false);
146
149
  }, [selection, handleSave]);
147
150
  const handleItemClick = useCallback((item) => {
148
151
  if (values && selection && !isEqual(values, normalize(selection))) {
@@ -182,5 +185,5 @@ export const ReferencesModal = ({ isOpen, handleCancel, items, item, citationCou
182
185
  React.createElement(CitationCount, { className: citationCounts.get(item._id) ? '' : 'unused' }, citationCounts.get(item._id) || 0),
183
186
  React.createElement(ReactTooltip, { disable: (citationCounts.get(item._id) || 0) < 1, id: "citation-count", place: "bottom", effect: "solid", offset: { top: 40 }, className: "tooltip" }, "Number of times used in the document")),
184
187
  React.createElement(ReferenceLine, { item: item }))))))),
185
- React.createElement(ScrollableModalContent, null, selection && (React.createElement(ReferenceForm, { values: normalize(selection), showDelete: !citationCounts.get(selection._id), handleChange: handleChange, handleCancel: handleCancel, handleDelete: () => handleDelete(selection), handleSave: save })))))));
188
+ React.createElement(ScrollableModalContent, null, selection && (React.createElement(ReferenceForm, { values: normalize(selection), showDelete: !citationCounts.get(selection._id), handleChange: handleChange, handleCancel: handleCancel, handleDelete: () => handleDelete(selection), handleSave: save, actionsRef: actionsRef })))))));
186
189
  };
@@ -14,18 +14,22 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { BibliographyItem } from '@manuscripts/json-schema';
17
- import React from 'react';
17
+ import React, { MutableRefObject } from 'react';
18
18
  export declare const LabelContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
19
19
  export declare const FormField: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
20
20
  export declare const ReferenceTextArea: import("styled-components").StyledComponent<"textarea", import("styled-components").DefaultTheme, import("../Form").ErrorProps, never>;
21
21
  export declare const FlexForm: import("styled-components").StyledComponent<React.ForwardRefExoticComponent<Pick<React.DetailedHTMLProps<React.FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, "name" | "slot" | "style" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "autoComplete" | "method" | "target" | "acceptCharset" | "action" | "encType" | "noValidate"> & React.RefAttributes<HTMLFormElement>>, import("styled-components").DefaultTheme, {}, never>;
22
22
  export declare const FormFields: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
23
- export type FormValues = Pick<BibliographyItem, '_id' | 'title' | 'author' | 'DOI' | 'issued' | 'type' | 'container-title' | 'URL' | 'issue' | 'volume' | 'supplement' | 'page'>;
23
+ export type ReferenceFormValues = Pick<BibliographyItem, '_id' | 'title' | 'author' | 'DOI' | 'issued' | 'type' | 'container-title' | 'URL' | 'issue' | 'volume' | 'supplement' | 'page'>;
24
+ export interface ReferenceFormActions {
25
+ reset: () => void;
26
+ }
24
27
  export declare const ReferenceForm: React.FC<{
25
- values: FormValues;
28
+ values: ReferenceFormValues;
26
29
  showDelete: boolean;
27
- handleChange: (values: FormValues) => void;
30
+ handleChange: (values: ReferenceFormValues) => void;
28
31
  handleCancel: () => void;
29
32
  handleDelete: () => void;
30
- handleSave: (values: FormValues) => void;
33
+ handleSave: (values: ReferenceFormValues) => void;
34
+ actionsRef?: MutableRefObject<ReferenceFormActions | undefined>;
31
35
  }>;
@@ -1,7 +1,7 @@
1
1
  import { BibliographyItem } from '@manuscripts/json-schema';
2
2
  import React from 'react';
3
- import { FormValues } from './ReferenceForm';
4
- export declare const normalize: (item: BibliographyItem) => FormValues;
3
+ import { ReferenceFormValues } from './ReferenceForm';
4
+ export declare const normalize: (item: BibliographyItem) => ReferenceFormValues;
5
5
  export interface ReferencesModalProps {
6
6
  isOpen: boolean;
7
7
  handleCancel: () => void;
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": "1.5.0-LEAN-3180",
4
+ "version": "1.5.0-LEAN-3180-2",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-style-guide",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",