@dxos/react-ui 0.7.5-main.499c70c → 0.7.5-main.5ae2ba8
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 +290 -216
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +663 -592
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +290 -216
- 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.d.ts +6 -10
- package/dist/types/src/components/Avatars/Avatar.d.ts.map +1 -1
- package/dist/types/src/components/Avatars/Avatar.stories.d.ts +12 -13
- package/dist/types/src/components/Avatars/Avatar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Avatars/AvatarGroup.d.ts +1 -1
- package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts +2 -2
- package/dist/types/src/components/Breadcrumb/Breadcrumb.d.ts +1 -1
- package/dist/types/src/components/Breadcrumb/Breadcrumb.stories.d.ts +3 -3
- package/dist/types/src/components/Buttons/Button.stories.d.ts +2 -2
- package/dist/types/src/components/Buttons/IconButton.d.ts +7 -2
- package/dist/types/src/components/Buttons/IconButton.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/IconButton.stories.d.ts +2 -2
- package/dist/types/src/components/Buttons/Toggle.stories.d.ts +2 -2
- package/dist/types/src/components/Buttons/ToggleGroup.d.ts +4 -4
- package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts +6 -6
- package/dist/types/src/components/Clipboard/ClipboardProvider.d.ts +1 -1
- package/dist/types/src/components/Clipboard/ClipboardProvider.d.ts.map +1 -1
- package/dist/types/src/components/Clipboard/CopyButton.d.ts +6 -3
- package/dist/types/src/components/Clipboard/CopyButton.d.ts.map +1 -1
- package/dist/types/src/components/Clipboard/index.d.ts +8 -3
- package/dist/types/src/components/Clipboard/index.d.ts.map +1 -1
- package/dist/types/src/components/DensityProvider/DensityProvider.d.ts +1 -1
- package/dist/types/src/components/DensityProvider/DensityProvider.d.ts.map +1 -1
- package/dist/types/src/components/Dialogs/AlertDialog.d.ts +1 -1
- package/dist/types/src/components/Dialogs/AlertDialog.d.ts.map +1 -1
- package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts +2 -2
- package/dist/types/src/components/Dialogs/Dialog.d.ts +4 -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/ElevationProvider/ElevationProvider.d.ts +1 -1
- package/dist/types/src/components/ElevationProvider/ElevationProvider.d.ts.map +1 -1
- package/dist/types/src/components/Icon/Icon.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 +7 -7
- package/dist/types/src/components/Input/Input.stories.d.ts.map +1 -1
- package/dist/types/src/components/Lists/List.stories.d.ts +5 -5
- package/dist/types/src/components/Lists/ListDropIndicator.d.ts +3 -2
- package/dist/types/src/components/Lists/ListDropIndicator.d.ts.map +1 -1
- package/dist/types/src/components/Lists/Tree.stories.d.ts +3 -3
- package/dist/types/src/components/Lists/TreeDropIndicator.d.ts +1 -2
- package/dist/types/src/components/Lists/TreeDropIndicator.d.ts.map +1 -1
- package/dist/types/src/components/Lists/Treegrid.stories.d.ts +2 -2
- package/dist/types/src/components/Main/Main.d.ts +35 -24
- package/dist/types/src/components/Main/Main.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.stories.d.ts +3 -4
- package/dist/types/src/components/Main/Main.stories.d.ts.map +1 -1
- package/dist/types/src/components/Menus/ContextMenu.d.ts +6 -6
- package/dist/types/src/components/Menus/ContextMenu.d.ts.map +1 -1
- package/dist/types/src/components/Menus/ContextMenu.stories.d.ts +8 -8
- package/dist/types/src/components/Menus/DropdownMenu.d.ts +3 -7
- package/dist/types/src/components/Menus/DropdownMenu.d.ts.map +1 -1
- package/dist/types/src/components/Menus/DropdownMenu.stories.d.ts +4 -4
- package/dist/types/src/components/Message/Message.stories.d.ts +2 -2
- package/dist/types/src/components/Popover/Popover.d.ts +1 -1
- package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
- package/dist/types/src/components/Popover/Popover.stories.d.ts +5 -5
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts +5 -5
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts +7 -7
- package/dist/types/src/components/Select/Select.d.ts +9 -9
- package/dist/types/src/components/Select/Select.d.ts.map +1 -1
- package/dist/types/src/components/Select/Select.stories.d.ts +2 -3
- package/dist/types/src/components/Select/Select.stories.d.ts.map +1 -1
- package/dist/types/src/components/Separator/Separator.d.ts +3 -1
- package/dist/types/src/components/Separator/Separator.d.ts.map +1 -1
- package/dist/types/src/components/Status/Status.stories.d.ts +3 -3
- package/dist/types/src/components/Status/Status.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tag/Tag.d.ts.map +1 -1
- package/dist/types/src/components/Tag/Tag.stories.d.ts +12 -5
- package/dist/types/src/components/Tag/Tag.stories.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts +5 -3
- 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.d.ts +4 -4
- package/dist/types/src/components/Toast/Toast.stories.d.ts +8 -8
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +20 -10
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts +17 -12
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.d.ts +2 -2
- package/dist/types/src/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts +16 -4
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +1 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useSafeArea.d.ts +9 -0
- package/dist/types/src/hooks/useSafeArea.d.ts.map +1 -0
- package/dist/types/src/hooks/useSafeCollisionPadding.d.ts +10 -0
- package/dist/types/src/hooks/useSafeCollisionPadding.d.ts.map +1 -0
- package/dist/types/src/hooks/useThemeContext.d.ts +1 -1
- package/dist/types/src/hooks/useThemeContext.d.ts.map +1 -1
- package/dist/types/src/hooks/useTranslationsContext.d.ts +1 -1
- package/dist/types/src/hooks/useVisualViewport.d.ts +1 -1
- package/dist/types/src/hooks/useVisualViewport.d.ts.map +1 -1
- package/dist/types/src/playground/Controls.stories.d.ts +2 -3
- package/dist/types/src/playground/Controls.stories.d.ts.map +1 -1
- package/dist/types/src/playground/Typography.stories.d.ts +2 -3
- package/dist/types/src/playground/Typography.stories.d.ts.map +1 -1
- package/dist/types/src/util/ThemedClassName.d.ts +1 -1
- package/dist/types/src/util/ThemedClassName.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +43 -42
- package/src/components/Avatars/Avatar.tsx +5 -13
- package/src/components/Buttons/IconButton.tsx +32 -7
- package/src/components/Clipboard/CopyButton.tsx +6 -2
- package/src/components/Dialogs/AlertDialog.tsx +3 -1
- package/src/components/Dialogs/Dialog.stories.tsx +1 -1
- package/src/components/Dialogs/Dialog.tsx +10 -13
- package/src/components/Icon/Icon.tsx +4 -1
- package/src/components/Input/Input.tsx +1 -1
- package/src/components/Lists/ListDropIndicator.tsx +15 -7
- package/src/components/Main/Main.stories.tsx +1 -1
- package/src/components/Main/Main.tsx +78 -108
- package/src/components/Menus/ContextMenu.tsx +4 -2
- package/src/components/Menus/DropdownMenu.tsx +4 -2
- package/src/components/Popover/Popover.tsx +4 -0
- package/src/components/Select/Select.tsx +4 -1
- package/src/components/Separator/Separator.tsx +14 -11
- package/src/components/Tag/Tag.stories.tsx +17 -31
- package/src/components/Tag/Tag.tsx +15 -6
- package/src/components/ThemeProvider/ThemeProvider.tsx +12 -3
- package/src/components/Toolbar/Toolbar.tsx +40 -10
- package/src/components/Tooltip/Tooltip.stories.tsx +13 -2
- package/src/components/Tooltip/Tooltip.tsx +17 -13
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useSafeArea.ts +25 -0
- package/src/hooks/useSafeCollisionPadding.ts +39 -0
- package/src/hooks/useVisualViewport.ts +11 -12
- package/src/util/ThemedClassName.ts +1 -1
|
@@ -22,13 +22,36 @@ var useElevationContext = (propsElevation) => {
|
|
|
22
22
|
return propsElevation ?? elevation;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
+
// packages/ui/react-ui/src/hooks/useSafeArea.ts
|
|
26
|
+
import { useCallback, useState } from "react";
|
|
27
|
+
import { useResize } from "@dxos/react-hooks";
|
|
28
|
+
var initialSafeArea = {
|
|
29
|
+
top: NaN,
|
|
30
|
+
right: NaN,
|
|
31
|
+
bottom: NaN,
|
|
32
|
+
left: NaN
|
|
33
|
+
};
|
|
34
|
+
var useSafeArea = () => {
|
|
35
|
+
const [padding, setPadding] = useState(initialSafeArea);
|
|
36
|
+
const handleResize = useCallback(() => {
|
|
37
|
+
setPadding({
|
|
38
|
+
top: parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--safe-area-top")),
|
|
39
|
+
right: parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--safe-area-right")),
|
|
40
|
+
bottom: parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--safe-area-bottom")),
|
|
41
|
+
left: parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--safe-area-left"))
|
|
42
|
+
});
|
|
43
|
+
}, []);
|
|
44
|
+
useResize(handleResize);
|
|
45
|
+
return padding;
|
|
46
|
+
};
|
|
47
|
+
|
|
25
48
|
// packages/ui/react-ui/src/hooks/useTranslationsContext.ts
|
|
26
49
|
import { useContext as useContext4 } from "react";
|
|
27
50
|
|
|
28
51
|
// packages/ui/react-ui/src/components/ThemeProvider/TranslationsProvider.tsx
|
|
29
52
|
import { enUS as dtLocaleEnUs } from "date-fns/locale";
|
|
30
53
|
import i18Next from "i18next";
|
|
31
|
-
import React, { useEffect, createContext, useState, Suspense, useContext as useContext3 } from "react";
|
|
54
|
+
import React, { useEffect, createContext, useState as useState2, Suspense, useContext as useContext3 } from "react";
|
|
32
55
|
import { initReactI18next, useTranslation as useI18NextTranslation } from "react-i18next";
|
|
33
56
|
var initialLng = "en-US";
|
|
34
57
|
var initialNs = "dxos-common";
|
|
@@ -63,7 +86,7 @@ var useTranslation = (...args) => {
|
|
|
63
86
|
};
|
|
64
87
|
};
|
|
65
88
|
var TranslationsProvider = ({ fallback, resourceExtensions, children, appNs, dtLocale }) => {
|
|
66
|
-
const [loaded, setLoaded] =
|
|
89
|
+
const [loaded, setLoaded] = useState2(false);
|
|
67
90
|
useEffect(() => {
|
|
68
91
|
setLoaded(false);
|
|
69
92
|
if (resourceExtensions && resourceExtensions.length) {
|
|
@@ -98,21 +121,18 @@ import { raise } from "@dxos/debug";
|
|
|
98
121
|
var useThemeContext = () => useContext5(ThemeContext) ?? raise(new Error("Missing ThemeContext"));
|
|
99
122
|
|
|
100
123
|
// packages/ui/react-ui/src/hooks/useVisualViewport.ts
|
|
101
|
-
import {
|
|
124
|
+
import { useCallback as useCallback2, useState as useState3 } from "react";
|
|
125
|
+
import { useResize as useResize2 } from "@dxos/react-hooks";
|
|
102
126
|
var useVisualViewport = (deps) => {
|
|
103
|
-
const [width, setWidth] =
|
|
104
|
-
const [height, setHeight] =
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
window.visualViewport?.addEventListener("resize", handleResize);
|
|
113
|
-
handleResize();
|
|
114
|
-
return () => window.visualViewport?.removeEventListener("resize", handleResize);
|
|
115
|
-
}, deps ?? []);
|
|
127
|
+
const [width, setWidth] = useState3(null);
|
|
128
|
+
const [height, setHeight] = useState3(null);
|
|
129
|
+
const handleResize = useCallback2(() => {
|
|
130
|
+
if (window.visualViewport) {
|
|
131
|
+
setWidth(window.visualViewport.width);
|
|
132
|
+
setHeight(window.visualViewport.height);
|
|
133
|
+
}
|
|
134
|
+
}, []);
|
|
135
|
+
useResize2(handleResize);
|
|
116
136
|
return {
|
|
117
137
|
width,
|
|
118
138
|
height
|
|
@@ -233,16 +253,12 @@ var AvatarFrame = /* @__PURE__ */ forwardRef3(({ classNames, children, ...props
|
|
|
233
253
|
y: ringGap + ringWidth,
|
|
234
254
|
rx
|
|
235
255
|
}))), variant === "circle" ? /* @__PURE__ */ React4.createElement("circle", {
|
|
236
|
-
className: hue ? tx("hue.fill", "avatar__frame__circle", {
|
|
237
|
-
hue
|
|
238
|
-
}) : "fill-[var(--surface-bg)]",
|
|
239
256
|
cx: "50%",
|
|
240
257
|
cy: "50%",
|
|
241
|
-
r
|
|
258
|
+
r,
|
|
259
|
+
fill: hue ? `var(--dx-${hue}Fill)` : "var(--surface-bg)"
|
|
242
260
|
}) : /* @__PURE__ */ React4.createElement("rect", {
|
|
243
|
-
|
|
244
|
-
hue
|
|
245
|
-
}) : "fill-[var(--surface-bg)]",
|
|
261
|
+
fill: hue ? `var(--dx-${hue}Fill)` : "var(--surface-bg)",
|
|
246
262
|
x: ringGap + ringWidth,
|
|
247
263
|
y: ringGap + ringWidth,
|
|
248
264
|
width: 2 * r,
|
|
@@ -572,11 +588,33 @@ var ButtonGroup = /* @__PURE__ */ forwardRef7(({ children, elevation: propsEleva
|
|
|
572
588
|
ButtonGroup.displayName = BUTTON_GROUP_NAME;
|
|
573
589
|
|
|
574
590
|
// packages/ui/react-ui/src/components/Buttons/IconButton.tsx
|
|
575
|
-
import React10, { forwardRef as forwardRef9 } from "react";
|
|
591
|
+
import React10, { forwardRef as forwardRef9, useState as useState4 } from "react";
|
|
576
592
|
|
|
577
593
|
// packages/ui/react-ui/src/components/Tooltip/Tooltip.tsx
|
|
578
594
|
import { Provider as TooltipProviderPrimitive, Root as TooltipRootPrimitive, TooltipContent as TooltipContentPrimitive, TooltipTrigger as TooltipTriggerPrimitive, TooltipPortal as TooltipPortalPrimitive, TooltipArrow as TooltipArrowPrimitive } from "@radix-ui/react-tooltip";
|
|
579
595
|
import React9, { forwardRef as forwardRef8 } from "react";
|
|
596
|
+
|
|
597
|
+
// packages/ui/react-ui/src/hooks/useSafeCollisionPadding.ts
|
|
598
|
+
import { useMemo } from "react";
|
|
599
|
+
var propIsNumber = (prop) => Number.isFinite(prop);
|
|
600
|
+
var propsIsRecord = (prop) => !!(prop && typeof prop === "object");
|
|
601
|
+
var safePadding = (propsPadding, safePadding2, side) => {
|
|
602
|
+
return (propIsNumber(safePadding2[side]) ? safePadding2[side] : 0) + (propIsNumber(propsPadding) ? propsPadding : propsIsRecord(propsPadding) ? propsPadding[side] ?? 0 : 0);
|
|
603
|
+
};
|
|
604
|
+
var useSafeCollisionPadding = (collisionPadding) => {
|
|
605
|
+
const { safeAreaPadding } = useThemeContext();
|
|
606
|
+
return useMemo(() => ({
|
|
607
|
+
top: safePadding(collisionPadding, safeAreaPadding, "top"),
|
|
608
|
+
right: safePadding(collisionPadding, safeAreaPadding, "right"),
|
|
609
|
+
bottom: safePadding(collisionPadding, safeAreaPadding, "bottom"),
|
|
610
|
+
left: safePadding(collisionPadding, safeAreaPadding, "left")
|
|
611
|
+
}), [
|
|
612
|
+
collisionPadding,
|
|
613
|
+
safeAreaPadding
|
|
614
|
+
]);
|
|
615
|
+
};
|
|
616
|
+
|
|
617
|
+
// packages/ui/react-ui/src/components/Tooltip/Tooltip.tsx
|
|
580
618
|
var TooltipProvider = TooltipProviderPrimitive;
|
|
581
619
|
var TooltipRoot = TooltipRootPrimitive;
|
|
582
620
|
var TooltipPortal = TooltipPortalPrimitive;
|
|
@@ -589,13 +627,14 @@ var TooltipArrow = /* @__PURE__ */ forwardRef8(({ classNames, ...props }, forwar
|
|
|
589
627
|
ref: forwardedRef
|
|
590
628
|
});
|
|
591
629
|
});
|
|
592
|
-
var TooltipContent = /* @__PURE__ */ forwardRef8(({ classNames, ...props }, forwardedRef) => {
|
|
630
|
+
var TooltipContent = /* @__PURE__ */ forwardRef8(({ classNames, collisionPadding = 8, ...props }, forwardedRef) => {
|
|
593
631
|
const { tx } = useThemeContext();
|
|
594
632
|
const elevation = useElevationContext();
|
|
633
|
+
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
595
634
|
return /* @__PURE__ */ React9.createElement(TooltipContentPrimitive, {
|
|
596
635
|
sideOffset: 4,
|
|
597
|
-
collisionPadding: 8,
|
|
598
636
|
...props,
|
|
637
|
+
collisionPadding: safeCollisionPadding,
|
|
599
638
|
className: tx("tooltip.content", "tooltip", {
|
|
600
639
|
elevation
|
|
601
640
|
}, classNames),
|
|
@@ -612,20 +651,40 @@ var Tooltip = {
|
|
|
612
651
|
};
|
|
613
652
|
|
|
614
653
|
// packages/ui/react-ui/src/components/Buttons/IconButton.tsx
|
|
615
|
-
var IconOnlyButton = /* @__PURE__ */ forwardRef9(({ tooltipPortal = true, tooltipZIndex: zIndex, ...props }, forwardedRef) => {
|
|
616
|
-
const
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
654
|
+
var IconOnlyButton = /* @__PURE__ */ forwardRef9(({ noTooltip, tooltipPortal = true, tooltipZIndex: zIndex, tooltipSide, suppressNextTooltip, ...props }, forwardedRef) => {
|
|
655
|
+
const [triggerTooltipOpen, setTriggerTooltipOpen] = useState4(false);
|
|
656
|
+
if (noTooltip) {
|
|
657
|
+
return /* @__PURE__ */ React10.createElement(LabelledIconButton, {
|
|
658
|
+
...props,
|
|
659
|
+
ref: forwardedRef
|
|
660
|
+
});
|
|
661
|
+
}
|
|
662
|
+
const content = /* @__PURE__ */ React10.createElement(Tooltip.Content, {
|
|
663
|
+
...zIndex && {
|
|
664
|
+
style: {
|
|
665
|
+
zIndex
|
|
666
|
+
}
|
|
667
|
+
},
|
|
668
|
+
side: tooltipSide
|
|
620
669
|
}, props.label, /* @__PURE__ */ React10.createElement(Tooltip.Arrow, null));
|
|
621
|
-
return /* @__PURE__ */ React10.createElement(Tooltip.Root,
|
|
670
|
+
return /* @__PURE__ */ React10.createElement(Tooltip.Root, {
|
|
671
|
+
open: triggerTooltipOpen,
|
|
672
|
+
onOpenChange: (nextOpen) => {
|
|
673
|
+
if (suppressNextTooltip?.current) {
|
|
674
|
+
setTriggerTooltipOpen(false);
|
|
675
|
+
suppressNextTooltip.current = false;
|
|
676
|
+
} else {
|
|
677
|
+
setTriggerTooltipOpen(nextOpen);
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
}, /* @__PURE__ */ React10.createElement(Tooltip.Trigger, {
|
|
622
681
|
asChild: true
|
|
623
682
|
}, /* @__PURE__ */ React10.createElement(LabelledIconButton, {
|
|
624
683
|
...props,
|
|
625
684
|
ref: forwardedRef
|
|
626
685
|
})), tooltipPortal ? /* @__PURE__ */ React10.createElement(Tooltip.Portal, null, content) : content);
|
|
627
686
|
});
|
|
628
|
-
var LabelledIconButton = /* @__PURE__ */ forwardRef9(({ icon, size, iconOnly, label, classNames, iconClassNames, ...props }, forwardedRef) => {
|
|
687
|
+
var LabelledIconButton = /* @__PURE__ */ forwardRef9(({ icon, size, iconOnly, label, classNames, iconClassNames, caretDown, suppressNextTooltip, ...props }, forwardedRef) => {
|
|
629
688
|
const { tx } = useThemeContext();
|
|
630
689
|
return /* @__PURE__ */ React10.createElement(Button, {
|
|
631
690
|
...props,
|
|
@@ -637,7 +696,10 @@ var LabelledIconButton = /* @__PURE__ */ forwardRef9(({ icon, size, iconOnly, la
|
|
|
637
696
|
classNames: iconClassNames
|
|
638
697
|
}), /* @__PURE__ */ React10.createElement("span", {
|
|
639
698
|
className: iconOnly ? "sr-only" : void 0
|
|
640
|
-
}, label)
|
|
699
|
+
}, label), caretDown && /* @__PURE__ */ React10.createElement(Icon, {
|
|
700
|
+
size: 3,
|
|
701
|
+
icon: "ph--caret-down--bold"
|
|
702
|
+
}));
|
|
641
703
|
});
|
|
642
704
|
var IconButton = /* @__PURE__ */ forwardRef9((props, forwardedRef) => props.iconOnly ? /* @__PURE__ */ React10.createElement(IconOnlyButton, {
|
|
643
705
|
...props,
|
|
@@ -690,7 +752,7 @@ var ToggleGroupItem = /* @__PURE__ */ forwardRef11(({ variant, elevation, densit
|
|
|
690
752
|
});
|
|
691
753
|
|
|
692
754
|
// packages/ui/react-ui/src/components/Clipboard/ClipboardProvider.tsx
|
|
693
|
-
import React13, { createContext as createContext4, useCallback, useContext as useContext6, useState as
|
|
755
|
+
import React13, { createContext as createContext4, useCallback as useCallback3, useContext as useContext6, useState as useState5 } from "react";
|
|
694
756
|
var ClipboardContext = /* @__PURE__ */ createContext4({
|
|
695
757
|
textValue: "",
|
|
696
758
|
setTextValue: async (_) => {
|
|
@@ -698,8 +760,8 @@ var ClipboardContext = /* @__PURE__ */ createContext4({
|
|
|
698
760
|
});
|
|
699
761
|
var useClipboard = () => useContext6(ClipboardContext);
|
|
700
762
|
var ClipboardProvider = ({ children }) => {
|
|
701
|
-
const [textValue, setInternalTextValue] =
|
|
702
|
-
const setTextValue =
|
|
763
|
+
const [textValue, setInternalTextValue] = useState5("");
|
|
764
|
+
const setTextValue = useCallback3(async (nextValue) => {
|
|
703
765
|
await navigator.clipboard.writeText(nextValue);
|
|
704
766
|
return setInternalTextValue(nextValue);
|
|
705
767
|
}, []);
|
|
@@ -712,12 +774,12 @@ var ClipboardProvider = ({ children }) => {
|
|
|
712
774
|
};
|
|
713
775
|
|
|
714
776
|
// packages/ui/react-ui/src/components/Clipboard/CopyButton.tsx
|
|
715
|
-
import React17, { useState as
|
|
777
|
+
import React17, { useState as useState6 } from "react";
|
|
716
778
|
import { mx } from "@dxos/react-ui-theme";
|
|
717
779
|
|
|
718
780
|
// packages/ui/react-ui/src/components/ThemeProvider/ThemeProvider.tsx
|
|
719
781
|
import { createKeyborg } from "keyborg";
|
|
720
|
-
import React16, { createContext as createContext7, useEffect as
|
|
782
|
+
import React16, { createContext as createContext7, useEffect as useEffect2, useMemo as useMemo2 } from "react";
|
|
721
783
|
|
|
722
784
|
// packages/ui/react-ui/src/util/hasIosKeyboard.ts
|
|
723
785
|
var hasIosKeyboard = () => {
|
|
@@ -749,20 +811,28 @@ var ElevationProvider = ({ elevation, children }) => /* @__PURE__ */ React15.cre
|
|
|
749
811
|
// packages/ui/react-ui/src/components/ThemeProvider/ThemeProvider.tsx
|
|
750
812
|
var ThemeContext = /* @__PURE__ */ createContext7(void 0);
|
|
751
813
|
var ThemeProvider = ({ children, fallback = null, resourceExtensions, appNs, tx = (_path, defaultClassName, _styleProps, ..._options) => defaultClassName, themeMode = "dark", rootDensity = "fine", ...rest }) => {
|
|
752
|
-
|
|
814
|
+
useEffect2(() => {
|
|
753
815
|
if (document.defaultView) {
|
|
754
816
|
const kb = createKeyborg(document.defaultView);
|
|
755
817
|
kb.subscribe(handleInputModalityChange);
|
|
756
818
|
return () => kb.unsubscribe(handleInputModalityChange);
|
|
757
819
|
}
|
|
758
820
|
}, []);
|
|
821
|
+
const safeAreaPadding = useSafeArea();
|
|
822
|
+
const contextValue = useMemo2(() => ({
|
|
823
|
+
tx,
|
|
824
|
+
themeMode,
|
|
825
|
+
hasIosKeyboard: hasIosKeyboard(),
|
|
826
|
+
safeAreaPadding,
|
|
827
|
+
...rest
|
|
828
|
+
}), [
|
|
829
|
+
tx,
|
|
830
|
+
themeMode,
|
|
831
|
+
safeAreaPadding,
|
|
832
|
+
rest
|
|
833
|
+
]);
|
|
759
834
|
return /* @__PURE__ */ React16.createElement(ThemeContext.Provider, {
|
|
760
|
-
value:
|
|
761
|
-
tx,
|
|
762
|
-
themeMode,
|
|
763
|
-
hasIosKeyboard: hasIosKeyboard(),
|
|
764
|
-
...rest
|
|
765
|
-
}
|
|
835
|
+
value: contextValue
|
|
766
836
|
}, /* @__PURE__ */ React16.createElement(TranslationsProvider, {
|
|
767
837
|
fallback,
|
|
768
838
|
resourceExtensions,
|
|
@@ -819,8 +889,8 @@ var CopyButtonIconOnly = ({ value, classNames, iconProps, variant, ...props }) =
|
|
|
819
889
|
const { t } = useTranslation("os");
|
|
820
890
|
const { textValue, setTextValue } = useClipboard();
|
|
821
891
|
const isCopied = textValue === value;
|
|
822
|
-
const label = isCopied ? t("copy success label") : t("copy label");
|
|
823
|
-
const [open, setOpen] =
|
|
892
|
+
const label = isCopied ? t("copy success label") : props.label ?? t("copy label");
|
|
893
|
+
const [open, setOpen] = useState6(false);
|
|
824
894
|
return /* @__PURE__ */ React17.createElement(Tooltip.Root, {
|
|
825
895
|
delayDuration: 1500,
|
|
826
896
|
open,
|
|
@@ -893,7 +963,7 @@ var DialogOverlay = /* @__PURE__ */ forwardRef12(({ classNames, children, blockA
|
|
|
893
963
|
const { tx } = useThemeContext();
|
|
894
964
|
return /* @__PURE__ */ React18.createElement(DialogOverlayPrimitive, {
|
|
895
965
|
...props,
|
|
896
|
-
className: tx("dialog.overlay", "dialog__overlay", {}, classNames
|
|
966
|
+
className: tx("dialog.overlay", "dialog__overlay", {}, classNames),
|
|
897
967
|
ref: forwardedRef,
|
|
898
968
|
"data-block-align": blockAlign
|
|
899
969
|
}, /* @__PURE__ */ React18.createElement(OverlayLayoutProvider, {
|
|
@@ -901,13 +971,13 @@ var DialogOverlay = /* @__PURE__ */ forwardRef12(({ classNames, children, blockA
|
|
|
901
971
|
}, children));
|
|
902
972
|
});
|
|
903
973
|
DialogOverlay.displayName = DIALOG_OVERLAY_NAME;
|
|
904
|
-
var DialogContent = /* @__PURE__ */ forwardRef12(({ classNames, children, ...props }, forwardedRef) => {
|
|
974
|
+
var DialogContent = /* @__PURE__ */ forwardRef12(({ classNames, children, inOverlayLayout: propsInOverlayLayout, ...props }, forwardedRef) => {
|
|
905
975
|
const { tx } = useThemeContext();
|
|
906
976
|
const { inOverlayLayout } = useOverlayLayoutContext(DIALOG_CONTENT_NAME);
|
|
907
977
|
return /* @__PURE__ */ React18.createElement(DialogContentPrimitive, {
|
|
908
978
|
...props,
|
|
909
979
|
className: tx("dialog.content", "dialog", {
|
|
910
|
-
inOverlayLayout
|
|
980
|
+
inOverlayLayout: propsInOverlayLayout || inOverlayLayout
|
|
911
981
|
}, classNames),
|
|
912
982
|
ref: forwardedRef
|
|
913
983
|
}, children);
|
|
@@ -1004,12 +1074,13 @@ import React20, { forwardRef as forwardRef14 } from "react";
|
|
|
1004
1074
|
var ContextMenuRoot = ContextMenuPrimitive.ContextMenu;
|
|
1005
1075
|
var ContextMenuTrigger = ContextMenuPrimitive.Trigger;
|
|
1006
1076
|
var ContextMenuPortal = ContextMenuPrimitive.Portal;
|
|
1007
|
-
var ContextMenuContent = /* @__PURE__ */ forwardRef14(({ classNames, children, ...props }, forwardedRef) => {
|
|
1077
|
+
var ContextMenuContent = /* @__PURE__ */ forwardRef14(({ classNames, children, collisionPadding = 8, ...props }, forwardedRef) => {
|
|
1008
1078
|
const { tx } = useThemeContext();
|
|
1009
1079
|
const elevation = useElevationContext();
|
|
1080
|
+
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
1010
1081
|
return /* @__PURE__ */ React20.createElement(ContextMenuPrimitive.Content, {
|
|
1011
|
-
collisionPadding: 8,
|
|
1012
1082
|
...props,
|
|
1083
|
+
collisionPadding: safeCollisionPadding,
|
|
1013
1084
|
className: tx("menu.content", "menu", {
|
|
1014
1085
|
elevation
|
|
1015
1086
|
}, classNames),
|
|
@@ -1092,7 +1163,7 @@ import { createMenuScope } from "@radix-ui/react-menu";
|
|
|
1092
1163
|
import { Primitive as Primitive7 } from "@radix-ui/react-primitive";
|
|
1093
1164
|
import { Slot as Slot7 } from "@radix-ui/react-slot";
|
|
1094
1165
|
import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
|
1095
|
-
import React21, { useRef, useCallback as
|
|
1166
|
+
import React21, { useRef, useCallback as useCallback4, forwardRef as forwardRef15, useEffect as useEffect3 } from "react";
|
|
1096
1167
|
var DROPDOWN_MENU_NAME = "DropdownMenu";
|
|
1097
1168
|
var [createDropdownMenuContext, createDropdownMenuScope] = createContextScope(DROPDOWN_MENU_NAME, [
|
|
1098
1169
|
createMenuScope
|
|
@@ -1115,7 +1186,7 @@ var DropdownMenuRoot = (props) => {
|
|
|
1115
1186
|
contentId: useId3(),
|
|
1116
1187
|
open,
|
|
1117
1188
|
onOpenChange: setOpen,
|
|
1118
|
-
onOpenToggle:
|
|
1189
|
+
onOpenToggle: useCallback4(() => setOpen((prevOpen) => !prevOpen), [
|
|
1119
1190
|
setOpen
|
|
1120
1191
|
]),
|
|
1121
1192
|
modal
|
|
@@ -1184,7 +1255,7 @@ var DropdownMenuVirtualTrigger = (props) => {
|
|
|
1184
1255
|
const { __scopeDropdownMenu, virtualRef } = props;
|
|
1185
1256
|
const context = useDropdownMenuContext(VIRTUAL_TRIGGER_NAME, __scopeDropdownMenu);
|
|
1186
1257
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1187
|
-
|
|
1258
|
+
useEffect3(() => {
|
|
1188
1259
|
if (virtualRef.current) {
|
|
1189
1260
|
context.triggerRef.current = virtualRef.current;
|
|
1190
1261
|
}
|
|
@@ -1216,17 +1287,19 @@ var DropdownMenuViewport = /* @__PURE__ */ forwardRef15(({ classNames, asChild,
|
|
|
1216
1287
|
});
|
|
1217
1288
|
var CONTENT_NAME = "DropdownMenuContent";
|
|
1218
1289
|
var DropdownMenuContent = /* @__PURE__ */ forwardRef15((props, forwardedRef) => {
|
|
1219
|
-
const { __scopeDropdownMenu, classNames, ...contentProps } = props;
|
|
1290
|
+
const { __scopeDropdownMenu, classNames, collisionPadding = 8, ...contentProps } = props;
|
|
1220
1291
|
const { tx } = useThemeContext();
|
|
1221
1292
|
const context = useDropdownMenuContext(CONTENT_NAME, __scopeDropdownMenu);
|
|
1222
1293
|
const elevation = useElevationContext();
|
|
1223
1294
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1224
1295
|
const hasInteractedOutsideRef = useRef(false);
|
|
1296
|
+
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
1225
1297
|
return /* @__PURE__ */ React21.createElement(MenuPrimitive.Content, {
|
|
1226
1298
|
id: context.contentId,
|
|
1227
1299
|
"aria-labelledby": context.triggerId,
|
|
1228
1300
|
...menuScope,
|
|
1229
1301
|
...contentProps,
|
|
1302
|
+
collisionPadding: safeCollisionPadding,
|
|
1230
1303
|
ref: forwardedRef,
|
|
1231
1304
|
onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
1232
1305
|
if (!hasInteractedOutsideRef.current) {
|
|
@@ -1441,7 +1514,7 @@ var useDropdownMenuMenuScope = useMenuScope;
|
|
|
1441
1514
|
// packages/ui/react-ui/src/components/Input/Input.tsx
|
|
1442
1515
|
import { Root as CheckboxPrimitive } from "@radix-ui/react-checkbox";
|
|
1443
1516
|
import { useControllableState as useControllableState2 } from "@radix-ui/react-use-controllable-state";
|
|
1444
|
-
import React22, { forwardRef as forwardRef16, useCallback as
|
|
1517
|
+
import React22, { forwardRef as forwardRef16, useCallback as useCallback5 } from "react";
|
|
1445
1518
|
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";
|
|
1446
1519
|
var Label3 = /* @__PURE__ */ forwardRef16(({ srOnly, classNames, children, ...props }, forwardedRef) => {
|
|
1447
1520
|
const { tx } = useThemeContext();
|
|
@@ -1490,7 +1563,7 @@ var PinInput = /* @__PURE__ */ forwardRef16(({ density: propsDensity, elevation:
|
|
|
1490
1563
|
const { tx } = useThemeContext();
|
|
1491
1564
|
const density = useDensityContext(propsDensity);
|
|
1492
1565
|
const elevation = useElevationContext(propsElevation);
|
|
1493
|
-
const segmentClassName =
|
|
1566
|
+
const segmentClassName = useCallback5(({ focused, validationValence }) => tx("input.input", "input--pin-segment", {
|
|
1494
1567
|
variant: "static",
|
|
1495
1568
|
focused,
|
|
1496
1569
|
disabled: props.disabled,
|
|
@@ -1598,7 +1671,7 @@ var Switch = /* @__PURE__ */ forwardRef16(({ __inputScope, checked: propsChecked
|
|
|
1598
1671
|
const { id, validationValence, descriptionId, errorMessageId } = useInputContext(INPUT_NAME, __inputScope);
|
|
1599
1672
|
return /* @__PURE__ */ React22.createElement("input", {
|
|
1600
1673
|
type: "checkbox",
|
|
1601
|
-
className: "
|
|
1674
|
+
className: "dx-checkbox--switch dx-focus-ring",
|
|
1602
1675
|
checked,
|
|
1603
1676
|
onChange: (event) => {
|
|
1604
1677
|
onCheckedChange(event.target.checked);
|
|
@@ -1641,8 +1714,8 @@ var edgeToOrientationMap = {
|
|
|
1641
1714
|
right: "vertical"
|
|
1642
1715
|
};
|
|
1643
1716
|
var orientationStyles = {
|
|
1644
|
-
horizontal: "h-[--line-thickness] left-[--terminal-radius] right-
|
|
1645
|
-
vertical: "w-[--line-thickness] top-[--terminal-radius] bottom-
|
|
1717
|
+
horizontal: "h-[--line-thickness] left-[calc(var(--line-inset)+var(--terminal-radius))] right-[--line-inset] before:left-[--terminal-inset]",
|
|
1718
|
+
vertical: "w-[--line-thickness] top-[calc(var(--line-inset)+var(--terminal-radius))] bottom-[--line-inset] before:top-[--terminal-inset]"
|
|
1646
1719
|
};
|
|
1647
1720
|
var edgeStyles = {
|
|
1648
1721
|
top: "top-[--line-offset] before:top-[--offset-terminal]",
|
|
@@ -1653,17 +1726,17 @@ var edgeStyles = {
|
|
|
1653
1726
|
var strokeSize = 2;
|
|
1654
1727
|
var terminalSize = 8;
|
|
1655
1728
|
var offsetToAlignTerminalWithLine = (strokeSize - terminalSize) / 2;
|
|
1656
|
-
var ListDropIndicator = ({ edge, gap = 0 }) => {
|
|
1657
|
-
const lineOffset = `calc(-0.5 * (${gap}px + ${strokeSize}px))`;
|
|
1729
|
+
var ListDropIndicator = ({ edge, gap = 0, lineInset = 0, terminalInset = lineInset - terminalSize }) => {
|
|
1658
1730
|
const orientation = edgeToOrientationMap[edge];
|
|
1659
1731
|
return /* @__PURE__ */ React23.createElement("div", {
|
|
1660
1732
|
role: "none",
|
|
1661
1733
|
style: {
|
|
1662
1734
|
"--line-thickness": `${strokeSize}px`,
|
|
1663
|
-
"--line-offset":
|
|
1735
|
+
"--line-offset": `calc(-0.5 * (${gap}px + ${strokeSize}px))`,
|
|
1736
|
+
"--line-inset": `${lineInset}px`,
|
|
1664
1737
|
"--terminal-size": `${terminalSize}px`,
|
|
1665
1738
|
"--terminal-radius": `${terminalSize / 2}px`,
|
|
1666
|
-
"--
|
|
1739
|
+
"--terminal-inset": `${terminalInset}px`,
|
|
1667
1740
|
"--offset-terminal": `${offsetToAlignTerminalWithLine}px`
|
|
1668
1741
|
},
|
|
1669
1742
|
className: `absolute z-10 pointer-events-none bg-accentSurface before:content-[''] before:w-[--terminal-size] before:h-[--terminal-size] box-border before:absolute before:border-[length:--line-thickness] before:border-solid before:border-accentSurface before:rounded-full ${orientationStyles[orientation]} ${edgeStyles[edge]}`
|
|
@@ -1943,18 +2016,17 @@ var Treegrid = {
|
|
|
1943
2016
|
|
|
1944
2017
|
// packages/ui/react-ui/src/components/Main/Main.tsx
|
|
1945
2018
|
import { useFocusableGroup as useFocusableGroup2 } from "@fluentui/react-tabster";
|
|
1946
|
-
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
1947
2019
|
import { createContext as createContext10 } from "@radix-ui/react-context";
|
|
1948
2020
|
import { Root as DialogRoot2, DialogContent as DialogContent2 } from "@radix-ui/react-dialog";
|
|
1949
2021
|
import { Primitive as Primitive9 } from "@radix-ui/react-primitive";
|
|
1950
2022
|
import { Slot as Slot10 } from "@radix-ui/react-slot";
|
|
1951
2023
|
import { useControllableState as useControllableState4 } from "@radix-ui/react-use-controllable-state";
|
|
1952
|
-
import React28, { forwardRef as forwardRef20, useCallback as
|
|
2024
|
+
import React28, { forwardRef as forwardRef20, useCallback as useCallback7, useEffect as useEffect5, useRef as useRef2, useState as useState8 } from "react";
|
|
1953
2025
|
import { log } from "@dxos/log";
|
|
1954
2026
|
import { useMediaQuery, useForwardedRef } from "@dxos/react-hooks";
|
|
1955
2027
|
|
|
1956
2028
|
// packages/ui/react-ui/src/components/Main/useSwipeToDismiss.ts
|
|
1957
|
-
import { useCallback as
|
|
2029
|
+
import { useCallback as useCallback6, useEffect as useEffect4, useState as useState7 } from "react";
|
|
1958
2030
|
var MotionState;
|
|
1959
2031
|
(function(MotionState2) {
|
|
1960
2032
|
MotionState2[MotionState2["IDLE"] = 0] = "IDLE";
|
|
@@ -1969,22 +2041,22 @@ var useSwipeToDismiss = (ref, {
|
|
|
1969
2041
|
/* side = 'inline-start' */
|
|
1970
2042
|
}) => {
|
|
1971
2043
|
const $root = ref.current;
|
|
1972
|
-
const [motionState, setMotionState] =
|
|
1973
|
-
const [gestureStartX, setGestureStartX] =
|
|
1974
|
-
const setIdle =
|
|
2044
|
+
const [motionState, setMotionState] = useState7(0);
|
|
2045
|
+
const [gestureStartX, setGestureStartX] = useState7(0);
|
|
2046
|
+
const setIdle = useCallback6(() => {
|
|
1975
2047
|
setMotionState(0);
|
|
1976
2048
|
$root?.style.removeProperty("inset-inline-start");
|
|
1977
2049
|
$root?.style.setProperty("transition-duration", "200ms");
|
|
1978
2050
|
}, [
|
|
1979
2051
|
$root
|
|
1980
2052
|
]);
|
|
1981
|
-
const setFollowing =
|
|
2053
|
+
const setFollowing = useCallback6(() => {
|
|
1982
2054
|
setMotionState(2);
|
|
1983
2055
|
$root?.style.setProperty("transition-duration", "0ms");
|
|
1984
2056
|
}, [
|
|
1985
2057
|
$root
|
|
1986
2058
|
]);
|
|
1987
|
-
const handlePointerDown =
|
|
2059
|
+
const handlePointerDown = useCallback6(({ screenX }) => {
|
|
1988
2060
|
if (motionState === 0) {
|
|
1989
2061
|
setMotionState(1);
|
|
1990
2062
|
setGestureStartX(screenX);
|
|
@@ -1992,7 +2064,7 @@ var useSwipeToDismiss = (ref, {
|
|
|
1992
2064
|
}, [
|
|
1993
2065
|
motionState
|
|
1994
2066
|
]);
|
|
1995
|
-
const handlePointerMove =
|
|
2067
|
+
const handlePointerMove = useCallback6(({ screenX }) => {
|
|
1996
2068
|
if ($root) {
|
|
1997
2069
|
const delta = Math.min(screenX - gestureStartX, 0);
|
|
1998
2070
|
switch (motionState) {
|
|
@@ -2016,12 +2088,12 @@ var useSwipeToDismiss = (ref, {
|
|
|
2016
2088
|
motionState,
|
|
2017
2089
|
gestureStartX
|
|
2018
2090
|
]);
|
|
2019
|
-
const handlePointerUp =
|
|
2091
|
+
const handlePointerUp = useCallback6(() => {
|
|
2020
2092
|
setIdle();
|
|
2021
2093
|
}, [
|
|
2022
2094
|
setIdle
|
|
2023
2095
|
]);
|
|
2024
|
-
|
|
2096
|
+
useEffect4(() => {
|
|
2025
2097
|
$root?.addEventListener("pointerdown", handlePointerDown);
|
|
2026
2098
|
return () => {
|
|
2027
2099
|
$root?.removeEventListener("pointerdown", handlePointerDown);
|
|
@@ -2030,7 +2102,7 @@ var useSwipeToDismiss = (ref, {
|
|
|
2030
2102
|
$root,
|
|
2031
2103
|
handlePointerDown
|
|
2032
2104
|
]);
|
|
2033
|
-
|
|
2105
|
+
useEffect4(() => {
|
|
2034
2106
|
$root && document.documentElement.addEventListener("pointermove", handlePointerMove);
|
|
2035
2107
|
return () => {
|
|
2036
2108
|
document.documentElement.removeEventListener("pointermove", handlePointerMove);
|
|
@@ -2039,7 +2111,7 @@ var useSwipeToDismiss = (ref, {
|
|
|
2039
2111
|
$root,
|
|
2040
2112
|
handlePointerMove
|
|
2041
2113
|
]);
|
|
2042
|
-
|
|
2114
|
+
useEffect4(() => {
|
|
2043
2115
|
$root && document.documentElement.addEventListener("pointerup", handlePointerUp);
|
|
2044
2116
|
return () => {
|
|
2045
2117
|
document.documentElement.removeEventListener("pointerup", handlePointerUp);
|
|
@@ -2059,7 +2131,7 @@ var MAIN_NAME = "Main";
|
|
|
2059
2131
|
var GENERIC_CONSUMER_NAME = "GenericConsumer";
|
|
2060
2132
|
var landmarkAttr = "data-main-landmark";
|
|
2061
2133
|
var useLandmarkMover = (propsOnKeyDown, landmark) => {
|
|
2062
|
-
const handleKeyDown =
|
|
2134
|
+
const handleKeyDown = useCallback7((event) => {
|
|
2063
2135
|
const target = event.target;
|
|
2064
2136
|
if (event.target === event.currentTarget && event.key === "Tab" && target.hasAttribute(landmarkAttr)) {
|
|
2065
2137
|
event.preventDefault();
|
|
@@ -2088,72 +2160,66 @@ var useLandmarkMover = (propsOnKeyDown, landmark) => {
|
|
|
2088
2160
|
};
|
|
2089
2161
|
var [MainProvider, useMainContext] = createContext10(MAIN_NAME, {
|
|
2090
2162
|
resizing: false,
|
|
2091
|
-
|
|
2092
|
-
|
|
2163
|
+
navigationSidebarState: "closed",
|
|
2164
|
+
setNavigationSidebarState: (nextState) => {
|
|
2093
2165
|
log.warn("Attempt to set sidebar state without initializing `MainRoot`", void 0, {
|
|
2094
2166
|
F: __dxlog_file,
|
|
2095
|
-
L:
|
|
2167
|
+
L: 81,
|
|
2096
2168
|
S: void 0,
|
|
2097
2169
|
C: (f, a) => f(...a)
|
|
2098
2170
|
});
|
|
2099
2171
|
},
|
|
2100
|
-
|
|
2101
|
-
|
|
2172
|
+
complementarySidebarState: "closed",
|
|
2173
|
+
setComplementarySidebarState: (nextState) => {
|
|
2102
2174
|
log.warn("Attempt to set sidebar state without initializing `MainRoot`", void 0, {
|
|
2103
2175
|
F: __dxlog_file,
|
|
2104
|
-
L:
|
|
2176
|
+
L: 86,
|
|
2105
2177
|
S: void 0,
|
|
2106
2178
|
C: (f, a) => f(...a)
|
|
2107
2179
|
});
|
|
2108
2180
|
}
|
|
2109
2181
|
});
|
|
2110
2182
|
var useSidebars = (consumerName = GENERIC_CONSUMER_NAME) => {
|
|
2111
|
-
const {
|
|
2183
|
+
const { setNavigationSidebarState, navigationSidebarState, setComplementarySidebarState, complementarySidebarState } = useMainContext(consumerName);
|
|
2112
2184
|
return {
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
toggleNavigationSidebar:
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
]),
|
|
2119
|
-
openNavigationSidebar: useCallback5(() => setNavigationSidebarOpen(true), [
|
|
2120
|
-
setNavigationSidebarOpen
|
|
2185
|
+
navigationSidebarState,
|
|
2186
|
+
setNavigationSidebarState,
|
|
2187
|
+
toggleNavigationSidebar: useCallback7(() => setNavigationSidebarState(navigationSidebarState === "expanded" ? "closed" : "expanded"), [
|
|
2188
|
+
navigationSidebarState,
|
|
2189
|
+
setNavigationSidebarState
|
|
2121
2190
|
]),
|
|
2122
|
-
|
|
2123
|
-
|
|
2191
|
+
openNavigationSidebar: useCallback7(() => setNavigationSidebarState("expanded"), []),
|
|
2192
|
+
collapseNavigationSidebar: useCallback7(() => setNavigationSidebarState("collapsed"), []),
|
|
2193
|
+
closeNavigationSidebar: useCallback7(() => setNavigationSidebarState("closed"), []),
|
|
2194
|
+
complementarySidebarState,
|
|
2195
|
+
setComplementarySidebarState,
|
|
2196
|
+
toggleComplementarySidebar: useCallback7(() => setComplementarySidebarState(complementarySidebarState === "expanded" ? "closed" : "expanded"), [
|
|
2197
|
+
complementarySidebarState,
|
|
2198
|
+
setComplementarySidebarState
|
|
2124
2199
|
]),
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
complementarySidebarOpen,
|
|
2129
|
-
setComplementarySidebarOpen
|
|
2130
|
-
]),
|
|
2131
|
-
openComplementarySidebar: useCallback5(() => setComplementarySidebarOpen(true), [
|
|
2132
|
-
setComplementarySidebarOpen
|
|
2133
|
-
]),
|
|
2134
|
-
closeComplementarySidebar: useCallback5(() => setComplementarySidebarOpen(false), [
|
|
2135
|
-
setComplementarySidebarOpen
|
|
2136
|
-
])
|
|
2200
|
+
openComplementarySidebar: useCallback7(() => setComplementarySidebarState("expanded"), []),
|
|
2201
|
+
collapseComplementarySidebar: useCallback7(() => setComplementarySidebarState("collapsed"), []),
|
|
2202
|
+
closeComplementarySidebar: useCallback7(() => setComplementarySidebarState("closed"), [])
|
|
2137
2203
|
};
|
|
2138
2204
|
};
|
|
2139
2205
|
var resizeDebounce = 3e3;
|
|
2140
|
-
var MainRoot = ({
|
|
2206
|
+
var MainRoot = ({ navigationSidebarState: propsNavigationSidebarState, defaultNavigationSidebarState, onNavigationSidebarStateChange, complementarySidebarState: propsComplementarySidebarState, defaultComplementarySidebarState, onComplementarySidebarStateChange, children, ...props }) => {
|
|
2141
2207
|
const [isLg] = useMediaQuery("lg", {
|
|
2142
2208
|
ssr: false
|
|
2143
2209
|
});
|
|
2144
|
-
const [
|
|
2145
|
-
prop:
|
|
2146
|
-
defaultProp:
|
|
2147
|
-
onChange:
|
|
2210
|
+
const [navigationSidebarState = isLg ? "expanded" : "collapsed", setNavigationSidebarState] = useControllableState4({
|
|
2211
|
+
prop: propsNavigationSidebarState,
|
|
2212
|
+
defaultProp: defaultNavigationSidebarState,
|
|
2213
|
+
onChange: onNavigationSidebarStateChange
|
|
2148
2214
|
});
|
|
2149
|
-
const [
|
|
2150
|
-
prop:
|
|
2151
|
-
defaultProp:
|
|
2152
|
-
onChange:
|
|
2215
|
+
const [complementarySidebarState = isLg ? "expanded" : "collapsed", setComplementarySidebarState] = useControllableState4({
|
|
2216
|
+
prop: propsComplementarySidebarState,
|
|
2217
|
+
defaultProp: defaultComplementarySidebarState,
|
|
2218
|
+
onChange: onComplementarySidebarStateChange
|
|
2153
2219
|
});
|
|
2154
|
-
const [resizing, setResizing] =
|
|
2220
|
+
const [resizing, setResizing] = useState8(false);
|
|
2155
2221
|
const resizeInterval = useRef2(null);
|
|
2156
|
-
const handleResize =
|
|
2222
|
+
const handleResize = useCallback7(() => {
|
|
2157
2223
|
setResizing(true);
|
|
2158
2224
|
if (resizeInterval.current) {
|
|
2159
2225
|
clearTimeout(resizeInterval.current);
|
|
@@ -2163,7 +2229,7 @@ var MainRoot = ({ navigationSidebarOpen: propsNavigationSidebarOpen, defaultNavi
|
|
|
2163
2229
|
resizeInterval.current = null;
|
|
2164
2230
|
}, resizeDebounce);
|
|
2165
2231
|
}, []);
|
|
2166
|
-
|
|
2232
|
+
useEffect5(() => {
|
|
2167
2233
|
window.addEventListener("resize", handleResize);
|
|
2168
2234
|
return () => window.removeEventListener("resize", handleResize);
|
|
2169
2235
|
}, [
|
|
@@ -2171,10 +2237,10 @@ var MainRoot = ({ navigationSidebarOpen: propsNavigationSidebarOpen, defaultNavi
|
|
|
2171
2237
|
]);
|
|
2172
2238
|
return /* @__PURE__ */ React28.createElement(MainProvider, {
|
|
2173
2239
|
...props,
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2240
|
+
navigationSidebarState,
|
|
2241
|
+
setNavigationSidebarState,
|
|
2242
|
+
complementarySidebarState,
|
|
2243
|
+
setComplementarySidebarState,
|
|
2178
2244
|
resizing
|
|
2179
2245
|
}, children);
|
|
2180
2246
|
};
|
|
@@ -2182,7 +2248,7 @@ MainRoot.displayName = MAIN_ROOT_NAME;
|
|
|
2182
2248
|
var handleOpenAutoFocus = (event) => {
|
|
2183
2249
|
!document.body.hasAttribute("data-is-keyboard") && event.preventDefault();
|
|
2184
2250
|
};
|
|
2185
|
-
var MainSidebar = /* @__PURE__ */ forwardRef20(({ classNames, children, swipeToDismiss, onOpenAutoFocus,
|
|
2251
|
+
var MainSidebar = /* @__PURE__ */ forwardRef20(({ classNames, children, swipeToDismiss, onOpenAutoFocus, state, resizing, onStateChange, side, ...props }, forwardedRef) => {
|
|
2186
2252
|
const [isLg] = useMediaQuery("lg", {
|
|
2187
2253
|
ssr: false
|
|
2188
2254
|
});
|
|
@@ -2190,9 +2256,9 @@ var MainSidebar = /* @__PURE__ */ forwardRef20(({ classNames, children, swipeToD
|
|
|
2190
2256
|
const ref = useForwardedRef(forwardedRef);
|
|
2191
2257
|
const noopRef = useRef2(null);
|
|
2192
2258
|
useSwipeToDismiss(swipeToDismiss ? ref : noopRef, {
|
|
2193
|
-
onDismiss: () =>
|
|
2259
|
+
onDismiss: () => onStateChange?.("closed")
|
|
2194
2260
|
});
|
|
2195
|
-
const handleKeyDown =
|
|
2261
|
+
const handleKeyDown = useCallback7((event) => {
|
|
2196
2262
|
if (event.key === "Escape") {
|
|
2197
2263
|
event.target.closest("[data-tabster]")?.focus();
|
|
2198
2264
|
}
|
|
@@ -2202,7 +2268,7 @@ var MainSidebar = /* @__PURE__ */ forwardRef20(({ classNames, children, swipeToD
|
|
|
2202
2268
|
]);
|
|
2203
2269
|
const Root5 = isLg ? Primitive9.div : DialogContent2;
|
|
2204
2270
|
return /* @__PURE__ */ React28.createElement(DialogRoot2, {
|
|
2205
|
-
open,
|
|
2271
|
+
open: state !== "closed",
|
|
2206
2272
|
modal: false
|
|
2207
2273
|
}, /* @__PURE__ */ React28.createElement(Root5, {
|
|
2208
2274
|
...!isLg && {
|
|
@@ -2212,24 +2278,24 @@ var MainSidebar = /* @__PURE__ */ forwardRef20(({ classNames, children, swipeToD
|
|
|
2212
2278
|
},
|
|
2213
2279
|
...props,
|
|
2214
2280
|
"data-side": side === "inline-end" ? "ie" : "is",
|
|
2215
|
-
"data-state":
|
|
2281
|
+
"data-state": state,
|
|
2216
2282
|
"data-resizing": resizing ? "true" : "false",
|
|
2217
2283
|
className: tx("main.sidebar", "main__sidebar", {}, classNames),
|
|
2218
2284
|
onKeyDown: handleKeyDown,
|
|
2219
|
-
|
|
2285
|
+
...state === "closed" && {
|
|
2220
2286
|
inert: "true"
|
|
2221
2287
|
},
|
|
2222
2288
|
ref
|
|
2223
2289
|
}, children));
|
|
2224
2290
|
});
|
|
2225
2291
|
var MainNavigationSidebar = /* @__PURE__ */ forwardRef20((props, forwardedRef) => {
|
|
2226
|
-
const {
|
|
2292
|
+
const { navigationSidebarState, setNavigationSidebarState, resizing } = useMainContext(NAVIGATION_SIDEBAR_NAME);
|
|
2227
2293
|
const mover = useLandmarkMover(props.onKeyDown, "0");
|
|
2228
2294
|
return /* @__PURE__ */ React28.createElement(MainSidebar, {
|
|
2229
2295
|
...mover,
|
|
2230
2296
|
...props,
|
|
2231
|
-
|
|
2232
|
-
|
|
2297
|
+
state: navigationSidebarState,
|
|
2298
|
+
onStateChange: setNavigationSidebarState,
|
|
2233
2299
|
resizing,
|
|
2234
2300
|
side: "inline-start",
|
|
2235
2301
|
ref: forwardedRef
|
|
@@ -2237,13 +2303,13 @@ var MainNavigationSidebar = /* @__PURE__ */ forwardRef20((props, forwardedRef) =
|
|
|
2237
2303
|
});
|
|
2238
2304
|
MainNavigationSidebar.displayName = NAVIGATION_SIDEBAR_NAME;
|
|
2239
2305
|
var MainComplementarySidebar = /* @__PURE__ */ forwardRef20((props, forwardedRef) => {
|
|
2240
|
-
const {
|
|
2306
|
+
const { complementarySidebarState, setComplementarySidebarState, resizing } = useMainContext(COMPLEMENTARY_SIDEBAR_NAME);
|
|
2241
2307
|
const mover = useLandmarkMover(props.onKeyDown, "2");
|
|
2242
2308
|
return /* @__PURE__ */ React28.createElement(MainSidebar, {
|
|
2243
2309
|
...mover,
|
|
2244
2310
|
...props,
|
|
2245
|
-
|
|
2246
|
-
|
|
2311
|
+
state: complementarySidebarState,
|
|
2312
|
+
onStateChange: setComplementarySidebarState,
|
|
2247
2313
|
resizing,
|
|
2248
2314
|
side: "inline-end",
|
|
2249
2315
|
ref: forwardedRef
|
|
@@ -2251,7 +2317,7 @@ var MainComplementarySidebar = /* @__PURE__ */ forwardRef20((props, forwardedRef
|
|
|
2251
2317
|
});
|
|
2252
2318
|
MainNavigationSidebar.displayName = NAVIGATION_SIDEBAR_NAME;
|
|
2253
2319
|
var MainContent = /* @__PURE__ */ forwardRef20(({ asChild, classNames, bounce, handlesFocus, children, role, ...props }, forwardedRef) => {
|
|
2254
|
-
const {
|
|
2320
|
+
const { navigationSidebarState, complementarySidebarState } = useMainContext(MAIN_NAME);
|
|
2255
2321
|
const { tx } = useThemeContext();
|
|
2256
2322
|
const Root5 = asChild ? Slot10 : role ? "div" : "main";
|
|
2257
2323
|
const mover = useLandmarkMover(props.onKeyDown, "1");
|
|
@@ -2261,8 +2327,8 @@ var MainContent = /* @__PURE__ */ forwardRef20(({ asChild, classNames, bounce, h
|
|
|
2261
2327
|
...mover
|
|
2262
2328
|
},
|
|
2263
2329
|
...props,
|
|
2264
|
-
"data-sidebar-inline-start-state":
|
|
2265
|
-
"data-sidebar-inline-end-state":
|
|
2330
|
+
"data-sidebar-inline-start-state": navigationSidebarState,
|
|
2331
|
+
"data-sidebar-inline-end-state": complementarySidebarState,
|
|
2266
2332
|
className: tx("main.content", "main", {
|
|
2267
2333
|
bounce,
|
|
2268
2334
|
handlesFocus
|
|
@@ -2275,55 +2341,30 @@ var MainOverlay = /* @__PURE__ */ forwardRef20(({ classNames, ...props }, forwar
|
|
|
2275
2341
|
const [isLg] = useMediaQuery("lg", {
|
|
2276
2342
|
ssr: false
|
|
2277
2343
|
});
|
|
2278
|
-
const {
|
|
2344
|
+
const { navigationSidebarState, setNavigationSidebarState, complementarySidebarState, setComplementarySidebarState } = useMainContext(MAIN_NAME);
|
|
2279
2345
|
const { tx } = useThemeContext();
|
|
2280
2346
|
return /* @__PURE__ */ React28.createElement("div", {
|
|
2281
2347
|
onClick: () => {
|
|
2282
|
-
|
|
2283
|
-
|
|
2348
|
+
setNavigationSidebarState("collapsed");
|
|
2349
|
+
setComplementarySidebarState("collapsed");
|
|
2284
2350
|
},
|
|
2285
2351
|
...props,
|
|
2286
2352
|
className: tx("main.overlay", "main__overlay", {
|
|
2287
2353
|
isLg,
|
|
2288
|
-
inlineStartSidebarOpen:
|
|
2289
|
-
inlineEndSidebarOpen:
|
|
2354
|
+
inlineStartSidebarOpen: navigationSidebarState,
|
|
2355
|
+
inlineEndSidebarOpen: complementarySidebarState
|
|
2290
2356
|
}, classNames),
|
|
2291
|
-
"data-state":
|
|
2357
|
+
"data-state": navigationSidebarState === "expanded" || complementarySidebarState === "expanded" ? "open" : "closed",
|
|
2292
2358
|
"aria-hidden": "true",
|
|
2293
2359
|
ref: forwardedRef
|
|
2294
2360
|
});
|
|
2295
2361
|
});
|
|
2296
|
-
var MainNotch = /* @__PURE__ */ forwardRef20(({ classNames, ...props }, forwardedRef) => {
|
|
2297
|
-
const { tx } = useThemeContext();
|
|
2298
|
-
const { navigationSidebarOpen } = useMainContext(MAIN_NAME);
|
|
2299
|
-
const notchElement = useRef2(null);
|
|
2300
|
-
const ref = useComposedRefs(forwardedRef, notchElement);
|
|
2301
|
-
const handleKeyDown = useCallback5((event) => {
|
|
2302
|
-
switch (event.key) {
|
|
2303
|
-
case "Escape":
|
|
2304
|
-
props?.onKeyDown?.(event);
|
|
2305
|
-
notchElement.current?.focus();
|
|
2306
|
-
}
|
|
2307
|
-
}, [
|
|
2308
|
-
props?.onKeyDown
|
|
2309
|
-
]);
|
|
2310
|
-
const mover = useLandmarkMover(handleKeyDown, "3");
|
|
2311
|
-
return /* @__PURE__ */ React28.createElement("div", {
|
|
2312
|
-
role: "toolbar",
|
|
2313
|
-
...mover,
|
|
2314
|
-
...props,
|
|
2315
|
-
"data-nav-sidebar-state": navigationSidebarOpen ? "open" : "closed",
|
|
2316
|
-
className: tx("main.notch", "main__notch", {}, classNames),
|
|
2317
|
-
ref
|
|
2318
|
-
});
|
|
2319
|
-
});
|
|
2320
2362
|
var Main = {
|
|
2321
2363
|
Root: MainRoot,
|
|
2322
2364
|
Content: MainContent,
|
|
2323
2365
|
Overlay: MainOverlay,
|
|
2324
2366
|
NavigationSidebar: MainNavigationSidebar,
|
|
2325
|
-
ComplementarySidebar: MainComplementarySidebar
|
|
2326
|
-
Notch: MainNotch
|
|
2367
|
+
ComplementarySidebar: MainComplementarySidebar
|
|
2327
2368
|
};
|
|
2328
2369
|
|
|
2329
2370
|
// packages/ui/react-ui/src/components/Message/Message.tsx
|
|
@@ -2389,7 +2430,7 @@ var Message = {
|
|
|
2389
2430
|
|
|
2390
2431
|
// packages/ui/react-ui/src/components/Popover/Popover.tsx
|
|
2391
2432
|
import { composeEventHandlers as composeEventHandlers2 } from "@radix-ui/primitive";
|
|
2392
|
-
import { useComposedRefs
|
|
2433
|
+
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
2393
2434
|
import { createContextScope as createContextScope3 } from "@radix-ui/react-context";
|
|
2394
2435
|
import { DismissableLayer } from "@radix-ui/react-dismissable-layer";
|
|
2395
2436
|
import { useFocusGuards } from "@radix-ui/react-focus-guards";
|
|
@@ -2403,7 +2444,7 @@ import { Primitive as Primitive11 } from "@radix-ui/react-primitive";
|
|
|
2403
2444
|
import { Slot as Slot12 } from "@radix-ui/react-slot";
|
|
2404
2445
|
import { useControllableState as useControllableState5 } from "@radix-ui/react-use-controllable-state";
|
|
2405
2446
|
import { hideOthers } from "aria-hidden";
|
|
2406
|
-
import React30, { forwardRef as forwardRef22, useRef as useRef3, useCallback as
|
|
2447
|
+
import React30, { forwardRef as forwardRef22, useRef as useRef3, useCallback as useCallback8, useState as useState9, useEffect as useEffect6 } from "react";
|
|
2407
2448
|
import { RemoveScroll } from "react-remove-scroll";
|
|
2408
2449
|
var POPOVER_NAME = "Popover";
|
|
2409
2450
|
var [createPopoverContext, createPopoverScope] = createContextScope3(POPOVER_NAME, [
|
|
@@ -2415,7 +2456,7 @@ var PopoverRoot = (props) => {
|
|
|
2415
2456
|
const { __scopePopover, children, open: openProp, defaultOpen, onOpenChange, modal = false } = props;
|
|
2416
2457
|
const popperScope = usePopperScope(__scopePopover);
|
|
2417
2458
|
const triggerRef = useRef3(null);
|
|
2418
|
-
const [hasCustomAnchor, setHasCustomAnchor] =
|
|
2459
|
+
const [hasCustomAnchor, setHasCustomAnchor] = useState9(false);
|
|
2419
2460
|
const [open = false, setOpen] = useControllableState5({
|
|
2420
2461
|
prop: openProp,
|
|
2421
2462
|
defaultProp: defaultOpen,
|
|
@@ -2427,12 +2468,12 @@ var PopoverRoot = (props) => {
|
|
|
2427
2468
|
triggerRef,
|
|
2428
2469
|
open,
|
|
2429
2470
|
onOpenChange: setOpen,
|
|
2430
|
-
onOpenToggle:
|
|
2471
|
+
onOpenToggle: useCallback8(() => setOpen((prevOpen) => !prevOpen), [
|
|
2431
2472
|
setOpen
|
|
2432
2473
|
]),
|
|
2433
2474
|
hasCustomAnchor,
|
|
2434
|
-
onCustomAnchorAdd:
|
|
2435
|
-
onCustomAnchorRemove:
|
|
2475
|
+
onCustomAnchorAdd: useCallback8(() => setHasCustomAnchor(true), []),
|
|
2476
|
+
onCustomAnchorRemove: useCallback8(() => setHasCustomAnchor(false), []),
|
|
2436
2477
|
modal
|
|
2437
2478
|
}, children));
|
|
2438
2479
|
};
|
|
@@ -2443,7 +2484,7 @@ var PopoverAnchor = /* @__PURE__ */ forwardRef22((props, forwardedRef) => {
|
|
|
2443
2484
|
const context = usePopoverContext(ANCHOR_NAME, __scopePopover);
|
|
2444
2485
|
const popperScope = usePopperScope(__scopePopover);
|
|
2445
2486
|
const { onCustomAnchorAdd, onCustomAnchorRemove } = context;
|
|
2446
|
-
|
|
2487
|
+
useEffect6(() => {
|
|
2447
2488
|
onCustomAnchorAdd();
|
|
2448
2489
|
return () => onCustomAnchorRemove();
|
|
2449
2490
|
}, [
|
|
@@ -2462,7 +2503,7 @@ var PopoverTrigger = /* @__PURE__ */ forwardRef22((props, forwardedRef) => {
|
|
|
2462
2503
|
const { __scopePopover, ...triggerProps } = props;
|
|
2463
2504
|
const context = usePopoverContext(TRIGGER_NAME2, __scopePopover);
|
|
2464
2505
|
const popperScope = usePopperScope(__scopePopover);
|
|
2465
|
-
const composedTriggerRef =
|
|
2506
|
+
const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
|
|
2466
2507
|
const trigger = /* @__PURE__ */ React30.createElement(Primitive11.button, {
|
|
2467
2508
|
type: "button",
|
|
2468
2509
|
"aria-haspopup": "dialog",
|
|
@@ -2484,7 +2525,7 @@ var PopoverVirtualTrigger = (props) => {
|
|
|
2484
2525
|
const { __scopePopover, virtualRef } = props;
|
|
2485
2526
|
const context = usePopoverContext(VIRTUAL_TRIGGER_NAME2, __scopePopover);
|
|
2486
2527
|
const popperScope = usePopperScope(__scopePopover);
|
|
2487
|
-
|
|
2528
|
+
useEffect6(() => {
|
|
2488
2529
|
if (virtualRef.current) {
|
|
2489
2530
|
context.triggerRef.current = virtualRef.current;
|
|
2490
2531
|
}
|
|
@@ -2532,9 +2573,9 @@ PopoverContent.displayName = CONTENT_NAME2;
|
|
|
2532
2573
|
var PopoverContentModal = /* @__PURE__ */ forwardRef22((props, forwardedRef) => {
|
|
2533
2574
|
const context = usePopoverContext(CONTENT_NAME2, props.__scopePopover);
|
|
2534
2575
|
const contentRef = useRef3(null);
|
|
2535
|
-
const composedRefs =
|
|
2576
|
+
const composedRefs = useComposedRefs(forwardedRef, contentRef);
|
|
2536
2577
|
const isRightClickOutsideRef = useRef3(false);
|
|
2537
|
-
|
|
2578
|
+
useEffect6(() => {
|
|
2538
2579
|
const content = contentRef.current;
|
|
2539
2580
|
if (content) {
|
|
2540
2581
|
return hideOthers(content);
|
|
@@ -2611,11 +2652,12 @@ var PopoverContentNonModal = /* @__PURE__ */ forwardRef22((props, forwardedRef)
|
|
|
2611
2652
|
});
|
|
2612
2653
|
});
|
|
2613
2654
|
var PopoverContentImpl = /* @__PURE__ */ forwardRef22((props, forwardedRef) => {
|
|
2614
|
-
const { __scopePopover, trapFocus, onOpenAutoFocus, onCloseAutoFocus, disableOutsidePointerEvents, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, classNames, ...contentProps } = props;
|
|
2655
|
+
const { __scopePopover, trapFocus, onOpenAutoFocus, onCloseAutoFocus, disableOutsidePointerEvents, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, collisionPadding = 8, classNames, ...contentProps } = props;
|
|
2615
2656
|
const context = usePopoverContext(CONTENT_NAME2, __scopePopover);
|
|
2616
2657
|
const popperScope = usePopperScope(__scopePopover);
|
|
2617
2658
|
const { tx } = useThemeContext();
|
|
2618
2659
|
const elevation = useElevationContext();
|
|
2660
|
+
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
2619
2661
|
useFocusGuards();
|
|
2620
2662
|
return /* @__PURE__ */ React30.createElement(FocusScope, {
|
|
2621
2663
|
asChild: true,
|
|
@@ -2637,6 +2679,7 @@ var PopoverContentImpl = /* @__PURE__ */ forwardRef22((props, forwardedRef) => {
|
|
|
2637
2679
|
id: context.contentId,
|
|
2638
2680
|
...popperScope,
|
|
2639
2681
|
...contentProps,
|
|
2682
|
+
collisionPadding: safeCollisionPadding,
|
|
2640
2683
|
className: tx("popover.content", "popover", {
|
|
2641
2684
|
elevation
|
|
2642
2685
|
}, classNames),
|
|
@@ -2807,11 +2850,13 @@ var SelectTriggerButton = /* @__PURE__ */ forwardRef25(({ children, placeholder,
|
|
|
2807
2850
|
weight: "bold"
|
|
2808
2851
|
}))));
|
|
2809
2852
|
});
|
|
2810
|
-
var SelectContent = /* @__PURE__ */ forwardRef25(({ classNames, children, ...props }, forwardedRef) => {
|
|
2853
|
+
var SelectContent = /* @__PURE__ */ forwardRef25(({ classNames, children, collisionPadding = 8, ...props }, forwardedRef) => {
|
|
2811
2854
|
const { tx } = useThemeContext();
|
|
2812
2855
|
const elevation = useElevationContext();
|
|
2856
|
+
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
2813
2857
|
return /* @__PURE__ */ React33.createElement(SelectPrimitive.Content, {
|
|
2814
2858
|
...props,
|
|
2859
|
+
collisionPadding: safeCollisionPadding,
|
|
2815
2860
|
className: tx("select.content", "select__content", {
|
|
2816
2861
|
elevation
|
|
2817
2862
|
}, classNames),
|
|
@@ -2917,30 +2962,32 @@ var Select = {
|
|
|
2917
2962
|
|
|
2918
2963
|
// packages/ui/react-ui/src/components/Separator/Separator.tsx
|
|
2919
2964
|
import { Separator as SeparatorPrimitive } from "@radix-ui/react-separator";
|
|
2920
|
-
import React34 from "react";
|
|
2921
|
-
var Separator4 = ({ classNames, orientation = "horizontal", ...props }) => {
|
|
2965
|
+
import React34, { forwardRef as forwardRef26 } from "react";
|
|
2966
|
+
var Separator4 = /* @__PURE__ */ forwardRef26(({ classNames, orientation = "horizontal", ...props }, forwardedRef) => {
|
|
2922
2967
|
const { tx } = useThemeContext();
|
|
2923
2968
|
return /* @__PURE__ */ React34.createElement(SeparatorPrimitive, {
|
|
2924
2969
|
orientation,
|
|
2925
2970
|
...props,
|
|
2926
2971
|
className: tx("separator.root", "separator", {
|
|
2927
2972
|
orientation
|
|
2928
|
-
}, classNames)
|
|
2973
|
+
}, classNames),
|
|
2974
|
+
ref: forwardedRef
|
|
2929
2975
|
});
|
|
2930
|
-
};
|
|
2976
|
+
});
|
|
2931
2977
|
|
|
2932
2978
|
// packages/ui/react-ui/src/components/Tag/Tag.tsx
|
|
2933
2979
|
import { Primitive as Primitive12 } from "@radix-ui/react-primitive";
|
|
2934
2980
|
import { Slot as Slot13 } from "@radix-ui/react-slot";
|
|
2935
|
-
import React35, { forwardRef as
|
|
2936
|
-
var Tag = /* @__PURE__ */
|
|
2981
|
+
import React35, { forwardRef as forwardRef27 } from "react";
|
|
2982
|
+
var Tag = /* @__PURE__ */ forwardRef27(({ asChild, palette = "neutral", classNames, ...props }, forwardedRef) => {
|
|
2937
2983
|
const { tx } = useThemeContext();
|
|
2938
2984
|
const Root5 = asChild ? Slot13 : Primitive12.span;
|
|
2939
2985
|
return /* @__PURE__ */ React35.createElement(Root5, {
|
|
2940
2986
|
...props,
|
|
2941
|
-
className: tx("tag.root", "tag", {
|
|
2987
|
+
className: tx("tag.root", "dx-tag", {
|
|
2942
2988
|
palette
|
|
2943
2989
|
}, classNames),
|
|
2990
|
+
"data-hue": palette,
|
|
2944
2991
|
ref: forwardedRef
|
|
2945
2992
|
});
|
|
2946
2993
|
});
|
|
@@ -2949,16 +2996,16 @@ var Tag = /* @__PURE__ */ forwardRef26(({ asChild, palette, classNames, ...props
|
|
|
2949
2996
|
import { Primitive as Primitive13 } from "@radix-ui/react-primitive";
|
|
2950
2997
|
import { Slot as Slot14 } from "@radix-ui/react-slot";
|
|
2951
2998
|
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";
|
|
2952
|
-
import React36, { forwardRef as
|
|
2999
|
+
import React36, { forwardRef as forwardRef28 } from "react";
|
|
2953
3000
|
var ToastProvider = ToastProviderPrimitive;
|
|
2954
|
-
var ToastViewport = /* @__PURE__ */
|
|
3001
|
+
var ToastViewport = /* @__PURE__ */ forwardRef28(({ classNames, ...props }, forwardedRef) => {
|
|
2955
3002
|
const { tx } = useThemeContext();
|
|
2956
3003
|
return /* @__PURE__ */ React36.createElement(ToastViewportPrimitive, {
|
|
2957
3004
|
className: tx("toast.viewport", "toast-viewport", {}, classNames),
|
|
2958
3005
|
ref: forwardedRef
|
|
2959
3006
|
});
|
|
2960
3007
|
});
|
|
2961
|
-
var ToastRoot = /* @__PURE__ */
|
|
3008
|
+
var ToastRoot = /* @__PURE__ */ forwardRef28(({ classNames, children, ...props }, forwardedRef) => {
|
|
2962
3009
|
const { tx } = useThemeContext();
|
|
2963
3010
|
return /* @__PURE__ */ React36.createElement(ToastRootPrimitive, {
|
|
2964
3011
|
...props,
|
|
@@ -2968,7 +3015,7 @@ var ToastRoot = /* @__PURE__ */ forwardRef27(({ classNames, children, ...props }
|
|
|
2968
3015
|
elevation: "toast"
|
|
2969
3016
|
}, children));
|
|
2970
3017
|
});
|
|
2971
|
-
var ToastBody = /* @__PURE__ */
|
|
3018
|
+
var ToastBody = /* @__PURE__ */ forwardRef28(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
2972
3019
|
const { tx } = useThemeContext();
|
|
2973
3020
|
const Root5 = asChild ? Slot14 : Primitive13.div;
|
|
2974
3021
|
return /* @__PURE__ */ React36.createElement(Root5, {
|
|
@@ -2977,7 +3024,7 @@ var ToastBody = /* @__PURE__ */ forwardRef27(({ asChild, classNames, ...props },
|
|
|
2977
3024
|
ref: forwardedRef
|
|
2978
3025
|
});
|
|
2979
3026
|
});
|
|
2980
|
-
var ToastTitle = /* @__PURE__ */
|
|
3027
|
+
var ToastTitle = /* @__PURE__ */ forwardRef28(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
2981
3028
|
const { tx } = useThemeContext();
|
|
2982
3029
|
const Root5 = asChild ? Slot14 : ToastTitlePrimitive;
|
|
2983
3030
|
return /* @__PURE__ */ React36.createElement(Root5, {
|
|
@@ -2986,7 +3033,7 @@ var ToastTitle = /* @__PURE__ */ forwardRef27(({ asChild, classNames, ...props }
|
|
|
2986
3033
|
ref: forwardedRef
|
|
2987
3034
|
});
|
|
2988
3035
|
});
|
|
2989
|
-
var ToastDescription = /* @__PURE__ */
|
|
3036
|
+
var ToastDescription = /* @__PURE__ */ forwardRef28(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
2990
3037
|
const { tx } = useThemeContext();
|
|
2991
3038
|
const Root5 = asChild ? Slot14 : ToastDescriptionPrimitive;
|
|
2992
3039
|
return /* @__PURE__ */ React36.createElement(Root5, {
|
|
@@ -2995,7 +3042,7 @@ var ToastDescription = /* @__PURE__ */ forwardRef27(({ asChild, classNames, ...p
|
|
|
2995
3042
|
ref: forwardedRef
|
|
2996
3043
|
});
|
|
2997
3044
|
});
|
|
2998
|
-
var ToastActions = /* @__PURE__ */
|
|
3045
|
+
var ToastActions = /* @__PURE__ */ forwardRef28(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
2999
3046
|
const { tx } = useThemeContext();
|
|
3000
3047
|
const Root5 = asChild ? Slot14 : Primitive13.div;
|
|
3001
3048
|
return /* @__PURE__ */ React36.createElement(Root5, {
|
|
@@ -3020,8 +3067,8 @@ var Toast = {
|
|
|
3020
3067
|
|
|
3021
3068
|
// packages/ui/react-ui/src/components/Toolbar/Toolbar.tsx
|
|
3022
3069
|
import * as ToolbarPrimitive from "@radix-ui/react-toolbar";
|
|
3023
|
-
import React37, { forwardRef as
|
|
3024
|
-
var ToolbarRoot = /* @__PURE__ */
|
|
3070
|
+
import React37, { forwardRef as forwardRef29 } from "react";
|
|
3071
|
+
var ToolbarRoot = /* @__PURE__ */ forwardRef29(({ classNames, children, ...props }, forwardedRef) => {
|
|
3025
3072
|
const { tx } = useThemeContext();
|
|
3026
3073
|
return /* @__PURE__ */ React37.createElement(ToolbarPrimitive.Root, {
|
|
3027
3074
|
...props,
|
|
@@ -3029,7 +3076,7 @@ var ToolbarRoot = /* @__PURE__ */ forwardRef28(({ classNames, children, ...props
|
|
|
3029
3076
|
ref: forwardedRef
|
|
3030
3077
|
}, children);
|
|
3031
3078
|
});
|
|
3032
|
-
var ToolbarButton = /* @__PURE__ */
|
|
3079
|
+
var ToolbarButton = /* @__PURE__ */ forwardRef29((props, forwardedRef) => {
|
|
3033
3080
|
return /* @__PURE__ */ React37.createElement(ToolbarPrimitive.Button, {
|
|
3034
3081
|
asChild: true
|
|
3035
3082
|
}, /* @__PURE__ */ React37.createElement(Button, {
|
|
@@ -3037,7 +3084,15 @@ var ToolbarButton = /* @__PURE__ */ forwardRef28((props, forwardedRef) => {
|
|
|
3037
3084
|
ref: forwardedRef
|
|
3038
3085
|
}));
|
|
3039
3086
|
});
|
|
3040
|
-
var
|
|
3087
|
+
var ToolbarIconButton = /* @__PURE__ */ forwardRef29((props, forwardedRef) => {
|
|
3088
|
+
return /* @__PURE__ */ React37.createElement(ToolbarPrimitive.Button, {
|
|
3089
|
+
asChild: true
|
|
3090
|
+
}, /* @__PURE__ */ React37.createElement(IconButton, {
|
|
3091
|
+
...props,
|
|
3092
|
+
ref: forwardedRef
|
|
3093
|
+
}));
|
|
3094
|
+
});
|
|
3095
|
+
var ToolbarToggle = /* @__PURE__ */ forwardRef29((props, forwardedRef) => {
|
|
3041
3096
|
return /* @__PURE__ */ React37.createElement(ToolbarPrimitive.Button, {
|
|
3042
3097
|
asChild: true
|
|
3043
3098
|
}, /* @__PURE__ */ React37.createElement(Toggle, {
|
|
@@ -3045,7 +3100,7 @@ var ToolbarToggle = /* @__PURE__ */ forwardRef28((props, forwardedRef) => {
|
|
|
3045
3100
|
ref: forwardedRef
|
|
3046
3101
|
}));
|
|
3047
3102
|
});
|
|
3048
|
-
var ToolbarLink = /* @__PURE__ */
|
|
3103
|
+
var ToolbarLink = /* @__PURE__ */ forwardRef29((props, forwardedRef) => {
|
|
3049
3104
|
return /* @__PURE__ */ React37.createElement(ToolbarPrimitive.Link, {
|
|
3050
3105
|
asChild: true
|
|
3051
3106
|
}, /* @__PURE__ */ React37.createElement(Link, {
|
|
@@ -3053,7 +3108,7 @@ var ToolbarLink = /* @__PURE__ */ forwardRef28((props, forwardedRef) => {
|
|
|
3053
3108
|
ref: forwardedRef
|
|
3054
3109
|
}));
|
|
3055
3110
|
});
|
|
3056
|
-
var ToolbarToggleGroup2 = /* @__PURE__ */
|
|
3111
|
+
var ToolbarToggleGroup2 = /* @__PURE__ */ forwardRef29(({ classNames, children, elevation, ...props }, forwardedRef) => {
|
|
3057
3112
|
return /* @__PURE__ */ React37.createElement(ToolbarPrimitive.ToolbarToggleGroup, {
|
|
3058
3113
|
...props,
|
|
3059
3114
|
asChild: true
|
|
@@ -3064,7 +3119,7 @@ var ToolbarToggleGroup2 = /* @__PURE__ */ forwardRef28(({ classNames, children,
|
|
|
3064
3119
|
ref: forwardedRef
|
|
3065
3120
|
}));
|
|
3066
3121
|
});
|
|
3067
|
-
var ToolbarToggleGroupItem = /* @__PURE__ */
|
|
3122
|
+
var ToolbarToggleGroupItem = /* @__PURE__ */ forwardRef29(({ variant, density, elevation, classNames, children, ...props }, forwardedRef) => {
|
|
3068
3123
|
return /* @__PURE__ */ React37.createElement(ToolbarPrimitive.ToolbarToggleItem, {
|
|
3069
3124
|
...props,
|
|
3070
3125
|
asChild: true
|
|
@@ -3077,26 +3132,42 @@ var ToolbarToggleGroupItem = /* @__PURE__ */ forwardRef28(({ variant, density, e
|
|
|
3077
3132
|
ref: forwardedRef
|
|
3078
3133
|
}));
|
|
3079
3134
|
});
|
|
3080
|
-
var
|
|
3081
|
-
return /* @__PURE__ */ React37.createElement(ToolbarPrimitive.
|
|
3135
|
+
var ToolbarToggleGroupIconItem = /* @__PURE__ */ forwardRef29(({ variant, density, elevation, classNames, icon, label, iconOnly, ...props }, forwardedRef) => {
|
|
3136
|
+
return /* @__PURE__ */ React37.createElement(ToolbarPrimitive.ToolbarToggleItem, {
|
|
3137
|
+
...props,
|
|
3082
3138
|
asChild: true
|
|
3083
|
-
}, /* @__PURE__ */ React37.createElement(
|
|
3084
|
-
|
|
3085
|
-
|
|
3139
|
+
}, /* @__PURE__ */ React37.createElement(IconButton, {
|
|
3140
|
+
variant,
|
|
3141
|
+
density,
|
|
3142
|
+
elevation,
|
|
3143
|
+
classNames,
|
|
3144
|
+
icon,
|
|
3145
|
+
label,
|
|
3146
|
+
iconOnly,
|
|
3147
|
+
ref: forwardedRef
|
|
3086
3148
|
}));
|
|
3087
|
-
};
|
|
3088
|
-
var
|
|
3089
|
-
|
|
3149
|
+
});
|
|
3150
|
+
var ToolbarSeparator = /* @__PURE__ */ forwardRef29(({ variant = "line", ...props }, forwardedRef) => {
|
|
3151
|
+
return variant === "line" ? /* @__PURE__ */ React37.createElement(ToolbarPrimitive.Separator, {
|
|
3152
|
+
asChild: true
|
|
3153
|
+
}, /* @__PURE__ */ React37.createElement(Separator4, {
|
|
3154
|
+
...props,
|
|
3155
|
+
ref: forwardedRef
|
|
3156
|
+
})) : /* @__PURE__ */ React37.createElement(ToolbarPrimitive.Separator, {
|
|
3157
|
+
className: "grow",
|
|
3158
|
+
ref: forwardedRef
|
|
3159
|
+
});
|
|
3090
3160
|
});
|
|
3091
3161
|
var Toolbar = {
|
|
3092
3162
|
Root: ToolbarRoot,
|
|
3093
3163
|
Button: ToolbarButton,
|
|
3164
|
+
IconButton: ToolbarIconButton,
|
|
3094
3165
|
Link: ToolbarLink,
|
|
3095
3166
|
Toggle: ToolbarToggle,
|
|
3096
3167
|
ToggleGroup: ToolbarToggleGroup2,
|
|
3097
3168
|
ToggleGroupItem: ToolbarToggleGroupItem,
|
|
3098
|
-
|
|
3099
|
-
|
|
3169
|
+
ToggleGroupIconItem: ToolbarToggleGroupIconItem,
|
|
3170
|
+
Separator: ToolbarSeparator
|
|
3100
3171
|
};
|
|
3101
3172
|
export {
|
|
3102
3173
|
AlertDialog,
|
|
@@ -3147,6 +3218,7 @@ export {
|
|
|
3147
3218
|
createDropdownMenuScope,
|
|
3148
3219
|
createPopoverScope,
|
|
3149
3220
|
hasIosKeyboard,
|
|
3221
|
+
initialSafeArea,
|
|
3150
3222
|
isLabel,
|
|
3151
3223
|
toLocalizedString,
|
|
3152
3224
|
useAvatarContext,
|
|
@@ -3156,9 +3228,11 @@ export {
|
|
|
3156
3228
|
useDropdownMenuContext,
|
|
3157
3229
|
useDropdownMenuMenuScope,
|
|
3158
3230
|
useElevationContext,
|
|
3231
|
+
useLandmarkMover,
|
|
3159
3232
|
useListContext,
|
|
3160
3233
|
useListItemContext,
|
|
3161
3234
|
useMainContext,
|
|
3235
|
+
useSafeArea,
|
|
3162
3236
|
useSidebars,
|
|
3163
3237
|
useThemeContext,
|
|
3164
3238
|
useTranslation,
|