improve checkbox styles

This commit is contained in:
Henry Jameson 2024-02-21 13:10:11 +02:00
parent 8a47069cee
commit f609aaba0c
7 changed files with 22 additions and 13 deletions

View File

@ -12,7 +12,7 @@
@change="$emit('update:modelValue', $event.target.checked)" @change="$emit('update:modelValue', $event.target.checked)"
> >
<i <i
class="input checkbox-indicator" class="input -checkbox checkbox-indicator"
:aria-hidden="true" :aria-hidden="true"
@transitionend.capture="onTransitionEnd" @transitionend.capture="onTransitionEnd"
/> />
@ -82,8 +82,7 @@ export default {
transition: color 200ms; transition: color 200ms;
width: 1.1em; width: 1.1em;
height: 1.1em; height: 1.1em;
border-radius: $fallback--checkboxRadius; border-radius: var(--roundness);
border-radius: var(--checkboxRadius, $fallback--checkboxRadius);
box-shadow: var(--shadow); box-shadow: var(--shadow);
background-color: var(--background); background-color: var(--background);
vertical-align: top; vertical-align: top;

View File

@ -14,7 +14,7 @@
v-if="typeof fallback !== 'undefined'" v-if="typeof fallback !== 'undefined'"
:id="name + '-o'" :id="name + '-o'"
:aria-labelledby="name + '-label'" :aria-labelledby="name + '-label'"
class="input opt exlcude-disabled visible-for-screenreader-only" class="input -checkbox opt exlcude-disabled visible-for-screenreader-only"
type="checkbox" type="checkbox"
:checked="present" :checked="present"
@change="$emit('update:modelValue', typeof modelValue === 'undefined' ? fallback : undefined)" @change="$emit('update:modelValue', typeof modelValue === 'undefined' ? fallback : undefined)"

View File

@ -12,6 +12,10 @@ const hoverGlow = {
export default { export default {
name: 'Input', name: 'Input',
selector: '.input', selector: '.input',
variant: {
checkbox: '.-checkbox',
radio: '.-radio'
},
states: { states: {
disabled: ':disabled', disabled: ':disabled',
hover: ':hover:not(:disabled)', hover: ':hover:not(:disabled)',
@ -21,6 +25,12 @@ export default {
'Text' 'Text'
], ],
defaultRules: [ defaultRules: [
{
variant: 'checkbox',
directives: {
roundness: 1
}
},
{ {
directives: { directives: {
background: '--fg, -5', background: '--fg, -5',

View File

@ -43,7 +43,7 @@
<input <input
v-if="poll.multiple" v-if="poll.multiple"
type="checkbox" type="checkbox"
class="input poll-checkbox" class="input -checkbox poll-checkbox"
:disabled="loading" :disabled="loading"
:value="index" :value="index"
> >
@ -52,7 +52,7 @@
type="radio" type="radio"
:disabled="loading" :disabled="loading"
:value="index" :value="index"
class="input" class="input -radio"
> >
<label class="option-vote"> <label class="option-vote">
<RichContent <RichContent

View File

@ -14,7 +14,7 @@
v-if="typeof fallback !== 'undefined'" v-if="typeof fallback !== 'undefined'"
:id="name + '-o'" :id="name + '-o'"
:aria-labelledby="name + '-label'" :aria-labelledby="name + '-label'"
class="input opt visible-for-screenreader-only" class="input -checkbox opt visible-for-screenreader-only"
type="checkbox" type="checkbox"
:checked="present" :checked="present"
@change="$emit('update:modelValue', !present ? fallback : undefined)" @change="$emit('update:modelValue', !present ? fallback : undefined)"

View File

@ -129,7 +129,7 @@
v-model="selected.inset" v-model="selected.inset"
:disabled="!present" :disabled="!present"
name="inset" name="inset"
class="input input-inset visible-for-screenreader-only" class="input -checkbox input-inset visible-for-screenreader-only"
type="checkbox" type="checkbox"
> >
<label <label

View File

@ -30,7 +30,7 @@ export const shadowsKeys = new Set([
export const radiiKeys = new Set([ export const radiiKeys = new Set([
'btn', 'btn',
'input', 'input',
// 'checkbox', 'checkbox',
'panel', 'panel',
'avatar', 'avatar',
'avatarAlt', 'avatarAlt',
@ -122,10 +122,10 @@ export const convertTheme2To3 = (data) => {
case 'input': case 'input':
rule.component = 'Input' rule.component = 'Input'
break break
// TODO: missing feature? case 'checkbox':
// case 'checkbox': rule.component = 'Input'
// rule.component = 'Input' rule.variant = 'checkbox'
// break break
case 'panel': case 'panel':
rule.component = 'Panel' rule.component = 'Panel'
break break