feat: integrate @base-ui/react
This commit is contained in:
@@ -24,6 +24,7 @@
|
|||||||
"typescript": "^5.9.3"
|
"typescript": "^5.9.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@base-ui/react": "^1.3.0",
|
||||||
"@fontsource-variable/roboto": "^5.2.10",
|
"@fontsource-variable/roboto": "^5.2.10",
|
||||||
"@fontsource/orbitron": "^5.2.8",
|
"@fontsource/orbitron": "^5.2.8",
|
||||||
"@fortawesome/fontawesome-svg-core": "^7.2.0",
|
"@fortawesome/fontawesome-svg-core": "^7.2.0",
|
||||||
|
|||||||
@@ -1,29 +1,22 @@
|
|||||||
|
import { useRender } from '@base-ui/react/use-render'
|
||||||
import { cx } from '@styled-system/css'
|
import { cx } from '@styled-system/css'
|
||||||
import { type ButtonVariantProps, button } from '@styled-system/recipes/button'
|
import { type ButtonVariantProps, button } from '@styled-system/recipes/button'
|
||||||
import type { ButtonHTMLAttributes, DetailedHTMLProps, FC } from 'react'
|
import type { FC } from 'react'
|
||||||
import type { MergeOmitting } from '@/types/helpers'
|
import type { MergeOmitting } from '@/types/helpers'
|
||||||
|
|
||||||
export type ButtonProps = MergeOmitting<
|
export type ButtonProps = MergeOmitting<
|
||||||
DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>,
|
useRender.ComponentProps<'button'>,
|
||||||
ButtonVariantProps
|
ButtonVariantProps
|
||||||
>
|
>
|
||||||
|
|
||||||
const Button: FC<ButtonProps> = ({
|
const Button: FC<ButtonProps> = ({ render, className, ...props }) => {
|
||||||
className,
|
const [buttonArgs, otherProps] = button.splitVariantProps(props)
|
||||||
type = 'button',
|
|
||||||
children,
|
return useRender({
|
||||||
...props
|
defaultTagName: 'button',
|
||||||
}) => {
|
render,
|
||||||
const [buttonArgs, restProps] = button.splitVariantProps(props)
|
props: { className: cx(button(buttonArgs), className), ...otherProps }
|
||||||
return (
|
})
|
||||||
<button
|
|
||||||
type={type}
|
|
||||||
{...restProps}
|
|
||||||
className={cx(button(buttonArgs), className)}
|
|
||||||
>
|
|
||||||
{children}
|
|
||||||
</button>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Button
|
export default Button
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
// Environment setup & latest features
|
// Environment setup & latest features
|
||||||
"lib": ["ESNext"],
|
"lib": ["ESNext", "DOM"],
|
||||||
"target": "ES2022",
|
"target": "ES2022",
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
"moduleDetection": "force",
|
"moduleDetection": "force",
|
||||||
|
|||||||
Reference in New Issue
Block a user