@tryghost/shade 0.1.0-alpha.5 → 0.1.0-alpha.51

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 (353) hide show
  1. package/README.md +38 -67
  2. package/es/app.js +2 -1
  3. package/es/assets/images/index.js +2 -2
  4. package/es/components/page-templates/list-page.js +3 -2
  5. package/es/components/page-templates/list-page.js.map +1 -1
  6. package/es/components/patterns/color-picker.js +79 -56
  7. package/es/components/patterns/color-picker.js.map +1 -1
  8. package/es/components/patterns/filter-bar.js +4 -6
  9. package/es/components/patterns/filter-bar.js.map +1 -1
  10. package/es/components/patterns/filters-sheet.js +178 -0
  11. package/es/components/patterns/filters-sheet.js.map +1 -0
  12. package/es/components/patterns/filters.js +195 -80
  13. package/es/components/patterns/filters.js.map +1 -1
  14. package/es/components/patterns/gh-chart.js +6 -3
  15. package/es/components/patterns/gh-chart.js.map +1 -1
  16. package/es/components/patterns/image-upload.js +21 -16
  17. package/es/components/patterns/image-upload.js.map +1 -1
  18. package/es/components/patterns/kpi-tabs.js +4 -1
  19. package/es/components/patterns/kpi-tabs.js.map +1 -1
  20. package/es/components/patterns/page-header.js +21 -45
  21. package/es/components/patterns/page-header.js.map +1 -1
  22. package/es/components/patterns/setting-group-variants.js +1 -1
  23. package/es/components/patterns/setting-group-variants.js.map +1 -1
  24. package/es/components/patterns/setting-group.js +2 -2
  25. package/es/components/patterns/setting-group.js.map +1 -1
  26. package/es/components/patterns/settings-modal-variants.js +3 -0
  27. package/es/components/patterns/settings-modal-variants.js.map +1 -1
  28. package/es/components/patterns/settings-modal.js +10 -3
  29. package/es/components/patterns/settings-modal.js.map +1 -1
  30. package/es/components/patterns/share-modal.js +5 -17
  31. package/es/components/patterns/share-modal.js.map +1 -1
  32. package/es/components/patterns/use-mobile-filters.js +20 -0
  33. package/es/components/patterns/use-mobile-filters.js.map +1 -0
  34. package/es/components/ui/alert-dialog.js +25 -15
  35. package/es/components/ui/alert-dialog.js.map +1 -1
  36. package/es/components/ui/avatar.js +8 -4
  37. package/es/components/ui/avatar.js.map +1 -1
  38. package/es/components/ui/badge-variants.js +2 -1
  39. package/es/components/ui/badge-variants.js.map +1 -1
  40. package/es/components/ui/banner-variants.js +13 -5
  41. package/es/components/ui/banner-variants.js.map +1 -1
  42. package/es/components/ui/banner.js +9 -3
  43. package/es/components/ui/banner.js.map +1 -1
  44. package/es/components/ui/button-variants.js +2 -33
  45. package/es/components/ui/button-variants.js.map +1 -1
  46. package/es/components/ui/button.js +17 -5
  47. package/es/components/ui/button.js.map +1 -1
  48. package/es/components/ui/calendar.js +5 -6
  49. package/es/components/ui/calendar.js.map +1 -1
  50. package/es/components/ui/card-variants.js +3 -2
  51. package/es/components/ui/card-variants.js.map +1 -1
  52. package/es/components/ui/card.js +7 -4
  53. package/es/components/ui/card.js.map +1 -1
  54. package/es/components/ui/chart.js +2 -29
  55. package/es/components/ui/chart.js.map +1 -1
  56. package/es/components/ui/checkbox.js +1 -1
  57. package/es/components/ui/checkbox.js.map +1 -1
  58. package/es/components/ui/code-editor-view.js +1 -1
  59. package/es/components/ui/code-editor-view.js.map +1 -1
  60. package/es/components/ui/combobox.js +1 -1
  61. package/es/components/ui/combobox.js.map +1 -1
  62. package/es/components/ui/command.js +1 -14
  63. package/es/components/ui/command.js.map +1 -1
  64. package/es/components/ui/context-menu.js +18 -8
  65. package/es/components/ui/context-menu.js.map +1 -1
  66. package/es/components/ui/copy-field.js +2 -4
  67. package/es/components/ui/copy-field.js.map +1 -1
  68. package/es/components/ui/data-list.js +2 -4
  69. package/es/components/ui/data-list.js.map +1 -1
  70. package/es/components/ui/dialog.js +53 -11
  71. package/es/components/ui/dialog.js.map +1 -1
  72. package/es/components/ui/dropdown-menu.js +20 -10
  73. package/es/components/ui/dropdown-menu.js.map +1 -1
  74. package/es/components/ui/dropzone-variants.js +26 -10
  75. package/es/components/ui/dropzone-variants.js.map +1 -1
  76. package/es/components/ui/dropzone.js +2 -2
  77. package/es/components/ui/dropzone.js.map +1 -1
  78. package/es/components/ui/field.js +4 -4
  79. package/es/components/ui/field.js.map +1 -1
  80. package/es/components/ui/floating-sidebar.js +69 -18
  81. package/es/components/ui/floating-sidebar.js.map +1 -1
  82. package/es/components/ui/hover-card.js +13 -7
  83. package/es/components/ui/hover-card.js.map +1 -1
  84. package/es/components/ui/icon.js +1 -1
  85. package/es/components/ui/image-overlay-button.js +2 -2
  86. package/es/components/ui/image-overlay-button.js.map +1 -1
  87. package/es/components/ui/indicator-variants.js +2 -2
  88. package/es/components/ui/indicator-variants.js.map +1 -1
  89. package/es/components/ui/input-group-variants.js +5 -5
  90. package/es/components/ui/input-group-variants.js.map +1 -1
  91. package/es/components/ui/input-group.js +4 -7
  92. package/es/components/ui/input-group.js.map +1 -1
  93. package/es/components/ui/input-surface.js +5 -4
  94. package/es/components/ui/input-surface.js.map +1 -1
  95. package/es/components/ui/input.js +1 -1
  96. package/es/components/ui/input.js.map +1 -1
  97. package/es/components/ui/list.js +94 -0
  98. package/es/components/ui/list.js.map +1 -0
  99. package/es/components/ui/navbar.js +1 -3
  100. package/es/components/ui/navbar.js.map +1 -1
  101. package/es/components/ui/pagemenu.js +51 -15
  102. package/es/components/ui/pagemenu.js.map +1 -1
  103. package/es/components/ui/popover.js +14 -8
  104. package/es/components/ui/popover.js.map +1 -1
  105. package/es/components/ui/radio-group-variants.js +1 -1
  106. package/es/components/ui/radio-group-variants.js.map +1 -1
  107. package/es/components/ui/row-primary-action.js +48 -0
  108. package/es/components/ui/row-primary-action.js.map +1 -0
  109. package/es/components/ui/row-surface.js +18 -0
  110. package/es/components/ui/row-surface.js.map +1 -0
  111. package/es/components/ui/select-variants.js +6 -14
  112. package/es/components/ui/select-variants.js.map +1 -1
  113. package/es/components/ui/select.js +26 -19
  114. package/es/components/ui/select.js.map +1 -1
  115. package/es/components/ui/sheet.js +32 -19
  116. package/es/components/ui/sheet.js.map +1 -1
  117. package/es/components/ui/sidebar.js +2 -2
  118. package/es/components/ui/simple-pagination.js +4 -7
  119. package/es/components/ui/simple-pagination.js.map +1 -1
  120. package/es/components/ui/sortable-list.js +110 -11
  121. package/es/components/ui/sortable-list.js.map +1 -1
  122. package/es/components/ui/sticky-footer.js +62 -22
  123. package/es/components/ui/sticky-footer.js.map +1 -1
  124. package/es/components/ui/table.js +20 -9
  125. package/es/components/ui/table.js.map +1 -1
  126. package/es/components/ui/tabs-variants.js +23 -1
  127. package/es/components/ui/tabs-variants.js.map +1 -1
  128. package/es/components/ui/tabs.js +102 -21
  129. package/es/components/ui/tabs.js.map +1 -1
  130. package/es/components/ui/textarea.js +1 -1
  131. package/es/components/ui/textarea.js.map +1 -1
  132. package/es/components/ui/toast.js +2 -0
  133. package/es/components/ui/toggle-group.js +1 -3
  134. package/es/components/ui/toggle-group.js.map +1 -1
  135. package/es/components/ui/toggle-variants.js +1 -7
  136. package/es/components/ui/toggle-variants.js.map +1 -1
  137. package/es/components/ui/toggle.js +1 -2
  138. package/es/components/ui/toggle.js.map +1 -1
  139. package/es/components/ui/token-field.js +3 -3
  140. package/es/components/ui/token-field.js.map +1 -1
  141. package/es/components/ui/tooltip.js +81 -40
  142. package/es/components/ui/tooltip.js.map +1 -1
  143. package/es/components/ui/trend-badge.js +46 -12
  144. package/es/components/ui/trend-badge.js.map +1 -1
  145. package/es/components.js +24 -21
  146. package/es/hooks/use-row-behavior.js +94 -0
  147. package/es/hooks/use-row-behavior.js.map +1 -0
  148. package/es/hooks/use-row-press.js +63 -0
  149. package/es/hooks/use-row-press.js.map +1 -0
  150. package/es/{icon-BJcGsQ4b.js → icon--CakqPdG.js} +15 -19
  151. package/es/icon--CakqPdG.js.map +1 -0
  152. package/es/{images-CUcakpOD.js → images-F6slcZrB.js} +16 -42
  153. package/es/images-F6slcZrB.js.map +1 -0
  154. package/es/index.js +43 -39
  155. package/es/lib/app-overlay.js +184 -0
  156. package/es/lib/app-overlay.js.map +1 -0
  157. package/es/lib/date-utils.js +151 -0
  158. package/es/lib/date-utils.js.map +1 -0
  159. package/es/lib/ds-utils.js +16 -72
  160. package/es/lib/ds-utils.js.map +1 -1
  161. package/es/lib/safe-area.js +168 -0
  162. package/es/lib/safe-area.js.map +1 -0
  163. package/es/lib/svg-graphic.js +32 -0
  164. package/es/lib/svg-graphic.js.map +1 -0
  165. package/es/lib/toast-press.js +11 -0
  166. package/es/lib/toast-press.js.map +1 -0
  167. package/es/lib/utils.js +3 -2
  168. package/es/patterns.js +2 -1
  169. package/es/providers/header-tooltip-provider.js +1 -4
  170. package/es/providers/header-tooltip-provider.js.map +1 -1
  171. package/es/providers/shade-context.js +2 -1
  172. package/es/providers/shade-context.js.map +1 -1
  173. package/es/providers/shade-provider.js +28 -13
  174. package/es/providers/shade-provider.js.map +1 -1
  175. package/es/shade-app.js +22 -6
  176. package/es/shade-app.js.map +1 -1
  177. package/es/shade-scope.js +3 -2
  178. package/es/shade-scope.js.map +1 -1
  179. package/es/tokens.js +56 -8
  180. package/es/tokens.js.map +1 -1
  181. package/es/utils.js +3 -2
  182. package/package.json +7 -7
  183. package/preflight.css +0 -10
  184. package/styles.css +469 -12
  185. package/tailwind.theme.css +237 -187
  186. package/theme-variables.css +412 -44
  187. package/types/app.d.ts +7 -5
  188. package/types/app.d.ts.map +1 -1
  189. package/types/assets/images/index.d.ts +3 -3
  190. package/types/assets/images/index.d.ts.map +1 -1
  191. package/types/components/page-templates/list-page.d.ts +2 -1
  192. package/types/components/page-templates/list-page.d.ts.map +1 -1
  193. package/types/components/page-templates/modal-page.d.ts +1 -1
  194. package/types/components/patterns/color-picker.d.ts +7 -2
  195. package/types/components/patterns/color-picker.d.ts.map +1 -1
  196. package/types/components/patterns/filter-bar.d.ts +2 -2
  197. package/types/components/patterns/filter-bar.d.ts.map +1 -1
  198. package/types/components/patterns/filters-helpers.d.ts +1 -1
  199. package/types/components/patterns/filters-sheet.d.ts +19 -0
  200. package/types/components/patterns/filters-sheet.d.ts.map +1 -0
  201. package/types/components/patterns/filters.d.ts +13 -6
  202. package/types/components/patterns/filters.d.ts.map +1 -1
  203. package/types/components/patterns/gh-chart.d.ts.map +1 -1
  204. package/types/components/patterns/image-upload.d.ts +3 -3
  205. package/types/components/patterns/image-upload.d.ts.map +1 -1
  206. package/types/components/patterns/kpi-tabs.d.ts +5 -2
  207. package/types/components/patterns/kpi-tabs.d.ts.map +1 -1
  208. package/types/components/patterns/page-header.d.ts +17 -14
  209. package/types/components/patterns/page-header.d.ts.map +1 -1
  210. package/types/components/patterns/setting-group.d.ts +8 -8
  211. package/types/components/patterns/settings-modal-variants.d.ts +3 -0
  212. package/types/components/patterns/settings-modal-variants.d.ts.map +1 -1
  213. package/types/components/patterns/settings-modal.d.ts +12 -3
  214. package/types/components/patterns/settings-modal.d.ts.map +1 -1
  215. package/types/components/patterns/share-modal.d.ts +3 -3
  216. package/types/components/patterns/share-modal.d.ts.map +1 -1
  217. package/types/components/patterns/use-dirty-confirmation.d.ts +1 -1
  218. package/types/components/patterns/use-mobile-filters.d.ts +2 -0
  219. package/types/components/patterns/use-mobile-filters.d.ts.map +1 -0
  220. package/types/components/ui/alert-dialog.d.ts +2 -2
  221. package/types/components/ui/alert-dialog.d.ts.map +1 -1
  222. package/types/components/ui/avatar.d.ts.map +1 -1
  223. package/types/components/ui/badge-variants.d.ts +1 -1
  224. package/types/components/ui/badge-variants.d.ts.map +1 -1
  225. package/types/components/ui/badge.d.ts +1 -1
  226. package/types/components/ui/banner-variants.d.ts +1 -1
  227. package/types/components/ui/banner-variants.d.ts.map +1 -1
  228. package/types/components/ui/banner.d.ts +3 -1
  229. package/types/components/ui/banner.d.ts.map +1 -1
  230. package/types/components/ui/button-variants.d.ts +0 -1
  231. package/types/components/ui/button-variants.d.ts.map +1 -1
  232. package/types/components/ui/button.d.ts +7 -2
  233. package/types/components/ui/button.d.ts.map +1 -1
  234. package/types/components/ui/calendar.d.ts +1 -1
  235. package/types/components/ui/calendar.d.ts.map +1 -1
  236. package/types/components/ui/card-variants.d.ts +1 -1
  237. package/types/components/ui/card-variants.d.ts.map +1 -1
  238. package/types/components/ui/card.d.ts +1 -1
  239. package/types/components/ui/card.d.ts.map +1 -1
  240. package/types/components/ui/chart.d.ts +1 -17
  241. package/types/components/ui/chart.d.ts.map +1 -1
  242. package/types/components/ui/code-editor.d.ts +1 -1
  243. package/types/components/ui/command.d.ts +1 -6
  244. package/types/components/ui/command.d.ts.map +1 -1
  245. package/types/components/ui/context-menu.d.ts +1 -1
  246. package/types/components/ui/context-menu.d.ts.map +1 -1
  247. package/types/components/ui/copy-field.d.ts +1 -1
  248. package/types/components/ui/copy-field.d.ts.map +1 -1
  249. package/types/components/ui/data-list.d.ts.map +1 -1
  250. package/types/components/ui/dialog.d.ts +11 -2
  251. package/types/components/ui/dialog.d.ts.map +1 -1
  252. package/types/components/ui/dropdown-menu.d.ts +1 -1
  253. package/types/components/ui/dropdown-menu.d.ts.map +1 -1
  254. package/types/components/ui/dropzone-variants.d.ts +3 -2
  255. package/types/components/ui/dropzone-variants.d.ts.map +1 -1
  256. package/types/components/ui/dropzone.d.ts +1 -1
  257. package/types/components/ui/field.d.ts +1 -1
  258. package/types/components/ui/field.d.ts.map +1 -1
  259. package/types/components/ui/floating-sidebar.d.ts +12 -3
  260. package/types/components/ui/floating-sidebar.d.ts.map +1 -1
  261. package/types/components/ui/hover-card.d.ts.map +1 -1
  262. package/types/components/ui/icon.d.ts +2 -1
  263. package/types/components/ui/icon.d.ts.map +1 -1
  264. package/types/components/ui/image-overlay-button.d.ts +1 -1
  265. package/types/components/ui/image-overlay-button.d.ts.map +1 -1
  266. package/types/components/ui/indicator.d.ts +1 -1
  267. package/types/components/ui/input-group-variants.d.ts.map +1 -1
  268. package/types/components/ui/input-group.d.ts +2 -2
  269. package/types/components/ui/input-group.d.ts.map +1 -1
  270. package/types/components/ui/input-surface.d.ts +4 -3
  271. package/types/components/ui/input-surface.d.ts.map +1 -1
  272. package/types/components/ui/list.d.ts +28 -0
  273. package/types/components/ui/list.d.ts.map +1 -0
  274. package/types/components/ui/multi-select-combobox.d.ts +1 -1
  275. package/types/components/ui/navbar.d.ts.map +1 -1
  276. package/types/components/ui/pagemenu.d.ts +3 -0
  277. package/types/components/ui/pagemenu.d.ts.map +1 -1
  278. package/types/components/ui/popover.d.ts.map +1 -1
  279. package/types/components/ui/preview-chrome.d.ts +1 -1
  280. package/types/components/ui/row-primary-action.d.ts +8 -0
  281. package/types/components/ui/row-primary-action.d.ts.map +1 -0
  282. package/types/components/ui/row-surface.d.ts +11 -0
  283. package/types/components/ui/row-surface.d.ts.map +1 -0
  284. package/types/components/ui/select-variants.d.ts +0 -1
  285. package/types/components/ui/select-variants.d.ts.map +1 -1
  286. package/types/components/ui/select.d.ts +2 -2
  287. package/types/components/ui/select.d.ts.map +1 -1
  288. package/types/components/ui/sheet.d.ts +1 -1
  289. package/types/components/ui/sheet.d.ts.map +1 -1
  290. package/types/components/ui/sidebar.d.ts +2 -2
  291. package/types/components/ui/simple-pagination.d.ts.map +1 -1
  292. package/types/components/ui/sortable-list.d.ts +4 -1
  293. package/types/components/ui/sortable-list.d.ts.map +1 -1
  294. package/types/components/ui/sticky-footer.d.ts +9 -2
  295. package/types/components/ui/sticky-footer.d.ts.map +1 -1
  296. package/types/components/ui/table.d.ts +4 -1
  297. package/types/components/ui/table.d.ts.map +1 -1
  298. package/types/components/ui/tabs-variants.d.ts +5 -1
  299. package/types/components/ui/tabs-variants.d.ts.map +1 -1
  300. package/types/components/ui/tabs.d.ts.map +1 -1
  301. package/types/components/ui/toast.d.ts +2 -0
  302. package/types/components/ui/toast.d.ts.map +1 -0
  303. package/types/components/ui/toggle-group.d.ts +4 -6
  304. package/types/components/ui/toggle-group.d.ts.map +1 -1
  305. package/types/components/ui/toggle-variants.d.ts +0 -1
  306. package/types/components/ui/toggle-variants.d.ts.map +1 -1
  307. package/types/components/ui/toggle.d.ts +2 -3
  308. package/types/components/ui/toggle.d.ts.map +1 -1
  309. package/types/components/ui/token-field.d.ts +2 -2
  310. package/types/components/ui/token-field.d.ts.map +1 -1
  311. package/types/components/ui/tooltip.d.ts.map +1 -1
  312. package/types/components/ui/trend-badge.d.ts +1 -0
  313. package/types/components/ui/trend-badge.d.ts.map +1 -1
  314. package/types/components.d.ts +5 -2
  315. package/types/components.d.ts.map +1 -1
  316. package/types/hooks/use-row-behavior.d.ts +24 -0
  317. package/types/hooks/use-row-behavior.d.ts.map +1 -0
  318. package/types/hooks/use-row-press.d.ts +11 -0
  319. package/types/hooks/use-row-press.d.ts.map +1 -0
  320. package/types/lib/app-overlay.d.ts +63 -0
  321. package/types/lib/app-overlay.d.ts.map +1 -0
  322. package/types/lib/date-utils.d.ts +17 -0
  323. package/types/lib/date-utils.d.ts.map +1 -0
  324. package/types/lib/ds-utils.d.ts +2 -16
  325. package/types/lib/ds-utils.d.ts.map +1 -1
  326. package/types/lib/safe-area.d.ts +27 -0
  327. package/types/lib/safe-area.d.ts.map +1 -0
  328. package/types/lib/svg-graphic.d.ts +22 -0
  329. package/types/lib/svg-graphic.d.ts.map +1 -0
  330. package/types/lib/toast-press.d.ts +4 -0
  331. package/types/lib/toast-press.d.ts.map +1 -0
  332. package/types/lib/utils.d.ts +1 -0
  333. package/types/lib/utils.d.ts.map +1 -1
  334. package/types/patterns.d.ts +1 -0
  335. package/types/patterns.d.ts.map +1 -1
  336. package/types/providers/header-tooltip-provider.d.ts.map +1 -1
  337. package/types/providers/shade-context.d.ts +4 -1
  338. package/types/providers/shade-context.d.ts.map +1 -1
  339. package/types/providers/shade-provider.d.ts +5 -2
  340. package/types/providers/shade-provider.d.ts.map +1 -1
  341. package/types/shade-app.d.ts +11 -3
  342. package/types/shade-app.d.ts.map +1 -1
  343. package/types/shade-scope.d.ts.map +1 -1
  344. package/types/tokens.d.ts +1 -1
  345. package/types/tokens.d.ts.map +1 -1
  346. package/types/utils.d.ts +2 -1
  347. package/types/utils.d.ts.map +1 -1
  348. package/es/components/ui/action-list.js +0 -56
  349. package/es/components/ui/action-list.js.map +0 -1
  350. package/es/icon-BJcGsQ4b.js.map +0 -1
  351. package/es/images-CUcakpOD.js.map +0 -1
  352. package/types/components/ui/action-list.d.ts +0 -21
  353. package/types/components/ui/action-list.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"code-editor-view.js","names":[],"sources":["../../../src/components/ui/code-editor-view.tsx"],"sourcesContent":["import CodeMirror, {\n EditorView,\n tooltips,\n type BasicSetupOptions,\n type ReactCodeMirrorProps,\n type ReactCodeMirrorRef,\n} from '@uiw/react-codemirror';\nimport React, {\n type FocusEventHandler,\n forwardRef,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { FieldDescription, FieldLabel } from '@/components/ui/field';\nimport { inputSurface } from '@/components/ui/input-surface';\nimport { Stack } from '@/components/primitives/stack';\nimport { cn } from '@/lib/utils';\nimport { useFocusContext } from '@/providers/shade-context';\nimport type { Extension } from '@codemirror/state';\n\nexport interface CodeEditorProps extends Omit<\n ReactCodeMirrorProps,\n 'value' | 'onChange' | 'extensions' | 'title'\n> {\n title?: React.ReactNode;\n value?: string;\n height?: string;\n error?: boolean;\n hint?: React.ReactNode;\n clearBg?: boolean;\n extensions: Array<Extension | Promise<Extension> | (() => Extension | Promise<Extension>)>;\n ariaLabel?: string;\n onChange?: (value: string) => void;\n}\n\nconst codeMirrorClasses = [\n '[&_.cm-editor]:bg-transparent',\n '[&_.cm-editor]:border-transparent',\n '[&_.cm-scroller]:font-mono',\n '[&_.cm-scroller]:border-transparent',\n '[&_.cm-activeLine]:bg-transparent',\n '[&_.cm-activeLineGutter]:bg-transparent',\n '[&_.cm-gutters]:bg-muted',\n '[&_.cm-gutters]:text-muted-foreground',\n '[&_.cm-gutters]:border-border',\n '[&_.cm-cursor]:border-foreground',\n].join(' ');\n\n// Imported asynchronously by CodeEditor so CodeMirror stays out of the main bundle.\nconst CodeEditorView = forwardRef<ReactCodeMirrorRef, CodeEditorProps>(function CodeEditorView(\n {\n title,\n value,\n height = '200px',\n error,\n hint,\n clearBg = true,\n extensions,\n ariaLabel,\n editable = true,\n onChange,\n onFocus,\n onBlur,\n className,\n ...props\n },\n ref,\n) {\n const id = useId();\n const labelId = `${id}-label`;\n const hintId = `${id}-description`;\n const hasTitle = Boolean(title);\n const sizeRef = useRef<HTMLDivElement>(null);\n const { darkMode, setFocusState } = useFocusContext();\n const focusedRef = useRef(false);\n const setFocusStateRef = useRef(setFocusState);\n const [width, setWidth] = useState(100);\n const [resolvedExtensions, setResolvedExtensions] = useState<Extension[]>([]);\n\n setFocusStateRef.current = setFocusState;\n\n // Keep autocomplete outside the editor and accordion overflow boundaries.\n // CodeMirror can switch fixed tooltips to absolute after its first layout\n // measurement. A viewport-sized body host gives both positioning modes the\n // same coordinate space, preventing the visible first-frame jump.\n const [tooltipParent] = useState(() => document.createElement('div'));\n\n useEffect(() => {\n tooltipParent.className = 'shade cm-tooltip-parent pointer-events-none fixed inset-0 z-[60]';\n document.body.appendChild(tooltipParent);\n\n return () => {\n tooltipParent.remove();\n };\n }, [tooltipParent]);\n\n const basicSetup = useMemo<BasicSetupOptions>(\n () => ({\n crosshairCursor: false,\n searchKeymap: false,\n }),\n [],\n );\n\n const editorExtensions = useMemo(() => {\n const contentAttributes: Record<string, string> = { id };\n\n if (hasTitle) {\n contentAttributes['aria-labelledby'] = labelId;\n } else if (ariaLabel) {\n contentAttributes['aria-label'] = ariaLabel;\n }\n if (error) {\n contentAttributes['aria-invalid'] = 'true';\n }\n if (hint) {\n contentAttributes['aria-describedby'] = hintId;\n }\n if (!editable) {\n contentAttributes['aria-disabled'] = 'true';\n }\n\n return [\n ...resolvedExtensions,\n tooltips({ position: 'fixed', parent: tooltipParent }),\n EditorView.contentAttributes.of(contentAttributes),\n ];\n }, [\n ariaLabel,\n editable,\n error,\n hasTitle,\n hint,\n hintId,\n id,\n labelId,\n resolvedExtensions,\n tooltipParent,\n ]);\n\n const handleFocus: FocusEventHandler<HTMLDivElement> = (event) => {\n onFocus?.(event);\n focusedRef.current = true;\n setFocusState(true);\n };\n\n const handleBlur: FocusEventHandler<HTMLDivElement> = (event) => {\n onBlur?.(event);\n focusedRef.current = false;\n setFocusState(false);\n };\n\n const handleLabelClick = () => {\n if (editable) {\n document.getElementById(id)?.focus();\n }\n };\n\n useEffect(() => {\n return () => {\n if (focusedRef.current) {\n setFocusStateRef.current(false);\n }\n };\n }, []);\n\n useEffect(() => {\n let cancelled = false;\n\n const pendingExtensions = extensions.map((extension) =>\n typeof extension === 'function' ? extension() : extension,\n );\n\n Promise.all(pendingExtensions).then(\n (nextExtensions) => {\n if (!cancelled) {\n setResolvedExtensions(nextExtensions);\n }\n },\n () => {\n if (!cancelled) {\n setResolvedExtensions([]);\n }\n },\n );\n\n return () => {\n cancelled = true;\n };\n }, [extensions]);\n\n useEffect(() => {\n const resizeObserver = new ResizeObserver(([entry]) => {\n setWidth(entry.contentRect.width);\n });\n\n resizeObserver.observe(sizeRef.current!);\n\n return () => resizeObserver.disconnect();\n }, []);\n\n const styles = cn(\n inputSurface('within'),\n 'peer order-2 w-full max-w-full overflow-hidden',\n clearBg && 'bg-transparent',\n height === 'full' && 'h-full',\n !editable && 'cursor-not-allowed opacity-50',\n codeMirrorClasses,\n className,\n );\n\n return (\n <div className={cn('w-full', height === 'full' && 'h-full')}>\n <div ref={sizeRef} />\n <Stack className={height === 'full' ? 'h-full' : ''} gap=\"xs\" style={{ width }}>\n {title && (\n <FieldLabel id={labelId} onClick={handleLabelClick}>\n {title}\n </FieldLabel>\n )}\n <CodeMirror\n ref={ref}\n basicSetup={basicSetup}\n className={styles}\n editable={editable}\n extensions={editorExtensions}\n height={height === 'full' ? '100%' : height}\n theme={darkMode ? 'dark' : 'light'}\n value={value}\n onBlur={handleBlur}\n onChange={onChange}\n onFocus={handleFocus}\n {...props}\n />\n {hint && (\n <FieldDescription className={cn(error && 'text-destructive')} id={hintId}>\n {hint}\n </FieldDescription>\n )}\n </Stack>\n </div>\n );\n});\n\nCodeEditorView.displayName = 'CodeEditorView';\n\nexport default CodeEditorView;\n"],"mappings":";;;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AA7E;IACG,SACC,oBAAC,YAAD;KAAY,IAAI;KAAS,SAAS;eAC/B;IACS,CAAA;IAEd,oBAAC,YAAD;KACO;KACO;KACZ,WAAW;KACD;KACV,YAAY;KACZ,QAAQ,WAAW,SAAS,SAAS;KACrC,OAAO,WAAW,SAAS;KACpB;KACP,QAAQ;KACE;KACV,SAAS;KACT,GAAI;IACL,CAAA;IACA,QACC,oBAAC,kBAAD;KAAkB,WAAW,GAAG,SAAS,kBAAkB;KAAG,IAAI;eAC/D;IACe,CAAA;GAEf;IACJ;;AAET,CAAC;AAED,eAAe,cAAc"}
1
+ {"version":3,"file":"code-editor-view.js","names":[],"sources":["../../../src/components/ui/code-editor-view.tsx"],"sourcesContent":["import CodeMirror, {\n EditorView,\n tooltips,\n type BasicSetupOptions,\n type ReactCodeMirrorProps,\n type ReactCodeMirrorRef,\n} from '@uiw/react-codemirror';\nimport React, {\n type FocusEventHandler,\n forwardRef,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { FieldDescription, FieldLabel } from '@/components/ui/field';\nimport { inputSurface } from '@/components/ui/input-surface';\nimport { Stack } from '@/components/primitives/stack';\nimport { cn } from '@/lib/utils';\nimport { useFocusContext } from '@/providers/shade-context';\nimport type { Extension } from '@codemirror/state';\n\nexport interface CodeEditorProps extends Omit<\n ReactCodeMirrorProps,\n 'value' | 'onChange' | 'extensions' | 'title'\n> {\n title?: React.ReactNode;\n value?: string;\n height?: string;\n error?: boolean;\n hint?: React.ReactNode;\n clearBg?: boolean;\n extensions: Array<Extension | Promise<Extension> | (() => Extension | Promise<Extension>)>;\n ariaLabel?: string;\n onChange?: (value: string) => void;\n}\n\nconst codeMirrorClasses = [\n '[&_.cm-editor]:bg-transparent',\n '[&_.cm-editor]:border-transparent',\n '[&_.cm-scroller]:font-mono',\n '[&_.cm-scroller]:border-transparent',\n '[&_.cm-activeLine]:bg-transparent',\n '[&_.cm-activeLineGutter]:bg-transparent',\n '[&_.cm-gutters]:bg-muted',\n '[&_.cm-gutters]:text-muted-foreground',\n '[&_.cm-gutters]:border-border',\n '[&_.cm-cursor]:border-foreground',\n].join(' ');\n\n// Imported asynchronously by CodeEditor so CodeMirror stays out of the main bundle.\nconst CodeEditorView = forwardRef<ReactCodeMirrorRef, CodeEditorProps>(function CodeEditorView(\n {\n title,\n value,\n height = '200px',\n error,\n hint,\n clearBg = true,\n extensions,\n ariaLabel,\n editable = true,\n onChange,\n onFocus,\n onBlur,\n className,\n ...props\n },\n ref,\n) {\n const id = useId();\n const labelId = `${id}-label`;\n const hintId = `${id}-description`;\n const hasTitle = Boolean(title);\n const sizeRef = useRef<HTMLDivElement>(null);\n const { darkMode, setFocusState } = useFocusContext();\n const focusedRef = useRef(false);\n const setFocusStateRef = useRef(setFocusState);\n const [width, setWidth] = useState(100);\n const [resolvedExtensions, setResolvedExtensions] = useState<Extension[]>([]);\n\n setFocusStateRef.current = setFocusState;\n\n // Keep autocomplete outside the editor and accordion overflow boundaries.\n // CodeMirror can switch fixed tooltips to absolute after its first layout\n // measurement. A viewport-sized body host gives both positioning modes the\n // same coordinate space, preventing the visible first-frame jump.\n const [tooltipParent] = useState(() => document.createElement('div'));\n\n useEffect(() => {\n tooltipParent.className = 'shade cm-tooltip-parent pointer-events-none fixed inset-0 z-[60]';\n document.body.appendChild(tooltipParent);\n\n return () => {\n tooltipParent.remove();\n };\n }, [tooltipParent]);\n\n const basicSetup = useMemo<BasicSetupOptions>(\n () => ({\n crosshairCursor: false,\n searchKeymap: false,\n }),\n [],\n );\n\n const editorExtensions = useMemo(() => {\n const contentAttributes: Record<string, string> = { id };\n\n if (hasTitle) {\n contentAttributes['aria-labelledby'] = labelId;\n } else if (ariaLabel) {\n contentAttributes['aria-label'] = ariaLabel;\n }\n if (error) {\n contentAttributes['aria-invalid'] = 'true';\n }\n if (hint) {\n contentAttributes['aria-describedby'] = hintId;\n }\n if (!editable) {\n contentAttributes['aria-disabled'] = 'true';\n }\n\n return [\n ...resolvedExtensions,\n tooltips({ position: 'fixed', parent: tooltipParent }),\n EditorView.contentAttributes.of(contentAttributes),\n ];\n }, [\n ariaLabel,\n editable,\n error,\n hasTitle,\n hint,\n hintId,\n id,\n labelId,\n resolvedExtensions,\n tooltipParent,\n ]);\n\n const handleFocus: FocusEventHandler<HTMLDivElement> = (event) => {\n onFocus?.(event);\n focusedRef.current = true;\n setFocusState(true);\n };\n\n const handleBlur: FocusEventHandler<HTMLDivElement> = (event) => {\n onBlur?.(event);\n focusedRef.current = false;\n setFocusState(false);\n };\n\n const handleLabelClick = () => {\n if (editable) {\n document.getElementById(id)?.focus();\n }\n };\n\n useEffect(() => {\n return () => {\n if (focusedRef.current) {\n setFocusStateRef.current(false);\n }\n };\n }, []);\n\n useEffect(() => {\n let cancelled = false;\n\n const pendingExtensions = extensions.map((extension) =>\n typeof extension === 'function' ? extension() : extension,\n );\n\n Promise.all(pendingExtensions).then(\n (nextExtensions) => {\n if (!cancelled) {\n setResolvedExtensions(nextExtensions);\n }\n },\n () => {\n if (!cancelled) {\n setResolvedExtensions([]);\n }\n },\n );\n\n return () => {\n cancelled = true;\n };\n }, [extensions]);\n\n useEffect(() => {\n const resizeObserver = new ResizeObserver(([entry]) => {\n setWidth(entry.contentRect.width);\n });\n\n resizeObserver.observe(sizeRef.current!);\n\n return () => resizeObserver.disconnect();\n }, []);\n\n const styles = cn(\n inputSurface('within'),\n 'peer w-full max-w-full overflow-hidden',\n clearBg && 'bg-transparent',\n height === 'full' && 'h-full',\n !editable && 'cursor-not-allowed opacity-50',\n codeMirrorClasses,\n className,\n );\n\n return (\n <div className={cn('w-full', height === 'full' && 'h-full')}>\n <div ref={sizeRef} />\n <Stack className={height === 'full' ? 'h-full' : ''} gap=\"xs\" style={{ width }}>\n {title && (\n <FieldLabel id={labelId} onClick={handleLabelClick}>\n {title}\n </FieldLabel>\n )}\n <CodeMirror\n ref={ref}\n basicSetup={basicSetup}\n className={styles}\n editable={editable}\n extensions={editorExtensions}\n height={height === 'full' ? '100%' : height}\n theme={darkMode ? 'dark' : 'light'}\n value={value}\n onBlur={handleBlur}\n onChange={onChange}\n onFocus={handleFocus}\n {...props}\n />\n {hint && (\n <FieldDescription className={cn(error && 'text-destructive')} id={hintId}>\n {hint}\n </FieldDescription>\n )}\n </Stack>\n </div>\n );\n});\n\nCodeEditorView.displayName = 'CodeEditorView';\n\nexport default CodeEditorView;\n"],"mappings":";;;;;;;;;AAuCA,IAAM,oBAAoB;CACxB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC,CAAC,KAAK,GAAG;AAGV,IAAM,iBAAiB,WAAgD,SAAS,eAC9E,EACE,OACA,OACA,SAAS,SACT,OACA,MACA,UAAU,MACV,YACA,WACA,WAAW,MACX,UACA,SACA,QACA,WACA,GAAG,SAEL,KACA;CACA,MAAM,KAAK,MAAM;CACjB,MAAM,UAAU,GAAG,GAAG;CACtB,MAAM,SAAS,GAAG,GAAG;CACrB,MAAM,WAAW,QAAQ,KAAK;CAC9B,MAAM,UAAU,OAAuB,IAAI;CAC3C,MAAM,EAAE,UAAU,kBAAkB,gBAAgB;CACpD,MAAM,aAAa,OAAO,KAAK;CAC/B,MAAM,mBAAmB,OAAO,aAAa;CAC7C,MAAM,CAAC,OAAO,YAAY,SAAS,GAAG;CACtC,MAAM,CAAC,oBAAoB,yBAAyB,SAAsB,CAAC,CAAC;CAE5E,iBAAiB,UAAU;CAM3B,MAAM,CAAC,iBAAiB,eAAe,SAAS,cAAc,KAAK,CAAC;CAEpE,gBAAgB;EACd,cAAc,YAAY;EAC1B,SAAS,KAAK,YAAY,aAAa;EAEvC,aAAa;GACX,cAAc,OAAO;EACvB;CACF,GAAG,CAAC,aAAa,CAAC;CAElB,MAAM,aAAa,eACV;EACL,iBAAiB;EACjB,cAAc;CAChB,IACA,CAAC,CACH;CAEA,MAAM,mBAAmB,cAAc;EACrC,MAAM,oBAA4C,EAAE,GAAG;EAEvD,IAAI,UACF,kBAAkB,qBAAqB;OAClC,IAAI,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AW,UAAU,UACrB,CAAC,YAAY,iCACb,mBACA,SACF;CAEA,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,UAAU,WAAW,UAAU,QAAQ;YAA1D,CACE,oBAAC,OAAD,EAAK,KAAK,QAAU,CAAA,GACpB,qBAAC,OAAD;GAAO,WAAW,WAAW,SAAS,WAAW;GAAI,KAAI;GAAK,OAAO,EAAE,MAAM;aAA7E;IACG,SACC,oBAAC,YAAD;KAAY,IAAI;KAAS,SAAS;eAC/B;IACS,CAAA;IAEd,oBAAC,YAAD;KACO;KACO;KACZ,WAAW;KACD;KACV,YAAY;KACZ,QAAQ,WAAW,SAAS,SAAS;KACrC,OAAO,WAAW,SAAS;KACpB;KACP,QAAQ;KACE;KACV,SAAS;KACT,GAAI;IACL,CAAA;IACA,QACC,oBAAC,kBAAD;KAAkB,WAAW,GAAG,SAAS,kBAAkB;KAAG,IAAI;eAC/D;IACe,CAAA;GAEf;IACJ;;AAET,CAAC;AAED,eAAe,cAAc"}
@@ -10,7 +10,7 @@ var ComboboxTrigger = React$1.forwardRef(({ children, className, ...props }, ref
10
10
  asChild: true,
11
11
  children: /* @__PURE__ */ jsxs("button", {
12
12
  ref,
13
- className: cn(inputSurface("self"), inputSurfaceClasses.disabledFieldSelf, "flex h-(--control-height) w-full min-w-0 items-center justify-between pr-2 pl-3 text-control hover:bg-button-hover", className),
13
+ className: cn(inputSurface("self"), inputSurfaceClasses.disabledFieldSelf, "flex h-(--control-height) w-full min-w-0 items-center justify-between pr-2 pl-3 text-(length:--text-field) hover:bg-button-hover", className),
14
14
  role: "combobox",
15
15
  ...props,
16
16
  type: "button",
@@ -1 +1 @@
1
- {"version":3,"file":"combobox.js","names":[],"sources":["../../../src/components/ui/combobox.tsx"],"sourcesContent":["import * as React from 'react';\nimport { ChevronDown } from 'lucide-react';\n\nimport { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';\nimport { inputSurface, inputSurfaceClasses } from '@/components/ui/input-surface';\nimport { cn } from '@/lib/utils';\n\nconst Combobox = Popover;\n\nconst ComboboxTrigger = React.forwardRef<\n HTMLButtonElement,\n Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type'>\n>(({ children, className, ...props }, ref) => (\n <PopoverTrigger asChild>\n <button\n ref={ref}\n className={cn(\n inputSurface('self'),\n inputSurfaceClasses.disabledFieldSelf,\n // Chevron position matches SelectTrigger.\n 'flex h-(--control-height) w-full min-w-0 items-center justify-between pr-2 pl-3 text-control hover:bg-button-hover',\n className,\n )}\n role=\"combobox\"\n {...props}\n type=\"button\"\n >\n {children}\n <ChevronDown className=\"-mr-0.5 ml-2 size-4 shrink-0 opacity-50\" />\n </button>\n </PopoverTrigger>\n));\nComboboxTrigger.displayName = 'ComboboxTrigger';\n\ninterface ComboboxValueProps extends React.HTMLAttributes<HTMLSpanElement> {\n placeholder?: boolean;\n}\n\nconst ComboboxValue = React.forwardRef<HTMLSpanElement, ComboboxValueProps>(\n ({ className, placeholder = false, ...props }, ref) => (\n <span\n ref={ref}\n className={cn(\n 'min-w-0 flex-1 truncate text-left',\n placeholder && 'text-muted-foreground',\n className,\n )}\n {...props}\n />\n ),\n);\nComboboxValue.displayName = 'ComboboxValue';\n\nconst ComboboxContent = React.forwardRef<\n React.ElementRef<typeof PopoverContent>,\n React.ComponentPropsWithoutRef<typeof PopoverContent>\n>(({ align = 'start', className, ...props }, ref) => (\n <PopoverContent\n ref={ref}\n align={align}\n className={cn('z-[9999] w-(--radix-popover-trigger-width) p-0', className)}\n {...props}\n />\n));\nComboboxContent.displayName = 'ComboboxContent';\n\nexport { Combobox, ComboboxContent, ComboboxTrigger, ComboboxValue };\n"],"mappings":";;;;;;;AAOA,IAAM,WAAW;AAEjB,IAAM,kBAAkB,QAAM,YAG3B,EAAE,UAAU,WAAW,GAAG,SAAS,QACpC,oBAAC,gBAAD;CAAgB,SAAA;WACd,qBAAC,UAAD;EACO;EACL,WAAW,GACT,aAAa,MAAM,GACnB,oBAAoB,mBAEpB,sHACA,SACF;EACA,MAAK;EACL,GAAI;EACJ,MAAK;YAXP,CAaG,UACD,oBAAC,aAAD,EAAa,WAAU,0CAA2C,CAAA,CAC5D;;AACM,CAAA,CACjB;AACD,gBAAgB,cAAc;AAM9B,IAAM,gBAAgB,QAAM,YACzB,EAAE,WAAW,cAAc,OAAO,GAAG,SAAS,QAC7C,oBAAC,QAAD;CACO;CACL,WAAW,GACT,qCACA,eAAe,yBACf,SACF;CACA,GAAI;AACL,CAAA,CAEL;AACA,cAAc,cAAc;AAE5B,IAAM,kBAAkB,QAAM,YAG3B,EAAE,QAAQ,SAAS,WAAW,GAAG,SAAS,QAC3C,oBAAC,gBAAD;CACO;CACE;CACP,WAAW,GAAG,kDAAkD,SAAS;CACzE,GAAI;AACL,CAAA,CACF;AACD,gBAAgB,cAAc"}
1
+ {"version":3,"file":"combobox.js","names":[],"sources":["../../../src/components/ui/combobox.tsx"],"sourcesContent":["import * as React from 'react';\nimport { ChevronDown } from 'lucide-react';\n\nimport { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';\nimport { inputSurface, inputSurfaceClasses } from '@/components/ui/input-surface';\nimport { cn } from '@/lib/utils';\n\nconst Combobox = Popover;\n\nconst ComboboxTrigger = React.forwardRef<\n HTMLButtonElement,\n Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type'>\n>(({ children, className, ...props }, ref) => (\n <PopoverTrigger asChild>\n <button\n ref={ref}\n className={cn(\n inputSurface('self'),\n inputSurfaceClasses.disabledFieldSelf,\n // Chevron position matches SelectTrigger.\n 'flex h-(--control-height) w-full min-w-0 items-center justify-between pr-2 pl-3 text-(length:--text-field) hover:bg-button-hover',\n className,\n )}\n role=\"combobox\"\n {...props}\n type=\"button\"\n >\n {children}\n <ChevronDown className=\"-mr-0.5 ml-2 size-4 shrink-0 opacity-50\" />\n </button>\n </PopoverTrigger>\n));\nComboboxTrigger.displayName = 'ComboboxTrigger';\n\ninterface ComboboxValueProps extends React.HTMLAttributes<HTMLSpanElement> {\n placeholder?: boolean;\n}\n\nconst ComboboxValue = React.forwardRef<HTMLSpanElement, ComboboxValueProps>(\n ({ className, placeholder = false, ...props }, ref) => (\n <span\n ref={ref}\n className={cn(\n 'min-w-0 flex-1 truncate text-left',\n placeholder && 'text-muted-foreground',\n className,\n )}\n {...props}\n />\n ),\n);\nComboboxValue.displayName = 'ComboboxValue';\n\nconst ComboboxContent = React.forwardRef<\n React.ElementRef<typeof PopoverContent>,\n React.ComponentPropsWithoutRef<typeof PopoverContent>\n>(({ align = 'start', className, ...props }, ref) => (\n <PopoverContent\n ref={ref}\n align={align}\n className={cn('z-[9999] w-(--radix-popover-trigger-width) p-0', className)}\n {...props}\n />\n));\nComboboxContent.displayName = 'ComboboxContent';\n\nexport { Combobox, ComboboxContent, ComboboxTrigger, ComboboxValue };\n"],"mappings":";;;;;;;AAOA,IAAM,WAAW;AAEjB,IAAM,kBAAkB,QAAM,YAG3B,EAAE,UAAU,WAAW,GAAG,SAAS,QACpC,oBAAC,gBAAD;CAAgB,SAAA;WACd,qBAAC,UAAD;EACO;EACL,WAAW,GACT,aAAa,MAAM,GACnB,oBAAoB,mBAEpB,oIACA,SACF;EACA,MAAK;EACL,GAAI;EACJ,MAAK;YAXP,CAaG,UACD,oBAAC,aAAD,EAAa,WAAU,0CAA2C,CAAA,CAC5D;;AACM,CAAA,CACjB;AACD,gBAAgB,cAAc;AAM9B,IAAM,gBAAgB,QAAM,YACzB,EAAE,WAAW,cAAc,OAAO,GAAG,SAAS,QAC7C,oBAAC,QAAD;CACO;CACL,WAAW,GACT,qCACA,eAAe,yBACf,SACF;CACA,GAAI;AACL,CAAA,CAEL;AACA,cAAc,cAAc;AAE5B,IAAM,kBAAkB,QAAM,YAG3B,EAAE,QAAQ,SAAS,WAAW,GAAG,SAAS,QAC3C,oBAAC,gBAAD;CACO;CACE;CACP,WAAW,GAAG,kDAAkD,SAAS;CACzE,GAAI;AACL,CAAA,CACF;AACD,gBAAgB,cAAc"}
@@ -1,6 +1,5 @@
1
1
  "use client";
2
2
  import { cn } from "../../lib/ds-utils.js";
3
- import { Dialog, DialogContent, DialogTitle } from "./dialog.js";
4
3
  import { Check, Search } from "lucide-react";
5
4
  import "react";
6
5
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -12,18 +11,6 @@ function Command({ className, ...props }) {
12
11
  ...props
13
12
  });
14
13
  }
15
- var CommandDialog = ({ children, className, ...props }) => {
16
- return /* @__PURE__ */ jsx(Dialog, {
17
- ...props,
18
- children: /* @__PURE__ */ jsxs(DialogContent, {
19
- className: cn("overflow-hidden p-0 shadow-lg", className),
20
- children: [/* @__PURE__ */ jsx(DialogTitle, { className: "hidden" }), /* @__PURE__ */ jsx(Command, {
21
- className: "[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:size-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:size-5",
22
- children
23
- })]
24
- })
25
- });
26
- };
27
14
  function CommandInput({ className, ...props }) {
28
15
  return /* @__PURE__ */ jsxs("div", {
29
16
  className: "flex items-center border-b border-border px-3",
@@ -86,6 +73,6 @@ function CommandCheck({ icon: Icon = Check, className, ...props }) {
86
73
  });
87
74
  }
88
75
  //#endregion
89
- export { Command, CommandCheck, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut };
76
+ export { Command, CommandCheck, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut };
90
77
 
91
78
  //# sourceMappingURL=command.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"command.js","names":[],"sources":["../../../src/components/ui/command.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\nimport { cn } from '@/lib/utils';\nimport { Dialog, DialogContent, DialogTitle } from '@/components/ui/dialog';\nimport { type DialogProps } from '@radix-ui/react-dialog';\nimport { Command as CommandPrimitive } from 'cmdk';\nimport { Check, LucideIcon, Search } from 'lucide-react';\n\nfunction Command({ className, ...props }: React.ComponentProps<typeof CommandPrimitive>) {\n return (\n <CommandPrimitive\n className={cn(\n 'flex size-full flex-col overflow-hidden rounded-menu bg-transparent text-popover-foreground',\n className,\n )}\n {...props}\n />\n );\n}\n\ntype CommandDialogProps = DialogProps & { className?: string };\n\nconst CommandDialog = ({ children, className, ...props }: CommandDialogProps) => {\n return (\n <Dialog {...props}>\n <DialogContent className={cn('overflow-hidden p-0 shadow-lg', className)}>\n <DialogTitle className=\"hidden\" />\n <Command className=\"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:size-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:size-5\">\n {children}\n </Command>\n </DialogContent>\n </Dialog>\n );\n};\n\nfunction CommandInput({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Input>) {\n return (\n <div\n className=\"flex items-center border-b border-border px-3\"\n {...{ 'cmdk-input-wrapper': '' }}\n data-slot=\"command-input\"\n >\n <Search className=\"me-2 size-4 shrink-0 opacity-50\" />\n <CommandPrimitive.Input\n className={cn(\n 'flex h-11 w-full rounded-control bg-transparent py-3 text-(length:--text-control) text-foreground outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50',\n className,\n )}\n {...props}\n />\n </div>\n );\n}\n\nfunction CommandList({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.List>) {\n return (\n <CommandPrimitive.List\n className={cn('max-h-[300px] overflow-x-hidden overflow-y-auto p-1', className)}\n data-slot=\"command-list\"\n {...props}\n />\n );\n}\n\nfunction CommandEmpty({ ...props }: React.ComponentProps<typeof CommandPrimitive.Empty>) {\n return (\n <CommandPrimitive.Empty\n className=\"py-6 text-center text-sm\"\n data-slot=\"command-empty\"\n {...props}\n />\n );\n}\n\nfunction CommandGroup({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Group>) {\n return (\n <CommandPrimitive.Group\n className={cn(\n 'overflow-hidden p-1.5 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground',\n className,\n )}\n data-slot=\"command-group\"\n {...props}\n />\n );\n}\n\nfunction CommandSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Separator>) {\n return (\n <CommandPrimitive.Separator\n className={cn('-mx-1.5 h-px bg-border', className)}\n data-slot=\"command-separator\"\n {...props}\n />\n );\n}\n\nfunction CommandItem({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Item>) {\n return (\n <CommandPrimitive.Item\n className={cn(\n 'relative flex cursor-default items-center gap-2 rounded-menu-item px-2 py-1.5 text-(length:--text-control) text-foreground outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-interactive-hover [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',\n '[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:stroke-[1.5px]',\n className,\n )}\n data-slot=\"command-item\"\n {...props}\n />\n );\n}\n\nconst CommandShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {\n return (\n <span\n className={cn('ms-auto text-xs tracking-widest text-muted-foreground', className)}\n data-slot=\"command-shortcut\"\n {...props}\n />\n );\n};\n\ninterface ButtonArrowProps extends React.SVGProps<SVGSVGElement> {\n icon?: LucideIcon; // Allows passing any Lucide icon\n}\n\nfunction CommandCheck({ icon: Icon = Check, className, ...props }: ButtonArrowProps) {\n return (\n <Icon\n className={cn('ms-auto size-4 text-primary', className)}\n data-check=\"true\"\n data-slot=\"command-check\"\n {...props}\n />\n );\n}\n\nexport {\n Command,\n CommandCheck,\n CommandDialog,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n CommandSeparator,\n CommandShortcut,\n};\n"],"mappings":";;;;;;;;AASA,SAAS,QAAQ,EAAE,WAAW,GAAG,SAAwD;CACvF,OACE,oBAAC,WAAD;EACE,WAAW,GACT,+FACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAIA,IAAM,iBAAiB,EAAE,UAAU,WAAW,GAAG,YAAgC;CAC/E,OACE,oBAAC,QAAD;EAAQ,GAAI;YACV,qBAAC,eAAD;GAAe,WAAW,GAAG,iCAAiC,SAAS;aAAvE,CACE,oBAAC,aAAD,EAAa,WAAU,SAAU,CAAA,GACjC,oBAAC,SAAD;IAAS,WAAU;IAChB;GACM,CAAA,CACI;;CACT,CAAA;AAEZ;AAEA,SAAS,aAAa,EACpB,WACA,GAAG,SACmD;CACtD,OACE,qBAAC,OAAD;EACE,WAAU;EACJ,sBAAsB;EAC5B,aAAU;YAHZ,CAKE,oBAAC,QAAD,EAAQ,WAAU,kCAAmC,CAAA,GACrD,oBAAC,UAAiB,OAAlB;GACE,WAAW,GACT,sMACA,SACF;GACA,GAAI;EACL,CAAA,CACE;;AAET;AAEA,SAAS,YAAY,EAAE,WAAW,GAAG,SAA6D;CAChG,OACE,oBAAC,UAAiB,MAAlB;EACE,WAAW,GAAG,uDAAuD,SAAS;EAC9E,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,aAAa,EAAE,GAAG,SAA8D;CACvF,OACE,oBAAC,UAAiB,OAAlB;EACE,WAAU;EACV,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,aAAa,EACpB,WACA,GAAG,SACmD;CACtD,OACE,oBAAC,UAAiB,OAAlB;EACE,WAAW,GACT,4NACA,SACF;EACA,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,iBAAiB,EACxB,WACA,GAAG,SACuD;CAC1D,OACE,oBAAC,UAAiB,WAAlB;EACE,WAAW,GAAG,0BAA0B,SAAS;EACjD,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,YAAY,EAAE,WAAW,GAAG,SAA6D;CAChG,OACE,oBAAC,UAAiB,MAAlB;EACE,WAAW,GACT,wUACA,sFACA,SACF;EACA,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAEA,IAAM,mBAAmB,EAAE,WAAW,GAAG,YAAmD;CAC1F,OACE,oBAAC,QAAD;EACE,WAAW,GAAG,yDAAyD,SAAS;EAChF,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAMA,SAAS,aAAa,EAAE,MAAM,OAAO,OAAO,WAAW,GAAG,SAA2B;CACnF,OACE,oBAAC,MAAD;EACE,WAAW,GAAG,+BAA+B,SAAS;EACtD,cAAW;EACX,aAAU;EACV,GAAI;CACL,CAAA;AAEL"}
1
+ {"version":3,"file":"command.js","names":[],"sources":["../../../src/components/ui/command.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\nimport { cn } from '@/lib/utils';\nimport { Command as CommandPrimitive } from 'cmdk';\nimport { Check, LucideIcon, Search } from 'lucide-react';\n\nfunction Command({ className, ...props }: React.ComponentProps<typeof CommandPrimitive>) {\n return (\n <CommandPrimitive\n className={cn(\n 'flex size-full flex-col overflow-hidden rounded-menu bg-transparent text-popover-foreground',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction CommandInput({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Input>) {\n return (\n <div\n className=\"flex items-center border-b border-border px-3\"\n {...{ 'cmdk-input-wrapper': '' }}\n data-slot=\"command-input\"\n >\n <Search className=\"me-2 size-4 shrink-0 opacity-50\" />\n <CommandPrimitive.Input\n className={cn(\n 'flex h-11 w-full rounded-control bg-transparent py-3 text-(length:--text-control) text-foreground outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50',\n className,\n )}\n {...props}\n />\n </div>\n );\n}\n\nfunction CommandList({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.List>) {\n return (\n <CommandPrimitive.List\n className={cn('max-h-[300px] overflow-x-hidden overflow-y-auto p-1', className)}\n data-slot=\"command-list\"\n {...props}\n />\n );\n}\n\nfunction CommandEmpty({ ...props }: React.ComponentProps<typeof CommandPrimitive.Empty>) {\n return (\n <CommandPrimitive.Empty\n className=\"py-6 text-center text-sm\"\n data-slot=\"command-empty\"\n {...props}\n />\n );\n}\n\nfunction CommandGroup({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Group>) {\n return (\n <CommandPrimitive.Group\n className={cn(\n 'overflow-hidden p-1.5 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground',\n className,\n )}\n data-slot=\"command-group\"\n {...props}\n />\n );\n}\n\nfunction CommandSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Separator>) {\n return (\n <CommandPrimitive.Separator\n className={cn('-mx-1.5 h-px bg-border', className)}\n data-slot=\"command-separator\"\n {...props}\n />\n );\n}\n\nfunction CommandItem({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Item>) {\n return (\n <CommandPrimitive.Item\n className={cn(\n 'relative flex cursor-default items-center gap-2 rounded-menu-item px-2 py-1.5 text-(length:--text-control) text-foreground outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-interactive-hover [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',\n '[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:stroke-[1.5px]',\n className,\n )}\n data-slot=\"command-item\"\n {...props}\n />\n );\n}\n\nconst CommandShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {\n return (\n <span\n className={cn('ms-auto text-xs tracking-widest text-muted-foreground', className)}\n data-slot=\"command-shortcut\"\n {...props}\n />\n );\n};\n\ninterface ButtonArrowProps extends React.SVGProps<SVGSVGElement> {\n icon?: LucideIcon; // Allows passing any Lucide icon\n}\n\nfunction CommandCheck({ icon: Icon = Check, className, ...props }: ButtonArrowProps) {\n return (\n <Icon\n className={cn('ms-auto size-4 text-primary', className)}\n data-check=\"true\"\n data-slot=\"command-check\"\n {...props}\n />\n );\n}\n\nexport {\n Command,\n CommandCheck,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n CommandSeparator,\n CommandShortcut,\n};\n"],"mappings":";;;;;;;AAOA,SAAS,QAAQ,EAAE,WAAW,GAAG,SAAwD;CACvF,OACE,oBAAC,WAAD;EACE,WAAW,GACT,+FACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,aAAa,EACpB,WACA,GAAG,SACmD;CACtD,OACE,qBAAC,OAAD;EACE,WAAU;EACJ,sBAAsB;EAC5B,aAAU;YAHZ,CAKE,oBAAC,QAAD,EAAQ,WAAU,kCAAmC,CAAA,GACrD,oBAAC,UAAiB,OAAlB;GACE,WAAW,GACT,sMACA,SACF;GACA,GAAI;EACL,CAAA,CACE;;AAET;AAEA,SAAS,YAAY,EAAE,WAAW,GAAG,SAA6D;CAChG,OACE,oBAAC,UAAiB,MAAlB;EACE,WAAW,GAAG,uDAAuD,SAAS;EAC9E,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,aAAa,EAAE,GAAG,SAA8D;CACvF,OACE,oBAAC,UAAiB,OAAlB;EACE,WAAU;EACV,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,aAAa,EACpB,WACA,GAAG,SACmD;CACtD,OACE,oBAAC,UAAiB,OAAlB;EACE,WAAW,GACT,4NACA,SACF;EACA,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,iBAAiB,EACxB,WACA,GAAG,SACuD;CAC1D,OACE,oBAAC,UAAiB,WAAlB;EACE,WAAW,GAAG,0BAA0B,SAAS;EACjD,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,YAAY,EAAE,WAAW,GAAG,SAA6D;CAChG,OACE,oBAAC,UAAiB,MAAlB;EACE,WAAW,GACT,wUACA,sFACA,SACF;EACA,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAEA,IAAM,mBAAmB,EAAE,WAAW,GAAG,YAAmD;CAC1F,OACE,oBAAC,QAAD;EACE,WAAW,GAAG,yDAAyD,SAAS;EAChF,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAMA,SAAS,aAAa,EAAE,MAAM,OAAO,OAAO,WAAW,GAAG,SAA2B;CACnF,OACE,oBAAC,MAAD;EACE,WAAW,GAAG,+BAA+B,SAAS;EACtD,cAAW;EACX,aAAU;EACV,GAAI;CACL,CAAA;AAEL"}
@@ -1,5 +1,7 @@
1
1
  import { cn } from "../../lib/ds-utils.js";
2
2
  import { ShadeScope } from "../../shade-scope.js";
3
+ import { safeAreaCollision } from "../../lib/safe-area.js";
4
+ import { usePortalContainer } from "../../lib/app-overlay.js";
3
5
  import { Check, ChevronRight, Circle } from "lucide-react";
4
6
  import * as React$1 from "react";
5
7
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -8,7 +10,10 @@ import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
8
10
  var ContextMenu = ContextMenuPrimitive.Root;
9
11
  var ContextMenuTrigger = ContextMenuPrimitive.Trigger;
10
12
  var ContextMenuGroup = ContextMenuPrimitive.Group;
11
- var ContextMenuPortal = ContextMenuPrimitive.Portal;
13
+ var ContextMenuPortal = (props) => /* @__PURE__ */ jsx(ContextMenuPrimitive.Portal, {
14
+ container: usePortalContainer(),
15
+ ...props
16
+ });
12
17
  var ContextMenuSub = ContextMenuPrimitive.Sub;
13
18
  var ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;
14
19
  var ContextMenuSubTrigger = React$1.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs(ContextMenuPrimitive.SubTrigger, {
@@ -18,17 +23,22 @@ var ContextMenuSubTrigger = React$1.forwardRef(({ className, inset, children, ..
18
23
  children: [children, /* @__PURE__ */ jsx(ChevronRight, { className: "ml-auto" })]
19
24
  }));
20
25
  ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;
21
- var ContextMenuSubContent = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(ShadeScope, { children: /* @__PURE__ */ jsx(ContextMenuPrimitive.SubContent, {
26
+ var ContextMenuSubContent = React$1.forwardRef(({ className, collisionBoundary, ...props }, ref) => /* @__PURE__ */ jsx(ShadeScope, { children: /* @__PURE__ */ jsx(ContextMenuPrimitive.SubContent, {
22
27
  ref,
23
- className: cn("z-50 min-w-[8rem] overflow-hidden rounded-menu border bg-popover p-1 text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-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-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95", className),
28
+ className: cn("data-[safe-area]:max-h-(--radix-context-menu-content-available-height) data-[safe-area]:max-w-(--radix-context-menu-content-available-width) data-[safe-area]:overflow-y-auto", "z-50 min-w-[8rem] overflow-hidden rounded-menu border bg-popover p-1 text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-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-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95", className),
29
+ ...safeAreaCollision(collisionBoundary, usePortalContainer()),
24
30
  ...props
25
31
  }) }));
26
32
  ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;
27
- var ContextMenuContent = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(ContextMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(ShadeScope, { children: /* @__PURE__ */ jsx(ContextMenuPrimitive.Content, {
28
- ref,
29
- className: cn("z-50 min-w-[8rem] overflow-hidden rounded-menu border bg-popover p-1 text-popover-foreground shadow-md", "data-[side=bottom]:slide-in-from-top-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-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95", className),
30
- ...props
31
- }) }) }));
33
+ var ContextMenuContent = React$1.forwardRef(({ className, collisionBoundary, ...props }, ref) => /* @__PURE__ */ jsx(ContextMenuPrimitive.Portal, {
34
+ container: usePortalContainer(),
35
+ children: /* @__PURE__ */ jsx(ShadeScope, { children: /* @__PURE__ */ jsx(ContextMenuPrimitive.Content, {
36
+ ref,
37
+ className: cn("data-[safe-area]:max-h-(--radix-context-menu-content-available-height) data-[safe-area]:max-w-(--radix-context-menu-content-available-width) data-[safe-area]:overflow-y-auto", "z-50 min-w-[8rem] overflow-hidden rounded-menu border bg-popover p-1 text-popover-foreground shadow-md", "data-[side=bottom]:slide-in-from-top-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-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95", className),
38
+ ...safeAreaCollision(collisionBoundary, usePortalContainer()),
39
+ ...props
40
+ }) })
41
+ }));
32
42
  ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;
33
43
  var ContextMenuItem = React$1.forwardRef(({ className, inset, variant = "default", ...props }, ref) => /* @__PURE__ */ jsx(ContextMenuPrimitive.Item, {
34
44
  ref,
@@ -1 +1 @@
1
- {"version":3,"file":"context-menu.js","names":[],"sources":["../../../src/components/ui/context-menu.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as ContextMenuPrimitive from '@radix-ui/react-context-menu';\nimport { Check, ChevronRight, Circle } from 'lucide-react';\n\nimport { cn } from '@/lib/utils';\nimport { ShadeScope } from '@/shade-scope';\n\nconst ContextMenu = ContextMenuPrimitive.Root;\n\nconst ContextMenuTrigger = ContextMenuPrimitive.Trigger;\n\nconst ContextMenuGroup = ContextMenuPrimitive.Group;\n\nconst ContextMenuPortal = ContextMenuPrimitive.Portal;\n\nconst ContextMenuSub = ContextMenuPrimitive.Sub;\n\nconst ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;\n\nconst ContextMenuSubTrigger = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & {\n inset?: boolean;\n }\n>(({ className, inset, children, ...props }, ref) => (\n <ContextMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n 'flex cursor-default items-center gap-2 rounded-menu-item px-2 py-1.5 text-sm outline-hidden select-none hover:bg-accent focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',\n inset && 'pl-8',\n className,\n )}\n {...props}\n >\n {children}\n <ChevronRight className=\"ml-auto\" />\n </ContextMenuPrimitive.SubTrigger>\n));\nContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;\n\nconst ContextMenuSubContent = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n <ShadeScope>\n <ContextMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n 'z-50 min-w-[8rem] overflow-hidden rounded-menu border bg-popover p-1 text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-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-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95',\n className,\n )}\n {...props}\n />\n </ShadeScope>\n));\nContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;\n\nconst ContextMenuContent = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>\n>(({ className, ...props }, ref) => (\n <ContextMenuPrimitive.Portal>\n <ShadeScope>\n <ContextMenuPrimitive.Content\n ref={ref}\n className={cn(\n 'z-50 min-w-[8rem] overflow-hidden rounded-menu border bg-popover p-1 text-popover-foreground shadow-md',\n 'data-[side=bottom]:slide-in-from-top-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-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95',\n className,\n )}\n {...props}\n />\n </ShadeScope>\n </ContextMenuPrimitive.Portal>\n));\nContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;\n\nconst ContextMenuItem = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {\n inset?: boolean;\n variant?: 'default' | 'destructive';\n }\n>(({ className, inset, variant = 'default', ...props }, ref) => (\n <ContextMenuPrimitive.Item\n ref={ref}\n className={cn(\n 'relative flex cursor-pointer items-center gap-2 rounded-menu-item px-2 py-1.5 text-sm outline-hidden transition-colors select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0',\n variant === 'destructive' &&\n 'text-destructive focus:bg-destructive/10 focus:text-destructive',\n inset && 'pl-8',\n className,\n )}\n {...props}\n />\n));\nContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;\n\nconst ContextMenuCheckboxItem = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>\n>(({ className, children, checked, ...props }, ref) => (\n <ContextMenuPrimitive.CheckboxItem\n ref={ref}\n checked={checked}\n className={cn(\n 'relative flex cursor-default items-center rounded-menu-item py-1.5 pr-2 pl-8 text-sm outline-hidden transition-colors select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n className,\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex size-3.5 items-center justify-center\">\n <ContextMenuPrimitive.ItemIndicator>\n <Check className=\"size-4\" />\n </ContextMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </ContextMenuPrimitive.CheckboxItem>\n));\nContextMenuCheckboxItem.displayName = ContextMenuPrimitive.CheckboxItem.displayName;\n\nconst ContextMenuRadioItem = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.RadioItem>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n <ContextMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n 'relative flex cursor-default items-center rounded-menu-item py-1.5 pr-2 pl-8 text-sm outline-hidden transition-colors select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n className,\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex size-3.5 items-center justify-center\">\n <ContextMenuPrimitive.ItemIndicator>\n <Circle className=\"size-2 fill-current\" />\n </ContextMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </ContextMenuPrimitive.RadioItem>\n));\nContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;\n\nconst ContextMenuLabel = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & {\n inset?: boolean;\n }\n>(({ className, inset, ...props }, ref) => (\n <ContextMenuPrimitive.Label\n ref={ref}\n className={cn('px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', className)}\n {...props}\n />\n));\nContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;\n\nconst ContextMenuSeparator = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <ContextMenuPrimitive.Separator\n ref={ref}\n className={cn('-mx-1 my-1 h-px bg-muted', className)}\n {...props}\n />\n));\nContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;\n\nconst ContextMenuShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {\n return <span className={cn('ml-auto text-xs tracking-wider opacity-60', className)} {...props} />;\n};\nContextMenuShortcut.displayName = 'ContextMenuShortcut';\n\nexport {\n ContextMenu,\n ContextMenuTrigger,\n ContextMenuContent,\n ContextMenuItem,\n ContextMenuCheckboxItem,\n ContextMenuRadioItem,\n ContextMenuLabel,\n ContextMenuSeparator,\n ContextMenuShortcut,\n ContextMenuGroup,\n ContextMenuPortal,\n ContextMenuSub,\n ContextMenuSubContent,\n ContextMenuSubTrigger,\n ContextMenuRadioGroup,\n};\n"],"mappings":";;;;;;;AAOA,IAAM,cAAc,qBAAqB;AAEzC,IAAM,qBAAqB,qBAAqB;AAEhD,IAAM,mBAAmB,qBAAqB;AAE9C,IAAM,oBAAoB,qBAAqB;AAE/C,IAAM,iBAAiB,qBAAqB;AAE5C,IAAM,wBAAwB,qBAAqB;AAEnD,IAAM,wBAAwB,Q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;EACpC;AACD,wBAAwB,cAAc,qBAAqB,aAAa;AAExE,IAAM,uBAAuB,QAAM,YAGhC,EAAE,WAAW,UAAU,GAAG,SAAS,QACpC,qBAAC,qBAAqB,WAAtB;CACO;CACL,WAAW,GACT,iPACA,SACF;CACA,GAAI;WANN,CAQE,oBAAC,QAAD;EAAM,WAAU;YACd,oBAAC,qBAAqB,eAAtB,EAAA,UACE,oBAAC,QAAD,EAAQ,WAAU,sBAAuB,CAAA,EACP,CAAA;CAChC,CAAA,GACL,QAC6B;EACjC;AACD,qBAAqB,cAAc,qBAAqB,UAAU;AAElE,IAAM,mBAAmB,QAAM,YAK5B,EAAE,WAAW,OAAO,GAAG,SAAS,QACjC,oBAAC,qBAAqB,OAAtB;CACO;CACL,WAAW,GAAG,qCAAqC,SAAS,QAAQ,SAAS;CAC7E,GAAI;AACL,CAAA,CACF;AACD,iBAAiB,cAAc,qBAAqB,MAAM;AAE1D,IAAM,uBAAuB,QAAM,YAGhC,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,qBAAqB,WAAtB;CACO;CACL,WAAW,GAAG,4BAA4B,SAAS;CACnD,GAAI;AACL,CAAA,CACF;AACD,qBAAqB,cAAc,qBAAqB,UAAU;AAElE,IAAM,uBAAuB,EAAE,WAAW,GAAG,YAAmD;CAC9F,OAAO,oBAAC,QAAD;EAAM,WAAW,GAAG,6CAA6C,SAAS;EAAG,GAAI;CAAQ,CAAA;AAClG;AACA,oBAAoB,cAAc"}
1
+ {"version":3,"file":"context-menu.js","names":[],"sources":["../../../src/components/ui/context-menu.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as ContextMenuPrimitive from '@radix-ui/react-context-menu';\nimport { Check, ChevronRight, Circle } from 'lucide-react';\n\nimport { usePortalContainer } from '@/lib/app-overlay';\nimport { cn } from '@/lib/utils';\nimport { ShadeScope } from '@/shade-scope';\nimport { safeAreaCollision } from '@/lib/safe-area';\n\nconst ContextMenu = ContextMenuPrimitive.Root;\n\nconst ContextMenuTrigger = ContextMenuPrimitive.Trigger;\n\nconst ContextMenuGroup = ContextMenuPrimitive.Group;\n\nconst ContextMenuPortal = (props: React.ComponentProps<typeof ContextMenuPrimitive.Portal>) => (\n <ContextMenuPrimitive.Portal container={usePortalContainer()} {...props} />\n);\n\nconst ContextMenuSub = ContextMenuPrimitive.Sub;\n\nconst ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;\n\nconst ContextMenuSubTrigger = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & {\n inset?: boolean;\n }\n>(({ className, inset, children, ...props }, ref) => (\n <ContextMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n 'flex cursor-default items-center gap-2 rounded-menu-item px-2 py-1.5 text-sm outline-hidden select-none hover:bg-accent focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',\n inset && 'pl-8',\n className,\n )}\n {...props}\n >\n {children}\n <ChevronRight className=\"ml-auto\" />\n </ContextMenuPrimitive.SubTrigger>\n));\nContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;\n\nconst ContextMenuSubContent = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>\n>(({ className, collisionBoundary, ...props }, ref) => (\n <ShadeScope>\n <ContextMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n 'data-[safe-area]:max-h-(--radix-context-menu-content-available-height) data-[safe-area]:max-w-(--radix-context-menu-content-available-width) data-[safe-area]:overflow-y-auto',\n 'z-50 min-w-[8rem] overflow-hidden rounded-menu border bg-popover p-1 text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-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-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95',\n className,\n )}\n {...safeAreaCollision(collisionBoundary, usePortalContainer())}\n {...props}\n />\n </ShadeScope>\n));\nContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;\n\nconst ContextMenuContent = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>\n>(({ className, collisionBoundary, ...props }, ref) => (\n <ContextMenuPrimitive.Portal container={usePortalContainer()}>\n <ShadeScope>\n <ContextMenuPrimitive.Content\n ref={ref}\n className={cn(\n 'data-[safe-area]:max-h-(--radix-context-menu-content-available-height) data-[safe-area]:max-w-(--radix-context-menu-content-available-width) data-[safe-area]:overflow-y-auto',\n 'z-50 min-w-[8rem] overflow-hidden rounded-menu border bg-popover p-1 text-popover-foreground shadow-md',\n 'data-[side=bottom]:slide-in-from-top-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-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95',\n className,\n )}\n {...safeAreaCollision(collisionBoundary, usePortalContainer())}\n {...props}\n />\n </ShadeScope>\n </ContextMenuPrimitive.Portal>\n));\nContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;\n\nconst ContextMenuItem = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {\n inset?: boolean;\n variant?: 'default' | 'destructive';\n }\n>(({ className, inset, variant = 'default', ...props }, ref) => (\n <ContextMenuPrimitive.Item\n ref={ref}\n className={cn(\n 'relative flex cursor-pointer items-center gap-2 rounded-menu-item px-2 py-1.5 text-sm outline-hidden transition-colors select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0',\n variant === 'destructive' &&\n 'text-destructive focus:bg-destructive/10 focus:text-destructive',\n inset && 'pl-8',\n className,\n )}\n {...props}\n />\n));\nContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;\n\nconst ContextMenuCheckboxItem = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>\n>(({ className, children, checked, ...props }, ref) => (\n <ContextMenuPrimitive.CheckboxItem\n ref={ref}\n checked={checked}\n className={cn(\n 'relative flex cursor-default items-center rounded-menu-item py-1.5 pr-2 pl-8 text-sm outline-hidden transition-colors select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n className,\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex size-3.5 items-center justify-center\">\n <ContextMenuPrimitive.ItemIndicator>\n <Check className=\"size-4\" />\n </ContextMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </ContextMenuPrimitive.CheckboxItem>\n));\nContextMenuCheckboxItem.displayName = ContextMenuPrimitive.CheckboxItem.displayName;\n\nconst ContextMenuRadioItem = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.RadioItem>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n <ContextMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n 'relative flex cursor-default items-center rounded-menu-item py-1.5 pr-2 pl-8 text-sm outline-hidden transition-colors select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n className,\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex size-3.5 items-center justify-center\">\n <ContextMenuPrimitive.ItemIndicator>\n <Circle className=\"size-2 fill-current\" />\n </ContextMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </ContextMenuPrimitive.RadioItem>\n));\nContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;\n\nconst ContextMenuLabel = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & {\n inset?: boolean;\n }\n>(({ className, inset, ...props }, ref) => (\n <ContextMenuPrimitive.Label\n ref={ref}\n className={cn('px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', className)}\n {...props}\n />\n));\nContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;\n\nconst ContextMenuSeparator = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <ContextMenuPrimitive.Separator\n ref={ref}\n className={cn('-mx-1 my-1 h-px bg-muted', className)}\n {...props}\n />\n));\nContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;\n\nconst ContextMenuShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {\n return <span className={cn('ml-auto text-xs tracking-wider opacity-60', className)} {...props} />;\n};\nContextMenuShortcut.displayName = 'ContextMenuShortcut';\n\nexport {\n ContextMenu,\n ContextMenuTrigger,\n ContextMenuContent,\n ContextMenuItem,\n ContextMenuCheckboxItem,\n ContextMenuRadioItem,\n ContextMenuLabel,\n ContextMenuSeparator,\n ContextMenuShortcut,\n ContextMenuGroup,\n ContextMenuPortal,\n ContextMenuSub,\n ContextMenuSubContent,\n ContextMenuSubTrigger,\n ContextMenuRadioGroup,\n};\n"],"mappings":";;;;;;;;;AASA,IAAM,cAAc,qBAAqB;AAEzC,IAAM,qBAAqB,qBAAqB;AAEhD,IAAM,mBAAmB,qBAAqB;AAE9C,IAAM,qBAAqB,UACzB,oBAAC,qBAAqB,QAAtB;CAA6B,WAAW,mBAAmB;CAAG,GAAI;AAAQ,CAAA;AAG5E,IAAM,iBAAiB,qBAAqB;AAE5C,IA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,WAAW,GACT,iPACA,SACF;CACA,GAAI;WAPN,CASE,oBAAC,QAAD;EAAM,WAAU;YACd,oBAAC,qBAAqB,eAAtB,EAAA,UACE,oBAAC,OAAD,EAAO,WAAU,SAAU,CAAA,EACO,CAAA;CAChC,CAAA,GACL,QACgC;EACpC;AACD,wBAAwB,cAAc,qBAAqB,aAAa;AAExE,IAAM,uBAAuB,QAAM,YAGhC,EAAE,WAAW,UAAU,GAAG,SAAS,QACpC,qBAAC,qBAAqB,WAAtB;CACO;CACL,WAAW,GACT,iPACA,SACF;CACA,GAAI;WANN,CAQE,oBAAC,QAAD;EAAM,WAAU;YACd,oBAAC,qBAAqB,eAAtB,EAAA,UACE,oBAAC,QAAD,EAAQ,WAAU,sBAAuB,CAAA,EACP,CAAA;CAChC,CAAA,GACL,QAC6B;EACjC;AACD,qBAAqB,cAAc,qBAAqB,UAAU;AAElE,IAAM,mBAAmB,QAAM,YAK5B,EAAE,WAAW,OAAO,GAAG,SAAS,QACjC,oBAAC,qBAAqB,OAAtB;CACO;CACL,WAAW,GAAG,qCAAqC,SAAS,QAAQ,SAAS;CAC7E,GAAI;AACL,CAAA,CACF;AACD,iBAAiB,cAAc,qBAAqB,MAAM;AAE1D,IAAM,uBAAuB,QAAM,YAGhC,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,qBAAqB,WAAtB;CACO;CACL,WAAW,GAAG,4BAA4B,SAAS;CACnD,GAAI;AACL,CAAA,CACF;AACD,qBAAqB,cAAc,qBAAqB,UAAU;AAElE,IAAM,uBAAuB,EAAE,WAAW,GAAG,YAAmD;CAC9F,OAAO,oBAAC,QAAD;EAAM,WAAW,GAAG,6CAA6C,SAAS;EAAG,GAAI;CAAQ,CAAA;AAClG;AACA,oBAAoB,cAAc"}
@@ -1,5 +1,4 @@
1
1
  import { cn } from "../../lib/ds-utils.js";
2
- import { useShade } from "../../providers/shade-context.js";
3
2
  import { Inline } from "../primitives/inline.js";
4
3
  import { Stack } from "../primitives/stack.js";
5
4
  import { Text } from "../primitives/text.js";
@@ -83,7 +82,7 @@ var CopyFieldLabel = React$1.forwardRef(({ className, id, ...props }, ref) => {
83
82
  CopyFieldLabel.displayName = "CopyFieldLabel";
84
83
  var CopyFieldContent = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", {
85
84
  ref,
86
- className: cn(inputSurface("within"), "group/copy-field-content relative flex h-(--control-height) w-full items-center overflow-hidden bg-control-readonly-surface px-3 py-1 group-data-[disabled=true]/copy-field:cursor-not-allowed group-data-[disabled=true]/copy-field:opacity-50", className),
85
+ className: cn(inputSurface("within"), "group/copy-field-content relative flex h-(--control-height) w-full items-center overflow-hidden bg-field-readonly-surface px-3 py-1 group-data-[disabled=true]/copy-field:cursor-not-allowed group-data-[disabled=true]/copy-field:opacity-50", className),
87
86
  "data-slot": "copy-field-content",
88
87
  ...props
89
88
  }));
@@ -107,10 +106,9 @@ var CopyFieldValue = React$1.forwardRef(({ children, className, ...props }, ref)
107
106
  });
108
107
  CopyFieldValue.displayName = "CopyFieldValue";
109
108
  var CopyFieldActions = React$1.forwardRef(({ className, ...props }, ref) => {
110
- const { isAdmin7 } = useShade();
111
109
  return /* @__PURE__ */ jsx(Inline, {
112
110
  ref,
113
- className: cn("absolute top-1/2 right-[1px] -translate-y-1/2 gap-px bg-control-readonly-surface pl-1 transition-opacity md:pointer-events-none md:opacity-0 md:group-focus-within/copy-field-content:pointer-events-auto md:group-focus-within/copy-field-content:opacity-100 md:group-hover/copy-field-content:pointer-events-auto md:group-hover/copy-field-content:opacity-100 [&_button:not([data-slot=copy-field-copy-button])]:bg-control-readonly-surface [&_button:not([data-slot=copy-field-copy-button])]:hover:bg-secondary [&_button[data-control-shape=rounded]]:rounded-sm", isAdmin7 ? "[&_button]:h-6" : "[&_button]:h-7", className),
111
+ className: cn("absolute top-1/2 right-[1px] -translate-y-1/2 gap-px bg-field-readonly-surface pl-1 transition-opacity md:pointer-events-none md:opacity-0 md:group-focus-within/copy-field-content:pointer-events-auto md:group-focus-within/copy-field-content:opacity-100 md:group-hover/copy-field-content:pointer-events-auto md:group-hover/copy-field-content:opacity-100 [&_button]:h-6 [&_button:not([data-slot=copy-field-copy-button])]:bg-field-readonly-surface [&_button:not([data-slot=copy-field-copy-button])]:hover:bg-secondary [&_button[data-control-shape=rounded]]:rounded-sm", className),
114
112
  "data-slot": "copy-field-actions",
115
113
  gap: "none",
116
114
  ...props
@@ -1 +1 @@
1
- {"version":3,"file":"copy-field.js","names":[],"sources":["../../../src/components/ui/copy-field.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Inline, Stack, Text } from '@/components/primitives';\nimport { Button, type ButtonProps } from '@/components/ui/button';\nimport { inputSurface } from '@/components/ui/input-surface';\nimport { cn } from '@/lib/utils';\nimport { useShade } from '@/providers/shade-context';\n\ntype CopyFieldContextValue = {\n copied: boolean;\n copy: () => Promise<void>;\n disabled: boolean;\n labelId: string;\n value: string;\n};\n\nconst CopyFieldContext = React.createContext<CopyFieldContextValue | null>(null);\n\nfunction useCopyField() {\n const context = React.useContext(CopyFieldContext);\n\n if (!context) {\n throw new Error('CopyField subcomponents must be used within CopyField');\n }\n\n return context;\n}\n\ninterface CopyFieldProps extends React.HTMLAttributes<HTMLDivElement> {\n disabled?: boolean;\n value: string;\n}\n\nconst CopyField = React.forwardRef<HTMLDivElement, CopyFieldProps>(\n ({ children, className, disabled = false, value, ...props }, ref) => {\n const [copied, setCopied] = React.useState(false);\n const labelId = React.useId();\n const resetTimer = React.useRef<ReturnType<typeof setTimeout> | null>(null);\n\n React.useEffect(() => {\n setCopied(false);\n\n if (resetTimer.current) {\n clearTimeout(resetTimer.current);\n resetTimer.current = null;\n }\n }, [value]);\n\n React.useEffect(() => {\n return () => {\n if (resetTimer.current) {\n clearTimeout(resetTimer.current);\n }\n };\n }, []);\n\n const copy = React.useCallback(async () => {\n if (disabled) {\n return;\n }\n\n try {\n await navigator.clipboard.writeText(value);\n setCopied(true);\n\n if (resetTimer.current) {\n clearTimeout(resetTimer.current);\n }\n\n resetTimer.current = setTimeout(() => setCopied(false), 2000);\n } catch {\n setCopied(false);\n }\n }, [disabled, value]);\n\n const contextValue = React.useMemo(\n () => ({ copied, copy, disabled, labelId, value }),\n [copied, copy, disabled, labelId, value],\n );\n\n return (\n <CopyFieldContext.Provider value={contextValue}>\n <Stack\n ref={ref}\n className={cn('group/copy-field w-full', className)}\n data-disabled={disabled || undefined}\n data-slot=\"copy-field\"\n gap=\"xs\"\n {...props}\n >\n {children}\n </Stack>\n </CopyFieldContext.Provider>\n );\n },\n);\nCopyField.displayName = 'CopyField';\n\nconst CopyFieldLabel = React.forwardRef<HTMLElement, React.ComponentProps<typeof Text>>(\n ({ className, id, ...props }, ref) => {\n const { labelId } = useCopyField();\n\n return (\n <Text\n ref={ref}\n as=\"div\"\n className={cn(\n 'text-control! font-medium group-data-[disabled=true]/copy-field:opacity-50',\n className,\n )}\n data-slot=\"copy-field-label\"\n id={id || labelId}\n leading=\"snug\"\n {...props}\n />\n );\n },\n);\nCopyFieldLabel.displayName = 'CopyFieldLabel';\n\nconst CopyFieldContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n inputSurface('within'),\n 'group/copy-field-content relative flex h-(--control-height) w-full items-center overflow-hidden bg-control-readonly-surface px-3 py-1 group-data-[disabled=true]/copy-field:cursor-not-allowed group-data-[disabled=true]/copy-field:opacity-50',\n className,\n )}\n data-slot=\"copy-field-content\"\n {...props}\n />\n ),\n);\nCopyFieldContent.displayName = 'CopyFieldContent';\n\nconst CopyFieldValue = React.forwardRef<HTMLElement, React.ComponentProps<typeof Text>>(\n ({ children, className, ...props }, ref) => {\n const { disabled, labelId, value } = useCopyField();\n\n return (\n <Text\n ref={ref}\n aria-disabled={disabled || undefined}\n aria-labelledby={\n props['aria-label'] || props['aria-labelledby'] ? props['aria-labelledby'] : labelId\n }\n aria-readonly=\"true\"\n as=\"div\"\n className={cn('min-w-0 truncate pr-2 text-muted-foreground', className)}\n data-slot=\"copy-field-value\"\n leading=\"snug\"\n role=\"textbox\"\n tabIndex={disabled ? undefined : 0}\n {...props}\n >\n {children ?? value}\n </Text>\n );\n },\n);\nCopyFieldValue.displayName = 'CopyFieldValue';\n\nconst CopyFieldActions = React.forwardRef<HTMLElement, React.ComponentProps<typeof Inline>>(\n ({ className, ...props }, ref) => {\n const { isAdmin7 } = useShade();\n\n return (\n <Inline\n ref={ref}\n className={cn(\n 'absolute top-1/2 right-[1px] -translate-y-1/2 gap-px bg-control-readonly-surface pl-1 transition-opacity md:pointer-events-none md:opacity-0 md:group-focus-within/copy-field-content:pointer-events-auto md:group-focus-within/copy-field-content:opacity-100 md:group-hover/copy-field-content:pointer-events-auto md:group-hover/copy-field-content:opacity-100 [&_button:not([data-slot=copy-field-copy-button])]:bg-control-readonly-surface [&_button:not([data-slot=copy-field-copy-button])]:hover:bg-secondary [&_button[data-control-shape=rounded]]:rounded-sm',\n isAdmin7 ? '[&_button]:h-6' : '[&_button]:h-7',\n className,\n )}\n data-slot=\"copy-field-actions\"\n gap=\"none\"\n {...props}\n />\n );\n },\n);\nCopyFieldActions.displayName = 'CopyFieldActions';\n\ninterface CopyFieldCopyButtonProps extends Omit<ButtonProps, 'children'> {\n children?: React.ReactNode;\n copiedLabel?: React.ReactNode;\n}\n\nconst CopyFieldCopyButton = React.forwardRef<HTMLButtonElement, CopyFieldCopyButtonProps>(\n ({ children = 'Copy', className, copiedLabel = 'Copied', disabled, onClick, ...props }, ref) => {\n const { copied, copy, disabled: fieldDisabled } = useCopyField();\n\n return (\n <Button\n ref={ref}\n className={cn(\n 'bg-surface-elevated hover:border-border-strong/40 hover:bg-surface-elevated',\n className,\n )}\n disabled={fieldDisabled || disabled}\n size=\"sm\"\n type=\"button\"\n variant=\"outline\"\n onClick={async (event) => {\n await copy();\n onClick?.(event);\n }}\n {...props}\n data-slot=\"copy-field-copy-button\"\n >\n {copied ? copiedLabel : children}\n </Button>\n );\n },\n);\nCopyFieldCopyButton.displayName = 'CopyFieldCopyButton';\n\nexport {\n CopyField,\n CopyFieldActions,\n CopyFieldContent,\n CopyFieldCopyButton,\n CopyFieldLabel,\n CopyFieldValue,\n};\nexport type { CopyFieldProps };\n"],"mappings":";;;;;;;;;;AAgBA,IAAM,mBAAmB,QAAM,cAA4C,IAAI;AAE/E,SAAS,eAAe;CACtB,MAAM,UAAU,QAAM,WAAW,gBAAgB;CAEjD,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,uDAAuD;CAGzE,OAAO;AACT;AAOA,IAAM,YAAY,QAAM,YACrB,EAAE,UAAU,WAAW,WAAW,OAAO,OAAO,GAAG,SAAS,QAAQ;CACnE,MAAM,CAAC,QAAQ,aAAa,QAAM,SAAS,KAAK;CAChD,MAAM,UAAU,QAAM,MAAM;CAC5B,MAAM,aAAa,QAAM,OAA6C,IAAI;CAE1E,QAAM,gBAAgB;EACpB,UAAU,KAAK;EAEf,IAAI,WAAW,SAAS;GACtB,aAAa,WAAW,OAAO;GAC/B,WAAW,UAAU;EACvB;CACF,GAAG,CAAC,KAAK,CAAC;CAEV,QAAM,gBAAgB;EACpB,aAAa;GACX,IAAI,WAAW,SACb,aAAa,WAAW,OAAO;EAEnC;CACF,GAAG,CAAC,CAAC;CAEL,MAAM,OAAO,QAAM,YAAY,YAAY;EACzC,IAAI,UACF;EAGF,IAAI;GACF,MAAM,UAAU,UAAU,UAAU,KAAK;GACzC,UAAU,IAAI;GAEd,IAAI,WAAW,SACb,aAAa,WAAW,OAAO;GAGjC,WAAW,UAAU,iBAAiB,UAAU,KAAK,GAAG,GAAI;EAC9D,QAAQ;GACN,UAAU,KAAK;EACjB;CACF,GAAG,CAAC,UAAU,KAAK,CAAC;CAEpB,MAAM,eAAe,QAAM,eAClB;EAAE;EAAQ;EAAM;EAAU;EAAS;CAAM,IAChD;EAAC;EAAQ;EAAM;EAAU;EAAS;CAAK,CACzC;CAEA,OACE,oBAAC,iBAAiB,UAAl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V,KAAI;EACJ,GAAI;CACL,CAAA;AAEL,CACF;AACA,iBAAiB,cAAc;AAO/B,IAAM,sBAAsB,QAAM,YAC/B,EAAE,WAAW,QAAQ,WAAW,cAAc,UAAU,UAAU,SAAS,GAAG,SAAS,QAAQ;CAC9F,MAAM,EAAE,QAAQ,MAAM,UAAU,kBAAkB,aAAa;CAE/D,OACE,oBAAC,QAAD;EACO;EACL,WAAW,GACT,+EACA,SACF;EACA,UAAU,iBAAiB;EAC3B,MAAK;EACL,MAAK;EACL,SAAQ;EACR,SAAS,OAAO,UAAU;GACxB,MAAM,KAAK;GACX,UAAU,KAAK;EACjB;EACA,GAAI;EACJ,aAAU;YAET,SAAS,cAAc;CAClB,CAAA;AAEZ,CACF;AACA,oBAAoB,cAAc"}
1
+ {"version":3,"file":"copy-field.js","names":[],"sources":["../../../src/components/ui/copy-field.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Inline, Stack, Text } from '@/components/primitives';\nimport { Button, type ButtonProps } from '@/components/ui/button';\nimport { inputSurface } from '@/components/ui/input-surface';\nimport { cn } from '@/lib/utils';\n\ntype CopyFieldContextValue = {\n copied: boolean;\n copy: () => Promise<void>;\n disabled: boolean;\n labelId: string;\n value: string;\n};\n\nconst CopyFieldContext = React.createContext<CopyFieldContextValue | null>(null);\n\nfunction useCopyField() {\n const context = React.useContext(CopyFieldContext);\n\n if (!context) {\n throw new Error('CopyField subcomponents must be used within CopyField');\n }\n\n return context;\n}\n\ninterface CopyFieldProps extends React.HTMLAttributes<HTMLDivElement> {\n disabled?: boolean;\n value: string;\n}\n\nconst CopyField = React.forwardRef<HTMLDivElement, CopyFieldProps>(\n ({ children, className, disabled = false, value, ...props }, ref) => {\n const [copied, setCopied] = React.useState(false);\n const labelId = React.useId();\n const resetTimer = React.useRef<ReturnType<typeof setTimeout> | null>(null);\n\n React.useEffect(() => {\n setCopied(false);\n\n if (resetTimer.current) {\n clearTimeout(resetTimer.current);\n resetTimer.current = null;\n }\n }, [value]);\n\n React.useEffect(() => {\n return () => {\n if (resetTimer.current) {\n clearTimeout(resetTimer.current);\n }\n };\n }, []);\n\n const copy = React.useCallback(async () => {\n if (disabled) {\n return;\n }\n\n try {\n await navigator.clipboard.writeText(value);\n setCopied(true);\n\n if (resetTimer.current) {\n clearTimeout(resetTimer.current);\n }\n\n resetTimer.current = setTimeout(() => setCopied(false), 2000);\n } catch {\n setCopied(false);\n }\n }, [disabled, value]);\n\n const contextValue = React.useMemo(\n () => ({ copied, copy, disabled, labelId, value }),\n [copied, copy, disabled, labelId, value],\n );\n\n return (\n <CopyFieldContext.Provider value={contextValue}>\n <Stack\n ref={ref}\n className={cn('group/copy-field w-full', className)}\n data-disabled={disabled || undefined}\n data-slot=\"copy-field\"\n gap=\"xs\"\n {...props}\n >\n {children}\n </Stack>\n </CopyFieldContext.Provider>\n );\n },\n);\nCopyField.displayName = 'CopyField';\n\nconst CopyFieldLabel = React.forwardRef<HTMLElement, React.ComponentProps<typeof Text>>(\n ({ className, id, ...props }, ref) => {\n const { labelId } = useCopyField();\n\n return (\n <Text\n ref={ref}\n as=\"div\"\n className={cn(\n 'text-control! font-medium group-data-[disabled=true]/copy-field:opacity-50',\n className,\n )}\n data-slot=\"copy-field-label\"\n id={id || labelId}\n leading=\"snug\"\n {...props}\n />\n );\n },\n);\nCopyFieldLabel.displayName = 'CopyFieldLabel';\n\nconst CopyFieldContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n inputSurface('within'),\n 'group/copy-field-content relative flex h-(--control-height) w-full items-center overflow-hidden bg-field-readonly-surface px-3 py-1 group-data-[disabled=true]/copy-field:cursor-not-allowed group-data-[disabled=true]/copy-field:opacity-50',\n className,\n )}\n data-slot=\"copy-field-content\"\n {...props}\n />\n ),\n);\nCopyFieldContent.displayName = 'CopyFieldContent';\n\nconst CopyFieldValue = React.forwardRef<HTMLElement, React.ComponentProps<typeof Text>>(\n ({ children, className, ...props }, ref) => {\n const { disabled, labelId, value } = useCopyField();\n\n return (\n <Text\n ref={ref}\n aria-disabled={disabled || undefined}\n aria-labelledby={\n props['aria-label'] || props['aria-labelledby'] ? props['aria-labelledby'] : labelId\n }\n aria-readonly=\"true\"\n as=\"div\"\n className={cn('min-w-0 truncate pr-2 text-muted-foreground', className)}\n data-slot=\"copy-field-value\"\n leading=\"snug\"\n role=\"textbox\"\n tabIndex={disabled ? undefined : 0}\n {...props}\n >\n {children ?? value}\n </Text>\n );\n },\n);\nCopyFieldValue.displayName = 'CopyFieldValue';\n\nconst CopyFieldActions = React.forwardRef<HTMLElement, React.ComponentProps<typeof Inline>>(\n ({ className, ...props }, ref) => {\n return (\n <Inline\n ref={ref}\n className={cn(\n 'absolute top-1/2 right-[1px] -translate-y-1/2 gap-px bg-field-readonly-surface pl-1 transition-opacity md:pointer-events-none md:opacity-0 md:group-focus-within/copy-field-content:pointer-events-auto md:group-focus-within/copy-field-content:opacity-100 md:group-hover/copy-field-content:pointer-events-auto md:group-hover/copy-field-content:opacity-100 [&_button]:h-6 [&_button:not([data-slot=copy-field-copy-button])]:bg-field-readonly-surface [&_button:not([data-slot=copy-field-copy-button])]:hover:bg-secondary [&_button[data-control-shape=rounded]]:rounded-sm',\n className,\n )}\n data-slot=\"copy-field-actions\"\n gap=\"none\"\n {...props}\n />\n );\n },\n);\nCopyFieldActions.displayName = 'CopyFieldActions';\n\ninterface CopyFieldCopyButtonProps extends Omit<ButtonProps, 'children'> {\n children?: React.ReactNode;\n copiedLabel?: React.ReactNode;\n}\n\nconst CopyFieldCopyButton = React.forwardRef<HTMLButtonElement, CopyFieldCopyButtonProps>(\n ({ children = 'Copy', className, copiedLabel = 'Copied', disabled, onClick, ...props }, ref) => {\n const { copied, copy, disabled: fieldDisabled } = useCopyField();\n\n return (\n <Button\n ref={ref}\n className={cn(\n 'bg-surface-elevated hover:border-border-strong/40 hover:bg-surface-elevated',\n className,\n )}\n disabled={fieldDisabled || disabled}\n size=\"sm\"\n type=\"button\"\n variant=\"outline\"\n onClick={async (event) => {\n await copy();\n onClick?.(event);\n }}\n {...props}\n data-slot=\"copy-field-copy-button\"\n >\n {copied ? copiedLabel : children}\n </Button>\n );\n },\n);\nCopyFieldCopyButton.displayName = 'CopyFieldCopyButton';\n\nexport {\n CopyField,\n CopyFieldActions,\n CopyFieldContent,\n CopyFieldCopyButton,\n CopyFieldLabel,\n CopyFieldValue,\n};\nexport type { CopyFieldProps };\n"],"mappings":";;;;;;;;;AAeA,IAAM,mBAAmB,QAAM,cAA4C,IAAI;AAE/E,SAAS,eAAe;CACtB,MAAM,UAAU,QAAM,WAAW,gBAAgB;CAEjD,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,uDAAuD;CAGzE,OAAO;AACT;AAOA,IAAM,YAAY,QAAM,YACrB,EAAE,UAAU,WAAW,WAAW,OAAO,OAAO,GAAG,SAAS,QAAQ;CACnE,MAAM,CAAC,QAAQ,aAAa,QAAM,SAAS,KAAK;CAChD,MAAM,UAAU,QAAM,MAAM;CAC5B,MAAM,aAAa,QAAM,OAA6C,IAAI;CAE1E,QAAM,gBAAgB;EACpB,UAAU,KAAK;EAEf,IAAI,WAAW,SAAS;GACtB,aAAa,WAAW,OAAO;GAC/B,WAAW,UAAU;EACvB;CACF,GAAG,CAAC,KAAK,CAAC;CAEV,QAAM,gBAAgB;EACpB,aAAa;GACX,IAAI,WAAW,SACb,aAAa,WAAW,OAAO;EAEnC;CACF,GAAG,CAAC,CAAC;CAEL,MAAM,OAAO,QAAM,YAAY,YAAY;EACzC,IAAI,UACF;EAGF,IAAI;GACF,MAAM,UAAU,UAAU,UAAU,KAAK;GACzC,UAAU,IAAI;GAEd,IAAI,WAAW,SACb,aAAa,WAAW,OAAO;GAGjC,WAAW,UAAU,iBAAiB,UAAU,KAAK,GAAG,GAAI;EAC9D,QAAQ;GACN,UAAU,KAAK;EACjB;CACF,GAAG,CAAC,UAAU,KAAK,CAAC;CAEpB,MAAM,eAAe,QAA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;CAChC,OACE,oBAAC,QAAD;EACO;EACL,WAAW,GACT,wjBACA,SACF;EACA,aAAU;EACV,KAAI;EACJ,GAAI;CACL,CAAA;AAEL,CACF;AACA,iBAAiB,cAAc;AAO/B,IAAM,sBAAsB,QAAM,YAC/B,EAAE,WAAW,QAAQ,WAAW,cAAc,UAAU,UAAU,SAAS,GAAG,SAAS,QAAQ;CAC9F,MAAM,EAAE,QAAQ,MAAM,UAAU,kBAAkB,aAAa;CAE/D,OACE,oBAAC,QAAD;EACO;EACL,WAAW,GACT,+EACA,SACF;EACA,UAAU,iBAAiB;EAC3B,MAAK;EACL,MAAK;EACL,SAAQ;EACR,SAAS,OAAO,UAAU;GACxB,MAAM,KAAK;GACX,UAAU,KAAK;EACjB;EACA,GAAI;EACJ,aAAU;YAET,SAAS,cAAc;CAClB,CAAA;AAEZ,CACF;AACA,oBAAoB,cAAc"}
@@ -1,5 +1,4 @@
1
1
  import { cn } from "../../lib/ds-utils.js";
2
- import { useShade } from "../../providers/shade-context.js";
3
2
  import React from "react";
4
3
  import { jsx } from "react/jsx-runtime";
5
4
  //#region src/components/ui/data-list.tsx
@@ -15,7 +14,7 @@ DataList.displayName = "DataList";
15
14
  var DataListHeader = React.forwardRef(({ children, className, ...props }, ref) => {
16
15
  return /* @__PURE__ */ jsx("div", {
17
16
  ref,
18
- className: cn("flex items-center justify-between gap-2 border-b p-2 text-xs font-medium tracking-wide text-muted-foreground uppercase", className),
17
+ className: cn("column-label flex items-center justify-between gap-2 border-b p-2 text-xs font-medium tracking-wide text-muted-foreground uppercase", className),
19
18
  ...props,
20
19
  children
21
20
  });
@@ -40,10 +39,9 @@ var DataListBody = React.forwardRef(({ children, className, ...props }, ref) =>
40
39
  });
41
40
  DataListBody.displayName = "DataListBody";
42
41
  var DataListRow = React.forwardRef(({ children, className, ...props }, ref) => {
43
- const { isAdmin7 } = useShade();
44
42
  return /* @__PURE__ */ jsx("div", {
45
43
  ref,
46
- className: cn("group/row relative flex items-center justify-between gap-3 py-0.5 before:absolute before:-inset-x-0.5 before:inset-y-0.5 before:z-0 before:bg-muted/60 before:opacity-0 hover:before:opacity-100", isAdmin7 ? "before:rounded-control" : "before:rounded-[6px]", className),
44
+ className: cn("group/row relative flex items-center justify-between gap-3 py-0.5 before:absolute before:-inset-x-0.5 before:inset-y-0.5 before:z-0 before:rounded-control before:bg-muted/60 before:opacity-0 hover:before:opacity-100", className),
47
45
  ...props,
48
46
  children
49
47
  });
@@ -1 +1 @@
1
- {"version":3,"file":"data-list.js","names":[],"sources":["../../../src/components/ui/data-list.tsx"],"sourcesContent":["import { useShade } from '@/providers/shade-context';\nimport { cn } from '@/lib/utils';\nimport React from 'react';\n\n/* Data List main component\n/* -------------------------------------------------------------------------- */\ninterface DataListProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataList = React.forwardRef<HTMLDivElement, DataListProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div ref={ref} className={cn('flex flex-col items-stretch', className)} {...props}>\n {children}\n </div>\n );\n },\n);\n\nDataList.displayName = 'DataList';\n\n/* Header\n/* -------------------------------------------------------------------------- */\ninterface DataListHeaderProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListHeader = React.forwardRef<HTMLDivElement, DataListHeaderProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\n 'flex items-center justify-between gap-2 border-b p-2 text-xs font-medium tracking-wide text-muted-foreground uppercase',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListHeader.displayName = 'DataListHeader';\n\n/* Head\n/* -------------------------------------------------------------------------- */\ninterface DataListHeadProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListHead = React.forwardRef<HTMLDivElement, DataListHeadProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div ref={ref} className={cn('', className)} {...props}>\n {children}\n </div>\n );\n },\n);\n\nDataListHead.displayName = 'DataListHead';\n\n/* Body\n/* -------------------------------------------------------------------------- */\ninterface DataListBodyProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListBody = React.forwardRef<HTMLDivElement, DataListBodyProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div ref={ref} className={cn('flex flex-col items-stretch pt-1.5', className)} {...props}>\n {children}\n </div>\n );\n },\n);\n\nDataListBody.displayName = 'DataListBody';\n\n/* Data row\n/* -------------------------------------------------------------------------- */\ninterface DataListRowProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListRow = React.forwardRef<HTMLDivElement, DataListRowProps>(\n ({ children, className, ...props }, ref) => {\n const { isAdmin7 } = useShade();\n return (\n <div\n ref={ref}\n className={cn(\n 'group/row relative flex items-center justify-between gap-3 py-0.5 before:absolute before:-inset-x-0.5 before:inset-y-0.5 before:z-0 before:bg-muted/60 before:opacity-0 hover:before:opacity-100',\n isAdmin7 ? 'before:rounded-control' : 'before:rounded-[6px]',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListRow.displayName = 'DataListRow';\n\n/* Bar\n/* -------------------------------------------------------------------------- */\ninterface DataListBarProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListBar = React.forwardRef<HTMLDivElement, DataListBarProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\n 'absolute inset-x-0 inset-y-1 z-0 origin-left rounded-[4px] bg-state-info/10 transition-all group-hover/row:bg-state-info/25 dark:bg-state-info/20 dark:group-hover/row:bg-state-info/35',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListBar.displayName = 'DataListBar';\n\n/* List item content\n/* -------------------------------------------------------------------------- */\ninterface DataListItemContentProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListItemContent = React.forwardRef<HTMLDivElement, DataListItemContentProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\n 'relative z-10 flex max-w-[calc(100%-32px)] min-w-0 items-center p-2 text-sm font-medium transition-[max-width] duration-300 ease-in-out group-hover/datalist:max-w-[calc(100%-100px)]',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListItemContent.displayName = 'DataListItemContent';\n\n/* Value\n/* -------------------------------------------------------------------------- */\ninterface DataListItemValueProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListItemValue = React.forwardRef<HTMLDivElement, DataListItemValueProps>(\n ({ children, className, ...props }, ref) => {\n // Apply animation styles when there are multiple children\n const childrenArray = React.Children.toArray(children);\n const hasMultipleChildren = childrenArray.length > 1;\n\n return (\n <div\n ref={ref}\n className={cn(\n 'z-10 flex items-center',\n // Apply animation styles when there are multiple children\n hasMultipleChildren &&\n '[&>[data-type=\"value-abs\"]]:transition-transform [&>[data-type=\"value-abs\"]]:duration-300 [&>[data-type=\"value-abs\"]]:group-hover/datalist:-translate-x-14',\n hasMultipleChildren &&\n '[&>[data-type=\"value-perc\"]]:invisible [&>[data-type=\"value-perc\"]]:absolute [&>[data-type=\"value-perc\"]]:right-0 [&>[data-type=\"value-perc\"]]:translate-x-14 [&>[data-type=\"value-perc\"]]:opacity-0 [&>[data-type=\"value-perc\"]]:transition-all [&>[data-type=\"value-perc\"]]:duration-300 [&>[data-type=\"value-perc\"]]:group-hover/datalist:visible [&>[data-type=\"value-perc\"]]:group-hover/datalist:translate-x-0 [&>[data-type=\"value-perc\"]]:group-hover/datalist:opacity-100',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListItemValue.displayName = 'DataListItemValue';\n\n/* Value absolute value, e.g. 996.178.341\n/* -------------------------------------------------------------------------- */\ninterface DataListItemValueAbsProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListItemValueAbs = React.forwardRef<HTMLDivElement, DataListItemValueAbsProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn('z-10 px-2 font-mono text-sm', className)}\n data-type=\"value-abs\"\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListItemValueAbs.displayName = 'DataListItemValueAbs';\n\n/* Value percentage value, e.g. 85%\n/* -------------------------------------------------------------------------- */\ninterface DataListItemValuePercProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListItemValuePerc = React.forwardRef<HTMLDivElement, DataListItemValuePercProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn('px-3 font-mono text-sm text-muted-foreground', className)}\n data-type=\"value-perc\"\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListItemValuePerc.displayName = 'DataListItemValuePerc';\n\n/* End of components\n/* -------------------------------------------------------------------------- */\nexport {\n DataList,\n DataListHeader,\n DataListHead,\n DataListBody,\n DataListRow,\n DataListBar,\n DataListItemContent,\n DataListItemValue,\n DataListItemValueAbs,\n DataListItemValuePerc,\n};\n"],"mappings":";;;;;AAWA,IAAM,WAAW,MAAM,YACpB,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EAAU;EAAK,WAAW,GAAG,+BAA+B,SAAS;EAAG,GAAI;EACzE;CACE,CAAA;AAET,CACF;AAEA,SAAS,cAAc;AASvB,IAAM,iBAAiB,MAAM,YAC1B,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EACO;EACL,WAAW,GACT,0HACA,SACF;EACA,GAAI;EAEH;CACE,CAAA;AAET,CACF;AAEA,eAAe,cAAc;AAS7B,IAAM,eAAe,MAAM,YACxB,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ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W,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EACO;EACL,WAAW,GAAG,+BAA+B,SAAS;EACtD,aAAU;EACV,GAAI;EAEH;CACE,CAAA;AAET,CACF;AAEA,qBAAqB,cAAc;AASnC,IAAM,wBAAwB,MAAM,YACjC,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EACO;EACL,WAAW,GAAG,gDAAgD,SAAS;EACvE,aAAU;EACV,GAAI;EAEH;CACE,CAAA;AAET,CACF;AAEA,sBAAsB,cAAc"}
1
+ {"version":3,"file":"data-list.js","names":[],"sources":["../../../src/components/ui/data-list.tsx"],"sourcesContent":["import { cn } from '@/lib/utils';\nimport React from 'react';\n\n/* Data List main component\n/* -------------------------------------------------------------------------- */\ninterface DataListProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataList = React.forwardRef<HTMLDivElement, DataListProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div ref={ref} className={cn('flex flex-col items-stretch', className)} {...props}>\n {children}\n </div>\n );\n },\n);\n\nDataList.displayName = 'DataList';\n\n/* Header\n/* -------------------------------------------------------------------------- */\ninterface DataListHeaderProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListHeader = React.forwardRef<HTMLDivElement, DataListHeaderProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\n 'column-label flex items-center justify-between gap-2 border-b p-2 text-xs font-medium tracking-wide text-muted-foreground uppercase',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListHeader.displayName = 'DataListHeader';\n\n/* Head\n/* -------------------------------------------------------------------------- */\ninterface DataListHeadProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListHead = React.forwardRef<HTMLDivElement, DataListHeadProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div ref={ref} className={cn('', className)} {...props}>\n {children}\n </div>\n );\n },\n);\n\nDataListHead.displayName = 'DataListHead';\n\n/* Body\n/* -------------------------------------------------------------------------- */\ninterface DataListBodyProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListBody = React.forwardRef<HTMLDivElement, DataListBodyProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div ref={ref} className={cn('flex flex-col items-stretch pt-1.5', className)} {...props}>\n {children}\n </div>\n );\n },\n);\n\nDataListBody.displayName = 'DataListBody';\n\n/* Data row\n/* -------------------------------------------------------------------------- */\ninterface DataListRowProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListRow = React.forwardRef<HTMLDivElement, DataListRowProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\n 'group/row relative flex items-center justify-between gap-3 py-0.5 before:absolute before:-inset-x-0.5 before:inset-y-0.5 before:z-0 before:rounded-control before:bg-muted/60 before:opacity-0 hover:before:opacity-100',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListRow.displayName = 'DataListRow';\n\n/* Bar\n/* -------------------------------------------------------------------------- */\ninterface DataListBarProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListBar = React.forwardRef<HTMLDivElement, DataListBarProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\n 'absolute inset-x-0 inset-y-1 z-0 origin-left rounded-[4px] bg-state-info/10 transition-all group-hover/row:bg-state-info/25 dark:bg-state-info/20 dark:group-hover/row:bg-state-info/35',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListBar.displayName = 'DataListBar';\n\n/* List item content\n/* -------------------------------------------------------------------------- */\ninterface DataListItemContentProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListItemContent = React.forwardRef<HTMLDivElement, DataListItemContentProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\n 'relative z-10 flex max-w-[calc(100%-32px)] min-w-0 items-center p-2 text-sm font-medium transition-[max-width] duration-300 ease-in-out group-hover/datalist:max-w-[calc(100%-100px)]',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListItemContent.displayName = 'DataListItemContent';\n\n/* Value\n/* -------------------------------------------------------------------------- */\ninterface DataListItemValueProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListItemValue = React.forwardRef<HTMLDivElement, DataListItemValueProps>(\n ({ children, className, ...props }, ref) => {\n // Apply animation styles when there are multiple children\n const childrenArray = React.Children.toArray(children);\n const hasMultipleChildren = childrenArray.length > 1;\n\n return (\n <div\n ref={ref}\n className={cn(\n 'z-10 flex items-center',\n // Apply animation styles when there are multiple children\n hasMultipleChildren &&\n '[&>[data-type=\"value-abs\"]]:transition-transform [&>[data-type=\"value-abs\"]]:duration-300 [&>[data-type=\"value-abs\"]]:group-hover/datalist:-translate-x-14',\n hasMultipleChildren &&\n '[&>[data-type=\"value-perc\"]]:invisible [&>[data-type=\"value-perc\"]]:absolute [&>[data-type=\"value-perc\"]]:right-0 [&>[data-type=\"value-perc\"]]:translate-x-14 [&>[data-type=\"value-perc\"]]:opacity-0 [&>[data-type=\"value-perc\"]]:transition-all [&>[data-type=\"value-perc\"]]:duration-300 [&>[data-type=\"value-perc\"]]:group-hover/datalist:visible [&>[data-type=\"value-perc\"]]:group-hover/datalist:translate-x-0 [&>[data-type=\"value-perc\"]]:group-hover/datalist:opacity-100',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListItemValue.displayName = 'DataListItemValue';\n\n/* Value absolute value, e.g. 996.178.341\n/* -------------------------------------------------------------------------- */\ninterface DataListItemValueAbsProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListItemValueAbs = React.forwardRef<HTMLDivElement, DataListItemValueAbsProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn('z-10 px-2 font-mono text-sm', className)}\n data-type=\"value-abs\"\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListItemValueAbs.displayName = 'DataListItemValueAbs';\n\n/* Value percentage value, e.g. 85%\n/* -------------------------------------------------------------------------- */\ninterface DataListItemValuePercProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListItemValuePerc = React.forwardRef<HTMLDivElement, DataListItemValuePercProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn('px-3 font-mono text-sm text-muted-foreground', className)}\n data-type=\"value-perc\"\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListItemValuePerc.displayName = 'DataListItemValuePerc';\n\n/* End of components\n/* -------------------------------------------------------------------------- */\nexport {\n DataList,\n DataListHeader,\n DataListHead,\n DataListBody,\n DataListRow,\n DataListBar,\n DataListItemContent,\n DataListItemValue,\n DataListItemValueAbs,\n DataListItemValuePerc,\n};\n"],"mappings":";;;;AAUA,IAAM,WAAW,MAAM,YACpB,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EAAU;EAAK,WAAW,GAAG,+BAA+B,SAAS;EAAG,GAAI;EACzE;CACE,CAAA;AAET,CACF;AAEA,SAAS,cAAc;AASvB,IAAM,iBAAiB,MAAM,YAC1B,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EACO;EACL,WAAW,GACT,uIACA,SACF;EACA,GAAI;EAEH;CACE,CAAA;AAET,CACF;AAEA,eAAe,cAAc;AAS7B,IAAM,eAAe,MAAM,YACxB,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAA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AA+B,SAAS;EACtD,aAAU;EACV,GAAI;EAEH;CACE,CAAA;AAET,CACF;AAEA,qBAAqB,cAAc;AASnC,IAAM,wBAAwB,MAAM,YACjC,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EACO;EACL,WAAW,GAAG,gDAAgD,SAAS;EACvE,aAAU;EACV,GAAI;EAEH;CACE,CAAA;AAET,CACF;AAEA,sBAAsB,cAAc"}
@@ -1,25 +1,67 @@
1
1
  import { cn } from "../../lib/ds-utils.js";
2
2
  import { ShadeScope } from "../../shade-scope.js";
3
+ import { SAFE_AREA_DIALOG_HEIGHT, SAFE_AREA_DIALOG_X, overlayTint, useHostedModal, useModalOpen } from "../../lib/app-overlay.js";
4
+ import { keepOpenOnToast } from "../../lib/toast-press.js";
3
5
  import * as React$1 from "react";
4
- import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
5
7
  import * as DialogPrimitive from "@radix-ui/react-dialog";
6
8
  //#region src/components/ui/dialog.tsx
7
- var Dialog = DialogPrimitive.Root;
9
+ var Dialog = (props) => {
10
+ const [rootProps, provideOpen] = useModalOpen(props);
11
+ return provideOpen(/* @__PURE__ */ jsx(DialogPrimitive.Root, { ...rootProps }));
12
+ };
8
13
  var DialogTrigger = DialogPrimitive.Trigger;
9
14
  var DialogPortal = DialogPrimitive.Portal;
10
15
  var DialogClose = DialogPrimitive.Close;
11
16
  var DialogOverlay = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(DialogPrimitive.Overlay, {
12
17
  ref,
13
- className: cn("fixed inset-0 z-50 transform-gpu bg-black/30 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0 dark:bg-black/60", className),
18
+ className: cn("fixed inset-0 z-50 transform-gpu data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0", overlayTint("dialog"), className),
19
+ "data-slot": "dialog-overlay",
14
20
  ...props
15
21
  }));
16
22
  DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
17
- var DialogContent = React$1.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(DialogPortal, { children: /* @__PURE__ */ jsxs(ShadeScope, { children: [/* @__PURE__ */ jsx(DialogOverlay, {}), /* @__PURE__ */ jsx(DialogPrimitive.Content, {
18
- ref,
19
- className: cn("fixed top-[8vmin] left-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] transform-gpu gap-6 bg-surface-elevated-2 p-6 shadow-lg outline-hidden duration-200 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:rounded-lg", className),
20
- ...props,
21
- children
22
- })] }) }));
23
+ var fixedDialogClassName = cn("fixed top-[max(8vmin,var(--ghost-safe-area-inset-top,0px))] left-[50%] sm:rounded-lg", SAFE_AREA_DIALOG_X);
24
+ var inAppFixedDialogClassName = cn(SAFE_AREA_DIALOG_HEIGHT, "translate-y-[clamp(var(--ghost-safe-area-inset-top,0px)_-_max(8vmin,var(--ghost-safe-area-inset-top,0px)),0px,100dvh_-_var(--ghost-safe-area-inset-bottom,0px)_-_1rem_-_max(8vmin,var(--ghost-safe-area-inset-top,0px))_-_100%)]");
25
+ var scrollingDialogClassName = "pointer-events-auto relative rounded-lg";
26
+ var inAppScrollerClassName = "top-[var(--ghost-safe-area-inset-top,0px)] right-[var(--ghost-safe-area-inset-right,0px)] bottom-[var(--ghost-safe-area-inset-bottom,0px)] left-[var(--ghost-safe-area-inset-left,0px)]";
27
+ var inAppScrollingWrapperClassName = "@container pt-[max(0px,calc(8vmin_-_var(--ghost-safe-area-inset-top,0px)))] pb-[max(1rem,calc(8vmin_-_var(--ghost-safe-area-inset-bottom,0px)))]";
28
+ var inAppScrollingDialogClassName = "translate-x-[clamp((100%_-_100cqw)/2,(var(--ghost-safe-area-inset-right,0px)_-_var(--ghost-safe-area-inset-left,0px))/2,(100cqw_-_100%)/2)]";
29
+ var dialogPanelClassName = "z-50 grid w-full max-w-lg transform-gpu gap-6 bg-surface-elevated-2 p-6 shadow-lg [--sticky-footer-background:var(--surface-elevated-2)] outline-hidden duration-200 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95";
30
+ var DialogContent = React$1.forwardRef(({ className, children, scroll = "fixed", ...props }, ref) => {
31
+ const { container, inApp, modal, overlayStyle, ref: contentRef, wrap } = useHostedModal("dialog", ref);
32
+ const panel = wrap(/* @__PURE__ */ jsx(DialogPrimitive.Content, {
33
+ ref: contentRef,
34
+ className: cn(dialogPanelClassName, scroll === "overlay" ? scrollingDialogClassName : fixedDialogClassName, inApp && (scroll === "overlay" ? inAppScrollingDialogClassName : inAppFixedDialogClassName), className),
35
+ ...props,
36
+ onInteractOutside: (event) => keepOpenOnToast(event, props.onInteractOutside),
37
+ children
38
+ }));
39
+ const scrollingPanel = /* @__PURE__ */ jsx("div", {
40
+ className: cn("flex min-h-full items-start justify-center px-4 py-[8vmin]", inApp && inAppScrollingWrapperClassName),
41
+ children: panel
42
+ });
43
+ const scroller = cn("overflow-y-auto", inApp && inAppScrollerClassName);
44
+ return /* @__PURE__ */ jsx(DialogPortal, {
45
+ container,
46
+ children: /* @__PURE__ */ jsx(ShadeScope, { children: scroll === "overlay" ? modal ? inApp ? /* @__PURE__ */ jsx(DialogOverlay, {
47
+ className: "duration-200",
48
+ style: overlayStyle,
49
+ children: /* @__PURE__ */ jsx("div", {
50
+ className: cn("fixed z-50", scroller),
51
+ "data-slot": "dialog-scroller",
52
+ children: scrollingPanel
53
+ })
54
+ }) : /* @__PURE__ */ jsx(DialogOverlay, {
55
+ className: cn(scroller, "duration-200"),
56
+ style: overlayStyle,
57
+ children: scrollingPanel
58
+ }) : /* @__PURE__ */ jsx("div", {
59
+ className: cn("pointer-events-none fixed inset-0 z-50", scroller),
60
+ "data-slot": "dialog-scroller",
61
+ children: scrollingPanel
62
+ }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(DialogOverlay, { style: overlayStyle }), panel] }) })
63
+ });
64
+ });
23
65
  DialogContent.displayName = DialogPrimitive.Content.displayName;
24
66
  var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
25
67
  className: cn("flex flex-col gap-y-1.5 text-center sm:text-left", className),
@@ -27,13 +69,13 @@ var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
27
69
  });
28
70
  DialogHeader.displayName = "DialogHeader";
29
71
  var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
30
- className: cn("flex flex-col-reverse sm:flex-row sm:items-end sm:justify-end sm:gap-2 [&_button]:min-w-20", className),
72
+ className: cn("flex flex-col-reverse sm:flex-row sm:items-end sm:justify-end sm:gap-2", className),
31
73
  ...props
32
74
  });
33
75
  DialogFooter.displayName = "DialogFooter";
34
76
  var DialogTitle = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(DialogPrimitive.Title, {
35
77
  ref,
36
- className: cn("text-xl leading-none font-semibold tracking-tight", className),
78
+ className: cn("text-xl leading-none font-semibold tracking-tight in-data-[admin7-design=true]:font-title", className),
37
79
  ...props
38
80
  }));
39
81
  DialogTitle.displayName = DialogPrimitive.Title.displayName;
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.js","names":[],"sources":["../../../src/components/ui/dialog.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\n\nimport { cn } from '@/lib/utils';\nimport { ShadeScope } from '@/shade-scope';\n\nconst Dialog = DialogPrimitive.Root;\n\nconst DialogTrigger = DialogPrimitive.Trigger;\n\nconst DialogPortal = DialogPrimitive.Portal;\n\nconst DialogClose = DialogPrimitive.Close;\n\nconst DialogOverlay = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn(\n 'fixed inset-0 z-50 transform-gpu bg-black/30 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0 dark:bg-black/60',\n className,\n )}\n {...props}\n />\n));\nDialogOverlay.displayName = DialogPrimitive.Overlay.displayName;\n\nconst DialogContent = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>\n>(({ className, children, ...props }, ref) => (\n <DialogPortal>\n <ShadeScope>\n <DialogOverlay />\n <DialogPrimitive.Content\n ref={ref}\n className={cn(\n 'fixed top-[8vmin] left-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] transform-gpu gap-6 bg-surface-elevated-2 p-6 shadow-lg outline-hidden duration-200 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:rounded-lg',\n className,\n )}\n {...props}\n >\n {children}\n </DialogPrimitive.Content>\n </ShadeScope>\n </DialogPortal>\n));\nDialogContent.displayName = DialogPrimitive.Content.displayName;\n\nconst DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div className={cn('flex flex-col gap-y-1.5 text-center sm:text-left', className)} {...props} />\n);\nDialogHeader.displayName = 'DialogHeader';\n\nconst DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n className={cn(\n 'flex flex-col-reverse sm:flex-row sm:items-end sm:justify-end sm:gap-2 [&_button]:min-w-20',\n className,\n )}\n {...props}\n />\n);\nDialogFooter.displayName = 'DialogFooter';\n\nconst DialogTitle = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title\n ref={ref}\n className={cn('text-xl leading-none font-semibold tracking-tight', className)}\n {...props}\n />\n));\nDialogTitle.displayName = DialogPrimitive.Title.displayName;\n\nconst DialogDescription = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description\n ref={ref}\n className={cn('text-muted-foreground', className)}\n {...props}\n />\n));\nDialogDescription.displayName = DialogPrimitive.Description.displayName;\n\nexport {\n Dialog,\n DialogPortal,\n DialogOverlay,\n DialogTrigger,\n DialogClose,\n DialogContent,\n DialogHeader,\n DialogFooter,\n DialogTitle,\n DialogDescription,\n};\n"],"mappings":";;;;;;AAMA,IAAM,SAAS,gBAAgB;AAE/B,IAAM,gBAAgB,gBAAgB;AAEtC,IAAM,eAAe,gBAAgB;AAErC,IAAM,cAAc,gBAAgB;AAEpC,IAAM,gBAAgB,QAAM,YAGzB,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,gBAAgB,SAAjB;CACO;CACL,WAAW,GACT,yLACA,SACF;CACA,GAAI;AACL,CAAA,CACF;AACD,cAAc,cAAc,gBAAgB,QAAQ;AAEpD,IAAM,gBAAgB,QAAM,YAGzB,EAAE,WAAW,UAAU,GAAG,SAAS,QACpC,oBAAC,cAAD,EAAA,UACE,qBAAC,YAAD,EAAA,UAAA,CACE,oBAAC,eAAD,CAAgB,CAAA,GAChB,oBAAC,gBAAgB,SAAjB;CACO;CACL,WAAW,GACT,oWACA,SACF;CACA,GAAI;CAEH;AACsB,CAAA,CACf,EAAA,CAAA,EACA,CAAA,CACf;AACD,cAAc,cAAc,gBAAgB,QAAQ;AAEpD,IAAM,gBAAgB,EAAE,WAAW,GAAG,YACpC,oBAAC,OAAD;CAAK,WAAW,GAAG,oDAAoD,SAAS;CAAG,GAAI;AAAQ,CAAA;AAEjG,aAAa,cAAc;AAE3B,IAAM,gBAAgB,EAAE,WAAW,GAAG,YACpC,oBAAC,OAAD;CACE,WAAW,GACT,8FACA,SACF;CACA,GAAI;AACL,CAAA;AAEH,aAAa,cAAc;AAE3B,IAAM,cAAc,QAAM,YAGvB,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,gBAAgB,OAAjB;CACO;CACL,WAAW,GAAG,qDAAqD,SAAS;CAC5E,GAAI;AACL,CAAA,CACF;AACD,YAAY,cAAc,gBAAgB,MAAM;AAEhD,IAAM,oBAAoB,QAAM,YAG7B,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,gBAAgB,aAAjB;CACO;CACL,WAAW,GAAG,yBAAyB,SAAS;CAChD,GAAI;AACL,CAAA,CACF;AACD,kBAAkB,cAAc,gBAAgB,YAAY"}
1
+ {"version":3,"file":"dialog.js","names":[],"sources":["../../../src/components/ui/dialog.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\n\nimport {\n overlayTint,\n SAFE_AREA_DIALOG_HEIGHT,\n SAFE_AREA_DIALOG_X,\n useHostedModal,\n useModalOpen,\n} from '@/lib/app-overlay';\nimport { cn } from '@/lib/utils';\nimport { keepOpenOnToast } from '@/lib/toast-press';\nimport { ShadeScope } from '@/shade-scope';\n\nconst Dialog = (props: React.ComponentProps<typeof DialogPrimitive.Root>) => {\n const [rootProps, provideOpen] = useModalOpen(props);\n return provideOpen(<DialogPrimitive.Root {...rootProps} />);\n};\n\nconst DialogTrigger = DialogPrimitive.Trigger;\n\nconst DialogPortal = DialogPrimitive.Portal;\n\nconst DialogClose = DialogPrimitive.Close;\n\nconst DialogOverlay = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn(\n 'fixed inset-0 z-50 transform-gpu data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0',\n overlayTint('dialog'),\n className,\n )}\n data-slot=\"dialog-overlay\"\n {...props}\n />\n));\nDialogOverlay.displayName = DialogPrimitive.Overlay.displayName;\n\nconst fixedDialogClassName = cn(\n 'fixed top-[max(8vmin,var(--ghost-safe-area-inset-top,0px))] left-[50%] sm:rounded-lg',\n SAFE_AREA_DIALOG_X,\n);\n\n// Moves up only as far as it must to stay between the safe area's top and bottom.\nconst inAppFixedDialogClassName = cn(\n SAFE_AREA_DIALOG_HEIGHT,\n 'translate-y-[clamp(var(--ghost-safe-area-inset-top,0px)_-_max(8vmin,var(--ghost-safe-area-inset-top,0px)),0px,100dvh_-_var(--ghost-safe-area-inset-bottom,0px)_-_1rem_-_max(8vmin,var(--ghost-safe-area-inset-top,0px))_-_100%)]',\n);\n\nconst scrollingDialogClassName = 'pointer-events-auto relative rounded-lg';\n\n// The dialog keeps as near the window's centre as the safe area allows. It measures against its\n// wrapper, a size container, so the wrapper's padding and the scrollbar are allowed for.\nconst inAppScrollerClassName =\n 'top-[var(--ghost-safe-area-inset-top,0px)] right-[var(--ghost-safe-area-inset-right,0px)] bottom-[var(--ghost-safe-area-inset-bottom,0px)] left-[var(--ghost-safe-area-inset-left,0px)]';\nconst inAppScrollingWrapperClassName =\n '@container pt-[max(0px,calc(8vmin_-_var(--ghost-safe-area-inset-top,0px)))] pb-[max(1rem,calc(8vmin_-_var(--ghost-safe-area-inset-bottom,0px)))]';\nconst inAppScrollingDialogClassName =\n 'translate-x-[clamp((100%_-_100cqw)/2,(var(--ghost-safe-area-inset-right,0px)_-_var(--ghost-safe-area-inset-left,0px))/2,(100cqw_-_100%)/2)]';\n\n// The panel itself, shared by both ways a dialog can sit on the page.\nconst dialogPanelClassName =\n 'z-50 grid w-full max-w-lg transform-gpu gap-6 bg-surface-elevated-2 p-6 shadow-lg [--sticky-footer-background:var(--surface-elevated-2)] outline-hidden duration-200 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95';\n\nexport interface DialogContentProps extends React.ComponentPropsWithoutRef<\n typeof DialogPrimitive.Content\n> {\n /**\n * How a dialog taller than the window scrolls. `fixed` (the default) pins the dialog near\n * the top of the window, so it needs its own height limit and inner scroll. `overlay` makes\n * the backdrop the scroll container instead: the whole dialog scrolls as one piece, the way\n * a page does.\n */\n scroll?: 'fixed' | 'overlay';\n}\n\nconst DialogContent = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Content>,\n DialogContentProps\n>(({ className, children, scroll = 'fixed', ...props }, ref) => {\n const {\n container,\n inApp,\n modal,\n overlayStyle,\n ref: contentRef,\n wrap,\n } = useHostedModal('dialog', ref);\n\n // Wrapped outside the content, so an `asChild` content's element still gets Radix's props.\n const panel = wrap(\n <DialogPrimitive.Content\n ref={contentRef}\n className={cn(\n dialogPanelClassName,\n scroll === 'overlay' ? scrollingDialogClassName : fixedDialogClassName,\n inApp && (scroll === 'overlay' ? inAppScrollingDialogClassName : inAppFixedDialogClassName),\n className,\n )}\n {...props}\n onInteractOutside={(event) => keepOpenOnToast(event, props.onInteractOutside)}\n >\n {children}\n </DialogPrimitive.Content>,\n );\n\n // The space around the dialog is padding on this wrapper, not on the scroll container:\n // browsers leave a scroll container's own bottom padding out of what it scrolls, which\n // would leave the dialog flush with the bottom of the window.\n const scrollingPanel = (\n <div\n className={cn(\n 'flex min-h-full items-start justify-center px-4 py-[8vmin]',\n inApp && inAppScrollingWrapperClassName,\n )}\n >\n {panel}\n </div>\n );\n const scroller = cn('overflow-y-auto', inApp && inAppScrollerClassName);\n\n return (\n <DialogPortal container={container}>\n <ShadeScope>\n {scroll === 'overlay' ? (\n modal ? (\n // The dialog sits inside the backdrop here, so the backdrop animates as long as the\n // dialog does; otherwise closing unmounts the dialog part-way through its animation.\n inApp ? (\n <DialogOverlay className=\"duration-200\" style={overlayStyle}>\n <div className={cn('fixed z-50', scroller)} data-slot=\"dialog-scroller\">\n {scrollingPanel}\n </div>\n </DialogOverlay>\n ) : (\n <DialogOverlay className={cn(scroller, 'duration-200')} style={overlayStyle}>\n {scrollingPanel}\n </DialogOverlay>\n )\n ) : (\n // Radix renders no backdrop for a non-modal dialog, and the page behind stays\n // usable, so this scroll container lets presses beside the dialog through.\n <div\n className={cn('pointer-events-none fixed inset-0 z-50', scroller)}\n data-slot=\"dialog-scroller\"\n >\n {scrollingPanel}\n </div>\n )\n ) : (\n <>\n <DialogOverlay style={overlayStyle} />\n {panel}\n </>\n )}\n </ShadeScope>\n </DialogPortal>\n );\n});\nDialogContent.displayName = DialogPrimitive.Content.displayName;\n\nconst DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div className={cn('flex flex-col gap-y-1.5 text-center sm:text-left', className)} {...props} />\n);\nDialogHeader.displayName = 'DialogHeader';\n\nconst DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n className={cn(\n 'flex flex-col-reverse sm:flex-row sm:items-end sm:justify-end sm:gap-2',\n className,\n )}\n {...props}\n />\n);\nDialogFooter.displayName = 'DialogFooter';\n\nconst DialogTitle = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title\n ref={ref}\n className={cn(\n 'text-xl leading-none font-semibold tracking-tight in-data-[admin7-design=true]:font-title',\n className,\n )}\n {...props}\n />\n));\nDialogTitle.displayName = DialogPrimitive.Title.displayName;\n\nconst DialogDescription = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description\n ref={ref}\n className={cn('text-muted-foreground', className)}\n {...props}\n />\n));\nDialogDescription.displayName = DialogPrimitive.Description.displayName;\n\nexport {\n Dialog,\n DialogPortal,\n DialogOverlay,\n DialogTrigger,\n DialogClose,\n DialogContent,\n DialogHeader,\n DialogFooter,\n DialogTitle,\n DialogDescription,\n};\n"],"mappings":";;;;;;;;AAcA,IAAM,UAAU,UAA6D;CAC3E,MAAM,CAAC,WAAW,eAAe,aAAa,KAAK;CACnD,OAAO,YAAY,oBAAC,gBAAgB,MAAjB,EAAsB,GAAI,UAAY,CAAA,CAAC;AAC5D;AAEA,IAAM,gBAAgB,gBAAgB;AAEtC,IAAM,eAAe,gBAAgB;AAErC,IAAM,cAAc,gBAAgB;AAEpC,IAAM,gBAAgB,QAAM,YAGzB,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,gBAAgB,SAAjB;CACO;CACL,WAAW,GACT,4JACA,YAAY,QAAQ,GACpB,SACF;CACA,aAAU;CACV,GAAI;AACL,CAAA,CACF;AACD,cAAc,cAAc,gBAAgB,QAAQ;AAEpD,IAAM,uBAAuB,GAC3B,wFACA,kBACF;AAGA,IAAM,4BAA4B,GAChC,yBACA,kOACF;AAEA,IAAM,2BAA2B;AAIjC,IAAM,yBACJ;AACF,IAAM,iCACJ;AACF,IAAM,gCACJ;AAGF,IAAM,uBACJ;AAcF,IAAM,gBAAgB,QAAM,YAGzB,EAAE,WAAW,UAAU,SAAS,SAAS,GAAG,SAAS,QAAQ;CAC9D,MAAM,EACJ,WACA,OACA,OACA,cACA,KAAK,YACL,SACE,eAAe,UAAU,GAAG;CAGhC,MAAM,QAAQ,KACZ,oBAAC,gBAAgB,SAAjB;EACE,KAAK;EACL,WAAW,GACT,sBACA,WAAW,YAAY,2BAA2B,sBAClD,UAAU,WAAW,YAAY,gCAAgC,4BACjE,SACF;EACA,GAAI;EACJ,oBAAoB,UAAU,gBAAgB,OAAO,MAAM,iBAAiB;EAE3E;CACsB,CAAA,CAC3B;CAKA,MAAM,iBACJ,oBAAC,OAAD;EACE,WAAW,GACT,8DACA,SAAS,8BACX;YAEC;CACE,CAAA;CAEP,MAAM,WAAW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