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