@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,185 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, type CSSProperties } from 'vue'
|
|
3
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
4
|
+
import { cn } from '../../lib/utils'
|
|
5
|
+
|
|
6
|
+
defineOptions({ inheritAttrs: false })
|
|
7
|
+
|
|
8
|
+
const skeletonVariants = cva(
|
|
9
|
+
'block bg-muted',
|
|
10
|
+
{
|
|
11
|
+
variants: {
|
|
12
|
+
shape: {
|
|
13
|
+
rectangular: 'rounded-md',
|
|
14
|
+
circular: 'rounded-full',
|
|
15
|
+
rounded: 'rounded-full',
|
|
16
|
+
},
|
|
17
|
+
animation: {
|
|
18
|
+
wave: 's-skeleton-wave',
|
|
19
|
+
pulse: 's-skeleton-pulse',
|
|
20
|
+
none: '',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
defaultVariants: {
|
|
24
|
+
shape: 'rectangular',
|
|
25
|
+
animation: 'wave',
|
|
26
|
+
},
|
|
27
|
+
}
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
export type SkeletonVariants = VariantProps<typeof skeletonVariants>
|
|
31
|
+
|
|
32
|
+
export interface Props {
|
|
33
|
+
/** Shape variant */
|
|
34
|
+
shape?: 'rectangular' | 'circular' | 'rounded'
|
|
35
|
+
/** Animation type */
|
|
36
|
+
animation?: 'wave' | 'pulse' | 'none'
|
|
37
|
+
/** Width (CSS value) */
|
|
38
|
+
width?: string
|
|
39
|
+
/** Height (CSS value) */
|
|
40
|
+
height?: string
|
|
41
|
+
/** Shorthand for equal width and height */
|
|
42
|
+
size?: string
|
|
43
|
+
/** Custom border radius override */
|
|
44
|
+
borderRadius?: string
|
|
45
|
+
/** Number of lines to render (for text-like skeletons) */
|
|
46
|
+
lines?: number
|
|
47
|
+
/** Gap between lines */
|
|
48
|
+
lineGap?: string
|
|
49
|
+
/** Additional class */
|
|
50
|
+
skeletonClass?: string
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
54
|
+
shape: 'rectangular',
|
|
55
|
+
animation: 'wave',
|
|
56
|
+
width: undefined,
|
|
57
|
+
height: undefined,
|
|
58
|
+
size: undefined,
|
|
59
|
+
borderRadius: undefined,
|
|
60
|
+
lines: 1,
|
|
61
|
+
lineGap: '0.75rem',
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
const containerStyle = computed<CSSProperties>(() => {
|
|
65
|
+
const style: CSSProperties = {}
|
|
66
|
+
|
|
67
|
+
if (props.size) {
|
|
68
|
+
style.width = props.size
|
|
69
|
+
style.height = props.size
|
|
70
|
+
} else {
|
|
71
|
+
if (props.width) style.width = props.width
|
|
72
|
+
if (props.height) style.height = props.height
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (!props.size && !props.height) {
|
|
76
|
+
style.height = props.shape === 'circular' ? props.width ?? '3rem' : '1rem'
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (!props.size && !props.width) {
|
|
80
|
+
style.width = props.shape === 'circular' ? props.height ?? '3rem' : '100%'
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (props.borderRadius) {
|
|
84
|
+
style.borderRadius = props.borderRadius
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return style
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
const skeletonClasses = computed(() =>
|
|
91
|
+
cn(
|
|
92
|
+
skeletonVariants({ shape: props.shape, animation: props.animation }),
|
|
93
|
+
props.skeletonClass,
|
|
94
|
+
)
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
const lineWidths = computed(() => {
|
|
98
|
+
if (props.lines <= 1) return ['100%']
|
|
99
|
+
return Array.from({ length: props.lines }, (_, i) => {
|
|
100
|
+
if (i === props.lines - 1) return '60%'
|
|
101
|
+
return '100%'
|
|
102
|
+
})
|
|
103
|
+
})
|
|
104
|
+
</script>
|
|
105
|
+
|
|
106
|
+
<template>
|
|
107
|
+
<div
|
|
108
|
+
v-if="lines > 1"
|
|
109
|
+
v-bind="$attrs"
|
|
110
|
+
class="flex flex-col"
|
|
111
|
+
:style="{ gap: lineGap }"
|
|
112
|
+
>
|
|
113
|
+
<div
|
|
114
|
+
v-for="(lineWidth, i) in lineWidths"
|
|
115
|
+
:key="i"
|
|
116
|
+
:class="skeletonClasses"
|
|
117
|
+
:style="{ ...containerStyle, width: lineWidth }"
|
|
118
|
+
/>
|
|
119
|
+
</div>
|
|
120
|
+
|
|
121
|
+
<div
|
|
122
|
+
v-else
|
|
123
|
+
v-bind="$attrs"
|
|
124
|
+
:class="skeletonClasses"
|
|
125
|
+
:style="containerStyle"
|
|
126
|
+
/>
|
|
127
|
+
</template>
|
|
128
|
+
|
|
129
|
+
<style>
|
|
130
|
+
/* Pulse animation — smooth opacity fade */
|
|
131
|
+
.s-skeleton-pulse {
|
|
132
|
+
animation: s-skeleton-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
@keyframes s-skeleton-pulse {
|
|
136
|
+
0%, 100% {
|
|
137
|
+
opacity: 1;
|
|
138
|
+
}
|
|
139
|
+
50% {
|
|
140
|
+
opacity: 0.4;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/* Wave / shimmer animation — gradient slide */
|
|
145
|
+
.s-skeleton-wave {
|
|
146
|
+
position: relative;
|
|
147
|
+
overflow: hidden;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.s-skeleton-wave::after {
|
|
151
|
+
content: '';
|
|
152
|
+
position: absolute;
|
|
153
|
+
inset: 0;
|
|
154
|
+
transform: translateX(-100%);
|
|
155
|
+
background: linear-gradient(
|
|
156
|
+
90deg,
|
|
157
|
+
transparent,
|
|
158
|
+
rgba(255, 255, 255, 0.08) 20%,
|
|
159
|
+
rgba(255, 255, 255, 0.18) 50%,
|
|
160
|
+
rgba(255, 255, 255, 0.08) 80%,
|
|
161
|
+
transparent
|
|
162
|
+
);
|
|
163
|
+
animation: s-skeleton-wave 1.8s ease-in-out infinite;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
:root:not(.dark) .s-skeleton-wave::after {
|
|
167
|
+
background: linear-gradient(
|
|
168
|
+
90deg,
|
|
169
|
+
transparent,
|
|
170
|
+
rgba(255, 255, 255, 0.3) 20%,
|
|
171
|
+
rgba(255, 255, 255, 0.6) 50%,
|
|
172
|
+
rgba(255, 255, 255, 0.3) 80%,
|
|
173
|
+
transparent
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
@keyframes s-skeleton-wave {
|
|
178
|
+
0% {
|
|
179
|
+
transform: translateX(-100%);
|
|
180
|
+
}
|
|
181
|
+
100% {
|
|
182
|
+
transform: translateX(100%);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
</style>
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, useAttrs, type CSSProperties } from 'vue'
|
|
3
|
+
import { cn } from '../../lib/utils'
|
|
4
|
+
|
|
5
|
+
defineOptions({ inheritAttrs: false })
|
|
6
|
+
|
|
7
|
+
const attrs = useAttrs()
|
|
8
|
+
|
|
9
|
+
export interface Props {
|
|
10
|
+
modelValue?: boolean | string | number
|
|
11
|
+
type?: 'inset' | 'outset'
|
|
12
|
+
size?: 'small' | 'medium' | 'large'
|
|
13
|
+
color?: string
|
|
14
|
+
disabled?: boolean
|
|
15
|
+
loading?: boolean
|
|
16
|
+
checkedValue?: boolean | string | number
|
|
17
|
+
uncheckedValue?: boolean | string | number
|
|
18
|
+
labelBefore?: string
|
|
19
|
+
labelAfter?: string
|
|
20
|
+
checkedIcon?: string
|
|
21
|
+
uncheckedIcon?: string
|
|
22
|
+
checkedText?: string
|
|
23
|
+
uncheckedText?: string
|
|
24
|
+
trackClass?: string
|
|
25
|
+
thumbClass?: string
|
|
26
|
+
labelClass?: string
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
30
|
+
modelValue: false,
|
|
31
|
+
type: 'inset',
|
|
32
|
+
size: 'medium',
|
|
33
|
+
color: undefined,
|
|
34
|
+
disabled: false,
|
|
35
|
+
loading: false,
|
|
36
|
+
checkedValue: true,
|
|
37
|
+
uncheckedValue: false,
|
|
38
|
+
labelBefore: undefined,
|
|
39
|
+
labelAfter: undefined,
|
|
40
|
+
checkedIcon: undefined,
|
|
41
|
+
uncheckedIcon: undefined,
|
|
42
|
+
checkedText: undefined,
|
|
43
|
+
uncheckedText: undefined,
|
|
44
|
+
trackClass: undefined,
|
|
45
|
+
thumbClass: undefined,
|
|
46
|
+
labelClass: undefined
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
const emit = defineEmits<{
|
|
50
|
+
'update:modelValue': [value: boolean | string | number]
|
|
51
|
+
'change': [value: boolean | string | number]
|
|
52
|
+
}>()
|
|
53
|
+
|
|
54
|
+
const isChecked = computed(() => props.modelValue === props.checkedValue)
|
|
55
|
+
const hasTrackText = computed(() => props.checkedText || props.uncheckedText)
|
|
56
|
+
|
|
57
|
+
const toggle = () => {
|
|
58
|
+
if (props.disabled || props.loading) return
|
|
59
|
+
const newValue = isChecked.value ? props.uncheckedValue : props.checkedValue
|
|
60
|
+
emit('update:modelValue', newValue)
|
|
61
|
+
emit('change', newValue)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const handleKeydown = (e: KeyboardEvent) => {
|
|
65
|
+
if (e.key === ' ' || e.key === 'Enter') {
|
|
66
|
+
e.preventDefault()
|
|
67
|
+
toggle()
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Size configurations for inset type (thumb inside track)
|
|
72
|
+
const insetSizes = {
|
|
73
|
+
small: {
|
|
74
|
+
track: 'w-8 h-4',
|
|
75
|
+
thumb: 'w-3 h-3',
|
|
76
|
+
thumbTranslate: 'translate-x-4',
|
|
77
|
+
icon: 'text-[8px]',
|
|
78
|
+
label: 'text-xs',
|
|
79
|
+
trackText: 'text-[8px]'
|
|
80
|
+
},
|
|
81
|
+
medium: {
|
|
82
|
+
track: 'w-11 h-6',
|
|
83
|
+
thumb: 'w-5 h-5',
|
|
84
|
+
thumbTranslate: 'translate-x-5',
|
|
85
|
+
icon: 'text-[10px]',
|
|
86
|
+
label: 'text-sm',
|
|
87
|
+
trackText: 'text-[10px]'
|
|
88
|
+
},
|
|
89
|
+
large: {
|
|
90
|
+
track: 'w-14 h-7',
|
|
91
|
+
thumb: 'w-6 h-6',
|
|
92
|
+
thumbTranslate: 'translate-x-7',
|
|
93
|
+
icon: 'text-xs',
|
|
94
|
+
label: 'text-base',
|
|
95
|
+
trackText: 'text-xs'
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Size configurations for outset type (thumb larger than track)
|
|
100
|
+
const outsetSizes = {
|
|
101
|
+
small: {
|
|
102
|
+
track: 'w-7 h-3',
|
|
103
|
+
thumb: 'w-4 h-4',
|
|
104
|
+
thumbTranslate: 'translate-x-3',
|
|
105
|
+
icon: 'text-[8px]',
|
|
106
|
+
label: 'text-xs',
|
|
107
|
+
trackText: 'text-[6px]'
|
|
108
|
+
},
|
|
109
|
+
medium: {
|
|
110
|
+
track: 'w-10 h-4',
|
|
111
|
+
thumb: 'w-6 h-6',
|
|
112
|
+
thumbTranslate: 'translate-x-4',
|
|
113
|
+
icon: 'text-[10px]',
|
|
114
|
+
label: 'text-sm',
|
|
115
|
+
trackText: 'text-[8px]'
|
|
116
|
+
},
|
|
117
|
+
large: {
|
|
118
|
+
track: 'w-12 h-5',
|
|
119
|
+
thumb: 'w-7 h-7',
|
|
120
|
+
thumbTranslate: 'translate-x-5',
|
|
121
|
+
icon: 'text-xs',
|
|
122
|
+
label: 'text-base',
|
|
123
|
+
trackText: 'text-[10px]'
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const sizeConfig = computed(() => {
|
|
128
|
+
const sizes = props.type === 'outset' ? outsetSizes : insetSizes
|
|
129
|
+
return sizes[props.size]
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
// Track style: when color is set and checked, use inline style; otherwise use token classes
|
|
133
|
+
const trackStyle = computed<CSSProperties | undefined>(() => {
|
|
134
|
+
if (isChecked.value && props.color) {
|
|
135
|
+
return { backgroundColor: props.color }
|
|
136
|
+
}
|
|
137
|
+
return undefined
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
// Icon color style for checked icon when color is set
|
|
141
|
+
const checkedIconStyle = computed<CSSProperties | undefined>(() => {
|
|
142
|
+
if (props.color) {
|
|
143
|
+
return { color: props.color }
|
|
144
|
+
}
|
|
145
|
+
return undefined
|
|
146
|
+
})
|
|
147
|
+
|
|
148
|
+
const wrapperClasses = computed(() => {
|
|
149
|
+
return cn(
|
|
150
|
+
'inline-flex items-center gap-2',
|
|
151
|
+
{ 'opacity-50 cursor-not-allowed': props.disabled },
|
|
152
|
+
(attrs as Record<string, unknown>).class,
|
|
153
|
+
)
|
|
154
|
+
})
|
|
155
|
+
|
|
156
|
+
const trackClasses = computed(() => {
|
|
157
|
+
return cn(
|
|
158
|
+
's-switch-track relative inline-flex items-center shrink-0 rounded-full transition-all duration-300 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-ring',
|
|
159
|
+
hasTrackText.value ? 'min-w-16 px-1' : sizeConfig.value.track,
|
|
160
|
+
// Unchecked state uses accent background; checked uses primary (or inline style when color is set)
|
|
161
|
+
isChecked.value && !props.color ? 'bg-primary' : '',
|
|
162
|
+
!isChecked.value ? 'bg-accent' : '',
|
|
163
|
+
{ 'cursor-pointer': !props.disabled && !props.loading, 'cursor-not-allowed': props.disabled || props.loading },
|
|
164
|
+
{ 'h-6': hasTrackText.value && props.size === 'medium', 'h-5': hasTrackText.value && props.size === 'small', 'h-7': hasTrackText.value && props.size === 'large' },
|
|
165
|
+
props.trackClass,
|
|
166
|
+
)
|
|
167
|
+
})
|
|
168
|
+
|
|
169
|
+
const thumbClasses = computed(() => {
|
|
170
|
+
return cn(
|
|
171
|
+
's-switch-thumb inline-flex items-center justify-center rounded-full shadow-md transition-all duration-300 ease-in-out z-10',
|
|
172
|
+
isChecked.value && !props.color ? 'bg-primary-foreground' : 'bg-white',
|
|
173
|
+
hasTrackText.value ? 'w-5 h-5' : sizeConfig.value.thumb,
|
|
174
|
+
hasTrackText.value
|
|
175
|
+
? (isChecked.value ? 'ml-auto' : 'mr-auto')
|
|
176
|
+
: (isChecked.value ? sizeConfig.value.thumbTranslate : 'translate-x-0.5'),
|
|
177
|
+
props.thumbClass,
|
|
178
|
+
)
|
|
179
|
+
})
|
|
180
|
+
</script>
|
|
181
|
+
|
|
182
|
+
<template>
|
|
183
|
+
<div
|
|
184
|
+
v-bind="$attrs"
|
|
185
|
+
:class="wrapperClasses"
|
|
186
|
+
>
|
|
187
|
+
<!-- Label Before -->
|
|
188
|
+
<span
|
|
189
|
+
v-if="labelBefore"
|
|
190
|
+
class="select-none text-muted-foreground"
|
|
191
|
+
:class="[sizeConfig.label, labelClass]"
|
|
192
|
+
>
|
|
193
|
+
{{ labelBefore }}
|
|
194
|
+
</span>
|
|
195
|
+
|
|
196
|
+
<!-- Switch Track -->
|
|
197
|
+
<button
|
|
198
|
+
type="button"
|
|
199
|
+
role="switch"
|
|
200
|
+
:aria-checked="isChecked"
|
|
201
|
+
:disabled="disabled || loading"
|
|
202
|
+
:class="trackClasses"
|
|
203
|
+
:style="trackStyle"
|
|
204
|
+
@click="toggle"
|
|
205
|
+
@keydown="handleKeydown"
|
|
206
|
+
>
|
|
207
|
+
<!-- Track Text (unchecked - right side) -->
|
|
208
|
+
<span
|
|
209
|
+
v-if="hasTrackText && !isChecked && uncheckedText"
|
|
210
|
+
:class="['absolute right-2 font-semibold select-none', color ? 'text-white' : 'text-primary-foreground', sizeConfig.trackText]"
|
|
211
|
+
>
|
|
212
|
+
{{ uncheckedText }}
|
|
213
|
+
</span>
|
|
214
|
+
|
|
215
|
+
<!-- Track Text (checked - left side) -->
|
|
216
|
+
<span
|
|
217
|
+
v-if="hasTrackText && isChecked && checkedText"
|
|
218
|
+
:class="['absolute left-2 font-semibold select-none', color ? 'text-white' : 'text-primary-foreground', sizeConfig.trackText]"
|
|
219
|
+
>
|
|
220
|
+
{{ checkedText }}
|
|
221
|
+
</span>
|
|
222
|
+
|
|
223
|
+
<!-- Thumb -->
|
|
224
|
+
<span :class="thumbClasses">
|
|
225
|
+
<!-- Loading Spinner -->
|
|
226
|
+
<span
|
|
227
|
+
v-if="loading"
|
|
228
|
+
class="mdi mdi-loading animate-spin text-muted-foreground"
|
|
229
|
+
:class="sizeConfig.icon"
|
|
230
|
+
></span>
|
|
231
|
+
|
|
232
|
+
<!-- Custom Icons via Slots -->
|
|
233
|
+
<template v-else>
|
|
234
|
+
<slot v-if="isChecked" name="checked-icon">
|
|
235
|
+
<span
|
|
236
|
+
v-if="checkedIcon"
|
|
237
|
+
:class="['mdi', `mdi-${checkedIcon}`, sizeConfig.icon]"
|
|
238
|
+
:style="checkedIconStyle"
|
|
239
|
+
:data-no-color="!color ? '' : undefined"
|
|
240
|
+
></span>
|
|
241
|
+
</slot>
|
|
242
|
+
<slot v-else name="unchecked-icon">
|
|
243
|
+
<span
|
|
244
|
+
v-if="uncheckedIcon"
|
|
245
|
+
:class="['mdi', `mdi-${uncheckedIcon}`, sizeConfig.icon, 'text-muted-foreground']"
|
|
246
|
+
></span>
|
|
247
|
+
</slot>
|
|
248
|
+
</template>
|
|
249
|
+
</span>
|
|
250
|
+
</button>
|
|
251
|
+
|
|
252
|
+
<!-- Label After -->
|
|
253
|
+
<span
|
|
254
|
+
v-if="labelAfter"
|
|
255
|
+
class="select-none text-muted-foreground"
|
|
256
|
+
:class="[sizeConfig.label, labelClass]"
|
|
257
|
+
>
|
|
258
|
+
{{ labelAfter }}
|
|
259
|
+
</span>
|
|
260
|
+
</div>
|
|
261
|
+
</template>
|
|
262
|
+
|
|
263
|
+
<style scoped>
|
|
264
|
+
.s-switch-track {
|
|
265
|
+
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.s-switch-thumb {
|
|
269
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.1);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.s-switch-track:hover:not(:disabled) .s-switch-thumb {
|
|
273
|
+
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.12);
|
|
274
|
+
}
|
|
275
|
+
</style>
|