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