mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-24 08:50:34 +01:00
fix(Accordion): solve the shift between buttons when they are opened (#379)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
committed by
GitHub
parent
b78fcf91a4
commit
eaf0043da6
@@ -259,12 +259,12 @@ const dropdown = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const accordion = {
|
const accordion = {
|
||||||
wrapper: 'w-full flex flex-col gap-y-2',
|
wrapper: 'w-full flex flex-col',
|
||||||
item: {
|
item: {
|
||||||
base: '',
|
base: '',
|
||||||
size: 'text-sm',
|
size: 'text-sm',
|
||||||
color: 'text-gray-500 dark:text-gray-400',
|
color: 'text-gray-500 dark:text-gray-400',
|
||||||
padding: 'py-2'
|
padding: 'pt-1.5 pb-3'
|
||||||
},
|
},
|
||||||
transition: {
|
transition: {
|
||||||
enterActiveClass: 'overflow-hidden transition-[height] duration-200 ease-out',
|
enterActiveClass: 'overflow-hidden transition-[height] duration-200 ease-out',
|
||||||
@@ -273,6 +273,7 @@ const accordion = {
|
|||||||
default: {
|
default: {
|
||||||
openIcon: 'i-heroicons-chevron-down-20-solid',
|
openIcon: 'i-heroicons-chevron-down-20-solid',
|
||||||
closeIcon: '',
|
closeIcon: '',
|
||||||
|
class: 'mb-1.5 w-full',
|
||||||
variant: 'soft'
|
variant: 'soft'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<HDisclosure v-for="(item, index) in items" v-slot="{ open, close }" :key="index" :default-open="defaultOpen || item.defaultOpen">
|
<HDisclosure v-for="(item, index) in items" v-slot="{ open, close }" :key="index" :default-open="defaultOpen || item.defaultOpen">
|
||||||
<HDisclosureButton :ref="() => buttonRefs[index] = close" as="template" :disabled="item.disabled">
|
<HDisclosureButton :ref="() => buttonRefs[index] = close" as="template" :disabled="item.disabled">
|
||||||
<slot :item="item" :index="index" :open="open" :close="close">
|
<slot :item="item" :index="index" :open="open" :close="close">
|
||||||
<UButton v-bind="{ ...omit(ui.default, ['openIcon', 'closeIcon']), ...$attrs, ...omit(item, ['slot', 'disabled', 'content', 'defaultOpen']) }" class="w-full">
|
<UButton v-bind="{ ...omit(ui.default, ['openIcon', 'closeIcon']), ...$attrs, ...omit(item, ['slot', 'disabled', 'content', 'defaultOpen']) }">
|
||||||
<template #trailing>
|
<template #trailing>
|
||||||
<UIcon
|
<UIcon
|
||||||
:name="!open ? openIcon : closeIcon ? closeIcon : openIcon"
|
:name="!open ? openIcon : closeIcon ? closeIcon : openIcon"
|
||||||
|
|||||||
Reference in New Issue
Block a user