@dxos/react-ui 0.8.2-main.12df754 → 0.8.2-main.30e4dbb
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.
- package/dist/lib/browser/index.mjs +1607 -1075
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +1942 -1408
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +1607 -1075
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/Buttons/Button.stories.d.ts +10 -44
- package/dist/types/src/components/Buttons/Button.stories.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/IconButton.d.ts +4 -5
- package/dist/types/src/components/Buttons/IconButton.d.ts.map +1 -1
- package/dist/types/src/components/Clipboard/ClipboardProvider.d.ts.map +1 -1
- package/dist/types/src/components/Clipboard/CopyButton.d.ts +2 -1
- package/dist/types/src/components/Clipboard/CopyButton.d.ts.map +1 -1
- package/dist/types/src/components/Clipboard/index.d.ts +2 -2
- package/dist/types/src/components/DensityProvider/DensityProvider.d.ts.map +1 -1
- package/dist/types/src/components/Dialogs/Dialog.d.ts +6 -2
- package/dist/types/src/components/Dialogs/Dialog.d.ts.map +1 -1
- package/dist/types/src/components/ElevationProvider/ElevationProvider.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.stories.d.ts.map +1 -1
- package/dist/types/src/components/Lists/ListDropIndicator.d.ts.map +1 -1
- package/dist/types/src/components/Lists/TreeDropIndicator.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.d.ts.map +1 -1
- package/dist/types/src/components/Main/useSwipeToDismiss.d.ts.map +1 -1
- package/dist/types/src/components/Popover/Popover.d.ts +2 -1
- package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts.map +1 -1
- package/dist/types/src/components/Status/Status.stories.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts +1 -1
- package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.d.ts +94 -20
- package/dist/types/src/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts +40 -16
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useDensityContext.d.ts.map +1 -1
- package/dist/types/src/hooks/useElevationContext.d.ts.map +1 -1
- package/dist/types/src/hooks/useIconHref.d.ts.map +1 -1
- package/dist/types/src/hooks/useSafeCollisionPadding.d.ts.map +1 -1
- package/dist/types/src/hooks/useVisualViewport.d.ts.map +1 -1
- package/dist/types/src/playground/Controls.stories.d.ts +1 -1
- package/dist/types/src/playground/Controls.stories.d.ts.map +1 -1
- package/dist/types/src/playground/Custom.stories.d.ts +8 -0
- package/dist/types/src/playground/Custom.stories.d.ts.map +1 -0
- package/dist/types/src/testing/decorators/withVariants.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -13
- package/src/components/Avatars/Avatar.tsx +1 -1
- package/src/components/Buttons/Button.stories.tsx +19 -14
- package/src/components/Buttons/IconButton.stories.tsx +2 -2
- package/src/components/Buttons/IconButton.tsx +8 -33
- package/src/components/Clipboard/CopyButton.tsx +22 -24
- package/src/components/Dialogs/Dialog.tsx +12 -7
- package/src/components/Popover/Popover.tsx +3 -0
- package/src/components/ScrollArea/ScrollArea.tsx +3 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +41 -16
- package/src/components/Tooltip/Tooltip.tsx +748 -58
- package/src/components/index.ts +1 -1
- package/src/playground/Controls.stories.tsx +2 -2
- package/src/playground/Custom.stories.tsx +137 -0
|
@@ -152,8 +152,8 @@ var useVisualViewport = (deps) => {
|
|
|
152
152
|
// packages/ui/react-ui/src/components/AnchoredOverflow/AnchoredOverflow.tsx
|
|
153
153
|
var AnchoredOverflowRoot = /* @__PURE__ */ forwardRef(({ asChild, classNames, children, ...props }, forwardedRef) => {
|
|
154
154
|
const { tx } = useThemeContext();
|
|
155
|
-
const
|
|
156
|
-
return /* @__PURE__ */ React2.createElement(
|
|
155
|
+
const Root7 = asChild ? Slot : Primitive.div;
|
|
156
|
+
return /* @__PURE__ */ React2.createElement(Root7, {
|
|
157
157
|
role: "none",
|
|
158
158
|
...props,
|
|
159
159
|
className: tx("anchoredOverflow.root", "overflow-anchored", {}, classNames),
|
|
@@ -162,8 +162,8 @@ var AnchoredOverflowRoot = /* @__PURE__ */ forwardRef(({ asChild, classNames, ch
|
|
|
162
162
|
});
|
|
163
163
|
var AnchoredOverflowAnchor = /* @__PURE__ */ forwardRef(({ asChild, classNames, children, ...props }, forwardedRef) => {
|
|
164
164
|
const { tx } = useThemeContext();
|
|
165
|
-
const
|
|
166
|
-
return /* @__PURE__ */ React2.createElement(
|
|
165
|
+
const Root7 = asChild ? Slot : Primitive.div;
|
|
166
|
+
return /* @__PURE__ */ React2.createElement(Root7, {
|
|
167
167
|
role: "none",
|
|
168
168
|
...props,
|
|
169
169
|
className: tx("anchoredOverflow.anchor", "overflow-anchor", {}, classNames),
|
|
@@ -206,17 +206,17 @@ var AvatarContent = /* @__PURE__ */ forwardRef2(({ icon, classNames, ...props },
|
|
|
206
206
|
return /* @__PURE__ */ React3.createElement(DxAvatar, {
|
|
207
207
|
...props,
|
|
208
208
|
icon: href,
|
|
209
|
-
labelId,
|
|
209
|
+
"aria-labelledby": labelId,
|
|
210
210
|
"aria-describedby": descriptionId,
|
|
211
211
|
rootClassName: mx(classNames),
|
|
212
212
|
ref: forwardedRef
|
|
213
213
|
});
|
|
214
214
|
});
|
|
215
215
|
var AvatarLabel = /* @__PURE__ */ forwardRef2(({ asChild, srOnly, classNames, ...props }, forwardedRef) => {
|
|
216
|
-
const
|
|
216
|
+
const Root7 = asChild ? Slot2 : Primitive2.span;
|
|
217
217
|
const { tx } = useThemeContext();
|
|
218
218
|
const { labelId } = useAvatarContext("AvatarLabel");
|
|
219
|
-
return /* @__PURE__ */ React3.createElement(
|
|
219
|
+
return /* @__PURE__ */ React3.createElement(Root7, {
|
|
220
220
|
...props,
|
|
221
221
|
id: labelId,
|
|
222
222
|
ref: forwardedRef,
|
|
@@ -226,10 +226,10 @@ var AvatarLabel = /* @__PURE__ */ forwardRef2(({ asChild, srOnly, classNames, ..
|
|
|
226
226
|
});
|
|
227
227
|
});
|
|
228
228
|
var AvatarDescription = /* @__PURE__ */ forwardRef2(({ asChild, srOnly, classNames, ...props }, forwardedRef) => {
|
|
229
|
-
const
|
|
229
|
+
const Root7 = asChild ? Slot2 : Primitive2.span;
|
|
230
230
|
const { tx } = useThemeContext();
|
|
231
231
|
const { descriptionId } = useAvatarContext("AvatarDescription");
|
|
232
|
-
return /* @__PURE__ */ React3.createElement(
|
|
232
|
+
return /* @__PURE__ */ React3.createElement(Root7, {
|
|
233
233
|
...props,
|
|
234
234
|
id: descriptionId,
|
|
235
235
|
ref: forwardedRef,
|
|
@@ -257,8 +257,8 @@ import { Slot as Slot3 } from "@radix-ui/react-slot";
|
|
|
257
257
|
import React4, { forwardRef as forwardRef3 } from "react";
|
|
258
258
|
var Link = /* @__PURE__ */ forwardRef3(({ asChild, variant, classNames, ...props }, forwardedRef) => {
|
|
259
259
|
const { tx } = useThemeContext();
|
|
260
|
-
const
|
|
261
|
-
return /* @__PURE__ */ React4.createElement(
|
|
260
|
+
const Root7 = asChild ? Slot3 : Primitive3.a;
|
|
261
|
+
return /* @__PURE__ */ React4.createElement(Root7, {
|
|
262
262
|
...props,
|
|
263
263
|
className: tx("link.root", "link", {
|
|
264
264
|
variant
|
|
@@ -270,8 +270,8 @@ var Link = /* @__PURE__ */ forwardRef3(({ asChild, variant, classNames, ...props
|
|
|
270
270
|
// packages/ui/react-ui/src/components/Breadcrumb/Breadcrumb.tsx
|
|
271
271
|
var BreadcrumbRoot = /* @__PURE__ */ forwardRef4(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
272
272
|
const { tx } = useThemeContext();
|
|
273
|
-
const
|
|
274
|
-
return /* @__PURE__ */ React5.createElement(
|
|
273
|
+
const Root7 = asChild ? Slot4 : Primitive4.div;
|
|
274
|
+
return /* @__PURE__ */ React5.createElement(Root7, {
|
|
275
275
|
role: "navigation",
|
|
276
276
|
...props,
|
|
277
277
|
className: tx("breadcrumb.root", "breadcrumb", {}, classNames),
|
|
@@ -280,8 +280,8 @@ var BreadcrumbRoot = /* @__PURE__ */ forwardRef4(({ asChild, classNames, ...prop
|
|
|
280
280
|
});
|
|
281
281
|
var BreadcrumbList = /* @__PURE__ */ forwardRef4(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
282
282
|
const { tx } = useThemeContext();
|
|
283
|
-
const
|
|
284
|
-
return /* @__PURE__ */ React5.createElement(
|
|
283
|
+
const Root7 = asChild ? Slot4 : Primitive4.ol;
|
|
284
|
+
return /* @__PURE__ */ React5.createElement(Root7, {
|
|
285
285
|
role: "list",
|
|
286
286
|
...props,
|
|
287
287
|
className: tx("breadcrumb.list", "breadcrumb__list", {}, classNames),
|
|
@@ -290,8 +290,8 @@ var BreadcrumbList = /* @__PURE__ */ forwardRef4(({ asChild, classNames, ...prop
|
|
|
290
290
|
});
|
|
291
291
|
var BreadcrumbListItem = /* @__PURE__ */ forwardRef4(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
292
292
|
const { tx } = useThemeContext();
|
|
293
|
-
const
|
|
294
|
-
return /* @__PURE__ */ React5.createElement(
|
|
293
|
+
const Root7 = asChild ? Slot4 : Primitive4.li;
|
|
294
|
+
return /* @__PURE__ */ React5.createElement(Root7, {
|
|
295
295
|
role: "listitem",
|
|
296
296
|
...props,
|
|
297
297
|
className: tx("breadcrumb.listItem", "breadcrumb__list__item", {}, classNames),
|
|
@@ -299,16 +299,16 @@ var BreadcrumbListItem = /* @__PURE__ */ forwardRef4(({ asChild, classNames, ...
|
|
|
299
299
|
});
|
|
300
300
|
});
|
|
301
301
|
var BreadcrumbLink = /* @__PURE__ */ forwardRef4(({ asChild, ...props }, forwardedRef) => {
|
|
302
|
-
const
|
|
303
|
-
return /* @__PURE__ */ React5.createElement(
|
|
302
|
+
const Root7 = asChild ? Slot4 : Link;
|
|
303
|
+
return /* @__PURE__ */ React5.createElement(Root7, {
|
|
304
304
|
...props,
|
|
305
305
|
ref: forwardedRef
|
|
306
306
|
});
|
|
307
307
|
});
|
|
308
308
|
var BreadcrumbCurrent = /* @__PURE__ */ forwardRef4(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
309
309
|
const { tx } = useThemeContext();
|
|
310
|
-
const
|
|
311
|
-
return /* @__PURE__ */ React5.createElement(
|
|
310
|
+
const Root7 = asChild ? Slot4 : "h1";
|
|
311
|
+
return /* @__PURE__ */ React5.createElement(Root7, {
|
|
312
312
|
...props,
|
|
313
313
|
"aria-current": "page",
|
|
314
314
|
className: tx("breadcrumb.current", "breadcrumb__item__heading--current", {}, classNames),
|
|
@@ -350,8 +350,8 @@ var Button = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef5(({ classNames, chi
|
|
|
350
350
|
const { tx } = useThemeContext();
|
|
351
351
|
const elevation = useElevationContext(propsElevation);
|
|
352
352
|
const density = useDensityContext(propsDensity);
|
|
353
|
-
const
|
|
354
|
-
return /* @__PURE__ */ React6.createElement(
|
|
353
|
+
const Root7 = asChild ? Slot5 : Primitive5.button;
|
|
354
|
+
return /* @__PURE__ */ React6.createElement(Root7, {
|
|
355
355
|
ref,
|
|
356
356
|
...props,
|
|
357
357
|
"data-variant": variant,
|
|
@@ -373,8 +373,8 @@ Button.displayName = BUTTON_NAME;
|
|
|
373
373
|
var ButtonGroup = /* @__PURE__ */ forwardRef5(({ children, elevation: propsElevation, classNames, asChild, ...props }, forwardedRef) => {
|
|
374
374
|
const { tx } = useThemeContext();
|
|
375
375
|
const elevation = useElevationContext(propsElevation);
|
|
376
|
-
const
|
|
377
|
-
return /* @__PURE__ */ React6.createElement(
|
|
376
|
+
const Root7 = asChild ? Slot5 : Primitive5.div;
|
|
377
|
+
return /* @__PURE__ */ React6.createElement(Root7, {
|
|
378
378
|
role: "none",
|
|
379
379
|
...props,
|
|
380
380
|
className: tx("button.group", "button-group", {
|
|
@@ -388,7 +388,7 @@ var ButtonGroup = /* @__PURE__ */ forwardRef5(({ children, elevation: propsEleva
|
|
|
388
388
|
ButtonGroup.displayName = BUTTON_GROUP_NAME;
|
|
389
389
|
|
|
390
390
|
// packages/ui/react-ui/src/components/Buttons/IconButton.tsx
|
|
391
|
-
import React9, { forwardRef as forwardRef8
|
|
391
|
+
import React9, { forwardRef as forwardRef8 } from "react";
|
|
392
392
|
|
|
393
393
|
// packages/ui/react-ui/src/components/Icon/Icon.tsx
|
|
394
394
|
import React7, { forwardRef as forwardRef6, memo as memo2 } from "react";
|
|
@@ -407,98 +407,618 @@ var Icon = /* @__PURE__ */ memo2(/* @__PURE__ */ forwardRef6(({ icon, classNames
|
|
|
407
407
|
}));
|
|
408
408
|
|
|
409
409
|
// packages/ui/react-ui/src/components/Tooltip/Tooltip.tsx
|
|
410
|
-
import {
|
|
411
|
-
import
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
import {
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
};
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
410
|
+
import { composeEventHandlers } from "@radix-ui/primitive";
|
|
411
|
+
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
412
|
+
import { createContextScope } from "@radix-ui/react-context";
|
|
413
|
+
import { DismissableLayer } from "@radix-ui/react-dismissable-layer";
|
|
414
|
+
import { useId as useId2 } from "@radix-ui/react-id";
|
|
415
|
+
import * as PopperPrimitive from "@radix-ui/react-popper";
|
|
416
|
+
import { createPopperScope } from "@radix-ui/react-popper";
|
|
417
|
+
import { Portal as PortalPrimitive } from "@radix-ui/react-portal";
|
|
418
|
+
import { Presence } from "@radix-ui/react-presence";
|
|
419
|
+
import { Primitive as Primitive6 } from "@radix-ui/react-primitive";
|
|
420
|
+
import { Slottable } from "@radix-ui/react-slot";
|
|
421
|
+
import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
|
422
|
+
import * as VisuallyHiddenPrimitive from "@radix-ui/react-visually-hidden";
|
|
423
|
+
import React8, { forwardRef as forwardRef7, useCallback as useCallback3, useEffect as useEffect2, useMemo, useRef, useState as useState4 } from "react";
|
|
424
|
+
var [createTooltipContext, createTooltipScope] = createContextScope("Tooltip", [
|
|
425
|
+
createPopperScope
|
|
426
|
+
]);
|
|
427
|
+
var usePopperScope = createPopperScope();
|
|
428
|
+
var DEFAULT_DELAY_DURATION = 700;
|
|
429
|
+
var TOOLTIP_OPEN = "tooltip.open";
|
|
430
|
+
var TOOLTIP_NAME = "Tooltip";
|
|
431
|
+
var [TooltipContextProvider, useTooltipContext] = createTooltipContext(TOOLTIP_NAME);
|
|
432
|
+
var TooltipProvider = (props) => {
|
|
433
|
+
const { __scopeTooltip, children, open: openProp, defaultOpen = false, onOpenChange, disableHoverableContent = false, delayDuration = DEFAULT_DELAY_DURATION, skipDelayDuration = 300 } = props;
|
|
434
|
+
const isOpenDelayedRef = useRef(true);
|
|
435
|
+
const isPointerInTransitRef = useRef(false);
|
|
436
|
+
const skipDelayTimerRef = useRef(0);
|
|
437
|
+
useEffect2(() => {
|
|
438
|
+
const skipDelayTimer = skipDelayTimerRef.current;
|
|
439
|
+
return () => window.clearTimeout(skipDelayTimer);
|
|
440
|
+
}, []);
|
|
441
|
+
const popperScope = usePopperScope(__scopeTooltip);
|
|
442
|
+
const [trigger, setTrigger] = useState4(null);
|
|
443
|
+
const [content, setContent] = useState4("");
|
|
444
|
+
const [side, setSide] = useState4(void 0);
|
|
445
|
+
const triggerRef = useRef(trigger);
|
|
446
|
+
const handleTriggerChange = useCallback3((nextTrigger) => {
|
|
447
|
+
setTrigger(nextTrigger);
|
|
448
|
+
triggerRef.current = nextTrigger;
|
|
449
|
+
setContent(nextTrigger?.getAttribute("data-tooltip-content") ?? "");
|
|
450
|
+
setSide(nextTrigger?.getAttribute("data-tooltip-side") ?? void 0);
|
|
451
|
+
}, []);
|
|
452
|
+
const contentId = useId2();
|
|
453
|
+
const openTimerRef = useRef(0);
|
|
454
|
+
const wasOpenDelayedRef = useRef(false);
|
|
455
|
+
const handleOpenChange = useCallback3((open2) => {
|
|
456
|
+
if (open2) {
|
|
457
|
+
window.clearTimeout(skipDelayTimerRef.current);
|
|
458
|
+
isOpenDelayedRef.current = false;
|
|
459
|
+
document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN));
|
|
460
|
+
} else {
|
|
461
|
+
window.clearTimeout(skipDelayTimerRef.current);
|
|
462
|
+
skipDelayTimerRef.current = window.setTimeout(() => isOpenDelayedRef.current = true, skipDelayDuration);
|
|
463
|
+
}
|
|
464
|
+
onOpenChange?.(open2);
|
|
465
|
+
}, [
|
|
466
|
+
skipDelayDuration,
|
|
467
|
+
onOpenChange
|
|
430
468
|
]);
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
var TooltipRoot = TooltipRootPrimitive;
|
|
436
|
-
var TooltipPortal = TooltipPortalPrimitive;
|
|
437
|
-
var TooltipTrigger = TooltipTriggerPrimitive;
|
|
438
|
-
var TooltipArrow = /* @__PURE__ */ forwardRef7(({ classNames, ...props }, forwardedRef) => {
|
|
439
|
-
const { tx } = useThemeContext();
|
|
440
|
-
return /* @__PURE__ */ React8.createElement(TooltipArrowPrimitive, {
|
|
441
|
-
...props,
|
|
442
|
-
className: tx("tooltip.arrow", "tooltip__arrow", {}, classNames),
|
|
443
|
-
ref: forwardedRef
|
|
469
|
+
const [open = false, setOpen] = useControllableState({
|
|
470
|
+
prop: openProp,
|
|
471
|
+
defaultProp: defaultOpen,
|
|
472
|
+
onChange: handleOpenChange
|
|
444
473
|
});
|
|
445
|
-
|
|
446
|
-
|
|
474
|
+
const stateAttribute = useMemo(() => {
|
|
475
|
+
return open ? wasOpenDelayedRef.current ? "delayed-open" : "instant-open" : "closed";
|
|
476
|
+
}, [
|
|
477
|
+
open
|
|
478
|
+
]);
|
|
479
|
+
const handleOpen = useCallback3(() => {
|
|
480
|
+
window.clearTimeout(openTimerRef.current);
|
|
481
|
+
openTimerRef.current = 0;
|
|
482
|
+
wasOpenDelayedRef.current = false;
|
|
483
|
+
setOpen(true);
|
|
484
|
+
}, [
|
|
485
|
+
setOpen
|
|
486
|
+
]);
|
|
487
|
+
const handleClose = useCallback3(() => {
|
|
488
|
+
window.clearTimeout(openTimerRef.current);
|
|
489
|
+
openTimerRef.current = 0;
|
|
490
|
+
setOpen(false);
|
|
491
|
+
}, [
|
|
492
|
+
setOpen
|
|
493
|
+
]);
|
|
494
|
+
const handleDelayedOpen = useCallback3(() => {
|
|
495
|
+
window.clearTimeout(openTimerRef.current);
|
|
496
|
+
openTimerRef.current = window.setTimeout(() => {
|
|
497
|
+
wasOpenDelayedRef.current = true;
|
|
498
|
+
setOpen(true);
|
|
499
|
+
openTimerRef.current = 0;
|
|
500
|
+
}, delayDuration);
|
|
501
|
+
}, [
|
|
502
|
+
delayDuration,
|
|
503
|
+
setOpen
|
|
504
|
+
]);
|
|
505
|
+
useEffect2(() => {
|
|
506
|
+
return () => {
|
|
507
|
+
if (openTimerRef.current) {
|
|
508
|
+
window.clearTimeout(openTimerRef.current);
|
|
509
|
+
openTimerRef.current = 0;
|
|
510
|
+
}
|
|
511
|
+
};
|
|
512
|
+
}, []);
|
|
447
513
|
const { tx } = useThemeContext();
|
|
448
514
|
const elevation = useElevationContext();
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
515
|
+
return /* @__PURE__ */ React8.createElement(PopperPrimitive.Root, popperScope, /* @__PURE__ */ React8.createElement(TooltipContextProvider, {
|
|
516
|
+
scope: __scopeTooltip,
|
|
517
|
+
contentId,
|
|
518
|
+
open,
|
|
519
|
+
stateAttribute,
|
|
520
|
+
trigger,
|
|
521
|
+
onTriggerChange: handleTriggerChange,
|
|
522
|
+
onTriggerEnter: useCallback3(() => {
|
|
523
|
+
if (isOpenDelayedRef.current) {
|
|
524
|
+
handleDelayedOpen();
|
|
525
|
+
} else {
|
|
526
|
+
handleOpen();
|
|
527
|
+
}
|
|
528
|
+
}, [
|
|
529
|
+
isOpenDelayedRef,
|
|
530
|
+
handleDelayedOpen,
|
|
531
|
+
handleOpen
|
|
532
|
+
]),
|
|
533
|
+
onTriggerLeave: useCallback3(() => {
|
|
534
|
+
if (disableHoverableContent) {
|
|
535
|
+
handleClose();
|
|
536
|
+
} else {
|
|
537
|
+
window.clearTimeout(openTimerRef.current);
|
|
538
|
+
openTimerRef.current = 0;
|
|
539
|
+
}
|
|
540
|
+
}, [
|
|
541
|
+
handleClose,
|
|
542
|
+
disableHoverableContent
|
|
543
|
+
]),
|
|
544
|
+
onOpen: handleOpen,
|
|
545
|
+
onClose: handleClose,
|
|
546
|
+
disableHoverableContent,
|
|
547
|
+
isPointerInTransitRef,
|
|
548
|
+
onPointerInTransitChange: useCallback3((inTransit) => {
|
|
549
|
+
isPointerInTransitRef.current = inTransit;
|
|
550
|
+
}, [])
|
|
551
|
+
}, /* @__PURE__ */ React8.createElement(TooltipContent, {
|
|
552
|
+
side,
|
|
454
553
|
className: tx("tooltip.content", "tooltip", {
|
|
455
554
|
elevation
|
|
456
|
-
}
|
|
555
|
+
})
|
|
556
|
+
}, content, /* @__PURE__ */ React8.createElement(TooltipArrow, {
|
|
557
|
+
className: tx("tooltip.arrow", "tooltip__arrow")
|
|
558
|
+
})), /* @__PURE__ */ React8.createElement(TooltipVirtualTrigger, {
|
|
559
|
+
virtualRef: triggerRef
|
|
560
|
+
}), children));
|
|
561
|
+
};
|
|
562
|
+
TooltipProvider.displayName = TOOLTIP_NAME;
|
|
563
|
+
var TooltipVirtualTrigger = ({ virtualRef, __scopeTooltip }) => {
|
|
564
|
+
const popperScope = usePopperScope(__scopeTooltip);
|
|
565
|
+
return /* @__PURE__ */ React8.createElement(PopperPrimitive.Anchor, {
|
|
566
|
+
asChild: true,
|
|
567
|
+
...popperScope,
|
|
568
|
+
virtualRef
|
|
569
|
+
});
|
|
570
|
+
};
|
|
571
|
+
var TRIGGER_NAME = "TooltipTrigger";
|
|
572
|
+
var TooltipTrigger = /* @__PURE__ */ forwardRef7((props, forwardedRef) => {
|
|
573
|
+
const {
|
|
574
|
+
__scopeTooltip,
|
|
575
|
+
onInteract,
|
|
576
|
+
// TODO(thure): Pass `delayDuration` into the context.
|
|
577
|
+
delayDuration: _delayDuration,
|
|
578
|
+
suppressNextTooltip,
|
|
579
|
+
side,
|
|
580
|
+
content,
|
|
581
|
+
...triggerProps
|
|
582
|
+
} = props;
|
|
583
|
+
const context = useTooltipContext(TRIGGER_NAME, __scopeTooltip);
|
|
584
|
+
const ref = useRef(null);
|
|
585
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
586
|
+
const isPointerDownRef = useRef(false);
|
|
587
|
+
const hasPointerMoveOpenedRef = useRef(false);
|
|
588
|
+
const handlePointerUp = useCallback3(() => isPointerDownRef.current = false, []);
|
|
589
|
+
useEffect2(() => {
|
|
590
|
+
return () => document.removeEventListener("pointerup", handlePointerUp);
|
|
591
|
+
}, [
|
|
592
|
+
handlePointerUp
|
|
593
|
+
]);
|
|
594
|
+
return /* @__PURE__ */ React8.createElement(Primitive6.button, {
|
|
595
|
+
// We purposefully avoid adding `type=button` here because tooltip triggers are also
|
|
596
|
+
// commonly anchors and the anchor `type` attribute signifies MIME type.
|
|
597
|
+
"aria-describedby": context.open ? context.contentId : void 0,
|
|
598
|
+
"data-state": context.stateAttribute,
|
|
599
|
+
"data-tooltip-content": content,
|
|
600
|
+
"data-tooltip-side": side,
|
|
601
|
+
...triggerProps,
|
|
602
|
+
ref: composedRefs,
|
|
603
|
+
onPointerMove: composeEventHandlers(props.onPointerMove, (event) => {
|
|
604
|
+
if (event.pointerType === "touch") {
|
|
605
|
+
return;
|
|
606
|
+
}
|
|
607
|
+
if (!hasPointerMoveOpenedRef.current && !context.isPointerInTransitRef.current) {
|
|
608
|
+
onInteract?.(event);
|
|
609
|
+
if (event.defaultPrevented) {
|
|
610
|
+
return;
|
|
611
|
+
}
|
|
612
|
+
context.onTriggerChange(ref.current);
|
|
613
|
+
context.onTriggerEnter();
|
|
614
|
+
hasPointerMoveOpenedRef.current = true;
|
|
615
|
+
}
|
|
616
|
+
}),
|
|
617
|
+
onPointerLeave: composeEventHandlers(props.onPointerLeave, () => {
|
|
618
|
+
context.onTriggerLeave();
|
|
619
|
+
hasPointerMoveOpenedRef.current = false;
|
|
620
|
+
}),
|
|
621
|
+
onPointerDown: composeEventHandlers(props.onPointerDown, () => {
|
|
622
|
+
if (context.open) {
|
|
623
|
+
context.onClose();
|
|
624
|
+
}
|
|
625
|
+
isPointerDownRef.current = true;
|
|
626
|
+
document.addEventListener("pointerup", handlePointerUp, {
|
|
627
|
+
once: true
|
|
628
|
+
});
|
|
629
|
+
}),
|
|
630
|
+
onFocus: composeEventHandlers(props.onFocus, (event) => {
|
|
631
|
+
if (!isPointerDownRef.current) {
|
|
632
|
+
onInteract?.(event);
|
|
633
|
+
if (event.defaultPrevented) {
|
|
634
|
+
return;
|
|
635
|
+
}
|
|
636
|
+
if (suppressNextTooltip?.current) {
|
|
637
|
+
suppressNextTooltip.current = false;
|
|
638
|
+
} else {
|
|
639
|
+
context.onTriggerChange(ref.current);
|
|
640
|
+
context.onOpen();
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
}),
|
|
644
|
+
onBlur: composeEventHandlers(props.onBlur, context.onClose),
|
|
645
|
+
onClick: composeEventHandlers(props.onClick, context.onClose)
|
|
646
|
+
});
|
|
647
|
+
});
|
|
648
|
+
TooltipTrigger.displayName = TRIGGER_NAME;
|
|
649
|
+
var PORTAL_NAME = "TooltipPortal";
|
|
650
|
+
var [PortalProvider, usePortalContext] = createTooltipContext(PORTAL_NAME, {
|
|
651
|
+
forceMount: void 0
|
|
652
|
+
});
|
|
653
|
+
var TooltipPortal = (props) => {
|
|
654
|
+
const { __scopeTooltip, forceMount, children, container } = props;
|
|
655
|
+
const context = useTooltipContext(PORTAL_NAME, __scopeTooltip);
|
|
656
|
+
return /* @__PURE__ */ React8.createElement(PortalProvider, {
|
|
657
|
+
scope: __scopeTooltip,
|
|
658
|
+
forceMount
|
|
659
|
+
}, /* @__PURE__ */ React8.createElement(Presence, {
|
|
660
|
+
present: forceMount || context.open
|
|
661
|
+
}, /* @__PURE__ */ React8.createElement(PortalPrimitive, {
|
|
662
|
+
asChild: true,
|
|
663
|
+
container
|
|
664
|
+
}, children)));
|
|
665
|
+
};
|
|
666
|
+
TooltipPortal.displayName = PORTAL_NAME;
|
|
667
|
+
var CONTENT_NAME = "TooltipContent";
|
|
668
|
+
var TooltipContent = /* @__PURE__ */ forwardRef7((props, forwardedRef) => {
|
|
669
|
+
const portalContext = usePortalContext(CONTENT_NAME, props.__scopeTooltip);
|
|
670
|
+
const { forceMount = portalContext.forceMount, side = "top", ...contentProps } = props;
|
|
671
|
+
const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);
|
|
672
|
+
return /* @__PURE__ */ React8.createElement(Presence, {
|
|
673
|
+
present: forceMount || context.open
|
|
674
|
+
}, context.disableHoverableContent ? /* @__PURE__ */ React8.createElement(TooltipContentImpl, {
|
|
675
|
+
side,
|
|
676
|
+
...contentProps,
|
|
677
|
+
ref: forwardedRef
|
|
678
|
+
}) : /* @__PURE__ */ React8.createElement(TooltipContentHoverable, {
|
|
679
|
+
side,
|
|
680
|
+
...contentProps,
|
|
681
|
+
ref: forwardedRef
|
|
682
|
+
}));
|
|
683
|
+
});
|
|
684
|
+
var TooltipContentHoverable = /* @__PURE__ */ forwardRef7((props, forwardedRef) => {
|
|
685
|
+
const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);
|
|
686
|
+
const ref = useRef(null);
|
|
687
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
688
|
+
const [pointerGraceArea, setPointerGraceArea] = useState4(null);
|
|
689
|
+
const { trigger, onClose } = context;
|
|
690
|
+
const content = ref.current;
|
|
691
|
+
const { onPointerInTransitChange } = context;
|
|
692
|
+
const handleRemoveGraceArea = useCallback3(() => {
|
|
693
|
+
setPointerGraceArea(null);
|
|
694
|
+
onPointerInTransitChange(false);
|
|
695
|
+
}, [
|
|
696
|
+
onPointerInTransitChange
|
|
697
|
+
]);
|
|
698
|
+
const handleCreateGraceArea = useCallback3((event, hoverTarget) => {
|
|
699
|
+
const currentTarget = event.currentTarget;
|
|
700
|
+
const exitPoint = {
|
|
701
|
+
x: event.clientX,
|
|
702
|
+
y: event.clientY
|
|
703
|
+
};
|
|
704
|
+
const exitSide = getExitSideFromRect(exitPoint, currentTarget.getBoundingClientRect());
|
|
705
|
+
const paddedExitPoints = getPaddedExitPoints(exitPoint, exitSide);
|
|
706
|
+
const hoverTargetPoints = getPointsFromRect(hoverTarget.getBoundingClientRect());
|
|
707
|
+
const graceArea = getHull([
|
|
708
|
+
...paddedExitPoints,
|
|
709
|
+
...hoverTargetPoints
|
|
710
|
+
]);
|
|
711
|
+
setPointerGraceArea(graceArea);
|
|
712
|
+
onPointerInTransitChange(true);
|
|
713
|
+
}, [
|
|
714
|
+
onPointerInTransitChange
|
|
715
|
+
]);
|
|
716
|
+
useEffect2(() => {
|
|
717
|
+
return () => handleRemoveGraceArea();
|
|
718
|
+
}, [
|
|
719
|
+
handleRemoveGraceArea
|
|
720
|
+
]);
|
|
721
|
+
useEffect2(() => {
|
|
722
|
+
if (trigger && content) {
|
|
723
|
+
const handleTriggerLeave = (event) => handleCreateGraceArea(event, content);
|
|
724
|
+
const handleContentLeave = (event) => handleCreateGraceArea(event, trigger);
|
|
725
|
+
trigger.addEventListener("pointerleave", handleTriggerLeave);
|
|
726
|
+
content.addEventListener("pointerleave", handleContentLeave);
|
|
727
|
+
return () => {
|
|
728
|
+
trigger.removeEventListener("pointerleave", handleTriggerLeave);
|
|
729
|
+
content.removeEventListener("pointerleave", handleContentLeave);
|
|
730
|
+
};
|
|
731
|
+
}
|
|
732
|
+
}, [
|
|
733
|
+
trigger,
|
|
734
|
+
content,
|
|
735
|
+
handleCreateGraceArea,
|
|
736
|
+
handleRemoveGraceArea
|
|
737
|
+
]);
|
|
738
|
+
useEffect2(() => {
|
|
739
|
+
if (pointerGraceArea) {
|
|
740
|
+
const handleTrackPointerGrace = (event) => {
|
|
741
|
+
const target = event.target;
|
|
742
|
+
const pointerPosition = {
|
|
743
|
+
x: event.clientX,
|
|
744
|
+
y: event.clientY
|
|
745
|
+
};
|
|
746
|
+
const hasEnteredTarget = trigger?.contains(target) || content?.contains(target);
|
|
747
|
+
const isPointerOutsideGraceArea = !isPointInPolygon(pointerPosition, pointerGraceArea);
|
|
748
|
+
if (hasEnteredTarget) {
|
|
749
|
+
handleRemoveGraceArea();
|
|
750
|
+
} else if (isPointerOutsideGraceArea) {
|
|
751
|
+
handleRemoveGraceArea();
|
|
752
|
+
onClose();
|
|
753
|
+
}
|
|
754
|
+
};
|
|
755
|
+
document.addEventListener("pointermove", handleTrackPointerGrace);
|
|
756
|
+
return () => document.removeEventListener("pointermove", handleTrackPointerGrace);
|
|
757
|
+
}
|
|
758
|
+
}, [
|
|
759
|
+
trigger,
|
|
760
|
+
content,
|
|
761
|
+
pointerGraceArea,
|
|
762
|
+
onClose,
|
|
763
|
+
handleRemoveGraceArea
|
|
764
|
+
]);
|
|
765
|
+
return /* @__PURE__ */ React8.createElement(TooltipContentImpl, {
|
|
766
|
+
...props,
|
|
767
|
+
ref: composedRefs
|
|
768
|
+
});
|
|
769
|
+
});
|
|
770
|
+
var [VisuallyHiddenContentContextProvider, useVisuallyHiddenContentContext] = createTooltipContext(TOOLTIP_NAME, {
|
|
771
|
+
isInside: false
|
|
772
|
+
});
|
|
773
|
+
var TooltipContentImpl = /* @__PURE__ */ forwardRef7((props, forwardedRef) => {
|
|
774
|
+
const { __scopeTooltip, children, "aria-label": ariaLabel, onEscapeKeyDown, onPointerDownOutside, ...contentProps } = props;
|
|
775
|
+
const context = useTooltipContext(CONTENT_NAME, __scopeTooltip);
|
|
776
|
+
const popperScope = usePopperScope(__scopeTooltip);
|
|
777
|
+
const { onClose } = context;
|
|
778
|
+
useEffect2(() => {
|
|
779
|
+
document.addEventListener(TOOLTIP_OPEN, onClose);
|
|
780
|
+
return () => document.removeEventListener(TOOLTIP_OPEN, onClose);
|
|
781
|
+
}, [
|
|
782
|
+
onClose
|
|
783
|
+
]);
|
|
784
|
+
useEffect2(() => {
|
|
785
|
+
if (context.trigger) {
|
|
786
|
+
const handleScroll = (event) => {
|
|
787
|
+
const target = event.target;
|
|
788
|
+
if (target?.contains(context.trigger)) {
|
|
789
|
+
onClose();
|
|
790
|
+
}
|
|
791
|
+
};
|
|
792
|
+
window.addEventListener("scroll", handleScroll, {
|
|
793
|
+
capture: true
|
|
794
|
+
});
|
|
795
|
+
return () => window.removeEventListener("scroll", handleScroll, {
|
|
796
|
+
capture: true
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
}, [
|
|
800
|
+
context.trigger,
|
|
801
|
+
onClose
|
|
802
|
+
]);
|
|
803
|
+
return /* @__PURE__ */ React8.createElement(DismissableLayer, {
|
|
804
|
+
asChild: true,
|
|
805
|
+
disableOutsidePointerEvents: false,
|
|
806
|
+
onEscapeKeyDown,
|
|
807
|
+
onPointerDownOutside,
|
|
808
|
+
onFocusOutside: (event) => event.preventDefault(),
|
|
809
|
+
onDismiss: onClose
|
|
810
|
+
}, /* @__PURE__ */ React8.createElement(PopperPrimitive.Content, {
|
|
811
|
+
"data-state": context.stateAttribute,
|
|
812
|
+
...popperScope,
|
|
813
|
+
...contentProps,
|
|
814
|
+
ref: forwardedRef,
|
|
815
|
+
style: {
|
|
816
|
+
...contentProps.style,
|
|
817
|
+
// re-namespace exposed content custom properties
|
|
818
|
+
...{
|
|
819
|
+
"--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
820
|
+
"--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
|
|
821
|
+
"--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
|
|
822
|
+
"--radix-tooltip-trigger-width": "var(--radix-popper-anchor-width)",
|
|
823
|
+
"--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
}, /* @__PURE__ */ React8.createElement(Slottable, null, children), /* @__PURE__ */ React8.createElement(VisuallyHiddenContentContextProvider, {
|
|
827
|
+
scope: __scopeTooltip,
|
|
828
|
+
isInside: true
|
|
829
|
+
}, /* @__PURE__ */ React8.createElement(VisuallyHiddenPrimitive.Root, {
|
|
830
|
+
id: context.contentId,
|
|
831
|
+
role: "tooltip"
|
|
832
|
+
}, ariaLabel || children))));
|
|
833
|
+
});
|
|
834
|
+
TooltipContent.displayName = CONTENT_NAME;
|
|
835
|
+
var ARROW_NAME = "TooltipArrow";
|
|
836
|
+
var TooltipArrow = /* @__PURE__ */ forwardRef7((props, forwardedRef) => {
|
|
837
|
+
const { __scopeTooltip, ...arrowProps } = props;
|
|
838
|
+
const popperScope = usePopperScope(__scopeTooltip);
|
|
839
|
+
const visuallyHiddenContentContext = useVisuallyHiddenContentContext(ARROW_NAME, __scopeTooltip);
|
|
840
|
+
return visuallyHiddenContentContext.isInside ? null : /* @__PURE__ */ React8.createElement(PopperPrimitive.Arrow, {
|
|
841
|
+
...popperScope,
|
|
842
|
+
...arrowProps,
|
|
457
843
|
ref: forwardedRef
|
|
458
844
|
});
|
|
459
845
|
});
|
|
846
|
+
TooltipArrow.displayName = ARROW_NAME;
|
|
847
|
+
var getExitSideFromRect = (point, rect) => {
|
|
848
|
+
const top = Math.abs(rect.top - point.y);
|
|
849
|
+
const bottom = Math.abs(rect.bottom - point.y);
|
|
850
|
+
const right = Math.abs(rect.right - point.x);
|
|
851
|
+
const left = Math.abs(rect.left - point.x);
|
|
852
|
+
switch (Math.min(top, bottom, right, left)) {
|
|
853
|
+
case left:
|
|
854
|
+
return "left";
|
|
855
|
+
case right:
|
|
856
|
+
return "right";
|
|
857
|
+
case top:
|
|
858
|
+
return "top";
|
|
859
|
+
case bottom:
|
|
860
|
+
return "bottom";
|
|
861
|
+
default:
|
|
862
|
+
throw new Error("unreachable");
|
|
863
|
+
}
|
|
864
|
+
};
|
|
865
|
+
var getPaddedExitPoints = (exitPoint, exitSide, padding = 5) => {
|
|
866
|
+
const paddedExitPoints = [];
|
|
867
|
+
switch (exitSide) {
|
|
868
|
+
case "top":
|
|
869
|
+
paddedExitPoints.push({
|
|
870
|
+
x: exitPoint.x - padding,
|
|
871
|
+
y: exitPoint.y + padding
|
|
872
|
+
}, {
|
|
873
|
+
x: exitPoint.x + padding,
|
|
874
|
+
y: exitPoint.y + padding
|
|
875
|
+
});
|
|
876
|
+
break;
|
|
877
|
+
case "bottom":
|
|
878
|
+
paddedExitPoints.push({
|
|
879
|
+
x: exitPoint.x - padding,
|
|
880
|
+
y: exitPoint.y - padding
|
|
881
|
+
}, {
|
|
882
|
+
x: exitPoint.x + padding,
|
|
883
|
+
y: exitPoint.y - padding
|
|
884
|
+
});
|
|
885
|
+
break;
|
|
886
|
+
case "left":
|
|
887
|
+
paddedExitPoints.push({
|
|
888
|
+
x: exitPoint.x + padding,
|
|
889
|
+
y: exitPoint.y - padding
|
|
890
|
+
}, {
|
|
891
|
+
x: exitPoint.x + padding,
|
|
892
|
+
y: exitPoint.y + padding
|
|
893
|
+
});
|
|
894
|
+
break;
|
|
895
|
+
case "right":
|
|
896
|
+
paddedExitPoints.push({
|
|
897
|
+
x: exitPoint.x - padding,
|
|
898
|
+
y: exitPoint.y - padding
|
|
899
|
+
}, {
|
|
900
|
+
x: exitPoint.x - padding,
|
|
901
|
+
y: exitPoint.y + padding
|
|
902
|
+
});
|
|
903
|
+
break;
|
|
904
|
+
}
|
|
905
|
+
return paddedExitPoints;
|
|
906
|
+
};
|
|
907
|
+
var getPointsFromRect = (rect) => {
|
|
908
|
+
const { top, right, bottom, left } = rect;
|
|
909
|
+
return [
|
|
910
|
+
{
|
|
911
|
+
x: left,
|
|
912
|
+
y: top
|
|
913
|
+
},
|
|
914
|
+
{
|
|
915
|
+
x: right,
|
|
916
|
+
y: top
|
|
917
|
+
},
|
|
918
|
+
{
|
|
919
|
+
x: right,
|
|
920
|
+
y: bottom
|
|
921
|
+
},
|
|
922
|
+
{
|
|
923
|
+
x: left,
|
|
924
|
+
y: bottom
|
|
925
|
+
}
|
|
926
|
+
];
|
|
927
|
+
};
|
|
928
|
+
var isPointInPolygon = (point, polygon) => {
|
|
929
|
+
const { x, y } = point;
|
|
930
|
+
let inside = false;
|
|
931
|
+
for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
|
|
932
|
+
const xi = polygon[i].x;
|
|
933
|
+
const yi = polygon[i].y;
|
|
934
|
+
const xj = polygon[j].x;
|
|
935
|
+
const yj = polygon[j].y;
|
|
936
|
+
const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
|
|
937
|
+
if (intersect) {
|
|
938
|
+
inside = !inside;
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
return inside;
|
|
942
|
+
};
|
|
943
|
+
var getHull = (points) => {
|
|
944
|
+
const newPoints = points.slice();
|
|
945
|
+
newPoints.sort((a, b) => {
|
|
946
|
+
if (a.x < b.x) {
|
|
947
|
+
return -1;
|
|
948
|
+
} else if (a.x > b.x) {
|
|
949
|
+
return 1;
|
|
950
|
+
} else if (a.y < b.y) {
|
|
951
|
+
return -1;
|
|
952
|
+
} else if (a.y > b.y) {
|
|
953
|
+
return 1;
|
|
954
|
+
} else {
|
|
955
|
+
return 0;
|
|
956
|
+
}
|
|
957
|
+
});
|
|
958
|
+
return getHullPresorted(newPoints);
|
|
959
|
+
};
|
|
960
|
+
var getHullPresorted = (points) => {
|
|
961
|
+
if (points.length <= 1) {
|
|
962
|
+
return points.slice();
|
|
963
|
+
}
|
|
964
|
+
const upperHull = [];
|
|
965
|
+
for (let i = 0; i < points.length; i++) {
|
|
966
|
+
const p = points[i];
|
|
967
|
+
while (upperHull.length >= 2) {
|
|
968
|
+
const q = upperHull[upperHull.length - 1];
|
|
969
|
+
const r = upperHull[upperHull.length - 2];
|
|
970
|
+
if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x)) {
|
|
971
|
+
upperHull.pop();
|
|
972
|
+
} else {
|
|
973
|
+
break;
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
upperHull.push(p);
|
|
977
|
+
}
|
|
978
|
+
upperHull.pop();
|
|
979
|
+
const lowerHull = [];
|
|
980
|
+
for (let i = points.length - 1; i >= 0; i--) {
|
|
981
|
+
const p = points[i];
|
|
982
|
+
while (lowerHull.length >= 2) {
|
|
983
|
+
const q = lowerHull[lowerHull.length - 1];
|
|
984
|
+
const r = lowerHull[lowerHull.length - 2];
|
|
985
|
+
if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x)) {
|
|
986
|
+
lowerHull.pop();
|
|
987
|
+
} else {
|
|
988
|
+
break;
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
lowerHull.push(p);
|
|
992
|
+
}
|
|
993
|
+
lowerHull.pop();
|
|
994
|
+
if (upperHull.length === 1 && lowerHull.length === 1 && upperHull[0].x === lowerHull[0].x && upperHull[0].y === lowerHull[0].y) {
|
|
995
|
+
return upperHull;
|
|
996
|
+
} else {
|
|
997
|
+
return upperHull.concat(lowerHull);
|
|
998
|
+
}
|
|
999
|
+
};
|
|
460
1000
|
var Tooltip = {
|
|
461
1001
|
Provider: TooltipProvider,
|
|
462
|
-
|
|
463
|
-
Portal: TooltipPortal,
|
|
464
|
-
Trigger: TooltipTrigger,
|
|
465
|
-
Arrow: TooltipArrow,
|
|
466
|
-
Content: TooltipContent
|
|
1002
|
+
Trigger: TooltipTrigger
|
|
467
1003
|
};
|
|
468
1004
|
|
|
469
1005
|
// packages/ui/react-ui/src/components/Buttons/IconButton.tsx
|
|
470
|
-
var IconOnlyButton = /* @__PURE__ */ forwardRef8(({ noTooltip, tooltipPortal = true,
|
|
471
|
-
const [triggerTooltipOpen, setTriggerTooltipOpen] = useState4(false);
|
|
1006
|
+
var IconOnlyButton = /* @__PURE__ */ forwardRef8(({ noTooltip, tooltipPortal = true, tooltipSide, suppressNextTooltip, ...props }, forwardedRef) => {
|
|
472
1007
|
if (noTooltip) {
|
|
473
1008
|
return /* @__PURE__ */ React9.createElement(LabelledIconButton, {
|
|
474
1009
|
...props,
|
|
475
1010
|
ref: forwardedRef
|
|
476
1011
|
});
|
|
477
1012
|
}
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
},
|
|
484
|
-
side: tooltipSide
|
|
485
|
-
}, props.label, /* @__PURE__ */ React9.createElement(Tooltip.Arrow, null));
|
|
486
|
-
return /* @__PURE__ */ React9.createElement(Tooltip.Root, {
|
|
487
|
-
open: triggerTooltipOpen,
|
|
488
|
-
onOpenChange: (nextOpen) => {
|
|
489
|
-
if (suppressNextTooltip?.current) {
|
|
490
|
-
setTriggerTooltipOpen(false);
|
|
491
|
-
suppressNextTooltip.current = false;
|
|
492
|
-
} else {
|
|
493
|
-
setTriggerTooltipOpen(nextOpen);
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
}, /* @__PURE__ */ React9.createElement(Tooltip.Trigger, {
|
|
497
|
-
asChild: true
|
|
1013
|
+
return /* @__PURE__ */ React9.createElement(Tooltip.Trigger, {
|
|
1014
|
+
asChild: true,
|
|
1015
|
+
content: props.label,
|
|
1016
|
+
side: tooltipSide,
|
|
1017
|
+
suppressNextTooltip
|
|
498
1018
|
}, /* @__PURE__ */ React9.createElement(LabelledIconButton, {
|
|
499
1019
|
...props,
|
|
500
1020
|
ref: forwardedRef
|
|
501
|
-
}))
|
|
1021
|
+
}));
|
|
502
1022
|
});
|
|
503
1023
|
var LabelledIconButton = /* @__PURE__ */ forwardRef8(({ icon, size, iconOnly, label, classNames, iconClassNames, caretDown, suppressNextTooltip, ...props }, forwardedRef) => {
|
|
504
1024
|
const { tx } = useThemeContext();
|
|
@@ -568,7 +1088,7 @@ var ToggleGroupItem = /* @__PURE__ */ forwardRef10(({ variant, elevation, densit
|
|
|
568
1088
|
});
|
|
569
1089
|
|
|
570
1090
|
// packages/ui/react-ui/src/components/Clipboard/ClipboardProvider.tsx
|
|
571
|
-
import React12, { createContext as createContext4, useCallback as
|
|
1091
|
+
import React12, { createContext as createContext4, useCallback as useCallback4, useContext as useContext6, useState as useState5 } from "react";
|
|
572
1092
|
var ClipboardContext = /* @__PURE__ */ createContext4({
|
|
573
1093
|
textValue: "",
|
|
574
1094
|
setTextValue: async (_) => {
|
|
@@ -577,7 +1097,7 @@ var ClipboardContext = /* @__PURE__ */ createContext4({
|
|
|
577
1097
|
var useClipboard = () => useContext6(ClipboardContext);
|
|
578
1098
|
var ClipboardProvider = ({ children }) => {
|
|
579
1099
|
const [textValue, setInternalTextValue] = useState5("");
|
|
580
|
-
const setTextValue =
|
|
1100
|
+
const setTextValue = useCallback4(async (nextValue) => {
|
|
581
1101
|
await navigator.clipboard.writeText(nextValue);
|
|
582
1102
|
return setInternalTextValue(nextValue);
|
|
583
1103
|
}, []);
|
|
@@ -590,12 +1110,12 @@ var ClipboardProvider = ({ children }) => {
|
|
|
590
1110
|
};
|
|
591
1111
|
|
|
592
1112
|
// packages/ui/react-ui/src/components/Clipboard/CopyButton.tsx
|
|
593
|
-
import React16
|
|
1113
|
+
import React16 from "react";
|
|
594
1114
|
import { mx as mx2 } from "@dxos/react-ui-theme";
|
|
595
1115
|
|
|
596
1116
|
// packages/ui/react-ui/src/components/ThemeProvider/ThemeProvider.tsx
|
|
597
1117
|
import { createKeyborg } from "keyborg";
|
|
598
|
-
import React15, { createContext as createContext7, useEffect as
|
|
1118
|
+
import React15, { createContext as createContext7, useEffect as useEffect3, useMemo as useMemo2 } from "react";
|
|
599
1119
|
|
|
600
1120
|
// packages/ui/react-ui/src/util/hasIosKeyboard.ts
|
|
601
1121
|
var hasIosKeyboard = () => {
|
|
@@ -627,7 +1147,7 @@ var ElevationProvider = ({ elevation, children }) => /* @__PURE__ */ React14.cre
|
|
|
627
1147
|
// packages/ui/react-ui/src/components/ThemeProvider/ThemeProvider.tsx
|
|
628
1148
|
var ThemeContext = /* @__PURE__ */ createContext7(void 0);
|
|
629
1149
|
var ThemeProvider = ({ children, fallback = null, resourceExtensions, appNs, tx = (_path, defaultClassName, _styleProps, ..._options) => defaultClassName, themeMode = "dark", rootDensity = "fine", ...rest }) => {
|
|
630
|
-
|
|
1150
|
+
useEffect3(() => {
|
|
631
1151
|
if (document.defaultView) {
|
|
632
1152
|
const kb = createKeyborg(document.defaultView);
|
|
633
1153
|
kb.subscribe(handleInputModalityChange);
|
|
@@ -701,36 +1221,25 @@ var CopyButton = ({ value, classNames, iconProps, ...props }) => {
|
|
|
701
1221
|
...iconProps
|
|
702
1222
|
})));
|
|
703
1223
|
};
|
|
704
|
-
var CopyButtonIconOnly = ({ value, classNames, iconProps, variant, ...props }) => {
|
|
1224
|
+
var CopyButtonIconOnly = ({ __scopeTooltip, value, classNames, iconProps, variant, ...props }) => {
|
|
705
1225
|
const { t } = useTranslation("os");
|
|
706
1226
|
const { textValue, setTextValue } = useClipboard();
|
|
707
1227
|
const isCopied = textValue === value;
|
|
708
1228
|
const label = isCopied ? t("copy success label") : props.label ?? t("copy label");
|
|
709
|
-
const
|
|
710
|
-
return /* @__PURE__ */ React16.createElement(
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
side: "bottom",
|
|
716
|
-
sideOffset: 12
|
|
717
|
-
}, /* @__PURE__ */ React16.createElement("span", null, label), /* @__PURE__ */ React16.createElement(Tooltip.Arrow, null))), /* @__PURE__ */ React16.createElement(Tooltip.Trigger, {
|
|
718
|
-
"aria-label": label,
|
|
719
|
-
...props,
|
|
720
|
-
onClick: () => setTextValue(value).then(() => setOpen(true)),
|
|
721
|
-
"data-testid": "copy-invitation",
|
|
722
|
-
asChild: true
|
|
723
|
-
}, /* @__PURE__ */ React16.createElement(Button, {
|
|
1229
|
+
const { onOpen } = useTooltipContext("CopyButton", __scopeTooltip);
|
|
1230
|
+
return /* @__PURE__ */ React16.createElement(IconButton, {
|
|
1231
|
+
iconOnly: true,
|
|
1232
|
+
label,
|
|
1233
|
+
icon: "ph--copy--regular",
|
|
1234
|
+
size: 5,
|
|
724
1235
|
variant,
|
|
725
1236
|
classNames: [
|
|
726
1237
|
"inline-flex flex-col justify-center",
|
|
727
1238
|
classNames
|
|
728
|
-
]
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
...iconProps
|
|
733
|
-
}))));
|
|
1239
|
+
],
|
|
1240
|
+
onClick: () => setTextValue(value).then(onOpen),
|
|
1241
|
+
"data-testid": "copy-invitation"
|
|
1242
|
+
});
|
|
734
1243
|
};
|
|
735
1244
|
|
|
736
1245
|
// packages/ui/react-ui/src/components/Clipboard/index.ts
|
|
@@ -772,9 +1281,7 @@ var DialogDescription = /* @__PURE__ */ forwardRef11(({ classNames, srOnly, ...p
|
|
|
772
1281
|
var DialogClose = DialogClosePrimitive;
|
|
773
1282
|
var DIALOG_OVERLAY_NAME = "DialogOverlay";
|
|
774
1283
|
var DIALOG_CONTENT_NAME = "DialogContent";
|
|
775
|
-
var [OverlayLayoutProvider, useOverlayLayoutContext] = createContext8(DIALOG_OVERLAY_NAME, {
|
|
776
|
-
inOverlayLayout: false
|
|
777
|
-
});
|
|
1284
|
+
var [OverlayLayoutProvider, useOverlayLayoutContext] = createContext8(DIALOG_OVERLAY_NAME, {});
|
|
778
1285
|
var DialogOverlay = /* @__PURE__ */ forwardRef11(({ classNames, children, blockAlign, ...props }, forwardedRef) => {
|
|
779
1286
|
const { tx } = useThemeContext();
|
|
780
1287
|
return /* @__PURE__ */ React17.createElement(DialogOverlayPrimitive, {
|
|
@@ -789,9 +1296,10 @@ var DialogOverlay = /* @__PURE__ */ forwardRef11(({ classNames, children, blockA
|
|
|
789
1296
|
DialogOverlay.displayName = DIALOG_OVERLAY_NAME;
|
|
790
1297
|
var DialogContent = /* @__PURE__ */ forwardRef11(({ classNames, children, inOverlayLayout: propsInOverlayLayout, ...props }, forwardedRef) => {
|
|
791
1298
|
const { tx } = useThemeContext();
|
|
792
|
-
const { inOverlayLayout } = useOverlayLayoutContext(DIALOG_CONTENT_NAME);
|
|
1299
|
+
const { inOverlayLayout, descriptionId } = useOverlayLayoutContext(DIALOG_CONTENT_NAME);
|
|
793
1300
|
return /* @__PURE__ */ React17.createElement(DialogContentPrimitive, {
|
|
794
|
-
|
|
1301
|
+
// NOTE: Radix warning unless set.
|
|
1302
|
+
"aria-describedby": descriptionId ?? "unknown",
|
|
795
1303
|
...props,
|
|
796
1304
|
className: tx("dialog.content", "dialog", {
|
|
797
1305
|
inOverlayLayout: propsInOverlayLayout || inOverlayLayout
|
|
@@ -883,757 +1391,312 @@ var AlertDialog = {
|
|
|
883
1391
|
Action: AlertDialogAction
|
|
884
1392
|
};
|
|
885
1393
|
|
|
886
|
-
// packages/ui/react-ui/src/components/
|
|
887
|
-
import
|
|
888
|
-
import {
|
|
889
|
-
import {
|
|
890
|
-
import
|
|
891
|
-
|
|
892
|
-
var
|
|
893
|
-
var ContextMenuPortal = ContextMenuPrimitive.Portal;
|
|
894
|
-
var ContextMenuContent = /* @__PURE__ */ forwardRef13(({ classNames, children, collisionPadding = 8, ...props }, forwardedRef) => {
|
|
1394
|
+
// packages/ui/react-ui/src/components/Input/Input.tsx
|
|
1395
|
+
import { Root as CheckboxPrimitive } from "@radix-ui/react-checkbox";
|
|
1396
|
+
import { useControllableState as useControllableState2 } from "@radix-ui/react-use-controllable-state";
|
|
1397
|
+
import React19, { forwardRef as forwardRef13, useCallback as useCallback5 } from "react";
|
|
1398
|
+
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";
|
|
1399
|
+
import { mx as mx3 } from "@dxos/react-ui-theme";
|
|
1400
|
+
var Label = /* @__PURE__ */ forwardRef13(({ srOnly, classNames, children, ...props }, forwardedRef) => {
|
|
895
1401
|
const { tx } = useThemeContext();
|
|
896
|
-
|
|
897
|
-
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
898
|
-
return /* @__PURE__ */ React19.createElement(ContextMenuPrimitive.Content, {
|
|
1402
|
+
return /* @__PURE__ */ React19.createElement(LabelPrimitive, {
|
|
899
1403
|
...props,
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
elevation
|
|
1404
|
+
className: tx("input.label", "input__label", {
|
|
1405
|
+
srOnly
|
|
903
1406
|
}, classNames),
|
|
904
1407
|
ref: forwardedRef
|
|
905
1408
|
}, children);
|
|
906
1409
|
});
|
|
907
|
-
var
|
|
1410
|
+
var Description = /* @__PURE__ */ forwardRef13(({ srOnly, classNames, children, ...props }, forwardedRef) => {
|
|
908
1411
|
const { tx } = useThemeContext();
|
|
909
|
-
|
|
910
|
-
return /* @__PURE__ */ React19.createElement(Root5, {
|
|
1412
|
+
return /* @__PURE__ */ React19.createElement(DescriptionPrimitive, {
|
|
911
1413
|
...props,
|
|
912
|
-
className: tx("
|
|
1414
|
+
className: tx("input.description", "input__description", {
|
|
1415
|
+
srOnly
|
|
1416
|
+
}, classNames),
|
|
913
1417
|
ref: forwardedRef
|
|
914
1418
|
}, children);
|
|
915
1419
|
});
|
|
916
|
-
var
|
|
1420
|
+
var Validation = /* @__PURE__ */ forwardRef13(({ __inputScope, srOnly, classNames, children, ...props }, forwardedRef) => {
|
|
917
1421
|
const { tx } = useThemeContext();
|
|
918
|
-
|
|
1422
|
+
const { validationValence } = useInputContext(INPUT_NAME, __inputScope);
|
|
1423
|
+
return /* @__PURE__ */ React19.createElement(ValidationPrimitive, {
|
|
919
1424
|
...props,
|
|
920
|
-
className: tx("
|
|
1425
|
+
className: tx("input.validation", `input__validation-message input__validation-message--${validationValence}`, {
|
|
1426
|
+
srOnly,
|
|
1427
|
+
validationValence
|
|
1428
|
+
}, classNames),
|
|
921
1429
|
ref: forwardedRef
|
|
922
|
-
});
|
|
1430
|
+
}, children);
|
|
923
1431
|
});
|
|
924
|
-
var
|
|
925
|
-
var ContextMenuItemIndicator = ContextMenuPrimitive.ItemIndicator;
|
|
926
|
-
var ContextMenuItem = /* @__PURE__ */ forwardRef13(({ classNames, ...props }, forwardedRef) => {
|
|
1432
|
+
var DescriptionAndValidation = /* @__PURE__ */ forwardRef13(({ srOnly, classNames, children, ...props }, forwardedRef) => {
|
|
927
1433
|
const { tx } = useThemeContext();
|
|
928
|
-
return /* @__PURE__ */ React19.createElement(
|
|
1434
|
+
return /* @__PURE__ */ React19.createElement(DescriptionAndValidationPrimitive, {
|
|
929
1435
|
...props,
|
|
930
|
-
className: tx("
|
|
1436
|
+
className: tx("input.descriptionAndValidation", "input__description-and-validation", {
|
|
1437
|
+
srOnly
|
|
1438
|
+
}, classNames),
|
|
931
1439
|
ref: forwardedRef
|
|
932
|
-
});
|
|
1440
|
+
}, children);
|
|
933
1441
|
});
|
|
934
|
-
var
|
|
1442
|
+
var PinInput = /* @__PURE__ */ forwardRef13(({ density: propsDensity, elevation: propsElevation, segmentClassName: propsSegmentClassName, inputClassName, variant, ...props }, forwardedRef) => {
|
|
1443
|
+
const { hasIosKeyboard: hasIosKeyboard2 } = useThemeContext();
|
|
935
1444
|
const { tx } = useThemeContext();
|
|
936
|
-
|
|
1445
|
+
const density = useDensityContext(propsDensity);
|
|
1446
|
+
const elevation = useElevationContext(propsElevation);
|
|
1447
|
+
const segmentClassName = useCallback5(({ focused, validationValence }) => tx("input.input", "input--pin-segment", {
|
|
1448
|
+
variant: "static",
|
|
1449
|
+
focused,
|
|
1450
|
+
disabled: props.disabled,
|
|
1451
|
+
density,
|
|
1452
|
+
elevation,
|
|
1453
|
+
validationValence
|
|
1454
|
+
}, propsSegmentClassName), [
|
|
1455
|
+
tx,
|
|
1456
|
+
props.disabled,
|
|
1457
|
+
elevation,
|
|
1458
|
+
propsElevation,
|
|
1459
|
+
density
|
|
1460
|
+
]);
|
|
1461
|
+
return /* @__PURE__ */ React19.createElement(PinInputPrimitive, {
|
|
937
1462
|
...props,
|
|
938
|
-
|
|
1463
|
+
segmentClassName,
|
|
1464
|
+
...props.autoFocus && !hasIosKeyboard2 && {
|
|
1465
|
+
autoFocus: true
|
|
1466
|
+
},
|
|
1467
|
+
inputClassName: tx("input.inputWithSegments", "input input--pin", {
|
|
1468
|
+
disabled: props.disabled
|
|
1469
|
+
}, inputClassName),
|
|
939
1470
|
ref: forwardedRef
|
|
940
1471
|
});
|
|
941
1472
|
});
|
|
942
|
-
var
|
|
943
|
-
const {
|
|
944
|
-
|
|
1473
|
+
var TextInput = /* @__PURE__ */ forwardRef13(({ __inputScope, classNames, density: propsDensity, elevation: propsElevation, variant, ...props }, forwardedRef) => {
|
|
1474
|
+
const { hasIosKeyboard: hasIosKeyboard2 } = useThemeContext();
|
|
1475
|
+
const themeContextValue = useThemeContext();
|
|
1476
|
+
const density = useDensityContext(propsDensity);
|
|
1477
|
+
const elevation = useElevationContext(propsElevation);
|
|
1478
|
+
const { validationValence } = useInputContext(INPUT_NAME, __inputScope);
|
|
1479
|
+
const { tx } = themeContextValue;
|
|
1480
|
+
return /* @__PURE__ */ React19.createElement(TextInputPrimitive, {
|
|
945
1481
|
...props,
|
|
946
|
-
className: tx("
|
|
1482
|
+
className: tx("input.input", "input", {
|
|
1483
|
+
variant,
|
|
1484
|
+
disabled: props.disabled,
|
|
1485
|
+
density,
|
|
1486
|
+
elevation,
|
|
1487
|
+
validationValence
|
|
1488
|
+
}, classNames),
|
|
1489
|
+
...props.autoFocus && !hasIosKeyboard2 && {
|
|
1490
|
+
autoFocus: true
|
|
1491
|
+
},
|
|
947
1492
|
ref: forwardedRef
|
|
948
1493
|
});
|
|
949
1494
|
});
|
|
950
|
-
var
|
|
1495
|
+
var TextArea = /* @__PURE__ */ forwardRef13(({ __inputScope, classNames, density: propsDensity, elevation: propsElevation, variant, ...props }, forwardedRef) => {
|
|
1496
|
+
const { hasIosKeyboard: hasIosKeyboard2 } = useThemeContext();
|
|
951
1497
|
const { tx } = useThemeContext();
|
|
952
|
-
|
|
1498
|
+
const density = useDensityContext(propsDensity);
|
|
1499
|
+
const elevation = useElevationContext(propsElevation);
|
|
1500
|
+
const { validationValence } = useInputContext(INPUT_NAME, __inputScope);
|
|
1501
|
+
return /* @__PURE__ */ React19.createElement(TextAreaPrimitive, {
|
|
953
1502
|
...props,
|
|
954
|
-
className: tx("
|
|
1503
|
+
className: tx("input.input", "input--text-area", {
|
|
1504
|
+
variant,
|
|
1505
|
+
disabled: props.disabled,
|
|
1506
|
+
density,
|
|
1507
|
+
elevation,
|
|
1508
|
+
validationValence
|
|
1509
|
+
}, classNames),
|
|
1510
|
+
...props.autoFocus && !hasIosKeyboard2 && {
|
|
1511
|
+
autoFocus: true
|
|
1512
|
+
},
|
|
955
1513
|
ref: forwardedRef
|
|
956
1514
|
});
|
|
957
1515
|
});
|
|
958
|
-
var
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
Viewport: ContextMenuViewport,
|
|
964
|
-
Arrow: ContextMenuArrow,
|
|
965
|
-
Group: ContextMenuGroup,
|
|
966
|
-
Item: ContextMenuItem,
|
|
967
|
-
CheckboxItem: ContextMenuCheckboxItem,
|
|
968
|
-
ItemIndicator: ContextMenuItemIndicator,
|
|
969
|
-
Separator: ContextMenuSeparator,
|
|
970
|
-
GroupLabel: ContextMenuGroupLabel
|
|
971
|
-
};
|
|
972
|
-
|
|
973
|
-
// packages/ui/react-ui/src/components/Menus/DropdownMenu.tsx
|
|
974
|
-
import { composeEventHandlers } from "@radix-ui/primitive";
|
|
975
|
-
import { composeRefs } from "@radix-ui/react-compose-refs";
|
|
976
|
-
import { createContextScope } from "@radix-ui/react-context";
|
|
977
|
-
import { useId as useId2 } from "@radix-ui/react-id";
|
|
978
|
-
import * as MenuPrimitive from "@radix-ui/react-menu";
|
|
979
|
-
import { createMenuScope } from "@radix-ui/react-menu";
|
|
980
|
-
import { Primitive as Primitive7 } from "@radix-ui/react-primitive";
|
|
981
|
-
import { Slot as Slot7 } from "@radix-ui/react-slot";
|
|
982
|
-
import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
|
983
|
-
import React20, { useRef, useCallback as useCallback4, forwardRef as forwardRef14, useEffect as useEffect3 } from "react";
|
|
984
|
-
var DROPDOWN_MENU_NAME = "DropdownMenu";
|
|
985
|
-
var [createDropdownMenuContext, createDropdownMenuScope] = createContextScope(DROPDOWN_MENU_NAME, [
|
|
986
|
-
createMenuScope
|
|
987
|
-
]);
|
|
988
|
-
var useMenuScope = createMenuScope();
|
|
989
|
-
var [DropdownMenuProvider, useDropdownMenuContext] = createDropdownMenuContext(DROPDOWN_MENU_NAME);
|
|
990
|
-
var DropdownMenuRoot = (props) => {
|
|
991
|
-
const { __scopeDropdownMenu, children, dir, open: openProp, defaultOpen, onOpenChange, modal = true } = props;
|
|
992
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
993
|
-
const triggerRef = useRef(null);
|
|
994
|
-
const [open = false, setOpen] = useControllableState({
|
|
995
|
-
prop: openProp,
|
|
996
|
-
defaultProp: defaultOpen,
|
|
997
|
-
onChange: onOpenChange
|
|
1516
|
+
var Checkbox = /* @__PURE__ */ forwardRef13(({ __inputScope, checked: propsChecked, defaultChecked: propsDefaultChecked, onCheckedChange: propsOnCheckedChange, size, weight = "bold", classNames, ...props }, forwardedRef) => {
|
|
1517
|
+
const [checked, onCheckedChange] = useControllableState2({
|
|
1518
|
+
prop: propsChecked,
|
|
1519
|
+
defaultProp: propsDefaultChecked,
|
|
1520
|
+
onChange: propsOnCheckedChange
|
|
998
1521
|
});
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
var DropdownMenuTrigger = /* @__PURE__ */ forwardRef14((props, forwardedRef) => {
|
|
1021
|
-
const { __scopeDropdownMenu, disabled = false, ...triggerProps } = props;
|
|
1022
|
-
const context = useDropdownMenuContext(TRIGGER_NAME, __scopeDropdownMenu);
|
|
1023
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1024
|
-
return /* @__PURE__ */ React20.createElement(MenuPrimitive.Anchor, {
|
|
1025
|
-
asChild: true,
|
|
1026
|
-
...menuScope
|
|
1027
|
-
}, /* @__PURE__ */ React20.createElement(Primitive7.button, {
|
|
1028
|
-
type: "button",
|
|
1029
|
-
id: context.triggerId,
|
|
1030
|
-
"aria-haspopup": "menu",
|
|
1031
|
-
"aria-expanded": context.open,
|
|
1032
|
-
"aria-controls": context.open ? context.contentId : void 0,
|
|
1033
|
-
"data-state": context.open ? "open" : "closed",
|
|
1034
|
-
"data-disabled": disabled ? "" : void 0,
|
|
1035
|
-
disabled,
|
|
1036
|
-
...triggerProps,
|
|
1037
|
-
ref: composeRefs(forwardedRef, context.triggerRef),
|
|
1038
|
-
onPointerDown: composeEventHandlers(props.onPointerDown, (event) => {
|
|
1039
|
-
if (!disabled && event.button === 0 && event.ctrlKey === false) {
|
|
1040
|
-
context.onOpenToggle();
|
|
1041
|
-
if (!context.open) {
|
|
1042
|
-
event.preventDefault();
|
|
1043
|
-
}
|
|
1044
|
-
}
|
|
1045
|
-
}),
|
|
1046
|
-
onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
|
|
1047
|
-
if (disabled) {
|
|
1048
|
-
return;
|
|
1049
|
-
}
|
|
1050
|
-
if ([
|
|
1051
|
-
"Enter",
|
|
1052
|
-
" "
|
|
1053
|
-
].includes(event.key)) {
|
|
1054
|
-
context.onOpenToggle();
|
|
1055
|
-
}
|
|
1056
|
-
if (event.key === "ArrowDown") {
|
|
1057
|
-
context.onOpenChange(true);
|
|
1058
|
-
}
|
|
1059
|
-
if ([
|
|
1060
|
-
"Enter",
|
|
1061
|
-
" ",
|
|
1062
|
-
"ArrowDown"
|
|
1063
|
-
].includes(event.key)) {
|
|
1064
|
-
event.preventDefault();
|
|
1065
|
-
}
|
|
1522
|
+
const { id, validationValence, descriptionId, errorMessageId } = useInputContext(INPUT_NAME, __inputScope);
|
|
1523
|
+
const { tx } = useThemeContext();
|
|
1524
|
+
return /* @__PURE__ */ React19.createElement(CheckboxPrimitive, {
|
|
1525
|
+
...props,
|
|
1526
|
+
checked,
|
|
1527
|
+
onCheckedChange,
|
|
1528
|
+
id,
|
|
1529
|
+
"aria-describedby": descriptionId,
|
|
1530
|
+
...validationValence === "error" && {
|
|
1531
|
+
"aria-invalid": "true",
|
|
1532
|
+
"aria-errormessage": errorMessageId
|
|
1533
|
+
},
|
|
1534
|
+
className: tx("input.checkbox", "input--checkbox", {
|
|
1535
|
+
size
|
|
1536
|
+
}, "shrink-0", classNames),
|
|
1537
|
+
ref: forwardedRef
|
|
1538
|
+
}, /* @__PURE__ */ React19.createElement(Icon, {
|
|
1539
|
+
icon: checked === "indeterminate" ? "ph--minus--regular" : "ph--check--regular",
|
|
1540
|
+
classNames: tx("input.checkboxIndicator", "input--checkbox__indicator", {
|
|
1541
|
+
size,
|
|
1542
|
+
checked
|
|
1066
1543
|
})
|
|
1067
1544
|
}));
|
|
1068
1545
|
});
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1075
|
-
useEffect3(() => {
|
|
1076
|
-
if (virtualRef.current) {
|
|
1077
|
-
context.triggerRef.current = virtualRef.current;
|
|
1078
|
-
}
|
|
1079
|
-
});
|
|
1080
|
-
return /* @__PURE__ */ React20.createElement(MenuPrimitive.Anchor, {
|
|
1081
|
-
...menuScope,
|
|
1082
|
-
virtualRef
|
|
1083
|
-
});
|
|
1084
|
-
};
|
|
1085
|
-
DropdownMenuVirtualTrigger.displayName = VIRTUAL_TRIGGER_NAME;
|
|
1086
|
-
var PORTAL_NAME = "DropdownMenuPortal";
|
|
1087
|
-
var DropdownMenuPortal = (props) => {
|
|
1088
|
-
const { __scopeDropdownMenu, ...portalProps } = props;
|
|
1089
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1090
|
-
return /* @__PURE__ */ React20.createElement(MenuPrimitive.Portal, {
|
|
1091
|
-
...menuScope,
|
|
1092
|
-
...portalProps
|
|
1546
|
+
var Switch = /* @__PURE__ */ forwardRef13(({ __inputScope, checked: propsChecked, defaultChecked: propsDefaultChecked, onCheckedChange: propsOnCheckedChange, classNames, ...props }, forwardedRef) => {
|
|
1547
|
+
const [checked, onCheckedChange] = useControllableState2({
|
|
1548
|
+
prop: propsChecked,
|
|
1549
|
+
defaultProp: propsDefaultChecked ?? false,
|
|
1550
|
+
onChange: propsOnCheckedChange
|
|
1093
1551
|
});
|
|
1094
|
-
};
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1552
|
+
const { id, validationValence, descriptionId, errorMessageId } = useInputContext(INPUT_NAME, __inputScope);
|
|
1553
|
+
return /* @__PURE__ */ React19.createElement("input", {
|
|
1554
|
+
type: "checkbox",
|
|
1555
|
+
className: mx3("dx-checkbox--switch dx-focus-ring", classNames),
|
|
1556
|
+
checked,
|
|
1557
|
+
onChange: (event) => {
|
|
1558
|
+
onCheckedChange(event.target.checked);
|
|
1559
|
+
},
|
|
1560
|
+
id,
|
|
1561
|
+
"aria-describedby": descriptionId,
|
|
1100
1562
|
...props,
|
|
1101
|
-
|
|
1563
|
+
...validationValence === "error" && {
|
|
1564
|
+
"aria-invalid": "true",
|
|
1565
|
+
"aria-errormessage": errorMessageId
|
|
1566
|
+
},
|
|
1102
1567
|
ref: forwardedRef
|
|
1103
|
-
}, children);
|
|
1104
|
-
});
|
|
1105
|
-
var CONTENT_NAME = "DropdownMenuContent";
|
|
1106
|
-
var DropdownMenuContent = /* @__PURE__ */ forwardRef14((props, forwardedRef) => {
|
|
1107
|
-
const { __scopeDropdownMenu, classNames, collisionPadding = 8, ...contentProps } = props;
|
|
1108
|
-
const { tx } = useThemeContext();
|
|
1109
|
-
const context = useDropdownMenuContext(CONTENT_NAME, __scopeDropdownMenu);
|
|
1110
|
-
const elevation = useElevationContext();
|
|
1111
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1112
|
-
const hasInteractedOutsideRef = useRef(false);
|
|
1113
|
-
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
1114
|
-
return /* @__PURE__ */ React20.createElement(MenuPrimitive.Content, {
|
|
1115
|
-
id: context.contentId,
|
|
1116
|
-
"aria-labelledby": context.triggerId,
|
|
1117
|
-
...menuScope,
|
|
1118
|
-
...contentProps,
|
|
1119
|
-
collisionPadding: safeCollisionPadding,
|
|
1120
|
-
ref: forwardedRef,
|
|
1121
|
-
onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
1122
|
-
if (!hasInteractedOutsideRef.current) {
|
|
1123
|
-
context.triggerRef.current?.focus();
|
|
1124
|
-
}
|
|
1125
|
-
hasInteractedOutsideRef.current = false;
|
|
1126
|
-
event.preventDefault();
|
|
1127
|
-
}),
|
|
1128
|
-
onInteractOutside: composeEventHandlers(props.onInteractOutside, (event) => {
|
|
1129
|
-
const originalEvent = event.detail.originalEvent;
|
|
1130
|
-
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
1131
|
-
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
1132
|
-
if (!context.modal || isRightClick) {
|
|
1133
|
-
hasInteractedOutsideRef.current = true;
|
|
1134
|
-
}
|
|
1135
|
-
}),
|
|
1136
|
-
className: tx("menu.content", "menu", {
|
|
1137
|
-
elevation
|
|
1138
|
-
}, classNames),
|
|
1139
|
-
style: {
|
|
1140
|
-
...props.style,
|
|
1141
|
-
// re-namespace exposed content custom properties
|
|
1142
|
-
...{
|
|
1143
|
-
"--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
1144
|
-
"--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
|
|
1145
|
-
"--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
|
|
1146
|
-
"--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
|
|
1147
|
-
"--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
|
|
1148
|
-
}
|
|
1149
|
-
}
|
|
1150
1568
|
});
|
|
1151
1569
|
});
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
DropdownMenuGroup.displayName = GROUP_NAME;
|
|
1164
|
-
var LABEL_NAME = "DropdownMenuLabel";
|
|
1165
|
-
var DropdownMenuGroupLabel = /* @__PURE__ */ forwardRef14((props, forwardedRef) => {
|
|
1166
|
-
const { __scopeDropdownMenu, classNames, ...labelProps } = props;
|
|
1167
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1168
|
-
const { tx } = useThemeContext();
|
|
1169
|
-
return /* @__PURE__ */ React20.createElement(MenuPrimitive.Label, {
|
|
1170
|
-
...menuScope,
|
|
1171
|
-
...labelProps,
|
|
1172
|
-
className: tx("menu.groupLabel", "menu__group__label", {}, classNames),
|
|
1173
|
-
ref: forwardedRef
|
|
1174
|
-
});
|
|
1175
|
-
});
|
|
1176
|
-
DropdownMenuGroupLabel.displayName = LABEL_NAME;
|
|
1177
|
-
var ITEM_NAME = "DropdownMenuItem";
|
|
1178
|
-
var DropdownMenuItem = /* @__PURE__ */ forwardRef14((props, forwardedRef) => {
|
|
1179
|
-
const { __scopeDropdownMenu, classNames, ...itemProps } = props;
|
|
1180
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1181
|
-
const { tx } = useThemeContext();
|
|
1182
|
-
return /* @__PURE__ */ React20.createElement(MenuPrimitive.Item, {
|
|
1183
|
-
...menuScope,
|
|
1184
|
-
...itemProps,
|
|
1185
|
-
className: tx("menu.item", "menu__item", {}, classNames),
|
|
1186
|
-
ref: forwardedRef
|
|
1187
|
-
});
|
|
1188
|
-
});
|
|
1189
|
-
DropdownMenuItem.displayName = ITEM_NAME;
|
|
1190
|
-
var CHECKBOX_ITEM_NAME = "DropdownMenuCheckboxItem";
|
|
1191
|
-
var DropdownMenuCheckboxItem = /* @__PURE__ */ forwardRef14((props, forwardedRef) => {
|
|
1192
|
-
const { __scopeDropdownMenu, classNames, ...checkboxItemProps } = props;
|
|
1193
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1194
|
-
const { tx } = useThemeContext();
|
|
1195
|
-
return /* @__PURE__ */ React20.createElement(MenuPrimitive.CheckboxItem, {
|
|
1196
|
-
...menuScope,
|
|
1197
|
-
...checkboxItemProps,
|
|
1198
|
-
className: tx("menu.item", "menu__item--checkbox", {}, classNames),
|
|
1199
|
-
ref: forwardedRef
|
|
1200
|
-
});
|
|
1201
|
-
});
|
|
1202
|
-
DropdownMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;
|
|
1203
|
-
var RADIO_GROUP_NAME = "DropdownMenuRadioGroup";
|
|
1204
|
-
var DropdownMenuRadioGroup = /* @__PURE__ */ forwardRef14((props, forwardedRef) => {
|
|
1205
|
-
const { __scopeDropdownMenu, ...radioGroupProps } = props;
|
|
1206
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1207
|
-
return /* @__PURE__ */ React20.createElement(MenuPrimitive.RadioGroup, {
|
|
1208
|
-
...menuScope,
|
|
1209
|
-
...radioGroupProps,
|
|
1210
|
-
ref: forwardedRef
|
|
1211
|
-
});
|
|
1212
|
-
});
|
|
1213
|
-
DropdownMenuRadioGroup.displayName = RADIO_GROUP_NAME;
|
|
1214
|
-
var RADIO_ITEM_NAME = "DropdownMenuRadioItem";
|
|
1215
|
-
var DropdownMenuRadioItem = /* @__PURE__ */ forwardRef14((props, forwardedRef) => {
|
|
1216
|
-
const { __scopeDropdownMenu, ...radioItemProps } = props;
|
|
1217
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1218
|
-
return /* @__PURE__ */ React20.createElement(MenuPrimitive.RadioItem, {
|
|
1219
|
-
...menuScope,
|
|
1220
|
-
...radioItemProps,
|
|
1221
|
-
ref: forwardedRef
|
|
1222
|
-
});
|
|
1223
|
-
});
|
|
1224
|
-
DropdownMenuRadioItem.displayName = RADIO_ITEM_NAME;
|
|
1225
|
-
var INDICATOR_NAME = "DropdownMenuItemIndicator";
|
|
1226
|
-
var DropdownMenuItemIndicator = /* @__PURE__ */ forwardRef14((props, forwardedRef) => {
|
|
1227
|
-
const { __scopeDropdownMenu, ...itemIndicatorProps } = props;
|
|
1228
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1229
|
-
return /* @__PURE__ */ React20.createElement(MenuPrimitive.ItemIndicator, {
|
|
1230
|
-
...menuScope,
|
|
1231
|
-
...itemIndicatorProps,
|
|
1232
|
-
ref: forwardedRef
|
|
1233
|
-
});
|
|
1234
|
-
});
|
|
1235
|
-
DropdownMenuItemIndicator.displayName = INDICATOR_NAME;
|
|
1236
|
-
var SEPARATOR_NAME = "DropdownMenuSeparator";
|
|
1237
|
-
var DropdownMenuSeparator = /* @__PURE__ */ forwardRef14((props, forwardedRef) => {
|
|
1238
|
-
const { __scopeDropdownMenu, classNames, ...separatorProps } = props;
|
|
1239
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1240
|
-
const { tx } = useThemeContext();
|
|
1241
|
-
return /* @__PURE__ */ React20.createElement(MenuPrimitive.Separator, {
|
|
1242
|
-
...menuScope,
|
|
1243
|
-
...separatorProps,
|
|
1244
|
-
className: tx("menu.separator", "menu__item", {}, classNames),
|
|
1245
|
-
ref: forwardedRef
|
|
1246
|
-
});
|
|
1247
|
-
});
|
|
1248
|
-
DropdownMenuSeparator.displayName = SEPARATOR_NAME;
|
|
1249
|
-
var ARROW_NAME = "DropdownMenuArrow";
|
|
1250
|
-
var DropdownMenuArrow = /* @__PURE__ */ forwardRef14((props, forwardedRef) => {
|
|
1251
|
-
const { __scopeDropdownMenu, classNames, ...arrowProps } = props;
|
|
1252
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1253
|
-
const { tx } = useThemeContext();
|
|
1254
|
-
return /* @__PURE__ */ React20.createElement(MenuPrimitive.Arrow, {
|
|
1255
|
-
...menuScope,
|
|
1256
|
-
...arrowProps,
|
|
1257
|
-
className: tx("menu.arrow", "menu__arrow", {}, classNames),
|
|
1258
|
-
ref: forwardedRef
|
|
1259
|
-
});
|
|
1260
|
-
});
|
|
1261
|
-
DropdownMenuArrow.displayName = ARROW_NAME;
|
|
1262
|
-
var DropdownMenuSub = (props) => {
|
|
1263
|
-
const { __scopeDropdownMenu, children, open: openProp, onOpenChange, defaultOpen } = props;
|
|
1264
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1265
|
-
const [open = false, setOpen] = useControllableState({
|
|
1266
|
-
prop: openProp,
|
|
1267
|
-
defaultProp: defaultOpen,
|
|
1268
|
-
onChange: onOpenChange
|
|
1269
|
-
});
|
|
1270
|
-
return /* @__PURE__ */ React20.createElement(MenuPrimitive.Sub, {
|
|
1271
|
-
...menuScope,
|
|
1272
|
-
open,
|
|
1273
|
-
onOpenChange: setOpen
|
|
1274
|
-
}, children);
|
|
1570
|
+
var Input = {
|
|
1571
|
+
Root: InputRoot,
|
|
1572
|
+
PinInput,
|
|
1573
|
+
TextInput,
|
|
1574
|
+
TextArea,
|
|
1575
|
+
Checkbox,
|
|
1576
|
+
Switch,
|
|
1577
|
+
Label,
|
|
1578
|
+
Description,
|
|
1579
|
+
Validation,
|
|
1580
|
+
DescriptionAndValidation
|
|
1275
1581
|
};
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1582
|
+
|
|
1583
|
+
// packages/ui/react-ui/src/components/Lists/List.tsx
|
|
1584
|
+
import { CaretDown, CaretRight } from "@phosphor-icons/react";
|
|
1585
|
+
import { Slot as Slot6 } from "@radix-ui/react-slot";
|
|
1586
|
+
import React21, { forwardRef as forwardRef14 } from "react";
|
|
1587
|
+
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";
|
|
1588
|
+
|
|
1589
|
+
// packages/ui/react-ui/src/components/Lists/ListDropIndicator.tsx
|
|
1590
|
+
import React20 from "react";
|
|
1591
|
+
var edgeToOrientationMap = {
|
|
1592
|
+
top: "horizontal",
|
|
1593
|
+
bottom: "horizontal",
|
|
1594
|
+
left: "vertical",
|
|
1595
|
+
right: "vertical"
|
|
1596
|
+
};
|
|
1597
|
+
var orientationStyles = {
|
|
1598
|
+
horizontal: "h-[--line-thickness] left-[calc(var(--line-inset)+var(--terminal-radius))] right-[--line-inset] before:left-[--terminal-inset]",
|
|
1599
|
+
vertical: "w-[--line-thickness] top-[calc(var(--line-inset)+var(--terminal-radius))] bottom-[--line-inset] before:top-[--terminal-inset]"
|
|
1600
|
+
};
|
|
1601
|
+
var edgeStyles = {
|
|
1602
|
+
top: "top-[--line-offset] before:top-[--offset-terminal]",
|
|
1603
|
+
right: "right-[--line-offset] before:right-[--offset-terminal]",
|
|
1604
|
+
bottom: "bottom-[--line-offset] before:bottom-[--offset-terminal]",
|
|
1605
|
+
left: "left-[--line-offset] before:left-[--offset-terminal]"
|
|
1606
|
+
};
|
|
1607
|
+
var strokeSize = 2;
|
|
1608
|
+
var terminalSize = 8;
|
|
1609
|
+
var offsetToAlignTerminalWithLine = (strokeSize - terminalSize) / 2;
|
|
1610
|
+
var ListDropIndicator = ({ edge, gap = 0, lineInset = 0, terminalInset = lineInset - terminalSize }) => {
|
|
1611
|
+
const orientation = edgeToOrientationMap[edge];
|
|
1612
|
+
return /* @__PURE__ */ React20.createElement("div", {
|
|
1613
|
+
role: "none",
|
|
1295
1614
|
style: {
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
}
|
|
1615
|
+
"--line-thickness": `${strokeSize}px`,
|
|
1616
|
+
"--line-offset": `calc(-0.5 * (${gap}px + ${strokeSize}px))`,
|
|
1617
|
+
"--line-inset": `${lineInset}px`,
|
|
1618
|
+
"--terminal-size": `${terminalSize}px`,
|
|
1619
|
+
"--terminal-radius": `${terminalSize / 2}px`,
|
|
1620
|
+
"--terminal-inset": `${terminalInset}px`,
|
|
1621
|
+
"--offset-terminal": `${offsetToAlignTerminalWithLine}px`
|
|
1622
|
+
},
|
|
1623
|
+
className: `absolute z-10 pointer-events-none bg-accentSurface before:content-[''] before:w-[--terminal-size] before:h-[--terminal-size] box-border before:absolute before:border-[length:--line-thickness] before:border-solid before:border-accentSurface before:rounded-full ${orientationStyles[orientation]} ${edgeStyles[edge]}`
|
|
1306
1624
|
});
|
|
1307
|
-
});
|
|
1308
|
-
DropdownMenuSubContent.displayName = SUB_CONTENT_NAME;
|
|
1309
|
-
var DropdownMenu = {
|
|
1310
|
-
Root: DropdownMenuRoot,
|
|
1311
|
-
Trigger: DropdownMenuTrigger,
|
|
1312
|
-
VirtualTrigger: DropdownMenuVirtualTrigger,
|
|
1313
|
-
Portal: DropdownMenuPortal,
|
|
1314
|
-
Content: DropdownMenuContent,
|
|
1315
|
-
Viewport: DropdownMenuViewport,
|
|
1316
|
-
Group: DropdownMenuGroup,
|
|
1317
|
-
GroupLabel: DropdownMenuGroupLabel,
|
|
1318
|
-
Item: DropdownMenuItem,
|
|
1319
|
-
CheckboxItem: DropdownMenuCheckboxItem,
|
|
1320
|
-
RadioGroup: DropdownMenuRadioGroup,
|
|
1321
|
-
RadioItem: DropdownMenuRadioItem,
|
|
1322
|
-
ItemIndicator: DropdownMenuItemIndicator,
|
|
1323
|
-
Separator: DropdownMenuSeparator,
|
|
1324
|
-
Arrow: DropdownMenuArrow,
|
|
1325
|
-
Sub: DropdownMenuSub,
|
|
1326
|
-
SubTrigger: DropdownMenuSubTrigger,
|
|
1327
|
-
SubContent: DropdownMenuSubContent
|
|
1328
1625
|
};
|
|
1329
|
-
var useDropdownMenuMenuScope = useMenuScope;
|
|
1330
1626
|
|
|
1331
|
-
// packages/ui/react-ui/src/components/
|
|
1332
|
-
|
|
1333
|
-
import { useControllableState as useControllableState2 } from "@radix-ui/react-use-controllable-state";
|
|
1334
|
-
import React21, { forwardRef as forwardRef15, useCallback as useCallback5 } from "react";
|
|
1335
|
-
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";
|
|
1336
|
-
import { mx as mx3 } from "@dxos/react-ui-theme";
|
|
1337
|
-
var Label3 = /* @__PURE__ */ forwardRef15(({ srOnly, classNames, children, ...props }, forwardedRef) => {
|
|
1627
|
+
// packages/ui/react-ui/src/components/Lists/List.tsx
|
|
1628
|
+
var List = /* @__PURE__ */ forwardRef14(({ classNames, children, ...props }, forwardedRef) => {
|
|
1338
1629
|
const { tx } = useThemeContext();
|
|
1339
|
-
|
|
1630
|
+
const density = useDensityContext(props.density);
|
|
1631
|
+
return /* @__PURE__ */ React21.createElement(DensityProvider, {
|
|
1632
|
+
density
|
|
1633
|
+
}, /* @__PURE__ */ React21.createElement(ListPrimitive, {
|
|
1340
1634
|
...props,
|
|
1341
|
-
className: tx("
|
|
1342
|
-
|
|
1635
|
+
className: tx("list.root", "list", {}, classNames),
|
|
1636
|
+
ref: forwardedRef
|
|
1637
|
+
}, children));
|
|
1638
|
+
});
|
|
1639
|
+
var ListItemEndcap = /* @__PURE__ */ forwardRef14(({ children, classNames, asChild, ...props }, forwardedRef) => {
|
|
1640
|
+
const Root7 = asChild ? Slot6 : "div";
|
|
1641
|
+
const density = useDensityContext();
|
|
1642
|
+
const { tx } = useThemeContext();
|
|
1643
|
+
return /* @__PURE__ */ React21.createElement(Root7, {
|
|
1644
|
+
...!asChild && {
|
|
1645
|
+
role: "none"
|
|
1646
|
+
},
|
|
1647
|
+
...props,
|
|
1648
|
+
className: tx("list.item.endcap", "list__listItem__endcap", {
|
|
1649
|
+
density
|
|
1343
1650
|
}, classNames),
|
|
1344
1651
|
ref: forwardedRef
|
|
1345
1652
|
}, children);
|
|
1346
1653
|
});
|
|
1347
|
-
var
|
|
1654
|
+
var MockListItemOpenTrigger = ({ classNames, ...props }) => {
|
|
1655
|
+
const density = useDensityContext();
|
|
1348
1656
|
const { tx } = useThemeContext();
|
|
1349
|
-
return /* @__PURE__ */ React21.createElement(
|
|
1657
|
+
return /* @__PURE__ */ React21.createElement("div", {
|
|
1658
|
+
role: "none",
|
|
1350
1659
|
...props,
|
|
1351
|
-
className: tx("
|
|
1352
|
-
|
|
1660
|
+
className: tx("list.item.openTrigger", "list__listItem__openTrigger--mock", {
|
|
1661
|
+
density
|
|
1662
|
+
}, classNames)
|
|
1663
|
+
});
|
|
1664
|
+
};
|
|
1665
|
+
var ListItemHeading = /* @__PURE__ */ forwardRef14(({ children, classNames, ...props }, forwardedRef) => {
|
|
1666
|
+
const { tx } = useThemeContext();
|
|
1667
|
+
const density = useDensityContext();
|
|
1668
|
+
return /* @__PURE__ */ React21.createElement(ListPrimitiveItemHeading, {
|
|
1669
|
+
...props,
|
|
1670
|
+
className: tx("list.item.heading", "list__listItem__heading", {
|
|
1671
|
+
density
|
|
1353
1672
|
}, classNames),
|
|
1354
1673
|
ref: forwardedRef
|
|
1355
1674
|
}, children);
|
|
1356
1675
|
});
|
|
1357
|
-
var
|
|
1676
|
+
var ListItemOpenTrigger = /* @__PURE__ */ forwardRef14(({ __listItemScope, classNames, children, ...props }, forwardedRef) => {
|
|
1358
1677
|
const { tx } = useThemeContext();
|
|
1359
|
-
const
|
|
1360
|
-
|
|
1678
|
+
const density = useDensityContext();
|
|
1679
|
+
const { open } = useListItemContext(LIST_ITEM_NAME, __listItemScope);
|
|
1680
|
+
const Icon3 = open ? CaretDown : CaretRight;
|
|
1681
|
+
return /* @__PURE__ */ React21.createElement(ListPrimitiveItemOpenTrigger, {
|
|
1361
1682
|
...props,
|
|
1362
|
-
className: tx("
|
|
1363
|
-
|
|
1364
|
-
validationValence
|
|
1683
|
+
className: tx("list.item.openTrigger", "list__listItem__openTrigger", {
|
|
1684
|
+
density
|
|
1365
1685
|
}, classNames),
|
|
1366
1686
|
ref: forwardedRef
|
|
1367
|
-
}, children
|
|
1687
|
+
}, children || /* @__PURE__ */ React21.createElement(Icon3, {
|
|
1688
|
+
weight: "bold",
|
|
1689
|
+
className: tx("list.item.openTriggerIcon", "list__listItem__openTrigger__icon", {})
|
|
1690
|
+
}));
|
|
1368
1691
|
});
|
|
1369
|
-
var
|
|
1692
|
+
var ListItemRoot = /* @__PURE__ */ forwardRef14(({ classNames, children, ...props }, forwardedRef) => {
|
|
1370
1693
|
const { tx } = useThemeContext();
|
|
1371
|
-
|
|
1694
|
+
const density = useDensityContext();
|
|
1695
|
+
return /* @__PURE__ */ React21.createElement(ListPrimitiveItem, {
|
|
1372
1696
|
...props,
|
|
1373
|
-
className: tx("
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
ref: forwardedRef
|
|
1377
|
-
}, children);
|
|
1378
|
-
});
|
|
1379
|
-
var PinInput = /* @__PURE__ */ forwardRef15(({ density: propsDensity, elevation: propsElevation, segmentClassName: propsSegmentClassName, inputClassName, variant, ...props }, forwardedRef) => {
|
|
1380
|
-
const { hasIosKeyboard: hasIosKeyboard2 } = useThemeContext();
|
|
1381
|
-
const { tx } = useThemeContext();
|
|
1382
|
-
const density = useDensityContext(propsDensity);
|
|
1383
|
-
const elevation = useElevationContext(propsElevation);
|
|
1384
|
-
const segmentClassName = useCallback5(({ focused, validationValence }) => tx("input.input", "input--pin-segment", {
|
|
1385
|
-
variant: "static",
|
|
1386
|
-
focused,
|
|
1387
|
-
disabled: props.disabled,
|
|
1388
|
-
density,
|
|
1389
|
-
elevation,
|
|
1390
|
-
validationValence
|
|
1391
|
-
}, propsSegmentClassName), [
|
|
1392
|
-
tx,
|
|
1393
|
-
props.disabled,
|
|
1394
|
-
elevation,
|
|
1395
|
-
propsElevation,
|
|
1396
|
-
density
|
|
1397
|
-
]);
|
|
1398
|
-
return /* @__PURE__ */ React21.createElement(PinInputPrimitive, {
|
|
1399
|
-
...props,
|
|
1400
|
-
segmentClassName,
|
|
1401
|
-
...props.autoFocus && !hasIosKeyboard2 && {
|
|
1402
|
-
autoFocus: true
|
|
1403
|
-
},
|
|
1404
|
-
inputClassName: tx("input.inputWithSegments", "input input--pin", {
|
|
1405
|
-
disabled: props.disabled
|
|
1406
|
-
}, inputClassName),
|
|
1407
|
-
ref: forwardedRef
|
|
1408
|
-
});
|
|
1409
|
-
});
|
|
1410
|
-
var TextInput = /* @__PURE__ */ forwardRef15(({ __inputScope, classNames, density: propsDensity, elevation: propsElevation, variant, ...props }, forwardedRef) => {
|
|
1411
|
-
const { hasIosKeyboard: hasIosKeyboard2 } = useThemeContext();
|
|
1412
|
-
const themeContextValue = useThemeContext();
|
|
1413
|
-
const density = useDensityContext(propsDensity);
|
|
1414
|
-
const elevation = useElevationContext(propsElevation);
|
|
1415
|
-
const { validationValence } = useInputContext(INPUT_NAME, __inputScope);
|
|
1416
|
-
const { tx } = themeContextValue;
|
|
1417
|
-
return /* @__PURE__ */ React21.createElement(TextInputPrimitive, {
|
|
1418
|
-
...props,
|
|
1419
|
-
className: tx("input.input", "input", {
|
|
1420
|
-
variant,
|
|
1421
|
-
disabled: props.disabled,
|
|
1422
|
-
density,
|
|
1423
|
-
elevation,
|
|
1424
|
-
validationValence
|
|
1425
|
-
}, classNames),
|
|
1426
|
-
...props.autoFocus && !hasIosKeyboard2 && {
|
|
1427
|
-
autoFocus: true
|
|
1428
|
-
},
|
|
1429
|
-
ref: forwardedRef
|
|
1430
|
-
});
|
|
1431
|
-
});
|
|
1432
|
-
var TextArea = /* @__PURE__ */ forwardRef15(({ __inputScope, classNames, density: propsDensity, elevation: propsElevation, variant, ...props }, forwardedRef) => {
|
|
1433
|
-
const { hasIosKeyboard: hasIosKeyboard2 } = useThemeContext();
|
|
1434
|
-
const { tx } = useThemeContext();
|
|
1435
|
-
const density = useDensityContext(propsDensity);
|
|
1436
|
-
const elevation = useElevationContext(propsElevation);
|
|
1437
|
-
const { validationValence } = useInputContext(INPUT_NAME, __inputScope);
|
|
1438
|
-
return /* @__PURE__ */ React21.createElement(TextAreaPrimitive, {
|
|
1439
|
-
...props,
|
|
1440
|
-
className: tx("input.input", "input--text-area", {
|
|
1441
|
-
variant,
|
|
1442
|
-
disabled: props.disabled,
|
|
1443
|
-
density,
|
|
1444
|
-
elevation,
|
|
1445
|
-
validationValence
|
|
1446
|
-
}, classNames),
|
|
1447
|
-
...props.autoFocus && !hasIosKeyboard2 && {
|
|
1448
|
-
autoFocus: true
|
|
1449
|
-
},
|
|
1450
|
-
ref: forwardedRef
|
|
1451
|
-
});
|
|
1452
|
-
});
|
|
1453
|
-
var Checkbox = /* @__PURE__ */ forwardRef15(({ __inputScope, checked: propsChecked, defaultChecked: propsDefaultChecked, onCheckedChange: propsOnCheckedChange, size, weight = "bold", classNames, ...props }, forwardedRef) => {
|
|
1454
|
-
const [checked, onCheckedChange] = useControllableState2({
|
|
1455
|
-
prop: propsChecked,
|
|
1456
|
-
defaultProp: propsDefaultChecked,
|
|
1457
|
-
onChange: propsOnCheckedChange
|
|
1458
|
-
});
|
|
1459
|
-
const { id, validationValence, descriptionId, errorMessageId } = useInputContext(INPUT_NAME, __inputScope);
|
|
1460
|
-
const { tx } = useThemeContext();
|
|
1461
|
-
return /* @__PURE__ */ React21.createElement(CheckboxPrimitive, {
|
|
1462
|
-
...props,
|
|
1463
|
-
checked,
|
|
1464
|
-
onCheckedChange,
|
|
1465
|
-
id,
|
|
1466
|
-
"aria-describedby": descriptionId,
|
|
1467
|
-
...validationValence === "error" && {
|
|
1468
|
-
"aria-invalid": "true",
|
|
1469
|
-
"aria-errormessage": errorMessageId
|
|
1470
|
-
},
|
|
1471
|
-
className: tx("input.checkbox", "input--checkbox", {
|
|
1472
|
-
size
|
|
1473
|
-
}, "shrink-0", classNames),
|
|
1474
|
-
ref: forwardedRef
|
|
1475
|
-
}, /* @__PURE__ */ React21.createElement(Icon, {
|
|
1476
|
-
icon: checked === "indeterminate" ? "ph--minus--regular" : "ph--check--regular",
|
|
1477
|
-
classNames: tx("input.checkboxIndicator", "input--checkbox__indicator", {
|
|
1478
|
-
size,
|
|
1479
|
-
checked
|
|
1480
|
-
})
|
|
1481
|
-
}));
|
|
1482
|
-
});
|
|
1483
|
-
var Switch = /* @__PURE__ */ forwardRef15(({ __inputScope, checked: propsChecked, defaultChecked: propsDefaultChecked, onCheckedChange: propsOnCheckedChange, classNames, ...props }, forwardedRef) => {
|
|
1484
|
-
const [checked, onCheckedChange] = useControllableState2({
|
|
1485
|
-
prop: propsChecked,
|
|
1486
|
-
defaultProp: propsDefaultChecked ?? false,
|
|
1487
|
-
onChange: propsOnCheckedChange
|
|
1488
|
-
});
|
|
1489
|
-
const { id, validationValence, descriptionId, errorMessageId } = useInputContext(INPUT_NAME, __inputScope);
|
|
1490
|
-
return /* @__PURE__ */ React21.createElement("input", {
|
|
1491
|
-
type: "checkbox",
|
|
1492
|
-
className: mx3("dx-checkbox--switch dx-focus-ring", classNames),
|
|
1493
|
-
checked,
|
|
1494
|
-
onChange: (event) => {
|
|
1495
|
-
onCheckedChange(event.target.checked);
|
|
1496
|
-
},
|
|
1497
|
-
id,
|
|
1498
|
-
"aria-describedby": descriptionId,
|
|
1499
|
-
...props,
|
|
1500
|
-
...validationValence === "error" && {
|
|
1501
|
-
"aria-invalid": "true",
|
|
1502
|
-
"aria-errormessage": errorMessageId
|
|
1503
|
-
},
|
|
1504
|
-
ref: forwardedRef
|
|
1505
|
-
});
|
|
1506
|
-
});
|
|
1507
|
-
var Input = {
|
|
1508
|
-
Root: InputRoot,
|
|
1509
|
-
PinInput,
|
|
1510
|
-
TextInput,
|
|
1511
|
-
TextArea,
|
|
1512
|
-
Checkbox,
|
|
1513
|
-
Switch,
|
|
1514
|
-
Label: Label3,
|
|
1515
|
-
Description,
|
|
1516
|
-
Validation,
|
|
1517
|
-
DescriptionAndValidation
|
|
1518
|
-
};
|
|
1519
|
-
|
|
1520
|
-
// packages/ui/react-ui/src/components/Lists/List.tsx
|
|
1521
|
-
import { CaretDown, CaretRight } from "@phosphor-icons/react";
|
|
1522
|
-
import { Slot as Slot8 } from "@radix-ui/react-slot";
|
|
1523
|
-
import React23, { forwardRef as forwardRef16 } from "react";
|
|
1524
|
-
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";
|
|
1525
|
-
|
|
1526
|
-
// packages/ui/react-ui/src/components/Lists/ListDropIndicator.tsx
|
|
1527
|
-
import React22 from "react";
|
|
1528
|
-
var edgeToOrientationMap = {
|
|
1529
|
-
top: "horizontal",
|
|
1530
|
-
bottom: "horizontal",
|
|
1531
|
-
left: "vertical",
|
|
1532
|
-
right: "vertical"
|
|
1533
|
-
};
|
|
1534
|
-
var orientationStyles = {
|
|
1535
|
-
horizontal: "h-[--line-thickness] left-[calc(var(--line-inset)+var(--terminal-radius))] right-[--line-inset] before:left-[--terminal-inset]",
|
|
1536
|
-
vertical: "w-[--line-thickness] top-[calc(var(--line-inset)+var(--terminal-radius))] bottom-[--line-inset] before:top-[--terminal-inset]"
|
|
1537
|
-
};
|
|
1538
|
-
var edgeStyles = {
|
|
1539
|
-
top: "top-[--line-offset] before:top-[--offset-terminal]",
|
|
1540
|
-
right: "right-[--line-offset] before:right-[--offset-terminal]",
|
|
1541
|
-
bottom: "bottom-[--line-offset] before:bottom-[--offset-terminal]",
|
|
1542
|
-
left: "left-[--line-offset] before:left-[--offset-terminal]"
|
|
1543
|
-
};
|
|
1544
|
-
var strokeSize = 2;
|
|
1545
|
-
var terminalSize = 8;
|
|
1546
|
-
var offsetToAlignTerminalWithLine = (strokeSize - terminalSize) / 2;
|
|
1547
|
-
var ListDropIndicator = ({ edge, gap = 0, lineInset = 0, terminalInset = lineInset - terminalSize }) => {
|
|
1548
|
-
const orientation = edgeToOrientationMap[edge];
|
|
1549
|
-
return /* @__PURE__ */ React22.createElement("div", {
|
|
1550
|
-
role: "none",
|
|
1551
|
-
style: {
|
|
1552
|
-
"--line-thickness": `${strokeSize}px`,
|
|
1553
|
-
"--line-offset": `calc(-0.5 * (${gap}px + ${strokeSize}px))`,
|
|
1554
|
-
"--line-inset": `${lineInset}px`,
|
|
1555
|
-
"--terminal-size": `${terminalSize}px`,
|
|
1556
|
-
"--terminal-radius": `${terminalSize / 2}px`,
|
|
1557
|
-
"--terminal-inset": `${terminalInset}px`,
|
|
1558
|
-
"--offset-terminal": `${offsetToAlignTerminalWithLine}px`
|
|
1559
|
-
},
|
|
1560
|
-
className: `absolute z-10 pointer-events-none bg-accentSurface before:content-[''] before:w-[--terminal-size] before:h-[--terminal-size] box-border before:absolute before:border-[length:--line-thickness] before:border-solid before:border-accentSurface before:rounded-full ${orientationStyles[orientation]} ${edgeStyles[edge]}`
|
|
1561
|
-
});
|
|
1562
|
-
};
|
|
1563
|
-
|
|
1564
|
-
// packages/ui/react-ui/src/components/Lists/List.tsx
|
|
1565
|
-
var List = /* @__PURE__ */ forwardRef16(({ classNames, children, ...props }, forwardedRef) => {
|
|
1566
|
-
const { tx } = useThemeContext();
|
|
1567
|
-
const density = useDensityContext(props.density);
|
|
1568
|
-
return /* @__PURE__ */ React23.createElement(DensityProvider, {
|
|
1569
|
-
density
|
|
1570
|
-
}, /* @__PURE__ */ React23.createElement(ListPrimitive, {
|
|
1571
|
-
...props,
|
|
1572
|
-
className: tx("list.root", "list", {}, classNames),
|
|
1573
|
-
ref: forwardedRef
|
|
1574
|
-
}, children));
|
|
1575
|
-
});
|
|
1576
|
-
var ListItemEndcap = /* @__PURE__ */ forwardRef16(({ children, classNames, asChild, ...props }, forwardedRef) => {
|
|
1577
|
-
const Root5 = asChild ? Slot8 : "div";
|
|
1578
|
-
const density = useDensityContext();
|
|
1579
|
-
const { tx } = useThemeContext();
|
|
1580
|
-
return /* @__PURE__ */ React23.createElement(Root5, {
|
|
1581
|
-
...!asChild && {
|
|
1582
|
-
role: "none"
|
|
1583
|
-
},
|
|
1584
|
-
...props,
|
|
1585
|
-
className: tx("list.item.endcap", "list__listItem__endcap", {
|
|
1586
|
-
density
|
|
1587
|
-
}, classNames),
|
|
1588
|
-
ref: forwardedRef
|
|
1589
|
-
}, children);
|
|
1590
|
-
});
|
|
1591
|
-
var MockListItemOpenTrigger = ({ classNames, ...props }) => {
|
|
1592
|
-
const density = useDensityContext();
|
|
1593
|
-
const { tx } = useThemeContext();
|
|
1594
|
-
return /* @__PURE__ */ React23.createElement("div", {
|
|
1595
|
-
role: "none",
|
|
1596
|
-
...props,
|
|
1597
|
-
className: tx("list.item.openTrigger", "list__listItem__openTrigger--mock", {
|
|
1598
|
-
density
|
|
1599
|
-
}, classNames)
|
|
1600
|
-
});
|
|
1601
|
-
};
|
|
1602
|
-
var ListItemHeading = /* @__PURE__ */ forwardRef16(({ children, classNames, ...props }, forwardedRef) => {
|
|
1603
|
-
const { tx } = useThemeContext();
|
|
1604
|
-
const density = useDensityContext();
|
|
1605
|
-
return /* @__PURE__ */ React23.createElement(ListPrimitiveItemHeading, {
|
|
1606
|
-
...props,
|
|
1607
|
-
className: tx("list.item.heading", "list__listItem__heading", {
|
|
1608
|
-
density
|
|
1609
|
-
}, classNames),
|
|
1610
|
-
ref: forwardedRef
|
|
1611
|
-
}, children);
|
|
1612
|
-
});
|
|
1613
|
-
var ListItemOpenTrigger = /* @__PURE__ */ forwardRef16(({ __listItemScope, classNames, children, ...props }, forwardedRef) => {
|
|
1614
|
-
const { tx } = useThemeContext();
|
|
1615
|
-
const density = useDensityContext();
|
|
1616
|
-
const { open } = useListItemContext(LIST_ITEM_NAME, __listItemScope);
|
|
1617
|
-
const Icon3 = open ? CaretDown : CaretRight;
|
|
1618
|
-
return /* @__PURE__ */ React23.createElement(ListPrimitiveItemOpenTrigger, {
|
|
1619
|
-
...props,
|
|
1620
|
-
className: tx("list.item.openTrigger", "list__listItem__openTrigger", {
|
|
1621
|
-
density
|
|
1622
|
-
}, classNames),
|
|
1623
|
-
ref: forwardedRef
|
|
1624
|
-
}, children || /* @__PURE__ */ React23.createElement(Icon3, {
|
|
1625
|
-
weight: "bold",
|
|
1626
|
-
className: tx("list.item.openTriggerIcon", "list__listItem__openTrigger__icon", {})
|
|
1627
|
-
}));
|
|
1628
|
-
});
|
|
1629
|
-
var ListItemRoot = /* @__PURE__ */ forwardRef16(({ classNames, children, ...props }, forwardedRef) => {
|
|
1630
|
-
const { tx } = useThemeContext();
|
|
1631
|
-
const density = useDensityContext();
|
|
1632
|
-
return /* @__PURE__ */ React23.createElement(ListPrimitiveItem, {
|
|
1633
|
-
...props,
|
|
1634
|
-
className: tx("list.item.root", "list__listItem", {
|
|
1635
|
-
density,
|
|
1636
|
-
collapsible: props.collapsible
|
|
1697
|
+
className: tx("list.item.root", "list__listItem", {
|
|
1698
|
+
density,
|
|
1699
|
+
collapsible: props.collapsible
|
|
1637
1700
|
}, classNames),
|
|
1638
1701
|
ref: forwardedRef
|
|
1639
1702
|
}, children);
|
|
@@ -1649,10 +1712,10 @@ var ListItem = {
|
|
|
1649
1712
|
};
|
|
1650
1713
|
|
|
1651
1714
|
// packages/ui/react-ui/src/components/Lists/Tree.tsx
|
|
1652
|
-
import
|
|
1715
|
+
import React23, { forwardRef as forwardRef15 } from "react";
|
|
1653
1716
|
|
|
1654
1717
|
// packages/ui/react-ui/src/components/Lists/TreeDropIndicator.tsx
|
|
1655
|
-
import
|
|
1718
|
+
import React22 from "react";
|
|
1656
1719
|
var edgeToOrientationMap2 = {
|
|
1657
1720
|
"reorder-above": "sibling",
|
|
1658
1721
|
"reorder-below": "sibling",
|
|
@@ -1682,7 +1745,7 @@ var TreeDropIndicator = ({ instruction, gap = 0 }) => {
|
|
|
1682
1745
|
if (isBlocked) {
|
|
1683
1746
|
return null;
|
|
1684
1747
|
}
|
|
1685
|
-
return /* @__PURE__ */
|
|
1748
|
+
return /* @__PURE__ */ React22.createElement("div", {
|
|
1686
1749
|
style: {
|
|
1687
1750
|
"--line-thickness": `${strokeSize2}px`,
|
|
1688
1751
|
"--line-offset": `${lineOffset}`,
|
|
@@ -1697,22 +1760,22 @@ var TreeDropIndicator = ({ instruction, gap = 0 }) => {
|
|
|
1697
1760
|
};
|
|
1698
1761
|
|
|
1699
1762
|
// packages/ui/react-ui/src/components/Lists/Tree.tsx
|
|
1700
|
-
var TreeRoot = /* @__PURE__ */
|
|
1701
|
-
return /* @__PURE__ */
|
|
1763
|
+
var TreeRoot = /* @__PURE__ */ forwardRef15((props, forwardedRef) => {
|
|
1764
|
+
return /* @__PURE__ */ React23.createElement(List, {
|
|
1702
1765
|
...props,
|
|
1703
1766
|
ref: forwardedRef
|
|
1704
1767
|
});
|
|
1705
1768
|
});
|
|
1706
|
-
var TreeBranch = /* @__PURE__ */
|
|
1769
|
+
var TreeBranch = /* @__PURE__ */ forwardRef15(({ __listScope, ...props }, forwardedRef) => {
|
|
1707
1770
|
const { headingId } = useListItemContext(LIST_ITEM_NAME, __listScope);
|
|
1708
|
-
return /* @__PURE__ */
|
|
1771
|
+
return /* @__PURE__ */ React23.createElement(List, {
|
|
1709
1772
|
...props,
|
|
1710
1773
|
"aria-labelledby": headingId,
|
|
1711
1774
|
ref: forwardedRef
|
|
1712
1775
|
});
|
|
1713
1776
|
});
|
|
1714
|
-
var TreeItemRoot = /* @__PURE__ */
|
|
1715
|
-
return /* @__PURE__ */
|
|
1777
|
+
var TreeItemRoot = /* @__PURE__ */ forwardRef15((props, forwardedRef) => {
|
|
1778
|
+
return /* @__PURE__ */ React23.createElement(ListItem.Root, {
|
|
1716
1779
|
role: "treeitem",
|
|
1717
1780
|
...props,
|
|
1718
1781
|
ref: forwardedRef
|
|
@@ -1738,24 +1801,24 @@ var TreeItem = {
|
|
|
1738
1801
|
// packages/ui/react-ui/src/components/Lists/Treegrid.tsx
|
|
1739
1802
|
import { useArrowNavigationGroup, useFocusableGroup } from "@fluentui/react-tabster";
|
|
1740
1803
|
import { createContextScope as createContextScope2 } from "@radix-ui/react-context";
|
|
1741
|
-
import { Primitive as
|
|
1742
|
-
import { Slot as
|
|
1804
|
+
import { Primitive as Primitive7 } from "@radix-ui/react-primitive";
|
|
1805
|
+
import { Slot as Slot7 } from "@radix-ui/react-slot";
|
|
1743
1806
|
import { useControllableState as useControllableState3 } from "@radix-ui/react-use-controllable-state";
|
|
1744
|
-
import
|
|
1807
|
+
import React24, { forwardRef as forwardRef16 } from "react";
|
|
1745
1808
|
var TREEGRID_ROW_NAME = "TreegridRow";
|
|
1746
1809
|
var [createTreegridRowContext, createTreegridRowScope] = createContextScope2(TREEGRID_ROW_NAME, []);
|
|
1747
1810
|
var [TreegridRowProvider, useTreegridRowContext] = createTreegridRowContext(TREEGRID_ROW_NAME);
|
|
1748
1811
|
var PATH_SEPARATOR = "~";
|
|
1749
1812
|
var PARENT_OF_SEPARATOR = " ";
|
|
1750
|
-
var TreegridRoot = /* @__PURE__ */
|
|
1813
|
+
var TreegridRoot = /* @__PURE__ */ forwardRef16(({ asChild, classNames, children, style, gridTemplateColumns, ...props }, forwardedRef) => {
|
|
1751
1814
|
const { tx } = useThemeContext();
|
|
1752
|
-
const
|
|
1815
|
+
const Root7 = asChild ? Slot7 : Primitive7.div;
|
|
1753
1816
|
const arrowNavigationAttrs = useArrowNavigationGroup({
|
|
1754
1817
|
axis: "vertical",
|
|
1755
1818
|
tabbable: false,
|
|
1756
1819
|
circular: true
|
|
1757
1820
|
});
|
|
1758
|
-
return /* @__PURE__ */
|
|
1821
|
+
return /* @__PURE__ */ React24.createElement(Root7, {
|
|
1759
1822
|
role: "treegrid",
|
|
1760
1823
|
...arrowNavigationAttrs,
|
|
1761
1824
|
...props,
|
|
@@ -1767,9 +1830,9 @@ var TreegridRoot = /* @__PURE__ */ forwardRef18(({ asChild, classNames, children
|
|
|
1767
1830
|
ref: forwardedRef
|
|
1768
1831
|
}, children);
|
|
1769
1832
|
});
|
|
1770
|
-
var TreegridRow = /* @__PURE__ */
|
|
1833
|
+
var TreegridRow = /* @__PURE__ */ forwardRef16(({ __treegridRowScope, asChild, classNames, children, id, parentOf, open: propsOpen, defaultOpen, onOpenChange: propsOnOpenChange, ...props }, forwardedRef) => {
|
|
1771
1834
|
const { tx } = useThemeContext();
|
|
1772
|
-
const
|
|
1835
|
+
const Root7 = asChild ? Slot7 : Primitive7.div;
|
|
1773
1836
|
const pathParts = id.split(PATH_SEPARATOR);
|
|
1774
1837
|
const level = pathParts.length - 1;
|
|
1775
1838
|
const [open, onOpenChange] = useControllableState3({
|
|
@@ -1786,11 +1849,11 @@ var TreegridRow = /* @__PURE__ */ forwardRef18(({ __treegridRowScope, asChild, c
|
|
|
1786
1849
|
circular: false,
|
|
1787
1850
|
memorizeCurrent: false
|
|
1788
1851
|
});
|
|
1789
|
-
return /* @__PURE__ */
|
|
1852
|
+
return /* @__PURE__ */ React24.createElement(TreegridRowProvider, {
|
|
1790
1853
|
open,
|
|
1791
1854
|
onOpenChange,
|
|
1792
1855
|
scope: __treegridRowScope
|
|
1793
|
-
}, /* @__PURE__ */
|
|
1856
|
+
}, /* @__PURE__ */ React24.createElement(Root7, {
|
|
1794
1857
|
role: "row",
|
|
1795
1858
|
"aria-level": level,
|
|
1796
1859
|
className: tx("treegrid.row", "treegrid__row", {
|
|
@@ -1805,15 +1868,15 @@ var TreegridRow = /* @__PURE__ */ forwardRef18(({ __treegridRowScope, asChild, c
|
|
|
1805
1868
|
...props,
|
|
1806
1869
|
id,
|
|
1807
1870
|
ref: forwardedRef
|
|
1808
|
-
}, /* @__PURE__ */
|
|
1871
|
+
}, /* @__PURE__ */ React24.createElement("div", {
|
|
1809
1872
|
role: "none",
|
|
1810
1873
|
className: "contents",
|
|
1811
1874
|
...arrowGroupAttrs
|
|
1812
1875
|
}, children)));
|
|
1813
1876
|
});
|
|
1814
|
-
var TreegridCell = /* @__PURE__ */
|
|
1877
|
+
var TreegridCell = /* @__PURE__ */ forwardRef16(({ classNames, children, indent, ...props }, forwardedRef) => {
|
|
1815
1878
|
const { tx } = useThemeContext();
|
|
1816
|
-
return /* @__PURE__ */
|
|
1879
|
+
return /* @__PURE__ */ React24.createElement("div", {
|
|
1817
1880
|
role: "gridcell",
|
|
1818
1881
|
className: tx("treegrid.cell", "treegrid__cell", {
|
|
1819
1882
|
indent
|
|
@@ -1835,15 +1898,15 @@ var Treegrid = {
|
|
|
1835
1898
|
// packages/ui/react-ui/src/components/Main/Main.tsx
|
|
1836
1899
|
import { createContext as createContext10 } from "@radix-ui/react-context";
|
|
1837
1900
|
import { Root as DialogRoot2, DialogContent as DialogContent2, DialogTitle as DialogTitle2 } from "@radix-ui/react-dialog";
|
|
1838
|
-
import { Primitive as
|
|
1839
|
-
import { Slot as
|
|
1901
|
+
import { Primitive as Primitive8 } from "@radix-ui/react-primitive";
|
|
1902
|
+
import { Slot as Slot8 } from "@radix-ui/react-slot";
|
|
1840
1903
|
import { useControllableState as useControllableState4 } from "@radix-ui/react-use-controllable-state";
|
|
1841
|
-
import
|
|
1904
|
+
import React25, { forwardRef as forwardRef17, useCallback as useCallback7, useEffect as useEffect5, useRef as useRef2, useState as useState7 } from "react";
|
|
1842
1905
|
import { log } from "@dxos/log";
|
|
1843
1906
|
import { useMediaQuery, useForwardedRef } from "@dxos/react-hooks";
|
|
1844
1907
|
|
|
1845
1908
|
// packages/ui/react-ui/src/components/Main/useSwipeToDismiss.ts
|
|
1846
|
-
import { useCallback as useCallback6, useEffect as useEffect4, useState as
|
|
1909
|
+
import { useCallback as useCallback6, useEffect as useEffect4, useState as useState6 } from "react";
|
|
1847
1910
|
var MotionState;
|
|
1848
1911
|
(function(MotionState2) {
|
|
1849
1912
|
MotionState2[MotionState2["IDLE"] = 0] = "IDLE";
|
|
@@ -1858,8 +1921,8 @@ var useSwipeToDismiss = (ref, {
|
|
|
1858
1921
|
/* side = 'inline-start' */
|
|
1859
1922
|
}) => {
|
|
1860
1923
|
const $root = ref.current;
|
|
1861
|
-
const [motionState, setMotionState] =
|
|
1862
|
-
const [gestureStartX, setGestureStartX] =
|
|
1924
|
+
const [motionState, setMotionState] = useState6(0);
|
|
1925
|
+
const [gestureStartX, setGestureStartX] = useState6(0);
|
|
1863
1926
|
const setIdle = useCallback6(() => {
|
|
1864
1927
|
setMotionState(0);
|
|
1865
1928
|
$root?.style.removeProperty("inset-inline-start");
|
|
@@ -2029,183 +2092,650 @@ var MainRoot = ({ navigationSidebarState: propsNavigationSidebarState, defaultNa
|
|
|
2029
2092
|
defaultProp: defaultNavigationSidebarState,
|
|
2030
2093
|
onChange: onNavigationSidebarStateChange
|
|
2031
2094
|
});
|
|
2032
|
-
const [complementarySidebarState = isLg ? "expanded" : "collapsed", setComplementarySidebarState] = useControllableState4({
|
|
2033
|
-
prop: propsComplementarySidebarState,
|
|
2034
|
-
defaultProp: defaultComplementarySidebarState,
|
|
2035
|
-
onChange: onComplementarySidebarStateChange
|
|
2095
|
+
const [complementarySidebarState = isLg ? "expanded" : "collapsed", setComplementarySidebarState] = useControllableState4({
|
|
2096
|
+
prop: propsComplementarySidebarState,
|
|
2097
|
+
defaultProp: defaultComplementarySidebarState,
|
|
2098
|
+
onChange: onComplementarySidebarStateChange
|
|
2099
|
+
});
|
|
2100
|
+
const [resizing, setResizing] = useState7(false);
|
|
2101
|
+
const resizeInterval = useRef2(null);
|
|
2102
|
+
const handleResize = useCallback7(() => {
|
|
2103
|
+
setResizing(true);
|
|
2104
|
+
if (resizeInterval.current) {
|
|
2105
|
+
clearTimeout(resizeInterval.current);
|
|
2106
|
+
}
|
|
2107
|
+
resizeInterval.current = setTimeout(() => {
|
|
2108
|
+
setResizing(false);
|
|
2109
|
+
resizeInterval.current = null;
|
|
2110
|
+
}, resizeDebounce);
|
|
2111
|
+
}, []);
|
|
2112
|
+
useEffect5(() => {
|
|
2113
|
+
window.addEventListener("resize", handleResize);
|
|
2114
|
+
return () => window.removeEventListener("resize", handleResize);
|
|
2115
|
+
}, [
|
|
2116
|
+
handleResize
|
|
2117
|
+
]);
|
|
2118
|
+
return /* @__PURE__ */ React25.createElement(MainProvider, {
|
|
2119
|
+
...props,
|
|
2120
|
+
navigationSidebarState,
|
|
2121
|
+
setNavigationSidebarState,
|
|
2122
|
+
complementarySidebarState,
|
|
2123
|
+
setComplementarySidebarState,
|
|
2124
|
+
resizing
|
|
2125
|
+
}, children);
|
|
2126
|
+
};
|
|
2127
|
+
MainRoot.displayName = MAIN_ROOT_NAME;
|
|
2128
|
+
var handleOpenAutoFocus = (event) => {
|
|
2129
|
+
!document.body.hasAttribute("data-is-keyboard") && event.preventDefault();
|
|
2130
|
+
};
|
|
2131
|
+
var MainSidebar = /* @__PURE__ */ forwardRef17(({ classNames, children, swipeToDismiss, onOpenAutoFocus, state, resizing, onStateChange, side, label, ...props }, forwardedRef) => {
|
|
2132
|
+
const [isLg] = useMediaQuery("lg", {
|
|
2133
|
+
ssr: false
|
|
2134
|
+
});
|
|
2135
|
+
const { tx } = useThemeContext();
|
|
2136
|
+
const { t } = useTranslation();
|
|
2137
|
+
const ref = useForwardedRef(forwardedRef);
|
|
2138
|
+
const noopRef = useRef2(null);
|
|
2139
|
+
useSwipeToDismiss(swipeToDismiss ? ref : noopRef, {
|
|
2140
|
+
onDismiss: () => onStateChange?.("closed")
|
|
2141
|
+
});
|
|
2142
|
+
const handleKeyDown = useCallback7((event) => {
|
|
2143
|
+
if (event.key === "Escape") {
|
|
2144
|
+
event.target.closest("[data-tabster]")?.focus();
|
|
2145
|
+
}
|
|
2146
|
+
props.onKeyDown?.(event);
|
|
2147
|
+
}, [
|
|
2148
|
+
props.onKeyDown
|
|
2149
|
+
]);
|
|
2150
|
+
const Root7 = isLg ? Primitive8.div : DialogContent2;
|
|
2151
|
+
return /* @__PURE__ */ React25.createElement(DialogRoot2, {
|
|
2152
|
+
open: state !== "closed",
|
|
2153
|
+
"aria-label": toLocalizedString(label, t),
|
|
2154
|
+
modal: false
|
|
2155
|
+
}, !isLg && /* @__PURE__ */ React25.createElement(DialogTitle2, {
|
|
2156
|
+
className: "sr-only"
|
|
2157
|
+
}, toLocalizedString(label, t)), /* @__PURE__ */ React25.createElement(Root7, {
|
|
2158
|
+
...!isLg && {
|
|
2159
|
+
forceMount: true,
|
|
2160
|
+
tabIndex: -1,
|
|
2161
|
+
onOpenAutoFocus: onOpenAutoFocus ?? handleOpenAutoFocus
|
|
2162
|
+
},
|
|
2163
|
+
...props,
|
|
2164
|
+
"data-side": side === "inline-end" ? "ie" : "is",
|
|
2165
|
+
"data-state": state,
|
|
2166
|
+
"data-resizing": resizing ? "true" : "false",
|
|
2167
|
+
className: tx("main.sidebar", "main__sidebar", {}, classNames),
|
|
2168
|
+
onKeyDown: handleKeyDown,
|
|
2169
|
+
...state === "closed" && {
|
|
2170
|
+
inert: "true"
|
|
2171
|
+
},
|
|
2172
|
+
ref
|
|
2173
|
+
}, children));
|
|
2174
|
+
});
|
|
2175
|
+
var MainNavigationSidebar = /* @__PURE__ */ forwardRef17((props, forwardedRef) => {
|
|
2176
|
+
const { navigationSidebarState, setNavigationSidebarState, resizing } = useMainContext(NAVIGATION_SIDEBAR_NAME);
|
|
2177
|
+
const mover = useLandmarkMover(props.onKeyDown, "0");
|
|
2178
|
+
return /* @__PURE__ */ React25.createElement(MainSidebar, {
|
|
2179
|
+
...mover,
|
|
2180
|
+
...props,
|
|
2181
|
+
state: navigationSidebarState,
|
|
2182
|
+
onStateChange: setNavigationSidebarState,
|
|
2183
|
+
resizing,
|
|
2184
|
+
side: "inline-start",
|
|
2185
|
+
ref: forwardedRef
|
|
2186
|
+
});
|
|
2187
|
+
});
|
|
2188
|
+
MainNavigationSidebar.displayName = NAVIGATION_SIDEBAR_NAME;
|
|
2189
|
+
var MainComplementarySidebar = /* @__PURE__ */ forwardRef17((props, forwardedRef) => {
|
|
2190
|
+
const { complementarySidebarState, setComplementarySidebarState, resizing } = useMainContext(COMPLEMENTARY_SIDEBAR_NAME);
|
|
2191
|
+
const mover = useLandmarkMover(props.onKeyDown, "2");
|
|
2192
|
+
return /* @__PURE__ */ React25.createElement(MainSidebar, {
|
|
2193
|
+
...mover,
|
|
2194
|
+
...props,
|
|
2195
|
+
state: complementarySidebarState,
|
|
2196
|
+
onStateChange: setComplementarySidebarState,
|
|
2197
|
+
resizing,
|
|
2198
|
+
side: "inline-end",
|
|
2199
|
+
ref: forwardedRef
|
|
2200
|
+
});
|
|
2201
|
+
});
|
|
2202
|
+
MainNavigationSidebar.displayName = NAVIGATION_SIDEBAR_NAME;
|
|
2203
|
+
var MainContent = /* @__PURE__ */ forwardRef17(({ asChild, classNames, bounce, handlesFocus, children, role, ...props }, forwardedRef) => {
|
|
2204
|
+
const { navigationSidebarState, complementarySidebarState } = useMainContext(MAIN_NAME);
|
|
2205
|
+
const { tx } = useThemeContext();
|
|
2206
|
+
const Root7 = asChild ? Slot8 : role ? "div" : "main";
|
|
2207
|
+
const mover = useLandmarkMover(props.onKeyDown, "1");
|
|
2208
|
+
return /* @__PURE__ */ React25.createElement(Root7, {
|
|
2209
|
+
role,
|
|
2210
|
+
...handlesFocus && {
|
|
2211
|
+
...mover
|
|
2212
|
+
},
|
|
2213
|
+
...props,
|
|
2214
|
+
"data-sidebar-inline-start-state": navigationSidebarState,
|
|
2215
|
+
"data-sidebar-inline-end-state": complementarySidebarState,
|
|
2216
|
+
className: tx("main.content", "main", {
|
|
2217
|
+
bounce,
|
|
2218
|
+
handlesFocus
|
|
2219
|
+
}, classNames),
|
|
2220
|
+
ref: forwardedRef
|
|
2221
|
+
}, children);
|
|
2222
|
+
});
|
|
2223
|
+
MainContent.displayName = MAIN_NAME;
|
|
2224
|
+
var MainOverlay = /* @__PURE__ */ forwardRef17(({ classNames, ...props }, forwardedRef) => {
|
|
2225
|
+
const [isLg] = useMediaQuery("lg", {
|
|
2226
|
+
ssr: false
|
|
2227
|
+
});
|
|
2228
|
+
const { navigationSidebarState, setNavigationSidebarState, complementarySidebarState, setComplementarySidebarState } = useMainContext(MAIN_NAME);
|
|
2229
|
+
const { tx } = useThemeContext();
|
|
2230
|
+
return /* @__PURE__ */ React25.createElement("div", {
|
|
2231
|
+
onClick: () => {
|
|
2232
|
+
setNavigationSidebarState("collapsed");
|
|
2233
|
+
setComplementarySidebarState("collapsed");
|
|
2234
|
+
},
|
|
2235
|
+
...props,
|
|
2236
|
+
className: tx("main.overlay", "main__overlay", {
|
|
2237
|
+
isLg,
|
|
2238
|
+
inlineStartSidebarOpen: navigationSidebarState,
|
|
2239
|
+
inlineEndSidebarOpen: complementarySidebarState
|
|
2240
|
+
}, classNames),
|
|
2241
|
+
"data-state": navigationSidebarState === "expanded" || complementarySidebarState === "expanded" ? "open" : "closed",
|
|
2242
|
+
"aria-hidden": "true",
|
|
2243
|
+
ref: forwardedRef
|
|
2244
|
+
});
|
|
2245
|
+
});
|
|
2246
|
+
var Main = {
|
|
2247
|
+
Root: MainRoot,
|
|
2248
|
+
Content: MainContent,
|
|
2249
|
+
Overlay: MainOverlay,
|
|
2250
|
+
NavigationSidebar: MainNavigationSidebar,
|
|
2251
|
+
ComplementarySidebar: MainComplementarySidebar
|
|
2252
|
+
};
|
|
2253
|
+
|
|
2254
|
+
// packages/ui/react-ui/src/components/Menus/ContextMenu.tsx
|
|
2255
|
+
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
|
|
2256
|
+
import { Primitive as Primitive9 } from "@radix-ui/react-primitive";
|
|
2257
|
+
import { Slot as Slot9 } from "@radix-ui/react-slot";
|
|
2258
|
+
import React26, { forwardRef as forwardRef18 } from "react";
|
|
2259
|
+
|
|
2260
|
+
// packages/ui/react-ui/src/hooks/useSafeCollisionPadding.ts
|
|
2261
|
+
import { useMemo as useMemo3 } from "react";
|
|
2262
|
+
var propIsNumber = (prop) => Number.isFinite(prop);
|
|
2263
|
+
var propsIsRecord = (prop) => !!(prop && typeof prop === "object");
|
|
2264
|
+
var safePadding = (propsPadding, safePadding2, side) => {
|
|
2265
|
+
return (propIsNumber(safePadding2[side]) ? safePadding2[side] : 0) + (propIsNumber(propsPadding) ? propsPadding : propsIsRecord(propsPadding) ? propsPadding[side] ?? 0 : 0);
|
|
2266
|
+
};
|
|
2267
|
+
var useSafeCollisionPadding = (collisionPadding) => {
|
|
2268
|
+
const { safeAreaPadding } = useThemeContext();
|
|
2269
|
+
return useMemo3(() => ({
|
|
2270
|
+
top: safePadding(collisionPadding, safeAreaPadding, "top"),
|
|
2271
|
+
right: safePadding(collisionPadding, safeAreaPadding, "right"),
|
|
2272
|
+
bottom: safePadding(collisionPadding, safeAreaPadding, "bottom"),
|
|
2273
|
+
left: safePadding(collisionPadding, safeAreaPadding, "left")
|
|
2274
|
+
}), [
|
|
2275
|
+
collisionPadding,
|
|
2276
|
+
safeAreaPadding
|
|
2277
|
+
]);
|
|
2278
|
+
};
|
|
2279
|
+
|
|
2280
|
+
// packages/ui/react-ui/src/components/Menus/ContextMenu.tsx
|
|
2281
|
+
var ContextMenuRoot = ContextMenuPrimitive.ContextMenu;
|
|
2282
|
+
var ContextMenuTrigger = ContextMenuPrimitive.Trigger;
|
|
2283
|
+
var ContextMenuPortal = ContextMenuPrimitive.Portal;
|
|
2284
|
+
var ContextMenuContent = /* @__PURE__ */ forwardRef18(({ classNames, children, collisionPadding = 8, ...props }, forwardedRef) => {
|
|
2285
|
+
const { tx } = useThemeContext();
|
|
2286
|
+
const elevation = useElevationContext();
|
|
2287
|
+
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
2288
|
+
return /* @__PURE__ */ React26.createElement(ContextMenuPrimitive.Content, {
|
|
2289
|
+
...props,
|
|
2290
|
+
collisionPadding: safeCollisionPadding,
|
|
2291
|
+
className: tx("menu.content", "menu", {
|
|
2292
|
+
elevation
|
|
2293
|
+
}, classNames),
|
|
2294
|
+
ref: forwardedRef
|
|
2295
|
+
}, children);
|
|
2296
|
+
});
|
|
2297
|
+
var ContextMenuViewport = /* @__PURE__ */ forwardRef18(({ classNames, asChild, children, ...props }, forwardedRef) => {
|
|
2298
|
+
const { tx } = useThemeContext();
|
|
2299
|
+
const Root7 = asChild ? Slot9 : Primitive9.div;
|
|
2300
|
+
return /* @__PURE__ */ React26.createElement(Root7, {
|
|
2301
|
+
...props,
|
|
2302
|
+
className: tx("menu.viewport", "menu__viewport", {}, classNames),
|
|
2303
|
+
ref: forwardedRef
|
|
2304
|
+
}, children);
|
|
2305
|
+
});
|
|
2306
|
+
var ContextMenuArrow = /* @__PURE__ */ forwardRef18(({ classNames, ...props }, forwardedRef) => {
|
|
2307
|
+
const { tx } = useThemeContext();
|
|
2308
|
+
return /* @__PURE__ */ React26.createElement(ContextMenuPrimitive.Arrow, {
|
|
2309
|
+
...props,
|
|
2310
|
+
className: tx("menu.arrow", "menu__arrow", {}, classNames),
|
|
2311
|
+
ref: forwardedRef
|
|
2312
|
+
});
|
|
2313
|
+
});
|
|
2314
|
+
var ContextMenuGroup = ContextMenuPrimitive.Group;
|
|
2315
|
+
var ContextMenuItemIndicator = ContextMenuPrimitive.ItemIndicator;
|
|
2316
|
+
var ContextMenuItem = /* @__PURE__ */ forwardRef18(({ classNames, ...props }, forwardedRef) => {
|
|
2317
|
+
const { tx } = useThemeContext();
|
|
2318
|
+
return /* @__PURE__ */ React26.createElement(ContextMenuPrimitive.Item, {
|
|
2319
|
+
...props,
|
|
2320
|
+
className: tx("menu.item", "menu__item", {}, classNames),
|
|
2321
|
+
ref: forwardedRef
|
|
2322
|
+
});
|
|
2323
|
+
});
|
|
2324
|
+
var ContextMenuCheckboxItem = /* @__PURE__ */ forwardRef18(({ classNames, ...props }, forwardedRef) => {
|
|
2325
|
+
const { tx } = useThemeContext();
|
|
2326
|
+
return /* @__PURE__ */ React26.createElement(ContextMenuPrimitive.CheckboxItem, {
|
|
2327
|
+
...props,
|
|
2328
|
+
className: tx("menu.item", "menu__item--checkbox", {}, classNames),
|
|
2329
|
+
ref: forwardedRef
|
|
2330
|
+
});
|
|
2331
|
+
});
|
|
2332
|
+
var ContextMenuSeparator = /* @__PURE__ */ forwardRef18(({ classNames, ...props }, forwardedRef) => {
|
|
2333
|
+
const { tx } = useThemeContext();
|
|
2334
|
+
return /* @__PURE__ */ React26.createElement(ContextMenuPrimitive.Separator, {
|
|
2335
|
+
...props,
|
|
2336
|
+
className: tx("menu.separator", "menu__item", {}, classNames),
|
|
2337
|
+
ref: forwardedRef
|
|
2338
|
+
});
|
|
2339
|
+
});
|
|
2340
|
+
var ContextMenuGroupLabel = /* @__PURE__ */ forwardRef18(({ classNames, ...props }, forwardedRef) => {
|
|
2341
|
+
const { tx } = useThemeContext();
|
|
2342
|
+
return /* @__PURE__ */ React26.createElement(ContextMenuPrimitive.Label, {
|
|
2343
|
+
...props,
|
|
2344
|
+
className: tx("menu.groupLabel", "menu__group__label", {}, classNames),
|
|
2345
|
+
ref: forwardedRef
|
|
2346
|
+
});
|
|
2347
|
+
});
|
|
2348
|
+
var ContextMenu2 = {
|
|
2349
|
+
Root: ContextMenuRoot,
|
|
2350
|
+
Trigger: ContextMenuTrigger,
|
|
2351
|
+
Portal: ContextMenuPortal,
|
|
2352
|
+
Content: ContextMenuContent,
|
|
2353
|
+
Viewport: ContextMenuViewport,
|
|
2354
|
+
Arrow: ContextMenuArrow,
|
|
2355
|
+
Group: ContextMenuGroup,
|
|
2356
|
+
Item: ContextMenuItem,
|
|
2357
|
+
CheckboxItem: ContextMenuCheckboxItem,
|
|
2358
|
+
ItemIndicator: ContextMenuItemIndicator,
|
|
2359
|
+
Separator: ContextMenuSeparator,
|
|
2360
|
+
GroupLabel: ContextMenuGroupLabel
|
|
2361
|
+
};
|
|
2362
|
+
|
|
2363
|
+
// packages/ui/react-ui/src/components/Menus/DropdownMenu.tsx
|
|
2364
|
+
import { composeEventHandlers as composeEventHandlers2 } from "@radix-ui/primitive";
|
|
2365
|
+
import { composeRefs } from "@radix-ui/react-compose-refs";
|
|
2366
|
+
import { createContextScope as createContextScope3 } from "@radix-ui/react-context";
|
|
2367
|
+
import { useId as useId3 } from "@radix-ui/react-id";
|
|
2368
|
+
import * as MenuPrimitive from "@radix-ui/react-menu";
|
|
2369
|
+
import { createMenuScope } from "@radix-ui/react-menu";
|
|
2370
|
+
import { Primitive as Primitive10 } from "@radix-ui/react-primitive";
|
|
2371
|
+
import { Slot as Slot10 } from "@radix-ui/react-slot";
|
|
2372
|
+
import { useControllableState as useControllableState5 } from "@radix-ui/react-use-controllable-state";
|
|
2373
|
+
import React27, { useRef as useRef3, useCallback as useCallback8, forwardRef as forwardRef19, useEffect as useEffect6 } from "react";
|
|
2374
|
+
var DROPDOWN_MENU_NAME = "DropdownMenu";
|
|
2375
|
+
var [createDropdownMenuContext, createDropdownMenuScope] = createContextScope3(DROPDOWN_MENU_NAME, [
|
|
2376
|
+
createMenuScope
|
|
2377
|
+
]);
|
|
2378
|
+
var useMenuScope = createMenuScope();
|
|
2379
|
+
var [DropdownMenuProvider, useDropdownMenuContext] = createDropdownMenuContext(DROPDOWN_MENU_NAME);
|
|
2380
|
+
var DropdownMenuRoot = (props) => {
|
|
2381
|
+
const { __scopeDropdownMenu, children, dir, open: openProp, defaultOpen, onOpenChange, modal = true } = props;
|
|
2382
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
2383
|
+
const triggerRef = useRef3(null);
|
|
2384
|
+
const [open = false, setOpen] = useControllableState5({
|
|
2385
|
+
prop: openProp,
|
|
2386
|
+
defaultProp: defaultOpen,
|
|
2387
|
+
onChange: onOpenChange
|
|
2388
|
+
});
|
|
2389
|
+
return /* @__PURE__ */ React27.createElement(DropdownMenuProvider, {
|
|
2390
|
+
scope: __scopeDropdownMenu,
|
|
2391
|
+
triggerId: useId3(),
|
|
2392
|
+
triggerRef,
|
|
2393
|
+
contentId: useId3(),
|
|
2394
|
+
open,
|
|
2395
|
+
onOpenChange: setOpen,
|
|
2396
|
+
onOpenToggle: useCallback8(() => setOpen((prevOpen) => !prevOpen), [
|
|
2397
|
+
setOpen
|
|
2398
|
+
]),
|
|
2399
|
+
modal
|
|
2400
|
+
}, /* @__PURE__ */ React27.createElement(MenuPrimitive.Root, {
|
|
2401
|
+
...menuScope,
|
|
2402
|
+
open,
|
|
2403
|
+
onOpenChange: setOpen,
|
|
2404
|
+
dir,
|
|
2405
|
+
modal
|
|
2406
|
+
}, children));
|
|
2407
|
+
};
|
|
2408
|
+
DropdownMenuRoot.displayName = DROPDOWN_MENU_NAME;
|
|
2409
|
+
var TRIGGER_NAME2 = "DropdownMenuTrigger";
|
|
2410
|
+
var DropdownMenuTrigger = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
|
|
2411
|
+
const { __scopeDropdownMenu, disabled = false, ...triggerProps } = props;
|
|
2412
|
+
const context = useDropdownMenuContext(TRIGGER_NAME2, __scopeDropdownMenu);
|
|
2413
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
2414
|
+
return /* @__PURE__ */ React27.createElement(MenuPrimitive.Anchor, {
|
|
2415
|
+
asChild: true,
|
|
2416
|
+
...menuScope
|
|
2417
|
+
}, /* @__PURE__ */ React27.createElement(Primitive10.button, {
|
|
2418
|
+
type: "button",
|
|
2419
|
+
id: context.triggerId,
|
|
2420
|
+
"aria-haspopup": "menu",
|
|
2421
|
+
"aria-expanded": context.open,
|
|
2422
|
+
"aria-controls": context.open ? context.contentId : void 0,
|
|
2423
|
+
"data-state": context.open ? "open" : "closed",
|
|
2424
|
+
"data-disabled": disabled ? "" : void 0,
|
|
2425
|
+
disabled,
|
|
2426
|
+
...triggerProps,
|
|
2427
|
+
ref: composeRefs(forwardedRef, context.triggerRef),
|
|
2428
|
+
onPointerDown: composeEventHandlers2(props.onPointerDown, (event) => {
|
|
2429
|
+
if (!disabled && event.button === 0 && event.ctrlKey === false) {
|
|
2430
|
+
context.onOpenToggle();
|
|
2431
|
+
if (!context.open) {
|
|
2432
|
+
event.preventDefault();
|
|
2433
|
+
}
|
|
2434
|
+
}
|
|
2435
|
+
}),
|
|
2436
|
+
onKeyDown: composeEventHandlers2(props.onKeyDown, (event) => {
|
|
2437
|
+
if (disabled) {
|
|
2438
|
+
return;
|
|
2439
|
+
}
|
|
2440
|
+
if ([
|
|
2441
|
+
"Enter",
|
|
2442
|
+
" "
|
|
2443
|
+
].includes(event.key)) {
|
|
2444
|
+
context.onOpenToggle();
|
|
2445
|
+
}
|
|
2446
|
+
if (event.key === "ArrowDown") {
|
|
2447
|
+
context.onOpenChange(true);
|
|
2448
|
+
}
|
|
2449
|
+
if ([
|
|
2450
|
+
"Enter",
|
|
2451
|
+
" ",
|
|
2452
|
+
"ArrowDown"
|
|
2453
|
+
].includes(event.key)) {
|
|
2454
|
+
event.preventDefault();
|
|
2455
|
+
}
|
|
2456
|
+
})
|
|
2457
|
+
}));
|
|
2458
|
+
});
|
|
2459
|
+
DropdownMenuTrigger.displayName = TRIGGER_NAME2;
|
|
2460
|
+
var VIRTUAL_TRIGGER_NAME = "DropdownMenuVirtualTrigger";
|
|
2461
|
+
var DropdownMenuVirtualTrigger = (props) => {
|
|
2462
|
+
const { __scopeDropdownMenu, virtualRef } = props;
|
|
2463
|
+
const context = useDropdownMenuContext(VIRTUAL_TRIGGER_NAME, __scopeDropdownMenu);
|
|
2464
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
2465
|
+
useEffect6(() => {
|
|
2466
|
+
if (virtualRef.current) {
|
|
2467
|
+
context.triggerRef.current = virtualRef.current;
|
|
2468
|
+
}
|
|
2469
|
+
});
|
|
2470
|
+
return /* @__PURE__ */ React27.createElement(MenuPrimitive.Anchor, {
|
|
2471
|
+
...menuScope,
|
|
2472
|
+
virtualRef
|
|
2473
|
+
});
|
|
2474
|
+
};
|
|
2475
|
+
DropdownMenuVirtualTrigger.displayName = VIRTUAL_TRIGGER_NAME;
|
|
2476
|
+
var PORTAL_NAME2 = "DropdownMenuPortal";
|
|
2477
|
+
var DropdownMenuPortal = (props) => {
|
|
2478
|
+
const { __scopeDropdownMenu, ...portalProps } = props;
|
|
2479
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
2480
|
+
return /* @__PURE__ */ React27.createElement(MenuPrimitive.Portal, {
|
|
2481
|
+
...menuScope,
|
|
2482
|
+
...portalProps
|
|
2483
|
+
});
|
|
2484
|
+
};
|
|
2485
|
+
DropdownMenuPortal.displayName = PORTAL_NAME2;
|
|
2486
|
+
var DropdownMenuViewport = /* @__PURE__ */ forwardRef19(({ classNames, asChild, children, ...props }, forwardedRef) => {
|
|
2487
|
+
const { tx } = useThemeContext();
|
|
2488
|
+
const Root7 = asChild ? Slot10 : Primitive10.div;
|
|
2489
|
+
return /* @__PURE__ */ React27.createElement(Root7, {
|
|
2490
|
+
...props,
|
|
2491
|
+
className: tx("menu.viewport", "menu__viewport", {}, classNames),
|
|
2492
|
+
ref: forwardedRef
|
|
2493
|
+
}, children);
|
|
2494
|
+
});
|
|
2495
|
+
var CONTENT_NAME2 = "DropdownMenuContent";
|
|
2496
|
+
var DropdownMenuContent = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
|
|
2497
|
+
const { __scopeDropdownMenu, classNames, collisionPadding = 8, ...contentProps } = props;
|
|
2498
|
+
const { tx } = useThemeContext();
|
|
2499
|
+
const context = useDropdownMenuContext(CONTENT_NAME2, __scopeDropdownMenu);
|
|
2500
|
+
const elevation = useElevationContext();
|
|
2501
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
2502
|
+
const hasInteractedOutsideRef = useRef3(false);
|
|
2503
|
+
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
2504
|
+
return /* @__PURE__ */ React27.createElement(MenuPrimitive.Content, {
|
|
2505
|
+
id: context.contentId,
|
|
2506
|
+
"aria-labelledby": context.triggerId,
|
|
2507
|
+
...menuScope,
|
|
2508
|
+
...contentProps,
|
|
2509
|
+
collisionPadding: safeCollisionPadding,
|
|
2510
|
+
ref: forwardedRef,
|
|
2511
|
+
onCloseAutoFocus: composeEventHandlers2(props.onCloseAutoFocus, (event) => {
|
|
2512
|
+
if (!hasInteractedOutsideRef.current) {
|
|
2513
|
+
context.triggerRef.current?.focus();
|
|
2514
|
+
}
|
|
2515
|
+
hasInteractedOutsideRef.current = false;
|
|
2516
|
+
event.preventDefault();
|
|
2517
|
+
}),
|
|
2518
|
+
onInteractOutside: composeEventHandlers2(props.onInteractOutside, (event) => {
|
|
2519
|
+
const originalEvent = event.detail.originalEvent;
|
|
2520
|
+
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
2521
|
+
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
2522
|
+
if (!context.modal || isRightClick) {
|
|
2523
|
+
hasInteractedOutsideRef.current = true;
|
|
2524
|
+
}
|
|
2525
|
+
}),
|
|
2526
|
+
className: tx("menu.content", "menu", {
|
|
2527
|
+
elevation
|
|
2528
|
+
}, classNames),
|
|
2529
|
+
style: {
|
|
2530
|
+
...props.style,
|
|
2531
|
+
// re-namespace exposed content custom properties
|
|
2532
|
+
...{
|
|
2533
|
+
"--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
2534
|
+
"--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
|
|
2535
|
+
"--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
|
|
2536
|
+
"--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
|
|
2537
|
+
"--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
|
|
2538
|
+
}
|
|
2539
|
+
}
|
|
2540
|
+
});
|
|
2541
|
+
});
|
|
2542
|
+
DropdownMenuContent.displayName = CONTENT_NAME2;
|
|
2543
|
+
var GROUP_NAME = "DropdownMenuGroup";
|
|
2544
|
+
var DropdownMenuGroup = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
|
|
2545
|
+
const { __scopeDropdownMenu, ...groupProps } = props;
|
|
2546
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
2547
|
+
return /* @__PURE__ */ React27.createElement(MenuPrimitive.Group, {
|
|
2548
|
+
...menuScope,
|
|
2549
|
+
...groupProps,
|
|
2550
|
+
ref: forwardedRef
|
|
2551
|
+
});
|
|
2552
|
+
});
|
|
2553
|
+
DropdownMenuGroup.displayName = GROUP_NAME;
|
|
2554
|
+
var LABEL_NAME = "DropdownMenuLabel";
|
|
2555
|
+
var DropdownMenuGroupLabel = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
|
|
2556
|
+
const { __scopeDropdownMenu, classNames, ...labelProps } = props;
|
|
2557
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
2558
|
+
const { tx } = useThemeContext();
|
|
2559
|
+
return /* @__PURE__ */ React27.createElement(MenuPrimitive.Label, {
|
|
2560
|
+
...menuScope,
|
|
2561
|
+
...labelProps,
|
|
2562
|
+
className: tx("menu.groupLabel", "menu__group__label", {}, classNames),
|
|
2563
|
+
ref: forwardedRef
|
|
2564
|
+
});
|
|
2565
|
+
});
|
|
2566
|
+
DropdownMenuGroupLabel.displayName = LABEL_NAME;
|
|
2567
|
+
var ITEM_NAME = "DropdownMenuItem";
|
|
2568
|
+
var DropdownMenuItem = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
|
|
2569
|
+
const { __scopeDropdownMenu, classNames, ...itemProps } = props;
|
|
2570
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
2571
|
+
const { tx } = useThemeContext();
|
|
2572
|
+
return /* @__PURE__ */ React27.createElement(MenuPrimitive.Item, {
|
|
2573
|
+
...menuScope,
|
|
2574
|
+
...itemProps,
|
|
2575
|
+
className: tx("menu.item", "menu__item", {}, classNames),
|
|
2576
|
+
ref: forwardedRef
|
|
2577
|
+
});
|
|
2578
|
+
});
|
|
2579
|
+
DropdownMenuItem.displayName = ITEM_NAME;
|
|
2580
|
+
var CHECKBOX_ITEM_NAME = "DropdownMenuCheckboxItem";
|
|
2581
|
+
var DropdownMenuCheckboxItem = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
|
|
2582
|
+
const { __scopeDropdownMenu, classNames, ...checkboxItemProps } = props;
|
|
2583
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
2584
|
+
const { tx } = useThemeContext();
|
|
2585
|
+
return /* @__PURE__ */ React27.createElement(MenuPrimitive.CheckboxItem, {
|
|
2586
|
+
...menuScope,
|
|
2587
|
+
...checkboxItemProps,
|
|
2588
|
+
className: tx("menu.item", "menu__item--checkbox", {}, classNames),
|
|
2589
|
+
ref: forwardedRef
|
|
2036
2590
|
});
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
}, resizeDebounce);
|
|
2048
|
-
}, []);
|
|
2049
|
-
useEffect5(() => {
|
|
2050
|
-
window.addEventListener("resize", handleResize);
|
|
2051
|
-
return () => window.removeEventListener("resize", handleResize);
|
|
2052
|
-
}, [
|
|
2053
|
-
handleResize
|
|
2054
|
-
]);
|
|
2055
|
-
return /* @__PURE__ */ React27.createElement(MainProvider, {
|
|
2056
|
-
...props,
|
|
2057
|
-
navigationSidebarState,
|
|
2058
|
-
setNavigationSidebarState,
|
|
2059
|
-
complementarySidebarState,
|
|
2060
|
-
setComplementarySidebarState,
|
|
2061
|
-
resizing
|
|
2062
|
-
}, children);
|
|
2063
|
-
};
|
|
2064
|
-
MainRoot.displayName = MAIN_ROOT_NAME;
|
|
2065
|
-
var handleOpenAutoFocus = (event) => {
|
|
2066
|
-
!document.body.hasAttribute("data-is-keyboard") && event.preventDefault();
|
|
2067
|
-
};
|
|
2068
|
-
var MainSidebar = /* @__PURE__ */ forwardRef19(({ classNames, children, swipeToDismiss, onOpenAutoFocus, state, resizing, onStateChange, side, label, ...props }, forwardedRef) => {
|
|
2069
|
-
const [isLg] = useMediaQuery("lg", {
|
|
2070
|
-
ssr: false
|
|
2591
|
+
});
|
|
2592
|
+
DropdownMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;
|
|
2593
|
+
var RADIO_GROUP_NAME = "DropdownMenuRadioGroup";
|
|
2594
|
+
var DropdownMenuRadioGroup = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
|
|
2595
|
+
const { __scopeDropdownMenu, ...radioGroupProps } = props;
|
|
2596
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
2597
|
+
return /* @__PURE__ */ React27.createElement(MenuPrimitive.RadioGroup, {
|
|
2598
|
+
...menuScope,
|
|
2599
|
+
...radioGroupProps,
|
|
2600
|
+
ref: forwardedRef
|
|
2071
2601
|
});
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2602
|
+
});
|
|
2603
|
+
DropdownMenuRadioGroup.displayName = RADIO_GROUP_NAME;
|
|
2604
|
+
var RADIO_ITEM_NAME = "DropdownMenuRadioItem";
|
|
2605
|
+
var DropdownMenuRadioItem = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
|
|
2606
|
+
const { __scopeDropdownMenu, ...radioItemProps } = props;
|
|
2607
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
2608
|
+
return /* @__PURE__ */ React27.createElement(MenuPrimitive.RadioItem, {
|
|
2609
|
+
...menuScope,
|
|
2610
|
+
...radioItemProps,
|
|
2611
|
+
ref: forwardedRef
|
|
2078
2612
|
});
|
|
2079
|
-
const handleKeyDown = useCallback7((event) => {
|
|
2080
|
-
if (event.key === "Escape") {
|
|
2081
|
-
event.target.closest("[data-tabster]")?.focus();
|
|
2082
|
-
}
|
|
2083
|
-
props.onKeyDown?.(event);
|
|
2084
|
-
}, [
|
|
2085
|
-
props.onKeyDown
|
|
2086
|
-
]);
|
|
2087
|
-
const Root5 = isLg ? Primitive9.div : DialogContent2;
|
|
2088
|
-
return /* @__PURE__ */ React27.createElement(DialogRoot2, {
|
|
2089
|
-
open: state !== "closed",
|
|
2090
|
-
"aria-label": toLocalizedString(label, t),
|
|
2091
|
-
modal: false
|
|
2092
|
-
}, !isLg && /* @__PURE__ */ React27.createElement(DialogTitle2, {
|
|
2093
|
-
className: "sr-only"
|
|
2094
|
-
}, toLocalizedString(label, t)), /* @__PURE__ */ React27.createElement(Root5, {
|
|
2095
|
-
...!isLg && {
|
|
2096
|
-
forceMount: true,
|
|
2097
|
-
tabIndex: -1,
|
|
2098
|
-
onOpenAutoFocus: onOpenAutoFocus ?? handleOpenAutoFocus
|
|
2099
|
-
},
|
|
2100
|
-
...props,
|
|
2101
|
-
"data-side": side === "inline-end" ? "ie" : "is",
|
|
2102
|
-
"data-state": state,
|
|
2103
|
-
"data-resizing": resizing ? "true" : "false",
|
|
2104
|
-
className: tx("main.sidebar", "main__sidebar", {}, classNames),
|
|
2105
|
-
onKeyDown: handleKeyDown,
|
|
2106
|
-
...state === "closed" && {
|
|
2107
|
-
inert: "true"
|
|
2108
|
-
},
|
|
2109
|
-
ref
|
|
2110
|
-
}, children));
|
|
2111
2613
|
});
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
resizing,
|
|
2121
|
-
side: "inline-start",
|
|
2614
|
+
DropdownMenuRadioItem.displayName = RADIO_ITEM_NAME;
|
|
2615
|
+
var INDICATOR_NAME = "DropdownMenuItemIndicator";
|
|
2616
|
+
var DropdownMenuItemIndicator = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
|
|
2617
|
+
const { __scopeDropdownMenu, ...itemIndicatorProps } = props;
|
|
2618
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
2619
|
+
return /* @__PURE__ */ React27.createElement(MenuPrimitive.ItemIndicator, {
|
|
2620
|
+
...menuScope,
|
|
2621
|
+
...itemIndicatorProps,
|
|
2122
2622
|
ref: forwardedRef
|
|
2123
2623
|
});
|
|
2124
2624
|
});
|
|
2125
|
-
|
|
2126
|
-
var
|
|
2127
|
-
|
|
2128
|
-
const
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
side: "inline-end",
|
|
2625
|
+
DropdownMenuItemIndicator.displayName = INDICATOR_NAME;
|
|
2626
|
+
var SEPARATOR_NAME = "DropdownMenuSeparator";
|
|
2627
|
+
var DropdownMenuSeparator = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
|
|
2628
|
+
const { __scopeDropdownMenu, classNames, ...separatorProps } = props;
|
|
2629
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
2630
|
+
const { tx } = useThemeContext();
|
|
2631
|
+
return /* @__PURE__ */ React27.createElement(MenuPrimitive.Separator, {
|
|
2632
|
+
...menuScope,
|
|
2633
|
+
...separatorProps,
|
|
2634
|
+
className: tx("menu.separator", "menu__item", {}, classNames),
|
|
2136
2635
|
ref: forwardedRef
|
|
2137
2636
|
});
|
|
2138
2637
|
});
|
|
2139
|
-
|
|
2140
|
-
var
|
|
2141
|
-
|
|
2638
|
+
DropdownMenuSeparator.displayName = SEPARATOR_NAME;
|
|
2639
|
+
var ARROW_NAME2 = "DropdownMenuArrow";
|
|
2640
|
+
var DropdownMenuArrow = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
|
|
2641
|
+
const { __scopeDropdownMenu, classNames, ...arrowProps } = props;
|
|
2642
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
2142
2643
|
const { tx } = useThemeContext();
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
...handlesFocus && {
|
|
2148
|
-
...mover
|
|
2149
|
-
},
|
|
2150
|
-
...props,
|
|
2151
|
-
"data-sidebar-inline-start-state": navigationSidebarState,
|
|
2152
|
-
"data-sidebar-inline-end-state": complementarySidebarState,
|
|
2153
|
-
className: tx("main.content", "main", {
|
|
2154
|
-
bounce,
|
|
2155
|
-
handlesFocus
|
|
2156
|
-
}, classNames),
|
|
2644
|
+
return /* @__PURE__ */ React27.createElement(MenuPrimitive.Arrow, {
|
|
2645
|
+
...menuScope,
|
|
2646
|
+
...arrowProps,
|
|
2647
|
+
className: tx("menu.arrow", "menu__arrow", {}, classNames),
|
|
2157
2648
|
ref: forwardedRef
|
|
2158
|
-
}
|
|
2649
|
+
});
|
|
2159
2650
|
});
|
|
2160
|
-
|
|
2161
|
-
var
|
|
2162
|
-
const
|
|
2163
|
-
|
|
2651
|
+
DropdownMenuArrow.displayName = ARROW_NAME2;
|
|
2652
|
+
var DropdownMenuSub = (props) => {
|
|
2653
|
+
const { __scopeDropdownMenu, children, open: openProp, onOpenChange, defaultOpen } = props;
|
|
2654
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
2655
|
+
const [open = false, setOpen] = useControllableState5({
|
|
2656
|
+
prop: openProp,
|
|
2657
|
+
defaultProp: defaultOpen,
|
|
2658
|
+
onChange: onOpenChange
|
|
2164
2659
|
});
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
"data-state": navigationSidebarState === "expanded" || complementarySidebarState === "expanded" ? "open" : "closed",
|
|
2179
|
-
"aria-hidden": "true",
|
|
2660
|
+
return /* @__PURE__ */ React27.createElement(MenuPrimitive.Sub, {
|
|
2661
|
+
...menuScope,
|
|
2662
|
+
open,
|
|
2663
|
+
onOpenChange: setOpen
|
|
2664
|
+
}, children);
|
|
2665
|
+
};
|
|
2666
|
+
var SUB_TRIGGER_NAME = "DropdownMenuSubTrigger";
|
|
2667
|
+
var DropdownMenuSubTrigger = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
|
|
2668
|
+
const { __scopeDropdownMenu, ...subTriggerProps } = props;
|
|
2669
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
2670
|
+
return /* @__PURE__ */ React27.createElement(MenuPrimitive.SubTrigger, {
|
|
2671
|
+
...menuScope,
|
|
2672
|
+
...subTriggerProps,
|
|
2180
2673
|
ref: forwardedRef
|
|
2181
2674
|
});
|
|
2182
2675
|
});
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2676
|
+
DropdownMenuSubTrigger.displayName = SUB_TRIGGER_NAME;
|
|
2677
|
+
var SUB_CONTENT_NAME = "DropdownMenuSubContent";
|
|
2678
|
+
var DropdownMenuSubContent = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
|
|
2679
|
+
const { __scopeDropdownMenu, ...subContentProps } = props;
|
|
2680
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
2681
|
+
return /* @__PURE__ */ React27.createElement(MenuPrimitive.SubContent, {
|
|
2682
|
+
...menuScope,
|
|
2683
|
+
...subContentProps,
|
|
2684
|
+
ref: forwardedRef,
|
|
2685
|
+
style: {
|
|
2686
|
+
...props.style,
|
|
2687
|
+
// re-namespace exposed content custom properties
|
|
2688
|
+
...{
|
|
2689
|
+
"--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
2690
|
+
"--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
|
|
2691
|
+
"--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
|
|
2692
|
+
"--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
|
|
2693
|
+
"--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
|
|
2694
|
+
}
|
|
2695
|
+
}
|
|
2696
|
+
});
|
|
2697
|
+
});
|
|
2698
|
+
DropdownMenuSubContent.displayName = SUB_CONTENT_NAME;
|
|
2699
|
+
var DropdownMenu = {
|
|
2700
|
+
Root: DropdownMenuRoot,
|
|
2701
|
+
Trigger: DropdownMenuTrigger,
|
|
2702
|
+
VirtualTrigger: DropdownMenuVirtualTrigger,
|
|
2703
|
+
Portal: DropdownMenuPortal,
|
|
2704
|
+
Content: DropdownMenuContent,
|
|
2705
|
+
Viewport: DropdownMenuViewport,
|
|
2706
|
+
Group: DropdownMenuGroup,
|
|
2707
|
+
GroupLabel: DropdownMenuGroupLabel,
|
|
2708
|
+
Item: DropdownMenuItem,
|
|
2709
|
+
CheckboxItem: DropdownMenuCheckboxItem,
|
|
2710
|
+
RadioGroup: DropdownMenuRadioGroup,
|
|
2711
|
+
RadioItem: DropdownMenuRadioItem,
|
|
2712
|
+
ItemIndicator: DropdownMenuItemIndicator,
|
|
2713
|
+
Separator: DropdownMenuSeparator,
|
|
2714
|
+
Arrow: DropdownMenuArrow,
|
|
2715
|
+
Sub: DropdownMenuSub,
|
|
2716
|
+
SubTrigger: DropdownMenuSubTrigger,
|
|
2717
|
+
SubContent: DropdownMenuSubContent
|
|
2189
2718
|
};
|
|
2719
|
+
var useDropdownMenuMenuScope = useMenuScope;
|
|
2190
2720
|
|
|
2191
2721
|
// packages/ui/react-ui/src/components/Message/Message.tsx
|
|
2192
2722
|
import { createContext as createContext11 } from "@radix-ui/react-context";
|
|
2193
|
-
import { Primitive as
|
|
2723
|
+
import { Primitive as Primitive11 } from "@radix-ui/react-primitive";
|
|
2194
2724
|
import { Slot as Slot11 } from "@radix-ui/react-slot";
|
|
2195
2725
|
import React28, { forwardRef as forwardRef20 } from "react";
|
|
2196
|
-
import { useId as
|
|
2726
|
+
import { useId as useId4 } from "@dxos/react-hooks";
|
|
2197
2727
|
var MESSAGE_NAME = "Message";
|
|
2198
2728
|
var [MessageProvider, useMessageContext] = createContext11(MESSAGE_NAME);
|
|
2199
2729
|
var MessageRoot = /* @__PURE__ */ forwardRef20(({ asChild, valence, elevation: propsElevation, className, titleId: propsTitleId, descriptionId: propsDescriptionId, children, ...props }, forwardedRef) => {
|
|
2200
2730
|
const { tx } = useThemeContext();
|
|
2201
|
-
const titleId =
|
|
2202
|
-
const descriptionId =
|
|
2731
|
+
const titleId = useId4("message__title", propsTitleId);
|
|
2732
|
+
const descriptionId = useId4("message__description", propsDescriptionId);
|
|
2203
2733
|
const elevation = useElevationContext(propsElevation);
|
|
2204
|
-
const
|
|
2734
|
+
const Root7 = asChild ? Slot11 : Primitive11.div;
|
|
2205
2735
|
return /* @__PURE__ */ React28.createElement(MessageProvider, {
|
|
2206
2736
|
titleId,
|
|
2207
2737
|
descriptionId
|
|
2208
|
-
}, /* @__PURE__ */ React28.createElement(
|
|
2738
|
+
}, /* @__PURE__ */ React28.createElement(Root7, {
|
|
2209
2739
|
...props,
|
|
2210
2740
|
className: tx("message.root", "message", {
|
|
2211
2741
|
valence,
|
|
@@ -2221,8 +2751,8 @@ var MESSAGE_TITLE_NAME = "MessageTitle";
|
|
|
2221
2751
|
var MessageTitle = /* @__PURE__ */ forwardRef20(({ asChild, className, children, ...props }, forwardedRef) => {
|
|
2222
2752
|
const { tx } = useThemeContext();
|
|
2223
2753
|
const { titleId } = useMessageContext(MESSAGE_TITLE_NAME);
|
|
2224
|
-
const
|
|
2225
|
-
return /* @__PURE__ */ React28.createElement(
|
|
2754
|
+
const Root7 = asChild ? Slot11 : Primitive11.h2;
|
|
2755
|
+
return /* @__PURE__ */ React28.createElement(Root7, {
|
|
2226
2756
|
...props,
|
|
2227
2757
|
className: tx("message.title", "message__title", {}, className),
|
|
2228
2758
|
id: titleId,
|
|
@@ -2234,8 +2764,8 @@ var MESSAGE_BODY_NAME = "MessageBody";
|
|
|
2234
2764
|
var MessageBody = /* @__PURE__ */ forwardRef20(({ asChild, className, children, ...props }, forwardedRef) => {
|
|
2235
2765
|
const { tx } = useThemeContext();
|
|
2236
2766
|
const { descriptionId } = useMessageContext(MESSAGE_BODY_NAME);
|
|
2237
|
-
const
|
|
2238
|
-
return /* @__PURE__ */ React28.createElement(
|
|
2767
|
+
const Root7 = asChild ? Slot11 : Primitive11.p;
|
|
2768
|
+
return /* @__PURE__ */ React28.createElement(Root7, {
|
|
2239
2769
|
...props,
|
|
2240
2770
|
className: tx("message.body", "message__body", {}, className),
|
|
2241
2771
|
id: descriptionId,
|
|
@@ -2250,51 +2780,51 @@ var Message = {
|
|
|
2250
2780
|
};
|
|
2251
2781
|
|
|
2252
2782
|
// packages/ui/react-ui/src/components/Popover/Popover.tsx
|
|
2253
|
-
import { composeEventHandlers as
|
|
2254
|
-
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
2255
|
-
import { createContextScope as
|
|
2256
|
-
import { DismissableLayer } from "@radix-ui/react-dismissable-layer";
|
|
2783
|
+
import { composeEventHandlers as composeEventHandlers3 } from "@radix-ui/primitive";
|
|
2784
|
+
import { useComposedRefs as useComposedRefs2 } from "@radix-ui/react-compose-refs";
|
|
2785
|
+
import { createContextScope as createContextScope4 } from "@radix-ui/react-context";
|
|
2786
|
+
import { DismissableLayer as DismissableLayer2 } from "@radix-ui/react-dismissable-layer";
|
|
2257
2787
|
import { useFocusGuards } from "@radix-ui/react-focus-guards";
|
|
2258
2788
|
import { FocusScope } from "@radix-ui/react-focus-scope";
|
|
2259
|
-
import { useId as
|
|
2260
|
-
import * as
|
|
2261
|
-
import { createPopperScope } from "@radix-ui/react-popper";
|
|
2262
|
-
import { Portal as
|
|
2263
|
-
import { Presence } from "@radix-ui/react-presence";
|
|
2264
|
-
import { Primitive as
|
|
2789
|
+
import { useId as useId5 } from "@radix-ui/react-id";
|
|
2790
|
+
import * as PopperPrimitive2 from "@radix-ui/react-popper";
|
|
2791
|
+
import { createPopperScope as createPopperScope2 } from "@radix-ui/react-popper";
|
|
2792
|
+
import { Portal as PortalPrimitive2 } from "@radix-ui/react-portal";
|
|
2793
|
+
import { Presence as Presence2 } from "@radix-ui/react-presence";
|
|
2794
|
+
import { Primitive as Primitive12 } from "@radix-ui/react-primitive";
|
|
2265
2795
|
import { Slot as Slot12 } from "@radix-ui/react-slot";
|
|
2266
|
-
import { useControllableState as
|
|
2796
|
+
import { useControllableState as useControllableState6 } from "@radix-ui/react-use-controllable-state";
|
|
2267
2797
|
import { hideOthers } from "aria-hidden";
|
|
2268
|
-
import React29, { forwardRef as forwardRef21, useRef as
|
|
2798
|
+
import React29, { forwardRef as forwardRef21, useRef as useRef4, useCallback as useCallback9, useState as useState8, useEffect as useEffect7 } from "react";
|
|
2269
2799
|
import { RemoveScroll } from "react-remove-scroll";
|
|
2270
2800
|
var POPOVER_NAME = "Popover";
|
|
2271
|
-
var [createPopoverContext, createPopoverScope] =
|
|
2272
|
-
|
|
2801
|
+
var [createPopoverContext, createPopoverScope] = createContextScope4(POPOVER_NAME, [
|
|
2802
|
+
createPopperScope2
|
|
2273
2803
|
]);
|
|
2274
|
-
var
|
|
2804
|
+
var usePopperScope2 = createPopperScope2();
|
|
2275
2805
|
var [PopoverProvider, usePopoverContext] = createPopoverContext(POPOVER_NAME);
|
|
2276
2806
|
var PopoverRoot = (props) => {
|
|
2277
2807
|
const { __scopePopover, children, open: openProp, defaultOpen, onOpenChange, modal = false } = props;
|
|
2278
|
-
const popperScope =
|
|
2279
|
-
const triggerRef =
|
|
2280
|
-
const [hasCustomAnchor, setHasCustomAnchor] =
|
|
2281
|
-
const [open = false, setOpen] =
|
|
2808
|
+
const popperScope = usePopperScope2(__scopePopover);
|
|
2809
|
+
const triggerRef = useRef4(null);
|
|
2810
|
+
const [hasCustomAnchor, setHasCustomAnchor] = useState8(false);
|
|
2811
|
+
const [open = false, setOpen] = useControllableState6({
|
|
2282
2812
|
prop: openProp,
|
|
2283
2813
|
defaultProp: defaultOpen,
|
|
2284
2814
|
onChange: onOpenChange
|
|
2285
2815
|
});
|
|
2286
|
-
return /* @__PURE__ */ React29.createElement(
|
|
2816
|
+
return /* @__PURE__ */ React29.createElement(PopperPrimitive2.Root, popperScope, /* @__PURE__ */ React29.createElement(PopoverProvider, {
|
|
2287
2817
|
scope: __scopePopover,
|
|
2288
|
-
contentId:
|
|
2818
|
+
contentId: useId5(),
|
|
2289
2819
|
triggerRef,
|
|
2290
2820
|
open,
|
|
2291
2821
|
onOpenChange: setOpen,
|
|
2292
|
-
onOpenToggle:
|
|
2822
|
+
onOpenToggle: useCallback9(() => setOpen((prevOpen) => !prevOpen), [
|
|
2293
2823
|
setOpen
|
|
2294
2824
|
]),
|
|
2295
2825
|
hasCustomAnchor,
|
|
2296
|
-
onCustomAnchorAdd:
|
|
2297
|
-
onCustomAnchorRemove:
|
|
2826
|
+
onCustomAnchorAdd: useCallback9(() => setHasCustomAnchor(true), []),
|
|
2827
|
+
onCustomAnchorRemove: useCallback9(() => setHasCustomAnchor(false), []),
|
|
2298
2828
|
modal
|
|
2299
2829
|
}, children));
|
|
2300
2830
|
};
|
|
@@ -2303,29 +2833,29 @@ var ANCHOR_NAME = "PopoverAnchor";
|
|
|
2303
2833
|
var PopoverAnchor = /* @__PURE__ */ forwardRef21((props, forwardedRef) => {
|
|
2304
2834
|
const { __scopePopover, ...anchorProps } = props;
|
|
2305
2835
|
const context = usePopoverContext(ANCHOR_NAME, __scopePopover);
|
|
2306
|
-
const popperScope =
|
|
2836
|
+
const popperScope = usePopperScope2(__scopePopover);
|
|
2307
2837
|
const { onCustomAnchorAdd, onCustomAnchorRemove } = context;
|
|
2308
|
-
|
|
2838
|
+
useEffect7(() => {
|
|
2309
2839
|
onCustomAnchorAdd();
|
|
2310
2840
|
return () => onCustomAnchorRemove();
|
|
2311
2841
|
}, [
|
|
2312
2842
|
onCustomAnchorAdd,
|
|
2313
2843
|
onCustomAnchorRemove
|
|
2314
2844
|
]);
|
|
2315
|
-
return /* @__PURE__ */ React29.createElement(
|
|
2845
|
+
return /* @__PURE__ */ React29.createElement(PopperPrimitive2.Anchor, {
|
|
2316
2846
|
...popperScope,
|
|
2317
2847
|
...anchorProps,
|
|
2318
2848
|
ref: forwardedRef
|
|
2319
2849
|
});
|
|
2320
2850
|
});
|
|
2321
2851
|
PopoverAnchor.displayName = ANCHOR_NAME;
|
|
2322
|
-
var
|
|
2852
|
+
var TRIGGER_NAME3 = "PopoverTrigger";
|
|
2323
2853
|
var PopoverTrigger = /* @__PURE__ */ forwardRef21((props, forwardedRef) => {
|
|
2324
2854
|
const { __scopePopover, ...triggerProps } = props;
|
|
2325
|
-
const context = usePopoverContext(
|
|
2326
|
-
const popperScope =
|
|
2327
|
-
const composedTriggerRef =
|
|
2328
|
-
const trigger = /* @__PURE__ */ React29.createElement(
|
|
2855
|
+
const context = usePopoverContext(TRIGGER_NAME3, __scopePopover);
|
|
2856
|
+
const popperScope = usePopperScope2(__scopePopover);
|
|
2857
|
+
const composedTriggerRef = useComposedRefs2(forwardedRef, context.triggerRef);
|
|
2858
|
+
const trigger = /* @__PURE__ */ React29.createElement(Primitive12.button, {
|
|
2329
2859
|
type: "button",
|
|
2330
2860
|
"aria-haspopup": "dialog",
|
|
2331
2861
|
"aria-expanded": context.open,
|
|
@@ -2333,54 +2863,54 @@ var PopoverTrigger = /* @__PURE__ */ forwardRef21((props, forwardedRef) => {
|
|
|
2333
2863
|
"data-state": getState(context.open),
|
|
2334
2864
|
...triggerProps,
|
|
2335
2865
|
ref: composedTriggerRef,
|
|
2336
|
-
onClick:
|
|
2866
|
+
onClick: composeEventHandlers3(props.onClick, context.onOpenToggle)
|
|
2337
2867
|
});
|
|
2338
|
-
return context.hasCustomAnchor ? trigger : /* @__PURE__ */ React29.createElement(
|
|
2868
|
+
return context.hasCustomAnchor ? trigger : /* @__PURE__ */ React29.createElement(PopperPrimitive2.Anchor, {
|
|
2339
2869
|
asChild: true,
|
|
2340
2870
|
...popperScope
|
|
2341
2871
|
}, trigger);
|
|
2342
2872
|
});
|
|
2343
|
-
PopoverTrigger.displayName =
|
|
2873
|
+
PopoverTrigger.displayName = TRIGGER_NAME3;
|
|
2344
2874
|
var VIRTUAL_TRIGGER_NAME2 = "PopoverVirtualTrigger";
|
|
2345
2875
|
var PopoverVirtualTrigger = (props) => {
|
|
2346
2876
|
const { __scopePopover, virtualRef } = props;
|
|
2347
2877
|
const context = usePopoverContext(VIRTUAL_TRIGGER_NAME2, __scopePopover);
|
|
2348
|
-
const popperScope =
|
|
2349
|
-
|
|
2878
|
+
const popperScope = usePopperScope2(__scopePopover);
|
|
2879
|
+
useEffect7(() => {
|
|
2350
2880
|
if (virtualRef.current) {
|
|
2351
2881
|
context.triggerRef.current = virtualRef.current;
|
|
2352
2882
|
}
|
|
2353
2883
|
});
|
|
2354
|
-
return /* @__PURE__ */ React29.createElement(
|
|
2884
|
+
return /* @__PURE__ */ React29.createElement(PopperPrimitive2.Anchor, {
|
|
2355
2885
|
...popperScope,
|
|
2356
2886
|
virtualRef
|
|
2357
2887
|
});
|
|
2358
2888
|
};
|
|
2359
2889
|
PopoverVirtualTrigger.displayName = VIRTUAL_TRIGGER_NAME2;
|
|
2360
|
-
var
|
|
2361
|
-
var [
|
|
2890
|
+
var PORTAL_NAME3 = "PopoverPortal";
|
|
2891
|
+
var [PortalProvider2, usePortalContext2] = createPopoverContext(PORTAL_NAME3, {
|
|
2362
2892
|
forceMount: void 0
|
|
2363
2893
|
});
|
|
2364
2894
|
var PopoverPortal = (props) => {
|
|
2365
2895
|
const { __scopePopover, forceMount, children, container } = props;
|
|
2366
|
-
const context = usePopoverContext(
|
|
2367
|
-
return /* @__PURE__ */ React29.createElement(
|
|
2896
|
+
const context = usePopoverContext(PORTAL_NAME3, __scopePopover);
|
|
2897
|
+
return /* @__PURE__ */ React29.createElement(PortalProvider2, {
|
|
2368
2898
|
scope: __scopePopover,
|
|
2369
2899
|
forceMount
|
|
2370
|
-
}, /* @__PURE__ */ React29.createElement(
|
|
2900
|
+
}, /* @__PURE__ */ React29.createElement(Presence2, {
|
|
2371
2901
|
present: forceMount || context.open
|
|
2372
|
-
}, /* @__PURE__ */ React29.createElement(
|
|
2902
|
+
}, /* @__PURE__ */ React29.createElement(PortalPrimitive2, {
|
|
2373
2903
|
asChild: true,
|
|
2374
2904
|
container
|
|
2375
2905
|
}, children)));
|
|
2376
2906
|
};
|
|
2377
|
-
PopoverPortal.displayName =
|
|
2378
|
-
var
|
|
2907
|
+
PopoverPortal.displayName = PORTAL_NAME3;
|
|
2908
|
+
var CONTENT_NAME3 = "PopoverContent";
|
|
2379
2909
|
var PopoverContent = /* @__PURE__ */ forwardRef21((props, forwardedRef) => {
|
|
2380
|
-
const portalContext =
|
|
2910
|
+
const portalContext = usePortalContext2(CONTENT_NAME3, props.__scopePopover);
|
|
2381
2911
|
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
2382
|
-
const context = usePopoverContext(
|
|
2383
|
-
return /* @__PURE__ */ React29.createElement(
|
|
2912
|
+
const context = usePopoverContext(CONTENT_NAME3, props.__scopePopover);
|
|
2913
|
+
return /* @__PURE__ */ React29.createElement(Presence2, {
|
|
2384
2914
|
present: forceMount || context.open
|
|
2385
2915
|
}, context.modal ? /* @__PURE__ */ React29.createElement(PopoverContentModal, {
|
|
2386
2916
|
...contentProps,
|
|
@@ -2390,13 +2920,13 @@ var PopoverContent = /* @__PURE__ */ forwardRef21((props, forwardedRef) => {
|
|
|
2390
2920
|
ref: forwardedRef
|
|
2391
2921
|
}));
|
|
2392
2922
|
});
|
|
2393
|
-
PopoverContent.displayName =
|
|
2923
|
+
PopoverContent.displayName = CONTENT_NAME3;
|
|
2394
2924
|
var PopoverContentModal = /* @__PURE__ */ forwardRef21((props, forwardedRef) => {
|
|
2395
|
-
const context = usePopoverContext(
|
|
2396
|
-
const contentRef =
|
|
2397
|
-
const composedRefs =
|
|
2398
|
-
const isRightClickOutsideRef =
|
|
2399
|
-
|
|
2925
|
+
const context = usePopoverContext(CONTENT_NAME3, props.__scopePopover);
|
|
2926
|
+
const contentRef = useRef4(null);
|
|
2927
|
+
const composedRefs = useComposedRefs2(forwardedRef, contentRef);
|
|
2928
|
+
const isRightClickOutsideRef = useRef4(false);
|
|
2929
|
+
useEffect7(() => {
|
|
2400
2930
|
const content = contentRef.current;
|
|
2401
2931
|
if (content) {
|
|
2402
2932
|
return hideOthers(content);
|
|
@@ -2412,13 +2942,13 @@ var PopoverContentModal = /* @__PURE__ */ forwardRef21((props, forwardedRef) =>
|
|
|
2412
2942
|
// (closed !== unmounted when animating out)
|
|
2413
2943
|
trapFocus: context.open,
|
|
2414
2944
|
disableOutsidePointerEvents: true,
|
|
2415
|
-
onCloseAutoFocus:
|
|
2945
|
+
onCloseAutoFocus: composeEventHandlers3(props.onCloseAutoFocus, (event) => {
|
|
2416
2946
|
event.preventDefault();
|
|
2417
2947
|
if (!isRightClickOutsideRef.current) {
|
|
2418
2948
|
context.triggerRef.current?.focus();
|
|
2419
2949
|
}
|
|
2420
2950
|
}),
|
|
2421
|
-
onPointerDownOutside:
|
|
2951
|
+
onPointerDownOutside: composeEventHandlers3(props.onPointerDownOutside, (event) => {
|
|
2422
2952
|
const originalEvent = event.detail.originalEvent;
|
|
2423
2953
|
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
2424
2954
|
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
@@ -2428,15 +2958,15 @@ var PopoverContentModal = /* @__PURE__ */ forwardRef21((props, forwardedRef) =>
|
|
|
2428
2958
|
}),
|
|
2429
2959
|
// When focus is trapped, a `focusout` event may still happen.
|
|
2430
2960
|
// We make sure we don't trigger our `onDismiss` in such case.
|
|
2431
|
-
onFocusOutside:
|
|
2961
|
+
onFocusOutside: composeEventHandlers3(props.onFocusOutside, (event) => event.preventDefault(), {
|
|
2432
2962
|
checkForDefaultPrevented: false
|
|
2433
2963
|
})
|
|
2434
2964
|
}));
|
|
2435
2965
|
});
|
|
2436
2966
|
var PopoverContentNonModal = /* @__PURE__ */ forwardRef21((props, forwardedRef) => {
|
|
2437
|
-
const context = usePopoverContext(
|
|
2438
|
-
const hasInteractedOutsideRef =
|
|
2439
|
-
const hasPointerDownOutsideRef =
|
|
2967
|
+
const context = usePopoverContext(CONTENT_NAME3, props.__scopePopover);
|
|
2968
|
+
const hasInteractedOutsideRef = useRef4(false);
|
|
2969
|
+
const hasPointerDownOutsideRef = useRef4(false);
|
|
2440
2970
|
return /* @__PURE__ */ React29.createElement(PopoverContentImpl, {
|
|
2441
2971
|
...props,
|
|
2442
2972
|
ref: forwardedRef,
|
|
@@ -2474,8 +3004,8 @@ var PopoverContentNonModal = /* @__PURE__ */ forwardRef21((props, forwardedRef)
|
|
|
2474
3004
|
});
|
|
2475
3005
|
var PopoverContentImpl = /* @__PURE__ */ forwardRef21((props, forwardedRef) => {
|
|
2476
3006
|
const { __scopePopover, trapFocus, onOpenAutoFocus, onCloseAutoFocus, disableOutsidePointerEvents, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, collisionPadding = 8, classNames, ...contentProps } = props;
|
|
2477
|
-
const context = usePopoverContext(
|
|
2478
|
-
const popperScope =
|
|
3007
|
+
const context = usePopoverContext(CONTENT_NAME3, __scopePopover);
|
|
3008
|
+
const popperScope = usePopperScope2(__scopePopover);
|
|
2479
3009
|
const { tx } = useThemeContext();
|
|
2480
3010
|
const elevation = useElevationContext();
|
|
2481
3011
|
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
@@ -2486,7 +3016,7 @@ var PopoverContentImpl = /* @__PURE__ */ forwardRef21((props, forwardedRef) => {
|
|
|
2486
3016
|
trapped: trapFocus,
|
|
2487
3017
|
onMountAutoFocus: onOpenAutoFocus,
|
|
2488
3018
|
onUnmountAutoFocus: onCloseAutoFocus
|
|
2489
|
-
}, /* @__PURE__ */ React29.createElement(
|
|
3019
|
+
}, /* @__PURE__ */ React29.createElement(DismissableLayer2, {
|
|
2490
3020
|
asChild: true,
|
|
2491
3021
|
disableOutsidePointerEvents,
|
|
2492
3022
|
onInteractOutside,
|
|
@@ -2494,7 +3024,7 @@ var PopoverContentImpl = /* @__PURE__ */ forwardRef21((props, forwardedRef) => {
|
|
|
2494
3024
|
onPointerDownOutside,
|
|
2495
3025
|
onFocusOutside,
|
|
2496
3026
|
onDismiss: () => context.onOpenChange(false)
|
|
2497
|
-
}, /* @__PURE__ */ React29.createElement(
|
|
3027
|
+
}, /* @__PURE__ */ React29.createElement(PopperPrimitive2.Content, {
|
|
2498
3028
|
"data-state": getState(context.open),
|
|
2499
3029
|
role: "dialog",
|
|
2500
3030
|
id: context.contentId,
|
|
@@ -2522,31 +3052,31 @@ var CLOSE_NAME = "PopoverClose";
|
|
|
2522
3052
|
var PopoverClose = /* @__PURE__ */ forwardRef21((props, forwardedRef) => {
|
|
2523
3053
|
const { __scopePopover, ...closeProps } = props;
|
|
2524
3054
|
const context = usePopoverContext(CLOSE_NAME, __scopePopover);
|
|
2525
|
-
return /* @__PURE__ */ React29.createElement(
|
|
3055
|
+
return /* @__PURE__ */ React29.createElement(Primitive12.button, {
|
|
2526
3056
|
type: "button",
|
|
2527
3057
|
...closeProps,
|
|
2528
3058
|
ref: forwardedRef,
|
|
2529
|
-
onClick:
|
|
3059
|
+
onClick: composeEventHandlers3(props.onClick, () => context.onOpenChange(false))
|
|
2530
3060
|
});
|
|
2531
3061
|
});
|
|
2532
3062
|
PopoverClose.displayName = CLOSE_NAME;
|
|
2533
|
-
var
|
|
3063
|
+
var ARROW_NAME3 = "PopoverArrow";
|
|
2534
3064
|
var PopoverArrow = /* @__PURE__ */ forwardRef21((props, forwardedRef) => {
|
|
2535
3065
|
const { __scopePopover, classNames, ...arrowProps } = props;
|
|
2536
|
-
const popperScope =
|
|
3066
|
+
const popperScope = usePopperScope2(__scopePopover);
|
|
2537
3067
|
const { tx } = useThemeContext();
|
|
2538
|
-
return /* @__PURE__ */ React29.createElement(
|
|
3068
|
+
return /* @__PURE__ */ React29.createElement(PopperPrimitive2.Arrow, {
|
|
2539
3069
|
...popperScope,
|
|
2540
3070
|
...arrowProps,
|
|
2541
3071
|
className: tx("popover.arrow", "popover__arrow", {}, classNames),
|
|
2542
3072
|
ref: forwardedRef
|
|
2543
3073
|
});
|
|
2544
3074
|
});
|
|
2545
|
-
PopoverArrow.displayName =
|
|
3075
|
+
PopoverArrow.displayName = ARROW_NAME3;
|
|
2546
3076
|
var PopoverViewport = /* @__PURE__ */ forwardRef21(({ classNames, asChild, constrainInline = true, constrainBlock = true, children, ...props }, forwardedRef) => {
|
|
2547
3077
|
const { tx } = useThemeContext();
|
|
2548
|
-
const
|
|
2549
|
-
return /* @__PURE__ */ React29.createElement(
|
|
3078
|
+
const Root7 = asChild ? Slot12 : Primitive12.div;
|
|
3079
|
+
return /* @__PURE__ */ React29.createElement(Root7, {
|
|
2550
3080
|
...props,
|
|
2551
3081
|
className: tx("popover.viewport", "popover__viewport", {
|
|
2552
3082
|
constrainInline,
|
|
@@ -2797,13 +3327,13 @@ var Separator4 = /* @__PURE__ */ forwardRef25(({ classNames, orientation = "hori
|
|
|
2797
3327
|
});
|
|
2798
3328
|
|
|
2799
3329
|
// packages/ui/react-ui/src/components/Tag/Tag.tsx
|
|
2800
|
-
import { Primitive as
|
|
3330
|
+
import { Primitive as Primitive13 } from "@radix-ui/react-primitive";
|
|
2801
3331
|
import { Slot as Slot13 } from "@radix-ui/react-slot";
|
|
2802
3332
|
import React34, { forwardRef as forwardRef26 } from "react";
|
|
2803
3333
|
var Tag = /* @__PURE__ */ forwardRef26(({ asChild, palette = "neutral", classNames, ...props }, forwardedRef) => {
|
|
2804
3334
|
const { tx } = useThemeContext();
|
|
2805
|
-
const
|
|
2806
|
-
return /* @__PURE__ */ React34.createElement(
|
|
3335
|
+
const Root7 = asChild ? Slot13 : Primitive13.span;
|
|
3336
|
+
return /* @__PURE__ */ React34.createElement(Root7, {
|
|
2807
3337
|
...props,
|
|
2808
3338
|
className: tx("tag.root", "dx-tag", {
|
|
2809
3339
|
palette
|
|
@@ -2814,7 +3344,7 @@ var Tag = /* @__PURE__ */ forwardRef26(({ asChild, palette = "neutral", classNam
|
|
|
2814
3344
|
});
|
|
2815
3345
|
|
|
2816
3346
|
// packages/ui/react-ui/src/components/Toast/Toast.tsx
|
|
2817
|
-
import { Primitive as
|
|
3347
|
+
import { Primitive as Primitive14 } from "@radix-ui/react-primitive";
|
|
2818
3348
|
import { Slot as Slot14 } from "@radix-ui/react-slot";
|
|
2819
3349
|
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";
|
|
2820
3350
|
import React35, { forwardRef as forwardRef27 } from "react";
|
|
@@ -2838,8 +3368,8 @@ var ToastRoot = /* @__PURE__ */ forwardRef27(({ classNames, children, ...props }
|
|
|
2838
3368
|
});
|
|
2839
3369
|
var ToastBody = /* @__PURE__ */ forwardRef27(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
2840
3370
|
const { tx } = useThemeContext();
|
|
2841
|
-
const
|
|
2842
|
-
return /* @__PURE__ */ React35.createElement(
|
|
3371
|
+
const Root7 = asChild ? Slot14 : Primitive14.div;
|
|
3372
|
+
return /* @__PURE__ */ React35.createElement(Root7, {
|
|
2843
3373
|
...props,
|
|
2844
3374
|
className: tx("toast.body", "toast__body", {}, classNames),
|
|
2845
3375
|
ref: forwardedRef
|
|
@@ -2847,8 +3377,8 @@ var ToastBody = /* @__PURE__ */ forwardRef27(({ asChild, classNames, ...props },
|
|
|
2847
3377
|
});
|
|
2848
3378
|
var ToastTitle = /* @__PURE__ */ forwardRef27(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
2849
3379
|
const { tx } = useThemeContext();
|
|
2850
|
-
const
|
|
2851
|
-
return /* @__PURE__ */ React35.createElement(
|
|
3380
|
+
const Root7 = asChild ? Slot14 : ToastTitlePrimitive;
|
|
3381
|
+
return /* @__PURE__ */ React35.createElement(Root7, {
|
|
2852
3382
|
...props,
|
|
2853
3383
|
className: tx("toast.title", "toast__title", {}, classNames),
|
|
2854
3384
|
ref: forwardedRef
|
|
@@ -2856,8 +3386,8 @@ var ToastTitle = /* @__PURE__ */ forwardRef27(({ asChild, classNames, ...props }
|
|
|
2856
3386
|
});
|
|
2857
3387
|
var ToastDescription = /* @__PURE__ */ forwardRef27(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
2858
3388
|
const { tx } = useThemeContext();
|
|
2859
|
-
const
|
|
2860
|
-
return /* @__PURE__ */ React35.createElement(
|
|
3389
|
+
const Root7 = asChild ? Slot14 : ToastDescriptionPrimitive;
|
|
3390
|
+
return /* @__PURE__ */ React35.createElement(Root7, {
|
|
2861
3391
|
...props,
|
|
2862
3392
|
className: tx("toast.description", "toast__description", {}, classNames),
|
|
2863
3393
|
ref: forwardedRef
|
|
@@ -2865,8 +3395,8 @@ var ToastDescription = /* @__PURE__ */ forwardRef27(({ asChild, classNames, ...p
|
|
|
2865
3395
|
});
|
|
2866
3396
|
var ToastActions = /* @__PURE__ */ forwardRef27(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
2867
3397
|
const { tx } = useThemeContext();
|
|
2868
|
-
const
|
|
2869
|
-
return /* @__PURE__ */ React35.createElement(
|
|
3398
|
+
const Root7 = asChild ? Slot14 : Primitive14.div;
|
|
3399
|
+
return /* @__PURE__ */ React35.createElement(Root7, {
|
|
2870
3400
|
...props,
|
|
2871
3401
|
className: tx("toast.actions", "toast__actions", {}, classNames),
|
|
2872
3402
|
ref: forwardedRef
|
|
@@ -3036,6 +3566,7 @@ export {
|
|
|
3036
3566
|
Treegrid,
|
|
3037
3567
|
createDropdownMenuScope,
|
|
3038
3568
|
createPopoverScope,
|
|
3569
|
+
createTooltipScope,
|
|
3039
3570
|
hasIosKeyboard,
|
|
3040
3571
|
initialSafeArea,
|
|
3041
3572
|
isLabel,
|
|
@@ -3055,6 +3586,7 @@ export {
|
|
|
3055
3586
|
useSafeArea,
|
|
3056
3587
|
useSidebars,
|
|
3057
3588
|
useThemeContext,
|
|
3589
|
+
useTooltipContext,
|
|
3058
3590
|
useTranslation,
|
|
3059
3591
|
useTranslationsContext,
|
|
3060
3592
|
useVisualViewport
|