fix(ButtonGroup): define its own size variant

This commit is contained in:
Benjamin Canac
2024-07-18 11:24:40 +02:00
parent 70b964f3a0
commit 0dfd8b3248
3 changed files with 9 additions and 3 deletions

View File

@@ -3,7 +3,6 @@ import { tv, type VariantProps } from 'tailwind-variants'
import type { AppConfig } from '@nuxt/schema'
import _appConfig from '#build/app.config'
import theme from '#build/ui/button-group'
import type { ButtonProps } from './Button.vue'
const appConfig = _appConfig as AppConfig & { ui: { buttonGroup: Partial<typeof theme> } }
@@ -17,7 +16,7 @@ export interface ButtonGroupProps {
* @defaultValue 'div'
*/
as?: any
size?: ButtonProps['size']
size?: ButtonGroupVariants['size']
/**
* The orientation the buttons are laid out.
* @defaultValue 'horizontal'

View File

@@ -4,7 +4,7 @@ import type { ButtonGroupProps } from '../components/ButtonGroup.vue'
import type { GetObjectField } from '../types/utils'
export const buttonGroupInjectionKey: InjectionKey<ComputedRef<{
size: ButtonGroupProps ['size']
size: ButtonGroupProps['size']
orientation: ButtonGroupProps['orientation']
}>> = Symbol('nuxt-ui.button-group')

View File

@@ -21,6 +21,13 @@ export const buttonGroupVariantWithRoot = {
export default {
base: 'relative',
variants: {
size: {
xs: '',
sm: '',
md: '',
lg: '',
xl: ''
},
orientation: {
horizontal: 'inline-flex -space-x-px',
vertical: 'flex flex-col -space-y-px'