diff --git a/packages/ui/src/components/Button/Button.tsx b/packages/ui/src/components/Button/Button.tsx index fcacf7c22d..069c8632e0 100644 --- a/packages/ui/src/components/Button/Button.tsx +++ b/packages/ui/src/components/Button/Button.tsx @@ -14,15 +14,12 @@ * limitations under the License. */ -import clsx from 'clsx'; import { forwardRef, Ref } from 'react'; import { Button as RAButton, ProgressBar } from 'react-aria-components'; import { RiLoader4Line } from '@remixicon/react'; import type { ButtonProps } from './types'; -import { useStyles } from '../../hooks/useStyles'; +import { useDefinition } from '../../hooks/useDefinition'; import { ButtonDefinition } from './definition'; -import styles from './Button.module.css'; -import { useSurface } from '../../hooks/useSurface'; /** * A button component built on React Aria Components that provides accessible @@ -56,41 +53,23 @@ import { useSurface } from '../../hooks/useSurface'; */ export const Button = forwardRef( (props: ButtonProps, ref: Ref) => { - const { classNames, dataAttributes, cleanedProps } = useStyles( + const { ownProps, restProps, dataAttributes } = useDefinition( ButtonDefinition, - { - size: 'small', - variant: 'primary', - ...props, - }, + props, ); - - const { - children, - className, - iconStart, - iconEnd, - loading, - onSurface, - ...rest - } = cleanedProps; - - const { surface } = useSurface({ onSurface }); + const { classes, iconStart, iconEnd, loading, children } = ownProps; return ( {({ isPending }) => ( <> - + {iconStart} {children} {iconEnd} @@ -100,7 +79,7 @@ export const Button = forwardRef(