Skip to content

Commit

Permalink
replace @cloudscape-design/components with subpath imports
Browse files Browse the repository at this point in the history
  • Loading branch information
just-boris committed Dec 12, 2023
1 parent a60f747 commit 81b4778
Show file tree
Hide file tree
Showing 19 changed files with 55 additions and 20 deletions.
6 changes: 5 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,17 @@
[" Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.", " SPDX-License-Identifier: Apache-2.0"]
],
"no-restricted-imports": [
"warn",
"error",
{
"paths": [
{
"name": "react",
"importNames": ["default"],
"message": "Prefer named imports."
},
{
"name": "@cloudscape-design/components",
"message": "Prefer subpath imports."
}
]
}
Expand Down
5 changes: 4 additions & 1 deletion pages/conditional/conditional.page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { Box, Button, Container, Header } from "@cloudscape-design/components";
import Box from "@cloudscape-design/components/box";
import Button from "@cloudscape-design/components/button";
import Container from "@cloudscape-design/components/container";
import Header from "@cloudscape-design/components/header";
import { useState } from "react";
import { Board, BoardItem, BoardProps } from "../../lib/components";
import { boardI18nStrings, boardItemI18nStrings } from "../shared/i18n";
Expand Down
4 changes: 3 additions & 1 deletion pages/dnd/commons.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { Button, FormField, SpaceBetween } from "@cloudscape-design/components";
import Box from "@cloudscape-design/components/box";
import Button from "@cloudscape-design/components/button";
import FormField from "@cloudscape-design/components/form-field";
import SpaceBetween from "@cloudscape-design/components/space-between";
import { useState } from "react";

export function Counter() {
Expand Down
8 changes: 6 additions & 2 deletions pages/dnd/engine-query-test.page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import { Button, Form, FormField, Header, SpaceBetween, Textarea } from "@cloudscape-design/components";
import Button from "@cloudscape-design/components/button";
import Form from "@cloudscape-design/components/form";
import FormField from "@cloudscape-design/components/form-field";
import Header from "@cloudscape-design/components/header";
import SpaceBetween from "@cloudscape-design/components/space-between";
import Textarea from "@cloudscape-design/components/textarea";
import { useState } from "react";
import { useSearchParams } from "react-router-dom";
import PageLayout from "../app/page-layout";
Expand Down
4 changes: 3 additions & 1 deletion pages/dnd/events-table.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { Link, StatusIndicator, Table } from "@cloudscape-design/components";
import Link from "@cloudscape-design/components/link";
import StatusIndicator from "@cloudscape-design/components/status-indicator";
import Table from "@cloudscape-design/components/table";

interface EventItem {
id: string;
Expand Down
4 changes: 3 additions & 1 deletion pages/dnd/items.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { Box, Link, SpaceBetween } from "@cloudscape-design/components";
import Box from "@cloudscape-design/components/box";
import Link from "@cloudscape-design/components/link";
import SpaceBetween from "@cloudscape-design/components/space-between";
import { BoardProps, ItemsPaletteProps } from "../../lib/components";
import { fromMatrix } from "../../lib/components/internal/debug-tools";
import { BoardItemDefinition, BoardItemDefinitionBase } from "../../lib/components/internal/interfaces";
Expand Down
2 changes: 1 addition & 1 deletion pages/dnd/update-layout-test.page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import { Header } from "@cloudscape-design/components";
import Header from "@cloudscape-design/components/header";
import { useState } from "react";
import { Board, BoardItem, BoardProps, ItemsPalette, ItemsPaletteProps } from "../../lib/components";
import PageLayout from "../app/page-layout";
Expand Down
2 changes: 1 addition & 1 deletion pages/grid/with-widget-containers-compact.page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { Header } from "@cloudscape-design/components";
import Header from "@cloudscape-design/components/header";
import { Board, BoardItem } from "../../lib/components";
import PageLayout from "../app/page-layout";
import { TestBed } from "../app/test-bed";
Expand Down
2 changes: 1 addition & 1 deletion pages/grid/with-widget-containers.page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { Header } from "@cloudscape-design/components";
import Header from "@cloudscape-design/components/header";
import { Board, BoardItem } from "../../lib/components";
import PageLayout from "../app/page-layout";
import { TestBed } from "../app/test-bed";
Expand Down
7 changes: 6 additions & 1 deletion pages/micro-frontend/integration.page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import { AppLayout, Box, Button, ContentLayout, Header, SplitPanel } from "@cloudscape-design/components";
import AppLayout from "@cloudscape-design/components/app-layout";
import Box from "@cloudscape-design/components/box";
import Button from "@cloudscape-design/components/button";
import ContentLayout from "@cloudscape-design/components/content-layout";
import Header from "@cloudscape-design/components/header";
import SplitPanel from "@cloudscape-design/components/split-panel";
import { ReactNode, useLayoutEffect, useRef, useState } from "react";
import { createRoot } from "react-dom/client";
import { Board, BoardItem, ItemsPalette } from "../../lib/components";
Expand Down
5 changes: 4 additions & 1 deletion pages/widget-container/permutations.page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { Box, Button, ButtonDropdown, SpaceBetween } from "@cloudscape-design/components";
import Box from "@cloudscape-design/components/box";
import Button from "@cloudscape-design/components/button";
import ButtonDropdown from "@cloudscape-design/components/button-dropdown";
import Header from "@cloudscape-design/components/header";
import SpaceBetween from "@cloudscape-design/components/space-between";
import { Board, BoardItem } from "../../lib/components";
import PageLayout from "../app/page-layout";
import { ScreenshotArea } from "../screenshot-area";
Expand Down
8 changes: 7 additions & 1 deletion pages/with-app-layout/app-layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import { AppLayout, Box, Button, ContentLayout, Header, SpaceBetween, SplitPanel } from "@cloudscape-design/components";
import AppLayout from "@cloudscape-design/components/app-layout";
import Box from "@cloudscape-design/components/box";
import Button from "@cloudscape-design/components/button";
import ContentLayout from "@cloudscape-design/components/content-layout";
import Header from "@cloudscape-design/components/header";
import SpaceBetween from "@cloudscape-design/components/space-between";
import SplitPanel from "@cloudscape-design/components/split-panel";
import { ReactNode, useState } from "react";
import { appLayoutI18nStrings, clientI18nStrings, splitPanelI18nStrings } from "../shared/i18n";

Expand Down
5 changes: 4 additions & 1 deletion pages/with-app-layout/delete-confirmation-modal.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import { Button, Form, Modal, SpaceBetween } from "@cloudscape-design/components";
import Button from "@cloudscape-design/components/button";
import Form from "@cloudscape-design/components/form";
import Modal from "@cloudscape-design/components/modal";
import SpaceBetween from "@cloudscape-design/components/space-between";
import { clientI18nStrings } from "../shared/i18n";

export function DeleteConfirmationModal({
Expand Down
3 changes: 2 additions & 1 deletion pages/with-app-layout/widgets-board.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import { Box, Header } from "@cloudscape-design/components";
import Box from "@cloudscape-design/components/box";
import ButtonDropdown from "@cloudscape-design/components/button-dropdown";
import Header from "@cloudscape-design/components/header";
import { useState } from "react";
import { Board, BoardItem, BoardProps } from "../../lib/components";
import LiveRegion from "../../lib/components/internal/live-region";
Expand Down
2 changes: 1 addition & 1 deletion pages/with-app-layout/widgets-palette.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import { Header } from "@cloudscape-design/components";
import Header from "@cloudscape-design/components/header";
import { BoardItem, ItemsPalette, ItemsPaletteProps } from "../../lib/components";
import LiveRegion from "../../lib/components/internal/live-region";
import { boardItemI18nStrings, clientI18nStrings, itemsPaletteI18nStrings } from "../shared/i18n";
Expand Down
2 changes: 1 addition & 1 deletion src/board-item/__tests__/board-item.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { Container } from "@cloudscape-design/components";
import Container from "@cloudscape-design/components/container";
import { cleanup, render as libRender } from "@testing-library/react";
import { ReactElement } from "react";
import { afterEach, describe, expect, test } from "vitest";
Expand Down
2 changes: 1 addition & 1 deletion src/board/__tests__/board.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { Button } from "@cloudscape-design/components";
import Button from "@cloudscape-design/components/button";
import { KeyCode } from "@cloudscape-design/test-utils-core/utils";
import { cleanup, fireEvent, render, waitFor } from "@testing-library/react";
import { vi } from "vitest";
Expand Down
2 changes: 1 addition & 1 deletion src/internal/drag-handle/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { Icon } from "@cloudscape-design/components";
import Icon from "@cloudscape-design/components/icon";
import clsx from "clsx";
import { ForwardedRef, KeyboardEvent, PointerEvent, forwardRef } from "react";

Expand Down
2 changes: 1 addition & 1 deletion src/internal/resize-handle/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { Icon } from "@cloudscape-design/components";
import Icon from "@cloudscape-design/components/icon";
import clsx from "clsx";
import { KeyboardEvent, PointerEvent } from "react";
import Handle from "../handle";
Expand Down

0 comments on commit 81b4778

Please sign in to comment.