@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,87 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { inject } from 'vue'
|
|
3
|
+
import { SColorPickerContextKey, type SColorPickerContext } from './SColorPicker.vue'
|
|
4
|
+
|
|
5
|
+
export interface Props {
|
|
6
|
+
presets?: string[]
|
|
7
|
+
label?: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
11
|
+
presets: () => [
|
|
12
|
+
'#ef4444', '#f97316', '#f59e0b', '#eab308', '#84cc16', '#22c55e',
|
|
13
|
+
'#10b981', '#14b8a6', '#06b6d4', '#0ea5e9', '#3b82f6', '#6366f1',
|
|
14
|
+
'#8b5cf6', '#a855f7', '#d946ef', '#ec4899', '#f43f5e', '#000000',
|
|
15
|
+
'#ffffff', '#6b7280'
|
|
16
|
+
],
|
|
17
|
+
label: 'Presets'
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
const ctx = inject<SColorPickerContext>(SColorPickerContextKey)
|
|
21
|
+
if (!ctx) console.warn('[SColorPickerPresets] Must be used inside SColorPicker')
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<template>
|
|
25
|
+
<div v-if="ctx && presets.length" class="s-color-picker__presets">
|
|
26
|
+
<div class="s-color-picker__presets-label">{{ label }}</div>
|
|
27
|
+
<div class="s-color-picker__swatches">
|
|
28
|
+
<button
|
|
29
|
+
v-for="color in presets"
|
|
30
|
+
:key="color"
|
|
31
|
+
type="button"
|
|
32
|
+
class="s-color-picker__swatch"
|
|
33
|
+
:class="[ctx.sizeConfig.value?.swatch, { 's-color-picker__swatch--active': ctx.currentHex.value.toUpperCase() === color.toUpperCase() }]"
|
|
34
|
+
:style="{ backgroundColor: color }"
|
|
35
|
+
:title="color"
|
|
36
|
+
:disabled="ctx.disabled.value || ctx.readonly.value"
|
|
37
|
+
@click="ctx.selectPreset(color)"
|
|
38
|
+
></button>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<style scoped>
|
|
44
|
+
.s-color-picker__presets {
|
|
45
|
+
display: flex;
|
|
46
|
+
flex-direction: column;
|
|
47
|
+
gap: 0.5rem;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.s-color-picker__presets-label {
|
|
51
|
+
font-size: 0.625rem;
|
|
52
|
+
font-weight: 600;
|
|
53
|
+
color: var(--s-muted-foreground);
|
|
54
|
+
text-transform: uppercase;
|
|
55
|
+
letter-spacing: 0.05em;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.s-color-picker__swatches {
|
|
59
|
+
display: flex;
|
|
60
|
+
flex-wrap: wrap;
|
|
61
|
+
gap: 0.375rem;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.s-color-picker__swatch {
|
|
65
|
+
border-radius: 0.375rem;
|
|
66
|
+
border: 2px solid transparent;
|
|
67
|
+
cursor: pointer;
|
|
68
|
+
transition: all 0.15s ease;
|
|
69
|
+
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.s-color-picker__swatch:hover:not(:disabled) {
|
|
73
|
+
transform: scale(1.15);
|
|
74
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.s-color-picker__swatch--active {
|
|
78
|
+
border-color: var(--s-primary);
|
|
79
|
+
box-shadow: 0 0 0 2px color-mix(in srgb, var(--s-primary) 15%, transparent);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@media (max-width: 400px) {
|
|
83
|
+
.s-color-picker__swatches {
|
|
84
|
+
justify-content: flex-start;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
</style>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, inject } from 'vue'
|
|
3
|
+
import { SColorPickerContextKey, type SColorPickerContext } from './SColorPicker.vue'
|
|
4
|
+
|
|
5
|
+
const ctx = inject<SColorPickerContext>(SColorPickerContextKey)
|
|
6
|
+
if (!ctx) console.warn('[SColorPickerPreview] Must be used inside SColorPicker')
|
|
7
|
+
|
|
8
|
+
const bgColor = computed(() => {
|
|
9
|
+
if (!ctx) return '#000'
|
|
10
|
+
if (ctx.showAlpha.value) {
|
|
11
|
+
const { r, g, b } = ctx.currentRgb.value
|
|
12
|
+
return `rgba(${r}, ${g}, ${b}, ${ctx.hsva.value.a})`
|
|
13
|
+
}
|
|
14
|
+
return ctx.currentHex.value
|
|
15
|
+
})
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
<div class="s-color-picker__preview">
|
|
20
|
+
<div
|
|
21
|
+
class="s-color-picker__preview-color"
|
|
22
|
+
:style="{ backgroundColor: bgColor }"
|
|
23
|
+
></div>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<style scoped>
|
|
28
|
+
.s-color-picker__preview {
|
|
29
|
+
flex: 1;
|
|
30
|
+
height: 2.5rem;
|
|
31
|
+
border-radius: 0.5rem;
|
|
32
|
+
overflow: hidden;
|
|
33
|
+
border: 1px solid var(--s-border);
|
|
34
|
+
background-image: linear-gradient(45deg, #ccc 25%, transparent 25%),
|
|
35
|
+
linear-gradient(-45deg, #ccc 25%, transparent 25%),
|
|
36
|
+
linear-gradient(45deg, transparent 75%, #ccc 75%),
|
|
37
|
+
linear-gradient(-45deg, transparent 75%, #ccc 75%);
|
|
38
|
+
background-size: 10px 10px;
|
|
39
|
+
background-position: 0 0, 0 5px, 5px -5px, -5px 0px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.s-color-picker__preview-color {
|
|
43
|
+
width: 100%;
|
|
44
|
+
height: 100%;
|
|
45
|
+
}
|
|
46
|
+
</style>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { inject } from 'vue'
|
|
3
|
+
import { SColorPickerContextKey, type SColorPickerContext } from './SColorPicker.vue'
|
|
4
|
+
|
|
5
|
+
export interface Props {
|
|
6
|
+
label?: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
10
|
+
label: 'Recent'
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
const ctx = inject<SColorPickerContext>(SColorPickerContextKey)
|
|
14
|
+
if (!ctx) console.warn('[SColorPickerRecent] Must be used inside SColorPicker')
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<div v-if="ctx && ctx.recentColors.value.length" class="s-color-picker__recent">
|
|
19
|
+
<div class="s-color-picker__presets-label">{{ label }}</div>
|
|
20
|
+
<div class="s-color-picker__swatches">
|
|
21
|
+
<button
|
|
22
|
+
v-for="color in ctx.recentColors.value"
|
|
23
|
+
:key="color"
|
|
24
|
+
type="button"
|
|
25
|
+
class="s-color-picker__swatch"
|
|
26
|
+
:class="[ctx.sizeConfig.value?.swatch, { 's-color-picker__swatch--active': ctx.currentHex.value.toUpperCase() === color.toUpperCase() }]"
|
|
27
|
+
:style="{ backgroundColor: color }"
|
|
28
|
+
:title="color"
|
|
29
|
+
:disabled="ctx.disabled.value || ctx.readonly.value"
|
|
30
|
+
@click="ctx.selectPreset(color)"
|
|
31
|
+
></button>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<style scoped>
|
|
37
|
+
.s-color-picker__recent {
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-direction: column;
|
|
40
|
+
gap: 0.5rem;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.s-color-picker__presets-label {
|
|
44
|
+
font-size: 0.625rem;
|
|
45
|
+
font-weight: 600;
|
|
46
|
+
color: var(--s-muted-foreground);
|
|
47
|
+
text-transform: uppercase;
|
|
48
|
+
letter-spacing: 0.05em;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.s-color-picker__swatches {
|
|
52
|
+
display: flex;
|
|
53
|
+
flex-wrap: wrap;
|
|
54
|
+
gap: 0.375rem;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.s-color-picker__swatch {
|
|
58
|
+
border-radius: 0.375rem;
|
|
59
|
+
border: 2px solid transparent;
|
|
60
|
+
cursor: pointer;
|
|
61
|
+
transition: all 0.15s ease;
|
|
62
|
+
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.s-color-picker__swatch:hover:not(:disabled) {
|
|
66
|
+
transform: scale(1.15);
|
|
67
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.s-color-picker__swatch--active {
|
|
71
|
+
border-color: var(--s-primary);
|
|
72
|
+
box-shadow: 0 0 0 2px color-mix(in srgb, var(--s-primary) 15%, transparent);
|
|
73
|
+
}
|
|
74
|
+
</style>
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref, computed, inject, onBeforeUnmount } from 'vue'
|
|
3
|
+
import { SColorPickerContextKey, type SColorPickerContext } from './SColorPicker.vue'
|
|
4
|
+
|
|
5
|
+
const ctx = inject<SColorPickerContext>(SColorPickerContextKey)
|
|
6
|
+
if (!ctx) console.warn('[SColorPickerSpectrum] Must be used inside SColorPicker')
|
|
7
|
+
|
|
8
|
+
const spectrumRef = ref<HTMLElement | null>(null)
|
|
9
|
+
const isDragging = ref(false)
|
|
10
|
+
|
|
11
|
+
const hueColor = computed(() => {
|
|
12
|
+
if (!ctx) return 'rgb(0,0,0)'
|
|
13
|
+
const rgb = ctx.hsvToRgb(ctx.hsva.value.h, 100, 100)
|
|
14
|
+
return `rgb(${rgb.r}, ${rgb.g}, ${rgb.b})`
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
const spectrumStyle = computed(() => ({
|
|
18
|
+
background: `linear-gradient(to top, #000, transparent),
|
|
19
|
+
linear-gradient(to right, #fff, ${hueColor.value})`
|
|
20
|
+
}))
|
|
21
|
+
|
|
22
|
+
const cursorPosition = computed(() => ({
|
|
23
|
+
left: `${ctx?.hsva.value.s ?? 0}%`,
|
|
24
|
+
top: `${100 - (ctx?.hsva.value.v ?? 0)}%`
|
|
25
|
+
}))
|
|
26
|
+
|
|
27
|
+
function updateFromEvent(event: MouseEvent) {
|
|
28
|
+
if (!spectrumRef.value || !ctx) return
|
|
29
|
+
const rect = spectrumRef.value.getBoundingClientRect()
|
|
30
|
+
const x = Math.max(0, Math.min(event.clientX - rect.left, rect.width))
|
|
31
|
+
const y = Math.max(0, Math.min(event.clientY - rect.top, rect.height))
|
|
32
|
+
ctx.hsva.value.s = (x / rect.width) * 100
|
|
33
|
+
ctx.hsva.value.v = 100 - (y / rect.height) * 100
|
|
34
|
+
ctx.emitInput()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function updateFromTouch(event: TouchEvent) {
|
|
38
|
+
if (!spectrumRef.value || !ctx || !event.touches[0]) return
|
|
39
|
+
const rect = spectrumRef.value.getBoundingClientRect()
|
|
40
|
+
const x = Math.max(0, Math.min(event.touches[0].clientX - rect.left, rect.width))
|
|
41
|
+
const y = Math.max(0, Math.min(event.touches[0].clientY - rect.top, rect.height))
|
|
42
|
+
ctx.hsva.value.s = (x / rect.width) * 100
|
|
43
|
+
ctx.hsva.value.v = 100 - (y / rect.height) * 100
|
|
44
|
+
ctx.emitInput()
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function onMouseDown(event: MouseEvent) {
|
|
48
|
+
if (ctx?.disabled.value || ctx?.readonly.value) return
|
|
49
|
+
isDragging.value = true
|
|
50
|
+
updateFromEvent(event)
|
|
51
|
+
document.addEventListener('mousemove', onMouseMove)
|
|
52
|
+
document.addEventListener('mouseup', onMouseUp)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function onTouchStart(event: TouchEvent) {
|
|
56
|
+
if (ctx?.disabled.value || ctx?.readonly.value) return
|
|
57
|
+
event.preventDefault()
|
|
58
|
+
isDragging.value = true
|
|
59
|
+
updateFromTouch(event)
|
|
60
|
+
document.addEventListener('touchmove', onTouchMove, { passive: false })
|
|
61
|
+
document.addEventListener('touchend', onTouchEnd)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function onMouseMove(event: MouseEvent) {
|
|
65
|
+
if (!isDragging.value) return
|
|
66
|
+
updateFromEvent(event)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function onTouchMove(event: TouchEvent) {
|
|
70
|
+
if (!isDragging.value) return
|
|
71
|
+
event.preventDefault()
|
|
72
|
+
updateFromTouch(event)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function onMouseUp() {
|
|
76
|
+
isDragging.value = false
|
|
77
|
+
document.removeEventListener('mousemove', onMouseMove)
|
|
78
|
+
document.removeEventListener('mouseup', onMouseUp)
|
|
79
|
+
ctx?.emitChange()
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function onTouchEnd() {
|
|
83
|
+
isDragging.value = false
|
|
84
|
+
document.removeEventListener('touchmove', onTouchMove)
|
|
85
|
+
document.removeEventListener('touchend', onTouchEnd)
|
|
86
|
+
ctx?.emitChange()
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
onBeforeUnmount(() => {
|
|
90
|
+
document.removeEventListener('mousemove', onMouseMove)
|
|
91
|
+
document.removeEventListener('mouseup', onMouseUp)
|
|
92
|
+
document.removeEventListener('touchmove', onTouchMove)
|
|
93
|
+
document.removeEventListener('touchend', onTouchEnd)
|
|
94
|
+
})
|
|
95
|
+
</script>
|
|
96
|
+
|
|
97
|
+
<template>
|
|
98
|
+
<div
|
|
99
|
+
ref="spectrumRef"
|
|
100
|
+
class="s-color-picker__spectrum w-full"
|
|
101
|
+
:class="ctx?.sizeConfig.value?.spectrumHeight"
|
|
102
|
+
:style="spectrumStyle"
|
|
103
|
+
@mousedown="onMouseDown"
|
|
104
|
+
@touchstart="onTouchStart"
|
|
105
|
+
>
|
|
106
|
+
<div
|
|
107
|
+
class="s-color-picker__spectrum-cursor"
|
|
108
|
+
:class="{ 's-color-picker__spectrum-cursor--dragging': isDragging }"
|
|
109
|
+
:style="cursorPosition"
|
|
110
|
+
>
|
|
111
|
+
<div class="s-color-picker__spectrum-cursor-inner" :style="{ backgroundColor: ctx?.currentHex.value }"></div>
|
|
112
|
+
</div>
|
|
113
|
+
</div>
|
|
114
|
+
</template>
|
|
115
|
+
|
|
116
|
+
<style scoped>
|
|
117
|
+
.s-color-picker__spectrum {
|
|
118
|
+
position: relative;
|
|
119
|
+
border-radius: 0.75rem;
|
|
120
|
+
cursor: crosshair;
|
|
121
|
+
overflow: hidden;
|
|
122
|
+
box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
123
|
+
touch-action: none;
|
|
124
|
+
user-select: none;
|
|
125
|
+
-webkit-user-select: none;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.s-color-picker__spectrum-cursor {
|
|
129
|
+
position: absolute;
|
|
130
|
+
width: 1.25rem;
|
|
131
|
+
height: 1.25rem;
|
|
132
|
+
transform: translate(-50%, -50%);
|
|
133
|
+
pointer-events: none;
|
|
134
|
+
transition: transform 0.1s ease;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.s-color-picker__spectrum-cursor--dragging {
|
|
138
|
+
transform: translate(-50%, -50%) scale(1.2);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.s-color-picker__spectrum-cursor-inner {
|
|
142
|
+
width: 100%;
|
|
143
|
+
height: 100%;
|
|
144
|
+
border-radius: 50%;
|
|
145
|
+
border: 3px solid white;
|
|
146
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3),
|
|
147
|
+
inset 0 0 0 1px rgba(0, 0, 0, 0.1);
|
|
148
|
+
}
|
|
149
|
+
</style>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { default as SColorPicker } from './SColorPicker.vue'
|
|
2
|
+
export { default as SColorPickerSpectrum } from './SColorPickerSpectrum.vue'
|
|
3
|
+
export { default as SColorPickerHueSlider } from './SColorPickerHueSlider.vue'
|
|
4
|
+
export { default as SColorPickerAlphaSlider } from './SColorPickerAlphaSlider.vue'
|
|
5
|
+
export { default as SColorPickerPreview } from './SColorPickerPreview.vue'
|
|
6
|
+
export { default as SColorPickerEyeDropper } from './SColorPickerEyeDropper.vue'
|
|
7
|
+
export { default as SColorPickerCopy } from './SColorPickerCopy.vue'
|
|
8
|
+
export { default as SColorPickerInputs } from './SColorPickerInputs.vue'
|
|
9
|
+
export { default as SColorPickerPresets } from './SColorPickerPresets.vue'
|
|
10
|
+
export { default as SColorPickerRecent } from './SColorPickerRecent.vue'
|
|
11
|
+
export { SColorPickerContextKey, type SColorPickerContext } from './SColorPicker.vue'
|