@dxos/react-ui 0.7.5-main.9cb18ac → 0.7.5-main.9d2a38b
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 +213 -140
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +589 -520
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +213 -140
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/Buttons/IconButton.d.ts +4 -2
- package/dist/types/src/components/Buttons/IconButton.d.ts.map +1 -1
- package/dist/types/src/components/Dialogs/Dialog.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.d.ts +0 -2
- package/dist/types/src/components/Main/Main.d.ts.map +1 -1
- package/dist/types/src/components/Menus/ContextMenu.d.ts.map +1 -1
- package/dist/types/src/components/Menus/DropdownMenu.d.ts.map +1 -1
- package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
- package/dist/types/src/components/Select/Select.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/ThemeProvider/ThemeProvider.d.ts +3 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +15 -5
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts +7 -2
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.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/useVisualViewport.d.ts +1 -1
- package/dist/types/src/hooks/useVisualViewport.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -12
- package/src/components/Buttons/IconButton.tsx +22 -5
- package/src/components/Dialogs/Dialog.tsx +1 -9
- package/src/components/Main/Main.tsx +0 -36
- 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/ThemeProvider/ThemeProvider.tsx +12 -3
- package/src/components/Toolbar/Toolbar.tsx +40 -10
- 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
|
@@ -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
|
|
@@ -574,11 +594,33 @@ var ButtonGroup = /* @__PURE__ */ forwardRef7(({ children, elevation: propsEleva
|
|
|
574
594
|
ButtonGroup.displayName = BUTTON_GROUP_NAME;
|
|
575
595
|
|
|
576
596
|
// packages/ui/react-ui/src/components/Buttons/IconButton.tsx
|
|
577
|
-
import React10, { forwardRef as forwardRef9 } from "react";
|
|
597
|
+
import React10, { forwardRef as forwardRef9, useState as useState4 } from "react";
|
|
578
598
|
|
|
579
599
|
// packages/ui/react-ui/src/components/Tooltip/Tooltip.tsx
|
|
580
600
|
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
601
|
import React9, { forwardRef as forwardRef8 } from "react";
|
|
602
|
+
|
|
603
|
+
// packages/ui/react-ui/src/hooks/useSafeCollisionPadding.ts
|
|
604
|
+
import { useMemo } from "react";
|
|
605
|
+
var propIsNumber = (prop) => Number.isFinite(prop);
|
|
606
|
+
var propsIsRecord = (prop) => !!(prop && typeof prop === "object");
|
|
607
|
+
var safePadding = (propsPadding, safePadding2, side) => {
|
|
608
|
+
return (propIsNumber(safePadding2[side]) ? safePadding2[side] : 0) + (propIsNumber(propsPadding) ? propsPadding : propsIsRecord(propsPadding) ? propsPadding[side] ?? 0 : 0);
|
|
609
|
+
};
|
|
610
|
+
var useSafeCollisionPadding = (collisionPadding) => {
|
|
611
|
+
const { safeAreaPadding } = useThemeContext();
|
|
612
|
+
return useMemo(() => ({
|
|
613
|
+
top: safePadding(collisionPadding, safeAreaPadding, "top"),
|
|
614
|
+
right: safePadding(collisionPadding, safeAreaPadding, "right"),
|
|
615
|
+
bottom: safePadding(collisionPadding, safeAreaPadding, "bottom"),
|
|
616
|
+
left: safePadding(collisionPadding, safeAreaPadding, "left")
|
|
617
|
+
}), [
|
|
618
|
+
collisionPadding,
|
|
619
|
+
safeAreaPadding
|
|
620
|
+
]);
|
|
621
|
+
};
|
|
622
|
+
|
|
623
|
+
// packages/ui/react-ui/src/components/Tooltip/Tooltip.tsx
|
|
582
624
|
var TooltipProvider = TooltipProviderPrimitive;
|
|
583
625
|
var TooltipRoot = TooltipRootPrimitive;
|
|
584
626
|
var TooltipPortal = TooltipPortalPrimitive;
|
|
@@ -591,13 +633,14 @@ var TooltipArrow = /* @__PURE__ */ forwardRef8(({ classNames, ...props }, forwar
|
|
|
591
633
|
ref: forwardedRef
|
|
592
634
|
});
|
|
593
635
|
});
|
|
594
|
-
var TooltipContent = /* @__PURE__ */ forwardRef8(({ classNames, ...props }, forwardedRef) => {
|
|
636
|
+
var TooltipContent = /* @__PURE__ */ forwardRef8(({ classNames, collisionPadding = 8, ...props }, forwardedRef) => {
|
|
595
637
|
const { tx } = useThemeContext();
|
|
596
638
|
const elevation = useElevationContext();
|
|
639
|
+
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
597
640
|
return /* @__PURE__ */ React9.createElement(TooltipContentPrimitive, {
|
|
598
641
|
sideOffset: 4,
|
|
599
|
-
collisionPadding: 8,
|
|
600
642
|
...props,
|
|
643
|
+
collisionPadding: safeCollisionPadding,
|
|
601
644
|
className: tx("tooltip.content", "tooltip", {
|
|
602
645
|
elevation
|
|
603
646
|
}, classNames),
|
|
@@ -614,20 +657,31 @@ var Tooltip = {
|
|
|
614
657
|
};
|
|
615
658
|
|
|
616
659
|
// packages/ui/react-ui/src/components/Buttons/IconButton.tsx
|
|
617
|
-
var IconOnlyButton = /* @__PURE__ */ forwardRef9(({ tooltipPortal = true, tooltipZIndex: zIndex, ...props }, forwardedRef) => {
|
|
660
|
+
var IconOnlyButton = /* @__PURE__ */ forwardRef9(({ tooltipPortal = true, tooltipZIndex: zIndex, suppressNextTooltip, ...props }, forwardedRef) => {
|
|
661
|
+
const [triggerTooltipOpen, setTriggerTooltipOpen] = useState4(false);
|
|
618
662
|
const content = /* @__PURE__ */ React10.createElement(Tooltip.Content, zIndex && {
|
|
619
663
|
style: {
|
|
620
664
|
zIndex
|
|
621
665
|
}
|
|
622
666
|
}, props.label, /* @__PURE__ */ React10.createElement(Tooltip.Arrow, null));
|
|
623
|
-
return /* @__PURE__ */ React10.createElement(Tooltip.Root,
|
|
667
|
+
return /* @__PURE__ */ React10.createElement(Tooltip.Root, {
|
|
668
|
+
open: triggerTooltipOpen,
|
|
669
|
+
onOpenChange: (nextOpen) => {
|
|
670
|
+
if (suppressNextTooltip?.current) {
|
|
671
|
+
setTriggerTooltipOpen(false);
|
|
672
|
+
suppressNextTooltip.current = false;
|
|
673
|
+
} else {
|
|
674
|
+
setTriggerTooltipOpen(nextOpen);
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
}, /* @__PURE__ */ React10.createElement(Tooltip.Trigger, {
|
|
624
678
|
asChild: true
|
|
625
679
|
}, /* @__PURE__ */ React10.createElement(LabelledIconButton, {
|
|
626
680
|
...props,
|
|
627
681
|
ref: forwardedRef
|
|
628
682
|
})), tooltipPortal ? /* @__PURE__ */ React10.createElement(Tooltip.Portal, null, content) : content);
|
|
629
683
|
});
|
|
630
|
-
var LabelledIconButton = /* @__PURE__ */ forwardRef9(({ icon, size, iconOnly, label, classNames, iconClassNames, ...props }, forwardedRef) => {
|
|
684
|
+
var LabelledIconButton = /* @__PURE__ */ forwardRef9(({ icon, size, iconOnly, label, classNames, iconClassNames, caretDown, suppressNextTooltip, ...props }, forwardedRef) => {
|
|
631
685
|
const { tx } = useThemeContext();
|
|
632
686
|
return /* @__PURE__ */ React10.createElement(Button, {
|
|
633
687
|
...props,
|
|
@@ -639,7 +693,10 @@ var LabelledIconButton = /* @__PURE__ */ forwardRef9(({ icon, size, iconOnly, la
|
|
|
639
693
|
classNames: iconClassNames
|
|
640
694
|
}), /* @__PURE__ */ React10.createElement("span", {
|
|
641
695
|
className: iconOnly ? "sr-only" : void 0
|
|
642
|
-
}, label)
|
|
696
|
+
}, label), caretDown && /* @__PURE__ */ React10.createElement(Icon, {
|
|
697
|
+
size: 3,
|
|
698
|
+
icon: "ph--caret-down--bold"
|
|
699
|
+
}));
|
|
643
700
|
});
|
|
644
701
|
var IconButton = /* @__PURE__ */ forwardRef9((props, forwardedRef) => props.iconOnly ? /* @__PURE__ */ React10.createElement(IconOnlyButton, {
|
|
645
702
|
...props,
|
|
@@ -692,7 +749,7 @@ var ToggleGroupItem = /* @__PURE__ */ forwardRef11(({ variant, elevation, densit
|
|
|
692
749
|
});
|
|
693
750
|
|
|
694
751
|
// packages/ui/react-ui/src/components/Clipboard/ClipboardProvider.tsx
|
|
695
|
-
import React13, { createContext as createContext4, useCallback, useContext as useContext6, useState as
|
|
752
|
+
import React13, { createContext as createContext4, useCallback as useCallback3, useContext as useContext6, useState as useState5 } from "react";
|
|
696
753
|
var ClipboardContext = /* @__PURE__ */ createContext4({
|
|
697
754
|
textValue: "",
|
|
698
755
|
setTextValue: async (_) => {
|
|
@@ -700,8 +757,8 @@ var ClipboardContext = /* @__PURE__ */ createContext4({
|
|
|
700
757
|
});
|
|
701
758
|
var useClipboard = () => useContext6(ClipboardContext);
|
|
702
759
|
var ClipboardProvider = ({ children }) => {
|
|
703
|
-
const [textValue, setInternalTextValue] =
|
|
704
|
-
const setTextValue =
|
|
760
|
+
const [textValue, setInternalTextValue] = useState5("");
|
|
761
|
+
const setTextValue = useCallback3(async (nextValue) => {
|
|
705
762
|
await navigator.clipboard.writeText(nextValue);
|
|
706
763
|
return setInternalTextValue(nextValue);
|
|
707
764
|
}, []);
|
|
@@ -714,12 +771,12 @@ var ClipboardProvider = ({ children }) => {
|
|
|
714
771
|
};
|
|
715
772
|
|
|
716
773
|
// packages/ui/react-ui/src/components/Clipboard/CopyButton.tsx
|
|
717
|
-
import React17, { useState as
|
|
774
|
+
import React17, { useState as useState6 } from "react";
|
|
718
775
|
import { mx } from "@dxos/react-ui-theme";
|
|
719
776
|
|
|
720
777
|
// packages/ui/react-ui/src/components/ThemeProvider/ThemeProvider.tsx
|
|
721
778
|
import { createKeyborg } from "keyborg";
|
|
722
|
-
import React16, { createContext as createContext7, useEffect as
|
|
779
|
+
import React16, { createContext as createContext7, useEffect as useEffect2, useMemo as useMemo2 } from "react";
|
|
723
780
|
|
|
724
781
|
// packages/ui/react-ui/src/util/hasIosKeyboard.ts
|
|
725
782
|
var hasIosKeyboard = () => {
|
|
@@ -751,20 +808,28 @@ var ElevationProvider = ({ elevation, children }) => /* @__PURE__ */ React15.cre
|
|
|
751
808
|
// packages/ui/react-ui/src/components/ThemeProvider/ThemeProvider.tsx
|
|
752
809
|
var ThemeContext = /* @__PURE__ */ createContext7(void 0);
|
|
753
810
|
var ThemeProvider = ({ children, fallback = null, resourceExtensions, appNs, tx = (_path, defaultClassName, _styleProps, ..._options) => defaultClassName, themeMode = "dark", rootDensity = "fine", ...rest }) => {
|
|
754
|
-
|
|
811
|
+
useEffect2(() => {
|
|
755
812
|
if (document.defaultView) {
|
|
756
813
|
const kb = createKeyborg(document.defaultView);
|
|
757
814
|
kb.subscribe(handleInputModalityChange);
|
|
758
815
|
return () => kb.unsubscribe(handleInputModalityChange);
|
|
759
816
|
}
|
|
760
817
|
}, []);
|
|
818
|
+
const safeAreaPadding = useSafeArea();
|
|
819
|
+
const contextValue = useMemo2(() => ({
|
|
820
|
+
tx,
|
|
821
|
+
themeMode,
|
|
822
|
+
hasIosKeyboard: hasIosKeyboard(),
|
|
823
|
+
safeAreaPadding,
|
|
824
|
+
...rest
|
|
825
|
+
}), [
|
|
826
|
+
tx,
|
|
827
|
+
themeMode,
|
|
828
|
+
safeAreaPadding,
|
|
829
|
+
rest
|
|
830
|
+
]);
|
|
761
831
|
return /* @__PURE__ */ React16.createElement(ThemeContext.Provider, {
|
|
762
|
-
value:
|
|
763
|
-
tx,
|
|
764
|
-
themeMode,
|
|
765
|
-
hasIosKeyboard: hasIosKeyboard(),
|
|
766
|
-
...rest
|
|
767
|
-
}
|
|
832
|
+
value: contextValue
|
|
768
833
|
}, /* @__PURE__ */ React16.createElement(TranslationsProvider, {
|
|
769
834
|
fallback,
|
|
770
835
|
resourceExtensions,
|
|
@@ -822,7 +887,7 @@ var CopyButtonIconOnly = ({ value, classNames, iconProps, variant, ...props }) =
|
|
|
822
887
|
const { textValue, setTextValue } = useClipboard();
|
|
823
888
|
const isCopied = textValue === value;
|
|
824
889
|
const label = isCopied ? t("copy success label") : t("copy label");
|
|
825
|
-
const [open, setOpen] =
|
|
890
|
+
const [open, setOpen] = useState6(false);
|
|
826
891
|
return /* @__PURE__ */ React17.createElement(Tooltip.Root, {
|
|
827
892
|
delayDuration: 1500,
|
|
828
893
|
open,
|
|
@@ -895,7 +960,7 @@ var DialogOverlay = /* @__PURE__ */ forwardRef12(({ classNames, children, blockA
|
|
|
895
960
|
const { tx } = useThemeContext();
|
|
896
961
|
return /* @__PURE__ */ React18.createElement(DialogOverlayPrimitive, {
|
|
897
962
|
...props,
|
|
898
|
-
className: tx("dialog.overlay", "dialog__overlay", {}, classNames
|
|
963
|
+
className: tx("dialog.overlay", "dialog__overlay", {}, classNames),
|
|
899
964
|
ref: forwardedRef,
|
|
900
965
|
"data-block-align": blockAlign
|
|
901
966
|
}, /* @__PURE__ */ React18.createElement(OverlayLayoutProvider, {
|
|
@@ -1006,12 +1071,13 @@ import React20, { forwardRef as forwardRef14 } from "react";
|
|
|
1006
1071
|
var ContextMenuRoot = ContextMenuPrimitive.ContextMenu;
|
|
1007
1072
|
var ContextMenuTrigger = ContextMenuPrimitive.Trigger;
|
|
1008
1073
|
var ContextMenuPortal = ContextMenuPrimitive.Portal;
|
|
1009
|
-
var ContextMenuContent = /* @__PURE__ */ forwardRef14(({ classNames, children, ...props }, forwardedRef) => {
|
|
1074
|
+
var ContextMenuContent = /* @__PURE__ */ forwardRef14(({ classNames, children, collisionPadding = 8, ...props }, forwardedRef) => {
|
|
1010
1075
|
const { tx } = useThemeContext();
|
|
1011
1076
|
const elevation = useElevationContext();
|
|
1077
|
+
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
1012
1078
|
return /* @__PURE__ */ React20.createElement(ContextMenuPrimitive.Content, {
|
|
1013
|
-
collisionPadding: 8,
|
|
1014
1079
|
...props,
|
|
1080
|
+
collisionPadding: safeCollisionPadding,
|
|
1015
1081
|
className: tx("menu.content", "menu", {
|
|
1016
1082
|
elevation
|
|
1017
1083
|
}, classNames),
|
|
@@ -1094,7 +1160,7 @@ import { createMenuScope } from "@radix-ui/react-menu";
|
|
|
1094
1160
|
import { Primitive as Primitive7 } from "@radix-ui/react-primitive";
|
|
1095
1161
|
import { Slot as Slot7 } from "@radix-ui/react-slot";
|
|
1096
1162
|
import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
|
1097
|
-
import React21, { useRef, useCallback as
|
|
1163
|
+
import React21, { useRef, useCallback as useCallback4, forwardRef as forwardRef15, useEffect as useEffect3 } from "react";
|
|
1098
1164
|
var DROPDOWN_MENU_NAME = "DropdownMenu";
|
|
1099
1165
|
var [createDropdownMenuContext, createDropdownMenuScope] = createContextScope(DROPDOWN_MENU_NAME, [
|
|
1100
1166
|
createMenuScope
|
|
@@ -1117,7 +1183,7 @@ var DropdownMenuRoot = (props) => {
|
|
|
1117
1183
|
contentId: useId3(),
|
|
1118
1184
|
open,
|
|
1119
1185
|
onOpenChange: setOpen,
|
|
1120
|
-
onOpenToggle:
|
|
1186
|
+
onOpenToggle: useCallback4(() => setOpen((prevOpen) => !prevOpen), [
|
|
1121
1187
|
setOpen
|
|
1122
1188
|
]),
|
|
1123
1189
|
modal
|
|
@@ -1186,7 +1252,7 @@ var DropdownMenuVirtualTrigger = (props) => {
|
|
|
1186
1252
|
const { __scopeDropdownMenu, virtualRef } = props;
|
|
1187
1253
|
const context = useDropdownMenuContext(VIRTUAL_TRIGGER_NAME, __scopeDropdownMenu);
|
|
1188
1254
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1189
|
-
|
|
1255
|
+
useEffect3(() => {
|
|
1190
1256
|
if (virtualRef.current) {
|
|
1191
1257
|
context.triggerRef.current = virtualRef.current;
|
|
1192
1258
|
}
|
|
@@ -1218,17 +1284,19 @@ var DropdownMenuViewport = /* @__PURE__ */ forwardRef15(({ classNames, asChild,
|
|
|
1218
1284
|
});
|
|
1219
1285
|
var CONTENT_NAME = "DropdownMenuContent";
|
|
1220
1286
|
var DropdownMenuContent = /* @__PURE__ */ forwardRef15((props, forwardedRef) => {
|
|
1221
|
-
const { __scopeDropdownMenu, classNames, ...contentProps } = props;
|
|
1287
|
+
const { __scopeDropdownMenu, classNames, collisionPadding = 8, ...contentProps } = props;
|
|
1222
1288
|
const { tx } = useThemeContext();
|
|
1223
1289
|
const context = useDropdownMenuContext(CONTENT_NAME, __scopeDropdownMenu);
|
|
1224
1290
|
const elevation = useElevationContext();
|
|
1225
1291
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1226
1292
|
const hasInteractedOutsideRef = useRef(false);
|
|
1293
|
+
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
1227
1294
|
return /* @__PURE__ */ React21.createElement(MenuPrimitive.Content, {
|
|
1228
1295
|
id: context.contentId,
|
|
1229
1296
|
"aria-labelledby": context.triggerId,
|
|
1230
1297
|
...menuScope,
|
|
1231
1298
|
...contentProps,
|
|
1299
|
+
collisionPadding: safeCollisionPadding,
|
|
1232
1300
|
ref: forwardedRef,
|
|
1233
1301
|
onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
1234
1302
|
if (!hasInteractedOutsideRef.current) {
|
|
@@ -1443,7 +1511,7 @@ var useDropdownMenuMenuScope = useMenuScope;
|
|
|
1443
1511
|
// packages/ui/react-ui/src/components/Input/Input.tsx
|
|
1444
1512
|
import { Root as CheckboxPrimitive } from "@radix-ui/react-checkbox";
|
|
1445
1513
|
import { useControllableState as useControllableState2 } from "@radix-ui/react-use-controllable-state";
|
|
1446
|
-
import React22, { forwardRef as forwardRef16, useCallback as
|
|
1514
|
+
import React22, { forwardRef as forwardRef16, useCallback as useCallback5 } from "react";
|
|
1447
1515
|
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
1516
|
var Label3 = /* @__PURE__ */ forwardRef16(({ srOnly, classNames, children, ...props }, forwardedRef) => {
|
|
1449
1517
|
const { tx } = useThemeContext();
|
|
@@ -1492,7 +1560,7 @@ var PinInput = /* @__PURE__ */ forwardRef16(({ density: propsDensity, elevation:
|
|
|
1492
1560
|
const { tx } = useThemeContext();
|
|
1493
1561
|
const density = useDensityContext(propsDensity);
|
|
1494
1562
|
const elevation = useElevationContext(propsElevation);
|
|
1495
|
-
const segmentClassName =
|
|
1563
|
+
const segmentClassName = useCallback5(({ focused, validationValence }) => tx("input.input", "input--pin-segment", {
|
|
1496
1564
|
variant: "static",
|
|
1497
1565
|
focused,
|
|
1498
1566
|
disabled: props.disabled,
|
|
@@ -1945,18 +2013,17 @@ var Treegrid = {
|
|
|
1945
2013
|
|
|
1946
2014
|
// packages/ui/react-ui/src/components/Main/Main.tsx
|
|
1947
2015
|
import { useFocusableGroup as useFocusableGroup2 } from "@fluentui/react-tabster";
|
|
1948
|
-
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
1949
2016
|
import { createContext as createContext10 } from "@radix-ui/react-context";
|
|
1950
2017
|
import { Root as DialogRoot2, DialogContent as DialogContent2 } from "@radix-ui/react-dialog";
|
|
1951
2018
|
import { Primitive as Primitive9 } from "@radix-ui/react-primitive";
|
|
1952
2019
|
import { Slot as Slot10 } from "@radix-ui/react-slot";
|
|
1953
2020
|
import { useControllableState as useControllableState4 } from "@radix-ui/react-use-controllable-state";
|
|
1954
|
-
import React28, { forwardRef as forwardRef20, useCallback as
|
|
2021
|
+
import React28, { forwardRef as forwardRef20, useCallback as useCallback7, useEffect as useEffect5, useRef as useRef2, useState as useState8 } from "react";
|
|
1955
2022
|
import { log } from "@dxos/log";
|
|
1956
2023
|
import { useMediaQuery, useForwardedRef } from "@dxos/react-hooks";
|
|
1957
2024
|
|
|
1958
2025
|
// packages/ui/react-ui/src/components/Main/useSwipeToDismiss.ts
|
|
1959
|
-
import { useCallback as
|
|
2026
|
+
import { useCallback as useCallback6, useEffect as useEffect4, useState as useState7 } from "react";
|
|
1960
2027
|
var MotionState;
|
|
1961
2028
|
(function(MotionState2) {
|
|
1962
2029
|
MotionState2[MotionState2["IDLE"] = 0] = "IDLE";
|
|
@@ -1971,22 +2038,22 @@ var useSwipeToDismiss = (ref, {
|
|
|
1971
2038
|
/* side = 'inline-start' */
|
|
1972
2039
|
}) => {
|
|
1973
2040
|
const $root = ref.current;
|
|
1974
|
-
const [motionState, setMotionState] =
|
|
1975
|
-
const [gestureStartX, setGestureStartX] =
|
|
1976
|
-
const setIdle =
|
|
2041
|
+
const [motionState, setMotionState] = useState7(0);
|
|
2042
|
+
const [gestureStartX, setGestureStartX] = useState7(0);
|
|
2043
|
+
const setIdle = useCallback6(() => {
|
|
1977
2044
|
setMotionState(0);
|
|
1978
2045
|
$root?.style.removeProperty("inset-inline-start");
|
|
1979
2046
|
$root?.style.setProperty("transition-duration", "200ms");
|
|
1980
2047
|
}, [
|
|
1981
2048
|
$root
|
|
1982
2049
|
]);
|
|
1983
|
-
const setFollowing =
|
|
2050
|
+
const setFollowing = useCallback6(() => {
|
|
1984
2051
|
setMotionState(2);
|
|
1985
2052
|
$root?.style.setProperty("transition-duration", "0ms");
|
|
1986
2053
|
}, [
|
|
1987
2054
|
$root
|
|
1988
2055
|
]);
|
|
1989
|
-
const handlePointerDown =
|
|
2056
|
+
const handlePointerDown = useCallback6(({ screenX }) => {
|
|
1990
2057
|
if (motionState === 0) {
|
|
1991
2058
|
setMotionState(1);
|
|
1992
2059
|
setGestureStartX(screenX);
|
|
@@ -1994,7 +2061,7 @@ var useSwipeToDismiss = (ref, {
|
|
|
1994
2061
|
}, [
|
|
1995
2062
|
motionState
|
|
1996
2063
|
]);
|
|
1997
|
-
const handlePointerMove =
|
|
2064
|
+
const handlePointerMove = useCallback6(({ screenX }) => {
|
|
1998
2065
|
if ($root) {
|
|
1999
2066
|
const delta = Math.min(screenX - gestureStartX, 0);
|
|
2000
2067
|
switch (motionState) {
|
|
@@ -2018,12 +2085,12 @@ var useSwipeToDismiss = (ref, {
|
|
|
2018
2085
|
motionState,
|
|
2019
2086
|
gestureStartX
|
|
2020
2087
|
]);
|
|
2021
|
-
const handlePointerUp =
|
|
2088
|
+
const handlePointerUp = useCallback6(() => {
|
|
2022
2089
|
setIdle();
|
|
2023
2090
|
}, [
|
|
2024
2091
|
setIdle
|
|
2025
2092
|
]);
|
|
2026
|
-
|
|
2093
|
+
useEffect4(() => {
|
|
2027
2094
|
$root?.addEventListener("pointerdown", handlePointerDown);
|
|
2028
2095
|
return () => {
|
|
2029
2096
|
$root?.removeEventListener("pointerdown", handlePointerDown);
|
|
@@ -2032,7 +2099,7 @@ var useSwipeToDismiss = (ref, {
|
|
|
2032
2099
|
$root,
|
|
2033
2100
|
handlePointerDown
|
|
2034
2101
|
]);
|
|
2035
|
-
|
|
2102
|
+
useEffect4(() => {
|
|
2036
2103
|
$root && document.documentElement.addEventListener("pointermove", handlePointerMove);
|
|
2037
2104
|
return () => {
|
|
2038
2105
|
document.documentElement.removeEventListener("pointermove", handlePointerMove);
|
|
@@ -2041,7 +2108,7 @@ var useSwipeToDismiss = (ref, {
|
|
|
2041
2108
|
$root,
|
|
2042
2109
|
handlePointerMove
|
|
2043
2110
|
]);
|
|
2044
|
-
|
|
2111
|
+
useEffect4(() => {
|
|
2045
2112
|
$root && document.documentElement.addEventListener("pointerup", handlePointerUp);
|
|
2046
2113
|
return () => {
|
|
2047
2114
|
document.documentElement.removeEventListener("pointerup", handlePointerUp);
|
|
@@ -2061,7 +2128,7 @@ var MAIN_NAME = "Main";
|
|
|
2061
2128
|
var GENERIC_CONSUMER_NAME = "GenericConsumer";
|
|
2062
2129
|
var landmarkAttr = "data-main-landmark";
|
|
2063
2130
|
var useLandmarkMover = (propsOnKeyDown, landmark) => {
|
|
2064
|
-
const handleKeyDown =
|
|
2131
|
+
const handleKeyDown = useCallback7((event) => {
|
|
2065
2132
|
const target = event.target;
|
|
2066
2133
|
if (event.target === event.currentTarget && event.key === "Tab" && target.hasAttribute(landmarkAttr)) {
|
|
2067
2134
|
event.preventDefault();
|
|
@@ -2094,7 +2161,7 @@ var [MainProvider, useMainContext] = createContext10(MAIN_NAME, {
|
|
|
2094
2161
|
setNavigationSidebarOpen: (nextOpen) => {
|
|
2095
2162
|
log.warn("Attempt to set sidebar state without initializing `MainRoot`", void 0, {
|
|
2096
2163
|
F: __dxlog_file,
|
|
2097
|
-
L:
|
|
2164
|
+
L: 79,
|
|
2098
2165
|
S: void 0,
|
|
2099
2166
|
C: (f, a) => f(...a)
|
|
2100
2167
|
});
|
|
@@ -2103,7 +2170,7 @@ var [MainProvider, useMainContext] = createContext10(MAIN_NAME, {
|
|
|
2103
2170
|
setComplementarySidebarOpen: (nextOpen) => {
|
|
2104
2171
|
log.warn("Attempt to set sidebar state without initializing `MainRoot`", void 0, {
|
|
2105
2172
|
F: __dxlog_file,
|
|
2106
|
-
L:
|
|
2173
|
+
L: 84,
|
|
2107
2174
|
S: void 0,
|
|
2108
2175
|
C: (f, a) => f(...a)
|
|
2109
2176
|
});
|
|
@@ -2114,26 +2181,26 @@ var useSidebars = (consumerName = GENERIC_CONSUMER_NAME) => {
|
|
|
2114
2181
|
return {
|
|
2115
2182
|
navigationSidebarOpen,
|
|
2116
2183
|
setNavigationSidebarOpen,
|
|
2117
|
-
toggleNavigationSidebar:
|
|
2184
|
+
toggleNavigationSidebar: useCallback7(() => setNavigationSidebarOpen(!navigationSidebarOpen), [
|
|
2118
2185
|
navigationSidebarOpen,
|
|
2119
2186
|
setNavigationSidebarOpen
|
|
2120
2187
|
]),
|
|
2121
|
-
openNavigationSidebar:
|
|
2188
|
+
openNavigationSidebar: useCallback7(() => setNavigationSidebarOpen(true), [
|
|
2122
2189
|
setNavigationSidebarOpen
|
|
2123
2190
|
]),
|
|
2124
|
-
closeNavigationSidebar:
|
|
2191
|
+
closeNavigationSidebar: useCallback7(() => setNavigationSidebarOpen(false), [
|
|
2125
2192
|
setNavigationSidebarOpen
|
|
2126
2193
|
]),
|
|
2127
2194
|
complementarySidebarOpen,
|
|
2128
2195
|
setComplementarySidebarOpen,
|
|
2129
|
-
toggleComplementarySidebar:
|
|
2196
|
+
toggleComplementarySidebar: useCallback7(() => setComplementarySidebarOpen(!complementarySidebarOpen), [
|
|
2130
2197
|
complementarySidebarOpen,
|
|
2131
2198
|
setComplementarySidebarOpen
|
|
2132
2199
|
]),
|
|
2133
|
-
openComplementarySidebar:
|
|
2200
|
+
openComplementarySidebar: useCallback7(() => setComplementarySidebarOpen(true), [
|
|
2134
2201
|
setComplementarySidebarOpen
|
|
2135
2202
|
]),
|
|
2136
|
-
closeComplementarySidebar:
|
|
2203
|
+
closeComplementarySidebar: useCallback7(() => setComplementarySidebarOpen(false), [
|
|
2137
2204
|
setComplementarySidebarOpen
|
|
2138
2205
|
])
|
|
2139
2206
|
};
|
|
@@ -2153,9 +2220,9 @@ var MainRoot = ({ navigationSidebarOpen: propsNavigationSidebarOpen, defaultNavi
|
|
|
2153
2220
|
defaultProp: defaultComplementarySidebarOpen,
|
|
2154
2221
|
onChange: onComplementarySidebarOpenChange
|
|
2155
2222
|
});
|
|
2156
|
-
const [resizing, setResizing] =
|
|
2223
|
+
const [resizing, setResizing] = useState8(false);
|
|
2157
2224
|
const resizeInterval = useRef2(null);
|
|
2158
|
-
const handleResize =
|
|
2225
|
+
const handleResize = useCallback7(() => {
|
|
2159
2226
|
setResizing(true);
|
|
2160
2227
|
if (resizeInterval.current) {
|
|
2161
2228
|
clearTimeout(resizeInterval.current);
|
|
@@ -2165,7 +2232,7 @@ var MainRoot = ({ navigationSidebarOpen: propsNavigationSidebarOpen, defaultNavi
|
|
|
2165
2232
|
resizeInterval.current = null;
|
|
2166
2233
|
}, resizeDebounce);
|
|
2167
2234
|
}, []);
|
|
2168
|
-
|
|
2235
|
+
useEffect5(() => {
|
|
2169
2236
|
window.addEventListener("resize", handleResize);
|
|
2170
2237
|
return () => window.removeEventListener("resize", handleResize);
|
|
2171
2238
|
}, [
|
|
@@ -2194,7 +2261,7 @@ var MainSidebar = /* @__PURE__ */ forwardRef20(({ classNames, children, swipeToD
|
|
|
2194
2261
|
useSwipeToDismiss(swipeToDismiss ? ref : noopRef, {
|
|
2195
2262
|
onDismiss: () => setOpen(false)
|
|
2196
2263
|
});
|
|
2197
|
-
const handleKeyDown =
|
|
2264
|
+
const handleKeyDown = useCallback7((event) => {
|
|
2198
2265
|
if (event.key === "Escape") {
|
|
2199
2266
|
event.target.closest("[data-tabster]")?.focus();
|
|
2200
2267
|
}
|
|
@@ -2295,37 +2362,12 @@ var MainOverlay = /* @__PURE__ */ forwardRef20(({ classNames, ...props }, forwar
|
|
|
2295
2362
|
ref: forwardedRef
|
|
2296
2363
|
});
|
|
2297
2364
|
});
|
|
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
2365
|
var Main = {
|
|
2323
2366
|
Root: MainRoot,
|
|
2324
2367
|
Content: MainContent,
|
|
2325
2368
|
Overlay: MainOverlay,
|
|
2326
2369
|
NavigationSidebar: MainNavigationSidebar,
|
|
2327
|
-
ComplementarySidebar: MainComplementarySidebar
|
|
2328
|
-
Notch: MainNotch
|
|
2370
|
+
ComplementarySidebar: MainComplementarySidebar
|
|
2329
2371
|
};
|
|
2330
2372
|
|
|
2331
2373
|
// packages/ui/react-ui/src/components/Message/Message.tsx
|
|
@@ -2391,7 +2433,7 @@ var Message = {
|
|
|
2391
2433
|
|
|
2392
2434
|
// packages/ui/react-ui/src/components/Popover/Popover.tsx
|
|
2393
2435
|
import { composeEventHandlers as composeEventHandlers2 } from "@radix-ui/primitive";
|
|
2394
|
-
import { useComposedRefs
|
|
2436
|
+
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
2395
2437
|
import { createContextScope as createContextScope3 } from "@radix-ui/react-context";
|
|
2396
2438
|
import { DismissableLayer } from "@radix-ui/react-dismissable-layer";
|
|
2397
2439
|
import { useFocusGuards } from "@radix-ui/react-focus-guards";
|
|
@@ -2405,7 +2447,7 @@ import { Primitive as Primitive11 } from "@radix-ui/react-primitive";
|
|
|
2405
2447
|
import { Slot as Slot12 } from "@radix-ui/react-slot";
|
|
2406
2448
|
import { useControllableState as useControllableState5 } from "@radix-ui/react-use-controllable-state";
|
|
2407
2449
|
import { hideOthers } from "aria-hidden";
|
|
2408
|
-
import React30, { forwardRef as forwardRef22, useRef as useRef3, useCallback as
|
|
2450
|
+
import React30, { forwardRef as forwardRef22, useRef as useRef3, useCallback as useCallback8, useState as useState9, useEffect as useEffect6 } from "react";
|
|
2409
2451
|
import { RemoveScroll } from "react-remove-scroll";
|
|
2410
2452
|
var POPOVER_NAME = "Popover";
|
|
2411
2453
|
var [createPopoverContext, createPopoverScope] = createContextScope3(POPOVER_NAME, [
|
|
@@ -2417,7 +2459,7 @@ var PopoverRoot = (props) => {
|
|
|
2417
2459
|
const { __scopePopover, children, open: openProp, defaultOpen, onOpenChange, modal = false } = props;
|
|
2418
2460
|
const popperScope = usePopperScope(__scopePopover);
|
|
2419
2461
|
const triggerRef = useRef3(null);
|
|
2420
|
-
const [hasCustomAnchor, setHasCustomAnchor] =
|
|
2462
|
+
const [hasCustomAnchor, setHasCustomAnchor] = useState9(false);
|
|
2421
2463
|
const [open = false, setOpen] = useControllableState5({
|
|
2422
2464
|
prop: openProp,
|
|
2423
2465
|
defaultProp: defaultOpen,
|
|
@@ -2429,12 +2471,12 @@ var PopoverRoot = (props) => {
|
|
|
2429
2471
|
triggerRef,
|
|
2430
2472
|
open,
|
|
2431
2473
|
onOpenChange: setOpen,
|
|
2432
|
-
onOpenToggle:
|
|
2474
|
+
onOpenToggle: useCallback8(() => setOpen((prevOpen) => !prevOpen), [
|
|
2433
2475
|
setOpen
|
|
2434
2476
|
]),
|
|
2435
2477
|
hasCustomAnchor,
|
|
2436
|
-
onCustomAnchorAdd:
|
|
2437
|
-
onCustomAnchorRemove:
|
|
2478
|
+
onCustomAnchorAdd: useCallback8(() => setHasCustomAnchor(true), []),
|
|
2479
|
+
onCustomAnchorRemove: useCallback8(() => setHasCustomAnchor(false), []),
|
|
2438
2480
|
modal
|
|
2439
2481
|
}, children));
|
|
2440
2482
|
};
|
|
@@ -2445,7 +2487,7 @@ var PopoverAnchor = /* @__PURE__ */ forwardRef22((props, forwardedRef) => {
|
|
|
2445
2487
|
const context = usePopoverContext(ANCHOR_NAME, __scopePopover);
|
|
2446
2488
|
const popperScope = usePopperScope(__scopePopover);
|
|
2447
2489
|
const { onCustomAnchorAdd, onCustomAnchorRemove } = context;
|
|
2448
|
-
|
|
2490
|
+
useEffect6(() => {
|
|
2449
2491
|
onCustomAnchorAdd();
|
|
2450
2492
|
return () => onCustomAnchorRemove();
|
|
2451
2493
|
}, [
|
|
@@ -2464,7 +2506,7 @@ var PopoverTrigger = /* @__PURE__ */ forwardRef22((props, forwardedRef) => {
|
|
|
2464
2506
|
const { __scopePopover, ...triggerProps } = props;
|
|
2465
2507
|
const context = usePopoverContext(TRIGGER_NAME2, __scopePopover);
|
|
2466
2508
|
const popperScope = usePopperScope(__scopePopover);
|
|
2467
|
-
const composedTriggerRef =
|
|
2509
|
+
const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
|
|
2468
2510
|
const trigger = /* @__PURE__ */ React30.createElement(Primitive11.button, {
|
|
2469
2511
|
type: "button",
|
|
2470
2512
|
"aria-haspopup": "dialog",
|
|
@@ -2486,7 +2528,7 @@ var PopoverVirtualTrigger = (props) => {
|
|
|
2486
2528
|
const { __scopePopover, virtualRef } = props;
|
|
2487
2529
|
const context = usePopoverContext(VIRTUAL_TRIGGER_NAME2, __scopePopover);
|
|
2488
2530
|
const popperScope = usePopperScope(__scopePopover);
|
|
2489
|
-
|
|
2531
|
+
useEffect6(() => {
|
|
2490
2532
|
if (virtualRef.current) {
|
|
2491
2533
|
context.triggerRef.current = virtualRef.current;
|
|
2492
2534
|
}
|
|
@@ -2534,9 +2576,9 @@ PopoverContent.displayName = CONTENT_NAME2;
|
|
|
2534
2576
|
var PopoverContentModal = /* @__PURE__ */ forwardRef22((props, forwardedRef) => {
|
|
2535
2577
|
const context = usePopoverContext(CONTENT_NAME2, props.__scopePopover);
|
|
2536
2578
|
const contentRef = useRef3(null);
|
|
2537
|
-
const composedRefs =
|
|
2579
|
+
const composedRefs = useComposedRefs(forwardedRef, contentRef);
|
|
2538
2580
|
const isRightClickOutsideRef = useRef3(false);
|
|
2539
|
-
|
|
2581
|
+
useEffect6(() => {
|
|
2540
2582
|
const content = contentRef.current;
|
|
2541
2583
|
if (content) {
|
|
2542
2584
|
return hideOthers(content);
|
|
@@ -2613,11 +2655,12 @@ var PopoverContentNonModal = /* @__PURE__ */ forwardRef22((props, forwardedRef)
|
|
|
2613
2655
|
});
|
|
2614
2656
|
});
|
|
2615
2657
|
var PopoverContentImpl = /* @__PURE__ */ forwardRef22((props, forwardedRef) => {
|
|
2616
|
-
const { __scopePopover, trapFocus, onOpenAutoFocus, onCloseAutoFocus, disableOutsidePointerEvents, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, classNames, ...contentProps } = props;
|
|
2658
|
+
const { __scopePopover, trapFocus, onOpenAutoFocus, onCloseAutoFocus, disableOutsidePointerEvents, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, collisionPadding = 8, classNames, ...contentProps } = props;
|
|
2617
2659
|
const context = usePopoverContext(CONTENT_NAME2, __scopePopover);
|
|
2618
2660
|
const popperScope = usePopperScope(__scopePopover);
|
|
2619
2661
|
const { tx } = useThemeContext();
|
|
2620
2662
|
const elevation = useElevationContext();
|
|
2663
|
+
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
2621
2664
|
useFocusGuards();
|
|
2622
2665
|
return /* @__PURE__ */ React30.createElement(FocusScope, {
|
|
2623
2666
|
asChild: true,
|
|
@@ -2639,6 +2682,7 @@ var PopoverContentImpl = /* @__PURE__ */ forwardRef22((props, forwardedRef) => {
|
|
|
2639
2682
|
id: context.contentId,
|
|
2640
2683
|
...popperScope,
|
|
2641
2684
|
...contentProps,
|
|
2685
|
+
collisionPadding: safeCollisionPadding,
|
|
2642
2686
|
className: tx("popover.content", "popover", {
|
|
2643
2687
|
elevation
|
|
2644
2688
|
}, classNames),
|
|
@@ -2809,11 +2853,13 @@ var SelectTriggerButton = /* @__PURE__ */ forwardRef25(({ children, placeholder,
|
|
|
2809
2853
|
weight: "bold"
|
|
2810
2854
|
}))));
|
|
2811
2855
|
});
|
|
2812
|
-
var SelectContent = /* @__PURE__ */ forwardRef25(({ classNames, children, ...props }, forwardedRef) => {
|
|
2856
|
+
var SelectContent = /* @__PURE__ */ forwardRef25(({ classNames, children, collisionPadding = 8, ...props }, forwardedRef) => {
|
|
2813
2857
|
const { tx } = useThemeContext();
|
|
2814
2858
|
const elevation = useElevationContext();
|
|
2859
|
+
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
2815
2860
|
return /* @__PURE__ */ React33.createElement(SelectPrimitive.Content, {
|
|
2816
2861
|
...props,
|
|
2862
|
+
collisionPadding: safeCollisionPadding,
|
|
2817
2863
|
className: tx("select.content", "select__content", {
|
|
2818
2864
|
elevation
|
|
2819
2865
|
}, classNames),
|
|
@@ -2919,23 +2965,24 @@ var Select = {
|
|
|
2919
2965
|
|
|
2920
2966
|
// packages/ui/react-ui/src/components/Separator/Separator.tsx
|
|
2921
2967
|
import { Separator as SeparatorPrimitive } from "@radix-ui/react-separator";
|
|
2922
|
-
import React34 from "react";
|
|
2923
|
-
var Separator4 = ({ classNames, orientation = "horizontal", ...props }) => {
|
|
2968
|
+
import React34, { forwardRef as forwardRef26 } from "react";
|
|
2969
|
+
var Separator4 = /* @__PURE__ */ forwardRef26(({ classNames, orientation = "horizontal", ...props }, forwardedRef) => {
|
|
2924
2970
|
const { tx } = useThemeContext();
|
|
2925
2971
|
return /* @__PURE__ */ React34.createElement(SeparatorPrimitive, {
|
|
2926
2972
|
orientation,
|
|
2927
2973
|
...props,
|
|
2928
2974
|
className: tx("separator.root", "separator", {
|
|
2929
2975
|
orientation
|
|
2930
|
-
}, classNames)
|
|
2976
|
+
}, classNames),
|
|
2977
|
+
ref: forwardedRef
|
|
2931
2978
|
});
|
|
2932
|
-
};
|
|
2979
|
+
});
|
|
2933
2980
|
|
|
2934
2981
|
// packages/ui/react-ui/src/components/Tag/Tag.tsx
|
|
2935
2982
|
import { Primitive as Primitive12 } from "@radix-ui/react-primitive";
|
|
2936
2983
|
import { Slot as Slot13 } from "@radix-ui/react-slot";
|
|
2937
|
-
import React35, { forwardRef as
|
|
2938
|
-
var Tag = /* @__PURE__ */
|
|
2984
|
+
import React35, { forwardRef as forwardRef27 } from "react";
|
|
2985
|
+
var Tag = /* @__PURE__ */ forwardRef27(({ asChild, palette, classNames, ...props }, forwardedRef) => {
|
|
2939
2986
|
const { tx } = useThemeContext();
|
|
2940
2987
|
const Root5 = asChild ? Slot13 : Primitive12.span;
|
|
2941
2988
|
return /* @__PURE__ */ React35.createElement(Root5, {
|
|
@@ -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,
|
|
@@ -3161,6 +3233,7 @@ export {
|
|
|
3161
3233
|
useListContext,
|
|
3162
3234
|
useListItemContext,
|
|
3163
3235
|
useMainContext,
|
|
3236
|
+
useSafeArea,
|
|
3164
3237
|
useSidebars,
|
|
3165
3238
|
useThemeContext,
|
|
3166
3239
|
useTranslation,
|