@sakoa/ui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +171 -0
- package/dist/App.d.ts +2 -0
- package/dist/cli/index.js +9243 -0
- package/dist/components/DemoSection.d.ts +30 -0
- package/dist/components/SApiKeyboard.d.ts +22 -0
- package/dist/components/SApiSection.d.ts +21 -0
- package/dist/components/SApiTable.d.ts +46 -0
- package/dist/components/STableOfContents.d.ts +2 -0
- package/dist/components/ui/SAlert.d.ts +76 -0
- package/dist/components/ui/SBadge.d.ts +56 -0
- package/dist/components/ui/SButton.d.ts +67 -0
- package/dist/components/ui/SCheckbox.d.ts +64 -0
- package/dist/components/ui/SChip.d.ts +43 -0
- package/dist/components/ui/SDatePicker.d.ts +77 -0
- package/dist/components/ui/SGlassButton.d.ts +70 -0
- package/dist/components/ui/SIcon.d.ts +29 -0
- package/dist/components/ui/SInput.d.ts +129 -0
- package/dist/components/ui/SKbd.d.ts +24 -0
- package/dist/components/ui/SKbdShortcut.d.ts +14 -0
- package/dist/components/ui/SSelect.d.ts +148 -0
- package/dist/components/ui/SSkeleton.d.ts +37 -0
- package/dist/components/ui/SSwitch.d.ts +61 -0
- package/dist/components/ui/STooltip.d.ts +82 -0
- package/dist/components/ui/accordion/SAccordionContent.d.ts +23 -0
- package/dist/components/ui/accordion/SAccordionItem.d.ts +70 -0
- package/dist/components/ui/accordion/SAccordionTrigger.d.ts +37 -0
- package/dist/components/ui/accordion/index.d.ts +4 -0
- package/dist/components/ui/avatar/SAvatar.d.ts +36 -0
- package/dist/components/ui/avatar/SAvatarFallback.d.ts +26 -0
- package/dist/components/ui/avatar/SAvatarGroup.d.ts +30 -0
- package/dist/components/ui/avatar/SAvatarImage.d.ts +23 -0
- package/dist/components/ui/avatar/index.d.ts +4 -0
- package/dist/components/ui/breadcrumb/SBreadcrumb.d.ts +22 -0
- package/dist/components/ui/breadcrumb/SBreadcrumbEllipsis.d.ts +17 -0
- package/dist/components/ui/breadcrumb/SBreadcrumbItem.d.ts +17 -0
- package/dist/components/ui/breadcrumb/SBreadcrumbLink.d.ts +26 -0
- package/dist/components/ui/breadcrumb/SBreadcrumbList.d.ts +17 -0
- package/dist/components/ui/breadcrumb/SBreadcrumbPage.d.ts +17 -0
- package/dist/components/ui/breadcrumb/SBreadcrumbSeparator.d.ts +17 -0
- package/dist/components/ui/breadcrumb/index.d.ts +7 -0
- package/dist/components/ui/card/SCard.d.ts +103 -0
- package/dist/components/ui/card/SCardActions.d.ts +44 -0
- package/dist/components/ui/card/SCardContent.d.ts +35 -0
- package/dist/components/ui/card/SCardFooter.d.ts +38 -0
- package/dist/components/ui/card/SCardHeader.d.ts +53 -0
- package/dist/components/ui/card/SCardMedia.d.ts +83 -0
- package/dist/components/ui/card/SGlassCard.d.ts +103 -0
- package/dist/components/ui/card/SMorphingCardContent.d.ts +18 -0
- package/dist/components/ui/card/index.d.ts +24 -0
- package/dist/components/ui/carousel/SCarousel.d.ts +166 -0
- package/dist/components/ui/carousel/index.d.ts +2 -0
- package/dist/components/ui/color-picker/SColorPickerAlphaSlider.d.ts +4 -0
- package/dist/components/ui/color-picker/SColorPickerCopy.d.ts +19 -0
- package/dist/components/ui/color-picker/SColorPickerEyeDropper.d.ts +17 -0
- package/dist/components/ui/color-picker/SColorPickerHueSlider.d.ts +4 -0
- package/dist/components/ui/color-picker/SColorPickerInputs.d.ts +2 -0
- package/dist/components/ui/color-picker/SColorPickerPresets.d.ts +9 -0
- package/dist/components/ui/color-picker/SColorPickerPreview.d.ts +2 -0
- package/dist/components/ui/color-picker/SColorPickerRecent.d.ts +7 -0
- package/dist/components/ui/color-picker/SColorPickerSpectrum.d.ts +4 -0
- package/dist/components/ui/color-picker/index.d.ts +11 -0
- package/dist/components/ui/drawer/index.d.ts +11 -0
- package/dist/components/ui/dropdown/SDropdownDivider.d.ts +8 -0
- package/dist/components/ui/dropdown/SDropdownGroup.d.ts +25 -0
- package/dist/components/ui/dropdown/SDropdownItem.d.ts +56 -0
- package/dist/components/ui/dropdown/index.d.ts +4 -0
- package/dist/components/ui/form/SForm.d.ts +38 -0
- package/dist/components/ui/form/SFormField.d.ts +31 -0
- package/dist/components/ui/form/index.d.ts +5 -0
- package/dist/components/ui/modal/index.d.ts +19 -0
- package/dist/components/ui/option/SOption.d.ts +32 -0
- package/dist/components/ui/option/SOptionGroup.d.ts +28 -0
- package/dist/components/ui/option/index.d.ts +2 -0
- package/dist/components/ui/otp/SOTP.d.ts +122 -0
- package/dist/components/ui/otp/SOTPGroup.d.ts +23 -0
- package/dist/components/ui/otp/SOTPSeparator.d.ts +17 -0
- package/dist/components/ui/otp/SOTPSlot.d.ts +49 -0
- package/dist/components/ui/otp/index.d.ts +7 -0
- package/dist/components/ui/otp/types.d.ts +26 -0
- package/dist/components/ui/otp/useOTPContext.d.ts +42 -0
- package/dist/components/ui/pagination/SPagination.d.ts +151 -0
- package/dist/components/ui/pagination/index.d.ts +2 -0
- package/dist/components/ui/progress/SProgress.d.ts +62 -0
- package/dist/components/ui/progress/SProgressRange.d.ts +91 -0
- package/dist/components/ui/progress/index.d.ts +4 -0
- package/dist/components/ui/radio/SRadio.d.ts +58 -0
- package/dist/components/ui/radio/SRadioGroup.d.ts +52 -0
- package/dist/components/ui/radio/index.d.ts +2 -0
- package/dist/components/ui/stepper/SStepper.d.ts +83 -0
- package/dist/components/ui/stepper/SStepperContent.d.ts +24 -0
- package/dist/components/ui/stepper/SStepperDescription.d.ts +20 -0
- package/dist/components/ui/stepper/SStepperIndicator.d.ts +37 -0
- package/dist/components/ui/stepper/SStepperItem.d.ts +37 -0
- package/dist/components/ui/stepper/SStepperSeparator.d.ts +5 -0
- package/dist/components/ui/stepper/SStepperTitle.d.ts +20 -0
- package/dist/components/ui/stepper/SStepperTrigger.d.ts +22 -0
- package/dist/components/ui/stepper/index.d.ts +11 -0
- package/dist/components/ui/table/STableBody.d.ts +27 -0
- package/dist/components/ui/table/STableCell.d.ts +55 -0
- package/dist/components/ui/table/STableColumn.d.ts +87 -0
- package/dist/components/ui/table/STableEmpty.d.ts +54 -0
- package/dist/components/ui/table/STableHeader.d.ts +25 -0
- package/dist/components/ui/table/STableRow.d.ts +38 -0
- package/dist/components/ui/table/STableSkeleton.d.ts +29 -0
- package/dist/components/ui/table/index.d.ts +98 -0
- package/dist/components/ui/table/useDataTable.d.ts +80 -0
- package/dist/components/ui/tabs/STabPane.d.ts +31 -0
- package/dist/components/ui/tabs/STabsContent.d.ts +21 -0
- package/dist/components/ui/tabs/STabsIndicator.d.ts +9 -0
- package/dist/components/ui/tabs/STabsTrigger.d.ts +28 -0
- package/dist/components/ui/tabs/index.d.ts +6 -0
- package/dist/components/ui/toast/SToast.d.ts +49 -0
- package/dist/components/ui/toast/SToastContainer.d.ts +21 -0
- package/dist/components/ui/toast/index.d.ts +2 -0
- package/dist/composables/useAsync.d.ts +134 -0
- package/dist/composables/useClickOutside.d.ts +69 -0
- package/dist/composables/useClipboard.d.ts +46 -0
- package/dist/composables/useDebounce.d.ts +150 -0
- package/dist/composables/useDialog.d.ts +118 -0
- package/dist/composables/useForm.d.ts +204 -0
- package/dist/composables/useHotkey.d.ts +128 -0
- package/dist/composables/useIntersectionObserver.d.ts +156 -0
- package/dist/composables/useLocalStorage.d.ts +120 -0
- package/dist/composables/useMediaQuery.d.ts +115 -0
- package/dist/composables/useTheme.d.ts +8 -0
- package/dist/composables/useToast.d.ts +1619 -0
- package/dist/index.d.ts +71 -0
- package/dist/layouts/UILayout.d.ts +2 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/main.d.ts +0 -0
- package/dist/router.d.ts +2 -0
- package/dist/saka-ui.css +1 -0
- package/dist/saka-ui.js +18513 -0
- package/dist/saka-ui.umd.cjs +38 -0
- package/dist/views/docs/CustomizationView.d.ts +2 -0
- package/dist/views/docs/FormValidationView.d.ts +2 -0
- package/dist/views/docs/StylingGuideView.d.ts +2 -0
- package/dist/views/docs/UseAsyncView.d.ts +2 -0
- package/dist/views/docs/UseClickOutsideView.d.ts +124 -0
- package/dist/views/docs/UseClipboardView.d.ts +4 -0
- package/dist/views/docs/UseDebounceView.d.ts +2 -0
- package/dist/views/docs/UseHotkeyView.d.ts +205 -0
- package/dist/views/docs/UseIntersectionObserverView.d.ts +5 -0
- package/dist/views/docs/UseLocalStorageView.d.ts +2 -0
- package/dist/views/docs/UseMediaQueryView.d.ts +2 -0
- package/dist/views/docs/UseThemeView.d.ts +2 -0
- package/dist/views/examples/AuthFormView.d.ts +2 -0
- package/dist/views/examples/CreditCardFormView.d.ts +6 -0
- package/dist/views/examples/FormFieldExampleView.d.ts +2 -0
- package/dist/views/examples/ProjectFormView.d.ts +2 -0
- package/dist/views/ui/AccordionView.d.ts +2 -0
- package/dist/views/ui/AlertView.d.ts +2 -0
- package/dist/views/ui/AvatarView.d.ts +2 -0
- package/dist/views/ui/BadgeView.d.ts +2 -0
- package/dist/views/ui/BreadcrumbView.d.ts +2 -0
- package/dist/views/ui/ButtonView.d.ts +2 -0
- package/dist/views/ui/CardView.d.ts +2 -0
- package/dist/views/ui/CarouselView.d.ts +274 -0
- package/dist/views/ui/CheckboxView.d.ts +2 -0
- package/dist/views/ui/ChipView.d.ts +2 -0
- package/dist/views/ui/ColorPickerView.d.ts +2 -0
- package/dist/views/ui/DatePickerView.d.ts +2 -0
- package/dist/views/ui/DialogView.d.ts +2 -0
- package/dist/views/ui/DrawerView.d.ts +2 -0
- package/dist/views/ui/DropdownView.d.ts +2 -0
- package/dist/views/ui/GlassButtonView.d.ts +2 -0
- package/dist/views/ui/GlassCardView.d.ts +2 -0
- package/dist/views/ui/HomeView.d.ts +2 -0
- package/dist/views/ui/IconsView.d.ts +2 -0
- package/dist/views/ui/InputView.d.ts +2 -0
- package/dist/views/ui/KbdView.d.ts +2 -0
- package/dist/views/ui/ModalView.d.ts +2 -0
- package/dist/views/ui/MorphingCardView.d.ts +2 -0
- package/dist/views/ui/MorphingModalView.d.ts +2 -0
- package/dist/views/ui/OTPView.d.ts +206 -0
- package/dist/views/ui/PaginationView.d.ts +2 -0
- package/dist/views/ui/ProgressView.d.ts +2 -0
- package/dist/views/ui/RadioView.d.ts +2 -0
- package/dist/views/ui/SelectView.d.ts +2 -0
- package/dist/views/ui/SkeletonView.d.ts +2 -0
- package/dist/views/ui/StepperView.d.ts +2 -0
- package/dist/views/ui/SwitchView.d.ts +2 -0
- package/dist/views/ui/TableView.d.ts +2 -0
- package/dist/views/ui/TabsView.d.ts +2 -0
- package/dist/views/ui/ToastView.d.ts +2 -0
- package/dist/views/ui/TooltipView.d.ts +2 -0
- package/dist/vite.svg +1 -0
- package/package.json +64 -0
- package/registry/components/accordion.json +19 -0
- package/registry/components/alert.json +17 -0
- package/registry/components/avatar.json +18 -0
- package/registry/components/badge.json +14 -0
- package/registry/components/breadcrumb.json +24 -0
- package/registry/components/button.json +17 -0
- package/registry/components/card.json +23 -0
- package/registry/components/carousel.json +19 -0
- package/registry/components/checkbox.json +17 -0
- package/registry/components/chip.json +17 -0
- package/registry/components/color-picker.json +24 -0
- package/registry/components/date-picker.json +17 -0
- package/registry/components/drawer.json +26 -0
- package/registry/components/dropdown.json +21 -0
- package/registry/components/form.json +16 -0
- package/registry/components/glass-button.json +17 -0
- package/registry/components/icon.json +17 -0
- package/registry/components/input.json +17 -0
- package/registry/components/kbd.json +16 -0
- package/registry/components/modal.json +32 -0
- package/registry/components/option.json +16 -0
- package/registry/components/otp.json +23 -0
- package/registry/components/pagination.json +18 -0
- package/registry/components/progress.json +16 -0
- package/registry/components/radio.json +19 -0
- package/registry/components/select.json +17 -0
- package/registry/components/skeleton.json +14 -0
- package/registry/components/switch.json +17 -0
- package/registry/components/table.json +26 -0
- package/registry/components/tabs.json +19 -0
- package/registry/components/toast.json +19 -0
- package/registry/components/tooltip.json +14 -0
- package/registry/index.json +4 -0
- package/registry/source/components/ui/SAlert.vue +388 -0
- package/registry/source/components/ui/SBadge.vue +243 -0
- package/registry/source/components/ui/SButton.vue +387 -0
- package/registry/source/components/ui/SCheckbox.vue +310 -0
- package/registry/source/components/ui/SChip.vue +130 -0
- package/registry/source/components/ui/SDatePicker.vue +1290 -0
- package/registry/source/components/ui/SGlassButton.vue +547 -0
- package/registry/source/components/ui/SIcon.vue +78 -0
- package/registry/source/components/ui/SInput.vue +1054 -0
- package/registry/source/components/ui/SKbd.vue +96 -0
- package/registry/source/components/ui/SKbdShortcut.vue +36 -0
- package/registry/source/components/ui/SSelect.vue +1290 -0
- package/registry/source/components/ui/SSkeleton.vue +185 -0
- package/registry/source/components/ui/SSwitch.vue +275 -0
- package/registry/source/components/ui/STooltip.vue +491 -0
- package/registry/source/components/ui/accordion/SAccordion.vue +248 -0
- package/registry/source/components/ui/accordion/SAccordionItem.vue +353 -0
- package/registry/source/components/ui/accordion/index.ts +5 -0
- package/registry/source/components/ui/avatar/SAvatar.vue +169 -0
- package/registry/source/components/ui/avatar/SAvatarFallback.vue +66 -0
- package/registry/source/components/ui/avatar/SAvatarGroup.vue +69 -0
- package/registry/source/components/ui/avatar/SAvatarImage.vue +92 -0
- package/registry/source/components/ui/avatar/index.ts +5 -0
- package/registry/source/components/ui/breadcrumb/SBreadcrumb.vue +23 -0
- package/registry/source/components/ui/breadcrumb/SBreadcrumbEllipsis.vue +17 -0
- package/registry/source/components/ui/breadcrumb/SBreadcrumbItem.vue +14 -0
- package/registry/source/components/ui/breadcrumb/SBreadcrumbLink.vue +46 -0
- package/registry/source/components/ui/breadcrumb/SBreadcrumbList.vue +17 -0
- package/registry/source/components/ui/breadcrumb/SBreadcrumbPage.vue +15 -0
- package/registry/source/components/ui/breadcrumb/SBreadcrumbSeparator.vue +18 -0
- package/registry/source/components/ui/breadcrumb/index.ts +7 -0
- package/registry/source/components/ui/card/SCard.vue +517 -0
- package/registry/source/components/ui/card/SCardActions.vue +129 -0
- package/registry/source/components/ui/card/SCardContent.vue +117 -0
- package/registry/source/components/ui/card/SCardFooter.vue +103 -0
- package/registry/source/components/ui/card/SCardHeader.vue +163 -0
- package/registry/source/components/ui/card/SCardMedia.vue +312 -0
- package/registry/source/components/ui/card/index.ts +34 -0
- package/registry/source/components/ui/carousel/SCarousel.vue +1069 -0
- package/registry/source/components/ui/carousel/SCarouselSlide.vue +107 -0
- package/registry/source/components/ui/carousel/index.ts +3 -0
- package/registry/source/components/ui/color-picker/SColorPicker.vue +772 -0
- package/registry/source/components/ui/color-picker/SColorPickerAlphaSlider.vue +158 -0
- package/registry/source/components/ui/color-picker/SColorPickerCopy.vue +76 -0
- package/registry/source/components/ui/color-picker/SColorPickerEyeDropper.vue +68 -0
- package/registry/source/components/ui/color-picker/SColorPickerHueSlider.vue +138 -0
- package/registry/source/components/ui/color-picker/SColorPickerInputs.vue +227 -0
- package/registry/source/components/ui/color-picker/SColorPickerPresets.vue +87 -0
- package/registry/source/components/ui/color-picker/SColorPickerPreview.vue +46 -0
- package/registry/source/components/ui/color-picker/SColorPickerRecent.vue +74 -0
- package/registry/source/components/ui/color-picker/SColorPickerSpectrum.vue +149 -0
- package/registry/source/components/ui/color-picker/index.ts +11 -0
- package/registry/source/components/ui/drawer/SDrawer.vue +797 -0
- package/registry/source/components/ui/drawer/SDrawerClose.vue +64 -0
- package/registry/source/components/ui/drawer/SDrawerContent.vue +81 -0
- package/registry/source/components/ui/drawer/SDrawerDescription.vue +40 -0
- package/registry/source/components/ui/drawer/SDrawerFooter.vue +97 -0
- package/registry/source/components/ui/drawer/SDrawerHandle.vue +79 -0
- package/registry/source/components/ui/drawer/SDrawerHeader.vue +117 -0
- package/registry/source/components/ui/drawer/SDrawerTitle.vue +40 -0
- package/registry/source/components/ui/drawer/SDrawerTrigger.vue +51 -0
- package/registry/source/components/ui/drawer/index.ts +20 -0
- package/registry/source/components/ui/dropdown/SDropdown.vue +843 -0
- package/registry/source/components/ui/dropdown/SDropdownDivider.vue +23 -0
- package/registry/source/components/ui/dropdown/SDropdownGroup.vue +53 -0
- package/registry/source/components/ui/dropdown/SDropdownItem.vue +179 -0
- package/registry/source/components/ui/dropdown/index.ts +5 -0
- package/registry/source/components/ui/form/SForm.vue +84 -0
- package/registry/source/components/ui/form/SFormField.vue +78 -0
- package/registry/source/components/ui/form/index.ts +8 -0
- package/registry/source/components/ui/modal/SModal.vue +648 -0
- package/registry/source/components/ui/modal/SModalClose.vue +49 -0
- package/registry/source/components/ui/modal/SModalContent.vue +74 -0
- package/registry/source/components/ui/modal/SModalDescription.vue +39 -0
- package/registry/source/components/ui/modal/SModalFooter.vue +84 -0
- package/registry/source/components/ui/modal/SModalHeader.vue +107 -0
- package/registry/source/components/ui/modal/SModalTitle.vue +39 -0
- package/registry/source/components/ui/modal/SModalTrigger.vue +61 -0
- package/registry/source/components/ui/modal/SMorphingModal.vue +429 -0
- package/registry/source/components/ui/modal/SMorphingModalClose.vue +42 -0
- package/registry/source/components/ui/modal/SMorphingModalDescription.vue +49 -0
- package/registry/source/components/ui/modal/SMorphingModalImage.vue +44 -0
- package/registry/source/components/ui/modal/SMorphingModalSubtitle.vue +29 -0
- package/registry/source/components/ui/modal/SMorphingModalTitle.vue +34 -0
- package/registry/source/components/ui/modal/SMorphingModalTrigger.vue +95 -0
- package/registry/source/components/ui/modal/index.ts +32 -0
- package/registry/source/components/ui/option/SOption.vue +180 -0
- package/registry/source/components/ui/option/SOptionGroup.vue +77 -0
- package/registry/source/components/ui/option/index.ts +3 -0
- package/registry/source/components/ui/otp/SOTP.vue +843 -0
- package/registry/source/components/ui/otp/SOTPGroup.vue +29 -0
- package/registry/source/components/ui/otp/SOTPSeparator.vue +15 -0
- package/registry/source/components/ui/otp/SOTPSlot.vue +462 -0
- package/registry/source/components/ui/otp/index.ts +7 -0
- package/registry/source/components/ui/otp/types.ts +27 -0
- package/registry/source/components/ui/otp/useOTPContext.ts +62 -0
- package/registry/source/components/ui/pagination/SPagination.vue +923 -0
- package/registry/source/components/ui/pagination/index.ts +8 -0
- package/registry/source/components/ui/progress/SProgress.vue +635 -0
- package/registry/source/components/ui/progress/SProgressRange.vue +715 -0
- package/registry/source/components/ui/progress/index.ts +4 -0
- package/registry/source/components/ui/radio/SRadio.vue +407 -0
- package/registry/source/components/ui/radio/SRadioGroup.vue +200 -0
- package/registry/source/components/ui/radio/index.ts +3 -0
- package/registry/source/components/ui/table/SDataTable.vue +828 -0
- package/registry/source/components/ui/table/STableBody.vue +70 -0
- package/registry/source/components/ui/table/STableCell.vue +147 -0
- package/registry/source/components/ui/table/STableColumn.vue +120 -0
- package/registry/source/components/ui/table/STableEmpty.vue +159 -0
- package/registry/source/components/ui/table/STableHeader.vue +132 -0
- package/registry/source/components/ui/table/STableRow.vue +106 -0
- package/registry/source/components/ui/table/STableSkeleton.vue +208 -0
- package/registry/source/components/ui/table/index.ts +126 -0
- package/registry/source/components/ui/table/useDataTable.ts +519 -0
- package/registry/source/components/ui/tabs/STabPane.vue +130 -0
- package/registry/source/components/ui/tabs/STabs.vue +467 -0
- package/registry/source/components/ui/tabs/index.ts +7 -0
- package/registry/source/components/ui/toast/SToast.vue +261 -0
- package/registry/source/components/ui/toast/SToastContainer.vue +209 -0
- package/registry/source/components/ui/toast/index.ts +2 -0
- package/registry/source/composables/useForm.ts +960 -0
- package/registry/source/composables/useTheme.ts +86 -0
- package/registry/source/composables/useToast.ts +440 -0
- package/registry/source/lib/utils.ts +6 -0
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* SAccordion - Advanced Accordion Component
|
|
4
|
+
* A highly customizable accordion component styled with TailwindCSS
|
|
5
|
+
*/
|
|
6
|
+
import { type InjectionKey, type Ref } from 'vue'
|
|
7
|
+
|
|
8
|
+
// Types
|
|
9
|
+
export type AccordionType = 'default' | 'bordered' | 'separated' | 'card' | 'minimal'
|
|
10
|
+
export type AccordionSize = 'small' | 'medium' | 'large'
|
|
11
|
+
export type IconPlacement = 'left' | 'right'
|
|
12
|
+
|
|
13
|
+
export interface AccordionItemInfo {
|
|
14
|
+
name: string | number
|
|
15
|
+
disabled?: boolean
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface SAccordionContext {
|
|
19
|
+
activeItems: Ref<Set<string | number>>
|
|
20
|
+
type: AccordionType
|
|
21
|
+
size: AccordionSize
|
|
22
|
+
multiple: boolean
|
|
23
|
+
collapsible: boolean
|
|
24
|
+
iconPlacement: IconPlacement
|
|
25
|
+
iconRotation: number
|
|
26
|
+
animated: boolean
|
|
27
|
+
divider: boolean
|
|
28
|
+
dense: boolean
|
|
29
|
+
color: string
|
|
30
|
+
registerItem: (item: AccordionItemInfo) => void
|
|
31
|
+
unregisterItem: (name: string | number) => void
|
|
32
|
+
toggleItem: (name: string | number) => void
|
|
33
|
+
isExpanded: (name: string | number) => boolean
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const SAccordionContextKey: InjectionKey<SAccordionContext> = Symbol('SAccordionContext')
|
|
37
|
+
|
|
38
|
+
export interface SAccordionItemContext {
|
|
39
|
+
isExpanded: Ref<boolean>
|
|
40
|
+
disabled: Ref<boolean>
|
|
41
|
+
toggle: () => void
|
|
42
|
+
contentRef: Ref<HTMLElement | null>
|
|
43
|
+
contentHeight: Ref<number>
|
|
44
|
+
updateContentHeight: () => void
|
|
45
|
+
shouldRender: Ref<boolean>
|
|
46
|
+
contentWrapperStyle: Ref<Record<string, string>>
|
|
47
|
+
sizeConfig: Ref<{ header: string; title: string; subtitle: string; icon: string; content: string; expandIcon: string }>
|
|
48
|
+
accordionContext: SAccordionContext | undefined
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const SAccordionItemContextKey: InjectionKey<SAccordionItemContext> = Symbol('SAccordionItemContext')
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<script setup lang="ts">
|
|
55
|
+
defineOptions({ inheritAttrs: false })
|
|
56
|
+
|
|
57
|
+
import { provide, ref, computed, watch } from 'vue'
|
|
58
|
+
import { cn } from '../../../lib/utils'
|
|
59
|
+
|
|
60
|
+
export interface Props {
|
|
61
|
+
/** Active item(s) - array for multiple mode, single value for single mode */
|
|
62
|
+
modelValue?: string | number | (string | number)[]
|
|
63
|
+
/** Visual variant */
|
|
64
|
+
type?: AccordionType
|
|
65
|
+
/** Size variant */
|
|
66
|
+
size?: AccordionSize
|
|
67
|
+
/** Allow multiple items to be expanded */
|
|
68
|
+
multiple?: boolean
|
|
69
|
+
/** Allow all items to be collapsed (in single mode) */
|
|
70
|
+
collapsible?: boolean
|
|
71
|
+
/** Expand icon position */
|
|
72
|
+
iconPlacement?: IconPlacement
|
|
73
|
+
/** Icon rotation angle when expanded */
|
|
74
|
+
iconRotation?: number
|
|
75
|
+
/** Enable height transitions */
|
|
76
|
+
animated?: boolean
|
|
77
|
+
/** Show dividers between items */
|
|
78
|
+
divider?: boolean
|
|
79
|
+
/** Active/accent color */
|
|
80
|
+
color?: string
|
|
81
|
+
/** Dense mode for compact layout */
|
|
82
|
+
dense?: boolean
|
|
83
|
+
/** Additional classes for the accordion */
|
|
84
|
+
accordionClass?: string
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
88
|
+
modelValue: undefined,
|
|
89
|
+
type: 'default',
|
|
90
|
+
size: 'medium',
|
|
91
|
+
multiple: false,
|
|
92
|
+
collapsible: true,
|
|
93
|
+
iconPlacement: 'right',
|
|
94
|
+
iconRotation: 180,
|
|
95
|
+
animated: true,
|
|
96
|
+
divider: true,
|
|
97
|
+
color: 'var(--s-primary)',
|
|
98
|
+
dense: false,
|
|
99
|
+
accordionClass: ''
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
const emit = defineEmits<{
|
|
103
|
+
'update:modelValue': [value: string | number | (string | number)[]]
|
|
104
|
+
'change': [name: string | number, expanded: boolean]
|
|
105
|
+
'before-expand': [name: string | number]
|
|
106
|
+
'after-expand': [name: string | number]
|
|
107
|
+
'before-collapse': [name: string | number]
|
|
108
|
+
'after-collapse': [name: string | number]
|
|
109
|
+
}>()
|
|
110
|
+
|
|
111
|
+
// State
|
|
112
|
+
const registeredItems = ref<AccordionItemInfo[]>([])
|
|
113
|
+
const activeItems = ref<Set<string | number>>(new Set())
|
|
114
|
+
|
|
115
|
+
// Initialize from modelValue
|
|
116
|
+
const initializeActiveItems = () => {
|
|
117
|
+
if (props.modelValue === undefined) return
|
|
118
|
+
|
|
119
|
+
activeItems.value.clear()
|
|
120
|
+
if (Array.isArray(props.modelValue)) {
|
|
121
|
+
props.modelValue.forEach(v => activeItems.value.add(v))
|
|
122
|
+
} else if (props.modelValue !== null) {
|
|
123
|
+
activeItems.value.add(props.modelValue)
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Watch modelValue changes
|
|
128
|
+
watch(() => props.modelValue, initializeActiveItems, { immediate: true })
|
|
129
|
+
|
|
130
|
+
// Methods
|
|
131
|
+
const registerItem = (item: AccordionItemInfo) => {
|
|
132
|
+
if (!registeredItems.value.find(i => i.name === item.name)) {
|
|
133
|
+
registeredItems.value.push(item)
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const unregisterItem = (name: string | number) => {
|
|
138
|
+
const index = registeredItems.value.findIndex(i => i.name === name)
|
|
139
|
+
if (index > -1) {
|
|
140
|
+
registeredItems.value.splice(index, 1)
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const isExpanded = (name: string | number): boolean => {
|
|
145
|
+
return activeItems.value.has(name)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const toggleItem = (name: string | number) => {
|
|
149
|
+
const item = registeredItems.value.find(i => i.name === name)
|
|
150
|
+
if (item?.disabled) return
|
|
151
|
+
|
|
152
|
+
const currentlyExpanded = isExpanded(name)
|
|
153
|
+
|
|
154
|
+
if (currentlyExpanded) {
|
|
155
|
+
// Collapsing
|
|
156
|
+
if (!props.collapsible && !props.multiple && activeItems.value.size === 1) {
|
|
157
|
+
return // Can't collapse if not collapsible and it's the only one open
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
emit('before-collapse', name)
|
|
161
|
+
activeItems.value.delete(name)
|
|
162
|
+
emit('change', name, false)
|
|
163
|
+
|
|
164
|
+
setTimeout(() => emit('after-collapse', name), props.animated ? 300 : 0)
|
|
165
|
+
} else {
|
|
166
|
+
// Expanding
|
|
167
|
+
emit('before-expand', name)
|
|
168
|
+
|
|
169
|
+
if (!props.multiple) {
|
|
170
|
+
// Close all others first
|
|
171
|
+
activeItems.value.forEach(n => {
|
|
172
|
+
if (n !== name) {
|
|
173
|
+
emit('before-collapse', n)
|
|
174
|
+
emit('change', n, false)
|
|
175
|
+
setTimeout(() => emit('after-collapse', n), props.animated ? 300 : 0)
|
|
176
|
+
}
|
|
177
|
+
})
|
|
178
|
+
activeItems.value.clear()
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
activeItems.value.add(name)
|
|
182
|
+
emit('change', name, true)
|
|
183
|
+
|
|
184
|
+
setTimeout(() => emit('after-expand', name), props.animated ? 300 : 0)
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// Emit modelValue update
|
|
188
|
+
emitModelValue()
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
const emitModelValue = () => {
|
|
192
|
+
if (props.multiple) {
|
|
193
|
+
emit('update:modelValue', Array.from(activeItems.value))
|
|
194
|
+
} else {
|
|
195
|
+
const first = activeItems.value.values().next().value
|
|
196
|
+
emit('update:modelValue', first ?? ('' as string | number))
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// Computed classes
|
|
201
|
+
const accordionClasses = computed(() => {
|
|
202
|
+
const base = 'w-full'
|
|
203
|
+
|
|
204
|
+
const typeClasses = {
|
|
205
|
+
default: '',
|
|
206
|
+
bordered: 'border border-border rounded-xl overflow-hidden',
|
|
207
|
+
separated: 'space-y-3',
|
|
208
|
+
card: 'space-y-3',
|
|
209
|
+
minimal: ''
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return `${base} ${typeClasses[props.type]} ${props.accordionClass}`
|
|
213
|
+
})
|
|
214
|
+
|
|
215
|
+
// Provide context
|
|
216
|
+
provide(SAccordionContextKey, {
|
|
217
|
+
activeItems,
|
|
218
|
+
type: props.type,
|
|
219
|
+
size: props.size,
|
|
220
|
+
multiple: props.multiple,
|
|
221
|
+
collapsible: props.collapsible,
|
|
222
|
+
iconPlacement: props.iconPlacement,
|
|
223
|
+
iconRotation: props.iconRotation,
|
|
224
|
+
animated: props.animated,
|
|
225
|
+
divider: props.divider,
|
|
226
|
+
dense: props.dense,
|
|
227
|
+
color: props.color,
|
|
228
|
+
registerItem,
|
|
229
|
+
unregisterItem,
|
|
230
|
+
toggleItem,
|
|
231
|
+
isExpanded
|
|
232
|
+
})
|
|
233
|
+
</script>
|
|
234
|
+
|
|
235
|
+
<template>
|
|
236
|
+
<div
|
|
237
|
+
v-bind="$attrs"
|
|
238
|
+
:class="cn(accordionClasses, $attrs.class ?? '')"
|
|
239
|
+
role="region"
|
|
240
|
+
aria-label="Accordion"
|
|
241
|
+
>
|
|
242
|
+
<slot />
|
|
243
|
+
</div>
|
|
244
|
+
</template>
|
|
245
|
+
|
|
246
|
+
<style scoped>
|
|
247
|
+
/* Base accordion styles */
|
|
248
|
+
</style>
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
defineOptions({ inheritAttrs: false })
|
|
3
|
+
|
|
4
|
+
import { inject, ref, computed, onMounted, onBeforeUnmount, watch, nextTick, provide, useSlots } from 'vue'
|
|
5
|
+
import { cn } from '../../../lib/utils'
|
|
6
|
+
import { SAccordionContextKey, SAccordionItemContextKey, type SAccordionContext } from './SAccordion.vue'
|
|
7
|
+
|
|
8
|
+
export interface Props {
|
|
9
|
+
/** Unique identifier for this item */
|
|
10
|
+
name: string | number
|
|
11
|
+
/** Header title text */
|
|
12
|
+
title?: string
|
|
13
|
+
/** Optional subtitle text */
|
|
14
|
+
subtitle?: string
|
|
15
|
+
/** MDI icon name for header */
|
|
16
|
+
icon?: string
|
|
17
|
+
/** Custom expand icon (MDI icon name, replaces default chevron) */
|
|
18
|
+
expandIcon?: string
|
|
19
|
+
/** Disable this item */
|
|
20
|
+
disabled?: boolean
|
|
21
|
+
/** Lazy render content */
|
|
22
|
+
lazy?: boolean
|
|
23
|
+
/** Custom header classes */
|
|
24
|
+
headerClass?: string
|
|
25
|
+
/** Custom content classes */
|
|
26
|
+
contentClass?: string
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
30
|
+
title: undefined,
|
|
31
|
+
subtitle: undefined,
|
|
32
|
+
icon: undefined,
|
|
33
|
+
expandIcon: undefined,
|
|
34
|
+
disabled: false,
|
|
35
|
+
lazy: false,
|
|
36
|
+
headerClass: '',
|
|
37
|
+
contentClass: ''
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
const emit = defineEmits<{
|
|
41
|
+
'toggle': [expanded: boolean]
|
|
42
|
+
}>()
|
|
43
|
+
|
|
44
|
+
const slots = useSlots()
|
|
45
|
+
|
|
46
|
+
// Inject context
|
|
47
|
+
const context = inject<SAccordionContext>(SAccordionContextKey)
|
|
48
|
+
|
|
49
|
+
if (!context) {
|
|
50
|
+
console.warn('[SAccordionItem] Must be used inside SAccordion')
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Refs
|
|
54
|
+
const contentRef = ref<HTMLElement | null>(null)
|
|
55
|
+
const contentHeight = ref(0)
|
|
56
|
+
const hasBeenExpanded = ref(false)
|
|
57
|
+
|
|
58
|
+
// Computed
|
|
59
|
+
const isExpanded = computed(() => context?.isExpanded(props.name) ?? false)
|
|
60
|
+
const disabledRef = computed(() => props.disabled)
|
|
61
|
+
const shouldRender = computed(() => {
|
|
62
|
+
if (!props.lazy) return true
|
|
63
|
+
return hasBeenExpanded.value
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
// Watch expansion state for lazy loading
|
|
67
|
+
watch(isExpanded, (expanded) => {
|
|
68
|
+
if (expanded) {
|
|
69
|
+
hasBeenExpanded.value = true
|
|
70
|
+
}
|
|
71
|
+
emit('toggle', expanded)
|
|
72
|
+
nextTick(() => updateContentHeight())
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
// Update content height for animation
|
|
76
|
+
const updateContentHeight = () => {
|
|
77
|
+
if (contentRef.value) {
|
|
78
|
+
contentHeight.value = contentRef.value.scrollHeight
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Register/unregister with parent
|
|
83
|
+
onMounted(() => {
|
|
84
|
+
context?.registerItem({ name: props.name, disabled: props.disabled })
|
|
85
|
+
updateContentHeight()
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
onBeforeUnmount(() => {
|
|
89
|
+
context?.unregisterItem(props.name)
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
// Toggle handler
|
|
93
|
+
const toggle = () => {
|
|
94
|
+
if (props.disabled) return
|
|
95
|
+
context?.toggleItem(props.name)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Keyboard handler
|
|
99
|
+
const handleKeydown = (e: KeyboardEvent) => {
|
|
100
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
101
|
+
e.preventDefault()
|
|
102
|
+
toggle()
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Size configurations
|
|
107
|
+
const sizeConfig = computed(() => {
|
|
108
|
+
const isDense = context?.dense ?? false
|
|
109
|
+
|
|
110
|
+
const sizes = {
|
|
111
|
+
small: {
|
|
112
|
+
header: isDense ? 'py-1 px-2' : 'py-1 px-2',
|
|
113
|
+
title: isDense ? 'text-xs' : 'text-sm',
|
|
114
|
+
subtitle: 'text-[10px]',
|
|
115
|
+
icon: 'text-sm',
|
|
116
|
+
content: isDense ? 'px-2 pt-1 pb-2 text-xs' : 'px-2 pt-1 pb-2 text-sm',
|
|
117
|
+
expandIcon: 'text-base'
|
|
118
|
+
},
|
|
119
|
+
medium: {
|
|
120
|
+
header: isDense ? 'py-1 px-2' : 'py-1 px-3',
|
|
121
|
+
title: isDense ? 'text-sm' : 'text-base',
|
|
122
|
+
subtitle: isDense ? 'text-xs' : 'text-sm',
|
|
123
|
+
icon: 'text-base',
|
|
124
|
+
content: isDense ? 'px-2 pt-1 pb-2 text-sm' : 'px-2.5 pt-1.5 pb-2.5',
|
|
125
|
+
expandIcon: isDense ? 'text-lg' : 'text-xl'
|
|
126
|
+
},
|
|
127
|
+
large: {
|
|
128
|
+
header: isDense ? 'py-1 px-2.5' : 'py-1 px-2.5',
|
|
129
|
+
title: isDense ? 'text-base' : 'text-lg',
|
|
130
|
+
subtitle: isDense ? 'text-sm' : 'text-sm',
|
|
131
|
+
icon: 'text-lg',
|
|
132
|
+
content: isDense ? 'px-2.5 pt-1.5 pb-2.5' : 'px-3 pt-2 pb-3',
|
|
133
|
+
expandIcon: isDense ? 'text-xl' : 'text-2xl'
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return sizes[context?.size ?? 'medium']
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
// Type-based classes
|
|
140
|
+
const itemClasses = computed(() => {
|
|
141
|
+
const type = context?.type ?? 'default'
|
|
142
|
+
|
|
143
|
+
const typeClasses = {
|
|
144
|
+
default: '',
|
|
145
|
+
bordered: '',
|
|
146
|
+
separated: 'rounded-xl border border-border overflow-hidden',
|
|
147
|
+
card: 'rounded-xl bg-background border border-border shadow-sm overflow-hidden',
|
|
148
|
+
minimal: ''
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return typeClasses[type]
|
|
152
|
+
})
|
|
153
|
+
|
|
154
|
+
const headerClasses = computed(() => {
|
|
155
|
+
const type = context?.type ?? 'default'
|
|
156
|
+
const base = `
|
|
157
|
+
w-full flex items-center gap-3 cursor-pointer select-none
|
|
158
|
+
transition-all duration-300 ease-out
|
|
159
|
+
focus:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2
|
|
160
|
+
`
|
|
161
|
+
|
|
162
|
+
const typeStyles = {
|
|
163
|
+
default: 'hover:bg-accent',
|
|
164
|
+
bordered: 'hover:bg-accent',
|
|
165
|
+
separated: 'bg-background hover:bg-accent',
|
|
166
|
+
card: 'hover:bg-accent',
|
|
167
|
+
minimal: 'hover:text-primary'
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const disabledStyles = props.disabled
|
|
171
|
+
? 'opacity-50 cursor-not-allowed'
|
|
172
|
+
: ''
|
|
173
|
+
|
|
174
|
+
const expandedStyles = isExpanded.value && !props.disabled
|
|
175
|
+
? 'bg-accent/50'
|
|
176
|
+
: ''
|
|
177
|
+
|
|
178
|
+
return `${base} ${sizeConfig.value.header} ${typeStyles[type]} ${disabledStyles} ${expandedStyles} ${props.headerClass}`
|
|
179
|
+
})
|
|
180
|
+
|
|
181
|
+
const contentWrapperStyle = computed(() => {
|
|
182
|
+
if (!context?.animated) {
|
|
183
|
+
return isExpanded.value ? {} : { display: 'none' }
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
return {
|
|
187
|
+
maxHeight: isExpanded.value ? `${contentHeight.value}px` : '0px',
|
|
188
|
+
opacity: isExpanded.value ? '1' : '0',
|
|
189
|
+
overflow: 'hidden',
|
|
190
|
+
transition: 'max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease'
|
|
191
|
+
}
|
|
192
|
+
})
|
|
193
|
+
|
|
194
|
+
const expandIconStyle = computed(() => {
|
|
195
|
+
const rotation = isExpanded.value ? context?.iconRotation ?? 180 : 0
|
|
196
|
+
return {
|
|
197
|
+
transform: `rotate(${rotation}deg)`,
|
|
198
|
+
transition: 'transform 0.3s cubic-bezier(0.4, 0, 0.2, 1)',
|
|
199
|
+
color: isExpanded.value && !props.disabled ? context?.color : undefined
|
|
200
|
+
}
|
|
201
|
+
})
|
|
202
|
+
|
|
203
|
+
// Show divider
|
|
204
|
+
const showDivider = computed(() => {
|
|
205
|
+
if (!context?.divider) return false
|
|
206
|
+
const type = context?.type ?? 'default'
|
|
207
|
+
return type === 'default' || type === 'bordered'
|
|
208
|
+
})
|
|
209
|
+
|
|
210
|
+
// Flex direction for icon placement
|
|
211
|
+
const headerFlexClass = computed(() => {
|
|
212
|
+
return context?.iconPlacement === 'left' ? 'flex-row-reverse' : ''
|
|
213
|
+
})
|
|
214
|
+
|
|
215
|
+
// Detect compound usage: if default slot contains SAccordionTrigger/SAccordionContent
|
|
216
|
+
// we use compound mode (no built-in header/content rendering)
|
|
217
|
+
const isCompound = computed(() => {
|
|
218
|
+
// If title prop is not set and no header slot override, check for compound usage
|
|
219
|
+
// The heuristic: if there's no title and no #header slot, assume compound
|
|
220
|
+
if (props.title) return false
|
|
221
|
+
return true
|
|
222
|
+
})
|
|
223
|
+
|
|
224
|
+
// Provide item context for SAccordionTrigger and SAccordionContent
|
|
225
|
+
provide(SAccordionItemContextKey, {
|
|
226
|
+
isExpanded,
|
|
227
|
+
disabled: disabledRef,
|
|
228
|
+
toggle,
|
|
229
|
+
contentRef,
|
|
230
|
+
contentHeight,
|
|
231
|
+
updateContentHeight,
|
|
232
|
+
shouldRender,
|
|
233
|
+
contentWrapperStyle,
|
|
234
|
+
sizeConfig,
|
|
235
|
+
accordionContext: context
|
|
236
|
+
})
|
|
237
|
+
</script>
|
|
238
|
+
|
|
239
|
+
<template>
|
|
240
|
+
<div
|
|
241
|
+
v-bind="$attrs"
|
|
242
|
+
:class="cn('s-accordion-item', itemClasses, $attrs.class ?? '')"
|
|
243
|
+
>
|
|
244
|
+
<!-- Compound API: just render the slot, subcomponents handle their own rendering -->
|
|
245
|
+
<template v-if="isCompound && !title">
|
|
246
|
+
<slot :expanded="isExpanded" :toggle="toggle" :disabled="disabled" />
|
|
247
|
+
</template>
|
|
248
|
+
|
|
249
|
+
<!-- Simple API: built-in header + content -->
|
|
250
|
+
<template v-else>
|
|
251
|
+
<!-- Header -->
|
|
252
|
+
<button
|
|
253
|
+
type="button"
|
|
254
|
+
role="button"
|
|
255
|
+
:aria-expanded="isExpanded"
|
|
256
|
+
:aria-disabled="disabled"
|
|
257
|
+
:disabled="disabled"
|
|
258
|
+
:class="headerClasses"
|
|
259
|
+
:style="{ justifyContent: context?.iconPlacement === 'left' ? 'flex-start' : 'space-between' }"
|
|
260
|
+
@click="toggle"
|
|
261
|
+
@keydown="handleKeydown"
|
|
262
|
+
>
|
|
263
|
+
<div
|
|
264
|
+
class="flex items-center gap-3 flex-1 min-w-0"
|
|
265
|
+
:class="headerFlexClass"
|
|
266
|
+
>
|
|
267
|
+
<!-- Custom Header Slot -->
|
|
268
|
+
<slot
|
|
269
|
+
name="header"
|
|
270
|
+
:expanded="isExpanded"
|
|
271
|
+
:toggle="toggle"
|
|
272
|
+
:disabled="disabled"
|
|
273
|
+
>
|
|
274
|
+
<!-- Icon -->
|
|
275
|
+
<span
|
|
276
|
+
v-if="icon"
|
|
277
|
+
:class="['mdi', `mdi-${icon}`, sizeConfig.icon, 'shrink-0 text-muted-foreground']"
|
|
278
|
+
:style="isExpanded ? { color: context?.color } : {}"
|
|
279
|
+
/>
|
|
280
|
+
|
|
281
|
+
<!-- Title & Subtitle -->
|
|
282
|
+
<div class="flex flex-col items-start min-w-0 flex-1">
|
|
283
|
+
<slot name="title">
|
|
284
|
+
<span
|
|
285
|
+
:class="[sizeConfig.title, 'font-medium text-foreground truncate w-full text-left']"
|
|
286
|
+
>
|
|
287
|
+
{{ title }}
|
|
288
|
+
</span>
|
|
289
|
+
</slot>
|
|
290
|
+
<slot name="subtitle">
|
|
291
|
+
<span
|
|
292
|
+
v-if="subtitle"
|
|
293
|
+
:class="[sizeConfig.subtitle, 'text-muted-foreground truncate w-full text-left']"
|
|
294
|
+
>
|
|
295
|
+
{{ subtitle }}
|
|
296
|
+
</span>
|
|
297
|
+
</slot>
|
|
298
|
+
</div>
|
|
299
|
+
</slot>
|
|
300
|
+
|
|
301
|
+
<!-- Extra Slot -->
|
|
302
|
+
<slot name="extra" />
|
|
303
|
+
</div>
|
|
304
|
+
|
|
305
|
+
<!-- Expand Icon -->
|
|
306
|
+
<slot name="icon" :expanded="isExpanded">
|
|
307
|
+
<span
|
|
308
|
+
:class="['mdi shrink-0', `mdi-${expandIcon || 'chevron-down'}`, sizeConfig.expandIcon, 'text-muted-foreground']"
|
|
309
|
+
:style="expandIconStyle"
|
|
310
|
+
/>
|
|
311
|
+
</slot>
|
|
312
|
+
</button>
|
|
313
|
+
|
|
314
|
+
<!-- Divider -->
|
|
315
|
+
<div
|
|
316
|
+
v-if="showDivider && !isExpanded"
|
|
317
|
+
class="border-b border-border"
|
|
318
|
+
/>
|
|
319
|
+
|
|
320
|
+
<!-- Content -->
|
|
321
|
+
<div
|
|
322
|
+
ref="contentRef"
|
|
323
|
+
:style="contentWrapperStyle"
|
|
324
|
+
role="region"
|
|
325
|
+
:aria-hidden="!isExpanded"
|
|
326
|
+
>
|
|
327
|
+
<div
|
|
328
|
+
v-if="shouldRender"
|
|
329
|
+
:class="[sizeConfig.content, 'text-muted-foreground', contentClass]"
|
|
330
|
+
>
|
|
331
|
+
<slot />
|
|
332
|
+
</div>
|
|
333
|
+
</div>
|
|
334
|
+
|
|
335
|
+
<!-- Bottom Divider for expanded state -->
|
|
336
|
+
<div
|
|
337
|
+
v-if="showDivider && isExpanded"
|
|
338
|
+
class="border-b border-border"
|
|
339
|
+
/>
|
|
340
|
+
</template>
|
|
341
|
+
</div>
|
|
342
|
+
</template>
|
|
343
|
+
|
|
344
|
+
<style scoped>
|
|
345
|
+
.s-accordion-item {
|
|
346
|
+
background: transparent;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/* Active state highlight */
|
|
350
|
+
button:active:not(:disabled) {
|
|
351
|
+
transform: scale(0.995);
|
|
352
|
+
}
|
|
353
|
+
</style>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Re-export components for convenience
|
|
2
|
+
export { default as SAccordion } from './SAccordion.vue'
|
|
3
|
+
export { default as SAccordionItem } from './SAccordionItem.vue'
|
|
4
|
+
export { default as SAccordionTrigger } from './SAccordionTrigger.vue'
|
|
5
|
+
export { default as SAccordionContent } from './SAccordionContent.vue'
|