diff --git a/packages/co-design-core/src/components/Affix/Affix.tsx b/packages/co-design-core/src/components/Affix/Affix.tsx index 8c58fcbd..79f82e97 100644 --- a/packages/co-design-core/src/components/Affix/Affix.tsx +++ b/packages/co-design-core/src/components/Affix/Affix.tsx @@ -21,7 +21,7 @@ export interface AffixProps extends CoComponentProps, React.ComponentPropsWithou } export const Affix = forwardRef( - ({ target, zIndex = 'sticky', position = { bottom: 20, right: 20 }, className, co, ...props }: AffixProps, ref) => { + ({ target, zIndex = 'sticky', position = { bottom: 20, right: 20 }, co, ...props }: AffixProps, ref) => { const theme = useCoTheme(); return ( diff --git a/packages/co-design-core/src/components/Alert/Alert.tsx b/packages/co-design-core/src/components/Alert/Alert.tsx index ff78b99b..41895338 100644 --- a/packages/co-design-core/src/components/Alert/Alert.tsx +++ b/packages/co-design-core/src/components/Alert/Alert.tsx @@ -1,4 +1,4 @@ -import React, { ReactNode, forwardRef } from 'react'; +import React, { forwardRef } from 'react'; import { CoComponentProps, PolymorphicComponentProps, PolymorphicRef, ClassNames } from '@co-design/styles'; import useStyles from './Alert.style'; @@ -45,7 +45,7 @@ export const Alert: AlertComponent & { displayName?: string } = forwardRef( )} {children && ( - {children as ReactNode} + {children as React.ReactNode} )} diff --git a/packages/co-design-core/src/components/Alert/AlertIcon.tsx b/packages/co-design-core/src/components/Alert/AlertIcon.tsx index 22fa433d..9172f479 100644 --- a/packages/co-design-core/src/components/Alert/AlertIcon.tsx +++ b/packages/co-design-core/src/components/Alert/AlertIcon.tsx @@ -1,11 +1,11 @@ -import { SVGProps } from 'react'; +import React from 'react'; import AlertCircle from './icons/AlertCircle'; import CheckCircle from './icons/CheckCircle'; import InfoCircle from './icons/InfoCircle'; import XCircle from './icons/XCircle'; import { useCoTheme } from '@co-design/styles'; -interface AlertIconProps extends SVGProps { +interface AlertIconProps extends React.SVGProps { severity: 'base' | 'info' | 'success' | 'warning' | 'critical'; color?: string; size?: number; diff --git a/packages/co-design-core/src/components/AppShell/AppShell.style.ts b/packages/co-design-core/src/components/AppShell/AppShell.style.ts index bcc70653..c72b24e1 100644 --- a/packages/co-design-core/src/components/AppShell/AppShell.style.ts +++ b/packages/co-design-core/src/components/AppShell/AppShell.style.ts @@ -1,4 +1,4 @@ -import { createStyles, CoTheme, CSSObject, CoSpacing, CoBreakpoints } from '@co-design/styles'; +import { createStyles, CoTheme, CSSObject, CoSpacing } from '@co-design/styles'; interface AppShellStyles { padding: CoSpacing | number; diff --git a/packages/co-design-core/src/components/AppShell/AppShell.tsx b/packages/co-design-core/src/components/AppShell/AppShell.tsx index e73c45a3..aeb77d4c 100644 --- a/packages/co-design-core/src/components/AppShell/AppShell.tsx +++ b/packages/co-design-core/src/components/AppShell/AppShell.tsx @@ -1,5 +1,5 @@ import React, { forwardRef } from 'react'; -import { CoComponentProps, CoTheme, useCoTheme, ClassNames, CoSpacing, CoZIndex, CoBreakpoints } from '@co-design/styles'; +import { CoComponentProps, CoTheme, useCoTheme, ClassNames, CoSpacing, CoZIndex } from '@co-design/styles'; import { View } from '../View'; import { getSortedBreakpoints } from './getSortedBreakpoints'; import useStyles from './AppShell.style'; diff --git a/packages/co-design-core/src/components/AppShell/Sidebar.tsx b/packages/co-design-core/src/components/AppShell/Sidebar.tsx index 5e994d0d..210d64dc 100644 --- a/packages/co-design-core/src/components/AppShell/Sidebar.tsx +++ b/packages/co-design-core/src/components/AppShell/Sidebar.tsx @@ -1,9 +1,8 @@ import React, { forwardRef } from 'react'; -import { ClassNames, CoComponentProps } from '@co-design/styles'; +import { ClassNames, CoComponentProps, CoBreakpoints, CoSpacing, CoZIndex } from '@co-design/styles'; import { View } from '../View'; import { SidebarSection } from './SidebarSection'; import useStyles, { SidebarPosition, SidebarWidth } from './Sidebar.style'; -import { CoBreakpoints, CoSpacing, CoZIndex } from '@co-design/styles'; export type SidebarStylesNames = ClassNames; diff --git a/packages/co-design-core/src/components/AspectRatio/AspectRatio.tsx b/packages/co-design-core/src/components/AspectRatio/AspectRatio.tsx index e0169e35..9d8121fa 100644 --- a/packages/co-design-core/src/components/AspectRatio/AspectRatio.tsx +++ b/packages/co-design-core/src/components/AspectRatio/AspectRatio.tsx @@ -1,6 +1,6 @@ import React, { forwardRef } from 'react'; import { CoComponentProps } from '@co-design/styles'; -import { View } from '../View/View'; +import { View } from '../View'; import useStyles from './AspectRatio.style'; export interface AspectRatioProps extends CoComponentProps, React.ComponentPropsWithoutRef<'div'> { diff --git a/packages/co-design-core/src/components/Badge/Badge.tsx b/packages/co-design-core/src/components/Badge/Badge.tsx index 384fa8f0..2a1f1c45 100644 --- a/packages/co-design-core/src/components/Badge/Badge.tsx +++ b/packages/co-design-core/src/components/Badge/Badge.tsx @@ -1,5 +1,5 @@ import { ClassNames, CoComponentProps, PolymorphicComponentProps, PolymorphicRef } from '@co-design/styles'; -import { ReactNode, forwardRef } from 'react'; +import React, { forwardRef } from 'react'; import useStyles from './Badge.style'; import { Typography } from '../Typography'; @@ -8,7 +8,7 @@ import { View } from '../View'; export type BadgeStylesNames = ClassNames; export interface _BadgeProps extends CoComponentProps { - badgeContent?: ReactNode; + badgeContent?: React.ReactNode; placement?: 'none' | 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left'; placeDistance?: number; placeDistanceX?: number; diff --git a/packages/co-design-core/src/components/Badge/Shield.tsx b/packages/co-design-core/src/components/Badge/Shield.tsx index e0841902..e011dd4f 100644 --- a/packages/co-design-core/src/components/Badge/Shield.tsx +++ b/packages/co-design-core/src/components/Badge/Shield.tsx @@ -1,5 +1,5 @@ import { ClassNames, PolymorphicComponentProps, PolymorphicRef, CoComponentProps } from '@co-design/styles'; -import { ComponentPropsWithoutRef, ReactElement, cloneElement, forwardRef } from 'react'; +import React, { cloneElement, forwardRef } from 'react'; import { _BadgeProps } from './Badge'; import useStyles from './Shield.style'; @@ -10,7 +10,7 @@ type ShieldBadgeStylesNames = ClassNames; interface Props { text?: string; - icon?: ReactElement; + icon?: React.ReactElement; size?: number; iconSize?: number; color?: string; @@ -19,7 +19,7 @@ interface Props { export interface _ShieldBadgeProps extends Omit<_BadgeProps, 'overrideStyles'>, CoComponentProps, - Omit, 'title'> { + Omit, 'title'> { title?: Props; message?: Props; } diff --git a/packages/co-design-core/src/components/Image/Image.tsx b/packages/co-design-core/src/components/Image/Image.tsx index 7b6f9020..094bbd21 100644 --- a/packages/co-design-core/src/components/Image/Image.tsx +++ b/packages/co-design-core/src/components/Image/Image.tsx @@ -58,7 +58,6 @@ export const Image = forwardRef( height = 'auto', alt, fit, - style, className, co, overrideStyles, diff --git a/packages/co-design-core/src/components/Menu/Menu.style.ts b/packages/co-design-core/src/components/Menu/Menu.style.ts index 08ee2051..dd9ac181 100644 --- a/packages/co-design-core/src/components/Menu/Menu.style.ts +++ b/packages/co-design-core/src/components/Menu/Menu.style.ts @@ -1,4 +1,4 @@ -import { createStyles, CoSize, CoSpacing } from '@co-design/styles'; +import { createStyles, CoSpacing } from '@co-design/styles'; interface MenuStyles { padding: CoSpacing | number; diff --git a/packages/co-design-core/src/components/Menu/Menu.tsx b/packages/co-design-core/src/components/Menu/Menu.tsx index b66b253a..6d41dde2 100644 --- a/packages/co-design-core/src/components/Menu/Menu.tsx +++ b/packages/co-design-core/src/components/Menu/Menu.tsx @@ -1,6 +1,5 @@ import React, { useState, useRef, forwardRef } from 'react'; -import { useId } from '@co-design/hooks'; -import { CoComponentProps, ClassNames, CoShadows, CoSize, CoSpacing } from '@co-design/styles'; +import { CoComponentProps, ClassNames, CoSpacing } from '@co-design/styles'; import { View } from '../View'; import { Divider } from '../Divider'; import { Text } from '../Text'; @@ -59,7 +58,7 @@ const getPreviousItem = (active: number, items: MenuItemType[]) => { }; export const Menu: MenuComponent = forwardRef( - ({ children, padding = 'medium', onMouseLeave, onMouseEnter, onChange, className, co, overrideStyles, ...props }: MenuProps, ref) => { + ({ children, padding = 'medium', className, co, overrideStyles, ...props }: MenuProps, ref) => { const [hovered, setHovered] = useState(-1); const buttonsRefs = useRef>({}); const { classes, cx, theme } = useStyles({ padding }, { overrideStyles, name: 'Menu' }); diff --git a/packages/co-design-core/src/components/Radio/RadioContext.tsx b/packages/co-design-core/src/components/Radio/RadioContext.tsx index e854db8e..1a9ea32b 100644 --- a/packages/co-design-core/src/components/Radio/RadioContext.tsx +++ b/packages/co-design-core/src/components/Radio/RadioContext.tsx @@ -1,4 +1,4 @@ -import { createContext, Context } from 'react'; +import React, { createContext, Context } from 'react'; export type RadioItemType = { label?: string; diff --git a/packages/co-design-core/src/components/Tabs/TabPane.tsx b/packages/co-design-core/src/components/Tabs/TabPane.tsx index 9fed3e14..e437f7cb 100644 --- a/packages/co-design-core/src/components/Tabs/TabPane.tsx +++ b/packages/co-design-core/src/components/Tabs/TabPane.tsx @@ -51,7 +51,6 @@ export const TabPane = forwardRef( buttonRef, color, orientation = 'horizontal', - icon: __, label, icon, color: overrideColor, diff --git a/packages/co-design-core/src/components/Typography/Typography.tsx b/packages/co-design-core/src/components/Typography/Typography.tsx index 604a15f9..734ba830 100644 --- a/packages/co-design-core/src/components/Typography/Typography.tsx +++ b/packages/co-design-core/src/components/Typography/Typography.tsx @@ -1,4 +1,4 @@ -import { forwardRef } from 'react'; +import React, { forwardRef } from 'react'; import { CoComponentProps, PolymorphicComponentProps, PolymorphicRef, CoTypography, ClassNames, CoColor } from '@co-design/styles'; import { View } from '../View'; import useStyles from './Typography.style'; diff --git a/packages/co-design-core/src/components/Upload/Upload.style.ts b/packages/co-design-core/src/components/Upload/Upload.style.ts index 6567f25a..a490b1be 100644 --- a/packages/co-design-core/src/components/Upload/Upload.style.ts +++ b/packages/co-design-core/src/components/Upload/Upload.style.ts @@ -1,6 +1,6 @@ import { createStyles } from '@co-design/styles'; -export default createStyles((theme) => { +export default createStyles(() => { return { root: { position: 'relative', diff --git a/packages/co-design-styles/src/theme/utils/getColor.ts b/packages/co-design-styles/src/theme/utils/getColor.ts index fd3159de..ee25ea53 100644 --- a/packages/co-design-styles/src/theme/utils/getColor.ts +++ b/packages/co-design-styles/src/theme/utils/getColor.ts @@ -23,8 +23,7 @@ export const getColor = (theme: CoTheme, color: CoColor, colorScale?: number): s return theme.palettes[color][colorScale ? colorScale : 5]; } } - - if (!CSS.supports('color', color)) { + if (window !== undefined && !CSS.supports('color', color)) { console.warn(`[@co-design/styles] Color ${color} is not supported by the browser. Please use a valid CSS color. [${color}]`); return 'inherit'; }