@dxos/react-ui 0.8.2-main.5885341 → 0.8.2-main.600d381
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 +839 -307
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +957 -423
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +839 -307
- 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/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/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/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/ScrollArea/ScrollArea.tsx +3 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +41 -16
- package/src/components/Tooltip/Tooltip.tsx +748 -58
- 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),
|
|
@@ -213,10 +213,10 @@ var AvatarContent = /* @__PURE__ */ forwardRef2(({ icon, classNames, ...props },
|
|
|
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
|
|
@@ -885,8 +1393,8 @@ var AlertDialog = {
|
|
|
885
1393
|
|
|
886
1394
|
// packages/ui/react-ui/src/components/Input/Input.tsx
|
|
887
1395
|
import { Root as CheckboxPrimitive } from "@radix-ui/react-checkbox";
|
|
888
|
-
import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
|
889
|
-
import React19, { forwardRef as forwardRef13, useCallback as
|
|
1396
|
+
import { useControllableState as useControllableState2 } from "@radix-ui/react-use-controllable-state";
|
|
1397
|
+
import React19, { forwardRef as forwardRef13, useCallback as useCallback5 } from "react";
|
|
890
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";
|
|
891
1399
|
import { mx as mx3 } from "@dxos/react-ui-theme";
|
|
892
1400
|
var Label = /* @__PURE__ */ forwardRef13(({ srOnly, classNames, children, ...props }, forwardedRef) => {
|
|
@@ -936,7 +1444,7 @@ var PinInput = /* @__PURE__ */ forwardRef13(({ density: propsDensity, elevation:
|
|
|
936
1444
|
const { tx } = useThemeContext();
|
|
937
1445
|
const density = useDensityContext(propsDensity);
|
|
938
1446
|
const elevation = useElevationContext(propsElevation);
|
|
939
|
-
const segmentClassName =
|
|
1447
|
+
const segmentClassName = useCallback5(({ focused, validationValence }) => tx("input.input", "input--pin-segment", {
|
|
940
1448
|
variant: "static",
|
|
941
1449
|
focused,
|
|
942
1450
|
disabled: props.disabled,
|
|
@@ -1006,7 +1514,7 @@ var TextArea = /* @__PURE__ */ forwardRef13(({ __inputScope, classNames, density
|
|
|
1006
1514
|
});
|
|
1007
1515
|
});
|
|
1008
1516
|
var Checkbox = /* @__PURE__ */ forwardRef13(({ __inputScope, checked: propsChecked, defaultChecked: propsDefaultChecked, onCheckedChange: propsOnCheckedChange, size, weight = "bold", classNames, ...props }, forwardedRef) => {
|
|
1009
|
-
const [checked, onCheckedChange] =
|
|
1517
|
+
const [checked, onCheckedChange] = useControllableState2({
|
|
1010
1518
|
prop: propsChecked,
|
|
1011
1519
|
defaultProp: propsDefaultChecked,
|
|
1012
1520
|
onChange: propsOnCheckedChange
|
|
@@ -1036,7 +1544,7 @@ var Checkbox = /* @__PURE__ */ forwardRef13(({ __inputScope, checked: propsCheck
|
|
|
1036
1544
|
}));
|
|
1037
1545
|
});
|
|
1038
1546
|
var Switch = /* @__PURE__ */ forwardRef13(({ __inputScope, checked: propsChecked, defaultChecked: propsDefaultChecked, onCheckedChange: propsOnCheckedChange, classNames, ...props }, forwardedRef) => {
|
|
1039
|
-
const [checked, onCheckedChange] =
|
|
1547
|
+
const [checked, onCheckedChange] = useControllableState2({
|
|
1040
1548
|
prop: propsChecked,
|
|
1041
1549
|
defaultProp: propsDefaultChecked ?? false,
|
|
1042
1550
|
onChange: propsOnCheckedChange
|
|
@@ -1129,10 +1637,10 @@ var List = /* @__PURE__ */ forwardRef14(({ classNames, children, ...props }, for
|
|
|
1129
1637
|
}, children));
|
|
1130
1638
|
});
|
|
1131
1639
|
var ListItemEndcap = /* @__PURE__ */ forwardRef14(({ children, classNames, asChild, ...props }, forwardedRef) => {
|
|
1132
|
-
const
|
|
1640
|
+
const Root7 = asChild ? Slot6 : "div";
|
|
1133
1641
|
const density = useDensityContext();
|
|
1134
1642
|
const { tx } = useThemeContext();
|
|
1135
|
-
return /* @__PURE__ */ React21.createElement(
|
|
1643
|
+
return /* @__PURE__ */ React21.createElement(Root7, {
|
|
1136
1644
|
...!asChild && {
|
|
1137
1645
|
role: "none"
|
|
1138
1646
|
},
|
|
@@ -1292,25 +1800,25 @@ var TreeItem = {
|
|
|
1292
1800
|
|
|
1293
1801
|
// packages/ui/react-ui/src/components/Lists/Treegrid.tsx
|
|
1294
1802
|
import { useArrowNavigationGroup, useFocusableGroup } from "@fluentui/react-tabster";
|
|
1295
|
-
import { createContextScope } from "@radix-ui/react-context";
|
|
1296
|
-
import { Primitive as
|
|
1803
|
+
import { createContextScope as createContextScope2 } from "@radix-ui/react-context";
|
|
1804
|
+
import { Primitive as Primitive7 } from "@radix-ui/react-primitive";
|
|
1297
1805
|
import { Slot as Slot7 } from "@radix-ui/react-slot";
|
|
1298
|
-
import { useControllableState as
|
|
1806
|
+
import { useControllableState as useControllableState3 } from "@radix-ui/react-use-controllable-state";
|
|
1299
1807
|
import React24, { forwardRef as forwardRef16 } from "react";
|
|
1300
1808
|
var TREEGRID_ROW_NAME = "TreegridRow";
|
|
1301
|
-
var [createTreegridRowContext, createTreegridRowScope] =
|
|
1809
|
+
var [createTreegridRowContext, createTreegridRowScope] = createContextScope2(TREEGRID_ROW_NAME, []);
|
|
1302
1810
|
var [TreegridRowProvider, useTreegridRowContext] = createTreegridRowContext(TREEGRID_ROW_NAME);
|
|
1303
1811
|
var PATH_SEPARATOR = "~";
|
|
1304
1812
|
var PARENT_OF_SEPARATOR = " ";
|
|
1305
1813
|
var TreegridRoot = /* @__PURE__ */ forwardRef16(({ asChild, classNames, children, style, gridTemplateColumns, ...props }, forwardedRef) => {
|
|
1306
1814
|
const { tx } = useThemeContext();
|
|
1307
|
-
const
|
|
1815
|
+
const Root7 = asChild ? Slot7 : Primitive7.div;
|
|
1308
1816
|
const arrowNavigationAttrs = useArrowNavigationGroup({
|
|
1309
1817
|
axis: "vertical",
|
|
1310
1818
|
tabbable: false,
|
|
1311
1819
|
circular: true
|
|
1312
1820
|
});
|
|
1313
|
-
return /* @__PURE__ */ React24.createElement(
|
|
1821
|
+
return /* @__PURE__ */ React24.createElement(Root7, {
|
|
1314
1822
|
role: "treegrid",
|
|
1315
1823
|
...arrowNavigationAttrs,
|
|
1316
1824
|
...props,
|
|
@@ -1324,10 +1832,10 @@ var TreegridRoot = /* @__PURE__ */ forwardRef16(({ asChild, classNames, children
|
|
|
1324
1832
|
});
|
|
1325
1833
|
var TreegridRow = /* @__PURE__ */ forwardRef16(({ __treegridRowScope, asChild, classNames, children, id, parentOf, open: propsOpen, defaultOpen, onOpenChange: propsOnOpenChange, ...props }, forwardedRef) => {
|
|
1326
1834
|
const { tx } = useThemeContext();
|
|
1327
|
-
const
|
|
1835
|
+
const Root7 = asChild ? Slot7 : Primitive7.div;
|
|
1328
1836
|
const pathParts = id.split(PATH_SEPARATOR);
|
|
1329
1837
|
const level = pathParts.length - 1;
|
|
1330
|
-
const [open, onOpenChange] =
|
|
1838
|
+
const [open, onOpenChange] = useControllableState3({
|
|
1331
1839
|
prop: propsOpen,
|
|
1332
1840
|
onChange: propsOnOpenChange,
|
|
1333
1841
|
defaultProp: defaultOpen
|
|
@@ -1345,7 +1853,7 @@ var TreegridRow = /* @__PURE__ */ forwardRef16(({ __treegridRowScope, asChild, c
|
|
|
1345
1853
|
open,
|
|
1346
1854
|
onOpenChange,
|
|
1347
1855
|
scope: __treegridRowScope
|
|
1348
|
-
}, /* @__PURE__ */ React24.createElement(
|
|
1856
|
+
}, /* @__PURE__ */ React24.createElement(Root7, {
|
|
1349
1857
|
role: "row",
|
|
1350
1858
|
"aria-level": level,
|
|
1351
1859
|
className: tx("treegrid.row", "treegrid__row", {
|
|
@@ -1390,15 +1898,15 @@ var Treegrid = {
|
|
|
1390
1898
|
// packages/ui/react-ui/src/components/Main/Main.tsx
|
|
1391
1899
|
import { createContext as createContext10 } from "@radix-ui/react-context";
|
|
1392
1900
|
import { Root as DialogRoot2, DialogContent as DialogContent2, DialogTitle as DialogTitle2 } from "@radix-ui/react-dialog";
|
|
1393
|
-
import { Primitive as
|
|
1901
|
+
import { Primitive as Primitive8 } from "@radix-ui/react-primitive";
|
|
1394
1902
|
import { Slot as Slot8 } from "@radix-ui/react-slot";
|
|
1395
|
-
import { useControllableState as
|
|
1396
|
-
import React25, { forwardRef as forwardRef17, useCallback as
|
|
1903
|
+
import { useControllableState as useControllableState4 } from "@radix-ui/react-use-controllable-state";
|
|
1904
|
+
import React25, { forwardRef as forwardRef17, useCallback as useCallback7, useEffect as useEffect5, useRef as useRef2, useState as useState7 } from "react";
|
|
1397
1905
|
import { log } from "@dxos/log";
|
|
1398
1906
|
import { useMediaQuery, useForwardedRef } from "@dxos/react-hooks";
|
|
1399
1907
|
|
|
1400
1908
|
// packages/ui/react-ui/src/components/Main/useSwipeToDismiss.ts
|
|
1401
|
-
import { useCallback as
|
|
1909
|
+
import { useCallback as useCallback6, useEffect as useEffect4, useState as useState6 } from "react";
|
|
1402
1910
|
var MotionState;
|
|
1403
1911
|
(function(MotionState2) {
|
|
1404
1912
|
MotionState2[MotionState2["IDLE"] = 0] = "IDLE";
|
|
@@ -1413,22 +1921,22 @@ var useSwipeToDismiss = (ref, {
|
|
|
1413
1921
|
/* side = 'inline-start' */
|
|
1414
1922
|
}) => {
|
|
1415
1923
|
const $root = ref.current;
|
|
1416
|
-
const [motionState, setMotionState] =
|
|
1417
|
-
const [gestureStartX, setGestureStartX] =
|
|
1418
|
-
const setIdle =
|
|
1924
|
+
const [motionState, setMotionState] = useState6(0);
|
|
1925
|
+
const [gestureStartX, setGestureStartX] = useState6(0);
|
|
1926
|
+
const setIdle = useCallback6(() => {
|
|
1419
1927
|
setMotionState(0);
|
|
1420
1928
|
$root?.style.removeProperty("inset-inline-start");
|
|
1421
1929
|
$root?.style.setProperty("transition-duration", "200ms");
|
|
1422
1930
|
}, [
|
|
1423
1931
|
$root
|
|
1424
1932
|
]);
|
|
1425
|
-
const setFollowing =
|
|
1933
|
+
const setFollowing = useCallback6(() => {
|
|
1426
1934
|
setMotionState(2);
|
|
1427
1935
|
$root?.style.setProperty("transition-duration", "0ms");
|
|
1428
1936
|
}, [
|
|
1429
1937
|
$root
|
|
1430
1938
|
]);
|
|
1431
|
-
const handlePointerDown =
|
|
1939
|
+
const handlePointerDown = useCallback6(({ screenX }) => {
|
|
1432
1940
|
if (motionState === 0) {
|
|
1433
1941
|
setMotionState(1);
|
|
1434
1942
|
setGestureStartX(screenX);
|
|
@@ -1436,7 +1944,7 @@ var useSwipeToDismiss = (ref, {
|
|
|
1436
1944
|
}, [
|
|
1437
1945
|
motionState
|
|
1438
1946
|
]);
|
|
1439
|
-
const handlePointerMove =
|
|
1947
|
+
const handlePointerMove = useCallback6(({ screenX }) => {
|
|
1440
1948
|
if ($root) {
|
|
1441
1949
|
const delta = Math.min(screenX - gestureStartX, 0);
|
|
1442
1950
|
switch (motionState) {
|
|
@@ -1460,12 +1968,12 @@ var useSwipeToDismiss = (ref, {
|
|
|
1460
1968
|
motionState,
|
|
1461
1969
|
gestureStartX
|
|
1462
1970
|
]);
|
|
1463
|
-
const handlePointerUp =
|
|
1971
|
+
const handlePointerUp = useCallback6(() => {
|
|
1464
1972
|
setIdle();
|
|
1465
1973
|
}, [
|
|
1466
1974
|
setIdle
|
|
1467
1975
|
]);
|
|
1468
|
-
|
|
1976
|
+
useEffect4(() => {
|
|
1469
1977
|
$root?.addEventListener("pointerdown", handlePointerDown);
|
|
1470
1978
|
return () => {
|
|
1471
1979
|
$root?.removeEventListener("pointerdown", handlePointerDown);
|
|
@@ -1474,7 +1982,7 @@ var useSwipeToDismiss = (ref, {
|
|
|
1474
1982
|
$root,
|
|
1475
1983
|
handlePointerDown
|
|
1476
1984
|
]);
|
|
1477
|
-
|
|
1985
|
+
useEffect4(() => {
|
|
1478
1986
|
$root && document.documentElement.addEventListener("pointermove", handlePointerMove);
|
|
1479
1987
|
return () => {
|
|
1480
1988
|
document.documentElement.removeEventListener("pointermove", handlePointerMove);
|
|
@@ -1483,7 +1991,7 @@ var useSwipeToDismiss = (ref, {
|
|
|
1483
1991
|
$root,
|
|
1484
1992
|
handlePointerMove
|
|
1485
1993
|
]);
|
|
1486
|
-
|
|
1994
|
+
useEffect4(() => {
|
|
1487
1995
|
$root && document.documentElement.addEventListener("pointerup", handlePointerUp);
|
|
1488
1996
|
return () => {
|
|
1489
1997
|
document.documentElement.removeEventListener("pointerup", handlePointerUp);
|
|
@@ -1503,7 +2011,7 @@ var MAIN_NAME = "Main";
|
|
|
1503
2011
|
var GENERIC_CONSUMER_NAME = "GenericConsumer";
|
|
1504
2012
|
var landmarkAttr = "data-main-landmark";
|
|
1505
2013
|
var useLandmarkMover = (propsOnKeyDown, landmark) => {
|
|
1506
|
-
const handleKeyDown =
|
|
2014
|
+
const handleKeyDown = useCallback7((event) => {
|
|
1507
2015
|
const target = event.target;
|
|
1508
2016
|
if (event.target === event.currentTarget && event.key === "Tab" && target.hasAttribute(landmarkAttr)) {
|
|
1509
2017
|
event.preventDefault();
|
|
@@ -1556,22 +2064,22 @@ var useSidebars = (consumerName = GENERIC_CONSUMER_NAME) => {
|
|
|
1556
2064
|
return {
|
|
1557
2065
|
navigationSidebarState,
|
|
1558
2066
|
setNavigationSidebarState,
|
|
1559
|
-
toggleNavigationSidebar:
|
|
2067
|
+
toggleNavigationSidebar: useCallback7(() => setNavigationSidebarState(navigationSidebarState === "expanded" ? "closed" : "expanded"), [
|
|
1560
2068
|
navigationSidebarState,
|
|
1561
2069
|
setNavigationSidebarState
|
|
1562
2070
|
]),
|
|
1563
|
-
openNavigationSidebar:
|
|
1564
|
-
collapseNavigationSidebar:
|
|
1565
|
-
closeNavigationSidebar:
|
|
2071
|
+
openNavigationSidebar: useCallback7(() => setNavigationSidebarState("expanded"), []),
|
|
2072
|
+
collapseNavigationSidebar: useCallback7(() => setNavigationSidebarState("collapsed"), []),
|
|
2073
|
+
closeNavigationSidebar: useCallback7(() => setNavigationSidebarState("closed"), []),
|
|
1566
2074
|
complementarySidebarState,
|
|
1567
2075
|
setComplementarySidebarState,
|
|
1568
|
-
toggleComplementarySidebar:
|
|
2076
|
+
toggleComplementarySidebar: useCallback7(() => setComplementarySidebarState(complementarySidebarState === "expanded" ? "closed" : "expanded"), [
|
|
1569
2077
|
complementarySidebarState,
|
|
1570
2078
|
setComplementarySidebarState
|
|
1571
2079
|
]),
|
|
1572
|
-
openComplementarySidebar:
|
|
1573
|
-
collapseComplementarySidebar:
|
|
1574
|
-
closeComplementarySidebar:
|
|
2080
|
+
openComplementarySidebar: useCallback7(() => setComplementarySidebarState("expanded"), []),
|
|
2081
|
+
collapseComplementarySidebar: useCallback7(() => setComplementarySidebarState("collapsed"), []),
|
|
2082
|
+
closeComplementarySidebar: useCallback7(() => setComplementarySidebarState("closed"), [])
|
|
1575
2083
|
};
|
|
1576
2084
|
};
|
|
1577
2085
|
var resizeDebounce = 3e3;
|
|
@@ -1579,19 +2087,19 @@ var MainRoot = ({ navigationSidebarState: propsNavigationSidebarState, defaultNa
|
|
|
1579
2087
|
const [isLg] = useMediaQuery("lg", {
|
|
1580
2088
|
ssr: false
|
|
1581
2089
|
});
|
|
1582
|
-
const [navigationSidebarState = isLg ? "expanded" : "collapsed", setNavigationSidebarState] =
|
|
2090
|
+
const [navigationSidebarState = isLg ? "expanded" : "collapsed", setNavigationSidebarState] = useControllableState4({
|
|
1583
2091
|
prop: propsNavigationSidebarState,
|
|
1584
2092
|
defaultProp: defaultNavigationSidebarState,
|
|
1585
2093
|
onChange: onNavigationSidebarStateChange
|
|
1586
2094
|
});
|
|
1587
|
-
const [complementarySidebarState = isLg ? "expanded" : "collapsed", setComplementarySidebarState] =
|
|
2095
|
+
const [complementarySidebarState = isLg ? "expanded" : "collapsed", setComplementarySidebarState] = useControllableState4({
|
|
1588
2096
|
prop: propsComplementarySidebarState,
|
|
1589
2097
|
defaultProp: defaultComplementarySidebarState,
|
|
1590
2098
|
onChange: onComplementarySidebarStateChange
|
|
1591
2099
|
});
|
|
1592
|
-
const [resizing, setResizing] =
|
|
1593
|
-
const resizeInterval =
|
|
1594
|
-
const handleResize =
|
|
2100
|
+
const [resizing, setResizing] = useState7(false);
|
|
2101
|
+
const resizeInterval = useRef2(null);
|
|
2102
|
+
const handleResize = useCallback7(() => {
|
|
1595
2103
|
setResizing(true);
|
|
1596
2104
|
if (resizeInterval.current) {
|
|
1597
2105
|
clearTimeout(resizeInterval.current);
|
|
@@ -1601,7 +2109,7 @@ var MainRoot = ({ navigationSidebarState: propsNavigationSidebarState, defaultNa
|
|
|
1601
2109
|
resizeInterval.current = null;
|
|
1602
2110
|
}, resizeDebounce);
|
|
1603
2111
|
}, []);
|
|
1604
|
-
|
|
2112
|
+
useEffect5(() => {
|
|
1605
2113
|
window.addEventListener("resize", handleResize);
|
|
1606
2114
|
return () => window.removeEventListener("resize", handleResize);
|
|
1607
2115
|
}, [
|
|
@@ -1627,11 +2135,11 @@ var MainSidebar = /* @__PURE__ */ forwardRef17(({ classNames, children, swipeToD
|
|
|
1627
2135
|
const { tx } = useThemeContext();
|
|
1628
2136
|
const { t } = useTranslation();
|
|
1629
2137
|
const ref = useForwardedRef(forwardedRef);
|
|
1630
|
-
const noopRef =
|
|
2138
|
+
const noopRef = useRef2(null);
|
|
1631
2139
|
useSwipeToDismiss(swipeToDismiss ? ref : noopRef, {
|
|
1632
2140
|
onDismiss: () => onStateChange?.("closed")
|
|
1633
2141
|
});
|
|
1634
|
-
const handleKeyDown =
|
|
2142
|
+
const handleKeyDown = useCallback7((event) => {
|
|
1635
2143
|
if (event.key === "Escape") {
|
|
1636
2144
|
event.target.closest("[data-tabster]")?.focus();
|
|
1637
2145
|
}
|
|
@@ -1639,14 +2147,14 @@ var MainSidebar = /* @__PURE__ */ forwardRef17(({ classNames, children, swipeToD
|
|
|
1639
2147
|
}, [
|
|
1640
2148
|
props.onKeyDown
|
|
1641
2149
|
]);
|
|
1642
|
-
const
|
|
2150
|
+
const Root7 = isLg ? Primitive8.div : DialogContent2;
|
|
1643
2151
|
return /* @__PURE__ */ React25.createElement(DialogRoot2, {
|
|
1644
2152
|
open: state !== "closed",
|
|
1645
2153
|
"aria-label": toLocalizedString(label, t),
|
|
1646
2154
|
modal: false
|
|
1647
2155
|
}, !isLg && /* @__PURE__ */ React25.createElement(DialogTitle2, {
|
|
1648
2156
|
className: "sr-only"
|
|
1649
|
-
}, toLocalizedString(label, t)), /* @__PURE__ */ React25.createElement(
|
|
2157
|
+
}, toLocalizedString(label, t)), /* @__PURE__ */ React25.createElement(Root7, {
|
|
1650
2158
|
...!isLg && {
|
|
1651
2159
|
forceMount: true,
|
|
1652
2160
|
tabIndex: -1,
|
|
@@ -1695,9 +2203,9 @@ MainNavigationSidebar.displayName = NAVIGATION_SIDEBAR_NAME;
|
|
|
1695
2203
|
var MainContent = /* @__PURE__ */ forwardRef17(({ asChild, classNames, bounce, handlesFocus, children, role, ...props }, forwardedRef) => {
|
|
1696
2204
|
const { navigationSidebarState, complementarySidebarState } = useMainContext(MAIN_NAME);
|
|
1697
2205
|
const { tx } = useThemeContext();
|
|
1698
|
-
const
|
|
2206
|
+
const Root7 = asChild ? Slot8 : role ? "div" : "main";
|
|
1699
2207
|
const mover = useLandmarkMover(props.onKeyDown, "1");
|
|
1700
|
-
return /* @__PURE__ */ React25.createElement(
|
|
2208
|
+
return /* @__PURE__ */ React25.createElement(Root7, {
|
|
1701
2209
|
role,
|
|
1702
2210
|
...handlesFocus && {
|
|
1703
2211
|
...mover
|
|
@@ -1745,9 +2253,31 @@ var Main = {
|
|
|
1745
2253
|
|
|
1746
2254
|
// packages/ui/react-ui/src/components/Menus/ContextMenu.tsx
|
|
1747
2255
|
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
|
|
1748
|
-
import { Primitive as
|
|
2256
|
+
import { Primitive as Primitive9 } from "@radix-ui/react-primitive";
|
|
1749
2257
|
import { Slot as Slot9 } from "@radix-ui/react-slot";
|
|
1750
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
|
|
1751
2281
|
var ContextMenuRoot = ContextMenuPrimitive.ContextMenu;
|
|
1752
2282
|
var ContextMenuTrigger = ContextMenuPrimitive.Trigger;
|
|
1753
2283
|
var ContextMenuPortal = ContextMenuPrimitive.Portal;
|
|
@@ -1766,8 +2296,8 @@ var ContextMenuContent = /* @__PURE__ */ forwardRef18(({ classNames, children, c
|
|
|
1766
2296
|
});
|
|
1767
2297
|
var ContextMenuViewport = /* @__PURE__ */ forwardRef18(({ classNames, asChild, children, ...props }, forwardedRef) => {
|
|
1768
2298
|
const { tx } = useThemeContext();
|
|
1769
|
-
const
|
|
1770
|
-
return /* @__PURE__ */ React26.createElement(
|
|
2299
|
+
const Root7 = asChild ? Slot9 : Primitive9.div;
|
|
2300
|
+
return /* @__PURE__ */ React26.createElement(Root7, {
|
|
1771
2301
|
...props,
|
|
1772
2302
|
className: tx("menu.viewport", "menu__viewport", {}, classNames),
|
|
1773
2303
|
ref: forwardedRef
|
|
@@ -1831,18 +2361,18 @@ var ContextMenu2 = {
|
|
|
1831
2361
|
};
|
|
1832
2362
|
|
|
1833
2363
|
// packages/ui/react-ui/src/components/Menus/DropdownMenu.tsx
|
|
1834
|
-
import { composeEventHandlers } from "@radix-ui/primitive";
|
|
2364
|
+
import { composeEventHandlers as composeEventHandlers2 } from "@radix-ui/primitive";
|
|
1835
2365
|
import { composeRefs } from "@radix-ui/react-compose-refs";
|
|
1836
|
-
import { createContextScope as
|
|
1837
|
-
import { useId as
|
|
2366
|
+
import { createContextScope as createContextScope3 } from "@radix-ui/react-context";
|
|
2367
|
+
import { useId as useId3 } from "@radix-ui/react-id";
|
|
1838
2368
|
import * as MenuPrimitive from "@radix-ui/react-menu";
|
|
1839
2369
|
import { createMenuScope } from "@radix-ui/react-menu";
|
|
1840
|
-
import { Primitive as
|
|
2370
|
+
import { Primitive as Primitive10 } from "@radix-ui/react-primitive";
|
|
1841
2371
|
import { Slot as Slot10 } from "@radix-ui/react-slot";
|
|
1842
|
-
import { useControllableState as
|
|
1843
|
-
import React27, { useRef as
|
|
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";
|
|
1844
2374
|
var DROPDOWN_MENU_NAME = "DropdownMenu";
|
|
1845
|
-
var [createDropdownMenuContext, createDropdownMenuScope] =
|
|
2375
|
+
var [createDropdownMenuContext, createDropdownMenuScope] = createContextScope3(DROPDOWN_MENU_NAME, [
|
|
1846
2376
|
createMenuScope
|
|
1847
2377
|
]);
|
|
1848
2378
|
var useMenuScope = createMenuScope();
|
|
@@ -1850,20 +2380,20 @@ var [DropdownMenuProvider, useDropdownMenuContext] = createDropdownMenuContext(D
|
|
|
1850
2380
|
var DropdownMenuRoot = (props) => {
|
|
1851
2381
|
const { __scopeDropdownMenu, children, dir, open: openProp, defaultOpen, onOpenChange, modal = true } = props;
|
|
1852
2382
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1853
|
-
const triggerRef =
|
|
1854
|
-
const [open = false, setOpen] =
|
|
2383
|
+
const triggerRef = useRef3(null);
|
|
2384
|
+
const [open = false, setOpen] = useControllableState5({
|
|
1855
2385
|
prop: openProp,
|
|
1856
2386
|
defaultProp: defaultOpen,
|
|
1857
2387
|
onChange: onOpenChange
|
|
1858
2388
|
});
|
|
1859
2389
|
return /* @__PURE__ */ React27.createElement(DropdownMenuProvider, {
|
|
1860
2390
|
scope: __scopeDropdownMenu,
|
|
1861
|
-
triggerId:
|
|
2391
|
+
triggerId: useId3(),
|
|
1862
2392
|
triggerRef,
|
|
1863
|
-
contentId:
|
|
2393
|
+
contentId: useId3(),
|
|
1864
2394
|
open,
|
|
1865
2395
|
onOpenChange: setOpen,
|
|
1866
|
-
onOpenToggle:
|
|
2396
|
+
onOpenToggle: useCallback8(() => setOpen((prevOpen) => !prevOpen), [
|
|
1867
2397
|
setOpen
|
|
1868
2398
|
]),
|
|
1869
2399
|
modal
|
|
@@ -1876,15 +2406,15 @@ var DropdownMenuRoot = (props) => {
|
|
|
1876
2406
|
}, children));
|
|
1877
2407
|
};
|
|
1878
2408
|
DropdownMenuRoot.displayName = DROPDOWN_MENU_NAME;
|
|
1879
|
-
var
|
|
2409
|
+
var TRIGGER_NAME2 = "DropdownMenuTrigger";
|
|
1880
2410
|
var DropdownMenuTrigger = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
|
|
1881
2411
|
const { __scopeDropdownMenu, disabled = false, ...triggerProps } = props;
|
|
1882
|
-
const context = useDropdownMenuContext(
|
|
2412
|
+
const context = useDropdownMenuContext(TRIGGER_NAME2, __scopeDropdownMenu);
|
|
1883
2413
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1884
2414
|
return /* @__PURE__ */ React27.createElement(MenuPrimitive.Anchor, {
|
|
1885
2415
|
asChild: true,
|
|
1886
2416
|
...menuScope
|
|
1887
|
-
}, /* @__PURE__ */ React27.createElement(
|
|
2417
|
+
}, /* @__PURE__ */ React27.createElement(Primitive10.button, {
|
|
1888
2418
|
type: "button",
|
|
1889
2419
|
id: context.triggerId,
|
|
1890
2420
|
"aria-haspopup": "menu",
|
|
@@ -1895,7 +2425,7 @@ var DropdownMenuTrigger = /* @__PURE__ */ forwardRef19((props, forwardedRef) =>
|
|
|
1895
2425
|
disabled,
|
|
1896
2426
|
...triggerProps,
|
|
1897
2427
|
ref: composeRefs(forwardedRef, context.triggerRef),
|
|
1898
|
-
onPointerDown:
|
|
2428
|
+
onPointerDown: composeEventHandlers2(props.onPointerDown, (event) => {
|
|
1899
2429
|
if (!disabled && event.button === 0 && event.ctrlKey === false) {
|
|
1900
2430
|
context.onOpenToggle();
|
|
1901
2431
|
if (!context.open) {
|
|
@@ -1903,7 +2433,7 @@ var DropdownMenuTrigger = /* @__PURE__ */ forwardRef19((props, forwardedRef) =>
|
|
|
1903
2433
|
}
|
|
1904
2434
|
}
|
|
1905
2435
|
}),
|
|
1906
|
-
onKeyDown:
|
|
2436
|
+
onKeyDown: composeEventHandlers2(props.onKeyDown, (event) => {
|
|
1907
2437
|
if (disabled) {
|
|
1908
2438
|
return;
|
|
1909
2439
|
}
|
|
@@ -1926,13 +2456,13 @@ var DropdownMenuTrigger = /* @__PURE__ */ forwardRef19((props, forwardedRef) =>
|
|
|
1926
2456
|
})
|
|
1927
2457
|
}));
|
|
1928
2458
|
});
|
|
1929
|
-
DropdownMenuTrigger.displayName =
|
|
2459
|
+
DropdownMenuTrigger.displayName = TRIGGER_NAME2;
|
|
1930
2460
|
var VIRTUAL_TRIGGER_NAME = "DropdownMenuVirtualTrigger";
|
|
1931
2461
|
var DropdownMenuVirtualTrigger = (props) => {
|
|
1932
2462
|
const { __scopeDropdownMenu, virtualRef } = props;
|
|
1933
2463
|
const context = useDropdownMenuContext(VIRTUAL_TRIGGER_NAME, __scopeDropdownMenu);
|
|
1934
2464
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1935
|
-
|
|
2465
|
+
useEffect6(() => {
|
|
1936
2466
|
if (virtualRef.current) {
|
|
1937
2467
|
context.triggerRef.current = virtualRef.current;
|
|
1938
2468
|
}
|
|
@@ -1943,7 +2473,7 @@ var DropdownMenuVirtualTrigger = (props) => {
|
|
|
1943
2473
|
});
|
|
1944
2474
|
};
|
|
1945
2475
|
DropdownMenuVirtualTrigger.displayName = VIRTUAL_TRIGGER_NAME;
|
|
1946
|
-
var
|
|
2476
|
+
var PORTAL_NAME2 = "DropdownMenuPortal";
|
|
1947
2477
|
var DropdownMenuPortal = (props) => {
|
|
1948
2478
|
const { __scopeDropdownMenu, ...portalProps } = props;
|
|
1949
2479
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
@@ -1952,24 +2482,24 @@ var DropdownMenuPortal = (props) => {
|
|
|
1952
2482
|
...portalProps
|
|
1953
2483
|
});
|
|
1954
2484
|
};
|
|
1955
|
-
DropdownMenuPortal.displayName =
|
|
2485
|
+
DropdownMenuPortal.displayName = PORTAL_NAME2;
|
|
1956
2486
|
var DropdownMenuViewport = /* @__PURE__ */ forwardRef19(({ classNames, asChild, children, ...props }, forwardedRef) => {
|
|
1957
2487
|
const { tx } = useThemeContext();
|
|
1958
|
-
const
|
|
1959
|
-
return /* @__PURE__ */ React27.createElement(
|
|
2488
|
+
const Root7 = asChild ? Slot10 : Primitive10.div;
|
|
2489
|
+
return /* @__PURE__ */ React27.createElement(Root7, {
|
|
1960
2490
|
...props,
|
|
1961
2491
|
className: tx("menu.viewport", "menu__viewport", {}, classNames),
|
|
1962
2492
|
ref: forwardedRef
|
|
1963
2493
|
}, children);
|
|
1964
2494
|
});
|
|
1965
|
-
var
|
|
2495
|
+
var CONTENT_NAME2 = "DropdownMenuContent";
|
|
1966
2496
|
var DropdownMenuContent = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
|
|
1967
2497
|
const { __scopeDropdownMenu, classNames, collisionPadding = 8, ...contentProps } = props;
|
|
1968
2498
|
const { tx } = useThemeContext();
|
|
1969
|
-
const context = useDropdownMenuContext(
|
|
2499
|
+
const context = useDropdownMenuContext(CONTENT_NAME2, __scopeDropdownMenu);
|
|
1970
2500
|
const elevation = useElevationContext();
|
|
1971
2501
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1972
|
-
const hasInteractedOutsideRef =
|
|
2502
|
+
const hasInteractedOutsideRef = useRef3(false);
|
|
1973
2503
|
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
1974
2504
|
return /* @__PURE__ */ React27.createElement(MenuPrimitive.Content, {
|
|
1975
2505
|
id: context.contentId,
|
|
@@ -1978,14 +2508,14 @@ var DropdownMenuContent = /* @__PURE__ */ forwardRef19((props, forwardedRef) =>
|
|
|
1978
2508
|
...contentProps,
|
|
1979
2509
|
collisionPadding: safeCollisionPadding,
|
|
1980
2510
|
ref: forwardedRef,
|
|
1981
|
-
onCloseAutoFocus:
|
|
2511
|
+
onCloseAutoFocus: composeEventHandlers2(props.onCloseAutoFocus, (event) => {
|
|
1982
2512
|
if (!hasInteractedOutsideRef.current) {
|
|
1983
2513
|
context.triggerRef.current?.focus();
|
|
1984
2514
|
}
|
|
1985
2515
|
hasInteractedOutsideRef.current = false;
|
|
1986
2516
|
event.preventDefault();
|
|
1987
2517
|
}),
|
|
1988
|
-
onInteractOutside:
|
|
2518
|
+
onInteractOutside: composeEventHandlers2(props.onInteractOutside, (event) => {
|
|
1989
2519
|
const originalEvent = event.detail.originalEvent;
|
|
1990
2520
|
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
1991
2521
|
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
@@ -2009,7 +2539,7 @@ var DropdownMenuContent = /* @__PURE__ */ forwardRef19((props, forwardedRef) =>
|
|
|
2009
2539
|
}
|
|
2010
2540
|
});
|
|
2011
2541
|
});
|
|
2012
|
-
DropdownMenuContent.displayName =
|
|
2542
|
+
DropdownMenuContent.displayName = CONTENT_NAME2;
|
|
2013
2543
|
var GROUP_NAME = "DropdownMenuGroup";
|
|
2014
2544
|
var DropdownMenuGroup = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
|
|
2015
2545
|
const { __scopeDropdownMenu, ...groupProps } = props;
|
|
@@ -2106,7 +2636,7 @@ var DropdownMenuSeparator = /* @__PURE__ */ forwardRef19((props, forwardedRef) =
|
|
|
2106
2636
|
});
|
|
2107
2637
|
});
|
|
2108
2638
|
DropdownMenuSeparator.displayName = SEPARATOR_NAME;
|
|
2109
|
-
var
|
|
2639
|
+
var ARROW_NAME2 = "DropdownMenuArrow";
|
|
2110
2640
|
var DropdownMenuArrow = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
|
|
2111
2641
|
const { __scopeDropdownMenu, classNames, ...arrowProps } = props;
|
|
2112
2642
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
@@ -2118,11 +2648,11 @@ var DropdownMenuArrow = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
|
|
|
2118
2648
|
ref: forwardedRef
|
|
2119
2649
|
});
|
|
2120
2650
|
});
|
|
2121
|
-
DropdownMenuArrow.displayName =
|
|
2651
|
+
DropdownMenuArrow.displayName = ARROW_NAME2;
|
|
2122
2652
|
var DropdownMenuSub = (props) => {
|
|
2123
2653
|
const { __scopeDropdownMenu, children, open: openProp, onOpenChange, defaultOpen } = props;
|
|
2124
2654
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
2125
|
-
const [open = false, setOpen] =
|
|
2655
|
+
const [open = false, setOpen] = useControllableState5({
|
|
2126
2656
|
prop: openProp,
|
|
2127
2657
|
defaultProp: defaultOpen,
|
|
2128
2658
|
onChange: onOpenChange
|
|
@@ -2190,22 +2720,22 @@ 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
|