Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change all imports to be relative to ./ rather than from ./index.ts #1828

Merged
merged 10 commits into from
Jul 5, 2023
5 changes: 3 additions & 2 deletions packages/odyssey-react-mui/src/Banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
* See the License for the specific language governing permissions and limitations under the License.
*/

import { AlertColor, AlertProps } from "@mui/material";
import { Alert, AlertColor, AlertProps } from "@mui/material";
import { memo } from "react";
import { Alert, Link, ScreenReaderText } from "./";
import { Link } from "./Link";
import { ScreenReaderText } from "./ScreenReaderText";
import { useTranslation } from "react-i18next";

export type BannerProps = {
Expand Down
8 changes: 5 additions & 3 deletions packages/odyssey-react-mui/src/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@
* See the License for the specific language governing permissions and limitations under the License.
*/

import { Checkbox as MuiCheckbox, Typography } from "@mui/material";
import {
Checkbox as MuiCheckbox,
FormControlLabel,
Typography,
} from "@mui/material";
import { ChangeEventHandler, memo, useMemo } from "react";
import { useTranslation } from "react-i18next";

import { FormControlLabel } from ".";

export type CheckboxProps = {
ariaLabel?: string;
ariaLabelledBy?: string;
Expand Down
3 changes: 2 additions & 1 deletion packages/odyssey-react-mui/src/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import {
DialogContentText,
DialogActions,
} from "@mui/material";
import { Button, CloseIcon } from "./";
import { Button } from "./Button";
import { CloseIcon } from "./iconDictionary";
import {
memo,
ReactNode,
Expand Down
2 changes: 1 addition & 1 deletion packages/odyssey-react-mui/src/FieldError.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import { memo } from "react";

import { FormHelperText } from ".";
import { FormHelperText } from "@mui/material";
import { ScreenReaderText } from "./ScreenReaderText";
import { useTranslation } from "react-i18next";

Expand Down
2 changes: 1 addition & 1 deletion packages/odyssey-react-mui/src/FieldHint.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import { memo } from "react";

import { FormHelperText } from "./";
import { FormHelperText } from "@mui/material";

export type FieldHintProps = {
id?: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/odyssey-react-mui/src/FieldLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { memo, useMemo } from "react";

import { useTranslation } from "react-i18next";
import { ScreenReaderText } from "./ScreenReaderText";
import { Typography } from ".";
import { Typography } from "@mui/material";

export type FieldLabelProps = {
hasVisibleLabel: boolean;
Expand Down
2 changes: 1 addition & 1 deletion packages/odyssey-react-mui/src/Fieldset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import { memo, ReactElement } from "react";

import { Box, Typography } from ".";
import { Box, Typography } from "@mui/material";
import { Infobox } from "./Infobox";
import { useUniqueId } from "./useUniqueId";

Expand Down
2 changes: 1 addition & 1 deletion packages/odyssey-react-mui/src/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import { memo, ReactElement } from "react";

import { Box, Typography } from "./";
import { Box, Typography } from "@mui/material";
import { Button } from "./Button";
import { Infobox } from "./Infobox";
import { useUniqueId } from "./useUniqueId";
Expand Down
3 changes: 2 additions & 1 deletion packages/odyssey-react-mui/src/Infobox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

import { AlertColor } from "@mui/material";
import { memo, ReactNode } from "react";
import { Alert, AlertTitle, ScreenReaderText } from ".";
import { Alert, AlertTitle } from "@mui/material";
import { ScreenReaderText } from "./ScreenReaderText";
import { useTranslation } from "react-i18next";

export type InfoboxProps = {
Expand Down
27 changes: 17 additions & 10 deletions packages/odyssey-react-mui/src/MenuButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,23 @@
* See the License for the specific language governing permissions and limitations under the License.
*/

import {
Button,
ButtonProps,
ChevronDownIcon,
Divider,
ListSubheader,
Menu,
MenuItem,
useUniqueId,
} from "./";
// import {
// Button,
// ButtonProps,
// ChevronDownIcon,
// Divider,
// ListSubheader,
// Menu,
// MenuItem,
// useUniqueId,
// } from "./";

import { Button, ButtonProps } from "./Button";
import { ChevronDownIcon } from "./iconDictionary";
import { Divider, ListSubheader, Menu } from "@mui/material";
import { useUniqueId } from "./useUniqueId";
import { MenuItem } from "./MenuItem";
jordankoschei-okta marked this conversation as resolved.
Show resolved Hide resolved

import { memo, MouseEvent, ReactElement, useMemo, useState } from "react";

export type MenuButtonProps = {
Expand Down
2 changes: 1 addition & 1 deletion packages/odyssey-react-mui/src/OdysseyProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import { memo, ReactElement } from "react";

import { ThemeOptions } from ".";
import { ThemeOptions } from "@mui/material";
import { DesignTokensOverride } from "../src/theme/index";
import { OdysseyCacheProvider } from "./OdysseyCacheProvider";
import { OdysseyThemeProvider } from "./OdysseyThemeProvider";
Expand Down
6 changes: 4 additions & 2 deletions packages/odyssey-react-mui/src/OdysseyThemeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
import { ThemeProvider as MuiThemeProvider } from "@mui/material/styles";
import { memo, ReactElement, useMemo } from "react";

import { createTheme, deepmerge, ThemeOptions, DesignTokensOverride } from ".";
import { createOdysseyMuiTheme } from "./theme";
import { createTheme } from ".";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reasons I don't understand, this one import only works when it's from . instead of @mui/material

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it was a fluke? I just tested it, and it works in this file:

import { createTheme } from '@mui/material'

We even export this function from @mui/material.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still getting this same issue; no idea why!

import { ThemeOptions } from "@mui/material";
import { deepmerge } from "@mui/utils";
import { createOdysseyMuiTheme, DesignTokensOverride } from "./theme";
import * as Tokens from "@okta/odyssey-design-tokens";

const OdysseyThemeProvider = ({
Expand Down
3 changes: 2 additions & 1 deletion packages/odyssey-react-mui/src/PasswordField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import {
useState,
} from "react";

import { EyeIcon, EyeOffIcon, IconButton } from "./";
import { EyeIcon, EyeOffIcon } from "./iconDictionary";
import { IconButton } from "@mui/material";
import { Field } from "./Field";

export type PasswordFieldProps = {
Expand Down
2 changes: 1 addition & 1 deletion packages/odyssey-react-mui/src/Radio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import { Radio as MuiRadio } from "@mui/material";
import { memo } from "react";

import { FormControlLabel } from ".";
import { FormControlLabel } from "@mui/material";

export type RadioProps = {
isChecked?: boolean;
Expand Down
3 changes: 2 additions & 1 deletion packages/odyssey-react-mui/src/ScreenReaderText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
*/

import { memo, ReactNode } from "react";
import { Box, visuallyHidden } from "./";
import { Box } from "@mui/material";
import { visuallyHidden } from "@mui/utils";

export type ScreenReaderTextProps = {
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/odyssey-react-mui/src/SearchField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
useCallback,
} from "react";

import { SearchIcon } from "./";
import { SearchIcon } from "./iconDictionary";
import { Field } from "./Field";

export type SearchFieldProps = {
Expand Down
2 changes: 1 addition & 1 deletion packages/odyssey-react-mui/src/Status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* See the License for the specific language governing permissions and limitations under the License.
*/

import { Chip } from "./";
import { Chip } from "@mui/material";

export type StatusProps = {
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/odyssey-react-mui/src/TagList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* See the License for the specific language governing permissions and limitations under the License.
*/

import { Tag } from "./";
import { Tag } from "./Tag";
import { Stack } from "@mui/material";
import { memo, ReactElement, useMemo } from "react";
import { ChipElementType, TagListContext } from "./TagListContext";
Expand Down
12 changes: 4 additions & 8 deletions packages/odyssey-react-mui/src/Toast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,10 @@

import { AlertColor } from "@mui/material";
import { useEffect, memo, useState, useCallback } from "react";
import {
Alert,
AlertTitle,
CloseIcon,
Link,
Snackbar,
visuallyHidden,
} from ".";
import { Alert, AlertTitle, Snackbar } from "@mui/material";
import { visuallyHidden } from "@mui/utils";
import { Link } from "./Link";
import { CloseIcon } from "./iconDictionary";
import { Button } from "./Button";
import { useTranslation } from "react-i18next";

Expand Down
2 changes: 1 addition & 1 deletion packages/odyssey-react-mui/src/ToastStack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/

import { memo, ReactElement } from "react";
import { Box, Snackbar } from ".";
import { Box, Snackbar } from "@mui/material";
import { Toast } from "./Toast";

export type ToastStackProps = {
Expand Down