Skip to content

Commit 45ca543

Browse files
authored
refactor: deprecate tree component (#4130)
Tree component we use for pages and instances got overcomplicated with time and should be reimplemented to move forward with css variables.
1 parent dcc75c1 commit 45ca543

File tree

9 files changed

+15
-15
lines changed

9 files changed

+15
-15
lines changed

packages/design-system/src/components/tree/horizontal-shift.test.ts renamed to packages/design-system/src/components/__DEPRECATED__/tree/horizontal-shift.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describe, test, expect } from "@jest/globals";
22
import { renderHook, act } from "@testing-library/react-hooks";
3-
import type { Placement } from "../primitives/dnd";
3+
import type { Placement } from "../../primitives/dnd";
44
import { useHorizontalShift } from "./horizontal-shift";
55
import type { ItemDropTarget, ItemId, ItemSelector } from "./item-utils";
66
import { type Item, findItemById, getItemPath } from "./test-tree-data";

packages/design-system/src/components/tree/horizontal-shift.ts renamed to packages/design-system/src/components/__DEPRECATED__/tree/horizontal-shift.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useMemo, useState } from "react";
2-
import type { Placement } from "../primitives/dnd";
2+
import type { Placement } from "../../primitives/dnd";
33
import type { ItemDropTarget, ItemId, ItemSelector } from "./item-utils";
44
import { getPlacementIndicatorAlignment } from "./tree-node";
55

File renamed without changes.

packages/design-system/src/components/tree/item-utils.ts renamed to packages/design-system/src/components/__DEPRECATED__/tree/item-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ChildrenOrientation } from "../primitives/dnd/geometry-utils";
1+
import type { ChildrenOrientation } from "../../primitives/dnd/geometry-utils";
22

33
export type ItemId = string;
44

File renamed without changes.

packages/design-system/src/components/tree/tree-node.tsx renamed to packages/design-system/src/components/__DEPRECATED__/tree/tree-node.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ import {
1212
ChevronFilledDownIcon,
1313
ChevronFilledRightIcon,
1414
} from "@webstudio-is/icons";
15-
import { Box } from "../box";
16-
import { Flex } from "../flex";
17-
import { Text } from "../text";
18-
import { styled, type CSS } from "../../stitches.config";
19-
import { theme } from "../../stitches.config";
15+
import { Box } from "../../box";
16+
import { Flex } from "../../flex";
17+
import { Text } from "../../text";
18+
import { styled, type CSS } from "../../../stitches.config";
19+
import { theme } from "../../../stitches.config";
2020
import {
2121
type ItemId,
2222
type ItemSelector,

packages/design-system/src/components/tree/tree.stories.tsx renamed to packages/design-system/src/components/__DEPRECATED__/tree/tree.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { Meta } from "@storybook/react";
22
import { useState } from "react";
33
import { Tree } from "./tree";
44
import { type Item, findItemById, reparent } from "./test-tree-data";
5-
import { Flex } from "../flex";
5+
import { Flex } from "../../flex";
66
import { TreeItemLabel, TreeItemBody } from "./tree-node";
77
import type { ItemDropTarget, ItemSelector } from "./item-utils";
88

packages/design-system/src/components/tree/tree.tsx renamed to packages/design-system/src/components/__DEPRECATED__/tree/tree.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { ReactNode } from "react";
22
import { useState, useMemo, useRef, useCallback, useEffect } from "react";
33
import { createPortal } from "react-dom";
44
import { FocusScope, useFocusManager } from "@react-aria/focus";
5-
import { ListPositionIndicator } from "../list-position-indicator";
5+
import { ListPositionIndicator } from "../../list-position-indicator";
66
import {
77
TreeNode,
88
INDENT,
@@ -17,8 +17,8 @@ import {
1717
useAutoScroll,
1818
useDragCursor,
1919
computeIndicatorPlacement,
20-
} from "../primitives/dnd";
21-
import { Box } from "../box";
20+
} from "../../primitives/dnd";
21+
import { Box } from "../../box";
2222
import { useHorizontalShift } from "./horizontal-shift";
2323
import {
2424
type ItemId,
@@ -28,8 +28,8 @@ import {
2828
getElementByItemSelector,
2929
getItemSelectorFromElement,
3030
} from "./item-utils";
31-
import { ScrollArea } from "../scroll-area";
32-
import { theme } from "../..";
31+
import { ScrollArea } from "../../scroll-area";
32+
import { theme } from "../../..";
3333

3434
const KeyboardNavigation = ({
3535
editingItemId,

packages/design-system/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ export {
6464
useEnhancedTooltipProps,
6565
} from "./components/enhanced-tooltip";
6666
export * from "./components/avatar";
67-
export * from "./components/tree";
6867
export * from "./components/pro-badge";
6968

7069
// No need to align
@@ -86,3 +85,4 @@ export * from "./components/kbd";
8685

8786
// Deprecated
8887
export * from "./components/__DEPRECATED__/list";
88+
export * from "./components/__DEPRECATED__/tree";

0 commit comments

Comments
 (0)