@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,70 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* STableBody - Table body wrapper with animation support
|
|
4
|
+
*/
|
|
5
|
+
import { inject, computed } from 'vue'
|
|
6
|
+
import { SDataTableContextKey } from './index'
|
|
7
|
+
|
|
8
|
+
interface Props {
|
|
9
|
+
/** Enable row animations */
|
|
10
|
+
animate?: boolean
|
|
11
|
+
/** Custom class for tbody */
|
|
12
|
+
bodyClass?: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
16
|
+
animate: undefined,
|
|
17
|
+
bodyClass: ''
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
defineOptions({ inheritAttrs: false })
|
|
21
|
+
|
|
22
|
+
const context = inject(SDataTableContextKey)
|
|
23
|
+
|
|
24
|
+
const shouldAnimate = computed(() => {
|
|
25
|
+
if (props.animate !== undefined) return props.animate
|
|
26
|
+
return context?.animateRows ?? true
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
const prefersReducedMotion = typeof window !== 'undefined'
|
|
30
|
+
? window.matchMedia('(prefers-reduced-motion: reduce)').matches
|
|
31
|
+
: false
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<template>
|
|
35
|
+
<TransitionGroup
|
|
36
|
+
v-if="shouldAnimate && !prefersReducedMotion"
|
|
37
|
+
v-bind="$attrs"
|
|
38
|
+
name="s-table-row"
|
|
39
|
+
tag="tbody"
|
|
40
|
+
:class="['s-table-body', bodyClass]"
|
|
41
|
+
>
|
|
42
|
+
<slot />
|
|
43
|
+
</TransitionGroup>
|
|
44
|
+
|
|
45
|
+
<tbody v-else v-bind="$attrs" :class="['s-table-body', bodyClass]">
|
|
46
|
+
<slot />
|
|
47
|
+
</tbody>
|
|
48
|
+
</template>
|
|
49
|
+
|
|
50
|
+
<style scoped>
|
|
51
|
+
/* Row Animation */
|
|
52
|
+
.s-table-row-enter-active,
|
|
53
|
+
.s-table-row-leave-active {
|
|
54
|
+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.s-table-row-enter-from {
|
|
58
|
+
opacity: 0;
|
|
59
|
+
transform: translateY(-10px);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.s-table-row-leave-to {
|
|
63
|
+
opacity: 0;
|
|
64
|
+
transform: translateX(-20px);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.s-table-row-move {
|
|
68
|
+
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
69
|
+
}
|
|
70
|
+
</style>
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* STableCell - Table cell component
|
|
4
|
+
*/
|
|
5
|
+
import { inject, computed } from 'vue'
|
|
6
|
+
import { cn } from '../../../lib/utils'
|
|
7
|
+
import { SDataTableContextKey, type ColumnAlign } from './index'
|
|
8
|
+
|
|
9
|
+
interface Props {
|
|
10
|
+
/** Cell alignment */
|
|
11
|
+
align?: ColumnAlign
|
|
12
|
+
/** Custom cell class */
|
|
13
|
+
cellClass?: string
|
|
14
|
+
/** Column key (for accessing column config) */
|
|
15
|
+
columnKey?: string
|
|
16
|
+
/** Whether this is a header cell */
|
|
17
|
+
header?: boolean
|
|
18
|
+
/** Colspan */
|
|
19
|
+
colspan?: number
|
|
20
|
+
/** Rowspan */
|
|
21
|
+
rowspan?: number
|
|
22
|
+
/** Cell width */
|
|
23
|
+
width?: string
|
|
24
|
+
/** Min width */
|
|
25
|
+
minWidth?: string
|
|
26
|
+
/** Max width */
|
|
27
|
+
maxWidth?: string
|
|
28
|
+
/** Sticky position */
|
|
29
|
+
sticky?: 'left' | 'right'
|
|
30
|
+
/** Truncate overflow text */
|
|
31
|
+
truncate?: boolean
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
35
|
+
align: 'left',
|
|
36
|
+
cellClass: '',
|
|
37
|
+
columnKey: undefined,
|
|
38
|
+
header: false,
|
|
39
|
+
colspan: undefined,
|
|
40
|
+
rowspan: undefined,
|
|
41
|
+
width: undefined,
|
|
42
|
+
minWidth: undefined,
|
|
43
|
+
maxWidth: undefined,
|
|
44
|
+
sticky: undefined,
|
|
45
|
+
truncate: false
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
defineOptions({ inheritAttrs: false })
|
|
49
|
+
|
|
50
|
+
const context = inject(SDataTableContextKey)
|
|
51
|
+
|
|
52
|
+
// Get size from context
|
|
53
|
+
const sizeClass = computed(() => {
|
|
54
|
+
const sizes = {
|
|
55
|
+
sm: 's-table-cell-sm',
|
|
56
|
+
md: 's-table-cell-md',
|
|
57
|
+
lg: 's-table-cell-lg'
|
|
58
|
+
}
|
|
59
|
+
return context ? sizes[context.size] : sizes.md
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
const cellClasses = computed(() => {
|
|
63
|
+
return [
|
|
64
|
+
props.header ? 's-table-th' : 's-table-td',
|
|
65
|
+
sizeClass.value,
|
|
66
|
+
props.cellClass,
|
|
67
|
+
{
|
|
68
|
+
'text-left': props.align === 'left',
|
|
69
|
+
'text-center': props.align === 'center',
|
|
70
|
+
'text-right': props.align === 'right',
|
|
71
|
+
'sticky left-0 bg-background z-5': props.sticky === 'left',
|
|
72
|
+
'sticky right-0 bg-background z-5': props.sticky === 'right',
|
|
73
|
+
'truncate': props.truncate
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
const cellStyles = computed(() => {
|
|
79
|
+
const styles: Record<string, string> = {}
|
|
80
|
+
if (props.width) styles.width = props.width
|
|
81
|
+
if (props.minWidth) styles.minWidth = props.minWidth
|
|
82
|
+
if (props.maxWidth) styles.maxWidth = props.maxWidth
|
|
83
|
+
return styles
|
|
84
|
+
})
|
|
85
|
+
</script>
|
|
86
|
+
|
|
87
|
+
<template>
|
|
88
|
+
<th
|
|
89
|
+
v-if="header"
|
|
90
|
+
v-bind="$attrs"
|
|
91
|
+
:class="cn(cellClasses, $attrs.class ?? '')"
|
|
92
|
+
:style="cellStyles"
|
|
93
|
+
:colspan="colspan"
|
|
94
|
+
:rowspan="rowspan"
|
|
95
|
+
scope="col"
|
|
96
|
+
>
|
|
97
|
+
<slot />
|
|
98
|
+
</th>
|
|
99
|
+
<td
|
|
100
|
+
v-else
|
|
101
|
+
v-bind="$attrs"
|
|
102
|
+
:class="cn(cellClasses, $attrs.class ?? '')"
|
|
103
|
+
:style="cellStyles"
|
|
104
|
+
:colspan="colspan"
|
|
105
|
+
:rowspan="rowspan"
|
|
106
|
+
>
|
|
107
|
+
<slot />
|
|
108
|
+
</td>
|
|
109
|
+
</template>
|
|
110
|
+
|
|
111
|
+
<style scoped>
|
|
112
|
+
.s-table-th,
|
|
113
|
+
.s-table-td {
|
|
114
|
+
color: var(--s-foreground);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.s-table-th {
|
|
118
|
+
font-weight: 600;
|
|
119
|
+
font-size: 0.75rem;
|
|
120
|
+
text-transform: uppercase;
|
|
121
|
+
letter-spacing: 0.05em;
|
|
122
|
+
color: var(--s-muted-foreground);
|
|
123
|
+
white-space: nowrap;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/* Size variants */
|
|
127
|
+
.s-table-cell-sm {
|
|
128
|
+
padding: 0.5rem 0.75rem;
|
|
129
|
+
font-size: 0.8125rem;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.s-table-cell-md {
|
|
133
|
+
padding: 0.75rem 1rem;
|
|
134
|
+
font-size: 0.875rem;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.s-table-cell-lg {
|
|
138
|
+
padding: 1rem 1.25rem;
|
|
139
|
+
font-size: 0.9375rem;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.truncate {
|
|
143
|
+
overflow: hidden;
|
|
144
|
+
text-overflow: ellipsis;
|
|
145
|
+
white-space: nowrap;
|
|
146
|
+
}
|
|
147
|
+
</style>
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* STableColumn - Declarative column definition component
|
|
4
|
+
*
|
|
5
|
+
* Use this component to define columns declaratively:
|
|
6
|
+
* <SDataTable :data="data">
|
|
7
|
+
* <STableColumn key="name" label="Name" sortable />
|
|
8
|
+
* <STableColumn key="email" label="Email" />
|
|
9
|
+
* </SDataTable>
|
|
10
|
+
*/
|
|
11
|
+
import { inject, onMounted, onUnmounted, watch } from 'vue'
|
|
12
|
+
import { SDataTableContextKey, type TableColumn, type ColumnAlign, type SortDirection } from './index'
|
|
13
|
+
|
|
14
|
+
interface Props {
|
|
15
|
+
/** Unique column key (required) */
|
|
16
|
+
columnKey: string
|
|
17
|
+
/** Display label for header */
|
|
18
|
+
label?: string
|
|
19
|
+
/** Data accessor key */
|
|
20
|
+
accessor?: string
|
|
21
|
+
/** Column width */
|
|
22
|
+
width?: string
|
|
23
|
+
/** Minimum width */
|
|
24
|
+
minWidth?: string
|
|
25
|
+
/** Maximum width */
|
|
26
|
+
maxWidth?: string
|
|
27
|
+
/** Text alignment */
|
|
28
|
+
align?: ColumnAlign
|
|
29
|
+
/** Whether column is sortable */
|
|
30
|
+
sortable?: boolean
|
|
31
|
+
/** Whether column is visible */
|
|
32
|
+
visible?: boolean
|
|
33
|
+
/** Sticky position */
|
|
34
|
+
sticky?: 'left' | 'right'
|
|
35
|
+
/** Custom header class */
|
|
36
|
+
headerClass?: string
|
|
37
|
+
/** Custom cell class */
|
|
38
|
+
cellClass?: string
|
|
39
|
+
/** Render priority for responsive hiding */
|
|
40
|
+
priority?: number
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
44
|
+
label: undefined,
|
|
45
|
+
accessor: undefined,
|
|
46
|
+
width: undefined,
|
|
47
|
+
minWidth: undefined,
|
|
48
|
+
maxWidth: undefined,
|
|
49
|
+
align: 'left',
|
|
50
|
+
sortable: false,
|
|
51
|
+
visible: true,
|
|
52
|
+
sticky: undefined,
|
|
53
|
+
headerClass: '',
|
|
54
|
+
cellClass: '',
|
|
55
|
+
priority: 0
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
defineSlots<{
|
|
59
|
+
/** Header cell content */
|
|
60
|
+
header?: (props: { column: TableColumn; sortState: { column: string | null; direction: SortDirection } }) => unknown
|
|
61
|
+
/** Cell content */
|
|
62
|
+
default?: (props: { row: unknown; value: unknown; index: number }) => unknown
|
|
63
|
+
}>()
|
|
64
|
+
|
|
65
|
+
defineOptions({ inheritAttrs: false })
|
|
66
|
+
|
|
67
|
+
const context = inject(SDataTableContextKey)
|
|
68
|
+
|
|
69
|
+
// Build column definition
|
|
70
|
+
const buildColumn = (): TableColumn => ({
|
|
71
|
+
key: props.columnKey,
|
|
72
|
+
label: props.label,
|
|
73
|
+
accessor: props.accessor as keyof unknown | undefined,
|
|
74
|
+
width: props.width,
|
|
75
|
+
minWidth: props.minWidth,
|
|
76
|
+
maxWidth: props.maxWidth,
|
|
77
|
+
align: props.align,
|
|
78
|
+
sortable: props.sortable,
|
|
79
|
+
visible: props.visible,
|
|
80
|
+
sticky: props.sticky,
|
|
81
|
+
headerClass: props.headerClass,
|
|
82
|
+
cellClass: props.cellClass,
|
|
83
|
+
priority: props.priority
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
// Register column with parent
|
|
87
|
+
onMounted(() => {
|
|
88
|
+
if (context) {
|
|
89
|
+
const existingIdx = context.columns.value.findIndex(c => c.key === props.columnKey)
|
|
90
|
+
if (existingIdx === -1) {
|
|
91
|
+
context.columns.value.push(buildColumn())
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
// Watch for prop changes
|
|
97
|
+
watch(() => props, () => {
|
|
98
|
+
if (context) {
|
|
99
|
+
const idx = context.columns.value.findIndex(c => c.key === props.columnKey)
|
|
100
|
+
if (idx !== -1) {
|
|
101
|
+
context.columns.value[idx] = buildColumn()
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}, { deep: true })
|
|
105
|
+
|
|
106
|
+
// Unregister on unmount
|
|
107
|
+
onUnmounted(() => {
|
|
108
|
+
if (context) {
|
|
109
|
+
const idx = context.columns.value.findIndex(c => c.key === props.columnKey)
|
|
110
|
+
if (idx !== -1) {
|
|
111
|
+
context.columns.value.splice(idx, 1)
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
})
|
|
115
|
+
</script>
|
|
116
|
+
|
|
117
|
+
<template>
|
|
118
|
+
<!-- This is a renderless component - slots are used by SDataTable -->
|
|
119
|
+
<slot />
|
|
120
|
+
</template>
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* STableEmpty - Empty state component for tables
|
|
4
|
+
*
|
|
5
|
+
* Features:
|
|
6
|
+
* - Customizable icon and message
|
|
7
|
+
* - Action button slot
|
|
8
|
+
* - Multiple visual variants
|
|
9
|
+
*/
|
|
10
|
+
import { computed } from 'vue'
|
|
11
|
+
import { cn } from '../../../lib/utils'
|
|
12
|
+
|
|
13
|
+
interface Props {
|
|
14
|
+
/** Icon class (MDI icons) */
|
|
15
|
+
icon?: string
|
|
16
|
+
/** Primary message */
|
|
17
|
+
title?: string
|
|
18
|
+
/** Secondary description */
|
|
19
|
+
description?: string
|
|
20
|
+
/** Visual variant */
|
|
21
|
+
variant?: 'default' | 'minimal' | 'illustrated'
|
|
22
|
+
/** Icon size */
|
|
23
|
+
iconSize?: 'sm' | 'md' | 'lg' | 'xl'
|
|
24
|
+
/** Column span (for td colspan) */
|
|
25
|
+
colspan?: number
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
29
|
+
icon: 'mdi-table-off',
|
|
30
|
+
title: 'No data available',
|
|
31
|
+
description: '',
|
|
32
|
+
variant: 'default',
|
|
33
|
+
iconSize: 'lg',
|
|
34
|
+
colspan: 1
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
defineOptions({ inheritAttrs: false })
|
|
38
|
+
|
|
39
|
+
defineSlots<{
|
|
40
|
+
/** Custom icon */
|
|
41
|
+
icon?: () => unknown
|
|
42
|
+
/** Custom title */
|
|
43
|
+
title?: () => unknown
|
|
44
|
+
/** Custom description */
|
|
45
|
+
description?: () => unknown
|
|
46
|
+
/** Action button(s) */
|
|
47
|
+
action?: () => unknown
|
|
48
|
+
}>()
|
|
49
|
+
|
|
50
|
+
const iconSizeClasses = computed(() => {
|
|
51
|
+
const sizes = {
|
|
52
|
+
sm: 'text-2xl',
|
|
53
|
+
md: 'text-3xl',
|
|
54
|
+
lg: 'text-4xl',
|
|
55
|
+
xl: 'text-5xl'
|
|
56
|
+
}
|
|
57
|
+
return sizes[props.iconSize]
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
const containerClasses = computed(() => {
|
|
61
|
+
const base = 's-table-empty flex flex-col items-center justify-center py-12'
|
|
62
|
+
|
|
63
|
+
const variants = {
|
|
64
|
+
default: 'text-muted-foreground',
|
|
65
|
+
minimal: 'text-muted-foreground py-8',
|
|
66
|
+
illustrated: 'text-muted-foreground py-16'
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return `${base} ${variants[props.variant]}`
|
|
70
|
+
})
|
|
71
|
+
</script>
|
|
72
|
+
|
|
73
|
+
<template>
|
|
74
|
+
<tr v-bind="$attrs" :class="cn('s-table-empty-row', $attrs.class ?? '')">
|
|
75
|
+
<td :colspan="colspan" class="s-table-td p-0">
|
|
76
|
+
<div :class="containerClasses">
|
|
77
|
+
<!-- Icon -->
|
|
78
|
+
<slot name="icon">
|
|
79
|
+
<div
|
|
80
|
+
class="s-table-empty-icon mb-4 opacity-40"
|
|
81
|
+
:class="iconSizeClasses"
|
|
82
|
+
>
|
|
83
|
+
<span :class="['mdi', icon]" />
|
|
84
|
+
</div>
|
|
85
|
+
</slot>
|
|
86
|
+
|
|
87
|
+
<!-- Title -->
|
|
88
|
+
<slot name="title">
|
|
89
|
+
<h3
|
|
90
|
+
v-if="title"
|
|
91
|
+
class="s-table-empty-title text-base font-medium mb-1"
|
|
92
|
+
>
|
|
93
|
+
{{ title }}
|
|
94
|
+
</h3>
|
|
95
|
+
</slot>
|
|
96
|
+
|
|
97
|
+
<!-- Description -->
|
|
98
|
+
<slot name="description">
|
|
99
|
+
<p
|
|
100
|
+
v-if="description"
|
|
101
|
+
class="s-table-empty-description text-sm opacity-70 max-w-xs text-center"
|
|
102
|
+
>
|
|
103
|
+
{{ description }}
|
|
104
|
+
</p>
|
|
105
|
+
</slot>
|
|
106
|
+
|
|
107
|
+
<!-- Action slot -->
|
|
108
|
+
<div v-if="$slots.action" class="s-table-empty-action mt-4">
|
|
109
|
+
<slot name="action" />
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
</td>
|
|
113
|
+
</tr>
|
|
114
|
+
</template>
|
|
115
|
+
|
|
116
|
+
<style scoped>
|
|
117
|
+
.s-table-empty-row {
|
|
118
|
+
background: transparent;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.s-table-empty-row:hover {
|
|
122
|
+
background: transparent !important;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/* Illustrated variant decoration */
|
|
126
|
+
.s-table-empty-icon {
|
|
127
|
+
transition: transform 0.3s ease;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.s-table-empty:hover .s-table-empty-icon {
|
|
131
|
+
transform: scale(1.05);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* Subtle animation */
|
|
135
|
+
@keyframes empty-state-appear {
|
|
136
|
+
0% {
|
|
137
|
+
opacity: 0;
|
|
138
|
+
transform: translateY(10px);
|
|
139
|
+
}
|
|
140
|
+
100% {
|
|
141
|
+
opacity: 1;
|
|
142
|
+
transform: translateY(0);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.s-table-empty {
|
|
147
|
+
animation: empty-state-appear 0.4s ease-out;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
@media (prefers-reduced-motion: reduce) {
|
|
151
|
+
.s-table-empty {
|
|
152
|
+
animation: none;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.s-table-empty:hover .s-table-empty-icon {
|
|
156
|
+
transform: none;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
</style>
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* STableHeader - Standalone header component for custom table layouts
|
|
4
|
+
*/
|
|
5
|
+
import { inject, computed } from 'vue'
|
|
6
|
+
import { cn } from '../../../lib/utils'
|
|
7
|
+
import { SDataTableContextKey } from './index'
|
|
8
|
+
|
|
9
|
+
interface Props {
|
|
10
|
+
/** Custom class for thead */
|
|
11
|
+
headerClass?: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
15
|
+
headerClass: ''
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
defineOptions({ inheritAttrs: false })
|
|
19
|
+
|
|
20
|
+
const context = inject(SDataTableContextKey)
|
|
21
|
+
|
|
22
|
+
const headerClasses = computed(() => {
|
|
23
|
+
return [
|
|
24
|
+
's-table-head',
|
|
25
|
+
props.headerClass,
|
|
26
|
+
{
|
|
27
|
+
'sticky z-10': context?.stickyHeader,
|
|
28
|
+
'bg-muted': true
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
})
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<template>
|
|
35
|
+
<thead v-bind="$attrs" :class="cn(headerClasses, $attrs.class ?? '')">
|
|
36
|
+
<slot>
|
|
37
|
+
<tr v-if="context">
|
|
38
|
+
<th
|
|
39
|
+
v-for="column in context.visibleColumns.value"
|
|
40
|
+
:key="column.key"
|
|
41
|
+
class="s-table-th"
|
|
42
|
+
:class="[
|
|
43
|
+
column.headerClass,
|
|
44
|
+
{
|
|
45
|
+
's-table-th-sortable cursor-pointer select-none': column.sortable,
|
|
46
|
+
's-table-th-sorted': context.sortState.value.column === column.key,
|
|
47
|
+
'text-left': column.align === 'left' || !column.align,
|
|
48
|
+
'text-center': column.align === 'center',
|
|
49
|
+
'text-right': column.align === 'right'
|
|
50
|
+
}
|
|
51
|
+
]"
|
|
52
|
+
:style="{
|
|
53
|
+
width: column.width,
|
|
54
|
+
minWidth: column.minWidth,
|
|
55
|
+
maxWidth: column.maxWidth
|
|
56
|
+
}"
|
|
57
|
+
scope="col"
|
|
58
|
+
:aria-sort="
|
|
59
|
+
context.sortState.value.column === column.key
|
|
60
|
+
? (context.sortState.value.direction === 'asc' ? 'ascending' : 'descending')
|
|
61
|
+
: undefined
|
|
62
|
+
"
|
|
63
|
+
@click="column.sortable ? context.toggleSort(column.key) : undefined"
|
|
64
|
+
@keydown.enter="column.sortable ? context.toggleSort(column.key) : undefined"
|
|
65
|
+
@keydown.space.prevent="column.sortable ? context.toggleSort(column.key) : undefined"
|
|
66
|
+
:tabindex="column.sortable ? 0 : undefined"
|
|
67
|
+
>
|
|
68
|
+
<slot :name="`header-${column.key}`" :column="column">
|
|
69
|
+
<div
|
|
70
|
+
class="flex items-center gap-2"
|
|
71
|
+
:class="{
|
|
72
|
+
'justify-center': column.align === 'center',
|
|
73
|
+
'justify-end': column.align === 'right'
|
|
74
|
+
}"
|
|
75
|
+
>
|
|
76
|
+
<span>{{ column.label || column.key }}</span>
|
|
77
|
+
|
|
78
|
+
<!-- Sort indicator -->
|
|
79
|
+
<span
|
|
80
|
+
v-if="column.sortable"
|
|
81
|
+
class="s-table-sort-icon inline-flex flex-col text-xs leading-none opacity-40 transition-opacity"
|
|
82
|
+
:class="{ 'opacity-100': context.sortState.value.column === column.key }"
|
|
83
|
+
>
|
|
84
|
+
<span
|
|
85
|
+
class="mdi mdi-chevron-up transition-transform -mb-1.5"
|
|
86
|
+
:class="{
|
|
87
|
+
'text-primary': context.sortState.value.column === column.key && context.sortState.value.direction === 'asc'
|
|
88
|
+
}"
|
|
89
|
+
/>
|
|
90
|
+
<span
|
|
91
|
+
class="mdi mdi-chevron-down transition-transform"
|
|
92
|
+
:class="{
|
|
93
|
+
'text-primary': context.sortState.value.column === column.key && context.sortState.value.direction === 'desc'
|
|
94
|
+
}"
|
|
95
|
+
/>
|
|
96
|
+
</span>
|
|
97
|
+
</div>
|
|
98
|
+
</slot>
|
|
99
|
+
</th>
|
|
100
|
+
</tr>
|
|
101
|
+
</slot>
|
|
102
|
+
</thead>
|
|
103
|
+
</template>
|
|
104
|
+
|
|
105
|
+
<style scoped>
|
|
106
|
+
.s-table-head {
|
|
107
|
+
background-color: var(--s-muted);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.s-table-th {
|
|
111
|
+
padding: 0.75rem 1rem;
|
|
112
|
+
font-weight: 600;
|
|
113
|
+
font-size: 0.75rem;
|
|
114
|
+
text-transform: uppercase;
|
|
115
|
+
letter-spacing: 0.05em;
|
|
116
|
+
color: var(--s-muted-foreground);
|
|
117
|
+
white-space: nowrap;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.s-table-th-sortable {
|
|
121
|
+
transition: background-color 0.15s ease;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.s-table-th-sortable:hover {
|
|
125
|
+
background-color: var(--s-accent);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.s-table-th-sortable:focus-visible {
|
|
129
|
+
outline: 2px solid var(--s-primary);
|
|
130
|
+
outline-offset: -2px;
|
|
131
|
+
}
|
|
132
|
+
</style>
|