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