@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
|
@@ -150,8 +150,8 @@ var useVisualViewport = (deps) => {
|
|
|
150
150
|
// packages/ui/react-ui/src/components/AnchoredOverflow/AnchoredOverflow.tsx
|
|
151
151
|
var AnchoredOverflowRoot = /* @__PURE__ */ forwardRef(({ asChild, classNames, children, ...props }, forwardedRef) => {
|
|
152
152
|
const { tx } = useThemeContext();
|
|
153
|
-
const
|
|
154
|
-
return /* @__PURE__ */ React2.createElement(
|
|
153
|
+
const Root7 = asChild ? Slot : Primitive.div;
|
|
154
|
+
return /* @__PURE__ */ React2.createElement(Root7, {
|
|
155
155
|
role: "none",
|
|
156
156
|
...props,
|
|
157
157
|
className: tx("anchoredOverflow.root", "overflow-anchored", {}, classNames),
|
|
@@ -160,8 +160,8 @@ var AnchoredOverflowRoot = /* @__PURE__ */ forwardRef(({ asChild, classNames, ch
|
|
|
160
160
|
});
|
|
161
161
|
var AnchoredOverflowAnchor = /* @__PURE__ */ forwardRef(({ asChild, classNames, children, ...props }, forwardedRef) => {
|
|
162
162
|
const { tx } = useThemeContext();
|
|
163
|
-
const
|
|
164
|
-
return /* @__PURE__ */ React2.createElement(
|
|
163
|
+
const Root7 = asChild ? Slot : Primitive.div;
|
|
164
|
+
return /* @__PURE__ */ React2.createElement(Root7, {
|
|
165
165
|
role: "none",
|
|
166
166
|
...props,
|
|
167
167
|
className: tx("anchoredOverflow.anchor", "overflow-anchor", {}, classNames),
|
|
@@ -211,10 +211,10 @@ var AvatarContent = /* @__PURE__ */ forwardRef2(({ icon, classNames, ...props },
|
|
|
211
211
|
});
|
|
212
212
|
});
|
|
213
213
|
var AvatarLabel = /* @__PURE__ */ forwardRef2(({ asChild, srOnly, classNames, ...props }, forwardedRef) => {
|
|
214
|
-
const
|
|
214
|
+
const Root7 = asChild ? Slot2 : Primitive2.span;
|
|
215
215
|
const { tx } = useThemeContext();
|
|
216
216
|
const { labelId } = useAvatarContext("AvatarLabel");
|
|
217
|
-
return /* @__PURE__ */ React3.createElement(
|
|
217
|
+
return /* @__PURE__ */ React3.createElement(Root7, {
|
|
218
218
|
...props,
|
|
219
219
|
id: labelId,
|
|
220
220
|
ref: forwardedRef,
|
|
@@ -224,10 +224,10 @@ var AvatarLabel = /* @__PURE__ */ forwardRef2(({ asChild, srOnly, classNames, ..
|
|
|
224
224
|
});
|
|
225
225
|
});
|
|
226
226
|
var AvatarDescription = /* @__PURE__ */ forwardRef2(({ asChild, srOnly, classNames, ...props }, forwardedRef) => {
|
|
227
|
-
const
|
|
227
|
+
const Root7 = asChild ? Slot2 : Primitive2.span;
|
|
228
228
|
const { tx } = useThemeContext();
|
|
229
229
|
const { descriptionId } = useAvatarContext("AvatarDescription");
|
|
230
|
-
return /* @__PURE__ */ React3.createElement(
|
|
230
|
+
return /* @__PURE__ */ React3.createElement(Root7, {
|
|
231
231
|
...props,
|
|
232
232
|
id: descriptionId,
|
|
233
233
|
ref: forwardedRef,
|
|
@@ -255,8 +255,8 @@ import { Slot as Slot3 } from "@radix-ui/react-slot";
|
|
|
255
255
|
import React4, { forwardRef as forwardRef3 } from "react";
|
|
256
256
|
var Link = /* @__PURE__ */ forwardRef3(({ asChild, variant, classNames, ...props }, forwardedRef) => {
|
|
257
257
|
const { tx } = useThemeContext();
|
|
258
|
-
const
|
|
259
|
-
return /* @__PURE__ */ React4.createElement(
|
|
258
|
+
const Root7 = asChild ? Slot3 : Primitive3.a;
|
|
259
|
+
return /* @__PURE__ */ React4.createElement(Root7, {
|
|
260
260
|
...props,
|
|
261
261
|
className: tx("link.root", "link", {
|
|
262
262
|
variant
|
|
@@ -268,8 +268,8 @@ var Link = /* @__PURE__ */ forwardRef3(({ asChild, variant, classNames, ...props
|
|
|
268
268
|
// packages/ui/react-ui/src/components/Breadcrumb/Breadcrumb.tsx
|
|
269
269
|
var BreadcrumbRoot = /* @__PURE__ */ forwardRef4(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
270
270
|
const { tx } = useThemeContext();
|
|
271
|
-
const
|
|
272
|
-
return /* @__PURE__ */ React5.createElement(
|
|
271
|
+
const Root7 = asChild ? Slot4 : Primitive4.div;
|
|
272
|
+
return /* @__PURE__ */ React5.createElement(Root7, {
|
|
273
273
|
role: "navigation",
|
|
274
274
|
...props,
|
|
275
275
|
className: tx("breadcrumb.root", "breadcrumb", {}, classNames),
|
|
@@ -278,8 +278,8 @@ var BreadcrumbRoot = /* @__PURE__ */ forwardRef4(({ asChild, classNames, ...prop
|
|
|
278
278
|
});
|
|
279
279
|
var BreadcrumbList = /* @__PURE__ */ forwardRef4(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
280
280
|
const { tx } = useThemeContext();
|
|
281
|
-
const
|
|
282
|
-
return /* @__PURE__ */ React5.createElement(
|
|
281
|
+
const Root7 = asChild ? Slot4 : Primitive4.ol;
|
|
282
|
+
return /* @__PURE__ */ React5.createElement(Root7, {
|
|
283
283
|
role: "list",
|
|
284
284
|
...props,
|
|
285
285
|
className: tx("breadcrumb.list", "breadcrumb__list", {}, classNames),
|
|
@@ -288,8 +288,8 @@ var BreadcrumbList = /* @__PURE__ */ forwardRef4(({ asChild, classNames, ...prop
|
|
|
288
288
|
});
|
|
289
289
|
var BreadcrumbListItem = /* @__PURE__ */ forwardRef4(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
290
290
|
const { tx } = useThemeContext();
|
|
291
|
-
const
|
|
292
|
-
return /* @__PURE__ */ React5.createElement(
|
|
291
|
+
const Root7 = asChild ? Slot4 : Primitive4.li;
|
|
292
|
+
return /* @__PURE__ */ React5.createElement(Root7, {
|
|
293
293
|
role: "listitem",
|
|
294
294
|
...props,
|
|
295
295
|
className: tx("breadcrumb.listItem", "breadcrumb__list__item", {}, classNames),
|
|
@@ -297,16 +297,16 @@ var BreadcrumbListItem = /* @__PURE__ */ forwardRef4(({ asChild, classNames, ...
|
|
|
297
297
|
});
|
|
298
298
|
});
|
|
299
299
|
var BreadcrumbLink = /* @__PURE__ */ forwardRef4(({ asChild, ...props }, forwardedRef) => {
|
|
300
|
-
const
|
|
301
|
-
return /* @__PURE__ */ React5.createElement(
|
|
300
|
+
const Root7 = asChild ? Slot4 : Link;
|
|
301
|
+
return /* @__PURE__ */ React5.createElement(Root7, {
|
|
302
302
|
...props,
|
|
303
303
|
ref: forwardedRef
|
|
304
304
|
});
|
|
305
305
|
});
|
|
306
306
|
var BreadcrumbCurrent = /* @__PURE__ */ forwardRef4(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
307
307
|
const { tx } = useThemeContext();
|
|
308
|
-
const
|
|
309
|
-
return /* @__PURE__ */ React5.createElement(
|
|
308
|
+
const Root7 = asChild ? Slot4 : "h1";
|
|
309
|
+
return /* @__PURE__ */ React5.createElement(Root7, {
|
|
310
310
|
...props,
|
|
311
311
|
"aria-current": "page",
|
|
312
312
|
className: tx("breadcrumb.current", "breadcrumb__item__heading--current", {}, classNames),
|
|
@@ -348,8 +348,8 @@ var Button = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef5(({ classNames, chi
|
|
|
348
348
|
const { tx } = useThemeContext();
|
|
349
349
|
const elevation = useElevationContext(propsElevation);
|
|
350
350
|
const density = useDensityContext(propsDensity);
|
|
351
|
-
const
|
|
352
|
-
return /* @__PURE__ */ React6.createElement(
|
|
351
|
+
const Root7 = asChild ? Slot5 : Primitive5.button;
|
|
352
|
+
return /* @__PURE__ */ React6.createElement(Root7, {
|
|
353
353
|
ref,
|
|
354
354
|
...props,
|
|
355
355
|
"data-variant": variant,
|
|
@@ -371,8 +371,8 @@ Button.displayName = BUTTON_NAME;
|
|
|
371
371
|
var ButtonGroup = /* @__PURE__ */ forwardRef5(({ children, elevation: propsElevation, classNames, asChild, ...props }, forwardedRef) => {
|
|
372
372
|
const { tx } = useThemeContext();
|
|
373
373
|
const elevation = useElevationContext(propsElevation);
|
|
374
|
-
const
|
|
375
|
-
return /* @__PURE__ */ React6.createElement(
|
|
374
|
+
const Root7 = asChild ? Slot5 : Primitive5.div;
|
|
375
|
+
return /* @__PURE__ */ React6.createElement(Root7, {
|
|
376
376
|
role: "none",
|
|
377
377
|
...props,
|
|
378
378
|
className: tx("button.group", "button-group", {
|
|
@@ -386,7 +386,7 @@ var ButtonGroup = /* @__PURE__ */ forwardRef5(({ children, elevation: propsEleva
|
|
|
386
386
|
ButtonGroup.displayName = BUTTON_GROUP_NAME;
|
|
387
387
|
|
|
388
388
|
// packages/ui/react-ui/src/components/Buttons/IconButton.tsx
|
|
389
|
-
import React9, { forwardRef as forwardRef8
|
|
389
|
+
import React9, { forwardRef as forwardRef8 } from "react";
|
|
390
390
|
|
|
391
391
|
// packages/ui/react-ui/src/components/Icon/Icon.tsx
|
|
392
392
|
import React7, { forwardRef as forwardRef6, memo as memo2 } from "react";
|
|
@@ -405,98 +405,618 @@ var Icon = /* @__PURE__ */ memo2(/* @__PURE__ */ forwardRef6(({ icon, classNames
|
|
|
405
405
|
}));
|
|
406
406
|
|
|
407
407
|
// packages/ui/react-ui/src/components/Tooltip/Tooltip.tsx
|
|
408
|
-
import {
|
|
409
|
-
import
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
import {
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
};
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
408
|
+
import { composeEventHandlers } from "@radix-ui/primitive";
|
|
409
|
+
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
410
|
+
import { createContextScope } from "@radix-ui/react-context";
|
|
411
|
+
import { DismissableLayer } from "@radix-ui/react-dismissable-layer";
|
|
412
|
+
import { useId as useId2 } from "@radix-ui/react-id";
|
|
413
|
+
import * as PopperPrimitive from "@radix-ui/react-popper";
|
|
414
|
+
import { createPopperScope } from "@radix-ui/react-popper";
|
|
415
|
+
import { Portal as PortalPrimitive } from "@radix-ui/react-portal";
|
|
416
|
+
import { Presence } from "@radix-ui/react-presence";
|
|
417
|
+
import { Primitive as Primitive6 } from "@radix-ui/react-primitive";
|
|
418
|
+
import { Slottable } from "@radix-ui/react-slot";
|
|
419
|
+
import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
|
420
|
+
import * as VisuallyHiddenPrimitive from "@radix-ui/react-visually-hidden";
|
|
421
|
+
import React8, { forwardRef as forwardRef7, useCallback as useCallback3, useEffect as useEffect2, useMemo, useRef, useState as useState4 } from "react";
|
|
422
|
+
var [createTooltipContext, createTooltipScope] = createContextScope("Tooltip", [
|
|
423
|
+
createPopperScope
|
|
424
|
+
]);
|
|
425
|
+
var usePopperScope = createPopperScope();
|
|
426
|
+
var DEFAULT_DELAY_DURATION = 700;
|
|
427
|
+
var TOOLTIP_OPEN = "tooltip.open";
|
|
428
|
+
var TOOLTIP_NAME = "Tooltip";
|
|
429
|
+
var [TooltipContextProvider, useTooltipContext] = createTooltipContext(TOOLTIP_NAME);
|
|
430
|
+
var TooltipProvider = (props) => {
|
|
431
|
+
const { __scopeTooltip, children, open: openProp, defaultOpen = false, onOpenChange, disableHoverableContent = false, delayDuration = DEFAULT_DELAY_DURATION, skipDelayDuration = 300 } = props;
|
|
432
|
+
const isOpenDelayedRef = useRef(true);
|
|
433
|
+
const isPointerInTransitRef = useRef(false);
|
|
434
|
+
const skipDelayTimerRef = useRef(0);
|
|
435
|
+
useEffect2(() => {
|
|
436
|
+
const skipDelayTimer = skipDelayTimerRef.current;
|
|
437
|
+
return () => window.clearTimeout(skipDelayTimer);
|
|
438
|
+
}, []);
|
|
439
|
+
const popperScope = usePopperScope(__scopeTooltip);
|
|
440
|
+
const [trigger, setTrigger] = useState4(null);
|
|
441
|
+
const [content, setContent] = useState4("");
|
|
442
|
+
const [side, setSide] = useState4(void 0);
|
|
443
|
+
const triggerRef = useRef(trigger);
|
|
444
|
+
const handleTriggerChange = useCallback3((nextTrigger) => {
|
|
445
|
+
setTrigger(nextTrigger);
|
|
446
|
+
triggerRef.current = nextTrigger;
|
|
447
|
+
setContent(nextTrigger?.getAttribute("data-tooltip-content") ?? "");
|
|
448
|
+
setSide(nextTrigger?.getAttribute("data-tooltip-side") ?? void 0);
|
|
449
|
+
}, []);
|
|
450
|
+
const contentId = useId2();
|
|
451
|
+
const openTimerRef = useRef(0);
|
|
452
|
+
const wasOpenDelayedRef = useRef(false);
|
|
453
|
+
const handleOpenChange = useCallback3((open2) => {
|
|
454
|
+
if (open2) {
|
|
455
|
+
window.clearTimeout(skipDelayTimerRef.current);
|
|
456
|
+
isOpenDelayedRef.current = false;
|
|
457
|
+
document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN));
|
|
458
|
+
} else {
|
|
459
|
+
window.clearTimeout(skipDelayTimerRef.current);
|
|
460
|
+
skipDelayTimerRef.current = window.setTimeout(() => isOpenDelayedRef.current = true, skipDelayDuration);
|
|
461
|
+
}
|
|
462
|
+
onOpenChange?.(open2);
|
|
463
|
+
}, [
|
|
464
|
+
skipDelayDuration,
|
|
465
|
+
onOpenChange
|
|
428
466
|
]);
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
var TooltipRoot = TooltipRootPrimitive;
|
|
434
|
-
var TooltipPortal = TooltipPortalPrimitive;
|
|
435
|
-
var TooltipTrigger = TooltipTriggerPrimitive;
|
|
436
|
-
var TooltipArrow = /* @__PURE__ */ forwardRef7(({ classNames, ...props }, forwardedRef) => {
|
|
437
|
-
const { tx } = useThemeContext();
|
|
438
|
-
return /* @__PURE__ */ React8.createElement(TooltipArrowPrimitive, {
|
|
439
|
-
...props,
|
|
440
|
-
className: tx("tooltip.arrow", "tooltip__arrow", {}, classNames),
|
|
441
|
-
ref: forwardedRef
|
|
467
|
+
const [open = false, setOpen] = useControllableState({
|
|
468
|
+
prop: openProp,
|
|
469
|
+
defaultProp: defaultOpen,
|
|
470
|
+
onChange: handleOpenChange
|
|
442
471
|
});
|
|
443
|
-
|
|
444
|
-
|
|
472
|
+
const stateAttribute = useMemo(() => {
|
|
473
|
+
return open ? wasOpenDelayedRef.current ? "delayed-open" : "instant-open" : "closed";
|
|
474
|
+
}, [
|
|
475
|
+
open
|
|
476
|
+
]);
|
|
477
|
+
const handleOpen = useCallback3(() => {
|
|
478
|
+
window.clearTimeout(openTimerRef.current);
|
|
479
|
+
openTimerRef.current = 0;
|
|
480
|
+
wasOpenDelayedRef.current = false;
|
|
481
|
+
setOpen(true);
|
|
482
|
+
}, [
|
|
483
|
+
setOpen
|
|
484
|
+
]);
|
|
485
|
+
const handleClose = useCallback3(() => {
|
|
486
|
+
window.clearTimeout(openTimerRef.current);
|
|
487
|
+
openTimerRef.current = 0;
|
|
488
|
+
setOpen(false);
|
|
489
|
+
}, [
|
|
490
|
+
setOpen
|
|
491
|
+
]);
|
|
492
|
+
const handleDelayedOpen = useCallback3(() => {
|
|
493
|
+
window.clearTimeout(openTimerRef.current);
|
|
494
|
+
openTimerRef.current = window.setTimeout(() => {
|
|
495
|
+
wasOpenDelayedRef.current = true;
|
|
496
|
+
setOpen(true);
|
|
497
|
+
openTimerRef.current = 0;
|
|
498
|
+
}, delayDuration);
|
|
499
|
+
}, [
|
|
500
|
+
delayDuration,
|
|
501
|
+
setOpen
|
|
502
|
+
]);
|
|
503
|
+
useEffect2(() => {
|
|
504
|
+
return () => {
|
|
505
|
+
if (openTimerRef.current) {
|
|
506
|
+
window.clearTimeout(openTimerRef.current);
|
|
507
|
+
openTimerRef.current = 0;
|
|
508
|
+
}
|
|
509
|
+
};
|
|
510
|
+
}, []);
|
|
445
511
|
const { tx } = useThemeContext();
|
|
446
512
|
const elevation = useElevationContext();
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
513
|
+
return /* @__PURE__ */ React8.createElement(PopperPrimitive.Root, popperScope, /* @__PURE__ */ React8.createElement(TooltipContextProvider, {
|
|
514
|
+
scope: __scopeTooltip,
|
|
515
|
+
contentId,
|
|
516
|
+
open,
|
|
517
|
+
stateAttribute,
|
|
518
|
+
trigger,
|
|
519
|
+
onTriggerChange: handleTriggerChange,
|
|
520
|
+
onTriggerEnter: useCallback3(() => {
|
|
521
|
+
if (isOpenDelayedRef.current) {
|
|
522
|
+
handleDelayedOpen();
|
|
523
|
+
} else {
|
|
524
|
+
handleOpen();
|
|
525
|
+
}
|
|
526
|
+
}, [
|
|
527
|
+
isOpenDelayedRef,
|
|
528
|
+
handleDelayedOpen,
|
|
529
|
+
handleOpen
|
|
530
|
+
]),
|
|
531
|
+
onTriggerLeave: useCallback3(() => {
|
|
532
|
+
if (disableHoverableContent) {
|
|
533
|
+
handleClose();
|
|
534
|
+
} else {
|
|
535
|
+
window.clearTimeout(openTimerRef.current);
|
|
536
|
+
openTimerRef.current = 0;
|
|
537
|
+
}
|
|
538
|
+
}, [
|
|
539
|
+
handleClose,
|
|
540
|
+
disableHoverableContent
|
|
541
|
+
]),
|
|
542
|
+
onOpen: handleOpen,
|
|
543
|
+
onClose: handleClose,
|
|
544
|
+
disableHoverableContent,
|
|
545
|
+
isPointerInTransitRef,
|
|
546
|
+
onPointerInTransitChange: useCallback3((inTransit) => {
|
|
547
|
+
isPointerInTransitRef.current = inTransit;
|
|
548
|
+
}, [])
|
|
549
|
+
}, /* @__PURE__ */ React8.createElement(TooltipContent, {
|
|
550
|
+
side,
|
|
452
551
|
className: tx("tooltip.content", "tooltip", {
|
|
453
552
|
elevation
|
|
454
|
-
}
|
|
553
|
+
})
|
|
554
|
+
}, content, /* @__PURE__ */ React8.createElement(TooltipArrow, {
|
|
555
|
+
className: tx("tooltip.arrow", "tooltip__arrow")
|
|
556
|
+
})), /* @__PURE__ */ React8.createElement(TooltipVirtualTrigger, {
|
|
557
|
+
virtualRef: triggerRef
|
|
558
|
+
}), children));
|
|
559
|
+
};
|
|
560
|
+
TooltipProvider.displayName = TOOLTIP_NAME;
|
|
561
|
+
var TooltipVirtualTrigger = ({ virtualRef, __scopeTooltip }) => {
|
|
562
|
+
const popperScope = usePopperScope(__scopeTooltip);
|
|
563
|
+
return /* @__PURE__ */ React8.createElement(PopperPrimitive.Anchor, {
|
|
564
|
+
asChild: true,
|
|
565
|
+
...popperScope,
|
|
566
|
+
virtualRef
|
|
567
|
+
});
|
|
568
|
+
};
|
|
569
|
+
var TRIGGER_NAME = "TooltipTrigger";
|
|
570
|
+
var TooltipTrigger = /* @__PURE__ */ forwardRef7((props, forwardedRef) => {
|
|
571
|
+
const {
|
|
572
|
+
__scopeTooltip,
|
|
573
|
+
onInteract,
|
|
574
|
+
// TODO(thure): Pass `delayDuration` into the context.
|
|
575
|
+
delayDuration: _delayDuration,
|
|
576
|
+
suppressNextTooltip,
|
|
577
|
+
side,
|
|
578
|
+
content,
|
|
579
|
+
...triggerProps
|
|
580
|
+
} = props;
|
|
581
|
+
const context = useTooltipContext(TRIGGER_NAME, __scopeTooltip);
|
|
582
|
+
const ref = useRef(null);
|
|
583
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
584
|
+
const isPointerDownRef = useRef(false);
|
|
585
|
+
const hasPointerMoveOpenedRef = useRef(false);
|
|
586
|
+
const handlePointerUp = useCallback3(() => isPointerDownRef.current = false, []);
|
|
587
|
+
useEffect2(() => {
|
|
588
|
+
return () => document.removeEventListener("pointerup", handlePointerUp);
|
|
589
|
+
}, [
|
|
590
|
+
handlePointerUp
|
|
591
|
+
]);
|
|
592
|
+
return /* @__PURE__ */ React8.createElement(Primitive6.button, {
|
|
593
|
+
// We purposefully avoid adding `type=button` here because tooltip triggers are also
|
|
594
|
+
// commonly anchors and the anchor `type` attribute signifies MIME type.
|
|
595
|
+
"aria-describedby": context.open ? context.contentId : void 0,
|
|
596
|
+
"data-state": context.stateAttribute,
|
|
597
|
+
"data-tooltip-content": content,
|
|
598
|
+
"data-tooltip-side": side,
|
|
599
|
+
...triggerProps,
|
|
600
|
+
ref: composedRefs,
|
|
601
|
+
onPointerMove: composeEventHandlers(props.onPointerMove, (event) => {
|
|
602
|
+
if (event.pointerType === "touch") {
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
605
|
+
if (!hasPointerMoveOpenedRef.current && !context.isPointerInTransitRef.current) {
|
|
606
|
+
onInteract?.(event);
|
|
607
|
+
if (event.defaultPrevented) {
|
|
608
|
+
return;
|
|
609
|
+
}
|
|
610
|
+
context.onTriggerChange(ref.current);
|
|
611
|
+
context.onTriggerEnter();
|
|
612
|
+
hasPointerMoveOpenedRef.current = true;
|
|
613
|
+
}
|
|
614
|
+
}),
|
|
615
|
+
onPointerLeave: composeEventHandlers(props.onPointerLeave, () => {
|
|
616
|
+
context.onTriggerLeave();
|
|
617
|
+
hasPointerMoveOpenedRef.current = false;
|
|
618
|
+
}),
|
|
619
|
+
onPointerDown: composeEventHandlers(props.onPointerDown, () => {
|
|
620
|
+
if (context.open) {
|
|
621
|
+
context.onClose();
|
|
622
|
+
}
|
|
623
|
+
isPointerDownRef.current = true;
|
|
624
|
+
document.addEventListener("pointerup", handlePointerUp, {
|
|
625
|
+
once: true
|
|
626
|
+
});
|
|
627
|
+
}),
|
|
628
|
+
onFocus: composeEventHandlers(props.onFocus, (event) => {
|
|
629
|
+
if (!isPointerDownRef.current) {
|
|
630
|
+
onInteract?.(event);
|
|
631
|
+
if (event.defaultPrevented) {
|
|
632
|
+
return;
|
|
633
|
+
}
|
|
634
|
+
if (suppressNextTooltip?.current) {
|
|
635
|
+
suppressNextTooltip.current = false;
|
|
636
|
+
} else {
|
|
637
|
+
context.onTriggerChange(ref.current);
|
|
638
|
+
context.onOpen();
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
}),
|
|
642
|
+
onBlur: composeEventHandlers(props.onBlur, context.onClose),
|
|
643
|
+
onClick: composeEventHandlers(props.onClick, context.onClose)
|
|
644
|
+
});
|
|
645
|
+
});
|
|
646
|
+
TooltipTrigger.displayName = TRIGGER_NAME;
|
|
647
|
+
var PORTAL_NAME = "TooltipPortal";
|
|
648
|
+
var [PortalProvider, usePortalContext] = createTooltipContext(PORTAL_NAME, {
|
|
649
|
+
forceMount: void 0
|
|
650
|
+
});
|
|
651
|
+
var TooltipPortal = (props) => {
|
|
652
|
+
const { __scopeTooltip, forceMount, children, container } = props;
|
|
653
|
+
const context = useTooltipContext(PORTAL_NAME, __scopeTooltip);
|
|
654
|
+
return /* @__PURE__ */ React8.createElement(PortalProvider, {
|
|
655
|
+
scope: __scopeTooltip,
|
|
656
|
+
forceMount
|
|
657
|
+
}, /* @__PURE__ */ React8.createElement(Presence, {
|
|
658
|
+
present: forceMount || context.open
|
|
659
|
+
}, /* @__PURE__ */ React8.createElement(PortalPrimitive, {
|
|
660
|
+
asChild: true,
|
|
661
|
+
container
|
|
662
|
+
}, children)));
|
|
663
|
+
};
|
|
664
|
+
TooltipPortal.displayName = PORTAL_NAME;
|
|
665
|
+
var CONTENT_NAME = "TooltipContent";
|
|
666
|
+
var TooltipContent = /* @__PURE__ */ forwardRef7((props, forwardedRef) => {
|
|
667
|
+
const portalContext = usePortalContext(CONTENT_NAME, props.__scopeTooltip);
|
|
668
|
+
const { forceMount = portalContext.forceMount, side = "top", ...contentProps } = props;
|
|
669
|
+
const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);
|
|
670
|
+
return /* @__PURE__ */ React8.createElement(Presence, {
|
|
671
|
+
present: forceMount || context.open
|
|
672
|
+
}, context.disableHoverableContent ? /* @__PURE__ */ React8.createElement(TooltipContentImpl, {
|
|
673
|
+
side,
|
|
674
|
+
...contentProps,
|
|
675
|
+
ref: forwardedRef
|
|
676
|
+
}) : /* @__PURE__ */ React8.createElement(TooltipContentHoverable, {
|
|
677
|
+
side,
|
|
678
|
+
...contentProps,
|
|
679
|
+
ref: forwardedRef
|
|
680
|
+
}));
|
|
681
|
+
});
|
|
682
|
+
var TooltipContentHoverable = /* @__PURE__ */ forwardRef7((props, forwardedRef) => {
|
|
683
|
+
const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);
|
|
684
|
+
const ref = useRef(null);
|
|
685
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
686
|
+
const [pointerGraceArea, setPointerGraceArea] = useState4(null);
|
|
687
|
+
const { trigger, onClose } = context;
|
|
688
|
+
const content = ref.current;
|
|
689
|
+
const { onPointerInTransitChange } = context;
|
|
690
|
+
const handleRemoveGraceArea = useCallback3(() => {
|
|
691
|
+
setPointerGraceArea(null);
|
|
692
|
+
onPointerInTransitChange(false);
|
|
693
|
+
}, [
|
|
694
|
+
onPointerInTransitChange
|
|
695
|
+
]);
|
|
696
|
+
const handleCreateGraceArea = useCallback3((event, hoverTarget) => {
|
|
697
|
+
const currentTarget = event.currentTarget;
|
|
698
|
+
const exitPoint = {
|
|
699
|
+
x: event.clientX,
|
|
700
|
+
y: event.clientY
|
|
701
|
+
};
|
|
702
|
+
const exitSide = getExitSideFromRect(exitPoint, currentTarget.getBoundingClientRect());
|
|
703
|
+
const paddedExitPoints = getPaddedExitPoints(exitPoint, exitSide);
|
|
704
|
+
const hoverTargetPoints = getPointsFromRect(hoverTarget.getBoundingClientRect());
|
|
705
|
+
const graceArea = getHull([
|
|
706
|
+
...paddedExitPoints,
|
|
707
|
+
...hoverTargetPoints
|
|
708
|
+
]);
|
|
709
|
+
setPointerGraceArea(graceArea);
|
|
710
|
+
onPointerInTransitChange(true);
|
|
711
|
+
}, [
|
|
712
|
+
onPointerInTransitChange
|
|
713
|
+
]);
|
|
714
|
+
useEffect2(() => {
|
|
715
|
+
return () => handleRemoveGraceArea();
|
|
716
|
+
}, [
|
|
717
|
+
handleRemoveGraceArea
|
|
718
|
+
]);
|
|
719
|
+
useEffect2(() => {
|
|
720
|
+
if (trigger && content) {
|
|
721
|
+
const handleTriggerLeave = (event) => handleCreateGraceArea(event, content);
|
|
722
|
+
const handleContentLeave = (event) => handleCreateGraceArea(event, trigger);
|
|
723
|
+
trigger.addEventListener("pointerleave", handleTriggerLeave);
|
|
724
|
+
content.addEventListener("pointerleave", handleContentLeave);
|
|
725
|
+
return () => {
|
|
726
|
+
trigger.removeEventListener("pointerleave", handleTriggerLeave);
|
|
727
|
+
content.removeEventListener("pointerleave", handleContentLeave);
|
|
728
|
+
};
|
|
729
|
+
}
|
|
730
|
+
}, [
|
|
731
|
+
trigger,
|
|
732
|
+
content,
|
|
733
|
+
handleCreateGraceArea,
|
|
734
|
+
handleRemoveGraceArea
|
|
735
|
+
]);
|
|
736
|
+
useEffect2(() => {
|
|
737
|
+
if (pointerGraceArea) {
|
|
738
|
+
const handleTrackPointerGrace = (event) => {
|
|
739
|
+
const target = event.target;
|
|
740
|
+
const pointerPosition = {
|
|
741
|
+
x: event.clientX,
|
|
742
|
+
y: event.clientY
|
|
743
|
+
};
|
|
744
|
+
const hasEnteredTarget = trigger?.contains(target) || content?.contains(target);
|
|
745
|
+
const isPointerOutsideGraceArea = !isPointInPolygon(pointerPosition, pointerGraceArea);
|
|
746
|
+
if (hasEnteredTarget) {
|
|
747
|
+
handleRemoveGraceArea();
|
|
748
|
+
} else if (isPointerOutsideGraceArea) {
|
|
749
|
+
handleRemoveGraceArea();
|
|
750
|
+
onClose();
|
|
751
|
+
}
|
|
752
|
+
};
|
|
753
|
+
document.addEventListener("pointermove", handleTrackPointerGrace);
|
|
754
|
+
return () => document.removeEventListener("pointermove", handleTrackPointerGrace);
|
|
755
|
+
}
|
|
756
|
+
}, [
|
|
757
|
+
trigger,
|
|
758
|
+
content,
|
|
759
|
+
pointerGraceArea,
|
|
760
|
+
onClose,
|
|
761
|
+
handleRemoveGraceArea
|
|
762
|
+
]);
|
|
763
|
+
return /* @__PURE__ */ React8.createElement(TooltipContentImpl, {
|
|
764
|
+
...props,
|
|
765
|
+
ref: composedRefs
|
|
766
|
+
});
|
|
767
|
+
});
|
|
768
|
+
var [VisuallyHiddenContentContextProvider, useVisuallyHiddenContentContext] = createTooltipContext(TOOLTIP_NAME, {
|
|
769
|
+
isInside: false
|
|
770
|
+
});
|
|
771
|
+
var TooltipContentImpl = /* @__PURE__ */ forwardRef7((props, forwardedRef) => {
|
|
772
|
+
const { __scopeTooltip, children, "aria-label": ariaLabel, onEscapeKeyDown, onPointerDownOutside, ...contentProps } = props;
|
|
773
|
+
const context = useTooltipContext(CONTENT_NAME, __scopeTooltip);
|
|
774
|
+
const popperScope = usePopperScope(__scopeTooltip);
|
|
775
|
+
const { onClose } = context;
|
|
776
|
+
useEffect2(() => {
|
|
777
|
+
document.addEventListener(TOOLTIP_OPEN, onClose);
|
|
778
|
+
return () => document.removeEventListener(TOOLTIP_OPEN, onClose);
|
|
779
|
+
}, [
|
|
780
|
+
onClose
|
|
781
|
+
]);
|
|
782
|
+
useEffect2(() => {
|
|
783
|
+
if (context.trigger) {
|
|
784
|
+
const handleScroll = (event) => {
|
|
785
|
+
const target = event.target;
|
|
786
|
+
if (target?.contains(context.trigger)) {
|
|
787
|
+
onClose();
|
|
788
|
+
}
|
|
789
|
+
};
|
|
790
|
+
window.addEventListener("scroll", handleScroll, {
|
|
791
|
+
capture: true
|
|
792
|
+
});
|
|
793
|
+
return () => window.removeEventListener("scroll", handleScroll, {
|
|
794
|
+
capture: true
|
|
795
|
+
});
|
|
796
|
+
}
|
|
797
|
+
}, [
|
|
798
|
+
context.trigger,
|
|
799
|
+
onClose
|
|
800
|
+
]);
|
|
801
|
+
return /* @__PURE__ */ React8.createElement(DismissableLayer, {
|
|
802
|
+
asChild: true,
|
|
803
|
+
disableOutsidePointerEvents: false,
|
|
804
|
+
onEscapeKeyDown,
|
|
805
|
+
onPointerDownOutside,
|
|
806
|
+
onFocusOutside: (event) => event.preventDefault(),
|
|
807
|
+
onDismiss: onClose
|
|
808
|
+
}, /* @__PURE__ */ React8.createElement(PopperPrimitive.Content, {
|
|
809
|
+
"data-state": context.stateAttribute,
|
|
810
|
+
...popperScope,
|
|
811
|
+
...contentProps,
|
|
812
|
+
ref: forwardedRef,
|
|
813
|
+
style: {
|
|
814
|
+
...contentProps.style,
|
|
815
|
+
// re-namespace exposed content custom properties
|
|
816
|
+
...{
|
|
817
|
+
"--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
818
|
+
"--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
|
|
819
|
+
"--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
|
|
820
|
+
"--radix-tooltip-trigger-width": "var(--radix-popper-anchor-width)",
|
|
821
|
+
"--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
}, /* @__PURE__ */ React8.createElement(Slottable, null, children), /* @__PURE__ */ React8.createElement(VisuallyHiddenContentContextProvider, {
|
|
825
|
+
scope: __scopeTooltip,
|
|
826
|
+
isInside: true
|
|
827
|
+
}, /* @__PURE__ */ React8.createElement(VisuallyHiddenPrimitive.Root, {
|
|
828
|
+
id: context.contentId,
|
|
829
|
+
role: "tooltip"
|
|
830
|
+
}, ariaLabel || children))));
|
|
831
|
+
});
|
|
832
|
+
TooltipContent.displayName = CONTENT_NAME;
|
|
833
|
+
var ARROW_NAME = "TooltipArrow";
|
|
834
|
+
var TooltipArrow = /* @__PURE__ */ forwardRef7((props, forwardedRef) => {
|
|
835
|
+
const { __scopeTooltip, ...arrowProps } = props;
|
|
836
|
+
const popperScope = usePopperScope(__scopeTooltip);
|
|
837
|
+
const visuallyHiddenContentContext = useVisuallyHiddenContentContext(ARROW_NAME, __scopeTooltip);
|
|
838
|
+
return visuallyHiddenContentContext.isInside ? null : /* @__PURE__ */ React8.createElement(PopperPrimitive.Arrow, {
|
|
839
|
+
...popperScope,
|
|
840
|
+
...arrowProps,
|
|
455
841
|
ref: forwardedRef
|
|
456
842
|
});
|
|
457
843
|
});
|
|
844
|
+
TooltipArrow.displayName = ARROW_NAME;
|
|
845
|
+
var getExitSideFromRect = (point, rect) => {
|
|
846
|
+
const top = Math.abs(rect.top - point.y);
|
|
847
|
+
const bottom = Math.abs(rect.bottom - point.y);
|
|
848
|
+
const right = Math.abs(rect.right - point.x);
|
|
849
|
+
const left = Math.abs(rect.left - point.x);
|
|
850
|
+
switch (Math.min(top, bottom, right, left)) {
|
|
851
|
+
case left:
|
|
852
|
+
return "left";
|
|
853
|
+
case right:
|
|
854
|
+
return "right";
|
|
855
|
+
case top:
|
|
856
|
+
return "top";
|
|
857
|
+
case bottom:
|
|
858
|
+
return "bottom";
|
|
859
|
+
default:
|
|
860
|
+
throw new Error("unreachable");
|
|
861
|
+
}
|
|
862
|
+
};
|
|
863
|
+
var getPaddedExitPoints = (exitPoint, exitSide, padding = 5) => {
|
|
864
|
+
const paddedExitPoints = [];
|
|
865
|
+
switch (exitSide) {
|
|
866
|
+
case "top":
|
|
867
|
+
paddedExitPoints.push({
|
|
868
|
+
x: exitPoint.x - padding,
|
|
869
|
+
y: exitPoint.y + padding
|
|
870
|
+
}, {
|
|
871
|
+
x: exitPoint.x + padding,
|
|
872
|
+
y: exitPoint.y + padding
|
|
873
|
+
});
|
|
874
|
+
break;
|
|
875
|
+
case "bottom":
|
|
876
|
+
paddedExitPoints.push({
|
|
877
|
+
x: exitPoint.x - padding,
|
|
878
|
+
y: exitPoint.y - padding
|
|
879
|
+
}, {
|
|
880
|
+
x: exitPoint.x + padding,
|
|
881
|
+
y: exitPoint.y - padding
|
|
882
|
+
});
|
|
883
|
+
break;
|
|
884
|
+
case "left":
|
|
885
|
+
paddedExitPoints.push({
|
|
886
|
+
x: exitPoint.x + padding,
|
|
887
|
+
y: exitPoint.y - padding
|
|
888
|
+
}, {
|
|
889
|
+
x: exitPoint.x + padding,
|
|
890
|
+
y: exitPoint.y + padding
|
|
891
|
+
});
|
|
892
|
+
break;
|
|
893
|
+
case "right":
|
|
894
|
+
paddedExitPoints.push({
|
|
895
|
+
x: exitPoint.x - padding,
|
|
896
|
+
y: exitPoint.y - padding
|
|
897
|
+
}, {
|
|
898
|
+
x: exitPoint.x - padding,
|
|
899
|
+
y: exitPoint.y + padding
|
|
900
|
+
});
|
|
901
|
+
break;
|
|
902
|
+
}
|
|
903
|
+
return paddedExitPoints;
|
|
904
|
+
};
|
|
905
|
+
var getPointsFromRect = (rect) => {
|
|
906
|
+
const { top, right, bottom, left } = rect;
|
|
907
|
+
return [
|
|
908
|
+
{
|
|
909
|
+
x: left,
|
|
910
|
+
y: top
|
|
911
|
+
},
|
|
912
|
+
{
|
|
913
|
+
x: right,
|
|
914
|
+
y: top
|
|
915
|
+
},
|
|
916
|
+
{
|
|
917
|
+
x: right,
|
|
918
|
+
y: bottom
|
|
919
|
+
},
|
|
920
|
+
{
|
|
921
|
+
x: left,
|
|
922
|
+
y: bottom
|
|
923
|
+
}
|
|
924
|
+
];
|
|
925
|
+
};
|
|
926
|
+
var isPointInPolygon = (point, polygon) => {
|
|
927
|
+
const { x, y } = point;
|
|
928
|
+
let inside = false;
|
|
929
|
+
for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
|
|
930
|
+
const xi = polygon[i].x;
|
|
931
|
+
const yi = polygon[i].y;
|
|
932
|
+
const xj = polygon[j].x;
|
|
933
|
+
const yj = polygon[j].y;
|
|
934
|
+
const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
|
|
935
|
+
if (intersect) {
|
|
936
|
+
inside = !inside;
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
return inside;
|
|
940
|
+
};
|
|
941
|
+
var getHull = (points) => {
|
|
942
|
+
const newPoints = points.slice();
|
|
943
|
+
newPoints.sort((a, b) => {
|
|
944
|
+
if (a.x < b.x) {
|
|
945
|
+
return -1;
|
|
946
|
+
} else if (a.x > b.x) {
|
|
947
|
+
return 1;
|
|
948
|
+
} else if (a.y < b.y) {
|
|
949
|
+
return -1;
|
|
950
|
+
} else if (a.y > b.y) {
|
|
951
|
+
return 1;
|
|
952
|
+
} else {
|
|
953
|
+
return 0;
|
|
954
|
+
}
|
|
955
|
+
});
|
|
956
|
+
return getHullPresorted(newPoints);
|
|
957
|
+
};
|
|
958
|
+
var getHullPresorted = (points) => {
|
|
959
|
+
if (points.length <= 1) {
|
|
960
|
+
return points.slice();
|
|
961
|
+
}
|
|
962
|
+
const upperHull = [];
|
|
963
|
+
for (let i = 0; i < points.length; i++) {
|
|
964
|
+
const p = points[i];
|
|
965
|
+
while (upperHull.length >= 2) {
|
|
966
|
+
const q = upperHull[upperHull.length - 1];
|
|
967
|
+
const r = upperHull[upperHull.length - 2];
|
|
968
|
+
if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x)) {
|
|
969
|
+
upperHull.pop();
|
|
970
|
+
} else {
|
|
971
|
+
break;
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
upperHull.push(p);
|
|
975
|
+
}
|
|
976
|
+
upperHull.pop();
|
|
977
|
+
const lowerHull = [];
|
|
978
|
+
for (let i = points.length - 1; i >= 0; i--) {
|
|
979
|
+
const p = points[i];
|
|
980
|
+
while (lowerHull.length >= 2) {
|
|
981
|
+
const q = lowerHull[lowerHull.length - 1];
|
|
982
|
+
const r = lowerHull[lowerHull.length - 2];
|
|
983
|
+
if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x)) {
|
|
984
|
+
lowerHull.pop();
|
|
985
|
+
} else {
|
|
986
|
+
break;
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
lowerHull.push(p);
|
|
990
|
+
}
|
|
991
|
+
lowerHull.pop();
|
|
992
|
+
if (upperHull.length === 1 && lowerHull.length === 1 && upperHull[0].x === lowerHull[0].x && upperHull[0].y === lowerHull[0].y) {
|
|
993
|
+
return upperHull;
|
|
994
|
+
} else {
|
|
995
|
+
return upperHull.concat(lowerHull);
|
|
996
|
+
}
|
|
997
|
+
};
|
|
458
998
|
var Tooltip = {
|
|
459
999
|
Provider: TooltipProvider,
|
|
460
|
-
|
|
461
|
-
Portal: TooltipPortal,
|
|
462
|
-
Trigger: TooltipTrigger,
|
|
463
|
-
Arrow: TooltipArrow,
|
|
464
|
-
Content: TooltipContent
|
|
1000
|
+
Trigger: TooltipTrigger
|
|
465
1001
|
};
|
|
466
1002
|
|
|
467
1003
|
// packages/ui/react-ui/src/components/Buttons/IconButton.tsx
|
|
468
|
-
var IconOnlyButton = /* @__PURE__ */ forwardRef8(({ noTooltip, tooltipPortal = true,
|
|
469
|
-
const [triggerTooltipOpen, setTriggerTooltipOpen] = useState4(false);
|
|
1004
|
+
var IconOnlyButton = /* @__PURE__ */ forwardRef8(({ noTooltip, tooltipPortal = true, tooltipSide, suppressNextTooltip, ...props }, forwardedRef) => {
|
|
470
1005
|
if (noTooltip) {
|
|
471
1006
|
return /* @__PURE__ */ React9.createElement(LabelledIconButton, {
|
|
472
1007
|
...props,
|
|
473
1008
|
ref: forwardedRef
|
|
474
1009
|
});
|
|
475
1010
|
}
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
},
|
|
482
|
-
side: tooltipSide
|
|
483
|
-
}, props.label, /* @__PURE__ */ React9.createElement(Tooltip.Arrow, null));
|
|
484
|
-
return /* @__PURE__ */ React9.createElement(Tooltip.Root, {
|
|
485
|
-
open: triggerTooltipOpen,
|
|
486
|
-
onOpenChange: (nextOpen) => {
|
|
487
|
-
if (suppressNextTooltip?.current) {
|
|
488
|
-
setTriggerTooltipOpen(false);
|
|
489
|
-
suppressNextTooltip.current = false;
|
|
490
|
-
} else {
|
|
491
|
-
setTriggerTooltipOpen(nextOpen);
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
}, /* @__PURE__ */ React9.createElement(Tooltip.Trigger, {
|
|
495
|
-
asChild: true
|
|
1011
|
+
return /* @__PURE__ */ React9.createElement(Tooltip.Trigger, {
|
|
1012
|
+
asChild: true,
|
|
1013
|
+
content: props.label,
|
|
1014
|
+
side: tooltipSide,
|
|
1015
|
+
suppressNextTooltip
|
|
496
1016
|
}, /* @__PURE__ */ React9.createElement(LabelledIconButton, {
|
|
497
1017
|
...props,
|
|
498
1018
|
ref: forwardedRef
|
|
499
|
-
}))
|
|
1019
|
+
}));
|
|
500
1020
|
});
|
|
501
1021
|
var LabelledIconButton = /* @__PURE__ */ forwardRef8(({ icon, size, iconOnly, label, classNames, iconClassNames, caretDown, suppressNextTooltip, ...props }, forwardedRef) => {
|
|
502
1022
|
const { tx } = useThemeContext();
|
|
@@ -566,7 +1086,7 @@ var ToggleGroupItem = /* @__PURE__ */ forwardRef10(({ variant, elevation, densit
|
|
|
566
1086
|
});
|
|
567
1087
|
|
|
568
1088
|
// packages/ui/react-ui/src/components/Clipboard/ClipboardProvider.tsx
|
|
569
|
-
import React12, { createContext as createContext4, useCallback as
|
|
1089
|
+
import React12, { createContext as createContext4, useCallback as useCallback4, useContext as useContext6, useState as useState5 } from "react";
|
|
570
1090
|
var ClipboardContext = /* @__PURE__ */ createContext4({
|
|
571
1091
|
textValue: "",
|
|
572
1092
|
setTextValue: async (_) => {
|
|
@@ -575,7 +1095,7 @@ var ClipboardContext = /* @__PURE__ */ createContext4({
|
|
|
575
1095
|
var useClipboard = () => useContext6(ClipboardContext);
|
|
576
1096
|
var ClipboardProvider = ({ children }) => {
|
|
577
1097
|
const [textValue, setInternalTextValue] = useState5("");
|
|
578
|
-
const setTextValue =
|
|
1098
|
+
const setTextValue = useCallback4(async (nextValue) => {
|
|
579
1099
|
await navigator.clipboard.writeText(nextValue);
|
|
580
1100
|
return setInternalTextValue(nextValue);
|
|
581
1101
|
}, []);
|
|
@@ -588,12 +1108,12 @@ var ClipboardProvider = ({ children }) => {
|
|
|
588
1108
|
};
|
|
589
1109
|
|
|
590
1110
|
// packages/ui/react-ui/src/components/Clipboard/CopyButton.tsx
|
|
591
|
-
import React16
|
|
1111
|
+
import React16 from "react";
|
|
592
1112
|
import { mx as mx2 } from "@dxos/react-ui-theme";
|
|
593
1113
|
|
|
594
1114
|
// packages/ui/react-ui/src/components/ThemeProvider/ThemeProvider.tsx
|
|
595
1115
|
import { createKeyborg } from "keyborg";
|
|
596
|
-
import React15, { createContext as createContext7, useEffect as
|
|
1116
|
+
import React15, { createContext as createContext7, useEffect as useEffect3, useMemo as useMemo2 } from "react";
|
|
597
1117
|
|
|
598
1118
|
// packages/ui/react-ui/src/util/hasIosKeyboard.ts
|
|
599
1119
|
var hasIosKeyboard = () => {
|
|
@@ -625,7 +1145,7 @@ var ElevationProvider = ({ elevation, children }) => /* @__PURE__ */ React14.cre
|
|
|
625
1145
|
// packages/ui/react-ui/src/components/ThemeProvider/ThemeProvider.tsx
|
|
626
1146
|
var ThemeContext = /* @__PURE__ */ createContext7(void 0);
|
|
627
1147
|
var ThemeProvider = ({ children, fallback = null, resourceExtensions, appNs, tx = (_path, defaultClassName, _styleProps, ..._options) => defaultClassName, themeMode = "dark", rootDensity = "fine", ...rest }) => {
|
|
628
|
-
|
|
1148
|
+
useEffect3(() => {
|
|
629
1149
|
if (document.defaultView) {
|
|
630
1150
|
const kb = createKeyborg(document.defaultView);
|
|
631
1151
|
kb.subscribe(handleInputModalityChange);
|
|
@@ -699,36 +1219,25 @@ var CopyButton = ({ value, classNames, iconProps, ...props }) => {
|
|
|
699
1219
|
...iconProps
|
|
700
1220
|
})));
|
|
701
1221
|
};
|
|
702
|
-
var CopyButtonIconOnly = ({ value, classNames, iconProps, variant, ...props }) => {
|
|
1222
|
+
var CopyButtonIconOnly = ({ __scopeTooltip, value, classNames, iconProps, variant, ...props }) => {
|
|
703
1223
|
const { t } = useTranslation("os");
|
|
704
1224
|
const { textValue, setTextValue } = useClipboard();
|
|
705
1225
|
const isCopied = textValue === value;
|
|
706
1226
|
const label = isCopied ? t("copy success label") : props.label ?? t("copy label");
|
|
707
|
-
const
|
|
708
|
-
return /* @__PURE__ */ React16.createElement(
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
side: "bottom",
|
|
714
|
-
sideOffset: 12
|
|
715
|
-
}, /* @__PURE__ */ React16.createElement("span", null, label), /* @__PURE__ */ React16.createElement(Tooltip.Arrow, null))), /* @__PURE__ */ React16.createElement(Tooltip.Trigger, {
|
|
716
|
-
"aria-label": label,
|
|
717
|
-
...props,
|
|
718
|
-
onClick: () => setTextValue(value).then(() => setOpen(true)),
|
|
719
|
-
"data-testid": "copy-invitation",
|
|
720
|
-
asChild: true
|
|
721
|
-
}, /* @__PURE__ */ React16.createElement(Button, {
|
|
1227
|
+
const { onOpen } = useTooltipContext("CopyButton", __scopeTooltip);
|
|
1228
|
+
return /* @__PURE__ */ React16.createElement(IconButton, {
|
|
1229
|
+
iconOnly: true,
|
|
1230
|
+
label,
|
|
1231
|
+
icon: "ph--copy--regular",
|
|
1232
|
+
size: 5,
|
|
722
1233
|
variant,
|
|
723
1234
|
classNames: [
|
|
724
1235
|
"inline-flex flex-col justify-center",
|
|
725
1236
|
classNames
|
|
726
|
-
]
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
...iconProps
|
|
731
|
-
}))));
|
|
1237
|
+
],
|
|
1238
|
+
onClick: () => setTextValue(value).then(onOpen),
|
|
1239
|
+
"data-testid": "copy-invitation"
|
|
1240
|
+
});
|
|
732
1241
|
};
|
|
733
1242
|
|
|
734
1243
|
// packages/ui/react-ui/src/components/Clipboard/index.ts
|
|
@@ -770,9 +1279,7 @@ var DialogDescription = /* @__PURE__ */ forwardRef11(({ classNames, srOnly, ...p
|
|
|
770
1279
|
var DialogClose = DialogClosePrimitive;
|
|
771
1280
|
var DIALOG_OVERLAY_NAME = "DialogOverlay";
|
|
772
1281
|
var DIALOG_CONTENT_NAME = "DialogContent";
|
|
773
|
-
var [OverlayLayoutProvider, useOverlayLayoutContext] = createContext8(DIALOG_OVERLAY_NAME, {
|
|
774
|
-
inOverlayLayout: false
|
|
775
|
-
});
|
|
1282
|
+
var [OverlayLayoutProvider, useOverlayLayoutContext] = createContext8(DIALOG_OVERLAY_NAME, {});
|
|
776
1283
|
var DialogOverlay = /* @__PURE__ */ forwardRef11(({ classNames, children, blockAlign, ...props }, forwardedRef) => {
|
|
777
1284
|
const { tx } = useThemeContext();
|
|
778
1285
|
return /* @__PURE__ */ React17.createElement(DialogOverlayPrimitive, {
|
|
@@ -787,9 +1294,10 @@ var DialogOverlay = /* @__PURE__ */ forwardRef11(({ classNames, children, blockA
|
|
|
787
1294
|
DialogOverlay.displayName = DIALOG_OVERLAY_NAME;
|
|
788
1295
|
var DialogContent = /* @__PURE__ */ forwardRef11(({ classNames, children, inOverlayLayout: propsInOverlayLayout, ...props }, forwardedRef) => {
|
|
789
1296
|
const { tx } = useThemeContext();
|
|
790
|
-
const { inOverlayLayout } = useOverlayLayoutContext(DIALOG_CONTENT_NAME);
|
|
1297
|
+
const { inOverlayLayout, descriptionId } = useOverlayLayoutContext(DIALOG_CONTENT_NAME);
|
|
791
1298
|
return /* @__PURE__ */ React17.createElement(DialogContentPrimitive, {
|
|
792
|
-
|
|
1299
|
+
// NOTE: Radix warning unless set.
|
|
1300
|
+
"aria-describedby": descriptionId ?? "unknown",
|
|
793
1301
|
...props,
|
|
794
1302
|
className: tx("dialog.content", "dialog", {
|
|
795
1303
|
inOverlayLayout: propsInOverlayLayout || inOverlayLayout
|
|
@@ -883,8 +1391,8 @@ var AlertDialog = {
|
|
|
883
1391
|
|
|
884
1392
|
// packages/ui/react-ui/src/components/Input/Input.tsx
|
|
885
1393
|
import { Root as CheckboxPrimitive } from "@radix-ui/react-checkbox";
|
|
886
|
-
import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
|
887
|
-
import React19, { forwardRef as forwardRef13, useCallback as
|
|
1394
|
+
import { useControllableState as useControllableState2 } from "@radix-ui/react-use-controllable-state";
|
|
1395
|
+
import React19, { forwardRef as forwardRef13, useCallback as useCallback5 } from "react";
|
|
888
1396
|
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";
|
|
889
1397
|
import { mx as mx3 } from "@dxos/react-ui-theme";
|
|
890
1398
|
var Label = /* @__PURE__ */ forwardRef13(({ srOnly, classNames, children, ...props }, forwardedRef) => {
|
|
@@ -934,7 +1442,7 @@ var PinInput = /* @__PURE__ */ forwardRef13(({ density: propsDensity, elevation:
|
|
|
934
1442
|
const { tx } = useThemeContext();
|
|
935
1443
|
const density = useDensityContext(propsDensity);
|
|
936
1444
|
const elevation = useElevationContext(propsElevation);
|
|
937
|
-
const segmentClassName =
|
|
1445
|
+
const segmentClassName = useCallback5(({ focused, validationValence }) => tx("input.input", "input--pin-segment", {
|
|
938
1446
|
variant: "static",
|
|
939
1447
|
focused,
|
|
940
1448
|
disabled: props.disabled,
|
|
@@ -1004,7 +1512,7 @@ var TextArea = /* @__PURE__ */ forwardRef13(({ __inputScope, classNames, density
|
|
|
1004
1512
|
});
|
|
1005
1513
|
});
|
|
1006
1514
|
var Checkbox = /* @__PURE__ */ forwardRef13(({ __inputScope, checked: propsChecked, defaultChecked: propsDefaultChecked, onCheckedChange: propsOnCheckedChange, size, weight = "bold", classNames, ...props }, forwardedRef) => {
|
|
1007
|
-
const [checked, onCheckedChange] =
|
|
1515
|
+
const [checked, onCheckedChange] = useControllableState2({
|
|
1008
1516
|
prop: propsChecked,
|
|
1009
1517
|
defaultProp: propsDefaultChecked,
|
|
1010
1518
|
onChange: propsOnCheckedChange
|
|
@@ -1034,7 +1542,7 @@ var Checkbox = /* @__PURE__ */ forwardRef13(({ __inputScope, checked: propsCheck
|
|
|
1034
1542
|
}));
|
|
1035
1543
|
});
|
|
1036
1544
|
var Switch = /* @__PURE__ */ forwardRef13(({ __inputScope, checked: propsChecked, defaultChecked: propsDefaultChecked, onCheckedChange: propsOnCheckedChange, classNames, ...props }, forwardedRef) => {
|
|
1037
|
-
const [checked, onCheckedChange] =
|
|
1545
|
+
const [checked, onCheckedChange] = useControllableState2({
|
|
1038
1546
|
prop: propsChecked,
|
|
1039
1547
|
defaultProp: propsDefaultChecked ?? false,
|
|
1040
1548
|
onChange: propsOnCheckedChange
|
|
@@ -1127,10 +1635,10 @@ var List = /* @__PURE__ */ forwardRef14(({ classNames, children, ...props }, for
|
|
|
1127
1635
|
}, children));
|
|
1128
1636
|
});
|
|
1129
1637
|
var ListItemEndcap = /* @__PURE__ */ forwardRef14(({ children, classNames, asChild, ...props }, forwardedRef) => {
|
|
1130
|
-
const
|
|
1638
|
+
const Root7 = asChild ? Slot6 : "div";
|
|
1131
1639
|
const density = useDensityContext();
|
|
1132
1640
|
const { tx } = useThemeContext();
|
|
1133
|
-
return /* @__PURE__ */ React21.createElement(
|
|
1641
|
+
return /* @__PURE__ */ React21.createElement(Root7, {
|
|
1134
1642
|
...!asChild && {
|
|
1135
1643
|
role: "none"
|
|
1136
1644
|
},
|
|
@@ -1290,25 +1798,25 @@ var TreeItem = {
|
|
|
1290
1798
|
|
|
1291
1799
|
// packages/ui/react-ui/src/components/Lists/Treegrid.tsx
|
|
1292
1800
|
import { useArrowNavigationGroup, useFocusableGroup } from "@fluentui/react-tabster";
|
|
1293
|
-
import { createContextScope } from "@radix-ui/react-context";
|
|
1294
|
-
import { Primitive as
|
|
1801
|
+
import { createContextScope as createContextScope2 } from "@radix-ui/react-context";
|
|
1802
|
+
import { Primitive as Primitive7 } from "@radix-ui/react-primitive";
|
|
1295
1803
|
import { Slot as Slot7 } from "@radix-ui/react-slot";
|
|
1296
|
-
import { useControllableState as
|
|
1804
|
+
import { useControllableState as useControllableState3 } from "@radix-ui/react-use-controllable-state";
|
|
1297
1805
|
import React24, { forwardRef as forwardRef16 } from "react";
|
|
1298
1806
|
var TREEGRID_ROW_NAME = "TreegridRow";
|
|
1299
|
-
var [createTreegridRowContext, createTreegridRowScope] =
|
|
1807
|
+
var [createTreegridRowContext, createTreegridRowScope] = createContextScope2(TREEGRID_ROW_NAME, []);
|
|
1300
1808
|
var [TreegridRowProvider, useTreegridRowContext] = createTreegridRowContext(TREEGRID_ROW_NAME);
|
|
1301
1809
|
var PATH_SEPARATOR = "~";
|
|
1302
1810
|
var PARENT_OF_SEPARATOR = " ";
|
|
1303
1811
|
var TreegridRoot = /* @__PURE__ */ forwardRef16(({ asChild, classNames, children, style, gridTemplateColumns, ...props }, forwardedRef) => {
|
|
1304
1812
|
const { tx } = useThemeContext();
|
|
1305
|
-
const
|
|
1813
|
+
const Root7 = asChild ? Slot7 : Primitive7.div;
|
|
1306
1814
|
const arrowNavigationAttrs = useArrowNavigationGroup({
|
|
1307
1815
|
axis: "vertical",
|
|
1308
1816
|
tabbable: false,
|
|
1309
1817
|
circular: true
|
|
1310
1818
|
});
|
|
1311
|
-
return /* @__PURE__ */ React24.createElement(
|
|
1819
|
+
return /* @__PURE__ */ React24.createElement(Root7, {
|
|
1312
1820
|
role: "treegrid",
|
|
1313
1821
|
...arrowNavigationAttrs,
|
|
1314
1822
|
...props,
|
|
@@ -1322,10 +1830,10 @@ var TreegridRoot = /* @__PURE__ */ forwardRef16(({ asChild, classNames, children
|
|
|
1322
1830
|
});
|
|
1323
1831
|
var TreegridRow = /* @__PURE__ */ forwardRef16(({ __treegridRowScope, asChild, classNames, children, id, parentOf, open: propsOpen, defaultOpen, onOpenChange: propsOnOpenChange, ...props }, forwardedRef) => {
|
|
1324
1832
|
const { tx } = useThemeContext();
|
|
1325
|
-
const
|
|
1833
|
+
const Root7 = asChild ? Slot7 : Primitive7.div;
|
|
1326
1834
|
const pathParts = id.split(PATH_SEPARATOR);
|
|
1327
1835
|
const level = pathParts.length - 1;
|
|
1328
|
-
const [open, onOpenChange] =
|
|
1836
|
+
const [open, onOpenChange] = useControllableState3({
|
|
1329
1837
|
prop: propsOpen,
|
|
1330
1838
|
onChange: propsOnOpenChange,
|
|
1331
1839
|
defaultProp: defaultOpen
|
|
@@ -1343,7 +1851,7 @@ var TreegridRow = /* @__PURE__ */ forwardRef16(({ __treegridRowScope, asChild, c
|
|
|
1343
1851
|
open,
|
|
1344
1852
|
onOpenChange,
|
|
1345
1853
|
scope: __treegridRowScope
|
|
1346
|
-
}, /* @__PURE__ */ React24.createElement(
|
|
1854
|
+
}, /* @__PURE__ */ React24.createElement(Root7, {
|
|
1347
1855
|
role: "row",
|
|
1348
1856
|
"aria-level": level,
|
|
1349
1857
|
className: tx("treegrid.row", "treegrid__row", {
|
|
@@ -1388,15 +1896,15 @@ var Treegrid = {
|
|
|
1388
1896
|
// packages/ui/react-ui/src/components/Main/Main.tsx
|
|
1389
1897
|
import { createContext as createContext10 } from "@radix-ui/react-context";
|
|
1390
1898
|
import { Root as DialogRoot2, DialogContent as DialogContent2, DialogTitle as DialogTitle2 } from "@radix-ui/react-dialog";
|
|
1391
|
-
import { Primitive as
|
|
1899
|
+
import { Primitive as Primitive8 } from "@radix-ui/react-primitive";
|
|
1392
1900
|
import { Slot as Slot8 } from "@radix-ui/react-slot";
|
|
1393
|
-
import { useControllableState as
|
|
1394
|
-
import React25, { forwardRef as forwardRef17, useCallback as
|
|
1901
|
+
import { useControllableState as useControllableState4 } from "@radix-ui/react-use-controllable-state";
|
|
1902
|
+
import React25, { forwardRef as forwardRef17, useCallback as useCallback7, useEffect as useEffect5, useRef as useRef2, useState as useState7 } from "react";
|
|
1395
1903
|
import { log } from "@dxos/log";
|
|
1396
1904
|
import { useMediaQuery, useForwardedRef } from "@dxos/react-hooks";
|
|
1397
1905
|
|
|
1398
1906
|
// packages/ui/react-ui/src/components/Main/useSwipeToDismiss.ts
|
|
1399
|
-
import { useCallback as
|
|
1907
|
+
import { useCallback as useCallback6, useEffect as useEffect4, useState as useState6 } from "react";
|
|
1400
1908
|
var MotionState;
|
|
1401
1909
|
(function(MotionState2) {
|
|
1402
1910
|
MotionState2[MotionState2["IDLE"] = 0] = "IDLE";
|
|
@@ -1411,22 +1919,22 @@ var useSwipeToDismiss = (ref, {
|
|
|
1411
1919
|
/* side = 'inline-start' */
|
|
1412
1920
|
}) => {
|
|
1413
1921
|
const $root = ref.current;
|
|
1414
|
-
const [motionState, setMotionState] =
|
|
1415
|
-
const [gestureStartX, setGestureStartX] =
|
|
1416
|
-
const setIdle =
|
|
1922
|
+
const [motionState, setMotionState] = useState6(0);
|
|
1923
|
+
const [gestureStartX, setGestureStartX] = useState6(0);
|
|
1924
|
+
const setIdle = useCallback6(() => {
|
|
1417
1925
|
setMotionState(0);
|
|
1418
1926
|
$root?.style.removeProperty("inset-inline-start");
|
|
1419
1927
|
$root?.style.setProperty("transition-duration", "200ms");
|
|
1420
1928
|
}, [
|
|
1421
1929
|
$root
|
|
1422
1930
|
]);
|
|
1423
|
-
const setFollowing =
|
|
1931
|
+
const setFollowing = useCallback6(() => {
|
|
1424
1932
|
setMotionState(2);
|
|
1425
1933
|
$root?.style.setProperty("transition-duration", "0ms");
|
|
1426
1934
|
}, [
|
|
1427
1935
|
$root
|
|
1428
1936
|
]);
|
|
1429
|
-
const handlePointerDown =
|
|
1937
|
+
const handlePointerDown = useCallback6(({ screenX }) => {
|
|
1430
1938
|
if (motionState === 0) {
|
|
1431
1939
|
setMotionState(1);
|
|
1432
1940
|
setGestureStartX(screenX);
|
|
@@ -1434,7 +1942,7 @@ var useSwipeToDismiss = (ref, {
|
|
|
1434
1942
|
}, [
|
|
1435
1943
|
motionState
|
|
1436
1944
|
]);
|
|
1437
|
-
const handlePointerMove =
|
|
1945
|
+
const handlePointerMove = useCallback6(({ screenX }) => {
|
|
1438
1946
|
if ($root) {
|
|
1439
1947
|
const delta = Math.min(screenX - gestureStartX, 0);
|
|
1440
1948
|
switch (motionState) {
|
|
@@ -1458,12 +1966,12 @@ var useSwipeToDismiss = (ref, {
|
|
|
1458
1966
|
motionState,
|
|
1459
1967
|
gestureStartX
|
|
1460
1968
|
]);
|
|
1461
|
-
const handlePointerUp =
|
|
1969
|
+
const handlePointerUp = useCallback6(() => {
|
|
1462
1970
|
setIdle();
|
|
1463
1971
|
}, [
|
|
1464
1972
|
setIdle
|
|
1465
1973
|
]);
|
|
1466
|
-
|
|
1974
|
+
useEffect4(() => {
|
|
1467
1975
|
$root?.addEventListener("pointerdown", handlePointerDown);
|
|
1468
1976
|
return () => {
|
|
1469
1977
|
$root?.removeEventListener("pointerdown", handlePointerDown);
|
|
@@ -1472,7 +1980,7 @@ var useSwipeToDismiss = (ref, {
|
|
|
1472
1980
|
$root,
|
|
1473
1981
|
handlePointerDown
|
|
1474
1982
|
]);
|
|
1475
|
-
|
|
1983
|
+
useEffect4(() => {
|
|
1476
1984
|
$root && document.documentElement.addEventListener("pointermove", handlePointerMove);
|
|
1477
1985
|
return () => {
|
|
1478
1986
|
document.documentElement.removeEventListener("pointermove", handlePointerMove);
|
|
@@ -1481,7 +1989,7 @@ var useSwipeToDismiss = (ref, {
|
|
|
1481
1989
|
$root,
|
|
1482
1990
|
handlePointerMove
|
|
1483
1991
|
]);
|
|
1484
|
-
|
|
1992
|
+
useEffect4(() => {
|
|
1485
1993
|
$root && document.documentElement.addEventListener("pointerup", handlePointerUp);
|
|
1486
1994
|
return () => {
|
|
1487
1995
|
document.documentElement.removeEventListener("pointerup", handlePointerUp);
|
|
@@ -1501,7 +2009,7 @@ var MAIN_NAME = "Main";
|
|
|
1501
2009
|
var GENERIC_CONSUMER_NAME = "GenericConsumer";
|
|
1502
2010
|
var landmarkAttr = "data-main-landmark";
|
|
1503
2011
|
var useLandmarkMover = (propsOnKeyDown, landmark) => {
|
|
1504
|
-
const handleKeyDown =
|
|
2012
|
+
const handleKeyDown = useCallback7((event) => {
|
|
1505
2013
|
const target = event.target;
|
|
1506
2014
|
if (event.target === event.currentTarget && event.key === "Tab" && target.hasAttribute(landmarkAttr)) {
|
|
1507
2015
|
event.preventDefault();
|
|
@@ -1554,22 +2062,22 @@ var useSidebars = (consumerName = GENERIC_CONSUMER_NAME) => {
|
|
|
1554
2062
|
return {
|
|
1555
2063
|
navigationSidebarState,
|
|
1556
2064
|
setNavigationSidebarState,
|
|
1557
|
-
toggleNavigationSidebar:
|
|
2065
|
+
toggleNavigationSidebar: useCallback7(() => setNavigationSidebarState(navigationSidebarState === "expanded" ? "closed" : "expanded"), [
|
|
1558
2066
|
navigationSidebarState,
|
|
1559
2067
|
setNavigationSidebarState
|
|
1560
2068
|
]),
|
|
1561
|
-
openNavigationSidebar:
|
|
1562
|
-
collapseNavigationSidebar:
|
|
1563
|
-
closeNavigationSidebar:
|
|
2069
|
+
openNavigationSidebar: useCallback7(() => setNavigationSidebarState("expanded"), []),
|
|
2070
|
+
collapseNavigationSidebar: useCallback7(() => setNavigationSidebarState("collapsed"), []),
|
|
2071
|
+
closeNavigationSidebar: useCallback7(() => setNavigationSidebarState("closed"), []),
|
|
1564
2072
|
complementarySidebarState,
|
|
1565
2073
|
setComplementarySidebarState,
|
|
1566
|
-
toggleComplementarySidebar:
|
|
2074
|
+
toggleComplementarySidebar: useCallback7(() => setComplementarySidebarState(complementarySidebarState === "expanded" ? "closed" : "expanded"), [
|
|
1567
2075
|
complementarySidebarState,
|
|
1568
2076
|
setComplementarySidebarState
|
|
1569
2077
|
]),
|
|
1570
|
-
openComplementarySidebar:
|
|
1571
|
-
collapseComplementarySidebar:
|
|
1572
|
-
closeComplementarySidebar:
|
|
2078
|
+
openComplementarySidebar: useCallback7(() => setComplementarySidebarState("expanded"), []),
|
|
2079
|
+
collapseComplementarySidebar: useCallback7(() => setComplementarySidebarState("collapsed"), []),
|
|
2080
|
+
closeComplementarySidebar: useCallback7(() => setComplementarySidebarState("closed"), [])
|
|
1573
2081
|
};
|
|
1574
2082
|
};
|
|
1575
2083
|
var resizeDebounce = 3e3;
|
|
@@ -1577,19 +2085,19 @@ var MainRoot = ({ navigationSidebarState: propsNavigationSidebarState, defaultNa
|
|
|
1577
2085
|
const [isLg] = useMediaQuery("lg", {
|
|
1578
2086
|
ssr: false
|
|
1579
2087
|
});
|
|
1580
|
-
const [navigationSidebarState = isLg ? "expanded" : "collapsed", setNavigationSidebarState] =
|
|
2088
|
+
const [navigationSidebarState = isLg ? "expanded" : "collapsed", setNavigationSidebarState] = useControllableState4({
|
|
1581
2089
|
prop: propsNavigationSidebarState,
|
|
1582
2090
|
defaultProp: defaultNavigationSidebarState,
|
|
1583
2091
|
onChange: onNavigationSidebarStateChange
|
|
1584
2092
|
});
|
|
1585
|
-
const [complementarySidebarState = isLg ? "expanded" : "collapsed", setComplementarySidebarState] =
|
|
2093
|
+
const [complementarySidebarState = isLg ? "expanded" : "collapsed", setComplementarySidebarState] = useControllableState4({
|
|
1586
2094
|
prop: propsComplementarySidebarState,
|
|
1587
2095
|
defaultProp: defaultComplementarySidebarState,
|
|
1588
2096
|
onChange: onComplementarySidebarStateChange
|
|
1589
2097
|
});
|
|
1590
|
-
const [resizing, setResizing] =
|
|
1591
|
-
const resizeInterval =
|
|
1592
|
-
const handleResize =
|
|
2098
|
+
const [resizing, setResizing] = useState7(false);
|
|
2099
|
+
const resizeInterval = useRef2(null);
|
|
2100
|
+
const handleResize = useCallback7(() => {
|
|
1593
2101
|
setResizing(true);
|
|
1594
2102
|
if (resizeInterval.current) {
|
|
1595
2103
|
clearTimeout(resizeInterval.current);
|
|
@@ -1599,7 +2107,7 @@ var MainRoot = ({ navigationSidebarState: propsNavigationSidebarState, defaultNa
|
|
|
1599
2107
|
resizeInterval.current = null;
|
|
1600
2108
|
}, resizeDebounce);
|
|
1601
2109
|
}, []);
|
|
1602
|
-
|
|
2110
|
+
useEffect5(() => {
|
|
1603
2111
|
window.addEventListener("resize", handleResize);
|
|
1604
2112
|
return () => window.removeEventListener("resize", handleResize);
|
|
1605
2113
|
}, [
|
|
@@ -1625,11 +2133,11 @@ var MainSidebar = /* @__PURE__ */ forwardRef17(({ classNames, children, swipeToD
|
|
|
1625
2133
|
const { tx } = useThemeContext();
|
|
1626
2134
|
const { t } = useTranslation();
|
|
1627
2135
|
const ref = useForwardedRef(forwardedRef);
|
|
1628
|
-
const noopRef =
|
|
2136
|
+
const noopRef = useRef2(null);
|
|
1629
2137
|
useSwipeToDismiss(swipeToDismiss ? ref : noopRef, {
|
|
1630
2138
|
onDismiss: () => onStateChange?.("closed")
|
|
1631
2139
|
});
|
|
1632
|
-
const handleKeyDown =
|
|
2140
|
+
const handleKeyDown = useCallback7((event) => {
|
|
1633
2141
|
if (event.key === "Escape") {
|
|
1634
2142
|
event.target.closest("[data-tabster]")?.focus();
|
|
1635
2143
|
}
|
|
@@ -1637,14 +2145,14 @@ var MainSidebar = /* @__PURE__ */ forwardRef17(({ classNames, children, swipeToD
|
|
|
1637
2145
|
}, [
|
|
1638
2146
|
props.onKeyDown
|
|
1639
2147
|
]);
|
|
1640
|
-
const
|
|
2148
|
+
const Root7 = isLg ? Primitive8.div : DialogContent2;
|
|
1641
2149
|
return /* @__PURE__ */ React25.createElement(DialogRoot2, {
|
|
1642
2150
|
open: state !== "closed",
|
|
1643
2151
|
"aria-label": toLocalizedString(label, t),
|
|
1644
2152
|
modal: false
|
|
1645
2153
|
}, !isLg && /* @__PURE__ */ React25.createElement(DialogTitle2, {
|
|
1646
2154
|
className: "sr-only"
|
|
1647
|
-
}, toLocalizedString(label, t)), /* @__PURE__ */ React25.createElement(
|
|
2155
|
+
}, toLocalizedString(label, t)), /* @__PURE__ */ React25.createElement(Root7, {
|
|
1648
2156
|
...!isLg && {
|
|
1649
2157
|
forceMount: true,
|
|
1650
2158
|
tabIndex: -1,
|
|
@@ -1693,9 +2201,9 @@ MainNavigationSidebar.displayName = NAVIGATION_SIDEBAR_NAME;
|
|
|
1693
2201
|
var MainContent = /* @__PURE__ */ forwardRef17(({ asChild, classNames, bounce, handlesFocus, children, role, ...props }, forwardedRef) => {
|
|
1694
2202
|
const { navigationSidebarState, complementarySidebarState } = useMainContext(MAIN_NAME);
|
|
1695
2203
|
const { tx } = useThemeContext();
|
|
1696
|
-
const
|
|
2204
|
+
const Root7 = asChild ? Slot8 : role ? "div" : "main";
|
|
1697
2205
|
const mover = useLandmarkMover(props.onKeyDown, "1");
|
|
1698
|
-
return /* @__PURE__ */ React25.createElement(
|
|
2206
|
+
return /* @__PURE__ */ React25.createElement(Root7, {
|
|
1699
2207
|
role,
|
|
1700
2208
|
...handlesFocus && {
|
|
1701
2209
|
...mover
|
|
@@ -1743,9 +2251,31 @@ var Main = {
|
|
|
1743
2251
|
|
|
1744
2252
|
// packages/ui/react-ui/src/components/Menus/ContextMenu.tsx
|
|
1745
2253
|
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
|
|
1746
|
-
import { Primitive as
|
|
2254
|
+
import { Primitive as Primitive9 } from "@radix-ui/react-primitive";
|
|
1747
2255
|
import { Slot as Slot9 } from "@radix-ui/react-slot";
|
|
1748
2256
|
import React26, { forwardRef as forwardRef18 } from "react";
|
|
2257
|
+
|
|
2258
|
+
// packages/ui/react-ui/src/hooks/useSafeCollisionPadding.ts
|
|
2259
|
+
import { useMemo as useMemo3 } from "react";
|
|
2260
|
+
var propIsNumber = (prop) => Number.isFinite(prop);
|
|
2261
|
+
var propsIsRecord = (prop) => !!(prop && typeof prop === "object");
|
|
2262
|
+
var safePadding = (propsPadding, safePadding2, side) => {
|
|
2263
|
+
return (propIsNumber(safePadding2[side]) ? safePadding2[side] : 0) + (propIsNumber(propsPadding) ? propsPadding : propsIsRecord(propsPadding) ? propsPadding[side] ?? 0 : 0);
|
|
2264
|
+
};
|
|
2265
|
+
var useSafeCollisionPadding = (collisionPadding) => {
|
|
2266
|
+
const { safeAreaPadding } = useThemeContext();
|
|
2267
|
+
return useMemo3(() => ({
|
|
2268
|
+
top: safePadding(collisionPadding, safeAreaPadding, "top"),
|
|
2269
|
+
right: safePadding(collisionPadding, safeAreaPadding, "right"),
|
|
2270
|
+
bottom: safePadding(collisionPadding, safeAreaPadding, "bottom"),
|
|
2271
|
+
left: safePadding(collisionPadding, safeAreaPadding, "left")
|
|
2272
|
+
}), [
|
|
2273
|
+
collisionPadding,
|
|
2274
|
+
safeAreaPadding
|
|
2275
|
+
]);
|
|
2276
|
+
};
|
|
2277
|
+
|
|
2278
|
+
// packages/ui/react-ui/src/components/Menus/ContextMenu.tsx
|
|
1749
2279
|
var ContextMenuRoot = ContextMenuPrimitive.ContextMenu;
|
|
1750
2280
|
var ContextMenuTrigger = ContextMenuPrimitive.Trigger;
|
|
1751
2281
|
var ContextMenuPortal = ContextMenuPrimitive.Portal;
|
|
@@ -1764,8 +2294,8 @@ var ContextMenuContent = /* @__PURE__ */ forwardRef18(({ classNames, children, c
|
|
|
1764
2294
|
});
|
|
1765
2295
|
var ContextMenuViewport = /* @__PURE__ */ forwardRef18(({ classNames, asChild, children, ...props }, forwardedRef) => {
|
|
1766
2296
|
const { tx } = useThemeContext();
|
|
1767
|
-
const
|
|
1768
|
-
return /* @__PURE__ */ React26.createElement(
|
|
2297
|
+
const Root7 = asChild ? Slot9 : Primitive9.div;
|
|
2298
|
+
return /* @__PURE__ */ React26.createElement(Root7, {
|
|
1769
2299
|
...props,
|
|
1770
2300
|
className: tx("menu.viewport", "menu__viewport", {}, classNames),
|
|
1771
2301
|
ref: forwardedRef
|
|
@@ -1829,18 +2359,18 @@ var ContextMenu2 = {
|
|
|
1829
2359
|
};
|
|
1830
2360
|
|
|
1831
2361
|
// packages/ui/react-ui/src/components/Menus/DropdownMenu.tsx
|
|
1832
|
-
import { composeEventHandlers } from "@radix-ui/primitive";
|
|
2362
|
+
import { composeEventHandlers as composeEventHandlers2 } from "@radix-ui/primitive";
|
|
1833
2363
|
import { composeRefs } from "@radix-ui/react-compose-refs";
|
|
1834
|
-
import { createContextScope as
|
|
1835
|
-
import { useId as
|
|
2364
|
+
import { createContextScope as createContextScope3 } from "@radix-ui/react-context";
|
|
2365
|
+
import { useId as useId3 } from "@radix-ui/react-id";
|
|
1836
2366
|
import * as MenuPrimitive from "@radix-ui/react-menu";
|
|
1837
2367
|
import { createMenuScope } from "@radix-ui/react-menu";
|
|
1838
|
-
import { Primitive as
|
|
2368
|
+
import { Primitive as Primitive10 } from "@radix-ui/react-primitive";
|
|
1839
2369
|
import { Slot as Slot10 } from "@radix-ui/react-slot";
|
|
1840
|
-
import { useControllableState as
|
|
1841
|
-
import React27, { useRef as
|
|
2370
|
+
import { useControllableState as useControllableState5 } from "@radix-ui/react-use-controllable-state";
|
|
2371
|
+
import React27, { useRef as useRef3, useCallback as useCallback8, forwardRef as forwardRef19, useEffect as useEffect6 } from "react";
|
|
1842
2372
|
var DROPDOWN_MENU_NAME = "DropdownMenu";
|
|
1843
|
-
var [createDropdownMenuContext, createDropdownMenuScope] =
|
|
2373
|
+
var [createDropdownMenuContext, createDropdownMenuScope] = createContextScope3(DROPDOWN_MENU_NAME, [
|
|
1844
2374
|
createMenuScope
|
|
1845
2375
|
]);
|
|
1846
2376
|
var useMenuScope = createMenuScope();
|
|
@@ -1848,20 +2378,20 @@ var [DropdownMenuProvider, useDropdownMenuContext] = createDropdownMenuContext(D
|
|
|
1848
2378
|
var DropdownMenuRoot = (props) => {
|
|
1849
2379
|
const { __scopeDropdownMenu, children, dir, open: openProp, defaultOpen, onOpenChange, modal = true } = props;
|
|
1850
2380
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1851
|
-
const triggerRef =
|
|
1852
|
-
const [open = false, setOpen] =
|
|
2381
|
+
const triggerRef = useRef3(null);
|
|
2382
|
+
const [open = false, setOpen] = useControllableState5({
|
|
1853
2383
|
prop: openProp,
|
|
1854
2384
|
defaultProp: defaultOpen,
|
|
1855
2385
|
onChange: onOpenChange
|
|
1856
2386
|
});
|
|
1857
2387
|
return /* @__PURE__ */ React27.createElement(DropdownMenuProvider, {
|
|
1858
2388
|
scope: __scopeDropdownMenu,
|
|
1859
|
-
triggerId:
|
|
2389
|
+
triggerId: useId3(),
|
|
1860
2390
|
triggerRef,
|
|
1861
|
-
contentId:
|
|
2391
|
+
contentId: useId3(),
|
|
1862
2392
|
open,
|
|
1863
2393
|
onOpenChange: setOpen,
|
|
1864
|
-
onOpenToggle:
|
|
2394
|
+
onOpenToggle: useCallback8(() => setOpen((prevOpen) => !prevOpen), [
|
|
1865
2395
|
setOpen
|
|
1866
2396
|
]),
|
|
1867
2397
|
modal
|
|
@@ -1874,15 +2404,15 @@ var DropdownMenuRoot = (props) => {
|
|
|
1874
2404
|
}, children));
|
|
1875
2405
|
};
|
|
1876
2406
|
DropdownMenuRoot.displayName = DROPDOWN_MENU_NAME;
|
|
1877
|
-
var
|
|
2407
|
+
var TRIGGER_NAME2 = "DropdownMenuTrigger";
|
|
1878
2408
|
var DropdownMenuTrigger = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
|
|
1879
2409
|
const { __scopeDropdownMenu, disabled = false, ...triggerProps } = props;
|
|
1880
|
-
const context = useDropdownMenuContext(
|
|
2410
|
+
const context = useDropdownMenuContext(TRIGGER_NAME2, __scopeDropdownMenu);
|
|
1881
2411
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1882
2412
|
return /* @__PURE__ */ React27.createElement(MenuPrimitive.Anchor, {
|
|
1883
2413
|
asChild: true,
|
|
1884
2414
|
...menuScope
|
|
1885
|
-
}, /* @__PURE__ */ React27.createElement(
|
|
2415
|
+
}, /* @__PURE__ */ React27.createElement(Primitive10.button, {
|
|
1886
2416
|
type: "button",
|
|
1887
2417
|
id: context.triggerId,
|
|
1888
2418
|
"aria-haspopup": "menu",
|
|
@@ -1893,7 +2423,7 @@ var DropdownMenuTrigger = /* @__PURE__ */ forwardRef19((props, forwardedRef) =>
|
|
|
1893
2423
|
disabled,
|
|
1894
2424
|
...triggerProps,
|
|
1895
2425
|
ref: composeRefs(forwardedRef, context.triggerRef),
|
|
1896
|
-
onPointerDown:
|
|
2426
|
+
onPointerDown: composeEventHandlers2(props.onPointerDown, (event) => {
|
|
1897
2427
|
if (!disabled && event.button === 0 && event.ctrlKey === false) {
|
|
1898
2428
|
context.onOpenToggle();
|
|
1899
2429
|
if (!context.open) {
|
|
@@ -1901,7 +2431,7 @@ var DropdownMenuTrigger = /* @__PURE__ */ forwardRef19((props, forwardedRef) =>
|
|
|
1901
2431
|
}
|
|
1902
2432
|
}
|
|
1903
2433
|
}),
|
|
1904
|
-
onKeyDown:
|
|
2434
|
+
onKeyDown: composeEventHandlers2(props.onKeyDown, (event) => {
|
|
1905
2435
|
if (disabled) {
|
|
1906
2436
|
return;
|
|
1907
2437
|
}
|
|
@@ -1924,13 +2454,13 @@ var DropdownMenuTrigger = /* @__PURE__ */ forwardRef19((props, forwardedRef) =>
|
|
|
1924
2454
|
})
|
|
1925
2455
|
}));
|
|
1926
2456
|
});
|
|
1927
|
-
DropdownMenuTrigger.displayName =
|
|
2457
|
+
DropdownMenuTrigger.displayName = TRIGGER_NAME2;
|
|
1928
2458
|
var VIRTUAL_TRIGGER_NAME = "DropdownMenuVirtualTrigger";
|
|
1929
2459
|
var DropdownMenuVirtualTrigger = (props) => {
|
|
1930
2460
|
const { __scopeDropdownMenu, virtualRef } = props;
|
|
1931
2461
|
const context = useDropdownMenuContext(VIRTUAL_TRIGGER_NAME, __scopeDropdownMenu);
|
|
1932
2462
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1933
|
-
|
|
2463
|
+
useEffect6(() => {
|
|
1934
2464
|
if (virtualRef.current) {
|
|
1935
2465
|
context.triggerRef.current = virtualRef.current;
|
|
1936
2466
|
}
|
|
@@ -1941,7 +2471,7 @@ var DropdownMenuVirtualTrigger = (props) => {
|
|
|
1941
2471
|
});
|
|
1942
2472
|
};
|
|
1943
2473
|
DropdownMenuVirtualTrigger.displayName = VIRTUAL_TRIGGER_NAME;
|
|
1944
|
-
var
|
|
2474
|
+
var PORTAL_NAME2 = "DropdownMenuPortal";
|
|
1945
2475
|
var DropdownMenuPortal = (props) => {
|
|
1946
2476
|
const { __scopeDropdownMenu, ...portalProps } = props;
|
|
1947
2477
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
@@ -1950,24 +2480,24 @@ var DropdownMenuPortal = (props) => {
|
|
|
1950
2480
|
...portalProps
|
|
1951
2481
|
});
|
|
1952
2482
|
};
|
|
1953
|
-
DropdownMenuPortal.displayName =
|
|
2483
|
+
DropdownMenuPortal.displayName = PORTAL_NAME2;
|
|
1954
2484
|
var DropdownMenuViewport = /* @__PURE__ */ forwardRef19(({ classNames, asChild, children, ...props }, forwardedRef) => {
|
|
1955
2485
|
const { tx } = useThemeContext();
|
|
1956
|
-
const
|
|
1957
|
-
return /* @__PURE__ */ React27.createElement(
|
|
2486
|
+
const Root7 = asChild ? Slot10 : Primitive10.div;
|
|
2487
|
+
return /* @__PURE__ */ React27.createElement(Root7, {
|
|
1958
2488
|
...props,
|
|
1959
2489
|
className: tx("menu.viewport", "menu__viewport", {}, classNames),
|
|
1960
2490
|
ref: forwardedRef
|
|
1961
2491
|
}, children);
|
|
1962
2492
|
});
|
|
1963
|
-
var
|
|
2493
|
+
var CONTENT_NAME2 = "DropdownMenuContent";
|
|
1964
2494
|
var DropdownMenuContent = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
|
|
1965
2495
|
const { __scopeDropdownMenu, classNames, collisionPadding = 8, ...contentProps } = props;
|
|
1966
2496
|
const { tx } = useThemeContext();
|
|
1967
|
-
const context = useDropdownMenuContext(
|
|
2497
|
+
const context = useDropdownMenuContext(CONTENT_NAME2, __scopeDropdownMenu);
|
|
1968
2498
|
const elevation = useElevationContext();
|
|
1969
2499
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1970
|
-
const hasInteractedOutsideRef =
|
|
2500
|
+
const hasInteractedOutsideRef = useRef3(false);
|
|
1971
2501
|
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
1972
2502
|
return /* @__PURE__ */ React27.createElement(MenuPrimitive.Content, {
|
|
1973
2503
|
id: context.contentId,
|
|
@@ -1976,14 +2506,14 @@ var DropdownMenuContent = /* @__PURE__ */ forwardRef19((props, forwardedRef) =>
|
|
|
1976
2506
|
...contentProps,
|
|
1977
2507
|
collisionPadding: safeCollisionPadding,
|
|
1978
2508
|
ref: forwardedRef,
|
|
1979
|
-
onCloseAutoFocus:
|
|
2509
|
+
onCloseAutoFocus: composeEventHandlers2(props.onCloseAutoFocus, (event) => {
|
|
1980
2510
|
if (!hasInteractedOutsideRef.current) {
|
|
1981
2511
|
context.triggerRef.current?.focus();
|
|
1982
2512
|
}
|
|
1983
2513
|
hasInteractedOutsideRef.current = false;
|
|
1984
2514
|
event.preventDefault();
|
|
1985
2515
|
}),
|
|
1986
|
-
onInteractOutside:
|
|
2516
|
+
onInteractOutside: composeEventHandlers2(props.onInteractOutside, (event) => {
|
|
1987
2517
|
const originalEvent = event.detail.originalEvent;
|
|
1988
2518
|
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
1989
2519
|
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
@@ -2007,7 +2537,7 @@ var DropdownMenuContent = /* @__PURE__ */ forwardRef19((props, forwardedRef) =>
|
|
|
2007
2537
|
}
|
|
2008
2538
|
});
|
|
2009
2539
|
});
|
|
2010
|
-
DropdownMenuContent.displayName =
|
|
2540
|
+
DropdownMenuContent.displayName = CONTENT_NAME2;
|
|
2011
2541
|
var GROUP_NAME = "DropdownMenuGroup";
|
|
2012
2542
|
var DropdownMenuGroup = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
|
|
2013
2543
|
const { __scopeDropdownMenu, ...groupProps } = props;
|
|
@@ -2104,7 +2634,7 @@ var DropdownMenuSeparator = /* @__PURE__ */ forwardRef19((props, forwardedRef) =
|
|
|
2104
2634
|
});
|
|
2105
2635
|
});
|
|
2106
2636
|
DropdownMenuSeparator.displayName = SEPARATOR_NAME;
|
|
2107
|
-
var
|
|
2637
|
+
var ARROW_NAME2 = "DropdownMenuArrow";
|
|
2108
2638
|
var DropdownMenuArrow = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
|
|
2109
2639
|
const { __scopeDropdownMenu, classNames, ...arrowProps } = props;
|
|
2110
2640
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
@@ -2116,11 +2646,11 @@ var DropdownMenuArrow = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
|
|
|
2116
2646
|
ref: forwardedRef
|
|
2117
2647
|
});
|
|
2118
2648
|
});
|
|
2119
|
-
DropdownMenuArrow.displayName =
|
|
2649
|
+
DropdownMenuArrow.displayName = ARROW_NAME2;
|
|
2120
2650
|
var DropdownMenuSub = (props) => {
|
|
2121
2651
|
const { __scopeDropdownMenu, children, open: openProp, onOpenChange, defaultOpen } = props;
|
|
2122
2652
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
2123
|
-
const [open = false, setOpen] =
|
|
2653
|
+
const [open = false, setOpen] = useControllableState5({
|
|
2124
2654
|
prop: openProp,
|
|
2125
2655
|
defaultProp: defaultOpen,
|
|
2126
2656
|
onChange: onOpenChange
|
|
@@ -2188,22 +2718,22 @@ var useDropdownMenuMenuScope = useMenuScope;
|
|
|
2188
2718
|
|
|
2189
2719
|
// packages/ui/react-ui/src/components/Message/Message.tsx
|
|
2190
2720
|
import { createContext as createContext11 } from "@radix-ui/react-context";
|
|
2191
|
-
import { Primitive as
|
|
2721
|
+
import { Primitive as Primitive11 } from "@radix-ui/react-primitive";
|
|
2192
2722
|
import { Slot as Slot11 } from "@radix-ui/react-slot";
|
|
2193
2723
|
import React28, { forwardRef as forwardRef20 } from "react";
|
|
2194
|
-
import { useId as
|
|
2724
|
+
import { useId as useId4 } from "@dxos/react-hooks";
|
|
2195
2725
|
var MESSAGE_NAME = "Message";
|
|
2196
2726
|
var [MessageProvider, useMessageContext] = createContext11(MESSAGE_NAME);
|
|
2197
2727
|
var MessageRoot = /* @__PURE__ */ forwardRef20(({ asChild, valence, elevation: propsElevation, className, titleId: propsTitleId, descriptionId: propsDescriptionId, children, ...props }, forwardedRef) => {
|
|
2198
2728
|
const { tx } = useThemeContext();
|
|
2199
|
-
const titleId =
|
|
2200
|
-
const descriptionId =
|
|
2729
|
+
const titleId = useId4("message__title", propsTitleId);
|
|
2730
|
+
const descriptionId = useId4("message__description", propsDescriptionId);
|
|
2201
2731
|
const elevation = useElevationContext(propsElevation);
|
|
2202
|
-
const
|
|
2732
|
+
const Root7 = asChild ? Slot11 : Primitive11.div;
|
|
2203
2733
|
return /* @__PURE__ */ React28.createElement(MessageProvider, {
|
|
2204
2734
|
titleId,
|
|
2205
2735
|
descriptionId
|
|
2206
|
-
}, /* @__PURE__ */ React28.createElement(
|
|
2736
|
+
}, /* @__PURE__ */ React28.createElement(Root7, {
|
|
2207
2737
|
...props,
|
|
2208
2738
|
className: tx("message.root", "message", {
|
|
2209
2739
|
valence,
|
|
@@ -2219,8 +2749,8 @@ var MESSAGE_TITLE_NAME = "MessageTitle";
|
|
|
2219
2749
|
var MessageTitle = /* @__PURE__ */ forwardRef20(({ asChild, className, children, ...props }, forwardedRef) => {
|
|
2220
2750
|
const { tx } = useThemeContext();
|
|
2221
2751
|
const { titleId } = useMessageContext(MESSAGE_TITLE_NAME);
|
|
2222
|
-
const
|
|
2223
|
-
return /* @__PURE__ */ React28.createElement(
|
|
2752
|
+
const Root7 = asChild ? Slot11 : Primitive11.h2;
|
|
2753
|
+
return /* @__PURE__ */ React28.createElement(Root7, {
|
|
2224
2754
|
...props,
|
|
2225
2755
|
className: tx("message.title", "message__title", {}, className),
|
|
2226
2756
|
id: titleId,
|
|
@@ -2232,8 +2762,8 @@ var MESSAGE_BODY_NAME = "MessageBody";
|
|
|
2232
2762
|
var MessageBody = /* @__PURE__ */ forwardRef20(({ asChild, className, children, ...props }, forwardedRef) => {
|
|
2233
2763
|
const { tx } = useThemeContext();
|
|
2234
2764
|
const { descriptionId } = useMessageContext(MESSAGE_BODY_NAME);
|
|
2235
|
-
const
|
|
2236
|
-
return /* @__PURE__ */ React28.createElement(
|
|
2765
|
+
const Root7 = asChild ? Slot11 : Primitive11.p;
|
|
2766
|
+
return /* @__PURE__ */ React28.createElement(Root7, {
|
|
2237
2767
|
...props,
|
|
2238
2768
|
className: tx("message.body", "message__body", {}, className),
|
|
2239
2769
|
id: descriptionId,
|
|
@@ -2248,51 +2778,51 @@ var Message = {
|
|
|
2248
2778
|
};
|
|
2249
2779
|
|
|
2250
2780
|
// packages/ui/react-ui/src/components/Popover/Popover.tsx
|
|
2251
|
-
import { composeEventHandlers as
|
|
2252
|
-
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
2253
|
-
import { createContextScope as
|
|
2254
|
-
import { DismissableLayer } from "@radix-ui/react-dismissable-layer";
|
|
2781
|
+
import { composeEventHandlers as composeEventHandlers3 } from "@radix-ui/primitive";
|
|
2782
|
+
import { useComposedRefs as useComposedRefs2 } from "@radix-ui/react-compose-refs";
|
|
2783
|
+
import { createContextScope as createContextScope4 } from "@radix-ui/react-context";
|
|
2784
|
+
import { DismissableLayer as DismissableLayer2 } from "@radix-ui/react-dismissable-layer";
|
|
2255
2785
|
import { useFocusGuards } from "@radix-ui/react-focus-guards";
|
|
2256
2786
|
import { FocusScope } from "@radix-ui/react-focus-scope";
|
|
2257
|
-
import { useId as
|
|
2258
|
-
import * as
|
|
2259
|
-
import { createPopperScope } from "@radix-ui/react-popper";
|
|
2260
|
-
import { Portal as
|
|
2261
|
-
import { Presence } from "@radix-ui/react-presence";
|
|
2262
|
-
import { Primitive as
|
|
2787
|
+
import { useId as useId5 } from "@radix-ui/react-id";
|
|
2788
|
+
import * as PopperPrimitive2 from "@radix-ui/react-popper";
|
|
2789
|
+
import { createPopperScope as createPopperScope2 } from "@radix-ui/react-popper";
|
|
2790
|
+
import { Portal as PortalPrimitive2 } from "@radix-ui/react-portal";
|
|
2791
|
+
import { Presence as Presence2 } from "@radix-ui/react-presence";
|
|
2792
|
+
import { Primitive as Primitive12 } from "@radix-ui/react-primitive";
|
|
2263
2793
|
import { Slot as Slot12 } from "@radix-ui/react-slot";
|
|
2264
|
-
import { useControllableState as
|
|
2794
|
+
import { useControllableState as useControllableState6 } from "@radix-ui/react-use-controllable-state";
|
|
2265
2795
|
import { hideOthers } from "aria-hidden";
|
|
2266
|
-
import React29, { forwardRef as forwardRef21, useRef as
|
|
2796
|
+
import React29, { forwardRef as forwardRef21, useRef as useRef4, useCallback as useCallback9, useState as useState8, useEffect as useEffect7 } from "react";
|
|
2267
2797
|
import { RemoveScroll } from "react-remove-scroll";
|
|
2268
2798
|
var POPOVER_NAME = "Popover";
|
|
2269
|
-
var [createPopoverContext, createPopoverScope] =
|
|
2270
|
-
|
|
2799
|
+
var [createPopoverContext, createPopoverScope] = createContextScope4(POPOVER_NAME, [
|
|
2800
|
+
createPopperScope2
|
|
2271
2801
|
]);
|
|
2272
|
-
var
|
|
2802
|
+
var usePopperScope2 = createPopperScope2();
|
|
2273
2803
|
var [PopoverProvider, usePopoverContext] = createPopoverContext(POPOVER_NAME);
|
|
2274
2804
|
var PopoverRoot = (props) => {
|
|
2275
2805
|
const { __scopePopover, children, open: openProp, defaultOpen, onOpenChange, modal = false } = props;
|
|
2276
|
-
const popperScope =
|
|
2277
|
-
const triggerRef =
|
|
2278
|
-
const [hasCustomAnchor, setHasCustomAnchor] =
|
|
2279
|
-
const [open = false, setOpen] =
|
|
2806
|
+
const popperScope = usePopperScope2(__scopePopover);
|
|
2807
|
+
const triggerRef = useRef4(null);
|
|
2808
|
+
const [hasCustomAnchor, setHasCustomAnchor] = useState8(false);
|
|
2809
|
+
const [open = false, setOpen] = useControllableState6({
|
|
2280
2810
|
prop: openProp,
|
|
2281
2811
|
defaultProp: defaultOpen,
|
|
2282
2812
|
onChange: onOpenChange
|
|
2283
2813
|
});
|
|
2284
|
-
return /* @__PURE__ */ React29.createElement(
|
|
2814
|
+
return /* @__PURE__ */ React29.createElement(PopperPrimitive2.Root, popperScope, /* @__PURE__ */ React29.createElement(PopoverProvider, {
|
|
2285
2815
|
scope: __scopePopover,
|
|
2286
|
-
contentId:
|
|
2816
|
+
contentId: useId5(),
|
|
2287
2817
|
triggerRef,
|
|
2288
2818
|
open,
|
|
2289
2819
|
onOpenChange: setOpen,
|
|
2290
|
-
onOpenToggle:
|
|
2820
|
+
onOpenToggle: useCallback9(() => setOpen((prevOpen) => !prevOpen), [
|
|
2291
2821
|
setOpen
|
|
2292
2822
|
]),
|
|
2293
2823
|
hasCustomAnchor,
|
|
2294
|
-
onCustomAnchorAdd:
|
|
2295
|
-
onCustomAnchorRemove:
|
|
2824
|
+
onCustomAnchorAdd: useCallback9(() => setHasCustomAnchor(true), []),
|
|
2825
|
+
onCustomAnchorRemove: useCallback9(() => setHasCustomAnchor(false), []),
|
|
2296
2826
|
modal
|
|
2297
2827
|
}, children));
|
|
2298
2828
|
};
|
|
@@ -2301,29 +2831,29 @@ var ANCHOR_NAME = "PopoverAnchor";
|
|
|
2301
2831
|
var PopoverAnchor = /* @__PURE__ */ forwardRef21((props, forwardedRef) => {
|
|
2302
2832
|
const { __scopePopover, ...anchorProps } = props;
|
|
2303
2833
|
const context = usePopoverContext(ANCHOR_NAME, __scopePopover);
|
|
2304
|
-
const popperScope =
|
|
2834
|
+
const popperScope = usePopperScope2(__scopePopover);
|
|
2305
2835
|
const { onCustomAnchorAdd, onCustomAnchorRemove } = context;
|
|
2306
|
-
|
|
2836
|
+
useEffect7(() => {
|
|
2307
2837
|
onCustomAnchorAdd();
|
|
2308
2838
|
return () => onCustomAnchorRemove();
|
|
2309
2839
|
}, [
|
|
2310
2840
|
onCustomAnchorAdd,
|
|
2311
2841
|
onCustomAnchorRemove
|
|
2312
2842
|
]);
|
|
2313
|
-
return /* @__PURE__ */ React29.createElement(
|
|
2843
|
+
return /* @__PURE__ */ React29.createElement(PopperPrimitive2.Anchor, {
|
|
2314
2844
|
...popperScope,
|
|
2315
2845
|
...anchorProps,
|
|
2316
2846
|
ref: forwardedRef
|
|
2317
2847
|
});
|
|
2318
2848
|
});
|
|
2319
2849
|
PopoverAnchor.displayName = ANCHOR_NAME;
|
|
2320
|
-
var
|
|
2850
|
+
var TRIGGER_NAME3 = "PopoverTrigger";
|
|
2321
2851
|
var PopoverTrigger = /* @__PURE__ */ forwardRef21((props, forwardedRef) => {
|
|
2322
2852
|
const { __scopePopover, ...triggerProps } = props;
|
|
2323
|
-
const context = usePopoverContext(
|
|
2324
|
-
const popperScope =
|
|
2325
|
-
const composedTriggerRef =
|
|
2326
|
-
const trigger = /* @__PURE__ */ React29.createElement(
|
|
2853
|
+
const context = usePopoverContext(TRIGGER_NAME3, __scopePopover);
|
|
2854
|
+
const popperScope = usePopperScope2(__scopePopover);
|
|
2855
|
+
const composedTriggerRef = useComposedRefs2(forwardedRef, context.triggerRef);
|
|
2856
|
+
const trigger = /* @__PURE__ */ React29.createElement(Primitive12.button, {
|
|
2327
2857
|
type: "button",
|
|
2328
2858
|
"aria-haspopup": "dialog",
|
|
2329
2859
|
"aria-expanded": context.open,
|
|
@@ -2331,54 +2861,54 @@ var PopoverTrigger = /* @__PURE__ */ forwardRef21((props, forwardedRef) => {
|
|
|
2331
2861
|
"data-state": getState(context.open),
|
|
2332
2862
|
...triggerProps,
|
|
2333
2863
|
ref: composedTriggerRef,
|
|
2334
|
-
onClick:
|
|
2864
|
+
onClick: composeEventHandlers3(props.onClick, context.onOpenToggle)
|
|
2335
2865
|
});
|
|
2336
|
-
return context.hasCustomAnchor ? trigger : /* @__PURE__ */ React29.createElement(
|
|
2866
|
+
return context.hasCustomAnchor ? trigger : /* @__PURE__ */ React29.createElement(PopperPrimitive2.Anchor, {
|
|
2337
2867
|
asChild: true,
|
|
2338
2868
|
...popperScope
|
|
2339
2869
|
}, trigger);
|
|
2340
2870
|
});
|
|
2341
|
-
PopoverTrigger.displayName =
|
|
2871
|
+
PopoverTrigger.displayName = TRIGGER_NAME3;
|
|
2342
2872
|
var VIRTUAL_TRIGGER_NAME2 = "PopoverVirtualTrigger";
|
|
2343
2873
|
var PopoverVirtualTrigger = (props) => {
|
|
2344
2874
|
const { __scopePopover, virtualRef } = props;
|
|
2345
2875
|
const context = usePopoverContext(VIRTUAL_TRIGGER_NAME2, __scopePopover);
|
|
2346
|
-
const popperScope =
|
|
2347
|
-
|
|
2876
|
+
const popperScope = usePopperScope2(__scopePopover);
|
|
2877
|
+
useEffect7(() => {
|
|
2348
2878
|
if (virtualRef.current) {
|
|
2349
2879
|
context.triggerRef.current = virtualRef.current;
|
|
2350
2880
|
}
|
|
2351
2881
|
});
|
|
2352
|
-
return /* @__PURE__ */ React29.createElement(
|
|
2882
|
+
return /* @__PURE__ */ React29.createElement(PopperPrimitive2.Anchor, {
|
|
2353
2883
|
...popperScope,
|
|
2354
2884
|
virtualRef
|
|
2355
2885
|
});
|
|
2356
2886
|
};
|
|
2357
2887
|
PopoverVirtualTrigger.displayName = VIRTUAL_TRIGGER_NAME2;
|
|
2358
|
-
var
|
|
2359
|
-
var [
|
|
2888
|
+
var PORTAL_NAME3 = "PopoverPortal";
|
|
2889
|
+
var [PortalProvider2, usePortalContext2] = createPopoverContext(PORTAL_NAME3, {
|
|
2360
2890
|
forceMount: void 0
|
|
2361
2891
|
});
|
|
2362
2892
|
var PopoverPortal = (props) => {
|
|
2363
2893
|
const { __scopePopover, forceMount, children, container } = props;
|
|
2364
|
-
const context = usePopoverContext(
|
|
2365
|
-
return /* @__PURE__ */ React29.createElement(
|
|
2894
|
+
const context = usePopoverContext(PORTAL_NAME3, __scopePopover);
|
|
2895
|
+
return /* @__PURE__ */ React29.createElement(PortalProvider2, {
|
|
2366
2896
|
scope: __scopePopover,
|
|
2367
2897
|
forceMount
|
|
2368
|
-
}, /* @__PURE__ */ React29.createElement(
|
|
2898
|
+
}, /* @__PURE__ */ React29.createElement(Presence2, {
|
|
2369
2899
|
present: forceMount || context.open
|
|
2370
|
-
}, /* @__PURE__ */ React29.createElement(
|
|
2900
|
+
}, /* @__PURE__ */ React29.createElement(PortalPrimitive2, {
|
|
2371
2901
|
asChild: true,
|
|
2372
2902
|
container
|
|
2373
2903
|
}, children)));
|
|
2374
2904
|
};
|
|
2375
|
-
PopoverPortal.displayName =
|
|
2376
|
-
var
|
|
2905
|
+
PopoverPortal.displayName = PORTAL_NAME3;
|
|
2906
|
+
var CONTENT_NAME3 = "PopoverContent";
|
|
2377
2907
|
var PopoverContent = /* @__PURE__ */ forwardRef21((props, forwardedRef) => {
|
|
2378
|
-
const portalContext =
|
|
2908
|
+
const portalContext = usePortalContext2(CONTENT_NAME3, props.__scopePopover);
|
|
2379
2909
|
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
2380
|
-
const context = usePopoverContext(
|
|
2381
|
-
return /* @__PURE__ */ React29.createElement(
|
|
2910
|
+
const context = usePopoverContext(CONTENT_NAME3, props.__scopePopover);
|
|
2911
|
+
return /* @__PURE__ */ React29.createElement(Presence2, {
|
|
2382
2912
|
present: forceMount || context.open
|
|
2383
2913
|
}, context.modal ? /* @__PURE__ */ React29.createElement(PopoverContentModal, {
|
|
2384
2914
|
...contentProps,
|
|
@@ -2388,13 +2918,13 @@ var PopoverContent = /* @__PURE__ */ forwardRef21((props, forwardedRef) => {
|
|
|
2388
2918
|
ref: forwardedRef
|
|
2389
2919
|
}));
|
|
2390
2920
|
});
|
|
2391
|
-
PopoverContent.displayName =
|
|
2921
|
+
PopoverContent.displayName = CONTENT_NAME3;
|
|
2392
2922
|
var PopoverContentModal = /* @__PURE__ */ forwardRef21((props, forwardedRef) => {
|
|
2393
|
-
const context = usePopoverContext(
|
|
2394
|
-
const contentRef =
|
|
2395
|
-
const composedRefs =
|
|
2396
|
-
const isRightClickOutsideRef =
|
|
2397
|
-
|
|
2923
|
+
const context = usePopoverContext(CONTENT_NAME3, props.__scopePopover);
|
|
2924
|
+
const contentRef = useRef4(null);
|
|
2925
|
+
const composedRefs = useComposedRefs2(forwardedRef, contentRef);
|
|
2926
|
+
const isRightClickOutsideRef = useRef4(false);
|
|
2927
|
+
useEffect7(() => {
|
|
2398
2928
|
const content = contentRef.current;
|
|
2399
2929
|
if (content) {
|
|
2400
2930
|
return hideOthers(content);
|
|
@@ -2410,13 +2940,13 @@ var PopoverContentModal = /* @__PURE__ */ forwardRef21((props, forwardedRef) =>
|
|
|
2410
2940
|
// (closed !== unmounted when animating out)
|
|
2411
2941
|
trapFocus: context.open,
|
|
2412
2942
|
disableOutsidePointerEvents: true,
|
|
2413
|
-
onCloseAutoFocus:
|
|
2943
|
+
onCloseAutoFocus: composeEventHandlers3(props.onCloseAutoFocus, (event) => {
|
|
2414
2944
|
event.preventDefault();
|
|
2415
2945
|
if (!isRightClickOutsideRef.current) {
|
|
2416
2946
|
context.triggerRef.current?.focus();
|
|
2417
2947
|
}
|
|
2418
2948
|
}),
|
|
2419
|
-
onPointerDownOutside:
|
|
2949
|
+
onPointerDownOutside: composeEventHandlers3(props.onPointerDownOutside, (event) => {
|
|
2420
2950
|
const originalEvent = event.detail.originalEvent;
|
|
2421
2951
|
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
2422
2952
|
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
@@ -2426,15 +2956,15 @@ var PopoverContentModal = /* @__PURE__ */ forwardRef21((props, forwardedRef) =>
|
|
|
2426
2956
|
}),
|
|
2427
2957
|
// When focus is trapped, a `focusout` event may still happen.
|
|
2428
2958
|
// We make sure we don't trigger our `onDismiss` in such case.
|
|
2429
|
-
onFocusOutside:
|
|
2959
|
+
onFocusOutside: composeEventHandlers3(props.onFocusOutside, (event) => event.preventDefault(), {
|
|
2430
2960
|
checkForDefaultPrevented: false
|
|
2431
2961
|
})
|
|
2432
2962
|
}));
|
|
2433
2963
|
});
|
|
2434
2964
|
var PopoverContentNonModal = /* @__PURE__ */ forwardRef21((props, forwardedRef) => {
|
|
2435
|
-
const context = usePopoverContext(
|
|
2436
|
-
const hasInteractedOutsideRef =
|
|
2437
|
-
const hasPointerDownOutsideRef =
|
|
2965
|
+
const context = usePopoverContext(CONTENT_NAME3, props.__scopePopover);
|
|
2966
|
+
const hasInteractedOutsideRef = useRef4(false);
|
|
2967
|
+
const hasPointerDownOutsideRef = useRef4(false);
|
|
2438
2968
|
return /* @__PURE__ */ React29.createElement(PopoverContentImpl, {
|
|
2439
2969
|
...props,
|
|
2440
2970
|
ref: forwardedRef,
|
|
@@ -2472,8 +3002,8 @@ var PopoverContentNonModal = /* @__PURE__ */ forwardRef21((props, forwardedRef)
|
|
|
2472
3002
|
});
|
|
2473
3003
|
var PopoverContentImpl = /* @__PURE__ */ forwardRef21((props, forwardedRef) => {
|
|
2474
3004
|
const { __scopePopover, trapFocus, onOpenAutoFocus, onCloseAutoFocus, disableOutsidePointerEvents, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, collisionPadding = 8, classNames, ...contentProps } = props;
|
|
2475
|
-
const context = usePopoverContext(
|
|
2476
|
-
const popperScope =
|
|
3005
|
+
const context = usePopoverContext(CONTENT_NAME3, __scopePopover);
|
|
3006
|
+
const popperScope = usePopperScope2(__scopePopover);
|
|
2477
3007
|
const { tx } = useThemeContext();
|
|
2478
3008
|
const elevation = useElevationContext();
|
|
2479
3009
|
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
@@ -2484,7 +3014,7 @@ var PopoverContentImpl = /* @__PURE__ */ forwardRef21((props, forwardedRef) => {
|
|
|
2484
3014
|
trapped: trapFocus,
|
|
2485
3015
|
onMountAutoFocus: onOpenAutoFocus,
|
|
2486
3016
|
onUnmountAutoFocus: onCloseAutoFocus
|
|
2487
|
-
}, /* @__PURE__ */ React29.createElement(
|
|
3017
|
+
}, /* @__PURE__ */ React29.createElement(DismissableLayer2, {
|
|
2488
3018
|
asChild: true,
|
|
2489
3019
|
disableOutsidePointerEvents,
|
|
2490
3020
|
onInteractOutside,
|
|
@@ -2492,7 +3022,7 @@ var PopoverContentImpl = /* @__PURE__ */ forwardRef21((props, forwardedRef) => {
|
|
|
2492
3022
|
onPointerDownOutside,
|
|
2493
3023
|
onFocusOutside,
|
|
2494
3024
|
onDismiss: () => context.onOpenChange(false)
|
|
2495
|
-
}, /* @__PURE__ */ React29.createElement(
|
|
3025
|
+
}, /* @__PURE__ */ React29.createElement(PopperPrimitive2.Content, {
|
|
2496
3026
|
"data-state": getState(context.open),
|
|
2497
3027
|
role: "dialog",
|
|
2498
3028
|
id: context.contentId,
|
|
@@ -2520,31 +3050,31 @@ var CLOSE_NAME = "PopoverClose";
|
|
|
2520
3050
|
var PopoverClose = /* @__PURE__ */ forwardRef21((props, forwardedRef) => {
|
|
2521
3051
|
const { __scopePopover, ...closeProps } = props;
|
|
2522
3052
|
const context = usePopoverContext(CLOSE_NAME, __scopePopover);
|
|
2523
|
-
return /* @__PURE__ */ React29.createElement(
|
|
3053
|
+
return /* @__PURE__ */ React29.createElement(Primitive12.button, {
|
|
2524
3054
|
type: "button",
|
|
2525
3055
|
...closeProps,
|
|
2526
3056
|
ref: forwardedRef,
|
|
2527
|
-
onClick:
|
|
3057
|
+
onClick: composeEventHandlers3(props.onClick, () => context.onOpenChange(false))
|
|
2528
3058
|
});
|
|
2529
3059
|
});
|
|
2530
3060
|
PopoverClose.displayName = CLOSE_NAME;
|
|
2531
|
-
var
|
|
3061
|
+
var ARROW_NAME3 = "PopoverArrow";
|
|
2532
3062
|
var PopoverArrow = /* @__PURE__ */ forwardRef21((props, forwardedRef) => {
|
|
2533
3063
|
const { __scopePopover, classNames, ...arrowProps } = props;
|
|
2534
|
-
const popperScope =
|
|
3064
|
+
const popperScope = usePopperScope2(__scopePopover);
|
|
2535
3065
|
const { tx } = useThemeContext();
|
|
2536
|
-
return /* @__PURE__ */ React29.createElement(
|
|
3066
|
+
return /* @__PURE__ */ React29.createElement(PopperPrimitive2.Arrow, {
|
|
2537
3067
|
...popperScope,
|
|
2538
3068
|
...arrowProps,
|
|
2539
3069
|
className: tx("popover.arrow", "popover__arrow", {}, classNames),
|
|
2540
3070
|
ref: forwardedRef
|
|
2541
3071
|
});
|
|
2542
3072
|
});
|
|
2543
|
-
PopoverArrow.displayName =
|
|
3073
|
+
PopoverArrow.displayName = ARROW_NAME3;
|
|
2544
3074
|
var PopoverViewport = /* @__PURE__ */ forwardRef21(({ classNames, asChild, constrainInline = true, constrainBlock = true, children, ...props }, forwardedRef) => {
|
|
2545
3075
|
const { tx } = useThemeContext();
|
|
2546
|
-
const
|
|
2547
|
-
return /* @__PURE__ */ React29.createElement(
|
|
3076
|
+
const Root7 = asChild ? Slot12 : Primitive12.div;
|
|
3077
|
+
return /* @__PURE__ */ React29.createElement(Root7, {
|
|
2548
3078
|
...props,
|
|
2549
3079
|
className: tx("popover.viewport", "popover__viewport", {
|
|
2550
3080
|
constrainInline,
|
|
@@ -2795,13 +3325,13 @@ var Separator4 = /* @__PURE__ */ forwardRef25(({ classNames, orientation = "hori
|
|
|
2795
3325
|
});
|
|
2796
3326
|
|
|
2797
3327
|
// packages/ui/react-ui/src/components/Tag/Tag.tsx
|
|
2798
|
-
import { Primitive as
|
|
3328
|
+
import { Primitive as Primitive13 } from "@radix-ui/react-primitive";
|
|
2799
3329
|
import { Slot as Slot13 } from "@radix-ui/react-slot";
|
|
2800
3330
|
import React34, { forwardRef as forwardRef26 } from "react";
|
|
2801
3331
|
var Tag = /* @__PURE__ */ forwardRef26(({ asChild, palette = "neutral", classNames, ...props }, forwardedRef) => {
|
|
2802
3332
|
const { tx } = useThemeContext();
|
|
2803
|
-
const
|
|
2804
|
-
return /* @__PURE__ */ React34.createElement(
|
|
3333
|
+
const Root7 = asChild ? Slot13 : Primitive13.span;
|
|
3334
|
+
return /* @__PURE__ */ React34.createElement(Root7, {
|
|
2805
3335
|
...props,
|
|
2806
3336
|
className: tx("tag.root", "dx-tag", {
|
|
2807
3337
|
palette
|
|
@@ -2812,7 +3342,7 @@ var Tag = /* @__PURE__ */ forwardRef26(({ asChild, palette = "neutral", classNam
|
|
|
2812
3342
|
});
|
|
2813
3343
|
|
|
2814
3344
|
// packages/ui/react-ui/src/components/Toast/Toast.tsx
|
|
2815
|
-
import { Primitive as
|
|
3345
|
+
import { Primitive as Primitive14 } from "@radix-ui/react-primitive";
|
|
2816
3346
|
import { Slot as Slot14 } from "@radix-ui/react-slot";
|
|
2817
3347
|
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";
|
|
2818
3348
|
import React35, { forwardRef as forwardRef27 } from "react";
|
|
@@ -2836,8 +3366,8 @@ var ToastRoot = /* @__PURE__ */ forwardRef27(({ classNames, children, ...props }
|
|
|
2836
3366
|
});
|
|
2837
3367
|
var ToastBody = /* @__PURE__ */ forwardRef27(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
2838
3368
|
const { tx } = useThemeContext();
|
|
2839
|
-
const
|
|
2840
|
-
return /* @__PURE__ */ React35.createElement(
|
|
3369
|
+
const Root7 = asChild ? Slot14 : Primitive14.div;
|
|
3370
|
+
return /* @__PURE__ */ React35.createElement(Root7, {
|
|
2841
3371
|
...props,
|
|
2842
3372
|
className: tx("toast.body", "toast__body", {}, classNames),
|
|
2843
3373
|
ref: forwardedRef
|
|
@@ -2845,8 +3375,8 @@ var ToastBody = /* @__PURE__ */ forwardRef27(({ asChild, classNames, ...props },
|
|
|
2845
3375
|
});
|
|
2846
3376
|
var ToastTitle = /* @__PURE__ */ forwardRef27(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
2847
3377
|
const { tx } = useThemeContext();
|
|
2848
|
-
const
|
|
2849
|
-
return /* @__PURE__ */ React35.createElement(
|
|
3378
|
+
const Root7 = asChild ? Slot14 : ToastTitlePrimitive;
|
|
3379
|
+
return /* @__PURE__ */ React35.createElement(Root7, {
|
|
2850
3380
|
...props,
|
|
2851
3381
|
className: tx("toast.title", "toast__title", {}, classNames),
|
|
2852
3382
|
ref: forwardedRef
|
|
@@ -2854,8 +3384,8 @@ var ToastTitle = /* @__PURE__ */ forwardRef27(({ asChild, classNames, ...props }
|
|
|
2854
3384
|
});
|
|
2855
3385
|
var ToastDescription = /* @__PURE__ */ forwardRef27(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
2856
3386
|
const { tx } = useThemeContext();
|
|
2857
|
-
const
|
|
2858
|
-
return /* @__PURE__ */ React35.createElement(
|
|
3387
|
+
const Root7 = asChild ? Slot14 : ToastDescriptionPrimitive;
|
|
3388
|
+
return /* @__PURE__ */ React35.createElement(Root7, {
|
|
2859
3389
|
...props,
|
|
2860
3390
|
className: tx("toast.description", "toast__description", {}, classNames),
|
|
2861
3391
|
ref: forwardedRef
|
|
@@ -2863,8 +3393,8 @@ var ToastDescription = /* @__PURE__ */ forwardRef27(({ asChild, classNames, ...p
|
|
|
2863
3393
|
});
|
|
2864
3394
|
var ToastActions = /* @__PURE__ */ forwardRef27(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
2865
3395
|
const { tx } = useThemeContext();
|
|
2866
|
-
const
|
|
2867
|
-
return /* @__PURE__ */ React35.createElement(
|
|
3396
|
+
const Root7 = asChild ? Slot14 : Primitive14.div;
|
|
3397
|
+
return /* @__PURE__ */ React35.createElement(Root7, {
|
|
2868
3398
|
...props,
|
|
2869
3399
|
className: tx("toast.actions", "toast__actions", {}, classNames),
|
|
2870
3400
|
ref: forwardedRef
|
|
@@ -3034,6 +3564,7 @@ export {
|
|
|
3034
3564
|
Treegrid,
|
|
3035
3565
|
createDropdownMenuScope,
|
|
3036
3566
|
createPopoverScope,
|
|
3567
|
+
createTooltipScope,
|
|
3037
3568
|
hasIosKeyboard,
|
|
3038
3569
|
initialSafeArea,
|
|
3039
3570
|
isLabel,
|
|
@@ -3053,6 +3584,7 @@ export {
|
|
|
3053
3584
|
useSafeArea,
|
|
3054
3585
|
useSidebars,
|
|
3055
3586
|
useThemeContext,
|
|
3587
|
+
useTooltipContext,
|
|
3056
3588
|
useTranslation,
|
|
3057
3589
|
useTranslationsContext,
|
|
3058
3590
|
useVisualViewport
|