@@ -3,20 +3,16 @@ import {
33 ButtonOptions as AriakitButtonOptions ,
44 useButton as useAriakitButton ,
55} from "ariakit" ;
6- import {
7- createComponent ,
8- createElement ,
9- createHook ,
10- } from "ariakit-utils/system" ;
6+ import { createElement , createHook } from "ariakit-utils/system" ;
117import { As , Props } from "ariakit-utils/types" ;
128import { announce } from "@react-aria/live-announcer" ;
139
14- import { Box } from "../box" ;
10+ import { Box , BoxOptions , useBox } from "../box" ;
1511import { useButtonGroupContext } from "../button-group" ;
1612import { usePrevious } from "../hooks" ;
1713import { Spinner } from "../spinner" ;
1814import { useTheme } from "../theme" ;
19- import { cx , RenderProp , tcm , withIconA11y } from "../utils" ;
15+ import { createComponent , cx , RenderProp , tcm , withIconA11y } from "../utils" ;
2016
2117import { ButtonFullWidthSpinner , ButtonSpinner } from "./ButtonSpinner" ;
2218
@@ -130,6 +126,7 @@ export const useButton = createHook<ButtonOptions>(
130126 ) ;
131127 props = { ...props , className, children, disabled } ;
132128 props = useAriakitButton ( props ) ;
129+ props = useBox ( props ) ;
133130
134131 return props ;
135132 } ,
@@ -139,7 +136,7 @@ export const Button = createComponent<ButtonOptions>(props => {
139136 const htmlProps = useButton ( props ) ;
140137
141138 return createElement ( "button" , htmlProps ) ;
142- } ) ;
139+ } , "Button" ) ;
143140
144141export type ButtonState = {
145142 /**
@@ -195,10 +192,8 @@ export type ButtonState = {
195192
196193export type ButtonRenderProps = Pick < ButtonProps , "className" | "disabled" > ;
197194
198- export type ButtonOptions < T extends As = "button" > = Omit <
199- AriakitButtonOptions < T > ,
200- "size" | "prefix"
201- > &
195+ export type ButtonOptions < T extends As = "button" > = BoxOptions < T > &
196+ Omit < AriakitButtonOptions < T > , "size" | "prefix" > &
202197 Partial < ButtonState > ;
203198
204199export type ButtonProps < T extends As = "button" > = Props < ButtonOptions < T > > ;
0 commit comments