11<script setup lang="ts">
22const props = withDefaults (
33 defineProps <{
4- ' disabled' ? : boolean
5- ' type' ? : ' button' | ' submit'
6- ' variant' ? : ' primary' | ' secondary'
7- ' size' ? : ' small' | ' medium'
8- ' keyshortcut' ? : string
9-
10- /**
11- * Do not use this directly. Use keyshortcut instead; it generates the correct HTML and displays the shortcut in the UI.
12- */
13- ' aria-keyshortcuts' ? : never
14-
15- ' classicon' ? : string
4+ disabled? : boolean
5+ type? : ' button' | ' submit'
6+ variant? : ' primary' | ' secondary'
7+ size? : ' small' | ' medium'
8+ classicon? : string
9+ ariaKeyshortcuts? : string
10+ block? : boolean
1611 }>(),
1712 {
1813 type: ' button' ,
@@ -32,7 +27,16 @@ defineExpose({
3227<template >
3328 <button
3429 ref =" el"
35- class =" rounded-md outline-none group"
30+ class =" group cursor-pointer inline-flex gap-x-1.5 relative items-center justify-center rounded-md active:scale-[0.98] font-mono border border-solid border-border transition-[background-color,color,border,outline] duration-200 outline-transparent focus-visible:(outline-2 outline-accent outline-offset-2)"
31+ :class =" {
32+ 'inline-flex': !block,
33+ 'flex': block,
34+ 'text-sm px-4 py-2': size === 'medium',
35+ 'text-xs px-2 py-0.5': size === 'small',
36+ 'text-fg bg-bg hover:(bg-fg/10 border-fg/10)': variant === 'secondary',
37+ 'text-bg bg-fg border-fg hover:(bg-fg/80)': variant === 'primary',
38+ 'opacity-40 cursor-not-allowed border-transparent': disabled,
39+ }"
3640 :type =" props.type"
3741 :disabled ="
3842 /**
@@ -43,31 +47,20 @@ defineExpose({
4347 */
4448 disabled ? true : undefined
4549 "
46- :aria-keyshortcuts =" keyshortcut "
50+ :aria-keyshortcuts =" ariaKeyshortcuts "
4751 >
4852 <span
49- class =" group cursor-pointer inline-flex gap-x-1.5 relative items-center justify-center rounded-md active:scale-[0.98] font-mono border border-solid border-border transition-[background-color,color,border,outline] duration-200 transition-[border-radius_100ms] after:(content-[''] absolute inset--0.5 rounded-md) outline-transparent group-focus-visible:(outline-2 outline-accent outline-offset-2)"
50- :class =" {
51- 'text-sm px-4 py-2': size === 'medium',
52- 'text-xs px-2 py-0.5': size === 'small',
53- 'text-fg bg-bg hover:(bg-fg/10 border-fg/10)': variant === 'secondary',
54- 'text-bg bg-fg border-fg hover:(bg-fg/80)': variant === 'primary',
55- 'opacity-40 cursor-not-allowed border-transparent': disabled,
56- }"
53+ v-if =" classicon"
54+ :class =" [size === 'small' ? 'size-3' : 'size-4', classicon]"
55+ aria-hidden =" true"
56+ />
57+ <slot />
58+ <kbd
59+ v-if =" ariaKeyshortcuts"
60+ class =" ms-2 inline-flex items-center justify-center w-4 h-4 text-xs text-fg bg-bg-muted border border-border rounded no-underline"
61+ aria-hidden =" true"
5762 >
58- <span
59- v-if =" classicon"
60- :class =" [size === 'small' ? 'size-3' : 'size-4', classicon]"
61- aria-hidden =" true"
62- />
63- <slot />
64- <kbd
65- v-if =" keyshortcut"
66- class =" ms-2 inline-flex items-center justify-center w-4 h-4 text-xs text-fg bg-bg-muted border border-border rounded no-underline"
67- aria-hidden =" true"
68- >
69- {{ keyshortcut }}
70- </kbd >
71- </span >
63+ {{ ariaKeyshortcuts }}
64+ </kbd >
7265 </button >
7366</template >
0 commit comments