Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

ui: make imports esm compatible

Abdullah Atta749a13efbcaa
diff --git a/packages/ui/src/components/index.ts b/packages/ui/src/components/index.ts
index 5dc78e1e9..c39606d3d 100644
--- a/packages/ui/src/components/index.ts
+++ b/packages/ui/src/components/index.ts
@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-export * from "./icon";
-export * from "./menu";
-export * from "./popup-presenter";
-export * from "./scroll-container";
+export * from "./icon/index.js";
+export * from "./menu/index.js";
+export * from "./popup-presenter/index.js";
+export * from "./scroll-container/index.js";
diff --git a/packages/ui/src/components/menu/index.tsx b/packages/ui/src/components/menu/index.tsx
index b75fbc75b..7084763c5 100644
--- a/packages/ui/src/components/menu/index.tsx
+++ b/packages/ui/src/components/menu/index.tsx
@@ -25,13 +25,16 @@ import React, {
useState
} from "react";
import { Box, FlexProps, Text } from "@theme-ui/components";
-import { getPosition } from "../../utils/position";
-import { LazyMenuItemsLoader, MenuButtonItem, MenuItem } from "./types";
-import { useFocus } from "./use-focus";
-import { MenuSeparator } from "./menu-separator";
-import { MenuButton } from "./menu-button";
-import { PopupPresenter, PopupPresenterProps } from "../popup-presenter";
-import { ScrollContainer } from "../scroll-container";
+import { getPosition } from "../../utils/position.js";
+import { LazyMenuItemsLoader, MenuButtonItem, MenuItem } from "./types.js";
+import { useFocus } from "./use-focus.js";
+import { MenuSeparator } from "./menu-separator.js";
+import { MenuButton } from "./menu-button.js";
+import {
+ PopupPresenter,
+ PopupPresenterProps
+} from "../popup-presenter/index.js";
+import { ScrollContainer } from "../scroll-container/index.js";
type MenuProps = MenuContainerProps & {
items?: MenuItem[];
@@ -301,6 +304,6 @@ function LazyLoader(props: {
);
}
-export * from "./types";
-export * from "./menu-button";
-export * from "./menu-separator";
+export * from "./types.js";
+export * from "./menu-button.js";
+export * from "./menu-separator.js";
diff --git a/packages/ui/src/components/menu/menu-button.tsx b/packages/ui/src/components/menu/menu-button.tsx
index dbb8bc859..fdb9c5045 100644
--- a/packages/ui/src/components/menu/menu-button.tsx
+++ b/packages/ui/src/components/menu/menu-button.tsx
@@ -19,8 +19,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import { useRef } from "react";
import { Flex, Text, Button } from "@theme-ui/components";
-import { Icon } from "../icon";
-import { MenuButtonItem, MenuItemComponentProps } from "./types";
+import { Icon } from "../icon/index.js";
+import { MenuButtonItem, MenuItemComponentProps } from "./types.js";
import { mdiCheck, mdiChevronRight } from "@mdi/js";
type MenuButtonProps = {
diff --git a/packages/ui/src/components/menu/use-focus.ts b/packages/ui/src/components/menu/use-focus.ts
index 2227f1bce..567a725bd 100644
--- a/packages/ui/src/components/menu/use-focus.ts
+++ b/packages/ui/src/components/menu/use-focus.ts
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { useCallback, useEffect, useState } from "react";
-import { MenuButtonItem, MenuItem } from "./types";
+import { MenuButtonItem, MenuItem } from "./types.js";
export function useFocus(
items: MenuItem[],
diff --git a/packages/ui/src/components/popup-presenter/index.tsx b/packages/ui/src/components/popup-presenter/index.tsx
index e35bd375c..c3d141144 100644
--- a/packages/ui/src/components/popup-presenter/index.tsx
+++ b/packages/ui/src/components/popup-presenter/index.tsx
@@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import { useCallback, useRef, useEffect, PropsWithChildren } from "react";
import { Box, BoxProps } from "@theme-ui/components";
-import { getPosition, PositionOptions } from "../../utils/position";
+import { getPosition, PositionOptions } from "../../utils/position.js";
import Modal from "react-modal";
import { EmotionThemeProvider, ThemeScopes } from "@notesnook/theme";
diff --git a/packages/ui/src/components/scroll-container/index.tsx b/packages/ui/src/components/scroll-container/index.tsx
index 3bc441317..694486279 100644
--- a/packages/ui/src/components/scroll-container/index.tsx
+++ b/packages/ui/src/components/scroll-container/index.tsx
@@ -19,7 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import { PropsWithChildren } from "react";
import { MacScrollbar, MacScrollbarProps } from "mac-scrollbar";
-import "mac-scrollbar/dist/mac-scrollbar.css";
type ScrollContainerProps = {
id?: string;
diff --git a/packages/ui/src/index.ts b/packages/ui/src/index.ts
index b4778c27c..2c8e03aed 100644
--- a/packages/ui/src/index.ts
+++ b/packages/ui/src/index.ts
@@ -17,5 +17,5 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-export * from "./components";
-export * from "./utils";
+export * from "./components/index.js";
+export * from "./utils/index.js";
diff --git a/packages/ui/src/utils/index.ts b/packages/ui/src/utils/index.ts
index fcd935b5a..1994fac0a 100644
--- a/packages/ui/src/utils/index.ts
+++ b/packages/ui/src/utils/index.ts
@@ -17,4 +17,4 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-export * from "./position";
+export * from "./position.js";