asta-ui 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (413) hide show
  1. package/dist/ai-chat.d.ts +2 -0
  2. package/dist/ai-chat.js +9 -0
  3. package/dist/alert.d.ts +2 -0
  4. package/dist/alert.js +9 -0
  5. package/dist/announcement-bar.d.ts +2 -0
  6. package/dist/announcement-bar.js +9 -0
  7. package/dist/avatar-group.d.ts +2 -0
  8. package/dist/avatar-group.js +10 -0
  9. package/dist/avatar.js +3 -1
  10. package/dist/base/ai-chat.d.ts +2 -0
  11. package/dist/base/ai-chat.js +9 -0
  12. package/dist/base/alert.d.ts +2 -0
  13. package/dist/base/alert.js +9 -0
  14. package/dist/base/announcement-bar.d.ts +2 -0
  15. package/dist/base/announcement-bar.js +9 -0
  16. package/dist/base/avatar-group.d.ts +2 -0
  17. package/dist/base/avatar-group.js +10 -0
  18. package/dist/base/avatar.js +3 -1
  19. package/dist/base/booking-slots.d.ts +2 -0
  20. package/dist/base/booking-slots.js +7 -0
  21. package/dist/base/breadcrumb.d.ts +2 -0
  22. package/dist/base/breadcrumb.js +9 -0
  23. package/dist/base/carousel.d.ts +2 -0
  24. package/dist/base/carousel.js +9 -0
  25. package/dist/base/chat-thread.d.ts +2 -0
  26. package/dist/base/chat-thread.js +7 -0
  27. package/dist/base/checkout.d.ts +2 -0
  28. package/dist/base/checkout.js +12 -0
  29. package/dist/base/color-picker.d.ts +2 -0
  30. package/dist/base/color-picker.js +9 -0
  31. package/dist/base/combobox.d.ts +2 -0
  32. package/dist/base/combobox.js +9 -0
  33. package/dist/base/comments.d.ts +2 -0
  34. package/dist/base/comments.js +11 -0
  35. package/dist/base/context-menu.d.ts +2 -0
  36. package/dist/base/context-menu.js +9 -0
  37. package/dist/base/copy-button.d.ts +2 -0
  38. package/dist/base/copy-button.js +9 -0
  39. package/dist/base/data-table.d.ts +2 -0
  40. package/dist/base/data-table.js +9 -0
  41. package/dist/base/date-picker.d.ts +2 -0
  42. package/dist/base/date-picker.js +9 -0
  43. package/dist/base/drawer.d.ts +2 -0
  44. package/dist/base/drawer.js +9 -0
  45. package/dist/base/empty-state.d.ts +2 -0
  46. package/dist/base/empty-state.js +10 -0
  47. package/dist/base/event-calendar.d.ts +2 -0
  48. package/dist/base/event-calendar.js +9 -0
  49. package/dist/base/file-upload.d.ts +2 -0
  50. package/dist/base/file-upload.js +11 -0
  51. package/dist/base/hover-card.d.ts +2 -0
  52. package/dist/base/hover-card.js +9 -0
  53. package/dist/base/image-compare.d.ts +2 -0
  54. package/dist/base/image-compare.js +9 -0
  55. package/dist/base/inline-edit.d.ts +2 -0
  56. package/dist/base/inline-edit.js +9 -0
  57. package/dist/base/kanban.d.ts +2 -0
  58. package/dist/base/kanban.js +10 -0
  59. package/dist/base/notification-center.d.ts +2 -0
  60. package/dist/base/notification-center.js +11 -0
  61. package/dist/base/notification-stack.d.ts +2 -0
  62. package/dist/base/notification-stack.js +7 -0
  63. package/dist/base/now-playing.d.ts +2 -0
  64. package/dist/base/now-playing.js +7 -0
  65. package/dist/base/onboarding.d.ts +2 -0
  66. package/dist/base/onboarding.js +10 -0
  67. package/dist/base/otp-input.d.ts +2 -0
  68. package/dist/base/otp-input.js +9 -0
  69. package/dist/base/pagination.d.ts +2 -0
  70. package/dist/base/pagination.js +11 -0
  71. package/dist/base/password-input.d.ts +2 -0
  72. package/dist/base/password-input.js +13 -0
  73. package/dist/base/payment-received.d.ts +2 -0
  74. package/dist/base/payment-received.js +7 -0
  75. package/dist/base/plan-switcher.d.ts +2 -0
  76. package/dist/base/plan-switcher.js +7 -0
  77. package/dist/base/popover.d.ts +2 -0
  78. package/dist/base/popover.js +9 -0
  79. package/dist/base/progress.d.ts +2 -0
  80. package/dist/base/progress.js +11 -0
  81. package/dist/base/range-slider.d.ts +2 -0
  82. package/dist/base/range-slider.js +9 -0
  83. package/dist/base/rating.d.ts +2 -0
  84. package/dist/base/rating.js +9 -0
  85. package/dist/base/seat-picker.d.ts +2 -0
  86. package/dist/base/seat-picker.js +7 -0
  87. package/dist/base/shipment-tracker.d.ts +2 -0
  88. package/dist/base/shipment-tracker.js +7 -0
  89. package/dist/base/sidebar.d.ts +2 -0
  90. package/dist/base/sidebar.js +10 -0
  91. package/dist/base/stat-card.d.ts +2 -0
  92. package/dist/base/stat-card.js +9 -0
  93. package/dist/base/stepper.d.ts +2 -0
  94. package/dist/base/stepper.js +9 -0
  95. package/dist/base/team-members.d.ts +2 -0
  96. package/dist/base/team-members.js +12 -0
  97. package/dist/base/timeline.d.ts +2 -0
  98. package/dist/base/timeline.js +9 -0
  99. package/dist/base/toggle-group.d.ts +2 -0
  100. package/dist/base/toggle-group.js +9 -0
  101. package/dist/base/token-swap.d.ts +2 -0
  102. package/dist/base/token-swap.js +7 -0
  103. package/dist/base/tree-view.d.ts +2 -0
  104. package/dist/base/tree-view.js +9 -0
  105. package/dist/base/wishlist.d.ts +2 -0
  106. package/dist/base/wishlist.js +7 -0
  107. package/dist/base.js +250 -46
  108. package/dist/booking-slots.d.ts +2 -0
  109. package/dist/booking-slots.js +7 -0
  110. package/dist/breadcrumb.d.ts +2 -0
  111. package/dist/breadcrumb.js +9 -0
  112. package/dist/carousel.d.ts +2 -0
  113. package/dist/carousel.js +9 -0
  114. package/dist/chat-thread.d.ts +2 -0
  115. package/dist/chat-thread.js +7 -0
  116. package/dist/checkout.d.ts +2 -0
  117. package/dist/checkout.js +12 -0
  118. package/dist/{chunk-VGBP42IZ.js → chunk-2LZM435Z.js} +3 -2
  119. package/dist/chunk-33N6SZB5.js +186 -0
  120. package/dist/chunk-3KS5EN3Q.js +134 -0
  121. package/dist/chunk-3RMCFFW2.js +228 -0
  122. package/dist/chunk-45VUWOHQ.js +299 -0
  123. package/dist/chunk-4FR6KJOJ.js +91 -0
  124. package/dist/chunk-4GF7WTR3.js +230 -0
  125. package/dist/chunk-4XM6DKEO.js +164 -0
  126. package/dist/chunk-57PESBSZ.js +97 -0
  127. package/dist/chunk-6HPSPZTF.js +232 -0
  128. package/dist/chunk-6VQTFRSP.js +435 -0
  129. package/dist/chunk-72UKXOMW.js +150 -0
  130. package/dist/chunk-7JNO265Q.js +431 -0
  131. package/dist/chunk-AYSC7AIC.js +322 -0
  132. package/dist/chunk-B5F775GP.js +339 -0
  133. package/dist/chunk-B5OESWCR.js +339 -0
  134. package/dist/chunk-BP3LXM3X.js +309 -0
  135. package/dist/chunk-CA7YQ5BJ.js +271 -0
  136. package/dist/chunk-DRX3KRNL.js +191 -0
  137. package/dist/chunk-EAUUUVUR.js +123 -0
  138. package/dist/chunk-EXX6YSUX.js +340 -0
  139. package/dist/chunk-F7LAUVDJ.js +97 -0
  140. package/dist/chunk-FDHU3RWR.js +213 -0
  141. package/dist/chunk-FJGGXXTT.js +109 -0
  142. package/dist/chunk-FKHNK5VC.js +172 -0
  143. package/dist/chunk-FY6BRODJ.js +230 -0
  144. package/dist/chunk-GDTSCUHY.js +234 -0
  145. package/dist/chunk-H7D6G3GQ.js +290 -0
  146. package/dist/chunk-HB7DFNZP.js +109 -0
  147. package/dist/{chunk-H5C7HOQJ.js → chunk-HNO6EUGJ.js} +3 -2
  148. package/dist/chunk-HPVPHWDM.js +197 -0
  149. package/dist/chunk-I5NZSWDW.js +431 -0
  150. package/dist/chunk-IMBCYI3F.js +114 -0
  151. package/dist/chunk-IS2VTYDA.js +235 -0
  152. package/dist/chunk-ISZ7O2Q6.js +245 -0
  153. package/dist/chunk-JAQKJBVJ.js +170 -0
  154. package/dist/chunk-KYFZ5TTK.js +271 -0
  155. package/dist/chunk-LBXIMJFU.js +170 -0
  156. package/dist/chunk-MSBN2O66.js +110 -0
  157. package/dist/chunk-NB7X26PY.js +388 -0
  158. package/dist/chunk-NIYIT2QU.js +118 -0
  159. package/dist/chunk-QJXPS55V.js +246 -0
  160. package/dist/chunk-RBTX7TVA.js +170 -0
  161. package/dist/chunk-RFVKRVTD.js +172 -0
  162. package/dist/chunk-RIWKIBEP.js +271 -0
  163. package/dist/chunk-RSUZHZCG.js +230 -0
  164. package/dist/chunk-S2DJLW6B.js +322 -0
  165. package/dist/chunk-SDL3JXFN.js +97 -0
  166. package/dist/chunk-SDOWCCM2.js +271 -0
  167. package/dist/chunk-SPKSRH6G.js +283 -0
  168. package/dist/chunk-TLODJONC.js +120 -0
  169. package/dist/chunk-TXRLBMFL.js +191 -0
  170. package/dist/chunk-UWQ26LYZ.js +133 -0
  171. package/dist/chunk-V3SPSN3A.js +308 -0
  172. package/dist/chunk-W57O4RLL.js +435 -0
  173. package/dist/chunk-WO36QUH3.js +188 -0
  174. package/dist/chunk-YLAL6ICI.js +142 -0
  175. package/dist/chunk-ZGMBQZDV.js +250 -0
  176. package/dist/chunk-ZKMEKSJZ.js +133 -0
  177. package/dist/color-picker.d.ts +2 -0
  178. package/dist/color-picker.js +9 -0
  179. package/dist/combobox.d.ts +2 -0
  180. package/dist/combobox.js +9 -0
  181. package/dist/comments.d.ts +2 -0
  182. package/dist/comments.js +11 -0
  183. package/dist/context-menu.d.ts +2 -0
  184. package/dist/context-menu.js +9 -0
  185. package/dist/copy-button.d.ts +2 -0
  186. package/dist/copy-button.js +9 -0
  187. package/dist/data-table.d.ts +2 -0
  188. package/dist/data-table.js +9 -0
  189. package/dist/date-picker.d.ts +2 -0
  190. package/dist/date-picker.js +9 -0
  191. package/dist/drawer.d.ts +2 -0
  192. package/dist/drawer.js +9 -0
  193. package/dist/empty-state.d.ts +2 -0
  194. package/dist/empty-state.js +10 -0
  195. package/dist/event-calendar.d.ts +2 -0
  196. package/dist/event-calendar.js +9 -0
  197. package/dist/file-upload.d.ts +2 -0
  198. package/dist/file-upload.js +11 -0
  199. package/dist/hover-card.d.ts +2 -0
  200. package/dist/hover-card.js +9 -0
  201. package/dist/image-compare.d.ts +2 -0
  202. package/dist/image-compare.js +9 -0
  203. package/dist/index.js +250 -46
  204. package/dist/inline-edit.d.ts +2 -0
  205. package/dist/inline-edit.js +9 -0
  206. package/dist/kanban.d.ts +2 -0
  207. package/dist/kanban.js +10 -0
  208. package/dist/notification-center.d.ts +2 -0
  209. package/dist/notification-center.js +11 -0
  210. package/dist/notification-stack.d.ts +2 -0
  211. package/dist/notification-stack.js +7 -0
  212. package/dist/now-playing.d.ts +2 -0
  213. package/dist/now-playing.js +7 -0
  214. package/dist/onboarding.d.ts +2 -0
  215. package/dist/onboarding.js +10 -0
  216. package/dist/otp-input.d.ts +2 -0
  217. package/dist/otp-input.js +9 -0
  218. package/dist/pagination.d.ts +2 -0
  219. package/dist/pagination.js +11 -0
  220. package/dist/password-input.d.ts +2 -0
  221. package/dist/password-input.js +13 -0
  222. package/dist/payment-received.d.ts +2 -0
  223. package/dist/payment-received.js +7 -0
  224. package/dist/plan-switcher.d.ts +2 -0
  225. package/dist/plan-switcher.js +7 -0
  226. package/dist/popover.d.ts +2 -0
  227. package/dist/popover.js +9 -0
  228. package/dist/progress.d.ts +2 -0
  229. package/dist/progress.js +11 -0
  230. package/dist/range-slider.d.ts +2 -0
  231. package/dist/range-slider.js +9 -0
  232. package/dist/rating.d.ts +2 -0
  233. package/dist/rating.js +9 -0
  234. package/dist/seat-picker.d.ts +2 -0
  235. package/dist/seat-picker.js +7 -0
  236. package/dist/shipment-tracker.d.ts +2 -0
  237. package/dist/shipment-tracker.js +7 -0
  238. package/dist/sidebar.d.ts +2 -0
  239. package/dist/sidebar.js +10 -0
  240. package/dist/stat-card.d.ts +2 -0
  241. package/dist/stat-card.js +9 -0
  242. package/dist/stepper.d.ts +2 -0
  243. package/dist/stepper.js +9 -0
  244. package/dist/team-members.d.ts +2 -0
  245. package/dist/team-members.js +12 -0
  246. package/dist/timeline.d.ts +2 -0
  247. package/dist/timeline.js +9 -0
  248. package/dist/toggle-group.d.ts +2 -0
  249. package/dist/toggle-group.js +9 -0
  250. package/dist/token-swap.d.ts +2 -0
  251. package/dist/token-swap.js +7 -0
  252. package/dist/tree-view.d.ts +2 -0
  253. package/dist/tree-view.js +9 -0
  254. package/dist/types/components/kit/ai-chat.d.ts +37 -0
  255. package/dist/types/components/kit/alert.d.ts +27 -0
  256. package/dist/types/components/kit/announcement-bar.d.ts +36 -0
  257. package/dist/types/components/kit/avatar-group.d.ts +22 -0
  258. package/dist/types/components/kit/avatar.d.ts +2 -0
  259. package/dist/types/components/kit/base/avatar-group.d.ts +22 -0
  260. package/dist/types/components/kit/base/avatar.d.ts +2 -0
  261. package/dist/types/components/kit/base/checkout.d.ts +68 -0
  262. package/dist/types/components/kit/base/comments.d.ts +30 -0
  263. package/dist/types/components/kit/base/empty-state.d.ts +29 -0
  264. package/dist/types/components/kit/base/kanban.d.ts +26 -0
  265. package/dist/types/components/kit/base/notification-center.d.ts +34 -0
  266. package/dist/types/components/kit/base/onboarding.d.ts +28 -0
  267. package/dist/types/components/kit/base/sidebar.d.ts +43 -0
  268. package/dist/types/components/kit/base/team-members.d.ts +46 -0
  269. package/dist/types/components/kit/breadcrumb.d.ts +29 -0
  270. package/dist/types/components/kit/carousel.d.ts +21 -0
  271. package/dist/types/components/kit/checkout.d.ts +68 -0
  272. package/dist/types/components/kit/color-picker.d.ts +28 -0
  273. package/dist/types/components/kit/combobox.d.ts +40 -0
  274. package/dist/types/components/kit/comments.d.ts +30 -0
  275. package/dist/types/components/kit/context-menu.d.ts +37 -0
  276. package/dist/types/components/kit/copy-button.d.ts +20 -0
  277. package/dist/types/components/kit/data-table.d.ts +47 -0
  278. package/dist/types/components/kit/date-picker.d.ts +40 -0
  279. package/dist/types/components/kit/drawer.d.ts +26 -0
  280. package/dist/types/components/kit/empty-state.d.ts +29 -0
  281. package/dist/types/components/kit/event-calendar.d.ts +34 -0
  282. package/dist/types/components/kit/file-upload.d.ts +37 -0
  283. package/dist/types/components/kit/hover-card.d.ts +31 -0
  284. package/dist/types/components/kit/image-compare.d.ts +29 -0
  285. package/dist/types/components/kit/inline-edit.d.ts +26 -0
  286. package/dist/types/components/kit/kanban.d.ts +26 -0
  287. package/dist/types/components/kit/notification-center.d.ts +34 -0
  288. package/dist/types/components/kit/onboarding.d.ts +28 -0
  289. package/dist/types/components/kit/otp-input.d.ts +28 -0
  290. package/dist/types/components/kit/pagination.d.ts +25 -0
  291. package/dist/types/components/kit/password-input.d.ts +32 -0
  292. package/dist/types/components/kit/popover.d.ts +40 -0
  293. package/dist/types/components/kit/progress.d.ts +37 -0
  294. package/dist/types/components/kit/range-slider.d.ts +27 -0
  295. package/dist/types/components/kit/rating.d.ts +23 -0
  296. package/dist/types/components/kit/sidebar.d.ts +43 -0
  297. package/dist/types/components/kit/stat-card.d.ts +24 -0
  298. package/dist/types/components/kit/stepper.d.ts +36 -0
  299. package/dist/types/components/kit/team-members.d.ts +46 -0
  300. package/dist/types/components/kit/timeline.d.ts +24 -0
  301. package/dist/types/components/kit/toggle-group.d.ts +42 -0
  302. package/dist/types/components/kit/tree-view.d.ts +31 -0
  303. package/dist/types/components/lab/blocks/BookingSlots.d.ts +2 -0
  304. package/dist/types/components/lab/blocks/ChatThread.d.ts +2 -0
  305. package/dist/types/components/lab/blocks/NotificationStack.d.ts +2 -0
  306. package/dist/types/components/lab/blocks/NowPlaying.d.ts +2 -0
  307. package/dist/types/components/lab/blocks/PaymentReceived.d.ts +2 -0
  308. package/dist/types/components/lab/blocks/PlanSwitcher.d.ts +2 -0
  309. package/dist/types/components/lab/blocks/SeatPicker.d.ts +2 -0
  310. package/dist/types/components/lab/blocks/ShipmentTracker.d.ts +2 -0
  311. package/dist/types/components/lab/blocks/TokenSwap.d.ts +2 -0
  312. package/dist/types/components/lab/blocks/Wishlist.d.ts +2 -0
  313. package/dist/types/packages/asta-ui/src/ai-chat.d.ts +2 -0
  314. package/dist/types/packages/asta-ui/src/alert.d.ts +2 -0
  315. package/dist/types/packages/asta-ui/src/announcement-bar.d.ts +2 -0
  316. package/dist/types/packages/asta-ui/src/avatar-group.d.ts +2 -0
  317. package/dist/types/packages/asta-ui/src/base/ai-chat.d.ts +2 -0
  318. package/dist/types/packages/asta-ui/src/base/alert.d.ts +2 -0
  319. package/dist/types/packages/asta-ui/src/base/announcement-bar.d.ts +2 -0
  320. package/dist/types/packages/asta-ui/src/base/avatar-group.d.ts +2 -0
  321. package/dist/types/packages/asta-ui/src/base/booking-slots.d.ts +2 -0
  322. package/dist/types/packages/asta-ui/src/base/breadcrumb.d.ts +2 -0
  323. package/dist/types/packages/asta-ui/src/base/carousel.d.ts +2 -0
  324. package/dist/types/packages/asta-ui/src/base/chat-thread.d.ts +2 -0
  325. package/dist/types/packages/asta-ui/src/base/checkout.d.ts +2 -0
  326. package/dist/types/packages/asta-ui/src/base/color-picker.d.ts +2 -0
  327. package/dist/types/packages/asta-ui/src/base/combobox.d.ts +2 -0
  328. package/dist/types/packages/asta-ui/src/base/comments.d.ts +2 -0
  329. package/dist/types/packages/asta-ui/src/base/context-menu.d.ts +2 -0
  330. package/dist/types/packages/asta-ui/src/base/copy-button.d.ts +2 -0
  331. package/dist/types/packages/asta-ui/src/base/data-table.d.ts +2 -0
  332. package/dist/types/packages/asta-ui/src/base/date-picker.d.ts +2 -0
  333. package/dist/types/packages/asta-ui/src/base/drawer.d.ts +2 -0
  334. package/dist/types/packages/asta-ui/src/base/empty-state.d.ts +2 -0
  335. package/dist/types/packages/asta-ui/src/base/event-calendar.d.ts +2 -0
  336. package/dist/types/packages/asta-ui/src/base/file-upload.d.ts +2 -0
  337. package/dist/types/packages/asta-ui/src/base/hover-card.d.ts +2 -0
  338. package/dist/types/packages/asta-ui/src/base/image-compare.d.ts +2 -0
  339. package/dist/types/packages/asta-ui/src/base/inline-edit.d.ts +2 -0
  340. package/dist/types/packages/asta-ui/src/base/kanban.d.ts +2 -0
  341. package/dist/types/packages/asta-ui/src/base/notification-center.d.ts +2 -0
  342. package/dist/types/packages/asta-ui/src/base/notification-stack.d.ts +2 -0
  343. package/dist/types/packages/asta-ui/src/base/now-playing.d.ts +2 -0
  344. package/dist/types/packages/asta-ui/src/base/onboarding.d.ts +2 -0
  345. package/dist/types/packages/asta-ui/src/base/otp-input.d.ts +2 -0
  346. package/dist/types/packages/asta-ui/src/base/pagination.d.ts +2 -0
  347. package/dist/types/packages/asta-ui/src/base/password-input.d.ts +2 -0
  348. package/dist/types/packages/asta-ui/src/base/payment-received.d.ts +2 -0
  349. package/dist/types/packages/asta-ui/src/base/plan-switcher.d.ts +2 -0
  350. package/dist/types/packages/asta-ui/src/base/popover.d.ts +2 -0
  351. package/dist/types/packages/asta-ui/src/base/progress.d.ts +2 -0
  352. package/dist/types/packages/asta-ui/src/base/range-slider.d.ts +2 -0
  353. package/dist/types/packages/asta-ui/src/base/rating.d.ts +2 -0
  354. package/dist/types/packages/asta-ui/src/base/seat-picker.d.ts +2 -0
  355. package/dist/types/packages/asta-ui/src/base/shipment-tracker.d.ts +2 -0
  356. package/dist/types/packages/asta-ui/src/base/sidebar.d.ts +2 -0
  357. package/dist/types/packages/asta-ui/src/base/stat-card.d.ts +2 -0
  358. package/dist/types/packages/asta-ui/src/base/stepper.d.ts +2 -0
  359. package/dist/types/packages/asta-ui/src/base/team-members.d.ts +2 -0
  360. package/dist/types/packages/asta-ui/src/base/timeline.d.ts +2 -0
  361. package/dist/types/packages/asta-ui/src/base/toggle-group.d.ts +2 -0
  362. package/dist/types/packages/asta-ui/src/base/token-swap.d.ts +2 -0
  363. package/dist/types/packages/asta-ui/src/base/tree-view.d.ts +2 -0
  364. package/dist/types/packages/asta-ui/src/base/wishlist.d.ts +2 -0
  365. package/dist/types/packages/asta-ui/src/base.d.ts +87 -1
  366. package/dist/types/packages/asta-ui/src/booking-slots.d.ts +2 -0
  367. package/dist/types/packages/asta-ui/src/breadcrumb.d.ts +2 -0
  368. package/dist/types/packages/asta-ui/src/carousel.d.ts +2 -0
  369. package/dist/types/packages/asta-ui/src/chat-thread.d.ts +2 -0
  370. package/dist/types/packages/asta-ui/src/checkout.d.ts +2 -0
  371. package/dist/types/packages/asta-ui/src/color-picker.d.ts +2 -0
  372. package/dist/types/packages/asta-ui/src/combobox.d.ts +2 -0
  373. package/dist/types/packages/asta-ui/src/comments.d.ts +2 -0
  374. package/dist/types/packages/asta-ui/src/context-menu.d.ts +2 -0
  375. package/dist/types/packages/asta-ui/src/copy-button.d.ts +2 -0
  376. package/dist/types/packages/asta-ui/src/data-table.d.ts +2 -0
  377. package/dist/types/packages/asta-ui/src/date-picker.d.ts +2 -0
  378. package/dist/types/packages/asta-ui/src/drawer.d.ts +2 -0
  379. package/dist/types/packages/asta-ui/src/empty-state.d.ts +2 -0
  380. package/dist/types/packages/asta-ui/src/event-calendar.d.ts +2 -0
  381. package/dist/types/packages/asta-ui/src/file-upload.d.ts +2 -0
  382. package/dist/types/packages/asta-ui/src/hover-card.d.ts +2 -0
  383. package/dist/types/packages/asta-ui/src/image-compare.d.ts +2 -0
  384. package/dist/types/packages/asta-ui/src/index.d.ts +87 -1
  385. package/dist/types/packages/asta-ui/src/inline-edit.d.ts +2 -0
  386. package/dist/types/packages/asta-ui/src/kanban.d.ts +2 -0
  387. package/dist/types/packages/asta-ui/src/notification-center.d.ts +2 -0
  388. package/dist/types/packages/asta-ui/src/notification-stack.d.ts +2 -0
  389. package/dist/types/packages/asta-ui/src/now-playing.d.ts +2 -0
  390. package/dist/types/packages/asta-ui/src/onboarding.d.ts +2 -0
  391. package/dist/types/packages/asta-ui/src/otp-input.d.ts +2 -0
  392. package/dist/types/packages/asta-ui/src/pagination.d.ts +2 -0
  393. package/dist/types/packages/asta-ui/src/password-input.d.ts +2 -0
  394. package/dist/types/packages/asta-ui/src/payment-received.d.ts +2 -0
  395. package/dist/types/packages/asta-ui/src/plan-switcher.d.ts +2 -0
  396. package/dist/types/packages/asta-ui/src/popover.d.ts +2 -0
  397. package/dist/types/packages/asta-ui/src/progress.d.ts +2 -0
  398. package/dist/types/packages/asta-ui/src/range-slider.d.ts +2 -0
  399. package/dist/types/packages/asta-ui/src/rating.d.ts +2 -0
  400. package/dist/types/packages/asta-ui/src/seat-picker.d.ts +2 -0
  401. package/dist/types/packages/asta-ui/src/shipment-tracker.d.ts +2 -0
  402. package/dist/types/packages/asta-ui/src/sidebar.d.ts +2 -0
  403. package/dist/types/packages/asta-ui/src/stat-card.d.ts +2 -0
  404. package/dist/types/packages/asta-ui/src/stepper.d.ts +2 -0
  405. package/dist/types/packages/asta-ui/src/team-members.d.ts +2 -0
  406. package/dist/types/packages/asta-ui/src/timeline.d.ts +2 -0
  407. package/dist/types/packages/asta-ui/src/toggle-group.d.ts +2 -0
  408. package/dist/types/packages/asta-ui/src/token-swap.d.ts +2 -0
  409. package/dist/types/packages/asta-ui/src/tree-view.d.ts +2 -0
  410. package/dist/types/packages/asta-ui/src/wishlist.d.ts +2 -0
  411. package/dist/wishlist.d.ts +2 -0
  412. package/dist/wishlist.js +7 -0
  413. package/package.json +1 -1
@@ -0,0 +1,197 @@
1
+ "use client";
2
+
3
+ // components/kit/popover.tsx
4
+ import {
5
+ cloneElement,
6
+ isValidElement,
7
+ useEffect,
8
+ useId,
9
+ useLayoutEffect,
10
+ useRef,
11
+ useState
12
+ } from "react";
13
+ import { createPortal } from "react-dom";
14
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
15
+ var cx = (...c) => c.filter(Boolean).join(" ");
16
+ var KEYFRAMES = `@keyframes asta-popover-in { from { opacity: 0; transform: translate(var(--asta-pop-x, 0), var(--asta-pop-y, 0)) scale(.94) } }
17
+ @keyframes asta-popover-out { to { opacity: 0; transform: scale(.97) } }`;
18
+ var PAD = 8;
19
+ function assignRef(r, el) {
20
+ if (typeof r === "function") r(el);
21
+ else if (r) r.current = el;
22
+ }
23
+ var OPPOSITE = { top: "bottom", bottom: "top", left: "right", right: "left" };
24
+ var FOCUSABLE = 'a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])';
25
+ function Popover({ trigger, children, open, defaultOpen = false, onOpenChange, side = "bottom", align = "center", offset = 8, arrow, label, className }) {
26
+ const id = useId();
27
+ const [inner, setInner] = useState(defaultOpen);
28
+ const isOpen = open ?? inner;
29
+ const [present, setPresent] = useState(isOpen);
30
+ const [anchor, setAnchor] = useState(null);
31
+ const panel = useRef(null);
32
+ const arrowEl = useRef(null);
33
+ if (isOpen && !present) setPresent(true);
34
+ const setOpen = (next) => {
35
+ if (next === isOpen) return;
36
+ if (open === void 0) setInner(next);
37
+ onOpenChange?.(next);
38
+ };
39
+ const close = (refocus = true) => {
40
+ setOpen(false);
41
+ if (refocus) anchor?.focus();
42
+ };
43
+ useLayoutEffect(() => {
44
+ if (!present || !anchor) return;
45
+ const place = () => {
46
+ const el = panel.current;
47
+ if (!el) return;
48
+ const a = anchor.getBoundingClientRect();
49
+ const w = el.offsetWidth;
50
+ const h = el.offsetHeight;
51
+ const vw = window.innerWidth;
52
+ const vh = window.innerHeight;
53
+ const room = { top: a.top, bottom: vh - a.bottom, left: a.left, right: vw - a.right };
54
+ const need = side === "top" || side === "bottom" ? h : w;
55
+ let s = side;
56
+ if (room[s] < need + offset + PAD && room[OPPOSITE[s]] > room[s]) s = OPPOSITE[s];
57
+ const vertical = s === "top" || s === "bottom";
58
+ let x;
59
+ let y;
60
+ if (vertical) {
61
+ x = align === "start" ? a.left : align === "end" ? a.right - w : a.left + a.width / 2 - w / 2;
62
+ y = s === "bottom" ? a.bottom + offset : a.top - offset - h;
63
+ x = Math.min(Math.max(PAD, x), vw - w - PAD);
64
+ } else {
65
+ y = align === "start" ? a.top : align === "end" ? a.bottom - h : a.top + a.height / 2 - h / 2;
66
+ x = s === "right" ? a.right + offset : a.left - offset - w;
67
+ y = Math.min(Math.max(PAD, y), vh - h - PAD);
68
+ }
69
+ const along = vertical ? Math.min(Math.max(14, a.left + a.width / 2 - x), w - 14) : Math.min(Math.max(14, a.top + a.height / 2 - y), h - 14);
70
+ const origin = vertical ? `${along}px ${s === "bottom" ? "0" : "100%"}` : `${s === "right" ? "0" : "100%"} ${along}px`;
71
+ const nudge = { top: ["0", "4px"], bottom: ["0", "-4px"], left: ["4px", "0"], right: ["-4px", "0"] }[s];
72
+ el.style.left = `${Math.round(x)}px`;
73
+ el.style.top = `${Math.round(y)}px`;
74
+ el.style.transformOrigin = origin;
75
+ el.style.setProperty("--asta-pop-x", nudge[0]);
76
+ el.style.setProperty("--asta-pop-y", nudge[1]);
77
+ el.dataset.side = s;
78
+ const ar = arrowEl.current;
79
+ if (ar) {
80
+ const rot = { bottom: 0, top: 180, left: 90, right: -90 }[s];
81
+ ar.style.transform = `rotate(${rot}deg)`;
82
+ ar.style.left = vertical ? `${along - 7}px` : s === "right" ? "-9.5px" : `${w - 4.5}px`;
83
+ ar.style.top = vertical ? s === "bottom" ? "-6px" : `${h - 1}px` : `${along - 3.5}px`;
84
+ }
85
+ };
86
+ place();
87
+ const ro = new ResizeObserver(place);
88
+ ro.observe(panel.current);
89
+ window.addEventListener("resize", place);
90
+ window.addEventListener("scroll", place, true);
91
+ return () => {
92
+ ro.disconnect();
93
+ window.removeEventListener("resize", place);
94
+ window.removeEventListener("scroll", place, true);
95
+ };
96
+ }, [present, anchor, side, align, offset]);
97
+ useEffect(() => {
98
+ if (!isOpen) return;
99
+ const el = panel.current;
100
+ if (!el) return;
101
+ const first = el.querySelector("[data-autofocus]") ?? el.querySelector(FOCUSABLE);
102
+ (first ?? el).focus({ preventScroll: true });
103
+ }, [isOpen]);
104
+ useEffect(() => {
105
+ if (!isOpen) return;
106
+ const onDown = (e) => {
107
+ const t = e.target;
108
+ if (panel.current?.contains(t) || anchor?.contains(t)) return;
109
+ if (open === void 0) setInner(false);
110
+ onOpenChange?.(false);
111
+ };
112
+ document.addEventListener("pointerdown", onDown);
113
+ return () => document.removeEventListener("pointerdown", onDown);
114
+ }, [isOpen, anchor, open, onOpenChange]);
115
+ const onKey = (e) => {
116
+ if (e.key === "Escape") {
117
+ e.stopPropagation();
118
+ close();
119
+ return;
120
+ }
121
+ if (e.key !== "Tab") return;
122
+ const items = [...panel.current.querySelectorAll(FOCUSABLE)];
123
+ const first = items[0];
124
+ const last = items[items.length - 1];
125
+ const at = document.activeElement;
126
+ if (!items.length || e.shiftKey && (at === first || at === panel.current) || !e.shiftKey && at === last) {
127
+ e.preventDefault();
128
+ close();
129
+ }
130
+ };
131
+ const triggerProps = {
132
+ ref: setAnchor,
133
+ onClick: () => setOpen(!isOpen),
134
+ "aria-haspopup": "dialog",
135
+ "aria-expanded": isOpen,
136
+ "aria-controls": present ? id : void 0,
137
+ "data-state": isOpen ? "open" : "closed"
138
+ };
139
+ let triggerNode;
140
+ if (typeof trigger === "function") triggerNode = trigger(triggerProps, isOpen);
141
+ else if (isValidElement(trigger)) {
142
+ const own = trigger.props;
143
+ triggerNode = cloneElement(trigger, {
144
+ ...triggerProps,
145
+ ref: (el) => {
146
+ setAnchor(el);
147
+ assignRef(own.ref, el);
148
+ },
149
+ onClick: (e) => {
150
+ own.onClick?.(e);
151
+ if (!e.defaultPrevented) setOpen(!isOpen);
152
+ }
153
+ });
154
+ }
155
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
156
+ triggerNode,
157
+ present && typeof document !== "undefined" && createPortal(
158
+ /* @__PURE__ */ jsxs(
159
+ "div",
160
+ {
161
+ ref: panel,
162
+ id,
163
+ role: "dialog",
164
+ "aria-label": label,
165
+ tabIndex: -1,
166
+ "data-state": isOpen ? "open" : "closed",
167
+ onKeyDown: onKey,
168
+ onAnimationEnd: (e) => {
169
+ if (e.target === e.currentTarget && !isOpen) setPresent(false);
170
+ },
171
+ className: cx(
172
+ "fixed left-0 top-0 z-50 w-max max-w-[calc(100vw-16px)] rounded-xl bg-paper p-3 text-ink outline-none",
173
+ "shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_10%,transparent),0_14px_36px_-14px_rgb(0_0_0/0.3),0_4px_10px_-6px_rgb(0_0_0/0.12)]",
174
+ "animate-[asta-popover-in_.24s_cubic-bezier(.16,1,.3,1)_both] data-[state=closed]:animate-[asta-popover-out_.12s_ease-in_both]",
175
+ "motion-reduce:![animation-duration:1ms]",
176
+ className
177
+ ),
178
+ children: [
179
+ /* @__PURE__ */ jsx("style", { href: "asta-popover", precedence: "asta", children: KEYFRAMES }),
180
+ arrow && /* @__PURE__ */ jsxs("svg", { ref: arrowEl, width: "14", height: "7", viewBox: "0 0 14 7", "aria-hidden": true, className: "pointer-events-none absolute", style: { transformOrigin: "50% 50%" }, children: [
181
+ /* @__PURE__ */ jsx("path", { d: "M0 7 7 .8 14 7z", className: "fill-paper" }),
182
+ /* @__PURE__ */ jsx("path", { d: "M0 7 7 .8 14 7", fill: "none", strokeWidth: "1", style: { stroke: "color-mix(in srgb, var(--ink) 12%, transparent)" } })
183
+ ] }),
184
+ typeof children === "function" ? children({ close: () => close() }) : children
185
+ ]
186
+ }
187
+ ),
188
+ document.body
189
+ )
190
+ ] });
191
+ }
192
+ var popover_default = Popover;
193
+
194
+ export {
195
+ Popover,
196
+ popover_default
197
+ };
@@ -0,0 +1,431 @@
1
+ "use client";
2
+ import {
3
+ Select
4
+ } from "./chunk-QDRBMWRX.js";
5
+ import {
6
+ Button
7
+ } from "./chunk-WSL4JGEA.js";
8
+ import {
9
+ Input
10
+ } from "./chunk-U7BYEW3Y.js";
11
+
12
+ // components/kit/base/checkout.tsx
13
+ import { useEffect, useId, useMemo, useRef, useState } from "react";
14
+ import { jsx, jsxs } from "react/jsx-runtime";
15
+ var cx = (...c) => c.filter(Boolean).join(" ");
16
+ var CURVE = "cubic-bezier(.16,1,.3,1)";
17
+ var KEYFRAMES = `@keyframes kit-co-roll { from { opacity: 0; transform: translateY(calc(var(--kit-co-d, 1) * 70%)) } }
18
+ @keyframes kit-co-up { from { opacity: 0; transform: translateY(8px) } }
19
+ @keyframes kit-co-pop { 0% { opacity: 0; transform: scale(.4) } 60% { opacity: 1; transform: scale(1.08) } 100% { transform: scale(1) } }
20
+ @media (prefers-reduced-motion: reduce) { .kit-co, .kit-co * { animation: none !important; transition-duration: 0s !important; } }`;
21
+ var DEFAULT_SHIPPING = [
22
+ { id: "standard", label: "Standard", eta: "3\u20135 business days", price: 0 },
23
+ { id: "express", label: "Express", eta: "1\u20132 business days", price: 14 }
24
+ ];
25
+ var DEFAULT_COUNTRIES = [
26
+ { value: "ID", label: "Indonesia" },
27
+ { value: "SG", label: "Singapore" },
28
+ { value: "AU", label: "Australia" },
29
+ { value: "GB", label: "United Kingdom" },
30
+ { value: "US", label: "United States" }
31
+ ];
32
+ var digits = (s) => s.replace(/\D/g, "");
33
+ var isAmex = (d) => /^3[47]/.test(d);
34
+ var fmtCard = (d) => {
35
+ if (isAmex(d)) {
36
+ const v = d.slice(0, 15);
37
+ return [v.slice(0, 4), v.slice(4, 10), v.slice(10)].filter(Boolean).join(" ");
38
+ }
39
+ return d.slice(0, 19).replace(/(\d{4})(?=\d)/g, "$1 ");
40
+ };
41
+ var fmtExpiry = (d) => {
42
+ const v = d.slice(0, 4);
43
+ return v.length > 2 ? `${v.slice(0, 2)} / ${v.slice(2)}` : v;
44
+ };
45
+ var ORDER = ["email", "name", "address", "city", "postal", "cardNumber", "cardExpiry", "cardCvc"];
46
+ function check(f, d) {
47
+ const v = d[f].trim();
48
+ switch (f) {
49
+ case "email":
50
+ return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(v) ? null : "Enter an email like you@example.com.";
51
+ case "cardNumber":
52
+ return (isAmex(v) ? v.length === 15 : v.length >= 13 && v.length <= 19) ? null : "Check the card number.";
53
+ case "cardExpiry": {
54
+ const [m, y] = v.split("/").map(Number);
55
+ if (!/^\d{2}\/\d{2}$/.test(v) || !m || m > 12) return "Use MM / YY.";
56
+ const now = /* @__PURE__ */ new Date();
57
+ const end = new Date(2e3 + y, m, 1);
58
+ return end > now ? null : "This card has expired.";
59
+ }
60
+ case "cardCvc":
61
+ return v.length >= 3 ? null : "3 or 4 digits, on the back.";
62
+ default:
63
+ return v ? null : "Required.";
64
+ }
65
+ }
66
+ function RollChar({ c, animate, delay }) {
67
+ const [on] = useState(animate);
68
+ return /* @__PURE__ */ jsx("span", { className: "inline-block whitespace-pre", style: on ? { animation: `kit-co-roll .5s ${CURVE} ${delay}ms both` } : void 0, children: c });
69
+ }
70
+ function Money({ value, format, className }) {
71
+ const [prev, setPrev] = useState(value);
72
+ const [dir, setDir] = useState(0);
73
+ if (prev !== value) {
74
+ setDir(value > prev ? 1 : -1);
75
+ setPrev(value);
76
+ }
77
+ const s = format(value);
78
+ const chars = s.split("");
79
+ return /* @__PURE__ */ jsxs("span", { className: cx("inline-flex overflow-hidden tabular-nums", className), style: { ["--kit-co-d"]: dir || 1 }, children: [
80
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: s }),
81
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "inline-flex", children: chars.map((c, i) => (
82
+ // Keyed by position from the right, so only characters that changed re-mount and roll.
83
+ /* @__PURE__ */ jsx(RollChar, { c, animate: dir !== 0, delay: (chars.length - i) * 18 }, `${chars.length - i}-${c}`)
84
+ )) })
85
+ ] });
86
+ }
87
+ function Section({ n, title, children }) {
88
+ return /* @__PURE__ */ jsxs("fieldset", { className: "min-w-0", children: [
89
+ /* @__PURE__ */ jsxs("legend", { className: "mb-4 flex items-center gap-2.5 text-[14px] font-medium tracking-[-0.01em] text-ink", children: [
90
+ /* @__PURE__ */ jsx("span", { className: "grid h-5 w-5 place-items-center rounded-md bg-paper-2 text-[11px] tabular-nums text-ink-2", children: n }),
91
+ title
92
+ ] }),
93
+ /* @__PURE__ */ jsx("div", { className: "grid gap-3", children })
94
+ ] });
95
+ }
96
+ function Labeled({ id, label, error, children, className }) {
97
+ return /* @__PURE__ */ jsxs("div", { className: cx("min-w-0", className), children: [
98
+ /* @__PURE__ */ jsx("label", { htmlFor: id, className: "mb-1.5 block text-[12.5px] text-ink-2", children: label }),
99
+ children,
100
+ error && /* @__PURE__ */ jsxs("p", { id: `${id}-err`, className: "mt-1.5 flex items-center gap-1.5 text-[12px] text-ink-2", style: { animation: `kit-co-up .3s ${CURVE}` }, children: [
101
+ /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", className: "h-3.5 w-3.5 shrink-0", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", "aria-hidden": true, children: [
102
+ /* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "6" }),
103
+ /* @__PURE__ */ jsx("path", { d: "M8 5v3.5M8 11h0" })
104
+ ] }),
105
+ error
106
+ ] })
107
+ ] });
108
+ }
109
+ var INVALID = "!shadow-[inset_0_0_0_1.5px_var(--ink)]";
110
+ function CardGlyph() {
111
+ return /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 20 14", className: "h-3.5 w-5", fill: "none", stroke: "currentColor", strokeWidth: "1.3", "aria-hidden": true, children: [
112
+ /* @__PURE__ */ jsx("rect", { x: ".75", y: ".75", width: "18.5", height: "12.5", rx: "2.2" }),
113
+ /* @__PURE__ */ jsx("path", { d: "M.75 4.5h18.5M4 9.5h4", strokeLinecap: "round" })
114
+ ] });
115
+ }
116
+ function Stepper({ name, qty, onChange, disabled }) {
117
+ const btn = "grid h-6 w-6 place-items-center rounded-md text-ink-2 outline-none transition-colors duration-200 hover:bg-paper hover:text-ink focus-visible:ring-2 focus-visible:ring-brand/50 disabled:opacity-35 disabled:hover:bg-transparent";
118
+ return /* @__PURE__ */ jsxs("div", { className: "inline-flex items-center gap-1", role: "group", "aria-label": `Quantity of ${name}`, children: [
119
+ /* @__PURE__ */ jsx("button", { type: "button", className: btn, "aria-label": "Fewer", disabled: disabled || qty <= 1, onClick: () => onChange(qty - 1), children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 12 12", className: "h-3 w-3", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M2.5 6h7" }) }) }),
120
+ /* @__PURE__ */ jsx("span", { className: "w-5 text-center text-[12.5px] tabular-nums text-ink", "aria-live": "polite", children: qty }),
121
+ /* @__PURE__ */ jsx("button", { type: "button", className: btn, "aria-label": "More", disabled: disabled || qty >= 99, onClick: () => onChange(qty + 1), children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 12 12", className: "h-3 w-3", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M2.5 6h7M6 2.5v7" }) }) })
122
+ ] });
123
+ }
124
+ function Checkout({
125
+ items: initialItems,
126
+ onPay,
127
+ shippingOptions = DEFAULT_SHIPPING,
128
+ countries = DEFAULT_COUNTRIES,
129
+ taxRate = 0,
130
+ promoCodes = {},
131
+ currency = "USD",
132
+ locale,
133
+ defaultDetails,
134
+ onItemsChange,
135
+ className
136
+ }) {
137
+ const uid = useId();
138
+ const id = (f) => `${uid}-${f}`;
139
+ const [items, setItems] = useState(initialItems);
140
+ const [seenItems, setSeenItems] = useState(initialItems);
141
+ if (seenItems !== initialItems) {
142
+ setSeenItems(initialItems);
143
+ setItems(initialItems);
144
+ }
145
+ const [d, setD] = useState(() => ({
146
+ email: "",
147
+ name: "",
148
+ address: "",
149
+ city: "",
150
+ postal: "",
151
+ country: countries[0]?.value ?? "",
152
+ shipping: shippingOptions[0]?.id ?? "",
153
+ cardNumber: "",
154
+ cardExpiry: "",
155
+ cardCvc: "",
156
+ ...defaultDetails
157
+ }));
158
+ const [touched, setTouched] = useState({});
159
+ const [promoOpen, setPromoOpen] = useState(false);
160
+ const [promoText, setPromoText] = useState("");
161
+ const [promo, setPromo] = useState(null);
162
+ const [promoMsg, setPromoMsg] = useState("");
163
+ const [state, setState] = useState("idle");
164
+ const [payError, setPayError] = useState("");
165
+ const alive = useRef(true);
166
+ useEffect(() => {
167
+ alive.current = true;
168
+ return () => {
169
+ alive.current = false;
170
+ };
171
+ }, []);
172
+ const money = useMemo(() => {
173
+ const f = new Intl.NumberFormat(locale, { style: "currency", currency });
174
+ return (n) => f.format(n);
175
+ }, [locale, currency]);
176
+ const ship = shippingOptions.find((s) => s.id === d.shipping) ?? shippingOptions[0];
177
+ const subtotal = items.reduce((a, i) => a + i.price * i.qty, 0);
178
+ const discount = promo ? Math.round(subtotal * promo.off * 100) / 100 : 0;
179
+ const tax = Math.round((subtotal - discount) * taxRate * 100) / 100;
180
+ const total = Math.max(0, subtotal - discount + (ship?.price ?? 0) + tax);
181
+ const errors = Object.fromEntries(ORDER.map((f) => [f, check(f, d)]));
182
+ const shown = (f) => touched[f] ? errors[f] : null;
183
+ const locked = state !== "idle";
184
+ const set = (f, v) => setD((p) => ({ ...p, [f]: v }));
185
+ const blur = (f) => setTouched((t) => ({ ...t, [f]: true }));
186
+ const formatted = (f, fmt, max) => (e) => {
187
+ const el = e.currentTarget;
188
+ const before = digits(el.value.slice(0, el.selectionStart ?? el.value.length)).length;
189
+ const raw = digits(el.value).slice(0, max);
190
+ const out = fmt(raw);
191
+ set(f, f === "cardExpiry" ? out.replace(/\s/g, "") : f === "cardNumber" ? digits(out) : raw);
192
+ let pos = 0;
193
+ for (let seen = 0; pos < out.length && seen < before; pos++) if (/\d/.test(out[pos])) seen++;
194
+ requestAnimationFrame(() => {
195
+ if (document.activeElement === el) el.setSelectionRange(pos, pos);
196
+ });
197
+ };
198
+ const changeQty = (itemId, qty) => {
199
+ const next = items.map((i) => i.id === itemId ? { ...i, qty } : i);
200
+ setItems(next);
201
+ onItemsChange?.(next);
202
+ };
203
+ const applyPromo = () => {
204
+ const code = promoText.trim().toUpperCase();
205
+ const hit = Object.entries(promoCodes).find(([k]) => k.toUpperCase() === code);
206
+ if (!code) return;
207
+ if (hit) {
208
+ setPromo({ code: hit[0].toUpperCase(), off: hit[1] });
209
+ setPromoMsg(`${hit[0].toUpperCase()} applied.`);
210
+ setPromoText("");
211
+ setPromoOpen(false);
212
+ } else setPromoMsg("That code isn't valid.");
213
+ };
214
+ const pay = async () => {
215
+ if (locked) return;
216
+ const bad = ORDER.filter((f) => errors[f]);
217
+ if (bad.length) {
218
+ setTouched(Object.fromEntries(ORDER.map((f) => [f, true])));
219
+ document.getElementById(id(bad[0]))?.focus();
220
+ return;
221
+ }
222
+ setPayError("");
223
+ setState("pending");
224
+ try {
225
+ await onPay({ details: d, items, total });
226
+ if (alive.current) setState("done");
227
+ } catch (err) {
228
+ if (!alive.current) return;
229
+ setState("idle");
230
+ setPayError(err instanceof Error && err.message ? err.message : "The payment didn't go through. Check the card and try again.");
231
+ }
232
+ };
233
+ const input = (f, extra = {}) => /* @__PURE__ */ jsx(
234
+ Input,
235
+ {
236
+ id: id(f),
237
+ value: f === "cardNumber" ? fmtCard(d[f]) : f === "cardExpiry" ? fmtExpiry(digits(d[f])) : d[f],
238
+ onChange: (e) => set(f, e.target.value),
239
+ onBlur: () => blur(f),
240
+ disabled: locked,
241
+ "aria-invalid": !!shown(f) || void 0,
242
+ "aria-describedby": shown(f) ? `${id(f)}-err` : void 0,
243
+ className: cx(shown(f) && INVALID),
244
+ ...extra
245
+ }
246
+ );
247
+ const rowCls = "flex items-baseline justify-between gap-4 text-[13px]";
248
+ return /* @__PURE__ */ jsxs("div", { className: cx("kit-co grid w-full gap-8 md:grid-cols-[minmax(0,1fr)_340px] md:gap-10", className), children: [
249
+ /* @__PURE__ */ jsx("style", { href: "asta-checkout", precedence: "asta", children: KEYFRAMES }),
250
+ /* @__PURE__ */ jsx("div", { className: "min-w-0", children: state === "done" ? /* @__PURE__ */ jsxs("div", { className: "flex h-full min-h-[420px] flex-col items-start justify-center", role: "status", style: { animation: `kit-co-up .5s ${CURVE}` }, children: [
251
+ /* @__PURE__ */ jsx("span", { className: "grid h-12 w-12 place-items-center rounded-full bg-brand text-white", style: { animation: `kit-co-pop .55s ${CURVE} .1s both` }, children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", className: "h-5 w-5", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "m3.5 8.5 3 3 6-7" }) }) }),
252
+ /* @__PURE__ */ jsx("h3", { className: "mt-6 text-[24px] font-medium tracking-[-0.03em] text-ink", children: "Payment received" }),
253
+ /* @__PURE__ */ jsxs("p", { className: "mt-2 max-w-[360px] text-[14px] leading-relaxed text-mute", children: [
254
+ "We charged ",
255
+ money(total),
256
+ " to the card ending ",
257
+ d.cardNumber.slice(-4),
258
+ ". A receipt is on its way to ",
259
+ d.email,
260
+ "."
261
+ ] }),
262
+ /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "sm", className: "mt-6 -ml-3", onClick: () => setState("idle"), children: "Back to checkout" })
263
+ ] }) : /* @__PURE__ */ jsxs(
264
+ "form",
265
+ {
266
+ noValidate: true,
267
+ className: "grid gap-9",
268
+ onSubmit: (e) => {
269
+ e.preventDefault();
270
+ pay();
271
+ },
272
+ children: [
273
+ /* @__PURE__ */ jsx(Section, { n: 1, title: "Contact", children: /* @__PURE__ */ jsx(Labeled, { id: id("email"), label: "Email", error: shown("email"), children: input("email", { type: "email", autoComplete: "email", placeholder: "you@example.com" }) }) }),
274
+ /* @__PURE__ */ jsxs(Section, { n: 2, title: "Shipping", children: [
275
+ /* @__PURE__ */ jsx(Labeled, { id: id("name"), label: "Full name", error: shown("name"), children: input("name", { autoComplete: "name" }) }),
276
+ /* @__PURE__ */ jsx(Labeled, { id: id("address"), label: "Address", error: shown("address"), children: input("address", { autoComplete: "street-address" }) }),
277
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-3", children: [
278
+ /* @__PURE__ */ jsx(Labeled, { id: id("city"), label: "City", error: shown("city"), children: input("city", { autoComplete: "address-level2" }) }),
279
+ /* @__PURE__ */ jsx(Labeled, { id: id("postal"), label: "Postal code", error: shown("postal"), children: input("postal", { autoComplete: "postal-code", inputMode: "numeric" }) })
280
+ ] }),
281
+ /* @__PURE__ */ jsxs("div", { children: [
282
+ /* @__PURE__ */ jsx("p", { className: "mb-1.5 text-[12.5px] text-ink-2", children: "Country" }),
283
+ /* @__PURE__ */ jsx(Select, { label: "Country", options: countries, value: d.country, onChange: (v) => set("country", v), disabled: locked })
284
+ ] }),
285
+ /* @__PURE__ */ jsx("div", { role: "radiogroup", "aria-label": "Shipping speed", className: "mt-1 grid gap-2 sm:grid-cols-2", children: shippingOptions.map((s) => {
286
+ const on = s.id === d.shipping;
287
+ return /* @__PURE__ */ jsxs(
288
+ "label",
289
+ {
290
+ className: cx(
291
+ "relative flex cursor-pointer items-start justify-between gap-3 rounded-[10px] p-3 transition-shadow duration-300 has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-brand/50",
292
+ on ? "shadow-[inset_0_0_0_1.5px_var(--brand)]" : "shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_12%,transparent)] hover:shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_26%,transparent)]",
293
+ locked && "pointer-events-none opacity-60"
294
+ ),
295
+ children: [
296
+ /* @__PURE__ */ jsx("input", { type: "radio", name: id("ship"), value: s.id, checked: on, disabled: locked, onChange: () => set("shipping", s.id), className: "sr-only" }),
297
+ /* @__PURE__ */ jsxs("span", { children: [
298
+ /* @__PURE__ */ jsx("span", { className: "block text-[13.5px] text-ink", children: s.label }),
299
+ /* @__PURE__ */ jsx("span", { className: "block text-[12px] text-mute", children: s.eta })
300
+ ] }),
301
+ /* @__PURE__ */ jsx("span", { className: "text-[13px] tabular-nums text-ink", children: s.price ? money(s.price) : "Free" })
302
+ ]
303
+ },
304
+ s.id
305
+ );
306
+ }) })
307
+ ] }),
308
+ /* @__PURE__ */ jsxs(Section, { n: 3, title: "Payment", children: [
309
+ /* @__PURE__ */ jsx(Labeled, { id: id("cardNumber"), label: "Card number", error: shown("cardNumber"), children: input("cardNumber", {
310
+ inputMode: "numeric",
311
+ autoComplete: "cc-number",
312
+ placeholder: "1234 1234 1234 1234",
313
+ onChange: formatted("cardNumber", fmtCard, 19),
314
+ iconRight: /* @__PURE__ */ jsx(CardGlyph, {})
315
+ }) }),
316
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-3", children: [
317
+ /* @__PURE__ */ jsx(Labeled, { id: id("cardExpiry"), label: "Expiry", error: shown("cardExpiry"), children: input("cardExpiry", { inputMode: "numeric", autoComplete: "cc-exp", placeholder: "MM / YY", onChange: formatted("cardExpiry", fmtExpiry, 4) }) }),
318
+ /* @__PURE__ */ jsx(Labeled, { id: id("cardCvc"), label: "CVC", error: shown("cardCvc"), children: input("cardCvc", { inputMode: "numeric", autoComplete: "cc-csc", placeholder: "123", onChange: formatted("cardCvc", (x) => x, 4) }) })
319
+ ] })
320
+ ] }),
321
+ /* @__PURE__ */ jsxs("div", { children: [
322
+ /* @__PURE__ */ jsxs(Button, { type: "submit", variant: "accent", size: "lg", className: "w-full", loading: state === "pending", children: [
323
+ "Pay ",
324
+ money(total)
325
+ ] }),
326
+ /* @__PURE__ */ jsx("p", { className: "mt-3 h-4 text-center text-[12px] text-mute", "aria-live": "polite", children: state === "pending" ? "Processing your payment\u2026" : payError || "Payments are encrypted. You won't be charged twice." })
327
+ ] })
328
+ ]
329
+ }
330
+ ) }),
331
+ /* @__PURE__ */ jsxs("aside", { "aria-label": "Order summary", className: "h-max rounded-[14px] bg-paper-2 p-5 md:sticky md:top-4", children: [
332
+ /* @__PURE__ */ jsx("h3", { className: "text-[14px] font-medium tracking-[-0.01em] text-ink", children: "Order" }),
333
+ /* @__PURE__ */ jsx("ul", { className: "mt-4 grid gap-4", children: items.map((i) => /* @__PURE__ */ jsxs("li", { className: "flex gap-3", children: [
334
+ i.image ? /* @__PURE__ */ jsx("img", { src: i.image, alt: "", className: "h-14 w-14 shrink-0 rounded-[10px] bg-paper object-cover" }) : /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "grid h-14 w-14 shrink-0 place-items-center rounded-[10px] bg-paper text-[15px] font-medium text-mute", children: i.name[0] }),
335
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
336
+ /* @__PURE__ */ jsxs("div", { className: "flex items-baseline justify-between gap-3", children: [
337
+ /* @__PURE__ */ jsx("p", { className: "truncate text-[13.5px] text-ink", children: i.name }),
338
+ /* @__PURE__ */ jsx(Money, { value: i.price * i.qty, format: money, className: "text-[13px] text-ink" })
339
+ ] }),
340
+ i.variant && /* @__PURE__ */ jsx("p", { className: "text-[12px] text-mute", children: i.variant }),
341
+ /* @__PURE__ */ jsx("div", { className: "mt-1 -ml-1", children: /* @__PURE__ */ jsx(Stepper, { name: i.name, qty: i.qty, disabled: locked, onChange: (q) => changeQty(i.id, q) }) })
342
+ ] })
343
+ ] }, i.id)) }),
344
+ /* @__PURE__ */ jsxs("div", { className: "mt-5", children: [
345
+ promo ? /* @__PURE__ */ jsxs("p", { className: "flex items-center justify-between text-[12.5px] text-ink-2", children: [
346
+ /* @__PURE__ */ jsxs("span", { children: [
347
+ "Code ",
348
+ /* @__PURE__ */ jsx("span", { className: "font-medium text-ink", children: promo.code })
349
+ ] }),
350
+ /* @__PURE__ */ jsx(
351
+ "button",
352
+ {
353
+ type: "button",
354
+ disabled: locked,
355
+ onClick: () => {
356
+ setPromo(null);
357
+ setPromoMsg("Code removed.");
358
+ },
359
+ className: "rounded text-mute outline-none hover:text-ink focus-visible:ring-2 focus-visible:ring-brand/50 disabled:opacity-40",
360
+ children: "Remove"
361
+ }
362
+ )
363
+ ] }) : promoOpen ? /* @__PURE__ */ jsxs("div", { className: "flex gap-2", style: { animation: `kit-co-up .3s ${CURVE}` }, children: [
364
+ /* @__PURE__ */ jsx(
365
+ Input,
366
+ {
367
+ size: "sm",
368
+ "aria-label": "Promo code",
369
+ placeholder: "Promo code",
370
+ value: promoText,
371
+ autoFocus: true,
372
+ disabled: locked,
373
+ onChange: (e) => {
374
+ setPromoText(e.target.value);
375
+ setPromoMsg("");
376
+ },
377
+ onKeyDown: (e) => {
378
+ if (e.key === "Enter") {
379
+ e.preventDefault();
380
+ applyPromo();
381
+ } else if (e.key === "Escape") setPromoOpen(false);
382
+ }
383
+ }
384
+ ),
385
+ /* @__PURE__ */ jsx(Button, { size: "sm", variant: "outline", onClick: applyPromo, disabled: locked || !promoText.trim(), children: "Apply" })
386
+ ] }) : /* @__PURE__ */ jsx(
387
+ "button",
388
+ {
389
+ type: "button",
390
+ disabled: locked,
391
+ onClick: () => setPromoOpen(true),
392
+ className: "rounded text-[12.5px] text-ink-2 underline decoration-[color-mix(in_srgb,var(--ink)_25%,transparent)] underline-offset-4 outline-none hover:text-ink focus-visible:ring-2 focus-visible:ring-brand/50 disabled:opacity-40",
393
+ children: "Add a promo code"
394
+ }
395
+ ),
396
+ /* @__PURE__ */ jsx("p", { className: "mt-1.5 min-h-4 text-[12px] text-mute", "aria-live": "polite", children: promoMsg })
397
+ ] }),
398
+ /* @__PURE__ */ jsxs("dl", { className: "mt-3 grid gap-2", children: [
399
+ /* @__PURE__ */ jsxs("div", { className: rowCls, children: [
400
+ /* @__PURE__ */ jsx("dt", { className: "text-mute", children: "Subtotal" }),
401
+ /* @__PURE__ */ jsx("dd", { children: /* @__PURE__ */ jsx(Money, { value: subtotal, format: money, className: "text-ink" }) })
402
+ ] }),
403
+ discount > 0 && /* @__PURE__ */ jsxs("div", { className: rowCls, style: { animation: `kit-co-up .35s ${CURVE}` }, children: [
404
+ /* @__PURE__ */ jsx("dt", { className: "text-mute", children: "Discount" }),
405
+ /* @__PURE__ */ jsxs("dd", { className: "text-brand", children: [
406
+ "\u2212",
407
+ /* @__PURE__ */ jsx(Money, { value: discount, format: money })
408
+ ] })
409
+ ] }),
410
+ /* @__PURE__ */ jsxs("div", { className: rowCls, children: [
411
+ /* @__PURE__ */ jsx("dt", { className: "text-mute", children: "Shipping" }),
412
+ /* @__PURE__ */ jsx("dd", { className: "text-ink", children: ship && ship.price ? /* @__PURE__ */ jsx(Money, { value: ship.price, format: money }) : "Free" })
413
+ ] }),
414
+ taxRate > 0 && /* @__PURE__ */ jsxs("div", { className: rowCls, children: [
415
+ /* @__PURE__ */ jsx("dt", { className: "text-mute", children: "Tax" }),
416
+ /* @__PURE__ */ jsx("dd", { children: /* @__PURE__ */ jsx(Money, { value: tax, format: money, className: "text-ink" }) })
417
+ ] }),
418
+ /* @__PURE__ */ jsxs("div", { className: "mt-3 flex items-baseline justify-between gap-4 pt-1", children: [
419
+ /* @__PURE__ */ jsx("dt", { className: "text-[14px] font-medium text-ink", children: "Total" }),
420
+ /* @__PURE__ */ jsx("dd", { children: /* @__PURE__ */ jsx(Money, { value: total, format: money, className: "text-[20px] font-medium tracking-[-0.02em] text-ink" }) })
421
+ ] })
422
+ ] })
423
+ ] })
424
+ ] });
425
+ }
426
+ var checkout_default = Checkout;
427
+
428
+ export {
429
+ Checkout,
430
+ checkout_default
431
+ };