@beautinique/frontend-components 1.0.8 → 1.0.9
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 +225 -16
- package/dist/auth/SocialAuth.d.cts +33 -0
- package/dist/auth/SocialAuth.d.cts.map +1 -0
- package/dist/auth/SocialAuth.d.ts +33 -0
- package/dist/auth/SocialAuth.d.ts.map +1 -0
- package/dist/auth/index.cjs +34 -26
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.d.cts +1 -0
- package/dist/auth/index.d.cts.map +1 -1
- package/dist/auth/index.d.ts +1 -0
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +32 -25
- package/dist/auth/index.js.map +1 -1
- package/dist/breadcrumb/Breadcrumb.d.cts +34 -0
- package/dist/breadcrumb/Breadcrumb.d.cts.map +1 -0
- package/dist/breadcrumb/Breadcrumb.d.ts +34 -0
- package/dist/breadcrumb/Breadcrumb.d.ts.map +1 -0
- package/dist/breadcrumb/breadcrumb-icons.d.cts +6 -0
- package/dist/breadcrumb/breadcrumb-icons.d.cts.map +1 -0
- package/dist/breadcrumb/breadcrumb-icons.d.ts +6 -0
- package/dist/breadcrumb/breadcrumb-icons.d.ts.map +1 -0
- package/dist/breadcrumb/getBreadcrumbItems.d.cts +16 -0
- package/dist/breadcrumb/getBreadcrumbItems.d.cts.map +1 -0
- package/dist/breadcrumb/getBreadcrumbItems.d.ts +16 -0
- package/dist/breadcrumb/getBreadcrumbItems.d.ts.map +1 -0
- package/dist/breadcrumb/index.cjs +110 -0
- package/dist/breadcrumb/index.cjs.map +1 -0
- package/dist/breadcrumb/index.d.cts +3 -0
- package/dist/breadcrumb/index.d.cts.map +1 -0
- package/dist/breadcrumb/index.d.ts +3 -0
- package/dist/breadcrumb/index.d.ts.map +1 -0
- package/dist/breadcrumb/index.js +107 -0
- package/dist/breadcrumb/index.js.map +1 -0
- package/dist/color-input/ColorInput.d.cts +33 -0
- package/dist/color-input/ColorInput.d.cts.map +1 -0
- package/dist/color-input/ColorInput.d.ts +33 -0
- package/dist/color-input/ColorInput.d.ts.map +1 -0
- package/dist/color-input/color-input-icons.d.cts +6 -0
- package/dist/color-input/color-input-icons.d.cts.map +1 -0
- package/dist/color-input/color-input-icons.d.ts +6 -0
- package/dist/color-input/color-input-icons.d.ts.map +1 -0
- package/dist/color-input/color.d.cts +10 -0
- package/dist/color-input/color.d.cts.map +1 -0
- package/dist/color-input/color.d.ts +10 -0
- package/dist/color-input/color.d.ts.map +1 -0
- package/dist/color-input/index.cjs +375 -0
- package/dist/color-input/index.cjs.map +1 -0
- package/dist/color-input/index.d.cts +2 -0
- package/dist/color-input/index.d.cts.map +1 -0
- package/dist/color-input/index.d.ts +2 -0
- package/dist/color-input/index.d.ts.map +1 -0
- package/dist/color-input/index.js +373 -0
- package/dist/color-input/index.js.map +1 -0
- package/dist/file-input/FileInput.d.cts +53 -0
- package/dist/file-input/FileInput.d.cts.map +1 -0
- package/dist/file-input/FileInput.d.ts +53 -0
- package/dist/file-input/FileInput.d.ts.map +1 -0
- package/dist/file-input/file-input-icons.d.cts +6 -0
- package/dist/file-input/file-input-icons.d.cts.map +1 -0
- package/dist/file-input/file-input-icons.d.ts +6 -0
- package/dist/file-input/file-input-icons.d.ts.map +1 -0
- package/dist/file-input/index.cjs +259 -0
- package/dist/file-input/index.cjs.map +1 -0
- package/dist/file-input/index.d.cts +3 -0
- package/dist/file-input/index.d.cts.map +1 -0
- package/dist/file-input/index.d.ts +3 -0
- package/dist/file-input/index.d.ts.map +1 -0
- package/dist/file-input/index.js +256 -0
- package/dist/file-input/index.js.map +1 -0
- package/dist/file-input/media-type.d.cts +8 -0
- package/dist/file-input/media-type.d.cts.map +1 -0
- package/dist/file-input/media-type.d.ts +8 -0
- package/dist/file-input/media-type.d.ts.map +1 -0
- package/dist/file-input/useObjectUrls.d.cts +10 -0
- package/dist/file-input/useObjectUrls.d.cts.map +1 -0
- package/dist/file-input/useObjectUrls.d.ts +10 -0
- package/dist/file-input/useObjectUrls.d.ts.map +1 -0
- package/dist/hierarchy-select/HierarchySelect.d.cts +58 -0
- package/dist/hierarchy-select/HierarchySelect.d.cts.map +1 -0
- package/dist/hierarchy-select/HierarchySelect.d.ts +58 -0
- package/dist/hierarchy-select/HierarchySelect.d.ts.map +1 -0
- package/dist/hierarchy-select/hierarchy-select-icons.d.cts +6 -0
- package/dist/hierarchy-select/hierarchy-select-icons.d.cts.map +1 -0
- package/dist/hierarchy-select/hierarchy-select-icons.d.ts +6 -0
- package/dist/hierarchy-select/hierarchy-select-icons.d.ts.map +1 -0
- package/dist/hierarchy-select/index.cjs +596 -0
- package/dist/hierarchy-select/index.cjs.map +1 -0
- package/dist/hierarchy-select/index.d.cts +2 -0
- package/dist/hierarchy-select/index.d.cts.map +1 -0
- package/dist/hierarchy-select/index.d.ts +2 -0
- package/dist/hierarchy-select/index.d.ts.map +1 -0
- package/dist/hierarchy-select/index.js +594 -0
- package/dist/hierarchy-select/index.js.map +1 -0
- package/dist/hierarchy-select/tree.d.cts +38 -0
- package/dist/hierarchy-select/tree.d.cts.map +1 -0
- package/dist/hierarchy-select/tree.d.ts +38 -0
- package/dist/hierarchy-select/tree.d.ts.map +1 -0
- package/dist/index.cjs +7 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/inputs/Checkbox.d.cts +21 -0
- package/dist/inputs/Checkbox.d.cts.map +1 -0
- package/dist/inputs/Checkbox.d.ts +21 -0
- package/dist/inputs/Checkbox.d.ts.map +1 -0
- package/dist/inputs/Input.d.cts +26 -0
- package/dist/inputs/Input.d.cts.map +1 -0
- package/dist/inputs/Input.d.ts +26 -0
- package/dist/inputs/Input.d.ts.map +1 -0
- package/dist/inputs/InputError.d.cts +11 -0
- package/dist/inputs/InputError.d.cts.map +1 -0
- package/dist/inputs/InputError.d.ts +11 -0
- package/dist/inputs/InputError.d.ts.map +1 -0
- package/dist/inputs/InputIcon.d.cts +9 -0
- package/dist/inputs/InputIcon.d.cts.map +1 -0
- package/dist/inputs/InputIcon.d.ts +9 -0
- package/dist/inputs/InputIcon.d.ts.map +1 -0
- package/dist/inputs/InputLabel.d.cts +8 -0
- package/dist/inputs/InputLabel.d.cts.map +1 -0
- package/dist/inputs/InputLabel.d.ts +8 -0
- package/dist/inputs/InputLabel.d.ts.map +1 -0
- package/dist/inputs/Radio.d.cts +25 -0
- package/dist/inputs/Radio.d.cts.map +1 -0
- package/dist/inputs/Radio.d.ts +25 -0
- package/dist/inputs/Radio.d.ts.map +1 -0
- package/dist/inputs/Select.d.cts +53 -0
- package/dist/inputs/Select.d.cts.map +1 -0
- package/dist/inputs/Select.d.ts +53 -0
- package/dist/inputs/Select.d.ts.map +1 -0
- package/dist/inputs/Textarea.d.cts +19 -0
- package/dist/inputs/Textarea.d.cts.map +1 -0
- package/dist/inputs/Textarea.d.ts +19 -0
- package/dist/inputs/Textarea.d.ts.map +1 -0
- package/dist/inputs/index.cjs +746 -0
- package/dist/inputs/index.cjs.map +1 -0
- package/dist/inputs/index.d.cts +10 -0
- package/dist/inputs/index.d.cts.map +1 -0
- package/dist/inputs/index.d.ts +10 -0
- package/dist/inputs/index.d.ts.map +1 -0
- package/dist/inputs/index.js +737 -0
- package/dist/inputs/index.js.map +1 -0
- package/dist/inputs/inputs-icons.d.cts +6 -0
- package/dist/inputs/inputs-icons.d.cts.map +1 -0
- package/dist/inputs/inputs-icons.d.ts +6 -0
- package/dist/inputs/inputs-icons.d.ts.map +1 -0
- package/dist/inputs/types.d.cts +48 -0
- package/dist/inputs/types.d.cts.map +1 -0
- package/dist/inputs/types.d.ts +48 -0
- package/dist/inputs/types.d.ts.map +1 -0
- package/dist/inputs/useFieldIds.d.cts +24 -0
- package/dist/inputs/useFieldIds.d.cts.map +1 -0
- package/dist/inputs/useFieldIds.d.ts +24 -0
- package/dist/inputs/useFieldIds.d.ts.map +1 -0
- package/dist/layout/ApiStatus.d.cts +20 -0
- package/dist/layout/ApiStatus.d.cts.map +1 -0
- package/dist/layout/ApiStatus.d.ts +20 -0
- package/dist/layout/ApiStatus.d.ts.map +1 -0
- package/dist/layout/BorderGradient.d.cts +11 -0
- package/dist/layout/BorderGradient.d.cts.map +1 -0
- package/dist/layout/BorderGradient.d.ts +11 -0
- package/dist/layout/BorderGradient.d.ts.map +1 -0
- package/dist/layout/ConfirmModal.d.cts +44 -0
- package/dist/layout/ConfirmModal.d.cts.map +1 -0
- package/dist/layout/ConfirmModal.d.ts +44 -0
- package/dist/layout/ConfirmModal.d.ts.map +1 -0
- package/dist/layout/Dropdown.d.cts +33 -0
- package/dist/layout/Dropdown.d.cts.map +1 -0
- package/dist/layout/Dropdown.d.ts +33 -0
- package/dist/layout/Dropdown.d.ts.map +1 -0
- package/dist/layout/LoadingPage.d.cts +11 -0
- package/dist/layout/LoadingPage.d.cts.map +1 -0
- package/dist/layout/LoadingPage.d.ts +11 -0
- package/dist/layout/LoadingPage.d.ts.map +1 -0
- package/dist/layout/LoadingRings.d.cts +12 -0
- package/dist/layout/LoadingRings.d.cts.map +1 -0
- package/dist/layout/LoadingRings.d.ts +12 -0
- package/dist/layout/LoadingRings.d.ts.map +1 -0
- package/dist/layout/LoadingText.d.cts +13 -0
- package/dist/layout/LoadingText.d.cts.map +1 -0
- package/dist/layout/LoadingText.d.ts +13 -0
- package/dist/layout/LoadingText.d.ts.map +1 -0
- package/dist/layout/ModalWrapper.d.cts +48 -0
- package/dist/layout/ModalWrapper.d.cts.map +1 -0
- package/dist/layout/ModalWrapper.d.ts +48 -0
- package/dist/layout/ModalWrapper.d.ts.map +1 -0
- package/dist/layout/NetworkStatusToaster.d.cts +39 -0
- package/dist/layout/NetworkStatusToaster.d.cts.map +1 -0
- package/dist/layout/NetworkStatusToaster.d.ts +39 -0
- package/dist/layout/NetworkStatusToaster.d.ts.map +1 -0
- package/dist/layout/ScrollableGradientContainer.d.cts +28 -0
- package/dist/layout/ScrollableGradientContainer.d.cts.map +1 -0
- package/dist/layout/ScrollableGradientContainer.d.ts +28 -0
- package/dist/layout/ScrollableGradientContainer.d.ts.map +1 -0
- package/dist/layout/Skeleton.d.cts +9 -0
- package/dist/layout/Skeleton.d.cts.map +1 -0
- package/dist/layout/Skeleton.d.ts +9 -0
- package/dist/layout/Skeleton.d.ts.map +1 -0
- package/dist/layout/Table.d.cts +9 -0
- package/dist/layout/Table.d.cts.map +1 -0
- package/dist/layout/Table.d.ts +9 -0
- package/dist/layout/Table.d.ts.map +1 -0
- package/dist/layout/index.cjs +743 -3
- package/dist/layout/index.cjs.map +1 -1
- package/dist/layout/index.d.cts +12 -0
- package/dist/layout/index.d.cts.map +1 -1
- package/dist/layout/index.d.ts +12 -0
- package/dist/layout/index.d.ts.map +1 -1
- package/dist/layout/index.js +724 -2
- package/dist/layout/index.js.map +1 -1
- package/dist/layout/layout-icons.d.cts +6 -0
- package/dist/layout/layout-icons.d.cts.map +1 -0
- package/dist/layout/layout-icons.d.ts +6 -0
- package/dist/layout/layout-icons.d.ts.map +1 -0
- package/dist/lib/dropdown-position.d.cts +33 -0
- package/dist/lib/dropdown-position.d.cts.map +1 -0
- package/dist/lib/dropdown-position.d.ts +33 -0
- package/dist/lib/dropdown-position.d.ts.map +1 -0
- package/dist/lib/focus.d.cts +3 -0
- package/dist/lib/focus.d.cts.map +1 -0
- package/dist/lib/focus.d.ts +3 -0
- package/dist/lib/focus.d.ts.map +1 -0
- package/dist/lib/icon-registry.d.cts +14 -0
- package/dist/lib/icon-registry.d.cts.map +1 -0
- package/dist/lib/icon-registry.d.ts +14 -0
- package/dist/lib/icon-registry.d.ts.map +1 -0
- package/dist/lib/mergeRefs.d.cts +10 -0
- package/dist/lib/mergeRefs.d.cts.map +1 -0
- package/dist/lib/mergeRefs.d.ts +10 -0
- package/dist/lib/mergeRefs.d.ts.map +1 -0
- package/dist/lib/scrollRowIntoView.d.cts +7 -0
- package/dist/lib/scrollRowIntoView.d.cts.map +1 -0
- package/dist/lib/scrollRowIntoView.d.ts +7 -0
- package/dist/lib/scrollRowIntoView.d.ts.map +1 -0
- package/dist/lib/typeahead.d.cts +21 -0
- package/dist/lib/typeahead.d.cts.map +1 -0
- package/dist/lib/typeahead.d.ts +21 -0
- package/dist/lib/typeahead.d.ts.map +1 -0
- package/dist/lib/useAnchoredBox.d.cts +26 -0
- package/dist/lib/useAnchoredBox.d.cts.map +1 -0
- package/dist/lib/useAnchoredBox.d.ts +26 -0
- package/dist/lib/useAnchoredBox.d.ts.map +1 -0
- package/dist/lib/useDismiss.d.cts +34 -0
- package/dist/lib/useDismiss.d.cts.map +1 -0
- package/dist/lib/useDismiss.d.ts +34 -0
- package/dist/lib/useDismiss.d.ts.map +1 -0
- package/dist/lib/useFocusTrap.d.cts +24 -0
- package/dist/lib/useFocusTrap.d.cts.map +1 -0
- package/dist/lib/useFocusTrap.d.ts +24 -0
- package/dist/lib/useFocusTrap.d.ts.map +1 -0
- package/dist/lib/useIsClient.d.cts +7 -0
- package/dist/lib/useIsClient.d.cts.map +1 -0
- package/dist/lib/useIsClient.d.ts +7 -0
- package/dist/lib/useIsClient.d.ts.map +1 -0
- package/dist/lib/usePrefersReducedMotion.d.cts +7 -0
- package/dist/lib/usePrefersReducedMotion.d.cts.map +1 -0
- package/dist/lib/usePrefersReducedMotion.d.ts +7 -0
- package/dist/lib/usePrefersReducedMotion.d.ts.map +1 -0
- package/dist/lib/useScrollLock.d.cts +7 -0
- package/dist/lib/useScrollLock.d.cts.map +1 -0
- package/dist/lib/useScrollLock.d.ts +7 -0
- package/dist/lib/useScrollLock.d.ts.map +1 -0
- package/dist/lib/useScrollable.d.cts +17 -0
- package/dist/lib/useScrollable.d.cts.map +1 -0
- package/dist/lib/useScrollable.d.ts +17 -0
- package/dist/lib/useScrollable.d.ts.map +1 -0
- package/dist/loading-screen/LoadingScreen.d.cts +21 -0
- package/dist/loading-screen/LoadingScreen.d.cts.map +1 -0
- package/dist/loading-screen/LoadingScreen.d.ts +21 -0
- package/dist/loading-screen/LoadingScreen.d.ts.map +1 -0
- package/dist/loading-screen/Teddy.d.cts +10 -0
- package/dist/loading-screen/Teddy.d.cts.map +1 -0
- package/dist/loading-screen/Teddy.d.ts +10 -0
- package/dist/loading-screen/Teddy.d.ts.map +1 -0
- package/dist/loading-screen/WakeUpProgress.d.cts +16 -0
- package/dist/loading-screen/WakeUpProgress.d.cts.map +1 -0
- package/dist/loading-screen/WakeUpProgress.d.ts +16 -0
- package/dist/loading-screen/WakeUpProgress.d.ts.map +1 -0
- package/dist/loading-screen/beauty-facts.d.cts +4 -0
- package/dist/loading-screen/beauty-facts.d.cts.map +1 -0
- package/dist/loading-screen/beauty-facts.d.ts +4 -0
- package/dist/loading-screen/beauty-facts.d.ts.map +1 -0
- package/dist/loading-screen/index.cjs +405 -0
- package/dist/loading-screen/index.cjs.map +1 -0
- package/dist/loading-screen/index.d.cts +5 -0
- package/dist/loading-screen/index.d.cts.map +1 -0
- package/dist/loading-screen/index.d.ts +5 -0
- package/dist/loading-screen/index.d.ts.map +1 -0
- package/dist/loading-screen/index.js +400 -0
- package/dist/loading-screen/index.js.map +1 -0
- package/dist/loading-screen/loading-screen-icons.d.cts +6 -0
- package/dist/loading-screen/loading-screen-icons.d.cts.map +1 -0
- package/dist/loading-screen/loading-screen-icons.d.ts +6 -0
- package/dist/loading-screen/loading-screen-icons.d.ts.map +1 -0
- package/dist/media/MediaCarousel.d.cts +30 -0
- package/dist/media/MediaCarousel.d.cts.map +1 -0
- package/dist/media/MediaCarousel.d.ts +30 -0
- package/dist/media/MediaCarousel.d.ts.map +1 -0
- package/dist/media/MediaCarouselWithModal.d.cts +17 -0
- package/dist/media/MediaCarouselWithModal.d.cts.map +1 -0
- package/dist/media/MediaCarouselWithModal.d.ts +17 -0
- package/dist/media/MediaCarouselWithModal.d.ts.map +1 -0
- package/dist/media/MediaCarouselWithParentMedia.d.cts +30 -0
- package/dist/media/MediaCarouselWithParentMedia.d.cts.map +1 -0
- package/dist/media/MediaCarouselWithParentMedia.d.ts +30 -0
- package/dist/media/MediaCarouselWithParentMedia.d.ts.map +1 -0
- package/dist/media/MediaModal.d.cts +27 -0
- package/dist/media/MediaModal.d.cts.map +1 -0
- package/dist/media/MediaModal.d.ts +27 -0
- package/dist/media/MediaModal.d.ts.map +1 -0
- package/dist/media/VideoPlayer.d.cts +37 -0
- package/dist/media/VideoPlayer.d.cts.map +1 -0
- package/dist/media/VideoPlayer.d.ts +37 -0
- package/dist/media/VideoPlayer.d.ts.map +1 -0
- package/dist/media/captureVideoPoster.d.cts +20 -0
- package/dist/media/captureVideoPoster.d.cts.map +1 -0
- package/dist/media/captureVideoPoster.d.ts +20 -0
- package/dist/media/captureVideoPoster.d.ts.map +1 -0
- package/dist/media/index.cjs +613 -0
- package/dist/media/index.cjs.map +1 -0
- package/dist/media/index.d.cts +8 -0
- package/dist/media/index.d.cts.map +1 -0
- package/dist/media/index.d.ts +8 -0
- package/dist/media/index.d.ts.map +1 -0
- package/dist/media/index.js +605 -0
- package/dist/media/index.js.map +1 -0
- package/dist/media/labels.d.cts +33 -0
- package/dist/media/labels.d.cts.map +1 -0
- package/dist/media/labels.d.ts +33 -0
- package/dist/media/labels.d.ts.map +1 -0
- package/dist/media/media-icons.d.cts +6 -0
- package/dist/media/media-icons.d.cts.map +1 -0
- package/dist/media/media-icons.d.ts +6 -0
- package/dist/media/media-icons.d.ts.map +1 -0
- package/dist/media/streaming.d.cts +18 -0
- package/dist/media/streaming.d.cts.map +1 -0
- package/dist/media/streaming.d.ts +18 -0
- package/dist/media/streaming.d.ts.map +1 -0
- package/dist/resend/index.cjs +5 -28
- package/dist/resend/index.cjs.map +1 -1
- package/dist/resend/index.js +1 -24
- package/dist/resend/index.js.map +1 -1
- package/dist/static-page/StaticPage.d.cts +91 -0
- package/dist/static-page/StaticPage.d.cts.map +1 -0
- package/dist/static-page/StaticPage.d.ts +91 -0
- package/dist/static-page/StaticPage.d.ts.map +1 -0
- package/dist/static-page/index.cjs +247 -0
- package/dist/static-page/index.cjs.map +1 -0
- package/dist/static-page/index.d.cts +2 -0
- package/dist/static-page/index.d.cts.map +1 -0
- package/dist/static-page/index.d.ts +2 -0
- package/dist/static-page/index.d.ts.map +1 -0
- package/dist/static-page/index.js +235 -0
- package/dist/static-page/index.js.map +1 -0
- package/dist/static-page/static-page-icons.d.cts +6 -0
- package/dist/static-page/static-page-icons.d.cts.map +1 -0
- package/dist/static-page/static-page-icons.d.ts +6 -0
- package/dist/static-page/static-page-icons.d.ts.map +1 -0
- package/dist/testimonials/TestimonialCarousel.d.cts +40 -0
- package/dist/testimonials/TestimonialCarousel.d.cts.map +1 -0
- package/dist/testimonials/TestimonialCarousel.d.ts +40 -0
- package/dist/testimonials/TestimonialCarousel.d.ts.map +1 -0
- package/dist/testimonials/index.cjs +246 -0
- package/dist/testimonials/index.cjs.map +1 -0
- package/dist/testimonials/index.d.cts +2 -0
- package/dist/testimonials/index.d.cts.map +1 -0
- package/dist/testimonials/index.d.ts +2 -0
- package/dist/testimonials/index.d.ts.map +1 -0
- package/dist/testimonials/index.js +244 -0
- package/dist/testimonials/index.js.map +1 -0
- package/dist/testimonials/testimonials-icons.d.cts +6 -0
- package/dist/testimonials/testimonials-icons.d.cts.map +1 -0
- package/dist/testimonials/testimonials-icons.d.ts +6 -0
- package/dist/testimonials/testimonials-icons.d.ts.map +1 -0
- package/dist/toast/index.cjs +2 -38
- package/dist/toast/index.cjs.map +1 -1
- package/dist/toast/index.js +1 -37
- package/dist/toast/index.js.map +1 -1
- package/package.json +67 -1
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('@beautinique/frontend-styles/color-input.css');
|
|
4
|
+
var react = require('@iconify/react');
|
|
5
|
+
var react$1 = require('react');
|
|
6
|
+
var reactDom = require('react-dom');
|
|
7
|
+
var reactColorPalette = require('react-color-palette');
|
|
8
|
+
var inputs = require('@beautinique/frontend-components/inputs');
|
|
9
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
10
|
+
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
13
|
+
|
|
14
|
+
// src/lib/dropdown-position.ts
|
|
15
|
+
var DROPDOWN_GAP = 8;
|
|
16
|
+
var getDropdownPlacement = /* @__PURE__ */ __name(({
|
|
17
|
+
rect,
|
|
18
|
+
viewportHeight,
|
|
19
|
+
desired,
|
|
20
|
+
needed
|
|
21
|
+
}) => {
|
|
22
|
+
const below = viewportHeight - rect.bottom - DROPDOWN_GAP;
|
|
23
|
+
const above = rect.top - DROPDOWN_GAP;
|
|
24
|
+
const room = desired === "bottom" ? below : above;
|
|
25
|
+
const other = desired === "bottom" ? above : below;
|
|
26
|
+
if (room >= needed || other <= room) return desired;
|
|
27
|
+
return desired === "bottom" ? "top" : "bottom";
|
|
28
|
+
}, "getDropdownPlacement");
|
|
29
|
+
var getDropdownStyle = /* @__PURE__ */ __name((rect, placement, viewportHeight) => ({
|
|
30
|
+
left: rect.left,
|
|
31
|
+
width: rect.width,
|
|
32
|
+
...placement === "top" ? { bottom: viewportHeight - rect.top + DROPDOWN_GAP } : { top: rect.bottom + DROPDOWN_GAP }
|
|
33
|
+
}), "getDropdownStyle");
|
|
34
|
+
|
|
35
|
+
// src/lib/mergeRefs.ts
|
|
36
|
+
var assign = /* @__PURE__ */ __name((ref, node) => {
|
|
37
|
+
if (typeof ref === "function") return ref(node);
|
|
38
|
+
if (ref) ref.current = node;
|
|
39
|
+
return void 0;
|
|
40
|
+
}, "assign");
|
|
41
|
+
var mergeRefs = /* @__PURE__ */ __name((...refs) => (node) => {
|
|
42
|
+
const cleanups = refs.map((ref) => assign(ref, node));
|
|
43
|
+
return () => {
|
|
44
|
+
refs.forEach((ref, index) => {
|
|
45
|
+
const cleanup = cleanups[index];
|
|
46
|
+
if (typeof cleanup === "function") cleanup();
|
|
47
|
+
else assign(ref, null);
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
}, "mergeRefs");
|
|
51
|
+
var useAnchoredBox = /* @__PURE__ */ __name(({
|
|
52
|
+
isOpen,
|
|
53
|
+
anchorRef,
|
|
54
|
+
position,
|
|
55
|
+
needed
|
|
56
|
+
}) => {
|
|
57
|
+
const [box, setBox] = react$1.useState(null);
|
|
58
|
+
react$1.useLayoutEffect(() => {
|
|
59
|
+
if (!isOpen) return;
|
|
60
|
+
const update = /* @__PURE__ */ __name(() => {
|
|
61
|
+
const anchor = anchorRef.current;
|
|
62
|
+
if (!anchor) return;
|
|
63
|
+
const rect = anchor.getBoundingClientRect();
|
|
64
|
+
setBox({
|
|
65
|
+
rect,
|
|
66
|
+
placement: getDropdownPlacement({
|
|
67
|
+
rect,
|
|
68
|
+
viewportHeight: window.innerHeight,
|
|
69
|
+
desired: position,
|
|
70
|
+
needed
|
|
71
|
+
})
|
|
72
|
+
});
|
|
73
|
+
}, "update");
|
|
74
|
+
update();
|
|
75
|
+
window.addEventListener("scroll", update, true);
|
|
76
|
+
window.addEventListener("resize", update);
|
|
77
|
+
return () => {
|
|
78
|
+
window.removeEventListener("scroll", update, true);
|
|
79
|
+
window.removeEventListener("resize", update);
|
|
80
|
+
};
|
|
81
|
+
}, [isOpen, anchorRef, position, needed]);
|
|
82
|
+
return box;
|
|
83
|
+
}, "useAnchoredBox");
|
|
84
|
+
var openStack = [];
|
|
85
|
+
var useDismiss = /* @__PURE__ */ __name((onDismiss, { enabled = true, ignore, outside = true, escape = true } = {}) => {
|
|
86
|
+
const ref = react$1.useRef(null);
|
|
87
|
+
const onDismissRef = react$1.useRef(onDismiss);
|
|
88
|
+
const ignoreRef = react$1.useRef(ignore);
|
|
89
|
+
react$1.useLayoutEffect(() => {
|
|
90
|
+
onDismissRef.current = onDismiss;
|
|
91
|
+
ignoreRef.current = ignore;
|
|
92
|
+
});
|
|
93
|
+
react$1.useEffect(() => {
|
|
94
|
+
if (!enabled) return;
|
|
95
|
+
const token = /* @__PURE__ */ Symbol("dismissable");
|
|
96
|
+
if (escape) openStack.push(token);
|
|
97
|
+
const handlePress = /* @__PURE__ */ __name((event) => {
|
|
98
|
+
const element = ref.current;
|
|
99
|
+
if (!outside || !element) return;
|
|
100
|
+
const path = event.composedPath();
|
|
101
|
+
const isInside = path.includes(element) || (ignoreRef.current ?? []).some(({ current }) => current !== null && path.includes(current));
|
|
102
|
+
if (!isInside) onDismissRef.current("outside", event);
|
|
103
|
+
}, "handlePress");
|
|
104
|
+
const handleKey = /* @__PURE__ */ __name((event) => {
|
|
105
|
+
if (!escape || event.key !== "Escape" || event.defaultPrevented) return;
|
|
106
|
+
if (openStack.at(-1) !== token) return;
|
|
107
|
+
onDismissRef.current("escape", event);
|
|
108
|
+
}, "handleKey");
|
|
109
|
+
document.addEventListener("pointerdown", handlePress, true);
|
|
110
|
+
document.addEventListener("keydown", handleKey);
|
|
111
|
+
return () => {
|
|
112
|
+
document.removeEventListener("pointerdown", handlePress, true);
|
|
113
|
+
document.removeEventListener("keydown", handleKey);
|
|
114
|
+
const index = openStack.indexOf(token);
|
|
115
|
+
if (index !== -1) openStack.splice(index, 1);
|
|
116
|
+
};
|
|
117
|
+
}, [enabled, outside, escape]);
|
|
118
|
+
return ref;
|
|
119
|
+
}, "useDismiss");
|
|
120
|
+
|
|
121
|
+
// src/lib/focus.ts
|
|
122
|
+
var TABBABLE = [
|
|
123
|
+
"a[href]",
|
|
124
|
+
"area[href]",
|
|
125
|
+
"button:not([disabled])",
|
|
126
|
+
'input:not([disabled]):not([type="hidden"])',
|
|
127
|
+
"select:not([disabled])",
|
|
128
|
+
"textarea:not([disabled])",
|
|
129
|
+
"summary",
|
|
130
|
+
"audio[controls]",
|
|
131
|
+
"video[controls]",
|
|
132
|
+
'[contenteditable]:not([contenteditable="false"])',
|
|
133
|
+
"[tabindex]"
|
|
134
|
+
].join(",");
|
|
135
|
+
var isTabbable = /* @__PURE__ */ __name((element) => {
|
|
136
|
+
if (element.tabIndex < 0) return false;
|
|
137
|
+
return !element.closest("[hidden], [inert]");
|
|
138
|
+
}, "isTabbable");
|
|
139
|
+
var getTabbable = /* @__PURE__ */ __name((root) => [...root.querySelectorAll(TABBABLE)].filter(isTabbable), "getTabbable");
|
|
140
|
+
|
|
141
|
+
// src/lib/useFocusTrap.ts
|
|
142
|
+
var activeTraps = [];
|
|
143
|
+
var useFocusTrap = /* @__PURE__ */ __name(({
|
|
144
|
+
enabled,
|
|
145
|
+
initialFocus,
|
|
146
|
+
returnFocus = true
|
|
147
|
+
}) => {
|
|
148
|
+
const ref = react$1.useRef(null);
|
|
149
|
+
const initialFocusRef = react$1.useRef(initialFocus);
|
|
150
|
+
react$1.useEffect(() => {
|
|
151
|
+
initialFocusRef.current = initialFocus;
|
|
152
|
+
});
|
|
153
|
+
react$1.useEffect(() => {
|
|
154
|
+
const dialog = ref.current;
|
|
155
|
+
if (!enabled || !dialog) return;
|
|
156
|
+
const token = /* @__PURE__ */ Symbol("trap");
|
|
157
|
+
const previous = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
158
|
+
activeTraps.push(token);
|
|
159
|
+
(initialFocusRef.current?.current ?? getTabbable(dialog).at(0) ?? dialog).focus();
|
|
160
|
+
const handleKey = /* @__PURE__ */ __name((event) => {
|
|
161
|
+
if (event.key !== "Tab" || activeTraps.at(-1) !== token) return;
|
|
162
|
+
const tabbable = getTabbable(dialog);
|
|
163
|
+
const first = tabbable.at(0);
|
|
164
|
+
const last = tabbable.at(-1);
|
|
165
|
+
const current = document.activeElement;
|
|
166
|
+
if (!first || !last) {
|
|
167
|
+
event.preventDefault();
|
|
168
|
+
dialog.focus();
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
if (!(current instanceof Node) || !dialog.contains(current) || current === dialog) {
|
|
172
|
+
event.preventDefault();
|
|
173
|
+
(event.shiftKey ? last : first).focus();
|
|
174
|
+
} else if (event.shiftKey && current === first) {
|
|
175
|
+
event.preventDefault();
|
|
176
|
+
last.focus();
|
|
177
|
+
} else if (!event.shiftKey && current === last) {
|
|
178
|
+
event.preventDefault();
|
|
179
|
+
first.focus();
|
|
180
|
+
}
|
|
181
|
+
}, "handleKey");
|
|
182
|
+
document.addEventListener("keydown", handleKey);
|
|
183
|
+
return () => {
|
|
184
|
+
document.removeEventListener("keydown", handleKey);
|
|
185
|
+
const index = activeTraps.indexOf(token);
|
|
186
|
+
if (index !== -1) activeTraps.splice(index, 1);
|
|
187
|
+
if (returnFocus && previous?.isConnected) previous.focus();
|
|
188
|
+
};
|
|
189
|
+
}, [enabled, returnFocus]);
|
|
190
|
+
return ref;
|
|
191
|
+
}, "useFocusTrap");
|
|
192
|
+
var HEX = /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i;
|
|
193
|
+
var FALLBACK_COLOR = "#000000";
|
|
194
|
+
var isHexColor = /* @__PURE__ */ __name((value) => value !== void 0 && HEX.test(value), "isHexColor");
|
|
195
|
+
var toColor = /* @__PURE__ */ __name((value) => reactColorPalette.ColorService.convert("hex", isHexColor(value) ? value : FALLBACK_COLOR), "toColor");
|
|
196
|
+
var isSameHex = /* @__PURE__ */ __name((a, b) => a?.toLowerCase() === b?.toLowerCase(), "isSameHex");
|
|
197
|
+
var createIconRegistry = /* @__PURE__ */ __name((sets) => {
|
|
198
|
+
let registered = false;
|
|
199
|
+
return {
|
|
200
|
+
register: /* @__PURE__ */ __name(() => {
|
|
201
|
+
if (registered) return;
|
|
202
|
+
for (const set of sets) react.addCollection(set);
|
|
203
|
+
registered = true;
|
|
204
|
+
}, "register"),
|
|
205
|
+
names: sets.flatMap(
|
|
206
|
+
({ prefix, icons, aliases }) => [...Object.keys(icons), ...Object.keys(aliases ?? {})].map((name) => `${prefix}:${name}`)
|
|
207
|
+
)
|
|
208
|
+
};
|
|
209
|
+
}, "createIconRegistry");
|
|
210
|
+
|
|
211
|
+
// src/color-input/color-input-icons.ts
|
|
212
|
+
var ICON_SETS = [
|
|
213
|
+
{
|
|
214
|
+
prefix: "mage",
|
|
215
|
+
width: 24,
|
|
216
|
+
height: 24,
|
|
217
|
+
icons: {
|
|
218
|
+
"color-picker-fill": {
|
|
219
|
+
body: '<path fill="currentColor" d="m17.042 10.894l-4-4.006a1 1 0 0 0-.2-.14l4.37 4.356a.7.7 0 0 0-.17-.21"/><path fill="currentColor" d="M20.962 3.002A3.56 3.56 0 0 0 18.502 2a3.64 3.64 0 0 0-2.55 1.002l-1.32 1.592a2.4 2.4 0 0 0-.68-.45a2.17 2.17 0 0 0-1.66 0a2.2 2.2 0 0 0-.7.47a2.185 2.185 0 0 0-.16 2.864l-7.4 7.421a2.64 2.64 0 0 0-.63 2.694l-.85.852a1.9 1.9 0 0 0-.41.61c-.09.227-.137.468-.14.712c.002.25.05.498.14.73q.144.325.39.582l.33.36c.176.176.383.318.61.42c.232.093.48.14.73.141c.247-.002.49-.05.72-.14a1.9 1.9 0 0 0 .6-.41l.87-.862c.36.121.743.16 1.12.11a2.63 2.63 0 0 0 1.55-.741l7.45-7.441c.371.28.825.432 1.29.43c.568 0 1.114-.222 1.52-.62a2.135 2.135 0 0 0 0-3.005l1.6-1.242l.09-.08a3.57 3.57 0 0 0-.08-5.007zm-1 3.886l-2.21 1.722a.77.77 0 0 0-.29.54a.8.8 0 0 0 .21.582l.57.57q.09.099.14.22a.5.5 0 0 1 .05.251a.56.56 0 0 1-.05.25a.6.6 0 0 1-.14.211a.69.69 0 0 1-.93 0l-.11-.1l-4.37-4.357l-.18-.17a.66.66 0 0 1 0-.931a.8.8 0 0 1 .21-.15a.7.7 0 0 1 .25 0a.7.7 0 0 1 .25 0q.115.06.21.15l.58.57a.73.73 0 0 0 .56.21a.77.77 0 0 0 .54-.27l1.78-2.153a1.94 1.94 0 0 1 1.44-.56a2.06 2.06 0 0 1 1.85 1.236a2.07 2.07 0 0 1-.35 2.199z"/>'
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
prefix: "pepicons-pop",
|
|
225
|
+
width: 26,
|
|
226
|
+
height: 26,
|
|
227
|
+
icons: {
|
|
228
|
+
"color-picker": {
|
|
229
|
+
body: '<g fill="currentColor"><path fill-rule="evenodd" d="M7.536 15.237c-1.56.616-4.257 2.37-4.728 1.9c-.306-.306.323-1.546.972-2.806h4.66z" clip-rule="evenodd"/><path d="M15.803 5.555a1 1 0 1 1 1.415 1.414l-8.975 8.975a1 1 0 0 1-.34.222c-.396.157-.8.355-1.753.846c-.47.242-.679.348-.933.474c-1.748.861-2.405 1.068-3.116.357c-.71-.71-.504-1.367.351-3.105c.127-.257.234-.468.48-.945c.491-.953.689-1.356.845-1.753A1 1 0 0 1 4 11.701l8.975-8.975a1 1 0 1 1 1.414 1.414l-8.832 8.833c-.174.414-.393.855-.847 1.736a52 52 0 0 0-.535 1.06l.158-.077c.24-.119.441-.221.902-.458c.88-.454 1.321-.673 1.736-.847z"/><path d="M14.39 4.14a1 1 0 1 1-1.415-1.414a3 3 0 1 1 4.243 4.243a1 1 0 1 1-1.415-1.414A1 1 0 0 0 14.39 4.14m-4.953.705a1 1 0 0 1 1.415-1.414l5.656 5.657a1 1 0 0 1-1.414 1.414z"/></g>'
|
|
230
|
+
},
|
|
231
|
+
"color-picker-off": {
|
|
232
|
+
body: '<g fill="currentColor"><path fill-rule="evenodd" d="M7.536 15.237c-1.56.616-4.257 2.37-4.728 1.9c-.306-.306.323-1.546.972-2.806h4.66z" clip-rule="evenodd"/><path d="M15.803 5.555a1 1 0 1 1 1.415 1.414l-8.975 8.975a1 1 0 0 1-.34.222c-.396.157-.8.355-1.753.846c-.47.242-.679.348-.933.474c-1.748.861-2.405 1.068-3.116.357c-.71-.71-.504-1.367.351-3.105c.127-.257.234-.468.48-.945c.491-.953.689-1.356.845-1.753A1 1 0 0 1 4 11.701l8.975-8.975a1 1 0 1 1 1.414 1.414l-8.832 8.833c-.174.414-.393.855-.847 1.736a52 52 0 0 0-.535 1.06l.158-.077c.24-.119.441-.221.902-.458c.88-.454 1.321-.673 1.736-.847z"/><path d="M14.39 4.14a1 1 0 1 1-1.415-1.414a3 3 0 1 1 4.243 4.243a1 1 0 1 1-1.415-1.414A1 1 0 0 0 14.39 4.14m-4.953.705a1 1 0 0 1 1.415-1.414l5.656 5.657a1 1 0 0 1-1.414 1.414zM1.293 2.707a1 1 0 0 1 1.414-1.414l16 16a1 1 0 0 1-1.414 1.414z"/></g>'
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
];
|
|
237
|
+
var { register: registerColorInputIcons, names: COLOR_INPUT_ICON_NAMES } = createIconRegistry(ICON_SETS);
|
|
238
|
+
var PICKER_HEIGHT = 340;
|
|
239
|
+
var ColorInput = /* @__PURE__ */ __name(({
|
|
240
|
+
label = "",
|
|
241
|
+
value,
|
|
242
|
+
error = "",
|
|
243
|
+
disabled = false,
|
|
244
|
+
placeholder,
|
|
245
|
+
onChange,
|
|
246
|
+
id,
|
|
247
|
+
containerClassName = "",
|
|
248
|
+
className = "",
|
|
249
|
+
position = "bottom",
|
|
250
|
+
hideAlpha = false,
|
|
251
|
+
pickerLabel = "Colour picker"
|
|
252
|
+
}) => {
|
|
253
|
+
registerColorInputIcons();
|
|
254
|
+
const baseId = react$1.useId();
|
|
255
|
+
const fieldId = id ?? `${baseId}-field`;
|
|
256
|
+
const pickerId = `${baseId}-picker`;
|
|
257
|
+
const errorId = `${baseId}-error`;
|
|
258
|
+
const [isOpenState, setIsOpen] = react$1.useState(false);
|
|
259
|
+
const [color, setColor] = react$1.useState(() => toColor(value));
|
|
260
|
+
const [seenValue, setSeenValue] = react$1.useState(value);
|
|
261
|
+
const anchorRef = react$1.useRef(null);
|
|
262
|
+
const pickerRef = react$1.useRef(null);
|
|
263
|
+
if (value !== seenValue) {
|
|
264
|
+
setSeenValue(value);
|
|
265
|
+
if (!isSameHex(value, color.hex)) setColor(toColor(value));
|
|
266
|
+
}
|
|
267
|
+
if (isOpenState && disabled) setIsOpen(false);
|
|
268
|
+
const isOpen = isOpenState && !disabled;
|
|
269
|
+
const box = useAnchoredBox({ isOpen, anchorRef, position, needed: PICKER_HEIGHT });
|
|
270
|
+
const isShown = isOpen && box !== null;
|
|
271
|
+
const containerRef = useDismiss(
|
|
272
|
+
() => {
|
|
273
|
+
setIsOpen(false);
|
|
274
|
+
},
|
|
275
|
+
{ enabled: isOpen, ignore: [pickerRef] }
|
|
276
|
+
);
|
|
277
|
+
const trapRef = useFocusTrap({ enabled: isShown });
|
|
278
|
+
const mergedPickerRef = react$1.useMemo(() => mergeRefs(pickerRef, trapRef), [trapRef]);
|
|
279
|
+
const handleChange = /* @__PURE__ */ __name((next) => {
|
|
280
|
+
if (!isHexColor(next.hex)) return;
|
|
281
|
+
setColor(next);
|
|
282
|
+
onChange?.(next.hex);
|
|
283
|
+
}, "handleChange");
|
|
284
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
285
|
+
"div",
|
|
286
|
+
{
|
|
287
|
+
ref: containerRef,
|
|
288
|
+
className: `flex max-w-full min-w-0 flex-col gap-1.5 ${containerClassName}`,
|
|
289
|
+
children: [
|
|
290
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", ref: anchorRef, children: [
|
|
291
|
+
/* @__PURE__ */ jsxRuntime.jsx(inputs.InputLabel, { htmlFor: fieldId, className: "z-2", children: label }),
|
|
292
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
293
|
+
"div",
|
|
294
|
+
{
|
|
295
|
+
"data-invalid": error ? "" : void 0,
|
|
296
|
+
className: `border-primary/10 bg-smoke-eerie focus-within:border-blue-crayola-c data-invalid:border-red-c flex items-center gap-1 overflow-hidden rounded-lg border px-3 text-[13px] ${className}`,
|
|
297
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
298
|
+
"button",
|
|
299
|
+
{
|
|
300
|
+
id: fieldId,
|
|
301
|
+
type: "button",
|
|
302
|
+
"aria-haspopup": "dialog",
|
|
303
|
+
"aria-expanded": isOpen,
|
|
304
|
+
"aria-controls": isOpen ? pickerId : void 0,
|
|
305
|
+
"aria-invalid": error ? true : void 0,
|
|
306
|
+
"aria-describedby": error ? errorId : void 0,
|
|
307
|
+
disabled,
|
|
308
|
+
onClick: () => {
|
|
309
|
+
setIsOpen(!isOpen);
|
|
310
|
+
},
|
|
311
|
+
className: `text-primary flex min-w-0 flex-1 items-center gap-2 border-none bg-transparent text-left outline-hidden ${disabled ? "cursor-no-drop" : "cursor-pointer"}`,
|
|
312
|
+
children: [
|
|
313
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
314
|
+
"span",
|
|
315
|
+
{
|
|
316
|
+
"aria-hidden": "true",
|
|
317
|
+
className: "border-primary/10 rounded border p-0.5 xl:p-1",
|
|
318
|
+
style: { backgroundColor: color.hex },
|
|
319
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
320
|
+
react.Icon,
|
|
321
|
+
{
|
|
322
|
+
icon: "mage:color-picker-fill",
|
|
323
|
+
className: "shrink-0 [&>path]:last:fill-primary-invert [&>path]:last:stroke-primary"
|
|
324
|
+
}
|
|
325
|
+
)
|
|
326
|
+
}
|
|
327
|
+
),
|
|
328
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: `flex-1 truncate py-2 xl:py-3 ${value ? "" : "text-primary/30"}`, children: value ? value.toUpperCase() : placeholder }),
|
|
329
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
330
|
+
react.Icon,
|
|
331
|
+
{
|
|
332
|
+
"aria-hidden": "true",
|
|
333
|
+
icon: isOpen ? "pepicons-pop:color-picker-off" : "pepicons-pop:color-picker",
|
|
334
|
+
className: "shrink-0"
|
|
335
|
+
}
|
|
336
|
+
)
|
|
337
|
+
]
|
|
338
|
+
}
|
|
339
|
+
)
|
|
340
|
+
}
|
|
341
|
+
)
|
|
342
|
+
] }),
|
|
343
|
+
/* @__PURE__ */ jsxRuntime.jsx(inputs.InputError, { id: errorId, error }),
|
|
344
|
+
isShown && reactDom.createPortal(
|
|
345
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
346
|
+
"div",
|
|
347
|
+
{
|
|
348
|
+
ref: mergedPickerRef,
|
|
349
|
+
id: pickerId,
|
|
350
|
+
role: "dialog",
|
|
351
|
+
tabIndex: -1,
|
|
352
|
+
"aria-label": label || pickerLabel,
|
|
353
|
+
className: "border-primary/10 bg-smoke-eerie fixed z-3 overflow-hidden rounded-lg border shadow-md outline-none",
|
|
354
|
+
style: getDropdownStyle(box.rect, box.placement, window.innerHeight),
|
|
355
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
356
|
+
reactColorPalette.ColorPicker,
|
|
357
|
+
{
|
|
358
|
+
hideInput: ["hsv"],
|
|
359
|
+
hideAlpha,
|
|
360
|
+
color,
|
|
361
|
+
onChange: handleChange
|
|
362
|
+
}
|
|
363
|
+
)
|
|
364
|
+
}
|
|
365
|
+
),
|
|
366
|
+
document.body
|
|
367
|
+
)
|
|
368
|
+
]
|
|
369
|
+
}
|
|
370
|
+
);
|
|
371
|
+
}, "ColorInput");
|
|
372
|
+
|
|
373
|
+
exports.ColorInput = ColorInput;
|
|
374
|
+
//# sourceMappingURL=index.cjs.map
|
|
375
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/dropdown-position.ts","../../src/lib/mergeRefs.ts","../../src/lib/useAnchoredBox.ts","../../src/lib/useDismiss.ts","../../src/lib/focus.ts","../../src/lib/useFocusTrap.ts","../../src/color-input/color.ts","../../src/lib/icon-registry.ts","../../src/color-input/color-input-icons.ts","../../src/color-input/ColorInput.tsx"],"names":["useState","useLayoutEffect","useRef","useEffect","ColorService","addCollection","useId","useMemo","jsxs","jsx","InputLabel","Icon","InputError","createPortal","ColorPicker"],"mappings":";;;;;;;;;;;;;;AAUO,IAAM,YAAA,GAAe,CAAA;AASrB,IAAM,uCAAuB,MAAA,CAAA,CAAC;AAAA,EACnC,IAAA;AAAA,EACA,cAAA;AAAA,EACA,OAAA;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AA;AAAA,YAAC,KAAA;AAAA,YAAA;AAAA,cACC,GAAA,EAAK,eAAA;AAAA,cACL,EAAA,EAAI,QAAA;AAAA,cACJ,IAAA,EAAK,QAAA;AAAA,cACL,QAAA,EAAU,EAAA;AAAA,cACV,cAAY,KAAA,IAAS,WAAA;AAAA,cACrB,SAAA,EAAU,qGAAA;AAAA,cACV,OAAO,gBAAA,CAAiB,GAAA,CAAI,MAAM,GAAA,CAAI,SAAA,EAAW,OAAO,WAAW,CAAA;AAAA,cAEnE,QAAA,kBAAAA,cAAA;AAAA,gBAACK,6BAAA;AAAA,gBAAA;AAAA,kBACC,SAAA,EAAW,CAAC,KAAK,CAAA;AAAA,kBACjB,SAAA;AAAA,kBACA,KAAA;AAAA,kBACA,QAAA,EAAU;AAAA;AAAA;AACZ;AAAA,WACF;AAAA,UACA,QAAA,CAAS;AAAA;AACX;AAAA;AAAA,GACJ;AAEJ,CAAA,EApI0B,YAAA","file":"index.cjs","sourcesContent":["export type TDropdownPlacement = 'top' | 'bottom';\n\nexport interface IDropdownRect {\n top: number;\n bottom: number;\n left: number;\n width: number;\n}\n\n/** The gap between the field and the list. */\nexport const DROPDOWN_GAP = 8;\n\n/**\n * Where a list that opens from a field goes: where the app asked (`desired`), unless that side of the\n * field has not room for the list and the other one has more. A list that fits on neither stays\n * where it was asked to open.\n *\n * @param needed how tall the list is, or the most it can be (its `max-height`).\n */\nexport const getDropdownPlacement = ({\n rect,\n viewportHeight,\n desired,\n needed,\n}: {\n rect: Pick<IDropdownRect, 'top' | 'bottom'>;\n viewportHeight: number;\n desired: TDropdownPlacement;\n needed: number;\n}): TDropdownPlacement => {\n const below = viewportHeight - rect.bottom - DROPDOWN_GAP;\n const above = rect.top - DROPDOWN_GAP;\n const room = desired === 'bottom' ? below : above;\n const other = desired === 'bottom' ? above : below;\n\n if (room >= needed || other <= room) return desired;\n\n return desired === 'bottom' ? 'top' : 'bottom';\n};\n\n/** The `style` of a list that is `position: fixed` under or over the field, as wide as it is. */\nexport const getDropdownStyle = (\n rect: IDropdownRect,\n placement: TDropdownPlacement,\n viewportHeight: number,\n) => ({\n left: rect.left,\n width: rect.width,\n ...(placement === 'top'\n ? { bottom: viewportHeight - rect.top + DROPDOWN_GAP }\n : { top: rect.bottom + DROPDOWN_GAP }),\n});\n","import type { Ref } from 'react';\n\nconst assign = <T>(ref: Ref<T> | undefined, node: T | null) => {\n if (typeof ref === 'function') return ref(node);\n\n if (ref) ref.current = node;\n\n return undefined;\n};\n\n/**\n * One ref callback that gives the element to all the refs it is given (a ref of the app, the ref that\n * `register()` of React Hook Form makes, a ref of the component itself). When the element goes away\n * every ref gets `null` again, or, for a ref callback that returns a cleanup function, that cleanup is\n * called. Keep the result stable (`useMemo`): a new function at every render makes React take the\n * element away from the refs and give it again.\n */\nexport const mergeRefs =\n <T>(...refs: (Ref<T> | undefined)[]) =>\n (node: T | null) => {\n const cleanups = refs.map((ref) => assign(ref, node));\n\n return () => {\n refs.forEach((ref, index) => {\n const cleanup = cleanups[index];\n\n if (typeof cleanup === 'function') cleanup();\n else assign(ref, null);\n });\n };\n };\n","import { type RefObject, useLayoutEffect, useState } from 'react';\n\nimport {\n getDropdownPlacement,\n type IDropdownRect,\n type TDropdownPlacement,\n} from './dropdown-position.js';\n\nexport interface IAnchoredBox {\n /** Where the anchor is on the screen. */\n rect: IDropdownRect;\n /** The side of the anchor the box goes on. */\n placement: TDropdownPlacement;\n}\n\nexport interface IAnchoredBoxOptions {\n /** The box is open: it is only measured (and followed) while it is. */\n isOpen: boolean;\n /** The element the box opens from. */\n anchorRef: RefObject<HTMLElement | null>;\n /** The side the app asked for. */\n position: TDropdownPlacement;\n /** How tall the box is, or the most it can be. */\n needed: number;\n}\n\n/**\n * Where a box that opens from an element (a list, a picker) goes: under or over it, on the side with\n * room. It is measured before the browser paints, so the box never shows in the wrong place for a\n * moment, and again whenever the page scrolls or the window is resized. It is `null` until the first\n * measure; use it with `getDropdownStyle()`.\n */\nexport const useAnchoredBox = ({\n isOpen,\n anchorRef,\n position,\n needed,\n}: IAnchoredBoxOptions): IAnchoredBox | null => {\n const [box, setBox] = useState<IAnchoredBox | null>(null);\n\n useLayoutEffect(() => {\n if (!isOpen) return;\n\n const update = () => {\n const anchor = anchorRef.current;\n\n if (!anchor) return;\n\n const rect = anchor.getBoundingClientRect();\n\n setBox({\n rect,\n placement: getDropdownPlacement({\n rect,\n viewportHeight: window.innerHeight,\n desired: position,\n needed,\n }),\n });\n };\n\n update();\n window.addEventListener('scroll', update, true);\n window.addEventListener('resize', update);\n\n return () => {\n window.removeEventListener('scroll', update, true);\n window.removeEventListener('resize', update);\n };\n }, [isOpen, anchorRef, position, needed]);\n\n return box;\n};\n","import { type RefObject, useEffect, useLayoutEffect, useRef } from 'react';\n\nexport type TDismissReason = 'outside' | 'escape';\n\nexport interface IDismissOptions {\n /** Turn the listeners off (e.g. while a popup is closed). @default true */\n enabled?: boolean;\n /**\n * Elements that count as inside although they are not inside the element in the DOM: a popup that\n * is rendered with `createPortal()` into `document.body`. A press on one of them (or on anything in\n * it) is not \"outside\". Refs that are not attached are skipped. The list is read when the press\n * happens, so a new array on every render is fine.\n */\n ignore?: readonly RefObject<Element | null>[];\n /** Dismiss when the user presses outside the element. @default true */\n outside?: boolean;\n /** Dismiss when the user presses Escape. @default true */\n escape?: boolean;\n}\n\n// The popups that are open, the last one on top. Escape closes the one on top only: a select that is\n// open inside a dialog closes first, and the dialog stays until the next Escape.\nconst openStack: symbol[] = [];\n\n/**\n * Closes a popup (a select, a dialog, a menu) the way people expect: a press (mouse, touch or pen)\n * anywhere outside it, or Escape.\n *\n * - The press is listened for on `document` in the capture phase, so an inner `stopPropagation()`\n * cannot hide it, and \"inside\" is decided from the path the event took (`composedPath()`), which\n * stays right when the pressed node is removed by another listener first.\n * - A popup portalled out of the element is not inside it in the DOM: list its ref in `ignore`.\n * - Escape only reaches the popup that opened last, and not an Escape that something else already\n * handled (`defaultPrevented`).\n * - The listeners are added once and only when `enabled` changes: the latest `onDismiss` and `ignore`\n * are used, so passing new ones on every render costs nothing.\n *\n * @returns the ref to put on the popup (or on its trigger, when the popup is portalled).\n */\nexport const useDismiss = <T extends HTMLElement>(\n onDismiss: (reason: TDismissReason, event: Event) => void,\n { enabled = true, ignore, outside = true, escape = true }: IDismissOptions = {},\n): RefObject<T | null> => {\n const ref = useRef<T | null>(null);\n const onDismissRef = useRef(onDismiss);\n const ignoreRef = useRef(ignore);\n\n // Updated as soon as a render commits, so the listeners below never need them as dependencies.\n useLayoutEffect(() => {\n onDismissRef.current = onDismiss;\n ignoreRef.current = ignore;\n });\n\n useEffect(() => {\n if (!enabled) return;\n\n const token = Symbol('dismissable');\n\n // a popup that does not listen for Escape is not in the stack: it must not hide the ones below it\n if (escape) openStack.push(token);\n\n const handlePress = (event: PointerEvent) => {\n const element = ref.current;\n\n if (!outside || !element) return;\n\n const path = event.composedPath();\n const isInside =\n path.includes(element) ||\n (ignoreRef.current ?? []).some(({ current }) => current !== null && path.includes(current));\n\n if (!isInside) onDismissRef.current('outside', event);\n };\n\n const handleKey = (event: KeyboardEvent) => {\n if (!escape || event.key !== 'Escape' || event.defaultPrevented) return;\n if (openStack.at(-1) !== token) return;\n\n onDismissRef.current('escape', event);\n };\n\n document.addEventListener('pointerdown', handlePress, true);\n document.addEventListener('keydown', handleKey);\n\n return () => {\n document.removeEventListener('pointerdown', handlePress, true);\n document.removeEventListener('keydown', handleKey);\n\n const index = openStack.indexOf(token);\n\n if (index !== -1) openStack.splice(index, 1);\n };\n }, [enabled, outside, escape]);\n\n return ref;\n};\n","// What can be reached with the Tab key. An element is left out when it is disabled, when it has\n// `tabindex=\"-1\"`, when it is `hidden` (or inside something that is, or that is `inert`) and for a\n// hidden input.\nconst TABBABLE = [\n 'a[href]',\n 'area[href]',\n 'button:not([disabled])',\n 'input:not([disabled]):not([type=\"hidden\"])',\n 'select:not([disabled])',\n 'textarea:not([disabled])',\n 'summary',\n 'audio[controls]',\n 'video[controls]',\n '[contenteditable]:not([contenteditable=\"false\"])',\n '[tabindex]',\n].join(',');\n\nconst isTabbable = (element: HTMLElement) => {\n if (element.tabIndex < 0) return false;\n\n return !element.closest('[hidden], [inert]');\n};\n\n/** The elements inside `root` that the Tab key stops on, in the order it goes through them. */\nexport const getTabbable = (root: HTMLElement) =>\n [...root.querySelectorAll<HTMLElement>(TABBABLE)].filter(isTabbable);\n","import { type RefObject, useEffect, useRef } from 'react';\n\nimport { getTabbable } from './focus.js';\n\nexport interface IFocusTrapOptions {\n /** Turn the trap on (while the dialog is open). */\n enabled: boolean;\n /** The element that gets the focus first. Without it: the first element that Tab stops on, or the dialog. */\n initialFocus?: RefObject<HTMLElement | null>;\n /** Give the focus back to what had it before the dialog opened, when it closes. @default true */\n returnFocus?: boolean;\n}\n\n// The traps that are on, the last one on top: with a dialog open over another one only the top one\n// keeps the focus in.\nconst activeTraps: symbol[] = [];\n\n/**\n * Keeps the keyboard inside a dialog, the way a dialog has to behave:\n *\n * - when it opens the focus goes into it (to `initialFocus`, or the first thing Tab stops on, or the\n * dialog itself);\n * - Tab on the last element goes to the first, and Shift + Tab on the first goes to the last, so the\n * focus cannot get to the page behind;\n * - when it closes the focus goes back to what had it before, so a person who opened it with the\n * keyboard is where they were.\n *\n * @returns the ref for the dialog (it should have `tabIndex={-1}`, so it can hold the focus when it has\n * nothing to focus in it).\n */\nexport const useFocusTrap = <T extends HTMLElement>({\n enabled,\n initialFocus,\n returnFocus = true,\n}: IFocusTrapOptions): RefObject<T | null> => {\n const ref = useRef<T | null>(null);\n const initialFocusRef = useRef(initialFocus);\n\n useEffect(() => {\n initialFocusRef.current = initialFocus;\n });\n\n useEffect(() => {\n const dialog = ref.current;\n\n if (!enabled || !dialog) return;\n\n const token = Symbol('trap');\n const previous = document.activeElement instanceof HTMLElement ? document.activeElement : null;\n\n activeTraps.push(token);\n (initialFocusRef.current?.current ?? getTabbable(dialog).at(0) ?? dialog).focus();\n\n const handleKey = (event: KeyboardEvent) => {\n if (event.key !== 'Tab' || activeTraps.at(-1) !== token) return;\n\n const tabbable = getTabbable(dialog);\n const first = tabbable.at(0);\n const last = tabbable.at(-1);\n const current = document.activeElement;\n\n if (!first || !last) {\n event.preventDefault();\n dialog.focus();\n\n return;\n }\n\n if (!(current instanceof Node) || !dialog.contains(current) || current === dialog) {\n // the focus is on the dialog itself, or got out: bring it in\n event.preventDefault();\n (event.shiftKey ? last : first).focus();\n } else if (event.shiftKey && current === first) {\n event.preventDefault();\n last.focus();\n } else if (!event.shiftKey && current === last) {\n event.preventDefault();\n first.focus();\n }\n };\n\n document.addEventListener('keydown', handleKey);\n\n return () => {\n document.removeEventListener('keydown', handleKey);\n\n const index = activeTraps.indexOf(token);\n\n if (index !== -1) activeTraps.splice(index, 1);\n\n if (returnFocus && previous?.isConnected) previous.focus();\n };\n }, [enabled, returnFocus]);\n\n return ref;\n};\n","import { ColorService, type IColor } from 'react-color-palette';\n\n// #rgb, #rgba, #rrggbb, #rrggbbaa\nconst HEX = /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i;\n\n/** The colour used when there is none, or the text is not a colour. */\nexport const FALLBACK_COLOR = '#000000';\n\n/** Whether `value` is a colour written in hexadecimal (`#fff`, `#ff00aa`, `#ff00aa80`). */\nexport const isHexColor = (value: string | undefined): value is string =>\n value !== undefined && HEX.test(value);\n\n/** The colour of a hexadecimal text; black for nothing and for text that is not a colour. */\nexport const toColor = (value: string | undefined): IColor =>\n ColorService.convert('hex', isHexColor(value) ? value : FALLBACK_COLOR);\n\n/** Two ways to write the same colour (`#FFF` and `#fff`)? Only the case is looked at. */\nexport const isSameHex = (a: string | undefined, b: string | undefined) =>\n a?.toLowerCase() === b?.toLowerCase();\n","import { addCollection, type IconifyJSON } from '@iconify/react';\n\n/**\n * Makes the registration of a bundled icon set: `register` puts the sets in Iconify (once, calling it\n * again does nothing) and `names` lists every icon, e.g. `solar:info-circle-linear`.\n *\n * A component calls `register` when it renders, not when its file is imported: an app that never\n * renders the component never runs it, and nothing depends on the bundler keeping an import that is\n * only there for its effect (the build says \"ignored-bare-import\" for those).\n */\nexport const createIconRegistry = (sets: readonly IconifyJSON[]) => {\n let registered = false;\n\n return {\n register: () => {\n if (registered) return;\n\n for (const set of sets) addCollection(set);\n registered = true;\n },\n names: sets.flatMap(({ prefix, icons, aliases }) =>\n [...Object.keys(icons), ...Object.keys(aliases ?? {})].map((name) => `${prefix}:${name}`),\n ),\n };\n};\n","import type { IconifyJSON } from '@iconify/react';\n\nimport { createIconRegistry } from '../lib/icon-registry.js';\n\n/*\n * The icons of the color input, bundled so they show without a network and without waiting for the\n * Iconify API (see `toast/toast-icons.ts`). The data is what\n * `https://api.iconify.design/<prefix>.json?icons=<name>` answers.\n */\nconst ICON_SETS: IconifyJSON[] = [\n {\n prefix: 'mage',\n width: 24,\n height: 24,\n icons: {\n 'color-picker-fill': {\n body: '<path fill=\"currentColor\" d=\"m17.042 10.894l-4-4.006a1 1 0 0 0-.2-.14l4.37 4.356a.7.7 0 0 0-.17-.21\"/><path fill=\"currentColor\" d=\"M20.962 3.002A3.56 3.56 0 0 0 18.502 2a3.64 3.64 0 0 0-2.55 1.002l-1.32 1.592a2.4 2.4 0 0 0-.68-.45a2.17 2.17 0 0 0-1.66 0a2.2 2.2 0 0 0-.7.47a2.185 2.185 0 0 0-.16 2.864l-7.4 7.421a2.64 2.64 0 0 0-.63 2.694l-.85.852a1.9 1.9 0 0 0-.41.61c-.09.227-.137.468-.14.712c.002.25.05.498.14.73q.144.325.39.582l.33.36c.176.176.383.318.61.42c.232.093.48.14.73.141c.247-.002.49-.05.72-.14a1.9 1.9 0 0 0 .6-.41l.87-.862c.36.121.743.16 1.12.11a2.63 2.63 0 0 0 1.55-.741l7.45-7.441c.371.28.825.432 1.29.43c.568 0 1.114-.222 1.52-.62a2.135 2.135 0 0 0 0-3.005l1.6-1.242l.09-.08a3.57 3.57 0 0 0-.08-5.007zm-1 3.886l-2.21 1.722a.77.77 0 0 0-.29.54a.8.8 0 0 0 .21.582l.57.57q.09.099.14.22a.5.5 0 0 1 .05.251a.56.56 0 0 1-.05.25a.6.6 0 0 1-.14.211a.69.69 0 0 1-.93 0l-.11-.1l-4.37-4.357l-.18-.17a.66.66 0 0 1 0-.931a.8.8 0 0 1 .21-.15a.7.7 0 0 1 .25 0a.7.7 0 0 1 .25 0q.115.06.21.15l.58.57a.73.73 0 0 0 .56.21a.77.77 0 0 0 .54-.27l1.78-2.153a1.94 1.94 0 0 1 1.44-.56a2.06 2.06 0 0 1 1.85 1.236a2.07 2.07 0 0 1-.35 2.199z\"/>',\n },\n },\n },\n {\n prefix: 'pepicons-pop',\n width: 26,\n height: 26,\n icons: {\n 'color-picker': {\n body: '<g fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M7.536 15.237c-1.56.616-4.257 2.37-4.728 1.9c-.306-.306.323-1.546.972-2.806h4.66z\" clip-rule=\"evenodd\"/><path d=\"M15.803 5.555a1 1 0 1 1 1.415 1.414l-8.975 8.975a1 1 0 0 1-.34.222c-.396.157-.8.355-1.753.846c-.47.242-.679.348-.933.474c-1.748.861-2.405 1.068-3.116.357c-.71-.71-.504-1.367.351-3.105c.127-.257.234-.468.48-.945c.491-.953.689-1.356.845-1.753A1 1 0 0 1 4 11.701l8.975-8.975a1 1 0 1 1 1.414 1.414l-8.832 8.833c-.174.414-.393.855-.847 1.736a52 52 0 0 0-.535 1.06l.158-.077c.24-.119.441-.221.902-.458c.88-.454 1.321-.673 1.736-.847z\"/><path d=\"M14.39 4.14a1 1 0 1 1-1.415-1.414a3 3 0 1 1 4.243 4.243a1 1 0 1 1-1.415-1.414A1 1 0 0 0 14.39 4.14m-4.953.705a1 1 0 0 1 1.415-1.414l5.656 5.657a1 1 0 0 1-1.414 1.414z\"/></g>',\n },\n 'color-picker-off': {\n body: '<g fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M7.536 15.237c-1.56.616-4.257 2.37-4.728 1.9c-.306-.306.323-1.546.972-2.806h4.66z\" clip-rule=\"evenodd\"/><path d=\"M15.803 5.555a1 1 0 1 1 1.415 1.414l-8.975 8.975a1 1 0 0 1-.34.222c-.396.157-.8.355-1.753.846c-.47.242-.679.348-.933.474c-1.748.861-2.405 1.068-3.116.357c-.71-.71-.504-1.367.351-3.105c.127-.257.234-.468.48-.945c.491-.953.689-1.356.845-1.753A1 1 0 0 1 4 11.701l8.975-8.975a1 1 0 1 1 1.414 1.414l-8.832 8.833c-.174.414-.393.855-.847 1.736a52 52 0 0 0-.535 1.06l.158-.077c.24-.119.441-.221.902-.458c.88-.454 1.321-.673 1.736-.847z\"/><path d=\"M14.39 4.14a1 1 0 1 1-1.415-1.414a3 3 0 1 1 4.243 4.243a1 1 0 1 1-1.415-1.414A1 1 0 0 0 14.39 4.14m-4.953.705a1 1 0 0 1 1.415-1.414l5.656 5.657a1 1 0 0 1-1.414 1.414zM1.293 2.707a1 1 0 0 1 1.414-1.414l16 16a1 1 0 0 1-1.414 1.414z\"/></g>',\n },\n },\n },\n];\n\n/**\n * Registers the icons above with Iconify; the components of this entry call it when they render\n * (calling it again is harmless).\n */\nexport const { register: registerColorInputIcons, names: COLOR_INPUT_ICON_NAMES } =\n createIconRegistry(ICON_SETS);\n","import '@beautinique/frontend-styles/color-input.css';\n\nimport { Icon } from '@iconify/react';\nimport { useId, useMemo, useRef, useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport { ColorPicker, type IColor } from 'react-color-palette';\n\nimport { type IFieldBase, InputError, InputLabel } from '../inputs/index.js';\nimport { getDropdownStyle, type TDropdownPlacement } from '../lib/dropdown-position.js';\nimport { mergeRefs } from '../lib/mergeRefs.js';\nimport { useAnchoredBox } from '../lib/useAnchoredBox.js';\nimport { useDismiss } from '../lib/useDismiss.js';\nimport { useFocusTrap } from '../lib/useFocusTrap.js';\nimport { isHexColor, isSameHex, toColor } from './color.js';\nimport { registerColorInputIcons } from './color-input-icons.js';\n\nexport interface IColorInput extends IFieldBase {\n /** The colour, in hexadecimal (`#ff00aa`). Anything else is shown as black. */\n value?: string;\n /** Gets the colour, in hexadecimal, as the person changes it. */\n onChange?: (value: string) => void;\n disabled?: boolean;\n /** What the field says while there is no `value`. */\n placeholder?: string;\n /** The `id` of the field, for something that has to point at it. */\n id?: string;\n /** Which side of the field the picker opens on, unless there is no room there. @default 'bottom' */\n position?: TDropdownPlacement;\n /** Leave out the slider and the field of the alpha (the transparency). @default false */\n hideAlpha?: boolean;\n /** The name of the picker for assistive technology, when the field has no `label`. @default 'Colour picker' */\n pickerLabel?: string;\n}\n\n// The tallest the picker gets: its area, its sliders and its fields.\nconst PICKER_HEIGHT = 340;\n\n/**\n * A field that shows a colour and opens a picker to change it (`react-color-palette`, which this\n * entry needs: install it). The field is one button, so the keyboard reaches it; the picker is a\n * dialog that holds the focus until it is closed (Escape, a press outside, or the field again) and\n * gives it back. The sliders need a mouse or a finger; the fields in the picker (hex, rgb) do not:\n * the colour can be typed.\n *\n * The picker is drawn in `document.body`, so a parent that scrolls or hides what overflows does not\n * cut it; it opens on the other side when there is no room, and follows the field while the page\n * scrolls.\n */\nexport const ColorInput = ({\n label = '',\n value,\n error = '',\n disabled = false,\n placeholder,\n onChange,\n id,\n containerClassName = '',\n className = '',\n position = 'bottom',\n hideAlpha = false,\n pickerLabel = 'Colour picker',\n}: IColorInput) => {\n registerColorInputIcons();\n\n const baseId = useId();\n const fieldId = id ?? `${baseId}-field`;\n const pickerId = `${baseId}-picker`;\n const errorId = `${baseId}-error`;\n\n const [isOpenState, setIsOpen] = useState(false);\n const [color, setColor] = useState<IColor>(() => toColor(value));\n const [seenValue, setSeenValue] = useState(value);\n const anchorRef = useRef<HTMLDivElement | null>(null);\n const pickerRef = useRef<HTMLDivElement | null>(null);\n\n // The app gave another colour: show it. Not when it is the colour the picker just gave it, because\n // writing it down again would lose the hue of a grey, which a hex cannot hold.\n if (value !== seenValue) {\n setSeenValue(value);\n\n if (!isSameHex(value, color.hex)) setColor(toColor(value));\n }\n\n // a field that is disabled while it is open closes, and stays closed when it is enabled again\n if (isOpenState && disabled) setIsOpen(false);\n\n const isOpen = isOpenState && !disabled;\n const box = useAnchoredBox({ isOpen, anchorRef, position, needed: PICKER_HEIGHT });\n const isShown = isOpen && box !== null;\n\n const containerRef = useDismiss<HTMLDivElement>(\n () => {\n setIsOpen(false);\n },\n { enabled: isOpen, ignore: [pickerRef] },\n );\n const trapRef = useFocusTrap<HTMLDivElement>({ enabled: isShown });\n const mergedPickerRef = useMemo(() => mergeRefs<HTMLDivElement>(pickerRef, trapRef), [trapRef]);\n\n const handleChange = (next: IColor) => {\n // text that is being typed can be no colour (`#GG0000`): the app is not told\n if (!isHexColor(next.hex)) return;\n\n setColor(next);\n onChange?.(next.hex);\n };\n\n return (\n <div\n ref={containerRef}\n className={`flex max-w-full min-w-0 flex-col gap-1.5 ${containerClassName}`}\n >\n <div className=\"relative\" ref={anchorRef}>\n <InputLabel htmlFor={fieldId} className=\"z-2\">\n {label}\n </InputLabel>\n <div\n data-invalid={error ? '' : undefined}\n className={`border-primary/10 bg-smoke-eerie focus-within:border-blue-crayola-c data-invalid:border-red-c flex items-center gap-1 overflow-hidden rounded-lg border px-3 text-[13px] ${className}`}\n >\n <button\n id={fieldId}\n type=\"button\"\n aria-haspopup=\"dialog\"\n aria-expanded={isOpen}\n aria-controls={isOpen ? pickerId : undefined}\n aria-invalid={error ? true : undefined}\n aria-describedby={error ? errorId : undefined}\n disabled={disabled}\n onClick={() => {\n setIsOpen(!isOpen);\n }}\n className={`text-primary flex min-w-0 flex-1 items-center gap-2 border-none bg-transparent text-left outline-hidden ${\n disabled ? 'cursor-no-drop' : 'cursor-pointer'\n }`}\n >\n <span\n aria-hidden=\"true\"\n className=\"border-primary/10 rounded border p-0.5 xl:p-1\"\n style={{ backgroundColor: color.hex }}\n >\n <Icon\n icon=\"mage:color-picker-fill\"\n className=\"shrink-0 [&>path]:last:fill-primary-invert [&>path]:last:stroke-primary\"\n />\n </span>\n <span className={`flex-1 truncate py-2 xl:py-3 ${value ? '' : 'text-primary/30'}`}>\n {value ? value.toUpperCase() : placeholder}\n </span>\n <Icon\n aria-hidden=\"true\"\n icon={isOpen ? 'pepicons-pop:color-picker-off' : 'pepicons-pop:color-picker'}\n className=\"shrink-0\"\n />\n </button>\n </div>\n </div>\n <InputError id={errorId} error={error} />\n {isShown &&\n createPortal(\n <div\n ref={mergedPickerRef}\n id={pickerId}\n role=\"dialog\"\n tabIndex={-1}\n aria-label={label || pickerLabel}\n className=\"border-primary/10 bg-smoke-eerie fixed z-3 overflow-hidden rounded-lg border shadow-md outline-none\"\n style={getDropdownStyle(box.rect, box.placement, window.innerHeight)}\n >\n <ColorPicker\n hideInput={['hsv']}\n hideAlpha={hideAlpha}\n color={color}\n onChange={handleChange}\n />\n </div>,\n document.body,\n )}\n </div>\n );\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/color-input/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/color-input/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC"}
|