asta-ui 0.0.0-stage → 0.2.1
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/LICENSE +21 -0
- package/README.md +69 -2
- package/bin/asta-ui.mjs +218 -0
- package/dist/accordion.d.ts +2 -0
- package/dist/accordion.js +9 -0
- package/dist/add-to-cart.d.ts +2 -0
- package/dist/add-to-cart.js +7 -0
- package/dist/avatar.d.ts +2 -0
- package/dist/avatar.js +13 -0
- package/dist/badge.d.ts +2 -0
- package/dist/badge.js +11 -0
- package/dist/base/accordion.d.ts +2 -0
- package/dist/base/accordion.js +9 -0
- package/dist/base/add-to-cart.d.ts +2 -0
- package/dist/base/add-to-cart.js +7 -0
- package/dist/base/avatar.d.ts +2 -0
- package/dist/base/avatar.js +13 -0
- package/dist/base/badge.d.ts +2 -0
- package/dist/base/badge.js +11 -0
- package/dist/base/bubble-wrap.d.ts +2 -0
- package/dist/base/bubble-wrap.js +7 -0
- package/dist/base/button.d.ts +2 -0
- package/dist/base/button.js +13 -0
- package/dist/base/candlestick.d.ts +2 -0
- package/dist/base/candlestick.js +7 -0
- package/dist/base/card-checkout.d.ts +2 -0
- package/dist/base/card-checkout.js +7 -0
- package/dist/base/cart-drawer.d.ts +2 -0
- package/dist/base/cart-drawer.js +7 -0
- package/dist/base/checkbox.d.ts +2 -0
- package/dist/base/checkbox.js +9 -0
- package/dist/base/combo-lock.d.ts +2 -0
- package/dist/base/combo-lock.js +7 -0
- package/dist/base/command-palette.d.ts +2 -0
- package/dist/base/command-palette.js +11 -0
- package/dist/base/dial-knob.d.ts +2 -0
- package/dist/base/dial-knob.js +7 -0
- package/dist/base/dialog.d.ts +2 -0
- package/dist/base/dialog.js +9 -0
- package/dist/base/dropdown-menu.d.ts +2 -0
- package/dist/base/dropdown-menu.js +10 -0
- package/dist/base/elastic-string.d.ts +2 -0
- package/dist/base/elastic-string.js +7 -0
- package/dist/base/field.d.ts +2 -0
- package/dist/base/field.js +11 -0
- package/dist/base/footer.d.ts +2 -0
- package/dist/base/footer.js +12 -0
- package/dist/base/gravity-pills.d.ts +2 -0
- package/dist/base/gravity-pills.js +7 -0
- package/dist/base/hold-to-confirm.d.ts +2 -0
- package/dist/base/hold-to-confirm.js +7 -0
- package/dist/base/ink-trail.d.ts +2 -0
- package/dist/base/ink-trail.js +7 -0
- package/dist/base/input.d.ts +2 -0
- package/dist/base/input.js +11 -0
- package/dist/base/kbd.d.ts +2 -0
- package/dist/base/kbd.js +11 -0
- package/dist/base/morse-tap.d.ts +2 -0
- package/dist/base/morse-tap.js +7 -0
- package/dist/base/motion-button.d.ts +2 -0
- package/dist/base/motion-button.js +23 -0
- package/dist/base/navbar.d.ts +2 -0
- package/dist/base/navbar.js +10 -0
- package/dist/base/needle-field.d.ts +2 -0
- package/dist/base/needle-field.js +7 -0
- package/dist/base/number-input.d.ts +2 -0
- package/dist/base/number-input.js +9 -0
- package/dist/base/order-book.d.ts +2 -0
- package/dist/base/order-book.js +7 -0
- package/dist/base/pay-methods.d.ts +2 -0
- package/dist/base/pay-methods.js +7 -0
- package/dist/base/payment-status.d.ts +2 -0
- package/dist/base/payment-status.js +7 -0
- package/dist/base/pixel-reveal.d.ts +2 -0
- package/dist/base/pixel-reveal.js +7 -0
- package/dist/base/price-chart.d.ts +2 -0
- package/dist/base/price-chart.js +7 -0
- package/dist/base/pricing.d.ts +2 -0
- package/dist/base/pricing.js +14 -0
- package/dist/base/radio-group.d.ts +2 -0
- package/dist/base/radio-group.js +11 -0
- package/dist/base/scramble-text.d.ts +2 -0
- package/dist/base/scramble-text.js +7 -0
- package/dist/base/segmented-control.d.ts +2 -0
- package/dist/base/segmented-control.js +9 -0
- package/dist/base/select.d.ts +2 -0
- package/dist/base/select.js +9 -0
- package/dist/base/settings-panel.d.ts +2 -0
- package/dist/base/settings-panel.js +10 -0
- package/dist/base/sign-in.d.ts +2 -0
- package/dist/base/sign-in.js +10 -0
- package/dist/base/skeleton.d.ts +2 -0
- package/dist/base/skeleton.js +13 -0
- package/dist/base/slider.d.ts +2 -0
- package/dist/base/slider.js +9 -0
- package/dist/base/snap-grid.d.ts +2 -0
- package/dist/base/snap-grid.js +7 -0
- package/dist/base/spinner.d.ts +2 -0
- package/dist/base/spinner.js +11 -0
- package/dist/base/split-flap.d.ts +2 -0
- package/dist/base/split-flap.js +7 -0
- package/dist/base/spotlight-grid.d.ts +2 -0
- package/dist/base/spotlight-grid.js +7 -0
- package/dist/base/switch.d.ts +2 -0
- package/dist/base/switch.js +9 -0
- package/dist/base/tabs.d.ts +2 -0
- package/dist/base/tabs.js +9 -0
- package/dist/base/tag-input.d.ts +2 -0
- package/dist/base/tag-input.js +9 -0
- package/dist/base/textarea-aui-001.d.ts +2 -0
- package/dist/base/textarea-aui-001.js +9 -0
- package/dist/base/textarea-aui-002.d.ts +2 -0
- package/dist/base/textarea-aui-002.js +9 -0
- package/dist/base/textarea-aui-003.d.ts +2 -0
- package/dist/base/textarea-aui-003.js +9 -0
- package/dist/base/textarea-aui-004.d.ts +2 -0
- package/dist/base/textarea-aui-004.js +9 -0
- package/dist/base/textarea-aui-005.d.ts +2 -0
- package/dist/base/textarea-aui-005.js +9 -0
- package/dist/base/textarea-aui-006.d.ts +2 -0
- package/dist/base/textarea-aui-006.js +9 -0
- package/dist/base/textarea-aui-007.d.ts +2 -0
- package/dist/base/textarea-aui-007.js +9 -0
- package/dist/base/textarea-aui-008.d.ts +2 -0
- package/dist/base/textarea-aui-008.js +9 -0
- package/dist/base/textarea.d.ts +2 -0
- package/dist/base/textarea.js +9 -0
- package/dist/base/toast.d.ts +2 -0
- package/dist/base/toast.js +11 -0
- package/dist/base/tooltip.d.ts +2 -0
- package/dist/base/tooltip.js +9 -0
- package/dist/base/trade-ticket.d.ts +2 -0
- package/dist/base/trade-ticket.js +7 -0
- package/dist/base/variant-picker.d.ts +2 -0
- package/dist/base/variant-picker.js +7 -0
- package/dist/base.d.ts +1 -0
- package/dist/base.js +315 -0
- package/dist/bubble-wrap.d.ts +2 -0
- package/dist/bubble-wrap.js +7 -0
- package/dist/button.d.ts +2 -0
- package/dist/button.js +13 -0
- package/dist/candlestick.d.ts +2 -0
- package/dist/candlestick.js +7 -0
- package/dist/card-checkout.d.ts +2 -0
- package/dist/card-checkout.js +7 -0
- package/dist/cart-drawer.d.ts +2 -0
- package/dist/cart-drawer.js +7 -0
- package/dist/checkbox.d.ts +2 -0
- package/dist/checkbox.js +9 -0
- package/dist/chunk-2KJNBHUV.js +137 -0
- package/dist/chunk-2OGTIQVU.js +237 -0
- package/dist/chunk-2Z5Z4YYZ.js +57 -0
- package/dist/chunk-37JQA6PI.js +98 -0
- package/dist/chunk-3JNUC3FU.js +92 -0
- package/dist/chunk-4L4EKC46.js +360 -0
- package/dist/chunk-4WK3F76T.js +57 -0
- package/dist/chunk-56BEMYK3.js +36 -0
- package/dist/chunk-5A36JYGI.js +71 -0
- package/dist/chunk-5RPJPL2V.js +102 -0
- package/dist/chunk-6322OCI4.js +189 -0
- package/dist/chunk-66OZ7CBK.js +153 -0
- package/dist/chunk-6AZKJUL4.js +67 -0
- package/dist/chunk-7L4YE6HM.js +56 -0
- package/dist/chunk-7MGB7FVD.js +221 -0
- package/dist/chunk-7RCBOTWL.js +138 -0
- package/dist/chunk-7TK42PS3.js +247 -0
- package/dist/chunk-7UMBKY3H.js +105 -0
- package/dist/chunk-AS6RA64I.js +53 -0
- package/dist/chunk-B7V4ZTKI.js +53 -0
- package/dist/chunk-BH2DLHFW.js +145 -0
- package/dist/chunk-BOJCW7Z7.js +131 -0
- package/dist/chunk-C2G5BUEG.js +197 -0
- package/dist/chunk-CLCP2GFW.js +93 -0
- package/dist/chunk-CNY76NHF.js +92 -0
- package/dist/chunk-CTO36MY2.js +87 -0
- package/dist/chunk-DK2BM32V.js +71 -0
- package/dist/chunk-DQWKBQBT.js +68 -0
- package/dist/chunk-DUGKLVQJ.js +89 -0
- package/dist/chunk-E4MX3E3B.js +66 -0
- package/dist/chunk-EG7NXGDD.js +109 -0
- package/dist/chunk-EVSTTLOT.js +141 -0
- package/dist/chunk-F5I6EK7F.js +55 -0
- package/dist/chunk-FATLQKRY.js +88 -0
- package/dist/chunk-FK2LKLRN.js +89 -0
- package/dist/chunk-FT7WZV3D.js +184 -0
- package/dist/chunk-FUNXYRSG.js +198 -0
- package/dist/chunk-H4URFOQC.js +69 -0
- package/dist/chunk-H5C7HOQJ.js +84 -0
- package/dist/chunk-JAQANAOP.js +247 -0
- package/dist/chunk-JIVLBHHE.js +266 -0
- package/dist/chunk-KEMMI76V.js +94 -0
- package/dist/chunk-N6FMS47F.js +225 -0
- package/dist/chunk-NDBLIYMX.js +62 -0
- package/dist/chunk-OBU2UOYI.js +96 -0
- package/dist/chunk-OLNMOTAD.js +141 -0
- package/dist/chunk-OQU6KGVR.js +70 -0
- package/dist/chunk-PIC5ZIR3.js +55 -0
- package/dist/chunk-PSTMF66E.js +79 -0
- package/dist/chunk-Q7OHWQP2.js +108 -0
- package/dist/chunk-QDRBMWRX.js +190 -0
- package/dist/chunk-R3LWG23K.js +138 -0
- package/dist/chunk-RS3XHHDE.js +77 -0
- package/dist/chunk-SAJ4D3Z2.js +206 -0
- package/dist/chunk-SATIWCJQ.js +141 -0
- package/dist/chunk-SRGDJSW7.js +107 -0
- package/dist/chunk-T4SOPNM5.js +107 -0
- package/dist/chunk-TCID6NNE.js +69 -0
- package/dist/chunk-TIAKMX7U.js +49 -0
- package/dist/chunk-TRIXMWR3.js +74 -0
- package/dist/chunk-TRR3J5NJ.js +28 -0
- package/dist/chunk-U7BYEW3Y.js +115 -0
- package/dist/chunk-U7VX6A6K.js +136 -0
- package/dist/chunk-UAP47MSR.js +230 -0
- package/dist/chunk-UXRTPEH7.js +57 -0
- package/dist/chunk-VGBP42IZ.js +84 -0
- package/dist/chunk-VWYX5IRP.js +92 -0
- package/dist/chunk-WRB66XD3.js +31 -0
- package/dist/chunk-WSL4JGEA.js +87 -0
- package/dist/chunk-WVIV4JBH.js +69 -0
- package/dist/chunk-WWQV7LE7.js +198 -0
- package/dist/chunk-XIU7K2YE.js +60 -0
- package/dist/chunk-XNL5BLUR.js +283 -0
- package/dist/chunk-XRVVZA2Y.js +360 -0
- package/dist/chunk-XYNJQGYX.js +107 -0
- package/dist/chunk-YON5SU2G.js +156 -0
- package/dist/chunk-Z6IAITZJ.js +214 -0
- package/dist/chunk-ZE7BT2K4.js +173 -0
- package/dist/chunk-ZN3W5PAI.js +107 -0
- package/dist/chunk-ZQV2GAWY.js +178 -0
- package/dist/chunk-ZRGPSYW6.js +237 -0
- package/dist/chunk-ZWBJUJTR.js +83 -0
- package/dist/combo-lock.d.ts +2 -0
- package/dist/combo-lock.js +7 -0
- package/dist/command-palette.d.ts +2 -0
- package/dist/command-palette.js +11 -0
- package/dist/dial-knob.d.ts +2 -0
- package/dist/dial-knob.js +7 -0
- package/dist/dialog.d.ts +2 -0
- package/dist/dialog.js +9 -0
- package/dist/dropdown-menu.d.ts +2 -0
- package/dist/dropdown-menu.js +10 -0
- package/dist/elastic-string.d.ts +2 -0
- package/dist/elastic-string.js +7 -0
- package/dist/field.d.ts +2 -0
- package/dist/field.js +11 -0
- package/dist/footer.d.ts +2 -0
- package/dist/footer.js +12 -0
- package/dist/gravity-pills.d.ts +2 -0
- package/dist/gravity-pills.js +7 -0
- package/dist/hold-to-confirm.d.ts +2 -0
- package/dist/hold-to-confirm.js +7 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +315 -0
- package/dist/ink-trail.d.ts +2 -0
- package/dist/ink-trail.js +7 -0
- package/dist/input.d.ts +2 -0
- package/dist/input.js +11 -0
- package/dist/kbd.d.ts +2 -0
- package/dist/kbd.js +11 -0
- package/dist/morse-tap.d.ts +2 -0
- package/dist/morse-tap.js +7 -0
- package/dist/motion-button.d.ts +2 -0
- package/dist/motion-button.js +23 -0
- package/dist/navbar.d.ts +2 -0
- package/dist/navbar.js +10 -0
- package/dist/needle-field.d.ts +2 -0
- package/dist/needle-field.js +7 -0
- package/dist/number-input.d.ts +2 -0
- package/dist/number-input.js +9 -0
- package/dist/order-book.d.ts +2 -0
- package/dist/order-book.js +7 -0
- package/dist/pay-methods.d.ts +2 -0
- package/dist/pay-methods.js +7 -0
- package/dist/payment-status.d.ts +2 -0
- package/dist/payment-status.js +7 -0
- package/dist/pixel-reveal.d.ts +2 -0
- package/dist/pixel-reveal.js +7 -0
- package/dist/price-chart.d.ts +2 -0
- package/dist/price-chart.js +7 -0
- package/dist/pricing.d.ts +2 -0
- package/dist/pricing.js +14 -0
- package/dist/radio-group.d.ts +2 -0
- package/dist/radio-group.js +11 -0
- package/dist/scramble-text.d.ts +2 -0
- package/dist/scramble-text.js +7 -0
- package/dist/segmented-control.d.ts +2 -0
- package/dist/segmented-control.js +9 -0
- package/dist/select.d.ts +2 -0
- package/dist/select.js +9 -0
- package/dist/settings-panel.d.ts +2 -0
- package/dist/settings-panel.js +10 -0
- package/dist/sign-in.d.ts +2 -0
- package/dist/sign-in.js +10 -0
- package/dist/skeleton.d.ts +2 -0
- package/dist/skeleton.js +13 -0
- package/dist/slider.d.ts +2 -0
- package/dist/slider.js +9 -0
- package/dist/snap-grid.d.ts +2 -0
- package/dist/snap-grid.js +7 -0
- package/dist/spinner.d.ts +2 -0
- package/dist/spinner.js +11 -0
- package/dist/split-flap.d.ts +2 -0
- package/dist/split-flap.js +7 -0
- package/dist/spotlight-grid.d.ts +2 -0
- package/dist/spotlight-grid.js +7 -0
- package/dist/styles.css +46 -0
- package/dist/switch.d.ts +2 -0
- package/dist/switch.js +9 -0
- package/dist/tabs.d.ts +2 -0
- package/dist/tabs.js +9 -0
- package/dist/tag-input.d.ts +2 -0
- package/dist/tag-input.js +9 -0
- package/dist/textarea-aui-001.d.ts +2 -0
- package/dist/textarea-aui-001.js +9 -0
- package/dist/textarea-aui-002.d.ts +2 -0
- package/dist/textarea-aui-002.js +9 -0
- package/dist/textarea-aui-003.d.ts +2 -0
- package/dist/textarea-aui-003.js +9 -0
- package/dist/textarea-aui-004.d.ts +2 -0
- package/dist/textarea-aui-004.js +9 -0
- package/dist/textarea-aui-005.d.ts +2 -0
- package/dist/textarea-aui-005.js +9 -0
- package/dist/textarea-aui-006.d.ts +2 -0
- package/dist/textarea-aui-006.js +9 -0
- package/dist/textarea-aui-007.d.ts +2 -0
- package/dist/textarea-aui-007.js +9 -0
- package/dist/textarea-aui-008.d.ts +2 -0
- package/dist/textarea-aui-008.js +9 -0
- package/dist/textarea.d.ts +2 -0
- package/dist/textarea.js +9 -0
- package/dist/toast.d.ts +2 -0
- package/dist/toast.js +11 -0
- package/dist/tooltip.d.ts +2 -0
- package/dist/tooltip.js +9 -0
- package/dist/trade-ticket.d.ts +2 -0
- package/dist/trade-ticket.js +7 -0
- package/dist/types/components/kit/accordion.d.ts +19 -0
- package/dist/types/components/kit/avatar.d.ts +32 -0
- package/dist/types/components/kit/badge.d.ts +23 -0
- package/dist/types/components/kit/base/accordion.d.ts +19 -0
- package/dist/types/components/kit/base/avatar.d.ts +32 -0
- package/dist/types/components/kit/base/button.d.ts +38 -0
- package/dist/types/components/kit/base/checkbox.d.ts +19 -0
- package/dist/types/components/kit/base/command-palette.d.ts +38 -0
- package/dist/types/components/kit/base/dialog.d.ts +21 -0
- package/dist/types/components/kit/base/dropdown-menu.d.ts +32 -0
- package/dist/types/components/kit/base/footer.d.ts +29 -0
- package/dist/types/components/kit/base/navbar.d.ts +54 -0
- package/dist/types/components/kit/base/pricing.d.ts +39 -0
- package/dist/types/components/kit/base/radio-group.d.ts +29 -0
- package/dist/types/components/kit/base/segmented-control.d.ts +23 -0
- package/dist/types/components/kit/base/select.d.ts +29 -0
- package/dist/types/components/kit/base/settings-panel.d.ts +29 -0
- package/dist/types/components/kit/base/sign-in.d.ts +17 -0
- package/dist/types/components/kit/base/slider.d.ts +27 -0
- package/dist/types/components/kit/base/switch.d.ts +22 -0
- package/dist/types/components/kit/base/tabs.d.ts +23 -0
- package/dist/types/components/kit/base/tooltip.d.ts +20 -0
- package/dist/types/components/kit/base/variants/textarea-aui-008.d.ts +23 -0
- package/dist/types/components/kit/button.d.ts +38 -0
- package/dist/types/components/kit/checkbox.d.ts +19 -0
- package/dist/types/components/kit/command-palette.d.ts +38 -0
- package/dist/types/components/kit/dialog.d.ts +21 -0
- package/dist/types/components/kit/dropdown-menu.d.ts +32 -0
- package/dist/types/components/kit/field.d.ts +19 -0
- package/dist/types/components/kit/footer.d.ts +29 -0
- package/dist/types/components/kit/input.d.ts +19 -0
- package/dist/types/components/kit/kbd.d.ts +26 -0
- package/dist/types/components/kit/motion-button.d.ts +30 -0
- package/dist/types/components/kit/navbar.d.ts +54 -0
- package/dist/types/components/kit/number-input.d.ts +20 -0
- package/dist/types/components/kit/pricing.d.ts +39 -0
- package/dist/types/components/kit/radio-group.d.ts +29 -0
- package/dist/types/components/kit/segmented-control.d.ts +23 -0
- package/dist/types/components/kit/select.d.ts +29 -0
- package/dist/types/components/kit/settings-panel.d.ts +29 -0
- package/dist/types/components/kit/sign-in.d.ts +17 -0
- package/dist/types/components/kit/skeleton.d.ts +20 -0
- package/dist/types/components/kit/slider.d.ts +27 -0
- package/dist/types/components/kit/spinner.d.ts +18 -0
- package/dist/types/components/kit/switch.d.ts +22 -0
- package/dist/types/components/kit/tabs.d.ts +23 -0
- package/dist/types/components/kit/tag-input.d.ts +16 -0
- package/dist/types/components/kit/textarea.d.ts +11 -0
- package/dist/types/components/kit/toast.d.ts +32 -0
- package/dist/types/components/kit/tooltip.d.ts +20 -0
- package/dist/types/components/kit/variants/textarea-aui-001.d.ts +13 -0
- package/dist/types/components/kit/variants/textarea-aui-002.d.ts +13 -0
- package/dist/types/components/kit/variants/textarea-aui-003.d.ts +16 -0
- package/dist/types/components/kit/variants/textarea-aui-004.d.ts +7 -0
- package/dist/types/components/kit/variants/textarea-aui-005.d.ts +8 -0
- package/dist/types/components/kit/variants/textarea-aui-006.d.ts +21 -0
- package/dist/types/components/kit/variants/textarea-aui-007.d.ts +20 -0
- package/dist/types/components/kit/variants/textarea-aui-008.d.ts +23 -0
- package/dist/types/components/lab/blocks/AddToCart.d.ts +10 -0
- package/dist/types/components/lab/blocks/BubbleWrap.d.ts +2 -0
- package/dist/types/components/lab/blocks/Candlestick.d.ts +2 -0
- package/dist/types/components/lab/blocks/CardCheckout.d.ts +5 -0
- package/dist/types/components/lab/blocks/CartDrawer.d.ts +2 -0
- package/dist/types/components/lab/blocks/ComboLock.d.ts +2 -0
- package/dist/types/components/lab/blocks/DialKnob.d.ts +2 -0
- package/dist/types/components/lab/blocks/ElasticString.d.ts +2 -0
- package/dist/types/components/lab/blocks/GravityPills.d.ts +2 -0
- package/dist/types/components/lab/blocks/HoldToConfirm.d.ts +6 -0
- package/dist/types/components/lab/blocks/InkTrail.d.ts +2 -0
- package/dist/types/components/lab/blocks/MorseTap.d.ts +2 -0
- package/dist/types/components/lab/blocks/NeedleField.d.ts +2 -0
- package/dist/types/components/lab/blocks/OrderBook.d.ts +2 -0
- package/dist/types/components/lab/blocks/PayMethods.d.ts +2 -0
- package/dist/types/components/lab/blocks/PaymentStatus.d.ts +2 -0
- package/dist/types/components/lab/blocks/PixelReveal.d.ts +2 -0
- package/dist/types/components/lab/blocks/PriceChart.d.ts +2 -0
- package/dist/types/components/lab/blocks/ScrambleText.d.ts +1 -0
- package/dist/types/components/lab/blocks/SnapGrid.d.ts +2 -0
- package/dist/types/components/lab/blocks/SplitFlap.d.ts +2 -0
- package/dist/types/components/lab/blocks/SpotlightGrid.d.ts +1 -0
- package/dist/types/components/lab/blocks/TradeTicket.d.ts +2 -0
- package/dist/types/components/lab/blocks/VariantPicker.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/accordion.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/add-to-cart.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/avatar.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/badge.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/accordion.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/add-to-cart.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/avatar.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/badge.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/bubble-wrap.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/button.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/candlestick.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/card-checkout.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/cart-drawer.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/checkbox.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/combo-lock.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/command-palette.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/dial-knob.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/dialog.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/dropdown-menu.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/elastic-string.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/field.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/footer.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/gravity-pills.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/hold-to-confirm.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/ink-trail.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/input.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/kbd.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/morse-tap.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/motion-button.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/navbar.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/needle-field.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/number-input.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/order-book.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/pay-methods.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/payment-status.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/pixel-reveal.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/price-chart.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/pricing.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/radio-group.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/scramble-text.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/segmented-control.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/select.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/settings-panel.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/sign-in.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/skeleton.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/slider.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/snap-grid.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/spinner.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/split-flap.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/spotlight-grid.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/switch.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/tabs.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/tag-input.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/textarea-aui-001.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/textarea-aui-002.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/textarea-aui-003.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/textarea-aui-004.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/textarea-aui-005.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/textarea-aui-006.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/textarea-aui-007.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/textarea-aui-008.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/textarea.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/toast.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/tooltip.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/trade-ticket.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/variant-picker.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base.d.ts +100 -0
- package/dist/types/packages/asta-ui/src/bubble-wrap.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/button.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/candlestick.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/card-checkout.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/cart-drawer.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/checkbox.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/combo-lock.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/command-palette.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/dial-knob.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/dialog.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/dropdown-menu.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/elastic-string.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/field.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/footer.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/gravity-pills.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/hold-to-confirm.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/index.d.ts +100 -0
- package/dist/types/packages/asta-ui/src/ink-trail.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/input.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/kbd.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/morse-tap.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/motion-button.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/navbar.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/needle-field.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/number-input.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/order-book.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/pay-methods.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/payment-status.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/pixel-reveal.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/price-chart.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/pricing.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/radio-group.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/scramble-text.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/segmented-control.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/select.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/settings-panel.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/sign-in.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/skeleton.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/slider.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/snap-grid.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/spinner.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/split-flap.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/spotlight-grid.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/switch.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/tabs.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/tag-input.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/textarea-aui-001.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/textarea-aui-002.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/textarea-aui-003.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/textarea-aui-004.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/textarea-aui-005.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/textarea-aui-006.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/textarea-aui-007.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/textarea-aui-008.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/textarea.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/toast.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/tooltip.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/trade-ticket.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/variant-picker.d.ts +2 -0
- package/dist/variant-picker.d.ts +2 -0
- package/dist/variant-picker.js +7 -0
- package/package.json +86 -4
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// components/lab/blocks/CartDrawer.tsx
|
|
4
|
+
import { useEffect, useRef, useState } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
var EASE = "cubic-bezier(.16,1,.3,1)";
|
|
7
|
+
var DIGITS = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
|
|
8
|
+
var FREE_AT = 150;
|
|
9
|
+
function Roll({ value }) {
|
|
10
|
+
const chars = value.split("");
|
|
11
|
+
return /* @__PURE__ */ jsx("span", { className: "inline-flex items-start leading-[1.15em] tabular-nums", "aria-label": value, children: chars.map((c, i) => {
|
|
12
|
+
const key = chars.length - i;
|
|
13
|
+
if (!/\d/.test(c))
|
|
14
|
+
return /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "inline-block h-[1.15em]", children: c }, `s${key}`);
|
|
15
|
+
return /* @__PURE__ */ jsxs("span", { "aria-hidden": true, className: "relative inline-block h-[1.15em] overflow-hidden leading-[1.15em]", children: [
|
|
16
|
+
/* @__PURE__ */ jsx("span", { className: "invisible", children: "0" }),
|
|
17
|
+
/* @__PURE__ */ jsx(
|
|
18
|
+
"span",
|
|
19
|
+
{
|
|
20
|
+
className: "absolute left-0 top-0 flex flex-col transition-transform duration-700 motion-reduce:transition-none",
|
|
21
|
+
style: { transform: `translateY(-${Number(c) * 1.15}em)`, transitionTimingFunction: EASE },
|
|
22
|
+
children: DIGITS.map((d) => /* @__PURE__ */ jsx("span", { className: "block h-[1.15em]", children: d }, d))
|
|
23
|
+
}
|
|
24
|
+
)
|
|
25
|
+
] }, `d${key}`);
|
|
26
|
+
}) });
|
|
27
|
+
}
|
|
28
|
+
var G = ({ d }) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", className: "h-[46%] w-[46%]", fill: "none", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d }) });
|
|
29
|
+
var CATALOG = [
|
|
30
|
+
{ name: "Orbit lamp", price: 70, art: /* @__PURE__ */ jsx(G, { d: "M12 3v3M7 10a5 5 0 0 1 10 0v2H7ZM9 21h6M12 12v9" }) },
|
|
31
|
+
{ name: "Field notebook", price: 34, art: /* @__PURE__ */ jsx(G, { d: "M6 3h11a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H6ZM9 3v18M12 8h4M12 11h4" }) },
|
|
32
|
+
{ name: "Stone mug", price: 28, art: /* @__PURE__ */ jsx(G, { d: "M5 7h11v8a4 4 0 0 1-4 4H9a4 4 0 0 1-4-4ZM16 9h1.5a2.5 2.5 0 0 1 0 5H16" }) },
|
|
33
|
+
{ name: "Brass pen", price: 22, art: /* @__PURE__ */ jsx(G, { d: "M16 4l4 4L9 19l-5 1 1-5ZM14 6l4 4" }) }
|
|
34
|
+
];
|
|
35
|
+
function useTween(target, ms = 600) {
|
|
36
|
+
const [v, setV] = useState(target);
|
|
37
|
+
const from = useRef(target);
|
|
38
|
+
const cur = useRef(target);
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
from.current = cur.current;
|
|
41
|
+
const still = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
42
|
+
const t0 = performance.now();
|
|
43
|
+
let id = 0;
|
|
44
|
+
const step = (t) => {
|
|
45
|
+
const k = still ? 1 : Math.min(1, (t - t0) / ms);
|
|
46
|
+
const e = 1 - Math.pow(1 - k, 4);
|
|
47
|
+
cur.current = from.current + (target - from.current) * e;
|
|
48
|
+
setV(cur.current);
|
|
49
|
+
if (k < 1) id = requestAnimationFrame(step);
|
|
50
|
+
};
|
|
51
|
+
id = requestAnimationFrame(step);
|
|
52
|
+
return () => cancelAnimationFrame(id);
|
|
53
|
+
}, [target, ms]);
|
|
54
|
+
return v;
|
|
55
|
+
}
|
|
56
|
+
var Check = () => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", className: "h-3 w-3", fill: "none", stroke: "currentColor", strokeWidth: "2.4", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M3.5 8.5l3 3 6-7" }) });
|
|
57
|
+
function CartDrawer() {
|
|
58
|
+
const [n, setN] = useState(0);
|
|
59
|
+
const [leaving, setLeaving] = useState(false);
|
|
60
|
+
const [paused, setPaused] = useState(false);
|
|
61
|
+
const idle = useRef(null);
|
|
62
|
+
const total = leaving ? 0 : CATALOG.slice(0, n).reduce((s, it) => s + it.price, 0);
|
|
63
|
+
const free = total >= FREE_AT;
|
|
64
|
+
const pct = Math.min(1, total / FREE_AT);
|
|
65
|
+
const away = Math.max(0, FREE_AT - total);
|
|
66
|
+
const shownTotal = useTween(total, 650);
|
|
67
|
+
const takeOver = () => {
|
|
68
|
+
setPaused(true);
|
|
69
|
+
setLeaving(false);
|
|
70
|
+
if (idle.current) clearTimeout(idle.current);
|
|
71
|
+
idle.current = setTimeout(() => setPaused(false), 8e3);
|
|
72
|
+
};
|
|
73
|
+
useEffect(() => () => void (idle.current && clearTimeout(idle.current)), []);
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
if (paused) return;
|
|
76
|
+
const t = [];
|
|
77
|
+
let alive = true;
|
|
78
|
+
const reset = () => {
|
|
79
|
+
if (!alive) return;
|
|
80
|
+
setN(0);
|
|
81
|
+
setLeaving(false);
|
|
82
|
+
};
|
|
83
|
+
const run = () => {
|
|
84
|
+
CATALOG.forEach((_, i) => t.push(setTimeout(() => alive && setN(i + 1), 900 + i * 1500)));
|
|
85
|
+
const end = 900 + CATALOG.length * 1500 + 1800;
|
|
86
|
+
t.push(setTimeout(() => alive && setLeaving(true), end));
|
|
87
|
+
t.push(setTimeout(reset, end + 1e3));
|
|
88
|
+
t.push(setTimeout(() => alive && run(), end + 1300));
|
|
89
|
+
};
|
|
90
|
+
t.push(setTimeout(reset, 0));
|
|
91
|
+
run();
|
|
92
|
+
return () => {
|
|
93
|
+
alive = false;
|
|
94
|
+
t.forEach(clearTimeout);
|
|
95
|
+
};
|
|
96
|
+
}, [paused]);
|
|
97
|
+
const shown = Math.min(n, CATALOG.length);
|
|
98
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex h-full w-full items-center justify-center px-5 pt-8", style: { containerType: "size" }, children: [
|
|
99
|
+
/* @__PURE__ */ jsx("style", { href: "asta-cartdrawer", precedence: "asta", children: `
|
|
100
|
+
@keyframes lab-cd-pop { 0% { transform: translateY(-14px) scale(.6); opacity: 0 } 55% { opacity: 1 } 70% { transform: translateY(1px) scale(1.04) } 100% { transform: none; opacity: 1 } }
|
|
101
|
+
@keyframes lab-cd-swap { from { opacity: 0; transform: translateY(30%); filter: blur(2px) } to { opacity: 1; transform: none; filter: none } }
|
|
102
|
+
@keyframes lab-cd-shine { from { transform: translateX(-100%) } to { transform: translateX(320%) } }
|
|
103
|
+
@media (prefers-reduced-motion: reduce) { .lab-cd-anim { animation: none !important } }
|
|
104
|
+
` }),
|
|
105
|
+
/* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col gap-[4.5cqh]", style: { maxWidth: 440 }, children: [
|
|
106
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-end justify-between gap-4", children: /* @__PURE__ */ jsx("div", { className: "relative min-w-0 text-[clamp(14px,4.2cqmin,18px)] font-medium leading-tight text-ink", children: free ? /* @__PURE__ */ jsxs("span", { className: "lab-cd-anim flex items-center gap-2 text-ink", style: { animation: `lab-cd-swap .6s ${EASE} both` }, children: [
|
|
107
|
+
/* @__PURE__ */ jsx("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-brand text-paper", children: /* @__PURE__ */ jsx(Check, {}) }),
|
|
108
|
+
"Free shipping unlocked"
|
|
109
|
+
] }, "free") : /* @__PURE__ */ jsxs("span", { className: "lab-cd-anim block", style: { animation: `lab-cd-swap .6s ${EASE} both` }, children: [
|
|
110
|
+
/* @__PURE__ */ jsx(Roll, { value: `$${away}` }),
|
|
111
|
+
" ",
|
|
112
|
+
/* @__PURE__ */ jsx("span", { className: "text-ink-2", children: "away from free shipping" })
|
|
113
|
+
] }, "away") }) }),
|
|
114
|
+
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
115
|
+
/* @__PURE__ */ jsxs("div", { className: "relative h-2 overflow-hidden rounded-[3px] bg-paper-2 shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_10%,transparent)]", children: [
|
|
116
|
+
/* @__PURE__ */ jsx(
|
|
117
|
+
"div",
|
|
118
|
+
{
|
|
119
|
+
className: "absolute inset-0 origin-left rounded-[3px] transition-transform will-change-transform motion-reduce:transition-none",
|
|
120
|
+
style: {
|
|
121
|
+
transform: `scaleX(${pct})`,
|
|
122
|
+
background: "var(--brand)",
|
|
123
|
+
transitionDuration: leaving ? "900ms" : "800ms",
|
|
124
|
+
transitionTimingFunction: leaving ? "cubic-bezier(.65,0,.35,1)" : EASE
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
),
|
|
128
|
+
/* @__PURE__ */ jsx("div", { "aria-hidden": true, className: "pointer-events-none absolute inset-0 overflow-hidden rounded-[3px]", children: free && /* @__PURE__ */ jsx(
|
|
129
|
+
"span",
|
|
130
|
+
{
|
|
131
|
+
"aria-hidden": true,
|
|
132
|
+
className: "lab-cd-anim absolute inset-y-0 w-1/3 bg-gradient-to-r from-transparent via-white/30 to-transparent",
|
|
133
|
+
style: { animation: `lab-cd-shine 1.1s cubic-bezier(.65,0,.35,1) .45s both` }
|
|
134
|
+
},
|
|
135
|
+
"shine"
|
|
136
|
+
) })
|
|
137
|
+
] }),
|
|
138
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-2 flex justify-between font-mono text-[10.5px] uppercase tracking-wider text-mute", children: [
|
|
139
|
+
/* @__PURE__ */ jsx("span", { children: "$0" }),
|
|
140
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
141
|
+
"$",
|
|
142
|
+
FREE_AT
|
|
143
|
+
] })
|
|
144
|
+
] })
|
|
145
|
+
] }),
|
|
146
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-4", children: [
|
|
147
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
148
|
+
CATALOG.slice(0, shown).map((it, i) => /* @__PURE__ */ jsx(
|
|
149
|
+
"span",
|
|
150
|
+
{
|
|
151
|
+
title: `${it.name} \xB7 $${it.price}`,
|
|
152
|
+
className: "flex transition-[opacity,transform] duration-500 motion-reduce:transition-none",
|
|
153
|
+
style: {
|
|
154
|
+
opacity: leaving ? 0 : 1,
|
|
155
|
+
transform: leaving ? "translateY(6px) scale(.85)" : "none",
|
|
156
|
+
transitionDelay: leaving ? `${i * 70}ms` : "0ms",
|
|
157
|
+
transitionTimingFunction: EASE
|
|
158
|
+
},
|
|
159
|
+
children: /* @__PURE__ */ jsx(
|
|
160
|
+
"span",
|
|
161
|
+
{
|
|
162
|
+
className: "lab-cd-anim flex h-[clamp(34px,11cqmin,46px)] w-[clamp(34px,11cqmin,46px)] items-center justify-center rounded-[9px] bg-paper-2 text-ink-2 shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_10%,transparent)]",
|
|
163
|
+
style: { animation: `lab-cd-pop .7s ${EASE} both` },
|
|
164
|
+
children: it.art
|
|
165
|
+
}
|
|
166
|
+
)
|
|
167
|
+
},
|
|
168
|
+
`${it.name}-${i}`
|
|
169
|
+
)),
|
|
170
|
+
/* @__PURE__ */ jsx(
|
|
171
|
+
"button",
|
|
172
|
+
{
|
|
173
|
+
type: "button",
|
|
174
|
+
onClick: () => {
|
|
175
|
+
takeOver();
|
|
176
|
+
setN((v) => v >= CATALOG.length ? 1 : v + 1);
|
|
177
|
+
},
|
|
178
|
+
className: "flex h-[clamp(34px,11cqmin,46px)] shrink-0 items-center gap-1 whitespace-nowrap rounded-[9px] px-2.5 text-[13px] text-mute shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_14%,transparent)] border border-dashed border-transparent outline-none transition-colors hover:bg-paper-2 hover:text-ink focus-visible:ring-2 focus-visible:ring-brand/60",
|
|
179
|
+
children: "+ add"
|
|
180
|
+
}
|
|
181
|
+
)
|
|
182
|
+
] }),
|
|
183
|
+
/* @__PURE__ */ jsxs("div", { className: "shrink-0 text-right", children: [
|
|
184
|
+
/* @__PURE__ */ jsx("div", { className: "font-mono text-[10.5px] uppercase tracking-wider text-mute", children: "Total" }),
|
|
185
|
+
/* @__PURE__ */ jsx("div", { className: "text-[clamp(18px,6cqmin,26px)] font-medium tracking-[-0.02em] text-ink", "aria-live": "polite", children: /* @__PURE__ */ jsxs("span", { className: "tabular-nums", children: [
|
|
186
|
+
"$",
|
|
187
|
+
shownTotal.toFixed(2)
|
|
188
|
+
] }) })
|
|
189
|
+
] })
|
|
190
|
+
] })
|
|
191
|
+
] })
|
|
192
|
+
] });
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export {
|
|
196
|
+
CartDrawer
|
|
197
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// components/kit/dialog.tsx
|
|
4
|
+
import { Dialog as D } from "radix-ui";
|
|
5
|
+
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
var cx = (...c) => c.filter(Boolean).join(" ");
|
|
8
|
+
var EASE = "cubic-bezier(.16,1,.3,1)";
|
|
9
|
+
var FOCUSABLE = 'a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])';
|
|
10
|
+
function Dialog({ open, onOpenChange, title, description, children, footer, contained = false, className }) {
|
|
11
|
+
const [mounted, setMounted] = useState(open);
|
|
12
|
+
if (open && !mounted) setMounted(true);
|
|
13
|
+
const panel = useRef(null);
|
|
14
|
+
const backdrop = useRef(null);
|
|
15
|
+
const opener = useRef(null);
|
|
16
|
+
const fromTrigger = () => {
|
|
17
|
+
const p = panel.current?.getBoundingClientRect();
|
|
18
|
+
const t = opener.current?.getBoundingClientRect();
|
|
19
|
+
if (!p || !t || !t.width) return "translateY(12px) scale(.96)";
|
|
20
|
+
const dx = t.left + t.width / 2 - (p.left + p.width / 2);
|
|
21
|
+
const dy = t.top + t.height / 2 - (p.top + p.height / 2);
|
|
22
|
+
return `translate(${dx}px, ${dy}px) scale(${Math.max(0.15, t.width / p.width)}, ${Math.max(0.1, t.height / p.height)})`;
|
|
23
|
+
};
|
|
24
|
+
const still = () => typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
25
|
+
useLayoutEffect(() => {
|
|
26
|
+
if (!open || !panel.current) return;
|
|
27
|
+
const p = panel.current;
|
|
28
|
+
if (!p.contains(document.activeElement)) opener.current = document.activeElement;
|
|
29
|
+
const from = still() ? "none" : fromTrigger();
|
|
30
|
+
p.animate([{ transform: from, opacity: 0, borderRadius: "999px" }, { transform: "none", opacity: 1, borderRadius: "24px" }], { duration: 520, easing: EASE });
|
|
31
|
+
backdrop.current?.animate([{ opacity: 0 }, { opacity: 1 }], { duration: 300, easing: "ease-out" });
|
|
32
|
+
}, [open]);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (open || !mounted) return;
|
|
35
|
+
const p = panel.current;
|
|
36
|
+
if (!p || still()) return setMounted(false);
|
|
37
|
+
backdrop.current?.animate([{ opacity: 1 }, { opacity: 0 }], { duration: 260, easing: "ease-in", fill: "forwards" });
|
|
38
|
+
const a = p.animate([{ transform: "none", opacity: 1 }, { transform: fromTrigger(), opacity: 0 }], { duration: 320, easing: "cubic-bezier(.7,0,.84,0)", fill: "forwards" });
|
|
39
|
+
a.onfinish = () => setMounted(false);
|
|
40
|
+
return () => {
|
|
41
|
+
a.onfinish = null;
|
|
42
|
+
};
|
|
43
|
+
}, [open, mounted]);
|
|
44
|
+
if (!mounted) return null;
|
|
45
|
+
const layer = /* @__PURE__ */ jsxs("div", { className: cx(contained ? "absolute" : "fixed", "inset-0 z-50 flex items-center justify-center p-4"), children: [
|
|
46
|
+
/* @__PURE__ */ jsx(D.Overlay, { forceMount: true, ref: backdrop, className: cx("absolute inset-0 bg-[rgb(10_10_10/0.38)] will-change-[opacity]", contained && "rounded-[inherit]") }),
|
|
47
|
+
/* @__PURE__ */ jsxs(
|
|
48
|
+
D.Content,
|
|
49
|
+
{
|
|
50
|
+
forceMount: true,
|
|
51
|
+
ref: panel,
|
|
52
|
+
...description ? {} : { "aria-describedby": void 0 },
|
|
53
|
+
onOpenAutoFocus: (e) => {
|
|
54
|
+
e.preventDefault();
|
|
55
|
+
const p = panel.current;
|
|
56
|
+
const first = p?.querySelector("[data-autofocus]") ?? p?.querySelector(FOCUSABLE);
|
|
57
|
+
(first ?? p)?.focus({ preventScroll: true });
|
|
58
|
+
},
|
|
59
|
+
onCloseAutoFocus: (e) => {
|
|
60
|
+
e.preventDefault();
|
|
61
|
+
opener.current?.focus({ preventScroll: true });
|
|
62
|
+
opener.current = null;
|
|
63
|
+
},
|
|
64
|
+
className: cx(
|
|
65
|
+
"relative w-full max-w-[400px] rounded-2xl bg-paper p-6 outline-none",
|
|
66
|
+
"shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_8%,transparent),0_24px_60px_-20px_rgb(0_0_0/0.45)]",
|
|
67
|
+
className
|
|
68
|
+
),
|
|
69
|
+
children: [
|
|
70
|
+
/* @__PURE__ */ jsx(
|
|
71
|
+
D.Close,
|
|
72
|
+
{
|
|
73
|
+
"aria-label": "Close",
|
|
74
|
+
className: "absolute right-3.5 top-3.5 flex h-8 w-8 items-center justify-center rounded-full text-mute outline-none transition-colors hover:bg-paper-2 hover:text-ink focus-visible:ring-2 focus-visible:ring-brand/50",
|
|
75
|
+
children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", className: "h-3.5 w-3.5", fill: "none", stroke: "currentColor", strokeWidth: "1.7", strokeLinecap: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "m4 4 8 8M12 4l-8 8" }) })
|
|
76
|
+
}
|
|
77
|
+
),
|
|
78
|
+
/* @__PURE__ */ jsx(D.Title, { className: "pr-8 text-[18px] font-medium tracking-[-0.02em] text-ink", children: title }),
|
|
79
|
+
description && /* @__PURE__ */ jsx(D.Description, { className: "mt-1.5 text-[14px] leading-relaxed text-mute", children: description }),
|
|
80
|
+
children && /* @__PURE__ */ jsx("div", { className: "mt-5", children }),
|
|
81
|
+
footer && /* @__PURE__ */ jsx("div", { className: "mt-6 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", children: footer })
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
)
|
|
85
|
+
] });
|
|
86
|
+
return /* @__PURE__ */ jsx(D.Root, { open, onOpenChange, children: contained ? layer : /* @__PURE__ */ jsx(D.Portal, { forceMount: true, children: layer }) });
|
|
87
|
+
}
|
|
88
|
+
var dialog_default = Dialog;
|
|
89
|
+
|
|
90
|
+
export {
|
|
91
|
+
Dialog,
|
|
92
|
+
dialog_default
|
|
93
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// components/lab/blocks/OrderBook.tsx
|
|
4
|
+
import { useEffect, useState } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
var UP = "var(--brand)";
|
|
7
|
+
var DOWN = "var(--ink-2)";
|
|
8
|
+
var LEVELS = 5;
|
|
9
|
+
var TICK = 0.01;
|
|
10
|
+
var EASE = "cubic-bezier(.16,1,.3,1)";
|
|
11
|
+
function seeded(s) {
|
|
12
|
+
return () => {
|
|
13
|
+
s = s + 1831565813 | 0;
|
|
14
|
+
let t = Math.imul(s ^ s >>> 15, 1 | s);
|
|
15
|
+
t = t + Math.imul(t ^ t >>> 7, 61 | t) ^ t;
|
|
16
|
+
return ((t ^ t >>> 14) >>> 0) / 4294967296;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function make(mid, prev, rand = Math.random) {
|
|
20
|
+
const size = () => +(0.4 + rand() * 6).toFixed(3);
|
|
21
|
+
const n = (prev?.n ?? 0) + 1;
|
|
22
|
+
const side = (k, old) => Array.from({ length: LEVELS }, (_, i) => {
|
|
23
|
+
const p = +(mid + k * (i + 1) * TICK).toFixed(2);
|
|
24
|
+
const was = old?.find((r) => r.p === p);
|
|
25
|
+
const change = !was || rand() < 0.28;
|
|
26
|
+
return { p, s: change ? size() : was.s, f: change && was ? n : was?.f ?? 0 };
|
|
27
|
+
});
|
|
28
|
+
return { mid, dir: prev ? mid >= prev.mid ? 1 : -1 : 1, asks: side(1, prev?.asks), bids: side(-1, prev?.bids), n };
|
|
29
|
+
}
|
|
30
|
+
function OrderBook() {
|
|
31
|
+
const [book, setBook] = useState(() => make(1842.5, void 0, seeded(1842)));
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
const id = setInterval(() => {
|
|
34
|
+
if (document.hidden) return;
|
|
35
|
+
setBook((b) => {
|
|
36
|
+
const r = Math.random();
|
|
37
|
+
const mid = r < 0.12 ? b.mid + TICK : r < 0.24 ? b.mid - TICK : b.mid;
|
|
38
|
+
return make(+mid.toFixed(2), b);
|
|
39
|
+
});
|
|
40
|
+
}, 1200);
|
|
41
|
+
return () => clearInterval(id);
|
|
42
|
+
}, []);
|
|
43
|
+
const cum = (rows) => rows.reduce((a, r) => [...a, (a.at(-1) ?? 0) + r.s], []);
|
|
44
|
+
const ca = cum(book.asks);
|
|
45
|
+
const cb = cum(book.bids);
|
|
46
|
+
const max = Math.max(ca.at(-1), cb.at(-1));
|
|
47
|
+
const row = (r, depth, color, key, i) => /* @__PURE__ */ jsxs("div", { className: "relative flex min-h-0 flex-1 items-center justify-between overflow-hidden rounded-[5px] px-3", children: [
|
|
48
|
+
/* @__PURE__ */ jsx(
|
|
49
|
+
"span",
|
|
50
|
+
{
|
|
51
|
+
"aria-hidden": true,
|
|
52
|
+
className: "absolute inset-y-[2px] left-0 right-0 origin-right rounded-[4px] transition-transform duration-[900ms] will-change-transform motion-reduce:transition-none",
|
|
53
|
+
style: {
|
|
54
|
+
transform: `scaleX(${depth / max})`,
|
|
55
|
+
background: `color-mix(in srgb, ${color} ${color === UP ? 20 : 7}%, transparent)`,
|
|
56
|
+
transitionTimingFunction: EASE,
|
|
57
|
+
transitionDelay: `${i * 40}ms`
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
),
|
|
61
|
+
r.f === book.n && /* @__PURE__ */ jsx(
|
|
62
|
+
"span",
|
|
63
|
+
{
|
|
64
|
+
"aria-hidden": true,
|
|
65
|
+
className: "absolute inset-0 rounded-[5px] animate-[ob-flash_1.4s_cubic-bezier(.16,1,.3,1)_forwards] motion-reduce:hidden",
|
|
66
|
+
style: { background: `color-mix(in srgb, ${color} 18%, transparent)` }
|
|
67
|
+
},
|
|
68
|
+
r.f
|
|
69
|
+
),
|
|
70
|
+
/* @__PURE__ */ jsx("span", { className: "relative tabular-nums", style: { color }, children: r.p.toFixed(2) }),
|
|
71
|
+
/* @__PURE__ */ jsx("span", { className: "relative tabular-nums text-ink-2", children: r.s.toFixed(3) })
|
|
72
|
+
] }, key);
|
|
73
|
+
const mc = book.dir > 0 ? UP : DOWN;
|
|
74
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex h-full w-full items-center justify-center px-5 pb-5 pt-14 [container-type:size]", children: [
|
|
75
|
+
/* @__PURE__ */ jsx("style", { href: "asta-orderbook", precedence: "asta", children: `@keyframes ob-flash { from { opacity: 1 } to { opacity: 0 } }` }),
|
|
76
|
+
/* @__PURE__ */ jsxs("div", { className: "flex h-full max-h-[460px] w-full max-w-[380px] flex-col gap-[3px] font-mono text-[clamp(11px,2.6cqh,15px)]", children: [
|
|
77
|
+
[...book.asks].reverse().map((r, i) => row(r, ca[LEVELS - 1 - i], DOWN, `a${i}`, LEVELS - 1 - i)),
|
|
78
|
+
/* @__PURE__ */ jsxs("div", { className: "my-1.5 flex flex-[1.6] items-center justify-between px-3", children: [
|
|
79
|
+
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2 text-[1.55em] font-medium tabular-nums tracking-[-0.02em] transition-colors duration-700", style: { color: mc, transitionTimingFunction: EASE }, children: [
|
|
80
|
+
book.mid.toFixed(2),
|
|
81
|
+
/* @__PURE__ */ jsx("span", { className: `text-[0.6em] transition-transform duration-500 ${book.dir > 0 ? "" : "rotate-180"}`, style: { transitionTimingFunction: EASE }, children: "\u25B2" })
|
|
82
|
+
] }),
|
|
83
|
+
/* @__PURE__ */ jsx("span", { className: "text-[0.85em] uppercase tracking-[0.1em] text-mute", children: "mid" })
|
|
84
|
+
] }),
|
|
85
|
+
book.bids.map((r, i) => row(r, cb[i], UP, `b${i}`, i))
|
|
86
|
+
] })
|
|
87
|
+
] });
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export {
|
|
91
|
+
OrderBook
|
|
92
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// components/lab/blocks/SnapGrid.tsx
|
|
4
|
+
import { useRef, useState } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
var CELL = 44;
|
|
7
|
+
function SnapGrid() {
|
|
8
|
+
const [pos, setPos] = useState({ x: CELL * 2, y: CELL * 1 });
|
|
9
|
+
const [dragging, setDragging] = useState(false);
|
|
10
|
+
const area = useRef(null);
|
|
11
|
+
const off = useRef({ x: 0, y: 0 });
|
|
12
|
+
const down = (e) => {
|
|
13
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
14
|
+
off.current = { x: e.clientX - pos.x, y: e.clientY - pos.y };
|
|
15
|
+
setDragging(true);
|
|
16
|
+
};
|
|
17
|
+
const move = (e) => {
|
|
18
|
+
if (!dragging) return;
|
|
19
|
+
const r = area.current.getBoundingClientRect();
|
|
20
|
+
setPos({
|
|
21
|
+
x: Math.max(0, Math.min(r.width - CELL, e.clientX - off.current.x)),
|
|
22
|
+
y: Math.max(0, Math.min(r.height - CELL, e.clientY - off.current.y))
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
const up = () => {
|
|
26
|
+
if (!dragging) return;
|
|
27
|
+
setDragging(false);
|
|
28
|
+
const r = area.current.getBoundingClientRect();
|
|
29
|
+
const maxX = Math.floor(r.width / CELL) - 1;
|
|
30
|
+
const maxY = Math.floor(r.height / CELL) - 1;
|
|
31
|
+
setPos((p) => ({
|
|
32
|
+
x: Math.min(maxX, Math.round(p.x / CELL)) * CELL,
|
|
33
|
+
y: Math.min(maxY, Math.round(p.y / CELL)) * CELL
|
|
34
|
+
}));
|
|
35
|
+
navigator.vibrate?.(8);
|
|
36
|
+
};
|
|
37
|
+
const cx = Math.round(pos.x / CELL);
|
|
38
|
+
const cy = Math.round(pos.y / CELL);
|
|
39
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex h-full w-full flex-col items-center justify-center gap-3 p-5", children: [
|
|
40
|
+
/* @__PURE__ */ jsxs(
|
|
41
|
+
"div",
|
|
42
|
+
{
|
|
43
|
+
ref: area,
|
|
44
|
+
className: "relative h-[176px] w-[264px] border border-line",
|
|
45
|
+
style: {
|
|
46
|
+
backgroundImage: "linear-gradient(rgba(233,233,228,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(233,233,228,.08) 1px, transparent 1px)",
|
|
47
|
+
backgroundSize: `${CELL}px ${CELL}px`,
|
|
48
|
+
backgroundPosition: "-1px -1px",
|
|
49
|
+
backgroundColor: "transparent",
|
|
50
|
+
transition: "opacity .3s"
|
|
51
|
+
},
|
|
52
|
+
children: [
|
|
53
|
+
/* @__PURE__ */ jsx("div", { className: `pointer-events-none absolute inset-0 bg-paper transition-opacity duration-300 ${dragging ? "opacity-0" : "opacity-100"}` }),
|
|
54
|
+
/* @__PURE__ */ jsx(
|
|
55
|
+
"div",
|
|
56
|
+
{
|
|
57
|
+
className: "pointer-events-none absolute border border-dashed border-signal/60 transition-all duration-150",
|
|
58
|
+
style: { left: cx * CELL, top: cy * CELL, width: CELL, height: CELL, opacity: dragging ? 1 : 0 }
|
|
59
|
+
}
|
|
60
|
+
),
|
|
61
|
+
/* @__PURE__ */ jsx(
|
|
62
|
+
"div",
|
|
63
|
+
{
|
|
64
|
+
onPointerDown: down,
|
|
65
|
+
onPointerMove: move,
|
|
66
|
+
onPointerUp: up,
|
|
67
|
+
onPointerCancel: up,
|
|
68
|
+
className: `absolute grid cursor-grab place-items-center bg-signal text-paper [touch-action:none] active:cursor-grabbing ${dragging ? "scale-110 shadow-[0_10px_30px_color-mix(in_srgb,var(--signal)_25%,transparent)]" : "transition-[left,top,transform] duration-500 ease-[cubic-bezier(.5,1.8,.4,.8)]"}`,
|
|
69
|
+
style: { left: pos.x, top: pos.y, width: CELL, height: CELL },
|
|
70
|
+
children: /* @__PURE__ */ jsx("span", { className: "font-mono text-[11px] uppercase tracking-[0.08em]", children: "AB" })
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
),
|
|
76
|
+
/* @__PURE__ */ jsxs("span", { className: "font-mono text-[11px] uppercase tracking-[0.08em] tabular-nums text-mute", children: [
|
|
77
|
+
"X ",
|
|
78
|
+
String(cx).padStart(2, "0"),
|
|
79
|
+
" \xB7 Y ",
|
|
80
|
+
String(cy).padStart(2, "0")
|
|
81
|
+
] })
|
|
82
|
+
] });
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export {
|
|
86
|
+
SnapGrid
|
|
87
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// components/kit/switch.tsx
|
|
4
|
+
import { Switch as Sw } from "radix-ui";
|
|
5
|
+
import { useId, useState } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
var cx = (...c) => c.filter(Boolean).join(" ");
|
|
8
|
+
var DIM = {
|
|
9
|
+
sm: { w: 30, h: 18, t: 14 },
|
|
10
|
+
md: { w: 40, h: 24, t: 20 },
|
|
11
|
+
lg: { w: 52, h: 30, t: 26 }
|
|
12
|
+
};
|
|
13
|
+
function Switch({ checked, defaultChecked = false, onCheckedChange, size = "md", disabled, label, description, id, name, className, "aria-label": ariaLabel }) {
|
|
14
|
+
const auto = useId();
|
|
15
|
+
const sid = id ?? auto;
|
|
16
|
+
const [inner, setInner] = useState(defaultChecked);
|
|
17
|
+
const [press, setPress] = useState(false);
|
|
18
|
+
const on = checked ?? inner;
|
|
19
|
+
const { w, h, t } = DIM[size];
|
|
20
|
+
const pad = (h - t) / 2;
|
|
21
|
+
const stretch = press ? t * 0.3 : 0;
|
|
22
|
+
const x = on ? w - pad * 2 - t - stretch : 0;
|
|
23
|
+
const control = /* @__PURE__ */ jsx(
|
|
24
|
+
Sw.Root,
|
|
25
|
+
{
|
|
26
|
+
id: sid,
|
|
27
|
+
name,
|
|
28
|
+
checked: on,
|
|
29
|
+
onCheckedChange: (v) => {
|
|
30
|
+
if (checked === void 0) setInner(v);
|
|
31
|
+
onCheckedChange?.(v);
|
|
32
|
+
},
|
|
33
|
+
"aria-label": ariaLabel,
|
|
34
|
+
"aria-describedby": description ? `${sid}-d` : void 0,
|
|
35
|
+
disabled,
|
|
36
|
+
onPointerDown: () => setPress(true),
|
|
37
|
+
onPointerUp: () => setPress(false),
|
|
38
|
+
onPointerLeave: () => setPress(false),
|
|
39
|
+
onKeyDown: (e) => (e.key === " " || e.key === "Enter") && setPress(true),
|
|
40
|
+
onKeyUp: () => setPress(false),
|
|
41
|
+
onBlur: () => setPress(false),
|
|
42
|
+
className: cx(
|
|
43
|
+
"relative shrink-0 rounded-full outline-none transition-[background-color,box-shadow] duration-300",
|
|
44
|
+
"focus-visible:ring-2 focus-visible:ring-brand/50 focus-visible:ring-offset-2 focus-visible:ring-offset-paper disabled:opacity-45",
|
|
45
|
+
on ? "bg-brand shadow-[inset_0_1px_2px_rgb(0_0_0/0.15)]" : "bg-[color-mix(in_srgb,var(--ink)_14%,var(--paper))] shadow-[inset_0_1px_2px_rgb(0_0_0/0.08)]"
|
|
46
|
+
),
|
|
47
|
+
style: { width: w, height: h, padding: pad },
|
|
48
|
+
children: /* @__PURE__ */ jsx(
|
|
49
|
+
Sw.Thumb,
|
|
50
|
+
{
|
|
51
|
+
className: "block rounded-full bg-white shadow-[0_1px_2px_rgb(0_0_0/0.2),0_2px_6px_-1px_rgb(0_0_0/0.18)] transition-[transform,width] duration-[450ms] ease-[cubic-bezier(.34,1.56,.64,1)] motion-reduce:transition-none",
|
|
52
|
+
style: { width: t + stretch, height: t, transform: `translateX(${x}px)` }
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
if (!label) return /* @__PURE__ */ jsx("span", { className, children: control });
|
|
58
|
+
return /* @__PURE__ */ jsxs("div", { className: cx("flex items-center justify-between gap-4", disabled && "opacity-60", className), children: [
|
|
59
|
+
/* @__PURE__ */ jsxs("span", { className: "min-w-0", children: [
|
|
60
|
+
/* @__PURE__ */ jsx("label", { htmlFor: sid, className: cx("block select-none text-[14px] leading-5 text-ink", !disabled && "cursor-pointer"), children: label }),
|
|
61
|
+
description && /* @__PURE__ */ jsx("span", { id: `${sid}-d`, className: "mt-0.5 block text-[13px] leading-snug text-mute", children: description })
|
|
62
|
+
] }),
|
|
63
|
+
control
|
|
64
|
+
] });
|
|
65
|
+
}
|
|
66
|
+
var switch_default = Switch;
|
|
67
|
+
|
|
68
|
+
export {
|
|
69
|
+
Switch,
|
|
70
|
+
switch_default
|
|
71
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// components/kit/checkbox.tsx
|
|
4
|
+
import { Checkbox as C } from "radix-ui";
|
|
5
|
+
import { useId, useState } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
var cx = (...c) => c.filter(Boolean).join(" ");
|
|
8
|
+
function Checkbox({ checked, defaultChecked = false, onCheckedChange, disabled, label, description, id, name, className }) {
|
|
9
|
+
const auto = useId();
|
|
10
|
+
const cid = id ?? auto;
|
|
11
|
+
const [inner, setInner] = useState(defaultChecked);
|
|
12
|
+
const state = checked ?? inner;
|
|
13
|
+
const on = state === true;
|
|
14
|
+
const mixed = state === "indeterminate";
|
|
15
|
+
const box = /* @__PURE__ */ jsxs(
|
|
16
|
+
C.Root,
|
|
17
|
+
{
|
|
18
|
+
id: cid,
|
|
19
|
+
name,
|
|
20
|
+
checked: state,
|
|
21
|
+
onCheckedChange: (v) => {
|
|
22
|
+
const next = v === true;
|
|
23
|
+
if (checked === void 0) setInner(next);
|
|
24
|
+
onCheckedChange?.(next);
|
|
25
|
+
},
|
|
26
|
+
"aria-describedby": description ? `${cid}-d` : void 0,
|
|
27
|
+
disabled,
|
|
28
|
+
className: cx(
|
|
29
|
+
"group/cb relative grid h-[18px] w-[18px] shrink-0 place-items-center rounded-[6px] outline-none transition-[background-color,box-shadow,transform] duration-200 active:scale-90",
|
|
30
|
+
"focus-visible:ring-2 focus-visible:ring-brand/50 focus-visible:ring-offset-2 focus-visible:ring-offset-paper disabled:opacity-45",
|
|
31
|
+
on || mixed ? "bg-brand shadow-[inset_0_1px_0_rgb(255_255_255/0.2),0_1px_2px_rgb(0_0_0/0.2)]" : "bg-paper shadow-[inset_0_0_0_1.5px_color-mix(in_srgb,var(--ink)_22%,transparent)] hover:shadow-[inset_0_0_0_1.5px_color-mix(in_srgb,var(--ink)_40%,transparent)]"
|
|
32
|
+
),
|
|
33
|
+
children: [
|
|
34
|
+
/* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", className: "col-start-1 row-start-1 h-3 w-3 text-white", fill: "none", stroke: "currentColor", strokeWidth: "2.4", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx(
|
|
35
|
+
"path",
|
|
36
|
+
{
|
|
37
|
+
d: "M3.5 8.5l3 3 6-7",
|
|
38
|
+
pathLength: 1,
|
|
39
|
+
strokeDasharray: "1",
|
|
40
|
+
className: "transition-[stroke-dashoffset] ease-[cubic-bezier(.16,1,.3,1)] motion-reduce:transition-none",
|
|
41
|
+
style: { strokeDashoffset: on ? 0 : 1, transitionDuration: on ? "420ms" : "120ms" }
|
|
42
|
+
}
|
|
43
|
+
) }),
|
|
44
|
+
/* @__PURE__ */ jsx(
|
|
45
|
+
"span",
|
|
46
|
+
{
|
|
47
|
+
"aria-hidden": true,
|
|
48
|
+
className: cx("col-start-1 row-start-1 h-[2.2px] w-2 rounded-full bg-white transition-transform duration-300 ease-[cubic-bezier(.16,1,.3,1)]", mixed ? "scale-x-100" : "scale-x-0")
|
|
49
|
+
}
|
|
50
|
+
)
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
if (!label) return /* @__PURE__ */ jsx("span", { className, children: box });
|
|
55
|
+
return /* @__PURE__ */ jsxs("div", { className: cx("flex items-start gap-3", disabled && "opacity-60", className), children: [
|
|
56
|
+
/* @__PURE__ */ jsx("span", { className: "pt-[1px]", children: box }),
|
|
57
|
+
/* @__PURE__ */ jsxs("span", { className: "min-w-0", children: [
|
|
58
|
+
/* @__PURE__ */ jsx("label", { htmlFor: cid, className: cx("block select-none text-[14px] leading-5 text-ink", !disabled && "cursor-pointer"), children: label }),
|
|
59
|
+
description && /* @__PURE__ */ jsx("span", { id: `${cid}-d`, className: "mt-0.5 block text-[13px] leading-snug text-mute", children: description })
|
|
60
|
+
] })
|
|
61
|
+
] });
|
|
62
|
+
}
|
|
63
|
+
var checkbox_default = Checkbox;
|
|
64
|
+
|
|
65
|
+
export {
|
|
66
|
+
Checkbox,
|
|
67
|
+
checkbox_default
|
|
68
|
+
};
|