asta-ui 0.0.0-stage → 0.2.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/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,89 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// components/kit/segmented-control.tsx
|
|
4
|
+
import { RadioGroup as R } from "radix-ui";
|
|
5
|
+
import { useLayoutEffect, useRef, useState } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
var cx = (...c) => c.filter(Boolean).join(" ");
|
|
8
|
+
function SegmentedControl({ segments, value, defaultValue, onChange, size = "md", full, label, className }) {
|
|
9
|
+
const [inner, setInner] = useState(defaultValue ?? segments[0]?.value);
|
|
10
|
+
const current = value ?? inner;
|
|
11
|
+
const refs = useRef([]);
|
|
12
|
+
const box = useRef(null);
|
|
13
|
+
const [pill, setPill] = useState(null);
|
|
14
|
+
const [squash, setSquash] = useState(false);
|
|
15
|
+
const index = Math.max(0, segments.findIndex((s) => s.value === current));
|
|
16
|
+
useLayoutEffect(() => {
|
|
17
|
+
const measure = () => {
|
|
18
|
+
const el = refs.current[index];
|
|
19
|
+
if (el) setPill({ x: el.offsetLeft, w: el.offsetWidth });
|
|
20
|
+
};
|
|
21
|
+
measure();
|
|
22
|
+
const ro = new ResizeObserver(measure);
|
|
23
|
+
if (box.current) ro.observe(box.current);
|
|
24
|
+
return () => ro.disconnect();
|
|
25
|
+
}, [index]);
|
|
26
|
+
const pick = (v) => {
|
|
27
|
+
if (v === current) return;
|
|
28
|
+
setSquash(true);
|
|
29
|
+
setTimeout(() => setSquash(false), 180);
|
|
30
|
+
if (value === void 0) setInner(v);
|
|
31
|
+
onChange?.(v);
|
|
32
|
+
};
|
|
33
|
+
const h = size === "sm" ? "h-8 text-[13px]" : "h-10 text-[14px]";
|
|
34
|
+
return /* @__PURE__ */ jsxs(
|
|
35
|
+
R.Root,
|
|
36
|
+
{
|
|
37
|
+
ref: box,
|
|
38
|
+
value: current,
|
|
39
|
+
onValueChange: pick,
|
|
40
|
+
orientation: "horizontal",
|
|
41
|
+
"aria-label": label,
|
|
42
|
+
className: cx(
|
|
43
|
+
"relative inline-flex rounded-[10px] bg-paper-2 p-1 shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_6%,transparent)]",
|
|
44
|
+
full && "flex w-full",
|
|
45
|
+
className
|
|
46
|
+
),
|
|
47
|
+
children: [
|
|
48
|
+
pill && /* @__PURE__ */ jsx(
|
|
49
|
+
"span",
|
|
50
|
+
{
|
|
51
|
+
"aria-hidden": true,
|
|
52
|
+
className: "absolute left-0 top-1 bottom-1 rounded-[7px] bg-paper shadow-[0_1px_2px_rgb(0_0_0/0.08),0_3px_10px_-4px_rgb(0_0_0/0.18),inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_8%,transparent)] transition-[transform,width] duration-500 ease-[cubic-bezier(.16,1,.3,1)] motion-reduce:transition-none",
|
|
53
|
+
style: { transform: `translateX(${pill.x}px) scaleY(${squash ? 0.86 : 1})`, width: pill.w }
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
segments.map((s, i) => {
|
|
57
|
+
const on = i === index;
|
|
58
|
+
return /* @__PURE__ */ jsxs(
|
|
59
|
+
R.Item,
|
|
60
|
+
{
|
|
61
|
+
value: s.value,
|
|
62
|
+
ref: (el) => {
|
|
63
|
+
refs.current[i] = el;
|
|
64
|
+
},
|
|
65
|
+
className: cx(
|
|
66
|
+
"relative z-10 inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-[7px] font-medium tracking-[-0.01em] outline-none transition-colors duration-300 focus-visible:ring-2 focus-visible:ring-brand/50 [&_svg]:h-[1.05em] [&_svg]:w-[1.05em]",
|
|
67
|
+
h,
|
|
68
|
+
size === "sm" ? "px-3" : "px-4",
|
|
69
|
+
full && "flex-1",
|
|
70
|
+
on ? "text-ink" : "text-mute hover:text-ink"
|
|
71
|
+
),
|
|
72
|
+
children: [
|
|
73
|
+
s.icon,
|
|
74
|
+
s.label
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
s.value
|
|
78
|
+
);
|
|
79
|
+
})
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
var segmented_control_default = SegmentedControl;
|
|
85
|
+
|
|
86
|
+
export {
|
|
87
|
+
SegmentedControl,
|
|
88
|
+
segmented_control_default
|
|
89
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// components/lab/blocks/InkTrail.tsx
|
|
4
|
+
import { useEffect, useRef } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
function InkTrail() {
|
|
7
|
+
const ref = useRef(null);
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
const canvas = ref.current;
|
|
10
|
+
const css = getComputedStyle(canvas);
|
|
11
|
+
const SIG = css.getPropertyValue("--color-signal").trim() || "#c5f82a";
|
|
12
|
+
const ctx = canvas.getContext("2d");
|
|
13
|
+
const pts = [];
|
|
14
|
+
let raf = 0;
|
|
15
|
+
let dpr = 1;
|
|
16
|
+
const LIFE = 700;
|
|
17
|
+
const resize = () => {
|
|
18
|
+
dpr = Math.min(devicePixelRatio || 1, 2);
|
|
19
|
+
canvas.width = canvas.clientWidth * dpr;
|
|
20
|
+
canvas.height = canvas.clientHeight * dpr;
|
|
21
|
+
};
|
|
22
|
+
const loop = (now) => {
|
|
23
|
+
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
24
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
25
|
+
while (pts.length && now - pts[0].t > LIFE) pts.shift();
|
|
26
|
+
ctx.lineCap = "round";
|
|
27
|
+
ctx.lineJoin = "round";
|
|
28
|
+
for (let i = 1; i < pts.length; i++) {
|
|
29
|
+
const a = pts[i - 1];
|
|
30
|
+
const b = pts[i];
|
|
31
|
+
const life = 1 - (now - b.t) / LIFE;
|
|
32
|
+
ctx.strokeStyle = SIG;
|
|
33
|
+
ctx.globalAlpha = Math.max(0, life);
|
|
34
|
+
ctx.lineWidth = 2 + life * 14;
|
|
35
|
+
ctx.beginPath();
|
|
36
|
+
ctx.moveTo(a.x, a.y);
|
|
37
|
+
ctx.lineTo(b.x, b.y);
|
|
38
|
+
ctx.stroke();
|
|
39
|
+
}
|
|
40
|
+
ctx.globalAlpha = 1;
|
|
41
|
+
raf = requestAnimationFrame(loop);
|
|
42
|
+
};
|
|
43
|
+
const move = (e) => {
|
|
44
|
+
const r = canvas.getBoundingClientRect();
|
|
45
|
+
pts.push({ x: e.clientX - r.left, y: e.clientY - r.top, t: performance.now() });
|
|
46
|
+
};
|
|
47
|
+
resize();
|
|
48
|
+
const ro = new ResizeObserver(resize);
|
|
49
|
+
ro.observe(canvas);
|
|
50
|
+
canvas.addEventListener("pointermove", move);
|
|
51
|
+
raf = requestAnimationFrame(loop);
|
|
52
|
+
return () => {
|
|
53
|
+
cancelAnimationFrame(raf);
|
|
54
|
+
ro.disconnect();
|
|
55
|
+
canvas.removeEventListener("pointermove", move);
|
|
56
|
+
};
|
|
57
|
+
}, []);
|
|
58
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative h-full w-full", children: [
|
|
59
|
+
/* @__PURE__ */ jsx("canvas", { ref, className: "absolute inset-0 h-full w-full [touch-action:none]" }),
|
|
60
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium leading-[0.92] tracking-[-0.05em] pointer-events-none absolute inset-0 flex items-center justify-center text-3xl text-ink/15", children: "draw here" })
|
|
61
|
+
] });
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export {
|
|
65
|
+
InkTrail
|
|
66
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// components/lab/blocks/HoldToConfirm.tsx
|
|
4
|
+
import { useEffect, useRef, useState } from "react";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
var DURATION = 1400;
|
|
7
|
+
var TICKS = 24;
|
|
8
|
+
function HoldToConfirm() {
|
|
9
|
+
const [p, setP] = useState(0);
|
|
10
|
+
const [done, setDone] = useState(false);
|
|
11
|
+
const [shake, setShake] = useState(0);
|
|
12
|
+
const raf = useRef(0);
|
|
13
|
+
const holding = useRef(false);
|
|
14
|
+
const progress = useRef(0);
|
|
15
|
+
const loop = (dir) => {
|
|
16
|
+
let last = performance.now();
|
|
17
|
+
const step = (t) => {
|
|
18
|
+
const dt = t - last;
|
|
19
|
+
last = t;
|
|
20
|
+
progress.current = Math.max(0, Math.min(1, progress.current + (dir === 1 ? dt / DURATION : -dt / 380)));
|
|
21
|
+
setP(progress.current);
|
|
22
|
+
setShake(dir === 1 ? Math.sin(t / 22) * progress.current ** 2 * 1.8 : 0);
|
|
23
|
+
if (dir === 1 && progress.current >= 1) {
|
|
24
|
+
holding.current = false;
|
|
25
|
+
setDone(true);
|
|
26
|
+
setShake(0);
|
|
27
|
+
navigator.vibrate?.(24);
|
|
28
|
+
setTimeout(() => {
|
|
29
|
+
setDone(false);
|
|
30
|
+
progress.current = 0;
|
|
31
|
+
setP(0);
|
|
32
|
+
}, 1800);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (dir === -1 && progress.current <= 0) return;
|
|
36
|
+
raf.current = requestAnimationFrame(step);
|
|
37
|
+
};
|
|
38
|
+
cancelAnimationFrame(raf.current);
|
|
39
|
+
raf.current = requestAnimationFrame(step);
|
|
40
|
+
};
|
|
41
|
+
const press = () => {
|
|
42
|
+
if (done || holding.current) return;
|
|
43
|
+
holding.current = true;
|
|
44
|
+
loop(1);
|
|
45
|
+
};
|
|
46
|
+
const release = () => {
|
|
47
|
+
if (!holding.current) return;
|
|
48
|
+
holding.current = false;
|
|
49
|
+
loop(-1);
|
|
50
|
+
};
|
|
51
|
+
useEffect(() => () => cancelAnimationFrame(raf.current), []);
|
|
52
|
+
const label = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
53
|
+
done ? /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", className: "h-[18px] w-[18px]", fill: "none", stroke: "currentColor", strokeWidth: "2.4", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M5 12.5l4.5 4.5L19 7.5", strokeDasharray: "24", className: "animate-[hold-draw_.5s_cubic-bezier(.16,1,.3,1)_both]" }) }) : /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", className: "h-[18px] w-[18px]", fill: "none", stroke: "currentColor", strokeWidth: "1.8", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M4 7h16M10 11v6M14 11v6M6 7l1 12h10l1-12M9 7V4h6v3" }) }),
|
|
54
|
+
done ? "Deleted" : p > 0.02 ? "Keep holding" : "Hold to delete"
|
|
55
|
+
] });
|
|
56
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex h-full w-full flex-col items-center justify-center gap-5", children: [
|
|
57
|
+
/* @__PURE__ */ jsx("style", { href: "asta-holdtoconfirm", precedence: "asta", children: `@keyframes hold-draw { from { stroke-dashoffset: 24 } to { stroke-dashoffset: 0 } }` }),
|
|
58
|
+
/* @__PURE__ */ jsxs(
|
|
59
|
+
"button",
|
|
60
|
+
{
|
|
61
|
+
type: "button",
|
|
62
|
+
onPointerDown: press,
|
|
63
|
+
onPointerUp: release,
|
|
64
|
+
onPointerLeave: release,
|
|
65
|
+
onPointerCancel: release,
|
|
66
|
+
onKeyDown: (e) => {
|
|
67
|
+
if ((e.key === " " || e.key === "Enter") && !e.repeat) {
|
|
68
|
+
e.preventDefault();
|
|
69
|
+
press();
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
onKeyUp: (e) => (e.key === " " || e.key === "Enter") && release(),
|
|
73
|
+
onBlur: release,
|
|
74
|
+
onContextMenu: (e) => e.preventDefault(),
|
|
75
|
+
"aria-label": done ? "Deleted" : "Hold to delete",
|
|
76
|
+
className: "relative h-[60px] w-60 select-none overflow-hidden bg-paper-2 text-[15px] font-medium tracking-[-0.01em] text-ink shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_14%,transparent)] outline-none [touch-action:none] focus-visible:shadow-[inset_0_0_0_2px_var(--signal)]",
|
|
77
|
+
style: { transform: `translateX(${shake}px) scale(${1 - p * 0.04})` },
|
|
78
|
+
children: [
|
|
79
|
+
/* @__PURE__ */ jsx("span", { className: "absolute inset-0 flex items-center justify-center gap-2.5", children: label }),
|
|
80
|
+
/* @__PURE__ */ jsx(
|
|
81
|
+
"span",
|
|
82
|
+
{
|
|
83
|
+
"aria-hidden": true,
|
|
84
|
+
className: `absolute inset-0 flex items-center justify-center gap-2.5 bg-signal text-on-signal ${done ? "animate-[hold-flash_.6s_ease-out]" : ""}`,
|
|
85
|
+
style: { clipPath: `inset(0 ${(1 - p) * 100}% 0 0)` },
|
|
86
|
+
children: label
|
|
87
|
+
}
|
|
88
|
+
),
|
|
89
|
+
/* @__PURE__ */ jsx("style", { href: "asta-holdtoconfirm-2", precedence: "asta", children: `@keyframes hold-flash { 0% { filter: brightness(1.6) } 100% { filter: none } }` })
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
),
|
|
93
|
+
/* @__PURE__ */ jsx("div", { className: "flex gap-[3px]", "aria-hidden": true, children: Array.from({ length: TICKS }, (_, i) => {
|
|
94
|
+
const lit = p * TICKS > i;
|
|
95
|
+
return /* @__PURE__ */ jsx(
|
|
96
|
+
"span",
|
|
97
|
+
{
|
|
98
|
+
className: "w-[3px] transition-[height,background-color] duration-150",
|
|
99
|
+
style: { height: lit ? i % 6 === 5 ? 14 : 10 : i % 6 === 5 ? 10 : 6, background: lit ? "var(--signal)" : "color-mix(in srgb, var(--ink) 18%, transparent)" }
|
|
100
|
+
},
|
|
101
|
+
i
|
|
102
|
+
);
|
|
103
|
+
}) })
|
|
104
|
+
] });
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export {
|
|
108
|
+
HoldToConfirm
|
|
109
|
+
};
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
Button
|
|
4
|
+
} from "./chunk-WSL4JGEA.js";
|
|
5
|
+
|
|
6
|
+
// components/kit/base/footer.tsx
|
|
7
|
+
import { useRef, useState } from "react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
var cx = (...c) => c.filter(Boolean).join(" ");
|
|
10
|
+
var EASE = "ease-[cubic-bezier(.16,1,.3,1)]";
|
|
11
|
+
function Newsletter({ onSubscribe }) {
|
|
12
|
+
const [email, setEmail] = useState("");
|
|
13
|
+
const [state, setState] = useState("idle");
|
|
14
|
+
const submit = async (e) => {
|
|
15
|
+
e.preventDefault();
|
|
16
|
+
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) return setState("error");
|
|
17
|
+
setState("busy");
|
|
18
|
+
try {
|
|
19
|
+
await (onSubscribe?.(email) ?? new Promise((r) => setTimeout(r, 900)));
|
|
20
|
+
setState("done");
|
|
21
|
+
} catch {
|
|
22
|
+
setState("error");
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
26
|
+
/* @__PURE__ */ jsxs(
|
|
27
|
+
"form",
|
|
28
|
+
{
|
|
29
|
+
onSubmit: submit,
|
|
30
|
+
noValidate: true,
|
|
31
|
+
"aria-hidden": state === "done" || void 0,
|
|
32
|
+
className: cx(
|
|
33
|
+
"flex h-11 items-center gap-1 rounded-[10px] bg-paper/10 p-1 pl-4 shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--paper)_14%,transparent)] transition-[opacity,transform,box-shadow] duration-500 focus-within:shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--paper)_45%,transparent)]",
|
|
34
|
+
EASE,
|
|
35
|
+
state === "done" && "pointer-events-none -translate-y-2 opacity-0",
|
|
36
|
+
state === "error" && "shadow-[inset_0_0_0_1px_#e5484d]"
|
|
37
|
+
),
|
|
38
|
+
children: [
|
|
39
|
+
/* @__PURE__ */ jsx("label", { htmlFor: "kit-footer-email", className: "sr-only", children: "Email address" }),
|
|
40
|
+
/* @__PURE__ */ jsx(
|
|
41
|
+
"input",
|
|
42
|
+
{
|
|
43
|
+
id: "kit-footer-email",
|
|
44
|
+
type: "email",
|
|
45
|
+
value: email,
|
|
46
|
+
onChange: (e) => {
|
|
47
|
+
setEmail(e.target.value);
|
|
48
|
+
if (state === "error") setState("idle");
|
|
49
|
+
},
|
|
50
|
+
placeholder: "you@company.com",
|
|
51
|
+
"aria-invalid": state === "error" || void 0,
|
|
52
|
+
"aria-describedby": "kit-footer-msg",
|
|
53
|
+
tabIndex: state === "done" ? -1 : void 0,
|
|
54
|
+
className: "min-w-0 flex-1 bg-transparent text-[14px] text-paper outline-none placeholder:text-paper/40"
|
|
55
|
+
}
|
|
56
|
+
),
|
|
57
|
+
/* @__PURE__ */ jsx(Button, { type: "submit", variant: "accent", size: "sm", shape: "pill", loading: state === "busy", className: "shadow-none", tabIndex: state === "done" ? -1 : void 0, children: "Subscribe" })
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
),
|
|
61
|
+
/* @__PURE__ */ jsxs(
|
|
62
|
+
"p",
|
|
63
|
+
{
|
|
64
|
+
className: cx(
|
|
65
|
+
"absolute inset-0 flex items-center gap-2 pl-1 text-[14px] text-paper transition-[opacity,transform] duration-500",
|
|
66
|
+
EASE,
|
|
67
|
+
state === "done" ? "opacity-100" : "pointer-events-none translate-y-2 opacity-0"
|
|
68
|
+
),
|
|
69
|
+
"aria-hidden": state !== "done",
|
|
70
|
+
children: [
|
|
71
|
+
/* @__PURE__ */ jsx("span", { className: "flex h-6 w-6 items-center justify-center rounded-full bg-brand text-white", children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", className: "h-3.5 w-3.5", fill: "none", stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "m3.5 8.5 3 3 6-7", strokeDasharray: "16", style: { strokeDashoffset: state === "done" ? 0 : 16, transition: "stroke-dashoffset .5s .2s" } }) }) }),
|
|
72
|
+
"You're in. First letter lands next week."
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
),
|
|
76
|
+
/* @__PURE__ */ jsx("p", { id: "kit-footer-msg", role: "status", className: "mt-2 h-4 text-[12px] text-[#ff8a8d]", children: state === "error" ? "That doesn't look like an email address." : "" })
|
|
77
|
+
] });
|
|
78
|
+
}
|
|
79
|
+
function Wordmark({ text }) {
|
|
80
|
+
const box = useRef(null);
|
|
81
|
+
const move = (x) => {
|
|
82
|
+
const el = box.current;
|
|
83
|
+
if (!el || window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
|
|
84
|
+
for (const s of el.querySelectorAll("span[data-l]")) {
|
|
85
|
+
if (x === null) {
|
|
86
|
+
s.style.transform = "";
|
|
87
|
+
s.style.opacity = "";
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
const r = s.getBoundingClientRect();
|
|
91
|
+
const k = Math.max(0, 1 - Math.abs(x - (r.left + r.width / 2)) / (r.width * 2.5));
|
|
92
|
+
s.style.transform = `translateY(${-k * 14}%)`;
|
|
93
|
+
s.style.opacity = String(0.22 + k * 0.78);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
return /* @__PURE__ */ jsx(
|
|
97
|
+
"div",
|
|
98
|
+
{
|
|
99
|
+
ref: box,
|
|
100
|
+
"aria-hidden": true,
|
|
101
|
+
onPointerMove: (e) => move(e.clientX),
|
|
102
|
+
onPointerLeave: () => move(null),
|
|
103
|
+
className: "-mb-[0.18em] mt-6 flex select-none justify-center overflow-hidden pt-[0.1em] text-[clamp(3rem,19.5cqw,13rem)] font-semibold leading-[0.9] tracking-[-0.06em]",
|
|
104
|
+
children: text.split("").map((c, i) => /* @__PURE__ */ jsx("span", { "data-l": true, className: cx("inline-block opacity-[0.22] transition-[transform,opacity] duration-500", EASE), children: c }, i))
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
function Footer({ brand, wordmark, columns, tagline, onSubscribe, legal, className }) {
|
|
109
|
+
return /* @__PURE__ */ jsxs("footer", { className: cx("@container overflow-hidden rounded-2xl bg-ink px-6 pt-8 text-paper sm:px-8", className), children: [
|
|
110
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-8 @min-[620px]:grid-cols-[1.3fr_2fr]", children: [
|
|
111
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col gap-4", children: [
|
|
112
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 text-[15px] font-semibold tracking-[-0.02em]", children: brand }),
|
|
113
|
+
tagline && /* @__PURE__ */ jsx("p", { className: "max-w-[30ch] text-[13.5px] leading-relaxed text-paper/60", children: tagline }),
|
|
114
|
+
/* @__PURE__ */ jsx(Newsletter, { onSubscribe })
|
|
115
|
+
] }),
|
|
116
|
+
/* @__PURE__ */ jsx("nav", { "aria-label": "Footer", className: "grid grid-cols-2 gap-6 @min-[420px]:grid-cols-3", children: columns.map((c) => /* @__PURE__ */ jsxs("div", { children: [
|
|
117
|
+
/* @__PURE__ */ jsx("p", { className: "text-[12px] text-paper/45", children: c.heading }),
|
|
118
|
+
/* @__PURE__ */ jsx("ul", { className: "mt-3 flex flex-col gap-2", children: c.links.map((l) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
|
|
119
|
+
"a",
|
|
120
|
+
{
|
|
121
|
+
href: l.href,
|
|
122
|
+
className: "group/fl inline-flex items-center gap-1 rounded text-[13.5px] text-paper/80 outline-none transition-colors hover:text-paper focus-visible:ring-2 focus-visible:ring-brand/60",
|
|
123
|
+
children: [
|
|
124
|
+
l.label,
|
|
125
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": true, className: cx("-translate-x-1 text-[11px] opacity-0 transition-[translate,opacity] duration-300 group-hover/fl:translate-x-0 group-hover/fl:opacity-60", EASE), children: "\u2197" })
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
) }, l.label)) })
|
|
129
|
+
] }, c.heading)) })
|
|
130
|
+
] }),
|
|
131
|
+
legal && /* @__PURE__ */ jsx("div", { className: "mt-8 flex flex-wrap justify-between gap-2 text-[12px] text-paper/45", children: legal }),
|
|
132
|
+
/* @__PURE__ */ jsx(Wordmark, { text: wordmark })
|
|
133
|
+
] });
|
|
134
|
+
}
|
|
135
|
+
var footer_default = Footer;
|
|
136
|
+
|
|
137
|
+
export {
|
|
138
|
+
Newsletter,
|
|
139
|
+
Footer,
|
|
140
|
+
footer_default
|
|
141
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// components/lab/blocks/BubbleWrap.tsx
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
var COLS = 7;
|
|
7
|
+
var ROWS = 4;
|
|
8
|
+
function BubbleWrap() {
|
|
9
|
+
const [popped, setPopped] = useState(() => Array(COLS * ROWS).fill(false));
|
|
10
|
+
const left = popped.filter((p) => !p).length;
|
|
11
|
+
const pop = (i) => {
|
|
12
|
+
if (popped[i]) return;
|
|
13
|
+
navigator.vibrate?.(6);
|
|
14
|
+
setPopped((p) => p.map((v, k) => k === i ? true : v));
|
|
15
|
+
};
|
|
16
|
+
const fromPoint = (e) => {
|
|
17
|
+
const el = document.elementFromPoint(e.clientX, e.clientY);
|
|
18
|
+
const i = el?.dataset.bubble;
|
|
19
|
+
if (i !== void 0) pop(Number(i));
|
|
20
|
+
};
|
|
21
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex h-full w-full flex-col items-center justify-center gap-4 p-4", children: [
|
|
22
|
+
/* @__PURE__ */ jsx(
|
|
23
|
+
"div",
|
|
24
|
+
{
|
|
25
|
+
onPointerDown: (e) => {
|
|
26
|
+
e.currentTarget.releasePointerCapture?.(e.pointerId);
|
|
27
|
+
fromPoint(e);
|
|
28
|
+
},
|
|
29
|
+
onPointerMove: (e) => e.buttons && fromPoint(e),
|
|
30
|
+
className: "grid select-none gap-2 [touch-action:none]",
|
|
31
|
+
style: { gridTemplateColumns: `repeat(${COLS}, 1fr)` },
|
|
32
|
+
children: popped.map((p, i) => /* @__PURE__ */ jsx(
|
|
33
|
+
"span",
|
|
34
|
+
{
|
|
35
|
+
"data-bubble": i,
|
|
36
|
+
className: `h-8 w-8 rounded-full transition-all duration-200 ease-[cubic-bezier(.5,1.8,.4,.8)] sm:h-9 sm:w-9 ${p ? "scale-[.82] border border-dashed border-line bg-transparent" : "cursor-pointer bg-paper-2 shadow-[inset_-3px_-4px_8px_rgba(0,0,0,.45),inset_3px_3px_6px_rgba(233,233,228,.12)] hover:scale-105"}`
|
|
37
|
+
},
|
|
38
|
+
i
|
|
39
|
+
))
|
|
40
|
+
}
|
|
41
|
+
),
|
|
42
|
+
/* @__PURE__ */ jsxs("div", { className: "font-mono text-[11px] uppercase tracking-[0.08em] flex items-center gap-3 text-mute", children: [
|
|
43
|
+
/* @__PURE__ */ jsxs("span", { className: "tabular-nums", children: [
|
|
44
|
+
left,
|
|
45
|
+
" left"
|
|
46
|
+
] }),
|
|
47
|
+
/* @__PURE__ */ jsx("span", { children: "\xB7" }),
|
|
48
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: () => setPopped(Array(COLS * ROWS).fill(false)), className: left === 0 ? "text-signal" : "hover:text-ink", children: "Refill" })
|
|
49
|
+
] })
|
|
50
|
+
] });
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export {
|
|
54
|
+
BubbleWrap
|
|
55
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// components/kit/base/dialog.tsx
|
|
4
|
+
import { Dialog as D } from "@base-ui/react/dialog";
|
|
5
|
+
import { useCallback, useLayoutEffect, useRef } from "react";
|
|
6
|
+
import { Fragment, 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
|
+
var still = () => typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
11
|
+
function Dialog({ open, onOpenChange, title, description, children, footer, contained = false, className }) {
|
|
12
|
+
const panel = useRef(null);
|
|
13
|
+
const backdrop = useRef(null);
|
|
14
|
+
const opener = useRef(null);
|
|
15
|
+
const host = useRef(null);
|
|
16
|
+
const fromTrigger = useCallback(() => {
|
|
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
|
+
useLayoutEffect(() => {
|
|
25
|
+
if (open && !panel.current?.contains(document.activeElement)) opener.current = document.activeElement;
|
|
26
|
+
}, [open]);
|
|
27
|
+
const attach = useCallback(
|
|
28
|
+
(el) => {
|
|
29
|
+
panel.current = el;
|
|
30
|
+
if (!el || !el.hasAttribute("data-open")) return;
|
|
31
|
+
el.animate([{ transform: still() ? "none" : fromTrigger(), opacity: 0, borderRadius: still() ? "24px" : "999px" }, { transform: "none", opacity: 1, borderRadius: "24px" }], { duration: still() ? 160 : 520, easing: EASE });
|
|
32
|
+
backdrop.current?.animate([{ opacity: 0 }, { opacity: 1 }], { duration: 300, easing: "ease-out" });
|
|
33
|
+
},
|
|
34
|
+
[fromTrigger]
|
|
35
|
+
);
|
|
36
|
+
useLayoutEffect(() => {
|
|
37
|
+
const p = panel.current;
|
|
38
|
+
if (open || !p || still()) return;
|
|
39
|
+
backdrop.current?.animate([{ opacity: 1 }, { opacity: 0 }], { duration: 260, easing: "ease-in", fill: "forwards" });
|
|
40
|
+
p.animate([{ transform: "none", opacity: 1 }, { transform: fromTrigger(), opacity: 0 }], { duration: 320, easing: "cubic-bezier(.7,0,.84,0)", fill: "forwards" });
|
|
41
|
+
}, [open, fromTrigger]);
|
|
42
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
43
|
+
contained && /* @__PURE__ */ jsx("span", { ref: host, className: "contents" }),
|
|
44
|
+
/* @__PURE__ */ jsx(D.Root, { open, onOpenChange: (next) => onOpenChange(next), children: /* @__PURE__ */ jsx(D.Portal, { container: contained ? host : void 0, children: /* @__PURE__ */ jsxs("div", { className: cx(contained ? "absolute" : "fixed", "inset-0 z-50 flex items-center justify-center p-4"), children: [
|
|
45
|
+
/* @__PURE__ */ jsx(D.Backdrop, { ref: backdrop, className: cx("absolute inset-0 bg-[rgb(10_10_10/0.38)] will-change-[opacity]", contained && "rounded-[inherit]") }),
|
|
46
|
+
/* @__PURE__ */ jsxs(
|
|
47
|
+
D.Popup,
|
|
48
|
+
{
|
|
49
|
+
ref: attach,
|
|
50
|
+
initialFocus: () => {
|
|
51
|
+
const p = panel.current;
|
|
52
|
+
return p?.querySelector("[data-autofocus]") ?? p?.querySelector(FOCUSABLE) ?? p ?? true;
|
|
53
|
+
},
|
|
54
|
+
finalFocus: () => {
|
|
55
|
+
const back = opener.current;
|
|
56
|
+
opener.current = null;
|
|
57
|
+
return back && back.isConnected ? back : true;
|
|
58
|
+
},
|
|
59
|
+
className: cx(
|
|
60
|
+
"relative w-full max-w-[400px] rounded-2xl bg-paper p-6 outline-none",
|
|
61
|
+
"shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_8%,transparent),0_24px_60px_-20px_rgb(0_0_0/0.45)]",
|
|
62
|
+
className
|
|
63
|
+
),
|
|
64
|
+
children: [
|
|
65
|
+
/* @__PURE__ */ jsx(
|
|
66
|
+
D.Close,
|
|
67
|
+
{
|
|
68
|
+
"aria-label": "Close",
|
|
69
|
+
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",
|
|
70
|
+
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" }) })
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
/* @__PURE__ */ jsx(D.Title, { className: "pr-8 text-[18px] font-medium tracking-[-0.02em] text-ink", children: title }),
|
|
74
|
+
description && /* @__PURE__ */ jsx(D.Description, { className: "mt-1.5 text-[14px] leading-relaxed text-mute", children: description }),
|
|
75
|
+
children && /* @__PURE__ */ jsx("div", { className: "mt-5", children }),
|
|
76
|
+
footer && /* @__PURE__ */ jsx("div", { className: "mt-6 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", children: footer })
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
] }) }) })
|
|
81
|
+
] });
|
|
82
|
+
}
|
|
83
|
+
var dialog_default = Dialog;
|
|
84
|
+
|
|
85
|
+
export {
|
|
86
|
+
Dialog,
|
|
87
|
+
dialog_default
|
|
88
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// components/kit/base/segmented-control.tsx
|
|
4
|
+
import { Radio } from "@base-ui/react/radio";
|
|
5
|
+
import { RadioGroup } from "@base-ui/react/radio-group";
|
|
6
|
+
import { useLayoutEffect, useRef, useState } from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
var cx = (...c) => c.filter(Boolean).join(" ");
|
|
9
|
+
function SegmentedControl({ segments, value, defaultValue, onChange, size = "md", full, label, className }) {
|
|
10
|
+
const [inner, setInner] = useState(defaultValue ?? segments[0]?.value);
|
|
11
|
+
const current = value ?? inner;
|
|
12
|
+
const refs = useRef([]);
|
|
13
|
+
const box = useRef(null);
|
|
14
|
+
const [pill, setPill] = useState(null);
|
|
15
|
+
const [squash, setSquash] = useState(false);
|
|
16
|
+
const index = Math.max(0, segments.findIndex((s) => s.value === current));
|
|
17
|
+
useLayoutEffect(() => {
|
|
18
|
+
const measure = () => {
|
|
19
|
+
const el = refs.current[index];
|
|
20
|
+
if (el) setPill({ x: el.offsetLeft, w: el.offsetWidth });
|
|
21
|
+
};
|
|
22
|
+
measure();
|
|
23
|
+
const ro = new ResizeObserver(measure);
|
|
24
|
+
if (box.current) ro.observe(box.current);
|
|
25
|
+
return () => ro.disconnect();
|
|
26
|
+
}, [index]);
|
|
27
|
+
const pick = (v) => {
|
|
28
|
+
if (v === current) return;
|
|
29
|
+
setSquash(true);
|
|
30
|
+
setTimeout(() => setSquash(false), 180);
|
|
31
|
+
if (value === void 0) setInner(v);
|
|
32
|
+
onChange?.(v);
|
|
33
|
+
};
|
|
34
|
+
const h = size === "sm" ? "h-8 text-[13px]" : "h-10 text-[14px]";
|
|
35
|
+
return /* @__PURE__ */ jsxs(
|
|
36
|
+
RadioGroup,
|
|
37
|
+
{
|
|
38
|
+
ref: box,
|
|
39
|
+
value: current,
|
|
40
|
+
onValueChange: (v) => pick(String(v)),
|
|
41
|
+
"aria-label": label,
|
|
42
|
+
className: cx(
|
|
43
|
+
"relative inline-flex rounded-[10px] bg-paper-2 p-1 shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_6%,transparent)]",
|
|
44
|
+
full && "flex w-full",
|
|
45
|
+
className
|
|
46
|
+
),
|
|
47
|
+
children: [
|
|
48
|
+
pill && /* @__PURE__ */ jsx(
|
|
49
|
+
"span",
|
|
50
|
+
{
|
|
51
|
+
"aria-hidden": true,
|
|
52
|
+
className: "absolute left-0 top-1 bottom-1 rounded-[7px] bg-paper shadow-[0_1px_2px_rgb(0_0_0/0.08),0_3px_10px_-4px_rgb(0_0_0/0.18),inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_8%,transparent)] transition-[transform,width] duration-500 ease-[cubic-bezier(.16,1,.3,1)] motion-reduce:transition-none",
|
|
53
|
+
style: { transform: `translateX(${pill.x}px) scaleY(${squash ? 0.86 : 1})`, width: pill.w }
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
segments.map((s, i) => {
|
|
57
|
+
const on = i === index;
|
|
58
|
+
return /* @__PURE__ */ jsxs(
|
|
59
|
+
Radio.Root,
|
|
60
|
+
{
|
|
61
|
+
value: s.value,
|
|
62
|
+
ref: (el) => {
|
|
63
|
+
refs.current[i] = el;
|
|
64
|
+
},
|
|
65
|
+
className: cx(
|
|
66
|
+
"relative z-10 inline-flex cursor-pointer select-none items-center justify-center gap-1.5 whitespace-nowrap rounded-[7px] font-medium tracking-[-0.01em] outline-none transition-colors duration-300 focus-visible:ring-2 focus-visible:ring-brand/50 [&_svg]:h-[1.05em] [&_svg]:w-[1.05em]",
|
|
67
|
+
h,
|
|
68
|
+
size === "sm" ? "px-3" : "px-4",
|
|
69
|
+
full && "flex-1",
|
|
70
|
+
on ? "text-ink" : "text-mute hover:text-ink"
|
|
71
|
+
),
|
|
72
|
+
children: [
|
|
73
|
+
s.icon,
|
|
74
|
+
s.label
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
s.value
|
|
78
|
+
);
|
|
79
|
+
})
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
var segmented_control_default = SegmentedControl;
|
|
85
|
+
|
|
86
|
+
export {
|
|
87
|
+
SegmentedControl,
|
|
88
|
+
segmented_control_default
|
|
89
|
+
};
|