@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,547 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, ref, useSlots, onMounted, onUnmounted } from 'vue'
|
|
3
|
+
import { useTheme } from '../../composables/useTheme'
|
|
4
|
+
import { cn } from '../../lib/utils'
|
|
5
|
+
|
|
6
|
+
defineOptions({ inheritAttrs: false })
|
|
7
|
+
|
|
8
|
+
export interface Props {
|
|
9
|
+
// SButton parity props
|
|
10
|
+
size?: 'xs' | 'small' | 'medium' | 'large' | 'xl'
|
|
11
|
+
disabled?: boolean
|
|
12
|
+
loading?: boolean
|
|
13
|
+
preserveSize?: boolean
|
|
14
|
+
block?: boolean
|
|
15
|
+
rounded?: 'none' | 'sm' | 'md' | 'lg' | 'full'
|
|
16
|
+
iconLeft?: string
|
|
17
|
+
iconRight?: string
|
|
18
|
+
iconOnly?: boolean
|
|
19
|
+
tag?: string
|
|
20
|
+
href?: string
|
|
21
|
+
to?: string | object
|
|
22
|
+
type?: 'button' | 'submit' | 'reset'
|
|
23
|
+
ripple?: boolean
|
|
24
|
+
animationType?: 'slide' | 'vertical' | 'scale' | 'rotate'
|
|
25
|
+
animateInactive?: boolean
|
|
26
|
+
|
|
27
|
+
// Glass-specific props
|
|
28
|
+
tint?: 'auto' | 'light' | 'dark'
|
|
29
|
+
blur?: number
|
|
30
|
+
saturation?: number
|
|
31
|
+
highlightIntensity?: number
|
|
32
|
+
color?: string
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
36
|
+
size: 'medium',
|
|
37
|
+
disabled: false,
|
|
38
|
+
loading: false,
|
|
39
|
+
preserveSize: false,
|
|
40
|
+
block: false,
|
|
41
|
+
rounded: 'md',
|
|
42
|
+
iconLeft: undefined,
|
|
43
|
+
iconRight: undefined,
|
|
44
|
+
iconOnly: false,
|
|
45
|
+
tag: 'button',
|
|
46
|
+
href: undefined,
|
|
47
|
+
to: undefined,
|
|
48
|
+
type: 'button',
|
|
49
|
+
ripple: true,
|
|
50
|
+
animationType: 'slide',
|
|
51
|
+
animateInactive: false,
|
|
52
|
+
tint: 'auto',
|
|
53
|
+
blur: 0,
|
|
54
|
+
saturation: 150,
|
|
55
|
+
highlightIntensity: 0.3,
|
|
56
|
+
color: undefined,
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
const slots = useSlots()
|
|
60
|
+
const hasAnimateSlot = computed(() => !!slots.animate)
|
|
61
|
+
|
|
62
|
+
const emit = defineEmits<{
|
|
63
|
+
click: [event: MouseEvent]
|
|
64
|
+
}>()
|
|
65
|
+
|
|
66
|
+
// Theme detection for auto tint
|
|
67
|
+
const { theme } = useTheme()
|
|
68
|
+
|
|
69
|
+
// System dark mode detection for 'system' theme
|
|
70
|
+
const systemDark = ref(false)
|
|
71
|
+
let mediaQuery: MediaQueryList | null = null
|
|
72
|
+
|
|
73
|
+
onMounted(() => {
|
|
74
|
+
if (typeof window !== 'undefined') {
|
|
75
|
+
mediaQuery = window.matchMedia('(prefers-color-scheme: dark)')
|
|
76
|
+
systemDark.value = mediaQuery.matches
|
|
77
|
+
const handler = (e: MediaQueryListEvent) => { systemDark.value = e.matches }
|
|
78
|
+
mediaQuery.addEventListener('change', handler)
|
|
79
|
+
onUnmounted(() => mediaQuery?.removeEventListener('change', handler))
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Inject SVG glass lens refraction filter (once globally)
|
|
83
|
+
if (typeof document !== 'undefined' && !document.getElementById('s-glass-filters')) {
|
|
84
|
+
// Generate rectangular barrel-distortion displacement map via Canvas
|
|
85
|
+
// Unlike a circular map, this covers the full rectangle for non-circular buttons
|
|
86
|
+
const canvas = document.createElement('canvas')
|
|
87
|
+
const mapW = 256
|
|
88
|
+
const mapH = 256
|
|
89
|
+
canvas.width = mapW
|
|
90
|
+
canvas.height = mapH
|
|
91
|
+
const ctx = canvas.getContext('2d')!
|
|
92
|
+
const imgData = ctx.createImageData(mapW, mapH)
|
|
93
|
+
const strength = 0.7
|
|
94
|
+
|
|
95
|
+
for (let y = 0; y < mapH; y++) {
|
|
96
|
+
for (let x = 0; x < mapW; x++) {
|
|
97
|
+
// Normalized coordinates: -1 to +1
|
|
98
|
+
const nx = (x / (mapW - 1)) * 2 - 1
|
|
99
|
+
const ny = (y / (mapH - 1)) * 2 - 1
|
|
100
|
+
|
|
101
|
+
// Rectangular edge distance (0 at edges, 1 at center)
|
|
102
|
+
const edgeX = 1 - Math.abs(nx)
|
|
103
|
+
const edgeY = 1 - Math.abs(ny)
|
|
104
|
+
// Smooth falloff using squared edge distances
|
|
105
|
+
const falloff = Math.pow(edgeX, 1.5) * Math.pow(edgeY, 1.5)
|
|
106
|
+
|
|
107
|
+
// Displacement pushes pixels outward from center (barrel distortion)
|
|
108
|
+
const r = Math.round(128 + nx * strength * falloff * 127)
|
|
109
|
+
const g = Math.round(128 + ny * strength * falloff * 127)
|
|
110
|
+
|
|
111
|
+
const i = (y * mapW + x) * 4
|
|
112
|
+
imgData.data[i] = r // R = horizontal displacement
|
|
113
|
+
imgData.data[i + 1] = g // G = vertical displacement
|
|
114
|
+
imgData.data[i + 2] = 128 // B = unused
|
|
115
|
+
imgData.data[i + 3] = 255 // A = opaque
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
ctx.putImageData(imgData, 0, 0)
|
|
119
|
+
const lensDataUri = canvas.toDataURL('image/png')
|
|
120
|
+
|
|
121
|
+
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg')
|
|
122
|
+
svg.id = 's-glass-filters'
|
|
123
|
+
svg.setAttribute('style', 'position:absolute;width:0;height:0;overflow:hidden;pointer-events:none')
|
|
124
|
+
svg.setAttribute('aria-hidden', 'true')
|
|
125
|
+
svg.innerHTML = `<defs>
|
|
126
|
+
<filter id="s-glass-refract" primitiveUnits="objectBoundingBox">
|
|
127
|
+
<feImage href="${lensDataUri}" x="0" y="0" width="1" height="1" result="lens" />
|
|
128
|
+
<feDisplacementMap in="SourceGraphic" in2="lens" scale="0.3" xChannelSelector="R" yChannelSelector="G" />
|
|
129
|
+
</filter>
|
|
130
|
+
</defs>`
|
|
131
|
+
document.body.appendChild(svg)
|
|
132
|
+
}
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
const isDarkMode = computed(() => {
|
|
136
|
+
if (theme.value === 'dark') return true
|
|
137
|
+
if (theme.value === 'light') return false
|
|
138
|
+
return systemDark.value
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
const effectiveTint = computed(() => {
|
|
142
|
+
if (props.tint !== 'auto') return props.tint
|
|
143
|
+
return isDarkMode.value ? 'light' : 'dark'
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
// Ripple effect
|
|
147
|
+
const ripples = ref<{ id: number; x: number; y: number; size: number }[]>([])
|
|
148
|
+
let rippleId = 0
|
|
149
|
+
|
|
150
|
+
const createRipple = (event: MouseEvent) => {
|
|
151
|
+
if (!props.ripple || props.disabled || props.loading) return
|
|
152
|
+
|
|
153
|
+
const button = event.currentTarget as HTMLElement
|
|
154
|
+
const rect = button.getBoundingClientRect()
|
|
155
|
+
const size = Math.max(rect.width, rect.height) * 2
|
|
156
|
+
const x = event.clientX - rect.left - size / 2
|
|
157
|
+
const y = event.clientY - rect.top - size / 2
|
|
158
|
+
|
|
159
|
+
const id = rippleId++
|
|
160
|
+
ripples.value.push({ id, x, y, size })
|
|
161
|
+
|
|
162
|
+
setTimeout(() => {
|
|
163
|
+
ripples.value = ripples.value.filter(r => r.id !== id)
|
|
164
|
+
}, 700)
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const handleClick = (event: MouseEvent) => {
|
|
168
|
+
if (props.disabled || props.loading) {
|
|
169
|
+
event.preventDefault()
|
|
170
|
+
return
|
|
171
|
+
}
|
|
172
|
+
createRipple(event)
|
|
173
|
+
emit('click', event)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const handleKeydown = (event: KeyboardEvent) => {
|
|
177
|
+
if (props.disabled || props.loading) return
|
|
178
|
+
if (event.key === ' ' || event.key === 'Enter') {
|
|
179
|
+
event.preventDefault()
|
|
180
|
+
const mouseEvent = new MouseEvent('click', {
|
|
181
|
+
bubbles: true,
|
|
182
|
+
clientX: (event.target as HTMLElement).getBoundingClientRect().left + 20,
|
|
183
|
+
clientY: (event.target as HTMLElement).getBoundingClientRect().top + 20
|
|
184
|
+
})
|
|
185
|
+
;(event.target as HTMLElement).dispatchEvent(mouseEvent)
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// Computed component tag
|
|
190
|
+
const componentTag = computed(() => {
|
|
191
|
+
if (props.to) return 'router-link'
|
|
192
|
+
if (props.href) return 'a'
|
|
193
|
+
return props.tag
|
|
194
|
+
})
|
|
195
|
+
|
|
196
|
+
// Size configurations
|
|
197
|
+
const sizeClasses = computed(() => {
|
|
198
|
+
if (props.iconOnly) {
|
|
199
|
+
const iconOnlySizes = {
|
|
200
|
+
xs: 'w-6 h-6 text-xs',
|
|
201
|
+
small: 'w-8 h-8 text-sm',
|
|
202
|
+
medium: 'w-10 h-10 text-base',
|
|
203
|
+
large: 'w-12 h-12 text-lg',
|
|
204
|
+
xl: 'w-14 h-14 text-xl'
|
|
205
|
+
}
|
|
206
|
+
return iconOnlySizes[props.size]
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
const sizes = {
|
|
210
|
+
xs: 'px-1.5 py-0.5 text-xs gap-1',
|
|
211
|
+
small: 'px-2 py-0.5 text-sm gap-1.5',
|
|
212
|
+
medium: 'px-2 py-0.5 text-sm gap-2',
|
|
213
|
+
large: 'px-2.5 py-0.5 text-base gap-2',
|
|
214
|
+
xl: 'px-3 py-0.5 text-lg gap-2.5'
|
|
215
|
+
}
|
|
216
|
+
return sizes[props.size]
|
|
217
|
+
})
|
|
218
|
+
|
|
219
|
+
const iconSizes = computed(() => {
|
|
220
|
+
const sizes = {
|
|
221
|
+
xs: 'text-xs',
|
|
222
|
+
small: 'text-sm',
|
|
223
|
+
medium: 'text-base',
|
|
224
|
+
large: 'text-lg',
|
|
225
|
+
xl: 'text-xl'
|
|
226
|
+
}
|
|
227
|
+
return sizes[props.size]
|
|
228
|
+
})
|
|
229
|
+
|
|
230
|
+
// Border radius
|
|
231
|
+
const radiusClasses = computed(() => {
|
|
232
|
+
const radii = {
|
|
233
|
+
none: 'rounded-none',
|
|
234
|
+
sm: 'rounded',
|
|
235
|
+
md: 'rounded-lg',
|
|
236
|
+
lg: 'rounded-xl',
|
|
237
|
+
full: 'rounded-full'
|
|
238
|
+
}
|
|
239
|
+
return radii[props.rounded]
|
|
240
|
+
})
|
|
241
|
+
|
|
242
|
+
// Glass computed styles
|
|
243
|
+
const computedStyle = computed(() => {
|
|
244
|
+
const style: Record<string, string> = {}
|
|
245
|
+
const isLight = effectiveTint.value === 'light'
|
|
246
|
+
|
|
247
|
+
// Glass surface
|
|
248
|
+
style['--glass-blur'] = `${props.blur}px`
|
|
249
|
+
style['--glass-saturation'] = `${props.saturation}%`
|
|
250
|
+
|
|
251
|
+
// Background (more transparent for liquid glass)
|
|
252
|
+
style['--glass-bg'] = isLight
|
|
253
|
+
? 'rgba(255, 255, 255, 0.06)'
|
|
254
|
+
: 'rgba(0, 0, 0, 0.04)'
|
|
255
|
+
|
|
256
|
+
// Text color
|
|
257
|
+
if (props.color) {
|
|
258
|
+
style['--glass-text'] = props.color
|
|
259
|
+
} else {
|
|
260
|
+
style['--glass-text'] = isLight ? '#ffffff' : '#1a1a1a'
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// Inner glow (replaces border for more realistic glass edge)
|
|
264
|
+
style['--glass-glow'] = isLight
|
|
265
|
+
? 'rgba(255, 255, 255, 0.7)'
|
|
266
|
+
: 'rgba(0, 0, 0, 0.15)'
|
|
267
|
+
|
|
268
|
+
// Subtle outer shadow
|
|
269
|
+
style['--glass-shadow-outer'] = isLight
|
|
270
|
+
? '0 2px 12px rgba(0, 0, 0, 0.06)'
|
|
271
|
+
: '0 2px 12px rgba(0, 0, 0, 0.03)'
|
|
272
|
+
|
|
273
|
+
// Highlight
|
|
274
|
+
style['--glass-highlight'] = `${props.highlightIntensity}`
|
|
275
|
+
|
|
276
|
+
// Hover states
|
|
277
|
+
style['--glass-bg-hover'] = isLight
|
|
278
|
+
? 'rgba(255, 255, 255, 0.15)'
|
|
279
|
+
: 'rgba(0, 0, 0, 0.1)'
|
|
280
|
+
style['--glass-shadow-hover'] = isLight
|
|
281
|
+
? '0 6px 24px rgba(0, 0, 0, 0.1)'
|
|
282
|
+
: '0 6px 24px rgba(0, 0, 0, 0.06)'
|
|
283
|
+
|
|
284
|
+
return style
|
|
285
|
+
})
|
|
286
|
+
|
|
287
|
+
// Component bindings
|
|
288
|
+
const componentBindings = computed(() => {
|
|
289
|
+
const bindings: Record<string, unknown> = {}
|
|
290
|
+
|
|
291
|
+
if (props.to) {
|
|
292
|
+
bindings.to = props.to
|
|
293
|
+
}
|
|
294
|
+
if (props.href) {
|
|
295
|
+
bindings.href = props.href
|
|
296
|
+
}
|
|
297
|
+
if (componentTag.value === 'button') {
|
|
298
|
+
bindings.type = props.type
|
|
299
|
+
}
|
|
300
|
+
if (props.disabled) {
|
|
301
|
+
bindings.disabled = true
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
return bindings
|
|
305
|
+
})
|
|
306
|
+
</script>
|
|
307
|
+
|
|
308
|
+
<template>
|
|
309
|
+
<component
|
|
310
|
+
:is="componentTag"
|
|
311
|
+
v-bind="{ ...$attrs, ...componentBindings }"
|
|
312
|
+
class="s-glass-button relative inline-flex items-center justify-center font-medium overflow-hidden select-none focus:outline-none"
|
|
313
|
+
:class="[
|
|
314
|
+
sizeClasses,
|
|
315
|
+
radiusClasses,
|
|
316
|
+
{
|
|
317
|
+
'w-full': block,
|
|
318
|
+
'opacity-50 cursor-not-allowed': disabled || loading,
|
|
319
|
+
'cursor-pointer': !disabled && !loading,
|
|
320
|
+
's-glass-button--loading': loading,
|
|
321
|
+
's-glass-button--animate': hasAnimateSlot && !animateInactive,
|
|
322
|
+
[`s-glass-button--animate-${animationType}`]: hasAnimateSlot && !animateInactive,
|
|
323
|
+
}
|
|
324
|
+
]"
|
|
325
|
+
:style="computedStyle"
|
|
326
|
+
@click="handleClick"
|
|
327
|
+
@keydown="handleKeydown"
|
|
328
|
+
>
|
|
329
|
+
<!-- Glass ripple effects -->
|
|
330
|
+
<span
|
|
331
|
+
v-for="ripple in ripples"
|
|
332
|
+
:key="ripple.id"
|
|
333
|
+
class="absolute rounded-full pointer-events-none animate-glass-ripple"
|
|
334
|
+
:class="effectiveTint === 'light' ? 'bg-white/20' : 'bg-black/10'"
|
|
335
|
+
:style="{
|
|
336
|
+
left: `${ripple.x}px`,
|
|
337
|
+
top: `${ripple.y}px`,
|
|
338
|
+
width: `${ripple.size}px`,
|
|
339
|
+
height: `${ripple.size}px`,
|
|
340
|
+
zIndex: 2
|
|
341
|
+
}"
|
|
342
|
+
/>
|
|
343
|
+
|
|
344
|
+
<!-- Loading spinner -->
|
|
345
|
+
<span
|
|
346
|
+
v-if="loading"
|
|
347
|
+
class="mdi mdi-loading animate-spin relative z-10"
|
|
348
|
+
:class="[iconSizes, { 'absolute inset-0 flex items-center justify-center': preserveSize }]"
|
|
349
|
+
/>
|
|
350
|
+
|
|
351
|
+
<!-- Content (z-10 to sit above pseudo-element layers) -->
|
|
352
|
+
<span
|
|
353
|
+
class="s-glass-button__content relative z-10 flex items-center justify-center gap-2"
|
|
354
|
+
:class="{ 'opacity-0': loading && preserveSize }"
|
|
355
|
+
>
|
|
356
|
+
<!-- Left icon -->
|
|
357
|
+
<template v-if="!loading || preserveSize">
|
|
358
|
+
<slot name="icon-left">
|
|
359
|
+
<span
|
|
360
|
+
v-if="iconLeft"
|
|
361
|
+
:class="['mdi', `mdi-${iconLeft}`, iconSizes]"
|
|
362
|
+
/>
|
|
363
|
+
</slot>
|
|
364
|
+
</template>
|
|
365
|
+
|
|
366
|
+
<!-- Content -->
|
|
367
|
+
<span v-if="!iconOnly && (!loading || preserveSize)">
|
|
368
|
+
<slot />
|
|
369
|
+
</span>
|
|
370
|
+
|
|
371
|
+
<!-- Icon only content -->
|
|
372
|
+
<template v-if="iconOnly && (!loading || preserveSize) && !iconLeft">
|
|
373
|
+
<slot />
|
|
374
|
+
</template>
|
|
375
|
+
|
|
376
|
+
<!-- Right icon -->
|
|
377
|
+
<template v-if="!loading || preserveSize">
|
|
378
|
+
<slot name="icon-right">
|
|
379
|
+
<span
|
|
380
|
+
v-if="iconRight"
|
|
381
|
+
:class="['mdi', `mdi-${iconRight}`, iconSizes]"
|
|
382
|
+
/>
|
|
383
|
+
</slot>
|
|
384
|
+
</template>
|
|
385
|
+
</span>
|
|
386
|
+
|
|
387
|
+
<!-- Animate slot content -->
|
|
388
|
+
<span
|
|
389
|
+
v-if="hasAnimateSlot"
|
|
390
|
+
class="s-glass-button__animate relative z-10 flex items-center justify-center gap-2"
|
|
391
|
+
:class="[`s-glass-button__animate--${animationType}`]"
|
|
392
|
+
>
|
|
393
|
+
<slot name="animate" />
|
|
394
|
+
</span>
|
|
395
|
+
</component>
|
|
396
|
+
</template>
|
|
397
|
+
|
|
398
|
+
<style scoped>
|
|
399
|
+
/* === BASE GLASS SURFACE === */
|
|
400
|
+
.s-glass-button {
|
|
401
|
+
background-color: var(--glass-bg);
|
|
402
|
+
color: var(--glass-text);
|
|
403
|
+
box-shadow: var(--glass-shadow-outer);
|
|
404
|
+
transition: background-color 0.2s ease-out,
|
|
405
|
+
box-shadow 0.2s ease-out,
|
|
406
|
+
transform 0.2s ease-out;
|
|
407
|
+
isolation: isolate;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/* === INNER GLOW + SPECULAR HIGHLIGHT === */
|
|
411
|
+
.s-glass-button::before {
|
|
412
|
+
content: '';
|
|
413
|
+
position: absolute;
|
|
414
|
+
inset: 0;
|
|
415
|
+
border-radius: inherit;
|
|
416
|
+
box-shadow: inset 2px 2px 0px -2px var(--glass-glow),
|
|
417
|
+
inset 0 0 3px 1px var(--glass-glow);
|
|
418
|
+
background: linear-gradient(
|
|
419
|
+
180deg,
|
|
420
|
+
rgba(255, 255, 255, var(--glass-highlight)) 0%,
|
|
421
|
+
transparent 50%
|
|
422
|
+
);
|
|
423
|
+
pointer-events: none;
|
|
424
|
+
z-index: 1;
|
|
425
|
+
transition: opacity 0.2s ease-out;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/* === GLASS REFRACTION + BLUR (backdrop layer) === */
|
|
429
|
+
.s-glass-button::after {
|
|
430
|
+
content: '';
|
|
431
|
+
position: absolute;
|
|
432
|
+
inset: 0;
|
|
433
|
+
border-radius: inherit;
|
|
434
|
+
z-index: -1;
|
|
435
|
+
backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation));
|
|
436
|
+
-webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation));
|
|
437
|
+
filter: url(#s-glass-refract);
|
|
438
|
+
overflow: hidden;
|
|
439
|
+
isolation: isolate;
|
|
440
|
+
pointer-events: none;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
/* === HOVER === */
|
|
444
|
+
.s-glass-button:not(:disabled):not(.s-glass-button--loading):hover {
|
|
445
|
+
background-color: var(--glass-bg-hover);
|
|
446
|
+
box-shadow: var(--glass-shadow-hover);
|
|
447
|
+
transform: translateY(-1px);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/* === ACTIVE === */
|
|
451
|
+
.s-glass-button:not(:disabled):not(.s-glass-button--loading):active {
|
|
452
|
+
transform: scale(0.98) translateY(0);
|
|
453
|
+
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
/* === FOCUS VISIBLE === */
|
|
457
|
+
.s-glass-button:focus-visible {
|
|
458
|
+
outline: none;
|
|
459
|
+
box-shadow:
|
|
460
|
+
0 0 0 2px rgba(255, 255, 255, 0.3),
|
|
461
|
+
0 0 0 4px var(--s-primary),
|
|
462
|
+
var(--glass-shadow-outer);
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
/* === GLASS RIPPLE === */
|
|
466
|
+
@keyframes glass-ripple {
|
|
467
|
+
0% {
|
|
468
|
+
transform: scale(0);
|
|
469
|
+
opacity: 0.4;
|
|
470
|
+
}
|
|
471
|
+
100% {
|
|
472
|
+
transform: scale(1);
|
|
473
|
+
opacity: 0;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
.animate-glass-ripple {
|
|
478
|
+
animation: glass-ripple 0.7s ease-out forwards;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
/* === CONTENT === */
|
|
482
|
+
.s-glass-button__content {
|
|
483
|
+
transition: transform 0.3s ease, opacity 0.3s ease;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
/* === ANIMATE SLOT === */
|
|
487
|
+
.s-glass-button__animate {
|
|
488
|
+
position: absolute;
|
|
489
|
+
width: 100%;
|
|
490
|
+
height: 100%;
|
|
491
|
+
top: 0;
|
|
492
|
+
left: 0;
|
|
493
|
+
pointer-events: none;
|
|
494
|
+
transition: transform 0.3s ease, opacity 0.3s ease;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
/* Slide animation */
|
|
498
|
+
.s-glass-button__animate--slide {
|
|
499
|
+
transform: translateX(100%);
|
|
500
|
+
}
|
|
501
|
+
.s-glass-button--animate-slide:hover .s-glass-button__content {
|
|
502
|
+
transform: translateX(-100%);
|
|
503
|
+
}
|
|
504
|
+
.s-glass-button--animate-slide:hover .s-glass-button__animate--slide {
|
|
505
|
+
transform: translateX(0);
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
/* Vertical animation */
|
|
509
|
+
.s-glass-button__animate--vertical {
|
|
510
|
+
transform: translateY(100%);
|
|
511
|
+
}
|
|
512
|
+
.s-glass-button--animate-vertical:hover .s-glass-button__content {
|
|
513
|
+
transform: translateY(-100%);
|
|
514
|
+
opacity: 0;
|
|
515
|
+
}
|
|
516
|
+
.s-glass-button--animate-vertical:hover .s-glass-button__animate--vertical {
|
|
517
|
+
transform: translateY(0);
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
/* Scale animation */
|
|
521
|
+
.s-glass-button__animate--scale {
|
|
522
|
+
transform: scale(0.5);
|
|
523
|
+
opacity: 0;
|
|
524
|
+
}
|
|
525
|
+
.s-glass-button--animate-scale:hover .s-glass-button__content {
|
|
526
|
+
transform: scale(1.4);
|
|
527
|
+
opacity: 0;
|
|
528
|
+
}
|
|
529
|
+
.s-glass-button--animate-scale:hover .s-glass-button__animate--scale {
|
|
530
|
+
transform: scale(1);
|
|
531
|
+
opacity: 1;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
/* Rotate animation */
|
|
535
|
+
.s-glass-button__animate--rotate {
|
|
536
|
+
transform: rotate(-180deg);
|
|
537
|
+
opacity: 0;
|
|
538
|
+
}
|
|
539
|
+
.s-glass-button--animate-rotate:hover .s-glass-button__content {
|
|
540
|
+
transform: rotate(180deg);
|
|
541
|
+
opacity: 0;
|
|
542
|
+
}
|
|
543
|
+
.s-glass-button--animate-rotate:hover .s-glass-button__animate--rotate {
|
|
544
|
+
transform: rotate(0);
|
|
545
|
+
opacity: 1;
|
|
546
|
+
}
|
|
547
|
+
</style>
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, type CSSProperties, type Component } from 'vue'
|
|
3
|
+
import { cn } from '../../lib/utils'
|
|
4
|
+
|
|
5
|
+
defineOptions({ inheritAttrs: false })
|
|
6
|
+
|
|
7
|
+
export interface Props {
|
|
8
|
+
component?: Component
|
|
9
|
+
size?: number | string
|
|
10
|
+
color?: string
|
|
11
|
+
depth?: 1 | 2 | 3 | 4 | 5
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
15
|
+
component: undefined,
|
|
16
|
+
size: 24,
|
|
17
|
+
color: undefined,
|
|
18
|
+
depth: undefined
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
const computedStyle = computed<CSSProperties>(() => {
|
|
22
|
+
const style: CSSProperties = {}
|
|
23
|
+
|
|
24
|
+
// Handle size
|
|
25
|
+
if (props.size !== undefined) {
|
|
26
|
+
const sizeVal = typeof props.size === 'number' ? `${props.size}px` : props.size
|
|
27
|
+
style.fontSize = sizeVal
|
|
28
|
+
style.width = sizeVal
|
|
29
|
+
style.height = sizeVal
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Handle color
|
|
33
|
+
if (props.color) {
|
|
34
|
+
style.color = props.color
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Handle depth (opacity)
|
|
38
|
+
if (props.depth) {
|
|
39
|
+
const opacityMap: Record<number, string> = {
|
|
40
|
+
1: '1',
|
|
41
|
+
2: '0.82',
|
|
42
|
+
3: '0.6',
|
|
43
|
+
4: '0.38',
|
|
44
|
+
5: '0.18'
|
|
45
|
+
}
|
|
46
|
+
style.opacity = opacityMap[props.depth] || '1'
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return style
|
|
50
|
+
})
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<template>
|
|
54
|
+
<i
|
|
55
|
+
:class="cn('inline-flex items-center justify-center align-middle leading-none', ($attrs as any).class)"
|
|
56
|
+
:style="computedStyle"
|
|
57
|
+
role="img"
|
|
58
|
+
v-bind="{ ...$attrs, class: undefined }"
|
|
59
|
+
>
|
|
60
|
+
<component :is="component" v-if="component" />
|
|
61
|
+
<slot v-else />
|
|
62
|
+
</i>
|
|
63
|
+
</template>
|
|
64
|
+
|
|
65
|
+
<style scoped>
|
|
66
|
+
/* Ensure svg children scale correctly */
|
|
67
|
+
.inline-flex :deep(svg) {
|
|
68
|
+
width: 1em;
|
|
69
|
+
height: 1em;
|
|
70
|
+
fill: currentColor;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* Ensure font icons inherit size */
|
|
74
|
+
.inline-flex :deep(i),
|
|
75
|
+
.inline-flex :deep(span) {
|
|
76
|
+
font-size: inherit;
|
|
77
|
+
}
|
|
78
|
+
</style>
|