@dxos/react-ui 0.8.4-main.e8ec1fe → 0.8.4-main.ef1bc66f44

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