@sanity/hierarchical-document-list 0.1.1 → 1.0.0

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 (57) hide show
  1. package/README.md +55 -19
  2. package/lib/TreeDeskStructure.d.ts +2 -1
  3. package/lib/TreeDeskStructure.js +46 -21
  4. package/lib/TreeInputComponent.d.ts +1 -1
  5. package/lib/TreeInputComponent.js +39 -8
  6. package/lib/components/DeskWarning.d.ts +1 -1
  7. package/lib/components/DeskWarning.js +28 -7
  8. package/lib/components/DocumentInNode.d.ts +1 -1
  9. package/lib/components/DocumentInNode.js +42 -18
  10. package/lib/components/DocumentPreviewStatus.d.ts +1 -1
  11. package/lib/components/DocumentPreviewStatus.js +16 -12
  12. package/lib/components/NodeActions.d.ts +1 -1
  13. package/lib/components/NodeActions.js +34 -10
  14. package/lib/components/NodeContentRenderer.js +43 -19
  15. package/lib/components/PlaceholderDropzone.d.ts +1 -1
  16. package/lib/components/PlaceholderDropzone.js +7 -5
  17. package/lib/components/TreeEditor.d.ts +1 -1
  18. package/lib/components/TreeEditor.js +28 -23
  19. package/lib/components/TreeEditorErrorBoundary.d.ts +1 -1
  20. package/lib/components/TreeEditorErrorBoundary.js +28 -7
  21. package/lib/components/TreeNodeRenderer.js +30 -6
  22. package/lib/components/TreeNodeRendererScaffold.d.ts +1 -1
  23. package/lib/components/TreeNodeRendererScaffold.js +9 -7
  24. package/lib/createDeskHierarchy.js +37 -19
  25. package/lib/createHierarchicalSchemas.d.ts +78 -0
  26. package/lib/createHierarchicalSchemas.js +138 -0
  27. package/lib/{utils → hooks}/useAllItems.d.ts +0 -0
  28. package/lib/{utils → hooks}/useAllItems.js +34 -9
  29. package/lib/{utils → hooks}/useLocalTree.d.ts +0 -0
  30. package/lib/{utils → hooks}/useLocalTree.js +26 -4
  31. package/lib/{utils → hooks}/useTreeOperations.d.ts +1 -1
  32. package/lib/hooks/useTreeOperations.js +39 -0
  33. package/lib/{utils → hooks}/useTreeOperationsProvider.d.ts +1 -1
  34. package/lib/hooks/useTreeOperationsProvider.js +85 -0
  35. package/lib/index.d.ts +1 -1
  36. package/lib/index.js +12 -3
  37. package/lib/schemas/hierarchy.tree.d.ts +5 -15
  38. package/lib/schemas/hierarchy.tree.js +10 -22
  39. package/lib/utils/flatDataToTree.js +6 -3
  40. package/lib/utils/getAdjescentNodes.js +4 -1
  41. package/lib/utils/getCommonTreeProps.js +16 -10
  42. package/lib/utils/getTreeHeight.js +9 -5
  43. package/lib/utils/gradientPatchAdapter.js +12 -5
  44. package/lib/utils/idUtils.js +7 -2
  45. package/lib/utils/injectNodeTypeInPatches.d.ts +12 -0
  46. package/lib/utils/injectNodeTypeInPatches.js +58 -0
  47. package/lib/utils/moveItemInArray.js +4 -1
  48. package/lib/utils/throwError.d.ts +7 -0
  49. package/lib/utils/throwError.js +12 -0
  50. package/lib/utils/treeData.js +27 -15
  51. package/lib/utils/treePatches.js +51 -21
  52. package/package.json +1 -2
  53. package/tsconfig.json +3 -3
  54. package/lib/createHierarchicalField.d.ts +0 -8
  55. package/lib/createHierarchicalField.js +0 -51
  56. package/lib/utils/useTreeOperations.js +0 -16
  57. package/lib/utils/useTreeOperationsProvider.js +0 -60
package/README.md CHANGED
@@ -48,7 +48,10 @@ export default () => {
48
48
  filterParams: {
49
49
  acceptedStatuses: ['published', 'approved']
50
50
  }
51
- }
51
+ },
52
+
53
+ // ❓ Optional: limit the depth of your hierarachies
54
+ maxDept: 3
52
55
  })
53
56
  ])
54
57
  }
@@ -215,26 +218,51 @@ After the transformation above, nodes with nested entries will include a `childr
215
218
 
216
219
  By default, this plugin will create and update documents of `_type: hierarchy.tree`, with a `tree` field holding the hierarchical data. When deploying a [GraphQL Sanity endpoint](https://www.sanity.io/docs/graphql), however, you'll need an explicit document type in your schema so that you get the proper types for querying.
217
220
 
218
- To add this document type, create a new document schema similar to the following:
221
+ To add this document type, create a set of schemas with the `createHierarchicalSchemas`:
219
222
 
220
223
  ```js
221
- import {createHierarchicalField} from '@sanity/hierarchical-document-list'
222
-
223
- export default {
224
- name: 'myCustomHierarchicalType',
225
- title: 'Custom document type for holding hierarchical data',
226
- type: 'document',
227
- liveEdit: true, // 👉 Important: set liveEdit to `true` to ensure the UI works properly
228
- fields: [
229
- createHierarchicalField({
230
- name: 'customTreeDataKey', // key for the tree field in the document
231
- title: 'Custom tree',
232
- options: {
233
- referenceTo: ['category']
234
- }
235
- })
236
- ]
224
+ // hierarchicalSchemas.js
225
+ import {createHierarchicalSchemas} from '@sanity/hierarchical-document-list'
226
+
227
+ export const hierarchicalOptions = {
228
+ // choose the document type name that suits you best
229
+ documentType: 'myCustomHierarchicalType',
230
+
231
+ // key for the tree field in the document - "tree" by default
232
+ fieldKeyInDocument: 'customTreeDataKey',
233
+
234
+ // Document types editors should be able to include in the hierarchy
235
+ referenceTo: ['site.page', 'site.post', 'docs.article', 'social.youtubeVideo'],
236
+
237
+ // ❓ Optional: provide filters and/or parameters for narrowing which documents can be added
238
+ referenceOptions: {
239
+ filter: 'status in $acceptedStatuses',
240
+ filterParams: {
241
+ acceptedStatuses: ['published', 'approved']
242
+ }
243
+ },
244
+
245
+ // ❓ Optional: limit the depth of your hierarachies
246
+ maxDept: 3
237
247
  }
248
+
249
+ export default createHierarchicalSchemas(hierarchicalOptions)
250
+ ```
251
+
252
+ And add these schemas to your studio:
253
+
254
+ ```js
255
+ import createSchema from 'part:@sanity/base/schema-creator'
256
+ import schemaTypes from 'all:part:@sanity/base/schema-type'
257
+ import hierarchicalSchemas from './hierarchicalSchemas'
258
+
259
+ export default createSchema({
260
+ name: 'default',
261
+ types: schemaTypes.concat([
262
+ // ...Other schemas
263
+ ...hierarchicalSchemas // add all items in the array of hierarchical schemas
264
+ ])
265
+ })
238
266
  ```
239
267
 
240
268
  Then, in your desk structure where you added the hierarchical document(s), include the right `documentType` and `fieldKeyInDocument` properties:
@@ -246,13 +274,21 @@ createDeskHierarchy({
246
274
  fieldKeyInDocument: 'customTreeDataKey' // the name of the hierarchical field
247
275
  // ...
248
276
  })
277
+
278
+ // Ideally, use the same configuration object you defined in your schemas:
279
+ import {hierarchicalOptions} from './hierarchicalSchemas'
280
+
281
+ createDeskHierarchy({
282
+ ...hierarchicalOptions
283
+ // ...
284
+ })
249
285
  ```
250
286
 
251
287
  ---
252
288
 
253
289
  📌 **Note:** you can also use the method above to add hierarchies inside the schema of documents and objects, which would be editable outside the desk structure.
254
290
 
255
- We're considering adapting this input to support any type of nest-able data, not only references. Until then, avoid `createHierarchicalField` for fields in nested schemas as, in these contexts, it lacks the necessary affordances for a good editing experience.
291
+ We're considering adapting this input to support any type of nest-able data, not only references. Until then, avoid using the generated schemas in nested schemas as, in these contexts, it lacks the necessary affordances for a good editing experience.
256
292
 
257
293
  ---
258
294
 
@@ -1,7 +1,8 @@
1
- import React from 'react';
1
+ import * as React from 'react';
2
2
  import { TreeDeskStructureProps } from './types';
3
3
  interface ComponentProps {
4
4
  options: TreeDeskStructureProps;
5
5
  }
6
+ export declare const DEFAULT_FIELD_KEY = "tree";
6
7
  declare const TreeDeskStructure: React.FC<ComponentProps>;
7
8
  export default TreeDeskStructure;
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __assign = (this && this.__assign) || function () {
2
3
  __assign = Object.assign || function(t) {
3
4
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -9,6 +10,25 @@ var __assign = (this && this.__assign) || function () {
9
10
  };
10
11
  return __assign.apply(this, arguments);
11
12
  };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
22
+ }) : function(o, v) {
23
+ o["default"] = v;
24
+ });
25
+ var __importStar = (this && this.__importStar) || function (mod) {
26
+ if (mod && mod.__esModule) return mod;
27
+ var result = {};
28
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
29
+ __setModuleDefault(result, mod);
30
+ return result;
31
+ };
12
32
  var __rest = (this && this.__rest) || function (s, e) {
13
33
  var t = {};
14
34
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -20,28 +40,33 @@ var __rest = (this && this.__rest) || function (s, e) {
20
40
  }
21
41
  return t;
22
42
  };
23
- import { jsx as _jsx } from "react/jsx-runtime";
24
- import { PublishIcon } from '@sanity/icons';
25
- import { useDocumentOperation, useEditState } from '@sanity/react-hooks';
26
- import { Box, Button, Flex, Spinner, useToast } from '@sanity/ui';
27
- import React from 'react';
28
- import DeskWarning from './components/DeskWarning';
29
- import TreeEditor from './components/TreeEditor';
30
- import { toGradient } from './utils/gradientPatchAdapter';
31
- var DEFAULT_TREE_FIELD_KEY = 'tree';
32
- var DEFAULT_TREE_DOC_TYPE = 'hierarchy.tree';
43
+ var __importDefault = (this && this.__importDefault) || function (mod) {
44
+ return (mod && mod.__esModule) ? mod : { "default": mod };
45
+ };
46
+ Object.defineProperty(exports, "__esModule", { value: true });
47
+ exports.DEFAULT_FIELD_KEY = void 0;
48
+ var jsx_runtime_1 = require("react/jsx-runtime");
49
+ var icons_1 = require("@sanity/icons");
50
+ var react_hooks_1 = require("@sanity/react-hooks");
51
+ var ui_1 = require("@sanity/ui");
52
+ var React = __importStar(require("react"));
53
+ var DeskWarning_1 = __importDefault(require("./components/DeskWarning"));
54
+ var TreeEditor_1 = __importDefault(require("./components/TreeEditor"));
55
+ var gradientPatchAdapter_1 = require("./utils/gradientPatchAdapter");
56
+ var injectNodeTypeInPatches_1 = __importStar(require("./utils/injectNodeTypeInPatches"));
57
+ exports.DEFAULT_FIELD_KEY = 'tree';
33
58
  var TreeDeskStructure = function (props) {
34
- var treeDocType = props.options.documentType || DEFAULT_TREE_DOC_TYPE;
35
- var treeFieldKey = props.options.fieldKeyInDocument || DEFAULT_TREE_FIELD_KEY;
36
- var _a = useEditState(props.options.documentId, treeDocType), published = _a.published, draft = _a.draft, liveEdit = _a.liveEdit;
37
- var _b = useDocumentOperation(props.options.documentId, treeDocType), patch = _b.patch, ops = __rest(_b, ["patch"]);
38
- var push = useToast().push;
59
+ var treeDocType = props.options.documentType || injectNodeTypeInPatches_1.DEFAULT_DOC_TYPE;
60
+ var treeFieldKey = props.options.fieldKeyInDocument || exports.DEFAULT_FIELD_KEY;
61
+ var _a = (0, react_hooks_1.useEditState)(props.options.documentId, treeDocType), published = _a.published, draft = _a.draft, liveEdit = _a.liveEdit;
62
+ var _b = (0, react_hooks_1.useDocumentOperation)(props.options.documentId, treeDocType), patch = _b.patch, ops = __rest(_b, ["patch"]);
63
+ var push = (0, ui_1.useToast)().push;
39
64
  var treeValue = ((published === null || published === void 0 ? void 0 : published[treeFieldKey]) || []);
40
65
  var handleChange = React.useCallback(function (patchEvent) {
41
66
  if (!(patch === null || patch === void 0 ? void 0 : patch.execute)) {
42
67
  return;
43
68
  }
44
- patch.execute(toGradient(patchEvent.patches));
69
+ patch.execute((0, gradientPatchAdapter_1.toGradient)((0, injectNodeTypeInPatches_1.default)(patchEvent.patches, treeDocType)));
45
70
  }, [patch]);
46
71
  React.useEffect(function () {
47
72
  var _a;
@@ -51,10 +76,10 @@ var TreeDeskStructure = function (props) {
51
76
  }
52
77
  }, [published === null || published === void 0 ? void 0 : published._id, patch]);
53
78
  if (!liveEdit) {
54
- return (_jsx(DeskWarning, { title: "Invalid configuration", subtitle: "The `documentType` passed to `createDeskHiearchy` isn't live editable. \\nTo continue using this plugin, add `liveEdit: true` to your custom schema type or unset `documentType` in your hierarchy configuration." }, void 0));
79
+ return ((0, jsx_runtime_1.jsx)(DeskWarning_1.default, { title: "Invalid configuration", subtitle: "The `documentType` passed to `createDeskHiearchy` isn't live editable. \\nTo continue using this plugin, add `liveEdit: true` to your custom schema type or unset `documentType` in your hierarchy configuration." }, void 0));
55
80
  }
56
81
  if (draft === null || draft === void 0 ? void 0 : draft._id) {
57
- return (_jsx(DeskWarning, __assign({ title: "This hierarchy tree contains a draft", subtitle: "Click on the button below to publish your draft in order to continue editing the live\r\n published document." }, { children: _jsx(Button, { fontSize: 1, tone: "positive", text: "Publish draft", icon: PublishIcon, onClick: function () {
82
+ return ((0, jsx_runtime_1.jsx)(DeskWarning_1.default, __assign({ title: "This hierarchy tree contains a draft", subtitle: "Click on the button below to publish your draft in order to continue editing the live\n published document." }, { children: (0, jsx_runtime_1.jsx)(ui_1.Button, { fontSize: 1, tone: "positive", text: "Publish draft", icon: icons_1.PublishIcon, onClick: function () {
58
83
  var _a, _b;
59
84
  (_b = (_a = ops.publish) === null || _a === void 0 ? void 0 : _a.execute) === null || _b === void 0 ? void 0 : _b.call(_a);
60
85
  push({
@@ -64,8 +89,8 @@ var TreeDeskStructure = function (props) {
64
89
  } }, void 0) }), void 0));
65
90
  }
66
91
  if (!(published === null || published === void 0 ? void 0 : published._id)) {
67
- return (_jsx(Flex, __assign({ padding: 5, align: 'center', justify: 'center', height: 'fill' }, { children: _jsx(Spinner, { width: 4, muted: true }, void 0) }), void 0));
92
+ return ((0, jsx_runtime_1.jsx)(ui_1.Flex, __assign({ padding: 5, align: 'center', justify: 'center', height: 'fill' }, { children: (0, jsx_runtime_1.jsx)(ui_1.Spinner, { width: 4, muted: true }, void 0) }), void 0));
68
93
  }
69
- return (_jsx(Box, __assign({ paddingBottom: 5, paddingRight: 2 }, { children: _jsx(TreeEditor, { options: props.options, tree: treeValue, onChange: handleChange, patchPrefix: treeFieldKey }, void 0) }), void 0));
94
+ return ((0, jsx_runtime_1.jsx)(ui_1.Box, __assign({ paddingBottom: 5, paddingRight: 2 }, { children: (0, jsx_runtime_1.jsx)(TreeEditor_1.default, { options: props.options, tree: treeValue, onChange: handleChange, patchPrefix: treeFieldKey }, void 0) }), void 0));
70
95
  };
71
- export default TreeDeskStructure;
96
+ exports.default = TreeDeskStructure;
@@ -1,6 +1,6 @@
1
1
  import { FormFieldPresence } from '@sanity/base/presence';
2
2
  import { Marker, Path } from '@sanity/types';
3
- import React from 'react';
3
+ import * as React from 'react';
4
4
  import { StoredTreeItem, TreeFieldSchema } from './types';
5
5
  export interface TreeInputComponentProps {
6
6
  type: TreeFieldSchema;
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __assign = (this && this.__assign) || function () {
2
3
  __assign = Object.assign || function(t) {
3
4
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -9,13 +10,43 @@ var __assign = (this && this.__assign) || function () {
9
10
  };
10
11
  return __assign.apply(this, arguments);
11
12
  };
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
- import React from 'react';
14
- import { FormField } from '@sanity/base/components';
15
- import TreeEditor from './components/TreeEditor';
16
- var TreeInputComponent = React.forwardRef(function (props, _ref) {
17
- return (_jsx(FormField, __assign({ description: props.type.description, title: props.type.title, __unstable_markers: props.markers, __unstable_presence: props.presence,
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
22
+ }) : function(o, v) {
23
+ o["default"] = v;
24
+ });
25
+ var __importStar = (this && this.__importStar) || function (mod) {
26
+ if (mod && mod.__esModule) return mod;
27
+ var result = {};
28
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
29
+ __setModuleDefault(result, mod);
30
+ return result;
31
+ };
32
+ var __importDefault = (this && this.__importDefault) || function (mod) {
33
+ return (mod && mod.__esModule) ? mod : { "default": mod };
34
+ };
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ var jsx_runtime_1 = require("react/jsx-runtime");
37
+ var components_1 = require("@sanity/base/components");
38
+ var PatchEvent_1 = __importDefault(require("@sanity/form-builder/PatchEvent"));
39
+ var React = __importStar(require("react"));
40
+ var TreeEditor_1 = __importDefault(require("./components/TreeEditor"));
41
+ var injectNodeTypeInPatches_1 = __importStar(require("./utils/injectNodeTypeInPatches"));
42
+ var TreeInputComponent = React.forwardRef(function (props) {
43
+ var documentType = props.type.options.documentType || injectNodeTypeInPatches_1.DEFAULT_DOC_TYPE;
44
+ var onChange = React.useCallback(function (patch) {
45
+ var patches = (0, injectNodeTypeInPatches_1.default)(patch === null || patch === void 0 ? void 0 : patch.patches, documentType);
46
+ props.onChange(new PatchEvent_1.default(patches));
47
+ }, [props.onChange]);
48
+ return ((0, jsx_runtime_1.jsx)(components_1.FormField, __assign({ description: props.type.description, title: props.type.title, __unstable_markers: props.markers, __unstable_presence: props.presence,
18
49
  // @ts-expect-error FormField's TS definitions are off - it doesn't include compareValue
19
- compareValue: props.compareValue }, { children: _jsx(TreeEditor, { options: props.type.options, tree: props.value || [], onChange: props.onChange }, void 0) }), void 0));
50
+ compareValue: props.compareValue }, { children: (0, jsx_runtime_1.jsx)(TreeEditor_1.default, { options: props.type.options, tree: props.value || [], onChange: onChange }, void 0) }), void 0));
20
51
  });
21
- export default TreeInputComponent;
52
+ exports.default = TreeInputComponent;
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import * as React from 'react';
2
2
  declare const DeskWarning: React.FC<{
3
3
  title: string;
4
4
  subtitle?: string;
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __assign = (this && this.__assign) || function () {
2
3
  __assign = Object.assign || function(t) {
3
4
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -9,17 +10,37 @@ var __assign = (this && this.__assign) || function () {
9
10
  };
10
11
  return __assign.apply(this, arguments);
11
12
  };
12
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { Box, Card, Container, Heading, Stack, Text } from '@sanity/ui';
14
- import React from 'react';
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
22
+ }) : function(o, v) {
23
+ o["default"] = v;
24
+ });
25
+ var __importStar = (this && this.__importStar) || function (mod) {
26
+ if (mod && mod.__esModule) return mod;
27
+ var result = {};
28
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
29
+ __setModuleDefault(result, mod);
30
+ return result;
31
+ };
32
+ Object.defineProperty(exports, "__esModule", { value: true });
33
+ var jsx_runtime_1 = require("react/jsx-runtime");
34
+ var ui_1 = require("@sanity/ui");
35
+ var React = __importStar(require("react"));
15
36
  // React component that wraps text between two delimiters in a <pre> tag
16
37
  var WrapCodeBlocks = function (_a) {
17
38
  var text = _a.text;
18
- return (_jsx(_Fragment, { children: text.split('`').map(function (part, i) { return (_jsx(React.Fragment, { children: i % 2 === 0 ? part : _jsx("code", { children: part }, void 0) }, i)); }) }, void 0));
39
+ return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: text.split('`').map(function (part, i) { return ((0, jsx_runtime_1.jsx)(React.Fragment, { children: i % 2 === 0 ? part : (0, jsx_runtime_1.jsx)("code", { children: part }, void 0) }, i)); }) }, void 0));
19
40
  };
20
41
  var DeskWarning = function (_a) {
21
42
  var subtitle = _a.subtitle, title = _a.title, children = _a.children;
22
- return (_jsx(Container, __assign({ padding: 5, style: { maxWidth: '25rem' }, sizing: 'content' }, { children: _jsx(Card, __assign({ padding: 4, border: true, radius: 2, width: 0, tone: "caution" }, { children: _jsxs(Stack, __assign({ space: 3 }, { children: [_jsx(Heading, __assign({ size: 1 }, { children: title }), void 0), subtitle &&
23
- subtitle.split('\\n').map(function (line) { return (_jsx(Text, __assign({ size: 1 }, { children: _jsx(WrapCodeBlocks, { text: line }, void 0) }), void 0)); }), children && _jsx(Box, __assign({ marginTop: 2 }, { children: children }), void 0)] }), void 0) }), void 0) }), void 0));
43
+ return ((0, jsx_runtime_1.jsx)(ui_1.Container, __assign({ padding: 5, style: { maxWidth: '25rem' }, sizing: 'content' }, { children: (0, jsx_runtime_1.jsx)(ui_1.Card, __assign({ padding: 4, border: true, radius: 2, width: 0, tone: "caution" }, { children: (0, jsx_runtime_1.jsxs)(ui_1.Stack, __assign({ space: 3 }, { children: [(0, jsx_runtime_1.jsx)(ui_1.Heading, __assign({ size: 1 }, { children: title }), void 0), subtitle &&
44
+ subtitle.split('\\n').map(function (line) { return ((0, jsx_runtime_1.jsx)(ui_1.Text, __assign({ size: 1 }, { children: (0, jsx_runtime_1.jsx)(WrapCodeBlocks, { text: line }, void 0) }), void 0)); }), children && (0, jsx_runtime_1.jsx)(ui_1.Box, __assign({ marginTop: 2 }, { children: children }), void 0)] }), void 0) }), void 0) }), void 0));
24
45
  };
25
- export default DeskWarning;
46
+ exports.default = DeskWarning;
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import * as React from 'react';
2
2
  import { LocalTreeItem } from '../types';
3
3
  /**
4
4
  * Renders a preview for each referenced document.
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __assign = (this && this.__assign) || function () {
2
3
  __assign = Object.assign || function(t) {
3
4
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -9,41 +10,64 @@ var __assign = (this && this.__assign) || function () {
9
10
  };
10
11
  return __assign.apply(this, arguments);
11
12
  };
12
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { TextWithTone } from '@sanity/base/components';
14
- import { usePaneRouter } from '@sanity/desk-tool';
15
- import { HelpCircleIcon } from '@sanity/icons';
16
- import { Box, Card, Flex, Stack, Text, Tooltip } from '@sanity/ui';
17
- import Preview from 'part:@sanity/base/preview';
18
- import schema from 'part:@sanity/base/schema';
19
- import React from 'react';
20
- import useTreeOperations from '../utils/useTreeOperations';
21
- import DocumentPreviewStatus from './DocumentPreviewStatus';
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
22
+ }) : function(o, v) {
23
+ o["default"] = v;
24
+ });
25
+ var __importStar = (this && this.__importStar) || function (mod) {
26
+ if (mod && mod.__esModule) return mod;
27
+ var result = {};
28
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
29
+ __setModuleDefault(result, mod);
30
+ return result;
31
+ };
32
+ var __importDefault = (this && this.__importDefault) || function (mod) {
33
+ return (mod && mod.__esModule) ? mod : { "default": mod };
34
+ };
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ var jsx_runtime_1 = require("react/jsx-runtime");
37
+ var components_1 = require("@sanity/base/components");
38
+ var desk_tool_1 = require("@sanity/desk-tool");
39
+ var icons_1 = require("@sanity/icons");
40
+ var ui_1 = require("@sanity/ui");
41
+ var preview_1 = __importDefault(require("part:@sanity/base/preview"));
42
+ var schema_1 = __importDefault(require("part:@sanity/base/schema"));
43
+ var React = __importStar(require("react"));
44
+ var useTreeOperations_1 = __importDefault(require("../hooks/useTreeOperations"));
45
+ var DocumentPreviewStatus_1 = __importDefault(require("./DocumentPreviewStatus"));
22
46
  /**
23
47
  * Renders a preview for each referenced document.
24
48
  * Nested inside TreeNode.tsx
25
49
  */
26
50
  var DocumentInNode = function (props) {
27
51
  var _a = props.item, _b = _a.value, _c = _b === void 0 ? {} : _b, reference = _c.reference, docType = _c.docType, draftId = _a.draftId, publishedId = _a.publishedId;
28
- var _d = usePaneRouter(), routerPanesState = _d.routerPanesState, ChildLink = _d.ChildLink;
29
- var allItemsStatus = useTreeOperations().allItemsStatus;
52
+ var _d = (0, desk_tool_1.usePaneRouter)(), routerPanesState = _d.routerPanesState, ChildLink = _d.ChildLink;
53
+ var allItemsStatus = (0, useTreeOperations_1.default)().allItemsStatus;
30
54
  var isActive = React.useMemo(function () {
31
55
  // If some pane is active with the current document `_id`, it's active
32
56
  return routerPanesState.some(function (pane) { return pane.some(function (group) { return group.id === (reference === null || reference === void 0 ? void 0 : reference._ref); }); });
33
57
  }, [routerPanesState]);
34
- var schemaType = React.useMemo(function () { return schema.get(docType); }, [docType]);
58
+ var schemaType = React.useMemo(function () { return schema_1.default.get(docType); }, [docType]);
35
59
  var LinkComponent = React.useMemo(function () {
36
60
  // eslint-disable-next-line @typescript-eslint/no-shadow
37
- return React.forwardRef(function (linkProps, ref) { return (_jsx(ChildLink, __assign({}, linkProps, { childId: reference === null || reference === void 0 ? void 0 : reference._ref, ref: ref, childParameters: {
61
+ return React.forwardRef(function (linkProps, ref) { return ((0, jsx_runtime_1.jsx)(ChildLink, __assign({}, linkProps, { childId: reference === null || reference === void 0 ? void 0 : reference._ref, ref: ref, childParameters: {
38
62
  type: docType
39
63
  } }), void 0)); });
40
64
  }, [ChildLink, reference === null || reference === void 0 ? void 0 : reference._ref]);
41
65
  if (!(reference === null || reference === void 0 ? void 0 : reference._ref)) {
42
66
  return null;
43
67
  }
44
- return (_jsxs(Flex, __assign({ gap: 2, align: "center", style: { flex: 1 } }, { children: [publishedId || allItemsStatus !== 'success' ? (
68
+ return ((0, jsx_runtime_1.jsxs)(ui_1.Flex, __assign({ gap: 2, align: "center", style: { flex: 1 } }, { children: [publishedId || allItemsStatus !== 'success' ? (
45
69
  /* Card loosely copied from @sanity/desk-tool's PaneItem.tsx */
46
- _jsx(Card, __assign({ __unstable_focusRing: true, as: LinkComponent, tone: isActive ? 'primary' : 'default', padding: 1, radius: 2, flex: 1, "data-as": "a", "data-ui": "PaneItem" }, { children: _jsx(Preview, { layout: "default", type: schemaType, value: { _ref: draftId || (reference === null || reference === void 0 ? void 0 : reference._ref) }, status: _jsx(DocumentPreviewStatus, { draft: draftId
70
+ (0, jsx_runtime_1.jsx)(ui_1.Card, __assign({ __unstable_focusRing: true, as: LinkComponent, tone: isActive ? 'primary' : 'default', padding: 1, radius: 2, flex: 1, "data-as": "a", "data-ui": "PaneItem" }, { children: (0, jsx_runtime_1.jsx)(preview_1.default, { layout: "default", type: schemaType, value: { _ref: draftId || (reference === null || reference === void 0 ? void 0 : reference._ref) }, status: (0, jsx_runtime_1.jsx)(DocumentPreviewStatus_1.default, { draft: draftId
47
71
  ? {
48
72
  _id: draftId,
49
73
  _type: docType,
@@ -53,6 +77,6 @@ var DocumentInNode = function (props) {
53
77
  _id: reference === null || reference === void 0 ? void 0 : reference._ref,
54
78
  _type: docType,
55
79
  _updatedAt: props.item.publishedUpdatedAt
56
- } }, void 0) }, void 0) }), void 0)) : (_jsx(Card, __assign({ padding: 3, radius: 1, flex: 1 }, { children: _jsxs(Flex, __assign({ align: "center" }, { children: [_jsx(Text, __assign({ size: 2, muted: true, style: { flex: 1 } }, { children: "Invalid document" }), void 0), _jsx(Tooltip, __assign({ placement: "left", portal: true, content: _jsx(Box, __assign({ padding: 3 }, { children: _jsxs(Flex, __assign({ align: "flex-start", gap: 3 }, { children: [_jsx(TextWithTone, __assign({ tone: "default", size: 3 }, { children: _jsx(HelpCircleIcon, {}, void 0) }), void 0), _jsxs(Stack, __assign({ space: 3 }, { children: [_jsx(Text, __assign({ as: "h2", size: 1, weight: "semibold" }, { children: "This document is not valid" }), void 0), _jsxs(Text, __assign({ size: 1 }, { children: ["ID: ", reference === null || reference === void 0 ? void 0 : reference._ref] }), void 0)] }), void 0)] }), void 0) }), void 0) }, { children: _jsx(TextWithTone, __assign({ tone: "default", size: 2 }, { children: _jsx(HelpCircleIcon, {}, void 0) }), void 0) }), void 0)] }), void 0) }), void 0)), props.action] }), void 0));
80
+ } }, void 0) }, void 0) }), void 0)) : ((0, jsx_runtime_1.jsx)(ui_1.Card, __assign({ padding: 3, radius: 1, flex: 1 }, { children: (0, jsx_runtime_1.jsxs)(ui_1.Flex, __assign({ align: "center" }, { children: [(0, jsx_runtime_1.jsx)(ui_1.Text, __assign({ size: 2, muted: true, style: { flex: 1 } }, { children: "Invalid document" }), void 0), (0, jsx_runtime_1.jsx)(ui_1.Tooltip, __assign({ placement: "left", portal: true, content: (0, jsx_runtime_1.jsx)(ui_1.Box, __assign({ padding: 3 }, { children: (0, jsx_runtime_1.jsxs)(ui_1.Flex, __assign({ align: "flex-start", gap: 3 }, { children: [(0, jsx_runtime_1.jsx)(components_1.TextWithTone, __assign({ tone: "default", size: 3 }, { children: (0, jsx_runtime_1.jsx)(icons_1.HelpCircleIcon, {}, void 0) }), void 0), (0, jsx_runtime_1.jsxs)(ui_1.Stack, __assign({ space: 3 }, { children: [(0, jsx_runtime_1.jsx)(ui_1.Text, __assign({ as: "h2", size: 1, weight: "semibold" }, { children: "This document is not valid" }), void 0), (0, jsx_runtime_1.jsxs)(ui_1.Text, __assign({ size: 1 }, { children: ["ID: ", reference === null || reference === void 0 ? void 0 : reference._ref] }), void 0)] }), void 0)] }), void 0) }), void 0) }, { children: (0, jsx_runtime_1.jsx)(components_1.TextWithTone, __assign({ tone: "default", size: 2 }, { children: (0, jsx_runtime_1.jsx)(icons_1.HelpCircleIcon, {}, void 0) }), void 0) }), void 0)] }), void 0) }), void 0)), props.action] }), void 0));
57
81
  };
58
- export default DocumentInNode;
82
+ exports.default = DocumentInNode;
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import * as React from 'react';
2
2
  import { DocumentPair } from '../types';
3
3
  export declare function TimeAgo({ time }: {
4
4
  time: string | Date;
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __assign = (this && this.__assign) || function () {
2
3
  __assign = Object.assign || function(t) {
3
4
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -9,27 +10,30 @@ var __assign = (this && this.__assign) || function () {
9
10
  };
10
11
  return __assign.apply(this, arguments);
11
12
  };
12
- import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
13
- import { TextWithTone } from '@sanity/base/components';
14
- import { useTimeAgo } from '@sanity/base/hooks';
15
- import { EditIcon, PublishIcon } from '@sanity/icons';
16
- import { Box, Inline, Text, Tooltip } from '@sanity/ui';
17
- export function TimeAgo(_a) {
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.TimeAgo = void 0;
15
+ var jsx_runtime_1 = require("react/jsx-runtime");
16
+ var components_1 = require("@sanity/base/components");
17
+ var hooks_1 = require("@sanity/base/hooks");
18
+ var icons_1 = require("@sanity/icons");
19
+ var ui_1 = require("@sanity/ui");
20
+ function TimeAgo(_a) {
18
21
  var time = _a.time;
19
- var timeAgo = useTimeAgo(time);
20
- return (_jsxs("span", __assign({ title: timeAgo }, { children: [timeAgo, timeAgo.toLowerCase().trim().startsWith('just now') ? '' : ' ago'] }), void 0));
22
+ var timeAgo = (0, hooks_1.useTimeAgo)(time);
23
+ return ((0, jsx_runtime_1.jsxs)("span", __assign({ title: timeAgo }, { children: [timeAgo, timeAgo.toLowerCase().trim().startsWith('just now') ? '' : ' ago'] }), void 0));
21
24
  }
25
+ exports.TimeAgo = TimeAgo;
22
26
  var PublishedStatus = function (_a) {
23
27
  var document = _a.document;
24
- return (_jsx(Tooltip, __assign({ portal: true, content: _jsx(Box, __assign({ padding: 2 }, { children: _jsx(Text, __assign({ size: 1 }, { children: document ? (_jsxs(_Fragment, { children: ["Published ", document._updatedAt && _jsx(TimeAgo, { time: document._updatedAt }, void 0)] }, void 0)) : (_jsx(_Fragment, { children: "Not published" }, void 0)) }), void 0) }), void 0) }, { children: _jsx(TextWithTone, __assign({ tone: "positive", dimmed: !document, muted: !document, size: 1 }, { children: _jsx(PublishIcon, {}, void 0) }), void 0) }), void 0));
28
+ return ((0, jsx_runtime_1.jsx)(ui_1.Tooltip, __assign({ portal: true, content: (0, jsx_runtime_1.jsx)(ui_1.Box, __assign({ padding: 2 }, { children: (0, jsx_runtime_1.jsx)(ui_1.Text, __assign({ size: 1 }, { children: document ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Published ", document._updatedAt && (0, jsx_runtime_1.jsx)(TimeAgo, { time: document._updatedAt }, void 0)] }, void 0)) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "Not published" }, void 0)) }), void 0) }), void 0) }, { children: (0, jsx_runtime_1.jsx)(components_1.TextWithTone, __assign({ tone: "positive", dimmed: !document, muted: !document, size: 1 }, { children: (0, jsx_runtime_1.jsx)(icons_1.PublishIcon, {}, void 0) }), void 0) }), void 0));
25
29
  };
26
30
  var DraftStatus = function (_a) {
27
31
  var document = _a.document;
28
- return (_jsx(Tooltip, __assign({ portal: true, content: _jsx(Box, __assign({ padding: 2 }, { children: _jsx(Text, __assign({ size: 1 }, { children: document ? (_jsxs(_Fragment, { children: ["Edited ", (document === null || document === void 0 ? void 0 : document._updatedAt) && _jsx(TimeAgo, { time: document === null || document === void 0 ? void 0 : document._updatedAt }, void 0)] }, void 0)) : (_jsx(_Fragment, { children: "No unpublished edits" }, void 0)) }), void 0) }), void 0) }, { children: _jsx(TextWithTone, __assign({ tone: "caution", dimmed: !document, muted: !document, size: 1 }, { children: _jsx(EditIcon, {}, void 0) }), void 0) }), void 0));
32
+ return ((0, jsx_runtime_1.jsx)(ui_1.Tooltip, __assign({ portal: true, content: (0, jsx_runtime_1.jsx)(ui_1.Box, __assign({ padding: 2 }, { children: (0, jsx_runtime_1.jsx)(ui_1.Text, __assign({ size: 1 }, { children: document ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Edited ", (document === null || document === void 0 ? void 0 : document._updatedAt) && (0, jsx_runtime_1.jsx)(TimeAgo, { time: document === null || document === void 0 ? void 0 : document._updatedAt }, void 0)] }, void 0)) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "No unpublished edits" }, void 0)) }), void 0) }), void 0) }, { children: (0, jsx_runtime_1.jsx)(components_1.TextWithTone, __assign({ tone: "caution", dimmed: !document, muted: !document, size: 1 }, { children: (0, jsx_runtime_1.jsx)(icons_1.EditIcon, {}, void 0) }), void 0) }), void 0));
29
33
  };
30
34
  // Adapted from @sanity\desk-tool\src\components\paneItem\helpers.tsx
31
35
  var DocumentPreviewStatus = function (_a) {
32
36
  var draft = _a.draft, published = _a.published;
33
- return (_jsxs(Inline, __assign({ space: 4 }, { children: [_jsx(PublishedStatus, { document: published }, void 0), _jsx(DraftStatus, { document: draft }, void 0)] }), void 0));
37
+ return ((0, jsx_runtime_1.jsxs)(ui_1.Inline, __assign({ space: 4 }, { children: [(0, jsx_runtime_1.jsx)(PublishedStatus, { document: published }, void 0), (0, jsx_runtime_1.jsx)(DraftStatus, { document: draft }, void 0)] }), void 0));
34
38
  };
35
- export default DocumentPreviewStatus;
39
+ exports.default = DocumentPreviewStatus;
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import * as React from 'react';
2
2
  import { NodeProps } from '../types';
3
3
  /**
4
4
  * Applicable only to nodes inside the main tree.
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __assign = (this && this.__assign) || function () {
2
3
  __assign = Object.assign || function(t) {
3
4
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -9,29 +10,52 @@ var __assign = (this && this.__assign) || function () {
9
10
  };
10
11
  return __assign.apply(this, arguments);
11
12
  };
12
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { IntentLink } from '@sanity/base/components';
14
- import { CopyIcon, EllipsisVerticalIcon, LaunchIcon, RemoveCircleIcon } from '@sanity/icons';
15
- import { Button, Menu, MenuButton, MenuDivider, MenuItem } from '@sanity/ui';
16
- import React from 'react';
17
- import useTreeOperations from '../utils/useTreeOperations';
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
22
+ }) : function(o, v) {
23
+ o["default"] = v;
24
+ });
25
+ var __importStar = (this && this.__importStar) || function (mod) {
26
+ if (mod && mod.__esModule) return mod;
27
+ var result = {};
28
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
29
+ __setModuleDefault(result, mod);
30
+ return result;
31
+ };
32
+ var __importDefault = (this && this.__importDefault) || function (mod) {
33
+ return (mod && mod.__esModule) ? mod : { "default": mod };
34
+ };
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ var jsx_runtime_1 = require("react/jsx-runtime");
37
+ var components_1 = require("@sanity/base/components");
38
+ var icons_1 = require("@sanity/icons");
39
+ var ui_1 = require("@sanity/ui");
40
+ var React = __importStar(require("react"));
41
+ var useTreeOperations_1 = __importDefault(require("../hooks/useTreeOperations"));
18
42
  /**
19
43
  * Applicable only to nodes inside the main tree.
20
44
  * Unadded items have their actions defined in TreeEditor.
21
45
  */
22
46
  var NodeActions = function (_a) {
23
47
  var nodeProps = _a.nodeProps;
24
- var operations = useTreeOperations();
48
+ var operations = (0, useTreeOperations_1.default)();
25
49
  var node = nodeProps.node;
26
50
  var _b = (node === null || node === void 0 ? void 0 : node.value) || {}, reference = _b.reference, docType = _b.docType;
27
51
  // Adapted from @sanity\form-builder\src\inputs\ReferenceInput\ArrayItemReferenceInput.tsx
28
52
  var OpenLink = React.useMemo(function () {
29
53
  // eslint-disable-next-line @typescript-eslint/no-shadow
30
54
  return React.forwardRef(function OpenLinkInner(restProps, _ref) {
31
- return (_jsx(IntentLink, __assign({}, restProps, { intent: "edit", params: { id: reference === null || reference === void 0 ? void 0 : reference._ref, type: docType }, target: "_blank", rel: "noopener noreferrer", ref: _ref }), void 0));
55
+ return ((0, jsx_runtime_1.jsx)(components_1.IntentLink, __assign({}, restProps, { intent: "edit", params: { id: reference === null || reference === void 0 ? void 0 : reference._ref, type: docType }, target: "_blank", rel: "noopener noreferrer", ref: _ref }), void 0));
32
56
  });
33
57
  }, [reference === null || reference === void 0 ? void 0 : reference._ref, docType]);
34
58
  var isValid = !!node.publishedId;
35
- return (_jsx(MenuButton, { button: _jsx(Button, { padding: 2, mode: "bleed", icon: EllipsisVerticalIcon }, void 0), id: "hiearchical-doc-list--".concat(node._key, "-menuButton"), menu: _jsxs(Menu, { children: [_jsx(MenuItem, { text: "Remove from list", tone: "critical", icon: RemoveCircleIcon, onClick: function () { return operations.removeItem(nodeProps); } }, void 0), _jsx(MenuItem, { text: "Duplicate item", icon: CopyIcon, disabled: !isValid, onClick: function () { return operations.duplicateItem(nodeProps); } }, void 0), _jsx(MenuDivider, {}, void 0), _jsx(MenuItem, { text: "Open in new tab", icon: LaunchIcon, disabled: !isValid, as: OpenLink, "data-as": "a" }, void 0)] }, void 0), placement: "right", popover: { portal: true, tone: 'default' } }, void 0));
59
+ return ((0, jsx_runtime_1.jsx)(ui_1.MenuButton, { button: (0, jsx_runtime_1.jsx)(ui_1.Button, { padding: 2, mode: "bleed", icon: icons_1.EllipsisVerticalIcon }, void 0), id: "hiearchical-doc-list--".concat(node._key, "-menuButton"), menu: (0, jsx_runtime_1.jsxs)(ui_1.Menu, { children: [(0, jsx_runtime_1.jsx)(ui_1.MenuItem, { text: "Remove from list", tone: "critical", icon: icons_1.RemoveCircleIcon, onClick: function () { return operations.removeItem(nodeProps); } }, void 0), (0, jsx_runtime_1.jsx)(ui_1.MenuItem, { text: "Duplicate item", icon: icons_1.CopyIcon, disabled: !isValid, onClick: function () { return operations.duplicateItem(nodeProps); } }, void 0), (0, jsx_runtime_1.jsx)(ui_1.MenuDivider, {}, void 0), (0, jsx_runtime_1.jsx)(ui_1.MenuItem, { text: "Open in new tab", icon: icons_1.LaunchIcon, disabled: !isValid, as: OpenLink, "data-as": "a" }, void 0)] }, void 0), placement: "right", popover: { portal: true, tone: 'default' } }, void 0));
36
60
  };
37
- export default NodeActions;
61
+ exports.default = NodeActions;