Skip to content

Commit

Permalink
chore: Updated imports to use import type when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
mlaursen committed Nov 26, 2021
1 parent 31a31da commit ba96bb6
Show file tree
Hide file tree
Showing 104 changed files with 183 additions and 157 deletions.
2 changes: 1 addition & 1 deletion packages/alert/src/MessageQueue.tsx
Expand Up @@ -9,7 +9,7 @@ import {
MessageVisibilityContext,
ToastMessage,
} from "./MessageQueueContext";
import { SnackbarProps } from "./Snackbar";
import type { SnackbarProps } from "./Snackbar";
import { ActionEventHandler, SnackbarQueue } from "./SnackbarQueue";
import { MessageQueueOptions, useMessageQueue } from "./useMessageQueue";

Expand Down
4 changes: 2 additions & 2 deletions packages/alert/src/MessageQueueContext.tsx
@@ -1,7 +1,7 @@
import { createContext, ReactNode, useContext } from "react";
import { ButtonProps } from "@react-md/button";
import type { ButtonProps } from "@react-md/button";

import { ToastProps } from "./Toast";
import type { ToastProps } from "./Toast";

export const DEFAULT_MESSAGE_QUEUE_TIMEOUT = 5000;

Expand Down
2 changes: 1 addition & 1 deletion packages/alert/src/useWindowBlurPause.ts
@@ -1,6 +1,6 @@
import { useEffect } from "react";

import { Message } from "./MessageQueueContext";
import type { Message } from "./MessageQueueContext";

interface Options {
startTimer: () => void;
Expand Down
2 changes: 1 addition & 1 deletion packages/autocomplete/src/AutoComplete.tsx
Expand Up @@ -11,7 +11,7 @@ import { ScaleTransition } from "@react-md/transition";
import { BELOW_CENTER_ANCHOR, bem, omit } from "@react-md/utils";

import { HighlightedResult } from "./HighlightedResult";
import { AutoCompleteProps } from "./types";
import type { AutoCompleteProps } from "./types";
import { useAutoComplete } from "./useAutoComplete";
import {
getResultId as DEFAULT_GET_RESULT_ID,
Expand Down
2 changes: 1 addition & 1 deletion packages/autocomplete/src/HighlightedResult.tsx
@@ -1,4 +1,4 @@
import { CSSProperties, ReactElement, ReactNode } from "react";
import type { CSSProperties, ReactElement, ReactNode } from "react";
import cn from "classnames";

export interface HighlightedResultProps {
Expand Down
4 changes: 2 additions & 2 deletions packages/autocomplete/src/useAutoComplete.ts
Expand Up @@ -11,7 +11,7 @@ import {
useRef,
useState,
} from "react";
import { ListElement } from "@react-md/list";
import type { ListElement } from "@react-md/list";
import {
FixedPositioningTransitionCallbacks,
useFixedPositioning,
Expand All @@ -27,7 +27,7 @@ import {
useToggle,
} from "@react-md/utils";

import {
import type {
AutoCompleteData,
AutoCompleteListboxPositionOptions,
AutoCompleteProps,
Expand Down
4 changes: 2 additions & 2 deletions packages/autocomplete/src/utils.ts
@@ -1,7 +1,7 @@
import { ReactNode } from "react";
import type { ReactNode } from "react";
import { caseInsensitiveFilter, fuzzyFilter } from "@react-md/utils";

import {
import type {
AutoCompleteData,
AutoCompleteFilterFunction,
FilterFunction,
Expand Down
2 changes: 1 addition & 1 deletion packages/badge/src/isEmpty.ts
@@ -1,4 +1,4 @@
import { ReactNode } from "react";
import type { ReactNode } from "react";

/**
* A small util to check if the badge is considered empty.
Expand Down
2 changes: 1 addition & 1 deletion packages/button/src/Button.tsx
Expand Up @@ -4,7 +4,7 @@ import {
InteractionStatesOptions,
useInteractionStates,
} from "@react-md/states";
import { PropsWithRef } from "@react-md/utils";
import type { PropsWithRef } from "@react-md/utils";

import {
buttonThemeClassNames,
Expand Down
2 changes: 1 addition & 1 deletion packages/card/src/CardHeaderAddon.tsx
@@ -1,4 +1,4 @@
import { HTMLAttributes, ReactElement } from "react";
import type { HTMLAttributes, ReactElement } from "react";
import cn from "classnames";
import { bem } from "@react-md/utils";

Expand Down
2 changes: 1 addition & 1 deletion packages/form/src/FormMessageContainer.tsx
@@ -1,6 +1,6 @@
import { forwardRef, HTMLAttributes, ReactElement } from "react";
import cn from "classnames";
import { PropsWithRef } from "@react-md/utils";
import type { PropsWithRef } from "@react-md/utils";

import { FormMessage, FormMessageProps } from "./FormMessage";

Expand Down
2 changes: 1 addition & 1 deletion packages/form/src/file-input/utils.ts
@@ -1,4 +1,4 @@
import { ChangeEventHandler, DragEventHandler } from "react";
import type { ChangeEventHandler, DragEventHandler } from "react";
import { nanoid } from "nanoid";

/** @remarks \@since 2.9.0 */
Expand Down
2 changes: 1 addition & 1 deletion packages/form/src/menu/MenuItemCheckbox.tsx
@@ -1,7 +1,7 @@
import { forwardRef } from "react";
import { useIcon } from "@react-md/icon";

import { IndeterminateCheckboxProps } from "../toggle/Checkbox";
import type { IndeterminateCheckboxProps } from "../toggle/Checkbox";
import {
BaseMenuItemInputToggleProps,
MenuItemInputToggle,
Expand Down
2 changes: 1 addition & 1 deletion packages/form/src/menu/MenuItemInputToggle.tsx
Expand Up @@ -9,7 +9,7 @@ import {
} from "@react-md/list";
import { bem } from "@react-md/utils";

import { IndeterminateCheckboxProps } from "../toggle/Checkbox";
import type { IndeterminateCheckboxProps } from "../toggle/Checkbox";
import { InputToggleIcon } from "../toggle/InputToggleIcon";
import { SwitchTrack } from "../toggle/SwitchTrack";

Expand Down
2 changes: 1 addition & 1 deletion packages/form/src/select/Select.tsx
Expand Up @@ -9,6 +9,7 @@ import {
} from "react";
import cn from "classnames";
import { useIcon } from "@react-md/icon";
import type { ListElement } from "@react-md/list";
import { useFixedPositioning } from "@react-md/transition";
import {
BELOW_CENTER_ANCHOR,
Expand Down Expand Up @@ -36,7 +37,6 @@ import {
getOptionId as DEFAULT_GET_OPTION_ID,
getOptionLabel as DEFAULT_GET_OPTION_LABEL,
} from "./utils";
import { ListElement } from "@react-md/list";

type FakeSelectAttributes = Omit<
HTMLAttributes<HTMLDivElement>,
Expand Down
2 changes: 1 addition & 1 deletion packages/form/src/select/utils.ts
@@ -1,6 +1,6 @@
import { createElement, ReactNode } from "react";
import { TextIconSpacing } from "@react-md/icon";
import { SimpleListItemProps } from "@react-md/list";
import type { SimpleListItemProps } from "@react-md/list";

export interface ListboxOptionProps extends SimpleListItemProps {
[labelKey: string]: ReactNode;
Expand Down
6 changes: 3 additions & 3 deletions packages/form/src/slider/RangeSlider.tsx
@@ -1,5 +1,5 @@
import { forwardRef, HTMLAttributes, KeyboardEvent, useCallback } from "react";
import { PropsWithRef } from "@react-md/utils";
import type { PropsWithRef } from "@react-md/utils";

import {
DEFAULT_SLIDER_ANIMATION_TIME,
Expand All @@ -8,8 +8,8 @@ import {
import { SliderContainer } from "./SliderContainer";
import { SliderThumb } from "./SliderThumb";
import { SliderTrack } from "./SliderTrack";
import { BaseSliderProps } from "./types";
import { RangeSliderRequiredProps } from "./useRangeSlider";
import type { BaseSliderProps } from "./types";
import type { RangeSliderRequiredProps } from "./useRangeSlider";
import { useSliderControls } from "./useSliderControls";

/**
Expand Down
6 changes: 3 additions & 3 deletions packages/form/src/slider/Slider.tsx
@@ -1,5 +1,5 @@
import { forwardRef, HTMLAttributes } from "react";
import { PropsWithRef } from "@react-md/utils";
import type { PropsWithRef } from "@react-md/utils";

import {
DEFAULT_SLIDER_ANIMATION_TIME,
Expand All @@ -8,8 +8,8 @@ import {
import { SliderContainer } from "./SliderContainer";
import { SliderThumb } from "./SliderThumb";
import { SliderTrack } from "./SliderTrack";
import { BaseSliderProps } from "./types";
import { SliderRequiredProps } from "./useSlider";
import type { BaseSliderProps } from "./types";
import type { SliderRequiredProps } from "./useSlider";
import { useSliderControls } from "./useSliderControls";

/**
Expand Down
6 changes: 5 additions & 1 deletion packages/form/src/slider/SliderContainer.tsx
Expand Up @@ -3,7 +3,11 @@ import cn from "classnames";
import { TextIconSpacing } from "@react-md/icon";
import { bem } from "@react-md/utils";

import { SliderAddons, SliderLabelProps, SliderPresentation } from "./types";
import type {
SliderAddons,
SliderLabelProps,
SliderPresentation,
} from "./types";
import { labelStyles } from "../label";

const styles = bem("rmd-slider-container");
Expand Down
2 changes: 1 addition & 1 deletion packages/form/src/slider/SliderThumb.tsx
Expand Up @@ -9,7 +9,7 @@ import {
DEFAULT_SLIDER_MIN,
} from "./constants";
import { SliderValue } from "./SliderValue";
import { SliderThumbOptions, ThumbIndex } from "./types";
import type { SliderThumbOptions, ThumbIndex } from "./types";
import { useDiscreteValueVisibility } from "./useDiscreteValueVisibility";

const styles = bem("rmd-slider-thumb");
Expand Down
2 changes: 1 addition & 1 deletion packages/form/src/slider/SliderTrack.tsx
Expand Up @@ -3,7 +3,7 @@ import cn from "classnames";
import { bem } from "@react-md/utils";

import { THUMB_1_VAR, THUMB_2_VAR } from "./constants";
import { SliderPresentation } from "./types";
import type { SliderPresentation } from "./types";

const styles = bem("rmd-slider-track");

Expand Down
6 changes: 3 additions & 3 deletions packages/form/src/slider/SliderValue.tsx
@@ -1,10 +1,10 @@
import { ReactElement } from "react";
import type { ReactElement } from "react";
import cn from "classnames";
import { CSSTransitionClassNames } from "@react-md/transition";
import type { CSSTransitionClassNames } from "@react-md/transition";
import { Tooltip, TooltipProps } from "@react-md/tooltip";
import { bem } from "@react-md/utils";

import { ThumbIndex } from "./types";
import type { ThumbIndex } from "./types";

const styles = bem("rmd-slider-value");

Expand Down
9 changes: 7 additions & 2 deletions packages/form/src/slider/types.ts
@@ -1,5 +1,10 @@
import { Dispatch, HTMLAttributes, ReactNode, SetStateAction } from "react";
import { PropsWithRef } from "@react-md/utils";
import type {
Dispatch,
HTMLAttributes,
ReactNode,
SetStateAction,
} from "react";
import type { PropsWithRef } from "@react-md/utils";

/**
* @remarks \@since 2.5.0
Expand Down
2 changes: 1 addition & 1 deletion packages/form/src/slider/useRangeSlider.ts
Expand Up @@ -6,7 +6,7 @@ import {
DEFAULT_SLIDER_MIN,
DEFAULT_SLIDER_STEP,
} from "./constants";
import {
import type {
DefinedSliderValueOptions,
RangeSliderControls,
RangeSliderDefaultValue,
Expand Down
2 changes: 1 addition & 1 deletion packages/form/src/slider/useSlider.ts
Expand Up @@ -6,7 +6,7 @@ import {
DEFAULT_SLIDER_MIN,
DEFAULT_SLIDER_STEP,
} from "./constants";
import {
import type {
DefinedSliderValueOptions,
SliderControls,
SliderDefaultValue,
Expand Down
2 changes: 1 addition & 1 deletion packages/form/src/slider/useSliderControls.ts
Expand Up @@ -13,7 +13,7 @@ import {
import { applyRef, useDir, useIsomorphicLayoutEffect } from "@react-md/utils";

import { DEFAULT_SLIDER_ANIMATION_TIME } from "./constants";
import {
import type {
DefinedSliderValueOptions,
SliderControls,
SliderDragEvent,
Expand Down
2 changes: 1 addition & 1 deletion packages/form/src/slider/utils.ts
@@ -1,6 +1,6 @@
import { getPercentage, nearest } from "@react-md/utils";

import {
import type {
DefinedSliderValueOptions,
RangeSliderControls,
RangeSliderValue,
Expand Down
2 changes: 1 addition & 1 deletion packages/form/src/text-field/TextArea.tsx
Expand Up @@ -15,11 +15,11 @@ import { bem, useEnsuredRef, useResizeObserver } from "@react-md/utils";

import { useFormTheme } from "../FormThemeProvider";
import { FloatingLabel } from "../label/FloatingLabel";
import { useFieldStates } from "../useFieldStates";
import {
TextFieldContainer,
TextFieldContainerOptions,
} from "./TextFieldContainer";
import { useFieldStates } from "../useFieldStates";