@dxos/react-ui 0.7.5-main.9d26e3a → 0.7.5-main.e9bb01b
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 +272 -200
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +646 -577
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +272 -200
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/Avatars/Avatar.d.ts +5 -9
- package/dist/types/src/components/Avatars/Avatar.d.ts.map +1 -1
- package/dist/types/src/components/Avatars/Avatar.stories.d.ts +1 -2
- package/dist/types/src/components/Avatars/Avatar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/IconButton.d.ts +6 -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 +35 -24
- package/dist/types/src/components/Main/Main.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.stories.d.ts +1 -1
- package/dist/types/src/components/Menus/ContextMenu.d.ts.map +1 -1
- package/dist/types/src/components/Menus/DropdownMenu.d.ts +2 -6
- 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/Tag/Tag.d.ts.map +1 -1
- package/dist/types/src/components/Tag/Tag.stories.d.ts +12 -5
- package/dist/types/src/components/Tag/Tag.stories.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts +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 +42 -42
- package/src/components/Avatars/Avatar.tsx +3 -6
- package/src/components/Buttons/IconButton.tsx +25 -7
- package/src/components/Dialogs/Dialog.tsx +1 -9
- package/src/components/Input/Input.tsx +1 -1
- package/src/components/Main/Main.stories.tsx +1 -1
- package/src/components/Main/Main.tsx +78 -108
- package/src/components/Menus/ContextMenu.tsx +4 -2
- package/src/components/Menus/DropdownMenu.tsx +4 -2
- package/src/components/Popover/Popover.tsx +4 -0
- package/src/components/Select/Select.tsx +4 -1
- package/src/components/Separator/Separator.tsx +14 -11
- package/src/components/Tag/Tag.stories.tsx +20 -31
- package/src/components/Tag/Tag.tsx +15 -6
- package/src/components/ThemeProvider/ThemeProvider.tsx +12 -3
- package/src/components/Toolbar/Toolbar.tsx +40 -10
- package/src/components/Tooltip/Tooltip.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,34 @@ 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) => {
|
|
616
|
-
const
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
658
|
+
var IconOnlyButton = /* @__PURE__ */ forwardRef9(({ tooltipPortal = true, tooltipZIndex: zIndex, tooltipSide, suppressNextTooltip, ...props }, forwardedRef) => {
|
|
659
|
+
const [triggerTooltipOpen, setTriggerTooltipOpen] = useState4(false);
|
|
660
|
+
const content = /* @__PURE__ */ React10.createElement(Tooltip.Content, {
|
|
661
|
+
...zIndex && {
|
|
662
|
+
style: {
|
|
663
|
+
zIndex
|
|
664
|
+
}
|
|
665
|
+
},
|
|
666
|
+
side: tooltipSide
|
|
620
667
|
}, props.label, /* @__PURE__ */ React10.createElement(Tooltip.Arrow, null));
|
|
621
|
-
return /* @__PURE__ */ React10.createElement(Tooltip.Root,
|
|
668
|
+
return /* @__PURE__ */ React10.createElement(Tooltip.Root, {
|
|
669
|
+
open: triggerTooltipOpen,
|
|
670
|
+
onOpenChange: (nextOpen) => {
|
|
671
|
+
if (suppressNextTooltip?.current) {
|
|
672
|
+
setTriggerTooltipOpen(false);
|
|
673
|
+
suppressNextTooltip.current = false;
|
|
674
|
+
} else {
|
|
675
|
+
setTriggerTooltipOpen(nextOpen);
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
}, /* @__PURE__ */ React10.createElement(Tooltip.Trigger, {
|
|
622
679
|
asChild: true
|
|
623
680
|
}, /* @__PURE__ */ React10.createElement(LabelledIconButton, {
|
|
624
681
|
...props,
|
|
625
682
|
ref: forwardedRef
|
|
626
683
|
})), tooltipPortal ? /* @__PURE__ */ React10.createElement(Tooltip.Portal, null, content) : content);
|
|
627
684
|
});
|
|
628
|
-
var LabelledIconButton = /* @__PURE__ */ forwardRef9(({ icon, size, iconOnly, label, classNames, iconClassNames, ...props }, forwardedRef) => {
|
|
685
|
+
var LabelledIconButton = /* @__PURE__ */ forwardRef9(({ icon, size, iconOnly, label, classNames, iconClassNames, caretDown, suppressNextTooltip, ...props }, forwardedRef) => {
|
|
629
686
|
const { tx } = useThemeContext();
|
|
630
687
|
return /* @__PURE__ */ React10.createElement(Button, {
|
|
631
688
|
...props,
|
|
@@ -637,7 +694,10 @@ var LabelledIconButton = /* @__PURE__ */ forwardRef9(({ icon, size, iconOnly, la
|
|
|
637
694
|
classNames: iconClassNames
|
|
638
695
|
}), /* @__PURE__ */ React10.createElement("span", {
|
|
639
696
|
className: iconOnly ? "sr-only" : void 0
|
|
640
|
-
}, label)
|
|
697
|
+
}, label), caretDown && /* @__PURE__ */ React10.createElement(Icon, {
|
|
698
|
+
size: 3,
|
|
699
|
+
icon: "ph--caret-down--bold"
|
|
700
|
+
}));
|
|
641
701
|
});
|
|
642
702
|
var IconButton = /* @__PURE__ */ forwardRef9((props, forwardedRef) => props.iconOnly ? /* @__PURE__ */ React10.createElement(IconOnlyButton, {
|
|
643
703
|
...props,
|
|
@@ -690,7 +750,7 @@ var ToggleGroupItem = /* @__PURE__ */ forwardRef11(({ variant, elevation, densit
|
|
|
690
750
|
});
|
|
691
751
|
|
|
692
752
|
// packages/ui/react-ui/src/components/Clipboard/ClipboardProvider.tsx
|
|
693
|
-
import React13, { createContext as createContext4, useCallback, useContext as useContext6, useState as
|
|
753
|
+
import React13, { createContext as createContext4, useCallback as useCallback3, useContext as useContext6, useState as useState5 } from "react";
|
|
694
754
|
var ClipboardContext = /* @__PURE__ */ createContext4({
|
|
695
755
|
textValue: "",
|
|
696
756
|
setTextValue: async (_) => {
|
|
@@ -698,8 +758,8 @@ var ClipboardContext = /* @__PURE__ */ createContext4({
|
|
|
698
758
|
});
|
|
699
759
|
var useClipboard = () => useContext6(ClipboardContext);
|
|
700
760
|
var ClipboardProvider = ({ children }) => {
|
|
701
|
-
const [textValue, setInternalTextValue] =
|
|
702
|
-
const setTextValue =
|
|
761
|
+
const [textValue, setInternalTextValue] = useState5("");
|
|
762
|
+
const setTextValue = useCallback3(async (nextValue) => {
|
|
703
763
|
await navigator.clipboard.writeText(nextValue);
|
|
704
764
|
return setInternalTextValue(nextValue);
|
|
705
765
|
}, []);
|
|
@@ -712,12 +772,12 @@ var ClipboardProvider = ({ children }) => {
|
|
|
712
772
|
};
|
|
713
773
|
|
|
714
774
|
// packages/ui/react-ui/src/components/Clipboard/CopyButton.tsx
|
|
715
|
-
import React17, { useState as
|
|
775
|
+
import React17, { useState as useState6 } from "react";
|
|
716
776
|
import { mx } from "@dxos/react-ui-theme";
|
|
717
777
|
|
|
718
778
|
// packages/ui/react-ui/src/components/ThemeProvider/ThemeProvider.tsx
|
|
719
779
|
import { createKeyborg } from "keyborg";
|
|
720
|
-
import React16, { createContext as createContext7, useEffect as
|
|
780
|
+
import React16, { createContext as createContext7, useEffect as useEffect2, useMemo as useMemo2 } from "react";
|
|
721
781
|
|
|
722
782
|
// packages/ui/react-ui/src/util/hasIosKeyboard.ts
|
|
723
783
|
var hasIosKeyboard = () => {
|
|
@@ -749,20 +809,28 @@ var ElevationProvider = ({ elevation, children }) => /* @__PURE__ */ React15.cre
|
|
|
749
809
|
// packages/ui/react-ui/src/components/ThemeProvider/ThemeProvider.tsx
|
|
750
810
|
var ThemeContext = /* @__PURE__ */ createContext7(void 0);
|
|
751
811
|
var ThemeProvider = ({ children, fallback = null, resourceExtensions, appNs, tx = (_path, defaultClassName, _styleProps, ..._options) => defaultClassName, themeMode = "dark", rootDensity = "fine", ...rest }) => {
|
|
752
|
-
|
|
812
|
+
useEffect2(() => {
|
|
753
813
|
if (document.defaultView) {
|
|
754
814
|
const kb = createKeyborg(document.defaultView);
|
|
755
815
|
kb.subscribe(handleInputModalityChange);
|
|
756
816
|
return () => kb.unsubscribe(handleInputModalityChange);
|
|
757
817
|
}
|
|
758
818
|
}, []);
|
|
819
|
+
const safeAreaPadding = useSafeArea();
|
|
820
|
+
const contextValue = useMemo2(() => ({
|
|
821
|
+
tx,
|
|
822
|
+
themeMode,
|
|
823
|
+
hasIosKeyboard: hasIosKeyboard(),
|
|
824
|
+
safeAreaPadding,
|
|
825
|
+
...rest
|
|
826
|
+
}), [
|
|
827
|
+
tx,
|
|
828
|
+
themeMode,
|
|
829
|
+
safeAreaPadding,
|
|
830
|
+
rest
|
|
831
|
+
]);
|
|
759
832
|
return /* @__PURE__ */ React16.createElement(ThemeContext.Provider, {
|
|
760
|
-
value:
|
|
761
|
-
tx,
|
|
762
|
-
themeMode,
|
|
763
|
-
hasIosKeyboard: hasIosKeyboard(),
|
|
764
|
-
...rest
|
|
765
|
-
}
|
|
833
|
+
value: contextValue
|
|
766
834
|
}, /* @__PURE__ */ React16.createElement(TranslationsProvider, {
|
|
767
835
|
fallback,
|
|
768
836
|
resourceExtensions,
|
|
@@ -820,7 +888,7 @@ var CopyButtonIconOnly = ({ value, classNames, iconProps, variant, ...props }) =
|
|
|
820
888
|
const { textValue, setTextValue } = useClipboard();
|
|
821
889
|
const isCopied = textValue === value;
|
|
822
890
|
const label = isCopied ? t("copy success label") : t("copy label");
|
|
823
|
-
const [open, setOpen] =
|
|
891
|
+
const [open, setOpen] = useState6(false);
|
|
824
892
|
return /* @__PURE__ */ React17.createElement(Tooltip.Root, {
|
|
825
893
|
delayDuration: 1500,
|
|
826
894
|
open,
|
|
@@ -893,7 +961,7 @@ var DialogOverlay = /* @__PURE__ */ forwardRef12(({ classNames, children, blockA
|
|
|
893
961
|
const { tx } = useThemeContext();
|
|
894
962
|
return /* @__PURE__ */ React18.createElement(DialogOverlayPrimitive, {
|
|
895
963
|
...props,
|
|
896
|
-
className: tx("dialog.overlay", "dialog__overlay", {}, classNames
|
|
964
|
+
className: tx("dialog.overlay", "dialog__overlay", {}, classNames),
|
|
897
965
|
ref: forwardedRef,
|
|
898
966
|
"data-block-align": blockAlign
|
|
899
967
|
}, /* @__PURE__ */ React18.createElement(OverlayLayoutProvider, {
|
|
@@ -1004,12 +1072,13 @@ import React20, { forwardRef as forwardRef14 } from "react";
|
|
|
1004
1072
|
var ContextMenuRoot = ContextMenuPrimitive.ContextMenu;
|
|
1005
1073
|
var ContextMenuTrigger = ContextMenuPrimitive.Trigger;
|
|
1006
1074
|
var ContextMenuPortal = ContextMenuPrimitive.Portal;
|
|
1007
|
-
var ContextMenuContent = /* @__PURE__ */ forwardRef14(({ classNames, children, ...props }, forwardedRef) => {
|
|
1075
|
+
var ContextMenuContent = /* @__PURE__ */ forwardRef14(({ classNames, children, collisionPadding = 8, ...props }, forwardedRef) => {
|
|
1008
1076
|
const { tx } = useThemeContext();
|
|
1009
1077
|
const elevation = useElevationContext();
|
|
1078
|
+
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
1010
1079
|
return /* @__PURE__ */ React20.createElement(ContextMenuPrimitive.Content, {
|
|
1011
|
-
collisionPadding: 8,
|
|
1012
1080
|
...props,
|
|
1081
|
+
collisionPadding: safeCollisionPadding,
|
|
1013
1082
|
className: tx("menu.content", "menu", {
|
|
1014
1083
|
elevation
|
|
1015
1084
|
}, classNames),
|
|
@@ -1092,7 +1161,7 @@ import { createMenuScope } from "@radix-ui/react-menu";
|
|
|
1092
1161
|
import { Primitive as Primitive7 } from "@radix-ui/react-primitive";
|
|
1093
1162
|
import { Slot as Slot7 } from "@radix-ui/react-slot";
|
|
1094
1163
|
import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
|
1095
|
-
import React21, { useRef, useCallback as
|
|
1164
|
+
import React21, { useRef, useCallback as useCallback4, forwardRef as forwardRef15, useEffect as useEffect3 } from "react";
|
|
1096
1165
|
var DROPDOWN_MENU_NAME = "DropdownMenu";
|
|
1097
1166
|
var [createDropdownMenuContext, createDropdownMenuScope] = createContextScope(DROPDOWN_MENU_NAME, [
|
|
1098
1167
|
createMenuScope
|
|
@@ -1115,7 +1184,7 @@ var DropdownMenuRoot = (props) => {
|
|
|
1115
1184
|
contentId: useId3(),
|
|
1116
1185
|
open,
|
|
1117
1186
|
onOpenChange: setOpen,
|
|
1118
|
-
onOpenToggle:
|
|
1187
|
+
onOpenToggle: useCallback4(() => setOpen((prevOpen) => !prevOpen), [
|
|
1119
1188
|
setOpen
|
|
1120
1189
|
]),
|
|
1121
1190
|
modal
|
|
@@ -1184,7 +1253,7 @@ var DropdownMenuVirtualTrigger = (props) => {
|
|
|
1184
1253
|
const { __scopeDropdownMenu, virtualRef } = props;
|
|
1185
1254
|
const context = useDropdownMenuContext(VIRTUAL_TRIGGER_NAME, __scopeDropdownMenu);
|
|
1186
1255
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1187
|
-
|
|
1256
|
+
useEffect3(() => {
|
|
1188
1257
|
if (virtualRef.current) {
|
|
1189
1258
|
context.triggerRef.current = virtualRef.current;
|
|
1190
1259
|
}
|
|
@@ -1216,17 +1285,19 @@ var DropdownMenuViewport = /* @__PURE__ */ forwardRef15(({ classNames, asChild,
|
|
|
1216
1285
|
});
|
|
1217
1286
|
var CONTENT_NAME = "DropdownMenuContent";
|
|
1218
1287
|
var DropdownMenuContent = /* @__PURE__ */ forwardRef15((props, forwardedRef) => {
|
|
1219
|
-
const { __scopeDropdownMenu, classNames, ...contentProps } = props;
|
|
1288
|
+
const { __scopeDropdownMenu, classNames, collisionPadding = 8, ...contentProps } = props;
|
|
1220
1289
|
const { tx } = useThemeContext();
|
|
1221
1290
|
const context = useDropdownMenuContext(CONTENT_NAME, __scopeDropdownMenu);
|
|
1222
1291
|
const elevation = useElevationContext();
|
|
1223
1292
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1224
1293
|
const hasInteractedOutsideRef = useRef(false);
|
|
1294
|
+
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
1225
1295
|
return /* @__PURE__ */ React21.createElement(MenuPrimitive.Content, {
|
|
1226
1296
|
id: context.contentId,
|
|
1227
1297
|
"aria-labelledby": context.triggerId,
|
|
1228
1298
|
...menuScope,
|
|
1229
1299
|
...contentProps,
|
|
1300
|
+
collisionPadding: safeCollisionPadding,
|
|
1230
1301
|
ref: forwardedRef,
|
|
1231
1302
|
onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
1232
1303
|
if (!hasInteractedOutsideRef.current) {
|
|
@@ -1441,7 +1512,7 @@ var useDropdownMenuMenuScope = useMenuScope;
|
|
|
1441
1512
|
// packages/ui/react-ui/src/components/Input/Input.tsx
|
|
1442
1513
|
import { Root as CheckboxPrimitive } from "@radix-ui/react-checkbox";
|
|
1443
1514
|
import { useControllableState as useControllableState2 } from "@radix-ui/react-use-controllable-state";
|
|
1444
|
-
import React22, { forwardRef as forwardRef16, useCallback as
|
|
1515
|
+
import React22, { forwardRef as forwardRef16, useCallback as useCallback5 } from "react";
|
|
1445
1516
|
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
1517
|
var Label3 = /* @__PURE__ */ forwardRef16(({ srOnly, classNames, children, ...props }, forwardedRef) => {
|
|
1447
1518
|
const { tx } = useThemeContext();
|
|
@@ -1490,7 +1561,7 @@ var PinInput = /* @__PURE__ */ forwardRef16(({ density: propsDensity, elevation:
|
|
|
1490
1561
|
const { tx } = useThemeContext();
|
|
1491
1562
|
const density = useDensityContext(propsDensity);
|
|
1492
1563
|
const elevation = useElevationContext(propsElevation);
|
|
1493
|
-
const segmentClassName =
|
|
1564
|
+
const segmentClassName = useCallback5(({ focused, validationValence }) => tx("input.input", "input--pin-segment", {
|
|
1494
1565
|
variant: "static",
|
|
1495
1566
|
focused,
|
|
1496
1567
|
disabled: props.disabled,
|
|
@@ -1598,7 +1669,7 @@ var Switch = /* @__PURE__ */ forwardRef16(({ __inputScope, checked: propsChecked
|
|
|
1598
1669
|
const { id, validationValence, descriptionId, errorMessageId } = useInputContext(INPUT_NAME, __inputScope);
|
|
1599
1670
|
return /* @__PURE__ */ React22.createElement("input", {
|
|
1600
1671
|
type: "checkbox",
|
|
1601
|
-
className: "
|
|
1672
|
+
className: "dx-checkbox--switch dx-focus-ring",
|
|
1602
1673
|
checked,
|
|
1603
1674
|
onChange: (event) => {
|
|
1604
1675
|
onCheckedChange(event.target.checked);
|
|
@@ -1943,18 +2014,17 @@ var Treegrid = {
|
|
|
1943
2014
|
|
|
1944
2015
|
// packages/ui/react-ui/src/components/Main/Main.tsx
|
|
1945
2016
|
import { useFocusableGroup as useFocusableGroup2 } from "@fluentui/react-tabster";
|
|
1946
|
-
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
1947
2017
|
import { createContext as createContext10 } from "@radix-ui/react-context";
|
|
1948
2018
|
import { Root as DialogRoot2, DialogContent as DialogContent2 } from "@radix-ui/react-dialog";
|
|
1949
2019
|
import { Primitive as Primitive9 } from "@radix-ui/react-primitive";
|
|
1950
2020
|
import { Slot as Slot10 } from "@radix-ui/react-slot";
|
|
1951
2021
|
import { useControllableState as useControllableState4 } from "@radix-ui/react-use-controllable-state";
|
|
1952
|
-
import React28, { forwardRef as forwardRef20, useCallback as
|
|
2022
|
+
import React28, { forwardRef as forwardRef20, useCallback as useCallback7, useEffect as useEffect5, useRef as useRef2, useState as useState8 } from "react";
|
|
1953
2023
|
import { log } from "@dxos/log";
|
|
1954
2024
|
import { useMediaQuery, useForwardedRef } from "@dxos/react-hooks";
|
|
1955
2025
|
|
|
1956
2026
|
// packages/ui/react-ui/src/components/Main/useSwipeToDismiss.ts
|
|
1957
|
-
import { useCallback as
|
|
2027
|
+
import { useCallback as useCallback6, useEffect as useEffect4, useState as useState7 } from "react";
|
|
1958
2028
|
var MotionState;
|
|
1959
2029
|
(function(MotionState2) {
|
|
1960
2030
|
MotionState2[MotionState2["IDLE"] = 0] = "IDLE";
|
|
@@ -1969,22 +2039,22 @@ var useSwipeToDismiss = (ref, {
|
|
|
1969
2039
|
/* side = 'inline-start' */
|
|
1970
2040
|
}) => {
|
|
1971
2041
|
const $root = ref.current;
|
|
1972
|
-
const [motionState, setMotionState] =
|
|
1973
|
-
const [gestureStartX, setGestureStartX] =
|
|
1974
|
-
const setIdle =
|
|
2042
|
+
const [motionState, setMotionState] = useState7(0);
|
|
2043
|
+
const [gestureStartX, setGestureStartX] = useState7(0);
|
|
2044
|
+
const setIdle = useCallback6(() => {
|
|
1975
2045
|
setMotionState(0);
|
|
1976
2046
|
$root?.style.removeProperty("inset-inline-start");
|
|
1977
2047
|
$root?.style.setProperty("transition-duration", "200ms");
|
|
1978
2048
|
}, [
|
|
1979
2049
|
$root
|
|
1980
2050
|
]);
|
|
1981
|
-
const setFollowing =
|
|
2051
|
+
const setFollowing = useCallback6(() => {
|
|
1982
2052
|
setMotionState(2);
|
|
1983
2053
|
$root?.style.setProperty("transition-duration", "0ms");
|
|
1984
2054
|
}, [
|
|
1985
2055
|
$root
|
|
1986
2056
|
]);
|
|
1987
|
-
const handlePointerDown =
|
|
2057
|
+
const handlePointerDown = useCallback6(({ screenX }) => {
|
|
1988
2058
|
if (motionState === 0) {
|
|
1989
2059
|
setMotionState(1);
|
|
1990
2060
|
setGestureStartX(screenX);
|
|
@@ -1992,7 +2062,7 @@ var useSwipeToDismiss = (ref, {
|
|
|
1992
2062
|
}, [
|
|
1993
2063
|
motionState
|
|
1994
2064
|
]);
|
|
1995
|
-
const handlePointerMove =
|
|
2065
|
+
const handlePointerMove = useCallback6(({ screenX }) => {
|
|
1996
2066
|
if ($root) {
|
|
1997
2067
|
const delta = Math.min(screenX - gestureStartX, 0);
|
|
1998
2068
|
switch (motionState) {
|
|
@@ -2016,12 +2086,12 @@ var useSwipeToDismiss = (ref, {
|
|
|
2016
2086
|
motionState,
|
|
2017
2087
|
gestureStartX
|
|
2018
2088
|
]);
|
|
2019
|
-
const handlePointerUp =
|
|
2089
|
+
const handlePointerUp = useCallback6(() => {
|
|
2020
2090
|
setIdle();
|
|
2021
2091
|
}, [
|
|
2022
2092
|
setIdle
|
|
2023
2093
|
]);
|
|
2024
|
-
|
|
2094
|
+
useEffect4(() => {
|
|
2025
2095
|
$root?.addEventListener("pointerdown", handlePointerDown);
|
|
2026
2096
|
return () => {
|
|
2027
2097
|
$root?.removeEventListener("pointerdown", handlePointerDown);
|
|
@@ -2030,7 +2100,7 @@ var useSwipeToDismiss = (ref, {
|
|
|
2030
2100
|
$root,
|
|
2031
2101
|
handlePointerDown
|
|
2032
2102
|
]);
|
|
2033
|
-
|
|
2103
|
+
useEffect4(() => {
|
|
2034
2104
|
$root && document.documentElement.addEventListener("pointermove", handlePointerMove);
|
|
2035
2105
|
return () => {
|
|
2036
2106
|
document.documentElement.removeEventListener("pointermove", handlePointerMove);
|
|
@@ -2039,7 +2109,7 @@ var useSwipeToDismiss = (ref, {
|
|
|
2039
2109
|
$root,
|
|
2040
2110
|
handlePointerMove
|
|
2041
2111
|
]);
|
|
2042
|
-
|
|
2112
|
+
useEffect4(() => {
|
|
2043
2113
|
$root && document.documentElement.addEventListener("pointerup", handlePointerUp);
|
|
2044
2114
|
return () => {
|
|
2045
2115
|
document.documentElement.removeEventListener("pointerup", handlePointerUp);
|
|
@@ -2059,7 +2129,7 @@ var MAIN_NAME = "Main";
|
|
|
2059
2129
|
var GENERIC_CONSUMER_NAME = "GenericConsumer";
|
|
2060
2130
|
var landmarkAttr = "data-main-landmark";
|
|
2061
2131
|
var useLandmarkMover = (propsOnKeyDown, landmark) => {
|
|
2062
|
-
const handleKeyDown =
|
|
2132
|
+
const handleKeyDown = useCallback7((event) => {
|
|
2063
2133
|
const target = event.target;
|
|
2064
2134
|
if (event.target === event.currentTarget && event.key === "Tab" && target.hasAttribute(landmarkAttr)) {
|
|
2065
2135
|
event.preventDefault();
|
|
@@ -2088,72 +2158,66 @@ var useLandmarkMover = (propsOnKeyDown, landmark) => {
|
|
|
2088
2158
|
};
|
|
2089
2159
|
var [MainProvider, useMainContext] = createContext10(MAIN_NAME, {
|
|
2090
2160
|
resizing: false,
|
|
2091
|
-
|
|
2092
|
-
|
|
2161
|
+
navigationSidebarState: "closed",
|
|
2162
|
+
setNavigationSidebarState: (nextState) => {
|
|
2093
2163
|
log.warn("Attempt to set sidebar state without initializing `MainRoot`", void 0, {
|
|
2094
2164
|
F: __dxlog_file,
|
|
2095
|
-
L:
|
|
2165
|
+
L: 81,
|
|
2096
2166
|
S: void 0,
|
|
2097
2167
|
C: (f, a) => f(...a)
|
|
2098
2168
|
});
|
|
2099
2169
|
},
|
|
2100
|
-
|
|
2101
|
-
|
|
2170
|
+
complementarySidebarState: "closed",
|
|
2171
|
+
setComplementarySidebarState: (nextState) => {
|
|
2102
2172
|
log.warn("Attempt to set sidebar state without initializing `MainRoot`", void 0, {
|
|
2103
2173
|
F: __dxlog_file,
|
|
2104
|
-
L:
|
|
2174
|
+
L: 86,
|
|
2105
2175
|
S: void 0,
|
|
2106
2176
|
C: (f, a) => f(...a)
|
|
2107
2177
|
});
|
|
2108
2178
|
}
|
|
2109
2179
|
});
|
|
2110
2180
|
var useSidebars = (consumerName = GENERIC_CONSUMER_NAME) => {
|
|
2111
|
-
const {
|
|
2181
|
+
const { setNavigationSidebarState, navigationSidebarState, setComplementarySidebarState, complementarySidebarState } = useMainContext(consumerName);
|
|
2112
2182
|
return {
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
toggleNavigationSidebar:
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
]),
|
|
2119
|
-
openNavigationSidebar: useCallback5(() => setNavigationSidebarOpen(true), [
|
|
2120
|
-
setNavigationSidebarOpen
|
|
2121
|
-
]),
|
|
2122
|
-
closeNavigationSidebar: useCallback5(() => setNavigationSidebarOpen(false), [
|
|
2123
|
-
setNavigationSidebarOpen
|
|
2183
|
+
navigationSidebarState,
|
|
2184
|
+
setNavigationSidebarState,
|
|
2185
|
+
toggleNavigationSidebar: useCallback7(() => setNavigationSidebarState(navigationSidebarState === "expanded" ? "closed" : "expanded"), [
|
|
2186
|
+
navigationSidebarState,
|
|
2187
|
+
setNavigationSidebarState
|
|
2124
2188
|
]),
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2189
|
+
openNavigationSidebar: useCallback7(() => setNavigationSidebarState("expanded"), []),
|
|
2190
|
+
collapseNavigationSidebar: useCallback7(() => setNavigationSidebarState("collapsed"), []),
|
|
2191
|
+
closeNavigationSidebar: useCallback7(() => setNavigationSidebarState("closed"), []),
|
|
2192
|
+
complementarySidebarState,
|
|
2193
|
+
setComplementarySidebarState,
|
|
2194
|
+
toggleComplementarySidebar: useCallback7(() => setComplementarySidebarState(complementarySidebarState === "expanded" ? "closed" : "expanded"), [
|
|
2195
|
+
complementarySidebarState,
|
|
2196
|
+
setComplementarySidebarState
|
|
2130
2197
|
]),
|
|
2131
|
-
openComplementarySidebar:
|
|
2132
|
-
|
|
2133
|
-
])
|
|
2134
|
-
closeComplementarySidebar: useCallback5(() => setComplementarySidebarOpen(false), [
|
|
2135
|
-
setComplementarySidebarOpen
|
|
2136
|
-
])
|
|
2198
|
+
openComplementarySidebar: useCallback7(() => setComplementarySidebarState("expanded"), []),
|
|
2199
|
+
collapseComplementarySidebar: useCallback7(() => setComplementarySidebarState("collapsed"), []),
|
|
2200
|
+
closeComplementarySidebar: useCallback7(() => setComplementarySidebarState("closed"), [])
|
|
2137
2201
|
};
|
|
2138
2202
|
};
|
|
2139
2203
|
var resizeDebounce = 3e3;
|
|
2140
|
-
var MainRoot = ({
|
|
2204
|
+
var MainRoot = ({ navigationSidebarState: propsNavigationSidebarState, defaultNavigationSidebarState, onNavigationSidebarStateChange, complementarySidebarState: propsComplementarySidebarState, defaultComplementarySidebarState, onComplementarySidebarStateChange, children, ...props }) => {
|
|
2141
2205
|
const [isLg] = useMediaQuery("lg", {
|
|
2142
2206
|
ssr: false
|
|
2143
2207
|
});
|
|
2144
|
-
const [
|
|
2145
|
-
prop:
|
|
2146
|
-
defaultProp:
|
|
2147
|
-
onChange:
|
|
2208
|
+
const [navigationSidebarState = isLg ? "expanded" : "collapsed", setNavigationSidebarState] = useControllableState4({
|
|
2209
|
+
prop: propsNavigationSidebarState,
|
|
2210
|
+
defaultProp: defaultNavigationSidebarState,
|
|
2211
|
+
onChange: onNavigationSidebarStateChange
|
|
2148
2212
|
});
|
|
2149
|
-
const [
|
|
2150
|
-
prop:
|
|
2151
|
-
defaultProp:
|
|
2152
|
-
onChange:
|
|
2213
|
+
const [complementarySidebarState = isLg ? "expanded" : "collapsed", setComplementarySidebarState] = useControllableState4({
|
|
2214
|
+
prop: propsComplementarySidebarState,
|
|
2215
|
+
defaultProp: defaultComplementarySidebarState,
|
|
2216
|
+
onChange: onComplementarySidebarStateChange
|
|
2153
2217
|
});
|
|
2154
|
-
const [resizing, setResizing] =
|
|
2218
|
+
const [resizing, setResizing] = useState8(false);
|
|
2155
2219
|
const resizeInterval = useRef2(null);
|
|
2156
|
-
const handleResize =
|
|
2220
|
+
const handleResize = useCallback7(() => {
|
|
2157
2221
|
setResizing(true);
|
|
2158
2222
|
if (resizeInterval.current) {
|
|
2159
2223
|
clearTimeout(resizeInterval.current);
|
|
@@ -2163,7 +2227,7 @@ var MainRoot = ({ navigationSidebarOpen: propsNavigationSidebarOpen, defaultNavi
|
|
|
2163
2227
|
resizeInterval.current = null;
|
|
2164
2228
|
}, resizeDebounce);
|
|
2165
2229
|
}, []);
|
|
2166
|
-
|
|
2230
|
+
useEffect5(() => {
|
|
2167
2231
|
window.addEventListener("resize", handleResize);
|
|
2168
2232
|
return () => window.removeEventListener("resize", handleResize);
|
|
2169
2233
|
}, [
|
|
@@ -2171,10 +2235,10 @@ var MainRoot = ({ navigationSidebarOpen: propsNavigationSidebarOpen, defaultNavi
|
|
|
2171
2235
|
]);
|
|
2172
2236
|
return /* @__PURE__ */ React28.createElement(MainProvider, {
|
|
2173
2237
|
...props,
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2238
|
+
navigationSidebarState,
|
|
2239
|
+
setNavigationSidebarState,
|
|
2240
|
+
complementarySidebarState,
|
|
2241
|
+
setComplementarySidebarState,
|
|
2178
2242
|
resizing
|
|
2179
2243
|
}, children);
|
|
2180
2244
|
};
|
|
@@ -2182,7 +2246,7 @@ MainRoot.displayName = MAIN_ROOT_NAME;
|
|
|
2182
2246
|
var handleOpenAutoFocus = (event) => {
|
|
2183
2247
|
!document.body.hasAttribute("data-is-keyboard") && event.preventDefault();
|
|
2184
2248
|
};
|
|
2185
|
-
var MainSidebar = /* @__PURE__ */ forwardRef20(({ classNames, children, swipeToDismiss, onOpenAutoFocus,
|
|
2249
|
+
var MainSidebar = /* @__PURE__ */ forwardRef20(({ classNames, children, swipeToDismiss, onOpenAutoFocus, state, resizing, onStateChange, side, ...props }, forwardedRef) => {
|
|
2186
2250
|
const [isLg] = useMediaQuery("lg", {
|
|
2187
2251
|
ssr: false
|
|
2188
2252
|
});
|
|
@@ -2190,9 +2254,9 @@ var MainSidebar = /* @__PURE__ */ forwardRef20(({ classNames, children, swipeToD
|
|
|
2190
2254
|
const ref = useForwardedRef(forwardedRef);
|
|
2191
2255
|
const noopRef = useRef2(null);
|
|
2192
2256
|
useSwipeToDismiss(swipeToDismiss ? ref : noopRef, {
|
|
2193
|
-
onDismiss: () =>
|
|
2257
|
+
onDismiss: () => onStateChange?.("closed")
|
|
2194
2258
|
});
|
|
2195
|
-
const handleKeyDown =
|
|
2259
|
+
const handleKeyDown = useCallback7((event) => {
|
|
2196
2260
|
if (event.key === "Escape") {
|
|
2197
2261
|
event.target.closest("[data-tabster]")?.focus();
|
|
2198
2262
|
}
|
|
@@ -2202,7 +2266,7 @@ var MainSidebar = /* @__PURE__ */ forwardRef20(({ classNames, children, swipeToD
|
|
|
2202
2266
|
]);
|
|
2203
2267
|
const Root5 = isLg ? Primitive9.div : DialogContent2;
|
|
2204
2268
|
return /* @__PURE__ */ React28.createElement(DialogRoot2, {
|
|
2205
|
-
open,
|
|
2269
|
+
open: state !== "closed",
|
|
2206
2270
|
modal: false
|
|
2207
2271
|
}, /* @__PURE__ */ React28.createElement(Root5, {
|
|
2208
2272
|
...!isLg && {
|
|
@@ -2212,24 +2276,24 @@ var MainSidebar = /* @__PURE__ */ forwardRef20(({ classNames, children, swipeToD
|
|
|
2212
2276
|
},
|
|
2213
2277
|
...props,
|
|
2214
2278
|
"data-side": side === "inline-end" ? "ie" : "is",
|
|
2215
|
-
"data-state":
|
|
2279
|
+
"data-state": state,
|
|
2216
2280
|
"data-resizing": resizing ? "true" : "false",
|
|
2217
2281
|
className: tx("main.sidebar", "main__sidebar", {}, classNames),
|
|
2218
2282
|
onKeyDown: handleKeyDown,
|
|
2219
|
-
|
|
2283
|
+
...state === "closed" && {
|
|
2220
2284
|
inert: "true"
|
|
2221
2285
|
},
|
|
2222
2286
|
ref
|
|
2223
2287
|
}, children));
|
|
2224
2288
|
});
|
|
2225
2289
|
var MainNavigationSidebar = /* @__PURE__ */ forwardRef20((props, forwardedRef) => {
|
|
2226
|
-
const {
|
|
2290
|
+
const { navigationSidebarState, setNavigationSidebarState, resizing } = useMainContext(NAVIGATION_SIDEBAR_NAME);
|
|
2227
2291
|
const mover = useLandmarkMover(props.onKeyDown, "0");
|
|
2228
2292
|
return /* @__PURE__ */ React28.createElement(MainSidebar, {
|
|
2229
2293
|
...mover,
|
|
2230
2294
|
...props,
|
|
2231
|
-
|
|
2232
|
-
|
|
2295
|
+
state: navigationSidebarState,
|
|
2296
|
+
onStateChange: setNavigationSidebarState,
|
|
2233
2297
|
resizing,
|
|
2234
2298
|
side: "inline-start",
|
|
2235
2299
|
ref: forwardedRef
|
|
@@ -2237,13 +2301,13 @@ var MainNavigationSidebar = /* @__PURE__ */ forwardRef20((props, forwardedRef) =
|
|
|
2237
2301
|
});
|
|
2238
2302
|
MainNavigationSidebar.displayName = NAVIGATION_SIDEBAR_NAME;
|
|
2239
2303
|
var MainComplementarySidebar = /* @__PURE__ */ forwardRef20((props, forwardedRef) => {
|
|
2240
|
-
const {
|
|
2304
|
+
const { complementarySidebarState, setComplementarySidebarState, resizing } = useMainContext(COMPLEMENTARY_SIDEBAR_NAME);
|
|
2241
2305
|
const mover = useLandmarkMover(props.onKeyDown, "2");
|
|
2242
2306
|
return /* @__PURE__ */ React28.createElement(MainSidebar, {
|
|
2243
2307
|
...mover,
|
|
2244
2308
|
...props,
|
|
2245
|
-
|
|
2246
|
-
|
|
2309
|
+
state: complementarySidebarState,
|
|
2310
|
+
onStateChange: setComplementarySidebarState,
|
|
2247
2311
|
resizing,
|
|
2248
2312
|
side: "inline-end",
|
|
2249
2313
|
ref: forwardedRef
|
|
@@ -2251,7 +2315,7 @@ var MainComplementarySidebar = /* @__PURE__ */ forwardRef20((props, forwardedRef
|
|
|
2251
2315
|
});
|
|
2252
2316
|
MainNavigationSidebar.displayName = NAVIGATION_SIDEBAR_NAME;
|
|
2253
2317
|
var MainContent = /* @__PURE__ */ forwardRef20(({ asChild, classNames, bounce, handlesFocus, children, role, ...props }, forwardedRef) => {
|
|
2254
|
-
const {
|
|
2318
|
+
const { navigationSidebarState, complementarySidebarState } = useMainContext(MAIN_NAME);
|
|
2255
2319
|
const { tx } = useThemeContext();
|
|
2256
2320
|
const Root5 = asChild ? Slot10 : role ? "div" : "main";
|
|
2257
2321
|
const mover = useLandmarkMover(props.onKeyDown, "1");
|
|
@@ -2261,8 +2325,8 @@ var MainContent = /* @__PURE__ */ forwardRef20(({ asChild, classNames, bounce, h
|
|
|
2261
2325
|
...mover
|
|
2262
2326
|
},
|
|
2263
2327
|
...props,
|
|
2264
|
-
"data-sidebar-inline-start-state":
|
|
2265
|
-
"data-sidebar-inline-end-state":
|
|
2328
|
+
"data-sidebar-inline-start-state": navigationSidebarState,
|
|
2329
|
+
"data-sidebar-inline-end-state": complementarySidebarState,
|
|
2266
2330
|
className: tx("main.content", "main", {
|
|
2267
2331
|
bounce,
|
|
2268
2332
|
handlesFocus
|
|
@@ -2275,55 +2339,30 @@ var MainOverlay = /* @__PURE__ */ forwardRef20(({ classNames, ...props }, forwar
|
|
|
2275
2339
|
const [isLg] = useMediaQuery("lg", {
|
|
2276
2340
|
ssr: false
|
|
2277
2341
|
});
|
|
2278
|
-
const {
|
|
2342
|
+
const { navigationSidebarState, setNavigationSidebarState, complementarySidebarState, setComplementarySidebarState } = useMainContext(MAIN_NAME);
|
|
2279
2343
|
const { tx } = useThemeContext();
|
|
2280
2344
|
return /* @__PURE__ */ React28.createElement("div", {
|
|
2281
2345
|
onClick: () => {
|
|
2282
|
-
|
|
2283
|
-
|
|
2346
|
+
setNavigationSidebarState("collapsed");
|
|
2347
|
+
setComplementarySidebarState("collapsed");
|
|
2284
2348
|
},
|
|
2285
2349
|
...props,
|
|
2286
2350
|
className: tx("main.overlay", "main__overlay", {
|
|
2287
2351
|
isLg,
|
|
2288
|
-
inlineStartSidebarOpen:
|
|
2289
|
-
inlineEndSidebarOpen:
|
|
2352
|
+
inlineStartSidebarOpen: navigationSidebarState,
|
|
2353
|
+
inlineEndSidebarOpen: complementarySidebarState
|
|
2290
2354
|
}, classNames),
|
|
2291
|
-
"data-state":
|
|
2355
|
+
"data-state": navigationSidebarState === "expanded" || complementarySidebarState === "expanded" ? "open" : "closed",
|
|
2292
2356
|
"aria-hidden": "true",
|
|
2293
2357
|
ref: forwardedRef
|
|
2294
2358
|
});
|
|
2295
2359
|
});
|
|
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
2360
|
var Main = {
|
|
2321
2361
|
Root: MainRoot,
|
|
2322
2362
|
Content: MainContent,
|
|
2323
2363
|
Overlay: MainOverlay,
|
|
2324
2364
|
NavigationSidebar: MainNavigationSidebar,
|
|
2325
|
-
ComplementarySidebar: MainComplementarySidebar
|
|
2326
|
-
Notch: MainNotch
|
|
2365
|
+
ComplementarySidebar: MainComplementarySidebar
|
|
2327
2366
|
};
|
|
2328
2367
|
|
|
2329
2368
|
// packages/ui/react-ui/src/components/Message/Message.tsx
|
|
@@ -2389,7 +2428,7 @@ var Message = {
|
|
|
2389
2428
|
|
|
2390
2429
|
// packages/ui/react-ui/src/components/Popover/Popover.tsx
|
|
2391
2430
|
import { composeEventHandlers as composeEventHandlers2 } from "@radix-ui/primitive";
|
|
2392
|
-
import { useComposedRefs
|
|
2431
|
+
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
2393
2432
|
import { createContextScope as createContextScope3 } from "@radix-ui/react-context";
|
|
2394
2433
|
import { DismissableLayer } from "@radix-ui/react-dismissable-layer";
|
|
2395
2434
|
import { useFocusGuards } from "@radix-ui/react-focus-guards";
|
|
@@ -2403,7 +2442,7 @@ import { Primitive as Primitive11 } from "@radix-ui/react-primitive";
|
|
|
2403
2442
|
import { Slot as Slot12 } from "@radix-ui/react-slot";
|
|
2404
2443
|
import { useControllableState as useControllableState5 } from "@radix-ui/react-use-controllable-state";
|
|
2405
2444
|
import { hideOthers } from "aria-hidden";
|
|
2406
|
-
import React30, { forwardRef as forwardRef22, useRef as useRef3, useCallback as
|
|
2445
|
+
import React30, { forwardRef as forwardRef22, useRef as useRef3, useCallback as useCallback8, useState as useState9, useEffect as useEffect6 } from "react";
|
|
2407
2446
|
import { RemoveScroll } from "react-remove-scroll";
|
|
2408
2447
|
var POPOVER_NAME = "Popover";
|
|
2409
2448
|
var [createPopoverContext, createPopoverScope] = createContextScope3(POPOVER_NAME, [
|
|
@@ -2415,7 +2454,7 @@ var PopoverRoot = (props) => {
|
|
|
2415
2454
|
const { __scopePopover, children, open: openProp, defaultOpen, onOpenChange, modal = false } = props;
|
|
2416
2455
|
const popperScope = usePopperScope(__scopePopover);
|
|
2417
2456
|
const triggerRef = useRef3(null);
|
|
2418
|
-
const [hasCustomAnchor, setHasCustomAnchor] =
|
|
2457
|
+
const [hasCustomAnchor, setHasCustomAnchor] = useState9(false);
|
|
2419
2458
|
const [open = false, setOpen] = useControllableState5({
|
|
2420
2459
|
prop: openProp,
|
|
2421
2460
|
defaultProp: defaultOpen,
|
|
@@ -2427,12 +2466,12 @@ var PopoverRoot = (props) => {
|
|
|
2427
2466
|
triggerRef,
|
|
2428
2467
|
open,
|
|
2429
2468
|
onOpenChange: setOpen,
|
|
2430
|
-
onOpenToggle:
|
|
2469
|
+
onOpenToggle: useCallback8(() => setOpen((prevOpen) => !prevOpen), [
|
|
2431
2470
|
setOpen
|
|
2432
2471
|
]),
|
|
2433
2472
|
hasCustomAnchor,
|
|
2434
|
-
onCustomAnchorAdd:
|
|
2435
|
-
onCustomAnchorRemove:
|
|
2473
|
+
onCustomAnchorAdd: useCallback8(() => setHasCustomAnchor(true), []),
|
|
2474
|
+
onCustomAnchorRemove: useCallback8(() => setHasCustomAnchor(false), []),
|
|
2436
2475
|
modal
|
|
2437
2476
|
}, children));
|
|
2438
2477
|
};
|
|
@@ -2443,7 +2482,7 @@ var PopoverAnchor = /* @__PURE__ */ forwardRef22((props, forwardedRef) => {
|
|
|
2443
2482
|
const context = usePopoverContext(ANCHOR_NAME, __scopePopover);
|
|
2444
2483
|
const popperScope = usePopperScope(__scopePopover);
|
|
2445
2484
|
const { onCustomAnchorAdd, onCustomAnchorRemove } = context;
|
|
2446
|
-
|
|
2485
|
+
useEffect6(() => {
|
|
2447
2486
|
onCustomAnchorAdd();
|
|
2448
2487
|
return () => onCustomAnchorRemove();
|
|
2449
2488
|
}, [
|
|
@@ -2462,7 +2501,7 @@ var PopoverTrigger = /* @__PURE__ */ forwardRef22((props, forwardedRef) => {
|
|
|
2462
2501
|
const { __scopePopover, ...triggerProps } = props;
|
|
2463
2502
|
const context = usePopoverContext(TRIGGER_NAME2, __scopePopover);
|
|
2464
2503
|
const popperScope = usePopperScope(__scopePopover);
|
|
2465
|
-
const composedTriggerRef =
|
|
2504
|
+
const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
|
|
2466
2505
|
const trigger = /* @__PURE__ */ React30.createElement(Primitive11.button, {
|
|
2467
2506
|
type: "button",
|
|
2468
2507
|
"aria-haspopup": "dialog",
|
|
@@ -2484,7 +2523,7 @@ var PopoverVirtualTrigger = (props) => {
|
|
|
2484
2523
|
const { __scopePopover, virtualRef } = props;
|
|
2485
2524
|
const context = usePopoverContext(VIRTUAL_TRIGGER_NAME2, __scopePopover);
|
|
2486
2525
|
const popperScope = usePopperScope(__scopePopover);
|
|
2487
|
-
|
|
2526
|
+
useEffect6(() => {
|
|
2488
2527
|
if (virtualRef.current) {
|
|
2489
2528
|
context.triggerRef.current = virtualRef.current;
|
|
2490
2529
|
}
|
|
@@ -2532,9 +2571,9 @@ PopoverContent.displayName = CONTENT_NAME2;
|
|
|
2532
2571
|
var PopoverContentModal = /* @__PURE__ */ forwardRef22((props, forwardedRef) => {
|
|
2533
2572
|
const context = usePopoverContext(CONTENT_NAME2, props.__scopePopover);
|
|
2534
2573
|
const contentRef = useRef3(null);
|
|
2535
|
-
const composedRefs =
|
|
2574
|
+
const composedRefs = useComposedRefs(forwardedRef, contentRef);
|
|
2536
2575
|
const isRightClickOutsideRef = useRef3(false);
|
|
2537
|
-
|
|
2576
|
+
useEffect6(() => {
|
|
2538
2577
|
const content = contentRef.current;
|
|
2539
2578
|
if (content) {
|
|
2540
2579
|
return hideOthers(content);
|
|
@@ -2611,11 +2650,12 @@ var PopoverContentNonModal = /* @__PURE__ */ forwardRef22((props, forwardedRef)
|
|
|
2611
2650
|
});
|
|
2612
2651
|
});
|
|
2613
2652
|
var PopoverContentImpl = /* @__PURE__ */ forwardRef22((props, forwardedRef) => {
|
|
2614
|
-
const { __scopePopover, trapFocus, onOpenAutoFocus, onCloseAutoFocus, disableOutsidePointerEvents, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, classNames, ...contentProps } = props;
|
|
2653
|
+
const { __scopePopover, trapFocus, onOpenAutoFocus, onCloseAutoFocus, disableOutsidePointerEvents, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, collisionPadding = 8, classNames, ...contentProps } = props;
|
|
2615
2654
|
const context = usePopoverContext(CONTENT_NAME2, __scopePopover);
|
|
2616
2655
|
const popperScope = usePopperScope(__scopePopover);
|
|
2617
2656
|
const { tx } = useThemeContext();
|
|
2618
2657
|
const elevation = useElevationContext();
|
|
2658
|
+
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
2619
2659
|
useFocusGuards();
|
|
2620
2660
|
return /* @__PURE__ */ React30.createElement(FocusScope, {
|
|
2621
2661
|
asChild: true,
|
|
@@ -2637,6 +2677,7 @@ var PopoverContentImpl = /* @__PURE__ */ forwardRef22((props, forwardedRef) => {
|
|
|
2637
2677
|
id: context.contentId,
|
|
2638
2678
|
...popperScope,
|
|
2639
2679
|
...contentProps,
|
|
2680
|
+
collisionPadding: safeCollisionPadding,
|
|
2640
2681
|
className: tx("popover.content", "popover", {
|
|
2641
2682
|
elevation
|
|
2642
2683
|
}, classNames),
|
|
@@ -2807,11 +2848,13 @@ var SelectTriggerButton = /* @__PURE__ */ forwardRef25(({ children, placeholder,
|
|
|
2807
2848
|
weight: "bold"
|
|
2808
2849
|
}))));
|
|
2809
2850
|
});
|
|
2810
|
-
var SelectContent = /* @__PURE__ */ forwardRef25(({ classNames, children, ...props }, forwardedRef) => {
|
|
2851
|
+
var SelectContent = /* @__PURE__ */ forwardRef25(({ classNames, children, collisionPadding = 8, ...props }, forwardedRef) => {
|
|
2811
2852
|
const { tx } = useThemeContext();
|
|
2812
2853
|
const elevation = useElevationContext();
|
|
2854
|
+
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
2813
2855
|
return /* @__PURE__ */ React33.createElement(SelectPrimitive.Content, {
|
|
2814
2856
|
...props,
|
|
2857
|
+
collisionPadding: safeCollisionPadding,
|
|
2815
2858
|
className: tx("select.content", "select__content", {
|
|
2816
2859
|
elevation
|
|
2817
2860
|
}, classNames),
|
|
@@ -2917,30 +2960,32 @@ var Select = {
|
|
|
2917
2960
|
|
|
2918
2961
|
// packages/ui/react-ui/src/components/Separator/Separator.tsx
|
|
2919
2962
|
import { Separator as SeparatorPrimitive } from "@radix-ui/react-separator";
|
|
2920
|
-
import React34 from "react";
|
|
2921
|
-
var Separator4 = ({ classNames, orientation = "horizontal", ...props }) => {
|
|
2963
|
+
import React34, { forwardRef as forwardRef26 } from "react";
|
|
2964
|
+
var Separator4 = /* @__PURE__ */ forwardRef26(({ classNames, orientation = "horizontal", ...props }, forwardedRef) => {
|
|
2922
2965
|
const { tx } = useThemeContext();
|
|
2923
2966
|
return /* @__PURE__ */ React34.createElement(SeparatorPrimitive, {
|
|
2924
2967
|
orientation,
|
|
2925
2968
|
...props,
|
|
2926
2969
|
className: tx("separator.root", "separator", {
|
|
2927
2970
|
orientation
|
|
2928
|
-
}, classNames)
|
|
2971
|
+
}, classNames),
|
|
2972
|
+
ref: forwardedRef
|
|
2929
2973
|
});
|
|
2930
|
-
};
|
|
2974
|
+
});
|
|
2931
2975
|
|
|
2932
2976
|
// packages/ui/react-ui/src/components/Tag/Tag.tsx
|
|
2933
2977
|
import { Primitive as Primitive12 } from "@radix-ui/react-primitive";
|
|
2934
2978
|
import { Slot as Slot13 } from "@radix-ui/react-slot";
|
|
2935
|
-
import React35, { forwardRef as
|
|
2936
|
-
var Tag = /* @__PURE__ */
|
|
2979
|
+
import React35, { forwardRef as forwardRef27 } from "react";
|
|
2980
|
+
var Tag = /* @__PURE__ */ forwardRef27(({ asChild, palette = "neutral", classNames, ...props }, forwardedRef) => {
|
|
2937
2981
|
const { tx } = useThemeContext();
|
|
2938
2982
|
const Root5 = asChild ? Slot13 : Primitive12.span;
|
|
2939
2983
|
return /* @__PURE__ */ React35.createElement(Root5, {
|
|
2940
2984
|
...props,
|
|
2941
|
-
className: tx("tag.root", "tag", {
|
|
2985
|
+
className: tx("tag.root", "dx-tag", {
|
|
2942
2986
|
palette
|
|
2943
2987
|
}, classNames),
|
|
2988
|
+
"data-hue": palette,
|
|
2944
2989
|
ref: forwardedRef
|
|
2945
2990
|
});
|
|
2946
2991
|
});
|
|
@@ -2949,16 +2994,16 @@ var Tag = /* @__PURE__ */ forwardRef26(({ asChild, palette, classNames, ...props
|
|
|
2949
2994
|
import { Primitive as Primitive13 } from "@radix-ui/react-primitive";
|
|
2950
2995
|
import { Slot as Slot14 } from "@radix-ui/react-slot";
|
|
2951
2996
|
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
|
|
2997
|
+
import React36, { forwardRef as forwardRef28 } from "react";
|
|
2953
2998
|
var ToastProvider = ToastProviderPrimitive;
|
|
2954
|
-
var ToastViewport = /* @__PURE__ */
|
|
2999
|
+
var ToastViewport = /* @__PURE__ */ forwardRef28(({ classNames, ...props }, forwardedRef) => {
|
|
2955
3000
|
const { tx } = useThemeContext();
|
|
2956
3001
|
return /* @__PURE__ */ React36.createElement(ToastViewportPrimitive, {
|
|
2957
3002
|
className: tx("toast.viewport", "toast-viewport", {}, classNames),
|
|
2958
3003
|
ref: forwardedRef
|
|
2959
3004
|
});
|
|
2960
3005
|
});
|
|
2961
|
-
var ToastRoot = /* @__PURE__ */
|
|
3006
|
+
var ToastRoot = /* @__PURE__ */ forwardRef28(({ classNames, children, ...props }, forwardedRef) => {
|
|
2962
3007
|
const { tx } = useThemeContext();
|
|
2963
3008
|
return /* @__PURE__ */ React36.createElement(ToastRootPrimitive, {
|
|
2964
3009
|
...props,
|
|
@@ -2968,7 +3013,7 @@ var ToastRoot = /* @__PURE__ */ forwardRef27(({ classNames, children, ...props }
|
|
|
2968
3013
|
elevation: "toast"
|
|
2969
3014
|
}, children));
|
|
2970
3015
|
});
|
|
2971
|
-
var ToastBody = /* @__PURE__ */
|
|
3016
|
+
var ToastBody = /* @__PURE__ */ forwardRef28(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
2972
3017
|
const { tx } = useThemeContext();
|
|
2973
3018
|
const Root5 = asChild ? Slot14 : Primitive13.div;
|
|
2974
3019
|
return /* @__PURE__ */ React36.createElement(Root5, {
|
|
@@ -2977,7 +3022,7 @@ var ToastBody = /* @__PURE__ */ forwardRef27(({ asChild, classNames, ...props },
|
|
|
2977
3022
|
ref: forwardedRef
|
|
2978
3023
|
});
|
|
2979
3024
|
});
|
|
2980
|
-
var ToastTitle = /* @__PURE__ */
|
|
3025
|
+
var ToastTitle = /* @__PURE__ */ forwardRef28(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
2981
3026
|
const { tx } = useThemeContext();
|
|
2982
3027
|
const Root5 = asChild ? Slot14 : ToastTitlePrimitive;
|
|
2983
3028
|
return /* @__PURE__ */ React36.createElement(Root5, {
|
|
@@ -2986,7 +3031,7 @@ var ToastTitle = /* @__PURE__ */ forwardRef27(({ asChild, classNames, ...props }
|
|
|
2986
3031
|
ref: forwardedRef
|
|
2987
3032
|
});
|
|
2988
3033
|
});
|
|
2989
|
-
var ToastDescription = /* @__PURE__ */
|
|
3034
|
+
var ToastDescription = /* @__PURE__ */ forwardRef28(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
2990
3035
|
const { tx } = useThemeContext();
|
|
2991
3036
|
const Root5 = asChild ? Slot14 : ToastDescriptionPrimitive;
|
|
2992
3037
|
return /* @__PURE__ */ React36.createElement(Root5, {
|
|
@@ -2995,7 +3040,7 @@ var ToastDescription = /* @__PURE__ */ forwardRef27(({ asChild, classNames, ...p
|
|
|
2995
3040
|
ref: forwardedRef
|
|
2996
3041
|
});
|
|
2997
3042
|
});
|
|
2998
|
-
var ToastActions = /* @__PURE__ */
|
|
3043
|
+
var ToastActions = /* @__PURE__ */ forwardRef28(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
2999
3044
|
const { tx } = useThemeContext();
|
|
3000
3045
|
const Root5 = asChild ? Slot14 : Primitive13.div;
|
|
3001
3046
|
return /* @__PURE__ */ React36.createElement(Root5, {
|
|
@@ -3020,8 +3065,8 @@ var Toast = {
|
|
|
3020
3065
|
|
|
3021
3066
|
// packages/ui/react-ui/src/components/Toolbar/Toolbar.tsx
|
|
3022
3067
|
import * as ToolbarPrimitive from "@radix-ui/react-toolbar";
|
|
3023
|
-
import React37, { forwardRef as
|
|
3024
|
-
var ToolbarRoot = /* @__PURE__ */
|
|
3068
|
+
import React37, { forwardRef as forwardRef29 } from "react";
|
|
3069
|
+
var ToolbarRoot = /* @__PURE__ */ forwardRef29(({ classNames, children, ...props }, forwardedRef) => {
|
|
3025
3070
|
const { tx } = useThemeContext();
|
|
3026
3071
|
return /* @__PURE__ */ React37.createElement(ToolbarPrimitive.Root, {
|
|
3027
3072
|
...props,
|
|
@@ -3029,7 +3074,7 @@ var ToolbarRoot = /* @__PURE__ */ forwardRef28(({ classNames, children, ...props
|
|
|
3029
3074
|
ref: forwardedRef
|
|
3030
3075
|
}, children);
|
|
3031
3076
|
});
|
|
3032
|
-
var ToolbarButton = /* @__PURE__ */
|
|
3077
|
+
var ToolbarButton = /* @__PURE__ */ forwardRef29((props, forwardedRef) => {
|
|
3033
3078
|
return /* @__PURE__ */ React37.createElement(ToolbarPrimitive.Button, {
|
|
3034
3079
|
asChild: true
|
|
3035
3080
|
}, /* @__PURE__ */ React37.createElement(Button, {
|
|
@@ -3037,7 +3082,15 @@ var ToolbarButton = /* @__PURE__ */ forwardRef28((props, forwardedRef) => {
|
|
|
3037
3082
|
ref: forwardedRef
|
|
3038
3083
|
}));
|
|
3039
3084
|
});
|
|
3040
|
-
var
|
|
3085
|
+
var ToolbarIconButton = /* @__PURE__ */ forwardRef29((props, forwardedRef) => {
|
|
3086
|
+
return /* @__PURE__ */ React37.createElement(ToolbarPrimitive.Button, {
|
|
3087
|
+
asChild: true
|
|
3088
|
+
}, /* @__PURE__ */ React37.createElement(IconButton, {
|
|
3089
|
+
...props,
|
|
3090
|
+
ref: forwardedRef
|
|
3091
|
+
}));
|
|
3092
|
+
});
|
|
3093
|
+
var ToolbarToggle = /* @__PURE__ */ forwardRef29((props, forwardedRef) => {
|
|
3041
3094
|
return /* @__PURE__ */ React37.createElement(ToolbarPrimitive.Button, {
|
|
3042
3095
|
asChild: true
|
|
3043
3096
|
}, /* @__PURE__ */ React37.createElement(Toggle, {
|
|
@@ -3045,7 +3098,7 @@ var ToolbarToggle = /* @__PURE__ */ forwardRef28((props, forwardedRef) => {
|
|
|
3045
3098
|
ref: forwardedRef
|
|
3046
3099
|
}));
|
|
3047
3100
|
});
|
|
3048
|
-
var ToolbarLink = /* @__PURE__ */
|
|
3101
|
+
var ToolbarLink = /* @__PURE__ */ forwardRef29((props, forwardedRef) => {
|
|
3049
3102
|
return /* @__PURE__ */ React37.createElement(ToolbarPrimitive.Link, {
|
|
3050
3103
|
asChild: true
|
|
3051
3104
|
}, /* @__PURE__ */ React37.createElement(Link, {
|
|
@@ -3053,7 +3106,7 @@ var ToolbarLink = /* @__PURE__ */ forwardRef28((props, forwardedRef) => {
|
|
|
3053
3106
|
ref: forwardedRef
|
|
3054
3107
|
}));
|
|
3055
3108
|
});
|
|
3056
|
-
var ToolbarToggleGroup2 = /* @__PURE__ */
|
|
3109
|
+
var ToolbarToggleGroup2 = /* @__PURE__ */ forwardRef29(({ classNames, children, elevation, ...props }, forwardedRef) => {
|
|
3057
3110
|
return /* @__PURE__ */ React37.createElement(ToolbarPrimitive.ToolbarToggleGroup, {
|
|
3058
3111
|
...props,
|
|
3059
3112
|
asChild: true
|
|
@@ -3064,7 +3117,7 @@ var ToolbarToggleGroup2 = /* @__PURE__ */ forwardRef28(({ classNames, children,
|
|
|
3064
3117
|
ref: forwardedRef
|
|
3065
3118
|
}));
|
|
3066
3119
|
});
|
|
3067
|
-
var ToolbarToggleGroupItem = /* @__PURE__ */
|
|
3120
|
+
var ToolbarToggleGroupItem = /* @__PURE__ */ forwardRef29(({ variant, density, elevation, classNames, children, ...props }, forwardedRef) => {
|
|
3068
3121
|
return /* @__PURE__ */ React37.createElement(ToolbarPrimitive.ToolbarToggleItem, {
|
|
3069
3122
|
...props,
|
|
3070
3123
|
asChild: true
|
|
@@ -3077,26 +3130,42 @@ var ToolbarToggleGroupItem = /* @__PURE__ */ forwardRef28(({ variant, density, e
|
|
|
3077
3130
|
ref: forwardedRef
|
|
3078
3131
|
}));
|
|
3079
3132
|
});
|
|
3080
|
-
var
|
|
3081
|
-
return /* @__PURE__ */ React37.createElement(ToolbarPrimitive.
|
|
3133
|
+
var ToolbarToggleGroupIconItem = /* @__PURE__ */ forwardRef29(({ variant, density, elevation, classNames, icon, label, iconOnly, ...props }, forwardedRef) => {
|
|
3134
|
+
return /* @__PURE__ */ React37.createElement(ToolbarPrimitive.ToolbarToggleItem, {
|
|
3135
|
+
...props,
|
|
3082
3136
|
asChild: true
|
|
3083
|
-
}, /* @__PURE__ */ React37.createElement(
|
|
3084
|
-
|
|
3085
|
-
|
|
3137
|
+
}, /* @__PURE__ */ React37.createElement(IconButton, {
|
|
3138
|
+
variant,
|
|
3139
|
+
density,
|
|
3140
|
+
elevation,
|
|
3141
|
+
classNames,
|
|
3142
|
+
icon,
|
|
3143
|
+
label,
|
|
3144
|
+
iconOnly,
|
|
3145
|
+
ref: forwardedRef
|
|
3086
3146
|
}));
|
|
3087
|
-
};
|
|
3088
|
-
var
|
|
3089
|
-
|
|
3147
|
+
});
|
|
3148
|
+
var ToolbarSeparator = /* @__PURE__ */ forwardRef29(({ variant = "line", ...props }, forwardedRef) => {
|
|
3149
|
+
return variant === "line" ? /* @__PURE__ */ React37.createElement(ToolbarPrimitive.Separator, {
|
|
3150
|
+
asChild: true
|
|
3151
|
+
}, /* @__PURE__ */ React37.createElement(Separator4, {
|
|
3152
|
+
...props,
|
|
3153
|
+
ref: forwardedRef
|
|
3154
|
+
})) : /* @__PURE__ */ React37.createElement(ToolbarPrimitive.Separator, {
|
|
3155
|
+
className: "grow",
|
|
3156
|
+
ref: forwardedRef
|
|
3157
|
+
});
|
|
3090
3158
|
});
|
|
3091
3159
|
var Toolbar = {
|
|
3092
3160
|
Root: ToolbarRoot,
|
|
3093
3161
|
Button: ToolbarButton,
|
|
3162
|
+
IconButton: ToolbarIconButton,
|
|
3094
3163
|
Link: ToolbarLink,
|
|
3095
3164
|
Toggle: ToolbarToggle,
|
|
3096
3165
|
ToggleGroup: ToolbarToggleGroup2,
|
|
3097
3166
|
ToggleGroupItem: ToolbarToggleGroupItem,
|
|
3098
|
-
|
|
3099
|
-
|
|
3167
|
+
ToggleGroupIconItem: ToolbarToggleGroupIconItem,
|
|
3168
|
+
Separator: ToolbarSeparator
|
|
3100
3169
|
};
|
|
3101
3170
|
export {
|
|
3102
3171
|
AlertDialog,
|
|
@@ -3147,6 +3216,7 @@ export {
|
|
|
3147
3216
|
createDropdownMenuScope,
|
|
3148
3217
|
createPopoverScope,
|
|
3149
3218
|
hasIosKeyboard,
|
|
3219
|
+
initialSafeArea,
|
|
3150
3220
|
isLabel,
|
|
3151
3221
|
toLocalizedString,
|
|
3152
3222
|
useAvatarContext,
|
|
@@ -3156,9 +3226,11 @@ export {
|
|
|
3156
3226
|
useDropdownMenuContext,
|
|
3157
3227
|
useDropdownMenuMenuScope,
|
|
3158
3228
|
useElevationContext,
|
|
3229
|
+
useLandmarkMover,
|
|
3159
3230
|
useListContext,
|
|
3160
3231
|
useListItemContext,
|
|
3161
3232
|
useMainContext,
|
|
3233
|
+
useSafeArea,
|
|
3162
3234
|
useSidebars,
|
|
3163
3235
|
useThemeContext,
|
|
3164
3236
|
useTranslation,
|