@dxos/react-ui 0.6.13 → 0.6.14-main.1366248

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 (127) hide show
  1. package/dist/lib/browser/index.mjs +740 -200
  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 +2932 -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 +2931 -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.d.ts +1 -1
  17. package/dist/types/src/components/Buttons/Button.d.ts.map +1 -1
  18. package/dist/types/src/components/Buttons/Button.stories.d.ts +12 -17
  19. package/dist/types/src/components/Buttons/Button.stories.d.ts.map +1 -1
  20. package/dist/types/src/components/Buttons/Toggle.stories.d.ts +2 -1
  21. package/dist/types/src/components/Buttons/Toggle.stories.d.ts.map +1 -1
  22. package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts +20 -1
  23. package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts.map +1 -1
  24. package/dist/types/src/components/DensityProvider/DensityProvider.d.ts.map +1 -1
  25. package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts +12 -1
  26. package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts.map +1 -1
  27. package/dist/types/src/components/Dialogs/Dialog.stories.d.ts +11 -1
  28. package/dist/types/src/components/Dialogs/Dialog.stories.d.ts.map +1 -1
  29. package/dist/types/src/components/Icon/Icon.d.ts +1 -1
  30. package/dist/types/src/components/Icon/Icon.d.ts.map +1 -1
  31. package/dist/types/src/components/Input/Input.d.ts.map +1 -1
  32. package/dist/types/src/components/Input/Input.stories.d.ts +16 -1
  33. package/dist/types/src/components/Input/Input.stories.d.ts.map +1 -1
  34. package/dist/types/src/components/Lists/List.stories.d.ts +2 -3
  35. package/dist/types/src/components/Lists/List.stories.d.ts.map +1 -1
  36. package/dist/types/src/components/Lists/Tree.stories.d.ts +5 -1
  37. package/dist/types/src/components/Lists/Tree.stories.d.ts.map +1 -1
  38. package/dist/types/src/components/Lists/Treegrid.stories.d.ts +3 -2
  39. package/dist/types/src/components/Lists/Treegrid.stories.d.ts.map +1 -1
  40. package/dist/types/src/components/Main/Main.stories.d.ts +5 -1
  41. package/dist/types/src/components/Main/Main.stories.d.ts.map +1 -1
  42. package/dist/types/src/components/Menus/ContextMenu.stories.d.ts +29 -1
  43. package/dist/types/src/components/Menus/ContextMenu.stories.d.ts.map +1 -1
  44. package/dist/types/src/components/Menus/DropdownMenu.d.ts +105 -44
  45. package/dist/types/src/components/Menus/DropdownMenu.d.ts.map +1 -1
  46. package/dist/types/src/components/Menus/DropdownMenu.stories.d.ts +29 -1
  47. package/dist/types/src/components/Menus/DropdownMenu.stories.d.ts.map +1 -1
  48. package/dist/types/src/components/Message/Message.stories.d.ts +6 -1
  49. package/dist/types/src/components/Message/Message.stories.d.ts.map +1 -1
  50. package/dist/types/src/components/Popover/Popover.d.ts +87 -21
  51. package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
  52. package/dist/types/src/components/Popover/Popover.stories.d.ts +20 -1
  53. package/dist/types/src/components/Popover/Popover.stories.d.ts.map +1 -1
  54. package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts +20 -1
  55. package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts.map +1 -1
  56. package/dist/types/src/components/Select/Select.d.ts +4 -2
  57. package/dist/types/src/components/Select/Select.d.ts.map +1 -1
  58. package/dist/types/src/components/Select/Select.stories.d.ts +10 -11
  59. package/dist/types/src/components/Select/Select.stories.d.ts.map +1 -1
  60. package/dist/types/src/components/Status/Status.stories.d.ts +0 -3
  61. package/dist/types/src/components/Status/Status.stories.d.ts.map +1 -1
  62. package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts +4 -5
  63. package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
  64. package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts +4 -4
  65. package/dist/types/src/components/Toast/Toast.d.ts.map +1 -1
  66. package/dist/types/src/components/Toast/Toast.stories.d.ts +20 -1
  67. package/dist/types/src/components/Toast/Toast.stories.d.ts.map +1 -1
  68. package/dist/types/src/components/Toolbar/Toolbar.d.ts +4 -2
  69. package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
  70. package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts +30 -1
  71. package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -1
  72. package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts +13 -1
  73. package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts.map +1 -1
  74. package/dist/types/src/hooks/useThemeContext.d.ts.map +1 -1
  75. package/dist/types/src/playground/Controls.stories.d.ts +2 -6
  76. package/dist/types/src/playground/Controls.stories.d.ts.map +1 -1
  77. package/dist/types/src/playground/Surfaces.stories.d.ts +6 -2
  78. package/dist/types/src/playground/Surfaces.stories.d.ts.map +1 -1
  79. package/dist/types/src/playground/Typography.stories.d.ts +1 -1
  80. package/dist/types/src/testing/decorators/index.d.ts +1 -0
  81. package/dist/types/src/testing/decorators/index.d.ts.map +1 -1
  82. package/dist/types/src/testing/decorators/withVariants.d.ts +13 -0
  83. package/dist/types/src/testing/decorators/withVariants.d.ts.map +1 -0
  84. package/package.json +28 -17
  85. package/src/components/Avatars/Avatar.stories.tsx +3 -2
  86. package/src/components/Avatars/AvatarGroup.stories.tsx +3 -2
  87. package/src/components/Breadcrumb/Breadcrumb.stories.tsx +3 -2
  88. package/src/components/Buttons/Button.stories.tsx +34 -63
  89. package/src/components/Buttons/Button.tsx +46 -36
  90. package/src/components/Buttons/Toggle.stories.tsx +3 -2
  91. package/src/components/Buttons/ToggleGroup.stories.tsx +3 -2
  92. package/src/components/DensityProvider/DensityProvider.tsx +1 -1
  93. package/src/components/Dialogs/AlertDialog.stories.tsx +3 -2
  94. package/src/components/Dialogs/Dialog.stories.tsx +3 -2
  95. package/src/components/Icon/Icon.tsx +11 -9
  96. package/src/components/Input/Input.stories.tsx +4 -3
  97. package/src/components/Link/Link.stories.tsx +1 -1
  98. package/src/components/Lists/List.stories.tsx +4 -4
  99. package/src/components/Lists/Tree.stories.tsx +3 -2
  100. package/src/components/Lists/Treegrid.stories.tsx +7 -5
  101. package/src/components/Main/Main.stories.tsx +3 -2
  102. package/src/components/Menus/ContextMenu.stories.tsx +3 -2
  103. package/src/components/Menus/DropdownMenu.stories.tsx +43 -3
  104. package/src/components/Menus/DropdownMenu.tsx +518 -69
  105. package/src/components/Message/Message.stories.tsx +3 -2
  106. package/src/components/Popover/Popover.stories.tsx +27 -3
  107. package/src/components/Popover/Popover.tsx +524 -55
  108. package/src/components/ScrollArea/ScrollArea.stories.tsx +3 -2
  109. package/src/components/Select/Select.stories.tsx +14 -31
  110. package/src/components/Select/Select.tsx +24 -12
  111. package/src/components/Status/Status.stories.tsx +1 -2
  112. package/src/components/Tag/Tag.stories.tsx +1 -1
  113. package/src/components/ThemeProvider/ThemeProvider.tsx +17 -18
  114. package/src/components/Toast/Toast.stories.tsx +3 -2
  115. package/src/components/Toast/Toast.tsx +1 -4
  116. package/src/components/Toolbar/Toolbar.stories.tsx +3 -2
  117. package/src/components/Toolbar/Toolbar.tsx +21 -1
  118. package/src/components/Tooltip/Tooltip.stories.tsx +3 -2
  119. package/src/hooks/useThemeContext.ts +3 -1
  120. package/src/playground/Controls.stories.tsx +7 -10
  121. package/src/playground/Surfaces.stories.tsx +4 -3
  122. package/src/playground/Typography.stories.tsx +2 -2
  123. package/src/testing/decorators/index.ts +1 -0
  124. package/src/testing/decorators/withVariants.tsx +45 -0
  125. package/dist/types/src/playground/helpers.d.ts +0 -6
  126. package/dist/types/src/playground/helpers.d.ts.map +0 -1
  127. package/src/playground/helpers.tsx +0 -32
@@ -0,0 +1,2931 @@
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 Root5 = asChild ? Slot : Primitive.div;
128
+ return /* @__PURE__ */ React2.createElement(Root5, {
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 Root5 = asChild ? Slot : Primitive.div;
138
+ return /* @__PURE__ */ React2.createElement(Root5, {
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, memo } from "react";
160
+ var Icon = /* @__PURE__ */ memo(/* @__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 Root5 = asChild ? Slot2 : Primitive2.span;
266
+ const { tx } = useThemeContext();
267
+ const { labelId } = useAvatarContext("AvatarLabel");
268
+ return /* @__PURE__ */ React4.createElement(Root5, {
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 Root5 = asChild ? Slot2 : Primitive2.span;
279
+ const { tx } = useThemeContext();
280
+ const { descriptionId } = useAvatarContext("AvatarDescription");
281
+ return /* @__PURE__ */ React4.createElement(Root5, {
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 Root5 = asChild ? Slot3 : Primitive3.a;
445
+ return /* @__PURE__ */ React6.createElement(Root5, {
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 Root5 = asChild ? Slot4 : Primitive4.div;
458
+ return /* @__PURE__ */ React7.createElement(Root5, {
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 Root5 = asChild ? Slot4 : Primitive4.ol;
468
+ return /* @__PURE__ */ React7.createElement(Root5, {
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 Root5 = asChild ? Slot4 : Primitive4.li;
478
+ return /* @__PURE__ */ React7.createElement(Root5, {
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 Root5 = asChild ? Slot4 : Link;
487
+ return /* @__PURE__ */ React7.createElement(Root5, {
488
+ ...props,
489
+ ref: forwardedRef
490
+ });
491
+ });
492
+ var BreadcrumbCurrent = /* @__PURE__ */ forwardRef6(({ asChild, classNames, ...props }, forwardedRef) => {
493
+ const { tx } = useThemeContext();
494
+ const Root5 = asChild ? Slot4 : "h1";
495
+ return /* @__PURE__ */ React7.createElement(Root5, {
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, memo as memo2 } 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__ */ memo2(/* @__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 Root5 = asChild ? Slot5 : Primitive5.button;
538
+ return /* @__PURE__ */ React8.createElement(Root5, {
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 Root5 = asChild ? Slot5 : Primitive5.div;
561
+ return /* @__PURE__ */ React8.createElement(Root5, {
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 Root5 = asChild ? Slot6 : Primitive6.div;
792
+ return /* @__PURE__ */ React14.createElement(Root5, {
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 { composeEventHandlers } from "@radix-ui/primitive";
857
+ import { composeRefs } from "@radix-ui/react-compose-refs";
858
+ import { createContextScope } from "@radix-ui/react-context";
859
+ import { useId as useId3 } from "@radix-ui/react-id";
860
+ import * as MenuPrimitive from "@radix-ui/react-menu";
861
+ import { createMenuScope } from "@radix-ui/react-menu";
862
+ import { Primitive as Primitive7 } from "@radix-ui/react-primitive";
863
+ import { Slot as Slot7 } from "@radix-ui/react-slot";
864
+ import { useControllableState } from "@radix-ui/react-use-controllable-state";
865
+ import React15, { useRef, useCallback, forwardRef as forwardRef13, useEffect as useEffect3 } from "react";
866
+ var DROPDOWN_MENU_NAME = "DropdownMenu";
867
+ var [createDropdownMenuContext, createDropdownMenuScope] = createContextScope(DROPDOWN_MENU_NAME, [
868
+ createMenuScope
869
+ ]);
870
+ var useMenuScope = createMenuScope();
871
+ var [DropdownMenuProvider, useDropdownMenuContext] = createDropdownMenuContext(DROPDOWN_MENU_NAME);
872
+ var DropdownMenuRoot = (props) => {
873
+ const { __scopeDropdownMenu, children, dir, open: openProp, defaultOpen, onOpenChange, modal = true } = props;
874
+ const menuScope = useMenuScope(__scopeDropdownMenu);
875
+ const triggerRef = useRef(null);
876
+ const [open = false, setOpen] = useControllableState({
877
+ prop: openProp,
878
+ defaultProp: defaultOpen,
879
+ onChange: onOpenChange
880
+ });
881
+ return /* @__PURE__ */ React15.createElement(DropdownMenuProvider, {
882
+ scope: __scopeDropdownMenu,
883
+ triggerId: useId3(),
884
+ triggerRef,
885
+ contentId: useId3(),
886
+ open,
887
+ onOpenChange: setOpen,
888
+ onOpenToggle: useCallback(() => setOpen((prevOpen) => !prevOpen), [
889
+ setOpen
890
+ ]),
891
+ modal
892
+ }, /* @__PURE__ */ React15.createElement(MenuPrimitive.Root, {
893
+ ...menuScope,
894
+ open,
895
+ onOpenChange: setOpen,
896
+ dir,
897
+ modal
898
+ }, children));
899
+ };
900
+ DropdownMenuRoot.displayName = DROPDOWN_MENU_NAME;
901
+ var TRIGGER_NAME = "DropdownMenuTrigger";
902
+ var DropdownMenuTrigger = /* @__PURE__ */ forwardRef13((props, forwardedRef) => {
903
+ const { __scopeDropdownMenu, disabled = false, ...triggerProps } = props;
904
+ const context = useDropdownMenuContext(TRIGGER_NAME, __scopeDropdownMenu);
905
+ const menuScope = useMenuScope(__scopeDropdownMenu);
906
+ return /* @__PURE__ */ React15.createElement(MenuPrimitive.Anchor, {
907
+ asChild: true,
908
+ ...menuScope
909
+ }, /* @__PURE__ */ React15.createElement(Primitive7.button, {
910
+ type: "button",
911
+ id: context.triggerId,
912
+ "aria-haspopup": "menu",
913
+ "aria-expanded": context.open,
914
+ "aria-controls": context.open ? context.contentId : void 0,
915
+ "data-state": context.open ? "open" : "closed",
916
+ "data-disabled": disabled ? "" : void 0,
917
+ disabled,
918
+ ...triggerProps,
919
+ ref: composeRefs(forwardedRef, context.triggerRef),
920
+ onPointerDown: composeEventHandlers(props.onPointerDown, (event) => {
921
+ if (!disabled && event.button === 0 && event.ctrlKey === false) {
922
+ context.onOpenToggle();
923
+ if (!context.open) {
924
+ event.preventDefault();
925
+ }
926
+ }
927
+ }),
928
+ onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
929
+ if (disabled) {
930
+ return;
931
+ }
932
+ if ([
933
+ "Enter",
934
+ " "
935
+ ].includes(event.key)) {
936
+ context.onOpenToggle();
937
+ }
938
+ if (event.key === "ArrowDown") {
939
+ context.onOpenChange(true);
940
+ }
941
+ if ([
942
+ "Enter",
943
+ " ",
944
+ "ArrowDown"
945
+ ].includes(event.key)) {
946
+ event.preventDefault();
947
+ }
948
+ })
949
+ }));
950
+ });
951
+ DropdownMenuTrigger.displayName = TRIGGER_NAME;
952
+ var VIRTUAL_TRIGGER_NAME = "DropdownMenuVirtualTrigger";
953
+ var DropdownMenuVirtualTrigger = (props) => {
954
+ const { __scopeDropdownMenu, virtualRef } = props;
955
+ const context = useDropdownMenuContext(VIRTUAL_TRIGGER_NAME, __scopeDropdownMenu);
956
+ const menuScope = useMenuScope(__scopeDropdownMenu);
957
+ useEffect3(() => {
958
+ if (virtualRef.current) {
959
+ context.triggerRef.current = virtualRef.current;
960
+ }
961
+ });
962
+ return /* @__PURE__ */ React15.createElement(MenuPrimitive.Anchor, {
963
+ ...menuScope,
964
+ virtualRef
965
+ });
966
+ };
967
+ DropdownMenuVirtualTrigger.displayName = VIRTUAL_TRIGGER_NAME;
968
+ var PORTAL_NAME = "DropdownMenuPortal";
969
+ var DropdownMenuPortal = (props) => {
970
+ const { __scopeDropdownMenu, ...portalProps } = props;
971
+ const menuScope = useMenuScope(__scopeDropdownMenu);
972
+ return /* @__PURE__ */ React15.createElement(MenuPrimitive.Portal, {
973
+ ...menuScope,
974
+ ...portalProps
975
+ });
976
+ };
977
+ DropdownMenuPortal.displayName = PORTAL_NAME;
978
+ var DropdownMenuViewport = /* @__PURE__ */ forwardRef13(({ classNames, asChild, children, ...props }, forwardedRef) => {
979
+ const { tx } = useThemeContext();
980
+ const Root5 = asChild ? Slot7 : Primitive7.div;
981
+ return /* @__PURE__ */ React15.createElement(Root5, {
982
+ ...props,
983
+ className: tx("menu.viewport", "menu__viewport", {}, classNames),
984
+ ref: forwardedRef
985
+ }, children);
986
+ });
987
+ var CONTENT_NAME = "DropdownMenuContent";
988
+ var DropdownMenuContent = /* @__PURE__ */ forwardRef13((props, forwardedRef) => {
989
+ const { __scopeDropdownMenu, classNames, ...contentProps } = props;
990
+ const { tx } = useThemeContext();
991
+ const context = useDropdownMenuContext(CONTENT_NAME, __scopeDropdownMenu);
992
+ const menuScope = useMenuScope(__scopeDropdownMenu);
993
+ const hasInteractedOutsideRef = useRef(false);
994
+ return /* @__PURE__ */ React15.createElement(MenuPrimitive.Content, {
995
+ id: context.contentId,
996
+ "aria-labelledby": context.triggerId,
997
+ ...menuScope,
998
+ ...contentProps,
999
+ ref: forwardedRef,
1000
+ onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
1001
+ if (!hasInteractedOutsideRef.current) {
1002
+ context.triggerRef.current?.focus();
1003
+ }
1004
+ hasInteractedOutsideRef.current = false;
1005
+ event.preventDefault();
1006
+ }),
1007
+ onInteractOutside: composeEventHandlers(props.onInteractOutside, (event) => {
1008
+ const originalEvent = event.detail.originalEvent;
1009
+ const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
1010
+ const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
1011
+ if (!context.modal || isRightClick) {
1012
+ hasInteractedOutsideRef.current = true;
1013
+ }
1014
+ }),
1015
+ className: tx("menu.content", "menu", {}, classNames),
1016
+ style: {
1017
+ ...props.style,
1018
+ // re-namespace exposed content custom properties
1019
+ ...{
1020
+ "--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
1021
+ "--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
1022
+ "--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
1023
+ "--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
1024
+ "--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
1025
+ }
1026
+ }
1027
+ });
1028
+ });
1029
+ DropdownMenuContent.displayName = CONTENT_NAME;
1030
+ var GROUP_NAME = "DropdownMenuGroup";
1031
+ var DropdownMenuGroup = /* @__PURE__ */ forwardRef13((props, forwardedRef) => {
1032
+ const { __scopeDropdownMenu, ...groupProps } = props;
1033
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1034
+ return /* @__PURE__ */ React15.createElement(MenuPrimitive.Group, {
1035
+ ...menuScope,
1036
+ ...groupProps,
1037
+ ref: forwardedRef
1038
+ });
1039
+ });
1040
+ DropdownMenuGroup.displayName = GROUP_NAME;
1041
+ var LABEL_NAME = "DropdownMenuLabel";
1042
+ var DropdownMenuGroupLabel = /* @__PURE__ */ forwardRef13((props, forwardedRef) => {
1043
+ const { __scopeDropdownMenu, classNames, ...labelProps } = props;
1044
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1045
+ const { tx } = useThemeContext();
1046
+ return /* @__PURE__ */ React15.createElement(MenuPrimitive.Label, {
1047
+ ...menuScope,
1048
+ ...labelProps,
1049
+ className: tx("menu.groupLabel", "menu__group__label", {}, classNames),
1050
+ ref: forwardedRef
1051
+ });
1052
+ });
1053
+ DropdownMenuGroupLabel.displayName = LABEL_NAME;
1054
+ var ITEM_NAME = "DropdownMenuItem";
1055
+ var DropdownMenuItem = /* @__PURE__ */ forwardRef13((props, forwardedRef) => {
1056
+ const { __scopeDropdownMenu, classNames, ...itemProps } = props;
1057
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1058
+ const { tx } = useThemeContext();
1059
+ return /* @__PURE__ */ React15.createElement(MenuPrimitive.Item, {
1060
+ ...menuScope,
1061
+ ...itemProps,
1062
+ className: tx("menu.item", "menu__item", {}, classNames),
1063
+ ref: forwardedRef
1064
+ });
1065
+ });
1066
+ DropdownMenuItem.displayName = ITEM_NAME;
1067
+ var CHECKBOX_ITEM_NAME = "DropdownMenuCheckboxItem";
1068
+ var DropdownMenuCheckboxItem = /* @__PURE__ */ forwardRef13((props, forwardedRef) => {
1069
+ const { __scopeDropdownMenu, classNames, ...checkboxItemProps } = props;
1070
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1071
+ const { tx } = useThemeContext();
1072
+ return /* @__PURE__ */ React15.createElement(MenuPrimitive.CheckboxItem, {
1073
+ ...menuScope,
1074
+ ...checkboxItemProps,
1075
+ className: tx("menu.item", "menu__item--checkbox", {}, classNames),
1076
+ ref: forwardedRef
1077
+ });
1078
+ });
1079
+ DropdownMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;
1080
+ var RADIO_GROUP_NAME = "DropdownMenuRadioGroup";
1081
+ var DropdownMenuRadioGroup = /* @__PURE__ */ forwardRef13((props, forwardedRef) => {
1082
+ const { __scopeDropdownMenu, ...radioGroupProps } = props;
1083
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1084
+ return /* @__PURE__ */ React15.createElement(MenuPrimitive.RadioGroup, {
1085
+ ...menuScope,
1086
+ ...radioGroupProps,
1087
+ ref: forwardedRef
1088
+ });
1089
+ });
1090
+ DropdownMenuRadioGroup.displayName = RADIO_GROUP_NAME;
1091
+ var RADIO_ITEM_NAME = "DropdownMenuRadioItem";
1092
+ var DropdownMenuRadioItem = /* @__PURE__ */ forwardRef13((props, forwardedRef) => {
1093
+ const { __scopeDropdownMenu, ...radioItemProps } = props;
1094
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1095
+ return /* @__PURE__ */ React15.createElement(MenuPrimitive.RadioItem, {
1096
+ ...menuScope,
1097
+ ...radioItemProps,
1098
+ ref: forwardedRef
1099
+ });
1100
+ });
1101
+ DropdownMenuRadioItem.displayName = RADIO_ITEM_NAME;
1102
+ var INDICATOR_NAME = "DropdownMenuItemIndicator";
1103
+ var DropdownMenuItemIndicator = /* @__PURE__ */ forwardRef13((props, forwardedRef) => {
1104
+ const { __scopeDropdownMenu, ...itemIndicatorProps } = props;
1105
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1106
+ return /* @__PURE__ */ React15.createElement(MenuPrimitive.ItemIndicator, {
1107
+ ...menuScope,
1108
+ ...itemIndicatorProps,
1109
+ ref: forwardedRef
1110
+ });
1111
+ });
1112
+ DropdownMenuItemIndicator.displayName = INDICATOR_NAME;
1113
+ var SEPARATOR_NAME = "DropdownMenuSeparator";
1114
+ var DropdownMenuSeparator = /* @__PURE__ */ forwardRef13((props, forwardedRef) => {
1115
+ const { __scopeDropdownMenu, classNames, ...separatorProps } = props;
1116
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1117
+ const { tx } = useThemeContext();
1118
+ return /* @__PURE__ */ React15.createElement(MenuPrimitive.Separator, {
1119
+ ...menuScope,
1120
+ ...separatorProps,
1121
+ className: tx("menu.separator", "menu__item", {}, classNames),
1122
+ ref: forwardedRef
1123
+ });
1124
+ });
1125
+ DropdownMenuSeparator.displayName = SEPARATOR_NAME;
1126
+ var ARROW_NAME = "DropdownMenuArrow";
1127
+ var DropdownMenuArrow = /* @__PURE__ */ forwardRef13((props, forwardedRef) => {
1128
+ const { __scopeDropdownMenu, classNames, ...arrowProps } = props;
1129
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1130
+ const { tx } = useThemeContext();
1131
+ return /* @__PURE__ */ React15.createElement(MenuPrimitive.Arrow, {
1132
+ ...menuScope,
1133
+ ...arrowProps,
1134
+ className: tx("menu.arrow", "menu__arrow", {}, classNames),
1135
+ ref: forwardedRef
1136
+ });
1137
+ });
1138
+ DropdownMenuArrow.displayName = ARROW_NAME;
1139
+ var DropdownMenuSub = (props) => {
1140
+ const { __scopeDropdownMenu, children, open: openProp, onOpenChange, defaultOpen } = props;
1141
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1142
+ const [open = false, setOpen] = useControllableState({
1143
+ prop: openProp,
1144
+ defaultProp: defaultOpen,
1145
+ onChange: onOpenChange
1146
+ });
1147
+ return /* @__PURE__ */ React15.createElement(MenuPrimitive.Sub, {
1148
+ ...menuScope,
1149
+ open,
1150
+ onOpenChange: setOpen
1151
+ }, children);
1152
+ };
1153
+ var SUB_TRIGGER_NAME = "DropdownMenuSubTrigger";
1154
+ var DropdownMenuSubTrigger = /* @__PURE__ */ forwardRef13((props, forwardedRef) => {
1155
+ const { __scopeDropdownMenu, ...subTriggerProps } = props;
1156
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1157
+ return /* @__PURE__ */ React15.createElement(MenuPrimitive.SubTrigger, {
1158
+ ...menuScope,
1159
+ ...subTriggerProps,
1160
+ ref: forwardedRef
1161
+ });
1162
+ });
1163
+ DropdownMenuSubTrigger.displayName = SUB_TRIGGER_NAME;
1164
+ var SUB_CONTENT_NAME = "DropdownMenuSubContent";
1165
+ var DropdownMenuSubContent = /* @__PURE__ */ forwardRef13((props, forwardedRef) => {
1166
+ const { __scopeDropdownMenu, ...subContentProps } = props;
1167
+ const menuScope = useMenuScope(__scopeDropdownMenu);
1168
+ return /* @__PURE__ */ React15.createElement(MenuPrimitive.SubContent, {
1169
+ ...menuScope,
1170
+ ...subContentProps,
1171
+ ref: forwardedRef,
1172
+ style: {
1173
+ ...props.style,
1174
+ // re-namespace exposed content custom properties
1175
+ ...{
1176
+ "--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
1177
+ "--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
1178
+ "--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
1179
+ "--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
1180
+ "--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
1181
+ }
1182
+ }
1183
+ });
1184
+ });
1185
+ DropdownMenuSubContent.displayName = SUB_CONTENT_NAME;
1186
+ var DropdownMenu = {
1187
+ Root: DropdownMenuRoot,
1188
+ Trigger: DropdownMenuTrigger,
1189
+ VirtualTrigger: DropdownMenuVirtualTrigger,
1190
+ Portal: DropdownMenuPortal,
1191
+ Content: DropdownMenuContent,
1192
+ Viewport: DropdownMenuViewport,
1193
+ Group: DropdownMenuGroup,
1194
+ GroupLabel: DropdownMenuGroupLabel,
1195
+ Item: DropdownMenuItem,
1196
+ CheckboxItem: DropdownMenuCheckboxItem,
1197
+ RadioGroup: DropdownMenuRadioGroup,
1198
+ RadioItem: DropdownMenuRadioItem,
1199
+ ItemIndicator: DropdownMenuItemIndicator,
1200
+ Separator: DropdownMenuSeparator,
1201
+ Arrow: DropdownMenuArrow,
1202
+ Sub: DropdownMenuSub,
1203
+ SubTrigger: DropdownMenuSubTrigger,
1204
+ SubContent: DropdownMenuSubContent
1205
+ };
1206
+ var useDropdownMenuMenuScope = useMenuScope;
1207
+
1208
+ // packages/ui/react-ui/src/components/Input/Input.tsx
1209
+ import { Check, Minus } from "@phosphor-icons/react";
1210
+ import { Root as CheckboxPrimitive, Indicator as CheckboxIndicatorPrimitive } from "@radix-ui/react-checkbox";
1211
+ import { Root as SwitchPrimitive, Thumb as SwitchThumbPrimitive } from "@radix-ui/react-switch";
1212
+ import { useControllableState as useControllableState2 } from "@radix-ui/react-use-controllable-state";
1213
+ import React16, { forwardRef as forwardRef14, Fragment, useCallback as useCallback2 } from "react";
1214
+ 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";
1215
+ var Label3 = /* @__PURE__ */ forwardRef14(({ srOnly, classNames, children, ...props }, forwardedRef) => {
1216
+ const { tx } = useThemeContext();
1217
+ return /* @__PURE__ */ React16.createElement(LabelPrimitive, {
1218
+ ...props,
1219
+ className: tx("input.label", "input__label", {
1220
+ srOnly
1221
+ }, classNames),
1222
+ ref: forwardedRef
1223
+ }, children);
1224
+ });
1225
+ var Description = /* @__PURE__ */ forwardRef14(({ srOnly, classNames, children, ...props }, forwardedRef) => {
1226
+ const { tx } = useThemeContext();
1227
+ return /* @__PURE__ */ React16.createElement(DescriptionPrimitive, {
1228
+ ...props,
1229
+ className: tx("input.description", "input__description", {
1230
+ srOnly
1231
+ }, classNames),
1232
+ ref: forwardedRef
1233
+ }, children);
1234
+ });
1235
+ var Validation = /* @__PURE__ */ forwardRef14(({ __inputScope, srOnly, classNames, children, ...props }, forwardedRef) => {
1236
+ const { tx } = useThemeContext();
1237
+ const { validationValence } = useInputContext(INPUT_NAME, __inputScope);
1238
+ return /* @__PURE__ */ React16.createElement(ValidationPrimitive, {
1239
+ ...props,
1240
+ className: tx("input.validation", `input__validation-message input__validation-message--${validationValence}`, {
1241
+ srOnly,
1242
+ validationValence
1243
+ }, classNames),
1244
+ ref: forwardedRef
1245
+ }, children);
1246
+ });
1247
+ var DescriptionAndValidation = /* @__PURE__ */ forwardRef14(({ srOnly, classNames, children, ...props }, forwardedRef) => {
1248
+ const { tx } = useThemeContext();
1249
+ return /* @__PURE__ */ React16.createElement(DescriptionAndValidationPrimitive, {
1250
+ ...props,
1251
+ className: tx("input.descriptionAndValidation", "input__description-and-validation", {
1252
+ srOnly
1253
+ }, classNames),
1254
+ ref: forwardedRef
1255
+ }, children);
1256
+ });
1257
+ var PinInput = /* @__PURE__ */ forwardRef14(({ density: propsDensity, elevation: propsElevation, segmentClassName: propsSegmentClassName, inputClassName, variant, ...props }, forwardedRef) => {
1258
+ const { hasIosKeyboard: hasIosKeyboard2 } = useThemeContext();
1259
+ const { tx } = useThemeContext();
1260
+ const density = useDensityContext(propsDensity);
1261
+ const elevation = useElevationContext(propsElevation);
1262
+ const segmentClassName = useCallback2(({ focused, validationValence }) => tx("input.input", "input--pin-segment", {
1263
+ variant: "static",
1264
+ focused,
1265
+ disabled: props.disabled,
1266
+ density,
1267
+ elevation,
1268
+ validationValence
1269
+ }, propsSegmentClassName), [
1270
+ tx,
1271
+ props.disabled,
1272
+ elevation,
1273
+ propsElevation,
1274
+ density
1275
+ ]);
1276
+ return /* @__PURE__ */ React16.createElement(PinInputPrimitive, {
1277
+ ...props,
1278
+ segmentClassName,
1279
+ ...props.autoFocus && !hasIosKeyboard2 && {
1280
+ autoFocus: true
1281
+ },
1282
+ inputClassName: tx("input.inputWithSegments", "input input--pin", {
1283
+ disabled: props.disabled
1284
+ }, inputClassName),
1285
+ ref: forwardedRef
1286
+ });
1287
+ });
1288
+ var TextInput = /* @__PURE__ */ forwardRef14(({ __inputScope, classNames, density: propsDensity, elevation: propsElevation, variant, ...props }, forwardedRef) => {
1289
+ const { hasIosKeyboard: hasIosKeyboard2 } = useThemeContext();
1290
+ const themeContextValue = useThemeContext();
1291
+ const density = useDensityContext(propsDensity);
1292
+ const elevation = useElevationContext(propsElevation);
1293
+ const { validationValence } = useInputContext(INPUT_NAME, __inputScope);
1294
+ const { tx } = themeContextValue;
1295
+ return /* @__PURE__ */ React16.createElement(TextInputPrimitive, {
1296
+ ...props,
1297
+ className: tx("input.input", "input", {
1298
+ variant,
1299
+ disabled: props.disabled,
1300
+ density,
1301
+ elevation,
1302
+ validationValence
1303
+ }, classNames),
1304
+ ...props.autoFocus && !hasIosKeyboard2 && {
1305
+ autoFocus: true
1306
+ },
1307
+ ref: forwardedRef
1308
+ });
1309
+ });
1310
+ var TextArea = /* @__PURE__ */ forwardRef14(({ __inputScope, classNames, density: propsDensity, elevation: propsElevation, variant, ...props }, forwardedRef) => {
1311
+ const { hasIosKeyboard: hasIosKeyboard2 } = useThemeContext();
1312
+ const { tx } = useThemeContext();
1313
+ const density = useDensityContext(propsDensity);
1314
+ const elevation = useElevationContext(propsElevation);
1315
+ const { validationValence } = useInputContext(INPUT_NAME, __inputScope);
1316
+ return /* @__PURE__ */ React16.createElement(TextAreaPrimitive, {
1317
+ ...props,
1318
+ className: tx("input.input", "input--text-area", {
1319
+ variant,
1320
+ disabled: props.disabled,
1321
+ density,
1322
+ elevation,
1323
+ validationValence
1324
+ }, classNames),
1325
+ ...props.autoFocus && !hasIosKeyboard2 && {
1326
+ autoFocus: true
1327
+ },
1328
+ ref: forwardedRef
1329
+ });
1330
+ });
1331
+ var Checkbox = /* @__PURE__ */ forwardRef14(({ __inputScope, checked: propsChecked, defaultChecked: propsDefaultChecked, onCheckedChange: propsOnCheckedChange, size, weight = "bold", classNames, ...props }, forwardedRef) => {
1332
+ const [checked, onCheckedChange] = useControllableState2({
1333
+ prop: propsChecked,
1334
+ defaultProp: propsDefaultChecked,
1335
+ onChange: propsOnCheckedChange
1336
+ });
1337
+ const { id, validationValence, descriptionId, errorMessageId } = useInputContext(INPUT_NAME, __inputScope);
1338
+ const { tx } = useThemeContext();
1339
+ const Icon3 = checked === "indeterminate" ? Minus : checked ? Check : Fragment;
1340
+ return /* @__PURE__ */ React16.createElement(CheckboxPrimitive, {
1341
+ ...props,
1342
+ checked,
1343
+ onCheckedChange,
1344
+ id,
1345
+ "aria-describedby": descriptionId,
1346
+ ...validationValence === "error" && {
1347
+ "aria-invalid": "true",
1348
+ "aria-errormessage": errorMessageId
1349
+ },
1350
+ className: tx("input.checkbox", "input--checkbox", {
1351
+ size
1352
+ }, "shrink-0", classNames),
1353
+ ref: forwardedRef
1354
+ }, /* @__PURE__ */ React16.createElement(CheckboxIndicatorPrimitive, {
1355
+ asChild: true
1356
+ }, /* @__PURE__ */ React16.createElement(Icon3, checked && {
1357
+ weight,
1358
+ className: tx("input.checkboxIndicator", "input--checkbox__indicator", {
1359
+ size
1360
+ })
1361
+ })));
1362
+ });
1363
+ var Switch = /* @__PURE__ */ forwardRef14(({ __inputScope, checked: propsChecked, defaultChecked: propsDefaultChecked, onCheckedChange: propsOnCheckedChange, size = 5, classNames, ...props }, forwardedRef) => {
1364
+ const { tx } = useThemeContext();
1365
+ const [checked, onCheckedChange] = useControllableState2({
1366
+ prop: propsChecked,
1367
+ defaultProp: propsDefaultChecked,
1368
+ onChange: propsOnCheckedChange
1369
+ });
1370
+ const { id, validationValence, descriptionId, errorMessageId } = useInputContext(INPUT_NAME, __inputScope);
1371
+ return /* @__PURE__ */ React16.createElement(SwitchPrimitive, {
1372
+ ...props,
1373
+ checked,
1374
+ onCheckedChange,
1375
+ id,
1376
+ "aria-describedby": descriptionId,
1377
+ ...validationValence === "error" && {
1378
+ "aria-invalid": "true",
1379
+ "aria-errormessage": errorMessageId
1380
+ },
1381
+ className: tx("input.switch", "input--switch", {
1382
+ size
1383
+ }, classNames),
1384
+ ref: forwardedRef
1385
+ }, /* @__PURE__ */ React16.createElement(SwitchThumbPrimitive, {
1386
+ className: tx("input.switchThumb", "input--switch__thumb", {
1387
+ size
1388
+ })
1389
+ }));
1390
+ });
1391
+ var Input = {
1392
+ Root: InputRoot,
1393
+ PinInput,
1394
+ TextInput,
1395
+ TextArea,
1396
+ Checkbox,
1397
+ Switch,
1398
+ Label: Label3,
1399
+ Description,
1400
+ Validation,
1401
+ DescriptionAndValidation
1402
+ };
1403
+
1404
+ // packages/ui/react-ui/src/components/Lists/List.tsx
1405
+ import { CaretDown, CaretRight } from "@phosphor-icons/react";
1406
+ import { Slot as Slot8 } from "@radix-ui/react-slot";
1407
+ import React18, { forwardRef as forwardRef15 } from "react";
1408
+ 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";
1409
+
1410
+ // packages/ui/react-ui/src/components/DensityProvider/DensityProvider.tsx
1411
+ import React17, { createContext as createContext7 } from "react";
1412
+ var DensityContext = /* @__PURE__ */ createContext7({
1413
+ density: "fine"
1414
+ });
1415
+ var DensityProvider = ({ density, children }) => /* @__PURE__ */ React17.createElement(DensityContext.Provider, {
1416
+ value: {
1417
+ density
1418
+ }
1419
+ }, children);
1420
+
1421
+ // packages/ui/react-ui/src/components/Lists/List.tsx
1422
+ var List = /* @__PURE__ */ forwardRef15(({ classNames, children, ...props }, forwardedRef) => {
1423
+ const { tx } = useThemeContext();
1424
+ const density = useDensityContext(props.density);
1425
+ return /* @__PURE__ */ React18.createElement(DensityProvider, {
1426
+ density
1427
+ }, /* @__PURE__ */ React18.createElement(ListPrimitive, {
1428
+ ...props,
1429
+ className: tx("list.root", "list", {}, classNames),
1430
+ ref: forwardedRef
1431
+ }, children));
1432
+ });
1433
+ var ListItemEndcap = /* @__PURE__ */ forwardRef15(({ children, classNames, asChild, ...props }, forwardedRef) => {
1434
+ const Root5 = asChild ? Slot8 : "div";
1435
+ const density = useDensityContext();
1436
+ const { tx } = useThemeContext();
1437
+ return /* @__PURE__ */ React18.createElement(Root5, {
1438
+ ...!asChild && {
1439
+ role: "none"
1440
+ },
1441
+ ...props,
1442
+ className: tx("list.item.endcap", "list__listItem__endcap", {
1443
+ density
1444
+ }, classNames),
1445
+ ref: forwardedRef
1446
+ }, children);
1447
+ });
1448
+ var MockListItemOpenTrigger = ({ classNames, ...props }) => {
1449
+ const density = useDensityContext();
1450
+ const { tx } = useThemeContext();
1451
+ return /* @__PURE__ */ React18.createElement("div", {
1452
+ role: "none",
1453
+ ...props,
1454
+ className: tx("list.item.openTrigger", "list__listItem__openTrigger--mock", {
1455
+ density
1456
+ }, classNames)
1457
+ });
1458
+ };
1459
+ var ListItemHeading = /* @__PURE__ */ forwardRef15(({ children, classNames, ...props }, forwardedRef) => {
1460
+ const { tx } = useThemeContext();
1461
+ const density = useDensityContext();
1462
+ return /* @__PURE__ */ React18.createElement(ListPrimitiveItemHeading, {
1463
+ ...props,
1464
+ className: tx("list.item.heading", "list__listItem__heading", {
1465
+ density
1466
+ }, classNames),
1467
+ ref: forwardedRef
1468
+ }, children);
1469
+ });
1470
+ var ListItemOpenTrigger = /* @__PURE__ */ forwardRef15(({ __listItemScope, classNames, children, ...props }, forwardedRef) => {
1471
+ const { tx } = useThemeContext();
1472
+ const density = useDensityContext();
1473
+ const { open } = useListItemContext(LIST_ITEM_NAME, __listItemScope);
1474
+ const Icon3 = open ? CaretDown : CaretRight;
1475
+ return /* @__PURE__ */ React18.createElement(ListPrimitiveItemOpenTrigger, {
1476
+ ...props,
1477
+ className: tx("list.item.openTrigger", "list__listItem__openTrigger", {
1478
+ density
1479
+ }, classNames),
1480
+ ref: forwardedRef
1481
+ }, children || /* @__PURE__ */ React18.createElement(Icon3, {
1482
+ weight: "bold",
1483
+ className: tx("list.item.openTriggerIcon", "list__listItem__openTrigger__icon", {})
1484
+ }));
1485
+ });
1486
+ var ListItemRoot = /* @__PURE__ */ forwardRef15(({ classNames, children, ...props }, forwardedRef) => {
1487
+ const { tx } = useThemeContext();
1488
+ const density = useDensityContext();
1489
+ return /* @__PURE__ */ React18.createElement(ListPrimitiveItem, {
1490
+ ...props,
1491
+ className: tx("list.item.root", "list__listItem", {
1492
+ density,
1493
+ collapsible: props.collapsible
1494
+ }, classNames),
1495
+ ref: forwardedRef
1496
+ }, children);
1497
+ });
1498
+ var ListItem = {
1499
+ Root: ListItemRoot,
1500
+ Endcap: ListItemEndcap,
1501
+ Heading: ListItemHeading,
1502
+ OpenTrigger: ListItemOpenTrigger,
1503
+ CollapsibleContent: ListItemCollapsibleContent,
1504
+ MockOpenTrigger: MockListItemOpenTrigger
1505
+ };
1506
+
1507
+ // packages/ui/react-ui/src/components/Lists/Tree.tsx
1508
+ import React19, { forwardRef as forwardRef16 } from "react";
1509
+ var TreeRoot = /* @__PURE__ */ forwardRef16((props, forwardedRef) => {
1510
+ return /* @__PURE__ */ React19.createElement(List, {
1511
+ ...props,
1512
+ ref: forwardedRef
1513
+ });
1514
+ });
1515
+ var TreeBranch = /* @__PURE__ */ forwardRef16(({ __listScope, ...props }, forwardedRef) => {
1516
+ const { headingId } = useListItemContext(LIST_ITEM_NAME, __listScope);
1517
+ return /* @__PURE__ */ React19.createElement(List, {
1518
+ ...props,
1519
+ "aria-labelledby": headingId,
1520
+ ref: forwardedRef
1521
+ });
1522
+ });
1523
+ var TreeItemRoot = /* @__PURE__ */ forwardRef16((props, forwardedRef) => {
1524
+ return /* @__PURE__ */ React19.createElement(ListItem.Root, {
1525
+ role: "treeitem",
1526
+ ...props,
1527
+ ref: forwardedRef
1528
+ });
1529
+ });
1530
+ var TreeItemHeading = ListItem.Heading;
1531
+ var TreeItemOpenTrigger = ListItem.OpenTrigger;
1532
+ var MockTreeItemOpenTrigger = ListItem.MockOpenTrigger;
1533
+ var TreeItemBody = ListItem.CollapsibleContent;
1534
+ var Tree = {
1535
+ Root: TreeRoot,
1536
+ Branch: TreeBranch
1537
+ };
1538
+ var TreeItem = {
1539
+ Root: TreeItemRoot,
1540
+ Heading: TreeItemHeading,
1541
+ Body: TreeItemBody,
1542
+ OpenTrigger: TreeItemOpenTrigger,
1543
+ MockOpenTrigger: MockTreeItemOpenTrigger
1544
+ };
1545
+
1546
+ // packages/ui/react-ui/src/components/Lists/Treegrid.tsx
1547
+ import { useFocusableGroup, useArrowNavigationGroup } from "@fluentui/react-tabster";
1548
+ import { createContextScope as createContextScope2 } from "@radix-ui/react-context";
1549
+ import { Primitive as Primitive8 } from "@radix-ui/react-primitive";
1550
+ import { Slot as Slot9 } from "@radix-ui/react-slot";
1551
+ import { useControllableState as useControllableState3 } from "@radix-ui/react-use-controllable-state";
1552
+ import React20, { forwardRef as forwardRef17 } from "react";
1553
+ var TREEGRID_ROW_NAME = "TreegridRow";
1554
+ var [createTreegridRowContext, createTreegridRowScope] = createContextScope2(TREEGRID_ROW_NAME, []);
1555
+ var [TreegridRowProvider, useTreegridRowContext] = createTreegridRowContext(TREEGRID_ROW_NAME);
1556
+ var PATH_SEPARATOR = "~";
1557
+ var PARENT_OF_SEPARATOR = " ";
1558
+ var TreegridRoot = /* @__PURE__ */ forwardRef17(({ asChild, classNames, children, style, gridTemplateColumns, ...props }, forwardedRef) => {
1559
+ const { tx } = useThemeContext();
1560
+ const Root5 = asChild ? Slot9 : Primitive8.div;
1561
+ const arrowNavigationAttrs = useArrowNavigationGroup({
1562
+ axis: "vertical",
1563
+ tabbable: false,
1564
+ circular: true
1565
+ });
1566
+ return /* @__PURE__ */ React20.createElement(Root5, {
1567
+ role: "treegrid",
1568
+ ...arrowNavigationAttrs,
1569
+ ...props,
1570
+ className: tx("treegrid.root", "treegrid", {}, classNames),
1571
+ style: {
1572
+ ...style,
1573
+ gridTemplateColumns
1574
+ },
1575
+ ref: forwardedRef
1576
+ }, children);
1577
+ });
1578
+ var TreegridRow = /* @__PURE__ */ forwardRef17(({ __treegridRowScope, asChild, classNames, children, id, parentOf, open: propsOpen, defaultOpen, onOpenChange: propsOnOpenChange, ...props }, forwardedRef) => {
1579
+ const { tx } = useThemeContext();
1580
+ const Root5 = asChild ? Slot9 : Primitive8.div;
1581
+ const pathParts = id.split(PATH_SEPARATOR);
1582
+ const level = pathParts.length - 1;
1583
+ const [open, onOpenChange] = useControllableState3({
1584
+ prop: propsOpen,
1585
+ onChange: propsOnOpenChange,
1586
+ defaultProp: defaultOpen
1587
+ });
1588
+ const focusableGroupAttrs = useFocusableGroup({
1589
+ tabBehavior: "limited"
1590
+ });
1591
+ const arrowGroupAttrs = useArrowNavigationGroup({
1592
+ axis: "horizontal",
1593
+ tabbable: false,
1594
+ circular: false,
1595
+ memorizeCurrent: false
1596
+ });
1597
+ return /* @__PURE__ */ React20.createElement(TreegridRowProvider, {
1598
+ open,
1599
+ onOpenChange,
1600
+ scope: __treegridRowScope
1601
+ }, /* @__PURE__ */ React20.createElement(Root5, {
1602
+ role: "row",
1603
+ "aria-level": level,
1604
+ className: tx("treegrid.row", "treegrid__row", {
1605
+ level
1606
+ }, classNames),
1607
+ ...parentOf && {
1608
+ "aria-expanded": open,
1609
+ "aria-owns": parentOf
1610
+ },
1611
+ tabIndex: 0,
1612
+ ...focusableGroupAttrs,
1613
+ ...props,
1614
+ id,
1615
+ ref: forwardedRef
1616
+ }, /* @__PURE__ */ React20.createElement("div", {
1617
+ role: "none",
1618
+ className: "contents",
1619
+ ...arrowGroupAttrs
1620
+ }, children)));
1621
+ });
1622
+ var TreegridCell = /* @__PURE__ */ forwardRef17(({ classNames, children, indent, ...props }, forwardedRef) => {
1623
+ const { tx } = useThemeContext();
1624
+ return /* @__PURE__ */ React20.createElement("div", {
1625
+ role: "gridcell",
1626
+ className: tx("treegrid.cell", "treegrid__cell", {
1627
+ indent
1628
+ }, classNames),
1629
+ ...props,
1630
+ ref: forwardedRef
1631
+ }, children);
1632
+ });
1633
+ var Treegrid = {
1634
+ Root: TreegridRoot,
1635
+ Row: TreegridRow,
1636
+ Cell: TreegridCell,
1637
+ PARENT_OF_SEPARATOR,
1638
+ PATH_SEPARATOR,
1639
+ createTreegridRowScope,
1640
+ useTreegridRowContext
1641
+ };
1642
+
1643
+ // packages/ui/react-ui/src/components/Main/Main.tsx
1644
+ import { useFocusableGroup as useFocusableGroup2 } from "@fluentui/react-tabster";
1645
+ import { useComposedRefs } from "@radix-ui/react-compose-refs";
1646
+ import { createContext as createContext8 } from "@radix-ui/react-context";
1647
+ import { Root as DialogRoot2, DialogContent as DialogContent2 } from "@radix-ui/react-dialog";
1648
+ import { Primitive as Primitive9 } from "@radix-ui/react-primitive";
1649
+ import { Slot as Slot10 } from "@radix-ui/react-slot";
1650
+ import { useControllableState as useControllableState4 } from "@radix-ui/react-use-controllable-state";
1651
+ import React21, { forwardRef as forwardRef18, useCallback as useCallback4, useEffect as useEffect5, useRef as useRef2, useState as useState4 } from "react";
1652
+ import { log } from "@dxos/log";
1653
+ import { useMediaQuery, useForwardedRef } from "@dxos/react-hooks";
1654
+
1655
+ // packages/ui/react-ui/src/components/Main/useSwipeToDismiss.ts
1656
+ import { useCallback as useCallback3, useEffect as useEffect4, useState as useState3 } from "react";
1657
+ var MotionState;
1658
+ (function(MotionState2) {
1659
+ MotionState2[MotionState2["IDLE"] = 0] = "IDLE";
1660
+ MotionState2[MotionState2["DEBOUNCING"] = 1] = "DEBOUNCING";
1661
+ MotionState2[MotionState2["FOLLOWING"] = 2] = "FOLLOWING";
1662
+ })(MotionState || (MotionState = {}));
1663
+ var useSwipeToDismiss = (ref, {
1664
+ onDismiss,
1665
+ dismissThreshold = 64,
1666
+ debounceThreshold = 8,
1667
+ offset = 0
1668
+ /* side = 'inline-start' */
1669
+ }) => {
1670
+ const $root = ref.current;
1671
+ const [motionState, setMotionState] = useState3(0);
1672
+ const [gestureStartX, setGestureStartX] = useState3(0);
1673
+ const setIdle = useCallback3(() => {
1674
+ setMotionState(0);
1675
+ $root?.style.removeProperty("inset-inline-start");
1676
+ $root?.style.setProperty("transition-duration", "200ms");
1677
+ }, [
1678
+ $root
1679
+ ]);
1680
+ const setFollowing = useCallback3(() => {
1681
+ setMotionState(2);
1682
+ $root?.style.setProperty("transition-duration", "0ms");
1683
+ }, [
1684
+ $root
1685
+ ]);
1686
+ const handlePointerDown = useCallback3(({ screenX }) => {
1687
+ if (motionState === 0) {
1688
+ setMotionState(1);
1689
+ setGestureStartX(screenX);
1690
+ }
1691
+ }, [
1692
+ motionState
1693
+ ]);
1694
+ const handlePointerMove = useCallback3(({ screenX }) => {
1695
+ if ($root) {
1696
+ const delta = Math.min(screenX - gestureStartX, 0);
1697
+ switch (motionState) {
1698
+ case 2:
1699
+ if (Math.abs(delta) > dismissThreshold) {
1700
+ setIdle();
1701
+ onDismiss?.();
1702
+ } else {
1703
+ $root.style.setProperty("inset-inline-start", `${offset + delta}px`);
1704
+ }
1705
+ break;
1706
+ case 1:
1707
+ if (Math.abs(delta) > debounceThreshold) {
1708
+ setFollowing();
1709
+ }
1710
+ break;
1711
+ }
1712
+ }
1713
+ }, [
1714
+ $root,
1715
+ motionState,
1716
+ gestureStartX
1717
+ ]);
1718
+ const handlePointerUp = useCallback3(() => {
1719
+ setIdle();
1720
+ }, [
1721
+ setIdle
1722
+ ]);
1723
+ useEffect4(() => {
1724
+ $root?.addEventListener("pointerdown", handlePointerDown);
1725
+ return () => {
1726
+ $root?.removeEventListener("pointerdown", handlePointerDown);
1727
+ };
1728
+ }, [
1729
+ $root,
1730
+ handlePointerDown
1731
+ ]);
1732
+ useEffect4(() => {
1733
+ $root && document.documentElement.addEventListener("pointermove", handlePointerMove);
1734
+ return () => {
1735
+ document.documentElement.removeEventListener("pointermove", handlePointerMove);
1736
+ };
1737
+ }, [
1738
+ $root,
1739
+ handlePointerMove
1740
+ ]);
1741
+ useEffect4(() => {
1742
+ $root && document.documentElement.addEventListener("pointerup", handlePointerUp);
1743
+ return () => {
1744
+ document.documentElement.removeEventListener("pointerup", handlePointerUp);
1745
+ };
1746
+ }, [
1747
+ $root,
1748
+ handlePointerUp
1749
+ ]);
1750
+ };
1751
+
1752
+ // packages/ui/react-ui/src/components/Main/Main.tsx
1753
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/ui/react-ui/src/components/Main/Main.tsx";
1754
+ var MAIN_ROOT_NAME = "MainRoot";
1755
+ var NAVIGATION_SIDEBAR_NAME = "NavigationSidebar";
1756
+ var COMPLEMENTARY_SIDEBAR_NAME = "ComplementarySidebar";
1757
+ var MAIN_NAME = "Main";
1758
+ var GENERIC_CONSUMER_NAME = "GenericConsumer";
1759
+ var landmarkAttr = "data-main-landmark";
1760
+ var useLandmarkMover = (propsOnKeyDown, landmark) => {
1761
+ const handleKeyDown = useCallback4((event) => {
1762
+ const target = event.target;
1763
+ if (event.target === event.currentTarget && event.key === "Tab" && target.hasAttribute(landmarkAttr)) {
1764
+ event.preventDefault();
1765
+ const landmarks = Array.from(document.querySelectorAll(`[${landmarkAttr}]:not([inert])`)).map((el) => el.hasAttribute(landmarkAttr) ? parseInt(el.getAttribute(landmarkAttr)) : NaN).sort();
1766
+ const l = landmarks.length;
1767
+ const cursor = landmarks.indexOf(parseInt(target.getAttribute(landmarkAttr)));
1768
+ const nextLandmark = landmarks[(cursor + l + (event.getModifierState("Shift") ? -1 : 1)) % l];
1769
+ document.querySelector(`[${landmarkAttr}="${nextLandmark}"]`)?.focus();
1770
+ }
1771
+ propsOnKeyDown?.(event);
1772
+ }, [
1773
+ propsOnKeyDown
1774
+ ]);
1775
+ const focusableAttrs = useFocusableGroup2({
1776
+ tabBehavior: "limited",
1777
+ ignoreDefaultKeydown: {
1778
+ Tab: true
1779
+ }
1780
+ });
1781
+ return {
1782
+ onKeyDown: handleKeyDown,
1783
+ [landmarkAttr]: landmark,
1784
+ tabIndex: 0,
1785
+ ...focusableAttrs
1786
+ };
1787
+ };
1788
+ var [MainProvider, useMainContext] = createContext8(MAIN_NAME, {
1789
+ resizing: false,
1790
+ navigationSidebarOpen: false,
1791
+ setNavigationSidebarOpen: (nextOpen) => {
1792
+ log.warn("Attempt to set sidebar state without initializing `MainRoot`", void 0, {
1793
+ F: __dxlog_file,
1794
+ L: 81,
1795
+ S: void 0,
1796
+ C: (f, a) => f(...a)
1797
+ });
1798
+ },
1799
+ complementarySidebarOpen: false,
1800
+ setComplementarySidebarOpen: (nextOpen) => {
1801
+ log.warn("Attempt to set sidebar state without initializing `MainRoot`", void 0, {
1802
+ F: __dxlog_file,
1803
+ L: 86,
1804
+ S: void 0,
1805
+ C: (f, a) => f(...a)
1806
+ });
1807
+ }
1808
+ });
1809
+ var useSidebars = (consumerName = GENERIC_CONSUMER_NAME) => {
1810
+ const { setNavigationSidebarOpen, navigationSidebarOpen, setComplementarySidebarOpen, complementarySidebarOpen } = useMainContext(consumerName);
1811
+ return {
1812
+ navigationSidebarOpen,
1813
+ setNavigationSidebarOpen,
1814
+ toggleNavigationSidebar: useCallback4(() => setNavigationSidebarOpen(!navigationSidebarOpen), [
1815
+ navigationSidebarOpen,
1816
+ setNavigationSidebarOpen
1817
+ ]),
1818
+ openNavigationSidebar: useCallback4(() => setNavigationSidebarOpen(true), [
1819
+ setNavigationSidebarOpen
1820
+ ]),
1821
+ closeNavigationSidebar: useCallback4(() => setNavigationSidebarOpen(false), [
1822
+ setNavigationSidebarOpen
1823
+ ]),
1824
+ complementarySidebarOpen,
1825
+ setComplementarySidebarOpen,
1826
+ toggleComplementarySidebar: useCallback4(() => setComplementarySidebarOpen(!complementarySidebarOpen), [
1827
+ complementarySidebarOpen,
1828
+ setComplementarySidebarOpen
1829
+ ]),
1830
+ openComplementarySidebar: useCallback4(() => setComplementarySidebarOpen(true), [
1831
+ setComplementarySidebarOpen
1832
+ ]),
1833
+ closeComplementarySidebar: useCallback4(() => setComplementarySidebarOpen(false), [
1834
+ setComplementarySidebarOpen
1835
+ ])
1836
+ };
1837
+ };
1838
+ var resizeDebounce = 3e3;
1839
+ var MainRoot = ({ navigationSidebarOpen: propsNavigationSidebarOpen, defaultNavigationSidebarOpen, onNavigationSidebarOpenChange, complementarySidebarOpen: propsComplementarySidebarOpen, defaultComplementarySidebarOpen, onComplementarySidebarOpenChange, children, ...props }) => {
1840
+ const [isLg] = useMediaQuery("lg", {
1841
+ ssr: false
1842
+ });
1843
+ const [navigationSidebarOpen = isLg, setNavigationSidebarOpen] = useControllableState4({
1844
+ prop: propsNavigationSidebarOpen,
1845
+ defaultProp: defaultNavigationSidebarOpen,
1846
+ onChange: onNavigationSidebarOpenChange
1847
+ });
1848
+ const [complementarySidebarOpen = false, setComplementarySidebarOpen] = useControllableState4({
1849
+ prop: propsComplementarySidebarOpen,
1850
+ defaultProp: defaultComplementarySidebarOpen,
1851
+ onChange: onComplementarySidebarOpenChange
1852
+ });
1853
+ const [resizing, setResizing] = useState4(false);
1854
+ const resizeInterval = useRef2(null);
1855
+ const handleResize = useCallback4(() => {
1856
+ setResizing(true);
1857
+ if (resizeInterval.current) {
1858
+ clearTimeout(resizeInterval.current);
1859
+ }
1860
+ resizeInterval.current = setTimeout(() => {
1861
+ setResizing(false);
1862
+ resizeInterval.current = null;
1863
+ }, resizeDebounce);
1864
+ }, []);
1865
+ useEffect5(() => {
1866
+ window.addEventListener("resize", handleResize);
1867
+ return () => window.removeEventListener("resize", handleResize);
1868
+ }, [
1869
+ handleResize
1870
+ ]);
1871
+ return /* @__PURE__ */ React21.createElement(MainProvider, {
1872
+ ...props,
1873
+ navigationSidebarOpen,
1874
+ setNavigationSidebarOpen,
1875
+ complementarySidebarOpen,
1876
+ setComplementarySidebarOpen,
1877
+ resizing
1878
+ }, children);
1879
+ };
1880
+ MainRoot.displayName = MAIN_ROOT_NAME;
1881
+ var handleOpenAutoFocus = (event) => {
1882
+ !document.body.hasAttribute("data-is-keyboard") && event.preventDefault();
1883
+ };
1884
+ var MainSidebar = /* @__PURE__ */ forwardRef18(({ classNames, children, swipeToDismiss, onOpenAutoFocus, open, resizing, setOpen, side, ...props }, forwardedRef) => {
1885
+ const [isLg] = useMediaQuery("lg", {
1886
+ ssr: false
1887
+ });
1888
+ const { tx } = useThemeContext();
1889
+ const ref = useForwardedRef(forwardedRef);
1890
+ const noopRef = useRef2(null);
1891
+ useSwipeToDismiss(swipeToDismiss ? ref : noopRef, {
1892
+ onDismiss: () => setOpen(false)
1893
+ });
1894
+ const handleKeyDown = useCallback4((event) => {
1895
+ if (event.key === "Escape") {
1896
+ event.target.closest("[data-tabster]")?.focus();
1897
+ }
1898
+ props.onKeyDown?.(event);
1899
+ }, [
1900
+ props.onKeyDown
1901
+ ]);
1902
+ const Root5 = isLg ? Primitive9.div : DialogContent2;
1903
+ return /* @__PURE__ */ React21.createElement(DialogRoot2, {
1904
+ open,
1905
+ modal: false
1906
+ }, /* @__PURE__ */ React21.createElement(Root5, {
1907
+ ...!isLg && {
1908
+ forceMount: true,
1909
+ tabIndex: -1,
1910
+ onOpenAutoFocus: onOpenAutoFocus ?? handleOpenAutoFocus
1911
+ },
1912
+ ...props,
1913
+ "data-side": side === "inline-end" ? "ie" : "is",
1914
+ "data-state": open ? "open" : "closed",
1915
+ "data-resizing": resizing ? "true" : "false",
1916
+ className: tx("main.sidebar", "main__sidebar", {}, classNames),
1917
+ onKeyDown: handleKeyDown,
1918
+ ...!open && {
1919
+ inert: "true"
1920
+ },
1921
+ ref
1922
+ }, /* @__PURE__ */ React21.createElement(ElevationProvider, {
1923
+ elevation: "group"
1924
+ }, children)));
1925
+ });
1926
+ var MainNavigationSidebar = /* @__PURE__ */ forwardRef18((props, forwardedRef) => {
1927
+ const { navigationSidebarOpen, setNavigationSidebarOpen, resizing } = useMainContext(NAVIGATION_SIDEBAR_NAME);
1928
+ const mover = useLandmarkMover(props.onKeyDown, "0");
1929
+ return /* @__PURE__ */ React21.createElement(MainSidebar, {
1930
+ ...mover,
1931
+ ...props,
1932
+ open: navigationSidebarOpen,
1933
+ setOpen: setNavigationSidebarOpen,
1934
+ resizing,
1935
+ side: "inline-start",
1936
+ ref: forwardedRef
1937
+ });
1938
+ });
1939
+ MainNavigationSidebar.displayName = NAVIGATION_SIDEBAR_NAME;
1940
+ var MainComplementarySidebar = /* @__PURE__ */ forwardRef18((props, forwardedRef) => {
1941
+ const { complementarySidebarOpen, setComplementarySidebarOpen, resizing } = useMainContext(COMPLEMENTARY_SIDEBAR_NAME);
1942
+ const mover = useLandmarkMover(props.onKeyDown, "2");
1943
+ return /* @__PURE__ */ React21.createElement(MainSidebar, {
1944
+ ...mover,
1945
+ ...props,
1946
+ open: complementarySidebarOpen,
1947
+ setOpen: setComplementarySidebarOpen,
1948
+ resizing,
1949
+ side: "inline-end",
1950
+ ref: forwardedRef
1951
+ });
1952
+ });
1953
+ MainNavigationSidebar.displayName = NAVIGATION_SIDEBAR_NAME;
1954
+ var MainContent = /* @__PURE__ */ forwardRef18(({ asChild, classNames, bounce, handlesFocus, children, role, ...props }, forwardedRef) => {
1955
+ const { navigationSidebarOpen, complementarySidebarOpen } = useMainContext(MAIN_NAME);
1956
+ const { tx } = useThemeContext();
1957
+ const Root5 = asChild ? Slot10 : role ? "div" : "main";
1958
+ const mover = useLandmarkMover(props.onKeyDown, "1");
1959
+ return /* @__PURE__ */ React21.createElement(Root5, {
1960
+ role,
1961
+ ...handlesFocus && {
1962
+ ...mover
1963
+ },
1964
+ ...props,
1965
+ "data-sidebar-inline-start-state": navigationSidebarOpen ? "open" : "closed",
1966
+ "data-sidebar-inline-end-state": complementarySidebarOpen ? "open" : "closed",
1967
+ className: tx("main.content", "main", {
1968
+ bounce,
1969
+ handlesFocus
1970
+ }, classNames),
1971
+ ref: forwardedRef
1972
+ }, children);
1973
+ });
1974
+ MainContent.displayName = MAIN_NAME;
1975
+ var MainOverlay = /* @__PURE__ */ forwardRef18(({ classNames, ...props }, forwardedRef) => {
1976
+ const [isLg] = useMediaQuery("lg", {
1977
+ ssr: false
1978
+ });
1979
+ const { navigationSidebarOpen, setNavigationSidebarOpen, complementarySidebarOpen, setComplementarySidebarOpen } = useMainContext(MAIN_NAME);
1980
+ const { tx } = useThemeContext();
1981
+ return /* @__PURE__ */ React21.createElement("div", {
1982
+ onClick: () => {
1983
+ setNavigationSidebarOpen(false);
1984
+ setComplementarySidebarOpen(false);
1985
+ },
1986
+ ...props,
1987
+ className: tx("main.overlay", "main__overlay", {
1988
+ isLg,
1989
+ inlineStartSidebarOpen: navigationSidebarOpen,
1990
+ inlineEndSidebarOpen: complementarySidebarOpen
1991
+ }, classNames),
1992
+ "data-state": navigationSidebarOpen || complementarySidebarOpen ? "open" : "closed",
1993
+ "aria-hidden": "true",
1994
+ ref: forwardedRef
1995
+ });
1996
+ });
1997
+ var MainNotch = /* @__PURE__ */ forwardRef18(({ classNames, ...props }, forwardedRef) => {
1998
+ const { tx } = useThemeContext();
1999
+ const { navigationSidebarOpen } = useMainContext(MAIN_NAME);
2000
+ const notchElement = useRef2(null);
2001
+ const ref = useComposedRefs(forwardedRef, notchElement);
2002
+ const handleKeyDown = useCallback4((event) => {
2003
+ switch (event.key) {
2004
+ case "Escape":
2005
+ props?.onKeyDown?.(event);
2006
+ notchElement.current?.focus();
2007
+ }
2008
+ }, [
2009
+ props?.onKeyDown
2010
+ ]);
2011
+ const mover = useLandmarkMover(handleKeyDown, "3");
2012
+ return /* @__PURE__ */ React21.createElement("div", {
2013
+ role: "toolbar",
2014
+ ...mover,
2015
+ ...props,
2016
+ "data-nav-sidebar-state": navigationSidebarOpen ? "open" : "closed",
2017
+ className: tx("main.notch", "main__notch", {}, classNames),
2018
+ ref
2019
+ });
2020
+ });
2021
+ var Main = {
2022
+ Root: MainRoot,
2023
+ Content: MainContent,
2024
+ Overlay: MainOverlay,
2025
+ NavigationSidebar: MainNavigationSidebar,
2026
+ ComplementarySidebar: MainComplementarySidebar,
2027
+ Notch: MainNotch
2028
+ };
2029
+
2030
+ // packages/ui/react-ui/src/components/Message/Message.tsx
2031
+ import { createContext as createContext9 } from "@radix-ui/react-context";
2032
+ import { Primitive as Primitive10 } from "@radix-ui/react-primitive";
2033
+ import { Slot as Slot11 } from "@radix-ui/react-slot";
2034
+ import React22, { forwardRef as forwardRef19 } from "react";
2035
+ import { useId as useId4 } from "@dxos/react-hooks";
2036
+ var MESSAGE_NAME = "Message";
2037
+ var [MessageProvider, useMessageContext] = createContext9(MESSAGE_NAME);
2038
+ var MessageRoot = /* @__PURE__ */ forwardRef19(({ asChild, valence, elevation: propsElevation, className, titleId: propsTitleId, descriptionId: propsDescriptionId, children, ...props }, forwardedRef) => {
2039
+ const { tx } = useThemeContext();
2040
+ const titleId = useId4("message__title", propsTitleId);
2041
+ const descriptionId = useId4("message__description", propsDescriptionId);
2042
+ const elevation = useElevationContext(propsElevation);
2043
+ const Root5 = asChild ? Slot11 : Primitive10.div;
2044
+ return /* @__PURE__ */ React22.createElement(MessageProvider, {
2045
+ titleId,
2046
+ descriptionId
2047
+ }, /* @__PURE__ */ React22.createElement(Root5, {
2048
+ ...props,
2049
+ className: tx("message.root", "message", {
2050
+ valence,
2051
+ elevation
2052
+ }, className),
2053
+ "aria-labelledby": titleId,
2054
+ "aria-describedby": descriptionId,
2055
+ ref: forwardedRef
2056
+ }, children));
2057
+ });
2058
+ MessageRoot.displayName = MESSAGE_NAME;
2059
+ var MESSAGE_TITLE_NAME = "MessageTitle";
2060
+ var MessageTitle = /* @__PURE__ */ forwardRef19(({ asChild, className, children, ...props }, forwardedRef) => {
2061
+ const { tx } = useThemeContext();
2062
+ const { titleId } = useMessageContext(MESSAGE_TITLE_NAME);
2063
+ const Root5 = asChild ? Slot11 : Primitive10.h2;
2064
+ return /* @__PURE__ */ React22.createElement(Root5, {
2065
+ ...props,
2066
+ className: tx("message.title", "message__title", {}, className),
2067
+ id: titleId,
2068
+ ref: forwardedRef
2069
+ }, children);
2070
+ });
2071
+ MessageTitle.displayName = MESSAGE_TITLE_NAME;
2072
+ var MESSAGE_BODY_NAME = "MessageBody";
2073
+ var MessageBody = /* @__PURE__ */ forwardRef19(({ asChild, className, children, ...props }, forwardedRef) => {
2074
+ const { tx } = useThemeContext();
2075
+ const { descriptionId } = useMessageContext(MESSAGE_BODY_NAME);
2076
+ const Root5 = asChild ? Slot11 : Primitive10.p;
2077
+ return /* @__PURE__ */ React22.createElement(Root5, {
2078
+ ...props,
2079
+ className: tx("message.body", "message__body", {}, className),
2080
+ id: descriptionId,
2081
+ ref: forwardedRef
2082
+ }, children);
2083
+ });
2084
+ MessageBody.displayName = MESSAGE_BODY_NAME;
2085
+ var Message = {
2086
+ Root: MessageRoot,
2087
+ Title: MessageTitle,
2088
+ Body: MessageBody
2089
+ };
2090
+
2091
+ // packages/ui/react-ui/src/components/Popover/Popover.tsx
2092
+ import { composeEventHandlers as composeEventHandlers2 } from "@radix-ui/primitive";
2093
+ import { useComposedRefs as useComposedRefs2 } from "@radix-ui/react-compose-refs";
2094
+ import { createContextScope as createContextScope3 } from "@radix-ui/react-context";
2095
+ import { DismissableLayer } from "@radix-ui/react-dismissable-layer";
2096
+ import { useFocusGuards } from "@radix-ui/react-focus-guards";
2097
+ import { FocusScope } from "@radix-ui/react-focus-scope";
2098
+ import { useId as useId5 } from "@radix-ui/react-id";
2099
+ import * as PopperPrimitive from "@radix-ui/react-popper";
2100
+ import { createPopperScope } from "@radix-ui/react-popper";
2101
+ import { Portal as PortalPrimitive } from "@radix-ui/react-portal";
2102
+ import { Presence } from "@radix-ui/react-presence";
2103
+ import { Primitive as Primitive11 } from "@radix-ui/react-primitive";
2104
+ import { Slot as Slot12 } from "@radix-ui/react-slot";
2105
+ import { useControllableState as useControllableState5 } from "@radix-ui/react-use-controllable-state";
2106
+ import { hideOthers } from "aria-hidden";
2107
+ import React23, { forwardRef as forwardRef20, useRef as useRef3, useCallback as useCallback5, useState as useState5, useEffect as useEffect6 } from "react";
2108
+ import { RemoveScroll } from "react-remove-scroll";
2109
+ var POPOVER_NAME = "Popover";
2110
+ var [createPopoverContext, createPopoverScope] = createContextScope3(POPOVER_NAME, [
2111
+ createPopperScope
2112
+ ]);
2113
+ var usePopperScope = createPopperScope();
2114
+ var [PopoverProvider, usePopoverContext] = createPopoverContext(POPOVER_NAME);
2115
+ var PopoverRoot = (props) => {
2116
+ const { __scopePopover, children, open: openProp, defaultOpen, onOpenChange, modal = false } = props;
2117
+ const popperScope = usePopperScope(__scopePopover);
2118
+ const triggerRef = useRef3(null);
2119
+ const [hasCustomAnchor, setHasCustomAnchor] = useState5(false);
2120
+ const [open = false, setOpen] = useControllableState5({
2121
+ prop: openProp,
2122
+ defaultProp: defaultOpen,
2123
+ onChange: onOpenChange
2124
+ });
2125
+ return /* @__PURE__ */ React23.createElement(PopperPrimitive.Root, popperScope, /* @__PURE__ */ React23.createElement(PopoverProvider, {
2126
+ scope: __scopePopover,
2127
+ contentId: useId5(),
2128
+ triggerRef,
2129
+ open,
2130
+ onOpenChange: setOpen,
2131
+ onOpenToggle: useCallback5(() => setOpen((prevOpen) => !prevOpen), [
2132
+ setOpen
2133
+ ]),
2134
+ hasCustomAnchor,
2135
+ onCustomAnchorAdd: useCallback5(() => setHasCustomAnchor(true), []),
2136
+ onCustomAnchorRemove: useCallback5(() => setHasCustomAnchor(false), []),
2137
+ modal
2138
+ }, children));
2139
+ };
2140
+ PopoverRoot.displayName = POPOVER_NAME;
2141
+ var ANCHOR_NAME = "PopoverAnchor";
2142
+ var PopoverAnchor = /* @__PURE__ */ forwardRef20((props, forwardedRef) => {
2143
+ const { __scopePopover, ...anchorProps } = props;
2144
+ const context = usePopoverContext(ANCHOR_NAME, __scopePopover);
2145
+ const popperScope = usePopperScope(__scopePopover);
2146
+ const { onCustomAnchorAdd, onCustomAnchorRemove } = context;
2147
+ useEffect6(() => {
2148
+ onCustomAnchorAdd();
2149
+ return () => onCustomAnchorRemove();
2150
+ }, [
2151
+ onCustomAnchorAdd,
2152
+ onCustomAnchorRemove
2153
+ ]);
2154
+ return /* @__PURE__ */ React23.createElement(PopperPrimitive.Anchor, {
2155
+ ...popperScope,
2156
+ ...anchorProps,
2157
+ ref: forwardedRef
2158
+ });
2159
+ });
2160
+ PopoverAnchor.displayName = ANCHOR_NAME;
2161
+ var TRIGGER_NAME2 = "PopoverTrigger";
2162
+ var PopoverTrigger = /* @__PURE__ */ forwardRef20((props, forwardedRef) => {
2163
+ const { __scopePopover, ...triggerProps } = props;
2164
+ const context = usePopoverContext(TRIGGER_NAME2, __scopePopover);
2165
+ const popperScope = usePopperScope(__scopePopover);
2166
+ const composedTriggerRef = useComposedRefs2(forwardedRef, context.triggerRef);
2167
+ const trigger = /* @__PURE__ */ React23.createElement(Primitive11.button, {
2168
+ type: "button",
2169
+ "aria-haspopup": "dialog",
2170
+ "aria-expanded": context.open,
2171
+ "aria-controls": context.contentId,
2172
+ "data-state": getState(context.open),
2173
+ ...triggerProps,
2174
+ ref: composedTriggerRef,
2175
+ onClick: composeEventHandlers2(props.onClick, context.onOpenToggle)
2176
+ });
2177
+ return context.hasCustomAnchor ? trigger : /* @__PURE__ */ React23.createElement(PopperPrimitive.Anchor, {
2178
+ asChild: true,
2179
+ ...popperScope
2180
+ }, trigger);
2181
+ });
2182
+ PopoverTrigger.displayName = TRIGGER_NAME2;
2183
+ var VIRTUAL_TRIGGER_NAME2 = "PopoverVirtualTrigger";
2184
+ var PopoverVirtualTrigger = (props) => {
2185
+ const { __scopePopover, virtualRef } = props;
2186
+ const context = usePopoverContext(VIRTUAL_TRIGGER_NAME2, __scopePopover);
2187
+ const popperScope = usePopperScope(__scopePopover);
2188
+ useEffect6(() => {
2189
+ if (virtualRef.current) {
2190
+ context.triggerRef.current = virtualRef.current;
2191
+ }
2192
+ });
2193
+ return /* @__PURE__ */ React23.createElement(PopperPrimitive.Anchor, {
2194
+ ...popperScope,
2195
+ virtualRef
2196
+ });
2197
+ };
2198
+ PopoverVirtualTrigger.displayName = VIRTUAL_TRIGGER_NAME2;
2199
+ var PORTAL_NAME2 = "PopoverPortal";
2200
+ var [PortalProvider, usePortalContext] = createPopoverContext(PORTAL_NAME2, {
2201
+ forceMount: void 0
2202
+ });
2203
+ var PopoverPortal = (props) => {
2204
+ const { __scopePopover, forceMount, children, container } = props;
2205
+ const context = usePopoverContext(PORTAL_NAME2, __scopePopover);
2206
+ return /* @__PURE__ */ React23.createElement(PortalProvider, {
2207
+ scope: __scopePopover,
2208
+ forceMount
2209
+ }, /* @__PURE__ */ React23.createElement(Presence, {
2210
+ present: forceMount || context.open
2211
+ }, /* @__PURE__ */ React23.createElement(PortalPrimitive, {
2212
+ asChild: true,
2213
+ container
2214
+ }, children)));
2215
+ };
2216
+ PopoverPortal.displayName = PORTAL_NAME2;
2217
+ var CONTENT_NAME2 = "PopoverContent";
2218
+ var PopoverContent = /* @__PURE__ */ forwardRef20((props, forwardedRef) => {
2219
+ const portalContext = usePortalContext(CONTENT_NAME2, props.__scopePopover);
2220
+ const { forceMount = portalContext.forceMount, ...contentProps } = props;
2221
+ const context = usePopoverContext(CONTENT_NAME2, props.__scopePopover);
2222
+ return /* @__PURE__ */ React23.createElement(Presence, {
2223
+ present: forceMount || context.open
2224
+ }, context.modal ? /* @__PURE__ */ React23.createElement(PopoverContentModal, {
2225
+ ...contentProps,
2226
+ ref: forwardedRef
2227
+ }) : /* @__PURE__ */ React23.createElement(PopoverContentNonModal, {
2228
+ ...contentProps,
2229
+ ref: forwardedRef
2230
+ }));
2231
+ });
2232
+ PopoverContent.displayName = CONTENT_NAME2;
2233
+ var PopoverContentModal = /* @__PURE__ */ forwardRef20((props, forwardedRef) => {
2234
+ const context = usePopoverContext(CONTENT_NAME2, props.__scopePopover);
2235
+ const contentRef = useRef3(null);
2236
+ const composedRefs = useComposedRefs2(forwardedRef, contentRef);
2237
+ const isRightClickOutsideRef = useRef3(false);
2238
+ useEffect6(() => {
2239
+ const content = contentRef.current;
2240
+ if (content) {
2241
+ return hideOthers(content);
2242
+ }
2243
+ }, []);
2244
+ return /* @__PURE__ */ React23.createElement(RemoveScroll, {
2245
+ as: Slot12,
2246
+ allowPinchZoom: true
2247
+ }, /* @__PURE__ */ React23.createElement(PopoverContentImpl, {
2248
+ ...props,
2249
+ ref: composedRefs,
2250
+ // we make sure we're not trapping once it's been closed
2251
+ // (closed !== unmounted when animating out)
2252
+ trapFocus: context.open,
2253
+ disableOutsidePointerEvents: true,
2254
+ onCloseAutoFocus: composeEventHandlers2(props.onCloseAutoFocus, (event) => {
2255
+ event.preventDefault();
2256
+ if (!isRightClickOutsideRef.current) {
2257
+ context.triggerRef.current?.focus();
2258
+ }
2259
+ }),
2260
+ onPointerDownOutside: composeEventHandlers2(props.onPointerDownOutside, (event) => {
2261
+ const originalEvent = event.detail.originalEvent;
2262
+ const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
2263
+ const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
2264
+ isRightClickOutsideRef.current = isRightClick;
2265
+ }, {
2266
+ checkForDefaultPrevented: false
2267
+ }),
2268
+ // When focus is trapped, a `focusout` event may still happen.
2269
+ // We make sure we don't trigger our `onDismiss` in such case.
2270
+ onFocusOutside: composeEventHandlers2(props.onFocusOutside, (event) => event.preventDefault(), {
2271
+ checkForDefaultPrevented: false
2272
+ })
2273
+ }));
2274
+ });
2275
+ var PopoverContentNonModal = /* @__PURE__ */ forwardRef20((props, forwardedRef) => {
2276
+ const context = usePopoverContext(CONTENT_NAME2, props.__scopePopover);
2277
+ const hasInteractedOutsideRef = useRef3(false);
2278
+ const hasPointerDownOutsideRef = useRef3(false);
2279
+ return /* @__PURE__ */ React23.createElement(PopoverContentImpl, {
2280
+ ...props,
2281
+ ref: forwardedRef,
2282
+ trapFocus: false,
2283
+ disableOutsidePointerEvents: false,
2284
+ onCloseAutoFocus: (event) => {
2285
+ props.onCloseAutoFocus?.(event);
2286
+ if (!event.defaultPrevented) {
2287
+ if (!hasInteractedOutsideRef.current) {
2288
+ context.triggerRef.current?.focus();
2289
+ }
2290
+ event.preventDefault();
2291
+ }
2292
+ hasInteractedOutsideRef.current = false;
2293
+ hasPointerDownOutsideRef.current = false;
2294
+ },
2295
+ onInteractOutside: (event) => {
2296
+ props.onInteractOutside?.(event);
2297
+ if (!event.defaultPrevented) {
2298
+ hasInteractedOutsideRef.current = true;
2299
+ if (event.detail.originalEvent.type === "pointerdown") {
2300
+ hasPointerDownOutsideRef.current = true;
2301
+ }
2302
+ }
2303
+ const target = event.target;
2304
+ const targetIsTrigger = context.triggerRef.current?.contains(target);
2305
+ if (targetIsTrigger) {
2306
+ event.preventDefault();
2307
+ }
2308
+ if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
2309
+ event.preventDefault();
2310
+ }
2311
+ }
2312
+ });
2313
+ });
2314
+ var PopoverContentImpl = /* @__PURE__ */ forwardRef20((props, forwardedRef) => {
2315
+ const { __scopePopover, trapFocus, onOpenAutoFocus, onCloseAutoFocus, disableOutsidePointerEvents, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, classNames, ...contentProps } = props;
2316
+ const context = usePopoverContext(CONTENT_NAME2, __scopePopover);
2317
+ const popperScope = usePopperScope(__scopePopover);
2318
+ const { tx } = useThemeContext();
2319
+ useFocusGuards();
2320
+ return /* @__PURE__ */ React23.createElement(FocusScope, {
2321
+ asChild: true,
2322
+ loop: true,
2323
+ trapped: trapFocus,
2324
+ onMountAutoFocus: onOpenAutoFocus,
2325
+ onUnmountAutoFocus: onCloseAutoFocus
2326
+ }, /* @__PURE__ */ React23.createElement(DismissableLayer, {
2327
+ asChild: true,
2328
+ disableOutsidePointerEvents,
2329
+ onInteractOutside,
2330
+ onEscapeKeyDown,
2331
+ onPointerDownOutside,
2332
+ onFocusOutside,
2333
+ onDismiss: () => context.onOpenChange(false)
2334
+ }, /* @__PURE__ */ React23.createElement(PopperPrimitive.Content, {
2335
+ "data-state": getState(context.open),
2336
+ role: "dialog",
2337
+ id: context.contentId,
2338
+ ...popperScope,
2339
+ ...contentProps,
2340
+ className: tx("popover.content", "popover", {}, classNames),
2341
+ ref: forwardedRef,
2342
+ style: {
2343
+ ...contentProps.style,
2344
+ // re-namespace exposed content custom properties
2345
+ ...{
2346
+ "--radix-popover-content-transform-origin": "var(--radix-popper-transform-origin)",
2347
+ "--radix-popover-content-available-width": "var(--radix-popper-available-width)",
2348
+ "--radix-popover-content-available-height": "var(--radix-popper-available-height)",
2349
+ "--radix-popover-trigger-width": "var(--radix-popper-anchor-width)",
2350
+ "--radix-popover-trigger-height": "var(--radix-popper-anchor-height)"
2351
+ }
2352
+ }
2353
+ })));
2354
+ });
2355
+ var CLOSE_NAME = "PopoverClose";
2356
+ var PopoverClose = /* @__PURE__ */ forwardRef20((props, forwardedRef) => {
2357
+ const { __scopePopover, ...closeProps } = props;
2358
+ const context = usePopoverContext(CLOSE_NAME, __scopePopover);
2359
+ return /* @__PURE__ */ React23.createElement(Primitive11.button, {
2360
+ type: "button",
2361
+ ...closeProps,
2362
+ ref: forwardedRef,
2363
+ onClick: composeEventHandlers2(props.onClick, () => context.onOpenChange(false))
2364
+ });
2365
+ });
2366
+ PopoverClose.displayName = CLOSE_NAME;
2367
+ var ARROW_NAME2 = "PopoverArrow";
2368
+ var PopoverArrow = /* @__PURE__ */ forwardRef20((props, forwardedRef) => {
2369
+ const { __scopePopover, classNames, ...arrowProps } = props;
2370
+ const popperScope = usePopperScope(__scopePopover);
2371
+ const { tx } = useThemeContext();
2372
+ return /* @__PURE__ */ React23.createElement(PopperPrimitive.Arrow, {
2373
+ ...popperScope,
2374
+ ...arrowProps,
2375
+ className: tx("popover.arrow", "popover__arrow", {}, classNames),
2376
+ ref: forwardedRef
2377
+ });
2378
+ });
2379
+ PopoverArrow.displayName = ARROW_NAME2;
2380
+ var PopoverViewport = /* @__PURE__ */ forwardRef20(({ classNames, asChild, constrainInline = true, constrainBlock = true, children, ...props }, forwardedRef) => {
2381
+ const { tx } = useThemeContext();
2382
+ const Root5 = asChild ? Slot12 : Primitive11.div;
2383
+ return /* @__PURE__ */ React23.createElement(Root5, {
2384
+ ...props,
2385
+ className: tx("popover.viewport", "popover__viewport", {
2386
+ constrainInline,
2387
+ constrainBlock
2388
+ }, classNames),
2389
+ ref: forwardedRef
2390
+ }, children);
2391
+ });
2392
+ var getState = (open) => open ? "open" : "closed";
2393
+ var Popover = {
2394
+ Root: PopoverRoot,
2395
+ Anchor: PopoverAnchor,
2396
+ Trigger: PopoverTrigger,
2397
+ VirtualTrigger: PopoverVirtualTrigger,
2398
+ Portal: PopoverPortal,
2399
+ Content: PopoverContent,
2400
+ Close: PopoverClose,
2401
+ Arrow: PopoverArrow,
2402
+ Viewport: PopoverViewport
2403
+ };
2404
+
2405
+ // packages/ui/react-ui/src/components/Status/Status.tsx
2406
+ import React24, { forwardRef as forwardRef21 } from "react";
2407
+ var Status = /* @__PURE__ */ forwardRef21(({ classNames, children, progress = 0, indeterminate, ...props }, forwardedRef) => {
2408
+ const { tx } = useThemeContext();
2409
+ return /* @__PURE__ */ React24.createElement("span", {
2410
+ role: "status",
2411
+ ...props,
2412
+ className: tx("status.root", "status", {
2413
+ indeterminate
2414
+ }, classNames),
2415
+ ref: forwardedRef
2416
+ }, /* @__PURE__ */ React24.createElement("span", {
2417
+ role: "none",
2418
+ className: tx("status.bar", "status__bar", {
2419
+ indeterminate
2420
+ }, classNames),
2421
+ ...!indeterminate && {
2422
+ style: {
2423
+ width: `${Math.round(progress * 100)}%`
2424
+ }
2425
+ }
2426
+ }), children);
2427
+ });
2428
+
2429
+ // packages/ui/react-ui/src/components/ScrollArea/ScrollArea.tsx
2430
+ import { Root as ScrollAreaPrimitiveRoot, Viewport as ScrollAreaPrimitiveViewport, Scrollbar as ScrollAreaPrimitiveScrollbar, Thumb as ScrollAreaPrimitiveThumb, Corner as ScrollAreaPrimitiveCorner } from "@radix-ui/react-scroll-area";
2431
+ import React25, { forwardRef as forwardRef22 } from "react";
2432
+ var ScrollAreaRoot = /* @__PURE__ */ forwardRef22(({ classNames, ...props }, forwardedRef) => {
2433
+ const { tx } = useThemeContext();
2434
+ return /* @__PURE__ */ React25.createElement(ScrollAreaPrimitiveRoot, {
2435
+ ...props,
2436
+ className: tx("scrollArea.root", "scroll-area", {}, classNames),
2437
+ ref: forwardedRef
2438
+ });
2439
+ });
2440
+ var ScrollAreaViewport = /* @__PURE__ */ forwardRef22(({ classNames, ...props }, forwardedRef) => {
2441
+ const { tx } = useThemeContext();
2442
+ return /* @__PURE__ */ React25.createElement(ScrollAreaPrimitiveViewport, {
2443
+ ...props,
2444
+ className: tx("scrollArea.viewport", "scroll-area", {}, classNames),
2445
+ ref: forwardedRef
2446
+ });
2447
+ });
2448
+ var ScrollAreaScrollbar = /* @__PURE__ */ forwardRef22(({ classNames, variant = "fine", ...props }, forwardedRef) => {
2449
+ const { tx } = useThemeContext();
2450
+ return /* @__PURE__ */ React25.createElement(ScrollAreaPrimitiveScrollbar, {
2451
+ "data-variant": variant,
2452
+ ...props,
2453
+ className: tx("scrollArea.scrollbar", "scroll-area__scrollbar", {}, classNames),
2454
+ ref: forwardedRef
2455
+ });
2456
+ });
2457
+ var ScrollAreaThumb = /* @__PURE__ */ forwardRef22(({ classNames, ...props }, forwardedRef) => {
2458
+ const { tx } = useThemeContext();
2459
+ return /* @__PURE__ */ React25.createElement(ScrollAreaPrimitiveThumb, {
2460
+ ...props,
2461
+ className: tx("scrollArea.thumb", "scroll-area__thumb", {}, classNames),
2462
+ ref: forwardedRef
2463
+ });
2464
+ });
2465
+ var ScrollAreaCorner = /* @__PURE__ */ forwardRef22(({ classNames, ...props }, forwardedRef) => {
2466
+ const { tx } = useThemeContext();
2467
+ return /* @__PURE__ */ React25.createElement(ScrollAreaPrimitiveCorner, {
2468
+ ...props,
2469
+ className: tx("scrollArea.corner", "scroll-area__corner", {}, classNames),
2470
+ ref: forwardedRef
2471
+ });
2472
+ });
2473
+ var ScrollArea = {
2474
+ Root: ScrollAreaRoot,
2475
+ Viewport: ScrollAreaViewport,
2476
+ Scrollbar: ScrollAreaScrollbar,
2477
+ Thumb: ScrollAreaThumb,
2478
+ Corner: ScrollAreaCorner
2479
+ };
2480
+
2481
+ // packages/ui/react-ui/src/components/Select/Select.tsx
2482
+ import { CaretDown as CaretDown2, CaretUp } from "@phosphor-icons/react";
2483
+ import * as SelectPrimitive from "@radix-ui/react-select";
2484
+ import React26, { forwardRef as forwardRef23 } from "react";
2485
+ var SelectRoot = SelectPrimitive.Root;
2486
+ var SelectTrigger = SelectPrimitive.Trigger;
2487
+ var SelectValue = SelectPrimitive.Value;
2488
+ var SelectIcon = SelectPrimitive.Icon;
2489
+ var SelectPortal = SelectPrimitive.Portal;
2490
+ var SelectTriggerButton = /* @__PURE__ */ forwardRef23(({ children, placeholder, ...props }, forwardedRef) => {
2491
+ const { tx } = useThemeContext();
2492
+ return /* @__PURE__ */ React26.createElement(SelectPrimitive.Trigger, {
2493
+ asChild: true,
2494
+ ref: forwardedRef
2495
+ }, /* @__PURE__ */ React26.createElement(Button, props, /* @__PURE__ */ React26.createElement(SelectPrimitive.Value, {
2496
+ placeholder
2497
+ }, children), /* @__PURE__ */ React26.createElement("span", {
2498
+ className: "w-1 flex-1"
2499
+ }), /* @__PURE__ */ React26.createElement(SelectPrimitive.Icon, {
2500
+ asChild: true
2501
+ }, /* @__PURE__ */ React26.createElement(CaretDown2, {
2502
+ className: tx("select.triggerIcon", "select__trigger__icon", {}),
2503
+ weight: "bold"
2504
+ }))));
2505
+ });
2506
+ var SelectContent = /* @__PURE__ */ forwardRef23(({ classNames, children, ...props }, forwardedRef) => {
2507
+ const { tx } = useThemeContext();
2508
+ return /* @__PURE__ */ React26.createElement(SelectPrimitive.Content, {
2509
+ ...props,
2510
+ className: tx("select.content", "select__content", {}, classNames),
2511
+ position: "popper",
2512
+ ref: forwardedRef
2513
+ }, children);
2514
+ });
2515
+ var SelectScrollUpButton2 = /* @__PURE__ */ forwardRef23(({ classNames, children, ...props }, forwardedRef) => {
2516
+ const { tx } = useThemeContext();
2517
+ return /* @__PURE__ */ React26.createElement(SelectPrimitive.SelectScrollUpButton, {
2518
+ ...props,
2519
+ className: tx("select.scrollButton", "select__scroll-button--up", {}, classNames),
2520
+ ref: forwardedRef
2521
+ }, children ?? /* @__PURE__ */ React26.createElement(CaretUp, {
2522
+ weight: "bold"
2523
+ }));
2524
+ });
2525
+ var SelectScrollDownButton2 = /* @__PURE__ */ forwardRef23(({ classNames, children, ...props }, forwardedRef) => {
2526
+ const { tx } = useThemeContext();
2527
+ return /* @__PURE__ */ React26.createElement(SelectPrimitive.SelectScrollDownButton, {
2528
+ ...props,
2529
+ className: tx("select.scrollButton", "select__scroll-button--down", {}, classNames),
2530
+ ref: forwardedRef
2531
+ }, children ?? /* @__PURE__ */ React26.createElement(CaretDown2, {
2532
+ weight: "bold"
2533
+ }));
2534
+ });
2535
+ var SelectViewport2 = /* @__PURE__ */ forwardRef23(({ classNames, asChild, children, ...props }, forwardedRef) => {
2536
+ const { tx } = useThemeContext();
2537
+ return /* @__PURE__ */ React26.createElement(SelectPrimitive.SelectViewport, {
2538
+ ...props,
2539
+ className: tx("select.viewport", "select__viewport", {}, classNames),
2540
+ ref: forwardedRef
2541
+ }, children);
2542
+ });
2543
+ var SelectItem = /* @__PURE__ */ forwardRef23(({ classNames, ...props }, forwardedRef) => {
2544
+ const { tx } = useThemeContext();
2545
+ return /* @__PURE__ */ React26.createElement(SelectPrimitive.Item, {
2546
+ ...props,
2547
+ className: tx("select.item", "option", {}, classNames),
2548
+ ref: forwardedRef
2549
+ });
2550
+ });
2551
+ var SelectItemText = SelectPrimitive.ItemText;
2552
+ var SelectItemIndicator = /* @__PURE__ */ forwardRef23(({ classNames, children, ...props }, forwardedRef) => {
2553
+ const { tx } = useThemeContext();
2554
+ return /* @__PURE__ */ React26.createElement(SelectPrimitive.ItemIndicator, {
2555
+ ...props,
2556
+ className: tx("select.itemIndicator", "option__indicator", {}, classNames),
2557
+ ref: forwardedRef
2558
+ }, children);
2559
+ });
2560
+ var SelectOption = /* @__PURE__ */ forwardRef23(({ children, classNames, ...props }, forwardedRef) => {
2561
+ const { tx } = useThemeContext();
2562
+ return /* @__PURE__ */ React26.createElement(SelectPrimitive.Item, {
2563
+ ...props,
2564
+ className: tx("select.item", "option", {}, classNames),
2565
+ ref: forwardedRef
2566
+ }, /* @__PURE__ */ React26.createElement(SelectPrimitive.ItemText, null, children), /* @__PURE__ */ React26.createElement("span", {
2567
+ className: "grow w-1"
2568
+ }), /* @__PURE__ */ React26.createElement(Icon, {
2569
+ icon: "ph--check--regular"
2570
+ }));
2571
+ });
2572
+ var SelectGroup = SelectPrimitive.Group;
2573
+ var SelectLabel = SelectPrimitive.Label;
2574
+ var SelectSeparator = /* @__PURE__ */ forwardRef23(({ classNames, ...props }, forwardedRef) => {
2575
+ const { tx } = useThemeContext();
2576
+ return /* @__PURE__ */ React26.createElement(SelectPrimitive.Separator, {
2577
+ ...props,
2578
+ className: tx("select.separator", "select__separator", {}, classNames),
2579
+ ref: forwardedRef
2580
+ });
2581
+ });
2582
+ var SelectArrow = /* @__PURE__ */ forwardRef23(({ classNames, ...props }, forwardedRef) => {
2583
+ const { tx } = useThemeContext();
2584
+ return /* @__PURE__ */ React26.createElement(SelectPrimitive.Arrow, {
2585
+ ...props,
2586
+ className: tx("select.arrow", "select__arrow", {}, classNames),
2587
+ ref: forwardedRef
2588
+ });
2589
+ });
2590
+ var Select = {
2591
+ Root: SelectRoot,
2592
+ Trigger: SelectTrigger,
2593
+ TriggerButton: SelectTriggerButton,
2594
+ Value: SelectValue,
2595
+ Icon: SelectIcon,
2596
+ Portal: SelectPortal,
2597
+ Content: SelectContent,
2598
+ ScrollUpButton: SelectScrollUpButton2,
2599
+ ScrollDownButton: SelectScrollDownButton2,
2600
+ Viewport: SelectViewport2,
2601
+ Item: SelectItem,
2602
+ ItemText: SelectItemText,
2603
+ ItemIndicator: SelectItemIndicator,
2604
+ Option: SelectOption,
2605
+ Group: SelectGroup,
2606
+ Label: SelectLabel,
2607
+ Separator: SelectSeparator,
2608
+ Arrow: SelectArrow
2609
+ };
2610
+
2611
+ // packages/ui/react-ui/src/components/Separator/Separator.tsx
2612
+ import { Separator as SeparatorPrimitive } from "@radix-ui/react-separator";
2613
+ import React27 from "react";
2614
+ var Separator4 = ({ classNames, orientation = "horizontal", ...props }) => {
2615
+ const { tx } = useThemeContext();
2616
+ return /* @__PURE__ */ React27.createElement(SeparatorPrimitive, {
2617
+ orientation,
2618
+ ...props,
2619
+ className: tx("separator.root", "separator", {
2620
+ orientation
2621
+ }, classNames)
2622
+ });
2623
+ };
2624
+
2625
+ // packages/ui/react-ui/src/components/Tag/Tag.tsx
2626
+ import { Primitive as Primitive12 } from "@radix-ui/react-primitive";
2627
+ import { Slot as Slot13 } from "@radix-ui/react-slot";
2628
+ import React28, { forwardRef as forwardRef24 } from "react";
2629
+ var Tag = /* @__PURE__ */ forwardRef24(({ asChild, palette, classNames, ...props }, forwardedRef) => {
2630
+ const { tx } = useThemeContext();
2631
+ const Root5 = asChild ? Slot13 : Primitive12.span;
2632
+ return /* @__PURE__ */ React28.createElement(Root5, {
2633
+ ...props,
2634
+ className: tx("tag.root", "tag", {
2635
+ palette
2636
+ }, classNames),
2637
+ ref: forwardedRef
2638
+ });
2639
+ });
2640
+
2641
+ // packages/ui/react-ui/src/components/Toast/Toast.tsx
2642
+ import { Primitive as Primitive13 } from "@radix-ui/react-primitive";
2643
+ import { Slot as Slot14 } from "@radix-ui/react-slot";
2644
+ 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";
2645
+ import React29, { forwardRef as forwardRef25 } from "react";
2646
+ var ToastProvider = ToastProviderPrimitive;
2647
+ var ToastViewport = /* @__PURE__ */ forwardRef25(({ classNames, ...props }, forwardedRef) => {
2648
+ const { tx } = useThemeContext();
2649
+ return /* @__PURE__ */ React29.createElement(ToastViewportPrimitive, {
2650
+ className: tx("toast.viewport", "toast-viewport", {}, classNames),
2651
+ ref: forwardedRef
2652
+ });
2653
+ });
2654
+ var ToastRoot = /* @__PURE__ */ forwardRef25(({ classNames, children, ...props }, forwardedRef) => {
2655
+ const { tx } = useThemeContext();
2656
+ return /* @__PURE__ */ React29.createElement(ToastRootPrimitive, {
2657
+ ...props,
2658
+ className: tx("toast.root", "toast", {}, classNames),
2659
+ ref: forwardedRef
2660
+ }, /* @__PURE__ */ React29.createElement(ElevationProvider, {
2661
+ elevation: "chrome"
2662
+ }, children));
2663
+ });
2664
+ var ToastBody = /* @__PURE__ */ forwardRef25(({ asChild, classNames, ...props }, forwardedRef) => {
2665
+ const { tx } = useThemeContext();
2666
+ const Root5 = asChild ? Slot14 : Primitive13.div;
2667
+ return /* @__PURE__ */ React29.createElement(Root5, {
2668
+ ...props,
2669
+ className: tx("toast.body", "toast__body", {}, classNames),
2670
+ ref: forwardedRef
2671
+ });
2672
+ });
2673
+ var ToastTitle = /* @__PURE__ */ forwardRef25(({ asChild, classNames, ...props }, forwardedRef) => {
2674
+ const { tx } = useThemeContext();
2675
+ const Root5 = asChild ? Slot14 : ToastTitlePrimitive;
2676
+ return /* @__PURE__ */ React29.createElement(Root5, {
2677
+ ...props,
2678
+ className: tx("toast.title", "toast__title", {}, classNames),
2679
+ ref: forwardedRef
2680
+ });
2681
+ });
2682
+ var ToastDescription = /* @__PURE__ */ forwardRef25(({ asChild, classNames, ...props }, forwardedRef) => {
2683
+ const { tx } = useThemeContext();
2684
+ const Root5 = asChild ? Slot14 : ToastDescriptionPrimitive;
2685
+ return /* @__PURE__ */ React29.createElement(Root5, {
2686
+ ...props,
2687
+ className: tx("toast.description", "toast__description", {}, classNames),
2688
+ ref: forwardedRef
2689
+ });
2690
+ });
2691
+ var ToastActions = /* @__PURE__ */ forwardRef25(({ asChild, classNames, ...props }, forwardedRef) => {
2692
+ const { tx } = useThemeContext();
2693
+ const Root5 = asChild ? Slot14 : Primitive13.div;
2694
+ return /* @__PURE__ */ React29.createElement(Root5, {
2695
+ ...props,
2696
+ className: tx("toast.actions", "toast__actions", {}, classNames),
2697
+ ref: forwardedRef
2698
+ });
2699
+ });
2700
+ var ToastAction = ToastActionPrimitive;
2701
+ var ToastClose = ToastClosePrimitive;
2702
+ var Toast = {
2703
+ Provider: ToastProvider,
2704
+ Viewport: ToastViewport,
2705
+ Root: ToastRoot,
2706
+ Body: ToastBody,
2707
+ Title: ToastTitle,
2708
+ Description: ToastDescription,
2709
+ Actions: ToastActions,
2710
+ Action: ToastAction,
2711
+ Close: ToastClose
2712
+ };
2713
+
2714
+ // packages/ui/react-ui/src/components/Toolbar/Toolbar.tsx
2715
+ import * as ToolbarPrimitive from "@radix-ui/react-toolbar";
2716
+ import React30, { forwardRef as forwardRef26 } from "react";
2717
+ var ToolbarRoot = /* @__PURE__ */ forwardRef26(({ classNames, children, ...props }, forwardedRef) => {
2718
+ const { tx } = useThemeContext();
2719
+ return /* @__PURE__ */ React30.createElement(ToolbarPrimitive.Root, {
2720
+ ...props,
2721
+ className: tx("toolbar.root", "toolbar", {}, classNames),
2722
+ ref: forwardedRef
2723
+ }, children);
2724
+ });
2725
+ var ToolbarButton = /* @__PURE__ */ forwardRef26((props, forwardedRef) => {
2726
+ return /* @__PURE__ */ React30.createElement(ToolbarPrimitive.Button, {
2727
+ asChild: true
2728
+ }, /* @__PURE__ */ React30.createElement(Button, {
2729
+ ...props,
2730
+ ref: forwardedRef
2731
+ }));
2732
+ });
2733
+ var ToolbarToggle = /* @__PURE__ */ forwardRef26((props, forwardedRef) => {
2734
+ return /* @__PURE__ */ React30.createElement(ToolbarPrimitive.Button, {
2735
+ asChild: true
2736
+ }, /* @__PURE__ */ React30.createElement(Toggle, {
2737
+ ...props,
2738
+ ref: forwardedRef
2739
+ }));
2740
+ });
2741
+ var ToolbarLink = /* @__PURE__ */ forwardRef26((props, forwardedRef) => {
2742
+ return /* @__PURE__ */ React30.createElement(ToolbarPrimitive.Link, {
2743
+ asChild: true
2744
+ }, /* @__PURE__ */ React30.createElement(Link, {
2745
+ ...props,
2746
+ ref: forwardedRef
2747
+ }));
2748
+ });
2749
+ var ToolbarToggleGroup2 = /* @__PURE__ */ forwardRef26(({ classNames, children, elevation, ...props }, forwardedRef) => {
2750
+ return /* @__PURE__ */ React30.createElement(ToolbarPrimitive.ToolbarToggleGroup, {
2751
+ ...props,
2752
+ asChild: true
2753
+ }, /* @__PURE__ */ React30.createElement(ButtonGroup, {
2754
+ classNames,
2755
+ children,
2756
+ elevation,
2757
+ ref: forwardedRef
2758
+ }));
2759
+ });
2760
+ var ToolbarToggleGroupItem = /* @__PURE__ */ forwardRef26(({ variant, density, elevation, classNames, children, ...props }, forwardedRef) => {
2761
+ return /* @__PURE__ */ React30.createElement(ToolbarPrimitive.ToolbarToggleItem, {
2762
+ ...props,
2763
+ asChild: true
2764
+ }, /* @__PURE__ */ React30.createElement(Button, {
2765
+ variant,
2766
+ density,
2767
+ elevation,
2768
+ classNames,
2769
+ children,
2770
+ ref: forwardedRef
2771
+ }));
2772
+ });
2773
+ var ToolbarSeparator = (props) => {
2774
+ return /* @__PURE__ */ React30.createElement(ToolbarPrimitive.Separator, {
2775
+ asChild: true
2776
+ }, /* @__PURE__ */ React30.createElement(Separator4, {
2777
+ orientation: "vertical",
2778
+ ...props
2779
+ }));
2780
+ };
2781
+ var Toolbar = {
2782
+ Root: ToolbarRoot,
2783
+ Button: ToolbarButton,
2784
+ Link: ToolbarLink,
2785
+ Toggle: ToolbarToggle,
2786
+ ToggleGroup: ToolbarToggleGroup2,
2787
+ ToggleGroupItem: ToolbarToggleGroupItem,
2788
+ Separator: ToolbarSeparator
2789
+ };
2790
+
2791
+ // packages/ui/react-ui/src/components/Tooltip/Tooltip.tsx
2792
+ import { Provider as TooltipProviderPrimitive, Root as TooltipRootPrimitive, TooltipContent as TooltipContentPrimitive, TooltipTrigger as TooltipTriggerPrimitive, TooltipPortal as TooltipPortalPrimitive, TooltipArrow as TooltipArrowPrimitive } from "@radix-ui/react-tooltip";
2793
+ import React31, { forwardRef as forwardRef27 } from "react";
2794
+ var TooltipProvider = TooltipProviderPrimitive;
2795
+ var TooltipRoot = TooltipRootPrimitive;
2796
+ var TooltipPortal = TooltipPortalPrimitive;
2797
+ var TooltipTrigger = TooltipTriggerPrimitive;
2798
+ var TooltipArrow = /* @__PURE__ */ forwardRef27(({ classNames, ...props }, forwardedRef) => {
2799
+ const { tx } = useThemeContext();
2800
+ return /* @__PURE__ */ React31.createElement(TooltipArrowPrimitive, {
2801
+ ...props,
2802
+ className: tx("tooltip.arrow", "tooltip__arrow", {}, classNames),
2803
+ ref: forwardedRef
2804
+ });
2805
+ });
2806
+ var TooltipContent = /* @__PURE__ */ forwardRef27(({ classNames, ...props }, forwardedRef) => {
2807
+ const { tx } = useThemeContext();
2808
+ return /* @__PURE__ */ React31.createElement(TooltipContentPrimitive, {
2809
+ sideOffset: 4,
2810
+ collisionPadding: 8,
2811
+ ...props,
2812
+ className: tx("tooltip.content", "tooltip", {}, classNames),
2813
+ ref: forwardedRef
2814
+ });
2815
+ });
2816
+ var Tooltip = {
2817
+ Provider: TooltipProvider,
2818
+ Root: TooltipRoot,
2819
+ Portal: TooltipPortal,
2820
+ Trigger: TooltipTrigger,
2821
+ Arrow: TooltipArrow,
2822
+ Content: TooltipContent
2823
+ };
2824
+
2825
+ // packages/ui/react-ui/src/components/ThemeProvider/ThemeProvider.tsx
2826
+ import { createKeyborg } from "keyborg";
2827
+ import React32, { createContext as createContext10, useEffect as useEffect7 } from "react";
2828
+
2829
+ // packages/ui/react-ui/src/util/hasIosKeyboard.ts
2830
+ var hasIosKeyboard = () => {
2831
+ return !!navigator.userAgent.match(/iP(ad|od|hone).+Safari/);
2832
+ };
2833
+
2834
+ // packages/ui/react-ui/src/components/ThemeProvider/ThemeProvider.tsx
2835
+ var ThemeContext = /* @__PURE__ */ createContext10(void 0);
2836
+ var ThemeProvider = ({ children, fallback = null, resourceExtensions, appNs, tx = (_path, defaultClassName, _styleProps, ..._options) => defaultClassName, themeMode = "dark", rootDensity = "fine", rootElevation = "base" }) => {
2837
+ useEffect7(() => {
2838
+ if (document.defaultView) {
2839
+ const kb = createKeyborg(document.defaultView);
2840
+ kb.subscribe(handleInputModalityChange);
2841
+ return () => kb.unsubscribe(handleInputModalityChange);
2842
+ }
2843
+ }, []);
2844
+ return /* @__PURE__ */ React32.createElement(ThemeContext.Provider, {
2845
+ value: {
2846
+ tx,
2847
+ themeMode,
2848
+ hasIosKeyboard: hasIosKeyboard()
2849
+ }
2850
+ }, /* @__PURE__ */ React32.createElement(TranslationsProvider, {
2851
+ fallback,
2852
+ resourceExtensions,
2853
+ appNs
2854
+ }, /* @__PURE__ */ React32.createElement(ElevationProvider, {
2855
+ elevation: rootElevation
2856
+ }, /* @__PURE__ */ React32.createElement(DensityProvider, {
2857
+ density: rootDensity
2858
+ }, children))));
2859
+ };
2860
+ var handleInputModalityChange = (isUsingKeyboard) => {
2861
+ if (isUsingKeyboard) {
2862
+ document.body.setAttribute("data-is-keyboard", "true");
2863
+ } else {
2864
+ document.body.removeAttribute("data-is-keyboard");
2865
+ }
2866
+ };
2867
+ export {
2868
+ AlertDialog,
2869
+ AnchoredOverflow,
2870
+ Avatar,
2871
+ AvatarGroup,
2872
+ AvatarGroupItem,
2873
+ BUTTON_GROUP_NAME,
2874
+ Breadcrumb,
2875
+ Button,
2876
+ ButtonGroup,
2877
+ ContextMenu2 as ContextMenu,
2878
+ DensityContext,
2879
+ DensityProvider,
2880
+ Dialog,
2881
+ DropdownMenu,
2882
+ ElevationContext,
2883
+ ElevationProvider,
2884
+ Icon,
2885
+ Input,
2886
+ LIST_ITEM_NAME,
2887
+ LIST_NAME,
2888
+ Link,
2889
+ List,
2890
+ ListItem,
2891
+ Main,
2892
+ Message,
2893
+ Popover,
2894
+ ScrollArea,
2895
+ Select,
2896
+ Separator4 as Separator,
2897
+ Status,
2898
+ Tag,
2899
+ ThemeContext,
2900
+ ThemeProvider,
2901
+ Toast,
2902
+ Toggle,
2903
+ ToggleGroup,
2904
+ ToggleGroupItem,
2905
+ Toolbar,
2906
+ Tooltip,
2907
+ Trans,
2908
+ Tree,
2909
+ TreeItem,
2910
+ Treegrid,
2911
+ createDropdownMenuScope,
2912
+ createPopoverScope,
2913
+ hasIosKeyboard,
2914
+ isLabel,
2915
+ toLocalizedString,
2916
+ useAvatarContext,
2917
+ useButtonGroupContext,
2918
+ useDensityContext,
2919
+ useDropdownMenuContext,
2920
+ useDropdownMenuMenuScope,
2921
+ useElevationContext,
2922
+ useListContext,
2923
+ useListItemContext,
2924
+ useMainContext,
2925
+ useSidebars,
2926
+ useThemeContext,
2927
+ useTranslation,
2928
+ useTranslationsContext,
2929
+ useVisualViewport
2930
+ };
2931
+ //# sourceMappingURL=index.mjs.map