@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,106 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* STableRow - Table row component with selection and expansion support
|
|
4
|
+
*/
|
|
5
|
+
import { inject, computed } from 'vue'
|
|
6
|
+
import { cn } from '../../../lib/utils'
|
|
7
|
+
import { SDataTableContextKey } from './index'
|
|
8
|
+
|
|
9
|
+
interface Props {
|
|
10
|
+
/** Unique row key */
|
|
11
|
+
rowKey?: string | number
|
|
12
|
+
/** Override hoverable state */
|
|
13
|
+
hoverable?: boolean
|
|
14
|
+
/** Custom row class */
|
|
15
|
+
rowClass?: string
|
|
16
|
+
/** Striped index (for striped variant) */
|
|
17
|
+
index?: number
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
21
|
+
rowKey: undefined,
|
|
22
|
+
hoverable: undefined,
|
|
23
|
+
rowClass: '',
|
|
24
|
+
index: 0
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
const emit = defineEmits<{
|
|
28
|
+
click: [event: MouseEvent]
|
|
29
|
+
dblclick: [event: MouseEvent]
|
|
30
|
+
}>()
|
|
31
|
+
|
|
32
|
+
defineOptions({ inheritAttrs: false })
|
|
33
|
+
|
|
34
|
+
const context = inject(SDataTableContextKey)
|
|
35
|
+
|
|
36
|
+
const isHoverable = computed(() => {
|
|
37
|
+
if (props.hoverable !== undefined) return props.hoverable
|
|
38
|
+
return context?.hoverable ?? true
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
const isSelected = computed(() => {
|
|
42
|
+
if (!props.rowKey || !context) return false
|
|
43
|
+
return context.isRowSelected(props.rowKey)
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
const isExpanded = computed(() => {
|
|
47
|
+
if (!props.rowKey || !context) return false
|
|
48
|
+
return context.isRowExpanded(props.rowKey)
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
const rowClasses = computed(() => {
|
|
52
|
+
return [
|
|
53
|
+
's-table-row',
|
|
54
|
+
props.rowClass,
|
|
55
|
+
{
|
|
56
|
+
's-table-row-hoverable': isHoverable.value,
|
|
57
|
+
's-table-row-selected': isSelected.value,
|
|
58
|
+
's-table-row-expanded': isExpanded.value,
|
|
59
|
+
's-table-row-even': props.index % 2 === 1 && context?.variant === 'striped'
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
const handleClick = (event: MouseEvent) => {
|
|
65
|
+
emit('click', event)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const handleDblClick = (event: MouseEvent) => {
|
|
69
|
+
emit('dblclick', event)
|
|
70
|
+
}
|
|
71
|
+
</script>
|
|
72
|
+
|
|
73
|
+
<template>
|
|
74
|
+
<tr
|
|
75
|
+
v-bind="$attrs"
|
|
76
|
+
:class="cn(rowClasses, $attrs.class ?? '')"
|
|
77
|
+
:data-row-key="rowKey"
|
|
78
|
+
:aria-selected="context?.selectionMode !== 'none' ? isSelected : undefined"
|
|
79
|
+
@click="handleClick"
|
|
80
|
+
@dblclick="handleDblClick"
|
|
81
|
+
>
|
|
82
|
+
<slot />
|
|
83
|
+
</tr>
|
|
84
|
+
</template>
|
|
85
|
+
|
|
86
|
+
<style scoped>
|
|
87
|
+
.s-table-row {
|
|
88
|
+
border-bottom: 1px solid var(--s-border);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.s-table-row-hoverable {
|
|
92
|
+
transition: background-color 0.15s ease;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.s-table-row-hoverable:hover {
|
|
96
|
+
background-color: var(--s-accent);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.s-table-row-selected {
|
|
100
|
+
background-color: color-mix(in srgb, var(--s-primary) 15%, transparent) !important;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.s-table-row-even {
|
|
104
|
+
background-color: var(--s-muted);
|
|
105
|
+
}
|
|
106
|
+
</style>
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* STableSkeleton - Skeleton loading state for tables
|
|
4
|
+
*
|
|
5
|
+
* Features:
|
|
6
|
+
* - Configurable row count
|
|
7
|
+
* - Column-aware skeleton widths
|
|
8
|
+
* - Shimmer animation
|
|
9
|
+
* - Respects prefers-reduced-motion
|
|
10
|
+
*/
|
|
11
|
+
import { inject, computed } from 'vue'
|
|
12
|
+
import { cn } from '../../../lib/utils'
|
|
13
|
+
import { SDataTableContextKey } from './index'
|
|
14
|
+
|
|
15
|
+
interface Props {
|
|
16
|
+
/** Number of skeleton rows to show */
|
|
17
|
+
rows?: number
|
|
18
|
+
/** Number of columns (auto-detected from context if available) */
|
|
19
|
+
columns?: number
|
|
20
|
+
/** Show selection column */
|
|
21
|
+
showSelection?: boolean
|
|
22
|
+
/** Show actions column */
|
|
23
|
+
showActions?: boolean
|
|
24
|
+
/** Custom class for skeleton rows */
|
|
25
|
+
skeletonClass?: string
|
|
26
|
+
/** Animation style */
|
|
27
|
+
animation?: 'shimmer' | 'pulse' | 'none'
|
|
28
|
+
/** Progressive loading - stagger row appearance */
|
|
29
|
+
progressive?: boolean
|
|
30
|
+
/** Delay between progressive rows (ms) */
|
|
31
|
+
progressiveDelay?: number
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
35
|
+
rows: 5,
|
|
36
|
+
columns: undefined,
|
|
37
|
+
showSelection: false,
|
|
38
|
+
showActions: false,
|
|
39
|
+
skeletonClass: '',
|
|
40
|
+
animation: 'shimmer',
|
|
41
|
+
progressive: false,
|
|
42
|
+
progressiveDelay: 100
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
defineOptions({ inheritAttrs: false })
|
|
46
|
+
|
|
47
|
+
const context = inject(SDataTableContextKey)
|
|
48
|
+
|
|
49
|
+
const columnCount = computed(() => {
|
|
50
|
+
if (props.columns !== undefined) return props.columns
|
|
51
|
+
if (context) return context.visibleColumns.value.length
|
|
52
|
+
return 4
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
const hasSelection = computed(() => {
|
|
56
|
+
if (props.showSelection) return true
|
|
57
|
+
return context?.selectionMode !== 'none'
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
// Generate random widths for more realistic skeleton
|
|
61
|
+
const generateWidths = (count: number): string[] => {
|
|
62
|
+
return Array.from({ length: count }, () => `${40 + Math.random() * 50}%`)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const rowWidths = computed(() => {
|
|
66
|
+
return Array.from({ length: props.rows }, () => generateWidths(columnCount.value))
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
// Animation class
|
|
70
|
+
const animationClass = computed(() => {
|
|
71
|
+
const classes: Record<string, string> = {
|
|
72
|
+
shimmer: 's-skeleton-shimmer',
|
|
73
|
+
pulse: 's-skeleton-pulse',
|
|
74
|
+
none: ''
|
|
75
|
+
}
|
|
76
|
+
return classes[props.animation]
|
|
77
|
+
})
|
|
78
|
+
</script>
|
|
79
|
+
|
|
80
|
+
<template>
|
|
81
|
+
<tbody v-bind="$attrs" :class="cn('s-table-skeleton-body', $attrs.class ?? '')">
|
|
82
|
+
<tr
|
|
83
|
+
v-for="(widths, rowIndex) in rowWidths"
|
|
84
|
+
:key="`skeleton-row-${rowIndex}`"
|
|
85
|
+
class="s-table-row s-table-row-skeleton"
|
|
86
|
+
:class="skeletonClass"
|
|
87
|
+
:style="progressive ? { animationDelay: `${rowIndex * progressiveDelay}ms` } : {}"
|
|
88
|
+
>
|
|
89
|
+
<!-- Selection skeleton -->
|
|
90
|
+
<td v-if="hasSelection" class="s-table-td s-table-td-skeleton-select">
|
|
91
|
+
<div :class="['s-skeleton s-skeleton-checkbox', animationClass]" />
|
|
92
|
+
</td>
|
|
93
|
+
|
|
94
|
+
<!-- Data cells -->
|
|
95
|
+
<td
|
|
96
|
+
v-for="(width, colIndex) in widths"
|
|
97
|
+
:key="`skeleton-cell-${rowIndex}-${colIndex}`"
|
|
98
|
+
class="s-table-td"
|
|
99
|
+
>
|
|
100
|
+
<div
|
|
101
|
+
:class="['s-skeleton', animationClass]"
|
|
102
|
+
:style="{ width }"
|
|
103
|
+
/>
|
|
104
|
+
</td>
|
|
105
|
+
|
|
106
|
+
<!-- Actions skeleton -->
|
|
107
|
+
<td v-if="showActions" class="s-table-td s-table-td-skeleton-actions">
|
|
108
|
+
<div class="flex gap-2">
|
|
109
|
+
<div :class="['s-skeleton s-skeleton-action', animationClass]" />
|
|
110
|
+
<div :class="['s-skeleton s-skeleton-action', animationClass]" />
|
|
111
|
+
</div>
|
|
112
|
+
</td>
|
|
113
|
+
</tr>
|
|
114
|
+
</tbody>
|
|
115
|
+
</template>
|
|
116
|
+
|
|
117
|
+
<style scoped>
|
|
118
|
+
.s-table-row-skeleton {
|
|
119
|
+
pointer-events: none;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.s-table-td {
|
|
123
|
+
padding: 0.75rem 1rem;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/* Base skeleton */
|
|
127
|
+
.s-skeleton {
|
|
128
|
+
height: 1rem;
|
|
129
|
+
border-radius: 0.25rem;
|
|
130
|
+
background-color: var(--s-accent);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.s-skeleton-checkbox {
|
|
134
|
+
width: 1rem;
|
|
135
|
+
height: 1rem;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.s-skeleton-action {
|
|
139
|
+
width: 1.5rem;
|
|
140
|
+
height: 1.5rem;
|
|
141
|
+
border-radius: 0.375rem;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/* Shimmer animation */
|
|
145
|
+
.s-skeleton-shimmer {
|
|
146
|
+
background: linear-gradient(
|
|
147
|
+
90deg,
|
|
148
|
+
var(--s-accent) 25%,
|
|
149
|
+
var(--s-muted) 50%,
|
|
150
|
+
var(--s-accent) 75%
|
|
151
|
+
);
|
|
152
|
+
background-size: 200% 100%;
|
|
153
|
+
animation: skeleton-shimmer 1.5s infinite;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
@keyframes skeleton-shimmer {
|
|
157
|
+
0% {
|
|
158
|
+
background-position: 200% 0;
|
|
159
|
+
}
|
|
160
|
+
100% {
|
|
161
|
+
background-position: -200% 0;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/* Pulse animation */
|
|
166
|
+
.s-skeleton-pulse {
|
|
167
|
+
animation: skeleton-pulse 2s ease-in-out infinite;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
@keyframes skeleton-pulse {
|
|
171
|
+
0%, 100% {
|
|
172
|
+
opacity: 1;
|
|
173
|
+
}
|
|
174
|
+
50% {
|
|
175
|
+
opacity: 0.4;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/* Progressive loading animation */
|
|
180
|
+
@keyframes skeleton-row-appear {
|
|
181
|
+
0% {
|
|
182
|
+
opacity: 0;
|
|
183
|
+
transform: translateY(-4px);
|
|
184
|
+
}
|
|
185
|
+
100% {
|
|
186
|
+
opacity: 1;
|
|
187
|
+
transform: translateY(0);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.s-table-row-skeleton {
|
|
192
|
+
animation: skeleton-row-appear 0.3s ease-out forwards;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/* Respect reduced motion */
|
|
196
|
+
@media (prefers-reduced-motion: reduce) {
|
|
197
|
+
.s-skeleton-shimmer,
|
|
198
|
+
.s-skeleton-pulse {
|
|
199
|
+
animation: none;
|
|
200
|
+
background: var(--s-accent);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.s-table-row-skeleton {
|
|
204
|
+
animation: none;
|
|
205
|
+
opacity: 1;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
</style>
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import type { InjectionKey, Ref, ComputedRef } from 'vue'
|
|
2
|
+
|
|
3
|
+
// ============================================================================
|
|
4
|
+
// Types
|
|
5
|
+
// ============================================================================
|
|
6
|
+
|
|
7
|
+
/** Table design variants */
|
|
8
|
+
export type TableVariant = 'default' | 'compact' | 'bordered' | 'striped' | 'minimal'
|
|
9
|
+
|
|
10
|
+
/** Table size presets */
|
|
11
|
+
export type TableSize = 'sm' | 'md' | 'lg'
|
|
12
|
+
|
|
13
|
+
/** Sort direction */
|
|
14
|
+
export type SortDirection = 'asc' | 'desc' | null
|
|
15
|
+
|
|
16
|
+
/** Column alignment */
|
|
17
|
+
export type ColumnAlign = 'left' | 'center' | 'right'
|
|
18
|
+
|
|
19
|
+
/** Selection mode */
|
|
20
|
+
export type SelectionMode = 'none' | 'single' | 'multiple'
|
|
21
|
+
|
|
22
|
+
/** Column definition */
|
|
23
|
+
export interface TableColumn<T = unknown> {
|
|
24
|
+
/** Unique key for the column */
|
|
25
|
+
key: string
|
|
26
|
+
/** Display label for header */
|
|
27
|
+
label?: string
|
|
28
|
+
/** Data accessor - can be a key of T or a function */
|
|
29
|
+
accessor?: keyof T | ((row: T, index: number) => unknown)
|
|
30
|
+
/** Column width (CSS value) */
|
|
31
|
+
width?: string
|
|
32
|
+
/** Minimum width */
|
|
33
|
+
minWidth?: string
|
|
34
|
+
/** Maximum width */
|
|
35
|
+
maxWidth?: string
|
|
36
|
+
/** Text alignment */
|
|
37
|
+
align?: ColumnAlign
|
|
38
|
+
/** Whether column is sortable */
|
|
39
|
+
sortable?: boolean
|
|
40
|
+
/** Custom sort function */
|
|
41
|
+
sortFn?: (a: T, b: T, direction: SortDirection) => number
|
|
42
|
+
/** Whether column is visible */
|
|
43
|
+
visible?: boolean
|
|
44
|
+
/** Sticky column position */
|
|
45
|
+
sticky?: 'left' | 'right'
|
|
46
|
+
/** Custom header class */
|
|
47
|
+
headerClass?: string
|
|
48
|
+
/** Custom cell class */
|
|
49
|
+
cellClass?: string
|
|
50
|
+
/** Render priority for responsive hiding */
|
|
51
|
+
priority?: number
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Sort state */
|
|
55
|
+
export interface SortState {
|
|
56
|
+
column: string | null
|
|
57
|
+
direction: SortDirection
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Pagination state */
|
|
61
|
+
export interface PaginationState {
|
|
62
|
+
page: number
|
|
63
|
+
pageSize: number
|
|
64
|
+
total: number
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** Row data with meta */
|
|
68
|
+
export interface TableRowData<T = unknown> {
|
|
69
|
+
data: T
|
|
70
|
+
index: number
|
|
71
|
+
originalIndex: number
|
|
72
|
+
selected: boolean
|
|
73
|
+
expanded: boolean
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Context provided to table children */
|
|
77
|
+
export interface SDataTableContext<T = unknown> {
|
|
78
|
+
// Config
|
|
79
|
+
variant: TableVariant
|
|
80
|
+
size: TableSize
|
|
81
|
+
selectionMode: SelectionMode
|
|
82
|
+
loading: Ref<boolean>
|
|
83
|
+
hoverable: boolean
|
|
84
|
+
stickyHeader: boolean
|
|
85
|
+
animateRows: boolean
|
|
86
|
+
|
|
87
|
+
// State
|
|
88
|
+
columns: Ref<TableColumn<T>[]>
|
|
89
|
+
visibleColumns: ComputedRef<TableColumn<T>[]>
|
|
90
|
+
sortState: Ref<SortState>
|
|
91
|
+
selectedKeys: Ref<Set<string | number>>
|
|
92
|
+
expandedKeys: Ref<Set<string | number>>
|
|
93
|
+
|
|
94
|
+
// Methods
|
|
95
|
+
getRowKey: (row: T, index: number) => string | number
|
|
96
|
+
toggleSort: (column: string) => void
|
|
97
|
+
toggleRowSelection: (key: string | number) => void
|
|
98
|
+
toggleAllSelection: () => void
|
|
99
|
+
toggleRowExpansion: (key: string | number) => void
|
|
100
|
+
isRowSelected: (key: string | number) => boolean
|
|
101
|
+
isRowExpanded: (key: string | number) => boolean
|
|
102
|
+
isAllSelected: ComputedRef<boolean>
|
|
103
|
+
isSomeSelected: ComputedRef<boolean>
|
|
104
|
+
|
|
105
|
+
// Column management
|
|
106
|
+
showColumn: (key: string) => void
|
|
107
|
+
hideColumn: (key: string) => void
|
|
108
|
+
toggleColumn: (key: string) => void
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Injection key
|
|
112
|
+
export const SDataTableContextKey: InjectionKey<SDataTableContext> = Symbol('SDataTableContext')
|
|
113
|
+
|
|
114
|
+
// ============================================================================
|
|
115
|
+
// Re-exports
|
|
116
|
+
// ============================================================================
|
|
117
|
+
|
|
118
|
+
export { default as SDataTable } from './SDataTable.vue'
|
|
119
|
+
export { default as STableHeader } from './STableHeader.vue'
|
|
120
|
+
export { default as STableBody } from './STableBody.vue'
|
|
121
|
+
export { default as STableRow } from './STableRow.vue'
|
|
122
|
+
export { default as STableCell } from './STableCell.vue'
|
|
123
|
+
export { default as STableColumn } from './STableColumn.vue'
|
|
124
|
+
export { default as STableSkeleton } from './STableSkeleton.vue'
|
|
125
|
+
export { default as STableEmpty } from './STableEmpty.vue'
|
|
126
|
+
export { useDataTable } from './useDataTable'
|