@sanity/hierarchical-document-list 0.1.0 → 1.1.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 (85) hide show
  1. package/.husky/commit-msg +4 -0
  2. package/.husky/pre-commit +4 -0
  3. package/.idea/hierarchical-document-list.iml +11 -0
  4. package/.idea/inspectionProfiles/Project_Default.xml +6 -0
  5. package/.idea/misc.xml +6 -0
  6. package/.idea/modules.xml +8 -0
  7. package/.idea/prettier.xml +7 -0
  8. package/.idea/vcs.xml +6 -0
  9. package/CHANGELOG.md +15 -0
  10. package/README.md +329 -224
  11. package/commitlint.config.js +3 -0
  12. package/lib/TreeDeskStructure.d.ts +8 -7
  13. package/lib/TreeDeskStructure.js +96 -71
  14. package/lib/TreeInputComponent.d.ts +19 -19
  15. package/lib/TreeInputComponent.js +50 -21
  16. package/lib/components/DeskWarning.d.ts +6 -6
  17. package/lib/components/DeskWarning.js +46 -25
  18. package/lib/components/DocumentInNode.d.ts +11 -11
  19. package/lib/components/DocumentInNode.js +81 -58
  20. package/lib/components/DocumentPreviewStatus.d.ts +7 -7
  21. package/lib/components/DocumentPreviewStatus.js +39 -35
  22. package/lib/components/NodeActions.d.ts +10 -10
  23. package/lib/components/NodeActions.js +61 -37
  24. package/lib/components/NodeContentRenderer.d.ts +8 -8
  25. package/lib/components/NodeContentRenderer.js +105 -81
  26. package/lib/components/PlaceholderDropzone.d.ts +9 -9
  27. package/lib/components/PlaceholderDropzone.js +30 -28
  28. package/lib/components/SuppressedDnDManager.d.ts +2 -0
  29. package/lib/components/SuppressedDnDManager.js +59 -0
  30. package/lib/components/TreeEditor.d.ts +12 -12
  31. package/lib/components/TreeEditor.js +74 -54
  32. package/lib/components/TreeEditorErrorBoundary.d.ts +16 -17
  33. package/lib/components/TreeEditorErrorBoundary.js +74 -69
  34. package/lib/components/TreeNodeRenderer.d.ts +3 -3
  35. package/lib/components/TreeNodeRenderer.js +59 -35
  36. package/lib/components/TreeNodeRendererScaffold.d.ts +4 -4
  37. package/lib/components/TreeNodeRendererScaffold.js +44 -42
  38. package/lib/createDeskHierarchy.d.ts +14 -14
  39. package/lib/createDeskHierarchy.js +84 -67
  40. package/lib/createHierarchicalSchemas.d.ts +98 -0
  41. package/lib/createHierarchicalSchemas.js +138 -0
  42. package/lib/{utils → hooks}/useAllItems.d.ts +7 -7
  43. package/lib/{utils → hooks}/useAllItems.js +119 -94
  44. package/lib/{utils → hooks}/useLocalTree.d.ts +17 -17
  45. package/lib/{utils → hooks}/useLocalTree.js +59 -37
  46. package/lib/{utils → hooks}/useTreeOperations.d.ts +9 -9
  47. package/lib/hooks/useTreeOperations.js +39 -0
  48. package/lib/{utils → hooks}/useTreeOperationsProvider.d.ts +14 -14
  49. package/lib/hooks/useTreeOperationsProvider.js +85 -0
  50. package/lib/index.d.ts +3 -3
  51. package/lib/index.js +12 -3
  52. package/lib/schemas/hierarchy.tree.d.ts +13 -23
  53. package/lib/schemas/hierarchy.tree.js +19 -31
  54. package/lib/types.d.ts +128 -0
  55. package/lib/types.js +2 -0
  56. package/lib/utils/flatDataToTree.d.ts +6 -6
  57. package/lib/utils/flatDataToTree.js +26 -23
  58. package/lib/utils/getAdjescentNodes.d.ts +12 -12
  59. package/lib/utils/getAdjescentNodes.js +19 -16
  60. package/lib/utils/getCommonTreeProps.d.ts +7 -7
  61. package/lib/utils/getCommonTreeProps.js +33 -27
  62. package/lib/utils/getTreeHeight.d.ts +3 -3
  63. package/lib/utils/getTreeHeight.js +11 -7
  64. package/lib/utils/gradientPatchAdapter.d.ts +4 -4
  65. package/lib/utils/gradientPatchAdapter.js +40 -35
  66. package/lib/utils/idUtils.d.ts +2 -2
  67. package/lib/utils/idUtils.js +13 -8
  68. package/lib/utils/injectNodeTypeInPatches.d.ts +12 -0
  69. package/lib/utils/injectNodeTypeInPatches.js +59 -0
  70. package/lib/utils/moveItemInArray.d.ts +5 -5
  71. package/lib/utils/moveItemInArray.js +26 -23
  72. package/lib/utils/throwError.d.ts +7 -0
  73. package/lib/utils/throwError.js +12 -0
  74. package/lib/utils/treeData.d.ts +18 -18
  75. package/lib/utils/treeData.js +118 -106
  76. package/lib/utils/treePatches.d.ts +15 -15
  77. package/lib/utils/treePatches.js +171 -141
  78. package/lint-staged.config.js +4 -0
  79. package/package.json +65 -56
  80. package/sanity.json +12 -12
  81. package/tsconfig.json +20 -20
  82. package/lib/createHierarchicalField.d.ts +0 -8
  83. package/lib/createHierarchicalField.js +0 -51
  84. package/lib/utils/useTreeOperations.js +0 -16
  85. package/lib/utils/useTreeOperationsProvider.js +0 -60
@@ -1,54 +1,74 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { AddCircleIcon } from '@sanity/icons';
14
- import { Box, Button, Card, Flex, Spinner, Stack, Text, Tooltip } from '@sanity/ui';
15
- import SortableTree from 'react-sortable-tree';
16
- import getCommonTreeProps from '../utils/getCommonTreeProps';
17
- import getTreeHeight from '../utils/getTreeHeight';
18
- import { getUnaddedItems } from '../utils/treeData';
19
- import useAllItems from '../utils/useAllItems';
20
- import useLocalTree from '../utils/useLocalTree';
21
- import { TreeOperationsContext } from '../utils/useTreeOperations';
22
- import useTreeOperationsProvider from '../utils/useTreeOperationsProvider';
23
- import DocumentInNode from './DocumentInNode';
24
- import TreeEditorErrorBoundary from './TreeEditorErrorBoundary';
25
- /**
26
- * The loaded tree users interact with
27
- */
28
- var TreeEditor = function (props) {
29
- var _a = useAllItems(props.options), allItemsStatus = _a.status, allItems = _a.allItems;
30
- var unaddedItems = getUnaddedItems({ tree: props.tree, allItems: allItems });
31
- var _b = useLocalTree({
32
- tree: props.tree,
33
- allItems: allItems
34
- }), localTree = _b.localTree, handleVisibilityToggle = _b.handleVisibilityToggle;
35
- var operations = useTreeOperationsProvider({
36
- patchPrefix: props.patchPrefix,
37
- onChange: props.onChange,
38
- localTree: localTree
39
- });
40
- return (_jsx(TreeEditorErrorBoundary, { children: _jsx(TreeOperationsContext.Provider, __assign({ value: __assign(__assign({}, operations), { allItemsStatus: allItemsStatus }) }, { children: _jsxs(Stack, __assign({ space: 4, paddingTop: 4 }, { children: [_jsx(Card, __assign({ style: { minHeight: getTreeHeight(localTree) },
41
- // Only include borderBottom if there's something to show in unadded items
42
- borderBottom: allItemsStatus !== 'success' || (unaddedItems === null || unaddedItems === void 0 ? void 0 : unaddedItems.length) > 0 }, { children: _jsx(SortableTree, __assign({ maxDepth: props.options.maxDepth, onChange: function () {
43
- // Do nothing. onMoveNode will do all the work
44
- }, onVisibilityToggle: handleVisibilityToggle, onMoveNode: function (data) {
45
- return operations.handleMovedNode(data);
46
- }, treeData: localTree }, getCommonTreeProps({
47
- placeholder: {
48
- title: 'Add items from the list below'
49
- }
50
- })), void 0) }), void 0), allItemsStatus === 'success' && (unaddedItems === null || unaddedItems === void 0 ? void 0 : unaddedItems.length) > 0 && (_jsxs(Stack, __assign({ space: 1, paddingX: 2, paddingTop: 3 }, { children: [_jsxs(Stack, __assign({ space: 2, paddingX: 2, paddingBottom: 3 }, { children: [_jsx(Text, __assign({ size: 2, as: "h2", weight: "semibold" }, { children: "Add more items" }), void 0), _jsx(Text, __assign({ size: 1, muted: true }, { children: "Only published documents are shown." }), void 0)] }), void 0), unaddedItems.map(function (item) { return (_jsx(DocumentInNode, { item: item, action: _jsx(Tooltip, __assign({ portal: true, placement: "left", content: _jsx(Box, __assign({ padding: 2 }, { children: _jsx(Text, __assign({ size: 1 }, { children: "Add to list" }), void 0) }), void 0) }, { children: _jsx(Button, { onClick: function () {
51
- operations.addItem(item);
52
- }, mode: "bleed", icon: AddCircleIcon, style: { cursor: 'pointer' } }, void 0) }), void 0) }, item.publishedId || item.draftId)); })] }), void 0)), allItemsStatus === 'loading' && (_jsx(Flex, __assign({ padding: 4, align: 'center', justify: 'center' }, { children: _jsx(Spinner, { size: 3, muted: true }, void 0) }), void 0)), allItemsStatus === 'error' && (_jsx(Flex, __assign({ padding: 4, align: 'center', justify: 'center' }, { children: _jsx(Text, __assign({ size: 2, weight: "semibold" }, { children: "Something went wrong when loading documents" }), void 0) }), void 0))] }), void 0) }), void 0) }, void 0));
53
- };
54
- export default TreeEditor;
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ var jsx_runtime_1 = require("react/jsx-runtime");
18
+ var icons_1 = require("@sanity/icons");
19
+ var ui_1 = require("@sanity/ui");
20
+ var react_1 = require("react");
21
+ var react_sortable_tree_1 = require("react-sortable-tree");
22
+ var getCommonTreeProps_1 = __importDefault(require("../utils/getCommonTreeProps"));
23
+ var getTreeHeight_1 = __importDefault(require("../utils/getTreeHeight"));
24
+ var treeData_1 = require("../utils/treeData");
25
+ var useAllItems_1 = __importDefault(require("../hooks/useAllItems"));
26
+ var useLocalTree_1 = __importDefault(require("../hooks/useLocalTree"));
27
+ var useTreeOperations_1 = require("../hooks/useTreeOperations");
28
+ var useTreeOperationsProvider_1 = __importDefault(require("../hooks/useTreeOperationsProvider"));
29
+ var DocumentInNode_1 = __importDefault(require("./DocumentInNode"));
30
+ var react_dnd_1 = require("react-dnd");
31
+ var TreeEditorErrorBoundary_1 = require("./TreeEditorErrorBoundary");
32
+ var SuppressedDnDManager_1 = require("./SuppressedDnDManager");
33
+ /**
34
+ * The loaded tree users interact with
35
+ */
36
+ var TreeEditor = function (props) {
37
+ var _a = (0, useAllItems_1.default)(props.options), allItemsStatus = _a.status, allItems = _a.allItems;
38
+ var unaddedItems = (0, treeData_1.getUnaddedItems)({ tree: props.tree, allItems: allItems });
39
+ var _b = (0, useLocalTree_1.default)({
40
+ tree: props.tree,
41
+ allItems: allItems
42
+ }), localTree = _b.localTree, handleVisibilityToggle = _b.handleVisibilityToggle;
43
+ var operations = (0, useTreeOperationsProvider_1.default)({
44
+ patchPrefix: props.patchPrefix,
45
+ onChange: props.onChange,
46
+ localTree: localTree
47
+ });
48
+ var onMoveNode = (0, react_1.useCallback)(function (data) {
49
+ return operations.handleMovedNode(data);
50
+ }, [operations]);
51
+ var treeProps = (0, react_1.useMemo)(function () {
52
+ return (0, getCommonTreeProps_1.default)({
53
+ placeholder: {
54
+ title: 'Add items from the list below'
55
+ }
56
+ });
57
+ }, []);
58
+ var operationContext = (0, react_1.useMemo)(function () { return (__assign(__assign({}, operations), { allItemsStatus: allItemsStatus })); }, [operations, allItemsStatus]);
59
+ return ((0, jsx_runtime_1.jsx)(TreeEditorErrorBoundary_1.TreeEditorErrorBoundary, { children: (0, jsx_runtime_1.jsx)(react_dnd_1.DndProvider, __assign({ manager: SuppressedDnDManager_1.suppressedDnDManager }, { children: (0, jsx_runtime_1.jsx)(useTreeOperations_1.TreeOperationsContext.Provider, __assign({ value: operationContext }, { children: (0, jsx_runtime_1.jsxs)(ui_1.Stack, __assign({ space: 4, paddingTop: 4 }, { children: [(0, jsx_runtime_1.jsx)(ui_1.Card, __assign({ style: { minHeight: (0, getTreeHeight_1.default)(localTree) },
60
+ // Only include borderBottom if there's something to show in unadded items
61
+ borderBottom: allItemsStatus !== 'success' || (unaddedItems === null || unaddedItems === void 0 ? void 0 : unaddedItems.length) > 0 }, { children: (0, jsx_runtime_1.jsx)(react_sortable_tree_1.SortableTreeWithoutDndContext, __assign({ maxDepth: props.options.maxDepth, onChange: doNothingOnChange, onVisibilityToggle: handleVisibilityToggle, canDrop: canDrop, onMoveNode: onMoveNode, treeData: localTree }, treeProps), void 0) }), void 0), allItemsStatus === 'success' && (unaddedItems === null || unaddedItems === void 0 ? void 0 : unaddedItems.length) > 0 && ((0, jsx_runtime_1.jsxs)(ui_1.Stack, __assign({ space: 1, paddingX: 2, paddingTop: 3 }, { children: [(0, jsx_runtime_1.jsxs)(ui_1.Stack, __assign({ space: 2, paddingX: 2, paddingBottom: 3 }, { children: [(0, jsx_runtime_1.jsx)(ui_1.Text, __assign({ size: 2, as: "h2", weight: "semibold" }, { children: "Add more items" }), void 0), (0, jsx_runtime_1.jsx)(ui_1.Text, __assign({ size: 1, muted: true }, { children: "Only published documents are shown." }), void 0)] }), void 0), unaddedItems.map(function (item) { return ((0, jsx_runtime_1.jsx)(DocumentInNode_1.default, { item: item, action: (0, jsx_runtime_1.jsx)(ui_1.Tooltip, __assign({ portal: true, placement: "left", 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: "Add to list" }), void 0) }), void 0) }, { children: (0, jsx_runtime_1.jsx)(ui_1.Button, { onClick: function () {
62
+ operations.addItem(item);
63
+ }, mode: "bleed", icon: icons_1.AddCircleIcon, style: { cursor: 'pointer' } }, void 0) }), void 0) }, item.publishedId || item.draftId)); })] }), void 0)), allItemsStatus === 'loading' && ((0, jsx_runtime_1.jsx)(ui_1.Flex, __assign({ padding: 4, align: 'center', justify: 'center' }, { children: (0, jsx_runtime_1.jsx)(ui_1.Spinner, { size: 3, muted: true }, void 0) }), void 0)), allItemsStatus === 'error' && ((0, jsx_runtime_1.jsx)(ui_1.Flex, __assign({ padding: 4, align: 'center', justify: 'center' }, { children: (0, jsx_runtime_1.jsx)(ui_1.Text, __assign({ size: 2, weight: "semibold" }, { children: "Something went wrong when loading documents" }), void 0) }), void 0))] }), void 0) }), void 0) }), void 0) }, void 0));
64
+ };
65
+ function canDrop(_a) {
66
+ var nextPath = _a.nextPath, prevPath = _a.prevPath;
67
+ var insideItself = nextPath.length >= prevPath.length &&
68
+ prevPath.every(function (pathIndex, index) { return nextPath[index] === pathIndex; });
69
+ return !insideItself;
70
+ }
71
+ var doNothingOnChange = function () {
72
+ // Do nothing. onMoveNode will do all the work
73
+ };
74
+ exports.default = TreeEditor;
@@ -1,17 +1,16 @@
1
- import React from 'react';
2
- interface ErrorInfo {
3
- title: string;
4
- description?: string;
5
- }
6
- declare class TreeEditorErrorBoundary extends React.Component<any, {
7
- error?: ErrorInfo;
8
- }> {
9
- constructor(props: any);
10
- static getDerivedStateFromError(error: unknown): {
11
- error: undefined;
12
- } | {
13
- error: ErrorInfo;
14
- };
15
- render(): JSX.Element;
16
- }
17
- export default TreeEditorErrorBoundary;
1
+ import * as React from 'react';
2
+ /**
3
+ * react-sortable-tree emits a lot of random errors when dragging to invalid states,
4
+ * even when drag-targets are disabled.
5
+ *
6
+ * This boundary is a workaround so users are not pestered with error-toasts for things
7
+ * that have no functional impact.
8
+ *
9
+ * This boundry does NOT handle errors that happen in the React dnd
10
+ * event handlers, so there is addtional workarounds in the
11
+ * DnDManager.
12
+ * */
13
+ export declare class TreeEditorErrorBoundary extends React.Component {
14
+ componentDidCatch(): void;
15
+ render(): React.ReactNode;
16
+ }
@@ -1,69 +1,74 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
- import { useToast } from '@sanity/ui';
18
- import React from 'react';
19
- var ErrorToast = function (_a) {
20
- var error = _a.error;
21
- var push = useToast().push;
22
- React.useEffect(function () {
23
- if (error === null || error === void 0 ? void 0 : error.title) {
24
- push({
25
- title: error.title,
26
- description: error.description,
27
- closable: true,
28
- status: 'error',
29
- id: 'hierarchical-error'
30
- });
31
- }
32
- }, [error]);
33
- return null;
34
- };
35
- var TreeEditorErrorBoundary = /** @class */ (function (_super) {
36
- __extends(TreeEditorErrorBoundary, _super);
37
- function TreeEditorErrorBoundary(props) {
38
- var _this = _super.call(this, props) || this;
39
- _this.state = { error: undefined };
40
- return _this;
41
- }
42
- Object.defineProperty(TreeEditorErrorBoundary, "getDerivedStateFromError", {
43
- enumerable: false,
44
- configurable: true,
45
- writable: true,
46
- value: function (error) {
47
- if (!error) {
48
- return {
49
- error: undefined
50
- };
51
- }
52
- return {
53
- error: {
54
- title: 'Something went wrong'
55
- }
56
- };
57
- }
58
- });
59
- Object.defineProperty(TreeEditorErrorBoundary.prototype, "render", {
60
- enumerable: false,
61
- configurable: true,
62
- writable: true,
63
- value: function () {
64
- return (_jsxs(React.Fragment, { children: [_jsx(ErrorToast, { error: this.state.error }, void 0), this.props.children] }, void 0));
65
- }
66
- });
67
- return TreeEditorErrorBoundary;
68
- }(React.Component));
69
- export default TreeEditorErrorBoundary;
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.TreeEditorErrorBoundary = void 0;
38
+ var React = __importStar(require("react"));
39
+ /**
40
+ * react-sortable-tree emits a lot of random errors when dragging to invalid states,
41
+ * even when drag-targets are disabled.
42
+ *
43
+ * This boundary is a workaround so users are not pestered with error-toasts for things
44
+ * that have no functional impact.
45
+ *
46
+ * This boundry does NOT handle errors that happen in the React dnd
47
+ * event handlers, so there is addtional workarounds in the
48
+ * DnDManager.
49
+ * */
50
+ var TreeEditorErrorBoundary = /** @class */ (function (_super) {
51
+ __extends(TreeEditorErrorBoundary, _super);
52
+ function TreeEditorErrorBoundary() {
53
+ return _super !== null && _super.apply(this, arguments) || this;
54
+ }
55
+ // eslint-disable-next-line class-methods-use-this
56
+ Object.defineProperty(TreeEditorErrorBoundary.prototype, "componentDidCatch", {
57
+ enumerable: false,
58
+ configurable: true,
59
+ writable: true,
60
+ value: function () {
61
+ // do nothing
62
+ }
63
+ });
64
+ Object.defineProperty(TreeEditorErrorBoundary.prototype, "render", {
65
+ enumerable: false,
66
+ configurable: true,
67
+ writable: true,
68
+ value: function () {
69
+ return this.props.children;
70
+ }
71
+ });
72
+ return TreeEditorErrorBoundary;
73
+ }(React.Component));
74
+ exports.TreeEditorErrorBoundary = TreeEditorErrorBoundary;
@@ -1,3 +1,3 @@
1
- import { TreeRenderer } from 'react-sortable-tree';
2
- declare const TreeNodeRenderer: TreeRenderer;
3
- export default TreeNodeRenderer;
1
+ import { TreeRenderer } from 'react-sortable-tree';
2
+ declare const TreeNodeRenderer: TreeRenderer;
3
+ export default TreeNodeRenderer;
@@ -1,35 +1,59 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- import React from 'react';
14
- import TreeNodeRendererScaffold from './TreeNodeRendererScaffold';
15
- /**
16
- * To prevent expand buttons from overflowing on the left, we add a minimum left padding to all entries
17
- */
18
- var BASE_LEFT_PADDING = 10;
19
- var NESTING_PADDING = 14;
20
- var TreeNodeRenderer = function (props) {
21
- var children = props.children, lowerSiblingCounts = props.lowerSiblingCounts, connectDropTarget = props.connectDropTarget, isOver = props.isOver, draggedNode = props.draggedNode, canDrop = props.canDrop;
22
- // Construct the scaffold representing the structure of the tree
23
- var scaffoldBlockCount = lowerSiblingCounts.length;
24
- return connectDropTarget(_jsxs("div", __assign({ style: props.style }, { children: [_jsx("div", __assign({ style: {
25
- // prettier-ignore
26
- paddingLeft: "".concat(BASE_LEFT_PADDING + (NESTING_PADDING * scaffoldBlockCount), "px")
27
- } }, { children: React.Children.map(children, function (child) {
28
- return React.cloneElement(child, {
29
- isOver: isOver,
30
- canDrop: canDrop,
31
- draggedNode: draggedNode
32
- });
33
- }) }), void 0), _jsx(TreeNodeRendererScaffold, __assign({}, props), void 0)] }), void 0));
34
- };
35
- export default TreeNodeRenderer;
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
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
+ };
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 React = __importStar(require("react"));
38
+ var TreeNodeRendererScaffold_1 = __importDefault(require("./TreeNodeRendererScaffold"));
39
+ /**
40
+ * To prevent expand buttons from overflowing on the left, we add a minimum left padding to all entries
41
+ */
42
+ var BASE_LEFT_PADDING = 10;
43
+ var NESTING_PADDING = 14;
44
+ var TreeNodeRenderer = function (props) {
45
+ var children = props.children, lowerSiblingCounts = props.lowerSiblingCounts, connectDropTarget = props.connectDropTarget, isOver = props.isOver, draggedNode = props.draggedNode, canDrop = props.canDrop;
46
+ // Construct the scaffold representing the structure of the tree
47
+ var scaffoldBlockCount = lowerSiblingCounts.length;
48
+ return connectDropTarget((0, jsx_runtime_1.jsxs)("div", __assign({ style: props.style }, { children: [(0, jsx_runtime_1.jsx)("div", __assign({ style: {
49
+ // prettier-ignore
50
+ paddingLeft: "".concat(BASE_LEFT_PADDING + (NESTING_PADDING * scaffoldBlockCount), "px")
51
+ } }, { children: React.Children.map(children, function (child) {
52
+ return React.cloneElement(child, {
53
+ isOver: isOver,
54
+ canDrop: canDrop,
55
+ draggedNode: draggedNode
56
+ });
57
+ }) }), void 0), (0, jsx_runtime_1.jsx)(TreeNodeRendererScaffold_1.default, __assign({}, props), void 0)] }), void 0));
58
+ };
59
+ exports.default = TreeNodeRenderer;
@@ -1,4 +1,4 @@
1
- import React from 'react';
2
- import { TreeRendererProps } from 'react-sortable-tree';
3
- declare const TreeNodeRendererScaffold: React.FC<TreeRendererProps>;
4
- export default TreeNodeRendererScaffold;
1
+ import * as React from 'react';
2
+ import { TreeRendererProps } from 'react-sortable-tree';
3
+ declare const TreeNodeRendererScaffold: React.FC<TreeRendererProps>;
4
+ export default TreeNodeRendererScaffold;
@@ -1,42 +1,44 @@
1
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
- return cooked;
4
- };
5
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
6
- import { blue } from '@sanity/color';
7
- import { createGlobalStyle } from 'styled-components';
8
- // Adapted from react-sortable-tree/src/tree-node.js
9
- var ScaffoldStyles = createGlobalStyle(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n .rst__lineBlock,\n .rst__absoluteLineBlock {\n height: 100%;\n position: relative;\n display: inline-block;\n --stroke-width: 3px;\n }\n\n .rst__absoluteLineBlock {\n position: absolute;\n top: 0;\n }\n\n /* Highlight line for pointing to dragged row destination\n ========================================================================== */\n /**\n * +--+--+\n * | | |\n * | | |\n * | | |\n * +--+--+\n */\n .rst__highlightLineVertical {\n z-index: 3;\n }\n .rst__highlightLineVertical::before {\n position: absolute;\n content: '';\n background-color: ", ";\n width: calc(var(--stroke-width) * 2);\n margin-left: calc(var(--stroke-width) * -1);\n left: 50%;\n top: 0;\n height: 100%;\n }\n\n @keyframes arrow-pulse {\n 0% {\n transform: translate(0, 0);\n opacity: 0;\n }\n 30% {\n transform: translate(0, 300%);\n opacity: 1;\n }\n 70% {\n transform: translate(0, 700%);\n opacity: 1;\n }\n 100% {\n transform: translate(0, 1000%);\n opacity: 0;\n }\n }\n .rst__highlightLineVertical::after {\n content: '';\n position: absolute;\n height: 0;\n margin-left: calc(var(--stroke-width) * -1);\n left: 50%;\n top: 0;\n border-left: var(--stroke-width) solid transparent;\n border-right: var(--stroke-width) solid transparent;\n border-top: var(--stroke-width) solid white;\n animation: arrow-pulse 1s infinite linear both;\n }\n\n /**\n * +-----+\n * | |\n * | +--+\n * | | |\n * +--+--+\n */\n .rst__highlightTopLeftCorner::before {\n z-index: 3;\n content: '';\n position: absolute;\n border-top: solid calc(var(--stroke-width) * 2) ", ";\n border-left: solid calc(var(--stroke-width) * 2) ", ";\n box-sizing: border-box;\n height: calc(50% + var(--stroke-width));\n top: 50%;\n margin-top: calc(var(--stroke-width) * -1);\n right: 0;\n width: calc(50% + var(--stroke-width));\n }\n\n /**\n * +--+--+\n * | | |\n * | | |\n * | +->|\n * +-----+\n */\n .rst__highlightBottomLeftCorner {\n z-index: 3;\n }\n .rst__highlightBottomLeftCorner::before {\n content: '';\n position: absolute;\n border-bottom: solid calc(var(--stroke-width) * 2) ", ";\n border-left: solid calc(var(--stroke-width) * 2) ", ";\n box-sizing: border-box;\n height: calc(100% + var(--stroke-width));\n top: 0;\n right: calc(var(--stroke-width) * 3);\n width: calc(50% - calc(var(--stroke-width) * 2));\n }\n\n .rst__highlightBottomLeftCorner::after {\n content: '';\n position: absolute;\n height: 0;\n right: 0;\n top: 100%;\n margin-top: calc(var(--stroke-width) * -3);\n border-top: calc(var(--stroke-width) * 3) solid transparent;\n border-bottom: calc(var(--stroke-width) * 3) solid transparent;\n border-left: calc(var(--stroke-width) * 3) solid ", ";\n }\n\n .rst__unclickable {\n pointer-events: none;\n margin-top: -calc(var(--stroke-width) * 3);\n }\n"], ["\n .rst__lineBlock,\n .rst__absoluteLineBlock {\n height: 100%;\n position: relative;\n display: inline-block;\n --stroke-width: 3px;\n }\n\n .rst__absoluteLineBlock {\n position: absolute;\n top: 0;\n }\n\n /* Highlight line for pointing to dragged row destination\n ========================================================================== */\n /**\n * +--+--+\n * | | |\n * | | |\n * | | |\n * +--+--+\n */\n .rst__highlightLineVertical {\n z-index: 3;\n }\n .rst__highlightLineVertical::before {\n position: absolute;\n content: '';\n background-color: ", ";\n width: calc(var(--stroke-width) * 2);\n margin-left: calc(var(--stroke-width) * -1);\n left: 50%;\n top: 0;\n height: 100%;\n }\n\n @keyframes arrow-pulse {\n 0% {\n transform: translate(0, 0);\n opacity: 0;\n }\n 30% {\n transform: translate(0, 300%);\n opacity: 1;\n }\n 70% {\n transform: translate(0, 700%);\n opacity: 1;\n }\n 100% {\n transform: translate(0, 1000%);\n opacity: 0;\n }\n }\n .rst__highlightLineVertical::after {\n content: '';\n position: absolute;\n height: 0;\n margin-left: calc(var(--stroke-width) * -1);\n left: 50%;\n top: 0;\n border-left: var(--stroke-width) solid transparent;\n border-right: var(--stroke-width) solid transparent;\n border-top: var(--stroke-width) solid white;\n animation: arrow-pulse 1s infinite linear both;\n }\n\n /**\n * +-----+\n * | |\n * | +--+\n * | | |\n * +--+--+\n */\n .rst__highlightTopLeftCorner::before {\n z-index: 3;\n content: '';\n position: absolute;\n border-top: solid calc(var(--stroke-width) * 2) ", ";\n border-left: solid calc(var(--stroke-width) * 2) ", ";\n box-sizing: border-box;\n height: calc(50% + var(--stroke-width));\n top: 50%;\n margin-top: calc(var(--stroke-width) * -1);\n right: 0;\n width: calc(50% + var(--stroke-width));\n }\n\n /**\n * +--+--+\n * | | |\n * | | |\n * | +->|\n * +-----+\n */\n .rst__highlightBottomLeftCorner {\n z-index: 3;\n }\n .rst__highlightBottomLeftCorner::before {\n content: '';\n position: absolute;\n border-bottom: solid calc(var(--stroke-width) * 2) ", ";\n border-left: solid calc(var(--stroke-width) * 2) ", ";\n box-sizing: border-box;\n height: calc(100% + var(--stroke-width));\n top: 0;\n right: calc(var(--stroke-width) * 3);\n width: calc(50% - calc(var(--stroke-width) * 2));\n }\n\n .rst__highlightBottomLeftCorner::after {\n content: '';\n position: absolute;\n height: 0;\n right: 0;\n top: 100%;\n margin-top: calc(var(--stroke-width) * -3);\n border-top: calc(var(--stroke-width) * 3) solid transparent;\n border-bottom: calc(var(--stroke-width) * 3) solid transparent;\n border-left: calc(var(--stroke-width) * 3) solid ", ";\n }\n\n .rst__unclickable {\n pointer-events: none;\n margin-top: -calc(var(--stroke-width) * 3);\n }\n"])), blue[400].hex, blue[400].hex, blue[400].hex, blue[400].hex, blue[400].hex, blue[400].hex);
10
- var TreeNodeRendererScaffold = function (props) {
11
- var lowerSiblingCounts = props.lowerSiblingCounts, scaffoldBlockPxWidth = props.scaffoldBlockPxWidth, listIndex = props.listIndex, swapDepth = props.swapDepth, swapFrom = props.swapFrom, swapLength = props.swapLength, treeIndex = props.treeIndex;
12
- // Construct the scaffold representing the structure of the tree
13
- var scaffold = lowerSiblingCounts.map(function (lowerSiblingCount, i) {
14
- if (lowerSiblingCount < 0 || treeIndex === listIndex || i !== swapDepth) {
15
- return null;
16
- }
17
- // This row has been shifted, and is at the depth of
18
- // the line pointing to the new destination
19
- var highlightLineClass = '';
20
- if (listIndex === (swapFrom || 0) + (swapLength || 0) - 1) {
21
- // This block is on the bottom (target) line
22
- // This block points at the target block (where the row will go when released)
23
- highlightLineClass = 'rst__highlightBottomLeftCorner';
24
- }
25
- else if (treeIndex === swapFrom) {
26
- // This block is on the top (source) line
27
- highlightLineClass = 'rst__highlightTopLeftCorner';
28
- }
29
- else {
30
- // This block is between the bottom and top
31
- highlightLineClass = 'rst__highlightLineVertical';
32
- }
33
- var style = {
34
- width: scaffoldBlockPxWidth,
35
- left: scaffoldBlockPxWidth * i
36
- };
37
- return (_jsx("div", { style: style, className: "rst__unclickable rst__absoluteLineBlock ".concat(highlightLineClass || ''), tabIndex: -1 }, i));
38
- });
39
- return (_jsxs(_Fragment, { children: [scaffold, _jsx(ScaffoldStyles, {}, void 0)] }, void 0));
40
- };
41
- export default TreeNodeRendererScaffold;
42
- var templateObject_1;
1
+ "use strict";
2
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
+ return cooked;
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ var jsx_runtime_1 = require("react/jsx-runtime");
8
+ var color_1 = require("@sanity/color");
9
+ var styled_components_1 = require("styled-components");
10
+ // Adapted from react-sortable-tree/src/tree-node.js
11
+ var ScaffoldStyles = (0, styled_components_1.createGlobalStyle)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n .rst__lineBlock,\n .rst__absoluteLineBlock {\n height: 100%;\n position: relative;\n display: inline-block;\n --stroke-width: 3px;\n }\n\n .rst__absoluteLineBlock {\n position: absolute;\n top: 0;\n }\n\n /* Highlight line for pointing to dragged row destination\n ========================================================================== */\n /**\n * +--+--+\n * | | |\n * | | |\n * | | |\n * +--+--+\n */\n .rst__highlightLineVertical {\n z-index: 3;\n }\n .rst__highlightLineVertical::before {\n position: absolute;\n content: '';\n background-color: ", ";\n width: calc(var(--stroke-width) * 2);\n margin-left: calc(var(--stroke-width) * -1);\n left: 50%;\n top: 0;\n height: 100%;\n }\n\n @keyframes arrow-pulse {\n 0% {\n transform: translate(0, 0);\n opacity: 0;\n }\n 30% {\n transform: translate(0, 300%);\n opacity: 1;\n }\n 70% {\n transform: translate(0, 700%);\n opacity: 1;\n }\n 100% {\n transform: translate(0, 1000%);\n opacity: 0;\n }\n }\n .rst__highlightLineVertical::after {\n content: '';\n position: absolute;\n height: 0;\n margin-left: calc(var(--stroke-width) * -1);\n left: 50%;\n top: 0;\n border-left: var(--stroke-width) solid transparent;\n border-right: var(--stroke-width) solid transparent;\n border-top: var(--stroke-width) solid white;\n animation: arrow-pulse 1s infinite linear both;\n }\n\n /**\n * +-----+\n * | |\n * | +--+\n * | | |\n * +--+--+\n */\n .rst__highlightTopLeftCorner::before {\n z-index: 3;\n content: '';\n position: absolute;\n border-top: solid calc(var(--stroke-width) * 2) ", ";\n border-left: solid calc(var(--stroke-width) * 2) ", ";\n box-sizing: border-box;\n height: calc(50% + var(--stroke-width));\n top: 50%;\n margin-top: calc(var(--stroke-width) * -1);\n right: 0;\n width: calc(50% + var(--stroke-width));\n }\n\n /**\n * +--+--+\n * | | |\n * | | |\n * | +->|\n * +-----+\n */\n .rst__highlightBottomLeftCorner {\n z-index: 3;\n }\n .rst__highlightBottomLeftCorner::before {\n content: '';\n position: absolute;\n border-bottom: solid calc(var(--stroke-width) * 2) ", ";\n border-left: solid calc(var(--stroke-width) * 2) ", ";\n box-sizing: border-box;\n height: calc(100% + var(--stroke-width));\n top: 0;\n right: calc(var(--stroke-width) * 3);\n width: calc(50% - calc(var(--stroke-width) * 2));\n }\n\n .rst__highlightBottomLeftCorner::after {\n content: '';\n position: absolute;\n height: 0;\n right: 0;\n top: 100%;\n margin-top: calc(var(--stroke-width) * -3);\n border-top: calc(var(--stroke-width) * 3) solid transparent;\n border-bottom: calc(var(--stroke-width) * 3) solid transparent;\n border-left: calc(var(--stroke-width) * 3) solid ", ";\n }\n\n .rst__unclickable {\n pointer-events: none;\n margin-top: -calc(var(--stroke-width) * 3);\n }\n"], ["\n .rst__lineBlock,\n .rst__absoluteLineBlock {\n height: 100%;\n position: relative;\n display: inline-block;\n --stroke-width: 3px;\n }\n\n .rst__absoluteLineBlock {\n position: absolute;\n top: 0;\n }\n\n /* Highlight line for pointing to dragged row destination\n ========================================================================== */\n /**\n * +--+--+\n * | | |\n * | | |\n * | | |\n * +--+--+\n */\n .rst__highlightLineVertical {\n z-index: 3;\n }\n .rst__highlightLineVertical::before {\n position: absolute;\n content: '';\n background-color: ", ";\n width: calc(var(--stroke-width) * 2);\n margin-left: calc(var(--stroke-width) * -1);\n left: 50%;\n top: 0;\n height: 100%;\n }\n\n @keyframes arrow-pulse {\n 0% {\n transform: translate(0, 0);\n opacity: 0;\n }\n 30% {\n transform: translate(0, 300%);\n opacity: 1;\n }\n 70% {\n transform: translate(0, 700%);\n opacity: 1;\n }\n 100% {\n transform: translate(0, 1000%);\n opacity: 0;\n }\n }\n .rst__highlightLineVertical::after {\n content: '';\n position: absolute;\n height: 0;\n margin-left: calc(var(--stroke-width) * -1);\n left: 50%;\n top: 0;\n border-left: var(--stroke-width) solid transparent;\n border-right: var(--stroke-width) solid transparent;\n border-top: var(--stroke-width) solid white;\n animation: arrow-pulse 1s infinite linear both;\n }\n\n /**\n * +-----+\n * | |\n * | +--+\n * | | |\n * +--+--+\n */\n .rst__highlightTopLeftCorner::before {\n z-index: 3;\n content: '';\n position: absolute;\n border-top: solid calc(var(--stroke-width) * 2) ", ";\n border-left: solid calc(var(--stroke-width) * 2) ", ";\n box-sizing: border-box;\n height: calc(50% + var(--stroke-width));\n top: 50%;\n margin-top: calc(var(--stroke-width) * -1);\n right: 0;\n width: calc(50% + var(--stroke-width));\n }\n\n /**\n * +--+--+\n * | | |\n * | | |\n * | +->|\n * +-----+\n */\n .rst__highlightBottomLeftCorner {\n z-index: 3;\n }\n .rst__highlightBottomLeftCorner::before {\n content: '';\n position: absolute;\n border-bottom: solid calc(var(--stroke-width) * 2) ", ";\n border-left: solid calc(var(--stroke-width) * 2) ", ";\n box-sizing: border-box;\n height: calc(100% + var(--stroke-width));\n top: 0;\n right: calc(var(--stroke-width) * 3);\n width: calc(50% - calc(var(--stroke-width) * 2));\n }\n\n .rst__highlightBottomLeftCorner::after {\n content: '';\n position: absolute;\n height: 0;\n right: 0;\n top: 100%;\n margin-top: calc(var(--stroke-width) * -3);\n border-top: calc(var(--stroke-width) * 3) solid transparent;\n border-bottom: calc(var(--stroke-width) * 3) solid transparent;\n border-left: calc(var(--stroke-width) * 3) solid ", ";\n }\n\n .rst__unclickable {\n pointer-events: none;\n margin-top: -calc(var(--stroke-width) * 3);\n }\n"])), color_1.blue[400].hex, color_1.blue[400].hex, color_1.blue[400].hex, color_1.blue[400].hex, color_1.blue[400].hex, color_1.blue[400].hex);
12
+ var TreeNodeRendererScaffold = function (props) {
13
+ var lowerSiblingCounts = props.lowerSiblingCounts, scaffoldBlockPxWidth = props.scaffoldBlockPxWidth, listIndex = props.listIndex, swapDepth = props.swapDepth, swapFrom = props.swapFrom, swapLength = props.swapLength, treeIndex = props.treeIndex;
14
+ // Construct the scaffold representing the structure of the tree
15
+ var scaffold = lowerSiblingCounts.map(function (lowerSiblingCount, i) {
16
+ if (lowerSiblingCount < 0 || treeIndex === listIndex || i !== swapDepth) {
17
+ return null;
18
+ }
19
+ // This row has been shifted, and is at the depth of
20
+ // the line pointing to the new destination
21
+ var highlightLineClass = '';
22
+ if (listIndex === (swapFrom || 0) + (swapLength || 0) - 1) {
23
+ // This block is on the bottom (target) line
24
+ // This block points at the target block (where the row will go when released)
25
+ highlightLineClass = 'rst__highlightBottomLeftCorner';
26
+ }
27
+ else if (treeIndex === swapFrom) {
28
+ // This block is on the top (source) line
29
+ highlightLineClass = 'rst__highlightTopLeftCorner';
30
+ }
31
+ else {
32
+ // This block is between the bottom and top
33
+ highlightLineClass = 'rst__highlightLineVertical';
34
+ }
35
+ var style = {
36
+ width: scaffoldBlockPxWidth,
37
+ left: scaffoldBlockPxWidth * i
38
+ };
39
+ return ((0, jsx_runtime_1.jsx)("div", { style: style, className: "rst__unclickable rst__absoluteLineBlock ".concat(highlightLineClass || ''), tabIndex: -1 }, i));
40
+ });
41
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [scaffold, (0, jsx_runtime_1.jsx)(ScaffoldStyles, {}, void 0)] }, void 0));
42
+ };
43
+ exports.default = TreeNodeRendererScaffold;
44
+ var templateObject_1;
@@ -1,14 +1,14 @@
1
- import { TreeDeskStructureProps } from './types';
2
- interface TreeProps extends TreeDeskStructureProps {
3
- /**
4
- * Visible title above the tree.
5
- * Also used as the label in the desk list item.
6
- */
7
- title: string;
8
- /**
9
- * Optional icon for rendering the item in the desk structure.
10
- */
11
- icon?: any;
12
- }
13
- export default function createDeskHierarchy(props: TreeProps): import("@sanity/structure/dist/dts/ListItem").ListItemBuilder;
14
- export {};
1
+ import { TreeDeskStructureProps } from './types';
2
+ interface TreeProps extends TreeDeskStructureProps {
3
+ /**
4
+ * Visible title above the tree.
5
+ * Also used as the label in the desk list item.
6
+ */
7
+ title: string;
8
+ /**
9
+ * Optional icon for rendering the item in the desk structure.
10
+ */
11
+ icon?: any;
12
+ }
13
+ export default function createDeskHierarchy(props: TreeProps): import("@sanity/structure/dist/dts/ListItem").ListItemBuilder;
14
+ export {};