feat(SW-2879): Move BookingWidget to booking-flow package * Fix lockfile * Fix styling * a tiny little booking widget test * Tiny fixes * Merge branch 'master' into feat/sw-2879-booking-widget-to-booking-flow-package * Remove unused scripts * lint:fix * Merge branch 'master' into feat/sw-2879-booking-widget-to-booking-flow-package * Tiny lint fixes * update test * Update Input in booking-flow * Clean up comments etc * Merge branch 'master' into feat/sw-2879-booking-widget-to-booking-flow-package * Setup tracking context for booking-flow * Add missing use client * Fix temp tracking function * Pass booking to booking-widget * Remove comment * Add use client to booking widget tracking provider * Add use client to tracking functions * Merge branch 'master' into feat/sw-2879-booking-widget-to-booking-flow-package * Move debug page * Merge branch 'master' into feat/sw-2879-booking-widget-to-booking-flow-package * Merge branch 'master' into feat/sw-2879-booking-widget-to-booking-flow-package * Merge branch 'master' into feat/sw-2879-booking-widget-to-booking-flow-package Approved-by: Bianca Widstam
71 lines
1.6 KiB
TypeScript
71 lines
1.6 KiB
TypeScript
'use client'
|
|
|
|
import { Slot } from '@radix-ui/react-slot'
|
|
import { Button as ButtonRAC } from 'react-aria-components'
|
|
|
|
import { buttonVariants } from './variants'
|
|
|
|
import type { VariantProps } from 'class-variance-authority'
|
|
import type { ButtonProps as ReactAriaButtonProps } from 'react-aria-components'
|
|
|
|
export interface ButtonPropsRAC
|
|
extends Omit<ReactAriaButtonProps, 'isDisabled' | 'onClick'>,
|
|
VariantProps<typeof buttonVariants> {
|
|
asChild?: false | undefined | never
|
|
disabled?: ReactAriaButtonProps['isDisabled']
|
|
onClick?: ReactAriaButtonProps['onPress']
|
|
}
|
|
|
|
export interface ButtonPropsSlot
|
|
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
VariantProps<typeof buttonVariants> {
|
|
asChild: true
|
|
}
|
|
|
|
export type ButtonProps = ButtonPropsSlot | ButtonPropsRAC
|
|
|
|
/**
|
|
* @deprecated Use `@scandic-hotels/design-system/Button` instead.
|
|
*/
|
|
export function OldDSButton(props: ButtonProps) {
|
|
const {
|
|
className,
|
|
clean,
|
|
intent,
|
|
size,
|
|
theme,
|
|
fullWidth,
|
|
wrapping,
|
|
variant,
|
|
...restProps
|
|
} = props
|
|
|
|
const classNames = buttonVariants({
|
|
className,
|
|
clean,
|
|
intent,
|
|
size,
|
|
theme,
|
|
fullWidth,
|
|
wrapping,
|
|
variant,
|
|
})
|
|
|
|
if (restProps.asChild) {
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
const { asChild, ...slotProps } = restProps
|
|
return <Slot className={classNames} {...slotProps} />
|
|
}
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
const { asChild, onClick, disabled, ...racProps } = restProps
|
|
return (
|
|
<ButtonRAC
|
|
className={classNames}
|
|
isDisabled={disabled}
|
|
onPress={onClick}
|
|
{...racProps}
|
|
/>
|
|
)
|
|
}
|