@dxos/react-ui 0.6.12 → 0.6.13-main.548ca8d

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