@dxos/react-ui 0.8.4-main.ae835ea → 0.8.4-main.bc674ce

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 (253) 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 +3163 -64
  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 +34 -46
  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 +3163 -64
  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 +34 -46
  14. package/dist/lib/node-esm/testing/index.mjs.map +4 -4
  15. package/dist/types/src/components/{Buttons → Button}/Button.d.ts +1 -1
  16. package/dist/types/src/components/Button/Button.d.ts.map +1 -0
  17. package/dist/types/src/components/Button/Button.stories.d.ts.map +1 -0
  18. package/dist/types/src/components/{Buttons → Button}/IconButton.d.ts +2 -2
  19. package/dist/types/src/components/Button/IconButton.d.ts.map +1 -0
  20. package/dist/types/src/components/Button/IconButton.stories.d.ts.map +1 -0
  21. package/dist/types/src/components/Button/Toggle.d.ts.map +1 -0
  22. package/dist/types/src/components/Button/Toggle.stories.d.ts +16 -0
  23. package/dist/types/src/components/Button/Toggle.stories.d.ts.map +1 -0
  24. package/dist/types/src/components/{Buttons → Button}/ToggleGroup.d.ts +4 -4
  25. package/dist/types/src/components/Button/ToggleGroup.d.ts.map +1 -0
  26. package/dist/types/src/components/{Buttons → Button}/ToggleGroup.stories.d.ts +4 -4
  27. package/dist/types/src/components/Button/ToggleGroup.stories.d.ts.map +1 -0
  28. package/dist/types/src/components/Button/index.d.ts.map +1 -0
  29. package/dist/types/src/components/Clipboard/CopyButton.d.ts +1 -1
  30. package/dist/types/src/components/Clipboard/CopyButton.d.ts.map +1 -1
  31. package/dist/types/src/components/DensityProvider/DensityProvider.d.ts +1 -1
  32. package/dist/types/src/components/DensityProvider/DensityProvider.d.ts.map +1 -1
  33. package/dist/types/src/components/Dialog/AlertDialog.d.ts.map +1 -0
  34. package/dist/types/src/components/Dialog/AlertDialog.stories.d.ts.map +1 -0
  35. package/dist/types/src/components/Dialog/Dialog.d.ts +40 -0
  36. package/dist/types/src/components/Dialog/Dialog.d.ts.map +1 -0
  37. package/dist/types/src/components/{Dialogs → Dialog}/Dialog.stories.d.ts +7 -5
  38. package/dist/types/src/components/Dialog/Dialog.stories.d.ts.map +1 -0
  39. package/dist/types/src/components/Dialog/index.d.ts.map +1 -0
  40. package/dist/types/src/components/ElevationProvider/ElevationProvider.d.ts +1 -1
  41. package/dist/types/src/components/ElevationProvider/ElevationProvider.d.ts.map +1 -1
  42. package/dist/types/src/components/Icon/Icon.d.ts +1 -1
  43. package/dist/types/src/components/Icon/Icon.d.ts.map +1 -1
  44. package/dist/types/src/components/Input/Input.d.ts +5 -2
  45. package/dist/types/src/components/Input/Input.d.ts.map +1 -1
  46. package/dist/types/src/components/Input/Input.stories.d.ts +1 -1
  47. package/dist/types/src/components/Input/Input.stories.d.ts.map +1 -1
  48. package/dist/types/src/components/{Lists → List}/List.d.ts +1 -1
  49. package/dist/types/src/components/List/List.d.ts.map +1 -0
  50. package/dist/types/src/components/List/List.stories.d.ts.map +1 -0
  51. package/dist/types/src/components/List/ListDropIndicator.d.ts.map +1 -0
  52. package/dist/types/src/components/List/Tree.d.ts.map +1 -0
  53. package/dist/types/src/components/List/Tree.stories.d.ts.map +1 -0
  54. package/dist/types/src/components/List/TreeDropIndicator.d.ts.map +1 -0
  55. package/dist/types/src/components/List/Treegrid.d.ts.map +1 -0
  56. package/dist/types/src/components/List/Treegrid.stories.d.ts.map +1 -0
  57. package/dist/types/src/components/List/index.d.ts.map +1 -0
  58. package/dist/types/src/components/Main/Main.d.ts +44 -19
  59. package/dist/types/src/components/Main/Main.d.ts.map +1 -1
  60. package/dist/types/src/components/Main/Main.stories.d.ts +2 -1
  61. package/dist/types/src/components/Main/Main.stories.d.ts.map +1 -1
  62. package/dist/types/src/components/{Menus → Menu}/ContextMenu.d.ts +6 -6
  63. package/dist/types/src/components/Menu/ContextMenu.d.ts.map +1 -0
  64. package/dist/types/src/components/Menu/ContextMenu.stories.d.ts.map +1 -0
  65. package/dist/types/src/components/{Menus → Menu}/DropdownMenu.d.ts +3 -4
  66. package/dist/types/src/components/Menu/DropdownMenu.d.ts.map +1 -0
  67. package/dist/types/src/components/Menu/DropdownMenu.stories.d.ts.map +1 -0
  68. package/dist/types/src/components/Menu/index.d.ts.map +1 -0
  69. package/dist/types/src/components/Message/Message.d.ts +1 -1
  70. package/dist/types/src/components/Message/Message.d.ts.map +1 -1
  71. package/dist/types/src/components/Message/Message.stories.d.ts +1 -1
  72. package/dist/types/src/components/Message/Message.stories.d.ts.map +1 -1
  73. package/dist/types/src/components/Popover/Popover.d.ts +1 -1
  74. package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
  75. package/dist/types/src/components/ScrollArea/ScrollArea.d.ts +9 -7
  76. package/dist/types/src/components/ScrollArea/ScrollArea.d.ts.map +1 -1
  77. package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts +4 -0
  78. package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts.map +1 -1
  79. package/dist/types/src/components/ScrollContainer/ScrollContainer.d.ts +39 -0
  80. package/dist/types/src/components/ScrollContainer/ScrollContainer.d.ts.map +1 -0
  81. package/dist/types/src/components/ScrollContainer/ScrollContainer.stories.d.ts +19 -0
  82. package/dist/types/src/components/ScrollContainer/ScrollContainer.stories.d.ts.map +1 -0
  83. package/dist/types/src/components/ScrollContainer/index.d.ts +2 -0
  84. package/dist/types/src/components/ScrollContainer/index.d.ts.map +1 -0
  85. package/dist/types/src/components/Select/Select.d.ts +10 -10
  86. package/dist/types/src/components/Select/Select.d.ts.map +1 -1
  87. package/dist/types/src/components/Separator/Separator.d.ts +1 -1
  88. package/dist/types/src/components/Tag/Tag.d.ts +1 -1
  89. package/dist/types/src/components/Tag/Tag.d.ts.map +1 -1
  90. package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts +1 -2
  91. package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
  92. package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts +1 -8
  93. package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts.map +1 -1
  94. package/dist/types/src/components/ThemeProvider/index.d.ts +2 -1
  95. package/dist/types/src/components/ThemeProvider/index.d.ts.map +1 -1
  96. package/dist/types/src/components/Toast/Toast.d.ts +4 -4
  97. package/dist/types/src/components/Toolbar/Toolbar.d.ts +11 -11
  98. package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
  99. package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -1
  100. package/dist/types/src/components/Tooltip/Tooltip.d.ts.map +1 -1
  101. package/dist/types/src/components/index.d.ts +5 -4
  102. package/dist/types/src/components/index.d.ts.map +1 -1
  103. package/dist/types/src/hooks/useDensityContext.d.ts +1 -1
  104. package/dist/types/src/hooks/useDensityContext.d.ts.map +1 -1
  105. package/dist/types/src/hooks/useElevationContext.d.ts +1 -1
  106. package/dist/types/src/hooks/useElevationContext.d.ts.map +1 -1
  107. package/dist/types/src/index.d.ts +1 -1
  108. package/dist/types/src/index.d.ts.map +1 -1
  109. package/dist/types/src/playground/Custom.stories.d.ts.map +1 -1
  110. package/dist/types/src/testing/decorators/index.d.ts +1 -1
  111. package/dist/types/src/testing/decorators/index.d.ts.map +1 -1
  112. package/dist/types/src/testing/decorators/withLayout.d.ts +3 -3
  113. package/dist/types/src/testing/decorators/withLayout.d.ts.map +1 -1
  114. package/dist/types/src/testing/decorators/withLayoutVariants.d.ts +12 -0
  115. package/dist/types/src/testing/decorators/withLayoutVariants.d.ts.map +1 -0
  116. package/dist/types/src/testing/decorators/withTheme.d.ts.map +1 -1
  117. package/dist/types/src/util/index.d.ts +1 -2
  118. package/dist/types/src/util/index.d.ts.map +1 -1
  119. package/dist/types/tsconfig.tsbuildinfo +1 -1
  120. package/package.json +32 -25
  121. package/src/components/Avatars/Avatar.stories.tsx +2 -2
  122. package/src/components/Avatars/Avatar.tsx +1 -1
  123. package/src/components/Breadcrumb/Breadcrumb.stories.tsx +1 -1
  124. package/src/components/{Buttons → Button}/Button.stories.tsx +2 -2
  125. package/src/components/{Buttons → Button}/Button.tsx +1 -1
  126. package/src/components/{Buttons → Button}/IconButton.tsx +19 -13
  127. package/src/components/{Buttons → Button}/Toggle.stories.tsx +5 -4
  128. package/src/components/Clipboard/CopyButton.tsx +4 -4
  129. package/src/components/DensityProvider/DensityProvider.tsx +1 -1
  130. package/src/components/{Dialogs → Dialog}/AlertDialog.stories.tsx +1 -1
  131. package/src/components/Dialog/Dialog.stories.tsx +97 -0
  132. package/src/components/{Dialogs → Dialog}/Dialog.tsx +140 -40
  133. package/src/components/ElevationProvider/ElevationProvider.tsx +1 -1
  134. package/src/components/Icon/Icon.stories.tsx +1 -1
  135. package/src/components/Icon/Icon.tsx +1 -1
  136. package/src/components/Input/Input.stories.tsx +2 -2
  137. package/src/components/Input/Input.tsx +13 -4
  138. package/src/components/{Lists → List}/List.stories.tsx +17 -13
  139. package/src/components/{Lists → List}/List.tsx +1 -1
  140. package/src/components/{Lists → List}/ListDropIndicator.tsx +1 -1
  141. package/src/components/Main/Main.stories.tsx +127 -20
  142. package/src/components/Main/Main.tsx +265 -58
  143. package/src/components/{Menus → Menu}/DropdownMenu.stories.tsx +1 -1
  144. package/src/components/{Menus → Menu}/DropdownMenu.tsx +79 -58
  145. package/src/components/Message/Message.stories.tsx +1 -1
  146. package/src/components/Message/Message.tsx +30 -5
  147. package/src/components/Popover/Popover.stories.tsx +1 -1
  148. package/src/components/Popover/Popover.tsx +52 -33
  149. package/src/components/ScrollArea/ScrollArea.stories.tsx +54 -4
  150. package/src/components/ScrollArea/ScrollArea.tsx +50 -4
  151. package/src/components/ScrollContainer/ScrollContainer.stories.tsx +70 -0
  152. package/src/components/ScrollContainer/ScrollContainer.tsx +233 -0
  153. package/src/components/ScrollContainer/index.ts +5 -0
  154. package/src/components/Select/Select.stories.tsx +2 -2
  155. package/src/components/Select/Select.tsx +4 -4
  156. package/src/components/Tag/Tag.stories.tsx +2 -2
  157. package/src/components/Tag/Tag.tsx +1 -1
  158. package/src/components/ThemeProvider/ThemeProvider.tsx +1 -3
  159. package/src/components/ThemeProvider/TranslationsProvider.tsx +1 -16
  160. package/src/components/ThemeProvider/index.ts +3 -3
  161. package/src/components/Toast/Toast.stories.tsx +1 -1
  162. package/src/components/Toolbar/Toolbar.stories.tsx +2 -4
  163. package/src/components/Toolbar/Toolbar.tsx +24 -9
  164. package/src/components/Tooltip/Tooltip.stories.tsx +1 -1
  165. package/src/components/Tooltip/Tooltip.tsx +22 -20
  166. package/src/components/index.ts +5 -4
  167. package/src/hooks/useDensityContext.ts +1 -1
  168. package/src/hooks/useElevationContext.ts +1 -1
  169. package/src/index.ts +1 -1
  170. package/src/playground/Controls.stories.tsx +2 -2
  171. package/src/playground/Custom.stories.tsx +6 -8
  172. package/src/testing/decorators/index.ts +1 -1
  173. package/src/testing/decorators/withLayout.tsx +22 -15
  174. package/src/testing/decorators/{withSurfaceVariantsLayout.tsx → withLayoutVariants.tsx} +5 -5
  175. package/src/testing/decorators/withTheme.tsx +3 -2
  176. package/src/util/index.ts +2 -2
  177. package/dist/lib/browser/chunk-HUZZ56DW.mjs +0 -4509
  178. package/dist/lib/browser/chunk-HUZZ56DW.mjs.map +0 -7
  179. package/dist/lib/node-esm/chunk-OJLL6E2Z.mjs +0 -4511
  180. package/dist/lib/node-esm/chunk-OJLL6E2Z.mjs.map +0 -7
  181. package/dist/types/src/components/Buttons/Button.d.ts.map +0 -1
  182. package/dist/types/src/components/Buttons/Button.stories.d.ts.map +0 -1
  183. package/dist/types/src/components/Buttons/IconButton.d.ts.map +0 -1
  184. package/dist/types/src/components/Buttons/IconButton.stories.d.ts.map +0 -1
  185. package/dist/types/src/components/Buttons/Toggle.d.ts.map +0 -1
  186. package/dist/types/src/components/Buttons/Toggle.stories.d.ts +0 -13
  187. package/dist/types/src/components/Buttons/Toggle.stories.d.ts.map +0 -1
  188. package/dist/types/src/components/Buttons/ToggleGroup.d.ts.map +0 -1
  189. package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts.map +0 -1
  190. package/dist/types/src/components/Buttons/index.d.ts.map +0 -1
  191. package/dist/types/src/components/Dialogs/AlertDialog.d.ts.map +0 -1
  192. package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts.map +0 -1
  193. package/dist/types/src/components/Dialogs/Dialog.d.ts +0 -31
  194. package/dist/types/src/components/Dialogs/Dialog.d.ts.map +0 -1
  195. package/dist/types/src/components/Dialogs/Dialog.stories.d.ts.map +0 -1
  196. package/dist/types/src/components/Dialogs/index.d.ts.map +0 -1
  197. package/dist/types/src/components/Lists/List.d.ts.map +0 -1
  198. package/dist/types/src/components/Lists/List.stories.d.ts.map +0 -1
  199. package/dist/types/src/components/Lists/ListDropIndicator.d.ts.map +0 -1
  200. package/dist/types/src/components/Lists/Tree.d.ts.map +0 -1
  201. package/dist/types/src/components/Lists/Tree.stories.d.ts.map +0 -1
  202. package/dist/types/src/components/Lists/TreeDropIndicator.d.ts.map +0 -1
  203. package/dist/types/src/components/Lists/Treegrid.d.ts.map +0 -1
  204. package/dist/types/src/components/Lists/Treegrid.stories.d.ts.map +0 -1
  205. package/dist/types/src/components/Lists/index.d.ts.map +0 -1
  206. package/dist/types/src/components/Menus/ContextMenu.d.ts.map +0 -1
  207. package/dist/types/src/components/Menus/ContextMenu.stories.d.ts.map +0 -1
  208. package/dist/types/src/components/Menus/DropdownMenu.d.ts.map +0 -1
  209. package/dist/types/src/components/Menus/DropdownMenu.stories.d.ts.map +0 -1
  210. package/dist/types/src/components/Menus/index.d.ts.map +0 -1
  211. package/dist/types/src/testing/decorators/withSurfaceVariantsLayout.d.ts +0 -12
  212. package/dist/types/src/testing/decorators/withSurfaceVariantsLayout.d.ts.map +0 -1
  213. package/dist/types/src/util/ThemedClassName.d.ts +0 -5
  214. package/dist/types/src/util/ThemedClassName.d.ts.map +0 -1
  215. package/dist/types/src/util/domino.d.ts +0 -18
  216. package/dist/types/src/util/domino.d.ts.map +0 -1
  217. package/src/components/Dialogs/Dialog.stories.tsx +0 -67
  218. package/src/util/ThemedClassName.ts +0 -7
  219. package/src/util/domino.ts +0 -53
  220. /package/dist/types/src/components/{Buttons → Button}/Button.stories.d.ts +0 -0
  221. /package/dist/types/src/components/{Buttons → Button}/IconButton.stories.d.ts +0 -0
  222. /package/dist/types/src/components/{Buttons → Button}/Toggle.d.ts +0 -0
  223. /package/dist/types/src/components/{Buttons → Button}/index.d.ts +0 -0
  224. /package/dist/types/src/components/{Dialogs → Dialog}/AlertDialog.d.ts +0 -0
  225. /package/dist/types/src/components/{Dialogs → Dialog}/AlertDialog.stories.d.ts +0 -0
  226. /package/dist/types/src/components/{Dialogs → Dialog}/index.d.ts +0 -0
  227. /package/dist/types/src/components/{Lists → List}/List.stories.d.ts +0 -0
  228. /package/dist/types/src/components/{Lists → List}/ListDropIndicator.d.ts +0 -0
  229. /package/dist/types/src/components/{Lists → List}/Tree.d.ts +0 -0
  230. /package/dist/types/src/components/{Lists → List}/Tree.stories.d.ts +0 -0
  231. /package/dist/types/src/components/{Lists → List}/TreeDropIndicator.d.ts +0 -0
  232. /package/dist/types/src/components/{Lists → List}/Treegrid.d.ts +0 -0
  233. /package/dist/types/src/components/{Lists → List}/Treegrid.stories.d.ts +0 -0
  234. /package/dist/types/src/components/{Lists → List}/index.d.ts +0 -0
  235. /package/dist/types/src/components/{Menus → Menu}/ContextMenu.stories.d.ts +0 -0
  236. /package/dist/types/src/components/{Menus → Menu}/DropdownMenu.stories.d.ts +0 -0
  237. /package/dist/types/src/components/{Menus → Menu}/index.d.ts +0 -0
  238. /package/src/components/{Buttons → Button}/IconButton.stories.tsx +0 -0
  239. /package/src/components/{Buttons → Button}/Toggle.tsx +0 -0
  240. /package/src/components/{Buttons → Button}/ToggleGroup.stories.tsx +0 -0
  241. /package/src/components/{Buttons → Button}/ToggleGroup.tsx +0 -0
  242. /package/src/components/{Buttons → Button}/index.ts +0 -0
  243. /package/src/components/{Dialogs → Dialog}/AlertDialog.tsx +0 -0
  244. /package/src/components/{Dialogs → Dialog}/index.ts +0 -0
  245. /package/src/components/{Lists → List}/Tree.stories.tsx +0 -0
  246. /package/src/components/{Lists → List}/Tree.tsx +0 -0
  247. /package/src/components/{Lists → List}/TreeDropIndicator.tsx +0 -0
  248. /package/src/components/{Lists → List}/Treegrid.stories.tsx +0 -0
  249. /package/src/components/{Lists → List}/Treegrid.tsx +0 -0
  250. /package/src/components/{Lists → List}/index.ts +0 -0
  251. /package/src/components/{Menus → Menu}/ContextMenu.stories.tsx +0 -0
  252. /package/src/components/{Menus → Menu}/ContextMenu.tsx +0 -0
  253. /package/src/components/{Menus → Menu}/index.ts +0 -0
@@ -1,84 +1,3181 @@
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
- Domino,
17
- DropdownMenu,
18
5
  ElevationContext,
19
6
  ElevationProvider,
20
- Icon,
21
- IconButton,
22
- Input,
23
- LIST_ITEM_NAME,
24
- LIST_NAME,
25
- Link,
26
- List,
27
- ListItem,
28
- Main,
29
- Message,
30
- Popover,
31
- ScrollArea,
32
- Select,
33
- Separator,
34
- Status,
35
- Tag,
36
7
  ThemeContext,
37
8
  ThemeProvider,
38
- Toast,
39
- Toggle,
40
- ToggleGroup,
41
- ToggleGroupIconItem,
42
- ToggleGroupItem,
43
- Toolbar,
44
9
  Tooltip,
45
- Tree,
46
- TreeItem,
47
- Treegrid,
48
- createDropdownMenuScope,
49
- createPopoverScope,
10
+ TranslationsContext,
50
11
  createTooltipScope,
51
12
  hasIosKeyboard,
52
13
  initialSafeArea,
53
- isLabel,
54
- messageIcons,
55
- toLocalizedString,
56
- useAvatarContext,
57
- useButtonGroupContext,
58
- useClipboard,
59
- useDensityContext,
60
- useDropdownMenuContext,
61
- useDropdownMenuMenuScope,
62
14
  useElevationContext,
63
- useIconHref,
64
- useLandmarkMover,
65
- useListContext,
66
- useListItemContext,
67
- useMainContext,
68
- usePx,
69
15
  useSafeArea,
70
- useSidebars,
71
16
  useThemeContext,
72
17
  useTooltipContext,
73
- useTranslation,
74
- useTranslationsContext,
75
- useVisualViewport
76
- } from "./chunk-OJLL6E2Z.mjs";
18
+ useTranslation
19
+ } from "./chunk-2NHEX4AD.mjs";
77
20
 
78
21
  // src/index.ts
79
22
  import { Trans } from "react-i18next";
80
23
  export * from "@dxos/react-hooks";
81
- export * from "@dxos/react-ui-types";
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 { addEventListener } from "@dxos/async";
1252
+ import { log } from "@dxos/log";
1253
+ import { useDynamicRef, useForwardedRef, useMediaQuery, useViewportResize as useViewportResize2 } from "@dxos/react-hooks";
1254
+
1255
+ // src/components/Main/useSwipeToDismiss.ts
1256
+ import { useCallback as useCallback6, useEffect as useEffect2, useState as useState4 } from "react";
1257
+ var useSwipeToDismiss = (ref, {
1258
+ onDismiss,
1259
+ dismissThreshold = 64,
1260
+ debounceThreshold = 8,
1261
+ offset = 0
1262
+ /* side = 'inline-start' */
1263
+ }) => {
1264
+ const $root = ref.current;
1265
+ const [motionState, setMotionState] = useState4(0);
1266
+ const [gestureStartX, setGestureStartX] = useState4(0);
1267
+ const setIdle = useCallback6(() => {
1268
+ setMotionState(0);
1269
+ $root?.style.removeProperty("inset-inline-start");
1270
+ $root?.style.setProperty("transition-duration", "200ms");
1271
+ }, [
1272
+ $root
1273
+ ]);
1274
+ const setFollowing = useCallback6(() => {
1275
+ setMotionState(2);
1276
+ $root?.style.setProperty("transition-duration", "0ms");
1277
+ }, [
1278
+ $root
1279
+ ]);
1280
+ const handlePointerDown = useCallback6(({ screenX }) => {
1281
+ if (motionState === 0) {
1282
+ setMotionState(1);
1283
+ setGestureStartX(screenX);
1284
+ }
1285
+ }, [
1286
+ motionState
1287
+ ]);
1288
+ const handlePointerMove = useCallback6(({ screenX }) => {
1289
+ if ($root) {
1290
+ const delta = Math.min(screenX - gestureStartX, 0);
1291
+ switch (motionState) {
1292
+ case 2:
1293
+ if (Math.abs(delta) > dismissThreshold) {
1294
+ setIdle();
1295
+ onDismiss?.();
1296
+ } else {
1297
+ $root.style.setProperty("inset-inline-start", `${offset + delta}px`);
1298
+ }
1299
+ break;
1300
+ case 1:
1301
+ if (Math.abs(delta) > debounceThreshold) {
1302
+ setFollowing();
1303
+ }
1304
+ break;
1305
+ }
1306
+ }
1307
+ }, [
1308
+ $root,
1309
+ motionState,
1310
+ gestureStartX
1311
+ ]);
1312
+ const handlePointerUp = useCallback6(() => {
1313
+ setIdle();
1314
+ }, [
1315
+ setIdle
1316
+ ]);
1317
+ useEffect2(() => {
1318
+ $root?.addEventListener("pointerdown", handlePointerDown);
1319
+ return () => {
1320
+ $root?.removeEventListener("pointerdown", handlePointerDown);
1321
+ };
1322
+ }, [
1323
+ $root,
1324
+ handlePointerDown
1325
+ ]);
1326
+ useEffect2(() => {
1327
+ $root && document.documentElement.addEventListener("pointermove", handlePointerMove);
1328
+ return () => {
1329
+ document.documentElement.removeEventListener("pointermove", handlePointerMove);
1330
+ };
1331
+ }, [
1332
+ $root,
1333
+ handlePointerMove
1334
+ ]);
1335
+ useEffect2(() => {
1336
+ $root && document.documentElement.addEventListener("pointerup", handlePointerUp);
1337
+ return () => {
1338
+ document.documentElement.removeEventListener("pointerup", handlePointerUp);
1339
+ };
1340
+ }, [
1341
+ $root,
1342
+ handlePointerUp
1343
+ ]);
1344
+ };
1345
+
1346
+ // src/components/Main/Main.tsx
1347
+ var __dxlog_file = "/__w/dxos/dxos/packages/ui/react-ui/src/components/Main/Main.tsx";
1348
+ var MAIN_NAME = "Main";
1349
+ var MAIN_ROOT_NAME = "MainRoot";
1350
+ var NAVIGATION_SIDEBAR_NAME = "NavigationSidebar";
1351
+ var COMPLEMENTARY_SIDEBAR_NAME = "ComplementarySidebar";
1352
+ var DRAWER_NAME = "Drawer";
1353
+ var handleOpenAutoFocus = (event) => {
1354
+ !document.body.hasAttribute("data-is-keyboard") && event.preventDefault();
1355
+ };
1356
+ var landmarkAttr = "data-main-landmark";
1357
+ var useLandmarkMover = (propsOnKeyDown, landmark) => {
1358
+ const handleKeyDown = useCallback7((event) => {
1359
+ const target = event.target;
1360
+ if (event.target === event.currentTarget && event.key === "Tab" && target.hasAttribute(landmarkAttr)) {
1361
+ event.preventDefault();
1362
+ const landmarks = Array.from(document.querySelectorAll(`[${landmarkAttr}]:not([inert])`)).map((el) => el.hasAttribute(landmarkAttr) ? parseInt(el.getAttribute(landmarkAttr)) : NaN).sort();
1363
+ const l = landmarks.length;
1364
+ const cursor = landmarks.indexOf(parseInt(target.getAttribute(landmarkAttr)));
1365
+ const nextLandmark = landmarks[(cursor + l + (event.getModifierState("Shift") ? -1 : 1)) % l];
1366
+ document.querySelector(`[${landmarkAttr}="${nextLandmark}"]`)?.focus();
1367
+ }
1368
+ propsOnKeyDown?.(event);
1369
+ }, [
1370
+ propsOnKeyDown
1371
+ ]);
1372
+ const focusableGroupAttrs = useFocusableGroup({
1373
+ tabBehavior: "limited",
1374
+ ignoreDefaultKeydown: {
1375
+ Tab: true
1376
+ }
1377
+ });
1378
+ return {
1379
+ [landmarkAttr]: landmark,
1380
+ tabIndex: 0,
1381
+ onKeyDown: handleKeyDown,
1382
+ ...focusableGroupAttrs
1383
+ };
1384
+ };
1385
+ var isFullscreen = () => {
1386
+ const isMobile = window.innerHeight <= 1e3;
1387
+ return window.visualViewport && isMobile ? window.visualViewport.height < 700 : false;
1388
+ };
1389
+ var useDynamicDrawer = (consumerName) => {
1390
+ const { drawerState, setDrawerState } = useSidebars(consumerName);
1391
+ const drawersStateRef = useDynamicRef(drawerState);
1392
+ const checkViewport = useCallback7(() => {
1393
+ if (window.visualViewport) {
1394
+ document.documentElement.style.setProperty("--visual-viewport-height", `${window.visualViewport.height}px`);
1395
+ }
1396
+ if (drawersStateRef.current !== "closed") {
1397
+ setDrawerState(isFullscreen() ? "full" : "expanded");
1398
+ }
1399
+ }, [
1400
+ setDrawerState
1401
+ ]);
1402
+ useViewportResize2(checkViewport, [], 100);
1403
+ useEffect3(() => addEventListener(window, "resize", checkViewport), [
1404
+ checkViewport
1405
+ ]);
1406
+ return drawerState;
1407
+ };
1408
+ var [MainProvider, useMainContext] = createContext6(MAIN_NAME, {
1409
+ resizing: false,
1410
+ navigationSidebarState: "closed",
1411
+ setNavigationSidebarState: (_nextState) => {
1412
+ log.warn("Not initialized", void 0, {
1413
+ F: __dxlog_file,
1414
+ L: 150,
1415
+ S: void 0,
1416
+ C: (f, a) => f(...a)
1417
+ });
1418
+ },
1419
+ complementarySidebarState: "closed",
1420
+ setComplementarySidebarState: (_nextState) => {
1421
+ log.warn("Not initialized", void 0, {
1422
+ F: __dxlog_file,
1423
+ L: 155,
1424
+ S: void 0,
1425
+ C: (f, a) => f(...a)
1426
+ });
1427
+ },
1428
+ drawerState: "closed",
1429
+ setDrawerState: (_nextState) => {
1430
+ log.warn("Not initialized", void 0, {
1431
+ F: __dxlog_file,
1432
+ L: 160,
1433
+ S: void 0,
1434
+ C: (f, a) => f(...a)
1435
+ });
1436
+ }
1437
+ });
1438
+ var useSidebars = (consumerName) => {
1439
+ const { navigationSidebarState, setNavigationSidebarState, complementarySidebarState, setComplementarySidebarState, drawerState, setDrawerState } = useMainContext(consumerName);
1440
+ return {
1441
+ navigationSidebarState,
1442
+ setNavigationSidebarState,
1443
+ toggleNavigationSidebar: useCallback7(() => setNavigationSidebarState(navigationSidebarState === "expanded" ? "closed" : "expanded"), [
1444
+ navigationSidebarState,
1445
+ setNavigationSidebarState
1446
+ ]),
1447
+ openNavigationSidebar: useCallback7(() => setNavigationSidebarState("expanded"), []),
1448
+ collapseNavigationSidebar: useCallback7(() => setNavigationSidebarState("collapsed"), []),
1449
+ closeNavigationSidebar: useCallback7(() => setNavigationSidebarState("closed"), []),
1450
+ complementarySidebarState,
1451
+ setComplementarySidebarState,
1452
+ toggleComplementarySidebar: useCallback7(() => setComplementarySidebarState(complementarySidebarState === "expanded" ? "closed" : "expanded"), [
1453
+ complementarySidebarState,
1454
+ setComplementarySidebarState
1455
+ ]),
1456
+ openComplementarySidebar: useCallback7(() => setComplementarySidebarState("expanded"), []),
1457
+ collapseComplementarySidebar: useCallback7(() => setComplementarySidebarState("collapsed"), []),
1458
+ closeComplementarySidebar: useCallback7(() => setComplementarySidebarState("closed"), []),
1459
+ drawerState,
1460
+ setDrawerState,
1461
+ toggleDrawer: useCallback7(() => setDrawerState(drawerState === "closed" ? isFullscreen() ? "full" : "expanded" : "closed"), [
1462
+ drawerState,
1463
+ setDrawerState
1464
+ ]),
1465
+ openDrawer: useCallback7(() => setDrawerState("expanded"), []),
1466
+ closeDrawer: useCallback7(() => setDrawerState("closed"), [])
1467
+ };
1468
+ };
1469
+ var MainRoot = ({ navigationSidebarState: propsNavigationSidebarState, defaultNavigationSidebarState = "closed", onNavigationSidebarStateChange, complementarySidebarState: propsComplementarySidebarState, defaultComplementarySidebarState = "closed", onComplementarySidebarStateChange, drawerState: propsDrawerState, defaultDrawerState = "closed", onDrawerStateChange, children, ...props }) => {
1470
+ const [isLg] = useMediaQuery("lg");
1471
+ const [navigationSidebarState = isLg ? "expanded" : "collapsed", setNavigationSidebarState] = useControllableState3({
1472
+ prop: propsNavigationSidebarState,
1473
+ defaultProp: defaultNavigationSidebarState,
1474
+ onChange: onNavigationSidebarStateChange
1475
+ });
1476
+ const [complementarySidebarState = isLg ? "expanded" : "collapsed", setComplementarySidebarState] = useControllableState3({
1477
+ prop: propsComplementarySidebarState,
1478
+ defaultProp: defaultComplementarySidebarState,
1479
+ onChange: onComplementarySidebarStateChange
1480
+ });
1481
+ const [drawerState = "closed", setDrawerState] = useControllableState3({
1482
+ prop: propsDrawerState,
1483
+ defaultProp: defaultDrawerState,
1484
+ onChange: onDrawerStateChange
1485
+ });
1486
+ const [resizing, setResizing] = useState5(false);
1487
+ const resizeInterval = useRef(null);
1488
+ useEffect3(() => addEventListener(window, "resize", () => {
1489
+ setResizing(true);
1490
+ if (resizeInterval.current) {
1491
+ clearTimeout(resizeInterval.current);
1492
+ }
1493
+ resizeInterval.current = setTimeout(() => {
1494
+ setResizing(false);
1495
+ resizeInterval.current = null;
1496
+ }, 3e3);
1497
+ }), []);
1498
+ return /* @__PURE__ */ React20.createElement(MainProvider, {
1499
+ ...props,
1500
+ navigationSidebarState,
1501
+ setNavigationSidebarState,
1502
+ complementarySidebarState,
1503
+ setComplementarySidebarState,
1504
+ drawerState,
1505
+ setDrawerState,
1506
+ resizing
1507
+ }, children);
1508
+ };
1509
+ MainRoot.displayName = MAIN_ROOT_NAME;
1510
+ var MainSidebar = /* @__PURE__ */ forwardRef16(({ classNames, children, swipeToDismiss, onOpenAutoFocus, state, resizing, onStateChange, side, label, ...props }, forwardedRef) => {
1511
+ const [isLg] = useMediaQuery("lg");
1512
+ const { tx } = useThemeContext();
1513
+ const { t } = useTranslation();
1514
+ const ref = useForwardedRef(forwardedRef);
1515
+ const noopRef = useRef(null);
1516
+ useSwipeToDismiss(swipeToDismiss ? ref : noopRef, {
1517
+ onDismiss: () => onStateChange?.("closed")
1518
+ });
1519
+ const handleKeyDown = useCallback7((event) => {
1520
+ const focusGroupParent = event.target.closest("[data-tabster]");
1521
+ if (event.key === "Escape" && focusGroupParent) {
1522
+ event.preventDefault();
1523
+ event.stopPropagation();
1524
+ focusGroupParent.focus();
1525
+ }
1526
+ props.onKeyDown?.(event);
1527
+ }, [
1528
+ props.onKeyDown
1529
+ ]);
1530
+ const Root6 = isLg ? Primitive7.div : DialogContent2;
1531
+ return /* @__PURE__ */ React20.createElement(DialogRoot2, {
1532
+ open: state !== "closed",
1533
+ "aria-label": toLocalizedString(label, t),
1534
+ modal: false
1535
+ }, !isLg && /* @__PURE__ */ React20.createElement(DialogTitle2, {
1536
+ className: "sr-only"
1537
+ }, toLocalizedString(label, t)), /* @__PURE__ */ React20.createElement(Root6, {
1538
+ ...!isLg && {
1539
+ forceMount: true,
1540
+ tabIndex: -1,
1541
+ onOpenAutoFocus: onOpenAutoFocus ?? handleOpenAutoFocus
1542
+ },
1543
+ ...state === "closed" && {
1544
+ inert: true
1545
+ },
1546
+ ...props,
1547
+ "data-side": side === "inline-end" ? "ie" : "is",
1548
+ "data-state": state,
1549
+ "data-resizing": resizing ? "true" : "false",
1550
+ className: tx("main.sidebar", "main__sidebar", {}, classNames),
1551
+ onKeyDownCapture: handleKeyDown,
1552
+ ref
1553
+ }, children));
1554
+ });
1555
+ var MainNavigationSidebar = /* @__PURE__ */ forwardRef16((props, forwardedRef) => {
1556
+ const { navigationSidebarState, setNavigationSidebarState, resizing } = useMainContext(NAVIGATION_SIDEBAR_NAME);
1557
+ const mover = useLandmarkMover(props.onKeyDown, "0");
1558
+ return /* @__PURE__ */ React20.createElement(MainSidebar, {
1559
+ ...mover,
1560
+ ...props,
1561
+ state: navigationSidebarState,
1562
+ onStateChange: setNavigationSidebarState,
1563
+ resizing,
1564
+ side: "inline-start",
1565
+ ref: forwardedRef
1566
+ });
1567
+ });
1568
+ MainNavigationSidebar.displayName = NAVIGATION_SIDEBAR_NAME;
1569
+ var MainComplementarySidebar = /* @__PURE__ */ forwardRef16((props, forwardedRef) => {
1570
+ const { complementarySidebarState, setComplementarySidebarState, resizing } = useMainContext(COMPLEMENTARY_SIDEBAR_NAME);
1571
+ const mover = useLandmarkMover(props.onKeyDown, "2");
1572
+ return /* @__PURE__ */ React20.createElement(MainSidebar, {
1573
+ ...mover,
1574
+ ...props,
1575
+ state: complementarySidebarState,
1576
+ onStateChange: setComplementarySidebarState,
1577
+ resizing,
1578
+ side: "inline-end",
1579
+ ref: forwardedRef
1580
+ });
1581
+ });
1582
+ MainComplementarySidebar.displayName = COMPLEMENTARY_SIDEBAR_NAME;
1583
+ var MainDrawer = /* @__PURE__ */ forwardRef16(({ classNames, children, swipeToDismiss, onOpenAutoFocus, state, resizing, onStateChange, label, ...props }, forwardedRef) => {
1584
+ const [isLg] = useMediaQuery("lg");
1585
+ const { tx } = useThemeContext();
1586
+ const { t } = useTranslation();
1587
+ const ref = useForwardedRef(forwardedRef);
1588
+ const noopRef = useRef(null);
1589
+ useSwipeToDismiss(swipeToDismiss ? ref : noopRef, {
1590
+ onDismiss: () => onStateChange?.("closed")
1591
+ });
1592
+ const handleKeyDown = useCallback7((event) => {
1593
+ const focusGroupParent = event.target.closest("[data-tabster]");
1594
+ if (event.key === "Escape" && focusGroupParent) {
1595
+ event.preventDefault();
1596
+ event.stopPropagation();
1597
+ focusGroupParent.focus();
1598
+ }
1599
+ props.onKeyDown?.(event);
1600
+ }, [
1601
+ props.onKeyDown
1602
+ ]);
1603
+ return /* @__PURE__ */ React20.createElement(Primitive7.div, {
1604
+ ...state === "closed" && {
1605
+ inert: true
1606
+ },
1607
+ ...!isLg && {
1608
+ forceMount: true,
1609
+ tabIndex: -1,
1610
+ onOpenAutoFocus: onOpenAutoFocus ?? handleOpenAutoFocus
1611
+ },
1612
+ ...props,
1613
+ role: "region",
1614
+ "aria-label": toLocalizedString(label, t),
1615
+ "data-state": state,
1616
+ "data-resizing": resizing ? "true" : "false",
1617
+ className: tx("main.drawer", "main__drawer", {}, classNames),
1618
+ onKeyDownCapture: handleKeyDown,
1619
+ ref
1620
+ }, children);
1621
+ });
1622
+ var MainDrawerRoot = /* @__PURE__ */ forwardRef16((props, forwardedRef) => {
1623
+ const { drawerState, setDrawerState, resizing } = useMainContext(DRAWER_NAME);
1624
+ const mover = useLandmarkMover(props.onKeyDown, "3");
1625
+ return /* @__PURE__ */ React20.createElement(MainDrawer, {
1626
+ ...mover,
1627
+ ...props,
1628
+ resizing,
1629
+ state: drawerState,
1630
+ onStateChange: setDrawerState,
1631
+ ref: forwardedRef
1632
+ });
1633
+ });
1634
+ MainDrawerRoot.displayName = DRAWER_NAME;
1635
+ var MainContent = /* @__PURE__ */ forwardRef16(({ asChild, classNames, bounce, handlesFocus, children, role, ...props }, forwardedRef) => {
1636
+ const { navigationSidebarState, complementarySidebarState, drawerState } = useMainContext(MAIN_NAME);
1637
+ const { tx } = useThemeContext();
1638
+ const Root6 = asChild ? Slot8 : role ? "div" : "main";
1639
+ const mover = useLandmarkMover(props.onKeyDown, "1");
1640
+ return /* @__PURE__ */ React20.createElement(Root6, {
1641
+ role,
1642
+ ...handlesFocus && {
1643
+ ...mover
1644
+ },
1645
+ ...props,
1646
+ "data-sidebar-inline-start-state": navigationSidebarState,
1647
+ "data-sidebar-inline-end-state": complementarySidebarState,
1648
+ "data-drawer-state": drawerState,
1649
+ "data-handles-focus": handlesFocus,
1650
+ className: tx("main.content", "main", {
1651
+ bounce,
1652
+ handlesFocus
1653
+ }, classNames),
1654
+ ref: forwardedRef
1655
+ }, children);
1656
+ });
1657
+ MainContent.displayName = MAIN_NAME;
1658
+ var MainOverlay = /* @__PURE__ */ forwardRef16(({ classNames, ...props }, forwardedRef) => {
1659
+ const [isLg] = useMediaQuery("lg");
1660
+ const { navigationSidebarState, setNavigationSidebarState, complementarySidebarState, setComplementarySidebarState } = useMainContext(MAIN_NAME);
1661
+ const { tx } = useThemeContext();
1662
+ return /* @__PURE__ */ React20.createElement("div", {
1663
+ ...props,
1664
+ onClick: () => {
1665
+ setNavigationSidebarState("collapsed");
1666
+ setComplementarySidebarState("collapsed");
1667
+ },
1668
+ className: tx("main.overlay", "main__overlay", {
1669
+ isLg,
1670
+ inlineStartSidebarOpen: navigationSidebarState,
1671
+ inlineEndSidebarOpen: complementarySidebarState
1672
+ }, classNames),
1673
+ "data-state": navigationSidebarState === "expanded" || complementarySidebarState === "expanded" ? "open" : "closed",
1674
+ "aria-hidden": "true",
1675
+ ref: forwardedRef
1676
+ });
1677
+ });
1678
+ var Main = {
1679
+ Root: MainRoot,
1680
+ Content: MainContent,
1681
+ Overlay: MainOverlay,
1682
+ NavigationSidebar: MainNavigationSidebar,
1683
+ ComplementarySidebar: MainComplementarySidebar,
1684
+ Drawer: MainDrawerRoot
1685
+ };
1686
+
1687
+ // src/components/Menu/ContextMenu.tsx
1688
+ import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
1689
+ import { Primitive as Primitive8 } from "@radix-ui/react-primitive";
1690
+ import { Slot as Slot9 } from "@radix-ui/react-slot";
1691
+ import React21, { forwardRef as forwardRef17 } from "react";
1692
+
1693
+ // src/hooks/useSafeCollisionPadding.ts
1694
+ import { useMemo as useMemo2 } from "react";
1695
+ var propIsNumber = (prop) => Number.isFinite(prop);
1696
+ var propsIsRecord = (prop) => !!(prop && typeof prop === "object");
1697
+ var safePadding = (propsPadding, safePadding2, side) => {
1698
+ return (propIsNumber(safePadding2[side]) ? safePadding2[side] : 0) + (propIsNumber(propsPadding) ? propsPadding : propsIsRecord(propsPadding) ? propsPadding[side] ?? 0 : 0);
1699
+ };
1700
+ var useSafeCollisionPadding = (collisionPadding) => {
1701
+ const { safeAreaPadding } = useThemeContext();
1702
+ return useMemo2(() => ({
1703
+ top: safePadding(collisionPadding, safeAreaPadding, "top"),
1704
+ right: safePadding(collisionPadding, safeAreaPadding, "right"),
1705
+ bottom: safePadding(collisionPadding, safeAreaPadding, "bottom"),
1706
+ left: safePadding(collisionPadding, safeAreaPadding, "left")
1707
+ }), [
1708
+ collisionPadding,
1709
+ safeAreaPadding
1710
+ ]);
1711
+ };
1712
+
1713
+ // src/components/Menu/ContextMenu.tsx
1714
+ var ContextMenuRoot = ContextMenuPrimitive.ContextMenu;
1715
+ var ContextMenuTrigger = ContextMenuPrimitive.Trigger;
1716
+ var ContextMenuPortal = ContextMenuPrimitive.Portal;
1717
+ var ContextMenuContent = /* @__PURE__ */ forwardRef17(({ classNames, children, collisionPadding = 8, ...props }, forwardedRef) => {
1718
+ const { tx } = useThemeContext();
1719
+ const elevation = useElevationContext();
1720
+ const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
1721
+ return /* @__PURE__ */ React21.createElement(ContextMenuPrimitive.Content, {
1722
+ ...props,
1723
+ "data-arrow-keys": "up down",
1724
+ collisionPadding: safeCollisionPadding,
1725
+ className: tx("menu.content", "menu", {
1726
+ elevation
1727
+ }, classNames),
1728
+ ref: forwardedRef
1729
+ }, children);
1730
+ });
1731
+ var ContextMenuViewport = /* @__PURE__ */ forwardRef17(({ classNames, asChild, children, ...props }, forwardedRef) => {
1732
+ const { tx } = useThemeContext();
1733
+ const Root6 = asChild ? Slot9 : Primitive8.div;
1734
+ return /* @__PURE__ */ React21.createElement(Root6, {
1735
+ ...props,
1736
+ className: tx("menu.viewport", "menu__viewport", {}, classNames),
1737
+ ref: forwardedRef
1738
+ }, children);
1739
+ });
1740
+ var ContextMenuArrow = /* @__PURE__ */ forwardRef17(({ classNames, ...props }, forwardedRef) => {
1741
+ const { tx } = useThemeContext();
1742
+ return /* @__PURE__ */ React21.createElement(ContextMenuPrimitive.Arrow, {
1743
+ ...props,
1744
+ className: tx("menu.arrow", "menu__arrow", {}, classNames),
1745
+ ref: forwardedRef
1746
+ });
1747
+ });
1748
+ var ContextMenuGroup = ContextMenuPrimitive.Group;
1749
+ var ContextMenuItemIndicator = ContextMenuPrimitive.ItemIndicator;
1750
+ var ContextMenuItem = /* @__PURE__ */ forwardRef17(({ classNames, ...props }, forwardedRef) => {
1751
+ const { tx } = useThemeContext();
1752
+ return /* @__PURE__ */ React21.createElement(ContextMenuPrimitive.Item, {
1753
+ ...props,
1754
+ className: tx("menu.item", "menu__item", {}, classNames),
1755
+ ref: forwardedRef
1756
+ });
1757
+ });
1758
+ var ContextMenuCheckboxItem = /* @__PURE__ */ forwardRef17(({ classNames, ...props }, forwardedRef) => {
1759
+ const { tx } = useThemeContext();
1760
+ return /* @__PURE__ */ React21.createElement(ContextMenuPrimitive.CheckboxItem, {
1761
+ ...props,
1762
+ className: tx("menu.item", "menu__item--checkbox", {}, classNames),
1763
+ ref: forwardedRef
1764
+ });
1765
+ });
1766
+ var ContextMenuSeparator = /* @__PURE__ */ forwardRef17(({ classNames, ...props }, forwardedRef) => {
1767
+ const { tx } = useThemeContext();
1768
+ return /* @__PURE__ */ React21.createElement(ContextMenuPrimitive.Separator, {
1769
+ ...props,
1770
+ className: tx("menu.separator", "menu__item", {}, classNames),
1771
+ ref: forwardedRef
1772
+ });
1773
+ });
1774
+ var ContextMenuGroupLabel = /* @__PURE__ */ forwardRef17(({ classNames, ...props }, forwardedRef) => {
1775
+ const { tx } = useThemeContext();
1776
+ return /* @__PURE__ */ React21.createElement(ContextMenuPrimitive.Label, {
1777
+ ...props,
1778
+ className: tx("menu.groupLabel", "menu__group__label", {}, classNames),
1779
+ ref: forwardedRef
1780
+ });
1781
+ });
1782
+ var ContextMenu2 = {
1783
+ Root: ContextMenuRoot,
1784
+ Trigger: ContextMenuTrigger,
1785
+ Portal: ContextMenuPortal,
1786
+ Content: ContextMenuContent,
1787
+ Viewport: ContextMenuViewport,
1788
+ Arrow: ContextMenuArrow,
1789
+ Group: ContextMenuGroup,
1790
+ Item: ContextMenuItem,
1791
+ CheckboxItem: ContextMenuCheckboxItem,
1792
+ ItemIndicator: ContextMenuItemIndicator,
1793
+ Separator: ContextMenuSeparator,
1794
+ GroupLabel: ContextMenuGroupLabel
1795
+ };
1796
+
1797
+ // src/components/Menu/DropdownMenu.tsx
1798
+ import { composeEventHandlers } from "@radix-ui/primitive";
1799
+ import { composeRefs } from "@radix-ui/react-compose-refs";
1800
+ import { createContextScope as createContextScope2 } from "@radix-ui/react-context";
1801
+ import { useId as useId2 } from "@radix-ui/react-id";
1802
+ import * as MenuPrimitive from "@radix-ui/react-menu";
1803
+ import { createMenuScope } from "@radix-ui/react-menu";
1804
+ import { Primitive as Primitive9 } from "@radix-ui/react-primitive";
1805
+ import { Slot as Slot10 } from "@radix-ui/react-slot";
1806
+ import { useControllableState as useControllableState4 } from "@radix-ui/react-use-controllable-state";
1807
+ import React22, { forwardRef as forwardRef18, useCallback as useCallback8, useEffect as useEffect4, useMemo as useMemo3, useRef as useRef2 } from "react";
1808
+ var DROPDOWN_MENU_NAME = "DropdownMenu";
1809
+ var [createDropdownMenuContext, createDropdownMenuScope] = createContextScope2(DROPDOWN_MENU_NAME, [
1810
+ createMenuScope
1811
+ ]);
1812
+ var useMenuScope = createMenuScope();
1813
+ var [DropdownMenuProvider, useDropdownMenuContext] = createDropdownMenuContext(DROPDOWN_MENU_NAME);
1814
+ var DropdownMenuRoot = (props) => {
1815
+ const { __scopeDropdownMenu, children, dir, open: openProp, defaultOpen, onOpenChange, modal = true } = props;
1816
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1817
+ const triggerRef = useRef2(null);
1818
+ const [open = false, setOpen] = useControllableState4({
1819
+ prop: openProp,
1820
+ defaultProp: defaultOpen,
1821
+ onChange: onOpenChange
1822
+ });
1823
+ return /* @__PURE__ */ React22.createElement(DropdownMenuProvider, {
1824
+ scope: __scopeDropdownMenu,
1825
+ triggerId: useId2(),
1826
+ triggerRef,
1827
+ contentId: useId2(),
1828
+ open,
1829
+ onOpenChange: setOpen,
1830
+ onOpenToggle: useCallback8(() => setOpen((prevOpen) => !prevOpen), [
1831
+ setOpen
1832
+ ]),
1833
+ modal
1834
+ }, /* @__PURE__ */ React22.createElement(MenuPrimitive.Root, {
1835
+ ...menuScope,
1836
+ open,
1837
+ onOpenChange: setOpen,
1838
+ dir,
1839
+ modal
1840
+ }, children));
1841
+ };
1842
+ DropdownMenuRoot.displayName = DROPDOWN_MENU_NAME;
1843
+ var TRIGGER_NAME = "DropdownMenuTrigger";
1844
+ var DropdownMenuTrigger = /* @__PURE__ */ forwardRef18((props, forwardedRef) => {
1845
+ const { __scopeDropdownMenu, disabled = false, ...triggerProps } = props;
1846
+ const context = useDropdownMenuContext(TRIGGER_NAME, __scopeDropdownMenu);
1847
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1848
+ return /* @__PURE__ */ React22.createElement(MenuPrimitive.Anchor, {
1849
+ asChild: true,
1850
+ ...menuScope
1851
+ }, /* @__PURE__ */ React22.createElement(Primitive9.button, {
1852
+ type: "button",
1853
+ id: context.triggerId,
1854
+ "aria-haspopup": "menu",
1855
+ "aria-expanded": context.open,
1856
+ "aria-controls": context.open ? context.contentId : void 0,
1857
+ "data-state": context.open ? "open" : "closed",
1858
+ "data-disabled": disabled ? "" : void 0,
1859
+ disabled,
1860
+ ...triggerProps,
1861
+ ref: composeRefs(forwardedRef, context.triggerRef),
1862
+ "data-arrow-keys": "down",
1863
+ onPointerDown: composeEventHandlers(props.onPointerDown, (event) => {
1864
+ if (!disabled && event.button === 0 && event.ctrlKey === false) {
1865
+ context.onOpenToggle();
1866
+ if (!context.open) {
1867
+ event.preventDefault();
1868
+ }
1869
+ }
1870
+ }),
1871
+ onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
1872
+ if (disabled) {
1873
+ return;
1874
+ }
1875
+ if ([
1876
+ "Enter",
1877
+ " "
1878
+ ].includes(event.key)) {
1879
+ context.onOpenToggle();
1880
+ }
1881
+ if (event.key === "ArrowDown") {
1882
+ context.onOpenChange(true);
1883
+ }
1884
+ if ([
1885
+ "Enter",
1886
+ " ",
1887
+ "ArrowDown"
1888
+ ].includes(event.key)) {
1889
+ event.preventDefault();
1890
+ }
1891
+ })
1892
+ }));
1893
+ });
1894
+ DropdownMenuTrigger.displayName = TRIGGER_NAME;
1895
+ var VIRTUAL_TRIGGER_NAME = "DropdownMenuVirtualTrigger";
1896
+ var DropdownMenuVirtualTrigger = (props) => {
1897
+ const { __scopeDropdownMenu, virtualRef } = props;
1898
+ const context = useDropdownMenuContext(VIRTUAL_TRIGGER_NAME, __scopeDropdownMenu);
1899
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1900
+ useEffect4(() => {
1901
+ if (virtualRef.current) {
1902
+ context.triggerRef.current = virtualRef.current;
1903
+ }
1904
+ });
1905
+ return /* @__PURE__ */ React22.createElement(MenuPrimitive.Anchor, {
1906
+ ...menuScope,
1907
+ virtualRef
1908
+ });
1909
+ };
1910
+ DropdownMenuVirtualTrigger.displayName = VIRTUAL_TRIGGER_NAME;
1911
+ var PORTAL_NAME = "DropdownMenuPortal";
1912
+ var DropdownMenuPortal = (props) => {
1913
+ const { __scopeDropdownMenu, ...portalProps } = props;
1914
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1915
+ return /* @__PURE__ */ React22.createElement(MenuPrimitive.Portal, {
1916
+ ...menuScope,
1917
+ ...portalProps
1918
+ });
1919
+ };
1920
+ DropdownMenuPortal.displayName = PORTAL_NAME;
1921
+ var DropdownMenuViewport = /* @__PURE__ */ forwardRef18(({ classNames, asChild, children, ...props }, forwardedRef) => {
1922
+ const { tx } = useThemeContext();
1923
+ const Root6 = asChild ? Slot10 : Primitive9.div;
1924
+ return /* @__PURE__ */ React22.createElement(Root6, {
1925
+ ...props,
1926
+ className: tx("menu.viewport", "menu__viewport", {}, classNames),
1927
+ ref: forwardedRef
1928
+ }, children);
1929
+ });
1930
+ var CONTENT_NAME = "DropdownMenuContent";
1931
+ var DropdownMenuContent = /* @__PURE__ */ forwardRef18((props, forwardedRef) => {
1932
+ const { __scopeDropdownMenu, classNames, collisionPadding = 8, collisionBoundary, ...contentProps } = props;
1933
+ const { tx } = useThemeContext();
1934
+ const context = useDropdownMenuContext(CONTENT_NAME, __scopeDropdownMenu);
1935
+ const elevation = useElevationContext();
1936
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1937
+ const hasInteractedOutsideRef = useRef2(false);
1938
+ const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
1939
+ const computedCollisionBoundary = useMemo3(() => {
1940
+ const closestBoundary = context.triggerRef.current?.closest("[data-popover-collision-boundary]");
1941
+ return closestBoundary ? Array.isArray(collisionBoundary) ? [
1942
+ closestBoundary,
1943
+ ...collisionBoundary
1944
+ ] : collisionBoundary ? [
1945
+ closestBoundary,
1946
+ collisionBoundary
1947
+ ] : [
1948
+ closestBoundary
1949
+ ] : collisionBoundary;
1950
+ }, [
1951
+ context.open,
1952
+ collisionBoundary,
1953
+ context.triggerRef.current
1954
+ ]);
1955
+ return /* @__PURE__ */ React22.createElement(MenuPrimitive.Content, {
1956
+ id: context.contentId,
1957
+ "aria-labelledby": context.triggerId,
1958
+ ...menuScope,
1959
+ ...contentProps,
1960
+ collisionBoundary: computedCollisionBoundary,
1961
+ collisionPadding: safeCollisionPadding,
1962
+ ref: forwardedRef,
1963
+ onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
1964
+ if (!hasInteractedOutsideRef.current) {
1965
+ context.triggerRef.current?.focus();
1966
+ }
1967
+ hasInteractedOutsideRef.current = false;
1968
+ event.preventDefault();
1969
+ }),
1970
+ onInteractOutside: composeEventHandlers(props.onInteractOutside, (event) => {
1971
+ const originalEvent = event.detail.originalEvent;
1972
+ const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
1973
+ const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
1974
+ if (!context.modal || isRightClick) {
1975
+ hasInteractedOutsideRef.current = true;
1976
+ }
1977
+ }),
1978
+ "data-arrow-keys": "up down",
1979
+ className: tx("menu.content", "menu", {
1980
+ elevation
1981
+ }, classNames),
1982
+ style: {
1983
+ ...props.style,
1984
+ // re-namespace exposed content custom properties
1985
+ ...{
1986
+ "--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
1987
+ "--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
1988
+ "--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
1989
+ "--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
1990
+ "--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
1991
+ }
1992
+ }
1993
+ });
1994
+ });
1995
+ DropdownMenuContent.displayName = CONTENT_NAME;
1996
+ var GROUP_NAME = "DropdownMenuGroup";
1997
+ var DropdownMenuGroup = /* @__PURE__ */ forwardRef18((props, forwardedRef) => {
1998
+ const { __scopeDropdownMenu, ...groupProps } = props;
1999
+ const menuScope = useMenuScope(__scopeDropdownMenu);
2000
+ return /* @__PURE__ */ React22.createElement(MenuPrimitive.Group, {
2001
+ ...menuScope,
2002
+ ...groupProps,
2003
+ ref: forwardedRef
2004
+ });
2005
+ });
2006
+ DropdownMenuGroup.displayName = GROUP_NAME;
2007
+ var LABEL_NAME = "DropdownMenuLabel";
2008
+ var DropdownMenuGroupLabel = /* @__PURE__ */ forwardRef18((props, forwardedRef) => {
2009
+ const { __scopeDropdownMenu, classNames, ...labelProps } = props;
2010
+ const menuScope = useMenuScope(__scopeDropdownMenu);
2011
+ const { tx } = useThemeContext();
2012
+ return /* @__PURE__ */ React22.createElement(MenuPrimitive.Label, {
2013
+ ...menuScope,
2014
+ ...labelProps,
2015
+ className: tx("menu.groupLabel", "menu__group__label", {}, classNames),
2016
+ ref: forwardedRef
2017
+ });
2018
+ });
2019
+ DropdownMenuGroupLabel.displayName = LABEL_NAME;
2020
+ var ITEM_NAME = "DropdownMenuItem";
2021
+ var DropdownMenuItem = /* @__PURE__ */ forwardRef18((props, forwardedRef) => {
2022
+ const { __scopeDropdownMenu, classNames, ...itemProps } = props;
2023
+ const menuScope = useMenuScope(__scopeDropdownMenu);
2024
+ const { tx } = useThemeContext();
2025
+ return /* @__PURE__ */ React22.createElement(MenuPrimitive.Item, {
2026
+ ...menuScope,
2027
+ ...itemProps,
2028
+ className: tx("menu.item", "menu__item", {}, classNames),
2029
+ ref: forwardedRef
2030
+ });
2031
+ });
2032
+ DropdownMenuItem.displayName = ITEM_NAME;
2033
+ var CHECKBOX_ITEM_NAME = "DropdownMenuCheckboxItem";
2034
+ var DropdownMenuCheckboxItem = /* @__PURE__ */ forwardRef18((props, forwardedRef) => {
2035
+ const { __scopeDropdownMenu, classNames, ...checkboxItemProps } = props;
2036
+ const menuScope = useMenuScope(__scopeDropdownMenu);
2037
+ const { tx } = useThemeContext();
2038
+ return /* @__PURE__ */ React22.createElement(MenuPrimitive.CheckboxItem, {
2039
+ ...menuScope,
2040
+ ...checkboxItemProps,
2041
+ className: tx("menu.item", "menu__item--checkbox", {}, classNames),
2042
+ ref: forwardedRef
2043
+ });
2044
+ });
2045
+ DropdownMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;
2046
+ var RADIO_GROUP_NAME = "DropdownMenuRadioGroup";
2047
+ var DropdownMenuRadioGroup = /* @__PURE__ */ forwardRef18((props, forwardedRef) => {
2048
+ const { __scopeDropdownMenu, ...radioGroupProps } = props;
2049
+ const menuScope = useMenuScope(__scopeDropdownMenu);
2050
+ return /* @__PURE__ */ React22.createElement(MenuPrimitive.RadioGroup, {
2051
+ ...menuScope,
2052
+ ...radioGroupProps,
2053
+ ref: forwardedRef
2054
+ });
2055
+ });
2056
+ DropdownMenuRadioGroup.displayName = RADIO_GROUP_NAME;
2057
+ var RADIO_ITEM_NAME = "DropdownMenuRadioItem";
2058
+ var DropdownMenuRadioItem = /* @__PURE__ */ forwardRef18((props, forwardedRef) => {
2059
+ const { __scopeDropdownMenu, classNames, ...itemProps } = props;
2060
+ const menuScope = useMenuScope(__scopeDropdownMenu);
2061
+ const { tx } = useThemeContext();
2062
+ return /* @__PURE__ */ React22.createElement(MenuPrimitive.Item, {
2063
+ ...menuScope,
2064
+ ...itemProps,
2065
+ className: tx("menu.item", "menu__item", {}, classNames),
2066
+ ref: forwardedRef
2067
+ });
2068
+ });
2069
+ DropdownMenuRadioItem.displayName = RADIO_ITEM_NAME;
2070
+ var INDICATOR_NAME = "DropdownMenuItemIndicator";
2071
+ var DropdownMenuItemIndicator = /* @__PURE__ */ forwardRef18((props, forwardedRef) => {
2072
+ const { __scopeDropdownMenu, ...itemIndicatorProps } = props;
2073
+ const menuScope = useMenuScope(__scopeDropdownMenu);
2074
+ return /* @__PURE__ */ React22.createElement(MenuPrimitive.ItemIndicator, {
2075
+ ...menuScope,
2076
+ ...itemIndicatorProps,
2077
+ ref: forwardedRef
2078
+ });
2079
+ });
2080
+ DropdownMenuItemIndicator.displayName = INDICATOR_NAME;
2081
+ var SEPARATOR_NAME = "DropdownMenuSeparator";
2082
+ var DropdownMenuSeparator = /* @__PURE__ */ forwardRef18((props, forwardedRef) => {
2083
+ const { __scopeDropdownMenu, classNames, ...separatorProps } = props;
2084
+ const menuScope = useMenuScope(__scopeDropdownMenu);
2085
+ const { tx } = useThemeContext();
2086
+ return /* @__PURE__ */ React22.createElement(MenuPrimitive.Separator, {
2087
+ ...menuScope,
2088
+ ...separatorProps,
2089
+ className: tx("menu.separator", "menu__item", {}, classNames),
2090
+ ref: forwardedRef
2091
+ });
2092
+ });
2093
+ DropdownMenuSeparator.displayName = SEPARATOR_NAME;
2094
+ var ARROW_NAME = "DropdownMenuArrow";
2095
+ var DropdownMenuArrow = /* @__PURE__ */ forwardRef18((props, forwardedRef) => {
2096
+ const { __scopeDropdownMenu, classNames, ...arrowProps } = props;
2097
+ const menuScope = useMenuScope(__scopeDropdownMenu);
2098
+ const { tx } = useThemeContext();
2099
+ return /* @__PURE__ */ React22.createElement(MenuPrimitive.Arrow, {
2100
+ ...menuScope,
2101
+ ...arrowProps,
2102
+ className: tx("menu.arrow", "menu__arrow", {}, classNames),
2103
+ ref: forwardedRef
2104
+ });
2105
+ });
2106
+ DropdownMenuArrow.displayName = ARROW_NAME;
2107
+ var DropdownMenuSub = (props) => {
2108
+ const { __scopeDropdownMenu, children, open: openProp, onOpenChange, defaultOpen } = props;
2109
+ const menuScope = useMenuScope(__scopeDropdownMenu);
2110
+ const [open = false, setOpen] = useControllableState4({
2111
+ prop: openProp,
2112
+ defaultProp: defaultOpen,
2113
+ onChange: onOpenChange
2114
+ });
2115
+ return /* @__PURE__ */ React22.createElement(MenuPrimitive.Sub, {
2116
+ ...menuScope,
2117
+ open,
2118
+ onOpenChange: setOpen
2119
+ }, children);
2120
+ };
2121
+ var SUB_TRIGGER_NAME = "DropdownMenuSubTrigger";
2122
+ var DropdownMenuSubTrigger = /* @__PURE__ */ forwardRef18((props, forwardedRef) => {
2123
+ const { __scopeDropdownMenu, ...subTriggerProps } = props;
2124
+ const menuScope = useMenuScope(__scopeDropdownMenu);
2125
+ return /* @__PURE__ */ React22.createElement(MenuPrimitive.SubTrigger, {
2126
+ ...menuScope,
2127
+ ...subTriggerProps,
2128
+ ref: forwardedRef
2129
+ });
2130
+ });
2131
+ DropdownMenuSubTrigger.displayName = SUB_TRIGGER_NAME;
2132
+ var SUB_CONTENT_NAME = "DropdownMenuSubContent";
2133
+ var DropdownMenuSubContent = /* @__PURE__ */ forwardRef18((props, forwardedRef) => {
2134
+ const { __scopeDropdownMenu, ...subContentProps } = props;
2135
+ const menuScope = useMenuScope(__scopeDropdownMenu);
2136
+ return /* @__PURE__ */ React22.createElement(MenuPrimitive.SubContent, {
2137
+ ...menuScope,
2138
+ ...subContentProps,
2139
+ ref: forwardedRef,
2140
+ style: {
2141
+ ...props.style,
2142
+ // re-namespace exposed content custom properties
2143
+ ...{
2144
+ "--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
2145
+ "--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
2146
+ "--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
2147
+ "--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
2148
+ "--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
2149
+ }
2150
+ }
2151
+ });
2152
+ });
2153
+ DropdownMenuSubContent.displayName = SUB_CONTENT_NAME;
2154
+ var DropdownMenu = {
2155
+ Root: DropdownMenuRoot,
2156
+ Trigger: DropdownMenuTrigger,
2157
+ VirtualTrigger: DropdownMenuVirtualTrigger,
2158
+ Portal: DropdownMenuPortal,
2159
+ Content: DropdownMenuContent,
2160
+ Viewport: DropdownMenuViewport,
2161
+ Group: DropdownMenuGroup,
2162
+ GroupLabel: DropdownMenuGroupLabel,
2163
+ Item: DropdownMenuItem,
2164
+ CheckboxItem: DropdownMenuCheckboxItem,
2165
+ RadioGroup: DropdownMenuRadioGroup,
2166
+ RadioItem: DropdownMenuRadioItem,
2167
+ ItemIndicator: DropdownMenuItemIndicator,
2168
+ Separator: DropdownMenuSeparator,
2169
+ Arrow: DropdownMenuArrow,
2170
+ Sub: DropdownMenuSub,
2171
+ SubTrigger: DropdownMenuSubTrigger,
2172
+ SubContent: DropdownMenuSubContent
2173
+ };
2174
+ var useDropdownMenuMenuScope = useMenuScope;
2175
+
2176
+ // src/components/Message/Message.tsx
2177
+ import { createContext as createContext7 } from "@radix-ui/react-context";
2178
+ import { Primitive as Primitive10 } from "@radix-ui/react-primitive";
2179
+ import { Slot as Slot11 } from "@radix-ui/react-slot";
2180
+ import React23, { forwardRef as forwardRef19 } from "react";
2181
+ import { useId as useId3 } from "@dxos/react-hooks";
2182
+ var messageIcons = {
2183
+ success: "ph--check-circle--duotone",
2184
+ info: "ph--info--duotone",
2185
+ warning: "ph--warning--duotone",
2186
+ error: "ph--warning-circle--duotone",
2187
+ neutral: "ph--info--duotone"
2188
+ };
2189
+ var MESSAGE_NAME = "Message";
2190
+ var [MessageProvider, useMessageContext] = createContext7(MESSAGE_NAME);
2191
+ var MessageRoot = /* @__PURE__ */ forwardRef19(({ asChild, valence = "neutral", elevation: propsElevation, classNames, titleId: propsTitleId, descriptionId: propsDescriptionId, children, ...props }, forwardedRef) => {
2192
+ const { tx } = useThemeContext();
2193
+ const titleId = useId3("message__title", propsTitleId);
2194
+ const descriptionId = useId3("message__description", propsDescriptionId);
2195
+ const elevation = useElevationContext(propsElevation);
2196
+ const Root6 = asChild ? Slot11 : Primitive10.div;
2197
+ return /* @__PURE__ */ React23.createElement(MessageProvider, {
2198
+ titleId,
2199
+ descriptionId,
2200
+ valence
2201
+ }, /* @__PURE__ */ React23.createElement(Root6, {
2202
+ role: valence === "neutral" ? "paragraph" : "alert",
2203
+ ...props,
2204
+ className: tx("message.root", "message", {
2205
+ valence,
2206
+ elevation
2207
+ }, classNames),
2208
+ "aria-labelledby": titleId,
2209
+ "aria-describedby": descriptionId,
2210
+ ref: forwardedRef
2211
+ }, children));
2212
+ });
2213
+ MessageRoot.displayName = MESSAGE_NAME;
2214
+ var MESSAGE_TITLE_NAME = "MessageTitle";
2215
+ var MessageTitle = /* @__PURE__ */ forwardRef19(({ asChild, classNames, children, icon, ...props }, forwardedRef) => {
2216
+ const { tx } = useThemeContext();
2217
+ const { titleId, valence } = useMessageContext(MESSAGE_TITLE_NAME);
2218
+ const Root6 = asChild ? Slot11 : Primitive10.h2;
2219
+ return /* @__PURE__ */ React23.createElement(Root6, {
2220
+ ...props,
2221
+ className: tx("message.title", "message__title", {}, classNames),
2222
+ id: titleId,
2223
+ ref: forwardedRef
2224
+ }, !icon && valence === "neutral" ? null : /* @__PURE__ */ React23.createElement(Icon, {
2225
+ size: 5,
2226
+ icon: icon ?? messageIcons[valence],
2227
+ classNames: tx("message.icon", "message__icon", {
2228
+ valence
2229
+ })
2230
+ }), /* @__PURE__ */ React23.createElement("span", null, children));
2231
+ });
2232
+ MessageTitle.displayName = MESSAGE_TITLE_NAME;
2233
+ var MESSAGE_CONTENT_NAME = "MessageContent";
2234
+ var MessageContent = /* @__PURE__ */ forwardRef19(({ asChild, classNames, children, ...props }, forwardedRef) => {
2235
+ const { tx } = useThemeContext();
2236
+ const { descriptionId } = useMessageContext(MESSAGE_CONTENT_NAME);
2237
+ const Root6 = asChild ? Slot11 : Primitive10.p;
2238
+ return /* @__PURE__ */ React23.createElement(Root6, {
2239
+ ...props,
2240
+ className: tx("message.content", "message__content", {}, classNames),
2241
+ id: descriptionId,
2242
+ ref: forwardedRef
2243
+ }, children);
2244
+ });
2245
+ MessageContent.displayName = MESSAGE_CONTENT_NAME;
2246
+ var Message = {
2247
+ Root: MessageRoot,
2248
+ Title: MessageTitle,
2249
+ Content: MessageContent
2250
+ };
2251
+ var Callout = Message;
2252
+
2253
+ // src/components/Popover/Popover.tsx
2254
+ import { composeEventHandlers as composeEventHandlers2 } from "@radix-ui/primitive";
2255
+ import { useComposedRefs } from "@radix-ui/react-compose-refs";
2256
+ import { createContextScope as createContextScope3 } from "@radix-ui/react-context";
2257
+ import { DismissableLayer } from "@radix-ui/react-dismissable-layer";
2258
+ import { useFocusGuards } from "@radix-ui/react-focus-guards";
2259
+ import { FocusScope } from "@radix-ui/react-focus-scope";
2260
+ import { useId as useId4 } from "@radix-ui/react-id";
2261
+ import * as PopperPrimitive from "@radix-ui/react-popper";
2262
+ import { createPopperScope } from "@radix-ui/react-popper";
2263
+ import { Portal as PortalPrimitive } from "@radix-ui/react-portal";
2264
+ import { Presence } from "@radix-ui/react-presence";
2265
+ import { Primitive as Primitive11 } from "@radix-ui/react-primitive";
2266
+ import { Slot as Slot12 } from "@radix-ui/react-slot";
2267
+ import { useControllableState as useControllableState5 } from "@radix-ui/react-use-controllable-state";
2268
+ import { hideOthers } from "aria-hidden";
2269
+ import React24, { forwardRef as forwardRef20, useCallback as useCallback9, useEffect as useEffect5, useMemo as useMemo4, useRef as useRef3, useState as useState6 } from "react";
2270
+ import { RemoveScroll } from "react-remove-scroll";
2271
+ var POPOVER_NAME = "Popover";
2272
+ var [createPopoverContext, createPopoverScope] = createContextScope3(POPOVER_NAME, [
2273
+ createPopperScope
2274
+ ]);
2275
+ var usePopperScope = createPopperScope();
2276
+ var [PopoverProvider, usePopoverContext] = createPopoverContext(POPOVER_NAME);
2277
+ var PopoverRoot = (props) => {
2278
+ const { __scopePopover, children, open: openProp, defaultOpen, onOpenChange, modal = false } = props;
2279
+ const popperScope = usePopperScope(__scopePopover);
2280
+ const triggerRef = useRef3(null);
2281
+ const [hasCustomAnchor, setHasCustomAnchor] = useState6(false);
2282
+ const [open = false, setOpen] = useControllableState5({
2283
+ prop: openProp,
2284
+ defaultProp: defaultOpen,
2285
+ onChange: onOpenChange
2286
+ });
2287
+ return /* @__PURE__ */ React24.createElement(PopperPrimitive.Root, popperScope, /* @__PURE__ */ React24.createElement(PopoverProvider, {
2288
+ scope: __scopePopover,
2289
+ contentId: useId4(),
2290
+ triggerRef,
2291
+ open,
2292
+ onOpenChange: setOpen,
2293
+ onOpenToggle: useCallback9(() => setOpen((prevOpen) => !prevOpen), [
2294
+ setOpen
2295
+ ]),
2296
+ hasCustomAnchor,
2297
+ onCustomAnchorAdd: useCallback9(() => setHasCustomAnchor(true), []),
2298
+ onCustomAnchorRemove: useCallback9(() => setHasCustomAnchor(false), []),
2299
+ modal
2300
+ }, children));
2301
+ };
2302
+ PopoverRoot.displayName = POPOVER_NAME;
2303
+ var ANCHOR_NAME = "PopoverAnchor";
2304
+ var PopoverAnchor = /* @__PURE__ */ forwardRef20((props, forwardedRef) => {
2305
+ const { __scopePopover, ...anchorProps } = props;
2306
+ const context = usePopoverContext(ANCHOR_NAME, __scopePopover);
2307
+ const popperScope = usePopperScope(__scopePopover);
2308
+ const { onCustomAnchorAdd, onCustomAnchorRemove } = context;
2309
+ useEffect5(() => {
2310
+ onCustomAnchorAdd();
2311
+ return () => onCustomAnchorRemove();
2312
+ }, [
2313
+ onCustomAnchorAdd,
2314
+ onCustomAnchorRemove
2315
+ ]);
2316
+ return /* @__PURE__ */ React24.createElement(PopperPrimitive.Anchor, {
2317
+ ...popperScope,
2318
+ ...anchorProps,
2319
+ ref: forwardedRef
2320
+ });
2321
+ });
2322
+ PopoverAnchor.displayName = ANCHOR_NAME;
2323
+ var TRIGGER_NAME2 = "PopoverTrigger";
2324
+ var PopoverTrigger = /* @__PURE__ */ forwardRef20((props, forwardedRef) => {
2325
+ const { __scopePopover, ...triggerProps } = props;
2326
+ const context = usePopoverContext(TRIGGER_NAME2, __scopePopover);
2327
+ const popperScope = usePopperScope(__scopePopover);
2328
+ const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
2329
+ const trigger = /* @__PURE__ */ React24.createElement(Primitive11.button, {
2330
+ type: "button",
2331
+ "aria-haspopup": "dialog",
2332
+ "aria-expanded": context.open,
2333
+ "aria-controls": context.contentId,
2334
+ "data-state": getState(context.open),
2335
+ ...triggerProps,
2336
+ ref: composedTriggerRef,
2337
+ onClick: composeEventHandlers2(props.onClick, context.onOpenToggle)
2338
+ });
2339
+ return context.hasCustomAnchor ? trigger : /* @__PURE__ */ React24.createElement(PopperPrimitive.Anchor, {
2340
+ asChild: true,
2341
+ ...popperScope
2342
+ }, trigger);
2343
+ });
2344
+ PopoverTrigger.displayName = TRIGGER_NAME2;
2345
+ var VIRTUAL_TRIGGER_NAME2 = "PopoverVirtualTrigger";
2346
+ var PopoverVirtualTrigger = (props) => {
2347
+ const { __scopePopover, virtualRef } = props;
2348
+ const context = usePopoverContext(VIRTUAL_TRIGGER_NAME2, __scopePopover);
2349
+ const popperScope = usePopperScope(__scopePopover);
2350
+ useEffect5(() => {
2351
+ if (virtualRef.current) {
2352
+ context.triggerRef.current = virtualRef.current;
2353
+ }
2354
+ });
2355
+ return /* @__PURE__ */ React24.createElement(PopperPrimitive.Anchor, {
2356
+ ...popperScope,
2357
+ virtualRef
2358
+ });
2359
+ };
2360
+ PopoverVirtualTrigger.displayName = VIRTUAL_TRIGGER_NAME2;
2361
+ var PORTAL_NAME2 = "PopoverPortal";
2362
+ var [PortalProvider, usePortalContext] = createPopoverContext(PORTAL_NAME2, {
2363
+ forceMount: void 0
2364
+ });
2365
+ var PopoverPortal = (props) => {
2366
+ const { __scopePopover, forceMount, children, container } = props;
2367
+ const context = usePopoverContext(PORTAL_NAME2, __scopePopover);
2368
+ return /* @__PURE__ */ React24.createElement(PortalProvider, {
2369
+ scope: __scopePopover,
2370
+ forceMount
2371
+ }, /* @__PURE__ */ React24.createElement(Presence, {
2372
+ present: forceMount || context.open
2373
+ }, /* @__PURE__ */ React24.createElement(PortalPrimitive, {
2374
+ asChild: true,
2375
+ container
2376
+ }, children)));
2377
+ };
2378
+ PopoverPortal.displayName = PORTAL_NAME2;
2379
+ var CONTENT_NAME2 = "PopoverContent";
2380
+ var PopoverContent = /* @__PURE__ */ forwardRef20((props, forwardedRef) => {
2381
+ const portalContext = usePortalContext(CONTENT_NAME2, props.__scopePopover);
2382
+ const { forceMount = portalContext.forceMount, ...contentProps } = props;
2383
+ const context = usePopoverContext(CONTENT_NAME2, props.__scopePopover);
2384
+ return /* @__PURE__ */ React24.createElement(Presence, {
2385
+ present: forceMount || context.open
2386
+ }, context.modal ? /* @__PURE__ */ React24.createElement(PopoverContentModal, {
2387
+ ...contentProps,
2388
+ ref: forwardedRef
2389
+ }) : /* @__PURE__ */ React24.createElement(PopoverContentNonModal, {
2390
+ ...contentProps,
2391
+ ref: forwardedRef
2392
+ }));
2393
+ });
2394
+ PopoverContent.displayName = CONTENT_NAME2;
2395
+ var PopoverContentModal = /* @__PURE__ */ forwardRef20((props, forwardedRef) => {
2396
+ const context = usePopoverContext(CONTENT_NAME2, props.__scopePopover);
2397
+ const contentRef = useRef3(null);
2398
+ const composedRefs = useComposedRefs(forwardedRef, contentRef);
2399
+ const isRightClickOutsideRef = useRef3(false);
2400
+ useEffect5(() => {
2401
+ const content = contentRef.current;
2402
+ if (content) {
2403
+ return hideOthers(content);
2404
+ }
2405
+ }, []);
2406
+ return /* @__PURE__ */ React24.createElement(RemoveScroll, {
2407
+ as: Slot12,
2408
+ allowPinchZoom: true
2409
+ }, /* @__PURE__ */ React24.createElement(PopoverContentImpl, {
2410
+ ...props,
2411
+ ref: composedRefs,
2412
+ // we make sure we're not trapping once it's been closed
2413
+ // (closed !== unmounted when animating out)
2414
+ trapFocus: context.open,
2415
+ disableOutsidePointerEvents: true,
2416
+ onCloseAutoFocus: composeEventHandlers2(props.onCloseAutoFocus, (event) => {
2417
+ event.preventDefault();
2418
+ if (!isRightClickOutsideRef.current) {
2419
+ context.triggerRef.current?.focus();
2420
+ }
2421
+ }),
2422
+ onPointerDownOutside: composeEventHandlers2(props.onPointerDownOutside, (event) => {
2423
+ const originalEvent = event.detail.originalEvent;
2424
+ const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
2425
+ const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
2426
+ isRightClickOutsideRef.current = isRightClick;
2427
+ }, {
2428
+ checkForDefaultPrevented: false
2429
+ }),
2430
+ // When focus is trapped, a `focusout` event may still happen.
2431
+ // We make sure we don't trigger our `onDismiss` in such case.
2432
+ onFocusOutside: composeEventHandlers2(props.onFocusOutside, (event) => event.preventDefault(), {
2433
+ checkForDefaultPrevented: false
2434
+ })
2435
+ }));
2436
+ });
2437
+ var PopoverContentNonModal = /* @__PURE__ */ forwardRef20((props, forwardedRef) => {
2438
+ const context = usePopoverContext(CONTENT_NAME2, props.__scopePopover);
2439
+ const hasInteractedOutsideRef = useRef3(false);
2440
+ const hasPointerDownOutsideRef = useRef3(false);
2441
+ return /* @__PURE__ */ React24.createElement(PopoverContentImpl, {
2442
+ ...props,
2443
+ ref: forwardedRef,
2444
+ trapFocus: false,
2445
+ disableOutsidePointerEvents: false,
2446
+ onCloseAutoFocus: (event) => {
2447
+ props.onCloseAutoFocus?.(event);
2448
+ if (!event.defaultPrevented) {
2449
+ if (!hasInteractedOutsideRef.current) {
2450
+ context.triggerRef.current?.focus();
2451
+ }
2452
+ event.preventDefault();
2453
+ }
2454
+ hasInteractedOutsideRef.current = false;
2455
+ hasPointerDownOutsideRef.current = false;
2456
+ },
2457
+ onInteractOutside: (event) => {
2458
+ props.onInteractOutside?.(event);
2459
+ if (!event.defaultPrevented) {
2460
+ hasInteractedOutsideRef.current = true;
2461
+ if (event.detail.originalEvent.type === "pointerdown") {
2462
+ hasPointerDownOutsideRef.current = true;
2463
+ }
2464
+ }
2465
+ const target = event.target;
2466
+ const targetIsTrigger = context.triggerRef.current?.contains(target);
2467
+ if (targetIsTrigger) {
2468
+ event.preventDefault();
2469
+ }
2470
+ if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
2471
+ event.preventDefault();
2472
+ }
2473
+ }
2474
+ });
2475
+ });
2476
+ var PopoverContentImpl = /* @__PURE__ */ forwardRef20((props, forwardedRef) => {
2477
+ const { __scopePopover, trapFocus, onOpenAutoFocus, onCloseAutoFocus, disableOutsidePointerEvents, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, collisionPadding = 8, collisionBoundary, classNames, ...contentProps } = props;
2478
+ const context = usePopoverContext(CONTENT_NAME2, __scopePopover);
2479
+ const popperScope = usePopperScope(__scopePopover);
2480
+ const { tx } = useThemeContext();
2481
+ const elevation = useElevationContext();
2482
+ const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
2483
+ useFocusGuards();
2484
+ const computedCollisionBoundary = useMemo4(() => {
2485
+ const closestBoundary = context.triggerRef.current?.closest("[data-popover-collision-boundary]");
2486
+ return closestBoundary ? Array.isArray(collisionBoundary) ? [
2487
+ closestBoundary,
2488
+ ...collisionBoundary
2489
+ ] : collisionBoundary ? [
2490
+ closestBoundary,
2491
+ collisionBoundary
2492
+ ] : [
2493
+ closestBoundary
2494
+ ] : collisionBoundary;
2495
+ }, [
2496
+ context.open,
2497
+ collisionBoundary,
2498
+ context.triggerRef.current
2499
+ ]);
2500
+ return /* @__PURE__ */ React24.createElement(FocusScope, {
2501
+ asChild: true,
2502
+ loop: true,
2503
+ trapped: trapFocus,
2504
+ onMountAutoFocus: onOpenAutoFocus,
2505
+ onUnmountAutoFocus: onCloseAutoFocus
2506
+ }, /* @__PURE__ */ React24.createElement(DismissableLayer, {
2507
+ asChild: true,
2508
+ disableOutsidePointerEvents,
2509
+ onInteractOutside,
2510
+ onEscapeKeyDown,
2511
+ onPointerDownOutside,
2512
+ onFocusOutside,
2513
+ onDismiss: () => context.onOpenChange(false)
2514
+ }, /* @__PURE__ */ React24.createElement(PopperPrimitive.Content, {
2515
+ "data-state": getState(context.open),
2516
+ role: "dialog",
2517
+ id: context.contentId,
2518
+ ...popperScope,
2519
+ ...contentProps,
2520
+ collisionPadding: safeCollisionPadding,
2521
+ collisionBoundary: computedCollisionBoundary,
2522
+ className: tx("popover.content", "popover", {
2523
+ elevation
2524
+ }, classNames),
2525
+ ref: forwardedRef,
2526
+ style: {
2527
+ ...contentProps.style,
2528
+ // Re-namespace exposed content custom properties.
2529
+ ...{
2530
+ "--radix-popover-content-transform-origin": "var(--radix-popper-transform-origin)",
2531
+ "--radix-popover-content-available-width": "var(--radix-popper-available-width)",
2532
+ "--radix-popover-content-available-height": "var(--radix-popper-available-height)",
2533
+ "--radix-popover-trigger-width": "var(--radix-popper-anchor-width)",
2534
+ "--radix-popover-trigger-height": "var(--radix-popper-anchor-height)"
2535
+ }
2536
+ }
2537
+ })));
2538
+ });
2539
+ var CLOSE_NAME = "PopoverClose";
2540
+ var PopoverClose = /* @__PURE__ */ forwardRef20((props, forwardedRef) => {
2541
+ const { __scopePopover, ...closeProps } = props;
2542
+ const context = usePopoverContext(CLOSE_NAME, __scopePopover);
2543
+ return /* @__PURE__ */ React24.createElement(Primitive11.button, {
2544
+ type: "button",
2545
+ ...closeProps,
2546
+ ref: forwardedRef,
2547
+ onClick: composeEventHandlers2(props.onClick, () => context.onOpenChange(false))
2548
+ });
2549
+ });
2550
+ PopoverClose.displayName = CLOSE_NAME;
2551
+ var ARROW_NAME2 = "PopoverArrow";
2552
+ var PopoverArrow = /* @__PURE__ */ forwardRef20((props, forwardedRef) => {
2553
+ const { __scopePopover, classNames, ...arrowProps } = props;
2554
+ const popperScope = usePopperScope(__scopePopover);
2555
+ const { tx } = useThemeContext();
2556
+ return /* @__PURE__ */ React24.createElement(PopperPrimitive.Arrow, {
2557
+ ...popperScope,
2558
+ ...arrowProps,
2559
+ className: tx("popover.arrow", "popover__arrow", {}, classNames),
2560
+ ref: forwardedRef
2561
+ });
2562
+ });
2563
+ PopoverArrow.displayName = ARROW_NAME2;
2564
+ var PopoverViewport = /* @__PURE__ */ forwardRef20(({ classNames, asChild, constrainInline = true, constrainBlock = true, children, ...props }, forwardedRef) => {
2565
+ const { tx } = useThemeContext();
2566
+ const Root6 = asChild ? Slot12 : Primitive11.div;
2567
+ return /* @__PURE__ */ React24.createElement(Root6, {
2568
+ ...props,
2569
+ className: tx("popover.viewport", "popover__viewport", {
2570
+ constrainInline,
2571
+ constrainBlock
2572
+ }, classNames),
2573
+ ref: forwardedRef
2574
+ }, children);
2575
+ });
2576
+ var getState = (open) => open ? "open" : "closed";
2577
+ var Popover = {
2578
+ Root: PopoverRoot,
2579
+ Anchor: PopoverAnchor,
2580
+ Trigger: PopoverTrigger,
2581
+ VirtualTrigger: PopoverVirtualTrigger,
2582
+ Portal: PopoverPortal,
2583
+ Content: PopoverContent,
2584
+ Close: PopoverClose,
2585
+ Arrow: PopoverArrow,
2586
+ Viewport: PopoverViewport
2587
+ };
2588
+
2589
+ // src/components/Status/Status.tsx
2590
+ import React25, { forwardRef as forwardRef21 } from "react";
2591
+ var Status = /* @__PURE__ */ forwardRef21(({ classNames, children, progress = 0, indeterminate, variant, ...props }, forwardedRef) => {
2592
+ const { tx } = useThemeContext();
2593
+ return /* @__PURE__ */ React25.createElement("span", {
2594
+ role: "status",
2595
+ ...props,
2596
+ className: tx("status.root", "status", {
2597
+ indeterminate,
2598
+ variant
2599
+ }, classNames),
2600
+ ref: forwardedRef
2601
+ }, /* @__PURE__ */ React25.createElement("span", {
2602
+ role: "none",
2603
+ className: tx("status.bar", "status__bar", {
2604
+ indeterminate,
2605
+ variant
2606
+ }, classNames),
2607
+ ...!indeterminate && {
2608
+ style: {
2609
+ width: `${Math.round(progress * 100)}%`
2610
+ }
2611
+ }
2612
+ }), children);
2613
+ });
2614
+
2615
+ // src/components/ScrollArea/ScrollArea.tsx
2616
+ import { Corner as ScrollAreaPrimitiveCorner, Root as ScrollAreaPrimitiveRoot, Scrollbar as ScrollAreaPrimitiveScrollbar, Thumb as ScrollAreaPrimitiveThumb, Viewport as ScrollAreaPrimitiveViewport } from "@radix-ui/react-scroll-area";
2617
+ import React26, { forwardRef as forwardRef22 } from "react";
2618
+ import { mx as mx4 } from "@dxos/ui-theme";
2619
+ var ScrollAreaRoot = /* @__PURE__ */ forwardRef22(({ classNames, ...props }, forwardedRef) => {
2620
+ const { tx } = useThemeContext();
2621
+ return /* @__PURE__ */ React26.createElement(ScrollAreaPrimitiveRoot, {
2622
+ ...props,
2623
+ className: tx("scrollArea.root", "scroll-area", {}, classNames),
2624
+ ref: forwardedRef
2625
+ });
2626
+ });
2627
+ var ScrollAreaViewport = /* @__PURE__ */ forwardRef22(({ classNames, ...props }, forwardedRef) => {
2628
+ const { tx } = useThemeContext();
2629
+ return /* @__PURE__ */ React26.createElement(ScrollAreaPrimitiveViewport, {
2630
+ ...props,
2631
+ className: tx("scrollArea.viewport", "scroll-area", {}, classNames),
2632
+ ref: forwardedRef
2633
+ });
2634
+ });
2635
+ var ScrollAreaScrollbar = /* @__PURE__ */ forwardRef22(({ classNames, variant = "fine", ...props }, forwardedRef) => {
2636
+ const { tx } = useThemeContext();
2637
+ return /* @__PURE__ */ React26.createElement(ScrollAreaPrimitiveScrollbar, {
2638
+ "data-variant": variant,
2639
+ ...props,
2640
+ className: tx("scrollArea.scrollbar", "scroll-area__scrollbar", {}, classNames),
2641
+ ref: forwardedRef
2642
+ });
2643
+ });
2644
+ var ScrollAreaThumb = /* @__PURE__ */ forwardRef22(({ classNames, ...props }, forwardedRef) => {
2645
+ const { tx } = useThemeContext();
2646
+ return /* @__PURE__ */ React26.createElement(ScrollAreaPrimitiveThumb, {
2647
+ ...props,
2648
+ className: tx("scrollArea.thumb", "scroll-area__thumb", {}, classNames),
2649
+ ref: forwardedRef
2650
+ });
2651
+ });
2652
+ var ScrollAreaCorner = /* @__PURE__ */ forwardRef22(({ classNames, ...props }, forwardedRef) => {
2653
+ const { tx } = useThemeContext();
2654
+ return /* @__PURE__ */ React26.createElement(ScrollAreaPrimitiveCorner, {
2655
+ ...props,
2656
+ className: tx("scrollArea.corner", "scroll-area__corner", {}, classNames),
2657
+ ref: forwardedRef
2658
+ });
2659
+ });
2660
+ var ScrollAreaExpander = ({ classNames, children }) => {
2661
+ return /* @__PURE__ */ React26.createElement("div", {
2662
+ role: "none",
2663
+ className: mx4("relative bs-full is-full overflow-hidden", classNames)
2664
+ }, /* @__PURE__ */ React26.createElement("div", {
2665
+ role: "none",
2666
+ className: "absolute inset-0 overflow-hidden"
2667
+ }, children));
2668
+ };
2669
+ var ScrollArea = {
2670
+ Root: ScrollAreaRoot,
2671
+ Viewport: ScrollAreaViewport,
2672
+ Scrollbar: ScrollAreaScrollbar,
2673
+ Thumb: ScrollAreaThumb,
2674
+ Corner: ScrollAreaCorner,
2675
+ Expander: ScrollAreaExpander
2676
+ };
2677
+
2678
+ // src/components/ScrollContainer/ScrollContainer.tsx
2679
+ import { createContext as createContext8 } from "@radix-ui/react-context";
2680
+ import React27, { forwardRef as forwardRef23, useCallback as useCallback10, useEffect as useEffect6, useImperativeHandle, useMemo as useMemo5, useRef as useRef4, useState as useState7 } from "react";
2681
+ import { addEventListener as addEventListener2, combine } from "@dxos/async";
2682
+ import { invariant } from "@dxos/invariant";
2683
+ import { useForwardedRef as useForwardedRef2 } from "@dxos/react-hooks";
2684
+ import { mx as mx5 } from "@dxos/ui-theme";
2685
+ var __dxlog_file2 = "/__w/dxos/dxos/packages/ui/react-ui/src/components/ScrollContainer/ScrollContainer.tsx";
2686
+ var isBottom = (el) => {
2687
+ return !!(el && el.scrollHeight - el.scrollTop === el.clientHeight);
2688
+ };
2689
+ var [ScrollContainerProvider, useScrollContainerContext] = createContext8("ScrollContainer");
2690
+ var Root3 = /* @__PURE__ */ forwardRef23(({ children, classNames, pin, fade, behavior: behaviorProp = "smooth" }, forwardedRef) => {
2691
+ const scrollerRef = useRef4(null);
2692
+ const autoScrollRef = useRef4(false);
2693
+ const [overflow, setOverflow] = useState7(false);
2694
+ const [pinned, setPinned] = useState7(pin);
2695
+ const timeoutRef = useRef4(void 0);
2696
+ const scrollToBottom = useCallback10((behavior = behaviorProp) => {
2697
+ if (scrollerRef.current) {
2698
+ autoScrollRef.current = true;
2699
+ scrollerRef.current.classList.add("scrollbar-none");
2700
+ scrollerRef.current.scrollTo({
2701
+ top: scrollerRef.current.scrollHeight,
2702
+ behavior
2703
+ });
2704
+ clearTimeout(timeoutRef.current);
2705
+ if (behavior !== "instant") {
2706
+ timeoutRef.current = setTimeout(() => {
2707
+ scrollerRef.current?.classList.remove("scrollbar-none");
2708
+ autoScrollRef.current = false;
2709
+ }, 500);
2710
+ }
2711
+ setPinned(true);
2712
+ }
2713
+ }, []);
2714
+ const controller = useMemo5(() => ({
2715
+ viewport: scrollerRef.current,
2716
+ scrollToTop: () => {
2717
+ invariant(scrollerRef.current, void 0, {
2718
+ F: __dxlog_file2,
2719
+ L: 94,
2720
+ S: void 0,
2721
+ A: [
2722
+ "scrollerRef.current",
2723
+ ""
2724
+ ]
2725
+ });
2726
+ scrollerRef.current.scrollTo({
2727
+ top: 0,
2728
+ behavior: "smooth"
2729
+ });
2730
+ setPinned(false);
2731
+ },
2732
+ scrollToBottom: () => {
2733
+ scrollToBottom("smooth");
2734
+ }
2735
+ }), [
2736
+ scrollToBottom,
2737
+ scrollerRef.current
2738
+ ]);
2739
+ useImperativeHandle(forwardedRef, () => controller, [
2740
+ controller
2741
+ ]);
2742
+ useEffect6(() => {
2743
+ if (!scrollerRef.current) {
2744
+ return;
2745
+ }
2746
+ return combine(
2747
+ // Check if user scrolls.
2748
+ addEventListener2(scrollerRef.current, "wheel", () => {
2749
+ setPinned(isBottom(scrollerRef.current));
2750
+ }),
2751
+ // Check if scrolls.
2752
+ addEventListener2(scrollerRef.current, "scroll", () => {
2753
+ setOverflow((scrollerRef.current?.scrollTop ?? 0) > 0);
2754
+ })
2755
+ );
2756
+ }, []);
2757
+ return /* @__PURE__ */ React27.createElement(ScrollContainerProvider, {
2758
+ pinned,
2759
+ controller,
2760
+ scrollToBottom
2761
+ }, /* @__PURE__ */ React27.createElement("div", {
2762
+ className: "relative grid flex-1 min-bs-0 overflow-hidden"
2763
+ }, fade && /* @__PURE__ */ React27.createElement("div", {
2764
+ role: "none",
2765
+ "data-visible": overflow,
2766
+ className: mx5(
2767
+ // NOTE: Gradients may not be visible with dark reader extensions.
2768
+ "z-10 absolute block-start-0 inset-inline-0 bs-24 is-full",
2769
+ 'opacity-0 duration-200 transition-opacity data-[visible="true"]:opacity-100',
2770
+ "bg-gradient-to-b from-[--surface-bg] to-transparent pointer-events-none"
2771
+ )
2772
+ }), /* @__PURE__ */ React27.createElement("div", {
2773
+ className: mx5("flex flex-col min-bs-0 overflow-y-auto scrollbar-thin", classNames),
2774
+ ref: scrollerRef
2775
+ }, children)));
2776
+ });
2777
+ Root3.displayName = "ScrollContainer.Root";
2778
+ var Viewport = /* @__PURE__ */ forwardRef23(({ classNames, children, ...props }, forwardedRef) => {
2779
+ const contentRef = useForwardedRef2(forwardedRef);
2780
+ const { pinned, scrollToBottom } = useScrollContainerContext(Viewport.displayName);
2781
+ useEffect6(() => {
2782
+ if (!pinned || !contentRef.current) {
2783
+ return;
2784
+ }
2785
+ scrollToBottom();
2786
+ const resizeObserver = new ResizeObserver(() => scrollToBottom());
2787
+ resizeObserver.observe(contentRef.current);
2788
+ return () => resizeObserver.disconnect();
2789
+ }, [
2790
+ pinned,
2791
+ scrollToBottom
2792
+ ]);
2793
+ return /* @__PURE__ */ React27.createElement("div", {
2794
+ className: mx5("is-full", classNames),
2795
+ ...props,
2796
+ ref: contentRef
2797
+ }, children);
2798
+ });
2799
+ Viewport.displayName = "ScrollContainer.Viewport";
2800
+ var ScrollDownButton = ({ classNames }) => {
2801
+ const { pinned, scrollToBottom } = useScrollContainerContext(ScrollDownButton.displayName);
2802
+ return /* @__PURE__ */ React27.createElement("div", {
2803
+ role: "none",
2804
+ className: mx5("absolute bottom-2 right-4 opacity-100 transition-opacity duration-300", pinned && "opacity-0", classNames)
2805
+ }, /* @__PURE__ */ React27.createElement(IconButton, {
2806
+ variant: "primary",
2807
+ icon: "ph--arrow-down--regular",
2808
+ iconOnly: true,
2809
+ size: 4,
2810
+ label: "Scroll down",
2811
+ onClick: () => scrollToBottom()
2812
+ }));
2813
+ };
2814
+ ScrollDownButton.displayName = "ScrollContainer.ScrollDownButton";
2815
+ var ScrollContainer = {
2816
+ Root: Root3,
2817
+ Viewport,
2818
+ ScrollDownButton
2819
+ };
2820
+
2821
+ // src/components/Select/Select.tsx
2822
+ import * as SelectPrimitive from "@radix-ui/react-select";
2823
+ import React28, { forwardRef as forwardRef24 } from "react";
2824
+ var SelectRoot = SelectPrimitive.Root;
2825
+ var SelectTrigger = SelectPrimitive.Trigger;
2826
+ var SelectValue = SelectPrimitive.Value;
2827
+ var SelectIcon = SelectPrimitive.Icon;
2828
+ var SelectPortal = SelectPrimitive.Portal;
2829
+ var SelectTriggerButton = /* @__PURE__ */ forwardRef24(({ children, placeholder, ...props }, forwardedRef) => {
2830
+ return /* @__PURE__ */ React28.createElement(SelectPrimitive.Trigger, {
2831
+ asChild: true,
2832
+ ref: forwardedRef
2833
+ }, /* @__PURE__ */ React28.createElement(Button, props, /* @__PURE__ */ React28.createElement(SelectPrimitive.Value, {
2834
+ placeholder
2835
+ }, children), /* @__PURE__ */ React28.createElement("span", {
2836
+ className: "is-1 flex-1"
2837
+ }), /* @__PURE__ */ React28.createElement(SelectPrimitive.Icon, {
2838
+ asChild: true
2839
+ }, /* @__PURE__ */ React28.createElement(Icon, {
2840
+ size: 3,
2841
+ icon: "ph--caret-down--bold"
2842
+ }))));
2843
+ });
2844
+ var SelectContent = /* @__PURE__ */ forwardRef24(({ classNames, children, collisionPadding = 8, ...props }, forwardedRef) => {
2845
+ const { tx } = useThemeContext();
2846
+ const elevation = useElevationContext();
2847
+ const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
2848
+ return /* @__PURE__ */ React28.createElement(SelectPrimitive.Content, {
2849
+ ...props,
2850
+ "data-arrow-keys": "up down",
2851
+ collisionPadding: safeCollisionPadding,
2852
+ className: tx("select.content", "select__content", {
2853
+ elevation
2854
+ }, classNames),
2855
+ position: "popper",
2856
+ ref: forwardedRef
2857
+ }, children);
2858
+ });
2859
+ var SelectScrollUpButton2 = /* @__PURE__ */ forwardRef24(({ classNames, children, ...props }, forwardedRef) => {
2860
+ const { tx } = useThemeContext();
2861
+ return /* @__PURE__ */ React28.createElement(SelectPrimitive.SelectScrollUpButton, {
2862
+ ...props,
2863
+ className: tx("select.scrollButton", "select__scroll-button--up", {}, classNames),
2864
+ ref: forwardedRef
2865
+ }, children ?? /* @__PURE__ */ React28.createElement(Icon, {
2866
+ size: 3,
2867
+ icon: "ph--caret-up--bold"
2868
+ }));
2869
+ });
2870
+ var SelectScrollDownButton2 = /* @__PURE__ */ forwardRef24(({ classNames, children, ...props }, forwardedRef) => {
2871
+ const { tx } = useThemeContext();
2872
+ return /* @__PURE__ */ React28.createElement(SelectPrimitive.SelectScrollDownButton, {
2873
+ ...props,
2874
+ className: tx("select.scrollButton", "select__scroll-button--down", {}, classNames),
2875
+ ref: forwardedRef
2876
+ }, children ?? /* @__PURE__ */ React28.createElement(Icon, {
2877
+ size: 3,
2878
+ icon: "ph--caret-down--bold"
2879
+ }));
2880
+ });
2881
+ var SelectViewport2 = /* @__PURE__ */ forwardRef24(({ classNames, children, ...props }, forwardedRef) => {
2882
+ const { tx } = useThemeContext();
2883
+ return /* @__PURE__ */ React28.createElement(SelectPrimitive.SelectViewport, {
2884
+ ...props,
2885
+ className: tx("select.viewport", "select__viewport", {}, classNames),
2886
+ ref: forwardedRef
2887
+ }, children);
2888
+ });
2889
+ var SelectItem = /* @__PURE__ */ forwardRef24(({ classNames, ...props }, forwardedRef) => {
2890
+ const { tx } = useThemeContext();
2891
+ return /* @__PURE__ */ React28.createElement(SelectPrimitive.Item, {
2892
+ ...props,
2893
+ className: tx("select.item", "option", {}, classNames),
2894
+ ref: forwardedRef
2895
+ });
2896
+ });
2897
+ var SelectItemText = SelectPrimitive.ItemText;
2898
+ var SelectItemIndicator = /* @__PURE__ */ forwardRef24(({ classNames, children, ...props }, forwardedRef) => {
2899
+ const { tx } = useThemeContext();
2900
+ return /* @__PURE__ */ React28.createElement(SelectPrimitive.ItemIndicator, {
2901
+ ...props,
2902
+ className: tx("select.itemIndicator", "option__indicator", {}, classNames),
2903
+ ref: forwardedRef
2904
+ }, children);
2905
+ });
2906
+ var SelectOption = /* @__PURE__ */ forwardRef24(({ children, classNames, ...props }, forwardedRef) => {
2907
+ const { tx } = useThemeContext();
2908
+ return /* @__PURE__ */ React28.createElement(SelectPrimitive.Item, {
2909
+ ...props,
2910
+ className: tx("select.item", "option", {}, classNames),
2911
+ ref: forwardedRef
2912
+ }, /* @__PURE__ */ React28.createElement(SelectPrimitive.ItemText, null, children), /* @__PURE__ */ React28.createElement("span", {
2913
+ className: "grow is-1"
2914
+ }), /* @__PURE__ */ React28.createElement(Icon, {
2915
+ icon: "ph--check--regular"
2916
+ }));
2917
+ });
2918
+ var SelectGroup = SelectPrimitive.Group;
2919
+ var SelectLabel = SelectPrimitive.Label;
2920
+ var SelectSeparator = /* @__PURE__ */ forwardRef24(({ classNames, ...props }, forwardedRef) => {
2921
+ const { tx } = useThemeContext();
2922
+ return /* @__PURE__ */ React28.createElement(SelectPrimitive.Separator, {
2923
+ ...props,
2924
+ className: tx("select.separator", "select__separator", {}, classNames),
2925
+ ref: forwardedRef
2926
+ });
2927
+ });
2928
+ var SelectArrow = /* @__PURE__ */ forwardRef24(({ classNames, ...props }, forwardedRef) => {
2929
+ const { tx } = useThemeContext();
2930
+ return /* @__PURE__ */ React28.createElement(SelectPrimitive.Arrow, {
2931
+ ...props,
2932
+ className: tx("select.arrow", "select__arrow", {}, classNames),
2933
+ ref: forwardedRef
2934
+ });
2935
+ });
2936
+ var Select = {
2937
+ Root: SelectRoot,
2938
+ Trigger: SelectTrigger,
2939
+ TriggerButton: SelectTriggerButton,
2940
+ Value: SelectValue,
2941
+ Icon: SelectIcon,
2942
+ Portal: SelectPortal,
2943
+ Content: SelectContent,
2944
+ ScrollUpButton: SelectScrollUpButton2,
2945
+ ScrollDownButton: SelectScrollDownButton2,
2946
+ Viewport: SelectViewport2,
2947
+ Item: SelectItem,
2948
+ ItemText: SelectItemText,
2949
+ ItemIndicator: SelectItemIndicator,
2950
+ Option: SelectOption,
2951
+ Group: SelectGroup,
2952
+ Label: SelectLabel,
2953
+ Separator: SelectSeparator,
2954
+ Arrow: SelectArrow
2955
+ };
2956
+
2957
+ // src/components/Separator/Separator.tsx
2958
+ import { Separator as SeparatorPrimitive } from "@radix-ui/react-separator";
2959
+ import React29, { forwardRef as forwardRef25 } from "react";
2960
+ var Separator4 = /* @__PURE__ */ forwardRef25(({ classNames, orientation = "horizontal", subdued, ...props }, forwardedRef) => {
2961
+ const { tx } = useThemeContext();
2962
+ return /* @__PURE__ */ React29.createElement(SeparatorPrimitive, {
2963
+ orientation,
2964
+ ...props,
2965
+ className: tx("separator.root", "separator", {
2966
+ orientation,
2967
+ subdued
2968
+ }, classNames),
2969
+ ref: forwardedRef
2970
+ });
2971
+ });
2972
+
2973
+ // src/components/Tag/Tag.tsx
2974
+ import { Primitive as Primitive12 } from "@radix-ui/react-primitive";
2975
+ import { Slot as Slot13 } from "@radix-ui/react-slot";
2976
+ import React30, { forwardRef as forwardRef26 } from "react";
2977
+ var Tag = /* @__PURE__ */ forwardRef26(({ asChild, palette = "neutral", classNames, ...props }, forwardedRef) => {
2978
+ const { tx } = useThemeContext();
2979
+ const Root6 = asChild ? Slot13 : Primitive12.span;
2980
+ return /* @__PURE__ */ React30.createElement(Root6, {
2981
+ ...props,
2982
+ className: tx("tag.root", "dx-tag", {
2983
+ palette
2984
+ }, classNames),
2985
+ "data-hue": palette,
2986
+ ref: forwardedRef
2987
+ });
2988
+ });
2989
+
2990
+ // src/components/Toast/Toast.tsx
2991
+ import { Primitive as Primitive13 } from "@radix-ui/react-primitive";
2992
+ import { Slot as Slot14 } from "@radix-ui/react-slot";
2993
+ 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";
2994
+ import React31, { forwardRef as forwardRef27 } from "react";
2995
+ var ToastProvider = ToastProviderPrimitive;
2996
+ var ToastViewport = /* @__PURE__ */ forwardRef27(({ classNames, ...props }, forwardedRef) => {
2997
+ const { tx } = useThemeContext();
2998
+ return /* @__PURE__ */ React31.createElement(ToastViewportPrimitive, {
2999
+ className: tx("toast.viewport", "toast-viewport", {}, classNames),
3000
+ ref: forwardedRef
3001
+ });
3002
+ });
3003
+ var ToastRoot = /* @__PURE__ */ forwardRef27(({ classNames, children, ...props }, forwardedRef) => {
3004
+ const { tx } = useThemeContext();
3005
+ return /* @__PURE__ */ React31.createElement(ToastRootPrimitive, {
3006
+ ...props,
3007
+ className: tx("toast.root", "toast", {}, classNames),
3008
+ ref: forwardedRef
3009
+ }, /* @__PURE__ */ React31.createElement(ElevationProvider, {
3010
+ elevation: "toast"
3011
+ }, children));
3012
+ });
3013
+ var ToastBody = /* @__PURE__ */ forwardRef27(({ asChild, classNames, ...props }, forwardedRef) => {
3014
+ const { tx } = useThemeContext();
3015
+ const Root6 = asChild ? Slot14 : Primitive13.div;
3016
+ return /* @__PURE__ */ React31.createElement(Root6, {
3017
+ ...props,
3018
+ className: tx("toast.body", "toast__body", {}, classNames),
3019
+ ref: forwardedRef
3020
+ });
3021
+ });
3022
+ var ToastTitle = /* @__PURE__ */ forwardRef27(({ asChild, classNames, ...props }, forwardedRef) => {
3023
+ const { tx } = useThemeContext();
3024
+ const Root6 = asChild ? Slot14 : ToastTitlePrimitive;
3025
+ return /* @__PURE__ */ React31.createElement(Root6, {
3026
+ ...props,
3027
+ className: tx("toast.title", "toast__title", {}, classNames),
3028
+ ref: forwardedRef
3029
+ });
3030
+ });
3031
+ var ToastDescription = /* @__PURE__ */ forwardRef27(({ asChild, classNames, ...props }, forwardedRef) => {
3032
+ const { tx } = useThemeContext();
3033
+ const Root6 = asChild ? Slot14 : ToastDescriptionPrimitive;
3034
+ return /* @__PURE__ */ React31.createElement(Root6, {
3035
+ ...props,
3036
+ className: tx("toast.description", "toast__description", {}, classNames),
3037
+ ref: forwardedRef
3038
+ });
3039
+ });
3040
+ var ToastActions = /* @__PURE__ */ forwardRef27(({ asChild, classNames, ...props }, forwardedRef) => {
3041
+ const { tx } = useThemeContext();
3042
+ const Root6 = asChild ? Slot14 : Primitive13.div;
3043
+ return /* @__PURE__ */ React31.createElement(Root6, {
3044
+ ...props,
3045
+ className: tx("toast.actions", "toast__actions", {}, classNames),
3046
+ ref: forwardedRef
3047
+ });
3048
+ });
3049
+ var ToastAction = ToastActionPrimitive;
3050
+ var ToastClose = ToastClosePrimitive;
3051
+ var Toast = {
3052
+ Provider: ToastProvider,
3053
+ Viewport: ToastViewport,
3054
+ Root: ToastRoot,
3055
+ Body: ToastBody,
3056
+ Title: ToastTitle,
3057
+ Description: ToastDescription,
3058
+ Actions: ToastActions,
3059
+ Action: ToastAction,
3060
+ Close: ToastClose
3061
+ };
3062
+
3063
+ // src/components/Toolbar/Toolbar.tsx
3064
+ import * as ToolbarPrimitive from "@radix-ui/react-toolbar";
3065
+ import React32, { Fragment, forwardRef as forwardRef28 } from "react";
3066
+ var ToolbarRoot = /* @__PURE__ */ forwardRef28(({ classNames, children, disabled, layoutManaged, textBlockWidth: textBlockWidthProp, ...props }, forwardedRef) => {
3067
+ const { tx } = useThemeContext();
3068
+ const InnerRoot = textBlockWidthProp ? "div" : Fragment;
3069
+ const innerRootProps = textBlockWidthProp ? {
3070
+ role: "none",
3071
+ className: tx("toolbar.inner", "toolbar", {
3072
+ layoutManaged
3073
+ }, classNames)
3074
+ } : {};
3075
+ return /* @__PURE__ */ React32.createElement(ToolbarPrimitive.Root, {
3076
+ ...props,
3077
+ "data-arrow-keys": props.orientation === "vertical" ? "up down" : "left right",
3078
+ className: tx("toolbar.root", "toolbar", {
3079
+ layoutManaged,
3080
+ disabled
3081
+ }, classNames),
3082
+ ref: forwardedRef
3083
+ }, /* @__PURE__ */ React32.createElement(InnerRoot, innerRootProps, children));
3084
+ });
3085
+ var ToolbarButton = /* @__PURE__ */ forwardRef28((props, forwardedRef) => {
3086
+ return /* @__PURE__ */ React32.createElement(ToolbarPrimitive.Button, {
3087
+ asChild: true
3088
+ }, /* @__PURE__ */ React32.createElement(Button, {
3089
+ ...props,
3090
+ ref: forwardedRef
3091
+ }));
3092
+ });
3093
+ var ToolbarIconButton = /* @__PURE__ */ forwardRef28((props, forwardedRef) => {
3094
+ return /* @__PURE__ */ React32.createElement(ToolbarPrimitive.Button, {
3095
+ asChild: true
3096
+ }, /* @__PURE__ */ React32.createElement(IconButton, {
3097
+ ...props,
3098
+ noTooltip: true,
3099
+ ref: forwardedRef
3100
+ }));
3101
+ });
3102
+ var ToolbarToggle = /* @__PURE__ */ forwardRef28((props, forwardedRef) => {
3103
+ return /* @__PURE__ */ React32.createElement(ToolbarPrimitive.Button, {
3104
+ asChild: true
3105
+ }, /* @__PURE__ */ React32.createElement(Toggle, {
3106
+ ...props,
3107
+ ref: forwardedRef
3108
+ }));
3109
+ });
3110
+ var ToolbarLink = /* @__PURE__ */ forwardRef28((props, forwardedRef) => {
3111
+ return /* @__PURE__ */ React32.createElement(ToolbarPrimitive.Link, {
3112
+ asChild: true
3113
+ }, /* @__PURE__ */ React32.createElement(Link, {
3114
+ ...props,
3115
+ ref: forwardedRef
3116
+ }));
3117
+ });
3118
+ var ToolbarToggleGroup2 = /* @__PURE__ */ forwardRef28(({ classNames, children, elevation, ...props }, forwardedRef) => {
3119
+ return /* @__PURE__ */ React32.createElement(ToolbarPrimitive.ToolbarToggleGroup, {
3120
+ ...props,
3121
+ asChild: true
3122
+ }, /* @__PURE__ */ React32.createElement(ButtonGroup, {
3123
+ classNames,
3124
+ children,
3125
+ elevation,
3126
+ ref: forwardedRef
3127
+ }));
3128
+ });
3129
+ var ToolbarToggleGroupItem = /* @__PURE__ */ forwardRef28(({ variant, density, elevation, classNames, children, ...props }, forwardedRef) => {
3130
+ return /* @__PURE__ */ React32.createElement(ToolbarPrimitive.ToolbarToggleItem, {
3131
+ ...props,
3132
+ asChild: true
3133
+ }, /* @__PURE__ */ React32.createElement(Button, {
3134
+ variant,
3135
+ density,
3136
+ elevation,
3137
+ classNames,
3138
+ children,
3139
+ ref: forwardedRef
3140
+ }));
3141
+ });
3142
+ var ToolbarToggleGroupIconItem = /* @__PURE__ */ forwardRef28(({ variant, density, elevation, classNames, icon, label, iconOnly, ...props }, forwardedRef) => {
3143
+ return /* @__PURE__ */ React32.createElement(ToolbarPrimitive.ToolbarToggleItem, {
3144
+ ...props,
3145
+ asChild: true
3146
+ }, /* @__PURE__ */ React32.createElement(IconButton, {
3147
+ variant,
3148
+ density,
3149
+ elevation,
3150
+ classNames,
3151
+ icon,
3152
+ label,
3153
+ iconOnly,
3154
+ ref: forwardedRef
3155
+ }));
3156
+ });
3157
+ var ToolbarSeparator = /* @__PURE__ */ forwardRef28(({ variant = "line", ...props }, forwardedRef) => {
3158
+ return variant === "line" ? /* @__PURE__ */ React32.createElement(ToolbarPrimitive.Separator, {
3159
+ asChild: true
3160
+ }, /* @__PURE__ */ React32.createElement(Separator4, {
3161
+ ...props,
3162
+ ref: forwardedRef
3163
+ })) : /* @__PURE__ */ React32.createElement(ToolbarPrimitive.Separator, {
3164
+ className: "grow",
3165
+ ref: forwardedRef
3166
+ });
3167
+ });
3168
+ var Toolbar = {
3169
+ Root: ToolbarRoot,
3170
+ Button: ToolbarButton,
3171
+ IconButton: ToolbarIconButton,
3172
+ Link: ToolbarLink,
3173
+ Toggle: ToolbarToggle,
3174
+ ToggleGroup: ToolbarToggleGroup2,
3175
+ ToggleGroupItem: ToolbarToggleGroupItem,
3176
+ ToggleGroupIconItem: ToolbarToggleGroupIconItem,
3177
+ Separator: ToolbarSeparator
3178
+ };
82
3179
  export {
83
3180
  AlertDialog,
84
3181
  AnchoredOverflow,
@@ -89,11 +3186,10 @@ export {
89
3186
  ButtonGroup,
90
3187
  Callout,
91
3188
  Clipboard,
92
- ContextMenu,
3189
+ ContextMenu2 as ContextMenu,
93
3190
  DensityContext,
94
3191
  DensityProvider,
95
3192
  Dialog,
96
- Domino,
97
3193
  DropdownMenu,
98
3194
  ElevationContext,
99
3195
  ElevationProvider,
@@ -109,8 +3205,9 @@ export {
109
3205
  Message,
110
3206
  Popover,
111
3207
  ScrollArea,
3208
+ ScrollContainer,
112
3209
  Select,
113
- Separator,
3210
+ Separator4 as Separator,
114
3211
  Status,
115
3212
  Tag,
116
3213
  ThemeContext,
@@ -140,6 +3237,7 @@ export {
140
3237
  useDensityContext,
141
3238
  useDropdownMenuContext,
142
3239
  useDropdownMenuMenuScope,
3240
+ useDynamicDrawer,
143
3241
  useElevationContext,
144
3242
  useIconHref,
145
3243
  useLandmarkMover,
@@ -148,6 +3246,7 @@ export {
148
3246
  useMainContext,
149
3247
  usePx,
150
3248
  useSafeArea,
3249
+ useScrollContainerContext,
151
3250
  useSidebars,
152
3251
  useThemeContext,
153
3252
  useTooltipContext,