@dxos/react-ui 0.8.4-main.67995b8 → 0.8.4-main.69d29f4

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 (312) hide show
  1. package/dist/lib/browser/chunk-CEKVHJ27.mjs +774 -0
  2. package/dist/lib/browser/chunk-CEKVHJ27.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +3069 -59
  4. package/dist/lib/browser/index.mjs.map +4 -4
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/testing/index.mjs +65 -49
  7. package/dist/lib/browser/testing/index.mjs.map +4 -4
  8. package/dist/lib/node-esm/chunk-2NHEX4AD.mjs +776 -0
  9. package/dist/lib/node-esm/chunk-2NHEX4AD.mjs.map +7 -0
  10. package/dist/lib/node-esm/index.mjs +3069 -59
  11. package/dist/lib/node-esm/index.mjs.map +4 -4
  12. package/dist/lib/node-esm/meta.json +1 -1
  13. package/dist/lib/node-esm/testing/index.mjs +65 -49
  14. package/dist/lib/node-esm/testing/index.mjs.map +4 -4
  15. package/dist/types/src/components/Avatars/Avatar.d.ts +1 -1
  16. package/dist/types/src/components/Avatars/Avatar.d.ts.map +1 -1
  17. package/dist/types/src/components/Avatars/Avatar.stories.d.ts +5 -31
  18. package/dist/types/src/components/Avatars/Avatar.stories.d.ts.map +1 -1
  19. package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts +5 -11
  20. package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts.map +1 -1
  21. package/dist/types/src/components/Breadcrumb/Breadcrumb.d.ts +1 -1
  22. package/dist/types/src/components/Breadcrumb/Breadcrumb.d.ts.map +1 -1
  23. package/dist/types/src/components/Breadcrumb/Breadcrumb.stories.d.ts +8 -20
  24. package/dist/types/src/components/Breadcrumb/Breadcrumb.stories.d.ts.map +1 -1
  25. package/dist/types/src/components/{Buttons → Button}/Button.d.ts +2 -2
  26. package/dist/types/src/components/Button/Button.d.ts.map +1 -0
  27. package/dist/types/src/components/Button/Button.stories.d.ts +17 -0
  28. package/dist/types/src/components/Button/Button.stories.d.ts.map +1 -0
  29. package/dist/types/src/components/{Buttons → Button}/IconButton.d.ts +4 -4
  30. package/dist/types/src/components/Button/IconButton.d.ts.map +1 -0
  31. package/dist/types/src/components/Button/IconButton.stories.d.ts +13 -0
  32. package/dist/types/src/components/Button/IconButton.stories.d.ts.map +1 -0
  33. package/dist/types/src/components/Button/Toggle.d.ts.map +1 -0
  34. package/dist/types/src/components/Button/Toggle.stories.d.ts +16 -0
  35. package/dist/types/src/components/Button/Toggle.stories.d.ts.map +1 -0
  36. package/dist/types/src/components/Button/ToggleGroup.d.ts +27 -0
  37. package/dist/types/src/components/Button/ToggleGroup.d.ts.map +1 -0
  38. package/dist/types/src/components/Button/ToggleGroup.stories.d.ts +27 -0
  39. package/dist/types/src/components/Button/ToggleGroup.stories.d.ts.map +1 -0
  40. package/dist/types/src/components/Button/index.d.ts.map +1 -0
  41. package/dist/types/src/components/Clipboard/ClipboardProvider.d.ts.map +1 -1
  42. package/dist/types/src/components/Clipboard/CopyButton.d.ts +1 -1
  43. package/dist/types/src/components/Clipboard/CopyButton.d.ts.map +1 -1
  44. package/dist/types/src/components/DensityProvider/DensityProvider.d.ts +1 -1
  45. package/dist/types/src/components/DensityProvider/DensityProvider.d.ts.map +1 -1
  46. package/dist/types/src/components/{Dialogs → Dialog}/AlertDialog.d.ts +1 -1
  47. package/dist/types/src/components/Dialog/AlertDialog.d.ts.map +1 -0
  48. package/dist/types/src/components/Dialog/AlertDialog.stories.d.ts +11 -0
  49. package/dist/types/src/components/Dialog/AlertDialog.stories.d.ts.map +1 -0
  50. package/dist/types/src/components/Dialog/Dialog.d.ts +40 -0
  51. package/dist/types/src/components/Dialog/Dialog.d.ts.map +1 -0
  52. package/dist/types/src/components/Dialog/Dialog.stories.d.ts +27 -0
  53. package/dist/types/src/components/Dialog/Dialog.stories.d.ts.map +1 -0
  54. package/dist/types/src/components/Dialog/index.d.ts.map +1 -0
  55. package/dist/types/src/components/ElevationProvider/ElevationProvider.d.ts +1 -1
  56. package/dist/types/src/components/ElevationProvider/ElevationProvider.d.ts.map +1 -1
  57. package/dist/types/src/components/Icon/Icon.d.ts +2 -2
  58. package/dist/types/src/components/Icon/Icon.d.ts.map +1 -1
  59. package/dist/types/src/components/Icon/Icon.stories.d.ts +17 -0
  60. package/dist/types/src/components/Icon/Icon.stories.d.ts.map +1 -0
  61. package/dist/types/src/components/Input/Input.d.ts +6 -5
  62. package/dist/types/src/components/Input/Input.d.ts.map +1 -1
  63. package/dist/types/src/components/Input/Input.stories.d.ts +11 -12
  64. package/dist/types/src/components/Input/Input.stories.d.ts.map +1 -1
  65. package/dist/types/src/components/Link/Link.stories.d.ts +8 -8
  66. package/dist/types/src/components/Link/Link.stories.d.ts.map +1 -1
  67. package/dist/types/src/components/{Lists → List}/List.d.ts +3 -3
  68. package/dist/types/src/components/List/List.d.ts.map +1 -0
  69. package/dist/types/src/components/List/List.stories.d.ts +14 -0
  70. package/dist/types/src/components/List/List.stories.d.ts.map +1 -0
  71. package/dist/types/src/components/List/ListDropIndicator.d.ts.map +1 -0
  72. package/dist/types/src/components/{Lists → List}/Tree.d.ts +1 -1
  73. package/dist/types/src/components/List/Tree.d.ts.map +1 -0
  74. package/dist/types/src/components/List/Tree.stories.d.ts +15 -0
  75. package/dist/types/src/components/List/Tree.stories.d.ts.map +1 -0
  76. package/dist/types/src/components/List/TreeDropIndicator.d.ts.map +1 -0
  77. package/dist/types/src/components/{Lists → List}/Treegrid.d.ts +1 -1
  78. package/dist/types/src/components/{Lists → List}/Treegrid.d.ts.map +1 -1
  79. package/dist/types/src/components/List/Treegrid.stories.d.ts +12 -0
  80. package/dist/types/src/components/List/Treegrid.stories.d.ts.map +1 -0
  81. package/dist/types/src/components/List/index.d.ts.map +1 -0
  82. package/dist/types/src/components/Main/Main.d.ts +10 -19
  83. package/dist/types/src/components/Main/Main.d.ts.map +1 -1
  84. package/dist/types/src/components/Main/Main.stories.d.ts +6 -7
  85. package/dist/types/src/components/Main/Main.stories.d.ts.map +1 -1
  86. package/dist/types/src/components/{Menus → Menu}/ContextMenu.d.ts +6 -6
  87. package/dist/types/src/components/Menu/ContextMenu.d.ts.map +1 -0
  88. package/dist/types/src/components/Menu/ContextMenu.stories.d.ts +12 -0
  89. package/dist/types/src/components/Menu/ContextMenu.stories.d.ts.map +1 -0
  90. package/dist/types/src/components/{Menus → Menu}/DropdownMenu.d.ts +8 -8
  91. package/dist/types/src/components/Menu/DropdownMenu.d.ts.map +1 -0
  92. package/dist/types/src/components/Menu/DropdownMenu.stories.d.ts +15 -0
  93. package/dist/types/src/components/Menu/DropdownMenu.stories.d.ts.map +1 -0
  94. package/dist/types/src/components/Menu/index.d.ts.map +1 -0
  95. package/dist/types/src/components/Message/Message.d.ts +1 -1
  96. package/dist/types/src/components/Message/Message.d.ts.map +1 -1
  97. package/dist/types/src/components/Message/Message.stories.d.ts +8 -17
  98. package/dist/types/src/components/Message/Message.stories.d.ts.map +1 -1
  99. package/dist/types/src/components/Popover/Popover.d.ts +3 -3
  100. package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
  101. package/dist/types/src/components/Popover/Popover.stories.d.ts +6 -34
  102. package/dist/types/src/components/Popover/Popover.stories.d.ts.map +1 -1
  103. package/dist/types/src/components/ScrollArea/ScrollArea.d.ts +10 -8
  104. package/dist/types/src/components/ScrollArea/ScrollArea.d.ts.map +1 -1
  105. package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts +8 -30
  106. package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts.map +1 -1
  107. package/dist/types/src/components/ScrollContainer/ScrollContainer.d.ts +39 -0
  108. package/dist/types/src/components/ScrollContainer/ScrollContainer.d.ts.map +1 -0
  109. package/dist/types/src/components/ScrollContainer/ScrollContainer.stories.d.ts +19 -0
  110. package/dist/types/src/components/ScrollContainer/ScrollContainer.stories.d.ts.map +1 -0
  111. package/dist/types/src/components/ScrollContainer/index.d.ts +2 -0
  112. package/dist/types/src/components/ScrollContainer/index.d.ts.map +1 -0
  113. package/dist/types/src/components/Select/Select.d.ts +10 -10
  114. package/dist/types/src/components/Select/Select.d.ts.map +1 -1
  115. package/dist/types/src/components/Select/Select.stories.d.ts +4 -9
  116. package/dist/types/src/components/Select/Select.stories.d.ts.map +1 -1
  117. package/dist/types/src/components/Separator/Separator.d.ts +1 -1
  118. package/dist/types/src/components/Status/Status.stories.d.ts +2 -8
  119. package/dist/types/src/components/Status/Status.stories.d.ts.map +1 -1
  120. package/dist/types/src/components/Tag/Tag.d.ts +1 -1
  121. package/dist/types/src/components/Tag/Tag.d.ts.map +1 -1
  122. package/dist/types/src/components/Tag/Tag.stories.d.ts +12 -12
  123. package/dist/types/src/components/Tag/Tag.stories.d.ts.map +1 -1
  124. package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts +2 -3
  125. package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
  126. package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts +1 -8
  127. package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts.map +1 -1
  128. package/dist/types/src/components/ThemeProvider/index.d.ts +2 -1
  129. package/dist/types/src/components/ThemeProvider/index.d.ts.map +1 -1
  130. package/dist/types/src/components/Toast/Toast.d.ts +5 -5
  131. package/dist/types/src/components/Toast/Toast.d.ts.map +1 -1
  132. package/dist/types/src/components/Toast/Toast.stories.d.ts +6 -44
  133. package/dist/types/src/components/Toast/Toast.stories.d.ts.map +1 -1
  134. package/dist/types/src/components/Toolbar/Toolbar.d.ts +17 -17
  135. package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
  136. package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts +6 -50
  137. package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -1
  138. package/dist/types/src/components/Tooltip/Tooltip.d.ts +2 -4
  139. package/dist/types/src/components/Tooltip/Tooltip.d.ts.map +1 -1
  140. package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts +8 -61
  141. package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts.map +1 -1
  142. package/dist/types/src/components/index.d.ts +5 -4
  143. package/dist/types/src/components/index.d.ts.map +1 -1
  144. package/dist/types/src/hooks/useDensityContext.d.ts +1 -1
  145. package/dist/types/src/hooks/useDensityContext.d.ts.map +1 -1
  146. package/dist/types/src/hooks/useElevationContext.d.ts +1 -1
  147. package/dist/types/src/hooks/useElevationContext.d.ts.map +1 -1
  148. package/dist/types/src/hooks/useSafeArea.d.ts.map +1 -1
  149. package/dist/types/src/hooks/useVisualViewport.d.ts +2 -2
  150. package/dist/types/src/hooks/useVisualViewport.d.ts.map +1 -1
  151. package/dist/types/src/index.d.ts +1 -1
  152. package/dist/types/src/index.d.ts.map +1 -1
  153. package/dist/types/src/playground/Controls.stories.d.ts +5 -9
  154. package/dist/types/src/playground/Controls.stories.d.ts.map +1 -1
  155. package/dist/types/src/playground/Custom.stories.d.ts +12 -4
  156. package/dist/types/src/playground/Custom.stories.d.ts.map +1 -1
  157. package/dist/types/src/playground/Typography.stories.d.ts +5 -11
  158. package/dist/types/src/playground/Typography.stories.d.ts.map +1 -1
  159. package/dist/types/src/testing/decorators/index.d.ts +2 -1
  160. package/dist/types/src/testing/decorators/index.d.ts.map +1 -1
  161. package/dist/types/src/testing/decorators/withLayout.d.ts +15 -0
  162. package/dist/types/src/testing/decorators/withLayout.d.ts.map +1 -0
  163. package/dist/types/src/testing/decorators/withLayoutVariants.d.ts +12 -0
  164. package/dist/types/src/testing/decorators/withLayoutVariants.d.ts.map +1 -0
  165. package/dist/types/src/testing/decorators/withTheme.d.ts +3 -0
  166. package/dist/types/src/testing/decorators/withTheme.d.ts.map +1 -1
  167. package/dist/types/src/util/index.d.ts +2 -1
  168. package/dist/types/src/util/index.d.ts.map +1 -1
  169. package/dist/types/src/util/usePx.d.ts +8 -0
  170. package/dist/types/src/util/usePx.d.ts.map +1 -0
  171. package/dist/types/tsconfig.tsbuildinfo +1 -1
  172. package/package.json +37 -31
  173. package/src/components/Avatars/Avatar.stories.tsx +21 -12
  174. package/src/components/Avatars/Avatar.tsx +4 -4
  175. package/src/components/Avatars/AvatarGroup.stories.tsx +10 -6
  176. package/src/components/Breadcrumb/Breadcrumb.stories.tsx +17 -12
  177. package/src/components/Breadcrumb/Breadcrumb.tsx +1 -1
  178. package/src/components/{Buttons → Button}/Button.stories.tsx +8 -9
  179. package/src/components/{Buttons → Button}/Button.tsx +1 -1
  180. package/src/components/{Buttons → Button}/IconButton.stories.tsx +11 -8
  181. package/src/components/{Buttons → Button}/IconButton.tsx +22 -15
  182. package/src/components/{Buttons → Button}/Toggle.stories.tsx +13 -9
  183. package/src/components/{Buttons → Button}/ToggleGroup.stories.tsx +10 -7
  184. package/src/components/{Buttons → Button}/ToggleGroup.tsx +17 -4
  185. package/src/components/Clipboard/ClipboardProvider.tsx +1 -1
  186. package/src/components/Clipboard/CopyButton.tsx +6 -5
  187. package/src/components/DensityProvider/DensityProvider.tsx +2 -2
  188. package/src/components/{Dialogs → Dialog}/AlertDialog.stories.tsx +15 -12
  189. package/src/components/{Dialogs → Dialog}/AlertDialog.tsx +13 -13
  190. package/src/components/Dialog/Dialog.stories.tsx +97 -0
  191. package/src/components/{Dialogs → Dialog}/Dialog.tsx +151 -51
  192. package/src/components/ElevationProvider/ElevationProvider.tsx +2 -2
  193. package/src/components/Icon/Icon.stories.tsx +113 -0
  194. package/src/components/Icon/Icon.tsx +2 -2
  195. package/src/components/Input/Input.stories.tsx +13 -15
  196. package/src/components/Input/Input.tsx +28 -19
  197. package/src/components/Link/Link.stories.tsx +10 -6
  198. package/src/components/{Lists → List}/List.stories.tsx +32 -26
  199. package/src/components/{Lists → List}/List.tsx +17 -13
  200. package/src/components/{Lists → List}/ListDropIndicator.tsx +1 -1
  201. package/src/components/{Lists → List}/Tree.stories.tsx +11 -8
  202. package/src/components/{Lists → List}/Tree.tsx +4 -3
  203. package/src/components/{Lists → List}/TreeDropIndicator.tsx +1 -1
  204. package/src/components/{Lists → List}/Treegrid.stories.tsx +12 -6
  205. package/src/components/{Lists → List}/Treegrid.tsx +58 -17
  206. package/src/components/Main/Main.stories.tsx +17 -9
  207. package/src/components/Main/Main.tsx +43 -28
  208. package/src/components/{Menus → Menu}/ContextMenu.stories.tsx +11 -8
  209. package/src/components/{Menus → Menu}/ContextMenu.tsx +1 -0
  210. package/src/components/{Menus → Menu}/DropdownMenu.stories.tsx +12 -9
  211. package/src/components/{Menus → Menu}/DropdownMenu.tsx +102 -71
  212. package/src/components/Message/Message.stories.tsx +12 -8
  213. package/src/components/Message/Message.tsx +30 -5
  214. package/src/components/Popover/Popover.stories.tsx +12 -9
  215. package/src/components/Popover/Popover.tsx +64 -45
  216. package/src/components/ScrollArea/ScrollArea.stories.tsx +64 -11
  217. package/src/components/ScrollArea/ScrollArea.tsx +54 -8
  218. package/src/components/ScrollContainer/ScrollContainer.stories.tsx +70 -0
  219. package/src/components/ScrollContainer/ScrollContainer.tsx +233 -0
  220. package/src/components/ScrollContainer/index.ts +5 -0
  221. package/src/components/Select/Select.stories.tsx +15 -12
  222. package/src/components/Select/Select.tsx +9 -8
  223. package/src/components/Status/Status.stories.tsx +9 -6
  224. package/src/components/Tag/Tag.stories.tsx +20 -11
  225. package/src/components/Tag/Tag.tsx +1 -1
  226. package/src/components/ThemeProvider/ThemeProvider.tsx +3 -4
  227. package/src/components/ThemeProvider/TranslationsProvider.tsx +3 -18
  228. package/src/components/ThemeProvider/index.ts +3 -3
  229. package/src/components/Toast/Toast.stories.tsx +12 -9
  230. package/src/components/Toast/Toast.tsx +9 -9
  231. package/src/components/Toolbar/Toolbar.stories.tsx +14 -12
  232. package/src/components/Toolbar/Toolbar.tsx +37 -10
  233. package/src/components/Tooltip/Tooltip.stories.tsx +16 -12
  234. package/src/components/Tooltip/Tooltip.tsx +27 -24
  235. package/src/components/index.ts +5 -4
  236. package/src/hooks/useDensityContext.ts +1 -1
  237. package/src/hooks/useElevationContext.ts +1 -1
  238. package/src/hooks/useSafeArea.ts +3 -2
  239. package/src/hooks/useVisualViewport.ts +4 -4
  240. package/src/index.ts +1 -1
  241. package/src/playground/Controls.stories.tsx +12 -8
  242. package/src/playground/Custom.stories.tsx +13 -24
  243. package/src/playground/Typography.stories.tsx +8 -6
  244. package/src/testing/decorators/index.ts +2 -1
  245. package/src/testing/decorators/withLayout.tsx +63 -0
  246. package/src/testing/decorators/{withSurfaceVariantsLayout.tsx → withLayoutVariants.tsx} +5 -5
  247. package/src/testing/decorators/withTheme.tsx +32 -0
  248. package/src/util/index.ts +3 -1
  249. package/src/util/usePx.ts +61 -0
  250. package/dist/lib/browser/chunk-2COVUP44.mjs +0 -4373
  251. package/dist/lib/browser/chunk-2COVUP44.mjs.map +0 -7
  252. package/dist/lib/node-esm/chunk-GHXHND5V.mjs +0 -4375
  253. package/dist/lib/node-esm/chunk-GHXHND5V.mjs.map +0 -7
  254. package/dist/types/src/components/Buttons/Button.d.ts.map +0 -1
  255. package/dist/types/src/components/Buttons/Button.stories.d.ts +0 -12
  256. package/dist/types/src/components/Buttons/Button.stories.d.ts.map +0 -1
  257. package/dist/types/src/components/Buttons/IconButton.d.ts.map +0 -1
  258. package/dist/types/src/components/Buttons/IconButton.stories.d.ts +0 -22
  259. package/dist/types/src/components/Buttons/IconButton.stories.d.ts.map +0 -1
  260. package/dist/types/src/components/Buttons/Toggle.d.ts.map +0 -1
  261. package/dist/types/src/components/Buttons/Toggle.stories.d.ts +0 -19
  262. package/dist/types/src/components/Buttons/Toggle.stories.d.ts.map +0 -1
  263. package/dist/types/src/components/Buttons/ToggleGroup.d.ts +0 -28
  264. package/dist/types/src/components/Buttons/ToggleGroup.d.ts.map +0 -1
  265. package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts +0 -39
  266. package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts.map +0 -1
  267. package/dist/types/src/components/Buttons/index.d.ts.map +0 -1
  268. package/dist/types/src/components/Dialogs/AlertDialog.d.ts.map +0 -1
  269. package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts +0 -43
  270. package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts.map +0 -1
  271. package/dist/types/src/components/Dialogs/Dialog.d.ts +0 -31
  272. package/dist/types/src/components/Dialogs/Dialog.d.ts.map +0 -1
  273. package/dist/types/src/components/Dialogs/Dialog.stories.d.ts +0 -48
  274. package/dist/types/src/components/Dialogs/Dialog.stories.d.ts.map +0 -1
  275. package/dist/types/src/components/Dialogs/index.d.ts.map +0 -1
  276. package/dist/types/src/components/Lists/List.d.ts.map +0 -1
  277. package/dist/types/src/components/Lists/List.stories.d.ts +0 -37
  278. package/dist/types/src/components/Lists/List.stories.d.ts.map +0 -1
  279. package/dist/types/src/components/Lists/ListDropIndicator.d.ts.map +0 -1
  280. package/dist/types/src/components/Lists/Tree.d.ts.map +0 -1
  281. package/dist/types/src/components/Lists/Tree.stories.d.ts +0 -41
  282. package/dist/types/src/components/Lists/Tree.stories.d.ts.map +0 -1
  283. package/dist/types/src/components/Lists/TreeDropIndicator.d.ts.map +0 -1
  284. package/dist/types/src/components/Lists/Treegrid.stories.d.ts +0 -10
  285. package/dist/types/src/components/Lists/Treegrid.stories.d.ts.map +0 -1
  286. package/dist/types/src/components/Lists/index.d.ts.map +0 -1
  287. package/dist/types/src/components/Menus/ContextMenu.d.ts.map +0 -1
  288. package/dist/types/src/components/Menus/ContextMenu.stories.d.ts +0 -50
  289. package/dist/types/src/components/Menus/ContextMenu.stories.d.ts.map +0 -1
  290. package/dist/types/src/components/Menus/DropdownMenu.d.ts.map +0 -1
  291. package/dist/types/src/components/Menus/DropdownMenu.stories.d.ts +0 -50
  292. package/dist/types/src/components/Menus/DropdownMenu.stories.d.ts.map +0 -1
  293. package/dist/types/src/components/Menus/index.d.ts.map +0 -1
  294. package/dist/types/src/testing/decorators/withSurfaceVariantsLayout.d.ts +0 -12
  295. package/dist/types/src/testing/decorators/withSurfaceVariantsLayout.d.ts.map +0 -1
  296. package/dist/types/src/util/ThemedClassName.d.ts +0 -5
  297. package/dist/types/src/util/ThemedClassName.d.ts.map +0 -1
  298. package/src/components/Dialogs/Dialog.stories.tsx +0 -65
  299. package/src/testing/decorators/withTheme.ts +0 -25
  300. package/src/util/ThemedClassName.ts +0 -7
  301. /package/dist/types/src/components/{Buttons → Button}/Toggle.d.ts +0 -0
  302. /package/dist/types/src/components/{Buttons → Button}/index.d.ts +0 -0
  303. /package/dist/types/src/components/{Dialogs → Dialog}/index.d.ts +0 -0
  304. /package/dist/types/src/components/{Lists → List}/ListDropIndicator.d.ts +0 -0
  305. /package/dist/types/src/components/{Lists → List}/TreeDropIndicator.d.ts +0 -0
  306. /package/dist/types/src/components/{Lists → List}/index.d.ts +0 -0
  307. /package/dist/types/src/components/{Menus → Menu}/index.d.ts +0 -0
  308. /package/src/components/{Buttons → Button}/Toggle.tsx +0 -0
  309. /package/src/components/{Buttons → Button}/index.ts +0 -0
  310. /package/src/components/{Dialogs → Dialog}/index.ts +0 -0
  311. /package/src/components/{Lists → List}/index.ts +0 -0
  312. /package/src/components/{Menus → Menu}/index.ts +0 -0
@@ -1,80 +1,3086 @@
1
1
  import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
2
  import {
3
- AlertDialog,
4
- AnchoredOverflow,
5
- Avatar,
6
- BUTTON_GROUP_NAME,
7
- Breadcrumb,
8
- Button,
9
- ButtonGroup,
10
- Callout,
11
- Clipboard,
12
- ContextMenu,
13
3
  DensityContext,
14
4
  DensityProvider,
15
- Dialog,
16
- DropdownMenu,
17
5
  ElevationContext,
18
6
  ElevationProvider,
19
- Icon,
20
- IconButton,
21
- Input,
22
- LIST_ITEM_NAME,
23
- LIST_NAME,
24
- Link,
25
- List,
26
- ListItem,
27
- Main,
28
- Message,
29
- Popover,
30
- ScrollArea,
31
- Select,
32
- Separator,
33
- Status,
34
- Tag,
35
7
  ThemeContext,
36
8
  ThemeProvider,
37
- Toast,
38
- Toggle,
39
- ToggleGroup,
40
- ToggleGroupItem,
41
- Toolbar,
42
9
  Tooltip,
43
- Tree,
44
- TreeItem,
45
- Treegrid,
46
- createDropdownMenuScope,
47
- createPopoverScope,
10
+ TranslationsContext,
48
11
  createTooltipScope,
49
12
  hasIosKeyboard,
50
13
  initialSafeArea,
51
- isLabel,
52
- messageIcons,
53
- toLocalizedString,
54
- useAvatarContext,
55
- useButtonGroupContext,
56
- useClipboard,
57
- useDensityContext,
58
- useDropdownMenuContext,
59
- useDropdownMenuMenuScope,
60
14
  useElevationContext,
61
- useIconHref,
62
- useLandmarkMover,
63
- useListContext,
64
- useListItemContext,
65
- useMainContext,
66
15
  useSafeArea,
67
- useSidebars,
68
16
  useThemeContext,
69
17
  useTooltipContext,
70
- useTranslation,
71
- useTranslationsContext,
72
- useVisualViewport
73
- } from "./chunk-GHXHND5V.mjs";
18
+ useTranslation
19
+ } from "./chunk-2NHEX4AD.mjs";
74
20
 
75
21
  // src/index.ts
76
22
  import { Trans } from "react-i18next";
77
23
  export * from "@dxos/react-hooks";
24
+ export * from "@dxos/ui-types";
25
+
26
+ // src/components/AnchoredOverflow/AnchoredOverflow.tsx
27
+ import { Primitive } from "@radix-ui/react-primitive";
28
+ import { Slot } from "@radix-ui/react-slot";
29
+ import React, { forwardRef } from "react";
30
+
31
+ // src/hooks/useDensityContext.ts
32
+ import { useContext } from "react";
33
+ var useDensityContext = (propsDensity) => {
34
+ const { density } = useContext(DensityContext);
35
+ return propsDensity ?? density;
36
+ };
37
+
38
+ // src/hooks/useIconHref.ts
39
+ var ICONS_URL = "/icons.svg";
40
+ var useIconHref = (icon) => {
41
+ const { noCache } = useThemeContext();
42
+ const url = noCache ? `${ICONS_URL}?nocache=${(/* @__PURE__ */ new Date()).getMinutes()}` : ICONS_URL;
43
+ return icon ? `${url}#${icon}` : void 0;
44
+ };
45
+
46
+ // src/hooks/useTranslationsContext.ts
47
+ import { useContext as useContext2 } from "react";
48
+ var useTranslationsContext = () => useContext2(TranslationsContext);
49
+
50
+ // src/hooks/useVisualViewport.ts
51
+ import { useCallback, useState } from "react";
52
+ import { useViewportResize } from "@dxos/react-hooks";
53
+ var useVisualViewport = (deps) => {
54
+ const [width, setWidth] = useState(null);
55
+ const [height, setHeight] = useState(null);
56
+ const handleResize = useCallback(() => {
57
+ if (window.visualViewport) {
58
+ setWidth(window.visualViewport.width);
59
+ setHeight(window.visualViewport.height);
60
+ }
61
+ }, []);
62
+ useViewportResize(handleResize, deps);
63
+ return {
64
+ width,
65
+ height
66
+ };
67
+ };
68
+
69
+ // src/components/AnchoredOverflow/AnchoredOverflow.tsx
70
+ var AnchoredOverflowRoot = /* @__PURE__ */ forwardRef(({ asChild, classNames, children, ...props }, forwardedRef) => {
71
+ const { tx } = useThemeContext();
72
+ const Root6 = asChild ? Slot : Primitive.div;
73
+ return /* @__PURE__ */ React.createElement(Root6, {
74
+ role: "none",
75
+ ...props,
76
+ className: tx("anchoredOverflow.root", "overflow-anchored", {}, classNames),
77
+ ref: forwardedRef
78
+ }, children);
79
+ });
80
+ var AnchoredOverflowAnchor = /* @__PURE__ */ forwardRef(({ asChild, classNames, children, ...props }, forwardedRef) => {
81
+ const { tx } = useThemeContext();
82
+ const Root6 = asChild ? Slot : Primitive.div;
83
+ return /* @__PURE__ */ React.createElement(Root6, {
84
+ role: "none",
85
+ ...props,
86
+ className: tx("anchoredOverflow.anchor", "overflow-anchor", {}, classNames),
87
+ ref: forwardedRef
88
+ }, children);
89
+ });
90
+ var AnchoredOverflow = {
91
+ Root: AnchoredOverflowRoot,
92
+ Anchor: AnchoredOverflowAnchor
93
+ };
94
+
95
+ // src/components/Avatars/Avatar.tsx
96
+ import "@dxos/lit-ui/dx-avatar.pcss";
97
+ import { createContext } from "@radix-ui/react-context";
98
+ import { Primitive as Primitive2 } from "@radix-ui/react-primitive";
99
+ import { Slot as Slot2 } from "@radix-ui/react-slot";
100
+ import React2, { forwardRef as forwardRef2 } from "react";
101
+ import { DxAvatar } from "@dxos/lit-ui/react";
102
+ import { useId } from "@dxos/react-hooks";
103
+ import { mx } from "@dxos/ui-theme";
104
+ var AVATAR_NAME = "Avatar";
105
+ var [AvatarProvider, useAvatarContext] = createContext(AVATAR_NAME);
106
+ var AvatarRoot = ({ children, labelId: propsLabelId, descriptionId: propsDescriptionId }) => {
107
+ const labelId = useId("avatar__label", propsLabelId);
108
+ const descriptionId = useId("avatar__description", propsDescriptionId);
109
+ return /* @__PURE__ */ React2.createElement(AvatarProvider, {
110
+ labelId,
111
+ descriptionId
112
+ }, children);
113
+ };
114
+ var AvatarContent = /* @__PURE__ */ forwardRef2(({ icon, classNames, ...props }, forwardedRef) => {
115
+ const href = useIconHref(icon);
116
+ const { labelId, descriptionId } = useAvatarContext("AvatarContent");
117
+ return /* @__PURE__ */ React2.createElement(DxAvatar, {
118
+ ...props,
119
+ icon: href,
120
+ "aria-labelledby": labelId,
121
+ "aria-describedby": descriptionId,
122
+ rootClassName: mx(classNames),
123
+ ref: forwardedRef
124
+ });
125
+ });
126
+ var AvatarLabel = /* @__PURE__ */ forwardRef2(({ asChild, srOnly, classNames, ...props }, forwardedRef) => {
127
+ const Root6 = asChild ? Slot2 : Primitive2.span;
128
+ const { tx } = useThemeContext();
129
+ const { labelId } = useAvatarContext("AvatarLabel");
130
+ return /* @__PURE__ */ React2.createElement(Root6, {
131
+ ...props,
132
+ id: labelId,
133
+ ref: forwardedRef,
134
+ className: tx("avatar.label", "avatar__label", {
135
+ srOnly
136
+ }, classNames)
137
+ });
138
+ });
139
+ var AvatarDescription = /* @__PURE__ */ forwardRef2(({ asChild, srOnly, classNames, ...props }, forwardedRef) => {
140
+ const Root6 = asChild ? Slot2 : Primitive2.span;
141
+ const { tx } = useThemeContext();
142
+ const { descriptionId } = useAvatarContext("AvatarDescription");
143
+ return /* @__PURE__ */ React2.createElement(Root6, {
144
+ ...props,
145
+ id: descriptionId,
146
+ ref: forwardedRef,
147
+ className: tx("avatar.description", "avatar__description", {
148
+ srOnly
149
+ }, classNames)
150
+ });
151
+ });
152
+ var Avatar = {
153
+ Root: AvatarRoot,
154
+ Content: AvatarContent,
155
+ Label: AvatarLabel,
156
+ Description: AvatarDescription
157
+ };
158
+
159
+ // src/components/Breadcrumb/Breadcrumb.tsx
160
+ import { Primitive as Primitive4 } from "@radix-ui/react-primitive";
161
+ import { Slot as Slot4 } from "@radix-ui/react-slot";
162
+ import React5, { forwardRef as forwardRef5 } from "react";
163
+
164
+ // src/components/Icon/Icon.tsx
165
+ import React3, { forwardRef as forwardRef3, memo } from "react";
166
+ var Icon = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef3(({ icon, classNames, size = 4, ...props }, forwardedRef) => {
167
+ const { tx } = useThemeContext();
168
+ const href = useIconHref(icon);
169
+ return /* @__PURE__ */ React3.createElement("svg", {
170
+ ...props,
171
+ className: tx("icon.root", "icon", {
172
+ size
173
+ }, classNames),
174
+ ref: forwardedRef
175
+ }, /* @__PURE__ */ React3.createElement("use", {
176
+ href
177
+ }));
178
+ }));
179
+
180
+ // src/components/Link/Link.tsx
181
+ import { Primitive as Primitive3 } from "@radix-ui/react-primitive";
182
+ import { Slot as Slot3 } from "@radix-ui/react-slot";
183
+ import React4, { forwardRef as forwardRef4 } from "react";
184
+ var Link = /* @__PURE__ */ forwardRef4(({ asChild, variant, classNames, ...props }, forwardedRef) => {
185
+ const { tx } = useThemeContext();
186
+ const Root6 = asChild ? Slot3 : Primitive3.a;
187
+ return /* @__PURE__ */ React4.createElement(Root6, {
188
+ ...props,
189
+ className: tx("link.root", "link", {
190
+ variant
191
+ }, classNames),
192
+ ref: forwardedRef
193
+ });
194
+ });
195
+
196
+ // src/components/Breadcrumb/Breadcrumb.tsx
197
+ var BreadcrumbRoot = /* @__PURE__ */ forwardRef5(({ asChild, classNames, ...props }, forwardedRef) => {
198
+ const { tx } = useThemeContext();
199
+ const Root6 = asChild ? Slot4 : Primitive4.div;
200
+ return /* @__PURE__ */ React5.createElement(Root6, {
201
+ role: "navigation",
202
+ ...props,
203
+ className: tx("breadcrumb.root", "breadcrumb", {}, classNames),
204
+ ref: forwardedRef
205
+ });
206
+ });
207
+ var BreadcrumbList = /* @__PURE__ */ forwardRef5(({ asChild, classNames, ...props }, forwardedRef) => {
208
+ const { tx } = useThemeContext();
209
+ const Root6 = asChild ? Slot4 : Primitive4.ol;
210
+ return /* @__PURE__ */ React5.createElement(Root6, {
211
+ role: "list",
212
+ ...props,
213
+ className: tx("breadcrumb.list", "breadcrumb__list", {}, classNames),
214
+ ref: forwardedRef
215
+ });
216
+ });
217
+ var BreadcrumbListItem = /* @__PURE__ */ forwardRef5(({ asChild, classNames, ...props }, forwardedRef) => {
218
+ const { tx } = useThemeContext();
219
+ const Root6 = asChild ? Slot4 : Primitive4.li;
220
+ return /* @__PURE__ */ React5.createElement(Root6, {
221
+ role: "listitem",
222
+ ...props,
223
+ className: tx("breadcrumb.listItem", "breadcrumb__list__item", {}, classNames),
224
+ ref: forwardedRef
225
+ });
226
+ });
227
+ var BreadcrumbLink = /* @__PURE__ */ forwardRef5(({ asChild, ...props }, forwardedRef) => {
228
+ const Root6 = asChild ? Slot4 : Link;
229
+ return /* @__PURE__ */ React5.createElement(Root6, {
230
+ ...props,
231
+ ref: forwardedRef
232
+ });
233
+ });
234
+ var BreadcrumbCurrent = /* @__PURE__ */ forwardRef5(({ asChild, classNames, ...props }, forwardedRef) => {
235
+ const { tx } = useThemeContext();
236
+ const Root6 = asChild ? Slot4 : "h1";
237
+ return /* @__PURE__ */ React5.createElement(Root6, {
238
+ ...props,
239
+ "aria-current": "page",
240
+ className: tx("breadcrumb.current", "breadcrumb__item__heading--current", {}, classNames),
241
+ ref: forwardedRef
242
+ });
243
+ });
244
+ var BreadcrumbSeparator = ({ children, classNames, ...props }) => {
245
+ const { tx } = useThemeContext();
246
+ return /* @__PURE__ */ React5.createElement(Primitive4.span, {
247
+ role: "separator",
248
+ "aria-hidden": "true",
249
+ ...props,
250
+ className: tx("breadcrumb.separator", "breadcrumb__separator", {}, classNames)
251
+ }, children ?? /* @__PURE__ */ React5.createElement(Icon, {
252
+ icon: "ph--dot--bold"
253
+ }));
254
+ };
255
+ var Breadcrumb = {
256
+ Root: BreadcrumbRoot,
257
+ List: BreadcrumbList,
258
+ ListItem: BreadcrumbListItem,
259
+ Link: BreadcrumbLink,
260
+ Current: BreadcrumbCurrent,
261
+ Separator: BreadcrumbSeparator
262
+ };
263
+
264
+ // src/components/Button/Button.tsx
265
+ import { createContext as createContext2 } from "@radix-ui/react-context";
266
+ import { Primitive as Primitive5 } from "@radix-ui/react-primitive";
267
+ import { Slot as Slot5 } from "@radix-ui/react-slot";
268
+ import React6, { forwardRef as forwardRef6, memo as memo2 } from "react";
269
+ var BUTTON_GROUP_NAME = "ButtonGroup";
270
+ var BUTTON_NAME = "Button";
271
+ var [ButtonGroupProvider, useButtonGroupContext] = createContext2(BUTTON_GROUP_NAME, {
272
+ inGroup: false
273
+ });
274
+ var Button = /* @__PURE__ */ memo2(/* @__PURE__ */ forwardRef6(({ classNames, children, density: propsDensity, elevation: propsElevation, variant = "default", asChild, ...props }, ref) => {
275
+ const { inGroup } = useButtonGroupContext(BUTTON_NAME);
276
+ const { tx } = useThemeContext();
277
+ const elevation = useElevationContext(propsElevation);
278
+ const density = useDensityContext(propsDensity);
279
+ const Root6 = asChild ? Slot5 : Primitive5.button;
280
+ return /* @__PURE__ */ React6.createElement(Root6, {
281
+ ref,
282
+ ...props,
283
+ "data-variant": variant,
284
+ "data-density": density,
285
+ "data-props": inGroup ? "grouped" : "",
286
+ className: tx("button.root", "button", {
287
+ variant,
288
+ inGroup,
289
+ disabled: props.disabled,
290
+ density,
291
+ elevation
292
+ }, classNames),
293
+ ...props.disabled && {
294
+ disabled: true
295
+ }
296
+ }, children);
297
+ }));
298
+ Button.displayName = BUTTON_NAME;
299
+ var ButtonGroup = /* @__PURE__ */ forwardRef6(({ children, elevation: propsElevation, classNames, asChild, ...props }, forwardedRef) => {
300
+ const { tx } = useThemeContext();
301
+ const elevation = useElevationContext(propsElevation);
302
+ const Root6 = asChild ? Slot5 : Primitive5.div;
303
+ return /* @__PURE__ */ React6.createElement(Root6, {
304
+ role: "none",
305
+ ...props,
306
+ className: tx("button.group", "button-group", {
307
+ elevation
308
+ }, classNames),
309
+ ref: forwardedRef
310
+ }, /* @__PURE__ */ React6.createElement(ButtonGroupProvider, {
311
+ inGroup: true
312
+ }, children));
313
+ });
314
+ ButtonGroup.displayName = BUTTON_GROUP_NAME;
315
+
316
+ // src/components/Button/IconButton.tsx
317
+ import React7, { forwardRef as forwardRef7 } from "react";
318
+ var IconButton = /* @__PURE__ */ forwardRef7((props, forwardedRef) => props.iconOnly ? /* @__PURE__ */ React7.createElement(IconOnlyButton, {
319
+ ...props,
320
+ ref: forwardedRef
321
+ }) : /* @__PURE__ */ React7.createElement(LabelledIconButton, {
322
+ ...props,
323
+ ref: forwardedRef
324
+ }));
325
+ var IconOnlyButton = /* @__PURE__ */ forwardRef7(({ noTooltip, tooltipSide, ...props }, forwardedRef) => {
326
+ if (noTooltip) {
327
+ return /* @__PURE__ */ React7.createElement(LabelledIconButton, {
328
+ ...props,
329
+ ref: forwardedRef
330
+ });
331
+ }
332
+ return /* @__PURE__ */ React7.createElement(Tooltip.Trigger, {
333
+ asChild: true,
334
+ content: props.label,
335
+ side: tooltipSide
336
+ }, /* @__PURE__ */ React7.createElement(LabelledIconButton, {
337
+ ...props,
338
+ ref: forwardedRef
339
+ }));
340
+ });
341
+ var LabelledIconButton = /* @__PURE__ */ forwardRef7(({ size = 5, icon, iconOnly, iconEnd, iconClassNames, label, caretDown, noTooltip: _, classNames, ...props }, forwardedRef) => {
342
+ const { tx } = useThemeContext();
343
+ return /* @__PURE__ */ React7.createElement(Button, {
344
+ ...props,
345
+ classNames: tx("iconButton.root", "iconButton", {
346
+ iconOnly
347
+ }, classNames),
348
+ ref: forwardedRef
349
+ }, icon && !iconEnd && /* @__PURE__ */ React7.createElement(Icon, {
350
+ icon,
351
+ size,
352
+ classNames: iconClassNames
353
+ }), /* @__PURE__ */ React7.createElement("span", {
354
+ className: iconOnly ? "sr-only" : void 0
355
+ }, label), icon && iconEnd && /* @__PURE__ */ React7.createElement(Icon, {
356
+ icon,
357
+ size,
358
+ classNames: iconClassNames
359
+ }), caretDown && /* @__PURE__ */ React7.createElement(Icon, {
360
+ size: 3,
361
+ icon: "ph--caret-down--bold"
362
+ }));
363
+ });
364
+
365
+ // src/components/Button/Toggle.tsx
366
+ import { Toggle as TogglePrimitive } from "@radix-ui/react-toggle";
367
+ import React8, { forwardRef as forwardRef8 } from "react";
368
+ var Toggle = /* @__PURE__ */ forwardRef8(({ defaultPressed, pressed, onPressedChange, ...props }, forwardedRef) => {
369
+ return /* @__PURE__ */ React8.createElement(TogglePrimitive, {
370
+ defaultPressed,
371
+ pressed,
372
+ onPressedChange,
373
+ asChild: true
374
+ }, /* @__PURE__ */ React8.createElement(Button, {
375
+ ...props,
376
+ ref: forwardedRef
377
+ }));
378
+ });
379
+
380
+ // src/components/Button/ToggleGroup.tsx
381
+ import { ToggleGroupItem as ToggleGroupItemPrimitive, ToggleGroup as ToggleGroupPrimitive } from "@radix-ui/react-toggle-group";
382
+ import React9, { forwardRef as forwardRef9 } from "react";
383
+ var ToggleGroup = /* @__PURE__ */ forwardRef9(({ classNames, children, ...props }, forwardedRef) => {
384
+ return /* @__PURE__ */ React9.createElement(ToggleGroupPrimitive, {
385
+ ...props,
386
+ asChild: true
387
+ }, /* @__PURE__ */ React9.createElement(ButtonGroup, {
388
+ classNames,
389
+ children,
390
+ ref: forwardedRef
391
+ }));
392
+ });
393
+ var ToggleGroupItem = /* @__PURE__ */ forwardRef9(({ variant, elevation, density, classNames, children, ...props }, forwardedRef) => {
394
+ return /* @__PURE__ */ React9.createElement(ToggleGroupItemPrimitive, {
395
+ ...props,
396
+ asChild: true
397
+ }, /* @__PURE__ */ React9.createElement(Button, {
398
+ variant,
399
+ elevation,
400
+ density,
401
+ classNames,
402
+ children,
403
+ ref: forwardedRef
404
+ }));
405
+ });
406
+ var ToggleGroupIconItem = /* @__PURE__ */ forwardRef9(({ variant, label, icon, size, elevation, density, classNames, ...props }, forwardedRef) => {
407
+ return /* @__PURE__ */ React9.createElement(ToggleGroupItemPrimitive, {
408
+ ...props,
409
+ asChild: true
410
+ }, /* @__PURE__ */ React9.createElement(IconButton, {
411
+ variant,
412
+ elevation,
413
+ density,
414
+ classNames,
415
+ label,
416
+ icon,
417
+ size,
418
+ ref: forwardedRef
419
+ }));
420
+ });
421
+
422
+ // src/components/Clipboard/ClipboardProvider.tsx
423
+ import React10, { createContext as createContext3, useCallback as useCallback2, useContext as useContext3, useState as useState2 } from "react";
424
+ var ClipboardContext = /* @__PURE__ */ createContext3({
425
+ textValue: "",
426
+ setTextValue: async (_) => {
427
+ }
428
+ });
429
+ var useClipboard = () => useContext3(ClipboardContext);
430
+ var ClipboardProvider = ({ children }) => {
431
+ const [textValue, setInternalTextValue] = useState2("");
432
+ const setTextValue = useCallback2(async (nextValue) => {
433
+ await navigator.clipboard.writeText(nextValue);
434
+ return setInternalTextValue(nextValue);
435
+ }, []);
436
+ return /* @__PURE__ */ React10.createElement(ClipboardContext.Provider, {
437
+ value: {
438
+ textValue,
439
+ setTextValue
440
+ }
441
+ }, children);
442
+ };
443
+
444
+ // src/components/Clipboard/CopyButton.tsx
445
+ import React11 from "react";
446
+ import { mx as mx2, osTranslations } from "@dxos/ui-theme";
447
+
448
+ // src/components/ThemeProvider/index.ts
449
+ import { isLabel, toLocalizedString } from "@dxos/ui-types";
450
+
451
+ // src/util/usePx.ts
452
+ import { useCallback as useCallback3, useEffect, useMemo, useState as useState3 } from "react";
453
+ var getDocumentElementFontSize = () => parseFloat(getComputedStyle(document.documentElement).fontSize);
454
+ var usePx = (rem) => {
455
+ const [fontSize, setFontSize] = useState3(() => {
456
+ if (typeof document !== "undefined") {
457
+ return getDocumentElementFontSize();
458
+ }
459
+ return 16;
460
+ });
461
+ const updateFontSize = useCallback3(() => {
462
+ setFontSize(getDocumentElementFontSize());
463
+ }, []);
464
+ useEffect(() => {
465
+ if (typeof document === "undefined") {
466
+ return;
467
+ }
468
+ const resizeObserver = new ResizeObserver(updateFontSize);
469
+ resizeObserver.observe(document.documentElement);
470
+ const mediaQueryList = window.matchMedia("all");
471
+ const handleMediaChange = () => {
472
+ updateFontSize();
473
+ };
474
+ if (mediaQueryList.addEventListener) {
475
+ mediaQueryList.addEventListener("change", handleMediaChange);
476
+ } else {
477
+ mediaQueryList.addListener(handleMediaChange);
478
+ }
479
+ return () => {
480
+ resizeObserver.disconnect();
481
+ if (mediaQueryList.removeEventListener) {
482
+ mediaQueryList.removeEventListener("change", handleMediaChange);
483
+ } else {
484
+ mediaQueryList.removeListener(handleMediaChange);
485
+ }
486
+ };
487
+ }, []);
488
+ return useMemo(() => rem * fontSize, [
489
+ fontSize
490
+ ]);
491
+ };
492
+
493
+ // src/components/Clipboard/CopyButton.tsx
494
+ var inactiveLabelStyles = "invisible bs-px -mbe-px overflow-hidden";
495
+ var CopyButton = ({ classNames, value, size = 5, ...props }) => {
496
+ const { t } = useTranslation(osTranslations);
497
+ const { textValue, setTextValue } = useClipboard();
498
+ const isCopied = textValue === value;
499
+ return /* @__PURE__ */ React11.createElement(Button, {
500
+ ...props,
501
+ classNames: [
502
+ "inline-flex flex-col justify-center",
503
+ classNames
504
+ ],
505
+ onClick: () => setTextValue(value),
506
+ "data-testid": "copy-invitation"
507
+ }, /* @__PURE__ */ React11.createElement("div", {
508
+ role: "none",
509
+ className: mx2("flex gap-1 items-center", isCopied && inactiveLabelStyles)
510
+ }, /* @__PURE__ */ React11.createElement("span", {
511
+ className: "pli-1"
512
+ }, t("copy label")), /* @__PURE__ */ React11.createElement(Icon, {
513
+ icon: "ph--copy--regular",
514
+ size
515
+ })), /* @__PURE__ */ React11.createElement("div", {
516
+ role: "none",
517
+ className: mx2("flex gap-1 items-center", !isCopied && inactiveLabelStyles)
518
+ }, /* @__PURE__ */ React11.createElement("span", {
519
+ className: "pli-1"
520
+ }, t("copy success label")), /* @__PURE__ */ React11.createElement(Icon, {
521
+ icon: "ph--check--regular",
522
+ size
523
+ })));
524
+ };
525
+ var CopyButtonIconOnly = ({ __scopeTooltip, value, classNames, size, variant, ...props }) => {
526
+ const { t } = useTranslation(osTranslations);
527
+ const { textValue, setTextValue } = useClipboard();
528
+ const isCopied = textValue === value;
529
+ const label = isCopied ? t("copy success label") : props.label ?? t("copy label");
530
+ const { onOpen } = useTooltipContext("CopyButton", __scopeTooltip);
531
+ return /* @__PURE__ */ React11.createElement(IconButton, {
532
+ iconOnly: true,
533
+ label,
534
+ icon: "ph--copy--regular",
535
+ size,
536
+ variant,
537
+ classNames: [
538
+ "inline-flex flex-col justify-center",
539
+ classNames
540
+ ],
541
+ onClick: () => setTextValue(value).then(onOpen),
542
+ "data-testid": "copy-invitation"
543
+ });
544
+ };
545
+
546
+ // src/components/Clipboard/index.ts
547
+ var Clipboard = {
548
+ Button: CopyButton,
549
+ IconButton: CopyButtonIconOnly,
550
+ Provider: ClipboardProvider
551
+ };
552
+
553
+ // src/components/Dialog/Dialog.tsx
554
+ import { createContext as createContext4 } from "@radix-ui/react-context";
555
+ import { DialogClose as DialogClosePrimitive, DialogContent as DialogContentPrimitive, DialogDescription as DialogDescriptionPrimitive, DialogOverlay as DialogOverlayPrimitive, DialogPortal as DialogPortalPrimitive, Root as DialogRootPrimitive, DialogTitle as DialogTitlePrimitive, DialogTrigger as DialogTriggerPrimitive } from "@radix-ui/react-dialog";
556
+ import React12, { forwardRef as forwardRef10 } from "react";
557
+ import { useTranslation as useTranslation2 } from "react-i18next";
558
+ import { osTranslations as osTranslations2 } from "@dxos/ui-theme";
559
+ var DialogRoot = (props) => /* @__PURE__ */ React12.createElement(ElevationProvider, {
560
+ elevation: "dialog"
561
+ }, /* @__PURE__ */ React12.createElement(DialogRootPrimitive, props));
562
+ var DialogTrigger = DialogTriggerPrimitive;
563
+ var DialogPortal = DialogPortalPrimitive;
564
+ var DIALOG_OVERLAY_NAME = "DialogOverlay";
565
+ var [OverlayLayoutProvider, useOverlayLayoutContext] = createContext4(DIALOG_OVERLAY_NAME, {});
566
+ var DialogOverlay = /* @__PURE__ */ forwardRef10(({ classNames, children, blockAlign, ...props }, forwardedRef) => {
567
+ const { tx } = useThemeContext();
568
+ return /* @__PURE__ */ React12.createElement(DialogOverlayPrimitive, {
569
+ ...props,
570
+ className: tx("dialog.overlay", "dialog__overlay", {}, classNames),
571
+ ref: forwardedRef,
572
+ "data-block-align": blockAlign
573
+ }, /* @__PURE__ */ React12.createElement(OverlayLayoutProvider, {
574
+ inOverlayLayout: true
575
+ }, children));
576
+ });
577
+ DialogOverlay.displayName = DIALOG_OVERLAY_NAME;
578
+ var DIALOG_CONTENT_NAME = "DialogContent";
579
+ var DialogContent = /* @__PURE__ */ forwardRef10(({ classNames, children, size, inOverlayLayout: propsInOverlayLayout, ...props }, forwardedRef) => {
580
+ const { tx } = useThemeContext();
581
+ const { inOverlayLayout } = useOverlayLayoutContext(DIALOG_CONTENT_NAME);
582
+ return /* @__PURE__ */ React12.createElement(DialogContentPrimitive, {
583
+ // NOTE: Radix warning unless set to undefined.
584
+ // https://www.radix-ui.com/primitives/docs/components/dialog#description
585
+ "aria-describedby": void 0,
586
+ ...props,
587
+ className: tx("dialog.content", "dialog", {
588
+ inOverlayLayout: propsInOverlayLayout || inOverlayLayout,
589
+ size
590
+ }, classNames),
591
+ ref: forwardedRef
592
+ }, children);
593
+ });
594
+ DialogContent.displayName = DIALOG_CONTENT_NAME;
595
+ var DialogHeader = /* @__PURE__ */ forwardRef10(({ classNames, srOnly, ...props }, forwardedRef) => {
596
+ const { tx } = useThemeContext();
597
+ return /* @__PURE__ */ React12.createElement("div", {
598
+ ...props,
599
+ role: "header",
600
+ className: tx("dialog.header", "dialog__header", {
601
+ srOnly
602
+ }, classNames),
603
+ ref: forwardedRef
604
+ });
605
+ });
606
+ var DialogTitle = /* @__PURE__ */ forwardRef10(({ classNames, srOnly, ...props }, forwardedRef) => {
607
+ const { tx } = useThemeContext();
608
+ return /* @__PURE__ */ React12.createElement(DialogTitlePrimitive, {
609
+ ...props,
610
+ className: tx("dialog.title", "dialog__title", {
611
+ srOnly
612
+ }, classNames),
613
+ ref: forwardedRef
614
+ });
615
+ });
616
+ var DialogDescription = /* @__PURE__ */ forwardRef10(({ classNames, srOnly, ...props }, forwardedRef) => {
617
+ const { tx } = useThemeContext();
618
+ return /* @__PURE__ */ React12.createElement(DialogDescriptionPrimitive, {
619
+ ...props,
620
+ className: tx("dialog.description", "dialog__description", {
621
+ srOnly
622
+ }, classNames),
623
+ ref: forwardedRef
624
+ });
625
+ });
626
+ var DialogClose = DialogClosePrimitive;
627
+ var DialogCloseIconButton = /* @__PURE__ */ forwardRef10((props, forwardedRef) => {
628
+ const { t } = useTranslation2(osTranslations2);
629
+ return /* @__PURE__ */ React12.createElement(IconButton, {
630
+ ...props,
631
+ label: props.label ?? t("close dialog label"),
632
+ icon: "ph--x--regular",
633
+ iconOnly: true,
634
+ size: 4,
635
+ density: "fine",
636
+ variant: "ghost",
637
+ ref: forwardedRef
638
+ });
639
+ });
640
+ var Dialog = {
641
+ Root: DialogRoot,
642
+ Trigger: DialogTrigger,
643
+ Portal: DialogPortal,
644
+ Overlay: DialogOverlay,
645
+ Content: DialogContent,
646
+ Header: DialogHeader,
647
+ Title: DialogTitle,
648
+ Description: DialogDescription,
649
+ Close: DialogClose,
650
+ CloseIconButton: DialogCloseIconButton
651
+ };
652
+
653
+ // src/components/Dialog/AlertDialog.tsx
654
+ import { AlertDialogAction as AlertDialogActionPrimitive, AlertDialogCancel as AlertDialogCancelPrimitive, AlertDialogContent as AlertDialogContentPrimitive, AlertDialogDescription as AlertDialogDescriptionPrimitive, AlertDialogOverlay as AlertDialogOverlayPrimitive, AlertDialogPortal as AlertDialogPortalPrimitive, Root as AlertDialogRootPrimitive, AlertDialogTitle as AlertDialogTitlePrimitive, AlertDialogTrigger as AlertDialogTriggerPrimitive } from "@radix-ui/react-alert-dialog";
655
+ import { createContext as createContext5 } from "@radix-ui/react-context";
656
+ import React13, { forwardRef as forwardRef11 } from "react";
657
+ var AlertDialogRoot = (props) => /* @__PURE__ */ React13.createElement(ElevationProvider, {
658
+ elevation: "dialog"
659
+ }, /* @__PURE__ */ React13.createElement(AlertDialogRootPrimitive, props));
660
+ var AlertDialogTrigger = AlertDialogTriggerPrimitive;
661
+ var AlertDialogPortal = AlertDialogPortalPrimitive;
662
+ var AlertDialogCancel = AlertDialogCancelPrimitive;
663
+ var AlertDialogAction = AlertDialogActionPrimitive;
664
+ var AlertDialogTitle = /* @__PURE__ */ forwardRef11(({ classNames, srOnly, ...props }, forwardedRef) => {
665
+ const { tx } = useThemeContext();
666
+ return /* @__PURE__ */ React13.createElement(AlertDialogTitlePrimitive, {
667
+ ...props,
668
+ className: tx("dialog.title", "dialog--alert__title", {
669
+ srOnly
670
+ }, classNames),
671
+ ref: forwardedRef
672
+ });
673
+ });
674
+ var AlertDialogDescription = /* @__PURE__ */ forwardRef11(({ classNames, srOnly, ...props }, forwardedRef) => {
675
+ const { tx } = useThemeContext();
676
+ return /* @__PURE__ */ React13.createElement(AlertDialogDescriptionPrimitive, {
677
+ ...props,
678
+ className: tx("dialog.description", "dialog--alert__description", {
679
+ srOnly
680
+ }, classNames),
681
+ ref: forwardedRef
682
+ });
683
+ });
684
+ var ALERT_DIALOG_OVERLAY_NAME = "AlertDialogOverlay";
685
+ var ALERT_DIALOG_CONTENT_NAME = "AlertDialogContent";
686
+ var [OverlayLayoutProvider2, useOverlayLayoutContext2] = createContext5(ALERT_DIALOG_OVERLAY_NAME, {
687
+ inOverlayLayout: false
688
+ });
689
+ var AlertDialogOverlay = /* @__PURE__ */ forwardRef11(({ classNames, children, blockAlign, ...props }, forwardedRef) => {
690
+ const { tx } = useThemeContext();
691
+ return /* @__PURE__ */ React13.createElement(AlertDialogOverlayPrimitive, {
692
+ ...props,
693
+ className: tx("dialog.overlay", "dialog--alert__overlay", {}, classNames, "data-[block-align=start]:justify-center", "data-[block-align=start]:items-start", "data-[block-align=center]:place-content-center"),
694
+ ref: forwardedRef,
695
+ "data-block-align": blockAlign
696
+ }, /* @__PURE__ */ React13.createElement(OverlayLayoutProvider2, {
697
+ inOverlayLayout: true
698
+ }, children));
699
+ });
700
+ AlertDialogOverlay.displayName = ALERT_DIALOG_OVERLAY_NAME;
701
+ var AlertDialogContent = /* @__PURE__ */ forwardRef11(({ classNames, children, ...props }, forwardedRef) => {
702
+ const { tx } = useThemeContext();
703
+ const { inOverlayLayout } = useOverlayLayoutContext2(ALERT_DIALOG_CONTENT_NAME);
704
+ return /* @__PURE__ */ React13.createElement(AlertDialogContentPrimitive, {
705
+ ...props,
706
+ className: tx("dialog.content", "dialog--alert", {
707
+ inOverlayLayout
708
+ }, classNames),
709
+ ref: forwardedRef
710
+ }, children);
711
+ });
712
+ AlertDialogContent.displayName = ALERT_DIALOG_CONTENT_NAME;
713
+ var AlertDialog = {
714
+ Root: AlertDialogRoot,
715
+ Trigger: AlertDialogTrigger,
716
+ Portal: AlertDialogPortal,
717
+ Overlay: AlertDialogOverlay,
718
+ Content: AlertDialogContent,
719
+ Title: AlertDialogTitle,
720
+ Description: AlertDialogDescription,
721
+ Cancel: AlertDialogCancel,
722
+ Action: AlertDialogAction
723
+ };
724
+
725
+ // src/components/Input/Input.tsx
726
+ import { Root as CheckboxPrimitive } from "@radix-ui/react-checkbox";
727
+ import { useControllableState } from "@radix-ui/react-use-controllable-state";
728
+ import React14, { forwardRef as forwardRef12, useCallback as useCallback4 } from "react";
729
+ import { DescriptionAndValidation as DescriptionAndValidationPrimitive, Description as DescriptionPrimitive, INPUT_NAME, InputRoot, Label as LabelPrimitive, PinInput as PinInputPrimitive, TextArea as TextAreaPrimitive, TextInput as TextInputPrimitive, Validation as ValidationPrimitive, useInputContext } from "@dxos/react-input";
730
+ import { mx as mx3 } from "@dxos/ui-theme";
731
+ var Label = /* @__PURE__ */ forwardRef12(({ srOnly, classNames, children, ...props }, forwardedRef) => {
732
+ const { tx } = useThemeContext();
733
+ return /* @__PURE__ */ React14.createElement(LabelPrimitive, {
734
+ ...props,
735
+ className: tx("input.label", "input__label", {
736
+ srOnly
737
+ }, classNames),
738
+ ref: forwardedRef
739
+ }, children);
740
+ });
741
+ var Description = /* @__PURE__ */ forwardRef12(({ srOnly, classNames, children, ...props }, forwardedRef) => {
742
+ const { tx } = useThemeContext();
743
+ return /* @__PURE__ */ React14.createElement(DescriptionPrimitive, {
744
+ ...props,
745
+ className: tx("input.description", "input__description", {
746
+ srOnly
747
+ }, classNames),
748
+ ref: forwardedRef
749
+ }, children);
750
+ });
751
+ var Validation = /* @__PURE__ */ forwardRef12(({ __inputScope, srOnly, classNames, children, ...props }, forwardedRef) => {
752
+ const { tx } = useThemeContext();
753
+ const { validationValence } = useInputContext(INPUT_NAME, __inputScope);
754
+ return /* @__PURE__ */ React14.createElement(ValidationPrimitive, {
755
+ ...props,
756
+ className: tx("input.validation", `input__validation-message input__validation-message--${validationValence}`, {
757
+ srOnly,
758
+ validationValence
759
+ }, classNames),
760
+ ref: forwardedRef
761
+ }, children);
762
+ });
763
+ var DescriptionAndValidation = /* @__PURE__ */ forwardRef12(({ srOnly, classNames, children, ...props }, forwardedRef) => {
764
+ const { tx } = useThemeContext();
765
+ return /* @__PURE__ */ React14.createElement(DescriptionAndValidationPrimitive, {
766
+ ...props,
767
+ className: tx("input.descriptionAndValidation", "input__description-and-validation", {
768
+ srOnly
769
+ }, classNames),
770
+ ref: forwardedRef
771
+ }, children);
772
+ });
773
+ var PinInput = /* @__PURE__ */ forwardRef12(({ density: propsDensity, elevation: propsElevation, segmentClassName: propsSegmentClassName, inputClassName, variant, ...props }, forwardedRef) => {
774
+ const { hasIosKeyboard: hasIosKeyboard2 } = useThemeContext();
775
+ const { tx } = useThemeContext();
776
+ const density = useDensityContext(propsDensity);
777
+ const elevation = useElevationContext(propsElevation);
778
+ const segmentClassName = useCallback4(({ focused, validationValence }) => tx("input.input", "input--pin-segment", {
779
+ variant: "static",
780
+ focused,
781
+ disabled: props.disabled,
782
+ density,
783
+ elevation,
784
+ validationValence
785
+ }, propsSegmentClassName), [
786
+ tx,
787
+ props.disabled,
788
+ elevation,
789
+ propsElevation,
790
+ density
791
+ ]);
792
+ return /* @__PURE__ */ React14.createElement(PinInputPrimitive, {
793
+ ...props,
794
+ segmentClassName,
795
+ ...props.autoFocus && !hasIosKeyboard2 && {
796
+ autoFocus: true
797
+ },
798
+ inputClassName: tx("input.inputWithSegments", "input input--pin", {
799
+ disabled: props.disabled
800
+ }, inputClassName),
801
+ ref: forwardedRef
802
+ });
803
+ });
804
+ var TextInput = /* @__PURE__ */ forwardRef12(({ __inputScope, classNames, density: propsDensity, elevation: propsElevation, variant, noAutoFill, ...props }, forwardedRef) => {
805
+ const { hasIosKeyboard: hasIosKeyboard2 } = useThemeContext();
806
+ const themeContextValue = useThemeContext();
807
+ const density = useDensityContext(propsDensity);
808
+ const elevation = useElevationContext(propsElevation);
809
+ const { validationValence } = useInputContext(INPUT_NAME, __inputScope);
810
+ const { tx } = themeContextValue;
811
+ return /* @__PURE__ */ React14.createElement(TextInputPrimitive, {
812
+ ...props,
813
+ "data-1p-ignore": noAutoFill,
814
+ className: tx("input.input", "input", {
815
+ variant,
816
+ disabled: props.disabled,
817
+ density,
818
+ elevation,
819
+ validationValence
820
+ }, classNames),
821
+ ...props.autoFocus && !hasIosKeyboard2 && {
822
+ autoFocus: true
823
+ },
824
+ ref: forwardedRef
825
+ });
826
+ });
827
+ var TextArea = /* @__PURE__ */ forwardRef12(({ __inputScope, classNames, density: propsDensity, elevation: propsElevation, variant, ...props }, forwardedRef) => {
828
+ const { hasIosKeyboard: hasIosKeyboard2 } = useThemeContext();
829
+ const { tx } = useThemeContext();
830
+ const density = useDensityContext(propsDensity);
831
+ const elevation = useElevationContext(propsElevation);
832
+ const { validationValence } = useInputContext(INPUT_NAME, __inputScope);
833
+ return /* @__PURE__ */ React14.createElement(TextAreaPrimitive, {
834
+ ...props,
835
+ className: tx("input.input", "input--text-area", {
836
+ variant,
837
+ disabled: props.disabled,
838
+ density,
839
+ elevation,
840
+ validationValence
841
+ }, "-mbe-labelSpacingBlock", classNames),
842
+ ...props.autoFocus && !hasIosKeyboard2 && {
843
+ autoFocus: true
844
+ },
845
+ ref: forwardedRef
846
+ });
847
+ });
848
+ var Checkbox = /* @__PURE__ */ forwardRef12(({ __inputScope, checked: propsChecked, defaultChecked: propsDefaultChecked, onCheckedChange: propsOnCheckedChange, size, classNames, ...props }, forwardedRef) => {
849
+ const [checked, onCheckedChange] = useControllableState({
850
+ prop: propsChecked,
851
+ defaultProp: propsDefaultChecked,
852
+ onChange: propsOnCheckedChange
853
+ });
854
+ const { id, validationValence, descriptionId, errorMessageId } = useInputContext(INPUT_NAME, __inputScope);
855
+ const { tx } = useThemeContext();
856
+ return /* @__PURE__ */ React14.createElement(CheckboxPrimitive, {
857
+ ...props,
858
+ checked,
859
+ onCheckedChange,
860
+ id,
861
+ "aria-describedby": descriptionId,
862
+ ...validationValence === "error" && {
863
+ "aria-invalid": "true",
864
+ "aria-errormessage": errorMessageId
865
+ },
866
+ className: tx("input.checkbox", "input--checkbox", {
867
+ size
868
+ }, "shrink-0", classNames),
869
+ ref: forwardedRef
870
+ }, /* @__PURE__ */ React14.createElement(Icon, {
871
+ icon: checked === "indeterminate" ? "ph--minus--regular" : "ph--check--regular",
872
+ classNames: tx("input.checkboxIndicator", "input--checkbox__indicator", {
873
+ size,
874
+ checked
875
+ })
876
+ }));
877
+ });
878
+ var Switch = /* @__PURE__ */ forwardRef12(({ __inputScope, checked: propsChecked, defaultChecked: propsDefaultChecked, onCheckedChange: propsOnCheckedChange, classNames, ...props }, forwardedRef) => {
879
+ const [checked, onCheckedChange] = useControllableState({
880
+ prop: propsChecked,
881
+ defaultProp: propsDefaultChecked ?? false,
882
+ onChange: propsOnCheckedChange
883
+ });
884
+ const { id, validationValence, descriptionId, errorMessageId } = useInputContext(INPUT_NAME, __inputScope);
885
+ return /* @__PURE__ */ React14.createElement("input", {
886
+ type: "checkbox",
887
+ className: mx3("dx-checkbox--switch dx-focus-ring", classNames),
888
+ checked,
889
+ onChange: (event) => {
890
+ onCheckedChange(event.target.checked);
891
+ },
892
+ id,
893
+ "aria-describedby": descriptionId,
894
+ ...props,
895
+ ...validationValence === "error" && {
896
+ "aria-invalid": "true",
897
+ "aria-errormessage": errorMessageId
898
+ },
899
+ ref: forwardedRef
900
+ });
901
+ });
902
+ var Input = {
903
+ Root: InputRoot,
904
+ PinInput,
905
+ TextInput,
906
+ TextArea,
907
+ Checkbox,
908
+ Switch,
909
+ Label,
910
+ Description,
911
+ Validation,
912
+ DescriptionAndValidation
913
+ };
914
+
915
+ // src/components/List/List.tsx
916
+ import { Slot as Slot6 } from "@radix-ui/react-slot";
917
+ import React16, { forwardRef as forwardRef13 } from "react";
918
+ import { LIST_ITEM_NAME, LIST_NAME, ListItemCollapsibleContent, List as ListPrimitive, ListItem as ListPrimitiveItem, ListItemHeading as ListPrimitiveItemHeading, ListItemOpenTrigger as ListPrimitiveItemOpenTrigger, useListContext, useListItemContext } from "@dxos/react-list";
919
+
920
+ // src/components/List/ListDropIndicator.tsx
921
+ import React15 from "react";
922
+ var edgeToOrientationMap = {
923
+ top: "horizontal",
924
+ bottom: "horizontal",
925
+ left: "vertical",
926
+ right: "vertical"
927
+ };
928
+ var orientationStyles = {
929
+ horizontal: "h-[--line-thickness] left-[calc(var(--line-inset)+var(--terminal-radius))] right-[--line-inset] before:left-[--terminal-inset]",
930
+ vertical: "is-[--line-thickness] top-[calc(var(--line-inset)+var(--terminal-radius))] bottom-[--line-inset] before:top-[--terminal-inset]"
931
+ };
932
+ var edgeStyles = {
933
+ top: "top-[--line-offset] before:top-[--offset-terminal]",
934
+ right: "right-[--line-offset] before:right-[--offset-terminal]",
935
+ bottom: "bottom-[--line-offset] before:bottom-[--offset-terminal]",
936
+ left: "left-[--line-offset] before:left-[--offset-terminal]"
937
+ };
938
+ var strokeSize = 2;
939
+ var terminalSize = 8;
940
+ var offsetToAlignTerminalWithLine = (strokeSize - terminalSize) / 2;
941
+ var ListDropIndicator = ({ edge, gap = 0, lineInset = 0, terminalInset = lineInset - terminalSize }) => {
942
+ const orientation = edgeToOrientationMap[edge];
943
+ return /* @__PURE__ */ React15.createElement("div", {
944
+ role: "none",
945
+ style: {
946
+ "--line-thickness": `${strokeSize}px`,
947
+ "--line-offset": `calc(-0.5 * (${gap}px + ${strokeSize}px))`,
948
+ "--line-inset": `${lineInset}px`,
949
+ "--terminal-size": `${terminalSize}px`,
950
+ "--terminal-radius": `${terminalSize / 2}px`,
951
+ "--terminal-inset": `${terminalInset}px`,
952
+ "--offset-terminal": `${offsetToAlignTerminalWithLine}px`
953
+ },
954
+ className: `absolute z-10 pointer-events-none bg-accentSurface before:content-[''] before:w-[--terminal-size] before:h-[--terminal-size] box-border before:absolute before:border-[length:--line-thickness] before:border-solid before:border-accentSurface before:rounded-full ${orientationStyles[orientation]} ${edgeStyles[edge]}`
955
+ });
956
+ };
957
+
958
+ // src/components/List/List.tsx
959
+ var List = /* @__PURE__ */ forwardRef13(({ classNames, children, ...props }, forwardedRef) => {
960
+ const { tx } = useThemeContext();
961
+ const density = useDensityContext(props.density);
962
+ return /* @__PURE__ */ React16.createElement(DensityProvider, {
963
+ density
964
+ }, /* @__PURE__ */ React16.createElement(ListPrimitive, {
965
+ ...props,
966
+ className: tx("list.root", "list", {}, classNames),
967
+ ref: forwardedRef
968
+ }, children));
969
+ });
970
+ var ListItemEndcap = /* @__PURE__ */ forwardRef13(({ children, classNames, asChild, ...props }, forwardedRef) => {
971
+ const Root6 = asChild ? Slot6 : "div";
972
+ const density = useDensityContext();
973
+ const { tx } = useThemeContext();
974
+ return /* @__PURE__ */ React16.createElement(Root6, {
975
+ ...!asChild && {
976
+ role: "none"
977
+ },
978
+ ...props,
979
+ className: tx("list.item.endcap", "list__listItem__endcap", {
980
+ density
981
+ }, classNames),
982
+ ref: forwardedRef
983
+ }, children);
984
+ });
985
+ var MockListItemOpenTrigger = ({ classNames, ...props }) => {
986
+ const density = useDensityContext();
987
+ const { tx } = useThemeContext();
988
+ return /* @__PURE__ */ React16.createElement("div", {
989
+ role: "none",
990
+ ...props,
991
+ className: tx("list.item.openTrigger", "list__listItem__openTrigger--mock", {
992
+ density
993
+ }, classNames)
994
+ });
995
+ };
996
+ var ListItemHeading = /* @__PURE__ */ forwardRef13(({ children, classNames, ...props }, forwardedRef) => {
997
+ const { tx } = useThemeContext();
998
+ const density = useDensityContext();
999
+ return /* @__PURE__ */ React16.createElement(ListPrimitiveItemHeading, {
1000
+ ...props,
1001
+ className: tx("list.item.heading", "list__listItem__heading", {
1002
+ density
1003
+ }, classNames),
1004
+ ref: forwardedRef
1005
+ }, children);
1006
+ });
1007
+ var ListItemOpenTrigger = /* @__PURE__ */ forwardRef13(({ __listItemScope, classNames, children, ...props }, forwardedRef) => {
1008
+ const { tx } = useThemeContext();
1009
+ const density = useDensityContext();
1010
+ const { open } = useListItemContext(LIST_ITEM_NAME, __listItemScope);
1011
+ return /* @__PURE__ */ React16.createElement(ListPrimitiveItemOpenTrigger, {
1012
+ ...props,
1013
+ className: tx("list.item.openTrigger", "list__listItem__openTrigger", {
1014
+ density
1015
+ }, classNames),
1016
+ ref: forwardedRef
1017
+ }, children || /* @__PURE__ */ React16.createElement(Icon, {
1018
+ size: 3,
1019
+ icon: open ? "ph--caret-down--bold" : "ph--caret-right--bold",
1020
+ classNames: tx("list.item.openTriggerIcon", "list__listItem__openTrigger__icon", {})
1021
+ }));
1022
+ });
1023
+ var ListItemRoot = /* @__PURE__ */ forwardRef13(({ classNames, children, ...props }, forwardedRef) => {
1024
+ const { tx } = useThemeContext();
1025
+ const density = useDensityContext();
1026
+ return /* @__PURE__ */ React16.createElement(ListPrimitiveItem, {
1027
+ ...props,
1028
+ className: tx("list.item.root", "list__listItem", {
1029
+ density,
1030
+ collapsible: props.collapsible
1031
+ }, classNames),
1032
+ ref: forwardedRef
1033
+ }, children);
1034
+ });
1035
+ var ListItem = {
1036
+ Root: ListItemRoot,
1037
+ Endcap: ListItemEndcap,
1038
+ Heading: ListItemHeading,
1039
+ OpenTrigger: ListItemOpenTrigger,
1040
+ CollapsibleContent: ListItemCollapsibleContent,
1041
+ MockOpenTrigger: MockListItemOpenTrigger,
1042
+ DropIndicator: ListDropIndicator
1043
+ };
1044
+
1045
+ // src/components/List/Tree.tsx
1046
+ import React18, { forwardRef as forwardRef14 } from "react";
1047
+
1048
+ // src/components/List/TreeDropIndicator.tsx
1049
+ import React17 from "react";
1050
+ var edgeToOrientationMap2 = {
1051
+ "reorder-above": "sibling",
1052
+ "reorder-below": "sibling",
1053
+ "make-child": "child",
1054
+ reparent: "child"
1055
+ };
1056
+ var orientationStyles2 = {
1057
+ // TODO(wittjosiah): Stop using left/right here.
1058
+ sibling: "bs-[--line-thickness] left-[--horizontal-indent] right-0 bg-accentSurface before:left-[--negative-terminal-size]",
1059
+ child: "is-full block-start-0 block-end-0 border-[length:--line-thickness] before:invisible"
1060
+ };
1061
+ var instructionStyles = {
1062
+ "reorder-above": "block-start-[--line-offset] before:block-start-[--offset-terminal]",
1063
+ "reorder-below": "block-end-[--line-offset] before:block-end-[--offset-terminal]",
1064
+ "make-child": "border-accentSurface",
1065
+ // TODO(wittjosiah): This is not occurring in the current implementation.
1066
+ reparent: ""
1067
+ };
1068
+ var strokeSize2 = 2;
1069
+ var terminalSize2 = 8;
1070
+ var offsetToAlignTerminalWithLine2 = (strokeSize2 - terminalSize2) / 2;
1071
+ var TreeDropIndicator = ({ instruction, gap = 0 }) => {
1072
+ const lineOffset = `calc(-0.5 * (${gap}px + ${strokeSize2}px))`;
1073
+ const isBlocked = instruction.type === "instruction-blocked";
1074
+ const desiredInstruction = isBlocked ? instruction.desired : instruction;
1075
+ const orientation = edgeToOrientationMap2[desiredInstruction.type];
1076
+ if (isBlocked) {
1077
+ return null;
1078
+ }
1079
+ return /* @__PURE__ */ React17.createElement("div", {
1080
+ style: {
1081
+ "--line-thickness": `${strokeSize2}px`,
1082
+ "--line-offset": `${lineOffset}`,
1083
+ "--terminal-size": `${terminalSize2}px`,
1084
+ "--terminal-radius": `${terminalSize2 / 2}px`,
1085
+ "--negative-terminal-size": `-${terminalSize2}px`,
1086
+ "--offset-terminal": `${offsetToAlignTerminalWithLine2}px`,
1087
+ "--horizontal-indent": `${desiredInstruction.currentLevel * desiredInstruction.indentPerLevel + 4}px`
1088
+ },
1089
+ className: `absolute z-10 pointer-events-none before:is-[--terminal-size] before:bs-[--terminal-size] box-border before:absolute before:border-[length:--line-thickness] before:border-solid before:border-accentSurface before:rounded-full ${orientationStyles2[orientation]} ${instructionStyles[desiredInstruction.type]}`
1090
+ });
1091
+ };
1092
+
1093
+ // src/components/List/Tree.tsx
1094
+ var TreeRoot = /* @__PURE__ */ forwardRef14((props, forwardedRef) => {
1095
+ return /* @__PURE__ */ React18.createElement(List, {
1096
+ ...props,
1097
+ ref: forwardedRef
1098
+ });
1099
+ });
1100
+ var TreeBranch = /* @__PURE__ */ forwardRef14(({ __listScope, ...props }, forwardedRef) => {
1101
+ const { headingId } = useListItemContext(LIST_ITEM_NAME, __listScope);
1102
+ return /* @__PURE__ */ React18.createElement(List, {
1103
+ ...props,
1104
+ "aria-labelledby": headingId,
1105
+ ref: forwardedRef
1106
+ });
1107
+ });
1108
+ var TreeItemRoot = /* @__PURE__ */ forwardRef14((props, forwardedRef) => {
1109
+ return /* @__PURE__ */ React18.createElement(ListItem.Root, {
1110
+ role: "treeitem",
1111
+ ...props,
1112
+ ref: forwardedRef
1113
+ });
1114
+ });
1115
+ var TreeItemHeading = ListItem.Heading;
1116
+ var TreeItemOpenTrigger = ListItem.OpenTrigger;
1117
+ var MockTreeItemOpenTrigger = ListItem.MockOpenTrigger;
1118
+ var TreeItemBody = ListItem.CollapsibleContent;
1119
+ var Tree = {
1120
+ Root: TreeRoot,
1121
+ Branch: TreeBranch
1122
+ };
1123
+ var TreeItem = {
1124
+ Root: TreeItemRoot,
1125
+ Heading: TreeItemHeading,
1126
+ Body: TreeItemBody,
1127
+ OpenTrigger: TreeItemOpenTrigger,
1128
+ MockOpenTrigger: MockTreeItemOpenTrigger,
1129
+ DropIndicator: TreeDropIndicator
1130
+ };
1131
+
1132
+ // src/components/List/Treegrid.tsx
1133
+ import { useFocusFinders } from "@fluentui/react-tabster";
1134
+ import { createContextScope } from "@radix-ui/react-context";
1135
+ import { Primitive as Primitive6 } from "@radix-ui/react-primitive";
1136
+ import { Slot as Slot7 } from "@radix-ui/react-slot";
1137
+ import { useControllableState as useControllableState2 } from "@radix-ui/react-use-controllable-state";
1138
+ import React19, { forwardRef as forwardRef15, useCallback as useCallback5 } from "react";
1139
+ var TREEGRID_ROW_NAME = "TreegridRow";
1140
+ var [createTreegridRowContext, createTreegridRowScope] = createContextScope(TREEGRID_ROW_NAME, []);
1141
+ var [TreegridRowProvider, useTreegridRowContext] = createTreegridRowContext(TREEGRID_ROW_NAME);
1142
+ var PATH_SEPARATOR = "~";
1143
+ var PARENT_OF_SEPARATOR = " ";
1144
+ var TreegridRoot = /* @__PURE__ */ forwardRef15(({ asChild, classNames, children, style, gridTemplateColumns, ...props }, forwardedRef) => {
1145
+ const { tx } = useThemeContext();
1146
+ const Root6 = asChild ? Slot7 : Primitive6.div;
1147
+ const { findFirstFocusable } = useFocusFinders();
1148
+ const handleKeyDown = useCallback5((event) => {
1149
+ switch (event.key) {
1150
+ case "ArrowDown":
1151
+ case "ArrowUp": {
1152
+ const direction = event.key === "ArrowDown" ? "down" : "up";
1153
+ const target = event.target;
1154
+ const ancestorWithArrowKeys = target.closest(`[data-arrow-keys*="${direction}"], [data-arrow-keys="all"]`);
1155
+ if (!ancestorWithArrowKeys) {
1156
+ const currentRow = target.closest('[role="row"]');
1157
+ if (currentRow) {
1158
+ const treegrid = currentRow.closest('[role="treegrid"]');
1159
+ if (treegrid) {
1160
+ const rows = Array.from(treegrid.querySelectorAll('[role="row"]'));
1161
+ const currentIndex = rows.indexOf(currentRow);
1162
+ const nextIndex = direction === "down" ? currentIndex + 1 : currentIndex - 1;
1163
+ const targetRow = rows[nextIndex];
1164
+ if (targetRow) {
1165
+ const firstFocusable = findFirstFocusable(targetRow);
1166
+ if (firstFocusable) {
1167
+ event.preventDefault();
1168
+ firstFocusable.focus();
1169
+ }
1170
+ }
1171
+ }
1172
+ }
1173
+ }
1174
+ break;
1175
+ }
1176
+ }
1177
+ props.onKeyDown?.(event);
1178
+ }, [
1179
+ findFirstFocusable
1180
+ ]);
1181
+ return /* @__PURE__ */ React19.createElement(Root6, {
1182
+ role: "treegrid",
1183
+ onKeyDown: handleKeyDown,
1184
+ ...props,
1185
+ className: tx("treegrid.root", "treegrid", {}, classNames),
1186
+ style: {
1187
+ ...style,
1188
+ gridTemplateColumns
1189
+ },
1190
+ ref: forwardedRef
1191
+ }, children);
1192
+ });
1193
+ var TreegridRow = /* @__PURE__ */ forwardRef15(({ __treegridRowScope, asChild, classNames, children, id, parentOf, open: propsOpen, defaultOpen, onOpenChange: propsOnOpenChange, ...props }, forwardedRef) => {
1194
+ const { tx } = useThemeContext();
1195
+ const Root6 = asChild ? Slot7 : Primitive6.div;
1196
+ const pathParts = id.split(PATH_SEPARATOR);
1197
+ const level = pathParts.length - 1;
1198
+ const [open, onOpenChange] = useControllableState2({
1199
+ prop: propsOpen,
1200
+ onChange: propsOnOpenChange,
1201
+ defaultProp: defaultOpen
1202
+ });
1203
+ return /* @__PURE__ */ React19.createElement(TreegridRowProvider, {
1204
+ open,
1205
+ onOpenChange,
1206
+ scope: __treegridRowScope
1207
+ }, /* @__PURE__ */ React19.createElement(Root6, {
1208
+ role: "row",
1209
+ "aria-level": level,
1210
+ className: tx("treegrid.row", "treegrid__row", {
1211
+ level
1212
+ }, classNames),
1213
+ ...parentOf && {
1214
+ "aria-expanded": open,
1215
+ "aria-owns": parentOf
1216
+ },
1217
+ ...props,
1218
+ id,
1219
+ ref: forwardedRef
1220
+ }, children));
1221
+ });
1222
+ var TreegridCell = /* @__PURE__ */ forwardRef15(({ classNames, children, indent, ...props }, forwardedRef) => {
1223
+ const { tx } = useThemeContext();
1224
+ return /* @__PURE__ */ React19.createElement("div", {
1225
+ role: "gridcell",
1226
+ className: tx("treegrid.cell", "treegrid__cell", {
1227
+ indent
1228
+ }, classNames),
1229
+ ...props,
1230
+ ref: forwardedRef
1231
+ }, children);
1232
+ });
1233
+ var Treegrid = {
1234
+ Root: TreegridRoot,
1235
+ Row: TreegridRow,
1236
+ Cell: TreegridCell,
1237
+ PARENT_OF_SEPARATOR,
1238
+ PATH_SEPARATOR,
1239
+ createTreegridRowScope,
1240
+ useTreegridRowContext
1241
+ };
1242
+
1243
+ // src/components/Main/Main.tsx
1244
+ import { useFocusableGroup } from "@fluentui/react-tabster";
1245
+ import { createContext as createContext6 } from "@radix-ui/react-context";
1246
+ import { DialogContent as DialogContent2, Root as DialogRoot2, DialogTitle as DialogTitle2 } from "@radix-ui/react-dialog";
1247
+ import { Primitive as Primitive7 } from "@radix-ui/react-primitive";
1248
+ import { Slot as Slot8 } from "@radix-ui/react-slot";
1249
+ import { useControllableState as useControllableState3 } from "@radix-ui/react-use-controllable-state";
1250
+ import React20, { forwardRef as forwardRef16, useCallback as useCallback7, useEffect as useEffect3, useRef, useState as useState5 } from "react";
1251
+ import { log } from "@dxos/log";
1252
+ import { useForwardedRef, useMediaQuery } from "@dxos/react-hooks";
1253
+
1254
+ // src/components/Main/useSwipeToDismiss.ts
1255
+ import { useCallback as useCallback6, useEffect as useEffect2, useState as useState4 } from "react";
1256
+ var useSwipeToDismiss = (ref, {
1257
+ onDismiss,
1258
+ dismissThreshold = 64,
1259
+ debounceThreshold = 8,
1260
+ offset = 0
1261
+ /* side = 'inline-start' */
1262
+ }) => {
1263
+ const $root = ref.current;
1264
+ const [motionState, setMotionState] = useState4(0);
1265
+ const [gestureStartX, setGestureStartX] = useState4(0);
1266
+ const setIdle = useCallback6(() => {
1267
+ setMotionState(0);
1268
+ $root?.style.removeProperty("inset-inline-start");
1269
+ $root?.style.setProperty("transition-duration", "200ms");
1270
+ }, [
1271
+ $root
1272
+ ]);
1273
+ const setFollowing = useCallback6(() => {
1274
+ setMotionState(2);
1275
+ $root?.style.setProperty("transition-duration", "0ms");
1276
+ }, [
1277
+ $root
1278
+ ]);
1279
+ const handlePointerDown = useCallback6(({ screenX }) => {
1280
+ if (motionState === 0) {
1281
+ setMotionState(1);
1282
+ setGestureStartX(screenX);
1283
+ }
1284
+ }, [
1285
+ motionState
1286
+ ]);
1287
+ const handlePointerMove = useCallback6(({ screenX }) => {
1288
+ if ($root) {
1289
+ const delta = Math.min(screenX - gestureStartX, 0);
1290
+ switch (motionState) {
1291
+ case 2:
1292
+ if (Math.abs(delta) > dismissThreshold) {
1293
+ setIdle();
1294
+ onDismiss?.();
1295
+ } else {
1296
+ $root.style.setProperty("inset-inline-start", `${offset + delta}px`);
1297
+ }
1298
+ break;
1299
+ case 1:
1300
+ if (Math.abs(delta) > debounceThreshold) {
1301
+ setFollowing();
1302
+ }
1303
+ break;
1304
+ }
1305
+ }
1306
+ }, [
1307
+ $root,
1308
+ motionState,
1309
+ gestureStartX
1310
+ ]);
1311
+ const handlePointerUp = useCallback6(() => {
1312
+ setIdle();
1313
+ }, [
1314
+ setIdle
1315
+ ]);
1316
+ useEffect2(() => {
1317
+ $root?.addEventListener("pointerdown", handlePointerDown);
1318
+ return () => {
1319
+ $root?.removeEventListener("pointerdown", handlePointerDown);
1320
+ };
1321
+ }, [
1322
+ $root,
1323
+ handlePointerDown
1324
+ ]);
1325
+ useEffect2(() => {
1326
+ $root && document.documentElement.addEventListener("pointermove", handlePointerMove);
1327
+ return () => {
1328
+ document.documentElement.removeEventListener("pointermove", handlePointerMove);
1329
+ };
1330
+ }, [
1331
+ $root,
1332
+ handlePointerMove
1333
+ ]);
1334
+ useEffect2(() => {
1335
+ $root && document.documentElement.addEventListener("pointerup", handlePointerUp);
1336
+ return () => {
1337
+ document.documentElement.removeEventListener("pointerup", handlePointerUp);
1338
+ };
1339
+ }, [
1340
+ $root,
1341
+ handlePointerUp
1342
+ ]);
1343
+ };
1344
+
1345
+ // src/components/Main/Main.tsx
1346
+ var __dxlog_file = "/__w/dxos/dxos/packages/ui/react-ui/src/components/Main/Main.tsx";
1347
+ var MAIN_NAME = "Main";
1348
+ var MAIN_ROOT_NAME = "MainRoot";
1349
+ var NAVIGATION_SIDEBAR_NAME = "NavigationSidebar";
1350
+ var COMPLEMENTARY_SIDEBAR_NAME = "ComplementarySidebar";
1351
+ var GENERIC_CONSUMER_NAME = "GenericConsumer";
1352
+ var landmarkAttr = "data-main-landmark";
1353
+ var useLandmarkMover = (propsOnKeyDown, landmark) => {
1354
+ const handleKeyDown = useCallback7((event) => {
1355
+ const target = event.target;
1356
+ if (event.target === event.currentTarget && event.key === "Tab" && target.hasAttribute(landmarkAttr)) {
1357
+ event.preventDefault();
1358
+ const landmarks = Array.from(document.querySelectorAll(`[${landmarkAttr}]:not([inert])`)).map((el) => el.hasAttribute(landmarkAttr) ? parseInt(el.getAttribute(landmarkAttr)) : NaN).sort();
1359
+ const l = landmarks.length;
1360
+ const cursor = landmarks.indexOf(parseInt(target.getAttribute(landmarkAttr)));
1361
+ const nextLandmark = landmarks[(cursor + l + (event.getModifierState("Shift") ? -1 : 1)) % l];
1362
+ document.querySelector(`[${landmarkAttr}="${nextLandmark}"]`)?.focus();
1363
+ }
1364
+ propsOnKeyDown?.(event);
1365
+ }, [
1366
+ propsOnKeyDown
1367
+ ]);
1368
+ const focusableGroupAttrs = useFocusableGroup({
1369
+ tabBehavior: "limited",
1370
+ ignoreDefaultKeydown: {
1371
+ Tab: true
1372
+ }
1373
+ });
1374
+ return {
1375
+ onKeyDown: handleKeyDown,
1376
+ [landmarkAttr]: landmark,
1377
+ tabIndex: 0,
1378
+ ...focusableGroupAttrs
1379
+ };
1380
+ };
1381
+ var [MainProvider, useMainContext] = createContext6(MAIN_NAME, {
1382
+ resizing: false,
1383
+ navigationSidebarState: "closed",
1384
+ setNavigationSidebarState: (_nextState) => {
1385
+ log.warn("Attempt to set sidebar state without initializing `MainRoot`", void 0, {
1386
+ F: __dxlog_file,
1387
+ L: 92,
1388
+ S: void 0,
1389
+ C: (f, a) => f(...a)
1390
+ });
1391
+ },
1392
+ complementarySidebarState: "closed",
1393
+ setComplementarySidebarState: (_nextState) => {
1394
+ log.warn("Attempt to set sidebar state without initializing `MainRoot`", void 0, {
1395
+ F: __dxlog_file,
1396
+ L: 97,
1397
+ S: void 0,
1398
+ C: (f, a) => f(...a)
1399
+ });
1400
+ }
1401
+ });
1402
+ var useSidebars = (consumerName = GENERIC_CONSUMER_NAME) => {
1403
+ const { setNavigationSidebarState, navigationSidebarState, setComplementarySidebarState, complementarySidebarState } = useMainContext(consumerName);
1404
+ return {
1405
+ navigationSidebarState,
1406
+ setNavigationSidebarState,
1407
+ toggleNavigationSidebar: useCallback7(() => setNavigationSidebarState(navigationSidebarState === "expanded" ? "closed" : "expanded"), [
1408
+ navigationSidebarState,
1409
+ setNavigationSidebarState
1410
+ ]),
1411
+ openNavigationSidebar: useCallback7(() => setNavigationSidebarState("expanded"), []),
1412
+ collapseNavigationSidebar: useCallback7(() => setNavigationSidebarState("collapsed"), []),
1413
+ closeNavigationSidebar: useCallback7(() => setNavigationSidebarState("closed"), []),
1414
+ complementarySidebarState,
1415
+ setComplementarySidebarState,
1416
+ toggleComplementarySidebar: useCallback7(() => setComplementarySidebarState(complementarySidebarState === "expanded" ? "closed" : "expanded"), [
1417
+ complementarySidebarState,
1418
+ setComplementarySidebarState
1419
+ ]),
1420
+ openComplementarySidebar: useCallback7(() => setComplementarySidebarState("expanded"), []),
1421
+ collapseComplementarySidebar: useCallback7(() => setComplementarySidebarState("collapsed"), []),
1422
+ closeComplementarySidebar: useCallback7(() => setComplementarySidebarState("closed"), [])
1423
+ };
1424
+ };
1425
+ var resizeDebounce = 3e3;
1426
+ var MainRoot = ({ navigationSidebarState: propsNavigationSidebarState, defaultNavigationSidebarState, onNavigationSidebarStateChange, complementarySidebarState: propsComplementarySidebarState, defaultComplementarySidebarState, onComplementarySidebarStateChange, children, ...props }) => {
1427
+ const [isLg] = useMediaQuery("lg");
1428
+ const [navigationSidebarState = isLg ? "expanded" : "collapsed", setNavigationSidebarState] = useControllableState3({
1429
+ prop: propsNavigationSidebarState,
1430
+ defaultProp: defaultNavigationSidebarState,
1431
+ onChange: onNavigationSidebarStateChange
1432
+ });
1433
+ const [complementarySidebarState = isLg ? "expanded" : "collapsed", setComplementarySidebarState] = useControllableState3({
1434
+ prop: propsComplementarySidebarState,
1435
+ defaultProp: defaultComplementarySidebarState,
1436
+ onChange: onComplementarySidebarStateChange
1437
+ });
1438
+ const [resizing, setResizing] = useState5(false);
1439
+ const resizeInterval = useRef(null);
1440
+ const handleResize = useCallback7(() => {
1441
+ setResizing(true);
1442
+ if (resizeInterval.current) {
1443
+ clearTimeout(resizeInterval.current);
1444
+ }
1445
+ resizeInterval.current = setTimeout(() => {
1446
+ setResizing(false);
1447
+ resizeInterval.current = null;
1448
+ }, resizeDebounce);
1449
+ }, []);
1450
+ useEffect3(() => {
1451
+ window.addEventListener("resize", handleResize);
1452
+ return () => window.removeEventListener("resize", handleResize);
1453
+ }, [
1454
+ handleResize
1455
+ ]);
1456
+ return /* @__PURE__ */ React20.createElement(MainProvider, {
1457
+ ...props,
1458
+ navigationSidebarState,
1459
+ setNavigationSidebarState,
1460
+ complementarySidebarState,
1461
+ setComplementarySidebarState,
1462
+ resizing
1463
+ }, children);
1464
+ };
1465
+ MainRoot.displayName = MAIN_ROOT_NAME;
1466
+ var handleOpenAutoFocus = (event) => {
1467
+ !document.body.hasAttribute("data-is-keyboard") && event.preventDefault();
1468
+ };
1469
+ var MainSidebar = /* @__PURE__ */ forwardRef16(({ classNames, children, swipeToDismiss, onOpenAutoFocus, state, resizing, onStateChange, side, label, ...props }, forwardedRef) => {
1470
+ const [isLg] = useMediaQuery("lg");
1471
+ const { tx } = useThemeContext();
1472
+ const { t } = useTranslation();
1473
+ const ref = useForwardedRef(forwardedRef);
1474
+ const noopRef = useRef(null);
1475
+ useSwipeToDismiss(swipeToDismiss ? ref : noopRef, {
1476
+ onDismiss: () => onStateChange?.("closed")
1477
+ });
1478
+ const handleKeyDown = useCallback7((event) => {
1479
+ const focusGroupParent = event.target.closest("[data-tabster]");
1480
+ if (event.key === "Escape" && focusGroupParent) {
1481
+ event.preventDefault();
1482
+ event.stopPropagation();
1483
+ focusGroupParent.focus();
1484
+ }
1485
+ props.onKeyDown?.(event);
1486
+ }, [
1487
+ props.onKeyDown
1488
+ ]);
1489
+ const Root6 = isLg ? Primitive7.div : DialogContent2;
1490
+ return /* @__PURE__ */ React20.createElement(DialogRoot2, {
1491
+ open: state !== "closed",
1492
+ "aria-label": toLocalizedString(label, t),
1493
+ modal: false
1494
+ }, !isLg && /* @__PURE__ */ React20.createElement(DialogTitle2, {
1495
+ className: "sr-only"
1496
+ }, toLocalizedString(label, t)), /* @__PURE__ */ React20.createElement(Root6, {
1497
+ ...!isLg && {
1498
+ forceMount: true,
1499
+ tabIndex: -1,
1500
+ onOpenAutoFocus: onOpenAutoFocus ?? handleOpenAutoFocus
1501
+ },
1502
+ ...props,
1503
+ "data-side": side === "inline-end" ? "ie" : "is",
1504
+ "data-state": state,
1505
+ "data-resizing": resizing ? "true" : "false",
1506
+ className: tx("main.sidebar", "main__sidebar", {}, classNames),
1507
+ onKeyDownCapture: handleKeyDown,
1508
+ ...state === "closed" && {
1509
+ inert: true
1510
+ },
1511
+ ref
1512
+ }, children));
1513
+ });
1514
+ var MainNavigationSidebar = /* @__PURE__ */ forwardRef16((props, forwardedRef) => {
1515
+ const { navigationSidebarState, setNavigationSidebarState, resizing } = useMainContext(NAVIGATION_SIDEBAR_NAME);
1516
+ const mover = useLandmarkMover(props.onKeyDown, "0");
1517
+ return /* @__PURE__ */ React20.createElement(MainSidebar, {
1518
+ ...mover,
1519
+ ...props,
1520
+ state: navigationSidebarState,
1521
+ onStateChange: setNavigationSidebarState,
1522
+ resizing,
1523
+ side: "inline-start",
1524
+ ref: forwardedRef
1525
+ });
1526
+ });
1527
+ MainNavigationSidebar.displayName = NAVIGATION_SIDEBAR_NAME;
1528
+ var MainComplementarySidebar = /* @__PURE__ */ forwardRef16((props, forwardedRef) => {
1529
+ const { complementarySidebarState, setComplementarySidebarState, resizing } = useMainContext(COMPLEMENTARY_SIDEBAR_NAME);
1530
+ const mover = useLandmarkMover(props.onKeyDown, "2");
1531
+ return /* @__PURE__ */ React20.createElement(MainSidebar, {
1532
+ ...mover,
1533
+ ...props,
1534
+ state: complementarySidebarState,
1535
+ onStateChange: setComplementarySidebarState,
1536
+ resizing,
1537
+ side: "inline-end",
1538
+ ref: forwardedRef
1539
+ });
1540
+ });
1541
+ MainNavigationSidebar.displayName = NAVIGATION_SIDEBAR_NAME;
1542
+ var MainContent = /* @__PURE__ */ forwardRef16(({ asChild, classNames, bounce, handlesFocus, children, role, ...props }, forwardedRef) => {
1543
+ const { navigationSidebarState, complementarySidebarState } = useMainContext(MAIN_NAME);
1544
+ const { tx } = useThemeContext();
1545
+ const Root6 = asChild ? Slot8 : role ? "div" : "main";
1546
+ const mover = useLandmarkMover(props.onKeyDown, "1");
1547
+ return /* @__PURE__ */ React20.createElement(Root6, {
1548
+ role,
1549
+ ...handlesFocus && {
1550
+ ...mover
1551
+ },
1552
+ ...props,
1553
+ "data-sidebar-inline-start-state": navigationSidebarState,
1554
+ "data-sidebar-inline-end-state": complementarySidebarState,
1555
+ "data-handles-focus": handlesFocus,
1556
+ className: tx("main.content", "main", {
1557
+ bounce,
1558
+ handlesFocus
1559
+ }, classNames),
1560
+ ref: forwardedRef
1561
+ }, children);
1562
+ });
1563
+ MainContent.displayName = MAIN_NAME;
1564
+ var MainOverlay = /* @__PURE__ */ forwardRef16(({ classNames, ...props }, forwardedRef) => {
1565
+ const [isLg] = useMediaQuery("lg");
1566
+ const { navigationSidebarState, setNavigationSidebarState, complementarySidebarState, setComplementarySidebarState } = useMainContext(MAIN_NAME);
1567
+ const { tx } = useThemeContext();
1568
+ return /* @__PURE__ */ React20.createElement("div", {
1569
+ onClick: () => {
1570
+ setNavigationSidebarState("collapsed");
1571
+ setComplementarySidebarState("collapsed");
1572
+ },
1573
+ ...props,
1574
+ className: tx("main.overlay", "main__overlay", {
1575
+ isLg,
1576
+ inlineStartSidebarOpen: navigationSidebarState,
1577
+ inlineEndSidebarOpen: complementarySidebarState
1578
+ }, classNames),
1579
+ "data-state": navigationSidebarState === "expanded" || complementarySidebarState === "expanded" ? "open" : "closed",
1580
+ "aria-hidden": "true",
1581
+ ref: forwardedRef
1582
+ });
1583
+ });
1584
+ var Main = {
1585
+ Root: MainRoot,
1586
+ Content: MainContent,
1587
+ Overlay: MainOverlay,
1588
+ NavigationSidebar: MainNavigationSidebar,
1589
+ ComplementarySidebar: MainComplementarySidebar
1590
+ };
1591
+
1592
+ // src/components/Menu/ContextMenu.tsx
1593
+ import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
1594
+ import { Primitive as Primitive8 } from "@radix-ui/react-primitive";
1595
+ import { Slot as Slot9 } from "@radix-ui/react-slot";
1596
+ import React21, { forwardRef as forwardRef17 } from "react";
1597
+
1598
+ // src/hooks/useSafeCollisionPadding.ts
1599
+ import { useMemo as useMemo2 } from "react";
1600
+ var propIsNumber = (prop) => Number.isFinite(prop);
1601
+ var propsIsRecord = (prop) => !!(prop && typeof prop === "object");
1602
+ var safePadding = (propsPadding, safePadding2, side) => {
1603
+ return (propIsNumber(safePadding2[side]) ? safePadding2[side] : 0) + (propIsNumber(propsPadding) ? propsPadding : propsIsRecord(propsPadding) ? propsPadding[side] ?? 0 : 0);
1604
+ };
1605
+ var useSafeCollisionPadding = (collisionPadding) => {
1606
+ const { safeAreaPadding } = useThemeContext();
1607
+ return useMemo2(() => ({
1608
+ top: safePadding(collisionPadding, safeAreaPadding, "top"),
1609
+ right: safePadding(collisionPadding, safeAreaPadding, "right"),
1610
+ bottom: safePadding(collisionPadding, safeAreaPadding, "bottom"),
1611
+ left: safePadding(collisionPadding, safeAreaPadding, "left")
1612
+ }), [
1613
+ collisionPadding,
1614
+ safeAreaPadding
1615
+ ]);
1616
+ };
1617
+
1618
+ // src/components/Menu/ContextMenu.tsx
1619
+ var ContextMenuRoot = ContextMenuPrimitive.ContextMenu;
1620
+ var ContextMenuTrigger = ContextMenuPrimitive.Trigger;
1621
+ var ContextMenuPortal = ContextMenuPrimitive.Portal;
1622
+ var ContextMenuContent = /* @__PURE__ */ forwardRef17(({ classNames, children, collisionPadding = 8, ...props }, forwardedRef) => {
1623
+ const { tx } = useThemeContext();
1624
+ const elevation = useElevationContext();
1625
+ const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
1626
+ return /* @__PURE__ */ React21.createElement(ContextMenuPrimitive.Content, {
1627
+ ...props,
1628
+ "data-arrow-keys": "up down",
1629
+ collisionPadding: safeCollisionPadding,
1630
+ className: tx("menu.content", "menu", {
1631
+ elevation
1632
+ }, classNames),
1633
+ ref: forwardedRef
1634
+ }, children);
1635
+ });
1636
+ var ContextMenuViewport = /* @__PURE__ */ forwardRef17(({ classNames, asChild, children, ...props }, forwardedRef) => {
1637
+ const { tx } = useThemeContext();
1638
+ const Root6 = asChild ? Slot9 : Primitive8.div;
1639
+ return /* @__PURE__ */ React21.createElement(Root6, {
1640
+ ...props,
1641
+ className: tx("menu.viewport", "menu__viewport", {}, classNames),
1642
+ ref: forwardedRef
1643
+ }, children);
1644
+ });
1645
+ var ContextMenuArrow = /* @__PURE__ */ forwardRef17(({ classNames, ...props }, forwardedRef) => {
1646
+ const { tx } = useThemeContext();
1647
+ return /* @__PURE__ */ React21.createElement(ContextMenuPrimitive.Arrow, {
1648
+ ...props,
1649
+ className: tx("menu.arrow", "menu__arrow", {}, classNames),
1650
+ ref: forwardedRef
1651
+ });
1652
+ });
1653
+ var ContextMenuGroup = ContextMenuPrimitive.Group;
1654
+ var ContextMenuItemIndicator = ContextMenuPrimitive.ItemIndicator;
1655
+ var ContextMenuItem = /* @__PURE__ */ forwardRef17(({ classNames, ...props }, forwardedRef) => {
1656
+ const { tx } = useThemeContext();
1657
+ return /* @__PURE__ */ React21.createElement(ContextMenuPrimitive.Item, {
1658
+ ...props,
1659
+ className: tx("menu.item", "menu__item", {}, classNames),
1660
+ ref: forwardedRef
1661
+ });
1662
+ });
1663
+ var ContextMenuCheckboxItem = /* @__PURE__ */ forwardRef17(({ classNames, ...props }, forwardedRef) => {
1664
+ const { tx } = useThemeContext();
1665
+ return /* @__PURE__ */ React21.createElement(ContextMenuPrimitive.CheckboxItem, {
1666
+ ...props,
1667
+ className: tx("menu.item", "menu__item--checkbox", {}, classNames),
1668
+ ref: forwardedRef
1669
+ });
1670
+ });
1671
+ var ContextMenuSeparator = /* @__PURE__ */ forwardRef17(({ classNames, ...props }, forwardedRef) => {
1672
+ const { tx } = useThemeContext();
1673
+ return /* @__PURE__ */ React21.createElement(ContextMenuPrimitive.Separator, {
1674
+ ...props,
1675
+ className: tx("menu.separator", "menu__item", {}, classNames),
1676
+ ref: forwardedRef
1677
+ });
1678
+ });
1679
+ var ContextMenuGroupLabel = /* @__PURE__ */ forwardRef17(({ classNames, ...props }, forwardedRef) => {
1680
+ const { tx } = useThemeContext();
1681
+ return /* @__PURE__ */ React21.createElement(ContextMenuPrimitive.Label, {
1682
+ ...props,
1683
+ className: tx("menu.groupLabel", "menu__group__label", {}, classNames),
1684
+ ref: forwardedRef
1685
+ });
1686
+ });
1687
+ var ContextMenu2 = {
1688
+ Root: ContextMenuRoot,
1689
+ Trigger: ContextMenuTrigger,
1690
+ Portal: ContextMenuPortal,
1691
+ Content: ContextMenuContent,
1692
+ Viewport: ContextMenuViewport,
1693
+ Arrow: ContextMenuArrow,
1694
+ Group: ContextMenuGroup,
1695
+ Item: ContextMenuItem,
1696
+ CheckboxItem: ContextMenuCheckboxItem,
1697
+ ItemIndicator: ContextMenuItemIndicator,
1698
+ Separator: ContextMenuSeparator,
1699
+ GroupLabel: ContextMenuGroupLabel
1700
+ };
1701
+
1702
+ // src/components/Menu/DropdownMenu.tsx
1703
+ import { composeEventHandlers } from "@radix-ui/primitive";
1704
+ import { composeRefs } from "@radix-ui/react-compose-refs";
1705
+ import { createContextScope as createContextScope2 } from "@radix-ui/react-context";
1706
+ import { useId as useId2 } from "@radix-ui/react-id";
1707
+ import * as MenuPrimitive from "@radix-ui/react-menu";
1708
+ import { createMenuScope } from "@radix-ui/react-menu";
1709
+ import { Primitive as Primitive9 } from "@radix-ui/react-primitive";
1710
+ import { Slot as Slot10 } from "@radix-ui/react-slot";
1711
+ import { useControllableState as useControllableState4 } from "@radix-ui/react-use-controllable-state";
1712
+ import React22, { forwardRef as forwardRef18, useCallback as useCallback8, useEffect as useEffect4, useMemo as useMemo3, useRef as useRef2 } from "react";
1713
+ var DROPDOWN_MENU_NAME = "DropdownMenu";
1714
+ var [createDropdownMenuContext, createDropdownMenuScope] = createContextScope2(DROPDOWN_MENU_NAME, [
1715
+ createMenuScope
1716
+ ]);
1717
+ var useMenuScope = createMenuScope();
1718
+ var [DropdownMenuProvider, useDropdownMenuContext] = createDropdownMenuContext(DROPDOWN_MENU_NAME);
1719
+ var DropdownMenuRoot = (props) => {
1720
+ const { __scopeDropdownMenu, children, dir, open: openProp, defaultOpen, onOpenChange, modal = true } = props;
1721
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1722
+ const triggerRef = useRef2(null);
1723
+ const [open = false, setOpen] = useControllableState4({
1724
+ prop: openProp,
1725
+ defaultProp: defaultOpen,
1726
+ onChange: onOpenChange
1727
+ });
1728
+ return /* @__PURE__ */ React22.createElement(DropdownMenuProvider, {
1729
+ scope: __scopeDropdownMenu,
1730
+ triggerId: useId2(),
1731
+ triggerRef,
1732
+ contentId: useId2(),
1733
+ open,
1734
+ onOpenChange: setOpen,
1735
+ onOpenToggle: useCallback8(() => setOpen((prevOpen) => !prevOpen), [
1736
+ setOpen
1737
+ ]),
1738
+ modal
1739
+ }, /* @__PURE__ */ React22.createElement(MenuPrimitive.Root, {
1740
+ ...menuScope,
1741
+ open,
1742
+ onOpenChange: setOpen,
1743
+ dir,
1744
+ modal
1745
+ }, children));
1746
+ };
1747
+ DropdownMenuRoot.displayName = DROPDOWN_MENU_NAME;
1748
+ var TRIGGER_NAME = "DropdownMenuTrigger";
1749
+ var DropdownMenuTrigger = /* @__PURE__ */ forwardRef18((props, forwardedRef) => {
1750
+ const { __scopeDropdownMenu, disabled = false, ...triggerProps } = props;
1751
+ const context = useDropdownMenuContext(TRIGGER_NAME, __scopeDropdownMenu);
1752
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1753
+ return /* @__PURE__ */ React22.createElement(MenuPrimitive.Anchor, {
1754
+ asChild: true,
1755
+ ...menuScope
1756
+ }, /* @__PURE__ */ React22.createElement(Primitive9.button, {
1757
+ type: "button",
1758
+ id: context.triggerId,
1759
+ "aria-haspopup": "menu",
1760
+ "aria-expanded": context.open,
1761
+ "aria-controls": context.open ? context.contentId : void 0,
1762
+ "data-state": context.open ? "open" : "closed",
1763
+ "data-disabled": disabled ? "" : void 0,
1764
+ disabled,
1765
+ ...triggerProps,
1766
+ ref: composeRefs(forwardedRef, context.triggerRef),
1767
+ "data-arrow-keys": "down",
1768
+ onPointerDown: composeEventHandlers(props.onPointerDown, (event) => {
1769
+ if (!disabled && event.button === 0 && event.ctrlKey === false) {
1770
+ context.onOpenToggle();
1771
+ if (!context.open) {
1772
+ event.preventDefault();
1773
+ }
1774
+ }
1775
+ }),
1776
+ onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
1777
+ if (disabled) {
1778
+ return;
1779
+ }
1780
+ if ([
1781
+ "Enter",
1782
+ " "
1783
+ ].includes(event.key)) {
1784
+ context.onOpenToggle();
1785
+ }
1786
+ if (event.key === "ArrowDown") {
1787
+ context.onOpenChange(true);
1788
+ }
1789
+ if ([
1790
+ "Enter",
1791
+ " ",
1792
+ "ArrowDown"
1793
+ ].includes(event.key)) {
1794
+ event.preventDefault();
1795
+ }
1796
+ })
1797
+ }));
1798
+ });
1799
+ DropdownMenuTrigger.displayName = TRIGGER_NAME;
1800
+ var VIRTUAL_TRIGGER_NAME = "DropdownMenuVirtualTrigger";
1801
+ var DropdownMenuVirtualTrigger = (props) => {
1802
+ const { __scopeDropdownMenu, virtualRef } = props;
1803
+ const context = useDropdownMenuContext(VIRTUAL_TRIGGER_NAME, __scopeDropdownMenu);
1804
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1805
+ useEffect4(() => {
1806
+ if (virtualRef.current) {
1807
+ context.triggerRef.current = virtualRef.current;
1808
+ }
1809
+ });
1810
+ return /* @__PURE__ */ React22.createElement(MenuPrimitive.Anchor, {
1811
+ ...menuScope,
1812
+ virtualRef
1813
+ });
1814
+ };
1815
+ DropdownMenuVirtualTrigger.displayName = VIRTUAL_TRIGGER_NAME;
1816
+ var PORTAL_NAME = "DropdownMenuPortal";
1817
+ var DropdownMenuPortal = (props) => {
1818
+ const { __scopeDropdownMenu, ...portalProps } = props;
1819
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1820
+ return /* @__PURE__ */ React22.createElement(MenuPrimitive.Portal, {
1821
+ ...menuScope,
1822
+ ...portalProps
1823
+ });
1824
+ };
1825
+ DropdownMenuPortal.displayName = PORTAL_NAME;
1826
+ var DropdownMenuViewport = /* @__PURE__ */ forwardRef18(({ classNames, asChild, children, ...props }, forwardedRef) => {
1827
+ const { tx } = useThemeContext();
1828
+ const Root6 = asChild ? Slot10 : Primitive9.div;
1829
+ return /* @__PURE__ */ React22.createElement(Root6, {
1830
+ ...props,
1831
+ className: tx("menu.viewport", "menu__viewport", {}, classNames),
1832
+ ref: forwardedRef
1833
+ }, children);
1834
+ });
1835
+ var CONTENT_NAME = "DropdownMenuContent";
1836
+ var DropdownMenuContent = /* @__PURE__ */ forwardRef18((props, forwardedRef) => {
1837
+ const { __scopeDropdownMenu, classNames, collisionPadding = 8, collisionBoundary, ...contentProps } = props;
1838
+ const { tx } = useThemeContext();
1839
+ const context = useDropdownMenuContext(CONTENT_NAME, __scopeDropdownMenu);
1840
+ const elevation = useElevationContext();
1841
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1842
+ const hasInteractedOutsideRef = useRef2(false);
1843
+ const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
1844
+ const computedCollisionBoundary = useMemo3(() => {
1845
+ const closestBoundary = context.triggerRef.current?.closest("[data-popover-collision-boundary]");
1846
+ return closestBoundary ? Array.isArray(collisionBoundary) ? [
1847
+ closestBoundary,
1848
+ ...collisionBoundary
1849
+ ] : collisionBoundary ? [
1850
+ closestBoundary,
1851
+ collisionBoundary
1852
+ ] : [
1853
+ closestBoundary
1854
+ ] : collisionBoundary;
1855
+ }, [
1856
+ context.open,
1857
+ collisionBoundary,
1858
+ context.triggerRef.current
1859
+ ]);
1860
+ return /* @__PURE__ */ React22.createElement(MenuPrimitive.Content, {
1861
+ id: context.contentId,
1862
+ "aria-labelledby": context.triggerId,
1863
+ ...menuScope,
1864
+ ...contentProps,
1865
+ collisionBoundary: computedCollisionBoundary,
1866
+ collisionPadding: safeCollisionPadding,
1867
+ ref: forwardedRef,
1868
+ onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
1869
+ if (!hasInteractedOutsideRef.current) {
1870
+ context.triggerRef.current?.focus();
1871
+ }
1872
+ hasInteractedOutsideRef.current = false;
1873
+ event.preventDefault();
1874
+ }),
1875
+ onInteractOutside: composeEventHandlers(props.onInteractOutside, (event) => {
1876
+ const originalEvent = event.detail.originalEvent;
1877
+ const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
1878
+ const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
1879
+ if (!context.modal || isRightClick) {
1880
+ hasInteractedOutsideRef.current = true;
1881
+ }
1882
+ }),
1883
+ "data-arrow-keys": "up down",
1884
+ className: tx("menu.content", "menu", {
1885
+ elevation
1886
+ }, classNames),
1887
+ style: {
1888
+ ...props.style,
1889
+ // re-namespace exposed content custom properties
1890
+ ...{
1891
+ "--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
1892
+ "--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
1893
+ "--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
1894
+ "--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
1895
+ "--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
1896
+ }
1897
+ }
1898
+ });
1899
+ });
1900
+ DropdownMenuContent.displayName = CONTENT_NAME;
1901
+ var GROUP_NAME = "DropdownMenuGroup";
1902
+ var DropdownMenuGroup = /* @__PURE__ */ forwardRef18((props, forwardedRef) => {
1903
+ const { __scopeDropdownMenu, ...groupProps } = props;
1904
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1905
+ return /* @__PURE__ */ React22.createElement(MenuPrimitive.Group, {
1906
+ ...menuScope,
1907
+ ...groupProps,
1908
+ ref: forwardedRef
1909
+ });
1910
+ });
1911
+ DropdownMenuGroup.displayName = GROUP_NAME;
1912
+ var LABEL_NAME = "DropdownMenuLabel";
1913
+ var DropdownMenuGroupLabel = /* @__PURE__ */ forwardRef18((props, forwardedRef) => {
1914
+ const { __scopeDropdownMenu, classNames, ...labelProps } = props;
1915
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1916
+ const { tx } = useThemeContext();
1917
+ return /* @__PURE__ */ React22.createElement(MenuPrimitive.Label, {
1918
+ ...menuScope,
1919
+ ...labelProps,
1920
+ className: tx("menu.groupLabel", "menu__group__label", {}, classNames),
1921
+ ref: forwardedRef
1922
+ });
1923
+ });
1924
+ DropdownMenuGroupLabel.displayName = LABEL_NAME;
1925
+ var ITEM_NAME = "DropdownMenuItem";
1926
+ var DropdownMenuItem = /* @__PURE__ */ forwardRef18((props, forwardedRef) => {
1927
+ const { __scopeDropdownMenu, classNames, ...itemProps } = props;
1928
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1929
+ const { tx } = useThemeContext();
1930
+ return /* @__PURE__ */ React22.createElement(MenuPrimitive.Item, {
1931
+ ...menuScope,
1932
+ ...itemProps,
1933
+ className: tx("menu.item", "menu__item", {}, classNames),
1934
+ ref: forwardedRef
1935
+ });
1936
+ });
1937
+ DropdownMenuItem.displayName = ITEM_NAME;
1938
+ var CHECKBOX_ITEM_NAME = "DropdownMenuCheckboxItem";
1939
+ var DropdownMenuCheckboxItem = /* @__PURE__ */ forwardRef18((props, forwardedRef) => {
1940
+ const { __scopeDropdownMenu, classNames, ...checkboxItemProps } = props;
1941
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1942
+ const { tx } = useThemeContext();
1943
+ return /* @__PURE__ */ React22.createElement(MenuPrimitive.CheckboxItem, {
1944
+ ...menuScope,
1945
+ ...checkboxItemProps,
1946
+ className: tx("menu.item", "menu__item--checkbox", {}, classNames),
1947
+ ref: forwardedRef
1948
+ });
1949
+ });
1950
+ DropdownMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;
1951
+ var RADIO_GROUP_NAME = "DropdownMenuRadioGroup";
1952
+ var DropdownMenuRadioGroup = /* @__PURE__ */ forwardRef18((props, forwardedRef) => {
1953
+ const { __scopeDropdownMenu, ...radioGroupProps } = props;
1954
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1955
+ return /* @__PURE__ */ React22.createElement(MenuPrimitive.RadioGroup, {
1956
+ ...menuScope,
1957
+ ...radioGroupProps,
1958
+ ref: forwardedRef
1959
+ });
1960
+ });
1961
+ DropdownMenuRadioGroup.displayName = RADIO_GROUP_NAME;
1962
+ var RADIO_ITEM_NAME = "DropdownMenuRadioItem";
1963
+ var DropdownMenuRadioItem = /* @__PURE__ */ forwardRef18((props, forwardedRef) => {
1964
+ const { __scopeDropdownMenu, classNames, ...itemProps } = props;
1965
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1966
+ const { tx } = useThemeContext();
1967
+ return /* @__PURE__ */ React22.createElement(MenuPrimitive.Item, {
1968
+ ...menuScope,
1969
+ ...itemProps,
1970
+ className: tx("menu.item", "menu__item", {}, classNames),
1971
+ ref: forwardedRef
1972
+ });
1973
+ });
1974
+ DropdownMenuRadioItem.displayName = RADIO_ITEM_NAME;
1975
+ var INDICATOR_NAME = "DropdownMenuItemIndicator";
1976
+ var DropdownMenuItemIndicator = /* @__PURE__ */ forwardRef18((props, forwardedRef) => {
1977
+ const { __scopeDropdownMenu, ...itemIndicatorProps } = props;
1978
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1979
+ return /* @__PURE__ */ React22.createElement(MenuPrimitive.ItemIndicator, {
1980
+ ...menuScope,
1981
+ ...itemIndicatorProps,
1982
+ ref: forwardedRef
1983
+ });
1984
+ });
1985
+ DropdownMenuItemIndicator.displayName = INDICATOR_NAME;
1986
+ var SEPARATOR_NAME = "DropdownMenuSeparator";
1987
+ var DropdownMenuSeparator = /* @__PURE__ */ forwardRef18((props, forwardedRef) => {
1988
+ const { __scopeDropdownMenu, classNames, ...separatorProps } = props;
1989
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1990
+ const { tx } = useThemeContext();
1991
+ return /* @__PURE__ */ React22.createElement(MenuPrimitive.Separator, {
1992
+ ...menuScope,
1993
+ ...separatorProps,
1994
+ className: tx("menu.separator", "menu__item", {}, classNames),
1995
+ ref: forwardedRef
1996
+ });
1997
+ });
1998
+ DropdownMenuSeparator.displayName = SEPARATOR_NAME;
1999
+ var ARROW_NAME = "DropdownMenuArrow";
2000
+ var DropdownMenuArrow = /* @__PURE__ */ forwardRef18((props, forwardedRef) => {
2001
+ const { __scopeDropdownMenu, classNames, ...arrowProps } = props;
2002
+ const menuScope = useMenuScope(__scopeDropdownMenu);
2003
+ const { tx } = useThemeContext();
2004
+ return /* @__PURE__ */ React22.createElement(MenuPrimitive.Arrow, {
2005
+ ...menuScope,
2006
+ ...arrowProps,
2007
+ className: tx("menu.arrow", "menu__arrow", {}, classNames),
2008
+ ref: forwardedRef
2009
+ });
2010
+ });
2011
+ DropdownMenuArrow.displayName = ARROW_NAME;
2012
+ var DropdownMenuSub = (props) => {
2013
+ const { __scopeDropdownMenu, children, open: openProp, onOpenChange, defaultOpen } = props;
2014
+ const menuScope = useMenuScope(__scopeDropdownMenu);
2015
+ const [open = false, setOpen] = useControllableState4({
2016
+ prop: openProp,
2017
+ defaultProp: defaultOpen,
2018
+ onChange: onOpenChange
2019
+ });
2020
+ return /* @__PURE__ */ React22.createElement(MenuPrimitive.Sub, {
2021
+ ...menuScope,
2022
+ open,
2023
+ onOpenChange: setOpen
2024
+ }, children);
2025
+ };
2026
+ var SUB_TRIGGER_NAME = "DropdownMenuSubTrigger";
2027
+ var DropdownMenuSubTrigger = /* @__PURE__ */ forwardRef18((props, forwardedRef) => {
2028
+ const { __scopeDropdownMenu, ...subTriggerProps } = props;
2029
+ const menuScope = useMenuScope(__scopeDropdownMenu);
2030
+ return /* @__PURE__ */ React22.createElement(MenuPrimitive.SubTrigger, {
2031
+ ...menuScope,
2032
+ ...subTriggerProps,
2033
+ ref: forwardedRef
2034
+ });
2035
+ });
2036
+ DropdownMenuSubTrigger.displayName = SUB_TRIGGER_NAME;
2037
+ var SUB_CONTENT_NAME = "DropdownMenuSubContent";
2038
+ var DropdownMenuSubContent = /* @__PURE__ */ forwardRef18((props, forwardedRef) => {
2039
+ const { __scopeDropdownMenu, ...subContentProps } = props;
2040
+ const menuScope = useMenuScope(__scopeDropdownMenu);
2041
+ return /* @__PURE__ */ React22.createElement(MenuPrimitive.SubContent, {
2042
+ ...menuScope,
2043
+ ...subContentProps,
2044
+ ref: forwardedRef,
2045
+ style: {
2046
+ ...props.style,
2047
+ // re-namespace exposed content custom properties
2048
+ ...{
2049
+ "--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
2050
+ "--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
2051
+ "--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
2052
+ "--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
2053
+ "--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
2054
+ }
2055
+ }
2056
+ });
2057
+ });
2058
+ DropdownMenuSubContent.displayName = SUB_CONTENT_NAME;
2059
+ var DropdownMenu = {
2060
+ Root: DropdownMenuRoot,
2061
+ Trigger: DropdownMenuTrigger,
2062
+ VirtualTrigger: DropdownMenuVirtualTrigger,
2063
+ Portal: DropdownMenuPortal,
2064
+ Content: DropdownMenuContent,
2065
+ Viewport: DropdownMenuViewport,
2066
+ Group: DropdownMenuGroup,
2067
+ GroupLabel: DropdownMenuGroupLabel,
2068
+ Item: DropdownMenuItem,
2069
+ CheckboxItem: DropdownMenuCheckboxItem,
2070
+ RadioGroup: DropdownMenuRadioGroup,
2071
+ RadioItem: DropdownMenuRadioItem,
2072
+ ItemIndicator: DropdownMenuItemIndicator,
2073
+ Separator: DropdownMenuSeparator,
2074
+ Arrow: DropdownMenuArrow,
2075
+ Sub: DropdownMenuSub,
2076
+ SubTrigger: DropdownMenuSubTrigger,
2077
+ SubContent: DropdownMenuSubContent
2078
+ };
2079
+ var useDropdownMenuMenuScope = useMenuScope;
2080
+
2081
+ // src/components/Message/Message.tsx
2082
+ import { createContext as createContext7 } from "@radix-ui/react-context";
2083
+ import { Primitive as Primitive10 } from "@radix-ui/react-primitive";
2084
+ import { Slot as Slot11 } from "@radix-ui/react-slot";
2085
+ import React23, { forwardRef as forwardRef19 } from "react";
2086
+ import { useId as useId3 } from "@dxos/react-hooks";
2087
+ var messageIcons = {
2088
+ success: "ph--check-circle--duotone",
2089
+ info: "ph--info--duotone",
2090
+ warning: "ph--warning--duotone",
2091
+ error: "ph--warning-circle--duotone",
2092
+ neutral: "ph--info--duotone"
2093
+ };
2094
+ var MESSAGE_NAME = "Message";
2095
+ var [MessageProvider, useMessageContext] = createContext7(MESSAGE_NAME);
2096
+ var MessageRoot = /* @__PURE__ */ forwardRef19(({ asChild, valence = "neutral", elevation: propsElevation, classNames, titleId: propsTitleId, descriptionId: propsDescriptionId, children, ...props }, forwardedRef) => {
2097
+ const { tx } = useThemeContext();
2098
+ const titleId = useId3("message__title", propsTitleId);
2099
+ const descriptionId = useId3("message__description", propsDescriptionId);
2100
+ const elevation = useElevationContext(propsElevation);
2101
+ const Root6 = asChild ? Slot11 : Primitive10.div;
2102
+ return /* @__PURE__ */ React23.createElement(MessageProvider, {
2103
+ titleId,
2104
+ descriptionId,
2105
+ valence
2106
+ }, /* @__PURE__ */ React23.createElement(Root6, {
2107
+ role: valence === "neutral" ? "paragraph" : "alert",
2108
+ ...props,
2109
+ className: tx("message.root", "message", {
2110
+ valence,
2111
+ elevation
2112
+ }, classNames),
2113
+ "aria-labelledby": titleId,
2114
+ "aria-describedby": descriptionId,
2115
+ ref: forwardedRef
2116
+ }, children));
2117
+ });
2118
+ MessageRoot.displayName = MESSAGE_NAME;
2119
+ var MESSAGE_TITLE_NAME = "MessageTitle";
2120
+ var MessageTitle = /* @__PURE__ */ forwardRef19(({ asChild, classNames, children, icon, ...props }, forwardedRef) => {
2121
+ const { tx } = useThemeContext();
2122
+ const { titleId, valence } = useMessageContext(MESSAGE_TITLE_NAME);
2123
+ const Root6 = asChild ? Slot11 : Primitive10.h2;
2124
+ return /* @__PURE__ */ React23.createElement(Root6, {
2125
+ ...props,
2126
+ className: tx("message.title", "message__title", {}, classNames),
2127
+ id: titleId,
2128
+ ref: forwardedRef
2129
+ }, !icon && valence === "neutral" ? null : /* @__PURE__ */ React23.createElement(Icon, {
2130
+ size: 5,
2131
+ icon: icon ?? messageIcons[valence],
2132
+ classNames: tx("message.icon", "message__icon", {
2133
+ valence
2134
+ })
2135
+ }), /* @__PURE__ */ React23.createElement("span", null, children));
2136
+ });
2137
+ MessageTitle.displayName = MESSAGE_TITLE_NAME;
2138
+ var MESSAGE_CONTENT_NAME = "MessageContent";
2139
+ var MessageContent = /* @__PURE__ */ forwardRef19(({ asChild, classNames, children, ...props }, forwardedRef) => {
2140
+ const { tx } = useThemeContext();
2141
+ const { descriptionId } = useMessageContext(MESSAGE_CONTENT_NAME);
2142
+ const Root6 = asChild ? Slot11 : Primitive10.p;
2143
+ return /* @__PURE__ */ React23.createElement(Root6, {
2144
+ ...props,
2145
+ className: tx("message.content", "message__content", {}, classNames),
2146
+ id: descriptionId,
2147
+ ref: forwardedRef
2148
+ }, children);
2149
+ });
2150
+ MessageContent.displayName = MESSAGE_CONTENT_NAME;
2151
+ var Message = {
2152
+ Root: MessageRoot,
2153
+ Title: MessageTitle,
2154
+ Content: MessageContent
2155
+ };
2156
+ var Callout = Message;
2157
+
2158
+ // src/components/Popover/Popover.tsx
2159
+ import { composeEventHandlers as composeEventHandlers2 } from "@radix-ui/primitive";
2160
+ import { useComposedRefs } from "@radix-ui/react-compose-refs";
2161
+ import { createContextScope as createContextScope3 } from "@radix-ui/react-context";
2162
+ import { DismissableLayer } from "@radix-ui/react-dismissable-layer";
2163
+ import { useFocusGuards } from "@radix-ui/react-focus-guards";
2164
+ import { FocusScope } from "@radix-ui/react-focus-scope";
2165
+ import { useId as useId4 } from "@radix-ui/react-id";
2166
+ import * as PopperPrimitive from "@radix-ui/react-popper";
2167
+ import { createPopperScope } from "@radix-ui/react-popper";
2168
+ import { Portal as PortalPrimitive } from "@radix-ui/react-portal";
2169
+ import { Presence } from "@radix-ui/react-presence";
2170
+ import { Primitive as Primitive11 } from "@radix-ui/react-primitive";
2171
+ import { Slot as Slot12 } from "@radix-ui/react-slot";
2172
+ import { useControllableState as useControllableState5 } from "@radix-ui/react-use-controllable-state";
2173
+ import { hideOthers } from "aria-hidden";
2174
+ import React24, { forwardRef as forwardRef20, useCallback as useCallback9, useEffect as useEffect5, useMemo as useMemo4, useRef as useRef3, useState as useState6 } from "react";
2175
+ import { RemoveScroll } from "react-remove-scroll";
2176
+ var POPOVER_NAME = "Popover";
2177
+ var [createPopoverContext, createPopoverScope] = createContextScope3(POPOVER_NAME, [
2178
+ createPopperScope
2179
+ ]);
2180
+ var usePopperScope = createPopperScope();
2181
+ var [PopoverProvider, usePopoverContext] = createPopoverContext(POPOVER_NAME);
2182
+ var PopoverRoot = (props) => {
2183
+ const { __scopePopover, children, open: openProp, defaultOpen, onOpenChange, modal = false } = props;
2184
+ const popperScope = usePopperScope(__scopePopover);
2185
+ const triggerRef = useRef3(null);
2186
+ const [hasCustomAnchor, setHasCustomAnchor] = useState6(false);
2187
+ const [open = false, setOpen] = useControllableState5({
2188
+ prop: openProp,
2189
+ defaultProp: defaultOpen,
2190
+ onChange: onOpenChange
2191
+ });
2192
+ return /* @__PURE__ */ React24.createElement(PopperPrimitive.Root, popperScope, /* @__PURE__ */ React24.createElement(PopoverProvider, {
2193
+ scope: __scopePopover,
2194
+ contentId: useId4(),
2195
+ triggerRef,
2196
+ open,
2197
+ onOpenChange: setOpen,
2198
+ onOpenToggle: useCallback9(() => setOpen((prevOpen) => !prevOpen), [
2199
+ setOpen
2200
+ ]),
2201
+ hasCustomAnchor,
2202
+ onCustomAnchorAdd: useCallback9(() => setHasCustomAnchor(true), []),
2203
+ onCustomAnchorRemove: useCallback9(() => setHasCustomAnchor(false), []),
2204
+ modal
2205
+ }, children));
2206
+ };
2207
+ PopoverRoot.displayName = POPOVER_NAME;
2208
+ var ANCHOR_NAME = "PopoverAnchor";
2209
+ var PopoverAnchor = /* @__PURE__ */ forwardRef20((props, forwardedRef) => {
2210
+ const { __scopePopover, ...anchorProps } = props;
2211
+ const context = usePopoverContext(ANCHOR_NAME, __scopePopover);
2212
+ const popperScope = usePopperScope(__scopePopover);
2213
+ const { onCustomAnchorAdd, onCustomAnchorRemove } = context;
2214
+ useEffect5(() => {
2215
+ onCustomAnchorAdd();
2216
+ return () => onCustomAnchorRemove();
2217
+ }, [
2218
+ onCustomAnchorAdd,
2219
+ onCustomAnchorRemove
2220
+ ]);
2221
+ return /* @__PURE__ */ React24.createElement(PopperPrimitive.Anchor, {
2222
+ ...popperScope,
2223
+ ...anchorProps,
2224
+ ref: forwardedRef
2225
+ });
2226
+ });
2227
+ PopoverAnchor.displayName = ANCHOR_NAME;
2228
+ var TRIGGER_NAME2 = "PopoverTrigger";
2229
+ var PopoverTrigger = /* @__PURE__ */ forwardRef20((props, forwardedRef) => {
2230
+ const { __scopePopover, ...triggerProps } = props;
2231
+ const context = usePopoverContext(TRIGGER_NAME2, __scopePopover);
2232
+ const popperScope = usePopperScope(__scopePopover);
2233
+ const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
2234
+ const trigger = /* @__PURE__ */ React24.createElement(Primitive11.button, {
2235
+ type: "button",
2236
+ "aria-haspopup": "dialog",
2237
+ "aria-expanded": context.open,
2238
+ "aria-controls": context.contentId,
2239
+ "data-state": getState(context.open),
2240
+ ...triggerProps,
2241
+ ref: composedTriggerRef,
2242
+ onClick: composeEventHandlers2(props.onClick, context.onOpenToggle)
2243
+ });
2244
+ return context.hasCustomAnchor ? trigger : /* @__PURE__ */ React24.createElement(PopperPrimitive.Anchor, {
2245
+ asChild: true,
2246
+ ...popperScope
2247
+ }, trigger);
2248
+ });
2249
+ PopoverTrigger.displayName = TRIGGER_NAME2;
2250
+ var VIRTUAL_TRIGGER_NAME2 = "PopoverVirtualTrigger";
2251
+ var PopoverVirtualTrigger = (props) => {
2252
+ const { __scopePopover, virtualRef } = props;
2253
+ const context = usePopoverContext(VIRTUAL_TRIGGER_NAME2, __scopePopover);
2254
+ const popperScope = usePopperScope(__scopePopover);
2255
+ useEffect5(() => {
2256
+ if (virtualRef.current) {
2257
+ context.triggerRef.current = virtualRef.current;
2258
+ }
2259
+ });
2260
+ return /* @__PURE__ */ React24.createElement(PopperPrimitive.Anchor, {
2261
+ ...popperScope,
2262
+ virtualRef
2263
+ });
2264
+ };
2265
+ PopoverVirtualTrigger.displayName = VIRTUAL_TRIGGER_NAME2;
2266
+ var PORTAL_NAME2 = "PopoverPortal";
2267
+ var [PortalProvider, usePortalContext] = createPopoverContext(PORTAL_NAME2, {
2268
+ forceMount: void 0
2269
+ });
2270
+ var PopoverPortal = (props) => {
2271
+ const { __scopePopover, forceMount, children, container } = props;
2272
+ const context = usePopoverContext(PORTAL_NAME2, __scopePopover);
2273
+ return /* @__PURE__ */ React24.createElement(PortalProvider, {
2274
+ scope: __scopePopover,
2275
+ forceMount
2276
+ }, /* @__PURE__ */ React24.createElement(Presence, {
2277
+ present: forceMount || context.open
2278
+ }, /* @__PURE__ */ React24.createElement(PortalPrimitive, {
2279
+ asChild: true,
2280
+ container
2281
+ }, children)));
2282
+ };
2283
+ PopoverPortal.displayName = PORTAL_NAME2;
2284
+ var CONTENT_NAME2 = "PopoverContent";
2285
+ var PopoverContent = /* @__PURE__ */ forwardRef20((props, forwardedRef) => {
2286
+ const portalContext = usePortalContext(CONTENT_NAME2, props.__scopePopover);
2287
+ const { forceMount = portalContext.forceMount, ...contentProps } = props;
2288
+ const context = usePopoverContext(CONTENT_NAME2, props.__scopePopover);
2289
+ return /* @__PURE__ */ React24.createElement(Presence, {
2290
+ present: forceMount || context.open
2291
+ }, context.modal ? /* @__PURE__ */ React24.createElement(PopoverContentModal, {
2292
+ ...contentProps,
2293
+ ref: forwardedRef
2294
+ }) : /* @__PURE__ */ React24.createElement(PopoverContentNonModal, {
2295
+ ...contentProps,
2296
+ ref: forwardedRef
2297
+ }));
2298
+ });
2299
+ PopoverContent.displayName = CONTENT_NAME2;
2300
+ var PopoverContentModal = /* @__PURE__ */ forwardRef20((props, forwardedRef) => {
2301
+ const context = usePopoverContext(CONTENT_NAME2, props.__scopePopover);
2302
+ const contentRef = useRef3(null);
2303
+ const composedRefs = useComposedRefs(forwardedRef, contentRef);
2304
+ const isRightClickOutsideRef = useRef3(false);
2305
+ useEffect5(() => {
2306
+ const content = contentRef.current;
2307
+ if (content) {
2308
+ return hideOthers(content);
2309
+ }
2310
+ }, []);
2311
+ return /* @__PURE__ */ React24.createElement(RemoveScroll, {
2312
+ as: Slot12,
2313
+ allowPinchZoom: true
2314
+ }, /* @__PURE__ */ React24.createElement(PopoverContentImpl, {
2315
+ ...props,
2316
+ ref: composedRefs,
2317
+ // we make sure we're not trapping once it's been closed
2318
+ // (closed !== unmounted when animating out)
2319
+ trapFocus: context.open,
2320
+ disableOutsidePointerEvents: true,
2321
+ onCloseAutoFocus: composeEventHandlers2(props.onCloseAutoFocus, (event) => {
2322
+ event.preventDefault();
2323
+ if (!isRightClickOutsideRef.current) {
2324
+ context.triggerRef.current?.focus();
2325
+ }
2326
+ }),
2327
+ onPointerDownOutside: composeEventHandlers2(props.onPointerDownOutside, (event) => {
2328
+ const originalEvent = event.detail.originalEvent;
2329
+ const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
2330
+ const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
2331
+ isRightClickOutsideRef.current = isRightClick;
2332
+ }, {
2333
+ checkForDefaultPrevented: false
2334
+ }),
2335
+ // When focus is trapped, a `focusout` event may still happen.
2336
+ // We make sure we don't trigger our `onDismiss` in such case.
2337
+ onFocusOutside: composeEventHandlers2(props.onFocusOutside, (event) => event.preventDefault(), {
2338
+ checkForDefaultPrevented: false
2339
+ })
2340
+ }));
2341
+ });
2342
+ var PopoverContentNonModal = /* @__PURE__ */ forwardRef20((props, forwardedRef) => {
2343
+ const context = usePopoverContext(CONTENT_NAME2, props.__scopePopover);
2344
+ const hasInteractedOutsideRef = useRef3(false);
2345
+ const hasPointerDownOutsideRef = useRef3(false);
2346
+ return /* @__PURE__ */ React24.createElement(PopoverContentImpl, {
2347
+ ...props,
2348
+ ref: forwardedRef,
2349
+ trapFocus: false,
2350
+ disableOutsidePointerEvents: false,
2351
+ onCloseAutoFocus: (event) => {
2352
+ props.onCloseAutoFocus?.(event);
2353
+ if (!event.defaultPrevented) {
2354
+ if (!hasInteractedOutsideRef.current) {
2355
+ context.triggerRef.current?.focus();
2356
+ }
2357
+ event.preventDefault();
2358
+ }
2359
+ hasInteractedOutsideRef.current = false;
2360
+ hasPointerDownOutsideRef.current = false;
2361
+ },
2362
+ onInteractOutside: (event) => {
2363
+ props.onInteractOutside?.(event);
2364
+ if (!event.defaultPrevented) {
2365
+ hasInteractedOutsideRef.current = true;
2366
+ if (event.detail.originalEvent.type === "pointerdown") {
2367
+ hasPointerDownOutsideRef.current = true;
2368
+ }
2369
+ }
2370
+ const target = event.target;
2371
+ const targetIsTrigger = context.triggerRef.current?.contains(target);
2372
+ if (targetIsTrigger) {
2373
+ event.preventDefault();
2374
+ }
2375
+ if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
2376
+ event.preventDefault();
2377
+ }
2378
+ }
2379
+ });
2380
+ });
2381
+ var PopoverContentImpl = /* @__PURE__ */ forwardRef20((props, forwardedRef) => {
2382
+ const { __scopePopover, trapFocus, onOpenAutoFocus, onCloseAutoFocus, disableOutsidePointerEvents, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, collisionPadding = 8, collisionBoundary, classNames, ...contentProps } = props;
2383
+ const context = usePopoverContext(CONTENT_NAME2, __scopePopover);
2384
+ const popperScope = usePopperScope(__scopePopover);
2385
+ const { tx } = useThemeContext();
2386
+ const elevation = useElevationContext();
2387
+ const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
2388
+ useFocusGuards();
2389
+ const computedCollisionBoundary = useMemo4(() => {
2390
+ const closestBoundary = context.triggerRef.current?.closest("[data-popover-collision-boundary]");
2391
+ return closestBoundary ? Array.isArray(collisionBoundary) ? [
2392
+ closestBoundary,
2393
+ ...collisionBoundary
2394
+ ] : collisionBoundary ? [
2395
+ closestBoundary,
2396
+ collisionBoundary
2397
+ ] : [
2398
+ closestBoundary
2399
+ ] : collisionBoundary;
2400
+ }, [
2401
+ context.open,
2402
+ collisionBoundary,
2403
+ context.triggerRef.current
2404
+ ]);
2405
+ return /* @__PURE__ */ React24.createElement(FocusScope, {
2406
+ asChild: true,
2407
+ loop: true,
2408
+ trapped: trapFocus,
2409
+ onMountAutoFocus: onOpenAutoFocus,
2410
+ onUnmountAutoFocus: onCloseAutoFocus
2411
+ }, /* @__PURE__ */ React24.createElement(DismissableLayer, {
2412
+ asChild: true,
2413
+ disableOutsidePointerEvents,
2414
+ onInteractOutside,
2415
+ onEscapeKeyDown,
2416
+ onPointerDownOutside,
2417
+ onFocusOutside,
2418
+ onDismiss: () => context.onOpenChange(false)
2419
+ }, /* @__PURE__ */ React24.createElement(PopperPrimitive.Content, {
2420
+ "data-state": getState(context.open),
2421
+ role: "dialog",
2422
+ id: context.contentId,
2423
+ ...popperScope,
2424
+ ...contentProps,
2425
+ collisionPadding: safeCollisionPadding,
2426
+ collisionBoundary: computedCollisionBoundary,
2427
+ className: tx("popover.content", "popover", {
2428
+ elevation
2429
+ }, classNames),
2430
+ ref: forwardedRef,
2431
+ style: {
2432
+ ...contentProps.style,
2433
+ // Re-namespace exposed content custom properties.
2434
+ ...{
2435
+ "--radix-popover-content-transform-origin": "var(--radix-popper-transform-origin)",
2436
+ "--radix-popover-content-available-width": "var(--radix-popper-available-width)",
2437
+ "--radix-popover-content-available-height": "var(--radix-popper-available-height)",
2438
+ "--radix-popover-trigger-width": "var(--radix-popper-anchor-width)",
2439
+ "--radix-popover-trigger-height": "var(--radix-popper-anchor-height)"
2440
+ }
2441
+ }
2442
+ })));
2443
+ });
2444
+ var CLOSE_NAME = "PopoverClose";
2445
+ var PopoverClose = /* @__PURE__ */ forwardRef20((props, forwardedRef) => {
2446
+ const { __scopePopover, ...closeProps } = props;
2447
+ const context = usePopoverContext(CLOSE_NAME, __scopePopover);
2448
+ return /* @__PURE__ */ React24.createElement(Primitive11.button, {
2449
+ type: "button",
2450
+ ...closeProps,
2451
+ ref: forwardedRef,
2452
+ onClick: composeEventHandlers2(props.onClick, () => context.onOpenChange(false))
2453
+ });
2454
+ });
2455
+ PopoverClose.displayName = CLOSE_NAME;
2456
+ var ARROW_NAME2 = "PopoverArrow";
2457
+ var PopoverArrow = /* @__PURE__ */ forwardRef20((props, forwardedRef) => {
2458
+ const { __scopePopover, classNames, ...arrowProps } = props;
2459
+ const popperScope = usePopperScope(__scopePopover);
2460
+ const { tx } = useThemeContext();
2461
+ return /* @__PURE__ */ React24.createElement(PopperPrimitive.Arrow, {
2462
+ ...popperScope,
2463
+ ...arrowProps,
2464
+ className: tx("popover.arrow", "popover__arrow", {}, classNames),
2465
+ ref: forwardedRef
2466
+ });
2467
+ });
2468
+ PopoverArrow.displayName = ARROW_NAME2;
2469
+ var PopoverViewport = /* @__PURE__ */ forwardRef20(({ classNames, asChild, constrainInline = true, constrainBlock = true, children, ...props }, forwardedRef) => {
2470
+ const { tx } = useThemeContext();
2471
+ const Root6 = asChild ? Slot12 : Primitive11.div;
2472
+ return /* @__PURE__ */ React24.createElement(Root6, {
2473
+ ...props,
2474
+ className: tx("popover.viewport", "popover__viewport", {
2475
+ constrainInline,
2476
+ constrainBlock
2477
+ }, classNames),
2478
+ ref: forwardedRef
2479
+ }, children);
2480
+ });
2481
+ var getState = (open) => open ? "open" : "closed";
2482
+ var Popover = {
2483
+ Root: PopoverRoot,
2484
+ Anchor: PopoverAnchor,
2485
+ Trigger: PopoverTrigger,
2486
+ VirtualTrigger: PopoverVirtualTrigger,
2487
+ Portal: PopoverPortal,
2488
+ Content: PopoverContent,
2489
+ Close: PopoverClose,
2490
+ Arrow: PopoverArrow,
2491
+ Viewport: PopoverViewport
2492
+ };
2493
+
2494
+ // src/components/Status/Status.tsx
2495
+ import React25, { forwardRef as forwardRef21 } from "react";
2496
+ var Status = /* @__PURE__ */ forwardRef21(({ classNames, children, progress = 0, indeterminate, variant, ...props }, forwardedRef) => {
2497
+ const { tx } = useThemeContext();
2498
+ return /* @__PURE__ */ React25.createElement("span", {
2499
+ role: "status",
2500
+ ...props,
2501
+ className: tx("status.root", "status", {
2502
+ indeterminate,
2503
+ variant
2504
+ }, classNames),
2505
+ ref: forwardedRef
2506
+ }, /* @__PURE__ */ React25.createElement("span", {
2507
+ role: "none",
2508
+ className: tx("status.bar", "status__bar", {
2509
+ indeterminate,
2510
+ variant
2511
+ }, classNames),
2512
+ ...!indeterminate && {
2513
+ style: {
2514
+ width: `${Math.round(progress * 100)}%`
2515
+ }
2516
+ }
2517
+ }), children);
2518
+ });
2519
+
2520
+ // src/components/ScrollArea/ScrollArea.tsx
2521
+ import { Corner as ScrollAreaPrimitiveCorner, Root as ScrollAreaPrimitiveRoot, Scrollbar as ScrollAreaPrimitiveScrollbar, Thumb as ScrollAreaPrimitiveThumb, Viewport as ScrollAreaPrimitiveViewport } from "@radix-ui/react-scroll-area";
2522
+ import React26, { forwardRef as forwardRef22 } from "react";
2523
+ import { mx as mx4 } from "@dxos/ui-theme";
2524
+ var ScrollAreaRoot = /* @__PURE__ */ forwardRef22(({ classNames, ...props }, forwardedRef) => {
2525
+ const { tx } = useThemeContext();
2526
+ return /* @__PURE__ */ React26.createElement(ScrollAreaPrimitiveRoot, {
2527
+ ...props,
2528
+ className: tx("scrollArea.root", "scroll-area", {}, classNames),
2529
+ ref: forwardedRef
2530
+ });
2531
+ });
2532
+ var ScrollAreaViewport = /* @__PURE__ */ forwardRef22(({ classNames, ...props }, forwardedRef) => {
2533
+ const { tx } = useThemeContext();
2534
+ return /* @__PURE__ */ React26.createElement(ScrollAreaPrimitiveViewport, {
2535
+ ...props,
2536
+ className: tx("scrollArea.viewport", "scroll-area", {}, classNames),
2537
+ ref: forwardedRef
2538
+ });
2539
+ });
2540
+ var ScrollAreaScrollbar = /* @__PURE__ */ forwardRef22(({ classNames, variant = "fine", ...props }, forwardedRef) => {
2541
+ const { tx } = useThemeContext();
2542
+ return /* @__PURE__ */ React26.createElement(ScrollAreaPrimitiveScrollbar, {
2543
+ "data-variant": variant,
2544
+ ...props,
2545
+ className: tx("scrollArea.scrollbar", "scroll-area__scrollbar", {}, classNames),
2546
+ ref: forwardedRef
2547
+ });
2548
+ });
2549
+ var ScrollAreaThumb = /* @__PURE__ */ forwardRef22(({ classNames, ...props }, forwardedRef) => {
2550
+ const { tx } = useThemeContext();
2551
+ return /* @__PURE__ */ React26.createElement(ScrollAreaPrimitiveThumb, {
2552
+ ...props,
2553
+ className: tx("scrollArea.thumb", "scroll-area__thumb", {}, classNames),
2554
+ ref: forwardedRef
2555
+ });
2556
+ });
2557
+ var ScrollAreaCorner = /* @__PURE__ */ forwardRef22(({ classNames, ...props }, forwardedRef) => {
2558
+ const { tx } = useThemeContext();
2559
+ return /* @__PURE__ */ React26.createElement(ScrollAreaPrimitiveCorner, {
2560
+ ...props,
2561
+ className: tx("scrollArea.corner", "scroll-area__corner", {}, classNames),
2562
+ ref: forwardedRef
2563
+ });
2564
+ });
2565
+ var ScrollAreaExpander = ({ classNames, children }) => {
2566
+ return /* @__PURE__ */ React26.createElement("div", {
2567
+ role: "none",
2568
+ className: mx4("relative bs-full is-full overflow-hidden", classNames)
2569
+ }, /* @__PURE__ */ React26.createElement("div", {
2570
+ role: "none",
2571
+ className: "absolute inset-0 overflow-hidden"
2572
+ }, children));
2573
+ };
2574
+ var ScrollArea = {
2575
+ Root: ScrollAreaRoot,
2576
+ Viewport: ScrollAreaViewport,
2577
+ Scrollbar: ScrollAreaScrollbar,
2578
+ Thumb: ScrollAreaThumb,
2579
+ Corner: ScrollAreaCorner,
2580
+ Expander: ScrollAreaExpander
2581
+ };
2582
+
2583
+ // src/components/ScrollContainer/ScrollContainer.tsx
2584
+ import { createContext as createContext8 } from "@radix-ui/react-context";
2585
+ import React27, { forwardRef as forwardRef23, useCallback as useCallback10, useEffect as useEffect6, useImperativeHandle, useMemo as useMemo5, useRef as useRef4, useState as useState7 } from "react";
2586
+ import { addEventListener, combine } from "@dxos/async";
2587
+ import { invariant } from "@dxos/invariant";
2588
+ import { useForwardedRef as useForwardedRef2 } from "@dxos/react-hooks";
2589
+ import { mx as mx5 } from "@dxos/ui-theme";
2590
+ var __dxlog_file2 = "/__w/dxos/dxos/packages/ui/react-ui/src/components/ScrollContainer/ScrollContainer.tsx";
2591
+ var isBottom = (el) => {
2592
+ return !!(el && el.scrollHeight - el.scrollTop === el.clientHeight);
2593
+ };
2594
+ var [ScrollContainerProvider, useScrollContainerContext] = createContext8("ScrollContainer");
2595
+ var Root3 = /* @__PURE__ */ forwardRef23(({ children, classNames, pin, fade, behavior: behaviorProp = "smooth" }, forwardedRef) => {
2596
+ const scrollerRef = useRef4(null);
2597
+ const autoScrollRef = useRef4(false);
2598
+ const [overflow, setOverflow] = useState7(false);
2599
+ const [pinned, setPinned] = useState7(pin);
2600
+ const timeoutRef = useRef4(void 0);
2601
+ const scrollToBottom = useCallback10((behavior = behaviorProp) => {
2602
+ if (scrollerRef.current) {
2603
+ autoScrollRef.current = true;
2604
+ scrollerRef.current.classList.add("scrollbar-none");
2605
+ scrollerRef.current.scrollTo({
2606
+ top: scrollerRef.current.scrollHeight,
2607
+ behavior
2608
+ });
2609
+ clearTimeout(timeoutRef.current);
2610
+ if (behavior !== "instant") {
2611
+ timeoutRef.current = setTimeout(() => {
2612
+ scrollerRef.current?.classList.remove("scrollbar-none");
2613
+ autoScrollRef.current = false;
2614
+ }, 500);
2615
+ }
2616
+ setPinned(true);
2617
+ }
2618
+ }, []);
2619
+ const controller = useMemo5(() => ({
2620
+ viewport: scrollerRef.current,
2621
+ scrollToTop: () => {
2622
+ invariant(scrollerRef.current, void 0, {
2623
+ F: __dxlog_file2,
2624
+ L: 94,
2625
+ S: void 0,
2626
+ A: [
2627
+ "scrollerRef.current",
2628
+ ""
2629
+ ]
2630
+ });
2631
+ scrollerRef.current.scrollTo({
2632
+ top: 0,
2633
+ behavior: "smooth"
2634
+ });
2635
+ setPinned(false);
2636
+ },
2637
+ scrollToBottom: () => {
2638
+ scrollToBottom("smooth");
2639
+ }
2640
+ }), [
2641
+ scrollToBottom,
2642
+ scrollerRef.current
2643
+ ]);
2644
+ useImperativeHandle(forwardedRef, () => controller, [
2645
+ controller
2646
+ ]);
2647
+ useEffect6(() => {
2648
+ if (!scrollerRef.current) {
2649
+ return;
2650
+ }
2651
+ return combine(
2652
+ // Check if user scrolls.
2653
+ addEventListener(scrollerRef.current, "wheel", () => {
2654
+ setPinned(isBottom(scrollerRef.current));
2655
+ }),
2656
+ // Check if scrolls.
2657
+ addEventListener(scrollerRef.current, "scroll", () => {
2658
+ setOverflow((scrollerRef.current?.scrollTop ?? 0) > 0);
2659
+ })
2660
+ );
2661
+ }, []);
2662
+ return /* @__PURE__ */ React27.createElement(ScrollContainerProvider, {
2663
+ pinned,
2664
+ controller,
2665
+ scrollToBottom
2666
+ }, /* @__PURE__ */ React27.createElement("div", {
2667
+ className: "relative grid flex-1 min-bs-0 overflow-hidden"
2668
+ }, fade && /* @__PURE__ */ React27.createElement("div", {
2669
+ role: "none",
2670
+ "data-visible": overflow,
2671
+ className: mx5(
2672
+ // NOTE: Gradients may not be visible with dark reader extensions.
2673
+ "z-10 absolute block-start-0 inset-inline-0 bs-24 is-full",
2674
+ 'opacity-0 duration-200 transition-opacity data-[visible="true"]:opacity-100',
2675
+ "bg-gradient-to-b from-[--surface-bg] to-transparent pointer-events-none"
2676
+ )
2677
+ }), /* @__PURE__ */ React27.createElement("div", {
2678
+ className: mx5("flex flex-col min-bs-0 overflow-y-auto scrollbar-thin", classNames),
2679
+ ref: scrollerRef
2680
+ }, children)));
2681
+ });
2682
+ Root3.displayName = "ScrollContainer.Root";
2683
+ var Viewport = /* @__PURE__ */ forwardRef23(({ classNames, children, ...props }, forwardedRef) => {
2684
+ const contentRef = useForwardedRef2(forwardedRef);
2685
+ const { pinned, scrollToBottom } = useScrollContainerContext(Viewport.displayName);
2686
+ useEffect6(() => {
2687
+ if (!pinned || !contentRef.current) {
2688
+ return;
2689
+ }
2690
+ scrollToBottom();
2691
+ const resizeObserver = new ResizeObserver(() => scrollToBottom());
2692
+ resizeObserver.observe(contentRef.current);
2693
+ return () => resizeObserver.disconnect();
2694
+ }, [
2695
+ pinned,
2696
+ scrollToBottom
2697
+ ]);
2698
+ return /* @__PURE__ */ React27.createElement("div", {
2699
+ className: mx5("is-full", classNames),
2700
+ ...props,
2701
+ ref: contentRef
2702
+ }, children);
2703
+ });
2704
+ Viewport.displayName = "ScrollContainer.Viewport";
2705
+ var ScrollDownButton = ({ classNames }) => {
2706
+ const { pinned, scrollToBottom } = useScrollContainerContext(ScrollDownButton.displayName);
2707
+ return /* @__PURE__ */ React27.createElement("div", {
2708
+ role: "none",
2709
+ className: mx5("absolute bottom-2 right-4 opacity-100 transition-opacity duration-300", pinned && "opacity-0", classNames)
2710
+ }, /* @__PURE__ */ React27.createElement(IconButton, {
2711
+ variant: "primary",
2712
+ icon: "ph--arrow-down--regular",
2713
+ iconOnly: true,
2714
+ size: 4,
2715
+ label: "Scroll down",
2716
+ onClick: () => scrollToBottom()
2717
+ }));
2718
+ };
2719
+ ScrollDownButton.displayName = "ScrollContainer.ScrollDownButton";
2720
+ var ScrollContainer = {
2721
+ Root: Root3,
2722
+ Viewport,
2723
+ ScrollDownButton
2724
+ };
2725
+
2726
+ // src/components/Select/Select.tsx
2727
+ import * as SelectPrimitive from "@radix-ui/react-select";
2728
+ import React28, { forwardRef as forwardRef24 } from "react";
2729
+ var SelectRoot = SelectPrimitive.Root;
2730
+ var SelectTrigger = SelectPrimitive.Trigger;
2731
+ var SelectValue = SelectPrimitive.Value;
2732
+ var SelectIcon = SelectPrimitive.Icon;
2733
+ var SelectPortal = SelectPrimitive.Portal;
2734
+ var SelectTriggerButton = /* @__PURE__ */ forwardRef24(({ children, placeholder, ...props }, forwardedRef) => {
2735
+ return /* @__PURE__ */ React28.createElement(SelectPrimitive.Trigger, {
2736
+ asChild: true,
2737
+ ref: forwardedRef
2738
+ }, /* @__PURE__ */ React28.createElement(Button, props, /* @__PURE__ */ React28.createElement(SelectPrimitive.Value, {
2739
+ placeholder
2740
+ }, children), /* @__PURE__ */ React28.createElement("span", {
2741
+ className: "is-1 flex-1"
2742
+ }), /* @__PURE__ */ React28.createElement(SelectPrimitive.Icon, {
2743
+ asChild: true
2744
+ }, /* @__PURE__ */ React28.createElement(Icon, {
2745
+ size: 3,
2746
+ icon: "ph--caret-down--bold"
2747
+ }))));
2748
+ });
2749
+ var SelectContent = /* @__PURE__ */ forwardRef24(({ classNames, children, collisionPadding = 8, ...props }, forwardedRef) => {
2750
+ const { tx } = useThemeContext();
2751
+ const elevation = useElevationContext();
2752
+ const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
2753
+ return /* @__PURE__ */ React28.createElement(SelectPrimitive.Content, {
2754
+ ...props,
2755
+ "data-arrow-keys": "up down",
2756
+ collisionPadding: safeCollisionPadding,
2757
+ className: tx("select.content", "select__content", {
2758
+ elevation
2759
+ }, classNames),
2760
+ position: "popper",
2761
+ ref: forwardedRef
2762
+ }, children);
2763
+ });
2764
+ var SelectScrollUpButton2 = /* @__PURE__ */ forwardRef24(({ classNames, children, ...props }, forwardedRef) => {
2765
+ const { tx } = useThemeContext();
2766
+ return /* @__PURE__ */ React28.createElement(SelectPrimitive.SelectScrollUpButton, {
2767
+ ...props,
2768
+ className: tx("select.scrollButton", "select__scroll-button--up", {}, classNames),
2769
+ ref: forwardedRef
2770
+ }, children ?? /* @__PURE__ */ React28.createElement(Icon, {
2771
+ size: 3,
2772
+ icon: "ph--caret-up--bold"
2773
+ }));
2774
+ });
2775
+ var SelectScrollDownButton2 = /* @__PURE__ */ forwardRef24(({ classNames, children, ...props }, forwardedRef) => {
2776
+ const { tx } = useThemeContext();
2777
+ return /* @__PURE__ */ React28.createElement(SelectPrimitive.SelectScrollDownButton, {
2778
+ ...props,
2779
+ className: tx("select.scrollButton", "select__scroll-button--down", {}, classNames),
2780
+ ref: forwardedRef
2781
+ }, children ?? /* @__PURE__ */ React28.createElement(Icon, {
2782
+ size: 3,
2783
+ icon: "ph--caret-down--bold"
2784
+ }));
2785
+ });
2786
+ var SelectViewport2 = /* @__PURE__ */ forwardRef24(({ classNames, children, ...props }, forwardedRef) => {
2787
+ const { tx } = useThemeContext();
2788
+ return /* @__PURE__ */ React28.createElement(SelectPrimitive.SelectViewport, {
2789
+ ...props,
2790
+ className: tx("select.viewport", "select__viewport", {}, classNames),
2791
+ ref: forwardedRef
2792
+ }, children);
2793
+ });
2794
+ var SelectItem = /* @__PURE__ */ forwardRef24(({ classNames, ...props }, forwardedRef) => {
2795
+ const { tx } = useThemeContext();
2796
+ return /* @__PURE__ */ React28.createElement(SelectPrimitive.Item, {
2797
+ ...props,
2798
+ className: tx("select.item", "option", {}, classNames),
2799
+ ref: forwardedRef
2800
+ });
2801
+ });
2802
+ var SelectItemText = SelectPrimitive.ItemText;
2803
+ var SelectItemIndicator = /* @__PURE__ */ forwardRef24(({ classNames, children, ...props }, forwardedRef) => {
2804
+ const { tx } = useThemeContext();
2805
+ return /* @__PURE__ */ React28.createElement(SelectPrimitive.ItemIndicator, {
2806
+ ...props,
2807
+ className: tx("select.itemIndicator", "option__indicator", {}, classNames),
2808
+ ref: forwardedRef
2809
+ }, children);
2810
+ });
2811
+ var SelectOption = /* @__PURE__ */ forwardRef24(({ children, classNames, ...props }, forwardedRef) => {
2812
+ const { tx } = useThemeContext();
2813
+ return /* @__PURE__ */ React28.createElement(SelectPrimitive.Item, {
2814
+ ...props,
2815
+ className: tx("select.item", "option", {}, classNames),
2816
+ ref: forwardedRef
2817
+ }, /* @__PURE__ */ React28.createElement(SelectPrimitive.ItemText, null, children), /* @__PURE__ */ React28.createElement("span", {
2818
+ className: "grow is-1"
2819
+ }), /* @__PURE__ */ React28.createElement(Icon, {
2820
+ icon: "ph--check--regular"
2821
+ }));
2822
+ });
2823
+ var SelectGroup = SelectPrimitive.Group;
2824
+ var SelectLabel = SelectPrimitive.Label;
2825
+ var SelectSeparator = /* @__PURE__ */ forwardRef24(({ classNames, ...props }, forwardedRef) => {
2826
+ const { tx } = useThemeContext();
2827
+ return /* @__PURE__ */ React28.createElement(SelectPrimitive.Separator, {
2828
+ ...props,
2829
+ className: tx("select.separator", "select__separator", {}, classNames),
2830
+ ref: forwardedRef
2831
+ });
2832
+ });
2833
+ var SelectArrow = /* @__PURE__ */ forwardRef24(({ classNames, ...props }, forwardedRef) => {
2834
+ const { tx } = useThemeContext();
2835
+ return /* @__PURE__ */ React28.createElement(SelectPrimitive.Arrow, {
2836
+ ...props,
2837
+ className: tx("select.arrow", "select__arrow", {}, classNames),
2838
+ ref: forwardedRef
2839
+ });
2840
+ });
2841
+ var Select = {
2842
+ Root: SelectRoot,
2843
+ Trigger: SelectTrigger,
2844
+ TriggerButton: SelectTriggerButton,
2845
+ Value: SelectValue,
2846
+ Icon: SelectIcon,
2847
+ Portal: SelectPortal,
2848
+ Content: SelectContent,
2849
+ ScrollUpButton: SelectScrollUpButton2,
2850
+ ScrollDownButton: SelectScrollDownButton2,
2851
+ Viewport: SelectViewport2,
2852
+ Item: SelectItem,
2853
+ ItemText: SelectItemText,
2854
+ ItemIndicator: SelectItemIndicator,
2855
+ Option: SelectOption,
2856
+ Group: SelectGroup,
2857
+ Label: SelectLabel,
2858
+ Separator: SelectSeparator,
2859
+ Arrow: SelectArrow
2860
+ };
2861
+
2862
+ // src/components/Separator/Separator.tsx
2863
+ import { Separator as SeparatorPrimitive } from "@radix-ui/react-separator";
2864
+ import React29, { forwardRef as forwardRef25 } from "react";
2865
+ var Separator4 = /* @__PURE__ */ forwardRef25(({ classNames, orientation = "horizontal", subdued, ...props }, forwardedRef) => {
2866
+ const { tx } = useThemeContext();
2867
+ return /* @__PURE__ */ React29.createElement(SeparatorPrimitive, {
2868
+ orientation,
2869
+ ...props,
2870
+ className: tx("separator.root", "separator", {
2871
+ orientation,
2872
+ subdued
2873
+ }, classNames),
2874
+ ref: forwardedRef
2875
+ });
2876
+ });
2877
+
2878
+ // src/components/Tag/Tag.tsx
2879
+ import { Primitive as Primitive12 } from "@radix-ui/react-primitive";
2880
+ import { Slot as Slot13 } from "@radix-ui/react-slot";
2881
+ import React30, { forwardRef as forwardRef26 } from "react";
2882
+ var Tag = /* @__PURE__ */ forwardRef26(({ asChild, palette = "neutral", classNames, ...props }, forwardedRef) => {
2883
+ const { tx } = useThemeContext();
2884
+ const Root6 = asChild ? Slot13 : Primitive12.span;
2885
+ return /* @__PURE__ */ React30.createElement(Root6, {
2886
+ ...props,
2887
+ className: tx("tag.root", "dx-tag", {
2888
+ palette
2889
+ }, classNames),
2890
+ "data-hue": palette,
2891
+ ref: forwardedRef
2892
+ });
2893
+ });
2894
+
2895
+ // src/components/Toast/Toast.tsx
2896
+ import { Primitive as Primitive13 } from "@radix-ui/react-primitive";
2897
+ import { Slot as Slot14 } from "@radix-ui/react-slot";
2898
+ import { ToastAction as ToastActionPrimitive, ToastClose as ToastClosePrimitive, ToastDescription as ToastDescriptionPrimitive, ToastProvider as ToastProviderPrimitive, Root as ToastRootPrimitive, ToastTitle as ToastTitlePrimitive, ToastViewport as ToastViewportPrimitive } from "@radix-ui/react-toast";
2899
+ import React31, { forwardRef as forwardRef27 } from "react";
2900
+ var ToastProvider = ToastProviderPrimitive;
2901
+ var ToastViewport = /* @__PURE__ */ forwardRef27(({ classNames, ...props }, forwardedRef) => {
2902
+ const { tx } = useThemeContext();
2903
+ return /* @__PURE__ */ React31.createElement(ToastViewportPrimitive, {
2904
+ className: tx("toast.viewport", "toast-viewport", {}, classNames),
2905
+ ref: forwardedRef
2906
+ });
2907
+ });
2908
+ var ToastRoot = /* @__PURE__ */ forwardRef27(({ classNames, children, ...props }, forwardedRef) => {
2909
+ const { tx } = useThemeContext();
2910
+ return /* @__PURE__ */ React31.createElement(ToastRootPrimitive, {
2911
+ ...props,
2912
+ className: tx("toast.root", "toast", {}, classNames),
2913
+ ref: forwardedRef
2914
+ }, /* @__PURE__ */ React31.createElement(ElevationProvider, {
2915
+ elevation: "toast"
2916
+ }, children));
2917
+ });
2918
+ var ToastBody = /* @__PURE__ */ forwardRef27(({ asChild, classNames, ...props }, forwardedRef) => {
2919
+ const { tx } = useThemeContext();
2920
+ const Root6 = asChild ? Slot14 : Primitive13.div;
2921
+ return /* @__PURE__ */ React31.createElement(Root6, {
2922
+ ...props,
2923
+ className: tx("toast.body", "toast__body", {}, classNames),
2924
+ ref: forwardedRef
2925
+ });
2926
+ });
2927
+ var ToastTitle = /* @__PURE__ */ forwardRef27(({ asChild, classNames, ...props }, forwardedRef) => {
2928
+ const { tx } = useThemeContext();
2929
+ const Root6 = asChild ? Slot14 : ToastTitlePrimitive;
2930
+ return /* @__PURE__ */ React31.createElement(Root6, {
2931
+ ...props,
2932
+ className: tx("toast.title", "toast__title", {}, classNames),
2933
+ ref: forwardedRef
2934
+ });
2935
+ });
2936
+ var ToastDescription = /* @__PURE__ */ forwardRef27(({ asChild, classNames, ...props }, forwardedRef) => {
2937
+ const { tx } = useThemeContext();
2938
+ const Root6 = asChild ? Slot14 : ToastDescriptionPrimitive;
2939
+ return /* @__PURE__ */ React31.createElement(Root6, {
2940
+ ...props,
2941
+ className: tx("toast.description", "toast__description", {}, classNames),
2942
+ ref: forwardedRef
2943
+ });
2944
+ });
2945
+ var ToastActions = /* @__PURE__ */ forwardRef27(({ asChild, classNames, ...props }, forwardedRef) => {
2946
+ const { tx } = useThemeContext();
2947
+ const Root6 = asChild ? Slot14 : Primitive13.div;
2948
+ return /* @__PURE__ */ React31.createElement(Root6, {
2949
+ ...props,
2950
+ className: tx("toast.actions", "toast__actions", {}, classNames),
2951
+ ref: forwardedRef
2952
+ });
2953
+ });
2954
+ var ToastAction = ToastActionPrimitive;
2955
+ var ToastClose = ToastClosePrimitive;
2956
+ var Toast = {
2957
+ Provider: ToastProvider,
2958
+ Viewport: ToastViewport,
2959
+ Root: ToastRoot,
2960
+ Body: ToastBody,
2961
+ Title: ToastTitle,
2962
+ Description: ToastDescription,
2963
+ Actions: ToastActions,
2964
+ Action: ToastAction,
2965
+ Close: ToastClose
2966
+ };
2967
+
2968
+ // src/components/Toolbar/Toolbar.tsx
2969
+ import * as ToolbarPrimitive from "@radix-ui/react-toolbar";
2970
+ import React32, { Fragment, forwardRef as forwardRef28 } from "react";
2971
+ var ToolbarRoot = /* @__PURE__ */ forwardRef28(({ classNames, children, disabled, layoutManaged, textBlockWidth: textBlockWidthProp, ...props }, forwardedRef) => {
2972
+ const { tx } = useThemeContext();
2973
+ const InnerRoot = textBlockWidthProp ? "div" : Fragment;
2974
+ const innerRootProps = textBlockWidthProp ? {
2975
+ role: "none",
2976
+ className: tx("toolbar.inner", "toolbar", {
2977
+ layoutManaged
2978
+ }, classNames)
2979
+ } : {};
2980
+ return /* @__PURE__ */ React32.createElement(ToolbarPrimitive.Root, {
2981
+ ...props,
2982
+ "data-arrow-keys": props.orientation === "vertical" ? "up down" : "left right",
2983
+ className: tx("toolbar.root", "toolbar", {
2984
+ layoutManaged,
2985
+ disabled
2986
+ }, classNames),
2987
+ ref: forwardedRef
2988
+ }, /* @__PURE__ */ React32.createElement(InnerRoot, innerRootProps, children));
2989
+ });
2990
+ var ToolbarButton = /* @__PURE__ */ forwardRef28((props, forwardedRef) => {
2991
+ return /* @__PURE__ */ React32.createElement(ToolbarPrimitive.Button, {
2992
+ asChild: true
2993
+ }, /* @__PURE__ */ React32.createElement(Button, {
2994
+ ...props,
2995
+ ref: forwardedRef
2996
+ }));
2997
+ });
2998
+ var ToolbarIconButton = /* @__PURE__ */ forwardRef28((props, forwardedRef) => {
2999
+ return /* @__PURE__ */ React32.createElement(ToolbarPrimitive.Button, {
3000
+ asChild: true
3001
+ }, /* @__PURE__ */ React32.createElement(IconButton, {
3002
+ ...props,
3003
+ noTooltip: true,
3004
+ ref: forwardedRef
3005
+ }));
3006
+ });
3007
+ var ToolbarToggle = /* @__PURE__ */ forwardRef28((props, forwardedRef) => {
3008
+ return /* @__PURE__ */ React32.createElement(ToolbarPrimitive.Button, {
3009
+ asChild: true
3010
+ }, /* @__PURE__ */ React32.createElement(Toggle, {
3011
+ ...props,
3012
+ ref: forwardedRef
3013
+ }));
3014
+ });
3015
+ var ToolbarLink = /* @__PURE__ */ forwardRef28((props, forwardedRef) => {
3016
+ return /* @__PURE__ */ React32.createElement(ToolbarPrimitive.Link, {
3017
+ asChild: true
3018
+ }, /* @__PURE__ */ React32.createElement(Link, {
3019
+ ...props,
3020
+ ref: forwardedRef
3021
+ }));
3022
+ });
3023
+ var ToolbarToggleGroup2 = /* @__PURE__ */ forwardRef28(({ classNames, children, elevation, ...props }, forwardedRef) => {
3024
+ return /* @__PURE__ */ React32.createElement(ToolbarPrimitive.ToolbarToggleGroup, {
3025
+ ...props,
3026
+ asChild: true
3027
+ }, /* @__PURE__ */ React32.createElement(ButtonGroup, {
3028
+ classNames,
3029
+ children,
3030
+ elevation,
3031
+ ref: forwardedRef
3032
+ }));
3033
+ });
3034
+ var ToolbarToggleGroupItem = /* @__PURE__ */ forwardRef28(({ variant, density, elevation, classNames, children, ...props }, forwardedRef) => {
3035
+ return /* @__PURE__ */ React32.createElement(ToolbarPrimitive.ToolbarToggleItem, {
3036
+ ...props,
3037
+ asChild: true
3038
+ }, /* @__PURE__ */ React32.createElement(Button, {
3039
+ variant,
3040
+ density,
3041
+ elevation,
3042
+ classNames,
3043
+ children,
3044
+ ref: forwardedRef
3045
+ }));
3046
+ });
3047
+ var ToolbarToggleGroupIconItem = /* @__PURE__ */ forwardRef28(({ variant, density, elevation, classNames, icon, label, iconOnly, ...props }, forwardedRef) => {
3048
+ return /* @__PURE__ */ React32.createElement(ToolbarPrimitive.ToolbarToggleItem, {
3049
+ ...props,
3050
+ asChild: true
3051
+ }, /* @__PURE__ */ React32.createElement(IconButton, {
3052
+ variant,
3053
+ density,
3054
+ elevation,
3055
+ classNames,
3056
+ icon,
3057
+ label,
3058
+ iconOnly,
3059
+ ref: forwardedRef
3060
+ }));
3061
+ });
3062
+ var ToolbarSeparator = /* @__PURE__ */ forwardRef28(({ variant = "line", ...props }, forwardedRef) => {
3063
+ return variant === "line" ? /* @__PURE__ */ React32.createElement(ToolbarPrimitive.Separator, {
3064
+ asChild: true
3065
+ }, /* @__PURE__ */ React32.createElement(Separator4, {
3066
+ ...props,
3067
+ ref: forwardedRef
3068
+ })) : /* @__PURE__ */ React32.createElement(ToolbarPrimitive.Separator, {
3069
+ className: "grow",
3070
+ ref: forwardedRef
3071
+ });
3072
+ });
3073
+ var Toolbar = {
3074
+ Root: ToolbarRoot,
3075
+ Button: ToolbarButton,
3076
+ IconButton: ToolbarIconButton,
3077
+ Link: ToolbarLink,
3078
+ Toggle: ToolbarToggle,
3079
+ ToggleGroup: ToolbarToggleGroup2,
3080
+ ToggleGroupItem: ToolbarToggleGroupItem,
3081
+ ToggleGroupIconItem: ToolbarToggleGroupIconItem,
3082
+ Separator: ToolbarSeparator
3083
+ };
78
3084
  export {
79
3085
  AlertDialog,
80
3086
  AnchoredOverflow,
@@ -85,7 +3091,7 @@ export {
85
3091
  ButtonGroup,
86
3092
  Callout,
87
3093
  Clipboard,
88
- ContextMenu,
3094
+ ContextMenu2 as ContextMenu,
89
3095
  DensityContext,
90
3096
  DensityProvider,
91
3097
  Dialog,
@@ -104,8 +3110,9 @@ export {
104
3110
  Message,
105
3111
  Popover,
106
3112
  ScrollArea,
3113
+ ScrollContainer,
107
3114
  Select,
108
- Separator,
3115
+ Separator4 as Separator,
109
3116
  Status,
110
3117
  Tag,
111
3118
  ThemeContext,
@@ -113,6 +3120,7 @@ export {
113
3120
  Toast,
114
3121
  Toggle,
115
3122
  ToggleGroup,
3123
+ ToggleGroupIconItem,
116
3124
  ToggleGroupItem,
117
3125
  Toolbar,
118
3126
  Tooltip,
@@ -140,7 +3148,9 @@ export {
140
3148
  useListContext,
141
3149
  useListItemContext,
142
3150
  useMainContext,
3151
+ usePx,
143
3152
  useSafeArea,
3153
+ useScrollContainerContext,
144
3154
  useSidebars,
145
3155
  useThemeContext,
146
3156
  useTooltipContext,