Skip to content

Commit

Permalink
chore: move useTheme, useDefaultProps, classes
Browse files Browse the repository at this point in the history
  • Loading branch information
zettca committed Aug 14, 2024
1 parent 5713b37 commit 564b8fc
Show file tree
Hide file tree
Showing 318 changed files with 747 additions and 547 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/Accordion/Accordion.styles.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createClasses } from "@hitachivantara/uikit-react-utils";
import { theme } from "@hitachivantara/uikit-styles";

import { createClasses } from "../utils/classes";
import { outlineStyles } from "../utils/focusUtils";

export const { staticClasses, useClasses } = createClasses("HvAccordion", {
Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/Accordion/Accordion.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { useCallback, useMemo } from "react";
import { DropDownXS, DropUpXS } from "@hitachivantara/uikit-react-icons";
import {
useDefaultProps,
type ExtractNames,
} from "@hitachivantara/uikit-react-utils";

import { useControlled } from "../hooks/useControlled";
import { useDefaultProps } from "../hooks/useDefaultProps";
import { useUniqueId } from "../hooks/useUniqueId";
import { HvBaseProps } from "../types/generic";
import { HvTypography, HvTypographyVariants } from "../Typography";
import { ExtractNames } from "../utils/classes";
import { setId } from "../utils/setId";
import { staticClasses, useClasses } from "./Accordion.styles";

Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/ActionBar/ActionBar.styles.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { createClasses } from "@hitachivantara/uikit-react-utils";
import { theme } from "@hitachivantara/uikit-styles";

import { createClasses } from "../utils/classes";

export const { staticClasses, useClasses } = createClasses("HvActionBar", {
root: {
width: "100%",
Expand Down
7 changes: 5 additions & 2 deletions packages/core/src/ActionBar/ActionBar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { useDefaultProps } from "../hooks/useDefaultProps";
import {
useDefaultProps,
type ExtractNames,
} from "@hitachivantara/uikit-react-utils";

import { HvBaseProps } from "../types/generic";
import { ExtractNames } from "../utils/classes";
import { staticClasses, useClasses } from "./ActionBar.styles";

export { staticClasses as actionBarClasses };
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/ActionsGeneric/ActionsGeneric.styles.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { createClasses } from "@hitachivantara/uikit-react-utils";
import { theme } from "@hitachivantara/uikit-styles";

import { createClasses } from "../utils/classes";

export const { staticClasses, useClasses } = createClasses("HvActionsGeneric", {
root: {},
button: {
Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/ActionsGeneric/ActionsGeneric.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { isValidElement } from "react";
import { MoreOptionsVertical } from "@hitachivantara/uikit-react-icons";
import {
useDefaultProps,
type ExtractNames,
} from "@hitachivantara/uikit-react-utils";

import { HvButton, HvButtonProps, HvButtonVariant } from "../Button";
import { HvDropDownMenu, HvDropDownMenuProps } from "../DropDownMenu";
import { useDefaultProps } from "../hooks/useDefaultProps";
import { HvIconButton } from "../IconButton";
import { HvBaseProps } from "../types/generic";
import { ExtractNames } from "../utils/classes";
import { setId } from "../utils/setId";
import { staticClasses, useClasses } from "./ActionsGeneric.styles";

Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/AppSwitcher/Action/Action.styles.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { createClasses } from "@hitachivantara/uikit-react-utils";
import { theme } from "@hitachivantara/uikit-styles";

import { createClasses } from "../../utils/classes";

export const { staticClasses, useClasses } = createClasses(
"HvAppSwitcher-Action",
{
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/AppSwitcher/Action/Action.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useCallback, useState } from "react";
import { Info } from "@hitachivantara/uikit-react-icons";
import { type ExtractNames } from "@hitachivantara/uikit-react-utils";
import { getColor, HvColorAny } from "@hitachivantara/uikit-styles";

import { HvAvatar } from "../../Avatar";
Expand All @@ -9,7 +10,6 @@ import { HvOverflowTooltip } from "../../OverflowTooltip";
import { HvTooltip } from "../../Tooltip";
import { HvBaseProps } from "../../types/generic";
import { HvTypography } from "../../Typography";
import { ExtractNames } from "../../utils/classes";
import { staticClasses, useClasses } from "./Action.styles";

export { staticClasses as appSwitcherActionClasses };
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/AppSwitcher/AppSwitcher.styles.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { createClasses } from "@hitachivantara/uikit-react-utils";
import { theme } from "@hitachivantara/uikit-styles";

import { createClasses } from "../utils/classes";

export const { staticClasses, useClasses } = createClasses("HvAppSwitcher", {
root: {
display: "flex",
Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/AppSwitcher/AppSwitcher.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { useMemo } from "react";
import {
useDefaultProps,
type ExtractNames,
} from "@hitachivantara/uikit-react-utils";

import { useDefaultProps } from "../hooks/useDefaultProps";
import { HvListContainer } from "../ListContainer";
import { HvOverflowTooltip } from "../OverflowTooltip";
import { HvPanel } from "../Panel";
import { HvBaseProps } from "../types/generic";
import { HvTypography } from "../Typography";
import { ExtractNames } from "../utils/classes";
import { HvAppSwitcherAction, HvAppSwitcherActionApplication } from "./Action";
import { staticClasses, useClasses } from "./AppSwitcher.styles";

Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/Avatar/Avatar.styles.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createClasses } from "../utils/classes";
import { createClasses } from "@hitachivantara/uikit-react-utils";

import { outlineStyles } from "../utils/focusUtils";

const EXTRA_SMALL = { container: "32px", avatar: "24px" };
Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/Avatar/Avatar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { forwardRef } from "react";
import MuiAvatar, { AvatarProps as MuiAvatarProps } from "@mui/material/Avatar";
import { User } from "@hitachivantara/uikit-react-icons";
import {
useDefaultProps,
type ExtractNames,
} from "@hitachivantara/uikit-react-utils";
import {
getColor,
HvColorAny,
Expand All @@ -9,10 +13,8 @@ import {
} from "@hitachivantara/uikit-styles";

import { useAvatarGroupContext } from "../AvatarGroup/AvatarGroupContext";
import { useDefaultProps } from "../hooks/useDefaultProps";
import { useImageLoaded } from "../hooks/useImageLoaded";
import { HvBaseProps } from "../types/generic";
import { ExtractNames } from "../utils/classes";
import { decreaseSize } from "../utils/sizes";
import { staticClasses, useClasses } from "./Avatar.styles";

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/AvatarGroup/AvatarGroup.styles.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createClasses } from "@hitachivantara/uikit-react-utils";
import { theme } from "@hitachivantara/uikit-styles";

import { avatarClasses } from "../Avatar/Avatar";
import { createClasses } from "../utils/classes";

export const { staticClasses, useClasses } = createClasses("HvAvatarGroup", {
root: {
Expand Down
9 changes: 6 additions & 3 deletions packages/core/src/AvatarGroup/AvatarGroup.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { Children, forwardRef } from "react";
import { useCss } from "@hitachivantara/uikit-react-shared";
import {
mergeStyles,
useCss,
useDefaultProps,
type ExtractNames,
} from "@hitachivantara/uikit-react-utils";
import { HvSize, theme } from "@hitachivantara/uikit-styles";

import { HvAvatar } from "../Avatar/Avatar";
import { useDefaultProps } from "../hooks/useDefaultProps";
import { HvBaseProps } from "../types/generic";
import { ExtractNames, mergeStyles } from "../utils/classes";
import { staticClasses, useClasses } from "./AvatarGroup.styles";
import { HvAvatarGroupProvider } from "./AvatarGroupContext";

Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/Badge/Badge.styles.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { createClasses } from "@hitachivantara/uikit-react-utils";
import { theme } from "@hitachivantara/uikit-styles";

import { createClasses } from "../utils/classes";

const labelBaseStyle: React.CSSProperties = {
...theme.typography.label,
padding: "0 5px",
Expand Down
7 changes: 5 additions & 2 deletions packages/core/src/Badge/Badge.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { useDefaultProps } from "../hooks/useDefaultProps";
import {
useDefaultProps,
type ExtractNames,
} from "@hitachivantara/uikit-react-utils";

import { HvBaseProps } from "../types/generic";
import { HvTypography, HvTypographyVariants } from "../Typography";
import { ExtractNames } from "../utils/classes";
import { staticClasses, useClasses } from "./Badge.styles";

export { staticClasses as badgeClasses };
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/Banner/Banner.styles.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { createClasses } from "@hitachivantara/uikit-react-utils";
import { theme } from "@hitachivantara/uikit-styles";

import { createClasses } from "../utils/classes";

export const { useClasses, staticClasses } = createClasses("HvBanner", {
/** Styles applied to the component root class when the component is closed. */
rootClosed: {
Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/Banner/Banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import Snackbar, {
SnackbarProps as MuiSnackbarProps,
SnackbarOrigin,
} from "@mui/material/Snackbar";
import {
useDefaultProps,
type ExtractNames,
} from "@hitachivantara/uikit-react-utils";

import { HvActionsGenericProps } from "../ActionsGeneric";
import { useDefaultProps } from "../hooks/useDefaultProps";
import { ExtractNames } from "../utils/classes";
import { setId } from "../utils/setId";
import { staticClasses, useClasses } from "./Banner.styles";
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createClasses } from "../../../utils/classes";
import { createClasses } from "@hitachivantara/uikit-react-utils";

import { outlineStyles } from "../../../utils/focusUtils";

const name = "HvBannerActionContainer";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Close } from "@hitachivantara/uikit-react-icons";
import { type ExtractNames } from "@hitachivantara/uikit-react-utils";

import {
HvActionsGeneric,
HvActionsGenericProps,
} from "../../../ActionsGeneric";
import { HvButton } from "../../../Button";
import { HvBaseProps } from "../../../types/generic";
import { ExtractNames } from "../../../utils/classes";
import { staticClasses, useClasses } from "./ActionContainer.styles";

export { staticClasses as actionContainerClasses };
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { createClasses } from "@hitachivantara/uikit-react-utils";
import { theme } from "@hitachivantara/uikit-styles";

import { createClasses } from "../../utils/classes";

export const { useClasses, staticClasses } = createClasses("HvBannerContent", {
root: {
minWidth: "100%",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/Banner/BannerContent/BannerContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { forwardRef } from "react";
import SnackbarContent, {
SnackbarContentProps as MuiSnackbarContentProps,
} from "@mui/material/SnackbarContent";
import { type ExtractNames } from "@hitachivantara/uikit-react-utils";

import { HvActionsGenericProps } from "../../ActionsGeneric";
import { ExtractNames } from "../../utils/classes";
import { iconVariant } from "../../utils/iconVariant";
import { HvBannerActionPosition, HvBannerVariant } from "../types";
import { HvActionContainer, HvActionContainerProps } from "./ActionContainer";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { createClasses } from "@hitachivantara/uikit-react-utils";
import { theme } from "@hitachivantara/uikit-styles";

import { createClasses } from "../../../utils/classes";

const name = "HvBannerMessageContainer";

export const { staticClasses, useClasses } = createClasses(name, {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { type ExtractNames } from "@hitachivantara/uikit-react-utils";

import {
HvActionsGeneric,
HvActionsGenericProps,
} from "../../../ActionsGeneric";
import { HvBaseProps } from "../../../types/generic";
import { HvTypography } from "../../../Typography";
import { ExtractNames } from "../../../utils/classes";
import { setId } from "../../../utils/setId";
import { staticClasses, useClasses } from "./MessageContainer.styles";

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/BaseCheckBox/BaseCheckBox.styles.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createClasses } from "@hitachivantara/uikit-react-utils";
import { theme } from "@hitachivantara/uikit-styles";

import { createClasses } from "../utils/classes";
import { outlineStyles } from "../utils/focusUtils";

export const { staticClasses, useClasses } = createClasses("HvBaseCheckBox", {
Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/BaseCheckBox/BaseCheckBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import { forwardRef, useCallback, useState } from "react";
import MuiCheckbox, {
CheckboxProps as MuiCheckboxProps,
} from "@mui/material/Checkbox";
import {
useDefaultProps,
type ExtractNames,
} from "@hitachivantara/uikit-react-utils";

import { useDefaultProps } from "../hooks/useDefaultProps";
import { ExtractNames } from "../utils/classes";
import { staticClasses, useClasses } from "./BaseCheckBox.styles";
import { Box, Check, Partial } from "./icons";

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/BaseDropdown/BaseDropdown.styles.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createClasses } from "@hitachivantara/uikit-react-utils";
import { theme } from "@hitachivantara/uikit-styles";

import { createClasses } from "../utils/classes";
import { outlineStyles } from "../utils/focusUtils";

export const { useClasses, staticClasses } = createClasses("HvBaseDropdown", {
Expand Down
8 changes: 5 additions & 3 deletions packages/core/src/BaseDropdown/BaseDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,17 @@ import {
Placement,
} from "@popperjs/core";
import { DropDownXS, DropUpXS } from "@hitachivantara/uikit-react-icons";
import { useTheme } from "@hitachivantara/uikit-react-shared";
import {
useDefaultProps,
useTheme,
type ExtractNames,
} from "@hitachivantara/uikit-react-utils";

import { useControlled } from "../hooks/useControlled";
import { useDefaultProps } from "../hooks/useDefaultProps";
import { useForkRef } from "../hooks/useForkRef";
import { useUniqueId } from "../hooks/useUniqueId";
import { HvBaseProps } from "../types/generic";
import { HvTypography } from "../Typography";
import { ExtractNames } from "../utils/classes";
import { getFirstAndLastFocus } from "../utils/focusableElementFinder";
import { isKey, isOneOfKeys } from "../utils/keyboardUtils";
import { setId } from "../utils/setId";
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/BaseInput/BaseInput.styles.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createClasses } from "@hitachivantara/uikit-react-utils";
import { theme } from "@hitachivantara/uikit-styles";

import { createClasses } from "../utils/classes";
import { outlineStyles } from "../utils/focusUtils";

export const { staticClasses, useClasses } = createClasses("HvBaseInput", {
Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/BaseInput/BaseInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import {
InputBaseProps,
InputBaseComponentProps as MuiInputBaseComponentProps,
} from "@mui/material/InputBase";
import {
useDefaultProps,
type ExtractNames,
} from "@hitachivantara/uikit-react-utils";
import { theme } from "@hitachivantara/uikit-styles";

import {
Expand All @@ -13,8 +17,6 @@ import {
HvFormElementContext,
HvFormElementDescriptorsContext,
} from "../Forms";
import { useDefaultProps } from "../hooks/useDefaultProps";
import { ExtractNames } from "../utils/classes";
import { staticClasses, useClasses } from "./BaseInput.styles";

export { staticClasses as baseInputClasses };
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/BaseRadio/BaseRadio.styles.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createClasses } from "@hitachivantara/uikit-react-utils";
import { theme } from "@hitachivantara/uikit-styles";

import { createClasses } from "../utils/classes";
import { outlineStyles } from "../utils/focusUtils";

export const { staticClasses, useClasses } = createClasses("HvBaseRadio", {
Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/BaseRadio/BaseRadio.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { forwardRef, useCallback, useState } from "react";
import MuiRadio, { RadioProps as MuiRadioProps } from "@mui/material/Radio";
import {
useDefaultProps,
type ExtractNames,
} from "@hitachivantara/uikit-react-utils";

import { useDefaultProps } from "../hooks/useDefaultProps";
import { ExtractNames } from "../utils/classes";
import { staticClasses, useClasses } from "./BaseRadio.styles";
import { Selected, Unselected } from "./icons";

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/BaseSwitch/BaseSwitch.styles.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createClasses } from "@hitachivantara/uikit-react-utils";
import { theme } from "@hitachivantara/uikit-styles";

import { createClasses } from "../utils/classes";
import { outlineStyles } from "../utils/focusUtils";

export const { staticClasses, useClasses } = createClasses("HvBaseSwitch", {
Expand Down
Loading

0 comments on commit 564b8fc

Please sign in to comment.