asta-ui 0.2.1 → 0.3.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/dist/ai-chat.d.ts +2 -0
- package/dist/ai-chat.js +9 -0
- package/dist/alert.d.ts +2 -0
- package/dist/alert.js +9 -0
- package/dist/announcement-bar.d.ts +2 -0
- package/dist/announcement-bar.js +9 -0
- package/dist/avatar-group.d.ts +2 -0
- package/dist/avatar-group.js +10 -0
- package/dist/avatar.js +3 -1
- package/dist/base/ai-chat.d.ts +2 -0
- package/dist/base/ai-chat.js +9 -0
- package/dist/base/alert.d.ts +2 -0
- package/dist/base/alert.js +9 -0
- package/dist/base/announcement-bar.d.ts +2 -0
- package/dist/base/announcement-bar.js +9 -0
- package/dist/base/avatar-group.d.ts +2 -0
- package/dist/base/avatar-group.js +10 -0
- package/dist/base/avatar.js +3 -1
- package/dist/base/booking-slots.d.ts +2 -0
- package/dist/base/booking-slots.js +7 -0
- package/dist/base/breadcrumb.d.ts +2 -0
- package/dist/base/breadcrumb.js +9 -0
- package/dist/base/carousel.d.ts +2 -0
- package/dist/base/carousel.js +9 -0
- package/dist/base/chat-thread.d.ts +2 -0
- package/dist/base/chat-thread.js +7 -0
- package/dist/base/checkout.d.ts +2 -0
- package/dist/base/checkout.js +12 -0
- package/dist/base/color-picker.d.ts +2 -0
- package/dist/base/color-picker.js +9 -0
- package/dist/base/combobox.d.ts +2 -0
- package/dist/base/combobox.js +9 -0
- package/dist/base/comments.d.ts +2 -0
- package/dist/base/comments.js +11 -0
- package/dist/base/context-menu.d.ts +2 -0
- package/dist/base/context-menu.js +9 -0
- package/dist/base/copy-button.d.ts +2 -0
- package/dist/base/copy-button.js +9 -0
- package/dist/base/data-table.d.ts +2 -0
- package/dist/base/data-table.js +9 -0
- package/dist/base/date-picker.d.ts +2 -0
- package/dist/base/date-picker.js +9 -0
- package/dist/base/drawer.d.ts +2 -0
- package/dist/base/drawer.js +9 -0
- package/dist/base/empty-state.d.ts +2 -0
- package/dist/base/empty-state.js +10 -0
- package/dist/base/event-calendar.d.ts +2 -0
- package/dist/base/event-calendar.js +9 -0
- package/dist/base/file-upload.d.ts +2 -0
- package/dist/base/file-upload.js +11 -0
- package/dist/base/hover-card.d.ts +2 -0
- package/dist/base/hover-card.js +9 -0
- package/dist/base/image-compare.d.ts +2 -0
- package/dist/base/image-compare.js +9 -0
- package/dist/base/inline-edit.d.ts +2 -0
- package/dist/base/inline-edit.js +9 -0
- package/dist/base/kanban.d.ts +2 -0
- package/dist/base/kanban.js +10 -0
- package/dist/base/notification-center.d.ts +2 -0
- package/dist/base/notification-center.js +11 -0
- package/dist/base/notification-stack.d.ts +2 -0
- package/dist/base/notification-stack.js +7 -0
- package/dist/base/now-playing.d.ts +2 -0
- package/dist/base/now-playing.js +7 -0
- package/dist/base/onboarding.d.ts +2 -0
- package/dist/base/onboarding.js +10 -0
- package/dist/base/otp-input.d.ts +2 -0
- package/dist/base/otp-input.js +9 -0
- package/dist/base/pagination.d.ts +2 -0
- package/dist/base/pagination.js +11 -0
- package/dist/base/password-input.d.ts +2 -0
- package/dist/base/password-input.js +13 -0
- package/dist/base/payment-received.d.ts +2 -0
- package/dist/base/payment-received.js +7 -0
- package/dist/base/plan-switcher.d.ts +2 -0
- package/dist/base/plan-switcher.js +7 -0
- package/dist/base/popover.d.ts +2 -0
- package/dist/base/popover.js +9 -0
- package/dist/base/progress.d.ts +2 -0
- package/dist/base/progress.js +11 -0
- package/dist/base/range-slider.d.ts +2 -0
- package/dist/base/range-slider.js +9 -0
- package/dist/base/rating.d.ts +2 -0
- package/dist/base/rating.js +9 -0
- package/dist/base/seat-picker.d.ts +2 -0
- package/dist/base/seat-picker.js +7 -0
- package/dist/base/shipment-tracker.d.ts +2 -0
- package/dist/base/shipment-tracker.js +7 -0
- package/dist/base/sidebar.d.ts +2 -0
- package/dist/base/sidebar.js +10 -0
- package/dist/base/stat-card.d.ts +2 -0
- package/dist/base/stat-card.js +9 -0
- package/dist/base/stepper.d.ts +2 -0
- package/dist/base/stepper.js +9 -0
- package/dist/base/team-members.d.ts +2 -0
- package/dist/base/team-members.js +12 -0
- package/dist/base/timeline.d.ts +2 -0
- package/dist/base/timeline.js +9 -0
- package/dist/base/toggle-group.d.ts +2 -0
- package/dist/base/toggle-group.js +9 -0
- package/dist/base/token-swap.d.ts +2 -0
- package/dist/base/token-swap.js +7 -0
- package/dist/base/tree-view.d.ts +2 -0
- package/dist/base/tree-view.js +9 -0
- package/dist/base/wishlist.d.ts +2 -0
- package/dist/base/wishlist.js +7 -0
- package/dist/base.js +250 -46
- package/dist/booking-slots.d.ts +2 -0
- package/dist/booking-slots.js +7 -0
- package/dist/breadcrumb.d.ts +2 -0
- package/dist/breadcrumb.js +9 -0
- package/dist/carousel.d.ts +2 -0
- package/dist/carousel.js +9 -0
- package/dist/chat-thread.d.ts +2 -0
- package/dist/chat-thread.js +7 -0
- package/dist/checkout.d.ts +2 -0
- package/dist/checkout.js +12 -0
- package/dist/{chunk-VGBP42IZ.js → chunk-2LZM435Z.js} +3 -2
- package/dist/chunk-33N6SZB5.js +186 -0
- package/dist/chunk-3KS5EN3Q.js +134 -0
- package/dist/chunk-3RMCFFW2.js +228 -0
- package/dist/chunk-45VUWOHQ.js +299 -0
- package/dist/chunk-4FR6KJOJ.js +91 -0
- package/dist/chunk-4GF7WTR3.js +230 -0
- package/dist/chunk-4XM6DKEO.js +164 -0
- package/dist/chunk-57PESBSZ.js +97 -0
- package/dist/chunk-6HPSPZTF.js +232 -0
- package/dist/chunk-6VQTFRSP.js +435 -0
- package/dist/chunk-72UKXOMW.js +150 -0
- package/dist/chunk-7JNO265Q.js +431 -0
- package/dist/chunk-AYSC7AIC.js +322 -0
- package/dist/chunk-B5F775GP.js +339 -0
- package/dist/chunk-B5OESWCR.js +339 -0
- package/dist/chunk-BP3LXM3X.js +309 -0
- package/dist/chunk-CA7YQ5BJ.js +271 -0
- package/dist/chunk-DRX3KRNL.js +191 -0
- package/dist/chunk-EAUUUVUR.js +123 -0
- package/dist/chunk-EXX6YSUX.js +340 -0
- package/dist/chunk-F7LAUVDJ.js +97 -0
- package/dist/chunk-FDHU3RWR.js +213 -0
- package/dist/chunk-FJGGXXTT.js +109 -0
- package/dist/chunk-FKHNK5VC.js +172 -0
- package/dist/chunk-FY6BRODJ.js +230 -0
- package/dist/chunk-GDTSCUHY.js +234 -0
- package/dist/chunk-H7D6G3GQ.js +290 -0
- package/dist/chunk-HB7DFNZP.js +109 -0
- package/dist/{chunk-H5C7HOQJ.js → chunk-HNO6EUGJ.js} +3 -2
- package/dist/chunk-HPVPHWDM.js +197 -0
- package/dist/chunk-I5NZSWDW.js +431 -0
- package/dist/chunk-IMBCYI3F.js +114 -0
- package/dist/chunk-IS2VTYDA.js +235 -0
- package/dist/chunk-ISZ7O2Q6.js +245 -0
- package/dist/chunk-JAQKJBVJ.js +170 -0
- package/dist/chunk-KYFZ5TTK.js +271 -0
- package/dist/chunk-LBXIMJFU.js +170 -0
- package/dist/chunk-MSBN2O66.js +110 -0
- package/dist/chunk-NB7X26PY.js +388 -0
- package/dist/chunk-NIYIT2QU.js +118 -0
- package/dist/chunk-QJXPS55V.js +246 -0
- package/dist/chunk-RBTX7TVA.js +170 -0
- package/dist/chunk-RFVKRVTD.js +172 -0
- package/dist/chunk-RIWKIBEP.js +271 -0
- package/dist/chunk-RSUZHZCG.js +230 -0
- package/dist/chunk-S2DJLW6B.js +322 -0
- package/dist/chunk-SDL3JXFN.js +97 -0
- package/dist/chunk-SDOWCCM2.js +271 -0
- package/dist/chunk-SPKSRH6G.js +283 -0
- package/dist/chunk-TLODJONC.js +120 -0
- package/dist/chunk-TXRLBMFL.js +191 -0
- package/dist/chunk-UWQ26LYZ.js +133 -0
- package/dist/chunk-V3SPSN3A.js +308 -0
- package/dist/chunk-W57O4RLL.js +435 -0
- package/dist/chunk-WO36QUH3.js +188 -0
- package/dist/chunk-YLAL6ICI.js +142 -0
- package/dist/chunk-ZGMBQZDV.js +250 -0
- package/dist/chunk-ZKMEKSJZ.js +133 -0
- package/dist/color-picker.d.ts +2 -0
- package/dist/color-picker.js +9 -0
- package/dist/combobox.d.ts +2 -0
- package/dist/combobox.js +9 -0
- package/dist/comments.d.ts +2 -0
- package/dist/comments.js +11 -0
- package/dist/context-menu.d.ts +2 -0
- package/dist/context-menu.js +9 -0
- package/dist/copy-button.d.ts +2 -0
- package/dist/copy-button.js +9 -0
- package/dist/data-table.d.ts +2 -0
- package/dist/data-table.js +9 -0
- package/dist/date-picker.d.ts +2 -0
- package/dist/date-picker.js +9 -0
- package/dist/drawer.d.ts +2 -0
- package/dist/drawer.js +9 -0
- package/dist/empty-state.d.ts +2 -0
- package/dist/empty-state.js +10 -0
- package/dist/event-calendar.d.ts +2 -0
- package/dist/event-calendar.js +9 -0
- package/dist/file-upload.d.ts +2 -0
- package/dist/file-upload.js +11 -0
- package/dist/hover-card.d.ts +2 -0
- package/dist/hover-card.js +9 -0
- package/dist/image-compare.d.ts +2 -0
- package/dist/image-compare.js +9 -0
- package/dist/index.js +250 -46
- package/dist/inline-edit.d.ts +2 -0
- package/dist/inline-edit.js +9 -0
- package/dist/kanban.d.ts +2 -0
- package/dist/kanban.js +10 -0
- package/dist/notification-center.d.ts +2 -0
- package/dist/notification-center.js +11 -0
- package/dist/notification-stack.d.ts +2 -0
- package/dist/notification-stack.js +7 -0
- package/dist/now-playing.d.ts +2 -0
- package/dist/now-playing.js +7 -0
- package/dist/onboarding.d.ts +2 -0
- package/dist/onboarding.js +10 -0
- package/dist/otp-input.d.ts +2 -0
- package/dist/otp-input.js +9 -0
- package/dist/pagination.d.ts +2 -0
- package/dist/pagination.js +11 -0
- package/dist/password-input.d.ts +2 -0
- package/dist/password-input.js +13 -0
- package/dist/payment-received.d.ts +2 -0
- package/dist/payment-received.js +7 -0
- package/dist/plan-switcher.d.ts +2 -0
- package/dist/plan-switcher.js +7 -0
- package/dist/popover.d.ts +2 -0
- package/dist/popover.js +9 -0
- package/dist/progress.d.ts +2 -0
- package/dist/progress.js +11 -0
- package/dist/range-slider.d.ts +2 -0
- package/dist/range-slider.js +9 -0
- package/dist/rating.d.ts +2 -0
- package/dist/rating.js +9 -0
- package/dist/seat-picker.d.ts +2 -0
- package/dist/seat-picker.js +7 -0
- package/dist/shipment-tracker.d.ts +2 -0
- package/dist/shipment-tracker.js +7 -0
- package/dist/sidebar.d.ts +2 -0
- package/dist/sidebar.js +10 -0
- package/dist/stat-card.d.ts +2 -0
- package/dist/stat-card.js +9 -0
- package/dist/stepper.d.ts +2 -0
- package/dist/stepper.js +9 -0
- package/dist/team-members.d.ts +2 -0
- package/dist/team-members.js +12 -0
- package/dist/timeline.d.ts +2 -0
- package/dist/timeline.js +9 -0
- package/dist/toggle-group.d.ts +2 -0
- package/dist/toggle-group.js +9 -0
- package/dist/token-swap.d.ts +2 -0
- package/dist/token-swap.js +7 -0
- package/dist/tree-view.d.ts +2 -0
- package/dist/tree-view.js +9 -0
- package/dist/types/components/kit/ai-chat.d.ts +37 -0
- package/dist/types/components/kit/alert.d.ts +27 -0
- package/dist/types/components/kit/announcement-bar.d.ts +36 -0
- package/dist/types/components/kit/avatar-group.d.ts +22 -0
- package/dist/types/components/kit/avatar.d.ts +2 -0
- package/dist/types/components/kit/base/avatar-group.d.ts +22 -0
- package/dist/types/components/kit/base/avatar.d.ts +2 -0
- package/dist/types/components/kit/base/checkout.d.ts +68 -0
- package/dist/types/components/kit/base/comments.d.ts +30 -0
- package/dist/types/components/kit/base/empty-state.d.ts +29 -0
- package/dist/types/components/kit/base/kanban.d.ts +26 -0
- package/dist/types/components/kit/base/notification-center.d.ts +34 -0
- package/dist/types/components/kit/base/onboarding.d.ts +28 -0
- package/dist/types/components/kit/base/sidebar.d.ts +43 -0
- package/dist/types/components/kit/base/team-members.d.ts +46 -0
- package/dist/types/components/kit/breadcrumb.d.ts +29 -0
- package/dist/types/components/kit/carousel.d.ts +21 -0
- package/dist/types/components/kit/checkout.d.ts +68 -0
- package/dist/types/components/kit/color-picker.d.ts +28 -0
- package/dist/types/components/kit/combobox.d.ts +40 -0
- package/dist/types/components/kit/comments.d.ts +30 -0
- package/dist/types/components/kit/context-menu.d.ts +37 -0
- package/dist/types/components/kit/copy-button.d.ts +20 -0
- package/dist/types/components/kit/data-table.d.ts +47 -0
- package/dist/types/components/kit/date-picker.d.ts +40 -0
- package/dist/types/components/kit/drawer.d.ts +26 -0
- package/dist/types/components/kit/empty-state.d.ts +29 -0
- package/dist/types/components/kit/event-calendar.d.ts +34 -0
- package/dist/types/components/kit/file-upload.d.ts +37 -0
- package/dist/types/components/kit/hover-card.d.ts +31 -0
- package/dist/types/components/kit/image-compare.d.ts +29 -0
- package/dist/types/components/kit/inline-edit.d.ts +26 -0
- package/dist/types/components/kit/kanban.d.ts +26 -0
- package/dist/types/components/kit/notification-center.d.ts +34 -0
- package/dist/types/components/kit/onboarding.d.ts +28 -0
- package/dist/types/components/kit/otp-input.d.ts +28 -0
- package/dist/types/components/kit/pagination.d.ts +25 -0
- package/dist/types/components/kit/password-input.d.ts +32 -0
- package/dist/types/components/kit/popover.d.ts +40 -0
- package/dist/types/components/kit/progress.d.ts +37 -0
- package/dist/types/components/kit/range-slider.d.ts +27 -0
- package/dist/types/components/kit/rating.d.ts +23 -0
- package/dist/types/components/kit/sidebar.d.ts +43 -0
- package/dist/types/components/kit/stat-card.d.ts +24 -0
- package/dist/types/components/kit/stepper.d.ts +36 -0
- package/dist/types/components/kit/team-members.d.ts +46 -0
- package/dist/types/components/kit/timeline.d.ts +24 -0
- package/dist/types/components/kit/toggle-group.d.ts +42 -0
- package/dist/types/components/kit/tree-view.d.ts +31 -0
- package/dist/types/components/lab/blocks/BookingSlots.d.ts +2 -0
- package/dist/types/components/lab/blocks/ChatThread.d.ts +2 -0
- package/dist/types/components/lab/blocks/NotificationStack.d.ts +2 -0
- package/dist/types/components/lab/blocks/NowPlaying.d.ts +2 -0
- package/dist/types/components/lab/blocks/PaymentReceived.d.ts +2 -0
- package/dist/types/components/lab/blocks/PlanSwitcher.d.ts +2 -0
- package/dist/types/components/lab/blocks/SeatPicker.d.ts +2 -0
- package/dist/types/components/lab/blocks/ShipmentTracker.d.ts +2 -0
- package/dist/types/components/lab/blocks/TokenSwap.d.ts +2 -0
- package/dist/types/components/lab/blocks/Wishlist.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/ai-chat.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/alert.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/announcement-bar.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/avatar-group.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/ai-chat.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/alert.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/announcement-bar.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/avatar-group.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/booking-slots.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/breadcrumb.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/carousel.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/chat-thread.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/checkout.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/color-picker.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/combobox.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/comments.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/context-menu.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/copy-button.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/data-table.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/date-picker.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/drawer.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/empty-state.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/event-calendar.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/file-upload.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/hover-card.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/image-compare.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/inline-edit.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/kanban.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/notification-center.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/notification-stack.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/now-playing.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/onboarding.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/otp-input.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/pagination.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/password-input.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/payment-received.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/plan-switcher.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/popover.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/progress.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/range-slider.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/rating.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/seat-picker.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/shipment-tracker.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/sidebar.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/stat-card.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/stepper.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/team-members.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/timeline.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/toggle-group.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/token-swap.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/tree-view.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/wishlist.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base.d.ts +87 -1
- package/dist/types/packages/asta-ui/src/booking-slots.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/breadcrumb.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/carousel.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/chat-thread.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/checkout.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/color-picker.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/combobox.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/comments.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/context-menu.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/copy-button.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/data-table.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/date-picker.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/drawer.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/empty-state.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/event-calendar.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/file-upload.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/hover-card.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/image-compare.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/index.d.ts +87 -1
- package/dist/types/packages/asta-ui/src/inline-edit.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/kanban.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/notification-center.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/notification-stack.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/now-playing.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/onboarding.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/otp-input.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/pagination.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/password-input.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/payment-received.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/plan-switcher.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/popover.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/progress.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/range-slider.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/rating.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/seat-picker.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/shipment-tracker.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/sidebar.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/stat-card.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/stepper.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/team-members.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/timeline.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/toggle-group.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/token-swap.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/tree-view.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/wishlist.d.ts +2 -0
- package/dist/wishlist.d.ts +2 -0
- package/dist/wishlist.js +7 -0
- package/package.json +1 -1
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// components/kit/pagination.tsx
|
|
4
|
+
import { useLayoutEffect, useRef, useState } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
var cx = (...c) => c.filter(Boolean).join(" ");
|
|
7
|
+
function pageRange(page, count, siblings = 1, boundaries = 1) {
|
|
8
|
+
const total = boundaries * 2 + siblings * 2 + 3;
|
|
9
|
+
const range = (a, b) => Array.from({ length: Math.max(0, b - a + 1) }, (_, i) => a + i);
|
|
10
|
+
if (count <= total) return range(1, count);
|
|
11
|
+
const left = Math.max(page - siblings, boundaries + 2);
|
|
12
|
+
const right = Math.min(page + siblings, count - boundaries - 1);
|
|
13
|
+
const showStart = left > boundaries + 2;
|
|
14
|
+
const showEnd = right < count - boundaries - 1;
|
|
15
|
+
const head = range(1, boundaries);
|
|
16
|
+
const tail = range(count - boundaries + 1, count);
|
|
17
|
+
if (!showStart) return [...range(1, total - boundaries - 1), "end-gap", ...tail];
|
|
18
|
+
if (!showEnd) return [...head, "start-gap", ...range(count - (total - boundaries - 2), count)];
|
|
19
|
+
return [...head, "start-gap", ...range(left, right), "end-gap", ...tail];
|
|
20
|
+
}
|
|
21
|
+
var Arrow = ({ dir }) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", className: "h-4 w-4", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: dir === 1 ? "m6 3.5 4.5 4.5L6 12.5" : "M10 3.5 5.5 8l4.5 4.5" }) });
|
|
22
|
+
function Pagination({ count, page, defaultPage = 1, onPageChange, siblings = 1, boundaries = 1, size = "md", label = "Pagination", className }) {
|
|
23
|
+
const [inner, setInner] = useState(defaultPage);
|
|
24
|
+
const pages = Math.max(1, count);
|
|
25
|
+
const current = Math.min(pages, Math.max(1, page ?? inner));
|
|
26
|
+
const list = useRef(null);
|
|
27
|
+
const marker = useRef(null);
|
|
28
|
+
const placed = useRef(false);
|
|
29
|
+
const go = (n) => {
|
|
30
|
+
const next = Math.min(pages, Math.max(1, n));
|
|
31
|
+
if (next === current) return;
|
|
32
|
+
if (page === void 0) setInner(next);
|
|
33
|
+
onPageChange?.(next);
|
|
34
|
+
};
|
|
35
|
+
const slots = pageRange(current, pages, siblings, boundaries);
|
|
36
|
+
const place = (animate) => {
|
|
37
|
+
const btn2 = list.current?.querySelector("[aria-current=page]");
|
|
38
|
+
const m = marker.current;
|
|
39
|
+
if (!btn2 || !m) return;
|
|
40
|
+
m.style.transition = animate && placed.current ? "" : "none";
|
|
41
|
+
m.style.width = `${btn2.offsetWidth}px`;
|
|
42
|
+
m.style.transform = `translateX(${btn2.offsetLeft}px)`;
|
|
43
|
+
m.style.opacity = "1";
|
|
44
|
+
placed.current = true;
|
|
45
|
+
};
|
|
46
|
+
const placeRef = useRef(place);
|
|
47
|
+
useLayoutEffect(() => {
|
|
48
|
+
placeRef.current = place;
|
|
49
|
+
place(true);
|
|
50
|
+
});
|
|
51
|
+
useLayoutEffect(() => {
|
|
52
|
+
let first = true;
|
|
53
|
+
const ro = new ResizeObserver(() => {
|
|
54
|
+
if (first) first = false;
|
|
55
|
+
else placeRef.current(false);
|
|
56
|
+
});
|
|
57
|
+
if (list.current) ro.observe(list.current);
|
|
58
|
+
return () => ro.disconnect();
|
|
59
|
+
}, []);
|
|
60
|
+
const h = size === "md" ? "h-9 min-w-9 text-[13.5px]" : "h-8 min-w-8 text-[13px]";
|
|
61
|
+
const btn = cx("relative flex items-center justify-center rounded-lg px-2 tabular-nums outline-none transition-colors duration-200 focus-visible:ring-2 focus-visible:ring-brand/50", h);
|
|
62
|
+
return /* @__PURE__ */ jsxs(
|
|
63
|
+
"nav",
|
|
64
|
+
{
|
|
65
|
+
"aria-label": label,
|
|
66
|
+
className: cx("flex items-center gap-1", className),
|
|
67
|
+
onKeyDown: (e) => {
|
|
68
|
+
if (e.key === "ArrowLeft") go(current - 1);
|
|
69
|
+
else if (e.key === "ArrowRight") go(current + 1);
|
|
70
|
+
else return;
|
|
71
|
+
e.preventDefault();
|
|
72
|
+
requestAnimationFrame(() => list.current?.querySelector("[aria-current=page]")?.focus());
|
|
73
|
+
},
|
|
74
|
+
children: [
|
|
75
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: () => go(current - 1), disabled: current === 1, "aria-label": "Previous page", className: cx(btn, "text-ink-2 hover:bg-paper-2 hover:text-ink disabled:pointer-events-none disabled:opacity-35"), children: /* @__PURE__ */ jsx(Arrow, { dir: -1 }) }),
|
|
76
|
+
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
77
|
+
/* @__PURE__ */ jsx(
|
|
78
|
+
"span",
|
|
79
|
+
{
|
|
80
|
+
ref: marker,
|
|
81
|
+
"aria-hidden": true,
|
|
82
|
+
className: cx("pointer-events-none absolute left-0 top-0 rounded-lg bg-[color-mix(in_srgb,var(--brand)_11%,transparent)] opacity-0 transition-transform duration-[420ms] ease-[cubic-bezier(.16,1,.3,1)] motion-reduce:!transition-none", size === "md" ? "h-9" : "h-8")
|
|
83
|
+
}
|
|
84
|
+
),
|
|
85
|
+
/* @__PURE__ */ jsx("ul", { ref: list, className: "flex items-center gap-1", children: slots.map(
|
|
86
|
+
(s) => typeof s === "number" ? /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
|
|
87
|
+
"button",
|
|
88
|
+
{
|
|
89
|
+
type: "button",
|
|
90
|
+
onClick: () => go(s),
|
|
91
|
+
"aria-current": s === current ? "page" : void 0,
|
|
92
|
+
"aria-label": `Page ${s}`,
|
|
93
|
+
className: cx(btn, s === current ? "font-medium text-brand" : "text-ink-2 hover:bg-paper-2 hover:text-ink"),
|
|
94
|
+
children: s
|
|
95
|
+
}
|
|
96
|
+
) }, s) : /* @__PURE__ */ jsx("li", { "aria-hidden": true, className: cx("flex items-center justify-center text-mute", h), children: "\u2026" }, s)
|
|
97
|
+
) })
|
|
98
|
+
] }),
|
|
99
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: () => go(current + 1), disabled: current === pages, "aria-label": "Next page", className: cx(btn, "text-ink-2 hover:bg-paper-2 hover:text-ink disabled:pointer-events-none disabled:opacity-35"), children: /* @__PURE__ */ jsx(Arrow, { dir: 1 }) })
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
var pagination_default = Pagination;
|
|
105
|
+
|
|
106
|
+
export {
|
|
107
|
+
pageRange,
|
|
108
|
+
Pagination,
|
|
109
|
+
pagination_default
|
|
110
|
+
};
|
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// components/kit/context-menu.tsx
|
|
4
|
+
import {
|
|
5
|
+
useEffect,
|
|
6
|
+
useId,
|
|
7
|
+
useLayoutEffect,
|
|
8
|
+
useRef,
|
|
9
|
+
useState
|
|
10
|
+
} from "react";
|
|
11
|
+
import { createPortal } from "react-dom";
|
|
12
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
var cx = (...c) => c.filter(Boolean).join(" ");
|
|
14
|
+
var KEYFRAMES = `@keyframes asta-ctx-in { from { opacity: 0; transform: translate(var(--asta-ctx-dx, 0), var(--asta-ctx-dy, 0)) scale(.95) } }
|
|
15
|
+
@keyframes asta-ctx-out { to { opacity: 0; transform: scale(.98) } }`;
|
|
16
|
+
var PAD = 8;
|
|
17
|
+
var isItem = (e) => e !== "separator";
|
|
18
|
+
var viewport = () => ({ left: 0, top: 0, right: window.innerWidth, bottom: window.innerHeight });
|
|
19
|
+
function Panel({ uid, items, label, at, bounds, focusFirst, closing, onExited, onCloseAll, onBack, onHold, className }) {
|
|
20
|
+
const sub = "rect" in at;
|
|
21
|
+
const el = useRef(null);
|
|
22
|
+
const refs = useRef([]);
|
|
23
|
+
const enabled = items.map((it, i) => isItem(it) && !it.disabled ? i : -1).filter((i) => i >= 0);
|
|
24
|
+
const [active, setActive] = useState(focusFirst ? enabled[0] ?? -1 : -1);
|
|
25
|
+
const [open, setOpen] = useState(null);
|
|
26
|
+
const subTimer = useRef(void 0);
|
|
27
|
+
const typed = useRef({ text: "", at: 0 });
|
|
28
|
+
useLayoutEffect(() => {
|
|
29
|
+
const p = el.current;
|
|
30
|
+
if (!p) return;
|
|
31
|
+
const b = bounds();
|
|
32
|
+
const w = p.offsetWidth;
|
|
33
|
+
const h = p.offsetHeight;
|
|
34
|
+
let x;
|
|
35
|
+
let y;
|
|
36
|
+
let fromRight = false;
|
|
37
|
+
let fromBottom = false;
|
|
38
|
+
if ("rect" in at) {
|
|
39
|
+
x = at.rect.right + 2;
|
|
40
|
+
if (x + w > b.right - PAD && at.rect.left - w - 2 >= b.left + PAD) {
|
|
41
|
+
x = at.rect.left - w - 2;
|
|
42
|
+
fromRight = true;
|
|
43
|
+
}
|
|
44
|
+
y = at.rect.top - 6;
|
|
45
|
+
} else {
|
|
46
|
+
x = at.x;
|
|
47
|
+
y = at.y;
|
|
48
|
+
if (x + w > b.right - PAD && x - w >= b.left + PAD) {
|
|
49
|
+
x -= w;
|
|
50
|
+
fromRight = true;
|
|
51
|
+
}
|
|
52
|
+
if (y + h > b.bottom - PAD && y - h >= b.top + PAD) {
|
|
53
|
+
y -= h;
|
|
54
|
+
fromBottom = true;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
x = Math.max(b.left + PAD, Math.min(x, b.right - w - PAD));
|
|
58
|
+
y = Math.max(b.top + PAD, Math.min(y, b.bottom - h - PAD));
|
|
59
|
+
p.style.left = `${Math.round(x)}px`;
|
|
60
|
+
p.style.top = `${Math.round(y)}px`;
|
|
61
|
+
p.style.transformOrigin = `${fromRight ? "100%" : "0"} ${fromBottom ? "100%" : "0"}`;
|
|
62
|
+
if (sub) p.style.setProperty("--asta-ctx-dx", fromRight ? "4px" : "-4px");
|
|
63
|
+
p.focus({ preventScroll: true });
|
|
64
|
+
}, []);
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (closing) return;
|
|
67
|
+
if (active >= 0) refs.current[active]?.focus({ preventScroll: true });
|
|
68
|
+
}, [active, closing]);
|
|
69
|
+
useEffect(() => () => clearTimeout(subTimer.current), []);
|
|
70
|
+
const openSub = (i, focus) => {
|
|
71
|
+
clearTimeout(subTimer.current);
|
|
72
|
+
const b = refs.current[i];
|
|
73
|
+
setActive(i);
|
|
74
|
+
if (b) setOpen({ i, focus, rect: b.getBoundingClientRect() });
|
|
75
|
+
};
|
|
76
|
+
const closeSub = (refocus) => {
|
|
77
|
+
clearTimeout(subTimer.current);
|
|
78
|
+
if (refocus && open) refs.current[open.i]?.focus({ preventScroll: true });
|
|
79
|
+
setOpen(null);
|
|
80
|
+
};
|
|
81
|
+
const pick = (i, focus) => {
|
|
82
|
+
const it = items[i];
|
|
83
|
+
if (!isItem(it) || it.disabled) return;
|
|
84
|
+
if (it.items) return openSub(i, focus);
|
|
85
|
+
it.onSelect?.();
|
|
86
|
+
onCloseAll(true);
|
|
87
|
+
};
|
|
88
|
+
const move = (dir) => {
|
|
89
|
+
if (!enabled.length) return;
|
|
90
|
+
const at2 = enabled.indexOf(active);
|
|
91
|
+
const next = at2 < 0 ? dir === 1 ? 0 : enabled.length - 1 : (at2 + dir + enabled.length) % enabled.length;
|
|
92
|
+
setActive(enabled[next]);
|
|
93
|
+
};
|
|
94
|
+
const onKey = (e) => {
|
|
95
|
+
if (!e.currentTarget.contains(e.target) || closing) return;
|
|
96
|
+
const it = active >= 0 ? items[active] : void 0;
|
|
97
|
+
switch (e.key) {
|
|
98
|
+
case "ArrowDown":
|
|
99
|
+
e.preventDefault();
|
|
100
|
+
return move(1);
|
|
101
|
+
case "ArrowUp":
|
|
102
|
+
e.preventDefault();
|
|
103
|
+
return move(-1);
|
|
104
|
+
case "Home":
|
|
105
|
+
case "PageUp":
|
|
106
|
+
e.preventDefault();
|
|
107
|
+
return enabled.length && setActive(enabled[0]);
|
|
108
|
+
case "End":
|
|
109
|
+
case "PageDown":
|
|
110
|
+
e.preventDefault();
|
|
111
|
+
return enabled.length && setActive(enabled[enabled.length - 1]);
|
|
112
|
+
case "ArrowRight":
|
|
113
|
+
e.preventDefault();
|
|
114
|
+
if (it && isItem(it) && it.items && !it.disabled) openSub(active, true);
|
|
115
|
+
return;
|
|
116
|
+
case "ArrowLeft":
|
|
117
|
+
e.preventDefault();
|
|
118
|
+
return onBack?.();
|
|
119
|
+
case "Enter":
|
|
120
|
+
case " ":
|
|
121
|
+
e.preventDefault();
|
|
122
|
+
if (active >= 0) pick(active, true);
|
|
123
|
+
return;
|
|
124
|
+
case "Escape":
|
|
125
|
+
e.preventDefault();
|
|
126
|
+
e.stopPropagation();
|
|
127
|
+
return onBack ? onBack() : onCloseAll(true);
|
|
128
|
+
case "Tab":
|
|
129
|
+
e.preventDefault();
|
|
130
|
+
return onCloseAll(true);
|
|
131
|
+
}
|
|
132
|
+
if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) {
|
|
133
|
+
const t = typed.current;
|
|
134
|
+
t.text = e.timeStamp - t.at > 600 ? e.key.toLowerCase() : t.text + e.key.toLowerCase();
|
|
135
|
+
t.at = e.timeStamp;
|
|
136
|
+
const start = Math.max(0, enabled.indexOf(active) + (t.text.length === 1 ? 1 : 0));
|
|
137
|
+
const order = [...enabled.slice(start), ...enabled.slice(0, start)];
|
|
138
|
+
const hit = order.find((i) => items[i].label.toLowerCase().startsWith(t.text));
|
|
139
|
+
if (hit !== void 0) setActive(hit);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
const onItemMove = (i, e) => {
|
|
143
|
+
if (e.pointerType !== "mouse" || closing) return;
|
|
144
|
+
const it = items[i];
|
|
145
|
+
if (active !== i) setActive(it.disabled ? -1 : i);
|
|
146
|
+
if (it.disabled) return;
|
|
147
|
+
clearTimeout(subTimer.current);
|
|
148
|
+
if (it.items) {
|
|
149
|
+
if (open?.i !== i) subTimer.current = setTimeout(() => openSub(i, false), 100);
|
|
150
|
+
} else if (open) {
|
|
151
|
+
subTimer.current = setTimeout(() => setOpen(null), 260);
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
const node = /* @__PURE__ */ jsxs(
|
|
155
|
+
"div",
|
|
156
|
+
{
|
|
157
|
+
ref: el,
|
|
158
|
+
role: "menu",
|
|
159
|
+
"aria-label": label,
|
|
160
|
+
"aria-orientation": "vertical",
|
|
161
|
+
tabIndex: -1,
|
|
162
|
+
"data-asta-ctx": uid,
|
|
163
|
+
"data-state": closing ? "closed" : "open",
|
|
164
|
+
onKeyDown: onKey,
|
|
165
|
+
onContextMenu: (e) => e.preventDefault(),
|
|
166
|
+
onPointerEnter: () => {
|
|
167
|
+
onHold?.();
|
|
168
|
+
clearTimeout(subTimer.current);
|
|
169
|
+
},
|
|
170
|
+
onPointerLeave: (e) => {
|
|
171
|
+
if (e.pointerType === "mouse" && !open && !closing) {
|
|
172
|
+
setActive(-1);
|
|
173
|
+
el.current?.focus({ preventScroll: true });
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
onAnimationEnd: (e) => {
|
|
177
|
+
if (e.target === e.currentTarget && closing) onExited?.();
|
|
178
|
+
},
|
|
179
|
+
className: cx(
|
|
180
|
+
"fixed left-0 top-0 z-50 min-w-[220px] max-w-[calc(100vw-16px)] select-none rounded-xl bg-paper p-1.5 text-ink outline-none",
|
|
181
|
+
"shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_10%,transparent),0_14px_36px_-14px_rgb(0_0_0/0.3),0_4px_10px_-6px_rgb(0_0_0/0.12)]",
|
|
182
|
+
sub ? "animate-[asta-ctx-in_.2s_cubic-bezier(.16,1,.3,1)_both]" : "animate-[asta-ctx-in_.22s_cubic-bezier(.16,1,.3,1)_both]",
|
|
183
|
+
"data-[state=closed]:pointer-events-none data-[state=closed]:animate-[asta-ctx-out_.12s_ease-in_both] motion-reduce:![animation-duration:1ms]",
|
|
184
|
+
className
|
|
185
|
+
),
|
|
186
|
+
children: [
|
|
187
|
+
!sub && /* @__PURE__ */ jsx("style", { href: "asta-context-menu", precedence: "asta", children: KEYFRAMES }),
|
|
188
|
+
items.map((it, i) => {
|
|
189
|
+
if (!isItem(it)) return /* @__PURE__ */ jsx("div", { role: "separator", className: "mx-1.5 my-1.5 h-px bg-[color-mix(in_srgb,var(--ink)_8%,transparent)]" }, `s${i}`);
|
|
190
|
+
const on = active === i;
|
|
191
|
+
const expanded = open?.i === i;
|
|
192
|
+
return /* @__PURE__ */ jsxs(
|
|
193
|
+
"button",
|
|
194
|
+
{
|
|
195
|
+
ref: (b) => {
|
|
196
|
+
refs.current[i] = b;
|
|
197
|
+
},
|
|
198
|
+
type: "button",
|
|
199
|
+
role: "menuitem",
|
|
200
|
+
tabIndex: -1,
|
|
201
|
+
"aria-disabled": it.disabled || void 0,
|
|
202
|
+
"aria-haspopup": it.items ? "menu" : void 0,
|
|
203
|
+
"aria-expanded": it.items ? expanded : void 0,
|
|
204
|
+
"data-highlighted": on || expanded ? "" : void 0,
|
|
205
|
+
onPointerMove: (e) => onItemMove(i, e),
|
|
206
|
+
onClick: (e) => pick(i, e.detail === 0),
|
|
207
|
+
className: cx(
|
|
208
|
+
"group/item flex h-8 w-full items-center gap-2.5 rounded-lg px-2.5 text-left text-[13px] outline-none transition-colors duration-150",
|
|
209
|
+
it.disabled ? "cursor-not-allowed text-mute opacity-50" : "cursor-pointer text-ink data-[highlighted]:bg-paper-2"
|
|
210
|
+
),
|
|
211
|
+
children: [
|
|
212
|
+
it.icon && /* @__PURE__ */ jsx("span", { className: "inline-flex h-4 w-4 shrink-0 text-mute transition-colors group-data-[highlighted]/item:text-ink [&_svg]:h-4 [&_svg]:w-4", children: it.icon }),
|
|
213
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1 truncate", children: it.label }),
|
|
214
|
+
it.shortcut && !it.items && /* @__PURE__ */ jsx("kbd", { className: "font-sans text-[11.5px] tracking-wide text-mute", children: it.shortcut }),
|
|
215
|
+
it.items && /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", className: "-mr-1 h-3.5 w-3.5 text-mute", fill: "none", stroke: "currentColor", strokeWidth: "1.7", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "m6 4 4 4-4 4" }) })
|
|
216
|
+
]
|
|
217
|
+
},
|
|
218
|
+
`${it.label}${i}`
|
|
219
|
+
);
|
|
220
|
+
})
|
|
221
|
+
]
|
|
222
|
+
}
|
|
223
|
+
);
|
|
224
|
+
const child = open ? items[open.i] : void 0;
|
|
225
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
226
|
+
createPortal(node, document.body),
|
|
227
|
+
open && child && isItem(child) && child.items && !closing && /* @__PURE__ */ jsx(
|
|
228
|
+
Panel,
|
|
229
|
+
{
|
|
230
|
+
uid,
|
|
231
|
+
items: child.items,
|
|
232
|
+
label: child.label,
|
|
233
|
+
at: { rect: open.rect },
|
|
234
|
+
bounds,
|
|
235
|
+
focusFirst: open.focus,
|
|
236
|
+
onCloseAll,
|
|
237
|
+
onBack: () => closeSub(true),
|
|
238
|
+
onHold: () => clearTimeout(subTimer.current),
|
|
239
|
+
className
|
|
240
|
+
},
|
|
241
|
+
open.i
|
|
242
|
+
)
|
|
243
|
+
] });
|
|
244
|
+
}
|
|
245
|
+
function ContextMenu({ items, children, label, contained = false, disabled = false, longPress = 500, onOpenChange, className, menuClassName }) {
|
|
246
|
+
const uid = useId();
|
|
247
|
+
const wrap = useRef(null);
|
|
248
|
+
const [menu, setMenu] = useState(null);
|
|
249
|
+
const [open, setOpen] = useState(false);
|
|
250
|
+
const restore = useRef(null);
|
|
251
|
+
const press = useRef(null);
|
|
252
|
+
const lastOpen = useRef({ at: -1e9 });
|
|
253
|
+
const openRef = useRef(false);
|
|
254
|
+
const clearPress = () => {
|
|
255
|
+
if (press.current) clearTimeout(press.current.t);
|
|
256
|
+
press.current = null;
|
|
257
|
+
};
|
|
258
|
+
useEffect(() => clearPress, []);
|
|
259
|
+
const show = (x, y, keyboard) => {
|
|
260
|
+
if (disabled) return;
|
|
261
|
+
if (!openRef.current) {
|
|
262
|
+
const a = document.activeElement;
|
|
263
|
+
restore.current = a && wrap.current?.contains(a) ? a : wrap.current;
|
|
264
|
+
onOpenChange?.(true);
|
|
265
|
+
}
|
|
266
|
+
lastOpen.current = { at: performance.now() };
|
|
267
|
+
openRef.current = true;
|
|
268
|
+
setMenu((m) => ({ x, y, n: (m?.n ?? 0) + 1, keyboard }));
|
|
269
|
+
setOpen(true);
|
|
270
|
+
};
|
|
271
|
+
const showRef = useRef(show);
|
|
272
|
+
useLayoutEffect(() => {
|
|
273
|
+
showRef.current = show;
|
|
274
|
+
});
|
|
275
|
+
const hide = (refocus) => {
|
|
276
|
+
if (!openRef.current) return;
|
|
277
|
+
openRef.current = false;
|
|
278
|
+
setOpen(false);
|
|
279
|
+
onOpenChange?.(false);
|
|
280
|
+
if (refocus) restore.current?.focus({ preventScroll: true });
|
|
281
|
+
};
|
|
282
|
+
const bounds = () => {
|
|
283
|
+
const v = viewport();
|
|
284
|
+
if (!contained || !wrap.current) return v;
|
|
285
|
+
const r = wrap.current.getBoundingClientRect();
|
|
286
|
+
return { left: Math.max(v.left, r.left), top: Math.max(v.top, r.top), right: Math.min(v.right, r.right), bottom: Math.min(v.bottom, r.bottom) };
|
|
287
|
+
};
|
|
288
|
+
useEffect(() => {
|
|
289
|
+
if (!open) return;
|
|
290
|
+
const inside = (t) => t instanceof Element && t.closest(`[data-asta-ctx="${CSS.escape(uid)}"]`);
|
|
291
|
+
const onDown = (e) => {
|
|
292
|
+
if (inside(e.target)) return;
|
|
293
|
+
if (e.button === 2 && wrap.current?.contains(e.target)) return;
|
|
294
|
+
hide(false);
|
|
295
|
+
};
|
|
296
|
+
const onScroll = (e) => {
|
|
297
|
+
if (!inside(e.target)) hide(false);
|
|
298
|
+
};
|
|
299
|
+
const onLose = () => hide(false);
|
|
300
|
+
document.addEventListener("pointerdown", onDown, true);
|
|
301
|
+
window.addEventListener("scroll", onScroll, true);
|
|
302
|
+
window.addEventListener("resize", onLose);
|
|
303
|
+
window.addEventListener("blur", onLose);
|
|
304
|
+
return () => {
|
|
305
|
+
document.removeEventListener("pointerdown", onDown, true);
|
|
306
|
+
window.removeEventListener("scroll", onScroll, true);
|
|
307
|
+
window.removeEventListener("resize", onLose);
|
|
308
|
+
window.removeEventListener("blur", onLose);
|
|
309
|
+
};
|
|
310
|
+
}, [open, uid]);
|
|
311
|
+
const mine = (t) => !!wrap.current?.contains(t);
|
|
312
|
+
const onContextMenu = (e) => {
|
|
313
|
+
if (disabled || !mine(e.target)) return;
|
|
314
|
+
e.preventDefault();
|
|
315
|
+
clearPress();
|
|
316
|
+
if (openRef.current && e.timeStamp - lastOpen.current.at < 700) return;
|
|
317
|
+
if (e.clientX === 0 && e.clientY === 0) return openFromKeyboard();
|
|
318
|
+
show(e.clientX, e.clientY, false);
|
|
319
|
+
};
|
|
320
|
+
const openFromKeyboard = () => {
|
|
321
|
+
const a = document.activeElement;
|
|
322
|
+
const r = (a instanceof HTMLElement && wrap.current?.contains(a) ? a : wrap.current).getBoundingClientRect();
|
|
323
|
+
show(r.left + Math.min(16, r.width / 2), r.top + Math.min(r.height / 2, 20), true);
|
|
324
|
+
};
|
|
325
|
+
const onKeyDown = (e) => {
|
|
326
|
+
if (disabled || !mine(e.target)) return;
|
|
327
|
+
if (e.key === "ContextMenu" || e.key === "F10" && e.shiftKey) {
|
|
328
|
+
e.preventDefault();
|
|
329
|
+
openFromKeyboard();
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
const onPointerDown = (e) => {
|
|
333
|
+
if (disabled || e.pointerType === "mouse" || !mine(e.target)) return;
|
|
334
|
+
clearPress();
|
|
335
|
+
const { clientX: x, clientY: y } = e;
|
|
336
|
+
press.current = {
|
|
337
|
+
x,
|
|
338
|
+
y,
|
|
339
|
+
t: setTimeout(() => {
|
|
340
|
+
press.current = null;
|
|
341
|
+
showRef.current(x, y, false);
|
|
342
|
+
}, longPress)
|
|
343
|
+
};
|
|
344
|
+
};
|
|
345
|
+
const onPointerMove = (e) => {
|
|
346
|
+
const p = press.current;
|
|
347
|
+
if (p && Math.hypot(e.clientX - p.x, e.clientY - p.y) > 10) clearPress();
|
|
348
|
+
};
|
|
349
|
+
return /* @__PURE__ */ jsxs(
|
|
350
|
+
"div",
|
|
351
|
+
{
|
|
352
|
+
ref: wrap,
|
|
353
|
+
tabIndex: 0,
|
|
354
|
+
onContextMenu,
|
|
355
|
+
onKeyDown,
|
|
356
|
+
onPointerDown,
|
|
357
|
+
onPointerMove,
|
|
358
|
+
onPointerUp: clearPress,
|
|
359
|
+
onPointerCancel: clearPress,
|
|
360
|
+
className: cx("outline-none [-webkit-touch-callout:none] focus-visible:ring-2 focus-visible:ring-brand/50", className),
|
|
361
|
+
children: [
|
|
362
|
+
children,
|
|
363
|
+
menu && typeof document !== "undefined" && /* @__PURE__ */ jsx(
|
|
364
|
+
Panel,
|
|
365
|
+
{
|
|
366
|
+
uid,
|
|
367
|
+
items,
|
|
368
|
+
label,
|
|
369
|
+
at: { x: menu.x, y: menu.y },
|
|
370
|
+
bounds,
|
|
371
|
+
focusFirst: menu.keyboard,
|
|
372
|
+
closing: !open,
|
|
373
|
+
onExited: () => setMenu(null),
|
|
374
|
+
onCloseAll: hide,
|
|
375
|
+
className: menuClassName
|
|
376
|
+
},
|
|
377
|
+
menu.n
|
|
378
|
+
)
|
|
379
|
+
]
|
|
380
|
+
}
|
|
381
|
+
);
|
|
382
|
+
}
|
|
383
|
+
var context_menu_default = ContextMenu;
|
|
384
|
+
|
|
385
|
+
export {
|
|
386
|
+
ContextMenu,
|
|
387
|
+
context_menu_default
|
|
388
|
+
};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// components/kit/rating.tsx
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
var cx = (...c) => c.filter(Boolean).join(" ");
|
|
7
|
+
var KEYFRAMES = `@keyframes asta-rating-pop { 0% { transform: scale(1) } 40% { transform: scale(1.3) } 100% { transform: scale(1) } }`;
|
|
8
|
+
var STAR = "M12 3.2l2.6 5.28 5.83.85-4.22 4.11 1 5.8L12 16.5l-5.21 2.74 1-5.8-4.22-4.11 5.83-.85L12 3.2z";
|
|
9
|
+
function StarIcon({ fill, preview }) {
|
|
10
|
+
return /* @__PURE__ */ jsxs("span", { className: "relative block h-full w-full", children: [
|
|
11
|
+
/* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", className: "absolute inset-0 h-full w-full text-[color-mix(in_srgb,var(--ink)_13%,transparent)]", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: STAR, fill: "currentColor", stroke: "currentColor", strokeWidth: "1.6", strokeLinejoin: "round" }) }),
|
|
12
|
+
/* @__PURE__ */ jsx(
|
|
13
|
+
"svg",
|
|
14
|
+
{
|
|
15
|
+
viewBox: "0 0 24 24",
|
|
16
|
+
className: cx("absolute inset-0 h-full w-full transition-opacity duration-200", preview ? "text-[color-mix(in_srgb,var(--brand)_62%,transparent)]" : "text-brand"),
|
|
17
|
+
style: { opacity: fill ? 1 : 0, clipPath: fill === 0.5 ? "inset(0 50% 0 0)" : void 0 },
|
|
18
|
+
"aria-hidden": true,
|
|
19
|
+
children: /* @__PURE__ */ jsx("path", { d: STAR, fill: "currentColor", stroke: "currentColor", strokeWidth: "1.6", strokeLinejoin: "round" })
|
|
20
|
+
}
|
|
21
|
+
)
|
|
22
|
+
] });
|
|
23
|
+
}
|
|
24
|
+
function Rating({ value, defaultValue = 0, onChange, max = 5, allowHalf, allowClear = true, readOnly, size = "md", label = "Rating", className }) {
|
|
25
|
+
const [inner, setInner] = useState(defaultValue);
|
|
26
|
+
const current = value ?? inner;
|
|
27
|
+
const [hover, setHover] = useState(null);
|
|
28
|
+
const [pop, setPop] = useState(0);
|
|
29
|
+
const [prev, setPrev] = useState(current);
|
|
30
|
+
if (prev !== current) {
|
|
31
|
+
setPrev(current);
|
|
32
|
+
setPop((p) => p + 1);
|
|
33
|
+
}
|
|
34
|
+
const step = allowHalf ? 0.5 : 1;
|
|
35
|
+
const px = size === "md" ? 24 : 16;
|
|
36
|
+
const set = (v, click = false) => {
|
|
37
|
+
let next = Math.min(max, Math.max(0, Math.round(v / step) * step));
|
|
38
|
+
if (click && next === current && allowClear && v > 0) next = 0;
|
|
39
|
+
if (next === current) return;
|
|
40
|
+
if (value === void 0) setInner(next);
|
|
41
|
+
onChange?.(next);
|
|
42
|
+
};
|
|
43
|
+
const at = (e, i) => {
|
|
44
|
+
const r = e.currentTarget.getBoundingClientRect();
|
|
45
|
+
return allowHalf && e.clientX - r.left < r.width / 2 ? i + 0.5 : i + 1;
|
|
46
|
+
};
|
|
47
|
+
const onKey = (e) => {
|
|
48
|
+
const k = e.key;
|
|
49
|
+
if (k === "ArrowRight" || k === "ArrowUp") set(Math.min(max, current + step));
|
|
50
|
+
else if (k === "ArrowLeft" || k === "ArrowDown") set(Math.max(0, current - step));
|
|
51
|
+
else if (k === "Home") set(0);
|
|
52
|
+
else if (k === "End") set(max);
|
|
53
|
+
else if (/^[0-9]$/.test(k) && Number(k) <= max) set(Number(k));
|
|
54
|
+
else return;
|
|
55
|
+
e.preventDefault();
|
|
56
|
+
};
|
|
57
|
+
const shown = hover ?? current;
|
|
58
|
+
const filled = Math.ceil(current);
|
|
59
|
+
const stars = Array.from({ length: max }, (_, i) => {
|
|
60
|
+
const fill = shown >= i + 1 ? 1 : shown >= i + 0.5 ? 0.5 : 0;
|
|
61
|
+
return /* @__PURE__ */ jsx(
|
|
62
|
+
"span",
|
|
63
|
+
{
|
|
64
|
+
onPointerMove: readOnly ? void 0 : (e) => setHover(at(e, i)),
|
|
65
|
+
onPointerDown: readOnly ? void 0 : (e) => e.preventDefault(),
|
|
66
|
+
onClick: readOnly ? void 0 : (e) => set(at(e, i), true),
|
|
67
|
+
className: cx("block shrink-0", !readOnly && "cursor-pointer"),
|
|
68
|
+
style: { width: px, height: px },
|
|
69
|
+
children: /* @__PURE__ */ jsx(
|
|
70
|
+
"span",
|
|
71
|
+
{
|
|
72
|
+
className: cx("block h-full w-full", pop > 0 && i < filled && "animate-[asta-rating-pop_.42s_cubic-bezier(.16,1,.3,1)_both] motion-reduce:animate-none"),
|
|
73
|
+
style: { animationDelay: `${i * 45}ms` },
|
|
74
|
+
children: /* @__PURE__ */ jsx(StarIcon, { fill, preview: hover !== null && hover !== current })
|
|
75
|
+
},
|
|
76
|
+
pop
|
|
77
|
+
)
|
|
78
|
+
},
|
|
79
|
+
i
|
|
80
|
+
);
|
|
81
|
+
});
|
|
82
|
+
const text = `${current} out of ${max} stars`;
|
|
83
|
+
if (readOnly) {
|
|
84
|
+
return /* @__PURE__ */ jsxs("span", { role: "img", "aria-label": `${label}: ${text}`, className: cx("inline-flex items-center", size === "md" ? "gap-1" : "gap-0.5", className), children: [
|
|
85
|
+
/* @__PURE__ */ jsx("style", { href: "asta-rating", precedence: "asta", children: KEYFRAMES }),
|
|
86
|
+
stars
|
|
87
|
+
] });
|
|
88
|
+
}
|
|
89
|
+
return /* @__PURE__ */ jsxs(
|
|
90
|
+
"div",
|
|
91
|
+
{
|
|
92
|
+
role: "slider",
|
|
93
|
+
tabIndex: 0,
|
|
94
|
+
"aria-label": label,
|
|
95
|
+
"aria-valuemin": 0,
|
|
96
|
+
"aria-valuemax": max,
|
|
97
|
+
"aria-valuenow": current,
|
|
98
|
+
"aria-valuetext": text,
|
|
99
|
+
onKeyDown: onKey,
|
|
100
|
+
onPointerLeave: () => setHover(null),
|
|
101
|
+
className: cx(
|
|
102
|
+
"inline-flex select-none items-center rounded-md outline-none [touch-action:manipulation] focus-visible:ring-2 focus-visible:ring-brand/50 focus-visible:ring-offset-2 focus-visible:ring-offset-paper",
|
|
103
|
+
size === "md" ? "gap-1" : "gap-0.5",
|
|
104
|
+
className
|
|
105
|
+
),
|
|
106
|
+
children: [
|
|
107
|
+
/* @__PURE__ */ jsx("style", { href: "asta-rating", precedence: "asta", children: KEYFRAMES }),
|
|
108
|
+
stars
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
var rating_default = Rating;
|
|
114
|
+
|
|
115
|
+
export {
|
|
116
|
+
Rating,
|
|
117
|
+
rating_default
|
|
118
|
+
};
|