dev: hotfix refactor
+ merged pub/custom-ui and pub/base into my-ui - droped pub/custom-ui
This commit is contained in:
No files matched your search
@@ -0,0 +1,55 @@
|
||||
<script setup lang="ts">
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
labelFor?: string
|
||||
size?: 'default' | 'narrow' | 'wide'
|
||||
height?: 'default' | 'compact'
|
||||
position?: 'default' | 'dynamic'
|
||||
stacked?: boolean
|
||||
}>(),
|
||||
{
|
||||
size: 'default',
|
||||
height: 'default',
|
||||
position: 'default',
|
||||
stacked: false,
|
||||
},
|
||||
)
|
||||
|
||||
const sizeMap = {
|
||||
default: 'w-28 2xl:w-36',
|
||||
narrow: 'w-24 2xl:w-28',
|
||||
wide: 'w-44 2xl:w-48',
|
||||
} as const
|
||||
|
||||
const heightMap = {
|
||||
default: 'pt-2 2xl:pt-2.5',
|
||||
compact: 'leading-[14pt]',
|
||||
} as const
|
||||
|
||||
const positionWrapMap = {
|
||||
default: 'pe-2 text-start',
|
||||
dynamic: 'md:text-end',
|
||||
} as const
|
||||
|
||||
const positionChildMap = {
|
||||
default: '',
|
||||
dynamic: 'block pe-2.5',
|
||||
} as const
|
||||
|
||||
const wrapperClass = computed(() => [
|
||||
'block shrink-0',
|
||||
props.stacked ? 'w-full mb-1 text-start' : sizeMap[props.size],
|
||||
props.stacked ? '' : heightMap[props.height],
|
||||
props.stacked ? '' : positionWrapMap[props.position],
|
||||
])
|
||||
|
||||
const labelClass = computed(() => [props.stacked ? 'block mb-1 text-sm font-medium' : positionChildMap[props.position]])
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div :class="wrapperClass">
|
||||
<label class="block" :class="labelClass" :for="labelFor">
|
||||
<slot />
|
||||
</label>
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user