@dxos/react-ui 0.6.13 → 0.6.14-main.2b6a0f3

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 (114) hide show
  1. package/dist/lib/browser/index.mjs +34 -29
  2. package/dist/lib/browser/index.mjs.map +3 -3
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node/index.cjs +2395 -0
  5. package/dist/lib/node/index.cjs.map +7 -0
  6. package/dist/lib/node/meta.json +1 -0
  7. package/dist/lib/node-esm/index.mjs +2396 -0
  8. package/dist/lib/node-esm/index.mjs.map +7 -0
  9. package/dist/lib/node-esm/meta.json +1 -0
  10. package/dist/types/src/components/Avatars/Avatar.stories.d.ts +15 -1
  11. package/dist/types/src/components/Avatars/Avatar.stories.d.ts.map +1 -1
  12. package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts +6 -1
  13. package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts.map +1 -1
  14. package/dist/types/src/components/Breadcrumb/Breadcrumb.stories.d.ts +9 -1
  15. package/dist/types/src/components/Breadcrumb/Breadcrumb.stories.d.ts.map +1 -1
  16. package/dist/types/src/components/Buttons/Button.stories.d.ts +12 -17
  17. package/dist/types/src/components/Buttons/Button.stories.d.ts.map +1 -1
  18. package/dist/types/src/components/Buttons/Toggle.stories.d.ts +2 -1
  19. package/dist/types/src/components/Buttons/Toggle.stories.d.ts.map +1 -1
  20. package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts +20 -1
  21. package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts.map +1 -1
  22. package/dist/types/src/components/DensityProvider/DensityProvider.d.ts.map +1 -1
  23. package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts +12 -1
  24. package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts.map +1 -1
  25. package/dist/types/src/components/Dialogs/Dialog.stories.d.ts +11 -1
  26. package/dist/types/src/components/Dialogs/Dialog.stories.d.ts.map +1 -1
  27. package/dist/types/src/components/Input/Input.d.ts.map +1 -1
  28. package/dist/types/src/components/Input/Input.stories.d.ts +16 -1
  29. package/dist/types/src/components/Input/Input.stories.d.ts.map +1 -1
  30. package/dist/types/src/components/Lists/List.stories.d.ts +2 -3
  31. package/dist/types/src/components/Lists/List.stories.d.ts.map +1 -1
  32. package/dist/types/src/components/Lists/Tree.stories.d.ts +5 -1
  33. package/dist/types/src/components/Lists/Tree.stories.d.ts.map +1 -1
  34. package/dist/types/src/components/Lists/Treegrid.stories.d.ts +3 -2
  35. package/dist/types/src/components/Lists/Treegrid.stories.d.ts.map +1 -1
  36. package/dist/types/src/components/Main/Main.stories.d.ts +5 -1
  37. package/dist/types/src/components/Main/Main.stories.d.ts.map +1 -1
  38. package/dist/types/src/components/Menus/ContextMenu.stories.d.ts +29 -1
  39. package/dist/types/src/components/Menus/ContextMenu.stories.d.ts.map +1 -1
  40. package/dist/types/src/components/Menus/DropdownMenu.stories.d.ts +29 -1
  41. package/dist/types/src/components/Menus/DropdownMenu.stories.d.ts.map +1 -1
  42. package/dist/types/src/components/Message/Message.stories.d.ts +6 -1
  43. package/dist/types/src/components/Message/Message.stories.d.ts.map +1 -1
  44. package/dist/types/src/components/Popover/Popover.stories.d.ts +15 -1
  45. package/dist/types/src/components/Popover/Popover.stories.d.ts.map +1 -1
  46. package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts +20 -1
  47. package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts.map +1 -1
  48. package/dist/types/src/components/Select/Select.d.ts.map +1 -1
  49. package/dist/types/src/components/Select/Select.stories.d.ts +10 -11
  50. package/dist/types/src/components/Select/Select.stories.d.ts.map +1 -1
  51. package/dist/types/src/components/Status/Status.stories.d.ts +0 -3
  52. package/dist/types/src/components/Status/Status.stories.d.ts.map +1 -1
  53. package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts +4 -5
  54. package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
  55. package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts +4 -4
  56. package/dist/types/src/components/Toast/Toast.d.ts.map +1 -1
  57. package/dist/types/src/components/Toast/Toast.stories.d.ts +20 -1
  58. package/dist/types/src/components/Toast/Toast.stories.d.ts.map +1 -1
  59. package/dist/types/src/components/Toolbar/Toolbar.d.ts +4 -2
  60. package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
  61. package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts +30 -1
  62. package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -1
  63. package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts +13 -1
  64. package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts.map +1 -1
  65. package/dist/types/src/hooks/useThemeContext.d.ts.map +1 -1
  66. package/dist/types/src/playground/Controls.stories.d.ts +2 -6
  67. package/dist/types/src/playground/Controls.stories.d.ts.map +1 -1
  68. package/dist/types/src/playground/Surfaces.stories.d.ts +6 -2
  69. package/dist/types/src/playground/Surfaces.stories.d.ts.map +1 -1
  70. package/dist/types/src/playground/Typography.stories.d.ts +1 -1
  71. package/dist/types/src/testing/decorators/index.d.ts +1 -0
  72. package/dist/types/src/testing/decorators/index.d.ts.map +1 -1
  73. package/dist/types/src/testing/decorators/withVariants.d.ts +13 -0
  74. package/dist/types/src/testing/decorators/withVariants.d.ts.map +1 -0
  75. package/package.json +20 -14
  76. package/src/components/Avatars/Avatar.stories.tsx +3 -2
  77. package/src/components/Avatars/AvatarGroup.stories.tsx +3 -2
  78. package/src/components/Breadcrumb/Breadcrumb.stories.tsx +3 -2
  79. package/src/components/Buttons/Button.stories.tsx +34 -63
  80. package/src/components/Buttons/Toggle.stories.tsx +3 -2
  81. package/src/components/Buttons/ToggleGroup.stories.tsx +3 -2
  82. package/src/components/DensityProvider/DensityProvider.tsx +1 -1
  83. package/src/components/Dialogs/AlertDialog.stories.tsx +3 -2
  84. package/src/components/Dialogs/Dialog.stories.tsx +3 -2
  85. package/src/components/Input/Input.stories.tsx +4 -3
  86. package/src/components/Link/Link.stories.tsx +1 -1
  87. package/src/components/Lists/List.stories.tsx +4 -4
  88. package/src/components/Lists/Tree.stories.tsx +3 -2
  89. package/src/components/Lists/Treegrid.stories.tsx +7 -5
  90. package/src/components/Main/Main.stories.tsx +3 -2
  91. package/src/components/Menus/ContextMenu.stories.tsx +3 -2
  92. package/src/components/Menus/DropdownMenu.stories.tsx +3 -2
  93. package/src/components/Message/Message.stories.tsx +3 -2
  94. package/src/components/Popover/Popover.stories.tsx +3 -2
  95. package/src/components/ScrollArea/ScrollArea.stories.tsx +3 -2
  96. package/src/components/Select/Select.stories.tsx +14 -31
  97. package/src/components/Select/Select.tsx +9 -10
  98. package/src/components/Status/Status.stories.tsx +1 -2
  99. package/src/components/Tag/Tag.stories.tsx +1 -1
  100. package/src/components/ThemeProvider/ThemeProvider.tsx +17 -18
  101. package/src/components/Toast/Toast.stories.tsx +3 -2
  102. package/src/components/Toast/Toast.tsx +1 -4
  103. package/src/components/Toolbar/Toolbar.stories.tsx +3 -2
  104. package/src/components/Toolbar/Toolbar.tsx +21 -1
  105. package/src/components/Tooltip/Tooltip.stories.tsx +3 -2
  106. package/src/hooks/useThemeContext.ts +3 -1
  107. package/src/playground/Controls.stories.tsx +7 -10
  108. package/src/playground/Surfaces.stories.tsx +4 -3
  109. package/src/playground/Typography.stories.tsx +2 -2
  110. package/src/testing/decorators/index.ts +1 -0
  111. package/src/testing/decorators/withVariants.tsx +45 -0
  112. package/dist/types/src/playground/helpers.d.ts +0 -6
  113. package/dist/types/src/playground/helpers.d.ts.map +0 -1
  114. package/src/playground/helpers.tsx +0 -32
@@ -0,0 +1,2396 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+
3
+ // packages/ui/react-ui/src/index.ts
4
+ import { Trans } from "react-i18next";
5
+ export * from "@dxos/react-hooks";
6
+ export * from "@dxos/react-ui-types";
7
+
8
+ // packages/ui/react-ui/src/components/AnchoredOverflow/AnchoredOverflow.tsx
9
+ import { Primitive } from "@radix-ui/react-primitive";
10
+ import { Slot } from "@radix-ui/react-slot";
11
+ import React2, { forwardRef } from "react";
12
+
13
+ // packages/ui/react-ui/src/hooks/useDensityContext.ts
14
+ import { useContext } from "react";
15
+ var useDensityContext = (propsDensity) => {
16
+ const { density } = useContext(DensityContext);
17
+ return propsDensity ?? density;
18
+ };
19
+
20
+ // packages/ui/react-ui/src/hooks/useElevationContext.ts
21
+ import { useContext as useContext2 } from "react";
22
+ var useElevationContext = (propsElevation) => {
23
+ const { elevation } = useContext2(ElevationContext);
24
+ return propsElevation ?? elevation;
25
+ };
26
+
27
+ // packages/ui/react-ui/src/hooks/useTranslationsContext.ts
28
+ import { useContext as useContext4 } from "react";
29
+
30
+ // packages/ui/react-ui/src/components/ThemeProvider/TranslationsProvider.tsx
31
+ import { enUS as dtLocaleEnUs } from "date-fns/locale";
32
+ import i18Next from "i18next";
33
+ import React, { useEffect, createContext, useState, Suspense, useContext as useContext3 } from "react";
34
+ import { initReactI18next, useTranslation as useI18NextTranslation } from "react-i18next";
35
+ var initialLng = "en-US";
36
+ var initialNs = "dxos-common";
37
+ var initialDtLocale = dtLocaleEnUs;
38
+ var isLabel = (o) => typeof o === "string" || Array.isArray(o) && o.length === 2 && typeof o[0] === "string" && !!o[1] && typeof o[1] === "object" && "ns" in o[1] && typeof o[1].ns === "string";
39
+ var toLocalizedString = (label, t) => Array.isArray(label) ? t(...label) : label;
40
+ var resources = {
41
+ [initialLng]: {
42
+ [initialNs]: {
43
+ "loading translations": "Loading translations\u2026"
44
+ }
45
+ }
46
+ };
47
+ void i18Next.use(initReactI18next).init({
48
+ resources,
49
+ lng: initialLng,
50
+ defaultNS: initialNs,
51
+ interpolation: {
52
+ escapeValue: false
53
+ }
54
+ });
55
+ var TranslationsContext = /* @__PURE__ */ createContext({
56
+ appNs: initialNs,
57
+ dtLocale: initialDtLocale
58
+ });
59
+ var useTranslation = (...args) => {
60
+ const result = useI18NextTranslation(...args);
61
+ const { dtLocale } = useContext3(TranslationsContext);
62
+ return {
63
+ ...result,
64
+ dtLocale
65
+ };
66
+ };
67
+ var TranslationsProvider = ({ fallback, resourceExtensions, children, appNs, dtLocale }) => {
68
+ const [loaded, setLoaded] = useState(false);
69
+ useEffect(() => {
70
+ setLoaded(false);
71
+ if (resourceExtensions && resourceExtensions.length) {
72
+ resourceExtensions.forEach((resource) => {
73
+ Object.keys(resource).forEach((language) => {
74
+ Object.keys(resource[language]).forEach((ns) => {
75
+ i18Next.addResourceBundle(language, ns, resource[language][ns]);
76
+ });
77
+ });
78
+ });
79
+ }
80
+ setLoaded(true);
81
+ }, [
82
+ resourceExtensions
83
+ ]);
84
+ return /* @__PURE__ */ React.createElement(TranslationsContext.Provider, {
85
+ value: {
86
+ appNs: appNs ?? initialNs,
87
+ dtLocale: dtLocale ?? initialDtLocale
88
+ }
89
+ }, /* @__PURE__ */ React.createElement(Suspense, {
90
+ fallback
91
+ }, loaded ? children : fallback));
92
+ };
93
+
94
+ // packages/ui/react-ui/src/hooks/useTranslationsContext.ts
95
+ var useTranslationsContext = () => useContext4(TranslationsContext);
96
+
97
+ // packages/ui/react-ui/src/hooks/useThemeContext.ts
98
+ import { useContext as useContext5 } from "react";
99
+ import { raise } from "@dxos/debug";
100
+ var useThemeContext = () => useContext5(ThemeContext) ?? raise(new Error("Missing ThemeContext"));
101
+
102
+ // packages/ui/react-ui/src/hooks/useVisualViewport.ts
103
+ import { useEffect as useEffect2, useState as useState2 } from "react";
104
+ var useVisualViewport = (deps) => {
105
+ const [width, setWidth] = useState2(null);
106
+ const [height, setHeight] = useState2(null);
107
+ useEffect2(() => {
108
+ const handleResize = () => {
109
+ if (window.visualViewport) {
110
+ setWidth(window.visualViewport.width);
111
+ setHeight(window.visualViewport.height);
112
+ }
113
+ };
114
+ window.visualViewport?.addEventListener("resize", handleResize);
115
+ handleResize();
116
+ return () => window.visualViewport?.removeEventListener("resize", handleResize);
117
+ }, deps ?? []);
118
+ return {
119
+ width,
120
+ height
121
+ };
122
+ };
123
+
124
+ // packages/ui/react-ui/src/components/AnchoredOverflow/AnchoredOverflow.tsx
125
+ var AnchoredOverflowRoot = /* @__PURE__ */ forwardRef(({ asChild, classNames, children, ...props }, forwardedRef) => {
126
+ const { tx } = useThemeContext();
127
+ const Root3 = asChild ? Slot : Primitive.div;
128
+ return /* @__PURE__ */ React2.createElement(Root3, {
129
+ role: "none",
130
+ ...props,
131
+ className: tx("anchoredOverflow.root", "overflow-anchored", {}, classNames),
132
+ ref: forwardedRef
133
+ }, children);
134
+ });
135
+ var AnchoredOverflowAnchor = /* @__PURE__ */ forwardRef(({ asChild, classNames, children, ...props }, forwardedRef) => {
136
+ const { tx } = useThemeContext();
137
+ const Root3 = asChild ? Slot : Primitive.div;
138
+ return /* @__PURE__ */ React2.createElement(Root3, {
139
+ role: "none",
140
+ ...props,
141
+ className: tx("anchoredOverflow.anchor", "overflow-anchor", {}, classNames),
142
+ ref: forwardedRef
143
+ }, children);
144
+ });
145
+ var AnchoredOverflow = {
146
+ Root: AnchoredOverflowRoot,
147
+ Anchor: AnchoredOverflowAnchor
148
+ };
149
+
150
+ // packages/ui/react-ui/src/components/Avatars/Avatar.tsx
151
+ import { Root as AvatarRootPrimitive, Fallback as AvatarFallbackPrimitive } from "@radix-ui/react-avatar";
152
+ import { createContext as createContext2 } from "@radix-ui/react-context";
153
+ import { Primitive as Primitive2 } from "@radix-ui/react-primitive";
154
+ import { Slot as Slot2 } from "@radix-ui/react-slot";
155
+ import React4, { forwardRef as forwardRef3 } from "react";
156
+ import { useId } from "@dxos/react-hooks";
157
+
158
+ // packages/ui/react-ui/src/components/Icon/Icon.tsx
159
+ import React3, { forwardRef as forwardRef2 } from "react";
160
+ var Icon = /* @__PURE__ */ forwardRef2(({ icon, classNames, size, ...props }, forwardedRef) => {
161
+ const { tx } = useThemeContext();
162
+ return /* @__PURE__ */ React3.createElement("svg", {
163
+ ...props,
164
+ className: tx("icon.root", "icon", {
165
+ size
166
+ }, classNames),
167
+ ref: forwardedRef
168
+ }, /* @__PURE__ */ React3.createElement("use", {
169
+ href: `/icons.svg#${icon}`
170
+ }));
171
+ });
172
+
173
+ // packages/ui/react-ui/src/components/Avatars/Avatar.tsx
174
+ var AVATAR_NAME = "Avatar";
175
+ var [AvatarProvider, useAvatarContext] = createContext2(AVATAR_NAME);
176
+ var AvatarRoot = ({ size = 10, variant = "circle", status, animation, children, labelId: propsLabelId, descriptionId: propsDescriptionId, maskId: propsMaskId, inGroup, hue }) => {
177
+ const labelId = useId("avatar__label", propsLabelId);
178
+ const descriptionId = useId("avatar__description", propsDescriptionId);
179
+ const maskId = useId("avatar__mask", propsMaskId);
180
+ return /* @__PURE__ */ React4.createElement(AvatarProvider, {
181
+ labelId,
182
+ descriptionId,
183
+ maskId,
184
+ size,
185
+ variant,
186
+ status,
187
+ animation,
188
+ inGroup,
189
+ hue
190
+ }, children);
191
+ };
192
+ var rx = "0.25rem";
193
+ var AvatarFrame = /* @__PURE__ */ forwardRef3(({ classNames, children, ...props }, forwardedRef) => {
194
+ const { size, variant, labelId, descriptionId, maskId, inGroup, status, animation, hue } = useAvatarContext("AvatarFrame");
195
+ const { tx } = useThemeContext();
196
+ const numericSize = size === "px" ? 1 : Number(size);
197
+ const sizePx = numericSize * 4;
198
+ const ringWidth = status ? numericSize > 4 ? 2 : numericSize > 3 ? 1 : 1 : 0;
199
+ const ringGap = status ? numericSize > 12 ? 3 : numericSize > 4 ? 2 : numericSize > 3 ? 1 : 0 : 0;
200
+ const r = sizePx / 2 - ringGap - ringWidth;
201
+ return /* @__PURE__ */ React4.createElement(AvatarRootPrimitive, {
202
+ role: "img",
203
+ ...props,
204
+ className: tx("avatar.root", "avatar", {
205
+ size,
206
+ variant,
207
+ inGroup
208
+ }, classNames),
209
+ ref: forwardedRef,
210
+ ...!inGroup && {
211
+ "aria-labelledby": labelId,
212
+ "aria-describedby": descriptionId
213
+ }
214
+ }, /* @__PURE__ */ React4.createElement("svg", {
215
+ viewBox: `0 0 ${sizePx} ${sizePx}`,
216
+ width: sizePx,
217
+ height: sizePx,
218
+ className: tx("avatar.frame", "avatar__frame", {
219
+ variant
220
+ })
221
+ }, /* @__PURE__ */ React4.createElement("defs", null, /* @__PURE__ */ React4.createElement("mask", {
222
+ id: maskId
223
+ }, variant === "circle" ? /* @__PURE__ */ React4.createElement("circle", {
224
+ fill: "white",
225
+ cx: "50%",
226
+ cy: "50%",
227
+ r
228
+ }) : /* @__PURE__ */ React4.createElement("rect", {
229
+ fill: "white",
230
+ width: 2 * r,
231
+ height: 2 * r,
232
+ x: ringGap + ringWidth,
233
+ y: ringGap + ringWidth,
234
+ rx
235
+ }))), variant === "circle" ? /* @__PURE__ */ React4.createElement("circle", {
236
+ className: hue ? tx("hue.fill", "avatar__frame__circle", {
237
+ hue
238
+ }) : "fill-[var(--surface-bg)]",
239
+ cx: "50%",
240
+ cy: "50%",
241
+ r
242
+ }) : /* @__PURE__ */ React4.createElement("rect", {
243
+ className: hue ? tx("hue.fill", "avatar__frame__rect", {
244
+ hue
245
+ }) : "fill-[var(--surface-bg)]",
246
+ x: ringGap + ringWidth,
247
+ y: ringGap + ringWidth,
248
+ width: 2 * r,
249
+ height: 2 * r,
250
+ rx
251
+ }), children), /* @__PURE__ */ React4.createElement("span", {
252
+ role: "none",
253
+ className: tx("avatar.ring", "avatar__ring", {
254
+ size,
255
+ variant,
256
+ status,
257
+ animation
258
+ }),
259
+ style: {
260
+ borderWidth: ringWidth + "px"
261
+ }
262
+ }));
263
+ });
264
+ var AvatarLabel = /* @__PURE__ */ forwardRef3(({ asChild, srOnly, classNames, ...props }, forwardedRef) => {
265
+ const Root3 = asChild ? Slot2 : Primitive2.span;
266
+ const { tx } = useThemeContext();
267
+ const { labelId } = useAvatarContext("AvatarLabel");
268
+ return /* @__PURE__ */ React4.createElement(Root3, {
269
+ ...props,
270
+ id: labelId,
271
+ ref: forwardedRef,
272
+ className: tx("avatar.label", "avatar__label", {
273
+ srOnly
274
+ }, classNames)
275
+ });
276
+ });
277
+ var AvatarDescription = /* @__PURE__ */ forwardRef3(({ asChild, srOnly, classNames, ...props }, forwardedRef) => {
278
+ const Root3 = asChild ? Slot2 : Primitive2.span;
279
+ const { tx } = useThemeContext();
280
+ const { descriptionId } = useAvatarContext("AvatarDescription");
281
+ return /* @__PURE__ */ React4.createElement(Root3, {
282
+ ...props,
283
+ id: descriptionId,
284
+ ref: forwardedRef,
285
+ className: tx("avatar.description", "avatar__description", {
286
+ srOnly
287
+ }, classNames)
288
+ });
289
+ });
290
+ var AvatarMaskedImage = /* @__PURE__ */ forwardRef3((props, forwardedRef) => {
291
+ const { maskId } = useAvatarContext("AvatarFallback");
292
+ return /* @__PURE__ */ React4.createElement("image", {
293
+ width: "100%",
294
+ height: "100%",
295
+ ...props,
296
+ mask: `url(#${maskId})`,
297
+ ref: forwardedRef,
298
+ preserveAspectRatio: "xMidYMid slice"
299
+ });
300
+ });
301
+ var AvatarMaskedText = (props) => {
302
+ const { maskId, size } = useAvatarContext("AvatarFallback");
303
+ const { large } = props;
304
+ const fontScale = (large ? 4 : 3) * (1 / 1.612);
305
+ const { tx } = useThemeContext();
306
+ return /* @__PURE__ */ React4.createElement("text", {
307
+ x: "50%",
308
+ y: "50%",
309
+ className: tx("avatar.fallbackText", "avatar__fallback-text"),
310
+ textAnchor: "middle",
311
+ alignmentBaseline: "central",
312
+ fontSize: size === "px" ? "200%" : size * fontScale,
313
+ mask: `url(#${maskId})`
314
+ }, props.children);
315
+ };
316
+ var AvatarImage = /* @__PURE__ */ forwardRef3(({ onLoadingStatusChange, ...props }, forwardedRef) => {
317
+ const { size } = useAvatarContext("AvatarImage");
318
+ const pxSize = size === "px" ? 1 : size * 4;
319
+ if (pxSize <= 20) {
320
+ return null;
321
+ }
322
+ return /* @__PURE__ */ React4.createElement(AvatarFallbackPrimitive, {
323
+ asChild: true
324
+ }, /* @__PURE__ */ React4.createElement(AvatarMaskedImage, {
325
+ ...props,
326
+ ref: forwardedRef
327
+ }));
328
+ });
329
+ var AvatarIcon = /* @__PURE__ */ forwardRef3(({ onLoadingStatusChange, ...props }, forwardedRef) => {
330
+ const { size } = useAvatarContext("AvatarIcon");
331
+ const pxSize = size === "px" ? 1 : size * 4;
332
+ if (pxSize <= 20) {
333
+ return null;
334
+ }
335
+ return /* @__PURE__ */ React4.createElement(AvatarFallbackPrimitive, {
336
+ asChild: true
337
+ }, /* @__PURE__ */ React4.createElement(Icon, {
338
+ ...props,
339
+ ref: forwardedRef
340
+ }));
341
+ });
342
+ var AvatarFallback = /* @__PURE__ */ forwardRef3(({ delayMs, text, ...props }, forwardedRef) => {
343
+ const isTextOnly = Boolean(text && /[0-9a-zA-Z]+/.test(text));
344
+ const { size } = useAvatarContext("AvatarFallback");
345
+ const numericSize = size === "px" ? 1 : Number(size);
346
+ return /* @__PURE__ */ React4.createElement(AvatarFallbackPrimitive, {
347
+ delayMs,
348
+ asChild: true
349
+ }, /* @__PURE__ */ React4.createElement(React4.Fragment, null, numericSize >= 6 && /* @__PURE__ */ React4.createElement(AvatarMaskedImage, {
350
+ ...props,
351
+ ref: forwardedRef
352
+ }), text && /* @__PURE__ */ React4.createElement(AvatarMaskedText, {
353
+ large: !isTextOnly
354
+ }, text.toLocaleUpperCase())));
355
+ });
356
+ var Avatar = {
357
+ Root: AvatarRoot,
358
+ Frame: AvatarFrame,
359
+ Image: AvatarImage,
360
+ Icon: AvatarIcon,
361
+ Fallback: AvatarFallback,
362
+ Label: AvatarLabel,
363
+ Description: AvatarDescription
364
+ };
365
+
366
+ // packages/ui/react-ui/src/components/Avatars/AvatarGroup.tsx
367
+ import React5, { forwardRef as forwardRef4 } from "react";
368
+ import { useId as useId2 } from "@dxos/react-hooks";
369
+ var AvatarGroupRoot = /* @__PURE__ */ forwardRef4(({ labelId: propsLabelId, descriptionId: propsDescriptionId, size, variant, children, classNames }, forwardedRef) => {
370
+ const { tx } = useThemeContext();
371
+ const labelId = useId2("avatar-group__label", propsLabelId);
372
+ const descriptionId = useId2("avatar-group__description", propsDescriptionId);
373
+ return /* @__PURE__ */ React5.createElement(Avatar.Root, {
374
+ labelId,
375
+ descriptionId,
376
+ size,
377
+ variant,
378
+ inGroup: true
379
+ }, /* @__PURE__ */ React5.createElement("div", {
380
+ role: "group",
381
+ className: tx("avatar.group", "avatar-group", {}, classNames),
382
+ "aria-labelledby": labelId,
383
+ "aria-describedby": descriptionId,
384
+ ref: forwardedRef
385
+ }, children));
386
+ });
387
+ var AvatarGroupItemRoot = ({ maskId, size, variant, status, children, ...rest }) => {
388
+ const { labelId, descriptionId, size: contextSize, variant: contextVariant } = useAvatarContext("AvatarGroupItemRoot");
389
+ return /* @__PURE__ */ React5.createElement(Avatar.Root, {
390
+ labelId,
391
+ descriptionId,
392
+ maskId,
393
+ status,
394
+ size: size ?? contextSize,
395
+ variant: variant ?? contextVariant,
396
+ inGroup: true,
397
+ ...rest
398
+ }, children);
399
+ };
400
+ var AvatarGroupLabel = /* @__PURE__ */ forwardRef4(({ srOnly, classNames, children, ...props }, forwardedRef) => {
401
+ const { labelId, size } = useAvatarContext("AvatarGroupLabel");
402
+ const { tx } = useThemeContext();
403
+ return /* @__PURE__ */ React5.createElement("span", {
404
+ ...props,
405
+ id: labelId,
406
+ className: tx("avatar.groupLabel", "avatar-group__label", {
407
+ srOnly,
408
+ size
409
+ }, classNames)
410
+ }, children);
411
+ });
412
+ var AvatarGroupDescription = /* @__PURE__ */ forwardRef4(({ srOnly, classNames, children, ...props }, forwardedRef) => {
413
+ const { descriptionId } = useAvatarContext("AvatarGroupDescription");
414
+ const { tx } = useThemeContext();
415
+ return /* @__PURE__ */ React5.createElement("span", {
416
+ ...props,
417
+ id: descriptionId,
418
+ className: tx("avatar.groupDescription", "avatar-group__description", {
419
+ srOnly
420
+ }, classNames)
421
+ }, children);
422
+ });
423
+ var AvatarGroup = {
424
+ Root: AvatarGroupRoot,
425
+ Label: AvatarGroupLabel,
426
+ Description: AvatarGroupDescription
427
+ };
428
+ var AvatarGroupItem = {
429
+ Root: AvatarGroupItemRoot
430
+ };
431
+
432
+ // packages/ui/react-ui/src/components/Breadcrumb/Breadcrumb.tsx
433
+ import { Dot } from "@phosphor-icons/react";
434
+ import { Primitive as Primitive4 } from "@radix-ui/react-primitive";
435
+ import { Slot as Slot4 } from "@radix-ui/react-slot";
436
+ import React7, { forwardRef as forwardRef6 } from "react";
437
+
438
+ // packages/ui/react-ui/src/components/Link/Link.tsx
439
+ import { Primitive as Primitive3 } from "@radix-ui/react-primitive";
440
+ import { Slot as Slot3 } from "@radix-ui/react-slot";
441
+ import React6, { forwardRef as forwardRef5 } from "react";
442
+ var Link = /* @__PURE__ */ forwardRef5(({ asChild, variant, classNames, ...props }, forwardedRef) => {
443
+ const { tx } = useThemeContext();
444
+ const Root3 = asChild ? Slot3 : Primitive3.a;
445
+ return /* @__PURE__ */ React6.createElement(Root3, {
446
+ ...props,
447
+ className: tx("link.root", "link", {
448
+ variant
449
+ }, classNames),
450
+ ref: forwardedRef
451
+ });
452
+ });
453
+
454
+ // packages/ui/react-ui/src/components/Breadcrumb/Breadcrumb.tsx
455
+ var BreadcrumbRoot = /* @__PURE__ */ forwardRef6(({ asChild, classNames, ...props }, forwardedRef) => {
456
+ const { tx } = useThemeContext();
457
+ const Root3 = asChild ? Slot4 : Primitive4.div;
458
+ return /* @__PURE__ */ React7.createElement(Root3, {
459
+ role: "navigation",
460
+ ...props,
461
+ className: tx("breadcrumb.root", "breadcrumb", {}, classNames),
462
+ ref: forwardedRef
463
+ });
464
+ });
465
+ var BreadcrumbList = /* @__PURE__ */ forwardRef6(({ asChild, classNames, ...props }, forwardedRef) => {
466
+ const { tx } = useThemeContext();
467
+ const Root3 = asChild ? Slot4 : Primitive4.ol;
468
+ return /* @__PURE__ */ React7.createElement(Root3, {
469
+ role: "list",
470
+ ...props,
471
+ className: tx("breadcrumb.list", "breadcrumb__list", {}, classNames),
472
+ ref: forwardedRef
473
+ });
474
+ });
475
+ var BreadcrumbListItem = /* @__PURE__ */ forwardRef6(({ asChild, classNames, ...props }, forwardedRef) => {
476
+ const { tx } = useThemeContext();
477
+ const Root3 = asChild ? Slot4 : Primitive4.li;
478
+ return /* @__PURE__ */ React7.createElement(Root3, {
479
+ role: "listitem",
480
+ ...props,
481
+ className: tx("breadcrumb.listItem", "breadcrumb__list__item", {}, classNames),
482
+ ref: forwardedRef
483
+ });
484
+ });
485
+ var BreadcrumbLink = /* @__PURE__ */ forwardRef6(({ asChild, ...props }, forwardedRef) => {
486
+ const Root3 = asChild ? Slot4 : Link;
487
+ return /* @__PURE__ */ React7.createElement(Root3, {
488
+ ...props,
489
+ ref: forwardedRef
490
+ });
491
+ });
492
+ var BreadcrumbCurrent = /* @__PURE__ */ forwardRef6(({ asChild, classNames, ...props }, forwardedRef) => {
493
+ const { tx } = useThemeContext();
494
+ const Root3 = asChild ? Slot4 : "h1";
495
+ return /* @__PURE__ */ React7.createElement(Root3, {
496
+ ...props,
497
+ "aria-current": "page",
498
+ className: tx("breadcrumb.current", "breadcrumb__item__heading--current", {}, classNames),
499
+ ref: forwardedRef
500
+ });
501
+ });
502
+ var BreadcrumbSeparator = ({ children, classNames, ...props }) => {
503
+ const { tx } = useThemeContext();
504
+ return /* @__PURE__ */ React7.createElement(Primitive4.span, {
505
+ role: "separator",
506
+ "aria-hidden": "true",
507
+ ...props,
508
+ className: tx("breadcrumb.separator", "breadcrumb__separator", {}, classNames)
509
+ }, children ?? /* @__PURE__ */ React7.createElement(Dot, {
510
+ weight: "bold"
511
+ }));
512
+ };
513
+ var Breadcrumb = {
514
+ Root: BreadcrumbRoot,
515
+ List: BreadcrumbList,
516
+ ListItem: BreadcrumbListItem,
517
+ Link: BreadcrumbLink,
518
+ Current: BreadcrumbCurrent,
519
+ Separator: BreadcrumbSeparator
520
+ };
521
+
522
+ // packages/ui/react-ui/src/components/Buttons/Button.tsx
523
+ import { createContext as createContext3 } from "@radix-ui/react-context";
524
+ import { Primitive as Primitive5 } from "@radix-ui/react-primitive";
525
+ import { Slot as Slot5 } from "@radix-ui/react-slot";
526
+ import React8, { forwardRef as forwardRef7 } from "react";
527
+ var BUTTON_GROUP_NAME = "ButtonGroup";
528
+ var BUTTON_NAME = "Button";
529
+ var [ButtonGroupProvider, useButtonGroupContext] = createContext3(BUTTON_GROUP_NAME, {
530
+ inGroup: false
531
+ });
532
+ var Button = /* @__PURE__ */ forwardRef7(({ classNames, children, density: propsDensity, elevation: propsElevation, variant = "default", asChild, ...props }, ref) => {
533
+ const { inGroup } = useButtonGroupContext(BUTTON_NAME);
534
+ const { tx } = useThemeContext();
535
+ const elevation = useElevationContext(propsElevation);
536
+ const density = useDensityContext(propsDensity);
537
+ const Root3 = asChild ? Slot5 : Primitive5.button;
538
+ return /* @__PURE__ */ React8.createElement(Root3, {
539
+ ref,
540
+ ...props,
541
+ "data-variant": variant,
542
+ "data-density": density,
543
+ "data-props": inGroup ? "grouped" : "",
544
+ className: tx("button.root", "button", {
545
+ variant,
546
+ inGroup,
547
+ disabled: props.disabled,
548
+ density,
549
+ elevation
550
+ }, classNames),
551
+ ...props.disabled && {
552
+ disabled: true
553
+ }
554
+ }, children);
555
+ });
556
+ Button.displayName = BUTTON_NAME;
557
+ var ButtonGroup = /* @__PURE__ */ forwardRef7(({ children, elevation: propsElevation, classNames, asChild, ...props }, forwardedRef) => {
558
+ const { tx } = useThemeContext();
559
+ const elevation = useElevationContext(propsElevation);
560
+ const Root3 = asChild ? Slot5 : Primitive5.div;
561
+ return /* @__PURE__ */ React8.createElement(Root3, {
562
+ role: "none",
563
+ ...props,
564
+ className: tx("button.group", "button-group", {
565
+ elevation
566
+ }, classNames),
567
+ ref: forwardedRef
568
+ }, /* @__PURE__ */ React8.createElement(ButtonGroupProvider, {
569
+ inGroup: true
570
+ }, children));
571
+ });
572
+ ButtonGroup.displayName = BUTTON_GROUP_NAME;
573
+
574
+ // packages/ui/react-ui/src/components/Buttons/Toggle.tsx
575
+ import { Toggle as TogglePrimitive } from "@radix-ui/react-toggle";
576
+ import React9, { forwardRef as forwardRef8 } from "react";
577
+ var Toggle = /* @__PURE__ */ forwardRef8(({ defaultPressed, pressed, onPressedChange, ...props }, forwardedRef) => {
578
+ return /* @__PURE__ */ React9.createElement(TogglePrimitive, {
579
+ defaultPressed,
580
+ pressed,
581
+ onPressedChange,
582
+ asChild: true
583
+ }, /* @__PURE__ */ React9.createElement(Button, {
584
+ ...props,
585
+ ref: forwardedRef
586
+ }));
587
+ });
588
+
589
+ // packages/ui/react-ui/src/components/Buttons/ToggleGroup.tsx
590
+ import { ToggleGroup as ToggleGroupPrimitive, ToggleGroupItem as ToggleGroupItemPrimitive } from "@radix-ui/react-toggle-group";
591
+ import React10, { forwardRef as forwardRef9 } from "react";
592
+ var ToggleGroup = /* @__PURE__ */ forwardRef9(({ classNames, children, ...props }, forwardedRef) => {
593
+ return /* @__PURE__ */ React10.createElement(ToggleGroupPrimitive, {
594
+ ...props,
595
+ asChild: true
596
+ }, /* @__PURE__ */ React10.createElement(ButtonGroup, {
597
+ classNames,
598
+ children,
599
+ ref: forwardedRef
600
+ }));
601
+ });
602
+ var ToggleGroupItem = /* @__PURE__ */ forwardRef9(({ variant, elevation, density, classNames, children, ...props }, forwardedRef) => {
603
+ return /* @__PURE__ */ React10.createElement(ToggleGroupItemPrimitive, {
604
+ ...props,
605
+ asChild: true
606
+ }, /* @__PURE__ */ React10.createElement(Button, {
607
+ variant,
608
+ elevation,
609
+ density,
610
+ classNames,
611
+ children,
612
+ ref: forwardedRef
613
+ }));
614
+ });
615
+
616
+ // packages/ui/react-ui/src/components/Dialogs/Dialog.tsx
617
+ import { createContext as createContext5 } from "@radix-ui/react-context";
618
+ import { Root as DialogRootPrimitive, DialogTrigger as DialogTriggerPrimitive, DialogPortal as DialogPortalPrimitive, DialogOverlay as DialogOverlayPrimitive, DialogTitle as DialogTitlePrimitive, DialogDescription as DialogDescriptionPrimitive, DialogClose as DialogClosePrimitive, DialogContent as DialogContentPrimitive } from "@radix-ui/react-dialog";
619
+ import React12, { forwardRef as forwardRef10 } from "react";
620
+
621
+ // packages/ui/react-ui/src/components/ElevationProvider/ElevationProvider.tsx
622
+ import React11, { createContext as createContext4 } from "react";
623
+ var ElevationContext = /* @__PURE__ */ createContext4({
624
+ elevation: "base"
625
+ });
626
+ var ElevationProvider = ({ elevation, children }) => /* @__PURE__ */ React11.createElement(ElevationContext.Provider, {
627
+ value: {
628
+ elevation
629
+ }
630
+ }, children);
631
+
632
+ // packages/ui/react-ui/src/components/Dialogs/Dialog.tsx
633
+ var DialogRoot = DialogRootPrimitive;
634
+ var DialogTrigger = DialogTriggerPrimitive;
635
+ var DialogPortal = DialogPortalPrimitive;
636
+ var DialogTitle = /* @__PURE__ */ forwardRef10(({ classNames, srOnly, ...props }, forwardedRef) => {
637
+ const { tx } = useThemeContext();
638
+ return /* @__PURE__ */ React12.createElement(DialogTitlePrimitive, {
639
+ ...props,
640
+ className: tx("dialog.title", "dialog__title", {
641
+ srOnly
642
+ }, classNames),
643
+ ref: forwardedRef
644
+ });
645
+ });
646
+ var DialogDescription = /* @__PURE__ */ forwardRef10(({ classNames, srOnly, ...props }, forwardedRef) => {
647
+ const { tx } = useThemeContext();
648
+ return /* @__PURE__ */ React12.createElement(DialogDescriptionPrimitive, {
649
+ ...props,
650
+ className: tx("dialog.description", "dialog__description", {
651
+ srOnly
652
+ }, classNames),
653
+ ref: forwardedRef
654
+ });
655
+ });
656
+ var DialogClose = DialogClosePrimitive;
657
+ var DIALOG_OVERLAY_NAME = "DialogOverlay";
658
+ var DIALOG_CONTENT_NAME = "DialogContent";
659
+ var [OverlayLayoutProvider, useOverlayLayoutContext] = createContext5(DIALOG_OVERLAY_NAME, {
660
+ inOverlayLayout: false
661
+ });
662
+ var DialogOverlay = /* @__PURE__ */ forwardRef10(({ classNames, children, blockAlign, ...props }, forwardedRef) => {
663
+ const { tx } = useThemeContext();
664
+ return /* @__PURE__ */ React12.createElement(DialogOverlayPrimitive, {
665
+ ...props,
666
+ className: tx("dialog.overlay", "dialog__overlay", {}, classNames, "data-[block-align=start]:justify-center", "data-[block-align=start]:items-start", "data-[block-align=center]:place-content-center"),
667
+ ref: forwardedRef,
668
+ "data-block-align": blockAlign
669
+ }, /* @__PURE__ */ React12.createElement(OverlayLayoutProvider, {
670
+ inOverlayLayout: true
671
+ }, children));
672
+ });
673
+ DialogOverlay.displayName = DIALOG_OVERLAY_NAME;
674
+ var DialogContent = /* @__PURE__ */ forwardRef10(({ classNames, children, ...props }, forwardedRef) => {
675
+ const { tx } = useThemeContext();
676
+ const { inOverlayLayout } = useOverlayLayoutContext(DIALOG_CONTENT_NAME);
677
+ return /* @__PURE__ */ React12.createElement(DialogContentPrimitive, {
678
+ ...props,
679
+ className: tx("dialog.content", "dialog", {
680
+ inOverlayLayout
681
+ }, classNames),
682
+ ref: forwardedRef
683
+ }, /* @__PURE__ */ React12.createElement(ElevationProvider, {
684
+ elevation: "chrome"
685
+ }, children));
686
+ });
687
+ DialogContent.displayName = DIALOG_CONTENT_NAME;
688
+ var Dialog = {
689
+ Root: DialogRoot,
690
+ Trigger: DialogTrigger,
691
+ Portal: DialogPortal,
692
+ Overlay: DialogOverlay,
693
+ Content: DialogContent,
694
+ Title: DialogTitle,
695
+ Description: DialogDescription,
696
+ Close: DialogClose
697
+ };
698
+
699
+ // packages/ui/react-ui/src/components/Dialogs/AlertDialog.tsx
700
+ import { Root as AlertDialogRootPrimitive, AlertDialogTrigger as AlertDialogTriggerPrimitive, AlertDialogPortal as AlertDialogPortalPrimitive, AlertDialogOverlay as AlertDialogOverlayPrimitive, AlertDialogTitle as AlertDialogTitlePrimitive, AlertDialogDescription as AlertDialogDescriptionPrimitive, AlertDialogAction as AlertDialogActionPrimitive, AlertDialogCancel as AlertDialogCancelPrimitive, AlertDialogContent as AlertDialogContentPrimitive } from "@radix-ui/react-alert-dialog";
701
+ import { createContext as createContext6 } from "@radix-ui/react-context";
702
+ import React13, { forwardRef as forwardRef11 } from "react";
703
+ var AlertDialogRoot = AlertDialogRootPrimitive;
704
+ var AlertDialogTrigger = AlertDialogTriggerPrimitive;
705
+ var AlertDialogPortal = AlertDialogPortalPrimitive;
706
+ var AlertDialogCancel = AlertDialogCancelPrimitive;
707
+ var AlertDialogAction = AlertDialogActionPrimitive;
708
+ var AlertDialogTitle = /* @__PURE__ */ forwardRef11(({ classNames, srOnly, ...props }, forwardedRef) => {
709
+ const { tx } = useThemeContext();
710
+ return /* @__PURE__ */ React13.createElement(AlertDialogTitlePrimitive, {
711
+ ...props,
712
+ className: tx("dialog.title", "dialog--alert__title", {
713
+ srOnly
714
+ }, classNames),
715
+ ref: forwardedRef
716
+ });
717
+ });
718
+ var AlertDialogDescription = /* @__PURE__ */ forwardRef11(({ classNames, srOnly, ...props }, forwardedRef) => {
719
+ const { tx } = useThemeContext();
720
+ return /* @__PURE__ */ React13.createElement(AlertDialogDescriptionPrimitive, {
721
+ ...props,
722
+ className: tx("dialog.description", "dialog--alert__description", {
723
+ srOnly
724
+ }, classNames),
725
+ ref: forwardedRef
726
+ });
727
+ });
728
+ var ALERT_DIALOG_OVERLAY_NAME = "AlertDialogOverlay";
729
+ var ALERT_DIALOG_CONTENT_NAME = "AlertDialogContent";
730
+ var [OverlayLayoutProvider2, useOverlayLayoutContext2] = createContext6(ALERT_DIALOG_OVERLAY_NAME, {
731
+ inOverlayLayout: false
732
+ });
733
+ var AlertDialogOverlay = /* @__PURE__ */ forwardRef11(({ classNames, children, ...props }, forwardedRef) => {
734
+ const { tx } = useThemeContext();
735
+ return /* @__PURE__ */ React13.createElement(AlertDialogOverlayPrimitive, {
736
+ ...props,
737
+ className: tx("dialog.overlay", "dialog--alert__overlay", {}, classNames),
738
+ ref: forwardedRef
739
+ }, /* @__PURE__ */ React13.createElement(OverlayLayoutProvider2, {
740
+ inOverlayLayout: true
741
+ }, children));
742
+ });
743
+ AlertDialogOverlay.displayName = ALERT_DIALOG_OVERLAY_NAME;
744
+ var AlertDialogContent = /* @__PURE__ */ forwardRef11(({ classNames, children, ...props }, forwardedRef) => {
745
+ const { tx } = useThemeContext();
746
+ const { inOverlayLayout } = useOverlayLayoutContext2(ALERT_DIALOG_CONTENT_NAME);
747
+ return /* @__PURE__ */ React13.createElement(AlertDialogContentPrimitive, {
748
+ ...props,
749
+ className: tx("dialog.content", "dialog--alert", {
750
+ inOverlayLayout
751
+ }, classNames),
752
+ ref: forwardedRef
753
+ }, /* @__PURE__ */ React13.createElement(ElevationProvider, {
754
+ elevation: "chrome"
755
+ }, children));
756
+ });
757
+ AlertDialogContent.displayName = ALERT_DIALOG_CONTENT_NAME;
758
+ var AlertDialog = {
759
+ Root: AlertDialogRoot,
760
+ Trigger: AlertDialogTrigger,
761
+ Portal: AlertDialogPortal,
762
+ Overlay: AlertDialogOverlay,
763
+ Content: AlertDialogContent,
764
+ Title: AlertDialogTitle,
765
+ Description: AlertDialogDescription,
766
+ Cancel: AlertDialogCancel,
767
+ Action: AlertDialogAction
768
+ };
769
+
770
+ // packages/ui/react-ui/src/components/Menus/ContextMenu.tsx
771
+ import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
772
+ import { Primitive as Primitive6 } from "@radix-ui/react-primitive";
773
+ import { Slot as Slot6 } from "@radix-ui/react-slot";
774
+ import React14, { forwardRef as forwardRef12 } from "react";
775
+ var ContextMenuRoot = ContextMenuPrimitive.ContextMenu;
776
+ var ContextMenuTrigger = ContextMenuPrimitive.Trigger;
777
+ var ContextMenuPortal = ContextMenuPrimitive.Portal;
778
+ var ContextMenuContent = /* @__PURE__ */ forwardRef12(({ classNames, children, ...props }, forwardedRef) => {
779
+ const { tx } = useThemeContext();
780
+ return /* @__PURE__ */ React14.createElement(ContextMenuPrimitive.Content, {
781
+ collisionPadding: 8,
782
+ ...props,
783
+ className: tx("menu.content", "menu", {}, classNames),
784
+ ref: forwardedRef
785
+ }, /* @__PURE__ */ React14.createElement(ElevationProvider, {
786
+ elevation: "chrome"
787
+ }, children));
788
+ });
789
+ var ContextMenuViewport = /* @__PURE__ */ forwardRef12(({ classNames, asChild, children, ...props }, forwardedRef) => {
790
+ const { tx } = useThemeContext();
791
+ const Root3 = asChild ? Slot6 : Primitive6.div;
792
+ return /* @__PURE__ */ React14.createElement(Root3, {
793
+ ...props,
794
+ className: tx("menu.viewport", "menu__viewport", {}, classNames),
795
+ ref: forwardedRef
796
+ }, children);
797
+ });
798
+ var ContextMenuArrow = /* @__PURE__ */ forwardRef12(({ classNames, ...props }, forwardedRef) => {
799
+ const { tx } = useThemeContext();
800
+ return /* @__PURE__ */ React14.createElement(ContextMenuPrimitive.Arrow, {
801
+ ...props,
802
+ className: tx("menu.arrow", "menu__arrow", {}, classNames),
803
+ ref: forwardedRef
804
+ });
805
+ });
806
+ var ContextMenuGroup = ContextMenuPrimitive.Group;
807
+ var ContextMenuItemIndicator = ContextMenuPrimitive.ItemIndicator;
808
+ var ContextMenuItem = /* @__PURE__ */ forwardRef12(({ classNames, ...props }, forwardedRef) => {
809
+ const { tx } = useThemeContext();
810
+ return /* @__PURE__ */ React14.createElement(ContextMenuPrimitive.Item, {
811
+ ...props,
812
+ className: tx("menu.item", "menu__item", {}, classNames),
813
+ ref: forwardedRef
814
+ });
815
+ });
816
+ var ContextMenuCheckboxItem = /* @__PURE__ */ forwardRef12(({ classNames, ...props }, forwardedRef) => {
817
+ const { tx } = useThemeContext();
818
+ return /* @__PURE__ */ React14.createElement(ContextMenuPrimitive.CheckboxItem, {
819
+ ...props,
820
+ className: tx("menu.item", "menu__item--checkbox", {}, classNames),
821
+ ref: forwardedRef
822
+ });
823
+ });
824
+ var ContextMenuSeparator = /* @__PURE__ */ forwardRef12(({ classNames, ...props }, forwardedRef) => {
825
+ const { tx } = useThemeContext();
826
+ return /* @__PURE__ */ React14.createElement(ContextMenuPrimitive.Separator, {
827
+ ...props,
828
+ className: tx("menu.separator", "menu__item", {}, classNames),
829
+ ref: forwardedRef
830
+ });
831
+ });
832
+ var ContextMenuGroupLabel = /* @__PURE__ */ forwardRef12(({ classNames, ...props }, forwardedRef) => {
833
+ const { tx } = useThemeContext();
834
+ return /* @__PURE__ */ React14.createElement(ContextMenuPrimitive.Label, {
835
+ ...props,
836
+ className: tx("menu.groupLabel", "menu__group__label", {}, classNames),
837
+ ref: forwardedRef
838
+ });
839
+ });
840
+ var ContextMenu2 = {
841
+ Root: ContextMenuRoot,
842
+ Trigger: ContextMenuTrigger,
843
+ Portal: ContextMenuPortal,
844
+ Content: ContextMenuContent,
845
+ Viewport: ContextMenuViewport,
846
+ Arrow: ContextMenuArrow,
847
+ Group: ContextMenuGroup,
848
+ Item: ContextMenuItem,
849
+ CheckboxItem: ContextMenuCheckboxItem,
850
+ ItemIndicator: ContextMenuItemIndicator,
851
+ Separator: ContextMenuSeparator,
852
+ GroupLabel: ContextMenuGroupLabel
853
+ };
854
+
855
+ // packages/ui/react-ui/src/components/Menus/DropdownMenu.tsx
856
+ import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
857
+ import { Primitive as Primitive7 } from "@radix-ui/react-primitive";
858
+ import { Slot as Slot7 } from "@radix-ui/react-slot";
859
+ import React15, { forwardRef as forwardRef13 } from "react";
860
+ var DropdownMenuRoot = DropdownMenuPrimitive.DropdownMenu;
861
+ var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
862
+ var DropdownMenuPortal = DropdownMenuPrimitive.Portal;
863
+ var useDropdownMenuContext2 = DropdownMenuPrimitive.useDropdownMenuContext;
864
+ var useDropdownMenuMenuScope2 = DropdownMenuPrimitive.useDropdownMenuMenuScope;
865
+ var DropdownMenuContent = /* @__PURE__ */ forwardRef13(({ classNames, children, ...props }, forwardedRef) => {
866
+ const { tx } = useThemeContext();
867
+ return /* @__PURE__ */ React15.createElement(DropdownMenuPrimitive.Content, {
868
+ sideOffset: 4,
869
+ collisionPadding: 8,
870
+ ...props,
871
+ className: tx("menu.content", "menu", {}, classNames),
872
+ ref: forwardedRef
873
+ }, /* @__PURE__ */ React15.createElement(ElevationProvider, {
874
+ elevation: "chrome"
875
+ }, children));
876
+ });
877
+ var DropdownMenuViewport = /* @__PURE__ */ forwardRef13(({ classNames, asChild, children, ...props }, forwardedRef) => {
878
+ const { tx } = useThemeContext();
879
+ const Root3 = asChild ? Slot7 : Primitive7.div;
880
+ return /* @__PURE__ */ React15.createElement(Root3, {
881
+ ...props,
882
+ className: tx("menu.viewport", "menu__viewport", {}, classNames),
883
+ ref: forwardedRef
884
+ }, children);
885
+ });
886
+ var DropdownMenuArrow = /* @__PURE__ */ forwardRef13(({ classNames, ...props }, forwardedRef) => {
887
+ const { tx } = useThemeContext();
888
+ return /* @__PURE__ */ React15.createElement(DropdownMenuPrimitive.Arrow, {
889
+ ...props,
890
+ className: tx("menu.arrow", "menu__arrow", {}, classNames),
891
+ ref: forwardedRef
892
+ });
893
+ });
894
+ var DropdownMenuGroup = DropdownMenuPrimitive.Group;
895
+ var DropdownMenuItemIndicator = DropdownMenuPrimitive.ItemIndicator;
896
+ var DropdownMenuItem = /* @__PURE__ */ forwardRef13(({ classNames, ...props }, forwardedRef) => {
897
+ const { tx } = useThemeContext();
898
+ return /* @__PURE__ */ React15.createElement(DropdownMenuPrimitive.Item, {
899
+ ...props,
900
+ className: tx("menu.item", "menu__item", {}, classNames),
901
+ ref: forwardedRef
902
+ });
903
+ });
904
+ var DropdownMenuCheckboxItem = /* @__PURE__ */ forwardRef13(({ classNames, ...props }, forwardedRef) => {
905
+ const { tx } = useThemeContext();
906
+ return /* @__PURE__ */ React15.createElement(DropdownMenuPrimitive.CheckboxItem, {
907
+ ...props,
908
+ className: tx("menu.item", "menu__item--checkbox", {}, classNames),
909
+ ref: forwardedRef
910
+ });
911
+ });
912
+ var DropdownMenuSeparator = /* @__PURE__ */ forwardRef13(({ classNames, ...props }, forwardedRef) => {
913
+ const { tx } = useThemeContext();
914
+ return /* @__PURE__ */ React15.createElement(DropdownMenuPrimitive.Separator, {
915
+ ...props,
916
+ className: tx("menu.separator", "menu__item", {}, classNames),
917
+ ref: forwardedRef
918
+ });
919
+ });
920
+ var DropdownMenuGroupLabel = /* @__PURE__ */ forwardRef13(({ classNames, ...props }, forwardedRef) => {
921
+ const { tx } = useThemeContext();
922
+ return /* @__PURE__ */ React15.createElement(DropdownMenuPrimitive.Label, {
923
+ ...props,
924
+ className: tx("menu.groupLabel", "menu__group__label", {}, classNames),
925
+ ref: forwardedRef
926
+ });
927
+ });
928
+ var DropdownMenu2 = {
929
+ Root: DropdownMenuRoot,
930
+ Trigger: DropdownMenuTrigger,
931
+ Portal: DropdownMenuPortal,
932
+ Content: DropdownMenuContent,
933
+ Viewport: DropdownMenuViewport,
934
+ Arrow: DropdownMenuArrow,
935
+ Group: DropdownMenuGroup,
936
+ Item: DropdownMenuItem,
937
+ CheckboxItem: DropdownMenuCheckboxItem,
938
+ ItemIndicator: DropdownMenuItemIndicator,
939
+ Separator: DropdownMenuSeparator,
940
+ GroupLabel: DropdownMenuGroupLabel
941
+ };
942
+
943
+ // packages/ui/react-ui/src/components/Input/Input.tsx
944
+ import { Check, Minus } from "@phosphor-icons/react";
945
+ import { Root as CheckboxPrimitive, Indicator as CheckboxIndicatorPrimitive } from "@radix-ui/react-checkbox";
946
+ import { Root as SwitchPrimitive, Thumb as SwitchThumbPrimitive } from "@radix-ui/react-switch";
947
+ import { useControllableState } from "@radix-ui/react-use-controllable-state";
948
+ import React16, { forwardRef as forwardRef14, Fragment, useCallback } from "react";
949
+ import { InputRoot, PinInput as PinInputPrimitive, TextInput as TextInputPrimitive, TextArea as TextAreaPrimitive, useInputContext, INPUT_NAME, Description as DescriptionPrimitive, DescriptionAndValidation as DescriptionAndValidationPrimitive, Label as LabelPrimitive, Validation as ValidationPrimitive } from "@dxos/react-input";
950
+ var Label3 = /* @__PURE__ */ forwardRef14(({ srOnly, classNames, children, ...props }, forwardedRef) => {
951
+ const { tx } = useThemeContext();
952
+ return /* @__PURE__ */ React16.createElement(LabelPrimitive, {
953
+ ...props,
954
+ className: tx("input.label", "input__label", {
955
+ srOnly
956
+ }, classNames),
957
+ ref: forwardedRef
958
+ }, children);
959
+ });
960
+ var Description = /* @__PURE__ */ forwardRef14(({ srOnly, classNames, children, ...props }, forwardedRef) => {
961
+ const { tx } = useThemeContext();
962
+ return /* @__PURE__ */ React16.createElement(DescriptionPrimitive, {
963
+ ...props,
964
+ className: tx("input.description", "input__description", {
965
+ srOnly
966
+ }, classNames),
967
+ ref: forwardedRef
968
+ }, children);
969
+ });
970
+ var Validation = /* @__PURE__ */ forwardRef14(({ __inputScope, srOnly, classNames, children, ...props }, forwardedRef) => {
971
+ const { tx } = useThemeContext();
972
+ const { validationValence } = useInputContext(INPUT_NAME, __inputScope);
973
+ return /* @__PURE__ */ React16.createElement(ValidationPrimitive, {
974
+ ...props,
975
+ className: tx("input.validation", `input__validation-message input__validation-message--${validationValence}`, {
976
+ srOnly,
977
+ validationValence
978
+ }, classNames),
979
+ ref: forwardedRef
980
+ }, children);
981
+ });
982
+ var DescriptionAndValidation = /* @__PURE__ */ forwardRef14(({ srOnly, classNames, children, ...props }, forwardedRef) => {
983
+ const { tx } = useThemeContext();
984
+ return /* @__PURE__ */ React16.createElement(DescriptionAndValidationPrimitive, {
985
+ ...props,
986
+ className: tx("input.descriptionAndValidation", "input__description-and-validation", {
987
+ srOnly
988
+ }, classNames),
989
+ ref: forwardedRef
990
+ }, children);
991
+ });
992
+ var PinInput = /* @__PURE__ */ forwardRef14(({ density: propsDensity, elevation: propsElevation, segmentClassName: propsSegmentClassName, inputClassName, variant, ...props }, forwardedRef) => {
993
+ const { hasIosKeyboard: hasIosKeyboard2 } = useThemeContext();
994
+ const { tx } = useThemeContext();
995
+ const density = useDensityContext(propsDensity);
996
+ const elevation = useElevationContext(propsElevation);
997
+ const segmentClassName = useCallback(({ focused, validationValence }) => tx("input.input", "input--pin-segment", {
998
+ variant: "static",
999
+ focused,
1000
+ disabled: props.disabled,
1001
+ density,
1002
+ elevation,
1003
+ validationValence
1004
+ }, propsSegmentClassName), [
1005
+ tx,
1006
+ props.disabled,
1007
+ elevation,
1008
+ propsElevation,
1009
+ density
1010
+ ]);
1011
+ return /* @__PURE__ */ React16.createElement(PinInputPrimitive, {
1012
+ ...props,
1013
+ segmentClassName,
1014
+ ...props.autoFocus && !hasIosKeyboard2 && {
1015
+ autoFocus: true
1016
+ },
1017
+ inputClassName: tx("input.inputWithSegments", "input input--pin", {
1018
+ disabled: props.disabled
1019
+ }, inputClassName),
1020
+ ref: forwardedRef
1021
+ });
1022
+ });
1023
+ var TextInput = /* @__PURE__ */ forwardRef14(({ __inputScope, classNames, density: propsDensity, elevation: propsElevation, variant, ...props }, forwardedRef) => {
1024
+ const { hasIosKeyboard: hasIosKeyboard2 } = useThemeContext();
1025
+ const themeContextValue = useThemeContext();
1026
+ const density = useDensityContext(propsDensity);
1027
+ const elevation = useElevationContext(propsElevation);
1028
+ const { validationValence } = useInputContext(INPUT_NAME, __inputScope);
1029
+ const { tx } = themeContextValue;
1030
+ return /* @__PURE__ */ React16.createElement(TextInputPrimitive, {
1031
+ ...props,
1032
+ className: tx("input.input", "input", {
1033
+ variant,
1034
+ disabled: props.disabled,
1035
+ density,
1036
+ elevation,
1037
+ validationValence
1038
+ }, classNames),
1039
+ ...props.autoFocus && !hasIosKeyboard2 && {
1040
+ autoFocus: true
1041
+ },
1042
+ ref: forwardedRef
1043
+ });
1044
+ });
1045
+ var TextArea = /* @__PURE__ */ forwardRef14(({ __inputScope, classNames, density: propsDensity, elevation: propsElevation, variant, ...props }, forwardedRef) => {
1046
+ const { hasIosKeyboard: hasIosKeyboard2 } = useThemeContext();
1047
+ const { tx } = useThemeContext();
1048
+ const density = useDensityContext(propsDensity);
1049
+ const elevation = useElevationContext(propsElevation);
1050
+ const { validationValence } = useInputContext(INPUT_NAME, __inputScope);
1051
+ return /* @__PURE__ */ React16.createElement(TextAreaPrimitive, {
1052
+ ...props,
1053
+ className: tx("input.input", "input--text-area", {
1054
+ variant,
1055
+ disabled: props.disabled,
1056
+ density,
1057
+ elevation,
1058
+ validationValence
1059
+ }, classNames),
1060
+ ...props.autoFocus && !hasIosKeyboard2 && {
1061
+ autoFocus: true
1062
+ },
1063
+ ref: forwardedRef
1064
+ });
1065
+ });
1066
+ var Checkbox = /* @__PURE__ */ forwardRef14(({ __inputScope, checked: propsChecked, defaultChecked: propsDefaultChecked, onCheckedChange: propsOnCheckedChange, size, weight = "bold", classNames, ...props }, forwardedRef) => {
1067
+ const [checked, onCheckedChange] = useControllableState({
1068
+ prop: propsChecked,
1069
+ defaultProp: propsDefaultChecked,
1070
+ onChange: propsOnCheckedChange
1071
+ });
1072
+ const { id, validationValence, descriptionId, errorMessageId } = useInputContext(INPUT_NAME, __inputScope);
1073
+ const { tx } = useThemeContext();
1074
+ const Icon3 = checked === "indeterminate" ? Minus : checked ? Check : Fragment;
1075
+ return /* @__PURE__ */ React16.createElement(CheckboxPrimitive, {
1076
+ ...props,
1077
+ checked,
1078
+ onCheckedChange,
1079
+ id,
1080
+ "aria-describedby": descriptionId,
1081
+ ...validationValence === "error" && {
1082
+ "aria-invalid": "true",
1083
+ "aria-errormessage": errorMessageId
1084
+ },
1085
+ className: tx("input.checkbox", "input--checkbox", {
1086
+ size
1087
+ }, "shrink-0", classNames),
1088
+ ref: forwardedRef
1089
+ }, /* @__PURE__ */ React16.createElement(CheckboxIndicatorPrimitive, {
1090
+ asChild: true
1091
+ }, /* @__PURE__ */ React16.createElement(Icon3, checked && {
1092
+ weight,
1093
+ className: tx("input.checkboxIndicator", "input--checkbox__indicator", {
1094
+ size
1095
+ })
1096
+ })));
1097
+ });
1098
+ var Switch = /* @__PURE__ */ forwardRef14(({ __inputScope, checked: propsChecked, defaultChecked: propsDefaultChecked, onCheckedChange: propsOnCheckedChange, size = 5, classNames, ...props }, forwardedRef) => {
1099
+ const { tx } = useThemeContext();
1100
+ const [checked, onCheckedChange] = useControllableState({
1101
+ prop: propsChecked,
1102
+ defaultProp: propsDefaultChecked,
1103
+ onChange: propsOnCheckedChange
1104
+ });
1105
+ const { id, validationValence, descriptionId, errorMessageId } = useInputContext(INPUT_NAME, __inputScope);
1106
+ return /* @__PURE__ */ React16.createElement(SwitchPrimitive, {
1107
+ ...props,
1108
+ checked,
1109
+ onCheckedChange,
1110
+ id,
1111
+ "aria-describedby": descriptionId,
1112
+ ...validationValence === "error" && {
1113
+ "aria-invalid": "true",
1114
+ "aria-errormessage": errorMessageId
1115
+ },
1116
+ className: tx("input.switch", "input--switch", {
1117
+ size
1118
+ }, classNames),
1119
+ ref: forwardedRef
1120
+ }, /* @__PURE__ */ React16.createElement(SwitchThumbPrimitive, {
1121
+ className: tx("input.switchThumb", "input--switch__thumb", {
1122
+ size
1123
+ })
1124
+ }));
1125
+ });
1126
+ var Input = {
1127
+ Root: InputRoot,
1128
+ PinInput,
1129
+ TextInput,
1130
+ TextArea,
1131
+ Checkbox,
1132
+ Switch,
1133
+ Label: Label3,
1134
+ Description,
1135
+ Validation,
1136
+ DescriptionAndValidation
1137
+ };
1138
+
1139
+ // packages/ui/react-ui/src/components/Lists/List.tsx
1140
+ import { CaretDown, CaretRight } from "@phosphor-icons/react";
1141
+ import { Slot as Slot8 } from "@radix-ui/react-slot";
1142
+ import React18, { forwardRef as forwardRef15 } from "react";
1143
+ import { List as ListPrimitive, ListItemHeading as ListPrimitiveItemHeading, ListItemOpenTrigger as ListPrimitiveItemOpenTrigger, ListItemCollapsibleContent, ListItem as ListPrimitiveItem, LIST_NAME, LIST_ITEM_NAME, useListContext, useListItemContext } from "@dxos/react-list";
1144
+
1145
+ // packages/ui/react-ui/src/components/DensityProvider/DensityProvider.tsx
1146
+ import React17, { createContext as createContext7 } from "react";
1147
+ var DensityContext = /* @__PURE__ */ createContext7({
1148
+ density: "fine"
1149
+ });
1150
+ var DensityProvider = ({ density, children }) => /* @__PURE__ */ React17.createElement(DensityContext.Provider, {
1151
+ value: {
1152
+ density
1153
+ }
1154
+ }, children);
1155
+
1156
+ // packages/ui/react-ui/src/components/Lists/List.tsx
1157
+ var List = /* @__PURE__ */ forwardRef15(({ classNames, children, ...props }, forwardedRef) => {
1158
+ const { tx } = useThemeContext();
1159
+ const density = useDensityContext(props.density);
1160
+ return /* @__PURE__ */ React18.createElement(DensityProvider, {
1161
+ density
1162
+ }, /* @__PURE__ */ React18.createElement(ListPrimitive, {
1163
+ ...props,
1164
+ className: tx("list.root", "list", {}, classNames),
1165
+ ref: forwardedRef
1166
+ }, children));
1167
+ });
1168
+ var ListItemEndcap = /* @__PURE__ */ forwardRef15(({ children, classNames, asChild, ...props }, forwardedRef) => {
1169
+ const Root3 = asChild ? Slot8 : "div";
1170
+ const density = useDensityContext();
1171
+ const { tx } = useThemeContext();
1172
+ return /* @__PURE__ */ React18.createElement(Root3, {
1173
+ ...!asChild && {
1174
+ role: "none"
1175
+ },
1176
+ ...props,
1177
+ className: tx("list.item.endcap", "list__listItem__endcap", {
1178
+ density
1179
+ }, classNames),
1180
+ ref: forwardedRef
1181
+ }, children);
1182
+ });
1183
+ var MockListItemOpenTrigger = ({ classNames, ...props }) => {
1184
+ const density = useDensityContext();
1185
+ const { tx } = useThemeContext();
1186
+ return /* @__PURE__ */ React18.createElement("div", {
1187
+ role: "none",
1188
+ ...props,
1189
+ className: tx("list.item.openTrigger", "list__listItem__openTrigger--mock", {
1190
+ density
1191
+ }, classNames)
1192
+ });
1193
+ };
1194
+ var ListItemHeading = /* @__PURE__ */ forwardRef15(({ children, classNames, ...props }, forwardedRef) => {
1195
+ const { tx } = useThemeContext();
1196
+ const density = useDensityContext();
1197
+ return /* @__PURE__ */ React18.createElement(ListPrimitiveItemHeading, {
1198
+ ...props,
1199
+ className: tx("list.item.heading", "list__listItem__heading", {
1200
+ density
1201
+ }, classNames),
1202
+ ref: forwardedRef
1203
+ }, children);
1204
+ });
1205
+ var ListItemOpenTrigger = /* @__PURE__ */ forwardRef15(({ __listItemScope, classNames, children, ...props }, forwardedRef) => {
1206
+ const { tx } = useThemeContext();
1207
+ const density = useDensityContext();
1208
+ const { open } = useListItemContext(LIST_ITEM_NAME, __listItemScope);
1209
+ const Icon3 = open ? CaretDown : CaretRight;
1210
+ return /* @__PURE__ */ React18.createElement(ListPrimitiveItemOpenTrigger, {
1211
+ ...props,
1212
+ className: tx("list.item.openTrigger", "list__listItem__openTrigger", {
1213
+ density
1214
+ }, classNames),
1215
+ ref: forwardedRef
1216
+ }, children || /* @__PURE__ */ React18.createElement(Icon3, {
1217
+ weight: "bold",
1218
+ className: tx("list.item.openTriggerIcon", "list__listItem__openTrigger__icon", {})
1219
+ }));
1220
+ });
1221
+ var ListItemRoot = /* @__PURE__ */ forwardRef15(({ classNames, children, ...props }, forwardedRef) => {
1222
+ const { tx } = useThemeContext();
1223
+ const density = useDensityContext();
1224
+ return /* @__PURE__ */ React18.createElement(ListPrimitiveItem, {
1225
+ ...props,
1226
+ className: tx("list.item.root", "list__listItem", {
1227
+ density,
1228
+ collapsible: props.collapsible
1229
+ }, classNames),
1230
+ ref: forwardedRef
1231
+ }, children);
1232
+ });
1233
+ var ListItem = {
1234
+ Root: ListItemRoot,
1235
+ Endcap: ListItemEndcap,
1236
+ Heading: ListItemHeading,
1237
+ OpenTrigger: ListItemOpenTrigger,
1238
+ CollapsibleContent: ListItemCollapsibleContent,
1239
+ MockOpenTrigger: MockListItemOpenTrigger
1240
+ };
1241
+
1242
+ // packages/ui/react-ui/src/components/Lists/Tree.tsx
1243
+ import React19, { forwardRef as forwardRef16 } from "react";
1244
+ var TreeRoot = /* @__PURE__ */ forwardRef16((props, forwardedRef) => {
1245
+ return /* @__PURE__ */ React19.createElement(List, {
1246
+ ...props,
1247
+ ref: forwardedRef
1248
+ });
1249
+ });
1250
+ var TreeBranch = /* @__PURE__ */ forwardRef16(({ __listScope, ...props }, forwardedRef) => {
1251
+ const { headingId } = useListItemContext(LIST_ITEM_NAME, __listScope);
1252
+ return /* @__PURE__ */ React19.createElement(List, {
1253
+ ...props,
1254
+ "aria-labelledby": headingId,
1255
+ ref: forwardedRef
1256
+ });
1257
+ });
1258
+ var TreeItemRoot = /* @__PURE__ */ forwardRef16((props, forwardedRef) => {
1259
+ return /* @__PURE__ */ React19.createElement(ListItem.Root, {
1260
+ role: "treeitem",
1261
+ ...props,
1262
+ ref: forwardedRef
1263
+ });
1264
+ });
1265
+ var TreeItemHeading = ListItem.Heading;
1266
+ var TreeItemOpenTrigger = ListItem.OpenTrigger;
1267
+ var MockTreeItemOpenTrigger = ListItem.MockOpenTrigger;
1268
+ var TreeItemBody = ListItem.CollapsibleContent;
1269
+ var Tree = {
1270
+ Root: TreeRoot,
1271
+ Branch: TreeBranch
1272
+ };
1273
+ var TreeItem = {
1274
+ Root: TreeItemRoot,
1275
+ Heading: TreeItemHeading,
1276
+ Body: TreeItemBody,
1277
+ OpenTrigger: TreeItemOpenTrigger,
1278
+ MockOpenTrigger: MockTreeItemOpenTrigger
1279
+ };
1280
+
1281
+ // packages/ui/react-ui/src/components/Lists/Treegrid.tsx
1282
+ import { useFocusableGroup, useArrowNavigationGroup } from "@fluentui/react-tabster";
1283
+ import { createContextScope } from "@radix-ui/react-context";
1284
+ import { Primitive as Primitive8 } from "@radix-ui/react-primitive";
1285
+ import { Slot as Slot9 } from "@radix-ui/react-slot";
1286
+ import { useControllableState as useControllableState2 } from "@radix-ui/react-use-controllable-state";
1287
+ import React20, { forwardRef as forwardRef17 } from "react";
1288
+ var TREEGRID_ROW_NAME = "TreegridRow";
1289
+ var [createTreegridRowContext, createTreegridRowScope] = createContextScope(TREEGRID_ROW_NAME, []);
1290
+ var [TreegridRowProvider, useTreegridRowContext] = createTreegridRowContext(TREEGRID_ROW_NAME);
1291
+ var PATH_SEPARATOR = "~";
1292
+ var PARENT_OF_SEPARATOR = " ";
1293
+ var TreegridRoot = /* @__PURE__ */ forwardRef17(({ asChild, classNames, children, style, gridTemplateColumns, ...props }, forwardedRef) => {
1294
+ const { tx } = useThemeContext();
1295
+ const Root3 = asChild ? Slot9 : Primitive8.div;
1296
+ const arrowNavigationAttrs = useArrowNavigationGroup({
1297
+ axis: "vertical",
1298
+ tabbable: false,
1299
+ circular: true
1300
+ });
1301
+ return /* @__PURE__ */ React20.createElement(Root3, {
1302
+ role: "treegrid",
1303
+ ...arrowNavigationAttrs,
1304
+ ...props,
1305
+ className: tx("treegrid.root", "treegrid", {}, classNames),
1306
+ style: {
1307
+ ...style,
1308
+ gridTemplateColumns
1309
+ },
1310
+ ref: forwardedRef
1311
+ }, children);
1312
+ });
1313
+ var TreegridRow = /* @__PURE__ */ forwardRef17(({ __treegridRowScope, asChild, classNames, children, id, parentOf, open: propsOpen, defaultOpen, onOpenChange: propsOnOpenChange, ...props }, forwardedRef) => {
1314
+ const { tx } = useThemeContext();
1315
+ const Root3 = asChild ? Slot9 : Primitive8.div;
1316
+ const pathParts = id.split(PATH_SEPARATOR);
1317
+ const level = pathParts.length - 1;
1318
+ const [open, onOpenChange] = useControllableState2({
1319
+ prop: propsOpen,
1320
+ onChange: propsOnOpenChange,
1321
+ defaultProp: defaultOpen
1322
+ });
1323
+ const focusableGroupAttrs = useFocusableGroup({
1324
+ tabBehavior: "limited"
1325
+ });
1326
+ const arrowGroupAttrs = useArrowNavigationGroup({
1327
+ axis: "horizontal",
1328
+ tabbable: false,
1329
+ circular: false,
1330
+ memorizeCurrent: false
1331
+ });
1332
+ return /* @__PURE__ */ React20.createElement(TreegridRowProvider, {
1333
+ open,
1334
+ onOpenChange,
1335
+ scope: __treegridRowScope
1336
+ }, /* @__PURE__ */ React20.createElement(Root3, {
1337
+ role: "row",
1338
+ "aria-level": level,
1339
+ className: tx("treegrid.row", "treegrid__row", {
1340
+ level
1341
+ }, classNames),
1342
+ ...parentOf && {
1343
+ "aria-expanded": open,
1344
+ "aria-owns": parentOf
1345
+ },
1346
+ tabIndex: 0,
1347
+ ...focusableGroupAttrs,
1348
+ ...props,
1349
+ id,
1350
+ ref: forwardedRef
1351
+ }, /* @__PURE__ */ React20.createElement("div", {
1352
+ role: "none",
1353
+ className: "contents",
1354
+ ...arrowGroupAttrs
1355
+ }, children)));
1356
+ });
1357
+ var TreegridCell = /* @__PURE__ */ forwardRef17(({ classNames, children, indent, ...props }, forwardedRef) => {
1358
+ const { tx } = useThemeContext();
1359
+ return /* @__PURE__ */ React20.createElement("div", {
1360
+ role: "gridcell",
1361
+ className: tx("treegrid.cell", "treegrid__cell", {
1362
+ indent
1363
+ }, classNames),
1364
+ ...props,
1365
+ ref: forwardedRef
1366
+ }, children);
1367
+ });
1368
+ var Treegrid = {
1369
+ Root: TreegridRoot,
1370
+ Row: TreegridRow,
1371
+ Cell: TreegridCell,
1372
+ PARENT_OF_SEPARATOR,
1373
+ PATH_SEPARATOR,
1374
+ createTreegridRowScope,
1375
+ useTreegridRowContext
1376
+ };
1377
+
1378
+ // packages/ui/react-ui/src/components/Main/Main.tsx
1379
+ import { useFocusableGroup as useFocusableGroup2 } from "@fluentui/react-tabster";
1380
+ import { useComposedRefs } from "@radix-ui/react-compose-refs";
1381
+ import { createContext as createContext8 } from "@radix-ui/react-context";
1382
+ import { Root as DialogRoot2, DialogContent as DialogContent2 } from "@radix-ui/react-dialog";
1383
+ import { Primitive as Primitive9 } from "@radix-ui/react-primitive";
1384
+ import { Slot as Slot10 } from "@radix-ui/react-slot";
1385
+ import { useControllableState as useControllableState3 } from "@radix-ui/react-use-controllable-state";
1386
+ import React21, { forwardRef as forwardRef18, useCallback as useCallback3, useEffect as useEffect4, useRef, useState as useState4 } from "react";
1387
+ import { log } from "@dxos/log";
1388
+ import { useMediaQuery, useForwardedRef } from "@dxos/react-hooks";
1389
+
1390
+ // packages/ui/react-ui/src/components/Main/useSwipeToDismiss.ts
1391
+ import { useCallback as useCallback2, useEffect as useEffect3, useState as useState3 } from "react";
1392
+ var MotionState;
1393
+ (function(MotionState2) {
1394
+ MotionState2[MotionState2["IDLE"] = 0] = "IDLE";
1395
+ MotionState2[MotionState2["DEBOUNCING"] = 1] = "DEBOUNCING";
1396
+ MotionState2[MotionState2["FOLLOWING"] = 2] = "FOLLOWING";
1397
+ })(MotionState || (MotionState = {}));
1398
+ var useSwipeToDismiss = (ref, {
1399
+ onDismiss,
1400
+ dismissThreshold = 64,
1401
+ debounceThreshold = 8,
1402
+ offset = 0
1403
+ /* side = 'inline-start' */
1404
+ }) => {
1405
+ const $root = ref.current;
1406
+ const [motionState, setMotionState] = useState3(0);
1407
+ const [gestureStartX, setGestureStartX] = useState3(0);
1408
+ const setIdle = useCallback2(() => {
1409
+ setMotionState(0);
1410
+ $root?.style.removeProperty("inset-inline-start");
1411
+ $root?.style.setProperty("transition-duration", "200ms");
1412
+ }, [
1413
+ $root
1414
+ ]);
1415
+ const setFollowing = useCallback2(() => {
1416
+ setMotionState(2);
1417
+ $root?.style.setProperty("transition-duration", "0ms");
1418
+ }, [
1419
+ $root
1420
+ ]);
1421
+ const handlePointerDown = useCallback2(({ screenX }) => {
1422
+ if (motionState === 0) {
1423
+ setMotionState(1);
1424
+ setGestureStartX(screenX);
1425
+ }
1426
+ }, [
1427
+ motionState
1428
+ ]);
1429
+ const handlePointerMove = useCallback2(({ screenX }) => {
1430
+ if ($root) {
1431
+ const delta = Math.min(screenX - gestureStartX, 0);
1432
+ switch (motionState) {
1433
+ case 2:
1434
+ if (Math.abs(delta) > dismissThreshold) {
1435
+ setIdle();
1436
+ onDismiss?.();
1437
+ } else {
1438
+ $root.style.setProperty("inset-inline-start", `${offset + delta}px`);
1439
+ }
1440
+ break;
1441
+ case 1:
1442
+ if (Math.abs(delta) > debounceThreshold) {
1443
+ setFollowing();
1444
+ }
1445
+ break;
1446
+ }
1447
+ }
1448
+ }, [
1449
+ $root,
1450
+ motionState,
1451
+ gestureStartX
1452
+ ]);
1453
+ const handlePointerUp = useCallback2(() => {
1454
+ setIdle();
1455
+ }, [
1456
+ setIdle
1457
+ ]);
1458
+ useEffect3(() => {
1459
+ $root?.addEventListener("pointerdown", handlePointerDown);
1460
+ return () => {
1461
+ $root?.removeEventListener("pointerdown", handlePointerDown);
1462
+ };
1463
+ }, [
1464
+ $root,
1465
+ handlePointerDown
1466
+ ]);
1467
+ useEffect3(() => {
1468
+ $root && document.documentElement.addEventListener("pointermove", handlePointerMove);
1469
+ return () => {
1470
+ document.documentElement.removeEventListener("pointermove", handlePointerMove);
1471
+ };
1472
+ }, [
1473
+ $root,
1474
+ handlePointerMove
1475
+ ]);
1476
+ useEffect3(() => {
1477
+ $root && document.documentElement.addEventListener("pointerup", handlePointerUp);
1478
+ return () => {
1479
+ document.documentElement.removeEventListener("pointerup", handlePointerUp);
1480
+ };
1481
+ }, [
1482
+ $root,
1483
+ handlePointerUp
1484
+ ]);
1485
+ };
1486
+
1487
+ // packages/ui/react-ui/src/components/Main/Main.tsx
1488
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/ui/react-ui/src/components/Main/Main.tsx";
1489
+ var MAIN_ROOT_NAME = "MainRoot";
1490
+ var NAVIGATION_SIDEBAR_NAME = "NavigationSidebar";
1491
+ var COMPLEMENTARY_SIDEBAR_NAME = "ComplementarySidebar";
1492
+ var MAIN_NAME = "Main";
1493
+ var GENERIC_CONSUMER_NAME = "GenericConsumer";
1494
+ var landmarkAttr = "data-main-landmark";
1495
+ var useLandmarkMover = (propsOnKeyDown, landmark) => {
1496
+ const handleKeyDown = useCallback3((event) => {
1497
+ const target = event.target;
1498
+ if (event.target === event.currentTarget && event.key === "Tab" && target.hasAttribute(landmarkAttr)) {
1499
+ event.preventDefault();
1500
+ const landmarks = Array.from(document.querySelectorAll(`[${landmarkAttr}]:not([inert])`)).map((el) => el.hasAttribute(landmarkAttr) ? parseInt(el.getAttribute(landmarkAttr)) : NaN).sort();
1501
+ const l = landmarks.length;
1502
+ const cursor = landmarks.indexOf(parseInt(target.getAttribute(landmarkAttr)));
1503
+ const nextLandmark = landmarks[(cursor + l + (event.getModifierState("Shift") ? -1 : 1)) % l];
1504
+ document.querySelector(`[${landmarkAttr}="${nextLandmark}"]`)?.focus();
1505
+ }
1506
+ propsOnKeyDown?.(event);
1507
+ }, [
1508
+ propsOnKeyDown
1509
+ ]);
1510
+ const focusableAttrs = useFocusableGroup2({
1511
+ tabBehavior: "limited",
1512
+ ignoreDefaultKeydown: {
1513
+ Tab: true
1514
+ }
1515
+ });
1516
+ return {
1517
+ onKeyDown: handleKeyDown,
1518
+ [landmarkAttr]: landmark,
1519
+ tabIndex: 0,
1520
+ ...focusableAttrs
1521
+ };
1522
+ };
1523
+ var [MainProvider, useMainContext] = createContext8(MAIN_NAME, {
1524
+ resizing: false,
1525
+ navigationSidebarOpen: false,
1526
+ setNavigationSidebarOpen: (nextOpen) => {
1527
+ log.warn("Attempt to set sidebar state without initializing `MainRoot`", void 0, {
1528
+ F: __dxlog_file,
1529
+ L: 81,
1530
+ S: void 0,
1531
+ C: (f, a) => f(...a)
1532
+ });
1533
+ },
1534
+ complementarySidebarOpen: false,
1535
+ setComplementarySidebarOpen: (nextOpen) => {
1536
+ log.warn("Attempt to set sidebar state without initializing `MainRoot`", void 0, {
1537
+ F: __dxlog_file,
1538
+ L: 86,
1539
+ S: void 0,
1540
+ C: (f, a) => f(...a)
1541
+ });
1542
+ }
1543
+ });
1544
+ var useSidebars = (consumerName = GENERIC_CONSUMER_NAME) => {
1545
+ const { setNavigationSidebarOpen, navigationSidebarOpen, setComplementarySidebarOpen, complementarySidebarOpen } = useMainContext(consumerName);
1546
+ return {
1547
+ navigationSidebarOpen,
1548
+ setNavigationSidebarOpen,
1549
+ toggleNavigationSidebar: useCallback3(() => setNavigationSidebarOpen(!navigationSidebarOpen), [
1550
+ navigationSidebarOpen,
1551
+ setNavigationSidebarOpen
1552
+ ]),
1553
+ openNavigationSidebar: useCallback3(() => setNavigationSidebarOpen(true), [
1554
+ setNavigationSidebarOpen
1555
+ ]),
1556
+ closeNavigationSidebar: useCallback3(() => setNavigationSidebarOpen(false), [
1557
+ setNavigationSidebarOpen
1558
+ ]),
1559
+ complementarySidebarOpen,
1560
+ setComplementarySidebarOpen,
1561
+ toggleComplementarySidebar: useCallback3(() => setComplementarySidebarOpen(!complementarySidebarOpen), [
1562
+ complementarySidebarOpen,
1563
+ setComplementarySidebarOpen
1564
+ ]),
1565
+ openComplementarySidebar: useCallback3(() => setComplementarySidebarOpen(true), [
1566
+ setComplementarySidebarOpen
1567
+ ]),
1568
+ closeComplementarySidebar: useCallback3(() => setComplementarySidebarOpen(false), [
1569
+ setComplementarySidebarOpen
1570
+ ])
1571
+ };
1572
+ };
1573
+ var resizeDebounce = 3e3;
1574
+ var MainRoot = ({ navigationSidebarOpen: propsNavigationSidebarOpen, defaultNavigationSidebarOpen, onNavigationSidebarOpenChange, complementarySidebarOpen: propsComplementarySidebarOpen, defaultComplementarySidebarOpen, onComplementarySidebarOpenChange, children, ...props }) => {
1575
+ const [isLg] = useMediaQuery("lg", {
1576
+ ssr: false
1577
+ });
1578
+ const [navigationSidebarOpen = isLg, setNavigationSidebarOpen] = useControllableState3({
1579
+ prop: propsNavigationSidebarOpen,
1580
+ defaultProp: defaultNavigationSidebarOpen,
1581
+ onChange: onNavigationSidebarOpenChange
1582
+ });
1583
+ const [complementarySidebarOpen = false, setComplementarySidebarOpen] = useControllableState3({
1584
+ prop: propsComplementarySidebarOpen,
1585
+ defaultProp: defaultComplementarySidebarOpen,
1586
+ onChange: onComplementarySidebarOpenChange
1587
+ });
1588
+ const [resizing, setResizing] = useState4(false);
1589
+ const resizeInterval = useRef(null);
1590
+ const handleResize = useCallback3(() => {
1591
+ setResizing(true);
1592
+ if (resizeInterval.current) {
1593
+ clearTimeout(resizeInterval.current);
1594
+ }
1595
+ resizeInterval.current = setTimeout(() => {
1596
+ setResizing(false);
1597
+ resizeInterval.current = null;
1598
+ }, resizeDebounce);
1599
+ }, []);
1600
+ useEffect4(() => {
1601
+ window.addEventListener("resize", handleResize);
1602
+ return () => window.removeEventListener("resize", handleResize);
1603
+ }, [
1604
+ handleResize
1605
+ ]);
1606
+ return /* @__PURE__ */ React21.createElement(MainProvider, {
1607
+ ...props,
1608
+ navigationSidebarOpen,
1609
+ setNavigationSidebarOpen,
1610
+ complementarySidebarOpen,
1611
+ setComplementarySidebarOpen,
1612
+ resizing
1613
+ }, children);
1614
+ };
1615
+ MainRoot.displayName = MAIN_ROOT_NAME;
1616
+ var handleOpenAutoFocus = (event) => {
1617
+ !document.body.hasAttribute("data-is-keyboard") && event.preventDefault();
1618
+ };
1619
+ var MainSidebar = /* @__PURE__ */ forwardRef18(({ classNames, children, swipeToDismiss, onOpenAutoFocus, open, resizing, setOpen, side, ...props }, forwardedRef) => {
1620
+ const [isLg] = useMediaQuery("lg", {
1621
+ ssr: false
1622
+ });
1623
+ const { tx } = useThemeContext();
1624
+ const ref = useForwardedRef(forwardedRef);
1625
+ const noopRef = useRef(null);
1626
+ useSwipeToDismiss(swipeToDismiss ? ref : noopRef, {
1627
+ onDismiss: () => setOpen(false)
1628
+ });
1629
+ const handleKeyDown = useCallback3((event) => {
1630
+ if (event.key === "Escape") {
1631
+ event.target.closest("[data-tabster]")?.focus();
1632
+ }
1633
+ props.onKeyDown?.(event);
1634
+ }, [
1635
+ props.onKeyDown
1636
+ ]);
1637
+ const Root3 = isLg ? Primitive9.div : DialogContent2;
1638
+ return /* @__PURE__ */ React21.createElement(DialogRoot2, {
1639
+ open,
1640
+ modal: false
1641
+ }, /* @__PURE__ */ React21.createElement(Root3, {
1642
+ ...!isLg && {
1643
+ forceMount: true,
1644
+ tabIndex: -1,
1645
+ onOpenAutoFocus: onOpenAutoFocus ?? handleOpenAutoFocus
1646
+ },
1647
+ ...props,
1648
+ "data-side": side === "inline-end" ? "ie" : "is",
1649
+ "data-state": open ? "open" : "closed",
1650
+ "data-resizing": resizing ? "true" : "false",
1651
+ className: tx("main.sidebar", "main__sidebar", {}, classNames),
1652
+ onKeyDown: handleKeyDown,
1653
+ ...!open && {
1654
+ inert: "true"
1655
+ },
1656
+ ref
1657
+ }, /* @__PURE__ */ React21.createElement(ElevationProvider, {
1658
+ elevation: "group"
1659
+ }, children)));
1660
+ });
1661
+ var MainNavigationSidebar = /* @__PURE__ */ forwardRef18((props, forwardedRef) => {
1662
+ const { navigationSidebarOpen, setNavigationSidebarOpen, resizing } = useMainContext(NAVIGATION_SIDEBAR_NAME);
1663
+ const mover = useLandmarkMover(props.onKeyDown, "0");
1664
+ return /* @__PURE__ */ React21.createElement(MainSidebar, {
1665
+ ...mover,
1666
+ ...props,
1667
+ open: navigationSidebarOpen,
1668
+ setOpen: setNavigationSidebarOpen,
1669
+ resizing,
1670
+ side: "inline-start",
1671
+ ref: forwardedRef
1672
+ });
1673
+ });
1674
+ MainNavigationSidebar.displayName = NAVIGATION_SIDEBAR_NAME;
1675
+ var MainComplementarySidebar = /* @__PURE__ */ forwardRef18((props, forwardedRef) => {
1676
+ const { complementarySidebarOpen, setComplementarySidebarOpen, resizing } = useMainContext(COMPLEMENTARY_SIDEBAR_NAME);
1677
+ const mover = useLandmarkMover(props.onKeyDown, "2");
1678
+ return /* @__PURE__ */ React21.createElement(MainSidebar, {
1679
+ ...mover,
1680
+ ...props,
1681
+ open: complementarySidebarOpen,
1682
+ setOpen: setComplementarySidebarOpen,
1683
+ resizing,
1684
+ side: "inline-end",
1685
+ ref: forwardedRef
1686
+ });
1687
+ });
1688
+ MainNavigationSidebar.displayName = NAVIGATION_SIDEBAR_NAME;
1689
+ var MainContent = /* @__PURE__ */ forwardRef18(({ asChild, classNames, bounce, handlesFocus, children, role, ...props }, forwardedRef) => {
1690
+ const { navigationSidebarOpen, complementarySidebarOpen } = useMainContext(MAIN_NAME);
1691
+ const { tx } = useThemeContext();
1692
+ const Root3 = asChild ? Slot10 : role ? "div" : "main";
1693
+ const mover = useLandmarkMover(props.onKeyDown, "1");
1694
+ return /* @__PURE__ */ React21.createElement(Root3, {
1695
+ role,
1696
+ ...handlesFocus && {
1697
+ ...mover
1698
+ },
1699
+ ...props,
1700
+ "data-sidebar-inline-start-state": navigationSidebarOpen ? "open" : "closed",
1701
+ "data-sidebar-inline-end-state": complementarySidebarOpen ? "open" : "closed",
1702
+ className: tx("main.content", "main", {
1703
+ bounce,
1704
+ handlesFocus
1705
+ }, classNames),
1706
+ ref: forwardedRef
1707
+ }, children);
1708
+ });
1709
+ MainContent.displayName = MAIN_NAME;
1710
+ var MainOverlay = /* @__PURE__ */ forwardRef18(({ classNames, ...props }, forwardedRef) => {
1711
+ const [isLg] = useMediaQuery("lg", {
1712
+ ssr: false
1713
+ });
1714
+ const { navigationSidebarOpen, setNavigationSidebarOpen, complementarySidebarOpen, setComplementarySidebarOpen } = useMainContext(MAIN_NAME);
1715
+ const { tx } = useThemeContext();
1716
+ return /* @__PURE__ */ React21.createElement("div", {
1717
+ onClick: () => {
1718
+ setNavigationSidebarOpen(false);
1719
+ setComplementarySidebarOpen(false);
1720
+ },
1721
+ ...props,
1722
+ className: tx("main.overlay", "main__overlay", {
1723
+ isLg,
1724
+ inlineStartSidebarOpen: navigationSidebarOpen,
1725
+ inlineEndSidebarOpen: complementarySidebarOpen
1726
+ }, classNames),
1727
+ "data-state": navigationSidebarOpen || complementarySidebarOpen ? "open" : "closed",
1728
+ "aria-hidden": "true",
1729
+ ref: forwardedRef
1730
+ });
1731
+ });
1732
+ var MainNotch = /* @__PURE__ */ forwardRef18(({ classNames, ...props }, forwardedRef) => {
1733
+ const { tx } = useThemeContext();
1734
+ const { navigationSidebarOpen } = useMainContext(MAIN_NAME);
1735
+ const notchElement = useRef(null);
1736
+ const ref = useComposedRefs(forwardedRef, notchElement);
1737
+ const handleKeyDown = useCallback3((event) => {
1738
+ switch (event.key) {
1739
+ case "Escape":
1740
+ props?.onKeyDown?.(event);
1741
+ notchElement.current?.focus();
1742
+ }
1743
+ }, [
1744
+ props?.onKeyDown
1745
+ ]);
1746
+ const mover = useLandmarkMover(handleKeyDown, "3");
1747
+ return /* @__PURE__ */ React21.createElement("div", {
1748
+ role: "toolbar",
1749
+ ...mover,
1750
+ ...props,
1751
+ "data-nav-sidebar-state": navigationSidebarOpen ? "open" : "closed",
1752
+ className: tx("main.notch", "main__notch", {}, classNames),
1753
+ ref
1754
+ });
1755
+ });
1756
+ var Main = {
1757
+ Root: MainRoot,
1758
+ Content: MainContent,
1759
+ Overlay: MainOverlay,
1760
+ NavigationSidebar: MainNavigationSidebar,
1761
+ ComplementarySidebar: MainComplementarySidebar,
1762
+ Notch: MainNotch
1763
+ };
1764
+
1765
+ // packages/ui/react-ui/src/components/Message/Message.tsx
1766
+ import { createContext as createContext9 } from "@radix-ui/react-context";
1767
+ import { Primitive as Primitive10 } from "@radix-ui/react-primitive";
1768
+ import { Slot as Slot11 } from "@radix-ui/react-slot";
1769
+ import React22, { forwardRef as forwardRef19 } from "react";
1770
+ import { useId as useId3 } from "@dxos/react-hooks";
1771
+ var MESSAGE_NAME = "Message";
1772
+ var [MessageProvider, useMessageContext] = createContext9(MESSAGE_NAME);
1773
+ var MessageRoot = /* @__PURE__ */ forwardRef19(({ asChild, valence, elevation: propsElevation, className, titleId: propsTitleId, descriptionId: propsDescriptionId, children, ...props }, forwardedRef) => {
1774
+ const { tx } = useThemeContext();
1775
+ const titleId = useId3("message__title", propsTitleId);
1776
+ const descriptionId = useId3("message__description", propsDescriptionId);
1777
+ const elevation = useElevationContext(propsElevation);
1778
+ const Root3 = asChild ? Slot11 : Primitive10.div;
1779
+ return /* @__PURE__ */ React22.createElement(MessageProvider, {
1780
+ titleId,
1781
+ descriptionId
1782
+ }, /* @__PURE__ */ React22.createElement(Root3, {
1783
+ ...props,
1784
+ className: tx("message.root", "message", {
1785
+ valence,
1786
+ elevation
1787
+ }, className),
1788
+ "aria-labelledby": titleId,
1789
+ "aria-describedby": descriptionId,
1790
+ ref: forwardedRef
1791
+ }, children));
1792
+ });
1793
+ MessageRoot.displayName = MESSAGE_NAME;
1794
+ var MESSAGE_TITLE_NAME = "MessageTitle";
1795
+ var MessageTitle = /* @__PURE__ */ forwardRef19(({ asChild, className, children, ...props }, forwardedRef) => {
1796
+ const { tx } = useThemeContext();
1797
+ const { titleId } = useMessageContext(MESSAGE_TITLE_NAME);
1798
+ const Root3 = asChild ? Slot11 : Primitive10.h2;
1799
+ return /* @__PURE__ */ React22.createElement(Root3, {
1800
+ ...props,
1801
+ className: tx("message.title", "message__title", {}, className),
1802
+ id: titleId,
1803
+ ref: forwardedRef
1804
+ }, children);
1805
+ });
1806
+ MessageTitle.displayName = MESSAGE_TITLE_NAME;
1807
+ var MESSAGE_BODY_NAME = "MessageBody";
1808
+ var MessageBody = /* @__PURE__ */ forwardRef19(({ asChild, className, children, ...props }, forwardedRef) => {
1809
+ const { tx } = useThemeContext();
1810
+ const { descriptionId } = useMessageContext(MESSAGE_BODY_NAME);
1811
+ const Root3 = asChild ? Slot11 : Primitive10.p;
1812
+ return /* @__PURE__ */ React22.createElement(Root3, {
1813
+ ...props,
1814
+ className: tx("message.body", "message__body", {}, className),
1815
+ id: descriptionId,
1816
+ ref: forwardedRef
1817
+ }, children);
1818
+ });
1819
+ MessageBody.displayName = MESSAGE_BODY_NAME;
1820
+ var Message = {
1821
+ Root: MessageRoot,
1822
+ Title: MessageTitle,
1823
+ Body: MessageBody
1824
+ };
1825
+
1826
+ // packages/ui/react-ui/src/components/Popover/Popover.tsx
1827
+ import { Root as PopoverRootPrimitive, PopoverContent as PopoverContentPrimitive, PopoverTrigger as PopoverTriggerPrimitive, PopoverAnchor as PopoverAnchorPrimitive, PopoverPortal as PopoverPortalPrimitive, PopoverArrow as PopoverArrowPrimitive, PopoverClose as PopoverClosePrimitive } from "@radix-ui/react-popover";
1828
+ import { Primitive as Primitive11 } from "@radix-ui/react-primitive";
1829
+ import { Slot as Slot12 } from "@radix-ui/react-slot";
1830
+ import React23, { forwardRef as forwardRef20 } from "react";
1831
+ var PopoverRoot = PopoverRootPrimitive;
1832
+ var PopoverPortal = PopoverPortalPrimitive;
1833
+ var PopoverTrigger = PopoverTriggerPrimitive;
1834
+ var PopoverAnchor = PopoverAnchorPrimitive;
1835
+ var PopoverClose = PopoverClosePrimitive;
1836
+ var PopoverArrow = /* @__PURE__ */ forwardRef20(({ classNames, ...props }, forwardedRef) => {
1837
+ const { tx } = useThemeContext();
1838
+ return /* @__PURE__ */ React23.createElement(PopoverArrowPrimitive, {
1839
+ ...props,
1840
+ className: tx("popover.arrow", "popover__arrow", {}, classNames),
1841
+ ref: forwardedRef
1842
+ });
1843
+ });
1844
+ var PopoverContent = /* @__PURE__ */ forwardRef20(({ classNames, children, ...props }, forwardedRef) => {
1845
+ const { tx } = useThemeContext();
1846
+ return /* @__PURE__ */ React23.createElement(PopoverContentPrimitive, {
1847
+ sideOffset: 4,
1848
+ collisionPadding: 8,
1849
+ ...props,
1850
+ className: tx("popover.content", "popover", {}, classNames),
1851
+ ref: forwardedRef
1852
+ }, /* @__PURE__ */ React23.createElement(ElevationProvider, {
1853
+ elevation: "chrome"
1854
+ }, children));
1855
+ });
1856
+ var PopoverViewport = /* @__PURE__ */ forwardRef20(({ classNames, asChild, constrainInline = true, constrainBlock = true, children, ...props }, forwardedRef) => {
1857
+ const { tx } = useThemeContext();
1858
+ const Root3 = asChild ? Slot12 : Primitive11.div;
1859
+ return /* @__PURE__ */ React23.createElement(Root3, {
1860
+ ...props,
1861
+ className: tx("popover.viewport", "popover__viewport", {
1862
+ constrainInline,
1863
+ constrainBlock
1864
+ }, classNames),
1865
+ ref: forwardedRef
1866
+ }, children);
1867
+ });
1868
+ var Popover = {
1869
+ Root: PopoverRoot,
1870
+ Portal: PopoverPortal,
1871
+ Trigger: PopoverTrigger,
1872
+ Anchor: PopoverAnchor,
1873
+ Arrow: PopoverArrow,
1874
+ Close: PopoverClose,
1875
+ Content: PopoverContent,
1876
+ Viewport: PopoverViewport
1877
+ };
1878
+
1879
+ // packages/ui/react-ui/src/components/Status/Status.tsx
1880
+ import React24, { forwardRef as forwardRef21 } from "react";
1881
+ var Status = /* @__PURE__ */ forwardRef21(({ classNames, children, progress = 0, indeterminate, ...props }, forwardedRef) => {
1882
+ const { tx } = useThemeContext();
1883
+ return /* @__PURE__ */ React24.createElement("span", {
1884
+ role: "status",
1885
+ ...props,
1886
+ className: tx("status.root", "status", {
1887
+ indeterminate
1888
+ }, classNames),
1889
+ ref: forwardedRef
1890
+ }, /* @__PURE__ */ React24.createElement("span", {
1891
+ role: "none",
1892
+ className: tx("status.bar", "status__bar", {
1893
+ indeterminate
1894
+ }, classNames),
1895
+ ...!indeterminate && {
1896
+ style: {
1897
+ width: `${Math.round(progress * 100)}%`
1898
+ }
1899
+ }
1900
+ }), children);
1901
+ });
1902
+
1903
+ // packages/ui/react-ui/src/components/ScrollArea/ScrollArea.tsx
1904
+ import { Root as ScrollAreaPrimitiveRoot, Viewport as ScrollAreaPrimitiveViewport, Scrollbar as ScrollAreaPrimitiveScrollbar, Thumb as ScrollAreaPrimitiveThumb, Corner as ScrollAreaPrimitiveCorner } from "@radix-ui/react-scroll-area";
1905
+ import React25, { forwardRef as forwardRef22 } from "react";
1906
+ var ScrollAreaRoot = /* @__PURE__ */ forwardRef22(({ classNames, ...props }, forwardedRef) => {
1907
+ const { tx } = useThemeContext();
1908
+ return /* @__PURE__ */ React25.createElement(ScrollAreaPrimitiveRoot, {
1909
+ ...props,
1910
+ className: tx("scrollArea.root", "scroll-area", {}, classNames),
1911
+ ref: forwardedRef
1912
+ });
1913
+ });
1914
+ var ScrollAreaViewport = /* @__PURE__ */ forwardRef22(({ classNames, ...props }, forwardedRef) => {
1915
+ const { tx } = useThemeContext();
1916
+ return /* @__PURE__ */ React25.createElement(ScrollAreaPrimitiveViewport, {
1917
+ ...props,
1918
+ className: tx("scrollArea.viewport", "scroll-area", {}, classNames),
1919
+ ref: forwardedRef
1920
+ });
1921
+ });
1922
+ var ScrollAreaScrollbar = /* @__PURE__ */ forwardRef22(({ classNames, variant = "fine", ...props }, forwardedRef) => {
1923
+ const { tx } = useThemeContext();
1924
+ return /* @__PURE__ */ React25.createElement(ScrollAreaPrimitiveScrollbar, {
1925
+ "data-variant": variant,
1926
+ ...props,
1927
+ className: tx("scrollArea.scrollbar", "scroll-area__scrollbar", {}, classNames),
1928
+ ref: forwardedRef
1929
+ });
1930
+ });
1931
+ var ScrollAreaThumb = /* @__PURE__ */ forwardRef22(({ classNames, ...props }, forwardedRef) => {
1932
+ const { tx } = useThemeContext();
1933
+ return /* @__PURE__ */ React25.createElement(ScrollAreaPrimitiveThumb, {
1934
+ ...props,
1935
+ className: tx("scrollArea.thumb", "scroll-area__thumb", {}, classNames),
1936
+ ref: forwardedRef
1937
+ });
1938
+ });
1939
+ var ScrollAreaCorner = /* @__PURE__ */ forwardRef22(({ classNames, ...props }, forwardedRef) => {
1940
+ const { tx } = useThemeContext();
1941
+ return /* @__PURE__ */ React25.createElement(ScrollAreaPrimitiveCorner, {
1942
+ ...props,
1943
+ className: tx("scrollArea.corner", "scroll-area__corner", {}, classNames),
1944
+ ref: forwardedRef
1945
+ });
1946
+ });
1947
+ var ScrollArea = {
1948
+ Root: ScrollAreaRoot,
1949
+ Viewport: ScrollAreaViewport,
1950
+ Scrollbar: ScrollAreaScrollbar,
1951
+ Thumb: ScrollAreaThumb,
1952
+ Corner: ScrollAreaCorner
1953
+ };
1954
+
1955
+ // packages/ui/react-ui/src/components/Select/Select.tsx
1956
+ import { CaretDown as CaretDown2, CaretUp } from "@phosphor-icons/react";
1957
+ import * as SelectPrimitive from "@radix-ui/react-select";
1958
+ import React26, { forwardRef as forwardRef23 } from "react";
1959
+ var SelectRoot = SelectPrimitive.Root;
1960
+ var SelectTrigger = SelectPrimitive.Trigger;
1961
+ var SelectValue = SelectPrimitive.Value;
1962
+ var SelectIcon = SelectPrimitive.Icon;
1963
+ var SelectPortal = SelectPrimitive.Portal;
1964
+ var SelectTriggerButton = /* @__PURE__ */ forwardRef23(({ children, placeholder, ...props }, forwardedRef) => {
1965
+ const { tx } = useThemeContext();
1966
+ return /* @__PURE__ */ React26.createElement(SelectPrimitive.Trigger, {
1967
+ asChild: true,
1968
+ ref: forwardedRef
1969
+ }, /* @__PURE__ */ React26.createElement(Button, props, /* @__PURE__ */ React26.createElement(SelectPrimitive.Value, {
1970
+ placeholder
1971
+ }, children), /* @__PURE__ */ React26.createElement("span", {
1972
+ className: "w-1 flex-1"
1973
+ }), /* @__PURE__ */ React26.createElement(SelectPrimitive.Icon, {
1974
+ asChild: true
1975
+ }, /* @__PURE__ */ React26.createElement(CaretDown2, {
1976
+ className: tx("select.triggerIcon", "select__trigger__icon", {}),
1977
+ weight: "bold"
1978
+ }))));
1979
+ });
1980
+ var SelectContent = /* @__PURE__ */ forwardRef23(({ classNames, children, ...props }, forwardedRef) => {
1981
+ const { tx } = useThemeContext();
1982
+ return /* @__PURE__ */ React26.createElement(SelectPrimitive.Content, {
1983
+ ...props,
1984
+ className: tx("select.content", "select__content", {}, classNames),
1985
+ position: "popper",
1986
+ ref: forwardedRef
1987
+ }, children);
1988
+ });
1989
+ var SelectScrollUpButton2 = /* @__PURE__ */ forwardRef23(({ classNames, children, ...props }, forwardedRef) => {
1990
+ const { tx } = useThemeContext();
1991
+ return /* @__PURE__ */ React26.createElement(SelectPrimitive.SelectScrollUpButton, {
1992
+ ...props,
1993
+ className: tx("select.scrollButton", "select__scroll-button--up", {}, classNames),
1994
+ ref: forwardedRef
1995
+ }, children ?? /* @__PURE__ */ React26.createElement(CaretUp, {
1996
+ weight: "bold"
1997
+ }));
1998
+ });
1999
+ var SelectScrollDownButton2 = /* @__PURE__ */ forwardRef23(({ classNames, children, ...props }, forwardedRef) => {
2000
+ const { tx } = useThemeContext();
2001
+ return /* @__PURE__ */ React26.createElement(SelectPrimitive.SelectScrollDownButton, {
2002
+ ...props,
2003
+ className: tx("select.scrollButton", "select__scroll-button--down", {}, classNames),
2004
+ ref: forwardedRef
2005
+ }, children ?? /* @__PURE__ */ React26.createElement(CaretDown2, {
2006
+ weight: "bold"
2007
+ }));
2008
+ });
2009
+ var SelectViewport = SelectPrimitive.Viewport;
2010
+ var SelectItem = /* @__PURE__ */ forwardRef23(({ classNames, ...props }, forwardedRef) => {
2011
+ const { tx } = useThemeContext();
2012
+ return /* @__PURE__ */ React26.createElement(SelectPrimitive.Item, {
2013
+ ...props,
2014
+ className: tx("select.item", "option", {}, classNames),
2015
+ ref: forwardedRef
2016
+ });
2017
+ });
2018
+ var SelectItemText = SelectPrimitive.ItemText;
2019
+ var SelectItemIndicator = /* @__PURE__ */ forwardRef23(({ classNames, children, ...props }, forwardedRef) => {
2020
+ const { tx } = useThemeContext();
2021
+ return /* @__PURE__ */ React26.createElement(SelectPrimitive.ItemIndicator, {
2022
+ ...props,
2023
+ className: tx("select.itemIndicator", "option__indicator", {}, classNames),
2024
+ ref: forwardedRef
2025
+ }, children);
2026
+ });
2027
+ var SelectOption = /* @__PURE__ */ forwardRef23(({ children, classNames, ...props }, forwardedRef) => {
2028
+ const { tx } = useThemeContext();
2029
+ return /* @__PURE__ */ React26.createElement(SelectPrimitive.Item, {
2030
+ ...props,
2031
+ className: tx("select.item", "option", {}, classNames),
2032
+ ref: forwardedRef
2033
+ }, /* @__PURE__ */ React26.createElement(SelectPrimitive.ItemText, null, children), /* @__PURE__ */ React26.createElement("span", {
2034
+ className: "grow w-1"
2035
+ }), /* @__PURE__ */ React26.createElement(Icon, {
2036
+ icon: "ph--check--regular"
2037
+ }));
2038
+ });
2039
+ var SelectGroup = SelectPrimitive.Group;
2040
+ var SelectLabel = SelectPrimitive.Label;
2041
+ var SelectSeparator = /* @__PURE__ */ forwardRef23(({ classNames, ...props }, forwardedRef) => {
2042
+ const { tx } = useThemeContext();
2043
+ return /* @__PURE__ */ React26.createElement(SelectPrimitive.Separator, {
2044
+ ...props,
2045
+ className: tx("select.separator", "select__separator", {}, classNames),
2046
+ ref: forwardedRef
2047
+ });
2048
+ });
2049
+ var SelectArrow = /* @__PURE__ */ forwardRef23(({ classNames, ...props }, forwardedRef) => {
2050
+ const { tx } = useThemeContext();
2051
+ return /* @__PURE__ */ React26.createElement(SelectPrimitive.Arrow, {
2052
+ ...props,
2053
+ className: tx("select.arrow", "select__arrow", {}, classNames),
2054
+ ref: forwardedRef
2055
+ });
2056
+ });
2057
+ var Select = {
2058
+ Root: SelectRoot,
2059
+ Trigger: SelectTrigger,
2060
+ TriggerButton: SelectTriggerButton,
2061
+ Value: SelectValue,
2062
+ Icon: SelectIcon,
2063
+ Portal: SelectPortal,
2064
+ Content: SelectContent,
2065
+ ScrollUpButton: SelectScrollUpButton2,
2066
+ ScrollDownButton: SelectScrollDownButton2,
2067
+ Viewport: SelectViewport,
2068
+ Item: SelectItem,
2069
+ ItemText: SelectItemText,
2070
+ ItemIndicator: SelectItemIndicator,
2071
+ Option: SelectOption,
2072
+ Group: SelectGroup,
2073
+ Label: SelectLabel,
2074
+ Separator: SelectSeparator,
2075
+ Arrow: SelectArrow
2076
+ };
2077
+
2078
+ // packages/ui/react-ui/src/components/Separator/Separator.tsx
2079
+ import { Separator as SeparatorPrimitive } from "@radix-ui/react-separator";
2080
+ import React27 from "react";
2081
+ var Separator4 = ({ classNames, orientation = "horizontal", ...props }) => {
2082
+ const { tx } = useThemeContext();
2083
+ return /* @__PURE__ */ React27.createElement(SeparatorPrimitive, {
2084
+ orientation,
2085
+ ...props,
2086
+ className: tx("separator.root", "separator", {
2087
+ orientation
2088
+ }, classNames)
2089
+ });
2090
+ };
2091
+
2092
+ // packages/ui/react-ui/src/components/Tag/Tag.tsx
2093
+ import { Primitive as Primitive12 } from "@radix-ui/react-primitive";
2094
+ import { Slot as Slot13 } from "@radix-ui/react-slot";
2095
+ import React28, { forwardRef as forwardRef24 } from "react";
2096
+ var Tag = /* @__PURE__ */ forwardRef24(({ asChild, palette, classNames, ...props }, forwardedRef) => {
2097
+ const { tx } = useThemeContext();
2098
+ const Root3 = asChild ? Slot13 : Primitive12.span;
2099
+ return /* @__PURE__ */ React28.createElement(Root3, {
2100
+ ...props,
2101
+ className: tx("tag.root", "tag", {
2102
+ palette
2103
+ }, classNames),
2104
+ ref: forwardedRef
2105
+ });
2106
+ });
2107
+
2108
+ // packages/ui/react-ui/src/components/Toast/Toast.tsx
2109
+ import { Primitive as Primitive13 } from "@radix-ui/react-primitive";
2110
+ import { Slot as Slot14 } from "@radix-ui/react-slot";
2111
+ import { ToastProvider as ToastProviderPrimitive, ToastViewport as ToastViewportPrimitive, Root as ToastRootPrimitive, ToastTitle as ToastTitlePrimitive, ToastDescription as ToastDescriptionPrimitive, ToastAction as ToastActionPrimitive, ToastClose as ToastClosePrimitive } from "@radix-ui/react-toast";
2112
+ import React29, { forwardRef as forwardRef25 } from "react";
2113
+ var ToastProvider = ToastProviderPrimitive;
2114
+ var ToastViewport = /* @__PURE__ */ forwardRef25(({ classNames, ...props }, forwardedRef) => {
2115
+ const { tx } = useThemeContext();
2116
+ return /* @__PURE__ */ React29.createElement(ToastViewportPrimitive, {
2117
+ className: tx("toast.viewport", "toast-viewport", {}, classNames),
2118
+ ref: forwardedRef
2119
+ });
2120
+ });
2121
+ var ToastRoot = /* @__PURE__ */ forwardRef25(({ classNames, children, ...props }, forwardedRef) => {
2122
+ const { tx } = useThemeContext();
2123
+ return /* @__PURE__ */ React29.createElement(ToastRootPrimitive, {
2124
+ ...props,
2125
+ className: tx("toast.root", "toast", {}, classNames),
2126
+ ref: forwardedRef
2127
+ }, /* @__PURE__ */ React29.createElement(ElevationProvider, {
2128
+ elevation: "chrome"
2129
+ }, children));
2130
+ });
2131
+ var ToastBody = /* @__PURE__ */ forwardRef25(({ asChild, classNames, ...props }, forwardedRef) => {
2132
+ const { tx } = useThemeContext();
2133
+ const Root3 = asChild ? Slot14 : Primitive13.div;
2134
+ return /* @__PURE__ */ React29.createElement(Root3, {
2135
+ ...props,
2136
+ className: tx("toast.body", "toast__body", {}, classNames),
2137
+ ref: forwardedRef
2138
+ });
2139
+ });
2140
+ var ToastTitle = /* @__PURE__ */ forwardRef25(({ asChild, classNames, ...props }, forwardedRef) => {
2141
+ const { tx } = useThemeContext();
2142
+ const Root3 = asChild ? Slot14 : ToastTitlePrimitive;
2143
+ return /* @__PURE__ */ React29.createElement(Root3, {
2144
+ ...props,
2145
+ className: tx("toast.title", "toast__title", {}, classNames),
2146
+ ref: forwardedRef
2147
+ });
2148
+ });
2149
+ var ToastDescription = /* @__PURE__ */ forwardRef25(({ asChild, classNames, ...props }, forwardedRef) => {
2150
+ const { tx } = useThemeContext();
2151
+ const Root3 = asChild ? Slot14 : ToastDescriptionPrimitive;
2152
+ return /* @__PURE__ */ React29.createElement(Root3, {
2153
+ ...props,
2154
+ className: tx("toast.description", "toast__description", {}, classNames),
2155
+ ref: forwardedRef
2156
+ });
2157
+ });
2158
+ var ToastActions = /* @__PURE__ */ forwardRef25(({ asChild, classNames, ...props }, forwardedRef) => {
2159
+ const { tx } = useThemeContext();
2160
+ const Root3 = asChild ? Slot14 : Primitive13.div;
2161
+ return /* @__PURE__ */ React29.createElement(Root3, {
2162
+ ...props,
2163
+ className: tx("toast.actions", "toast__actions", {}, classNames),
2164
+ ref: forwardedRef
2165
+ });
2166
+ });
2167
+ var ToastAction = ToastActionPrimitive;
2168
+ var ToastClose = ToastClosePrimitive;
2169
+ var Toast = {
2170
+ Provider: ToastProvider,
2171
+ Viewport: ToastViewport,
2172
+ Root: ToastRoot,
2173
+ Body: ToastBody,
2174
+ Title: ToastTitle,
2175
+ Description: ToastDescription,
2176
+ Actions: ToastActions,
2177
+ Action: ToastAction,
2178
+ Close: ToastClose
2179
+ };
2180
+
2181
+ // packages/ui/react-ui/src/components/Toolbar/Toolbar.tsx
2182
+ import * as ToolbarPrimitive from "@radix-ui/react-toolbar";
2183
+ import React30, { forwardRef as forwardRef26 } from "react";
2184
+ var ToolbarRoot = /* @__PURE__ */ forwardRef26(({ classNames, children, ...props }, forwardedRef) => {
2185
+ const { tx } = useThemeContext();
2186
+ return /* @__PURE__ */ React30.createElement(ToolbarPrimitive.Root, {
2187
+ ...props,
2188
+ className: tx("toolbar.root", "toolbar", {}, classNames),
2189
+ ref: forwardedRef
2190
+ }, children);
2191
+ });
2192
+ var ToolbarButton = /* @__PURE__ */ forwardRef26((props, forwardedRef) => {
2193
+ return /* @__PURE__ */ React30.createElement(ToolbarPrimitive.Button, {
2194
+ asChild: true
2195
+ }, /* @__PURE__ */ React30.createElement(Button, {
2196
+ ...props,
2197
+ ref: forwardedRef
2198
+ }));
2199
+ });
2200
+ var ToolbarToggle = /* @__PURE__ */ forwardRef26((props, forwardedRef) => {
2201
+ return /* @__PURE__ */ React30.createElement(ToolbarPrimitive.Button, {
2202
+ asChild: true
2203
+ }, /* @__PURE__ */ React30.createElement(Toggle, {
2204
+ ...props,
2205
+ ref: forwardedRef
2206
+ }));
2207
+ });
2208
+ var ToolbarLink = /* @__PURE__ */ forwardRef26((props, forwardedRef) => {
2209
+ return /* @__PURE__ */ React30.createElement(ToolbarPrimitive.Link, {
2210
+ asChild: true
2211
+ }, /* @__PURE__ */ React30.createElement(Link, {
2212
+ ...props,
2213
+ ref: forwardedRef
2214
+ }));
2215
+ });
2216
+ var ToolbarToggleGroup2 = /* @__PURE__ */ forwardRef26(({ classNames, children, elevation, ...props }, forwardedRef) => {
2217
+ return /* @__PURE__ */ React30.createElement(ToolbarPrimitive.ToolbarToggleGroup, {
2218
+ ...props,
2219
+ asChild: true
2220
+ }, /* @__PURE__ */ React30.createElement(ButtonGroup, {
2221
+ classNames,
2222
+ children,
2223
+ elevation,
2224
+ ref: forwardedRef
2225
+ }));
2226
+ });
2227
+ var ToolbarToggleGroupItem = /* @__PURE__ */ forwardRef26(({ variant, density, elevation, classNames, children, ...props }, forwardedRef) => {
2228
+ return /* @__PURE__ */ React30.createElement(ToolbarPrimitive.ToolbarToggleItem, {
2229
+ ...props,
2230
+ asChild: true
2231
+ }, /* @__PURE__ */ React30.createElement(Button, {
2232
+ variant,
2233
+ density,
2234
+ elevation,
2235
+ classNames,
2236
+ children,
2237
+ ref: forwardedRef
2238
+ }));
2239
+ });
2240
+ var ToolbarSeparator = (props) => {
2241
+ return /* @__PURE__ */ React30.createElement(ToolbarPrimitive.Separator, {
2242
+ asChild: true
2243
+ }, /* @__PURE__ */ React30.createElement(Separator4, {
2244
+ orientation: "vertical",
2245
+ ...props
2246
+ }));
2247
+ };
2248
+ var Toolbar = {
2249
+ Root: ToolbarRoot,
2250
+ Button: ToolbarButton,
2251
+ Link: ToolbarLink,
2252
+ Toggle: ToolbarToggle,
2253
+ ToggleGroup: ToolbarToggleGroup2,
2254
+ ToggleGroupItem: ToolbarToggleGroupItem,
2255
+ Separator: ToolbarSeparator
2256
+ };
2257
+
2258
+ // packages/ui/react-ui/src/components/Tooltip/Tooltip.tsx
2259
+ import { Provider as TooltipProviderPrimitive, Root as TooltipRootPrimitive, TooltipContent as TooltipContentPrimitive, TooltipTrigger as TooltipTriggerPrimitive, TooltipPortal as TooltipPortalPrimitive, TooltipArrow as TooltipArrowPrimitive } from "@radix-ui/react-tooltip";
2260
+ import React31, { forwardRef as forwardRef27 } from "react";
2261
+ var TooltipProvider = TooltipProviderPrimitive;
2262
+ var TooltipRoot = TooltipRootPrimitive;
2263
+ var TooltipPortal = TooltipPortalPrimitive;
2264
+ var TooltipTrigger = TooltipTriggerPrimitive;
2265
+ var TooltipArrow = /* @__PURE__ */ forwardRef27(({ classNames, ...props }, forwardedRef) => {
2266
+ const { tx } = useThemeContext();
2267
+ return /* @__PURE__ */ React31.createElement(TooltipArrowPrimitive, {
2268
+ ...props,
2269
+ className: tx("tooltip.arrow", "tooltip__arrow", {}, classNames),
2270
+ ref: forwardedRef
2271
+ });
2272
+ });
2273
+ var TooltipContent = /* @__PURE__ */ forwardRef27(({ classNames, ...props }, forwardedRef) => {
2274
+ const { tx } = useThemeContext();
2275
+ return /* @__PURE__ */ React31.createElement(TooltipContentPrimitive, {
2276
+ sideOffset: 4,
2277
+ collisionPadding: 8,
2278
+ ...props,
2279
+ className: tx("tooltip.content", "tooltip", {}, classNames),
2280
+ ref: forwardedRef
2281
+ });
2282
+ });
2283
+ var Tooltip = {
2284
+ Provider: TooltipProvider,
2285
+ Root: TooltipRoot,
2286
+ Portal: TooltipPortal,
2287
+ Trigger: TooltipTrigger,
2288
+ Arrow: TooltipArrow,
2289
+ Content: TooltipContent
2290
+ };
2291
+
2292
+ // packages/ui/react-ui/src/components/ThemeProvider/ThemeProvider.tsx
2293
+ import { createKeyborg } from "keyborg";
2294
+ import React32, { createContext as createContext10, useEffect as useEffect5 } from "react";
2295
+
2296
+ // packages/ui/react-ui/src/util/hasIosKeyboard.ts
2297
+ var hasIosKeyboard = () => {
2298
+ return !!navigator.userAgent.match(/iP(ad|od|hone).+Safari/);
2299
+ };
2300
+
2301
+ // packages/ui/react-ui/src/components/ThemeProvider/ThemeProvider.tsx
2302
+ var ThemeContext = /* @__PURE__ */ createContext10(void 0);
2303
+ var ThemeProvider = ({ children, fallback = null, resourceExtensions, appNs, tx = (_path, defaultClassName, _styleProps, ..._options) => defaultClassName, themeMode = "dark", rootDensity = "fine", rootElevation = "base" }) => {
2304
+ useEffect5(() => {
2305
+ if (document.defaultView) {
2306
+ const kb = createKeyborg(document.defaultView);
2307
+ kb.subscribe(handleInputModalityChange);
2308
+ return () => kb.unsubscribe(handleInputModalityChange);
2309
+ }
2310
+ }, []);
2311
+ return /* @__PURE__ */ React32.createElement(ThemeContext.Provider, {
2312
+ value: {
2313
+ tx,
2314
+ themeMode,
2315
+ hasIosKeyboard: hasIosKeyboard()
2316
+ }
2317
+ }, /* @__PURE__ */ React32.createElement(TranslationsProvider, {
2318
+ fallback,
2319
+ resourceExtensions,
2320
+ appNs
2321
+ }, /* @__PURE__ */ React32.createElement(ElevationProvider, {
2322
+ elevation: rootElevation
2323
+ }, /* @__PURE__ */ React32.createElement(DensityProvider, {
2324
+ density: rootDensity
2325
+ }, children))));
2326
+ };
2327
+ var handleInputModalityChange = (isUsingKeyboard) => {
2328
+ if (isUsingKeyboard) {
2329
+ document.body.setAttribute("data-is-keyboard", "true");
2330
+ } else {
2331
+ document.body.removeAttribute("data-is-keyboard");
2332
+ }
2333
+ };
2334
+ export {
2335
+ AlertDialog,
2336
+ AnchoredOverflow,
2337
+ Avatar,
2338
+ AvatarGroup,
2339
+ AvatarGroupItem,
2340
+ BUTTON_GROUP_NAME,
2341
+ Breadcrumb,
2342
+ Button,
2343
+ ButtonGroup,
2344
+ ContextMenu2 as ContextMenu,
2345
+ DensityContext,
2346
+ DensityProvider,
2347
+ Dialog,
2348
+ DropdownMenu2 as DropdownMenu,
2349
+ ElevationContext,
2350
+ ElevationProvider,
2351
+ Icon,
2352
+ Input,
2353
+ LIST_ITEM_NAME,
2354
+ LIST_NAME,
2355
+ Link,
2356
+ List,
2357
+ ListItem,
2358
+ Main,
2359
+ Message,
2360
+ Popover,
2361
+ ScrollArea,
2362
+ Select,
2363
+ Separator4 as Separator,
2364
+ Status,
2365
+ Tag,
2366
+ ThemeContext,
2367
+ ThemeProvider,
2368
+ Toast,
2369
+ Toggle,
2370
+ ToggleGroup,
2371
+ ToggleGroupItem,
2372
+ Toolbar,
2373
+ Tooltip,
2374
+ Trans,
2375
+ Tree,
2376
+ TreeItem,
2377
+ Treegrid,
2378
+ hasIosKeyboard,
2379
+ isLabel,
2380
+ toLocalizedString,
2381
+ useAvatarContext,
2382
+ useButtonGroupContext,
2383
+ useDensityContext,
2384
+ useDropdownMenuContext2 as useDropdownMenuContext,
2385
+ useDropdownMenuMenuScope2 as useDropdownMenuMenuScope,
2386
+ useElevationContext,
2387
+ useListContext,
2388
+ useListItemContext,
2389
+ useMainContext,
2390
+ useSidebars,
2391
+ useThemeContext,
2392
+ useTranslation,
2393
+ useTranslationsContext,
2394
+ useVisualViewport
2395
+ };
2396
+ //# sourceMappingURL=index.mjs.map