@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
|
@@ -22,13 +22,36 @@ var useElevationContext = (propsElevation) => {
|
|
|
22
22
|
return propsElevation ?? elevation;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
+
// packages/ui/react-ui/src/hooks/useSafeArea.ts
|
|
26
|
+
import { useCallback, useState } from "react";
|
|
27
|
+
import { useResize } from "@dxos/react-hooks";
|
|
28
|
+
var initialSafeArea = {
|
|
29
|
+
top: NaN,
|
|
30
|
+
right: NaN,
|
|
31
|
+
bottom: NaN,
|
|
32
|
+
left: NaN
|
|
33
|
+
};
|
|
34
|
+
var useSafeArea = () => {
|
|
35
|
+
const [padding, setPadding] = useState(initialSafeArea);
|
|
36
|
+
const handleResize = useCallback(() => {
|
|
37
|
+
setPadding({
|
|
38
|
+
top: parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--safe-area-top")),
|
|
39
|
+
right: parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--safe-area-right")),
|
|
40
|
+
bottom: parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--safe-area-bottom")),
|
|
41
|
+
left: parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--safe-area-left"))
|
|
42
|
+
});
|
|
43
|
+
}, []);
|
|
44
|
+
useResize(handleResize);
|
|
45
|
+
return padding;
|
|
46
|
+
};
|
|
47
|
+
|
|
25
48
|
// packages/ui/react-ui/src/hooks/useTranslationsContext.ts
|
|
26
49
|
import { useContext as useContext4 } from "react";
|
|
27
50
|
|
|
28
51
|
// packages/ui/react-ui/src/components/ThemeProvider/TranslationsProvider.tsx
|
|
29
52
|
import { enUS as dtLocaleEnUs } from "date-fns/locale";
|
|
30
53
|
import i18Next from "i18next";
|
|
31
|
-
import React, { useEffect, createContext, useState, Suspense, useContext as useContext3 } from "react";
|
|
54
|
+
import React, { useEffect, createContext, useState as useState2, Suspense, useContext as useContext3 } from "react";
|
|
32
55
|
import { initReactI18next, useTranslation as useI18NextTranslation } from "react-i18next";
|
|
33
56
|
var initialLng = "en-US";
|
|
34
57
|
var initialNs = "dxos-common";
|
|
@@ -63,7 +86,7 @@ var useTranslation = (...args) => {
|
|
|
63
86
|
};
|
|
64
87
|
};
|
|
65
88
|
var TranslationsProvider = ({ fallback, resourceExtensions, children, appNs, dtLocale }) => {
|
|
66
|
-
const [loaded, setLoaded] =
|
|
89
|
+
const [loaded, setLoaded] = useState2(false);
|
|
67
90
|
useEffect(() => {
|
|
68
91
|
setLoaded(false);
|
|
69
92
|
if (resourceExtensions && resourceExtensions.length) {
|
|
@@ -98,21 +121,18 @@ import { raise } from "@dxos/debug";
|
|
|
98
121
|
var useThemeContext = () => useContext5(ThemeContext) ?? raise(new Error("Missing ThemeContext"));
|
|
99
122
|
|
|
100
123
|
// packages/ui/react-ui/src/hooks/useVisualViewport.ts
|
|
101
|
-
import {
|
|
124
|
+
import { useCallback as useCallback2, useState as useState3 } from "react";
|
|
125
|
+
import { useResize as useResize2 } from "@dxos/react-hooks";
|
|
102
126
|
var useVisualViewport = (deps) => {
|
|
103
|
-
const [width, setWidth] =
|
|
104
|
-
const [height, setHeight] =
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
window.visualViewport?.addEventListener("resize", handleResize);
|
|
113
|
-
handleResize();
|
|
114
|
-
return () => window.visualViewport?.removeEventListener("resize", handleResize);
|
|
115
|
-
}, deps ?? []);
|
|
127
|
+
const [width, setWidth] = useState3(null);
|
|
128
|
+
const [height, setHeight] = useState3(null);
|
|
129
|
+
const handleResize = useCallback2(() => {
|
|
130
|
+
if (window.visualViewport) {
|
|
131
|
+
setWidth(window.visualViewport.width);
|
|
132
|
+
setHeight(window.visualViewport.height);
|
|
133
|
+
}
|
|
134
|
+
}, []);
|
|
135
|
+
useResize2(handleResize);
|
|
116
136
|
return {
|
|
117
137
|
width,
|
|
118
138
|
height
|
|
@@ -572,11 +592,33 @@ var ButtonGroup = /* @__PURE__ */ forwardRef7(({ children, elevation: propsEleva
|
|
|
572
592
|
ButtonGroup.displayName = BUTTON_GROUP_NAME;
|
|
573
593
|
|
|
574
594
|
// packages/ui/react-ui/src/components/Buttons/IconButton.tsx
|
|
575
|
-
import React10, { forwardRef as forwardRef9 } from "react";
|
|
595
|
+
import React10, { forwardRef as forwardRef9, useState as useState4 } from "react";
|
|
576
596
|
|
|
577
597
|
// packages/ui/react-ui/src/components/Tooltip/Tooltip.tsx
|
|
578
598
|
import { Provider as TooltipProviderPrimitive, Root as TooltipRootPrimitive, TooltipContent as TooltipContentPrimitive, TooltipTrigger as TooltipTriggerPrimitive, TooltipPortal as TooltipPortalPrimitive, TooltipArrow as TooltipArrowPrimitive } from "@radix-ui/react-tooltip";
|
|
579
599
|
import React9, { forwardRef as forwardRef8 } from "react";
|
|
600
|
+
|
|
601
|
+
// packages/ui/react-ui/src/hooks/useSafeCollisionPadding.ts
|
|
602
|
+
import { useMemo } from "react";
|
|
603
|
+
var propIsNumber = (prop) => Number.isFinite(prop);
|
|
604
|
+
var propsIsRecord = (prop) => !!(prop && typeof prop === "object");
|
|
605
|
+
var safePadding = (propsPadding, safePadding2, side) => {
|
|
606
|
+
return (propIsNumber(safePadding2[side]) ? safePadding2[side] : 0) + (propIsNumber(propsPadding) ? propsPadding : propsIsRecord(propsPadding) ? propsPadding[side] ?? 0 : 0);
|
|
607
|
+
};
|
|
608
|
+
var useSafeCollisionPadding = (collisionPadding) => {
|
|
609
|
+
const { safeAreaPadding } = useThemeContext();
|
|
610
|
+
return useMemo(() => ({
|
|
611
|
+
top: safePadding(collisionPadding, safeAreaPadding, "top"),
|
|
612
|
+
right: safePadding(collisionPadding, safeAreaPadding, "right"),
|
|
613
|
+
bottom: safePadding(collisionPadding, safeAreaPadding, "bottom"),
|
|
614
|
+
left: safePadding(collisionPadding, safeAreaPadding, "left")
|
|
615
|
+
}), [
|
|
616
|
+
collisionPadding,
|
|
617
|
+
safeAreaPadding
|
|
618
|
+
]);
|
|
619
|
+
};
|
|
620
|
+
|
|
621
|
+
// packages/ui/react-ui/src/components/Tooltip/Tooltip.tsx
|
|
580
622
|
var TooltipProvider = TooltipProviderPrimitive;
|
|
581
623
|
var TooltipRoot = TooltipRootPrimitive;
|
|
582
624
|
var TooltipPortal = TooltipPortalPrimitive;
|
|
@@ -589,13 +631,14 @@ var TooltipArrow = /* @__PURE__ */ forwardRef8(({ classNames, ...props }, forwar
|
|
|
589
631
|
ref: forwardedRef
|
|
590
632
|
});
|
|
591
633
|
});
|
|
592
|
-
var TooltipContent = /* @__PURE__ */ forwardRef8(({ classNames, ...props }, forwardedRef) => {
|
|
634
|
+
var TooltipContent = /* @__PURE__ */ forwardRef8(({ classNames, collisionPadding = 8, ...props }, forwardedRef) => {
|
|
593
635
|
const { tx } = useThemeContext();
|
|
594
636
|
const elevation = useElevationContext();
|
|
637
|
+
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
595
638
|
return /* @__PURE__ */ React9.createElement(TooltipContentPrimitive, {
|
|
596
639
|
sideOffset: 4,
|
|
597
|
-
collisionPadding: 8,
|
|
598
640
|
...props,
|
|
641
|
+
collisionPadding: safeCollisionPadding,
|
|
599
642
|
className: tx("tooltip.content", "tooltip", {
|
|
600
643
|
elevation
|
|
601
644
|
}, classNames),
|
|
@@ -612,20 +655,31 @@ var Tooltip = {
|
|
|
612
655
|
};
|
|
613
656
|
|
|
614
657
|
// packages/ui/react-ui/src/components/Buttons/IconButton.tsx
|
|
615
|
-
var IconOnlyButton = /* @__PURE__ */ forwardRef9(({ tooltipPortal = true, tooltipZIndex: zIndex, ...props }, forwardedRef) => {
|
|
658
|
+
var IconOnlyButton = /* @__PURE__ */ forwardRef9(({ tooltipPortal = true, tooltipZIndex: zIndex, suppressNextTooltip, ...props }, forwardedRef) => {
|
|
659
|
+
const [triggerTooltipOpen, setTriggerTooltipOpen] = useState4(false);
|
|
616
660
|
const content = /* @__PURE__ */ React10.createElement(Tooltip.Content, zIndex && {
|
|
617
661
|
style: {
|
|
618
662
|
zIndex
|
|
619
663
|
}
|
|
620
664
|
}, props.label, /* @__PURE__ */ React10.createElement(Tooltip.Arrow, null));
|
|
621
|
-
return /* @__PURE__ */ React10.createElement(Tooltip.Root,
|
|
665
|
+
return /* @__PURE__ */ React10.createElement(Tooltip.Root, {
|
|
666
|
+
open: triggerTooltipOpen,
|
|
667
|
+
onOpenChange: (nextOpen) => {
|
|
668
|
+
if (suppressNextTooltip?.current) {
|
|
669
|
+
setTriggerTooltipOpen(false);
|
|
670
|
+
suppressNextTooltip.current = false;
|
|
671
|
+
} else {
|
|
672
|
+
setTriggerTooltipOpen(nextOpen);
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
}, /* @__PURE__ */ React10.createElement(Tooltip.Trigger, {
|
|
622
676
|
asChild: true
|
|
623
677
|
}, /* @__PURE__ */ React10.createElement(LabelledIconButton, {
|
|
624
678
|
...props,
|
|
625
679
|
ref: forwardedRef
|
|
626
680
|
})), tooltipPortal ? /* @__PURE__ */ React10.createElement(Tooltip.Portal, null, content) : content);
|
|
627
681
|
});
|
|
628
|
-
var LabelledIconButton = /* @__PURE__ */ forwardRef9(({ icon, size, iconOnly, label, classNames, iconClassNames, ...props }, forwardedRef) => {
|
|
682
|
+
var LabelledIconButton = /* @__PURE__ */ forwardRef9(({ icon, size, iconOnly, label, classNames, iconClassNames, caretDown, suppressNextTooltip, ...props }, forwardedRef) => {
|
|
629
683
|
const { tx } = useThemeContext();
|
|
630
684
|
return /* @__PURE__ */ React10.createElement(Button, {
|
|
631
685
|
...props,
|
|
@@ -637,7 +691,10 @@ var LabelledIconButton = /* @__PURE__ */ forwardRef9(({ icon, size, iconOnly, la
|
|
|
637
691
|
classNames: iconClassNames
|
|
638
692
|
}), /* @__PURE__ */ React10.createElement("span", {
|
|
639
693
|
className: iconOnly ? "sr-only" : void 0
|
|
640
|
-
}, label)
|
|
694
|
+
}, label), caretDown && /* @__PURE__ */ React10.createElement(Icon, {
|
|
695
|
+
size: 3,
|
|
696
|
+
icon: "ph--caret-down--bold"
|
|
697
|
+
}));
|
|
641
698
|
});
|
|
642
699
|
var IconButton = /* @__PURE__ */ forwardRef9((props, forwardedRef) => props.iconOnly ? /* @__PURE__ */ React10.createElement(IconOnlyButton, {
|
|
643
700
|
...props,
|
|
@@ -690,7 +747,7 @@ var ToggleGroupItem = /* @__PURE__ */ forwardRef11(({ variant, elevation, densit
|
|
|
690
747
|
});
|
|
691
748
|
|
|
692
749
|
// packages/ui/react-ui/src/components/Clipboard/ClipboardProvider.tsx
|
|
693
|
-
import React13, { createContext as createContext4, useCallback, useContext as useContext6, useState as
|
|
750
|
+
import React13, { createContext as createContext4, useCallback as useCallback3, useContext as useContext6, useState as useState5 } from "react";
|
|
694
751
|
var ClipboardContext = /* @__PURE__ */ createContext4({
|
|
695
752
|
textValue: "",
|
|
696
753
|
setTextValue: async (_) => {
|
|
@@ -698,8 +755,8 @@ var ClipboardContext = /* @__PURE__ */ createContext4({
|
|
|
698
755
|
});
|
|
699
756
|
var useClipboard = () => useContext6(ClipboardContext);
|
|
700
757
|
var ClipboardProvider = ({ children }) => {
|
|
701
|
-
const [textValue, setInternalTextValue] =
|
|
702
|
-
const setTextValue =
|
|
758
|
+
const [textValue, setInternalTextValue] = useState5("");
|
|
759
|
+
const setTextValue = useCallback3(async (nextValue) => {
|
|
703
760
|
await navigator.clipboard.writeText(nextValue);
|
|
704
761
|
return setInternalTextValue(nextValue);
|
|
705
762
|
}, []);
|
|
@@ -712,12 +769,12 @@ var ClipboardProvider = ({ children }) => {
|
|
|
712
769
|
};
|
|
713
770
|
|
|
714
771
|
// packages/ui/react-ui/src/components/Clipboard/CopyButton.tsx
|
|
715
|
-
import React17, { useState as
|
|
772
|
+
import React17, { useState as useState6 } from "react";
|
|
716
773
|
import { mx } from "@dxos/react-ui-theme";
|
|
717
774
|
|
|
718
775
|
// packages/ui/react-ui/src/components/ThemeProvider/ThemeProvider.tsx
|
|
719
776
|
import { createKeyborg } from "keyborg";
|
|
720
|
-
import React16, { createContext as createContext7, useEffect as
|
|
777
|
+
import React16, { createContext as createContext7, useEffect as useEffect2, useMemo as useMemo2 } from "react";
|
|
721
778
|
|
|
722
779
|
// packages/ui/react-ui/src/util/hasIosKeyboard.ts
|
|
723
780
|
var hasIosKeyboard = () => {
|
|
@@ -749,20 +806,28 @@ var ElevationProvider = ({ elevation, children }) => /* @__PURE__ */ React15.cre
|
|
|
749
806
|
// packages/ui/react-ui/src/components/ThemeProvider/ThemeProvider.tsx
|
|
750
807
|
var ThemeContext = /* @__PURE__ */ createContext7(void 0);
|
|
751
808
|
var ThemeProvider = ({ children, fallback = null, resourceExtensions, appNs, tx = (_path, defaultClassName, _styleProps, ..._options) => defaultClassName, themeMode = "dark", rootDensity = "fine", ...rest }) => {
|
|
752
|
-
|
|
809
|
+
useEffect2(() => {
|
|
753
810
|
if (document.defaultView) {
|
|
754
811
|
const kb = createKeyborg(document.defaultView);
|
|
755
812
|
kb.subscribe(handleInputModalityChange);
|
|
756
813
|
return () => kb.unsubscribe(handleInputModalityChange);
|
|
757
814
|
}
|
|
758
815
|
}, []);
|
|
816
|
+
const safeAreaPadding = useSafeArea();
|
|
817
|
+
const contextValue = useMemo2(() => ({
|
|
818
|
+
tx,
|
|
819
|
+
themeMode,
|
|
820
|
+
hasIosKeyboard: hasIosKeyboard(),
|
|
821
|
+
safeAreaPadding,
|
|
822
|
+
...rest
|
|
823
|
+
}), [
|
|
824
|
+
tx,
|
|
825
|
+
themeMode,
|
|
826
|
+
safeAreaPadding,
|
|
827
|
+
rest
|
|
828
|
+
]);
|
|
759
829
|
return /* @__PURE__ */ React16.createElement(ThemeContext.Provider, {
|
|
760
|
-
value:
|
|
761
|
-
tx,
|
|
762
|
-
themeMode,
|
|
763
|
-
hasIosKeyboard: hasIosKeyboard(),
|
|
764
|
-
...rest
|
|
765
|
-
}
|
|
830
|
+
value: contextValue
|
|
766
831
|
}, /* @__PURE__ */ React16.createElement(TranslationsProvider, {
|
|
767
832
|
fallback,
|
|
768
833
|
resourceExtensions,
|
|
@@ -820,7 +885,7 @@ var CopyButtonIconOnly = ({ value, classNames, iconProps, variant, ...props }) =
|
|
|
820
885
|
const { textValue, setTextValue } = useClipboard();
|
|
821
886
|
const isCopied = textValue === value;
|
|
822
887
|
const label = isCopied ? t("copy success label") : t("copy label");
|
|
823
|
-
const [open, setOpen] =
|
|
888
|
+
const [open, setOpen] = useState6(false);
|
|
824
889
|
return /* @__PURE__ */ React17.createElement(Tooltip.Root, {
|
|
825
890
|
delayDuration: 1500,
|
|
826
891
|
open,
|
|
@@ -893,7 +958,7 @@ var DialogOverlay = /* @__PURE__ */ forwardRef12(({ classNames, children, blockA
|
|
|
893
958
|
const { tx } = useThemeContext();
|
|
894
959
|
return /* @__PURE__ */ React18.createElement(DialogOverlayPrimitive, {
|
|
895
960
|
...props,
|
|
896
|
-
className: tx("dialog.overlay", "dialog__overlay", {}, classNames
|
|
961
|
+
className: tx("dialog.overlay", "dialog__overlay", {}, classNames),
|
|
897
962
|
ref: forwardedRef,
|
|
898
963
|
"data-block-align": blockAlign
|
|
899
964
|
}, /* @__PURE__ */ React18.createElement(OverlayLayoutProvider, {
|
|
@@ -1004,12 +1069,13 @@ import React20, { forwardRef as forwardRef14 } from "react";
|
|
|
1004
1069
|
var ContextMenuRoot = ContextMenuPrimitive.ContextMenu;
|
|
1005
1070
|
var ContextMenuTrigger = ContextMenuPrimitive.Trigger;
|
|
1006
1071
|
var ContextMenuPortal = ContextMenuPrimitive.Portal;
|
|
1007
|
-
var ContextMenuContent = /* @__PURE__ */ forwardRef14(({ classNames, children, ...props }, forwardedRef) => {
|
|
1072
|
+
var ContextMenuContent = /* @__PURE__ */ forwardRef14(({ classNames, children, collisionPadding = 8, ...props }, forwardedRef) => {
|
|
1008
1073
|
const { tx } = useThemeContext();
|
|
1009
1074
|
const elevation = useElevationContext();
|
|
1075
|
+
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
1010
1076
|
return /* @__PURE__ */ React20.createElement(ContextMenuPrimitive.Content, {
|
|
1011
|
-
collisionPadding: 8,
|
|
1012
1077
|
...props,
|
|
1078
|
+
collisionPadding: safeCollisionPadding,
|
|
1013
1079
|
className: tx("menu.content", "menu", {
|
|
1014
1080
|
elevation
|
|
1015
1081
|
}, classNames),
|
|
@@ -1092,7 +1158,7 @@ import { createMenuScope } from "@radix-ui/react-menu";
|
|
|
1092
1158
|
import { Primitive as Primitive7 } from "@radix-ui/react-primitive";
|
|
1093
1159
|
import { Slot as Slot7 } from "@radix-ui/react-slot";
|
|
1094
1160
|
import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
|
1095
|
-
import React21, { useRef, useCallback as
|
|
1161
|
+
import React21, { useRef, useCallback as useCallback4, forwardRef as forwardRef15, useEffect as useEffect3 } from "react";
|
|
1096
1162
|
var DROPDOWN_MENU_NAME = "DropdownMenu";
|
|
1097
1163
|
var [createDropdownMenuContext, createDropdownMenuScope] = createContextScope(DROPDOWN_MENU_NAME, [
|
|
1098
1164
|
createMenuScope
|
|
@@ -1115,7 +1181,7 @@ var DropdownMenuRoot = (props) => {
|
|
|
1115
1181
|
contentId: useId3(),
|
|
1116
1182
|
open,
|
|
1117
1183
|
onOpenChange: setOpen,
|
|
1118
|
-
onOpenToggle:
|
|
1184
|
+
onOpenToggle: useCallback4(() => setOpen((prevOpen) => !prevOpen), [
|
|
1119
1185
|
setOpen
|
|
1120
1186
|
]),
|
|
1121
1187
|
modal
|
|
@@ -1184,7 +1250,7 @@ var DropdownMenuVirtualTrigger = (props) => {
|
|
|
1184
1250
|
const { __scopeDropdownMenu, virtualRef } = props;
|
|
1185
1251
|
const context = useDropdownMenuContext(VIRTUAL_TRIGGER_NAME, __scopeDropdownMenu);
|
|
1186
1252
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1187
|
-
|
|
1253
|
+
useEffect3(() => {
|
|
1188
1254
|
if (virtualRef.current) {
|
|
1189
1255
|
context.triggerRef.current = virtualRef.current;
|
|
1190
1256
|
}
|
|
@@ -1216,17 +1282,19 @@ var DropdownMenuViewport = /* @__PURE__ */ forwardRef15(({ classNames, asChild,
|
|
|
1216
1282
|
});
|
|
1217
1283
|
var CONTENT_NAME = "DropdownMenuContent";
|
|
1218
1284
|
var DropdownMenuContent = /* @__PURE__ */ forwardRef15((props, forwardedRef) => {
|
|
1219
|
-
const { __scopeDropdownMenu, classNames, ...contentProps } = props;
|
|
1285
|
+
const { __scopeDropdownMenu, classNames, collisionPadding = 8, ...contentProps } = props;
|
|
1220
1286
|
const { tx } = useThemeContext();
|
|
1221
1287
|
const context = useDropdownMenuContext(CONTENT_NAME, __scopeDropdownMenu);
|
|
1222
1288
|
const elevation = useElevationContext();
|
|
1223
1289
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1224
1290
|
const hasInteractedOutsideRef = useRef(false);
|
|
1291
|
+
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
1225
1292
|
return /* @__PURE__ */ React21.createElement(MenuPrimitive.Content, {
|
|
1226
1293
|
id: context.contentId,
|
|
1227
1294
|
"aria-labelledby": context.triggerId,
|
|
1228
1295
|
...menuScope,
|
|
1229
1296
|
...contentProps,
|
|
1297
|
+
collisionPadding: safeCollisionPadding,
|
|
1230
1298
|
ref: forwardedRef,
|
|
1231
1299
|
onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
1232
1300
|
if (!hasInteractedOutsideRef.current) {
|
|
@@ -1441,7 +1509,7 @@ var useDropdownMenuMenuScope = useMenuScope;
|
|
|
1441
1509
|
// packages/ui/react-ui/src/components/Input/Input.tsx
|
|
1442
1510
|
import { Root as CheckboxPrimitive } from "@radix-ui/react-checkbox";
|
|
1443
1511
|
import { useControllableState as useControllableState2 } from "@radix-ui/react-use-controllable-state";
|
|
1444
|
-
import React22, { forwardRef as forwardRef16, useCallback as
|
|
1512
|
+
import React22, { forwardRef as forwardRef16, useCallback as useCallback5 } from "react";
|
|
1445
1513
|
import { InputRoot, PinInput as PinInputPrimitive, TextInput as TextInputPrimitive, TextArea as TextAreaPrimitive, useInputContext, INPUT_NAME, Description as DescriptionPrimitive, DescriptionAndValidation as DescriptionAndValidationPrimitive, Label as LabelPrimitive, Validation as ValidationPrimitive } from "@dxos/react-input";
|
|
1446
1514
|
var Label3 = /* @__PURE__ */ forwardRef16(({ srOnly, classNames, children, ...props }, forwardedRef) => {
|
|
1447
1515
|
const { tx } = useThemeContext();
|
|
@@ -1490,7 +1558,7 @@ var PinInput = /* @__PURE__ */ forwardRef16(({ density: propsDensity, elevation:
|
|
|
1490
1558
|
const { tx } = useThemeContext();
|
|
1491
1559
|
const density = useDensityContext(propsDensity);
|
|
1492
1560
|
const elevation = useElevationContext(propsElevation);
|
|
1493
|
-
const segmentClassName =
|
|
1561
|
+
const segmentClassName = useCallback5(({ focused, validationValence }) => tx("input.input", "input--pin-segment", {
|
|
1494
1562
|
variant: "static",
|
|
1495
1563
|
focused,
|
|
1496
1564
|
disabled: props.disabled,
|
|
@@ -1943,18 +2011,17 @@ var Treegrid = {
|
|
|
1943
2011
|
|
|
1944
2012
|
// packages/ui/react-ui/src/components/Main/Main.tsx
|
|
1945
2013
|
import { useFocusableGroup as useFocusableGroup2 } from "@fluentui/react-tabster";
|
|
1946
|
-
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
1947
2014
|
import { createContext as createContext10 } from "@radix-ui/react-context";
|
|
1948
2015
|
import { Root as DialogRoot2, DialogContent as DialogContent2 } from "@radix-ui/react-dialog";
|
|
1949
2016
|
import { Primitive as Primitive9 } from "@radix-ui/react-primitive";
|
|
1950
2017
|
import { Slot as Slot10 } from "@radix-ui/react-slot";
|
|
1951
2018
|
import { useControllableState as useControllableState4 } from "@radix-ui/react-use-controllable-state";
|
|
1952
|
-
import React28, { forwardRef as forwardRef20, useCallback as
|
|
2019
|
+
import React28, { forwardRef as forwardRef20, useCallback as useCallback7, useEffect as useEffect5, useRef as useRef2, useState as useState8 } from "react";
|
|
1953
2020
|
import { log } from "@dxos/log";
|
|
1954
2021
|
import { useMediaQuery, useForwardedRef } from "@dxos/react-hooks";
|
|
1955
2022
|
|
|
1956
2023
|
// packages/ui/react-ui/src/components/Main/useSwipeToDismiss.ts
|
|
1957
|
-
import { useCallback as
|
|
2024
|
+
import { useCallback as useCallback6, useEffect as useEffect4, useState as useState7 } from "react";
|
|
1958
2025
|
var MotionState;
|
|
1959
2026
|
(function(MotionState2) {
|
|
1960
2027
|
MotionState2[MotionState2["IDLE"] = 0] = "IDLE";
|
|
@@ -1969,22 +2036,22 @@ var useSwipeToDismiss = (ref, {
|
|
|
1969
2036
|
/* side = 'inline-start' */
|
|
1970
2037
|
}) => {
|
|
1971
2038
|
const $root = ref.current;
|
|
1972
|
-
const [motionState, setMotionState] =
|
|
1973
|
-
const [gestureStartX, setGestureStartX] =
|
|
1974
|
-
const setIdle =
|
|
2039
|
+
const [motionState, setMotionState] = useState7(0);
|
|
2040
|
+
const [gestureStartX, setGestureStartX] = useState7(0);
|
|
2041
|
+
const setIdle = useCallback6(() => {
|
|
1975
2042
|
setMotionState(0);
|
|
1976
2043
|
$root?.style.removeProperty("inset-inline-start");
|
|
1977
2044
|
$root?.style.setProperty("transition-duration", "200ms");
|
|
1978
2045
|
}, [
|
|
1979
2046
|
$root
|
|
1980
2047
|
]);
|
|
1981
|
-
const setFollowing =
|
|
2048
|
+
const setFollowing = useCallback6(() => {
|
|
1982
2049
|
setMotionState(2);
|
|
1983
2050
|
$root?.style.setProperty("transition-duration", "0ms");
|
|
1984
2051
|
}, [
|
|
1985
2052
|
$root
|
|
1986
2053
|
]);
|
|
1987
|
-
const handlePointerDown =
|
|
2054
|
+
const handlePointerDown = useCallback6(({ screenX }) => {
|
|
1988
2055
|
if (motionState === 0) {
|
|
1989
2056
|
setMotionState(1);
|
|
1990
2057
|
setGestureStartX(screenX);
|
|
@@ -1992,7 +2059,7 @@ var useSwipeToDismiss = (ref, {
|
|
|
1992
2059
|
}, [
|
|
1993
2060
|
motionState
|
|
1994
2061
|
]);
|
|
1995
|
-
const handlePointerMove =
|
|
2062
|
+
const handlePointerMove = useCallback6(({ screenX }) => {
|
|
1996
2063
|
if ($root) {
|
|
1997
2064
|
const delta = Math.min(screenX - gestureStartX, 0);
|
|
1998
2065
|
switch (motionState) {
|
|
@@ -2016,12 +2083,12 @@ var useSwipeToDismiss = (ref, {
|
|
|
2016
2083
|
motionState,
|
|
2017
2084
|
gestureStartX
|
|
2018
2085
|
]);
|
|
2019
|
-
const handlePointerUp =
|
|
2086
|
+
const handlePointerUp = useCallback6(() => {
|
|
2020
2087
|
setIdle();
|
|
2021
2088
|
}, [
|
|
2022
2089
|
setIdle
|
|
2023
2090
|
]);
|
|
2024
|
-
|
|
2091
|
+
useEffect4(() => {
|
|
2025
2092
|
$root?.addEventListener("pointerdown", handlePointerDown);
|
|
2026
2093
|
return () => {
|
|
2027
2094
|
$root?.removeEventListener("pointerdown", handlePointerDown);
|
|
@@ -2030,7 +2097,7 @@ var useSwipeToDismiss = (ref, {
|
|
|
2030
2097
|
$root,
|
|
2031
2098
|
handlePointerDown
|
|
2032
2099
|
]);
|
|
2033
|
-
|
|
2100
|
+
useEffect4(() => {
|
|
2034
2101
|
$root && document.documentElement.addEventListener("pointermove", handlePointerMove);
|
|
2035
2102
|
return () => {
|
|
2036
2103
|
document.documentElement.removeEventListener("pointermove", handlePointerMove);
|
|
@@ -2039,7 +2106,7 @@ var useSwipeToDismiss = (ref, {
|
|
|
2039
2106
|
$root,
|
|
2040
2107
|
handlePointerMove
|
|
2041
2108
|
]);
|
|
2042
|
-
|
|
2109
|
+
useEffect4(() => {
|
|
2043
2110
|
$root && document.documentElement.addEventListener("pointerup", handlePointerUp);
|
|
2044
2111
|
return () => {
|
|
2045
2112
|
document.documentElement.removeEventListener("pointerup", handlePointerUp);
|
|
@@ -2059,7 +2126,7 @@ var MAIN_NAME = "Main";
|
|
|
2059
2126
|
var GENERIC_CONSUMER_NAME = "GenericConsumer";
|
|
2060
2127
|
var landmarkAttr = "data-main-landmark";
|
|
2061
2128
|
var useLandmarkMover = (propsOnKeyDown, landmark) => {
|
|
2062
|
-
const handleKeyDown =
|
|
2129
|
+
const handleKeyDown = useCallback7((event) => {
|
|
2063
2130
|
const target = event.target;
|
|
2064
2131
|
if (event.target === event.currentTarget && event.key === "Tab" && target.hasAttribute(landmarkAttr)) {
|
|
2065
2132
|
event.preventDefault();
|
|
@@ -2092,7 +2159,7 @@ var [MainProvider, useMainContext] = createContext10(MAIN_NAME, {
|
|
|
2092
2159
|
setNavigationSidebarOpen: (nextOpen) => {
|
|
2093
2160
|
log.warn("Attempt to set sidebar state without initializing `MainRoot`", void 0, {
|
|
2094
2161
|
F: __dxlog_file,
|
|
2095
|
-
L:
|
|
2162
|
+
L: 79,
|
|
2096
2163
|
S: void 0,
|
|
2097
2164
|
C: (f, a) => f(...a)
|
|
2098
2165
|
});
|
|
@@ -2101,7 +2168,7 @@ var [MainProvider, useMainContext] = createContext10(MAIN_NAME, {
|
|
|
2101
2168
|
setComplementarySidebarOpen: (nextOpen) => {
|
|
2102
2169
|
log.warn("Attempt to set sidebar state without initializing `MainRoot`", void 0, {
|
|
2103
2170
|
F: __dxlog_file,
|
|
2104
|
-
L:
|
|
2171
|
+
L: 84,
|
|
2105
2172
|
S: void 0,
|
|
2106
2173
|
C: (f, a) => f(...a)
|
|
2107
2174
|
});
|
|
@@ -2112,26 +2179,26 @@ var useSidebars = (consumerName = GENERIC_CONSUMER_NAME) => {
|
|
|
2112
2179
|
return {
|
|
2113
2180
|
navigationSidebarOpen,
|
|
2114
2181
|
setNavigationSidebarOpen,
|
|
2115
|
-
toggleNavigationSidebar:
|
|
2182
|
+
toggleNavigationSidebar: useCallback7(() => setNavigationSidebarOpen(!navigationSidebarOpen), [
|
|
2116
2183
|
navigationSidebarOpen,
|
|
2117
2184
|
setNavigationSidebarOpen
|
|
2118
2185
|
]),
|
|
2119
|
-
openNavigationSidebar:
|
|
2186
|
+
openNavigationSidebar: useCallback7(() => setNavigationSidebarOpen(true), [
|
|
2120
2187
|
setNavigationSidebarOpen
|
|
2121
2188
|
]),
|
|
2122
|
-
closeNavigationSidebar:
|
|
2189
|
+
closeNavigationSidebar: useCallback7(() => setNavigationSidebarOpen(false), [
|
|
2123
2190
|
setNavigationSidebarOpen
|
|
2124
2191
|
]),
|
|
2125
2192
|
complementarySidebarOpen,
|
|
2126
2193
|
setComplementarySidebarOpen,
|
|
2127
|
-
toggleComplementarySidebar:
|
|
2194
|
+
toggleComplementarySidebar: useCallback7(() => setComplementarySidebarOpen(!complementarySidebarOpen), [
|
|
2128
2195
|
complementarySidebarOpen,
|
|
2129
2196
|
setComplementarySidebarOpen
|
|
2130
2197
|
]),
|
|
2131
|
-
openComplementarySidebar:
|
|
2198
|
+
openComplementarySidebar: useCallback7(() => setComplementarySidebarOpen(true), [
|
|
2132
2199
|
setComplementarySidebarOpen
|
|
2133
2200
|
]),
|
|
2134
|
-
closeComplementarySidebar:
|
|
2201
|
+
closeComplementarySidebar: useCallback7(() => setComplementarySidebarOpen(false), [
|
|
2135
2202
|
setComplementarySidebarOpen
|
|
2136
2203
|
])
|
|
2137
2204
|
};
|
|
@@ -2151,9 +2218,9 @@ var MainRoot = ({ navigationSidebarOpen: propsNavigationSidebarOpen, defaultNavi
|
|
|
2151
2218
|
defaultProp: defaultComplementarySidebarOpen,
|
|
2152
2219
|
onChange: onComplementarySidebarOpenChange
|
|
2153
2220
|
});
|
|
2154
|
-
const [resizing, setResizing] =
|
|
2221
|
+
const [resizing, setResizing] = useState8(false);
|
|
2155
2222
|
const resizeInterval = useRef2(null);
|
|
2156
|
-
const handleResize =
|
|
2223
|
+
const handleResize = useCallback7(() => {
|
|
2157
2224
|
setResizing(true);
|
|
2158
2225
|
if (resizeInterval.current) {
|
|
2159
2226
|
clearTimeout(resizeInterval.current);
|
|
@@ -2163,7 +2230,7 @@ var MainRoot = ({ navigationSidebarOpen: propsNavigationSidebarOpen, defaultNavi
|
|
|
2163
2230
|
resizeInterval.current = null;
|
|
2164
2231
|
}, resizeDebounce);
|
|
2165
2232
|
}, []);
|
|
2166
|
-
|
|
2233
|
+
useEffect5(() => {
|
|
2167
2234
|
window.addEventListener("resize", handleResize);
|
|
2168
2235
|
return () => window.removeEventListener("resize", handleResize);
|
|
2169
2236
|
}, [
|
|
@@ -2192,7 +2259,7 @@ var MainSidebar = /* @__PURE__ */ forwardRef20(({ classNames, children, swipeToD
|
|
|
2192
2259
|
useSwipeToDismiss(swipeToDismiss ? ref : noopRef, {
|
|
2193
2260
|
onDismiss: () => setOpen(false)
|
|
2194
2261
|
});
|
|
2195
|
-
const handleKeyDown =
|
|
2262
|
+
const handleKeyDown = useCallback7((event) => {
|
|
2196
2263
|
if (event.key === "Escape") {
|
|
2197
2264
|
event.target.closest("[data-tabster]")?.focus();
|
|
2198
2265
|
}
|
|
@@ -2293,37 +2360,12 @@ var MainOverlay = /* @__PURE__ */ forwardRef20(({ classNames, ...props }, forwar
|
|
|
2293
2360
|
ref: forwardedRef
|
|
2294
2361
|
});
|
|
2295
2362
|
});
|
|
2296
|
-
var MainNotch = /* @__PURE__ */ forwardRef20(({ classNames, ...props }, forwardedRef) => {
|
|
2297
|
-
const { tx } = useThemeContext();
|
|
2298
|
-
const { navigationSidebarOpen } = useMainContext(MAIN_NAME);
|
|
2299
|
-
const notchElement = useRef2(null);
|
|
2300
|
-
const ref = useComposedRefs(forwardedRef, notchElement);
|
|
2301
|
-
const handleKeyDown = useCallback5((event) => {
|
|
2302
|
-
switch (event.key) {
|
|
2303
|
-
case "Escape":
|
|
2304
|
-
props?.onKeyDown?.(event);
|
|
2305
|
-
notchElement.current?.focus();
|
|
2306
|
-
}
|
|
2307
|
-
}, [
|
|
2308
|
-
props?.onKeyDown
|
|
2309
|
-
]);
|
|
2310
|
-
const mover = useLandmarkMover(handleKeyDown, "3");
|
|
2311
|
-
return /* @__PURE__ */ React28.createElement("div", {
|
|
2312
|
-
role: "toolbar",
|
|
2313
|
-
...mover,
|
|
2314
|
-
...props,
|
|
2315
|
-
"data-nav-sidebar-state": navigationSidebarOpen ? "open" : "closed",
|
|
2316
|
-
className: tx("main.notch", "main__notch", {}, classNames),
|
|
2317
|
-
ref
|
|
2318
|
-
});
|
|
2319
|
-
});
|
|
2320
2363
|
var Main = {
|
|
2321
2364
|
Root: MainRoot,
|
|
2322
2365
|
Content: MainContent,
|
|
2323
2366
|
Overlay: MainOverlay,
|
|
2324
2367
|
NavigationSidebar: MainNavigationSidebar,
|
|
2325
|
-
ComplementarySidebar: MainComplementarySidebar
|
|
2326
|
-
Notch: MainNotch
|
|
2368
|
+
ComplementarySidebar: MainComplementarySidebar
|
|
2327
2369
|
};
|
|
2328
2370
|
|
|
2329
2371
|
// packages/ui/react-ui/src/components/Message/Message.tsx
|
|
@@ -2389,7 +2431,7 @@ var Message = {
|
|
|
2389
2431
|
|
|
2390
2432
|
// packages/ui/react-ui/src/components/Popover/Popover.tsx
|
|
2391
2433
|
import { composeEventHandlers as composeEventHandlers2 } from "@radix-ui/primitive";
|
|
2392
|
-
import { useComposedRefs
|
|
2434
|
+
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
2393
2435
|
import { createContextScope as createContextScope3 } from "@radix-ui/react-context";
|
|
2394
2436
|
import { DismissableLayer } from "@radix-ui/react-dismissable-layer";
|
|
2395
2437
|
import { useFocusGuards } from "@radix-ui/react-focus-guards";
|
|
@@ -2403,7 +2445,7 @@ import { Primitive as Primitive11 } from "@radix-ui/react-primitive";
|
|
|
2403
2445
|
import { Slot as Slot12 } from "@radix-ui/react-slot";
|
|
2404
2446
|
import { useControllableState as useControllableState5 } from "@radix-ui/react-use-controllable-state";
|
|
2405
2447
|
import { hideOthers } from "aria-hidden";
|
|
2406
|
-
import React30, { forwardRef as forwardRef22, useRef as useRef3, useCallback as
|
|
2448
|
+
import React30, { forwardRef as forwardRef22, useRef as useRef3, useCallback as useCallback8, useState as useState9, useEffect as useEffect6 } from "react";
|
|
2407
2449
|
import { RemoveScroll } from "react-remove-scroll";
|
|
2408
2450
|
var POPOVER_NAME = "Popover";
|
|
2409
2451
|
var [createPopoverContext, createPopoverScope] = createContextScope3(POPOVER_NAME, [
|
|
@@ -2415,7 +2457,7 @@ var PopoverRoot = (props) => {
|
|
|
2415
2457
|
const { __scopePopover, children, open: openProp, defaultOpen, onOpenChange, modal = false } = props;
|
|
2416
2458
|
const popperScope = usePopperScope(__scopePopover);
|
|
2417
2459
|
const triggerRef = useRef3(null);
|
|
2418
|
-
const [hasCustomAnchor, setHasCustomAnchor] =
|
|
2460
|
+
const [hasCustomAnchor, setHasCustomAnchor] = useState9(false);
|
|
2419
2461
|
const [open = false, setOpen] = useControllableState5({
|
|
2420
2462
|
prop: openProp,
|
|
2421
2463
|
defaultProp: defaultOpen,
|
|
@@ -2427,12 +2469,12 @@ var PopoverRoot = (props) => {
|
|
|
2427
2469
|
triggerRef,
|
|
2428
2470
|
open,
|
|
2429
2471
|
onOpenChange: setOpen,
|
|
2430
|
-
onOpenToggle:
|
|
2472
|
+
onOpenToggle: useCallback8(() => setOpen((prevOpen) => !prevOpen), [
|
|
2431
2473
|
setOpen
|
|
2432
2474
|
]),
|
|
2433
2475
|
hasCustomAnchor,
|
|
2434
|
-
onCustomAnchorAdd:
|
|
2435
|
-
onCustomAnchorRemove:
|
|
2476
|
+
onCustomAnchorAdd: useCallback8(() => setHasCustomAnchor(true), []),
|
|
2477
|
+
onCustomAnchorRemove: useCallback8(() => setHasCustomAnchor(false), []),
|
|
2436
2478
|
modal
|
|
2437
2479
|
}, children));
|
|
2438
2480
|
};
|
|
@@ -2443,7 +2485,7 @@ var PopoverAnchor = /* @__PURE__ */ forwardRef22((props, forwardedRef) => {
|
|
|
2443
2485
|
const context = usePopoverContext(ANCHOR_NAME, __scopePopover);
|
|
2444
2486
|
const popperScope = usePopperScope(__scopePopover);
|
|
2445
2487
|
const { onCustomAnchorAdd, onCustomAnchorRemove } = context;
|
|
2446
|
-
|
|
2488
|
+
useEffect6(() => {
|
|
2447
2489
|
onCustomAnchorAdd();
|
|
2448
2490
|
return () => onCustomAnchorRemove();
|
|
2449
2491
|
}, [
|
|
@@ -2462,7 +2504,7 @@ var PopoverTrigger = /* @__PURE__ */ forwardRef22((props, forwardedRef) => {
|
|
|
2462
2504
|
const { __scopePopover, ...triggerProps } = props;
|
|
2463
2505
|
const context = usePopoverContext(TRIGGER_NAME2, __scopePopover);
|
|
2464
2506
|
const popperScope = usePopperScope(__scopePopover);
|
|
2465
|
-
const composedTriggerRef =
|
|
2507
|
+
const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
|
|
2466
2508
|
const trigger = /* @__PURE__ */ React30.createElement(Primitive11.button, {
|
|
2467
2509
|
type: "button",
|
|
2468
2510
|
"aria-haspopup": "dialog",
|
|
@@ -2484,7 +2526,7 @@ var PopoverVirtualTrigger = (props) => {
|
|
|
2484
2526
|
const { __scopePopover, virtualRef } = props;
|
|
2485
2527
|
const context = usePopoverContext(VIRTUAL_TRIGGER_NAME2, __scopePopover);
|
|
2486
2528
|
const popperScope = usePopperScope(__scopePopover);
|
|
2487
|
-
|
|
2529
|
+
useEffect6(() => {
|
|
2488
2530
|
if (virtualRef.current) {
|
|
2489
2531
|
context.triggerRef.current = virtualRef.current;
|
|
2490
2532
|
}
|
|
@@ -2532,9 +2574,9 @@ PopoverContent.displayName = CONTENT_NAME2;
|
|
|
2532
2574
|
var PopoverContentModal = /* @__PURE__ */ forwardRef22((props, forwardedRef) => {
|
|
2533
2575
|
const context = usePopoverContext(CONTENT_NAME2, props.__scopePopover);
|
|
2534
2576
|
const contentRef = useRef3(null);
|
|
2535
|
-
const composedRefs =
|
|
2577
|
+
const composedRefs = useComposedRefs(forwardedRef, contentRef);
|
|
2536
2578
|
const isRightClickOutsideRef = useRef3(false);
|
|
2537
|
-
|
|
2579
|
+
useEffect6(() => {
|
|
2538
2580
|
const content = contentRef.current;
|
|
2539
2581
|
if (content) {
|
|
2540
2582
|
return hideOthers(content);
|
|
@@ -2611,11 +2653,12 @@ var PopoverContentNonModal = /* @__PURE__ */ forwardRef22((props, forwardedRef)
|
|
|
2611
2653
|
});
|
|
2612
2654
|
});
|
|
2613
2655
|
var PopoverContentImpl = /* @__PURE__ */ forwardRef22((props, forwardedRef) => {
|
|
2614
|
-
const { __scopePopover, trapFocus, onOpenAutoFocus, onCloseAutoFocus, disableOutsidePointerEvents, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, classNames, ...contentProps } = props;
|
|
2656
|
+
const { __scopePopover, trapFocus, onOpenAutoFocus, onCloseAutoFocus, disableOutsidePointerEvents, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, collisionPadding = 8, classNames, ...contentProps } = props;
|
|
2615
2657
|
const context = usePopoverContext(CONTENT_NAME2, __scopePopover);
|
|
2616
2658
|
const popperScope = usePopperScope(__scopePopover);
|
|
2617
2659
|
const { tx } = useThemeContext();
|
|
2618
2660
|
const elevation = useElevationContext();
|
|
2661
|
+
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
2619
2662
|
useFocusGuards();
|
|
2620
2663
|
return /* @__PURE__ */ React30.createElement(FocusScope, {
|
|
2621
2664
|
asChild: true,
|
|
@@ -2637,6 +2680,7 @@ var PopoverContentImpl = /* @__PURE__ */ forwardRef22((props, forwardedRef) => {
|
|
|
2637
2680
|
id: context.contentId,
|
|
2638
2681
|
...popperScope,
|
|
2639
2682
|
...contentProps,
|
|
2683
|
+
collisionPadding: safeCollisionPadding,
|
|
2640
2684
|
className: tx("popover.content", "popover", {
|
|
2641
2685
|
elevation
|
|
2642
2686
|
}, classNames),
|
|
@@ -2807,11 +2851,13 @@ var SelectTriggerButton = /* @__PURE__ */ forwardRef25(({ children, placeholder,
|
|
|
2807
2851
|
weight: "bold"
|
|
2808
2852
|
}))));
|
|
2809
2853
|
});
|
|
2810
|
-
var SelectContent = /* @__PURE__ */ forwardRef25(({ classNames, children, ...props }, forwardedRef) => {
|
|
2854
|
+
var SelectContent = /* @__PURE__ */ forwardRef25(({ classNames, children, collisionPadding = 8, ...props }, forwardedRef) => {
|
|
2811
2855
|
const { tx } = useThemeContext();
|
|
2812
2856
|
const elevation = useElevationContext();
|
|
2857
|
+
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
2813
2858
|
return /* @__PURE__ */ React33.createElement(SelectPrimitive.Content, {
|
|
2814
2859
|
...props,
|
|
2860
|
+
collisionPadding: safeCollisionPadding,
|
|
2815
2861
|
className: tx("select.content", "select__content", {
|
|
2816
2862
|
elevation
|
|
2817
2863
|
}, classNames),
|
|
@@ -2917,23 +2963,24 @@ var Select = {
|
|
|
2917
2963
|
|
|
2918
2964
|
// packages/ui/react-ui/src/components/Separator/Separator.tsx
|
|
2919
2965
|
import { Separator as SeparatorPrimitive } from "@radix-ui/react-separator";
|
|
2920
|
-
import React34 from "react";
|
|
2921
|
-
var Separator4 = ({ classNames, orientation = "horizontal", ...props }) => {
|
|
2966
|
+
import React34, { forwardRef as forwardRef26 } from "react";
|
|
2967
|
+
var Separator4 = /* @__PURE__ */ forwardRef26(({ classNames, orientation = "horizontal", ...props }, forwardedRef) => {
|
|
2922
2968
|
const { tx } = useThemeContext();
|
|
2923
2969
|
return /* @__PURE__ */ React34.createElement(SeparatorPrimitive, {
|
|
2924
2970
|
orientation,
|
|
2925
2971
|
...props,
|
|
2926
2972
|
className: tx("separator.root", "separator", {
|
|
2927
2973
|
orientation
|
|
2928
|
-
}, classNames)
|
|
2974
|
+
}, classNames),
|
|
2975
|
+
ref: forwardedRef
|
|
2929
2976
|
});
|
|
2930
|
-
};
|
|
2977
|
+
});
|
|
2931
2978
|
|
|
2932
2979
|
// packages/ui/react-ui/src/components/Tag/Tag.tsx
|
|
2933
2980
|
import { Primitive as Primitive12 } from "@radix-ui/react-primitive";
|
|
2934
2981
|
import { Slot as Slot13 } from "@radix-ui/react-slot";
|
|
2935
|
-
import React35, { forwardRef as
|
|
2936
|
-
var Tag = /* @__PURE__ */
|
|
2982
|
+
import React35, { forwardRef as forwardRef27 } from "react";
|
|
2983
|
+
var Tag = /* @__PURE__ */ forwardRef27(({ asChild, palette, classNames, ...props }, forwardedRef) => {
|
|
2937
2984
|
const { tx } = useThemeContext();
|
|
2938
2985
|
const Root5 = asChild ? Slot13 : Primitive12.span;
|
|
2939
2986
|
return /* @__PURE__ */ React35.createElement(Root5, {
|
|
@@ -2949,16 +2996,16 @@ var Tag = /* @__PURE__ */ forwardRef26(({ asChild, palette, classNames, ...props
|
|
|
2949
2996
|
import { Primitive as Primitive13 } from "@radix-ui/react-primitive";
|
|
2950
2997
|
import { Slot as Slot14 } from "@radix-ui/react-slot";
|
|
2951
2998
|
import { ToastProvider as ToastProviderPrimitive, ToastViewport as ToastViewportPrimitive, Root as ToastRootPrimitive, ToastTitle as ToastTitlePrimitive, ToastDescription as ToastDescriptionPrimitive, ToastAction as ToastActionPrimitive, ToastClose as ToastClosePrimitive } from "@radix-ui/react-toast";
|
|
2952
|
-
import React36, { forwardRef as
|
|
2999
|
+
import React36, { forwardRef as forwardRef28 } from "react";
|
|
2953
3000
|
var ToastProvider = ToastProviderPrimitive;
|
|
2954
|
-
var ToastViewport = /* @__PURE__ */
|
|
3001
|
+
var ToastViewport = /* @__PURE__ */ forwardRef28(({ classNames, ...props }, forwardedRef) => {
|
|
2955
3002
|
const { tx } = useThemeContext();
|
|
2956
3003
|
return /* @__PURE__ */ React36.createElement(ToastViewportPrimitive, {
|
|
2957
3004
|
className: tx("toast.viewport", "toast-viewport", {}, classNames),
|
|
2958
3005
|
ref: forwardedRef
|
|
2959
3006
|
});
|
|
2960
3007
|
});
|
|
2961
|
-
var ToastRoot = /* @__PURE__ */
|
|
3008
|
+
var ToastRoot = /* @__PURE__ */ forwardRef28(({ classNames, children, ...props }, forwardedRef) => {
|
|
2962
3009
|
const { tx } = useThemeContext();
|
|
2963
3010
|
return /* @__PURE__ */ React36.createElement(ToastRootPrimitive, {
|
|
2964
3011
|
...props,
|
|
@@ -2968,7 +3015,7 @@ var ToastRoot = /* @__PURE__ */ forwardRef27(({ classNames, children, ...props }
|
|
|
2968
3015
|
elevation: "toast"
|
|
2969
3016
|
}, children));
|
|
2970
3017
|
});
|
|
2971
|
-
var ToastBody = /* @__PURE__ */
|
|
3018
|
+
var ToastBody = /* @__PURE__ */ forwardRef28(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
2972
3019
|
const { tx } = useThemeContext();
|
|
2973
3020
|
const Root5 = asChild ? Slot14 : Primitive13.div;
|
|
2974
3021
|
return /* @__PURE__ */ React36.createElement(Root5, {
|
|
@@ -2977,7 +3024,7 @@ var ToastBody = /* @__PURE__ */ forwardRef27(({ asChild, classNames, ...props },
|
|
|
2977
3024
|
ref: forwardedRef
|
|
2978
3025
|
});
|
|
2979
3026
|
});
|
|
2980
|
-
var ToastTitle = /* @__PURE__ */
|
|
3027
|
+
var ToastTitle = /* @__PURE__ */ forwardRef28(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
2981
3028
|
const { tx } = useThemeContext();
|
|
2982
3029
|
const Root5 = asChild ? Slot14 : ToastTitlePrimitive;
|
|
2983
3030
|
return /* @__PURE__ */ React36.createElement(Root5, {
|
|
@@ -2986,7 +3033,7 @@ var ToastTitle = /* @__PURE__ */ forwardRef27(({ asChild, classNames, ...props }
|
|
|
2986
3033
|
ref: forwardedRef
|
|
2987
3034
|
});
|
|
2988
3035
|
});
|
|
2989
|
-
var ToastDescription = /* @__PURE__ */
|
|
3036
|
+
var ToastDescription = /* @__PURE__ */ forwardRef28(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
2990
3037
|
const { tx } = useThemeContext();
|
|
2991
3038
|
const Root5 = asChild ? Slot14 : ToastDescriptionPrimitive;
|
|
2992
3039
|
return /* @__PURE__ */ React36.createElement(Root5, {
|
|
@@ -2995,7 +3042,7 @@ var ToastDescription = /* @__PURE__ */ forwardRef27(({ asChild, classNames, ...p
|
|
|
2995
3042
|
ref: forwardedRef
|
|
2996
3043
|
});
|
|
2997
3044
|
});
|
|
2998
|
-
var ToastActions = /* @__PURE__ */
|
|
3045
|
+
var ToastActions = /* @__PURE__ */ forwardRef28(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
2999
3046
|
const { tx } = useThemeContext();
|
|
3000
3047
|
const Root5 = asChild ? Slot14 : Primitive13.div;
|
|
3001
3048
|
return /* @__PURE__ */ React36.createElement(Root5, {
|
|
@@ -3020,8 +3067,8 @@ var Toast = {
|
|
|
3020
3067
|
|
|
3021
3068
|
// packages/ui/react-ui/src/components/Toolbar/Toolbar.tsx
|
|
3022
3069
|
import * as ToolbarPrimitive from "@radix-ui/react-toolbar";
|
|
3023
|
-
import React37, { forwardRef as
|
|
3024
|
-
var ToolbarRoot = /* @__PURE__ */
|
|
3070
|
+
import React37, { forwardRef as forwardRef29 } from "react";
|
|
3071
|
+
var ToolbarRoot = /* @__PURE__ */ forwardRef29(({ classNames, children, ...props }, forwardedRef) => {
|
|
3025
3072
|
const { tx } = useThemeContext();
|
|
3026
3073
|
return /* @__PURE__ */ React37.createElement(ToolbarPrimitive.Root, {
|
|
3027
3074
|
...props,
|
|
@@ -3029,7 +3076,7 @@ var ToolbarRoot = /* @__PURE__ */ forwardRef28(({ classNames, children, ...props
|
|
|
3029
3076
|
ref: forwardedRef
|
|
3030
3077
|
}, children);
|
|
3031
3078
|
});
|
|
3032
|
-
var ToolbarButton = /* @__PURE__ */
|
|
3079
|
+
var ToolbarButton = /* @__PURE__ */ forwardRef29((props, forwardedRef) => {
|
|
3033
3080
|
return /* @__PURE__ */ React37.createElement(ToolbarPrimitive.Button, {
|
|
3034
3081
|
asChild: true
|
|
3035
3082
|
}, /* @__PURE__ */ React37.createElement(Button, {
|
|
@@ -3037,7 +3084,15 @@ var ToolbarButton = /* @__PURE__ */ forwardRef28((props, forwardedRef) => {
|
|
|
3037
3084
|
ref: forwardedRef
|
|
3038
3085
|
}));
|
|
3039
3086
|
});
|
|
3040
|
-
var
|
|
3087
|
+
var ToolbarIconButton = /* @__PURE__ */ forwardRef29((props, forwardedRef) => {
|
|
3088
|
+
return /* @__PURE__ */ React37.createElement(ToolbarPrimitive.Button, {
|
|
3089
|
+
asChild: true
|
|
3090
|
+
}, /* @__PURE__ */ React37.createElement(IconButton, {
|
|
3091
|
+
...props,
|
|
3092
|
+
ref: forwardedRef
|
|
3093
|
+
}));
|
|
3094
|
+
});
|
|
3095
|
+
var ToolbarToggle = /* @__PURE__ */ forwardRef29((props, forwardedRef) => {
|
|
3041
3096
|
return /* @__PURE__ */ React37.createElement(ToolbarPrimitive.Button, {
|
|
3042
3097
|
asChild: true
|
|
3043
3098
|
}, /* @__PURE__ */ React37.createElement(Toggle, {
|
|
@@ -3045,7 +3100,7 @@ var ToolbarToggle = /* @__PURE__ */ forwardRef28((props, forwardedRef) => {
|
|
|
3045
3100
|
ref: forwardedRef
|
|
3046
3101
|
}));
|
|
3047
3102
|
});
|
|
3048
|
-
var ToolbarLink = /* @__PURE__ */
|
|
3103
|
+
var ToolbarLink = /* @__PURE__ */ forwardRef29((props, forwardedRef) => {
|
|
3049
3104
|
return /* @__PURE__ */ React37.createElement(ToolbarPrimitive.Link, {
|
|
3050
3105
|
asChild: true
|
|
3051
3106
|
}, /* @__PURE__ */ React37.createElement(Link, {
|
|
@@ -3053,7 +3108,7 @@ var ToolbarLink = /* @__PURE__ */ forwardRef28((props, forwardedRef) => {
|
|
|
3053
3108
|
ref: forwardedRef
|
|
3054
3109
|
}));
|
|
3055
3110
|
});
|
|
3056
|
-
var ToolbarToggleGroup2 = /* @__PURE__ */
|
|
3111
|
+
var ToolbarToggleGroup2 = /* @__PURE__ */ forwardRef29(({ classNames, children, elevation, ...props }, forwardedRef) => {
|
|
3057
3112
|
return /* @__PURE__ */ React37.createElement(ToolbarPrimitive.ToolbarToggleGroup, {
|
|
3058
3113
|
...props,
|
|
3059
3114
|
asChild: true
|
|
@@ -3064,7 +3119,7 @@ var ToolbarToggleGroup2 = /* @__PURE__ */ forwardRef28(({ classNames, children,
|
|
|
3064
3119
|
ref: forwardedRef
|
|
3065
3120
|
}));
|
|
3066
3121
|
});
|
|
3067
|
-
var ToolbarToggleGroupItem = /* @__PURE__ */
|
|
3122
|
+
var ToolbarToggleGroupItem = /* @__PURE__ */ forwardRef29(({ variant, density, elevation, classNames, children, ...props }, forwardedRef) => {
|
|
3068
3123
|
return /* @__PURE__ */ React37.createElement(ToolbarPrimitive.ToolbarToggleItem, {
|
|
3069
3124
|
...props,
|
|
3070
3125
|
asChild: true
|
|
@@ -3077,26 +3132,42 @@ var ToolbarToggleGroupItem = /* @__PURE__ */ forwardRef28(({ variant, density, e
|
|
|
3077
3132
|
ref: forwardedRef
|
|
3078
3133
|
}));
|
|
3079
3134
|
});
|
|
3080
|
-
var
|
|
3081
|
-
return /* @__PURE__ */ React37.createElement(ToolbarPrimitive.
|
|
3135
|
+
var ToolbarToggleGroupIconItem = /* @__PURE__ */ forwardRef29(({ variant, density, elevation, classNames, icon, label, iconOnly, ...props }, forwardedRef) => {
|
|
3136
|
+
return /* @__PURE__ */ React37.createElement(ToolbarPrimitive.ToolbarToggleItem, {
|
|
3137
|
+
...props,
|
|
3082
3138
|
asChild: true
|
|
3083
|
-
}, /* @__PURE__ */ React37.createElement(
|
|
3084
|
-
|
|
3085
|
-
|
|
3139
|
+
}, /* @__PURE__ */ React37.createElement(IconButton, {
|
|
3140
|
+
variant,
|
|
3141
|
+
density,
|
|
3142
|
+
elevation,
|
|
3143
|
+
classNames,
|
|
3144
|
+
icon,
|
|
3145
|
+
label,
|
|
3146
|
+
iconOnly,
|
|
3147
|
+
ref: forwardedRef
|
|
3086
3148
|
}));
|
|
3087
|
-
};
|
|
3088
|
-
var
|
|
3089
|
-
|
|
3149
|
+
});
|
|
3150
|
+
var ToolbarSeparator = /* @__PURE__ */ forwardRef29(({ variant = "line", ...props }, forwardedRef) => {
|
|
3151
|
+
return variant === "line" ? /* @__PURE__ */ React37.createElement(ToolbarPrimitive.Separator, {
|
|
3152
|
+
asChild: true
|
|
3153
|
+
}, /* @__PURE__ */ React37.createElement(Separator4, {
|
|
3154
|
+
...props,
|
|
3155
|
+
ref: forwardedRef
|
|
3156
|
+
})) : /* @__PURE__ */ React37.createElement(ToolbarPrimitive.Separator, {
|
|
3157
|
+
className: "grow",
|
|
3158
|
+
ref: forwardedRef
|
|
3159
|
+
});
|
|
3090
3160
|
});
|
|
3091
3161
|
var Toolbar = {
|
|
3092
3162
|
Root: ToolbarRoot,
|
|
3093
3163
|
Button: ToolbarButton,
|
|
3164
|
+
IconButton: ToolbarIconButton,
|
|
3094
3165
|
Link: ToolbarLink,
|
|
3095
3166
|
Toggle: ToolbarToggle,
|
|
3096
3167
|
ToggleGroup: ToolbarToggleGroup2,
|
|
3097
3168
|
ToggleGroupItem: ToolbarToggleGroupItem,
|
|
3098
|
-
|
|
3099
|
-
|
|
3169
|
+
ToggleGroupIconItem: ToolbarToggleGroupIconItem,
|
|
3170
|
+
Separator: ToolbarSeparator
|
|
3100
3171
|
};
|
|
3101
3172
|
export {
|
|
3102
3173
|
AlertDialog,
|
|
@@ -3147,6 +3218,7 @@ export {
|
|
|
3147
3218
|
createDropdownMenuScope,
|
|
3148
3219
|
createPopoverScope,
|
|
3149
3220
|
hasIosKeyboard,
|
|
3221
|
+
initialSafeArea,
|
|
3150
3222
|
isLabel,
|
|
3151
3223
|
toLocalizedString,
|
|
3152
3224
|
useAvatarContext,
|
|
@@ -3159,6 +3231,7 @@ export {
|
|
|
3159
3231
|
useListContext,
|
|
3160
3232
|
useListItemContext,
|
|
3161
3233
|
useMainContext,
|
|
3234
|
+
useSafeArea,
|
|
3162
3235
|
useSidebars,
|
|
3163
3236
|
useThemeContext,
|
|
3164
3237
|
useTranslation,
|