File tree Expand file tree Collapse file tree 1 file changed +9
-18
lines changed
Expand file tree Collapse file tree 1 file changed +9
-18
lines changed Original file line number Diff line number Diff line change @@ -17,40 +17,31 @@ const props = defineProps<{
1717
1818const uid = useId ()
1919const internalId = ` ${model .value }-${uid } `
20-
2120const checked = computed (() => model .value === props .value )
22-
2321/** Todo: This shouldn't be necessary, but using v-model on `input type=radio` doesn't work as expected in Vue */
2422const onChange = () => {
2523 model .value = props .value
2624}
2725 </script >
2826
2927<template >
30- <label
31- class =" inline-flex items-center px-2 py-0.5 text-xs font-mono border rounded transition-colors duration-200 focus-within:ring-2 focus-within:ring-fg"
32- :class =" [
33- /** TODO: This should ideally be done in CSS only, but right now I can't get it working with UnoCSS */
34- checked
35- ? 'peer-checked:(bg-fg text-bg border-fg hover:(text-text-bg/50))'
36- : 'bg-bg-muted text-fg-muted border-border hover:(text-fg border-border-hover)',
37- {
38- 'opacity-50 cursor-not-allowed': props.disabled,
39- },
40- ]"
41- :htmlFor =" internalId"
42- >
28+ <div >
4329 <input
4430 type =" radio"
45- :name =" props.value"
4631 :id =" internalId"
4732 :value =" props.value"
4833 :checked =" checked"
4934 :disabled =" props.disabled ? true : undefined"
5035 @change =" onChange"
36+ class =" peer"
5137 />
52- <slot />
53- </label >
38+ <label
39+ class =" bg-bg-muted text-fg-muted border-border hover:(text-fg border-border-hover) inline-flex items-center px-2 py-0.5 text-xs font-mono border rounded transition-colors duration-200 peer-focus:ring-2 peer-focus:ring-fg border-none peer-checked:(bg-fg text-bg border-fg hover:(text-text-bg/50)) peer-disabled:(opacity-50 pointer-events-none)"
40+ :htmlFor =" internalId"
41+ >
42+ <slot />
43+ </label >
44+ </div >
5445</template >
5546
5647<style scoped>
You can’t perform that action at this time.
0 commit comments