@stevederico/skateboard-ui 3.12.0 → 4.1.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 (339) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +37 -31
  3. package/dist/components/core/Command.js +33 -7
  4. package/dist/shadcn/ui/accordion.d.ts +1 -6
  5. package/dist/shadcn/ui/accordion.js +3 -17
  6. package/dist/shadcn/ui/alert-dialog.d.ts +1 -18
  7. package/dist/shadcn/ui/alert-dialog.js +3 -43
  8. package/dist/shadcn/ui/alert.d.ts +1 -13
  9. package/dist/shadcn/ui/alert.js +3 -28
  10. package/dist/shadcn/ui/aspect-ratio.d.ts +1 -4
  11. package/dist/shadcn/ui/aspect-ratio.js +3 -8
  12. package/dist/shadcn/ui/avatar.d.ts +1 -11
  13. package/dist/shadcn/ui/avatar.js +3 -24
  14. package/dist/shadcn/ui/badge.d.ts +1 -14
  15. package/dist/shadcn/ui/badge.js +3 -33
  16. package/dist/shadcn/ui/breadcrumb.d.ts +1 -10
  17. package/dist/shadcn/ui/breadcrumb.js +3 -37
  18. package/dist/shadcn/ui/button-group.d.ts +1 -13
  19. package/dist/shadcn/ui/button-group.js +3 -36
  20. package/dist/shadcn/ui/button.d.ts +1 -34
  21. package/dist/shadcn/ui/button.js +3 -53
  22. package/dist/shadcn/ui/calendar.d.ts +1 -13
  23. package/dist/shadcn/ui/calendar.js +3 -75
  24. package/dist/shadcn/ui/card.d.ts +1 -11
  25. package/dist/shadcn/ui/card.js +3 -25
  26. package/dist/shadcn/ui/checkbox.d.ts +1 -3
  27. package/dist/shadcn/ui/checkbox.js +3 -9
  28. package/dist/shadcn/ui/collapsible.d.ts +1 -5
  29. package/dist/shadcn/ui/collapsible.js +3 -13
  30. package/dist/shadcn/ui/command.d.ts +1 -19
  31. package/dist/shadcn/ui/command.js +3 -35
  32. package/dist/shadcn/ui/context-menu.d.ts +1 -29
  33. package/dist/shadcn/ui/context-menu.js +3 -52
  34. package/dist/shadcn/ui/dialog.d.ts +1 -17
  35. package/dist/shadcn/ui/dialog.js +3 -38
  36. package/dist/shadcn/ui/drawer.d.ts +1 -13
  37. package/dist/shadcn/ui/drawer.js +3 -196
  38. package/dist/shadcn/ui/dropdown-menu.d.ts +1 -29
  39. package/dist/shadcn/ui/dropdown-menu.js +3 -52
  40. package/dist/shadcn/ui/empty.d.ts +1 -14
  41. package/dist/shadcn/ui/empty.js +3 -33
  42. package/dist/shadcn/ui/field.d.ts +1 -28
  43. package/dist/shadcn/ui/field.js +3 -68
  44. package/dist/shadcn/ui/hover-card.d.ts +1 -5
  45. package/dist/shadcn/ui/hover-card.js +3 -14
  46. package/dist/shadcn/ui/input-group.d.ts +1 -28
  47. package/dist/shadcn/ui/input-group.js +3 -58
  48. package/dist/shadcn/ui/input.d.ts +1 -3
  49. package/dist/shadcn/ui/input.js +3 -8
  50. package/dist/shadcn/ui/item.d.ts +1 -34
  51. package/dist/shadcn/ui/item.js +3 -79
  52. package/dist/shadcn/ui/kbd.d.ts +1 -3
  53. package/dist/shadcn/ui/kbd.js +3 -9
  54. package/dist/shadcn/ui/label.d.ts +1 -3
  55. package/dist/shadcn/ui/label.js +3 -8
  56. package/dist/shadcn/ui/menubar.d.ts +1 -29
  57. package/dist/shadcn/ui/menubar.js +3 -57
  58. package/dist/shadcn/ui/navigation-menu.d.ts +1 -13
  59. package/dist/shadcn/ui/navigation-menu.js +3 -31
  60. package/dist/shadcn/ui/pagination.d.ts +1 -17
  61. package/dist/shadcn/ui/pagination.js +3 -27
  62. package/dist/shadcn/ui/popover.d.ts +1 -9
  63. package/dist/shadcn/ui/popover.js +3 -24
  64. package/dist/shadcn/ui/progress.d.ts +1 -7
  65. package/dist/shadcn/ui/progress.js +3 -20
  66. package/dist/shadcn/ui/radio-group.d.ts +1 -5
  67. package/dist/shadcn/ui/radio-group.js +3 -12
  68. package/dist/shadcn/ui/scroll-area.d.ts +1 -5
  69. package/dist/shadcn/ui/scroll-area.js +3 -12
  70. package/dist/shadcn/ui/select.d.ts +1 -15
  71. package/dist/shadcn/ui/select.js +3 -35
  72. package/dist/shadcn/ui/separator.d.ts +1 -3
  73. package/dist/shadcn/ui/separator.js +3 -8
  74. package/dist/shadcn/ui/sheet.d.ts +1 -14
  75. package/dist/shadcn/ui/sheet.js +3 -38
  76. package/dist/shadcn/ui/sidebar.d.ts +1 -70
  77. package/dist/shadcn/ui/sidebar.js +3 -256
  78. package/dist/shadcn/ui/skeleton.d.ts +1 -2
  79. package/dist/shadcn/ui/skeleton.js +3 -6
  80. package/dist/shadcn/ui/slider.d.ts +1 -3
  81. package/dist/shadcn/ui/slider.js +3 -12
  82. package/dist/shadcn/ui/spinner.d.ts +1 -2
  83. package/dist/shadcn/ui/spinner.js +3 -7
  84. package/dist/shadcn/ui/switch.d.ts +1 -5
  85. package/dist/shadcn/ui/switch.js +3 -8
  86. package/dist/shadcn/ui/table.d.ts +1 -10
  87. package/dist/shadcn/ui/table.js +3 -29
  88. package/dist/shadcn/ui/tabs.d.ts +1 -13
  89. package/dist/shadcn/ui/tabs.js +3 -29
  90. package/dist/shadcn/ui/textarea.d.ts +1 -3
  91. package/dist/shadcn/ui/textarea.js +3 -7
  92. package/dist/shadcn/ui/toggle-group.d.ts +1 -11
  93. package/dist/shadcn/ui/toggle-group.js +3 -25
  94. package/dist/shadcn/ui/toggle.d.ts +1 -15
  95. package/dist/shadcn/ui/toggle.js +3 -26
  96. package/dist/shadcn/ui/tooltip.d.ts +1 -6
  97. package/dist/shadcn/ui/tooltip.js +3 -17
  98. package/dist/ui/accordion.d.ts +21 -0
  99. package/dist/ui/accordion.js +67 -0
  100. package/dist/ui/alert-dialog.d.ts +32 -0
  101. package/dist/ui/alert-dialog.js +102 -0
  102. package/dist/ui/alert.d.ts +13 -0
  103. package/dist/ui/alert.js +28 -0
  104. package/dist/ui/aspect-ratio.d.ts +5 -0
  105. package/dist/ui/aspect-ratio.js +9 -0
  106. package/dist/ui/avatar.d.ts +14 -0
  107. package/dist/ui/avatar.js +49 -0
  108. package/dist/ui/badge.d.ts +22 -0
  109. package/dist/ui/badge.js +26 -0
  110. package/dist/ui/breadcrumb.d.ts +13 -0
  111. package/dist/ui/breadcrumb.js +29 -0
  112. package/dist/ui/button-group.d.ts +21 -0
  113. package/dist/ui/button-group.js +29 -0
  114. package/dist/ui/button.d.ts +38 -0
  115. package/dist/ui/button.js +49 -0
  116. package/dist/ui/calendar.d.ts +13 -0
  117. package/dist/ui/calendar.js +75 -0
  118. package/dist/ui/card.d.ts +11 -0
  119. package/dist/ui/card.js +25 -0
  120. package/dist/ui/checkbox.d.ts +17 -0
  121. package/dist/ui/checkbox.js +25 -0
  122. package/dist/ui/collapsible.d.ts +11 -0
  123. package/dist/ui/collapsible.js +40 -0
  124. package/dist/ui/command.d.ts +19 -0
  125. package/dist/ui/command.js +35 -0
  126. package/dist/ui/context-menu.d.ts +53 -0
  127. package/dist/ui/context-menu.js +372 -0
  128. package/dist/ui/dialog.d.ts +40 -0
  129. package/dist/ui/dialog.js +109 -0
  130. package/dist/ui/drawer.d.ts +36 -0
  131. package/dist/ui/drawer.js +243 -0
  132. package/dist/ui/dropdown-menu.d.ts +61 -0
  133. package/dist/ui/dropdown-menu.js +347 -0
  134. package/dist/ui/empty.d.ts +14 -0
  135. package/dist/ui/empty.js +33 -0
  136. package/dist/ui/field.d.ts +28 -0
  137. package/dist/ui/field.js +68 -0
  138. package/dist/ui/hover-card.d.ts +32 -0
  139. package/dist/ui/hover-card.js +119 -0
  140. package/dist/ui/input-group.d.ts +28 -0
  141. package/dist/ui/input-group.js +58 -0
  142. package/dist/ui/input.d.ts +3 -0
  143. package/dist/ui/input.js +7 -0
  144. package/dist/ui/item.d.ts +41 -0
  145. package/dist/ui/item.js +69 -0
  146. package/dist/ui/kbd.d.ts +4 -0
  147. package/dist/ui/kbd.js +10 -0
  148. package/dist/ui/label.d.ts +3 -0
  149. package/dist/ui/label.js +8 -0
  150. package/dist/ui/menubar.d.ts +59 -0
  151. package/dist/ui/menubar.js +397 -0
  152. package/dist/ui/navigation-menu.d.ts +24 -0
  153. package/dist/ui/navigation-menu.js +203 -0
  154. package/dist/ui/pagination.d.ts +17 -0
  155. package/dist/ui/pagination.js +36 -0
  156. package/dist/ui/popover.d.ts +25 -0
  157. package/dist/ui/popover.js +126 -0
  158. package/dist/ui/portal.d.ts +7 -0
  159. package/dist/ui/portal.js +12 -0
  160. package/dist/ui/progress.d.ts +15 -0
  161. package/dist/ui/progress.js +36 -0
  162. package/dist/ui/radio-group.d.ts +17 -0
  163. package/dist/ui/radio-group.js +66 -0
  164. package/dist/ui/scroll-area.d.ts +9 -0
  165. package/dist/ui/scroll-area.js +72 -0
  166. package/dist/ui/select.d.ts +37 -0
  167. package/dist/ui/select.js +226 -0
  168. package/dist/ui/separator.d.ts +14 -0
  169. package/dist/ui/separator.js +13 -0
  170. package/dist/ui/sheet.d.ts +31 -0
  171. package/dist/ui/sheet.js +121 -0
  172. package/dist/ui/sidebar.d.ts +86 -0
  173. package/dist/ui/sidebar.js +211 -0
  174. package/dist/ui/skeleton.d.ts +3 -0
  175. package/dist/ui/skeleton.js +7 -0
  176. package/dist/ui/slider.d.ts +18 -0
  177. package/dist/ui/slider.js +94 -0
  178. package/dist/ui/slot.d.ts +27 -0
  179. package/dist/ui/slot.js +62 -0
  180. package/dist/ui/spinner.d.ts +3 -0
  181. package/dist/ui/spinner.js +8 -0
  182. package/dist/ui/switch.d.ts +17 -0
  183. package/dist/ui/switch.js +23 -0
  184. package/dist/ui/table.d.ts +10 -0
  185. package/dist/ui/table.js +29 -0
  186. package/dist/ui/tabs.d.ts +29 -0
  187. package/dist/ui/tabs.js +96 -0
  188. package/dist/ui/textarea.d.ts +3 -0
  189. package/dist/ui/textarea.js +7 -0
  190. package/dist/ui/toggle-group.d.ts +23 -0
  191. package/dist/ui/toggle-group.js +52 -0
  192. package/dist/ui/toggle.d.ts +25 -0
  193. package/dist/ui/toggle.js +41 -0
  194. package/dist/ui/tooltip.d.ts +25 -0
  195. package/dist/ui/tooltip.js +90 -0
  196. package/dist/ui/use-controllable-state.d.ts +10 -0
  197. package/dist/ui/use-controllable-state.js +17 -0
  198. package/dist/ui/use-dismiss.d.ts +10 -0
  199. package/dist/ui/use-dismiss.js +51 -0
  200. package/dist/ui/use-floating.d.ts +42 -0
  201. package/dist/ui/use-floating.js +136 -0
  202. package/dist/ui/use-presence.d.ts +8 -0
  203. package/dist/ui/use-presence.js +48 -0
  204. package/dist/ui/use-typeahead.d.ts +19 -0
  205. package/dist/ui/use-typeahead.js +64 -0
  206. package/package.json +6 -1
  207. package/dist/shadcn/lib/base-ui/LICENSE +0 -21
  208. package/dist/shadcn/lib/base-ui/_chunk-000kmre8.js +0 -150
  209. package/dist/shadcn/lib/base-ui/_chunk-1vw45v38.js +0 -64
  210. package/dist/shadcn/lib/base-ui/_chunk-23rx7haq.js +0 -81
  211. package/dist/shadcn/lib/base-ui/_chunk-242gh8ph.js +0 -230
  212. package/dist/shadcn/lib/base-ui/_chunk-26cc610z.js +0 -6
  213. package/dist/shadcn/lib/base-ui/_chunk-2z044bba.js +0 -5890
  214. package/dist/shadcn/lib/base-ui/_chunk-3cpd1vjz.js +0 -13
  215. package/dist/shadcn/lib/base-ui/_chunk-3enq1vat.js +0 -82
  216. package/dist/shadcn/lib/base-ui/_chunk-3xpke33f.js +0 -23
  217. package/dist/shadcn/lib/base-ui/_chunk-451nqgsa.js +0 -6
  218. package/dist/shadcn/lib/base-ui/_chunk-4maf6pas.js +0 -11
  219. package/dist/shadcn/lib/base-ui/_chunk-4zhfq4d3.js +0 -16
  220. package/dist/shadcn/lib/base-ui/_chunk-5gaqyne5.js +0 -21
  221. package/dist/shadcn/lib/base-ui/_chunk-5tt5hk59.js +0 -4
  222. package/dist/shadcn/lib/base-ui/_chunk-5tze5c8q.js +0 -13
  223. package/dist/shadcn/lib/base-ui/_chunk-5xmdvndx.js +0 -225
  224. package/dist/shadcn/lib/base-ui/_chunk-6adaer33.js +0 -435
  225. package/dist/shadcn/lib/base-ui/_chunk-6ejf1z1r.js +0 -9
  226. package/dist/shadcn/lib/base-ui/_chunk-6kqramh9.js +0 -27
  227. package/dist/shadcn/lib/base-ui/_chunk-7b9dc493.js +0 -14
  228. package/dist/shadcn/lib/base-ui/_chunk-8a9vv8am.js +0 -89
  229. package/dist/shadcn/lib/base-ui/_chunk-8ctgmf06.js +0 -129
  230. package/dist/shadcn/lib/base-ui/_chunk-8ganmsbg.js +0 -54
  231. package/dist/shadcn/lib/base-ui/_chunk-8xaqxgck.js +0 -15
  232. package/dist/shadcn/lib/base-ui/_chunk-95tf2rxq.js +0 -62
  233. package/dist/shadcn/lib/base-ui/_chunk-9x63vfqj.js +0 -70
  234. package/dist/shadcn/lib/base-ui/_chunk-ase0ydtt.js +0 -9
  235. package/dist/shadcn/lib/base-ui/_chunk-b0nc8wq7.js +0 -34
  236. package/dist/shadcn/lib/base-ui/_chunk-b5ya6xds.js +0 -10
  237. package/dist/shadcn/lib/base-ui/_chunk-b6dkjkbw.js +0 -43
  238. package/dist/shadcn/lib/base-ui/_chunk-c2bz952e.js +0 -19
  239. package/dist/shadcn/lib/base-ui/_chunk-cdgfsr3q.js +0 -15
  240. package/dist/shadcn/lib/base-ui/_chunk-cdj8cpx5.js +0 -347
  241. package/dist/shadcn/lib/base-ui/_chunk-cgptgywc.js +0 -104
  242. package/dist/shadcn/lib/base-ui/_chunk-cwvtvwc7.js +0 -35
  243. package/dist/shadcn/lib/base-ui/_chunk-dan0mva4.js +0 -23
  244. package/dist/shadcn/lib/base-ui/_chunk-dzvjwv25.js +0 -0
  245. package/dist/shadcn/lib/base-ui/_chunk-e13rsb6b.js +0 -184
  246. package/dist/shadcn/lib/base-ui/_chunk-e56mpvk1.js +0 -118
  247. package/dist/shadcn/lib/base-ui/_chunk-e6k2ecs7.js +0 -48
  248. package/dist/shadcn/lib/base-ui/_chunk-ebyxgtb4.js +0 -29
  249. package/dist/shadcn/lib/base-ui/_chunk-f2wttwrf.js +0 -39
  250. package/dist/shadcn/lib/base-ui/_chunk-fdzctasg.js +0 -38
  251. package/dist/shadcn/lib/base-ui/_chunk-ffpjy0ta.js +0 -39
  252. package/dist/shadcn/lib/base-ui/_chunk-fqry7pew.js +0 -603
  253. package/dist/shadcn/lib/base-ui/_chunk-ghn1tzt8.js +0 -84
  254. package/dist/shadcn/lib/base-ui/_chunk-gy0bpkmx.js +0 -12
  255. package/dist/shadcn/lib/base-ui/_chunk-hm5h9vsk.js +0 -16
  256. package/dist/shadcn/lib/base-ui/_chunk-htdj1jps.js +0 -833
  257. package/dist/shadcn/lib/base-ui/_chunk-j29xjete.js +0 -146
  258. package/dist/shadcn/lib/base-ui/_chunk-j3qkyd10.js +0 -50
  259. package/dist/shadcn/lib/base-ui/_chunk-ktvsd5k6.js +0 -2386
  260. package/dist/shadcn/lib/base-ui/_chunk-kw8nnq00.js +0 -546
  261. package/dist/shadcn/lib/base-ui/_chunk-m307wpdj.js +0 -18
  262. package/dist/shadcn/lib/base-ui/_chunk-mnd0j7v9.js +0 -15
  263. package/dist/shadcn/lib/base-ui/_chunk-n11h505c.js +0 -32
  264. package/dist/shadcn/lib/base-ui/_chunk-p0e2qacz.js +0 -26
  265. package/dist/shadcn/lib/base-ui/_chunk-pv7b791x.js +0 -106
  266. package/dist/shadcn/lib/base-ui/_chunk-q5cg71p7.js +0 -83
  267. package/dist/shadcn/lib/base-ui/_chunk-qbezxj1g.js +0 -385
  268. package/dist/shadcn/lib/base-ui/_chunk-qmsqz6nt.js +0 -15
  269. package/dist/shadcn/lib/base-ui/_chunk-rrh8rt4v.js +0 -65
  270. package/dist/shadcn/lib/base-ui/_chunk-s5pwkz8v.js +0 -25
  271. package/dist/shadcn/lib/base-ui/_chunk-svxv97ph.js +0 -218
  272. package/dist/shadcn/lib/base-ui/_chunk-t7ppm3t0.js +0 -68
  273. package/dist/shadcn/lib/base-ui/_chunk-vg16xxmb.js +0 -52
  274. package/dist/shadcn/lib/base-ui/_chunk-vgkfmtbe.js +0 -21
  275. package/dist/shadcn/lib/base-ui/_chunk-watha94s.js +0 -14
  276. package/dist/shadcn/lib/base-ui/_chunk-wdqynnjf.js +0 -35
  277. package/dist/shadcn/lib/base-ui/_chunk-wx2nxg0p.js +0 -15
  278. package/dist/shadcn/lib/base-ui/_chunk-x11e1k9r.js +0 -0
  279. package/dist/shadcn/lib/base-ui/_chunk-x8xehj6d.js +0 -302
  280. package/dist/shadcn/lib/base-ui/_chunk-xcqbtm2f.js +0 -28
  281. package/dist/shadcn/lib/base-ui/_chunk-ytnp24gq.js +0 -328
  282. package/dist/shadcn/lib/base-ui/_chunk-yzr7eg4b.js +0 -6
  283. package/dist/shadcn/lib/base-ui/_chunk-zk4mtm9m.js +0 -9
  284. package/dist/shadcn/lib/base-ui/accordion.d.ts +0 -447
  285. package/dist/shadcn/lib/base-ui/accordion.js +0 -630
  286. package/dist/shadcn/lib/base-ui/alert-dialog.d.ts +0 -1467
  287. package/dist/shadcn/lib/base-ui/alert-dialog.js +0 -98
  288. package/dist/shadcn/lib/base-ui/avatar.d.ts +0 -123
  289. package/dist/shadcn/lib/base-ui/avatar.js +0 -235
  290. package/dist/shadcn/lib/base-ui/button.d.ts +0 -84
  291. package/dist/shadcn/lib/base-ui/button.js +0 -51
  292. package/dist/shadcn/lib/base-ui/checkbox.d.ts +0 -341
  293. package/dist/shadcn/lib/base-ui/checkbox.js +0 -501
  294. package/dist/shadcn/lib/base-ui/collapsible.d.ts +0 -291
  295. package/dist/shadcn/lib/base-ui/collapsible.js +0 -264
  296. package/dist/shadcn/lib/base-ui/context-menu.d.ts +0 -2213
  297. package/dist/shadcn/lib/base-ui/context-menu.js +0 -323
  298. package/dist/shadcn/lib/base-ui/dialog.d.ts +0 -1448
  299. package/dist/shadcn/lib/base-ui/dialog.js +0 -79
  300. package/dist/shadcn/lib/base-ui/input.d.ts +0 -506
  301. package/dist/shadcn/lib/base-ui/input.js +0 -1027
  302. package/dist/shadcn/lib/base-ui/menu.d.ts +0 -2275
  303. package/dist/shadcn/lib/base-ui/menu.js +0 -60
  304. package/dist/shadcn/lib/base-ui/menubar.d.ts +0 -48
  305. package/dist/shadcn/lib/base-ui/menubar.js +0 -156
  306. package/dist/shadcn/lib/base-ui/merge-props.d.ts +0 -70
  307. package/dist/shadcn/lib/base-ui/merge-props.js +0 -15
  308. package/dist/shadcn/lib/base-ui/navigation-menu.d.ts +0 -825
  309. package/dist/shadcn/lib/base-ui/navigation-menu.js +0 -1849
  310. package/dist/shadcn/lib/base-ui/popover.d.ts +0 -1743
  311. package/dist/shadcn/lib/base-ui/popover.js +0 -1089
  312. package/dist/shadcn/lib/base-ui/preview-card.d.ts +0 -1608
  313. package/dist/shadcn/lib/base-ui/preview-card.js +0 -919
  314. package/dist/shadcn/lib/base-ui/progress.d.ts +0 -172
  315. package/dist/shadcn/lib/base-ui/progress.js +0 -272
  316. package/dist/shadcn/lib/base-ui/radio-group.d.ts +0 -260
  317. package/dist/shadcn/lib/base-ui/radio-group.js +0 -239
  318. package/dist/shadcn/lib/base-ui/radio.d.ts +0 -176
  319. package/dist/shadcn/lib/base-ui/radio.js +0 -387
  320. package/dist/shadcn/lib/base-ui/scroll-area.d.ts +0 -241
  321. package/dist/shadcn/lib/base-ui/scroll-area.js +0 -1055
  322. package/dist/shadcn/lib/base-ui/select.d.ts +0 -1266
  323. package/dist/shadcn/lib/base-ui/select.js +0 -2450
  324. package/dist/shadcn/lib/base-ui/separator.d.ts +0 -76
  325. package/dist/shadcn/lib/base-ui/separator.js +0 -11
  326. package/dist/shadcn/lib/base-ui/slider.d.ts +0 -551
  327. package/dist/shadcn/lib/base-ui/slider.js +0 -1583
  328. package/dist/shadcn/lib/base-ui/switch.d.ts +0 -313
  329. package/dist/shadcn/lib/base-ui/switch.js +0 -326
  330. package/dist/shadcn/lib/base-ui/tabs.d.ts +0 -406
  331. package/dist/shadcn/lib/base-ui/tabs.js +0 -915
  332. package/dist/shadcn/lib/base-ui/toggle-group.d.ts +0 -235
  333. package/dist/shadcn/lib/base-ui/toggle-group.js +0 -145
  334. package/dist/shadcn/lib/base-ui/toggle.d.ts +0 -224
  335. package/dist/shadcn/lib/base-ui/toggle.js +0 -127
  336. package/dist/shadcn/lib/base-ui/tooltip.d.ts +0 -1656
  337. package/dist/shadcn/lib/base-ui/tooltip.js +0 -920
  338. package/dist/shadcn/lib/base-ui/use-render.d.ts +0 -87
  339. package/dist/shadcn/lib/base-ui/use-render.js +0 -15
@@ -0,0 +1,372 @@
1
+ "use client";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { cn } from "../shadcn/lib/utils.js";
5
+ import { Slot, mergeRefs, resolveRender } from "./slot.js";
6
+ import { Portal } from "./portal.js";
7
+ import { useFloating } from "./use-floating.js";
8
+ import { usePresence } from "./use-presence.js";
9
+ import { useTypeahead } from "./use-typeahead.js";
10
+ import { ChevronRightIcon, CheckIcon } from "../icons/index.js";
11
+ const MenuContext = React.createContext(null);
12
+ function useMenu() {
13
+ const ctx = React.useContext(MenuContext);
14
+ if (!ctx)
15
+ throw new Error("ContextMenu parts must be used within <ContextMenu>");
16
+ return ctx;
17
+ }
18
+ function itemsOf(container) {
19
+ return Array.from(container.querySelectorAll(':scope > [role^="menuitem"]:not([data-disabled]), :scope > [data-slot="context-menu-group"] > [role^="menuitem"]:not([data-disabled]), :scope > [data-slot="context-menu-radio-group"] > [role^="menuitem"]:not([data-disabled])'));
20
+ }
21
+ function moveFocus(container, dir) {
22
+ const items = itemsOf(container);
23
+ if (!items.length)
24
+ return;
25
+ const idx = items.indexOf(document.activeElement);
26
+ let next = 0;
27
+ if (dir === "first")
28
+ next = 0;
29
+ else if (dir === "last")
30
+ next = items.length - 1;
31
+ else if (dir === "next")
32
+ next = idx < 0 ? 0 : (idx + 1) % items.length;
33
+ else
34
+ next = idx < 0 ? items.length - 1 : (idx - 1 + items.length) % items.length;
35
+ items[next]?.focus();
36
+ }
37
+ function ContextMenu({ children }) {
38
+ const [open, setOpen] = React.useState(false);
39
+ const [point, setPoint] = React.useState({ x: 0, y: 0 });
40
+ const contentId = React.useId();
41
+ const layers = React.useRef(new Set());
42
+ const openAt = React.useCallback((p) => {
43
+ setPoint(p);
44
+ setOpen(true);
45
+ }, []);
46
+ return (_jsx(MenuContext.Provider, { value: { open, setOpen, point, openAt, contentId, layers }, children: children }));
47
+ }
48
+ function ContextMenuPortal({ children }) {
49
+ return _jsx(_Fragment, { children: children });
50
+ }
51
+ function ContextMenuTrigger({ asChild = false, render, nativeButton: _nativeButton, children, className, onContextMenu, ...props }) {
52
+ const { open, openAt, contentId } = useMenu();
53
+ const { useSlot, slotChild } = resolveRender(asChild, render, children);
54
+ const Comp = useSlot ? Slot : "div";
55
+ return (_jsx(Comp, { "data-slot": "context-menu-trigger", "aria-haspopup": "menu", "aria-expanded": open, "aria-controls": open ? contentId : undefined, "data-state": open ? "open" : "closed", className: cn("select-none", className), onContextMenu: (e) => {
56
+ onContextMenu?.(e);
57
+ if (e.defaultPrevented)
58
+ return;
59
+ e.preventDefault();
60
+ openAt({ x: e.clientX, y: e.clientY });
61
+ }, ...props, children: slotChild }));
62
+ }
63
+ function ContextMenuContent({ className, children, onKeyDown, ...props }) {
64
+ const { open, setOpen, point, contentId, layers } = useMenu();
65
+ const [mounted, presenceRef] = usePresence(open);
66
+ const containerRef = React.useRef(null);
67
+ const { onTypeaheadKeyDown } = useTypeahead();
68
+ // Position the menu at the cursor, clamped into the viewport once the
69
+ // popup has measurable dimensions. availableHeight caps the menu so long
70
+ // lists scroll inside the viewport instead of overflowing it.
71
+ const [pos, setPos] = React.useState(null);
72
+ React.useLayoutEffect(() => {
73
+ if (!mounted) {
74
+ setPos(null);
75
+ return;
76
+ }
77
+ let raf = 0;
78
+ const measure = () => {
79
+ const node = containerRef.current;
80
+ // The popup is portaled and may attach a frame late; retry until it does,
81
+ // otherwise pos stays null and the menu is stuck visibility:hidden.
82
+ if (!node) {
83
+ raf = requestAnimationFrame(measure);
84
+ return;
85
+ }
86
+ const w = node.offsetWidth;
87
+ const h = node.offsetHeight;
88
+ const PAD = 8;
89
+ const vw = window.innerWidth;
90
+ const vh = window.innerHeight;
91
+ // Flip toward the side with room, then clamp.
92
+ let x = point.x;
93
+ let y = point.y;
94
+ if (x + w + PAD > vw)
95
+ x = Math.max(PAD, point.x - w);
96
+ if (y + h + PAD > vh)
97
+ y = Math.max(PAD, point.y - h);
98
+ x = Math.max(PAD, Math.min(x, vw - w - PAD));
99
+ y = Math.max(PAD, Math.min(y, vh - h - PAD));
100
+ // Space from the menu's top to the bottom of the viewport, minus padding.
101
+ const availableHeight = Math.max(0, vh - y - PAD);
102
+ setPos({ x, y, availableHeight });
103
+ };
104
+ measure();
105
+ window.addEventListener("scroll", measure, true);
106
+ window.addEventListener("resize", measure);
107
+ return () => {
108
+ cancelAnimationFrame(raf);
109
+ window.removeEventListener("scroll", measure, true);
110
+ window.removeEventListener("resize", measure);
111
+ };
112
+ }, [mounted, point]);
113
+ React.useEffect(() => {
114
+ const node = containerRef.current;
115
+ if (!node)
116
+ return;
117
+ layers.current.add(node);
118
+ return () => {
119
+ layers.current.delete(node);
120
+ };
121
+ }, [mounted, layers]);
122
+ // Focus the first item once the popup is actually visible — a
123
+ // visibility:hidden element can't take focus, so retry each frame until it is.
124
+ const didFocus = React.useRef(false);
125
+ React.useEffect(() => {
126
+ if (!open) {
127
+ didFocus.current = false;
128
+ return;
129
+ }
130
+ let raf = 0;
131
+ const tryFocus = () => {
132
+ const c = containerRef.current;
133
+ if (c && getComputedStyle(c).visibility !== "hidden") {
134
+ didFocus.current = true;
135
+ moveFocus(c, "first");
136
+ }
137
+ else if (!didFocus.current) {
138
+ raf = requestAnimationFrame(tryFocus);
139
+ }
140
+ };
141
+ raf = requestAnimationFrame(tryFocus);
142
+ return () => cancelAnimationFrame(raf);
143
+ }, [open]);
144
+ React.useEffect(() => {
145
+ if (!open)
146
+ return;
147
+ const onPointerDown = (e) => {
148
+ const t = e.target;
149
+ for (const layer of layers.current)
150
+ if (layer.contains(t))
151
+ return;
152
+ setOpen(false);
153
+ };
154
+ document.addEventListener("pointerdown", onPointerDown, true);
155
+ return () => {
156
+ document.removeEventListener("pointerdown", onPointerDown, true);
157
+ };
158
+ }, [open, setOpen, layers]);
159
+ if (!mounted)
160
+ return null;
161
+ return (_jsx(Portal, { children: _jsx("div", { ref: mergeRefs(presenceRef, containerRef), id: contentId, role: "menu", "aria-orientation": "vertical", tabIndex: -1, "data-slot": "context-menu-content", "data-state": open ? "open" : "closed", "data-open": open ? "" : undefined, "data-closed": open ? undefined : "", style: {
162
+ position: "fixed",
163
+ left: pos?.x ?? point.x,
164
+ top: pos?.y ?? point.y,
165
+ visibility: pos ? "visible" : "hidden",
166
+ ["--transform-origin"]: "top left",
167
+ ["--available-height"]: pos ? `${pos.availableHeight}px` : undefined,
168
+ }, onPointerMove: (e) => {
169
+ const item = e.target.closest('[role^="menuitem"]:not([data-disabled])');
170
+ if (item && item !== document.activeElement)
171
+ item.focus();
172
+ }, onKeyDown: (e) => {
173
+ onKeyDown?.(e);
174
+ if (e.defaultPrevented)
175
+ return;
176
+ const c = containerRef.current;
177
+ if (e.key === "ArrowDown")
178
+ (e.preventDefault(), moveFocus(c, "next"));
179
+ else if (e.key === "ArrowUp")
180
+ (e.preventDefault(), moveFocus(c, "prev"));
181
+ else if (e.key === "Home")
182
+ (e.preventDefault(), moveFocus(c, "first"));
183
+ else if (e.key === "End")
184
+ (e.preventDefault(), moveFocus(c, "last"));
185
+ else if (e.key === "Escape") {
186
+ e.preventDefault();
187
+ setOpen(false);
188
+ }
189
+ else if (e.key === "Tab") {
190
+ setOpen(false);
191
+ }
192
+ else if (e.key === "Enter" || e.key === " ") {
193
+ const active = document.activeElement;
194
+ if (active && c.contains(active) && active.getAttribute("role")?.startsWith("menuitem")) {
195
+ e.preventDefault();
196
+ active.click();
197
+ }
198
+ }
199
+ else {
200
+ // Printable-character typeahead: jump to the matching item.
201
+ const items = itemsOf(c);
202
+ const idx = items.indexOf(document.activeElement);
203
+ const match = onTypeaheadKeyDown(e, items, idx);
204
+ if (match) {
205
+ e.preventDefault();
206
+ match.focus();
207
+ }
208
+ }
209
+ }, className: cn("z-50 max-h-(--available-height) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className), ...props, children: children }) }));
210
+ }
211
+ function ContextMenuGroup({ className, ...props }) {
212
+ return _jsx("div", { role: "group", "data-slot": "context-menu-group", className: className, ...props });
213
+ }
214
+ function ContextMenuLabel({ className, inset, ...props }) {
215
+ return (_jsx("div", { "data-slot": "context-menu-label", "data-inset": inset ? "" : undefined, className: cn("px-2 py-1.5 text-xs font-medium text-muted-foreground data-inset:pl-8", className), ...props }));
216
+ }
217
+ function ContextMenuItem({ className, inset, variant = "default", disabled, onSelect, onClick, ...props }) {
218
+ const { setOpen } = useMenu();
219
+ return (_jsx("div", { role: "menuitem", tabIndex: -1, "aria-disabled": disabled || undefined, "data-slot": "context-menu-item", "data-inset": inset ? "" : undefined, "data-variant": variant, "data-disabled": disabled ? "" : undefined, className: cn("group/context-menu-item relative flex cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus:*:[svg]:text-accent-foreground data-[variant=destructive]:*:[svg]:text-destructive", className), onClick: (e) => {
220
+ if (disabled)
221
+ return;
222
+ onClick?.(e);
223
+ if (e.defaultPrevented)
224
+ return;
225
+ onSelect?.();
226
+ setOpen(false);
227
+ }, ...props }));
228
+ }
229
+ const RadioGroupContext = React.createContext({});
230
+ function ContextMenuCheckboxItem({ className, children, checked, onCheckedChange, disabled, inset, onClick, ...props }) {
231
+ return (_jsxs("div", { role: "menuitemcheckbox", tabIndex: -1, "aria-checked": !!checked, "aria-disabled": disabled || undefined, "data-slot": "context-menu-checkbox-item", "data-disabled": disabled ? "" : undefined, "data-inset": inset ? "" : undefined, className: cn("relative flex cursor-pointer items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-8 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className), onClick: (e) => {
232
+ if (disabled)
233
+ return;
234
+ onClick?.(e);
235
+ if (!e.defaultPrevented)
236
+ onCheckedChange?.(!checked);
237
+ }, ...props, children: [_jsx("span", { className: "pointer-events-none absolute right-2 flex items-center justify-center", "data-slot": "context-menu-checkbox-item-indicator", children: checked ? _jsx(CheckIcon, {}) : null }), children] }));
238
+ }
239
+ function ContextMenuRadioGroup({ value, onValueChange, ...props }) {
240
+ return (_jsx(RadioGroupContext.Provider, { value: { value, onValueChange }, children: _jsx("div", { role: "group", "data-slot": "context-menu-radio-group", ...props }) }));
241
+ }
242
+ function ContextMenuRadioItem({ className, children, value, disabled, inset, onClick, ...props }) {
243
+ const { value: groupValue, onValueChange } = React.useContext(RadioGroupContext);
244
+ const checked = groupValue === value;
245
+ return (_jsxs("div", { role: "menuitemradio", tabIndex: -1, "aria-checked": checked, "aria-disabled": disabled || undefined, "data-slot": "context-menu-radio-item", "data-disabled": disabled ? "" : undefined, "data-inset": inset ? "" : undefined, className: cn("relative flex cursor-pointer items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-8 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className), onClick: (e) => {
246
+ if (disabled)
247
+ return;
248
+ onClick?.(e);
249
+ if (!e.defaultPrevented)
250
+ onValueChange?.(value);
251
+ }, ...props, children: [_jsx("span", { className: "pointer-events-none absolute right-2 flex items-center justify-center", "data-slot": "context-menu-radio-item-indicator", children: checked ? _jsx(CheckIcon, {}) : null }), children] }));
252
+ }
253
+ function ContextMenuSeparator({ className, ...props }) {
254
+ return (_jsx("div", { role: "separator", "data-slot": "context-menu-separator", className: cn("-mx-1 my-1 h-px bg-border", className), ...props }));
255
+ }
256
+ function ContextMenuShortcut({ className, ...props }) {
257
+ return (_jsx("span", { "data-slot": "context-menu-shortcut", className: cn("ml-auto text-xs tracking-widest text-muted-foreground group-focus/context-menu-item:text-accent-foreground", className), ...props }));
258
+ }
259
+ const SubContext = React.createContext(null);
260
+ function useSub() {
261
+ const ctx = React.useContext(SubContext);
262
+ if (!ctx)
263
+ throw new Error("Submenu parts must be used within <ContextMenuSub>");
264
+ return ctx;
265
+ }
266
+ function ContextMenuSub({ defaultOpen = false, children, }) {
267
+ const [open, setOpen] = React.useState(defaultOpen);
268
+ const triggerRef = React.useRef(null);
269
+ return (_jsx(SubContext.Provider, { value: { open, setOpen, triggerRef }, children: children }));
270
+ }
271
+ function ContextMenuSubTrigger({ className, inset, children, onClick, onKeyDown, onMouseEnter, ...props }) {
272
+ const { open, setOpen, triggerRef } = useSub();
273
+ return (_jsxs("div", { ref: triggerRef, role: "menuitem", tabIndex: -1, "aria-haspopup": "menu", "aria-expanded": open, "data-slot": "context-menu-sub-trigger", "data-inset": inset ? "" : undefined, "data-popup-open": open ? "" : undefined, "data-open": open ? "" : undefined, className: cn("flex cursor-pointer items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-8 data-popup-open:bg-accent data-popup-open:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className), onMouseEnter: (e) => {
274
+ onMouseEnter?.(e);
275
+ setOpen(true);
276
+ }, onClick: (e) => {
277
+ onClick?.(e);
278
+ if (!e.defaultPrevented)
279
+ setOpen(!open);
280
+ }, onKeyDown: (e) => {
281
+ onKeyDown?.(e);
282
+ if (e.defaultPrevented)
283
+ return;
284
+ if (e.key === "ArrowRight" || e.key === "Enter" || e.key === " ") {
285
+ e.preventDefault();
286
+ setOpen(true);
287
+ }
288
+ }, ...props, children: [children, _jsx(ChevronRightIcon, { className: "ml-auto" })] }));
289
+ }
290
+ function ContextMenuSubContent({ className, children, onKeyDown, ...props }) {
291
+ const { open, setOpen, triggerRef } = useSub();
292
+ const { layers } = useMenu();
293
+ const [mounted, presenceRef] = usePresence(open);
294
+ const { floatingRef, pos } = useFloating(triggerRef, mounted, {
295
+ side: "right",
296
+ align: "start",
297
+ sideOffset: 0,
298
+ alignOffset: -3,
299
+ });
300
+ const containerRef = React.useRef(null);
301
+ const { onTypeaheadKeyDown } = useTypeahead();
302
+ React.useEffect(() => {
303
+ const node = containerRef.current;
304
+ if (!node)
305
+ return;
306
+ layers.current.add(node);
307
+ return () => {
308
+ layers.current.delete(node);
309
+ };
310
+ }, [mounted, layers]);
311
+ const didFocus = React.useRef(false);
312
+ React.useEffect(() => {
313
+ if (!open) {
314
+ didFocus.current = false;
315
+ return;
316
+ }
317
+ let raf = 0;
318
+ const tryFocus = () => {
319
+ const c = containerRef.current;
320
+ if (c && getComputedStyle(c).visibility !== "hidden") {
321
+ didFocus.current = true;
322
+ moveFocus(c, "first");
323
+ }
324
+ else if (!didFocus.current) {
325
+ raf = requestAnimationFrame(tryFocus);
326
+ }
327
+ };
328
+ raf = requestAnimationFrame(tryFocus);
329
+ return () => cancelAnimationFrame(raf);
330
+ }, [open]);
331
+ if (!mounted)
332
+ return null;
333
+ return (_jsx(Portal, { children: _jsx("div", { ref: mergeRefs(floatingRef, presenceRef, containerRef), role: "menu", tabIndex: -1, "data-slot": "context-menu-sub-content", "data-state": open ? "open" : "closed", "data-open": open ? "" : undefined, "data-closed": open ? undefined : "", "data-side": pos?.side ?? "right", style: {
334
+ position: "fixed",
335
+ left: pos?.x ?? 0,
336
+ top: pos?.y ?? 0,
337
+ visibility: pos ? "visible" : "hidden",
338
+ ["--transform-origin"]: pos?.transformOrigin ?? "center",
339
+ }, onKeyDown: (e) => {
340
+ onKeyDown?.(e);
341
+ if (e.defaultPrevented)
342
+ return;
343
+ const c = containerRef.current;
344
+ if (e.key === "ArrowDown")
345
+ (e.preventDefault(), moveFocus(c, "next"));
346
+ else if (e.key === "ArrowUp")
347
+ (e.preventDefault(), moveFocus(c, "prev"));
348
+ else if (e.key === "ArrowLeft" || e.key === "Escape") {
349
+ e.preventDefault();
350
+ setOpen(false);
351
+ triggerRef.current?.focus();
352
+ }
353
+ else if (e.key === "Enter" || e.key === " ") {
354
+ const active = document.activeElement;
355
+ if (active && c.contains(active)) {
356
+ e.preventDefault();
357
+ active.click();
358
+ }
359
+ }
360
+ else {
361
+ // Printable-character typeahead: jump to the matching item.
362
+ const items = itemsOf(c);
363
+ const idx = items.indexOf(document.activeElement);
364
+ const match = onTypeaheadKeyDown(e, items, idx);
365
+ if (match) {
366
+ e.preventDefault();
367
+ match.focus();
368
+ }
369
+ }
370
+ }, className: cn("z-50 min-w-[96px] origin-(--transform-origin) overflow-hidden rounded-md bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className), ...props, children: children }) }));
371
+ }
372
+ export { ContextMenu, ContextMenuTrigger, ContextMenuContent, ContextMenuItem, ContextMenuCheckboxItem, ContextMenuRadioItem, ContextMenuLabel, ContextMenuSeparator, ContextMenuShortcut, ContextMenuGroup, ContextMenuPortal, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuRadioGroup, };
@@ -0,0 +1,40 @@
1
+ import * as React from "react";
2
+ export interface DialogProps {
3
+ open?: boolean;
4
+ defaultOpen?: boolean;
5
+ onOpenChange?: (open: boolean) => void;
6
+ children?: React.ReactNode;
7
+ }
8
+ /**
9
+ * Self-contained dialog built on the native `<dialog>` element: focus trapping,
10
+ * Escape, top-layer stacking, and the `::backdrop` come from the platform, so no
11
+ * hand-rolled focus trap or portal is needed.
12
+ */
13
+ declare function Dialog({ open, defaultOpen, onOpenChange, children }: DialogProps): React.JSX.Element;
14
+ declare function DialogTrigger({ asChild, render, nativeButton: _nativeButton, children, onClick, ...props }: React.ComponentProps<"button"> & {
15
+ asChild?: boolean;
16
+ render?: React.ReactElement;
17
+ nativeButton?: boolean;
18
+ }): React.JSX.Element;
19
+ declare function DialogClose({ asChild, render, nativeButton: _nativeButton, children, onClick, ...props }: React.ComponentProps<"button"> & {
20
+ asChild?: boolean;
21
+ render?: React.ReactElement;
22
+ nativeButton?: boolean;
23
+ }): React.JSX.Element;
24
+ /** No-op wrappers kept for API parity with the Base UI version. The native
25
+ * `<dialog>` provides the portal/top-layer and the dim via `::backdrop`. */
26
+ declare function DialogPortal({ children }: {
27
+ children?: React.ReactNode;
28
+ }): React.JSX.Element;
29
+ declare function DialogOverlay(): null;
30
+ export interface DialogContentProps extends React.ComponentProps<"div"> {
31
+ showCloseButton?: boolean;
32
+ }
33
+ declare function DialogContent({ className, children, showCloseButton, ...props }: DialogContentProps): React.JSX.Element;
34
+ declare function DialogHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
35
+ declare function DialogFooter({ className, showCloseButton, children, ...props }: React.ComponentProps<"div"> & {
36
+ showCloseButton?: boolean;
37
+ }): React.JSX.Element;
38
+ declare function DialogTitle({ className, ...props }: React.ComponentProps<"h2">): React.JSX.Element;
39
+ declare function DialogDescription({ className, ...props }: React.ComponentProps<"p">): React.JSX.Element;
40
+ export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
@@ -0,0 +1,109 @@
1
+ "use client";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { cn } from "../shadcn/lib/utils.js";
5
+ import { Button } from "./button.js";
6
+ import { Slot, resolveRender } from "./slot.js";
7
+ import { XIcon } from "../icons/index.js";
8
+ import { useControllableState } from "./use-controllable-state.js";
9
+ const DialogContext = React.createContext(null);
10
+ function useDialog() {
11
+ const ctx = React.useContext(DialogContext);
12
+ if (!ctx)
13
+ throw new Error("Dialog parts must be used within <Dialog>");
14
+ return ctx;
15
+ }
16
+ /**
17
+ * Self-contained dialog built on the native `<dialog>` element: focus trapping,
18
+ * Escape, top-layer stacking, and the `::backdrop` come from the platform, so no
19
+ * hand-rolled focus trap or portal is needed.
20
+ */
21
+ function Dialog({ open, defaultOpen = false, onOpenChange, children }) {
22
+ const [isOpen, setOpen] = useControllableState({
23
+ value: open,
24
+ defaultValue: defaultOpen,
25
+ onChange: onOpenChange,
26
+ });
27
+ const titleId = React.useId();
28
+ const descriptionId = React.useId();
29
+ return (_jsx(DialogContext.Provider, { value: { open: isOpen, setOpen, titleId, descriptionId }, children: children }));
30
+ }
31
+ function DialogTrigger({ asChild = false, render, nativeButton: _nativeButton, children, onClick, ...props }) {
32
+ const { open, setOpen } = useDialog();
33
+ const { useSlot, slotChild } = resolveRender(asChild, render, children);
34
+ const Comp = useSlot ? Slot : "button";
35
+ return (_jsx(Comp, { type: useSlot ? undefined : "button", "data-slot": "dialog-trigger", "aria-haspopup": "dialog", "aria-expanded": open, "data-state": open ? "open" : "closed", onClick: (e) => {
36
+ onClick?.(e);
37
+ if (!e.defaultPrevented)
38
+ setOpen(true);
39
+ }, ...props, children: slotChild }));
40
+ }
41
+ function DialogClose({ asChild = false, render, nativeButton: _nativeButton, children, onClick, ...props }) {
42
+ const { setOpen } = useDialog();
43
+ const { useSlot, slotChild } = resolveRender(asChild, render, children);
44
+ const Comp = useSlot ? Slot : "button";
45
+ return (_jsx(Comp, { type: useSlot ? undefined : "button", "data-slot": "dialog-close", onClick: (e) => {
46
+ onClick?.(e);
47
+ if (!e.defaultPrevented)
48
+ setOpen(false);
49
+ }, ...props, children: slotChild }));
50
+ }
51
+ /** No-op wrappers kept for API parity with the Base UI version. The native
52
+ * `<dialog>` provides the portal/top-layer and the dim via `::backdrop`. */
53
+ function DialogPortal({ children }) {
54
+ return _jsx(_Fragment, { children: children });
55
+ }
56
+ function DialogOverlay() {
57
+ return null;
58
+ }
59
+ function DialogContent({ className, children, showCloseButton = true, ...props }) {
60
+ const { open, setOpen, titleId, descriptionId } = useDialog();
61
+ const ref = React.useRef(null);
62
+ const pointerDownOnBackdrop = React.useRef(false);
63
+ React.useEffect(() => {
64
+ const node = ref.current;
65
+ if (!node)
66
+ return;
67
+ if (open && !node.open)
68
+ node.showModal();
69
+ else if (!open && node.open)
70
+ node.close();
71
+ }, [open]);
72
+ // Lock background scroll while open.
73
+ React.useEffect(() => {
74
+ if (!open)
75
+ return;
76
+ const prev = document.body.style.overflow;
77
+ document.body.style.overflow = "hidden";
78
+ return () => {
79
+ document.body.style.overflow = prev;
80
+ };
81
+ }, [open]);
82
+ return (_jsx("dialog", { ref: ref, "aria-labelledby": titleId, "aria-describedby": descriptionId, "data-slot": "dialog-overlay", "data-state": open ? "open" : "closed", "data-open": open ? "" : undefined, "data-closed": open ? undefined : "", onCancel: (e) => {
83
+ e.preventDefault();
84
+ setOpen(false);
85
+ }, onClose: () => setOpen(false), onPointerDown: (e) => {
86
+ pointerDownOnBackdrop.current = e.target === ref.current;
87
+ }, onClick: (e) => {
88
+ // Close only when the press both started and ended on the backdrop —
89
+ // a drag that began inside the content (e.g. text selection) must not.
90
+ if (e.target === ref.current && pointerDownOnBackdrop.current) {
91
+ setOpen(false);
92
+ }
93
+ }, className: "group/dialog m-0 grid max-h-none max-w-none place-items-center bg-transparent p-4 backdrop:bg-black/10 backdrop:duration-100 supports-backdrop-filter:backdrop:backdrop-blur-xs open:fixed open:inset-0 open:size-full", children: open ? (_jsxs("div", { "data-slot": "dialog-content", "data-state": open ? "open" : "closed", "data-open": open ? "" : undefined, className: cn("relative grid w-full max-w-[calc(100%-2rem)] gap-6 rounded-xl bg-background p-6 text-sm text-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-md data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95", className), ...props, children: [children, showCloseButton && (_jsx(DialogClose, { asChild: true, children: _jsxs(Button, { variant: "ghost", className: "absolute top-4 right-4", size: "icon-sm", children: [_jsx(XIcon, {}), _jsx("span", { className: "sr-only", children: "Close" })] }) }))] })) : null }));
94
+ }
95
+ function DialogHeader({ className, ...props }) {
96
+ return (_jsx("div", { "data-slot": "dialog-header", className: cn("flex flex-col gap-2", className), ...props }));
97
+ }
98
+ function DialogFooter({ className, showCloseButton = false, children, ...props }) {
99
+ return (_jsxs("div", { "data-slot": "dialog-footer", className: cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className), ...props, children: [children, showCloseButton && (_jsx(DialogClose, { asChild: true, children: _jsx(Button, { variant: "outline", children: "Close" }) }))] }));
100
+ }
101
+ function DialogTitle({ className, ...props }) {
102
+ const { titleId } = useDialog();
103
+ return (_jsx("h2", { id: titleId, "data-slot": "dialog-title", className: cn("leading-none font-medium", className), ...props }));
104
+ }
105
+ function DialogDescription({ className, ...props }) {
106
+ const { descriptionId } = useDialog();
107
+ return (_jsx("p", { id: descriptionId, "data-slot": "dialog-description", className: cn("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground", className), ...props }));
108
+ }
109
+ export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
@@ -0,0 +1,36 @@
1
+ import * as React from "react";
2
+ export interface DrawerProps {
3
+ open?: boolean;
4
+ defaultOpen?: boolean;
5
+ onOpenChange?: (open: boolean) => void;
6
+ children?: React.ReactNode;
7
+ }
8
+ /**
9
+ * Self-contained bottom drawer on native `<dialog>` (focus trap, Escape,
10
+ * top-layer, ::backdrop) with vaul-style drag-to-dismiss: direct translate when
11
+ * dragging down, logarithmic rubber-band damping when dragging up, dismiss past
12
+ * 25% height or 0.4 px/ms velocity, otherwise snap back.
13
+ */
14
+ declare function Drawer({ open, defaultOpen, onOpenChange, children }: DrawerProps): React.JSX.Element;
15
+ declare function DrawerTrigger({ asChild, render, nativeButton: _nativeButton, children, onClick, ...props }: React.ComponentProps<"button"> & {
16
+ asChild?: boolean;
17
+ render?: React.ReactElement;
18
+ nativeButton?: boolean;
19
+ }): React.JSX.Element;
20
+ declare function DrawerClose({ asChild, render, nativeButton: _nativeButton, children, onClick, ...props }: React.ComponentProps<"button"> & {
21
+ asChild?: boolean;
22
+ render?: React.ReactElement;
23
+ nativeButton?: boolean;
24
+ }): React.JSX.Element;
25
+ /** No-op wrappers kept for API parity — the native `<dialog>` provides the
26
+ * top-layer portal and the dim via `::backdrop`. */
27
+ declare function DrawerPortal({ children }: {
28
+ children?: React.ReactNode;
29
+ }): React.JSX.Element;
30
+ declare function DrawerOverlay(): null;
31
+ declare function DrawerContent({ className, children, onPointerDown, onPointerMove, onPointerUp, onPointerCancel, ...props }: React.ComponentProps<"dialog">): React.JSX.Element | null;
32
+ declare function DrawerHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
33
+ declare function DrawerFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
34
+ declare function DrawerTitle({ className, ...props }: React.ComponentProps<"h2">): React.JSX.Element;
35
+ declare function DrawerDescription({ className, ...props }: React.ComponentProps<"p">): React.JSX.Element;
36
+ export { Drawer, DrawerPortal, DrawerOverlay, DrawerTrigger, DrawerClose, DrawerContent, DrawerHeader, DrawerFooter, DrawerTitle, DrawerDescription, };