@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,467 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* STabs - Custom Tab Component
|
|
4
|
+
* Supports both simple (STabPane) and compound (STabsList + STabsTrigger + STabsContent) APIs
|
|
5
|
+
*/
|
|
6
|
+
import { type InjectionKey, type Ref } from 'vue'
|
|
7
|
+
|
|
8
|
+
// Types - exported for external use
|
|
9
|
+
export type TabType = 'line' | 'card' | 'segment' | 'bar' | 'chip'
|
|
10
|
+
export type TabSize = 'small' | 'medium' | 'large'
|
|
11
|
+
export type TabPlacement = 'top' | 'left' | 'right' | 'bottom'
|
|
12
|
+
export type TabJustify = 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly'
|
|
13
|
+
|
|
14
|
+
export interface TabPaneInfo {
|
|
15
|
+
name: string | number
|
|
16
|
+
tab: string
|
|
17
|
+
icon?: string
|
|
18
|
+
disabled?: boolean
|
|
19
|
+
closable?: boolean
|
|
20
|
+
tabClass?: string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface STabsContext {
|
|
24
|
+
activeTab: Ref<string | number>
|
|
25
|
+
type: TabType
|
|
26
|
+
size: TabSize
|
|
27
|
+
placement: TabPlacement
|
|
28
|
+
animated: boolean
|
|
29
|
+
closable: boolean
|
|
30
|
+
barColor: string
|
|
31
|
+
justifyContent: TabJustify
|
|
32
|
+
trigger: 'click' | 'hover'
|
|
33
|
+
registerPane: (pane: TabPaneInfo) => void
|
|
34
|
+
unregisterPane: (name: string | number) => void
|
|
35
|
+
setActiveTab: (name: string | number) => void
|
|
36
|
+
setListRef: (el: HTMLElement) => void
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const STabsContextKey: InjectionKey<STabsContext> = Symbol('STabsContext')
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<script setup lang="ts">
|
|
43
|
+
defineOptions({ inheritAttrs: false })
|
|
44
|
+
|
|
45
|
+
import { provide, ref, computed, watch, nextTick, onMounted, useSlots } from 'vue'
|
|
46
|
+
import { cn } from '../../../lib/utils'
|
|
47
|
+
|
|
48
|
+
// Props
|
|
49
|
+
export interface Props {
|
|
50
|
+
/** Active tab value (v-model) */
|
|
51
|
+
modelValue?: string | number
|
|
52
|
+
/** Tab style variant */
|
|
53
|
+
type?: TabType
|
|
54
|
+
/** Tab size */
|
|
55
|
+
size?: TabSize
|
|
56
|
+
/** Enable panel transition animations */
|
|
57
|
+
animated?: boolean
|
|
58
|
+
/** Tab position */
|
|
59
|
+
placement?: TabPlacement
|
|
60
|
+
/** Tab alignment */
|
|
61
|
+
justifyContent?: TabJustify
|
|
62
|
+
/** Show close button on tabs */
|
|
63
|
+
closable?: boolean
|
|
64
|
+
/** Additional classes for tabs */
|
|
65
|
+
tabClass?: string
|
|
66
|
+
/** Classes for active tab */
|
|
67
|
+
activeTabClass?: string
|
|
68
|
+
/** Classes for content panel */
|
|
69
|
+
panelClass?: string
|
|
70
|
+
/** Active indicator/chip color */
|
|
71
|
+
barColor?: string
|
|
72
|
+
/** Chip background color (for chip type) */
|
|
73
|
+
chipColor?: string
|
|
74
|
+
/** Active chip background color (for chip type) */
|
|
75
|
+
chipActiveColor?: string
|
|
76
|
+
/** Classes for tabs wrapper */
|
|
77
|
+
tabsWrapperClass?: string
|
|
78
|
+
/** Trigger mode for switching tabs */
|
|
79
|
+
trigger?: 'click' | 'hover'
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
83
|
+
modelValue: undefined,
|
|
84
|
+
type: 'line',
|
|
85
|
+
size: 'medium',
|
|
86
|
+
animated: false,
|
|
87
|
+
placement: 'top',
|
|
88
|
+
justifyContent: 'flex-start',
|
|
89
|
+
closable: false,
|
|
90
|
+
tabClass: '',
|
|
91
|
+
activeTabClass: '',
|
|
92
|
+
panelClass: '',
|
|
93
|
+
barColor: 'var(--s-primary)',
|
|
94
|
+
chipColor: 'var(--s-accent)',
|
|
95
|
+
chipActiveColor: 'var(--s-primary)',
|
|
96
|
+
tabsWrapperClass: '',
|
|
97
|
+
trigger: 'click'
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
// Events
|
|
101
|
+
const emit = defineEmits<{
|
|
102
|
+
(e: 'update:modelValue', value: string | number): void
|
|
103
|
+
(e: 'close', name: string | number): void
|
|
104
|
+
(e: 'before-leave', from: string | number, to: string | number): void
|
|
105
|
+
}>()
|
|
106
|
+
|
|
107
|
+
const slots = useSlots()
|
|
108
|
+
|
|
109
|
+
// State
|
|
110
|
+
const registeredPanes = ref<TabPaneInfo[]>([])
|
|
111
|
+
const internalActiveTab = ref<string | number>('')
|
|
112
|
+
|
|
113
|
+
// Refs for sliding indicator (simple API)
|
|
114
|
+
const tabsWrapperRef = ref<HTMLElement | null>(null)
|
|
115
|
+
const tabRefs = ref<Map<string | number, HTMLElement>>(new Map())
|
|
116
|
+
const indicatorStyle = ref<Record<string, string>>({
|
|
117
|
+
left: '0px',
|
|
118
|
+
width: '0px',
|
|
119
|
+
opacity: '0'
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
// Computed
|
|
123
|
+
const activeTab = computed({
|
|
124
|
+
get: () => props.modelValue ?? internalActiveTab.value,
|
|
125
|
+
set: (value) => {
|
|
126
|
+
internalActiveTab.value = value
|
|
127
|
+
emit('update:modelValue', value)
|
|
128
|
+
}
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
// Detect compound API: if registeredPanes stays empty, we're in compound mode
|
|
132
|
+
// (STabsTrigger/STabsContent don't register panes)
|
|
133
|
+
const isSimpleApi = computed(() => registeredPanes.value.length > 0)
|
|
134
|
+
|
|
135
|
+
// Update indicator position when active tab changes (simple API only)
|
|
136
|
+
const updateIndicator = async () => {
|
|
137
|
+
await nextTick()
|
|
138
|
+
|
|
139
|
+
const wrapper = tabsWrapperRef.value
|
|
140
|
+
const activeTabEl = tabRefs.value.get(activeTab.value)
|
|
141
|
+
|
|
142
|
+
if (!wrapper || !activeTabEl) {
|
|
143
|
+
indicatorStyle.value = { ...indicatorStyle.value, opacity: '0' }
|
|
144
|
+
return
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const wrapperRect = wrapper.getBoundingClientRect()
|
|
148
|
+
const tabRect = activeTabEl.getBoundingClientRect()
|
|
149
|
+
|
|
150
|
+
const isVertical = props.placement === 'left' || props.placement === 'right'
|
|
151
|
+
|
|
152
|
+
if (isVertical) {
|
|
153
|
+
indicatorStyle.value = {
|
|
154
|
+
top: `${tabRect.top - wrapperRect.top}px`,
|
|
155
|
+
height: `${tabRect.height}px`,
|
|
156
|
+
width: '2px',
|
|
157
|
+
opacity: '1'
|
|
158
|
+
}
|
|
159
|
+
} else {
|
|
160
|
+
indicatorStyle.value = {
|
|
161
|
+
left: `${tabRect.left - wrapperRect.left}px`,
|
|
162
|
+
width: `${tabRect.width}px`,
|
|
163
|
+
height: '2px',
|
|
164
|
+
opacity: '1'
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// Set tab ref (simple API)
|
|
170
|
+
const setTabRef = (name: string | number, el: HTMLElement | null) => {
|
|
171
|
+
if (el) {
|
|
172
|
+
tabRefs.value.set(name, el)
|
|
173
|
+
} else {
|
|
174
|
+
tabRefs.value.delete(name)
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// Allow STabsList to register its ref for compound API
|
|
179
|
+
const setListRef = (el: HTMLElement) => {
|
|
180
|
+
// Not needed for simple API indicator, but kept for potential future use
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// Watch for active tab changes and update indicator
|
|
184
|
+
watch(activeTab, () => {
|
|
185
|
+
if (isSimpleApi.value) updateIndicator()
|
|
186
|
+
})
|
|
187
|
+
|
|
188
|
+
// Watch for panes changes
|
|
189
|
+
watch(registeredPanes, () => {
|
|
190
|
+
nextTick(() => {
|
|
191
|
+
if (isSimpleApi.value) updateIndicator()
|
|
192
|
+
})
|
|
193
|
+
}, { deep: true })
|
|
194
|
+
|
|
195
|
+
// Set first tab as default when panes register
|
|
196
|
+
watch(registeredPanes, (panes) => {
|
|
197
|
+
if (panes.length > 0 && !activeTab.value) {
|
|
198
|
+
const firstEnabled = panes.find(p => !p.disabled)
|
|
199
|
+
if (firstEnabled) {
|
|
200
|
+
activeTab.value = firstEnabled.name
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}, { immediate: true })
|
|
204
|
+
|
|
205
|
+
// Initial indicator setup
|
|
206
|
+
onMounted(() => {
|
|
207
|
+
setTimeout(() => {
|
|
208
|
+
if (isSimpleApi.value) updateIndicator()
|
|
209
|
+
}, 50)
|
|
210
|
+
})
|
|
211
|
+
|
|
212
|
+
// Methods
|
|
213
|
+
const registerPane = (pane: TabPaneInfo) => {
|
|
214
|
+
if (!registeredPanes.value.find(p => p.name === pane.name)) {
|
|
215
|
+
registeredPanes.value.push(pane)
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const unregisterPane = (name: string | number) => {
|
|
220
|
+
const index = registeredPanes.value.findIndex(p => p.name === name)
|
|
221
|
+
if (index > -1) {
|
|
222
|
+
registeredPanes.value.splice(index, 1)
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const setActiveTab = (name: string | number) => {
|
|
227
|
+
// For simple API, check pane disabled state
|
|
228
|
+
const pane = registeredPanes.value.find(p => p.name === name)
|
|
229
|
+
if (pane?.disabled) return
|
|
230
|
+
|
|
231
|
+
emit('before-leave', activeTab.value, name)
|
|
232
|
+
activeTab.value = name
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
const handleMouseEnter = (name: string | number) => {
|
|
236
|
+
if (props.trigger === 'hover') {
|
|
237
|
+
setActiveTab(name)
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
const handleClose = (name: string | number, event: Event) => {
|
|
242
|
+
event.stopPropagation()
|
|
243
|
+
emit('close', name)
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// Size classes
|
|
247
|
+
const sizeClasses = computed(() => {
|
|
248
|
+
const sizes = {
|
|
249
|
+
small: 'text-xs px-2.5 py-1.5',
|
|
250
|
+
medium: 'text-sm px-4 py-2',
|
|
251
|
+
large: 'text-base px-5 py-2.5'
|
|
252
|
+
}
|
|
253
|
+
return sizes[props.size]
|
|
254
|
+
})
|
|
255
|
+
|
|
256
|
+
// Type-specific classes for tabs wrapper (simple API)
|
|
257
|
+
const wrapperClasses = computed(() => {
|
|
258
|
+
const base = 'relative flex transition-colors duration-300'
|
|
259
|
+
const placement = props.placement === 'left' || props.placement === 'right'
|
|
260
|
+
? 'flex-col'
|
|
261
|
+
: 'flex-row'
|
|
262
|
+
|
|
263
|
+
const typeClasses = {
|
|
264
|
+
line: 'gap-1',
|
|
265
|
+
card: 'gap-2',
|
|
266
|
+
segment: 'gap-0.5 bg-muted p-1 rounded-xl shadow-sm border border-border',
|
|
267
|
+
bar: 'gap-1',
|
|
268
|
+
chip: 'gap-2 flex-wrap'
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
return `${base} ${placement} ${typeClasses[props.type]} ${props.tabsWrapperClass}`
|
|
272
|
+
})
|
|
273
|
+
|
|
274
|
+
// Container layout based on placement
|
|
275
|
+
const containerClasses = computed(() => {
|
|
276
|
+
if (props.placement === 'left') return 'flex flex-row gap-4'
|
|
277
|
+
if (props.placement === 'right') return 'flex flex-row-reverse gap-4'
|
|
278
|
+
if (props.placement === 'bottom') return 'flex flex-col-reverse gap-3'
|
|
279
|
+
return 'flex flex-col gap-3'
|
|
280
|
+
})
|
|
281
|
+
|
|
282
|
+
// Tab button classes (simple API)
|
|
283
|
+
const getTabClasses = (pane: TabPaneInfo) => {
|
|
284
|
+
const isActive = activeTab.value === pane.name
|
|
285
|
+
const isDisabled = pane.disabled
|
|
286
|
+
|
|
287
|
+
const base = `
|
|
288
|
+
relative cursor-pointer
|
|
289
|
+
flex items-center gap-2 whitespace-nowrap
|
|
290
|
+
transition-all duration-300 ease-out
|
|
291
|
+
${sizeClasses.value}
|
|
292
|
+
${props.tabClass}
|
|
293
|
+
${pane.tabClass || ''}
|
|
294
|
+
`
|
|
295
|
+
|
|
296
|
+
const disabledClass = isDisabled
|
|
297
|
+
? 'opacity-40 cursor-not-allowed'
|
|
298
|
+
: ''
|
|
299
|
+
|
|
300
|
+
const typeStyles = {
|
|
301
|
+
line: isActive
|
|
302
|
+
? `text-foreground font-medium ${props.activeTabClass}`
|
|
303
|
+
: 'text-muted-foreground hover:text-foreground',
|
|
304
|
+
card: isActive
|
|
305
|
+
? `bg-muted text-foreground rounded-xl border border-border shadow-md ${props.activeTabClass}`
|
|
306
|
+
: 'text-muted-foreground border border-transparent hover:border-border rounded-xl hover:bg-accent',
|
|
307
|
+
segment: isActive
|
|
308
|
+
? `bg-background text-foreground rounded-lg shadow-sm font-medium ${props.activeTabClass}`
|
|
309
|
+
: 'text-muted-foreground rounded-lg hover:text-foreground',
|
|
310
|
+
bar: isActive
|
|
311
|
+
? `text-foreground font-medium ${props.activeTabClass}`
|
|
312
|
+
: 'text-muted-foreground hover:text-foreground',
|
|
313
|
+
chip: isActive
|
|
314
|
+
? `text-background font-medium rounded-full shadow-md ${props.activeTabClass}`
|
|
315
|
+
: 'text-muted-foreground rounded-full hover:text-foreground'
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
return `${base} ${disabledClass} ${typeStyles[props.type]}`
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
// Get chip background style (simple API)
|
|
322
|
+
const getChipStyle = (pane: TabPaneInfo) => {
|
|
323
|
+
if (props.type !== 'chip') return {}
|
|
324
|
+
|
|
325
|
+
const isActive = activeTab.value === pane.name
|
|
326
|
+
return {
|
|
327
|
+
backgroundColor: isActive ? props.chipActiveColor : props.chipColor,
|
|
328
|
+
transition: 'all 0.3s cubic-bezier(0.4, 0, 0.2, 1)'
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// Sliding indicator position and style (simple API)
|
|
333
|
+
const slidingIndicatorStyle = computed(() => {
|
|
334
|
+
const isVertical = props.placement === 'left' || props.placement === 'right'
|
|
335
|
+
|
|
336
|
+
if (isVertical) {
|
|
337
|
+
return {
|
|
338
|
+
...indicatorStyle.value,
|
|
339
|
+
backgroundColor: props.barColor,
|
|
340
|
+
borderRadius: '2px',
|
|
341
|
+
position: 'absolute' as const,
|
|
342
|
+
[props.placement === 'left' ? 'right' : 'left']: '0',
|
|
343
|
+
transition: 'all 0.35s cubic-bezier(0.4, 0, 0.2, 1)'
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
return {
|
|
348
|
+
...indicatorStyle.value,
|
|
349
|
+
backgroundColor: props.barColor,
|
|
350
|
+
borderRadius: '2px',
|
|
351
|
+
position: 'absolute' as const,
|
|
352
|
+
bottom: '0',
|
|
353
|
+
transition: 'all 0.35s cubic-bezier(0.4, 0, 0.2, 1)'
|
|
354
|
+
}
|
|
355
|
+
})
|
|
356
|
+
|
|
357
|
+
// Check if sliding indicator should be shown (simple API)
|
|
358
|
+
const showSlidingIndicator = computed(() => {
|
|
359
|
+
return props.type === 'line' || props.type === 'bar'
|
|
360
|
+
})
|
|
361
|
+
|
|
362
|
+
// Provide context to all children
|
|
363
|
+
provide(STabsContextKey, {
|
|
364
|
+
activeTab: activeTab as Ref<string | number>,
|
|
365
|
+
type: props.type,
|
|
366
|
+
size: props.size,
|
|
367
|
+
placement: props.placement,
|
|
368
|
+
animated: props.animated,
|
|
369
|
+
closable: props.closable,
|
|
370
|
+
barColor: props.barColor,
|
|
371
|
+
justifyContent: props.justifyContent,
|
|
372
|
+
trigger: props.trigger,
|
|
373
|
+
registerPane,
|
|
374
|
+
unregisterPane,
|
|
375
|
+
setActiveTab,
|
|
376
|
+
setListRef
|
|
377
|
+
})
|
|
378
|
+
</script>
|
|
379
|
+
|
|
380
|
+
<template>
|
|
381
|
+
<div v-bind="$attrs" :class="cn(containerClasses, $attrs.class ?? '')">
|
|
382
|
+
<!-- Simple API: auto-render tabs from registered panes -->
|
|
383
|
+
<template v-if="isSimpleApi">
|
|
384
|
+
<div
|
|
385
|
+
ref="tabsWrapperRef"
|
|
386
|
+
:class="wrapperClasses"
|
|
387
|
+
:style="{ justifyContent: justifyContent }"
|
|
388
|
+
role="tablist"
|
|
389
|
+
>
|
|
390
|
+
<!-- Sliding indicator (for line and bar types) -->
|
|
391
|
+
<span
|
|
392
|
+
v-if="showSlidingIndicator"
|
|
393
|
+
class="s-tab-sliding-indicator"
|
|
394
|
+
:style="slidingIndicatorStyle"
|
|
395
|
+
/>
|
|
396
|
+
|
|
397
|
+
<button
|
|
398
|
+
v-for="pane in registeredPanes"
|
|
399
|
+
:key="pane.name"
|
|
400
|
+
:ref="(el) => setTabRef(pane.name, el as HTMLElement)"
|
|
401
|
+
:class="getTabClasses(pane)"
|
|
402
|
+
:style="getChipStyle(pane)"
|
|
403
|
+
:disabled="pane.disabled"
|
|
404
|
+
:aria-selected="activeTab === pane.name"
|
|
405
|
+
:aria-disabled="pane.disabled"
|
|
406
|
+
role="tab"
|
|
407
|
+
@click="setActiveTab(pane.name)"
|
|
408
|
+
@mouseenter="handleMouseEnter(pane.name)"
|
|
409
|
+
>
|
|
410
|
+
<!-- Custom tab template slot -->
|
|
411
|
+
<slot
|
|
412
|
+
name="tab"
|
|
413
|
+
:pane="pane"
|
|
414
|
+
:active="activeTab === pane.name"
|
|
415
|
+
:disabled="pane.disabled"
|
|
416
|
+
:close="() => emit('close', pane.name)"
|
|
417
|
+
>
|
|
418
|
+
<!-- Icon -->
|
|
419
|
+
<span
|
|
420
|
+
v-if="pane.icon"
|
|
421
|
+
class="mdi transition-transform duration-300"
|
|
422
|
+
:class="[`mdi-${pane.icon}`, { 'scale-110': activeTab === pane.name }]"
|
|
423
|
+
/>
|
|
424
|
+
|
|
425
|
+
<!-- Label -->
|
|
426
|
+
<span>{{ pane.tab }}</span>
|
|
427
|
+
|
|
428
|
+
<!-- Close button -->
|
|
429
|
+
<span
|
|
430
|
+
v-if="(closable || pane.closable) && !pane.disabled"
|
|
431
|
+
class="ml-1 hover:bg-black/10 dark:hover:bg-white/10 rounded-full p-1 transition-all duration-200 hover:scale-110"
|
|
432
|
+
@click="handleClose(pane.name, $event)"
|
|
433
|
+
>
|
|
434
|
+
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
435
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
|
|
436
|
+
</svg>
|
|
437
|
+
</span>
|
|
438
|
+
</slot>
|
|
439
|
+
</button>
|
|
440
|
+
</div>
|
|
441
|
+
|
|
442
|
+
<!-- Panels (simple API - STabPane children render here) -->
|
|
443
|
+
<div :class="['flex-1 relative overflow-hidden', panelClass]" role="tabpanel">
|
|
444
|
+
<slot />
|
|
445
|
+
</div>
|
|
446
|
+
</template>
|
|
447
|
+
|
|
448
|
+
<!-- Compound API: everything in default slot (STabsList, STabsContent, etc.) -->
|
|
449
|
+
<template v-else>
|
|
450
|
+
<slot />
|
|
451
|
+
</template>
|
|
452
|
+
</div>
|
|
453
|
+
</template>
|
|
454
|
+
|
|
455
|
+
<style scoped>
|
|
456
|
+
/* Sliding indicator base styles */
|
|
457
|
+
.s-tab-sliding-indicator {
|
|
458
|
+
pointer-events: none;
|
|
459
|
+
z-index: 1;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
/* Focus styles */
|
|
463
|
+
button:focus-visible {
|
|
464
|
+
outline: 2px solid rgba(99, 226, 183, 0.5);
|
|
465
|
+
outline-offset: 2px;
|
|
466
|
+
}
|
|
467
|
+
</style>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Re-export components for convenience
|
|
2
|
+
export { default as STabs } from './STabs.vue'
|
|
3
|
+
export { default as STabPane } from './STabPane.vue'
|
|
4
|
+
export { default as STabsList } from './STabsList.vue'
|
|
5
|
+
export { default as STabsTrigger } from './STabsTrigger.vue'
|
|
6
|
+
export { default as STabsContent } from './STabsContent.vue'
|
|
7
|
+
export { default as STabsIndicator } from './STabsIndicator.vue'
|