@dxos/react-ui 0.8.1 → 0.8.2-main.10c050d
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/chunk-5Y5JI6KC.mjs +4355 -0
- package/dist/lib/browser/chunk-5Y5JI6KC.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +75 -2986
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +85 -0
- package/dist/lib/browser/testing/index.mjs.map +7 -0
- package/dist/lib/node/chunk-KMS7RFL7.cjs +4340 -0
- package/dist/lib/node/chunk-KMS7RFL7.cjs.map +7 -0
- package/dist/lib/node/index.cjs +71 -2946
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +114 -0
- package/dist/lib/node/testing/index.cjs.map +7 -0
- package/dist/lib/node-esm/chunk-ANVE7WX5.mjs +4357 -0
- package/dist/lib/node-esm/chunk-ANVE7WX5.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +74 -2986
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +86 -0
- package/dist/lib/node-esm/testing/index.mjs.map +7 -0
- package/dist/types/src/components/Avatars/Avatar.d.ts +4 -4
- package/dist/types/src/components/Avatars/Avatar.d.ts.map +1 -1
- package/dist/types/src/components/Avatars/Avatar.stories.d.ts +3 -3
- package/dist/types/src/components/Avatars/Avatar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts +0 -1
- package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/Button.stories.d.ts +10 -44
- package/dist/types/src/components/Buttons/Button.stories.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/IconButton.d.ts +4 -6
- package/dist/types/src/components/Buttons/IconButton.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/IconButton.stories.d.ts +7 -6
- package/dist/types/src/components/Buttons/IconButton.stories.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/Toggle.stories.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts +1 -4
- package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts.map +1 -1
- package/dist/types/src/components/Clipboard/ClipboardProvider.d.ts.map +1 -1
- package/dist/types/src/components/Clipboard/CopyButton.d.ts +2 -1
- package/dist/types/src/components/Clipboard/CopyButton.d.ts.map +1 -1
- package/dist/types/src/components/Clipboard/index.d.ts +2 -2
- package/dist/types/src/components/DensityProvider/DensityProvider.d.ts.map +1 -1
- package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts +2 -2
- package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/Dialogs/Dialog.d.ts +2 -2
- package/dist/types/src/components/Dialogs/Dialog.d.ts.map +1 -1
- package/dist/types/src/components/Dialogs/Dialog.stories.d.ts +2 -2
- package/dist/types/src/components/Dialogs/Dialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/ElevationProvider/ElevationProvider.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.d.ts +1 -1
- package/dist/types/src/components/Input/Input.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.stories.d.ts +33 -159
- package/dist/types/src/components/Input/Input.stories.d.ts.map +1 -1
- package/dist/types/src/components/Lists/ListDropIndicator.d.ts.map +1 -1
- package/dist/types/src/components/Lists/Tree.stories.d.ts.map +1 -1
- package/dist/types/src/components/Lists/TreeDropIndicator.d.ts.map +1 -1
- package/dist/types/src/components/Lists/Treegrid.stories.d.ts +1 -1
- package/dist/types/src/components/Lists/Treegrid.stories.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.stories.d.ts.map +1 -1
- package/dist/types/src/components/Main/useSwipeToDismiss.d.ts.map +1 -1
- package/dist/types/src/components/Message/Message.stories.d.ts +8 -2
- package/dist/types/src/components/Message/Message.stories.d.ts.map +1 -1
- package/dist/types/src/components/Popover/Popover.d.ts +15 -6
- package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
- package/dist/types/src/components/Popover/Popover.stories.d.ts +5 -1
- package/dist/types/src/components/Popover/Popover.stories.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts.map +1 -1
- package/dist/types/src/components/Status/Status.stories.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts +1 -1
- package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts.map +1 -1
- package/dist/types/src/components/Toast/Toast.stories.d.ts +2 -2
- package/dist/types/src/components/Toast/Toast.stories.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.d.ts +92 -20
- package/dist/types/src/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts +40 -17
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useDensityContext.d.ts.map +1 -1
- package/dist/types/src/hooks/useElevationContext.d.ts.map +1 -1
- package/dist/types/src/hooks/useIconHref.d.ts.map +1 -1
- package/dist/types/src/hooks/useSafeCollisionPadding.d.ts.map +1 -1
- package/dist/types/src/hooks/useVisualViewport.d.ts.map +1 -1
- package/dist/types/src/playground/Controls.stories.d.ts +1 -1
- package/dist/types/src/playground/Controls.stories.d.ts.map +1 -1
- package/dist/types/src/playground/Custom.stories.d.ts +8 -0
- package/dist/types/src/playground/Custom.stories.d.ts.map +1 -0
- package/dist/types/src/testing/decorators/index.d.ts +1 -1
- package/dist/types/src/testing/decorators/index.d.ts.map +1 -1
- package/dist/types/src/testing/decorators/{withVariants.d.ts → withSurfaceVariantsLayout.d.ts} +2 -3
- package/dist/types/src/testing/decorators/withSurfaceVariantsLayout.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +25 -15
- package/src/components/Avatars/Avatar.stories.tsx +27 -27
- package/src/components/Avatars/Avatar.tsx +24 -21
- package/src/components/Avatars/AvatarGroup.stories.tsx +4 -5
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +2 -2
- package/src/components/Buttons/Button.stories.tsx +20 -15
- package/src/components/Buttons/IconButton.stories.tsx +9 -10
- package/src/components/Buttons/IconButton.tsx +9 -38
- package/src/components/Buttons/Toggle.stories.tsx +2 -2
- package/src/components/Buttons/ToggleGroup.stories.tsx +3 -7
- package/src/components/Clipboard/CopyButton.tsx +22 -24
- package/src/components/Dialogs/AlertDialog.stories.tsx +4 -11
- package/src/components/Dialogs/Dialog.stories.tsx +3 -3
- package/src/components/Dialogs/Dialog.tsx +8 -4
- package/src/components/Input/Input.stories.tsx +69 -58
- package/src/components/Input/Input.tsx +1 -0
- package/src/components/Lists/Tree.stories.tsx +2 -2
- package/src/components/Lists/Treegrid.stories.tsx +12 -12
- package/src/components/Main/Main.stories.tsx +2 -2
- package/src/components/Main/Main.tsx +1 -0
- package/src/components/Menus/ContextMenu.stories.tsx +2 -2
- package/src/components/Menus/DropdownMenu.stories.tsx +2 -2
- package/src/components/Message/Message.stories.tsx +10 -4
- package/src/components/Popover/Popover.stories.tsx +2 -2
- package/src/components/Popover/Popover.tsx +8 -4
- package/src/components/ScrollArea/ScrollArea.stories.tsx +4 -4
- package/src/components/ScrollArea/ScrollArea.tsx +3 -0
- package/src/components/Select/Select.stories.tsx +2 -2
- package/src/components/Toast/Toast.stories.tsx +15 -10
- package/src/components/Toolbar/Toolbar.stories.tsx +2 -2
- package/src/components/Tooltip/Tooltip.stories.tsx +43 -18
- package/src/components/Tooltip/Tooltip.tsx +733 -58
- package/src/components/index.ts +1 -1
- package/src/playground/Controls.stories.tsx +4 -4
- package/src/playground/Custom.stories.tsx +137 -0
- package/src/playground/Typography.stories.tsx +2 -2
- package/src/testing/decorators/index.ts +1 -1
- package/src/testing/decorators/withSurfaceVariantsLayout.tsx +53 -0
- package/dist/types/src/testing/decorators/withVariants.d.ts.map +0 -1
- package/src/testing/decorators/withVariants.tsx +0 -45
|
@@ -1,2991 +1,78 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AlertDialog,
|
|
3
|
+
AnchoredOverflow,
|
|
4
|
+
Avatar,
|
|
5
|
+
BUTTON_GROUP_NAME,
|
|
6
|
+
Breadcrumb,
|
|
7
|
+
Button,
|
|
8
|
+
ButtonGroup,
|
|
9
|
+
Clipboard,
|
|
10
|
+
ContextMenu,
|
|
11
|
+
DensityContext,
|
|
12
|
+
DensityProvider,
|
|
13
|
+
Dialog,
|
|
14
|
+
DropdownMenu,
|
|
15
|
+
ElevationContext,
|
|
16
|
+
ElevationProvider,
|
|
17
|
+
Icon,
|
|
18
|
+
IconButton,
|
|
19
|
+
Input,
|
|
20
|
+
LIST_ITEM_NAME,
|
|
21
|
+
LIST_NAME,
|
|
22
|
+
Link,
|
|
23
|
+
List,
|
|
24
|
+
ListItem,
|
|
25
|
+
Main,
|
|
26
|
+
Message,
|
|
27
|
+
Popover,
|
|
28
|
+
ScrollArea,
|
|
29
|
+
Select,
|
|
30
|
+
Separator,
|
|
31
|
+
Status,
|
|
32
|
+
Tag,
|
|
33
|
+
ThemeContext,
|
|
34
|
+
ThemeProvider,
|
|
35
|
+
Toast,
|
|
36
|
+
Toggle,
|
|
37
|
+
ToggleGroup,
|
|
38
|
+
ToggleGroupItem,
|
|
39
|
+
Toolbar,
|
|
40
|
+
Tooltip,
|
|
41
|
+
Tree,
|
|
42
|
+
TreeItem,
|
|
43
|
+
Treegrid,
|
|
44
|
+
createDropdownMenuScope,
|
|
45
|
+
createPopoverScope,
|
|
46
|
+
createTooltipScope,
|
|
47
|
+
hasIosKeyboard,
|
|
48
|
+
initialSafeArea,
|
|
49
|
+
isLabel,
|
|
50
|
+
toLocalizedString,
|
|
51
|
+
useAvatarContext,
|
|
52
|
+
useButtonGroupContext,
|
|
53
|
+
useClipboard,
|
|
54
|
+
useDensityContext,
|
|
55
|
+
useDropdownMenuContext,
|
|
56
|
+
useDropdownMenuMenuScope,
|
|
57
|
+
useElevationContext,
|
|
58
|
+
useIconHref,
|
|
59
|
+
useLandmarkMover,
|
|
60
|
+
useListContext,
|
|
61
|
+
useListItemContext,
|
|
62
|
+
useMainContext,
|
|
63
|
+
useSafeArea,
|
|
64
|
+
useSidebars,
|
|
65
|
+
useThemeContext,
|
|
66
|
+
useTooltipContext,
|
|
67
|
+
useTranslation,
|
|
68
|
+
useTranslationsContext,
|
|
69
|
+
useVisualViewport
|
|
70
|
+
} from "./chunk-5Y5JI6KC.mjs";
|
|
71
|
+
|
|
1
72
|
// packages/ui/react-ui/src/index.ts
|
|
2
73
|
import { Trans } from "react-i18next";
|
|
3
74
|
export * from "@dxos/react-hooks";
|
|
4
75
|
export * from "@dxos/react-ui-types";
|
|
5
|
-
|
|
6
|
-
// packages/ui/react-ui/src/components/AnchoredOverflow/AnchoredOverflow.tsx
|
|
7
|
-
import { Primitive } from "@radix-ui/react-primitive";
|
|
8
|
-
import { Slot } from "@radix-ui/react-slot";
|
|
9
|
-
import React2, { forwardRef } from "react";
|
|
10
|
-
|
|
11
|
-
// packages/ui/react-ui/src/hooks/useDensityContext.ts
|
|
12
|
-
import { useContext } from "react";
|
|
13
|
-
var useDensityContext = (propsDensity) => {
|
|
14
|
-
const { density } = useContext(DensityContext);
|
|
15
|
-
return propsDensity ?? density;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
// packages/ui/react-ui/src/hooks/useElevationContext.ts
|
|
19
|
-
import { useContext as useContext2 } from "react";
|
|
20
|
-
var useElevationContext = (propsElevation) => {
|
|
21
|
-
const { elevation } = useContext2(ElevationContext);
|
|
22
|
-
return propsElevation ?? elevation;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
// packages/ui/react-ui/src/hooks/useThemeContext.ts
|
|
26
|
-
import { useContext as useContext3 } from "react";
|
|
27
|
-
import { raise } from "@dxos/debug";
|
|
28
|
-
var useThemeContext = () => useContext3(ThemeContext) ?? raise(new Error("Missing ThemeContext"));
|
|
29
|
-
|
|
30
|
-
// packages/ui/react-ui/src/hooks/useIconHref.ts
|
|
31
|
-
var ICONS_URL = "/icons.svg";
|
|
32
|
-
var useIconHref = (icon) => {
|
|
33
|
-
const { noCache } = useThemeContext();
|
|
34
|
-
const url = noCache ? `${ICONS_URL}?nocache=${(/* @__PURE__ */ new Date()).getMinutes()}` : ICONS_URL;
|
|
35
|
-
return icon ? `${url}#${icon}` : void 0;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
// packages/ui/react-ui/src/hooks/useSafeArea.ts
|
|
39
|
-
import { useCallback, useState } from "react";
|
|
40
|
-
import { useResize } from "@dxos/react-hooks";
|
|
41
|
-
var initialSafeArea = {
|
|
42
|
-
top: NaN,
|
|
43
|
-
right: NaN,
|
|
44
|
-
bottom: NaN,
|
|
45
|
-
left: NaN
|
|
46
|
-
};
|
|
47
|
-
var useSafeArea = () => {
|
|
48
|
-
const [padding, setPadding] = useState(initialSafeArea);
|
|
49
|
-
const handleResize = useCallback(() => {
|
|
50
|
-
setPadding({
|
|
51
|
-
top: parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--safe-area-top")),
|
|
52
|
-
right: parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--safe-area-right")),
|
|
53
|
-
bottom: parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--safe-area-bottom")),
|
|
54
|
-
left: parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--safe-area-left"))
|
|
55
|
-
});
|
|
56
|
-
}, []);
|
|
57
|
-
useResize(handleResize);
|
|
58
|
-
return padding;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
// packages/ui/react-ui/src/hooks/useTranslationsContext.ts
|
|
62
|
-
import { useContext as useContext5 } from "react";
|
|
63
|
-
|
|
64
|
-
// packages/ui/react-ui/src/components/ThemeProvider/TranslationsProvider.tsx
|
|
65
|
-
import { enUS as dtLocaleEnUs } from "date-fns/locale";
|
|
66
|
-
import i18Next from "i18next";
|
|
67
|
-
import React, { useEffect, createContext, useState as useState2, Suspense, useContext as useContext4 } from "react";
|
|
68
|
-
import { initReactI18next, useTranslation as useI18NextTranslation } from "react-i18next";
|
|
69
|
-
var initialLng = "en-US";
|
|
70
|
-
var initialNs = "dxos-common";
|
|
71
|
-
var initialDtLocale = dtLocaleEnUs;
|
|
72
|
-
var isLabel = (o) => typeof o === "string" || Array.isArray(o) && o.length === 2 && typeof o[0] === "string" && !!o[1] && typeof o[1] === "object" && "ns" in o[1] && typeof o[1].ns === "string";
|
|
73
|
-
var toLocalizedString = (label, t) => Array.isArray(label) ? t(...label) : label;
|
|
74
|
-
var resources = {
|
|
75
|
-
[initialLng]: {
|
|
76
|
-
[initialNs]: {
|
|
77
|
-
"loading translations": "Loading translations\u2026"
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
void i18Next.use(initReactI18next).init({
|
|
82
|
-
resources,
|
|
83
|
-
lng: initialLng,
|
|
84
|
-
defaultNS: initialNs,
|
|
85
|
-
interpolation: {
|
|
86
|
-
escapeValue: false
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
var TranslationsContext = /* @__PURE__ */ createContext({
|
|
90
|
-
appNs: initialNs,
|
|
91
|
-
dtLocale: initialDtLocale
|
|
92
|
-
});
|
|
93
|
-
var useTranslation = (...args) => {
|
|
94
|
-
const result = useI18NextTranslation(...args);
|
|
95
|
-
const { dtLocale } = useContext4(TranslationsContext);
|
|
96
|
-
return {
|
|
97
|
-
...result,
|
|
98
|
-
dtLocale
|
|
99
|
-
};
|
|
100
|
-
};
|
|
101
|
-
var TranslationsProvider = ({ fallback, resourceExtensions, children, appNs, dtLocale }) => {
|
|
102
|
-
const [loaded, setLoaded] = useState2(false);
|
|
103
|
-
useEffect(() => {
|
|
104
|
-
setLoaded(false);
|
|
105
|
-
if (resourceExtensions && resourceExtensions.length) {
|
|
106
|
-
resourceExtensions.forEach((resource) => {
|
|
107
|
-
Object.keys(resource).forEach((language) => {
|
|
108
|
-
Object.keys(resource[language]).forEach((ns) => {
|
|
109
|
-
i18Next.addResourceBundle(language, ns, resource[language][ns]);
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
setLoaded(true);
|
|
115
|
-
}, [
|
|
116
|
-
resourceExtensions
|
|
117
|
-
]);
|
|
118
|
-
return /* @__PURE__ */ React.createElement(TranslationsContext.Provider, {
|
|
119
|
-
value: {
|
|
120
|
-
appNs: appNs ?? initialNs,
|
|
121
|
-
dtLocale: dtLocale ?? initialDtLocale
|
|
122
|
-
}
|
|
123
|
-
}, /* @__PURE__ */ React.createElement(Suspense, {
|
|
124
|
-
fallback
|
|
125
|
-
}, loaded ? children : fallback));
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
// packages/ui/react-ui/src/hooks/useTranslationsContext.ts
|
|
129
|
-
var useTranslationsContext = () => useContext5(TranslationsContext);
|
|
130
|
-
|
|
131
|
-
// packages/ui/react-ui/src/hooks/useVisualViewport.ts
|
|
132
|
-
import { useCallback as useCallback2, useState as useState3 } from "react";
|
|
133
|
-
import { useResize as useResize2 } from "@dxos/react-hooks";
|
|
134
|
-
var useVisualViewport = (deps) => {
|
|
135
|
-
const [width, setWidth] = useState3(null);
|
|
136
|
-
const [height, setHeight] = useState3(null);
|
|
137
|
-
const handleResize = useCallback2(() => {
|
|
138
|
-
if (window.visualViewport) {
|
|
139
|
-
setWidth(window.visualViewport.width);
|
|
140
|
-
setHeight(window.visualViewport.height);
|
|
141
|
-
}
|
|
142
|
-
}, []);
|
|
143
|
-
useResize2(handleResize);
|
|
144
|
-
return {
|
|
145
|
-
width,
|
|
146
|
-
height
|
|
147
|
-
};
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
// packages/ui/react-ui/src/components/AnchoredOverflow/AnchoredOverflow.tsx
|
|
151
|
-
var AnchoredOverflowRoot = /* @__PURE__ */ forwardRef(({ asChild, classNames, children, ...props }, forwardedRef) => {
|
|
152
|
-
const { tx } = useThemeContext();
|
|
153
|
-
const Root5 = asChild ? Slot : Primitive.div;
|
|
154
|
-
return /* @__PURE__ */ React2.createElement(Root5, {
|
|
155
|
-
role: "none",
|
|
156
|
-
...props,
|
|
157
|
-
className: tx("anchoredOverflow.root", "overflow-anchored", {}, classNames),
|
|
158
|
-
ref: forwardedRef
|
|
159
|
-
}, children);
|
|
160
|
-
});
|
|
161
|
-
var AnchoredOverflowAnchor = /* @__PURE__ */ forwardRef(({ asChild, classNames, children, ...props }, forwardedRef) => {
|
|
162
|
-
const { tx } = useThemeContext();
|
|
163
|
-
const Root5 = asChild ? Slot : Primitive.div;
|
|
164
|
-
return /* @__PURE__ */ React2.createElement(Root5, {
|
|
165
|
-
role: "none",
|
|
166
|
-
...props,
|
|
167
|
-
className: tx("anchoredOverflow.anchor", "overflow-anchor", {}, classNames),
|
|
168
|
-
ref: forwardedRef
|
|
169
|
-
}, children);
|
|
170
|
-
});
|
|
171
|
-
var AnchoredOverflow = {
|
|
172
|
-
Root: AnchoredOverflowRoot,
|
|
173
|
-
Anchor: AnchoredOverflowAnchor
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
// packages/ui/react-ui/src/components/Avatars/Avatar.tsx
|
|
177
|
-
import "@dxos/lit-ui/dx-avatar.pcss";
|
|
178
|
-
import { createComponent } from "@lit/react";
|
|
179
|
-
import { createContext as createContext2 } from "@radix-ui/react-context";
|
|
180
|
-
import { Primitive as Primitive2 } from "@radix-ui/react-primitive";
|
|
181
|
-
import { Slot as Slot2 } from "@radix-ui/react-slot";
|
|
182
|
-
import React3, { forwardRef as forwardRef2 } from "react";
|
|
183
|
-
import { DxAvatar as NaturalDxAvatar } from "@dxos/lit-ui";
|
|
184
|
-
import { useId } from "@dxos/react-hooks";
|
|
185
|
-
import { mx } from "@dxos/react-ui-theme";
|
|
186
|
-
var AVATAR_NAME = "Avatar";
|
|
187
|
-
var [AvatarProvider, useAvatarContext] = createContext2(AVATAR_NAME);
|
|
188
|
-
var AvatarRoot = ({ children, labelId: propsLabelId, descriptionId: propsDescriptionId }) => {
|
|
189
|
-
const labelId = useId("avatar__label", propsLabelId);
|
|
190
|
-
const descriptionId = useId("avatar__description", propsDescriptionId);
|
|
191
|
-
return /* @__PURE__ */ React3.createElement(AvatarProvider, {
|
|
192
|
-
labelId,
|
|
193
|
-
descriptionId
|
|
194
|
-
}, children);
|
|
195
|
-
};
|
|
196
|
-
var DxAvatar = createComponent({
|
|
197
|
-
tagName: "dx-avatar",
|
|
198
|
-
elementClass: NaturalDxAvatar,
|
|
199
|
-
react: React3
|
|
200
|
-
});
|
|
201
|
-
var AvatarContent = ({ icon, classNames, ...props }) => {
|
|
202
|
-
const href = useIconHref(icon);
|
|
203
|
-
const { labelId, descriptionId } = useAvatarContext("AvatarContent");
|
|
204
|
-
return /* @__PURE__ */ React3.createElement(DxAvatar, {
|
|
205
|
-
...props,
|
|
206
|
-
icon: href,
|
|
207
|
-
labelId,
|
|
208
|
-
"aria-describedby": descriptionId,
|
|
209
|
-
rootClassName: mx(classNames)
|
|
210
|
-
});
|
|
211
|
-
};
|
|
212
|
-
var AvatarLabel = /* @__PURE__ */ forwardRef2(({ asChild, srOnly, classNames, ...props }, forwardedRef) => {
|
|
213
|
-
const Root5 = asChild ? Slot2 : Primitive2.span;
|
|
214
|
-
const { tx } = useThemeContext();
|
|
215
|
-
const { labelId } = useAvatarContext("AvatarLabel");
|
|
216
|
-
return /* @__PURE__ */ React3.createElement(Root5, {
|
|
217
|
-
...props,
|
|
218
|
-
id: labelId,
|
|
219
|
-
ref: forwardedRef,
|
|
220
|
-
className: tx("avatar.label", "avatar__label", {
|
|
221
|
-
srOnly
|
|
222
|
-
}, classNames)
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
|
-
var AvatarDescription = /* @__PURE__ */ forwardRef2(({ asChild, srOnly, classNames, ...props }, forwardedRef) => {
|
|
226
|
-
const Root5 = asChild ? Slot2 : Primitive2.span;
|
|
227
|
-
const { tx } = useThemeContext();
|
|
228
|
-
const { descriptionId } = useAvatarContext("AvatarDescription");
|
|
229
|
-
return /* @__PURE__ */ React3.createElement(Root5, {
|
|
230
|
-
...props,
|
|
231
|
-
id: descriptionId,
|
|
232
|
-
ref: forwardedRef,
|
|
233
|
-
className: tx("avatar.description", "avatar__description", {
|
|
234
|
-
srOnly
|
|
235
|
-
}, classNames)
|
|
236
|
-
});
|
|
237
|
-
});
|
|
238
|
-
var Avatar = {
|
|
239
|
-
Root: AvatarRoot,
|
|
240
|
-
Content: AvatarContent,
|
|
241
|
-
Label: AvatarLabel,
|
|
242
|
-
Description: AvatarDescription
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
// packages/ui/react-ui/src/components/Breadcrumb/Breadcrumb.tsx
|
|
246
|
-
import { Dot } from "@phosphor-icons/react";
|
|
247
|
-
import { Primitive as Primitive4 } from "@radix-ui/react-primitive";
|
|
248
|
-
import { Slot as Slot4 } from "@radix-ui/react-slot";
|
|
249
|
-
import React5, { forwardRef as forwardRef4 } from "react";
|
|
250
|
-
|
|
251
|
-
// packages/ui/react-ui/src/components/Link/Link.tsx
|
|
252
|
-
import { Primitive as Primitive3 } from "@radix-ui/react-primitive";
|
|
253
|
-
import { Slot as Slot3 } from "@radix-ui/react-slot";
|
|
254
|
-
import React4, { forwardRef as forwardRef3 } from "react";
|
|
255
|
-
var Link = /* @__PURE__ */ forwardRef3(({ asChild, variant, classNames, ...props }, forwardedRef) => {
|
|
256
|
-
const { tx } = useThemeContext();
|
|
257
|
-
const Root5 = asChild ? Slot3 : Primitive3.a;
|
|
258
|
-
return /* @__PURE__ */ React4.createElement(Root5, {
|
|
259
|
-
...props,
|
|
260
|
-
className: tx("link.root", "link", {
|
|
261
|
-
variant
|
|
262
|
-
}, classNames),
|
|
263
|
-
ref: forwardedRef
|
|
264
|
-
});
|
|
265
|
-
});
|
|
266
|
-
|
|
267
|
-
// packages/ui/react-ui/src/components/Breadcrumb/Breadcrumb.tsx
|
|
268
|
-
var BreadcrumbRoot = /* @__PURE__ */ forwardRef4(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
269
|
-
const { tx } = useThemeContext();
|
|
270
|
-
const Root5 = asChild ? Slot4 : Primitive4.div;
|
|
271
|
-
return /* @__PURE__ */ React5.createElement(Root5, {
|
|
272
|
-
role: "navigation",
|
|
273
|
-
...props,
|
|
274
|
-
className: tx("breadcrumb.root", "breadcrumb", {}, classNames),
|
|
275
|
-
ref: forwardedRef
|
|
276
|
-
});
|
|
277
|
-
});
|
|
278
|
-
var BreadcrumbList = /* @__PURE__ */ forwardRef4(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
279
|
-
const { tx } = useThemeContext();
|
|
280
|
-
const Root5 = asChild ? Slot4 : Primitive4.ol;
|
|
281
|
-
return /* @__PURE__ */ React5.createElement(Root5, {
|
|
282
|
-
role: "list",
|
|
283
|
-
...props,
|
|
284
|
-
className: tx("breadcrumb.list", "breadcrumb__list", {}, classNames),
|
|
285
|
-
ref: forwardedRef
|
|
286
|
-
});
|
|
287
|
-
});
|
|
288
|
-
var BreadcrumbListItem = /* @__PURE__ */ forwardRef4(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
289
|
-
const { tx } = useThemeContext();
|
|
290
|
-
const Root5 = asChild ? Slot4 : Primitive4.li;
|
|
291
|
-
return /* @__PURE__ */ React5.createElement(Root5, {
|
|
292
|
-
role: "listitem",
|
|
293
|
-
...props,
|
|
294
|
-
className: tx("breadcrumb.listItem", "breadcrumb__list__item", {}, classNames),
|
|
295
|
-
ref: forwardedRef
|
|
296
|
-
});
|
|
297
|
-
});
|
|
298
|
-
var BreadcrumbLink = /* @__PURE__ */ forwardRef4(({ asChild, ...props }, forwardedRef) => {
|
|
299
|
-
const Root5 = asChild ? Slot4 : Link;
|
|
300
|
-
return /* @__PURE__ */ React5.createElement(Root5, {
|
|
301
|
-
...props,
|
|
302
|
-
ref: forwardedRef
|
|
303
|
-
});
|
|
304
|
-
});
|
|
305
|
-
var BreadcrumbCurrent = /* @__PURE__ */ forwardRef4(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
306
|
-
const { tx } = useThemeContext();
|
|
307
|
-
const Root5 = asChild ? Slot4 : "h1";
|
|
308
|
-
return /* @__PURE__ */ React5.createElement(Root5, {
|
|
309
|
-
...props,
|
|
310
|
-
"aria-current": "page",
|
|
311
|
-
className: tx("breadcrumb.current", "breadcrumb__item__heading--current", {}, classNames),
|
|
312
|
-
ref: forwardedRef
|
|
313
|
-
});
|
|
314
|
-
});
|
|
315
|
-
var BreadcrumbSeparator = ({ children, classNames, ...props }) => {
|
|
316
|
-
const { tx } = useThemeContext();
|
|
317
|
-
return /* @__PURE__ */ React5.createElement(Primitive4.span, {
|
|
318
|
-
role: "separator",
|
|
319
|
-
"aria-hidden": "true",
|
|
320
|
-
...props,
|
|
321
|
-
className: tx("breadcrumb.separator", "breadcrumb__separator", {}, classNames)
|
|
322
|
-
}, children ?? /* @__PURE__ */ React5.createElement(Dot, {
|
|
323
|
-
weight: "bold"
|
|
324
|
-
}));
|
|
325
|
-
};
|
|
326
|
-
var Breadcrumb = {
|
|
327
|
-
Root: BreadcrumbRoot,
|
|
328
|
-
List: BreadcrumbList,
|
|
329
|
-
ListItem: BreadcrumbListItem,
|
|
330
|
-
Link: BreadcrumbLink,
|
|
331
|
-
Current: BreadcrumbCurrent,
|
|
332
|
-
Separator: BreadcrumbSeparator
|
|
333
|
-
};
|
|
334
|
-
|
|
335
|
-
// packages/ui/react-ui/src/components/Buttons/Button.tsx
|
|
336
|
-
import { createContext as createContext3 } from "@radix-ui/react-context";
|
|
337
|
-
import { Primitive as Primitive5 } from "@radix-ui/react-primitive";
|
|
338
|
-
import { Slot as Slot5 } from "@radix-ui/react-slot";
|
|
339
|
-
import React6, { forwardRef as forwardRef5, memo } from "react";
|
|
340
|
-
var BUTTON_GROUP_NAME = "ButtonGroup";
|
|
341
|
-
var BUTTON_NAME = "Button";
|
|
342
|
-
var [ButtonGroupProvider, useButtonGroupContext] = createContext3(BUTTON_GROUP_NAME, {
|
|
343
|
-
inGroup: false
|
|
344
|
-
});
|
|
345
|
-
var Button = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef5(({ classNames, children, density: propsDensity, elevation: propsElevation, variant = "default", asChild, ...props }, ref) => {
|
|
346
|
-
const { inGroup } = useButtonGroupContext(BUTTON_NAME);
|
|
347
|
-
const { tx } = useThemeContext();
|
|
348
|
-
const elevation = useElevationContext(propsElevation);
|
|
349
|
-
const density = useDensityContext(propsDensity);
|
|
350
|
-
const Root5 = asChild ? Slot5 : Primitive5.button;
|
|
351
|
-
return /* @__PURE__ */ React6.createElement(Root5, {
|
|
352
|
-
ref,
|
|
353
|
-
...props,
|
|
354
|
-
"data-variant": variant,
|
|
355
|
-
"data-density": density,
|
|
356
|
-
"data-props": inGroup ? "grouped" : "",
|
|
357
|
-
className: tx("button.root", "button", {
|
|
358
|
-
variant,
|
|
359
|
-
inGroup,
|
|
360
|
-
disabled: props.disabled,
|
|
361
|
-
density,
|
|
362
|
-
elevation
|
|
363
|
-
}, classNames),
|
|
364
|
-
...props.disabled && {
|
|
365
|
-
disabled: true
|
|
366
|
-
}
|
|
367
|
-
}, children);
|
|
368
|
-
}));
|
|
369
|
-
Button.displayName = BUTTON_NAME;
|
|
370
|
-
var ButtonGroup = /* @__PURE__ */ forwardRef5(({ children, elevation: propsElevation, classNames, asChild, ...props }, forwardedRef) => {
|
|
371
|
-
const { tx } = useThemeContext();
|
|
372
|
-
const elevation = useElevationContext(propsElevation);
|
|
373
|
-
const Root5 = asChild ? Slot5 : Primitive5.div;
|
|
374
|
-
return /* @__PURE__ */ React6.createElement(Root5, {
|
|
375
|
-
role: "none",
|
|
376
|
-
...props,
|
|
377
|
-
className: tx("button.group", "button-group", {
|
|
378
|
-
elevation
|
|
379
|
-
}, classNames),
|
|
380
|
-
ref: forwardedRef
|
|
381
|
-
}, /* @__PURE__ */ React6.createElement(ButtonGroupProvider, {
|
|
382
|
-
inGroup: true
|
|
383
|
-
}, children));
|
|
384
|
-
});
|
|
385
|
-
ButtonGroup.displayName = BUTTON_GROUP_NAME;
|
|
386
|
-
|
|
387
|
-
// packages/ui/react-ui/src/components/Buttons/IconButton.tsx
|
|
388
|
-
import React9, { forwardRef as forwardRef8, useState as useState4 } from "react";
|
|
389
|
-
|
|
390
|
-
// packages/ui/react-ui/src/components/Icon/Icon.tsx
|
|
391
|
-
import React7, { forwardRef as forwardRef6, memo as memo2 } from "react";
|
|
392
|
-
var Icon = /* @__PURE__ */ memo2(/* @__PURE__ */ forwardRef6(({ icon, classNames, size, ...props }, forwardedRef) => {
|
|
393
|
-
const { tx } = useThemeContext();
|
|
394
|
-
const href = useIconHref(icon);
|
|
395
|
-
return /* @__PURE__ */ React7.createElement("svg", {
|
|
396
|
-
...props,
|
|
397
|
-
className: tx("icon.root", "icon", {
|
|
398
|
-
size
|
|
399
|
-
}, classNames),
|
|
400
|
-
ref: forwardedRef
|
|
401
|
-
}, /* @__PURE__ */ React7.createElement("use", {
|
|
402
|
-
href
|
|
403
|
-
}));
|
|
404
|
-
}));
|
|
405
|
-
|
|
406
|
-
// packages/ui/react-ui/src/components/Tooltip/Tooltip.tsx
|
|
407
|
-
import { Provider as TooltipProviderPrimitive, Root as TooltipRootPrimitive, TooltipContent as TooltipContentPrimitive, TooltipTrigger as TooltipTriggerPrimitive, TooltipPortal as TooltipPortalPrimitive, TooltipArrow as TooltipArrowPrimitive } from "@radix-ui/react-tooltip";
|
|
408
|
-
import React8, { forwardRef as forwardRef7 } from "react";
|
|
409
|
-
|
|
410
|
-
// packages/ui/react-ui/src/hooks/useSafeCollisionPadding.ts
|
|
411
|
-
import { useMemo } from "react";
|
|
412
|
-
var propIsNumber = (prop) => Number.isFinite(prop);
|
|
413
|
-
var propsIsRecord = (prop) => !!(prop && typeof prop === "object");
|
|
414
|
-
var safePadding = (propsPadding, safePadding2, side) => {
|
|
415
|
-
return (propIsNumber(safePadding2[side]) ? safePadding2[side] : 0) + (propIsNumber(propsPadding) ? propsPadding : propsIsRecord(propsPadding) ? propsPadding[side] ?? 0 : 0);
|
|
416
|
-
};
|
|
417
|
-
var useSafeCollisionPadding = (collisionPadding) => {
|
|
418
|
-
const { safeAreaPadding } = useThemeContext();
|
|
419
|
-
return useMemo(() => ({
|
|
420
|
-
top: safePadding(collisionPadding, safeAreaPadding, "top"),
|
|
421
|
-
right: safePadding(collisionPadding, safeAreaPadding, "right"),
|
|
422
|
-
bottom: safePadding(collisionPadding, safeAreaPadding, "bottom"),
|
|
423
|
-
left: safePadding(collisionPadding, safeAreaPadding, "left")
|
|
424
|
-
}), [
|
|
425
|
-
collisionPadding,
|
|
426
|
-
safeAreaPadding
|
|
427
|
-
]);
|
|
428
|
-
};
|
|
429
|
-
|
|
430
|
-
// packages/ui/react-ui/src/components/Tooltip/Tooltip.tsx
|
|
431
|
-
var TooltipProvider = TooltipProviderPrimitive;
|
|
432
|
-
var TooltipRoot = TooltipRootPrimitive;
|
|
433
|
-
var TooltipPortal = TooltipPortalPrimitive;
|
|
434
|
-
var TooltipTrigger = TooltipTriggerPrimitive;
|
|
435
|
-
var TooltipArrow = /* @__PURE__ */ forwardRef7(({ classNames, ...props }, forwardedRef) => {
|
|
436
|
-
const { tx } = useThemeContext();
|
|
437
|
-
return /* @__PURE__ */ React8.createElement(TooltipArrowPrimitive, {
|
|
438
|
-
...props,
|
|
439
|
-
className: tx("tooltip.arrow", "tooltip__arrow", {}, classNames),
|
|
440
|
-
ref: forwardedRef
|
|
441
|
-
});
|
|
442
|
-
});
|
|
443
|
-
var TooltipContent = /* @__PURE__ */ forwardRef7(({ classNames, collisionPadding = 8, ...props }, forwardedRef) => {
|
|
444
|
-
const { tx } = useThemeContext();
|
|
445
|
-
const elevation = useElevationContext();
|
|
446
|
-
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
447
|
-
return /* @__PURE__ */ React8.createElement(TooltipContentPrimitive, {
|
|
448
|
-
sideOffset: 4,
|
|
449
|
-
...props,
|
|
450
|
-
collisionPadding: safeCollisionPadding,
|
|
451
|
-
className: tx("tooltip.content", "tooltip", {
|
|
452
|
-
elevation
|
|
453
|
-
}, classNames),
|
|
454
|
-
ref: forwardedRef
|
|
455
|
-
});
|
|
456
|
-
});
|
|
457
|
-
var Tooltip = {
|
|
458
|
-
Provider: TooltipProvider,
|
|
459
|
-
Root: TooltipRoot,
|
|
460
|
-
Portal: TooltipPortal,
|
|
461
|
-
Trigger: TooltipTrigger,
|
|
462
|
-
Arrow: TooltipArrow,
|
|
463
|
-
Content: TooltipContent
|
|
464
|
-
};
|
|
465
|
-
|
|
466
|
-
// packages/ui/react-ui/src/components/Buttons/IconButton.tsx
|
|
467
|
-
var IconOnlyButton = /* @__PURE__ */ forwardRef8(({ noTooltip, tooltipPortal = true, tooltipZIndex: zIndex, tooltipSide, suppressNextTooltip, ...props }, forwardedRef) => {
|
|
468
|
-
const [triggerTooltipOpen, setTriggerTooltipOpen] = useState4(false);
|
|
469
|
-
if (noTooltip) {
|
|
470
|
-
return /* @__PURE__ */ React9.createElement(LabelledIconButton, {
|
|
471
|
-
...props,
|
|
472
|
-
ref: forwardedRef
|
|
473
|
-
});
|
|
474
|
-
}
|
|
475
|
-
const content = /* @__PURE__ */ React9.createElement(Tooltip.Content, {
|
|
476
|
-
...zIndex && {
|
|
477
|
-
style: {
|
|
478
|
-
zIndex
|
|
479
|
-
}
|
|
480
|
-
},
|
|
481
|
-
side: tooltipSide
|
|
482
|
-
}, props.label, /* @__PURE__ */ React9.createElement(Tooltip.Arrow, null));
|
|
483
|
-
return /* @__PURE__ */ React9.createElement(Tooltip.Root, {
|
|
484
|
-
open: triggerTooltipOpen,
|
|
485
|
-
onOpenChange: (nextOpen) => {
|
|
486
|
-
if (suppressNextTooltip?.current) {
|
|
487
|
-
setTriggerTooltipOpen(false);
|
|
488
|
-
suppressNextTooltip.current = false;
|
|
489
|
-
} else {
|
|
490
|
-
setTriggerTooltipOpen(nextOpen);
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
}, /* @__PURE__ */ React9.createElement(Tooltip.Trigger, {
|
|
494
|
-
asChild: true
|
|
495
|
-
}, /* @__PURE__ */ React9.createElement(LabelledIconButton, {
|
|
496
|
-
...props,
|
|
497
|
-
ref: forwardedRef
|
|
498
|
-
})), tooltipPortal ? /* @__PURE__ */ React9.createElement(Tooltip.Portal, null, content) : content);
|
|
499
|
-
});
|
|
500
|
-
var LabelledIconButton = /* @__PURE__ */ forwardRef8(({ icon, size, iconOnly, label, classNames, iconClassNames, caretDown, suppressNextTooltip, ...props }, forwardedRef) => {
|
|
501
|
-
const { tx } = useThemeContext();
|
|
502
|
-
return /* @__PURE__ */ React9.createElement(Button, {
|
|
503
|
-
...props,
|
|
504
|
-
classNames: tx("iconButton.root", "iconButton", {}, classNames),
|
|
505
|
-
ref: forwardedRef
|
|
506
|
-
}, /* @__PURE__ */ React9.createElement(Icon, {
|
|
507
|
-
icon,
|
|
508
|
-
size,
|
|
509
|
-
classNames: iconClassNames
|
|
510
|
-
}), /* @__PURE__ */ React9.createElement("span", {
|
|
511
|
-
className: iconOnly ? "sr-only" : void 0
|
|
512
|
-
}, label), caretDown && /* @__PURE__ */ React9.createElement(Icon, {
|
|
513
|
-
size: 3,
|
|
514
|
-
icon: "ph--caret-down--bold"
|
|
515
|
-
}));
|
|
516
|
-
});
|
|
517
|
-
var IconButton = /* @__PURE__ */ forwardRef8((props, forwardedRef) => props.iconOnly ? /* @__PURE__ */ React9.createElement(IconOnlyButton, {
|
|
518
|
-
...props,
|
|
519
|
-
ref: forwardedRef
|
|
520
|
-
}) : /* @__PURE__ */ React9.createElement(LabelledIconButton, {
|
|
521
|
-
...props,
|
|
522
|
-
ref: forwardedRef
|
|
523
|
-
}));
|
|
524
|
-
|
|
525
|
-
// packages/ui/react-ui/src/components/Buttons/Toggle.tsx
|
|
526
|
-
import { Toggle as TogglePrimitive } from "@radix-ui/react-toggle";
|
|
527
|
-
import React10, { forwardRef as forwardRef9 } from "react";
|
|
528
|
-
var Toggle = /* @__PURE__ */ forwardRef9(({ defaultPressed, pressed, onPressedChange, ...props }, forwardedRef) => {
|
|
529
|
-
return /* @__PURE__ */ React10.createElement(TogglePrimitive, {
|
|
530
|
-
defaultPressed,
|
|
531
|
-
pressed,
|
|
532
|
-
onPressedChange,
|
|
533
|
-
asChild: true
|
|
534
|
-
}, /* @__PURE__ */ React10.createElement(Button, {
|
|
535
|
-
...props,
|
|
536
|
-
ref: forwardedRef
|
|
537
|
-
}));
|
|
538
|
-
});
|
|
539
|
-
|
|
540
|
-
// packages/ui/react-ui/src/components/Buttons/ToggleGroup.tsx
|
|
541
|
-
import { ToggleGroup as ToggleGroupPrimitive, ToggleGroupItem as ToggleGroupItemPrimitive } from "@radix-ui/react-toggle-group";
|
|
542
|
-
import React11, { forwardRef as forwardRef10 } from "react";
|
|
543
|
-
var ToggleGroup = /* @__PURE__ */ forwardRef10(({ classNames, children, ...props }, forwardedRef) => {
|
|
544
|
-
return /* @__PURE__ */ React11.createElement(ToggleGroupPrimitive, {
|
|
545
|
-
...props,
|
|
546
|
-
asChild: true
|
|
547
|
-
}, /* @__PURE__ */ React11.createElement(ButtonGroup, {
|
|
548
|
-
classNames,
|
|
549
|
-
children,
|
|
550
|
-
ref: forwardedRef
|
|
551
|
-
}));
|
|
552
|
-
});
|
|
553
|
-
var ToggleGroupItem = /* @__PURE__ */ forwardRef10(({ variant, elevation, density, classNames, children, ...props }, forwardedRef) => {
|
|
554
|
-
return /* @__PURE__ */ React11.createElement(ToggleGroupItemPrimitive, {
|
|
555
|
-
...props,
|
|
556
|
-
asChild: true
|
|
557
|
-
}, /* @__PURE__ */ React11.createElement(Button, {
|
|
558
|
-
variant,
|
|
559
|
-
elevation,
|
|
560
|
-
density,
|
|
561
|
-
classNames,
|
|
562
|
-
children,
|
|
563
|
-
ref: forwardedRef
|
|
564
|
-
}));
|
|
565
|
-
});
|
|
566
|
-
|
|
567
|
-
// packages/ui/react-ui/src/components/Clipboard/ClipboardProvider.tsx
|
|
568
|
-
import React12, { createContext as createContext4, useCallback as useCallback3, useContext as useContext6, useState as useState5 } from "react";
|
|
569
|
-
var ClipboardContext = /* @__PURE__ */ createContext4({
|
|
570
|
-
textValue: "",
|
|
571
|
-
setTextValue: async (_) => {
|
|
572
|
-
}
|
|
573
|
-
});
|
|
574
|
-
var useClipboard = () => useContext6(ClipboardContext);
|
|
575
|
-
var ClipboardProvider = ({ children }) => {
|
|
576
|
-
const [textValue, setInternalTextValue] = useState5("");
|
|
577
|
-
const setTextValue = useCallback3(async (nextValue) => {
|
|
578
|
-
await navigator.clipboard.writeText(nextValue);
|
|
579
|
-
return setInternalTextValue(nextValue);
|
|
580
|
-
}, []);
|
|
581
|
-
return /* @__PURE__ */ React12.createElement(ClipboardContext.Provider, {
|
|
582
|
-
value: {
|
|
583
|
-
textValue,
|
|
584
|
-
setTextValue
|
|
585
|
-
}
|
|
586
|
-
}, children);
|
|
587
|
-
};
|
|
588
|
-
|
|
589
|
-
// packages/ui/react-ui/src/components/Clipboard/CopyButton.tsx
|
|
590
|
-
import React16, { useState as useState6 } from "react";
|
|
591
|
-
import { mx as mx2 } from "@dxos/react-ui-theme";
|
|
592
|
-
|
|
593
|
-
// packages/ui/react-ui/src/components/ThemeProvider/ThemeProvider.tsx
|
|
594
|
-
import { createKeyborg } from "keyborg";
|
|
595
|
-
import React15, { createContext as createContext7, useEffect as useEffect2, useMemo as useMemo2 } from "react";
|
|
596
|
-
|
|
597
|
-
// packages/ui/react-ui/src/util/hasIosKeyboard.ts
|
|
598
|
-
var hasIosKeyboard = () => {
|
|
599
|
-
return !!navigator.userAgent.match(/iP(ad|od|hone).+Safari/);
|
|
600
|
-
};
|
|
601
|
-
|
|
602
|
-
// packages/ui/react-ui/src/components/DensityProvider/DensityProvider.tsx
|
|
603
|
-
import React13, { createContext as createContext5 } from "react";
|
|
604
|
-
var DensityContext = /* @__PURE__ */ createContext5({
|
|
605
|
-
density: "fine"
|
|
606
|
-
});
|
|
607
|
-
var DensityProvider = ({ density, children }) => /* @__PURE__ */ React13.createElement(DensityContext.Provider, {
|
|
608
|
-
value: {
|
|
609
|
-
density
|
|
610
|
-
}
|
|
611
|
-
}, children);
|
|
612
|
-
|
|
613
|
-
// packages/ui/react-ui/src/components/ElevationProvider/ElevationProvider.tsx
|
|
614
|
-
import React14, { createContext as createContext6 } from "react";
|
|
615
|
-
var ElevationContext = /* @__PURE__ */ createContext6({
|
|
616
|
-
elevation: "base"
|
|
617
|
-
});
|
|
618
|
-
var ElevationProvider = ({ elevation, children }) => /* @__PURE__ */ React14.createElement(ElevationContext.Provider, {
|
|
619
|
-
value: {
|
|
620
|
-
elevation
|
|
621
|
-
}
|
|
622
|
-
}, children);
|
|
623
|
-
|
|
624
|
-
// packages/ui/react-ui/src/components/ThemeProvider/ThemeProvider.tsx
|
|
625
|
-
var ThemeContext = /* @__PURE__ */ createContext7(void 0);
|
|
626
|
-
var ThemeProvider = ({ children, fallback = null, resourceExtensions, appNs, tx = (_path, defaultClassName, _styleProps, ..._options) => defaultClassName, themeMode = "dark", rootDensity = "fine", ...rest }) => {
|
|
627
|
-
useEffect2(() => {
|
|
628
|
-
if (document.defaultView) {
|
|
629
|
-
const kb = createKeyborg(document.defaultView);
|
|
630
|
-
kb.subscribe(handleInputModalityChange);
|
|
631
|
-
return () => kb.unsubscribe(handleInputModalityChange);
|
|
632
|
-
}
|
|
633
|
-
}, []);
|
|
634
|
-
const safeAreaPadding = useSafeArea();
|
|
635
|
-
const contextValue = useMemo2(() => ({
|
|
636
|
-
tx,
|
|
637
|
-
themeMode,
|
|
638
|
-
hasIosKeyboard: hasIosKeyboard(),
|
|
639
|
-
safeAreaPadding,
|
|
640
|
-
...rest
|
|
641
|
-
}), [
|
|
642
|
-
tx,
|
|
643
|
-
themeMode,
|
|
644
|
-
safeAreaPadding,
|
|
645
|
-
rest
|
|
646
|
-
]);
|
|
647
|
-
return /* @__PURE__ */ React15.createElement(ThemeContext.Provider, {
|
|
648
|
-
value: contextValue
|
|
649
|
-
}, /* @__PURE__ */ React15.createElement(TranslationsProvider, {
|
|
650
|
-
fallback,
|
|
651
|
-
resourceExtensions,
|
|
652
|
-
appNs
|
|
653
|
-
}, /* @__PURE__ */ React15.createElement(ElevationProvider, {
|
|
654
|
-
elevation: "base"
|
|
655
|
-
}, /* @__PURE__ */ React15.createElement(DensityProvider, {
|
|
656
|
-
density: rootDensity
|
|
657
|
-
}, children))));
|
|
658
|
-
};
|
|
659
|
-
var handleInputModalityChange = (isUsingKeyboard) => {
|
|
660
|
-
if (isUsingKeyboard) {
|
|
661
|
-
document.body.setAttribute("data-is-keyboard", "true");
|
|
662
|
-
} else {
|
|
663
|
-
document.body.removeAttribute("data-is-keyboard");
|
|
664
|
-
}
|
|
665
|
-
};
|
|
666
|
-
|
|
667
|
-
// packages/ui/react-ui/src/components/Clipboard/CopyButton.tsx
|
|
668
|
-
var inactiveLabelStyles = "invisible bs-px -mbe-px overflow-hidden";
|
|
669
|
-
var CopyButton = ({ value, classNames, iconProps, ...props }) => {
|
|
670
|
-
const { t } = useTranslation("os");
|
|
671
|
-
const { textValue, setTextValue } = useClipboard();
|
|
672
|
-
const isCopied = textValue === value;
|
|
673
|
-
return /* @__PURE__ */ React16.createElement(Button, {
|
|
674
|
-
...props,
|
|
675
|
-
classNames: [
|
|
676
|
-
"inline-flex flex-col justify-center",
|
|
677
|
-
classNames
|
|
678
|
-
],
|
|
679
|
-
onClick: () => setTextValue(value),
|
|
680
|
-
"data-testid": "copy-invitation"
|
|
681
|
-
}, /* @__PURE__ */ React16.createElement("div", {
|
|
682
|
-
role: "none",
|
|
683
|
-
className: mx2("flex gap-1 items-center", isCopied && inactiveLabelStyles)
|
|
684
|
-
}, /* @__PURE__ */ React16.createElement("span", {
|
|
685
|
-
className: "pli-1"
|
|
686
|
-
}, t("copy label")), /* @__PURE__ */ React16.createElement(Icon, {
|
|
687
|
-
icon: "ph--copy--regular",
|
|
688
|
-
size: 5,
|
|
689
|
-
...iconProps
|
|
690
|
-
})), /* @__PURE__ */ React16.createElement("div", {
|
|
691
|
-
role: "none",
|
|
692
|
-
className: mx2("flex gap-1 items-center", !isCopied && inactiveLabelStyles)
|
|
693
|
-
}, /* @__PURE__ */ React16.createElement("span", {
|
|
694
|
-
className: "pli-1"
|
|
695
|
-
}, t("copy success label")), /* @__PURE__ */ React16.createElement(Icon, {
|
|
696
|
-
icon: "ph--check--regular",
|
|
697
|
-
size: 5,
|
|
698
|
-
...iconProps
|
|
699
|
-
})));
|
|
700
|
-
};
|
|
701
|
-
var CopyButtonIconOnly = ({ value, classNames, iconProps, variant, ...props }) => {
|
|
702
|
-
const { t } = useTranslation("os");
|
|
703
|
-
const { textValue, setTextValue } = useClipboard();
|
|
704
|
-
const isCopied = textValue === value;
|
|
705
|
-
const label = isCopied ? t("copy success label") : props.label ?? t("copy label");
|
|
706
|
-
const [open, setOpen] = useState6(false);
|
|
707
|
-
return /* @__PURE__ */ React16.createElement(Tooltip.Root, {
|
|
708
|
-
delayDuration: 1500,
|
|
709
|
-
open,
|
|
710
|
-
onOpenChange: setOpen
|
|
711
|
-
}, /* @__PURE__ */ React16.createElement(Tooltip.Portal, null, /* @__PURE__ */ React16.createElement(Tooltip.Content, {
|
|
712
|
-
side: "bottom",
|
|
713
|
-
sideOffset: 12
|
|
714
|
-
}, /* @__PURE__ */ React16.createElement("span", null, label), /* @__PURE__ */ React16.createElement(Tooltip.Arrow, null))), /* @__PURE__ */ React16.createElement(Tooltip.Trigger, {
|
|
715
|
-
"aria-label": label,
|
|
716
|
-
...props,
|
|
717
|
-
onClick: () => setTextValue(value).then(() => setOpen(true)),
|
|
718
|
-
"data-testid": "copy-invitation",
|
|
719
|
-
asChild: true
|
|
720
|
-
}, /* @__PURE__ */ React16.createElement(Button, {
|
|
721
|
-
variant,
|
|
722
|
-
classNames: [
|
|
723
|
-
"inline-flex flex-col justify-center",
|
|
724
|
-
classNames
|
|
725
|
-
]
|
|
726
|
-
}, /* @__PURE__ */ React16.createElement(Icon, {
|
|
727
|
-
icon: "ph--copy--regular",
|
|
728
|
-
size: 5,
|
|
729
|
-
...iconProps
|
|
730
|
-
}))));
|
|
731
|
-
};
|
|
732
|
-
|
|
733
|
-
// packages/ui/react-ui/src/components/Clipboard/index.ts
|
|
734
|
-
var Clipboard = {
|
|
735
|
-
Button: CopyButton,
|
|
736
|
-
IconButton: CopyButtonIconOnly,
|
|
737
|
-
Provider: ClipboardProvider
|
|
738
|
-
};
|
|
739
|
-
|
|
740
|
-
// packages/ui/react-ui/src/components/Dialogs/Dialog.tsx
|
|
741
|
-
import { createContext as createContext8 } from "@radix-ui/react-context";
|
|
742
|
-
import { Root as DialogRootPrimitive, DialogTrigger as DialogTriggerPrimitive, DialogPortal as DialogPortalPrimitive, DialogOverlay as DialogOverlayPrimitive, DialogTitle as DialogTitlePrimitive, DialogDescription as DialogDescriptionPrimitive, DialogClose as DialogClosePrimitive, DialogContent as DialogContentPrimitive } from "@radix-ui/react-dialog";
|
|
743
|
-
import React17, { forwardRef as forwardRef11 } from "react";
|
|
744
|
-
var DialogRoot = (props) => /* @__PURE__ */ React17.createElement(ElevationProvider, {
|
|
745
|
-
elevation: "dialog"
|
|
746
|
-
}, /* @__PURE__ */ React17.createElement(DialogRootPrimitive, props));
|
|
747
|
-
var DialogTrigger = DialogTriggerPrimitive;
|
|
748
|
-
var DialogPortal = DialogPortalPrimitive;
|
|
749
|
-
var DialogTitle = /* @__PURE__ */ forwardRef11(({ classNames, srOnly, ...props }, forwardedRef) => {
|
|
750
|
-
const { tx } = useThemeContext();
|
|
751
|
-
return /* @__PURE__ */ React17.createElement(DialogTitlePrimitive, {
|
|
752
|
-
...props,
|
|
753
|
-
className: tx("dialog.title", "dialog__title", {
|
|
754
|
-
srOnly
|
|
755
|
-
}, classNames),
|
|
756
|
-
ref: forwardedRef
|
|
757
|
-
});
|
|
758
|
-
});
|
|
759
|
-
var DialogDescription = /* @__PURE__ */ forwardRef11(({ classNames, srOnly, ...props }, forwardedRef) => {
|
|
760
|
-
const { tx } = useThemeContext();
|
|
761
|
-
return /* @__PURE__ */ React17.createElement(DialogDescriptionPrimitive, {
|
|
762
|
-
...props,
|
|
763
|
-
className: tx("dialog.description", "dialog__description", {
|
|
764
|
-
srOnly
|
|
765
|
-
}, classNames),
|
|
766
|
-
ref: forwardedRef
|
|
767
|
-
});
|
|
768
|
-
});
|
|
769
|
-
var DialogClose = DialogClosePrimitive;
|
|
770
|
-
var DIALOG_OVERLAY_NAME = "DialogOverlay";
|
|
771
|
-
var DIALOG_CONTENT_NAME = "DialogContent";
|
|
772
|
-
var [OverlayLayoutProvider, useOverlayLayoutContext] = createContext8(DIALOG_OVERLAY_NAME, {
|
|
773
|
-
inOverlayLayout: false
|
|
774
|
-
});
|
|
775
|
-
var DialogOverlay = /* @__PURE__ */ forwardRef11(({ classNames, children, blockAlign, ...props }, forwardedRef) => {
|
|
776
|
-
const { tx } = useThemeContext();
|
|
777
|
-
return /* @__PURE__ */ React17.createElement(DialogOverlayPrimitive, {
|
|
778
|
-
...props,
|
|
779
|
-
className: tx("dialog.overlay", "dialog__overlay", {}, classNames),
|
|
780
|
-
ref: forwardedRef,
|
|
781
|
-
"data-block-align": blockAlign
|
|
782
|
-
}, /* @__PURE__ */ React17.createElement(OverlayLayoutProvider, {
|
|
783
|
-
inOverlayLayout: true
|
|
784
|
-
}, children));
|
|
785
|
-
});
|
|
786
|
-
DialogOverlay.displayName = DIALOG_OVERLAY_NAME;
|
|
787
|
-
var DialogContent = /* @__PURE__ */ forwardRef11(({ classNames, children, inOverlayLayout: propsInOverlayLayout, ...props }, forwardedRef) => {
|
|
788
|
-
const { tx } = useThemeContext();
|
|
789
|
-
const { inOverlayLayout } = useOverlayLayoutContext(DIALOG_CONTENT_NAME);
|
|
790
|
-
return /* @__PURE__ */ React17.createElement(DialogContentPrimitive, {
|
|
791
|
-
...props,
|
|
792
|
-
className: tx("dialog.content", "dialog", {
|
|
793
|
-
inOverlayLayout: propsInOverlayLayout || inOverlayLayout
|
|
794
|
-
}, classNames),
|
|
795
|
-
ref: forwardedRef
|
|
796
|
-
}, children);
|
|
797
|
-
});
|
|
798
|
-
DialogContent.displayName = DIALOG_CONTENT_NAME;
|
|
799
|
-
var Dialog = {
|
|
800
|
-
Root: DialogRoot,
|
|
801
|
-
Trigger: DialogTrigger,
|
|
802
|
-
Portal: DialogPortal,
|
|
803
|
-
Overlay: DialogOverlay,
|
|
804
|
-
Content: DialogContent,
|
|
805
|
-
Title: DialogTitle,
|
|
806
|
-
Description: DialogDescription,
|
|
807
|
-
Close: DialogClose
|
|
808
|
-
};
|
|
809
|
-
|
|
810
|
-
// packages/ui/react-ui/src/components/Dialogs/AlertDialog.tsx
|
|
811
|
-
import { Root as AlertDialogRootPrimitive, AlertDialogTrigger as AlertDialogTriggerPrimitive, AlertDialogPortal as AlertDialogPortalPrimitive, AlertDialogOverlay as AlertDialogOverlayPrimitive, AlertDialogTitle as AlertDialogTitlePrimitive, AlertDialogDescription as AlertDialogDescriptionPrimitive, AlertDialogAction as AlertDialogActionPrimitive, AlertDialogCancel as AlertDialogCancelPrimitive, AlertDialogContent as AlertDialogContentPrimitive } from "@radix-ui/react-alert-dialog";
|
|
812
|
-
import { createContext as createContext9 } from "@radix-ui/react-context";
|
|
813
|
-
import React18, { forwardRef as forwardRef12 } from "react";
|
|
814
|
-
var AlertDialogRoot = (props) => /* @__PURE__ */ React18.createElement(ElevationProvider, {
|
|
815
|
-
elevation: "dialog"
|
|
816
|
-
}, /* @__PURE__ */ React18.createElement(AlertDialogRootPrimitive, props));
|
|
817
|
-
var AlertDialogTrigger = AlertDialogTriggerPrimitive;
|
|
818
|
-
var AlertDialogPortal = AlertDialogPortalPrimitive;
|
|
819
|
-
var AlertDialogCancel = AlertDialogCancelPrimitive;
|
|
820
|
-
var AlertDialogAction = AlertDialogActionPrimitive;
|
|
821
|
-
var AlertDialogTitle = /* @__PURE__ */ forwardRef12(({ classNames, srOnly, ...props }, forwardedRef) => {
|
|
822
|
-
const { tx } = useThemeContext();
|
|
823
|
-
return /* @__PURE__ */ React18.createElement(AlertDialogTitlePrimitive, {
|
|
824
|
-
...props,
|
|
825
|
-
className: tx("dialog.title", "dialog--alert__title", {
|
|
826
|
-
srOnly
|
|
827
|
-
}, classNames),
|
|
828
|
-
ref: forwardedRef
|
|
829
|
-
});
|
|
830
|
-
});
|
|
831
|
-
var AlertDialogDescription = /* @__PURE__ */ forwardRef12(({ classNames, srOnly, ...props }, forwardedRef) => {
|
|
832
|
-
const { tx } = useThemeContext();
|
|
833
|
-
return /* @__PURE__ */ React18.createElement(AlertDialogDescriptionPrimitive, {
|
|
834
|
-
...props,
|
|
835
|
-
className: tx("dialog.description", "dialog--alert__description", {
|
|
836
|
-
srOnly
|
|
837
|
-
}, classNames),
|
|
838
|
-
ref: forwardedRef
|
|
839
|
-
});
|
|
840
|
-
});
|
|
841
|
-
var ALERT_DIALOG_OVERLAY_NAME = "AlertDialogOverlay";
|
|
842
|
-
var ALERT_DIALOG_CONTENT_NAME = "AlertDialogContent";
|
|
843
|
-
var [OverlayLayoutProvider2, useOverlayLayoutContext2] = createContext9(ALERT_DIALOG_OVERLAY_NAME, {
|
|
844
|
-
inOverlayLayout: false
|
|
845
|
-
});
|
|
846
|
-
var AlertDialogOverlay = /* @__PURE__ */ forwardRef12(({ classNames, children, blockAlign, ...props }, forwardedRef) => {
|
|
847
|
-
const { tx } = useThemeContext();
|
|
848
|
-
return /* @__PURE__ */ React18.createElement(AlertDialogOverlayPrimitive, {
|
|
849
|
-
...props,
|
|
850
|
-
className: tx("dialog.overlay", "dialog--alert__overlay", {}, classNames, "data-[block-align=start]:justify-center", "data-[block-align=start]:items-start", "data-[block-align=center]:place-content-center"),
|
|
851
|
-
ref: forwardedRef,
|
|
852
|
-
"data-block-align": blockAlign
|
|
853
|
-
}, /* @__PURE__ */ React18.createElement(OverlayLayoutProvider2, {
|
|
854
|
-
inOverlayLayout: true
|
|
855
|
-
}, children));
|
|
856
|
-
});
|
|
857
|
-
AlertDialogOverlay.displayName = ALERT_DIALOG_OVERLAY_NAME;
|
|
858
|
-
var AlertDialogContent = /* @__PURE__ */ forwardRef12(({ classNames, children, ...props }, forwardedRef) => {
|
|
859
|
-
const { tx } = useThemeContext();
|
|
860
|
-
const { inOverlayLayout } = useOverlayLayoutContext2(ALERT_DIALOG_CONTENT_NAME);
|
|
861
|
-
return /* @__PURE__ */ React18.createElement(AlertDialogContentPrimitive, {
|
|
862
|
-
...props,
|
|
863
|
-
className: tx("dialog.content", "dialog--alert", {
|
|
864
|
-
inOverlayLayout
|
|
865
|
-
}, classNames),
|
|
866
|
-
ref: forwardedRef
|
|
867
|
-
}, children);
|
|
868
|
-
});
|
|
869
|
-
AlertDialogContent.displayName = ALERT_DIALOG_CONTENT_NAME;
|
|
870
|
-
var AlertDialog = {
|
|
871
|
-
Root: AlertDialogRoot,
|
|
872
|
-
Trigger: AlertDialogTrigger,
|
|
873
|
-
Portal: AlertDialogPortal,
|
|
874
|
-
Overlay: AlertDialogOverlay,
|
|
875
|
-
Content: AlertDialogContent,
|
|
876
|
-
Title: AlertDialogTitle,
|
|
877
|
-
Description: AlertDialogDescription,
|
|
878
|
-
Cancel: AlertDialogCancel,
|
|
879
|
-
Action: AlertDialogAction
|
|
880
|
-
};
|
|
881
|
-
|
|
882
|
-
// packages/ui/react-ui/src/components/Menus/ContextMenu.tsx
|
|
883
|
-
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
|
|
884
|
-
import { Primitive as Primitive6 } from "@radix-ui/react-primitive";
|
|
885
|
-
import { Slot as Slot6 } from "@radix-ui/react-slot";
|
|
886
|
-
import React19, { forwardRef as forwardRef13 } from "react";
|
|
887
|
-
var ContextMenuRoot = ContextMenuPrimitive.ContextMenu;
|
|
888
|
-
var ContextMenuTrigger = ContextMenuPrimitive.Trigger;
|
|
889
|
-
var ContextMenuPortal = ContextMenuPrimitive.Portal;
|
|
890
|
-
var ContextMenuContent = /* @__PURE__ */ forwardRef13(({ classNames, children, collisionPadding = 8, ...props }, forwardedRef) => {
|
|
891
|
-
const { tx } = useThemeContext();
|
|
892
|
-
const elevation = useElevationContext();
|
|
893
|
-
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
894
|
-
return /* @__PURE__ */ React19.createElement(ContextMenuPrimitive.Content, {
|
|
895
|
-
...props,
|
|
896
|
-
collisionPadding: safeCollisionPadding,
|
|
897
|
-
className: tx("menu.content", "menu", {
|
|
898
|
-
elevation
|
|
899
|
-
}, classNames),
|
|
900
|
-
ref: forwardedRef
|
|
901
|
-
}, children);
|
|
902
|
-
});
|
|
903
|
-
var ContextMenuViewport = /* @__PURE__ */ forwardRef13(({ classNames, asChild, children, ...props }, forwardedRef) => {
|
|
904
|
-
const { tx } = useThemeContext();
|
|
905
|
-
const Root5 = asChild ? Slot6 : Primitive6.div;
|
|
906
|
-
return /* @__PURE__ */ React19.createElement(Root5, {
|
|
907
|
-
...props,
|
|
908
|
-
className: tx("menu.viewport", "menu__viewport", {}, classNames),
|
|
909
|
-
ref: forwardedRef
|
|
910
|
-
}, children);
|
|
911
|
-
});
|
|
912
|
-
var ContextMenuArrow = /* @__PURE__ */ forwardRef13(({ classNames, ...props }, forwardedRef) => {
|
|
913
|
-
const { tx } = useThemeContext();
|
|
914
|
-
return /* @__PURE__ */ React19.createElement(ContextMenuPrimitive.Arrow, {
|
|
915
|
-
...props,
|
|
916
|
-
className: tx("menu.arrow", "menu__arrow", {}, classNames),
|
|
917
|
-
ref: forwardedRef
|
|
918
|
-
});
|
|
919
|
-
});
|
|
920
|
-
var ContextMenuGroup = ContextMenuPrimitive.Group;
|
|
921
|
-
var ContextMenuItemIndicator = ContextMenuPrimitive.ItemIndicator;
|
|
922
|
-
var ContextMenuItem = /* @__PURE__ */ forwardRef13(({ classNames, ...props }, forwardedRef) => {
|
|
923
|
-
const { tx } = useThemeContext();
|
|
924
|
-
return /* @__PURE__ */ React19.createElement(ContextMenuPrimitive.Item, {
|
|
925
|
-
...props,
|
|
926
|
-
className: tx("menu.item", "menu__item", {}, classNames),
|
|
927
|
-
ref: forwardedRef
|
|
928
|
-
});
|
|
929
|
-
});
|
|
930
|
-
var ContextMenuCheckboxItem = /* @__PURE__ */ forwardRef13(({ classNames, ...props }, forwardedRef) => {
|
|
931
|
-
const { tx } = useThemeContext();
|
|
932
|
-
return /* @__PURE__ */ React19.createElement(ContextMenuPrimitive.CheckboxItem, {
|
|
933
|
-
...props,
|
|
934
|
-
className: tx("menu.item", "menu__item--checkbox", {}, classNames),
|
|
935
|
-
ref: forwardedRef
|
|
936
|
-
});
|
|
937
|
-
});
|
|
938
|
-
var ContextMenuSeparator = /* @__PURE__ */ forwardRef13(({ classNames, ...props }, forwardedRef) => {
|
|
939
|
-
const { tx } = useThemeContext();
|
|
940
|
-
return /* @__PURE__ */ React19.createElement(ContextMenuPrimitive.Separator, {
|
|
941
|
-
...props,
|
|
942
|
-
className: tx("menu.separator", "menu__item", {}, classNames),
|
|
943
|
-
ref: forwardedRef
|
|
944
|
-
});
|
|
945
|
-
});
|
|
946
|
-
var ContextMenuGroupLabel = /* @__PURE__ */ forwardRef13(({ classNames, ...props }, forwardedRef) => {
|
|
947
|
-
const { tx } = useThemeContext();
|
|
948
|
-
return /* @__PURE__ */ React19.createElement(ContextMenuPrimitive.Label, {
|
|
949
|
-
...props,
|
|
950
|
-
className: tx("menu.groupLabel", "menu__group__label", {}, classNames),
|
|
951
|
-
ref: forwardedRef
|
|
952
|
-
});
|
|
953
|
-
});
|
|
954
|
-
var ContextMenu2 = {
|
|
955
|
-
Root: ContextMenuRoot,
|
|
956
|
-
Trigger: ContextMenuTrigger,
|
|
957
|
-
Portal: ContextMenuPortal,
|
|
958
|
-
Content: ContextMenuContent,
|
|
959
|
-
Viewport: ContextMenuViewport,
|
|
960
|
-
Arrow: ContextMenuArrow,
|
|
961
|
-
Group: ContextMenuGroup,
|
|
962
|
-
Item: ContextMenuItem,
|
|
963
|
-
CheckboxItem: ContextMenuCheckboxItem,
|
|
964
|
-
ItemIndicator: ContextMenuItemIndicator,
|
|
965
|
-
Separator: ContextMenuSeparator,
|
|
966
|
-
GroupLabel: ContextMenuGroupLabel
|
|
967
|
-
};
|
|
968
|
-
|
|
969
|
-
// packages/ui/react-ui/src/components/Menus/DropdownMenu.tsx
|
|
970
|
-
import { composeEventHandlers } from "@radix-ui/primitive";
|
|
971
|
-
import { composeRefs } from "@radix-ui/react-compose-refs";
|
|
972
|
-
import { createContextScope } from "@radix-ui/react-context";
|
|
973
|
-
import { useId as useId2 } from "@radix-ui/react-id";
|
|
974
|
-
import * as MenuPrimitive from "@radix-ui/react-menu";
|
|
975
|
-
import { createMenuScope } from "@radix-ui/react-menu";
|
|
976
|
-
import { Primitive as Primitive7 } from "@radix-ui/react-primitive";
|
|
977
|
-
import { Slot as Slot7 } from "@radix-ui/react-slot";
|
|
978
|
-
import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
|
979
|
-
import React20, { useRef, useCallback as useCallback4, forwardRef as forwardRef14, useEffect as useEffect3 } from "react";
|
|
980
|
-
var DROPDOWN_MENU_NAME = "DropdownMenu";
|
|
981
|
-
var [createDropdownMenuContext, createDropdownMenuScope] = createContextScope(DROPDOWN_MENU_NAME, [
|
|
982
|
-
createMenuScope
|
|
983
|
-
]);
|
|
984
|
-
var useMenuScope = createMenuScope();
|
|
985
|
-
var [DropdownMenuProvider, useDropdownMenuContext] = createDropdownMenuContext(DROPDOWN_MENU_NAME);
|
|
986
|
-
var DropdownMenuRoot = (props) => {
|
|
987
|
-
const { __scopeDropdownMenu, children, dir, open: openProp, defaultOpen, onOpenChange, modal = true } = props;
|
|
988
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
989
|
-
const triggerRef = useRef(null);
|
|
990
|
-
const [open = false, setOpen] = useControllableState({
|
|
991
|
-
prop: openProp,
|
|
992
|
-
defaultProp: defaultOpen,
|
|
993
|
-
onChange: onOpenChange
|
|
994
|
-
});
|
|
995
|
-
return /* @__PURE__ */ React20.createElement(DropdownMenuProvider, {
|
|
996
|
-
scope: __scopeDropdownMenu,
|
|
997
|
-
triggerId: useId2(),
|
|
998
|
-
triggerRef,
|
|
999
|
-
contentId: useId2(),
|
|
1000
|
-
open,
|
|
1001
|
-
onOpenChange: setOpen,
|
|
1002
|
-
onOpenToggle: useCallback4(() => setOpen((prevOpen) => !prevOpen), [
|
|
1003
|
-
setOpen
|
|
1004
|
-
]),
|
|
1005
|
-
modal
|
|
1006
|
-
}, /* @__PURE__ */ React20.createElement(MenuPrimitive.Root, {
|
|
1007
|
-
...menuScope,
|
|
1008
|
-
open,
|
|
1009
|
-
onOpenChange: setOpen,
|
|
1010
|
-
dir,
|
|
1011
|
-
modal
|
|
1012
|
-
}, children));
|
|
1013
|
-
};
|
|
1014
|
-
DropdownMenuRoot.displayName = DROPDOWN_MENU_NAME;
|
|
1015
|
-
var TRIGGER_NAME = "DropdownMenuTrigger";
|
|
1016
|
-
var DropdownMenuTrigger = /* @__PURE__ */ forwardRef14((props, forwardedRef) => {
|
|
1017
|
-
const { __scopeDropdownMenu, disabled = false, ...triggerProps } = props;
|
|
1018
|
-
const context = useDropdownMenuContext(TRIGGER_NAME, __scopeDropdownMenu);
|
|
1019
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1020
|
-
return /* @__PURE__ */ React20.createElement(MenuPrimitive.Anchor, {
|
|
1021
|
-
asChild: true,
|
|
1022
|
-
...menuScope
|
|
1023
|
-
}, /* @__PURE__ */ React20.createElement(Primitive7.button, {
|
|
1024
|
-
type: "button",
|
|
1025
|
-
id: context.triggerId,
|
|
1026
|
-
"aria-haspopup": "menu",
|
|
1027
|
-
"aria-expanded": context.open,
|
|
1028
|
-
"aria-controls": context.open ? context.contentId : void 0,
|
|
1029
|
-
"data-state": context.open ? "open" : "closed",
|
|
1030
|
-
"data-disabled": disabled ? "" : void 0,
|
|
1031
|
-
disabled,
|
|
1032
|
-
...triggerProps,
|
|
1033
|
-
ref: composeRefs(forwardedRef, context.triggerRef),
|
|
1034
|
-
onPointerDown: composeEventHandlers(props.onPointerDown, (event) => {
|
|
1035
|
-
if (!disabled && event.button === 0 && event.ctrlKey === false) {
|
|
1036
|
-
context.onOpenToggle();
|
|
1037
|
-
if (!context.open) {
|
|
1038
|
-
event.preventDefault();
|
|
1039
|
-
}
|
|
1040
|
-
}
|
|
1041
|
-
}),
|
|
1042
|
-
onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
|
|
1043
|
-
if (disabled) {
|
|
1044
|
-
return;
|
|
1045
|
-
}
|
|
1046
|
-
if ([
|
|
1047
|
-
"Enter",
|
|
1048
|
-
" "
|
|
1049
|
-
].includes(event.key)) {
|
|
1050
|
-
context.onOpenToggle();
|
|
1051
|
-
}
|
|
1052
|
-
if (event.key === "ArrowDown") {
|
|
1053
|
-
context.onOpenChange(true);
|
|
1054
|
-
}
|
|
1055
|
-
if ([
|
|
1056
|
-
"Enter",
|
|
1057
|
-
" ",
|
|
1058
|
-
"ArrowDown"
|
|
1059
|
-
].includes(event.key)) {
|
|
1060
|
-
event.preventDefault();
|
|
1061
|
-
}
|
|
1062
|
-
})
|
|
1063
|
-
}));
|
|
1064
|
-
});
|
|
1065
|
-
DropdownMenuTrigger.displayName = TRIGGER_NAME;
|
|
1066
|
-
var VIRTUAL_TRIGGER_NAME = "DropdownMenuVirtualTrigger";
|
|
1067
|
-
var DropdownMenuVirtualTrigger = (props) => {
|
|
1068
|
-
const { __scopeDropdownMenu, virtualRef } = props;
|
|
1069
|
-
const context = useDropdownMenuContext(VIRTUAL_TRIGGER_NAME, __scopeDropdownMenu);
|
|
1070
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1071
|
-
useEffect3(() => {
|
|
1072
|
-
if (virtualRef.current) {
|
|
1073
|
-
context.triggerRef.current = virtualRef.current;
|
|
1074
|
-
}
|
|
1075
|
-
});
|
|
1076
|
-
return /* @__PURE__ */ React20.createElement(MenuPrimitive.Anchor, {
|
|
1077
|
-
...menuScope,
|
|
1078
|
-
virtualRef
|
|
1079
|
-
});
|
|
1080
|
-
};
|
|
1081
|
-
DropdownMenuVirtualTrigger.displayName = VIRTUAL_TRIGGER_NAME;
|
|
1082
|
-
var PORTAL_NAME = "DropdownMenuPortal";
|
|
1083
|
-
var DropdownMenuPortal = (props) => {
|
|
1084
|
-
const { __scopeDropdownMenu, ...portalProps } = props;
|
|
1085
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1086
|
-
return /* @__PURE__ */ React20.createElement(MenuPrimitive.Portal, {
|
|
1087
|
-
...menuScope,
|
|
1088
|
-
...portalProps
|
|
1089
|
-
});
|
|
1090
|
-
};
|
|
1091
|
-
DropdownMenuPortal.displayName = PORTAL_NAME;
|
|
1092
|
-
var DropdownMenuViewport = /* @__PURE__ */ forwardRef14(({ classNames, asChild, children, ...props }, forwardedRef) => {
|
|
1093
|
-
const { tx } = useThemeContext();
|
|
1094
|
-
const Root5 = asChild ? Slot7 : Primitive7.div;
|
|
1095
|
-
return /* @__PURE__ */ React20.createElement(Root5, {
|
|
1096
|
-
...props,
|
|
1097
|
-
className: tx("menu.viewport", "menu__viewport", {}, classNames),
|
|
1098
|
-
ref: forwardedRef
|
|
1099
|
-
}, children);
|
|
1100
|
-
});
|
|
1101
|
-
var CONTENT_NAME = "DropdownMenuContent";
|
|
1102
|
-
var DropdownMenuContent = /* @__PURE__ */ forwardRef14((props, forwardedRef) => {
|
|
1103
|
-
const { __scopeDropdownMenu, classNames, collisionPadding = 8, ...contentProps } = props;
|
|
1104
|
-
const { tx } = useThemeContext();
|
|
1105
|
-
const context = useDropdownMenuContext(CONTENT_NAME, __scopeDropdownMenu);
|
|
1106
|
-
const elevation = useElevationContext();
|
|
1107
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1108
|
-
const hasInteractedOutsideRef = useRef(false);
|
|
1109
|
-
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
1110
|
-
return /* @__PURE__ */ React20.createElement(MenuPrimitive.Content, {
|
|
1111
|
-
id: context.contentId,
|
|
1112
|
-
"aria-labelledby": context.triggerId,
|
|
1113
|
-
...menuScope,
|
|
1114
|
-
...contentProps,
|
|
1115
|
-
collisionPadding: safeCollisionPadding,
|
|
1116
|
-
ref: forwardedRef,
|
|
1117
|
-
onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
1118
|
-
if (!hasInteractedOutsideRef.current) {
|
|
1119
|
-
context.triggerRef.current?.focus();
|
|
1120
|
-
}
|
|
1121
|
-
hasInteractedOutsideRef.current = false;
|
|
1122
|
-
event.preventDefault();
|
|
1123
|
-
}),
|
|
1124
|
-
onInteractOutside: composeEventHandlers(props.onInteractOutside, (event) => {
|
|
1125
|
-
const originalEvent = event.detail.originalEvent;
|
|
1126
|
-
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
1127
|
-
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
1128
|
-
if (!context.modal || isRightClick) {
|
|
1129
|
-
hasInteractedOutsideRef.current = true;
|
|
1130
|
-
}
|
|
1131
|
-
}),
|
|
1132
|
-
className: tx("menu.content", "menu", {
|
|
1133
|
-
elevation
|
|
1134
|
-
}, classNames),
|
|
1135
|
-
style: {
|
|
1136
|
-
...props.style,
|
|
1137
|
-
// re-namespace exposed content custom properties
|
|
1138
|
-
...{
|
|
1139
|
-
"--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
1140
|
-
"--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
|
|
1141
|
-
"--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
|
|
1142
|
-
"--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
|
|
1143
|
-
"--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
|
|
1144
|
-
}
|
|
1145
|
-
}
|
|
1146
|
-
});
|
|
1147
|
-
});
|
|
1148
|
-
DropdownMenuContent.displayName = CONTENT_NAME;
|
|
1149
|
-
var GROUP_NAME = "DropdownMenuGroup";
|
|
1150
|
-
var DropdownMenuGroup = /* @__PURE__ */ forwardRef14((props, forwardedRef) => {
|
|
1151
|
-
const { __scopeDropdownMenu, ...groupProps } = props;
|
|
1152
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1153
|
-
return /* @__PURE__ */ React20.createElement(MenuPrimitive.Group, {
|
|
1154
|
-
...menuScope,
|
|
1155
|
-
...groupProps,
|
|
1156
|
-
ref: forwardedRef
|
|
1157
|
-
});
|
|
1158
|
-
});
|
|
1159
|
-
DropdownMenuGroup.displayName = GROUP_NAME;
|
|
1160
|
-
var LABEL_NAME = "DropdownMenuLabel";
|
|
1161
|
-
var DropdownMenuGroupLabel = /* @__PURE__ */ forwardRef14((props, forwardedRef) => {
|
|
1162
|
-
const { __scopeDropdownMenu, classNames, ...labelProps } = props;
|
|
1163
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1164
|
-
const { tx } = useThemeContext();
|
|
1165
|
-
return /* @__PURE__ */ React20.createElement(MenuPrimitive.Label, {
|
|
1166
|
-
...menuScope,
|
|
1167
|
-
...labelProps,
|
|
1168
|
-
className: tx("menu.groupLabel", "menu__group__label", {}, classNames),
|
|
1169
|
-
ref: forwardedRef
|
|
1170
|
-
});
|
|
1171
|
-
});
|
|
1172
|
-
DropdownMenuGroupLabel.displayName = LABEL_NAME;
|
|
1173
|
-
var ITEM_NAME = "DropdownMenuItem";
|
|
1174
|
-
var DropdownMenuItem = /* @__PURE__ */ forwardRef14((props, forwardedRef) => {
|
|
1175
|
-
const { __scopeDropdownMenu, classNames, ...itemProps } = props;
|
|
1176
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1177
|
-
const { tx } = useThemeContext();
|
|
1178
|
-
return /* @__PURE__ */ React20.createElement(MenuPrimitive.Item, {
|
|
1179
|
-
...menuScope,
|
|
1180
|
-
...itemProps,
|
|
1181
|
-
className: tx("menu.item", "menu__item", {}, classNames),
|
|
1182
|
-
ref: forwardedRef
|
|
1183
|
-
});
|
|
1184
|
-
});
|
|
1185
|
-
DropdownMenuItem.displayName = ITEM_NAME;
|
|
1186
|
-
var CHECKBOX_ITEM_NAME = "DropdownMenuCheckboxItem";
|
|
1187
|
-
var DropdownMenuCheckboxItem = /* @__PURE__ */ forwardRef14((props, forwardedRef) => {
|
|
1188
|
-
const { __scopeDropdownMenu, classNames, ...checkboxItemProps } = props;
|
|
1189
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1190
|
-
const { tx } = useThemeContext();
|
|
1191
|
-
return /* @__PURE__ */ React20.createElement(MenuPrimitive.CheckboxItem, {
|
|
1192
|
-
...menuScope,
|
|
1193
|
-
...checkboxItemProps,
|
|
1194
|
-
className: tx("menu.item", "menu__item--checkbox", {}, classNames),
|
|
1195
|
-
ref: forwardedRef
|
|
1196
|
-
});
|
|
1197
|
-
});
|
|
1198
|
-
DropdownMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;
|
|
1199
|
-
var RADIO_GROUP_NAME = "DropdownMenuRadioGroup";
|
|
1200
|
-
var DropdownMenuRadioGroup = /* @__PURE__ */ forwardRef14((props, forwardedRef) => {
|
|
1201
|
-
const { __scopeDropdownMenu, ...radioGroupProps } = props;
|
|
1202
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1203
|
-
return /* @__PURE__ */ React20.createElement(MenuPrimitive.RadioGroup, {
|
|
1204
|
-
...menuScope,
|
|
1205
|
-
...radioGroupProps,
|
|
1206
|
-
ref: forwardedRef
|
|
1207
|
-
});
|
|
1208
|
-
});
|
|
1209
|
-
DropdownMenuRadioGroup.displayName = RADIO_GROUP_NAME;
|
|
1210
|
-
var RADIO_ITEM_NAME = "DropdownMenuRadioItem";
|
|
1211
|
-
var DropdownMenuRadioItem = /* @__PURE__ */ forwardRef14((props, forwardedRef) => {
|
|
1212
|
-
const { __scopeDropdownMenu, ...radioItemProps } = props;
|
|
1213
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1214
|
-
return /* @__PURE__ */ React20.createElement(MenuPrimitive.RadioItem, {
|
|
1215
|
-
...menuScope,
|
|
1216
|
-
...radioItemProps,
|
|
1217
|
-
ref: forwardedRef
|
|
1218
|
-
});
|
|
1219
|
-
});
|
|
1220
|
-
DropdownMenuRadioItem.displayName = RADIO_ITEM_NAME;
|
|
1221
|
-
var INDICATOR_NAME = "DropdownMenuItemIndicator";
|
|
1222
|
-
var DropdownMenuItemIndicator = /* @__PURE__ */ forwardRef14((props, forwardedRef) => {
|
|
1223
|
-
const { __scopeDropdownMenu, ...itemIndicatorProps } = props;
|
|
1224
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1225
|
-
return /* @__PURE__ */ React20.createElement(MenuPrimitive.ItemIndicator, {
|
|
1226
|
-
...menuScope,
|
|
1227
|
-
...itemIndicatorProps,
|
|
1228
|
-
ref: forwardedRef
|
|
1229
|
-
});
|
|
1230
|
-
});
|
|
1231
|
-
DropdownMenuItemIndicator.displayName = INDICATOR_NAME;
|
|
1232
|
-
var SEPARATOR_NAME = "DropdownMenuSeparator";
|
|
1233
|
-
var DropdownMenuSeparator = /* @__PURE__ */ forwardRef14((props, forwardedRef) => {
|
|
1234
|
-
const { __scopeDropdownMenu, classNames, ...separatorProps } = props;
|
|
1235
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1236
|
-
const { tx } = useThemeContext();
|
|
1237
|
-
return /* @__PURE__ */ React20.createElement(MenuPrimitive.Separator, {
|
|
1238
|
-
...menuScope,
|
|
1239
|
-
...separatorProps,
|
|
1240
|
-
className: tx("menu.separator", "menu__item", {}, classNames),
|
|
1241
|
-
ref: forwardedRef
|
|
1242
|
-
});
|
|
1243
|
-
});
|
|
1244
|
-
DropdownMenuSeparator.displayName = SEPARATOR_NAME;
|
|
1245
|
-
var ARROW_NAME = "DropdownMenuArrow";
|
|
1246
|
-
var DropdownMenuArrow = /* @__PURE__ */ forwardRef14((props, forwardedRef) => {
|
|
1247
|
-
const { __scopeDropdownMenu, classNames, ...arrowProps } = props;
|
|
1248
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1249
|
-
const { tx } = useThemeContext();
|
|
1250
|
-
return /* @__PURE__ */ React20.createElement(MenuPrimitive.Arrow, {
|
|
1251
|
-
...menuScope,
|
|
1252
|
-
...arrowProps,
|
|
1253
|
-
className: tx("menu.arrow", "menu__arrow", {}, classNames),
|
|
1254
|
-
ref: forwardedRef
|
|
1255
|
-
});
|
|
1256
|
-
});
|
|
1257
|
-
DropdownMenuArrow.displayName = ARROW_NAME;
|
|
1258
|
-
var DropdownMenuSub = (props) => {
|
|
1259
|
-
const { __scopeDropdownMenu, children, open: openProp, onOpenChange, defaultOpen } = props;
|
|
1260
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1261
|
-
const [open = false, setOpen] = useControllableState({
|
|
1262
|
-
prop: openProp,
|
|
1263
|
-
defaultProp: defaultOpen,
|
|
1264
|
-
onChange: onOpenChange
|
|
1265
|
-
});
|
|
1266
|
-
return /* @__PURE__ */ React20.createElement(MenuPrimitive.Sub, {
|
|
1267
|
-
...menuScope,
|
|
1268
|
-
open,
|
|
1269
|
-
onOpenChange: setOpen
|
|
1270
|
-
}, children);
|
|
1271
|
-
};
|
|
1272
|
-
var SUB_TRIGGER_NAME = "DropdownMenuSubTrigger";
|
|
1273
|
-
var DropdownMenuSubTrigger = /* @__PURE__ */ forwardRef14((props, forwardedRef) => {
|
|
1274
|
-
const { __scopeDropdownMenu, ...subTriggerProps } = props;
|
|
1275
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1276
|
-
return /* @__PURE__ */ React20.createElement(MenuPrimitive.SubTrigger, {
|
|
1277
|
-
...menuScope,
|
|
1278
|
-
...subTriggerProps,
|
|
1279
|
-
ref: forwardedRef
|
|
1280
|
-
});
|
|
1281
|
-
});
|
|
1282
|
-
DropdownMenuSubTrigger.displayName = SUB_TRIGGER_NAME;
|
|
1283
|
-
var SUB_CONTENT_NAME = "DropdownMenuSubContent";
|
|
1284
|
-
var DropdownMenuSubContent = /* @__PURE__ */ forwardRef14((props, forwardedRef) => {
|
|
1285
|
-
const { __scopeDropdownMenu, ...subContentProps } = props;
|
|
1286
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1287
|
-
return /* @__PURE__ */ React20.createElement(MenuPrimitive.SubContent, {
|
|
1288
|
-
...menuScope,
|
|
1289
|
-
...subContentProps,
|
|
1290
|
-
ref: forwardedRef,
|
|
1291
|
-
style: {
|
|
1292
|
-
...props.style,
|
|
1293
|
-
// re-namespace exposed content custom properties
|
|
1294
|
-
...{
|
|
1295
|
-
"--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
1296
|
-
"--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
|
|
1297
|
-
"--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
|
|
1298
|
-
"--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
|
|
1299
|
-
"--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
|
|
1300
|
-
}
|
|
1301
|
-
}
|
|
1302
|
-
});
|
|
1303
|
-
});
|
|
1304
|
-
DropdownMenuSubContent.displayName = SUB_CONTENT_NAME;
|
|
1305
|
-
var DropdownMenu = {
|
|
1306
|
-
Root: DropdownMenuRoot,
|
|
1307
|
-
Trigger: DropdownMenuTrigger,
|
|
1308
|
-
VirtualTrigger: DropdownMenuVirtualTrigger,
|
|
1309
|
-
Portal: DropdownMenuPortal,
|
|
1310
|
-
Content: DropdownMenuContent,
|
|
1311
|
-
Viewport: DropdownMenuViewport,
|
|
1312
|
-
Group: DropdownMenuGroup,
|
|
1313
|
-
GroupLabel: DropdownMenuGroupLabel,
|
|
1314
|
-
Item: DropdownMenuItem,
|
|
1315
|
-
CheckboxItem: DropdownMenuCheckboxItem,
|
|
1316
|
-
RadioGroup: DropdownMenuRadioGroup,
|
|
1317
|
-
RadioItem: DropdownMenuRadioItem,
|
|
1318
|
-
ItemIndicator: DropdownMenuItemIndicator,
|
|
1319
|
-
Separator: DropdownMenuSeparator,
|
|
1320
|
-
Arrow: DropdownMenuArrow,
|
|
1321
|
-
Sub: DropdownMenuSub,
|
|
1322
|
-
SubTrigger: DropdownMenuSubTrigger,
|
|
1323
|
-
SubContent: DropdownMenuSubContent
|
|
1324
|
-
};
|
|
1325
|
-
var useDropdownMenuMenuScope = useMenuScope;
|
|
1326
|
-
|
|
1327
|
-
// packages/ui/react-ui/src/components/Input/Input.tsx
|
|
1328
|
-
import { Root as CheckboxPrimitive } from "@radix-ui/react-checkbox";
|
|
1329
|
-
import { useControllableState as useControllableState2 } from "@radix-ui/react-use-controllable-state";
|
|
1330
|
-
import React21, { forwardRef as forwardRef15, useCallback as useCallback5 } from "react";
|
|
1331
|
-
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";
|
|
1332
|
-
import { mx as mx3 } from "@dxos/react-ui-theme";
|
|
1333
|
-
var Label3 = /* @__PURE__ */ forwardRef15(({ srOnly, classNames, children, ...props }, forwardedRef) => {
|
|
1334
|
-
const { tx } = useThemeContext();
|
|
1335
|
-
return /* @__PURE__ */ React21.createElement(LabelPrimitive, {
|
|
1336
|
-
...props,
|
|
1337
|
-
className: tx("input.label", "input__label", {
|
|
1338
|
-
srOnly
|
|
1339
|
-
}, classNames),
|
|
1340
|
-
ref: forwardedRef
|
|
1341
|
-
}, children);
|
|
1342
|
-
});
|
|
1343
|
-
var Description = /* @__PURE__ */ forwardRef15(({ srOnly, classNames, children, ...props }, forwardedRef) => {
|
|
1344
|
-
const { tx } = useThemeContext();
|
|
1345
|
-
return /* @__PURE__ */ React21.createElement(DescriptionPrimitive, {
|
|
1346
|
-
...props,
|
|
1347
|
-
className: tx("input.description", "input__description", {
|
|
1348
|
-
srOnly
|
|
1349
|
-
}, classNames),
|
|
1350
|
-
ref: forwardedRef
|
|
1351
|
-
}, children);
|
|
1352
|
-
});
|
|
1353
|
-
var Validation = /* @__PURE__ */ forwardRef15(({ __inputScope, srOnly, classNames, children, ...props }, forwardedRef) => {
|
|
1354
|
-
const { tx } = useThemeContext();
|
|
1355
|
-
const { validationValence } = useInputContext(INPUT_NAME, __inputScope);
|
|
1356
|
-
return /* @__PURE__ */ React21.createElement(ValidationPrimitive, {
|
|
1357
|
-
...props,
|
|
1358
|
-
className: tx("input.validation", `input__validation-message input__validation-message--${validationValence}`, {
|
|
1359
|
-
srOnly,
|
|
1360
|
-
validationValence
|
|
1361
|
-
}, classNames),
|
|
1362
|
-
ref: forwardedRef
|
|
1363
|
-
}, children);
|
|
1364
|
-
});
|
|
1365
|
-
var DescriptionAndValidation = /* @__PURE__ */ forwardRef15(({ srOnly, classNames, children, ...props }, forwardedRef) => {
|
|
1366
|
-
const { tx } = useThemeContext();
|
|
1367
|
-
return /* @__PURE__ */ React21.createElement(DescriptionAndValidationPrimitive, {
|
|
1368
|
-
...props,
|
|
1369
|
-
className: tx("input.descriptionAndValidation", "input__description-and-validation", {
|
|
1370
|
-
srOnly
|
|
1371
|
-
}, classNames),
|
|
1372
|
-
ref: forwardedRef
|
|
1373
|
-
}, children);
|
|
1374
|
-
});
|
|
1375
|
-
var PinInput = /* @__PURE__ */ forwardRef15(({ density: propsDensity, elevation: propsElevation, segmentClassName: propsSegmentClassName, inputClassName, variant, ...props }, forwardedRef) => {
|
|
1376
|
-
const { hasIosKeyboard: hasIosKeyboard2 } = useThemeContext();
|
|
1377
|
-
const { tx } = useThemeContext();
|
|
1378
|
-
const density = useDensityContext(propsDensity);
|
|
1379
|
-
const elevation = useElevationContext(propsElevation);
|
|
1380
|
-
const segmentClassName = useCallback5(({ focused, validationValence }) => tx("input.input", "input--pin-segment", {
|
|
1381
|
-
variant: "static",
|
|
1382
|
-
focused,
|
|
1383
|
-
disabled: props.disabled,
|
|
1384
|
-
density,
|
|
1385
|
-
elevation,
|
|
1386
|
-
validationValence
|
|
1387
|
-
}, propsSegmentClassName), [
|
|
1388
|
-
tx,
|
|
1389
|
-
props.disabled,
|
|
1390
|
-
elevation,
|
|
1391
|
-
propsElevation,
|
|
1392
|
-
density
|
|
1393
|
-
]);
|
|
1394
|
-
return /* @__PURE__ */ React21.createElement(PinInputPrimitive, {
|
|
1395
|
-
...props,
|
|
1396
|
-
segmentClassName,
|
|
1397
|
-
...props.autoFocus && !hasIosKeyboard2 && {
|
|
1398
|
-
autoFocus: true
|
|
1399
|
-
},
|
|
1400
|
-
inputClassName: tx("input.inputWithSegments", "input input--pin", {
|
|
1401
|
-
disabled: props.disabled
|
|
1402
|
-
}, inputClassName),
|
|
1403
|
-
ref: forwardedRef
|
|
1404
|
-
});
|
|
1405
|
-
});
|
|
1406
|
-
var TextInput = /* @__PURE__ */ forwardRef15(({ __inputScope, classNames, density: propsDensity, elevation: propsElevation, variant, ...props }, forwardedRef) => {
|
|
1407
|
-
const { hasIosKeyboard: hasIosKeyboard2 } = useThemeContext();
|
|
1408
|
-
const themeContextValue = useThemeContext();
|
|
1409
|
-
const density = useDensityContext(propsDensity);
|
|
1410
|
-
const elevation = useElevationContext(propsElevation);
|
|
1411
|
-
const { validationValence } = useInputContext(INPUT_NAME, __inputScope);
|
|
1412
|
-
const { tx } = themeContextValue;
|
|
1413
|
-
return /* @__PURE__ */ React21.createElement(TextInputPrimitive, {
|
|
1414
|
-
...props,
|
|
1415
|
-
className: tx("input.input", "input", {
|
|
1416
|
-
variant,
|
|
1417
|
-
disabled: props.disabled,
|
|
1418
|
-
density,
|
|
1419
|
-
elevation,
|
|
1420
|
-
validationValence
|
|
1421
|
-
}, classNames),
|
|
1422
|
-
...props.autoFocus && !hasIosKeyboard2 && {
|
|
1423
|
-
autoFocus: true
|
|
1424
|
-
},
|
|
1425
|
-
ref: forwardedRef
|
|
1426
|
-
});
|
|
1427
|
-
});
|
|
1428
|
-
var TextArea = /* @__PURE__ */ forwardRef15(({ __inputScope, classNames, density: propsDensity, elevation: propsElevation, variant, ...props }, forwardedRef) => {
|
|
1429
|
-
const { hasIosKeyboard: hasIosKeyboard2 } = useThemeContext();
|
|
1430
|
-
const { tx } = useThemeContext();
|
|
1431
|
-
const density = useDensityContext(propsDensity);
|
|
1432
|
-
const elevation = useElevationContext(propsElevation);
|
|
1433
|
-
const { validationValence } = useInputContext(INPUT_NAME, __inputScope);
|
|
1434
|
-
return /* @__PURE__ */ React21.createElement(TextAreaPrimitive, {
|
|
1435
|
-
...props,
|
|
1436
|
-
className: tx("input.input", "input--text-area", {
|
|
1437
|
-
variant,
|
|
1438
|
-
disabled: props.disabled,
|
|
1439
|
-
density,
|
|
1440
|
-
elevation,
|
|
1441
|
-
validationValence
|
|
1442
|
-
}, classNames),
|
|
1443
|
-
...props.autoFocus && !hasIosKeyboard2 && {
|
|
1444
|
-
autoFocus: true
|
|
1445
|
-
},
|
|
1446
|
-
ref: forwardedRef
|
|
1447
|
-
});
|
|
1448
|
-
});
|
|
1449
|
-
var Checkbox = /* @__PURE__ */ forwardRef15(({ __inputScope, checked: propsChecked, defaultChecked: propsDefaultChecked, onCheckedChange: propsOnCheckedChange, size, weight = "bold", classNames, ...props }, forwardedRef) => {
|
|
1450
|
-
const [checked, onCheckedChange] = useControllableState2({
|
|
1451
|
-
prop: propsChecked,
|
|
1452
|
-
defaultProp: propsDefaultChecked,
|
|
1453
|
-
onChange: propsOnCheckedChange
|
|
1454
|
-
});
|
|
1455
|
-
const { id, validationValence, descriptionId, errorMessageId } = useInputContext(INPUT_NAME, __inputScope);
|
|
1456
|
-
const { tx } = useThemeContext();
|
|
1457
|
-
return /* @__PURE__ */ React21.createElement(CheckboxPrimitive, {
|
|
1458
|
-
...props,
|
|
1459
|
-
checked,
|
|
1460
|
-
onCheckedChange,
|
|
1461
|
-
id,
|
|
1462
|
-
"aria-describedby": descriptionId,
|
|
1463
|
-
...validationValence === "error" && {
|
|
1464
|
-
"aria-invalid": "true",
|
|
1465
|
-
"aria-errormessage": errorMessageId
|
|
1466
|
-
},
|
|
1467
|
-
className: tx("input.checkbox", "input--checkbox", {
|
|
1468
|
-
size
|
|
1469
|
-
}, "shrink-0", classNames),
|
|
1470
|
-
ref: forwardedRef
|
|
1471
|
-
}, /* @__PURE__ */ React21.createElement(Icon, {
|
|
1472
|
-
icon: checked === "indeterminate" ? "ph--minus--regular" : "ph--check--regular",
|
|
1473
|
-
classNames: tx("input.checkboxIndicator", "input--checkbox__indicator", {
|
|
1474
|
-
size,
|
|
1475
|
-
checked
|
|
1476
|
-
})
|
|
1477
|
-
}));
|
|
1478
|
-
});
|
|
1479
|
-
var Switch = /* @__PURE__ */ forwardRef15(({ __inputScope, checked: propsChecked, defaultChecked: propsDefaultChecked, onCheckedChange: propsOnCheckedChange, classNames, ...props }, forwardedRef) => {
|
|
1480
|
-
const [checked, onCheckedChange] = useControllableState2({
|
|
1481
|
-
prop: propsChecked,
|
|
1482
|
-
defaultProp: propsDefaultChecked ?? false,
|
|
1483
|
-
onChange: propsOnCheckedChange
|
|
1484
|
-
});
|
|
1485
|
-
const { id, validationValence, descriptionId, errorMessageId } = useInputContext(INPUT_NAME, __inputScope);
|
|
1486
|
-
return /* @__PURE__ */ React21.createElement("input", {
|
|
1487
|
-
type: "checkbox",
|
|
1488
|
-
className: mx3("dx-checkbox--switch dx-focus-ring", classNames),
|
|
1489
|
-
checked,
|
|
1490
|
-
onChange: (event) => {
|
|
1491
|
-
onCheckedChange(event.target.checked);
|
|
1492
|
-
},
|
|
1493
|
-
id,
|
|
1494
|
-
"aria-describedby": descriptionId,
|
|
1495
|
-
...props,
|
|
1496
|
-
...validationValence === "error" && {
|
|
1497
|
-
"aria-invalid": "true",
|
|
1498
|
-
"aria-errormessage": errorMessageId
|
|
1499
|
-
},
|
|
1500
|
-
ref: forwardedRef
|
|
1501
|
-
});
|
|
1502
|
-
});
|
|
1503
|
-
var Input = {
|
|
1504
|
-
Root: InputRoot,
|
|
1505
|
-
PinInput,
|
|
1506
|
-
TextInput,
|
|
1507
|
-
TextArea,
|
|
1508
|
-
Checkbox,
|
|
1509
|
-
Switch,
|
|
1510
|
-
Label: Label3,
|
|
1511
|
-
Description,
|
|
1512
|
-
Validation,
|
|
1513
|
-
DescriptionAndValidation
|
|
1514
|
-
};
|
|
1515
|
-
|
|
1516
|
-
// packages/ui/react-ui/src/components/Lists/List.tsx
|
|
1517
|
-
import { CaretDown, CaretRight } from "@phosphor-icons/react";
|
|
1518
|
-
import { Slot as Slot8 } from "@radix-ui/react-slot";
|
|
1519
|
-
import React23, { forwardRef as forwardRef16 } from "react";
|
|
1520
|
-
import { List as ListPrimitive, ListItemHeading as ListPrimitiveItemHeading, ListItemOpenTrigger as ListPrimitiveItemOpenTrigger, ListItemCollapsibleContent, ListItem as ListPrimitiveItem, LIST_NAME, LIST_ITEM_NAME, useListContext, useListItemContext } from "@dxos/react-list";
|
|
1521
|
-
|
|
1522
|
-
// packages/ui/react-ui/src/components/Lists/ListDropIndicator.tsx
|
|
1523
|
-
import React22 from "react";
|
|
1524
|
-
var edgeToOrientationMap = {
|
|
1525
|
-
top: "horizontal",
|
|
1526
|
-
bottom: "horizontal",
|
|
1527
|
-
left: "vertical",
|
|
1528
|
-
right: "vertical"
|
|
1529
|
-
};
|
|
1530
|
-
var orientationStyles = {
|
|
1531
|
-
horizontal: "h-[--line-thickness] left-[calc(var(--line-inset)+var(--terminal-radius))] right-[--line-inset] before:left-[--terminal-inset]",
|
|
1532
|
-
vertical: "w-[--line-thickness] top-[calc(var(--line-inset)+var(--terminal-radius))] bottom-[--line-inset] before:top-[--terminal-inset]"
|
|
1533
|
-
};
|
|
1534
|
-
var edgeStyles = {
|
|
1535
|
-
top: "top-[--line-offset] before:top-[--offset-terminal]",
|
|
1536
|
-
right: "right-[--line-offset] before:right-[--offset-terminal]",
|
|
1537
|
-
bottom: "bottom-[--line-offset] before:bottom-[--offset-terminal]",
|
|
1538
|
-
left: "left-[--line-offset] before:left-[--offset-terminal]"
|
|
1539
|
-
};
|
|
1540
|
-
var strokeSize = 2;
|
|
1541
|
-
var terminalSize = 8;
|
|
1542
|
-
var offsetToAlignTerminalWithLine = (strokeSize - terminalSize) / 2;
|
|
1543
|
-
var ListDropIndicator = ({ edge, gap = 0, lineInset = 0, terminalInset = lineInset - terminalSize }) => {
|
|
1544
|
-
const orientation = edgeToOrientationMap[edge];
|
|
1545
|
-
return /* @__PURE__ */ React22.createElement("div", {
|
|
1546
|
-
role: "none",
|
|
1547
|
-
style: {
|
|
1548
|
-
"--line-thickness": `${strokeSize}px`,
|
|
1549
|
-
"--line-offset": `calc(-0.5 * (${gap}px + ${strokeSize}px))`,
|
|
1550
|
-
"--line-inset": `${lineInset}px`,
|
|
1551
|
-
"--terminal-size": `${terminalSize}px`,
|
|
1552
|
-
"--terminal-radius": `${terminalSize / 2}px`,
|
|
1553
|
-
"--terminal-inset": `${terminalInset}px`,
|
|
1554
|
-
"--offset-terminal": `${offsetToAlignTerminalWithLine}px`
|
|
1555
|
-
},
|
|
1556
|
-
className: `absolute z-10 pointer-events-none bg-accentSurface before:content-[''] before:w-[--terminal-size] before:h-[--terminal-size] box-border before:absolute before:border-[length:--line-thickness] before:border-solid before:border-accentSurface before:rounded-full ${orientationStyles[orientation]} ${edgeStyles[edge]}`
|
|
1557
|
-
});
|
|
1558
|
-
};
|
|
1559
|
-
|
|
1560
|
-
// packages/ui/react-ui/src/components/Lists/List.tsx
|
|
1561
|
-
var List = /* @__PURE__ */ forwardRef16(({ classNames, children, ...props }, forwardedRef) => {
|
|
1562
|
-
const { tx } = useThemeContext();
|
|
1563
|
-
const density = useDensityContext(props.density);
|
|
1564
|
-
return /* @__PURE__ */ React23.createElement(DensityProvider, {
|
|
1565
|
-
density
|
|
1566
|
-
}, /* @__PURE__ */ React23.createElement(ListPrimitive, {
|
|
1567
|
-
...props,
|
|
1568
|
-
className: tx("list.root", "list", {}, classNames),
|
|
1569
|
-
ref: forwardedRef
|
|
1570
|
-
}, children));
|
|
1571
|
-
});
|
|
1572
|
-
var ListItemEndcap = /* @__PURE__ */ forwardRef16(({ children, classNames, asChild, ...props }, forwardedRef) => {
|
|
1573
|
-
const Root5 = asChild ? Slot8 : "div";
|
|
1574
|
-
const density = useDensityContext();
|
|
1575
|
-
const { tx } = useThemeContext();
|
|
1576
|
-
return /* @__PURE__ */ React23.createElement(Root5, {
|
|
1577
|
-
...!asChild && {
|
|
1578
|
-
role: "none"
|
|
1579
|
-
},
|
|
1580
|
-
...props,
|
|
1581
|
-
className: tx("list.item.endcap", "list__listItem__endcap", {
|
|
1582
|
-
density
|
|
1583
|
-
}, classNames),
|
|
1584
|
-
ref: forwardedRef
|
|
1585
|
-
}, children);
|
|
1586
|
-
});
|
|
1587
|
-
var MockListItemOpenTrigger = ({ classNames, ...props }) => {
|
|
1588
|
-
const density = useDensityContext();
|
|
1589
|
-
const { tx } = useThemeContext();
|
|
1590
|
-
return /* @__PURE__ */ React23.createElement("div", {
|
|
1591
|
-
role: "none",
|
|
1592
|
-
...props,
|
|
1593
|
-
className: tx("list.item.openTrigger", "list__listItem__openTrigger--mock", {
|
|
1594
|
-
density
|
|
1595
|
-
}, classNames)
|
|
1596
|
-
});
|
|
1597
|
-
};
|
|
1598
|
-
var ListItemHeading = /* @__PURE__ */ forwardRef16(({ children, classNames, ...props }, forwardedRef) => {
|
|
1599
|
-
const { tx } = useThemeContext();
|
|
1600
|
-
const density = useDensityContext();
|
|
1601
|
-
return /* @__PURE__ */ React23.createElement(ListPrimitiveItemHeading, {
|
|
1602
|
-
...props,
|
|
1603
|
-
className: tx("list.item.heading", "list__listItem__heading", {
|
|
1604
|
-
density
|
|
1605
|
-
}, classNames),
|
|
1606
|
-
ref: forwardedRef
|
|
1607
|
-
}, children);
|
|
1608
|
-
});
|
|
1609
|
-
var ListItemOpenTrigger = /* @__PURE__ */ forwardRef16(({ __listItemScope, classNames, children, ...props }, forwardedRef) => {
|
|
1610
|
-
const { tx } = useThemeContext();
|
|
1611
|
-
const density = useDensityContext();
|
|
1612
|
-
const { open } = useListItemContext(LIST_ITEM_NAME, __listItemScope);
|
|
1613
|
-
const Icon3 = open ? CaretDown : CaretRight;
|
|
1614
|
-
return /* @__PURE__ */ React23.createElement(ListPrimitiveItemOpenTrigger, {
|
|
1615
|
-
...props,
|
|
1616
|
-
className: tx("list.item.openTrigger", "list__listItem__openTrigger", {
|
|
1617
|
-
density
|
|
1618
|
-
}, classNames),
|
|
1619
|
-
ref: forwardedRef
|
|
1620
|
-
}, children || /* @__PURE__ */ React23.createElement(Icon3, {
|
|
1621
|
-
weight: "bold",
|
|
1622
|
-
className: tx("list.item.openTriggerIcon", "list__listItem__openTrigger__icon", {})
|
|
1623
|
-
}));
|
|
1624
|
-
});
|
|
1625
|
-
var ListItemRoot = /* @__PURE__ */ forwardRef16(({ classNames, children, ...props }, forwardedRef) => {
|
|
1626
|
-
const { tx } = useThemeContext();
|
|
1627
|
-
const density = useDensityContext();
|
|
1628
|
-
return /* @__PURE__ */ React23.createElement(ListPrimitiveItem, {
|
|
1629
|
-
...props,
|
|
1630
|
-
className: tx("list.item.root", "list__listItem", {
|
|
1631
|
-
density,
|
|
1632
|
-
collapsible: props.collapsible
|
|
1633
|
-
}, classNames),
|
|
1634
|
-
ref: forwardedRef
|
|
1635
|
-
}, children);
|
|
1636
|
-
});
|
|
1637
|
-
var ListItem = {
|
|
1638
|
-
Root: ListItemRoot,
|
|
1639
|
-
Endcap: ListItemEndcap,
|
|
1640
|
-
Heading: ListItemHeading,
|
|
1641
|
-
OpenTrigger: ListItemOpenTrigger,
|
|
1642
|
-
CollapsibleContent: ListItemCollapsibleContent,
|
|
1643
|
-
MockOpenTrigger: MockListItemOpenTrigger,
|
|
1644
|
-
DropIndicator: ListDropIndicator
|
|
1645
|
-
};
|
|
1646
|
-
|
|
1647
|
-
// packages/ui/react-ui/src/components/Lists/Tree.tsx
|
|
1648
|
-
import React25, { forwardRef as forwardRef17 } from "react";
|
|
1649
|
-
|
|
1650
|
-
// packages/ui/react-ui/src/components/Lists/TreeDropIndicator.tsx
|
|
1651
|
-
import React24 from "react";
|
|
1652
|
-
var edgeToOrientationMap2 = {
|
|
1653
|
-
"reorder-above": "sibling",
|
|
1654
|
-
"reorder-below": "sibling",
|
|
1655
|
-
"make-child": "child",
|
|
1656
|
-
reparent: "child"
|
|
1657
|
-
};
|
|
1658
|
-
var orientationStyles2 = {
|
|
1659
|
-
// TODO(wittjosiah): Stop using left/right here.
|
|
1660
|
-
sibling: "bs-[--line-thickness] left-[--horizontal-indent] right-0 bg-accentSurface before:left-[--negative-terminal-size]",
|
|
1661
|
-
child: "is-full block-start-0 block-end-0 border-[length:--line-thickness] before:invisible"
|
|
1662
|
-
};
|
|
1663
|
-
var instructionStyles = {
|
|
1664
|
-
"reorder-above": "block-start-[--line-offset] before:block-start-[--offset-terminal]",
|
|
1665
|
-
"reorder-below": "block-end-[--line-offset] before:block-end-[--offset-terminal]",
|
|
1666
|
-
"make-child": "border-accentSurface",
|
|
1667
|
-
// TODO(wittjosiah): This is not occurring in the current implementation.
|
|
1668
|
-
reparent: ""
|
|
1669
|
-
};
|
|
1670
|
-
var strokeSize2 = 2;
|
|
1671
|
-
var terminalSize2 = 8;
|
|
1672
|
-
var offsetToAlignTerminalWithLine2 = (strokeSize2 - terminalSize2) / 2;
|
|
1673
|
-
var TreeDropIndicator = ({ instruction, gap = 0 }) => {
|
|
1674
|
-
const lineOffset = `calc(-0.5 * (${gap}px + ${strokeSize2}px))`;
|
|
1675
|
-
const isBlocked = instruction.type === "instruction-blocked";
|
|
1676
|
-
const desiredInstruction = isBlocked ? instruction.desired : instruction;
|
|
1677
|
-
const orientation = edgeToOrientationMap2[desiredInstruction.type];
|
|
1678
|
-
if (isBlocked) {
|
|
1679
|
-
return null;
|
|
1680
|
-
}
|
|
1681
|
-
return /* @__PURE__ */ React24.createElement("div", {
|
|
1682
|
-
style: {
|
|
1683
|
-
"--line-thickness": `${strokeSize2}px`,
|
|
1684
|
-
"--line-offset": `${lineOffset}`,
|
|
1685
|
-
"--terminal-size": `${terminalSize2}px`,
|
|
1686
|
-
"--terminal-radius": `${terminalSize2 / 2}px`,
|
|
1687
|
-
"--negative-terminal-size": `-${terminalSize2}px`,
|
|
1688
|
-
"--offset-terminal": `${offsetToAlignTerminalWithLine2}px`,
|
|
1689
|
-
"--horizontal-indent": `${desiredInstruction.currentLevel * desiredInstruction.indentPerLevel + 4}px`
|
|
1690
|
-
},
|
|
1691
|
-
className: `absolute z-10 pointer-events-none before:is-[--terminal-size] before:bs-[--terminal-size] box-border before:absolute before:border-[length:--line-thickness] before:border-solid before:border-accentSurface before:rounded-full ${orientationStyles2[orientation]} ${instructionStyles[desiredInstruction.type]}`
|
|
1692
|
-
});
|
|
1693
|
-
};
|
|
1694
|
-
|
|
1695
|
-
// packages/ui/react-ui/src/components/Lists/Tree.tsx
|
|
1696
|
-
var TreeRoot = /* @__PURE__ */ forwardRef17((props, forwardedRef) => {
|
|
1697
|
-
return /* @__PURE__ */ React25.createElement(List, {
|
|
1698
|
-
...props,
|
|
1699
|
-
ref: forwardedRef
|
|
1700
|
-
});
|
|
1701
|
-
});
|
|
1702
|
-
var TreeBranch = /* @__PURE__ */ forwardRef17(({ __listScope, ...props }, forwardedRef) => {
|
|
1703
|
-
const { headingId } = useListItemContext(LIST_ITEM_NAME, __listScope);
|
|
1704
|
-
return /* @__PURE__ */ React25.createElement(List, {
|
|
1705
|
-
...props,
|
|
1706
|
-
"aria-labelledby": headingId,
|
|
1707
|
-
ref: forwardedRef
|
|
1708
|
-
});
|
|
1709
|
-
});
|
|
1710
|
-
var TreeItemRoot = /* @__PURE__ */ forwardRef17((props, forwardedRef) => {
|
|
1711
|
-
return /* @__PURE__ */ React25.createElement(ListItem.Root, {
|
|
1712
|
-
role: "treeitem",
|
|
1713
|
-
...props,
|
|
1714
|
-
ref: forwardedRef
|
|
1715
|
-
});
|
|
1716
|
-
});
|
|
1717
|
-
var TreeItemHeading = ListItem.Heading;
|
|
1718
|
-
var TreeItemOpenTrigger = ListItem.OpenTrigger;
|
|
1719
|
-
var MockTreeItemOpenTrigger = ListItem.MockOpenTrigger;
|
|
1720
|
-
var TreeItemBody = ListItem.CollapsibleContent;
|
|
1721
|
-
var Tree = {
|
|
1722
|
-
Root: TreeRoot,
|
|
1723
|
-
Branch: TreeBranch
|
|
1724
|
-
};
|
|
1725
|
-
var TreeItem = {
|
|
1726
|
-
Root: TreeItemRoot,
|
|
1727
|
-
Heading: TreeItemHeading,
|
|
1728
|
-
Body: TreeItemBody,
|
|
1729
|
-
OpenTrigger: TreeItemOpenTrigger,
|
|
1730
|
-
MockOpenTrigger: MockTreeItemOpenTrigger,
|
|
1731
|
-
DropIndicator: TreeDropIndicator
|
|
1732
|
-
};
|
|
1733
|
-
|
|
1734
|
-
// packages/ui/react-ui/src/components/Lists/Treegrid.tsx
|
|
1735
|
-
import { useArrowNavigationGroup, useFocusableGroup } from "@fluentui/react-tabster";
|
|
1736
|
-
import { createContextScope as createContextScope2 } from "@radix-ui/react-context";
|
|
1737
|
-
import { Primitive as Primitive8 } from "@radix-ui/react-primitive";
|
|
1738
|
-
import { Slot as Slot9 } from "@radix-ui/react-slot";
|
|
1739
|
-
import { useControllableState as useControllableState3 } from "@radix-ui/react-use-controllable-state";
|
|
1740
|
-
import React26, { forwardRef as forwardRef18 } from "react";
|
|
1741
|
-
var TREEGRID_ROW_NAME = "TreegridRow";
|
|
1742
|
-
var [createTreegridRowContext, createTreegridRowScope] = createContextScope2(TREEGRID_ROW_NAME, []);
|
|
1743
|
-
var [TreegridRowProvider, useTreegridRowContext] = createTreegridRowContext(TREEGRID_ROW_NAME);
|
|
1744
|
-
var PATH_SEPARATOR = "~";
|
|
1745
|
-
var PARENT_OF_SEPARATOR = " ";
|
|
1746
|
-
var TreegridRoot = /* @__PURE__ */ forwardRef18(({ asChild, classNames, children, style, gridTemplateColumns, ...props }, forwardedRef) => {
|
|
1747
|
-
const { tx } = useThemeContext();
|
|
1748
|
-
const Root5 = asChild ? Slot9 : Primitive8.div;
|
|
1749
|
-
const arrowNavigationAttrs = useArrowNavigationGroup({
|
|
1750
|
-
axis: "vertical",
|
|
1751
|
-
tabbable: false,
|
|
1752
|
-
circular: true
|
|
1753
|
-
});
|
|
1754
|
-
return /* @__PURE__ */ React26.createElement(Root5, {
|
|
1755
|
-
role: "treegrid",
|
|
1756
|
-
...arrowNavigationAttrs,
|
|
1757
|
-
...props,
|
|
1758
|
-
className: tx("treegrid.root", "treegrid", {}, classNames),
|
|
1759
|
-
style: {
|
|
1760
|
-
...style,
|
|
1761
|
-
gridTemplateColumns
|
|
1762
|
-
},
|
|
1763
|
-
ref: forwardedRef
|
|
1764
|
-
}, children);
|
|
1765
|
-
});
|
|
1766
|
-
var TreegridRow = /* @__PURE__ */ forwardRef18(({ __treegridRowScope, asChild, classNames, children, id, parentOf, open: propsOpen, defaultOpen, onOpenChange: propsOnOpenChange, ...props }, forwardedRef) => {
|
|
1767
|
-
const { tx } = useThemeContext();
|
|
1768
|
-
const Root5 = asChild ? Slot9 : Primitive8.div;
|
|
1769
|
-
const pathParts = id.split(PATH_SEPARATOR);
|
|
1770
|
-
const level = pathParts.length - 1;
|
|
1771
|
-
const [open, onOpenChange] = useControllableState3({
|
|
1772
|
-
prop: propsOpen,
|
|
1773
|
-
onChange: propsOnOpenChange,
|
|
1774
|
-
defaultProp: defaultOpen
|
|
1775
|
-
});
|
|
1776
|
-
const focusableGroupAttrs = useFocusableGroup({
|
|
1777
|
-
tabBehavior: "limited"
|
|
1778
|
-
});
|
|
1779
|
-
const arrowGroupAttrs = useArrowNavigationGroup({
|
|
1780
|
-
axis: "horizontal",
|
|
1781
|
-
tabbable: false,
|
|
1782
|
-
circular: false,
|
|
1783
|
-
memorizeCurrent: false
|
|
1784
|
-
});
|
|
1785
|
-
return /* @__PURE__ */ React26.createElement(TreegridRowProvider, {
|
|
1786
|
-
open,
|
|
1787
|
-
onOpenChange,
|
|
1788
|
-
scope: __treegridRowScope
|
|
1789
|
-
}, /* @__PURE__ */ React26.createElement(Root5, {
|
|
1790
|
-
role: "row",
|
|
1791
|
-
"aria-level": level,
|
|
1792
|
-
className: tx("treegrid.row", "treegrid__row", {
|
|
1793
|
-
level
|
|
1794
|
-
}, classNames),
|
|
1795
|
-
...parentOf && {
|
|
1796
|
-
"aria-expanded": open,
|
|
1797
|
-
"aria-owns": parentOf
|
|
1798
|
-
},
|
|
1799
|
-
tabIndex: 0,
|
|
1800
|
-
...focusableGroupAttrs,
|
|
1801
|
-
...props,
|
|
1802
|
-
id,
|
|
1803
|
-
ref: forwardedRef
|
|
1804
|
-
}, /* @__PURE__ */ React26.createElement("div", {
|
|
1805
|
-
role: "none",
|
|
1806
|
-
className: "contents",
|
|
1807
|
-
...arrowGroupAttrs
|
|
1808
|
-
}, children)));
|
|
1809
|
-
});
|
|
1810
|
-
var TreegridCell = /* @__PURE__ */ forwardRef18(({ classNames, children, indent, ...props }, forwardedRef) => {
|
|
1811
|
-
const { tx } = useThemeContext();
|
|
1812
|
-
return /* @__PURE__ */ React26.createElement("div", {
|
|
1813
|
-
role: "gridcell",
|
|
1814
|
-
className: tx("treegrid.cell", "treegrid__cell", {
|
|
1815
|
-
indent
|
|
1816
|
-
}, classNames),
|
|
1817
|
-
...props,
|
|
1818
|
-
ref: forwardedRef
|
|
1819
|
-
}, children);
|
|
1820
|
-
});
|
|
1821
|
-
var Treegrid = {
|
|
1822
|
-
Root: TreegridRoot,
|
|
1823
|
-
Row: TreegridRow,
|
|
1824
|
-
Cell: TreegridCell,
|
|
1825
|
-
PARENT_OF_SEPARATOR,
|
|
1826
|
-
PATH_SEPARATOR,
|
|
1827
|
-
createTreegridRowScope,
|
|
1828
|
-
useTreegridRowContext
|
|
1829
|
-
};
|
|
1830
|
-
|
|
1831
|
-
// packages/ui/react-ui/src/components/Main/Main.tsx
|
|
1832
|
-
import { createContext as createContext10 } from "@radix-ui/react-context";
|
|
1833
|
-
import { Root as DialogRoot2, DialogContent as DialogContent2, DialogTitle as DialogTitle2 } from "@radix-ui/react-dialog";
|
|
1834
|
-
import { Primitive as Primitive9 } from "@radix-ui/react-primitive";
|
|
1835
|
-
import { Slot as Slot10 } from "@radix-ui/react-slot";
|
|
1836
|
-
import { useControllableState as useControllableState4 } from "@radix-ui/react-use-controllable-state";
|
|
1837
|
-
import React27, { forwardRef as forwardRef19, useCallback as useCallback7, useEffect as useEffect5, useRef as useRef2, useState as useState8 } from "react";
|
|
1838
|
-
import { log } from "@dxos/log";
|
|
1839
|
-
import { useMediaQuery, useForwardedRef } from "@dxos/react-hooks";
|
|
1840
|
-
|
|
1841
|
-
// packages/ui/react-ui/src/components/Main/useSwipeToDismiss.ts
|
|
1842
|
-
import { useCallback as useCallback6, useEffect as useEffect4, useState as useState7 } from "react";
|
|
1843
|
-
var MotionState;
|
|
1844
|
-
(function(MotionState2) {
|
|
1845
|
-
MotionState2[MotionState2["IDLE"] = 0] = "IDLE";
|
|
1846
|
-
MotionState2[MotionState2["DEBOUNCING"] = 1] = "DEBOUNCING";
|
|
1847
|
-
MotionState2[MotionState2["FOLLOWING"] = 2] = "FOLLOWING";
|
|
1848
|
-
})(MotionState || (MotionState = {}));
|
|
1849
|
-
var useSwipeToDismiss = (ref, {
|
|
1850
|
-
onDismiss,
|
|
1851
|
-
dismissThreshold = 64,
|
|
1852
|
-
debounceThreshold = 8,
|
|
1853
|
-
offset = 0
|
|
1854
|
-
/* side = 'inline-start' */
|
|
1855
|
-
}) => {
|
|
1856
|
-
const $root = ref.current;
|
|
1857
|
-
const [motionState, setMotionState] = useState7(0);
|
|
1858
|
-
const [gestureStartX, setGestureStartX] = useState7(0);
|
|
1859
|
-
const setIdle = useCallback6(() => {
|
|
1860
|
-
setMotionState(0);
|
|
1861
|
-
$root?.style.removeProperty("inset-inline-start");
|
|
1862
|
-
$root?.style.setProperty("transition-duration", "200ms");
|
|
1863
|
-
}, [
|
|
1864
|
-
$root
|
|
1865
|
-
]);
|
|
1866
|
-
const setFollowing = useCallback6(() => {
|
|
1867
|
-
setMotionState(2);
|
|
1868
|
-
$root?.style.setProperty("transition-duration", "0ms");
|
|
1869
|
-
}, [
|
|
1870
|
-
$root
|
|
1871
|
-
]);
|
|
1872
|
-
const handlePointerDown = useCallback6(({ screenX }) => {
|
|
1873
|
-
if (motionState === 0) {
|
|
1874
|
-
setMotionState(1);
|
|
1875
|
-
setGestureStartX(screenX);
|
|
1876
|
-
}
|
|
1877
|
-
}, [
|
|
1878
|
-
motionState
|
|
1879
|
-
]);
|
|
1880
|
-
const handlePointerMove = useCallback6(({ screenX }) => {
|
|
1881
|
-
if ($root) {
|
|
1882
|
-
const delta = Math.min(screenX - gestureStartX, 0);
|
|
1883
|
-
switch (motionState) {
|
|
1884
|
-
case 2:
|
|
1885
|
-
if (Math.abs(delta) > dismissThreshold) {
|
|
1886
|
-
setIdle();
|
|
1887
|
-
onDismiss?.();
|
|
1888
|
-
} else {
|
|
1889
|
-
$root.style.setProperty("inset-inline-start", `${offset + delta}px`);
|
|
1890
|
-
}
|
|
1891
|
-
break;
|
|
1892
|
-
case 1:
|
|
1893
|
-
if (Math.abs(delta) > debounceThreshold) {
|
|
1894
|
-
setFollowing();
|
|
1895
|
-
}
|
|
1896
|
-
break;
|
|
1897
|
-
}
|
|
1898
|
-
}
|
|
1899
|
-
}, [
|
|
1900
|
-
$root,
|
|
1901
|
-
motionState,
|
|
1902
|
-
gestureStartX
|
|
1903
|
-
]);
|
|
1904
|
-
const handlePointerUp = useCallback6(() => {
|
|
1905
|
-
setIdle();
|
|
1906
|
-
}, [
|
|
1907
|
-
setIdle
|
|
1908
|
-
]);
|
|
1909
|
-
useEffect4(() => {
|
|
1910
|
-
$root?.addEventListener("pointerdown", handlePointerDown);
|
|
1911
|
-
return () => {
|
|
1912
|
-
$root?.removeEventListener("pointerdown", handlePointerDown);
|
|
1913
|
-
};
|
|
1914
|
-
}, [
|
|
1915
|
-
$root,
|
|
1916
|
-
handlePointerDown
|
|
1917
|
-
]);
|
|
1918
|
-
useEffect4(() => {
|
|
1919
|
-
$root && document.documentElement.addEventListener("pointermove", handlePointerMove);
|
|
1920
|
-
return () => {
|
|
1921
|
-
document.documentElement.removeEventListener("pointermove", handlePointerMove);
|
|
1922
|
-
};
|
|
1923
|
-
}, [
|
|
1924
|
-
$root,
|
|
1925
|
-
handlePointerMove
|
|
1926
|
-
]);
|
|
1927
|
-
useEffect4(() => {
|
|
1928
|
-
$root && document.documentElement.addEventListener("pointerup", handlePointerUp);
|
|
1929
|
-
return () => {
|
|
1930
|
-
document.documentElement.removeEventListener("pointerup", handlePointerUp);
|
|
1931
|
-
};
|
|
1932
|
-
}, [
|
|
1933
|
-
$root,
|
|
1934
|
-
handlePointerUp
|
|
1935
|
-
]);
|
|
1936
|
-
};
|
|
1937
|
-
|
|
1938
|
-
// packages/ui/react-ui/src/components/Main/Main.tsx
|
|
1939
|
-
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/ui/react-ui/src/components/Main/Main.tsx";
|
|
1940
|
-
var MAIN_ROOT_NAME = "MainRoot";
|
|
1941
|
-
var NAVIGATION_SIDEBAR_NAME = "NavigationSidebar";
|
|
1942
|
-
var COMPLEMENTARY_SIDEBAR_NAME = "ComplementarySidebar";
|
|
1943
|
-
var MAIN_NAME = "Main";
|
|
1944
|
-
var GENERIC_CONSUMER_NAME = "GenericConsumer";
|
|
1945
|
-
var landmarkAttr = "data-main-landmark";
|
|
1946
|
-
var useLandmarkMover = (propsOnKeyDown, landmark) => {
|
|
1947
|
-
const handleKeyDown = useCallback7((event) => {
|
|
1948
|
-
const target = event.target;
|
|
1949
|
-
if (event.target === event.currentTarget && event.key === "Tab" && target.hasAttribute(landmarkAttr)) {
|
|
1950
|
-
event.preventDefault();
|
|
1951
|
-
const landmarks = Array.from(document.querySelectorAll(`[${landmarkAttr}]:not([inert])`)).map((el) => el.hasAttribute(landmarkAttr) ? parseInt(el.getAttribute(landmarkAttr)) : NaN).sort();
|
|
1952
|
-
const l = landmarks.length;
|
|
1953
|
-
const cursor = landmarks.indexOf(parseInt(target.getAttribute(landmarkAttr)));
|
|
1954
|
-
const nextLandmark = landmarks[(cursor + l + (event.getModifierState("Shift") ? -1 : 1)) % l];
|
|
1955
|
-
document.querySelector(`[${landmarkAttr}="${nextLandmark}"]`)?.focus();
|
|
1956
|
-
}
|
|
1957
|
-
propsOnKeyDown?.(event);
|
|
1958
|
-
}, [
|
|
1959
|
-
propsOnKeyDown
|
|
1960
|
-
]);
|
|
1961
|
-
const focusableGroupAttrs = window ? {} : {
|
|
1962
|
-
tabBehavior: "limited",
|
|
1963
|
-
ignoreDefaultKeydown: {
|
|
1964
|
-
Tab: true
|
|
1965
|
-
}
|
|
1966
|
-
};
|
|
1967
|
-
return {
|
|
1968
|
-
onKeyDown: handleKeyDown,
|
|
1969
|
-
[landmarkAttr]: landmark,
|
|
1970
|
-
tabIndex: 0,
|
|
1971
|
-
...focusableGroupAttrs
|
|
1972
|
-
};
|
|
1973
|
-
};
|
|
1974
|
-
var [MainProvider, useMainContext] = createContext10(MAIN_NAME, {
|
|
1975
|
-
resizing: false,
|
|
1976
|
-
navigationSidebarState: "closed",
|
|
1977
|
-
setNavigationSidebarState: (nextState) => {
|
|
1978
|
-
log.warn("Attempt to set sidebar state without initializing `MainRoot`", void 0, {
|
|
1979
|
-
F: __dxlog_file,
|
|
1980
|
-
L: 82,
|
|
1981
|
-
S: void 0,
|
|
1982
|
-
C: (f, a) => f(...a)
|
|
1983
|
-
});
|
|
1984
|
-
},
|
|
1985
|
-
complementarySidebarState: "closed",
|
|
1986
|
-
setComplementarySidebarState: (nextState) => {
|
|
1987
|
-
log.warn("Attempt to set sidebar state without initializing `MainRoot`", void 0, {
|
|
1988
|
-
F: __dxlog_file,
|
|
1989
|
-
L: 87,
|
|
1990
|
-
S: void 0,
|
|
1991
|
-
C: (f, a) => f(...a)
|
|
1992
|
-
});
|
|
1993
|
-
}
|
|
1994
|
-
});
|
|
1995
|
-
var useSidebars = (consumerName = GENERIC_CONSUMER_NAME) => {
|
|
1996
|
-
const { setNavigationSidebarState, navigationSidebarState, setComplementarySidebarState, complementarySidebarState } = useMainContext(consumerName);
|
|
1997
|
-
return {
|
|
1998
|
-
navigationSidebarState,
|
|
1999
|
-
setNavigationSidebarState,
|
|
2000
|
-
toggleNavigationSidebar: useCallback7(() => setNavigationSidebarState(navigationSidebarState === "expanded" ? "closed" : "expanded"), [
|
|
2001
|
-
navigationSidebarState,
|
|
2002
|
-
setNavigationSidebarState
|
|
2003
|
-
]),
|
|
2004
|
-
openNavigationSidebar: useCallback7(() => setNavigationSidebarState("expanded"), []),
|
|
2005
|
-
collapseNavigationSidebar: useCallback7(() => setNavigationSidebarState("collapsed"), []),
|
|
2006
|
-
closeNavigationSidebar: useCallback7(() => setNavigationSidebarState("closed"), []),
|
|
2007
|
-
complementarySidebarState,
|
|
2008
|
-
setComplementarySidebarState,
|
|
2009
|
-
toggleComplementarySidebar: useCallback7(() => setComplementarySidebarState(complementarySidebarState === "expanded" ? "closed" : "expanded"), [
|
|
2010
|
-
complementarySidebarState,
|
|
2011
|
-
setComplementarySidebarState
|
|
2012
|
-
]),
|
|
2013
|
-
openComplementarySidebar: useCallback7(() => setComplementarySidebarState("expanded"), []),
|
|
2014
|
-
collapseComplementarySidebar: useCallback7(() => setComplementarySidebarState("collapsed"), []),
|
|
2015
|
-
closeComplementarySidebar: useCallback7(() => setComplementarySidebarState("closed"), [])
|
|
2016
|
-
};
|
|
2017
|
-
};
|
|
2018
|
-
var resizeDebounce = 3e3;
|
|
2019
|
-
var MainRoot = ({ navigationSidebarState: propsNavigationSidebarState, defaultNavigationSidebarState, onNavigationSidebarStateChange, complementarySidebarState: propsComplementarySidebarState, defaultComplementarySidebarState, onComplementarySidebarStateChange, children, ...props }) => {
|
|
2020
|
-
const [isLg] = useMediaQuery("lg", {
|
|
2021
|
-
ssr: false
|
|
2022
|
-
});
|
|
2023
|
-
const [navigationSidebarState = isLg ? "expanded" : "collapsed", setNavigationSidebarState] = useControllableState4({
|
|
2024
|
-
prop: propsNavigationSidebarState,
|
|
2025
|
-
defaultProp: defaultNavigationSidebarState,
|
|
2026
|
-
onChange: onNavigationSidebarStateChange
|
|
2027
|
-
});
|
|
2028
|
-
const [complementarySidebarState = isLg ? "expanded" : "collapsed", setComplementarySidebarState] = useControllableState4({
|
|
2029
|
-
prop: propsComplementarySidebarState,
|
|
2030
|
-
defaultProp: defaultComplementarySidebarState,
|
|
2031
|
-
onChange: onComplementarySidebarStateChange
|
|
2032
|
-
});
|
|
2033
|
-
const [resizing, setResizing] = useState8(false);
|
|
2034
|
-
const resizeInterval = useRef2(null);
|
|
2035
|
-
const handleResize = useCallback7(() => {
|
|
2036
|
-
setResizing(true);
|
|
2037
|
-
if (resizeInterval.current) {
|
|
2038
|
-
clearTimeout(resizeInterval.current);
|
|
2039
|
-
}
|
|
2040
|
-
resizeInterval.current = setTimeout(() => {
|
|
2041
|
-
setResizing(false);
|
|
2042
|
-
resizeInterval.current = null;
|
|
2043
|
-
}, resizeDebounce);
|
|
2044
|
-
}, []);
|
|
2045
|
-
useEffect5(() => {
|
|
2046
|
-
window.addEventListener("resize", handleResize);
|
|
2047
|
-
return () => window.removeEventListener("resize", handleResize);
|
|
2048
|
-
}, [
|
|
2049
|
-
handleResize
|
|
2050
|
-
]);
|
|
2051
|
-
return /* @__PURE__ */ React27.createElement(MainProvider, {
|
|
2052
|
-
...props,
|
|
2053
|
-
navigationSidebarState,
|
|
2054
|
-
setNavigationSidebarState,
|
|
2055
|
-
complementarySidebarState,
|
|
2056
|
-
setComplementarySidebarState,
|
|
2057
|
-
resizing
|
|
2058
|
-
}, children);
|
|
2059
|
-
};
|
|
2060
|
-
MainRoot.displayName = MAIN_ROOT_NAME;
|
|
2061
|
-
var handleOpenAutoFocus = (event) => {
|
|
2062
|
-
!document.body.hasAttribute("data-is-keyboard") && event.preventDefault();
|
|
2063
|
-
};
|
|
2064
|
-
var MainSidebar = /* @__PURE__ */ forwardRef19(({ classNames, children, swipeToDismiss, onOpenAutoFocus, state, resizing, onStateChange, side, label, ...props }, forwardedRef) => {
|
|
2065
|
-
const [isLg] = useMediaQuery("lg", {
|
|
2066
|
-
ssr: false
|
|
2067
|
-
});
|
|
2068
|
-
const { tx } = useThemeContext();
|
|
2069
|
-
const { t } = useTranslation();
|
|
2070
|
-
const ref = useForwardedRef(forwardedRef);
|
|
2071
|
-
const noopRef = useRef2(null);
|
|
2072
|
-
useSwipeToDismiss(swipeToDismiss ? ref : noopRef, {
|
|
2073
|
-
onDismiss: () => onStateChange?.("closed")
|
|
2074
|
-
});
|
|
2075
|
-
const handleKeyDown = useCallback7((event) => {
|
|
2076
|
-
if (event.key === "Escape") {
|
|
2077
|
-
event.target.closest("[data-tabster]")?.focus();
|
|
2078
|
-
}
|
|
2079
|
-
props.onKeyDown?.(event);
|
|
2080
|
-
}, [
|
|
2081
|
-
props.onKeyDown
|
|
2082
|
-
]);
|
|
2083
|
-
const Root5 = isLg ? Primitive9.div : DialogContent2;
|
|
2084
|
-
return /* @__PURE__ */ React27.createElement(DialogRoot2, {
|
|
2085
|
-
open: state !== "closed",
|
|
2086
|
-
"aria-label": toLocalizedString(label, t),
|
|
2087
|
-
modal: false
|
|
2088
|
-
}, !isLg && /* @__PURE__ */ React27.createElement(DialogTitle2, {
|
|
2089
|
-
className: "sr-only"
|
|
2090
|
-
}, toLocalizedString(label, t)), /* @__PURE__ */ React27.createElement(Root5, {
|
|
2091
|
-
...!isLg && {
|
|
2092
|
-
forceMount: true,
|
|
2093
|
-
tabIndex: -1,
|
|
2094
|
-
onOpenAutoFocus: onOpenAutoFocus ?? handleOpenAutoFocus
|
|
2095
|
-
},
|
|
2096
|
-
...props,
|
|
2097
|
-
"data-side": side === "inline-end" ? "ie" : "is",
|
|
2098
|
-
"data-state": state,
|
|
2099
|
-
"data-resizing": resizing ? "true" : "false",
|
|
2100
|
-
className: tx("main.sidebar", "main__sidebar", {}, classNames),
|
|
2101
|
-
onKeyDown: handleKeyDown,
|
|
2102
|
-
...state === "closed" && {
|
|
2103
|
-
inert: "true"
|
|
2104
|
-
},
|
|
2105
|
-
ref
|
|
2106
|
-
}, children));
|
|
2107
|
-
});
|
|
2108
|
-
var MainNavigationSidebar = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
|
|
2109
|
-
const { navigationSidebarState, setNavigationSidebarState, resizing } = useMainContext(NAVIGATION_SIDEBAR_NAME);
|
|
2110
|
-
const mover = useLandmarkMover(props.onKeyDown, "0");
|
|
2111
|
-
return /* @__PURE__ */ React27.createElement(MainSidebar, {
|
|
2112
|
-
...mover,
|
|
2113
|
-
...props,
|
|
2114
|
-
state: navigationSidebarState,
|
|
2115
|
-
onStateChange: setNavigationSidebarState,
|
|
2116
|
-
resizing,
|
|
2117
|
-
side: "inline-start",
|
|
2118
|
-
ref: forwardedRef
|
|
2119
|
-
});
|
|
2120
|
-
});
|
|
2121
|
-
MainNavigationSidebar.displayName = NAVIGATION_SIDEBAR_NAME;
|
|
2122
|
-
var MainComplementarySidebar = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
|
|
2123
|
-
const { complementarySidebarState, setComplementarySidebarState, resizing } = useMainContext(COMPLEMENTARY_SIDEBAR_NAME);
|
|
2124
|
-
const mover = useLandmarkMover(props.onKeyDown, "2");
|
|
2125
|
-
return /* @__PURE__ */ React27.createElement(MainSidebar, {
|
|
2126
|
-
...mover,
|
|
2127
|
-
...props,
|
|
2128
|
-
state: complementarySidebarState,
|
|
2129
|
-
onStateChange: setComplementarySidebarState,
|
|
2130
|
-
resizing,
|
|
2131
|
-
side: "inline-end",
|
|
2132
|
-
ref: forwardedRef
|
|
2133
|
-
});
|
|
2134
|
-
});
|
|
2135
|
-
MainNavigationSidebar.displayName = NAVIGATION_SIDEBAR_NAME;
|
|
2136
|
-
var MainContent = /* @__PURE__ */ forwardRef19(({ asChild, classNames, bounce, handlesFocus, children, role, ...props }, forwardedRef) => {
|
|
2137
|
-
const { navigationSidebarState, complementarySidebarState } = useMainContext(MAIN_NAME);
|
|
2138
|
-
const { tx } = useThemeContext();
|
|
2139
|
-
const Root5 = asChild ? Slot10 : role ? "div" : "main";
|
|
2140
|
-
const mover = useLandmarkMover(props.onKeyDown, "1");
|
|
2141
|
-
return /* @__PURE__ */ React27.createElement(Root5, {
|
|
2142
|
-
role,
|
|
2143
|
-
...handlesFocus && {
|
|
2144
|
-
...mover
|
|
2145
|
-
},
|
|
2146
|
-
...props,
|
|
2147
|
-
"data-sidebar-inline-start-state": navigationSidebarState,
|
|
2148
|
-
"data-sidebar-inline-end-state": complementarySidebarState,
|
|
2149
|
-
className: tx("main.content", "main", {
|
|
2150
|
-
bounce,
|
|
2151
|
-
handlesFocus
|
|
2152
|
-
}, classNames),
|
|
2153
|
-
ref: forwardedRef
|
|
2154
|
-
}, children);
|
|
2155
|
-
});
|
|
2156
|
-
MainContent.displayName = MAIN_NAME;
|
|
2157
|
-
var MainOverlay = /* @__PURE__ */ forwardRef19(({ classNames, ...props }, forwardedRef) => {
|
|
2158
|
-
const [isLg] = useMediaQuery("lg", {
|
|
2159
|
-
ssr: false
|
|
2160
|
-
});
|
|
2161
|
-
const { navigationSidebarState, setNavigationSidebarState, complementarySidebarState, setComplementarySidebarState } = useMainContext(MAIN_NAME);
|
|
2162
|
-
const { tx } = useThemeContext();
|
|
2163
|
-
return /* @__PURE__ */ React27.createElement("div", {
|
|
2164
|
-
onClick: () => {
|
|
2165
|
-
setNavigationSidebarState("collapsed");
|
|
2166
|
-
setComplementarySidebarState("collapsed");
|
|
2167
|
-
},
|
|
2168
|
-
...props,
|
|
2169
|
-
className: tx("main.overlay", "main__overlay", {
|
|
2170
|
-
isLg,
|
|
2171
|
-
inlineStartSidebarOpen: navigationSidebarState,
|
|
2172
|
-
inlineEndSidebarOpen: complementarySidebarState
|
|
2173
|
-
}, classNames),
|
|
2174
|
-
"data-state": navigationSidebarState === "expanded" || complementarySidebarState === "expanded" ? "open" : "closed",
|
|
2175
|
-
"aria-hidden": "true",
|
|
2176
|
-
ref: forwardedRef
|
|
2177
|
-
});
|
|
2178
|
-
});
|
|
2179
|
-
var Main = {
|
|
2180
|
-
Root: MainRoot,
|
|
2181
|
-
Content: MainContent,
|
|
2182
|
-
Overlay: MainOverlay,
|
|
2183
|
-
NavigationSidebar: MainNavigationSidebar,
|
|
2184
|
-
ComplementarySidebar: MainComplementarySidebar
|
|
2185
|
-
};
|
|
2186
|
-
|
|
2187
|
-
// packages/ui/react-ui/src/components/Message/Message.tsx
|
|
2188
|
-
import { createContext as createContext11 } from "@radix-ui/react-context";
|
|
2189
|
-
import { Primitive as Primitive10 } from "@radix-ui/react-primitive";
|
|
2190
|
-
import { Slot as Slot11 } from "@radix-ui/react-slot";
|
|
2191
|
-
import React28, { forwardRef as forwardRef20 } from "react";
|
|
2192
|
-
import { useId as useId3 } from "@dxos/react-hooks";
|
|
2193
|
-
var MESSAGE_NAME = "Message";
|
|
2194
|
-
var [MessageProvider, useMessageContext] = createContext11(MESSAGE_NAME);
|
|
2195
|
-
var MessageRoot = /* @__PURE__ */ forwardRef20(({ asChild, valence, elevation: propsElevation, className, titleId: propsTitleId, descriptionId: propsDescriptionId, children, ...props }, forwardedRef) => {
|
|
2196
|
-
const { tx } = useThemeContext();
|
|
2197
|
-
const titleId = useId3("message__title", propsTitleId);
|
|
2198
|
-
const descriptionId = useId3("message__description", propsDescriptionId);
|
|
2199
|
-
const elevation = useElevationContext(propsElevation);
|
|
2200
|
-
const Root5 = asChild ? Slot11 : Primitive10.div;
|
|
2201
|
-
return /* @__PURE__ */ React28.createElement(MessageProvider, {
|
|
2202
|
-
titleId,
|
|
2203
|
-
descriptionId
|
|
2204
|
-
}, /* @__PURE__ */ React28.createElement(Root5, {
|
|
2205
|
-
...props,
|
|
2206
|
-
className: tx("message.root", "message", {
|
|
2207
|
-
valence,
|
|
2208
|
-
elevation
|
|
2209
|
-
}, className),
|
|
2210
|
-
"aria-labelledby": titleId,
|
|
2211
|
-
"aria-describedby": descriptionId,
|
|
2212
|
-
ref: forwardedRef
|
|
2213
|
-
}, children));
|
|
2214
|
-
});
|
|
2215
|
-
MessageRoot.displayName = MESSAGE_NAME;
|
|
2216
|
-
var MESSAGE_TITLE_NAME = "MessageTitle";
|
|
2217
|
-
var MessageTitle = /* @__PURE__ */ forwardRef20(({ asChild, className, children, ...props }, forwardedRef) => {
|
|
2218
|
-
const { tx } = useThemeContext();
|
|
2219
|
-
const { titleId } = useMessageContext(MESSAGE_TITLE_NAME);
|
|
2220
|
-
const Root5 = asChild ? Slot11 : Primitive10.h2;
|
|
2221
|
-
return /* @__PURE__ */ React28.createElement(Root5, {
|
|
2222
|
-
...props,
|
|
2223
|
-
className: tx("message.title", "message__title", {}, className),
|
|
2224
|
-
id: titleId,
|
|
2225
|
-
ref: forwardedRef
|
|
2226
|
-
}, children);
|
|
2227
|
-
});
|
|
2228
|
-
MessageTitle.displayName = MESSAGE_TITLE_NAME;
|
|
2229
|
-
var MESSAGE_BODY_NAME = "MessageBody";
|
|
2230
|
-
var MessageBody = /* @__PURE__ */ forwardRef20(({ asChild, className, children, ...props }, forwardedRef) => {
|
|
2231
|
-
const { tx } = useThemeContext();
|
|
2232
|
-
const { descriptionId } = useMessageContext(MESSAGE_BODY_NAME);
|
|
2233
|
-
const Root5 = asChild ? Slot11 : Primitive10.p;
|
|
2234
|
-
return /* @__PURE__ */ React28.createElement(Root5, {
|
|
2235
|
-
...props,
|
|
2236
|
-
className: tx("message.body", "message__body", {}, className),
|
|
2237
|
-
id: descriptionId,
|
|
2238
|
-
ref: forwardedRef
|
|
2239
|
-
}, children);
|
|
2240
|
-
});
|
|
2241
|
-
MessageBody.displayName = MESSAGE_BODY_NAME;
|
|
2242
|
-
var Message = {
|
|
2243
|
-
Root: MessageRoot,
|
|
2244
|
-
Title: MessageTitle,
|
|
2245
|
-
Body: MessageBody
|
|
2246
|
-
};
|
|
2247
|
-
|
|
2248
|
-
// packages/ui/react-ui/src/components/Popover/Popover.tsx
|
|
2249
|
-
import { composeEventHandlers as composeEventHandlers2 } from "@radix-ui/primitive";
|
|
2250
|
-
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
2251
|
-
import { createContextScope as createContextScope3 } from "@radix-ui/react-context";
|
|
2252
|
-
import { DismissableLayer } from "@radix-ui/react-dismissable-layer";
|
|
2253
|
-
import { useFocusGuards } from "@radix-ui/react-focus-guards";
|
|
2254
|
-
import { FocusScope } from "@radix-ui/react-focus-scope";
|
|
2255
|
-
import { useId as useId4 } from "@radix-ui/react-id";
|
|
2256
|
-
import * as PopperPrimitive from "@radix-ui/react-popper";
|
|
2257
|
-
import { createPopperScope } from "@radix-ui/react-popper";
|
|
2258
|
-
import { Portal as PortalPrimitive } from "@radix-ui/react-portal";
|
|
2259
|
-
import { Presence } from "@radix-ui/react-presence";
|
|
2260
|
-
import { Primitive as Primitive11 } from "@radix-ui/react-primitive";
|
|
2261
|
-
import { Slot as Slot12 } from "@radix-ui/react-slot";
|
|
2262
|
-
import { useControllableState as useControllableState5 } from "@radix-ui/react-use-controllable-state";
|
|
2263
|
-
import { hideOthers } from "aria-hidden";
|
|
2264
|
-
import React29, { forwardRef as forwardRef21, useRef as useRef3, useCallback as useCallback8, useState as useState9, useEffect as useEffect6 } from "react";
|
|
2265
|
-
import { RemoveScroll } from "react-remove-scroll";
|
|
2266
|
-
var POPOVER_NAME = "Popover";
|
|
2267
|
-
var [createPopoverContext, createPopoverScope] = createContextScope3(POPOVER_NAME, [
|
|
2268
|
-
createPopperScope
|
|
2269
|
-
]);
|
|
2270
|
-
var usePopperScope = createPopperScope();
|
|
2271
|
-
var [PopoverProvider, usePopoverContext] = createPopoverContext(POPOVER_NAME);
|
|
2272
|
-
var PopoverRoot = (props) => {
|
|
2273
|
-
const { __scopePopover, children, open: openProp, defaultOpen, onOpenChange, modal = false } = props;
|
|
2274
|
-
const popperScope = usePopperScope(__scopePopover);
|
|
2275
|
-
const triggerRef = useRef3(null);
|
|
2276
|
-
const [hasCustomAnchor, setHasCustomAnchor] = useState9(false);
|
|
2277
|
-
const [open = false, setOpen] = useControllableState5({
|
|
2278
|
-
prop: openProp,
|
|
2279
|
-
defaultProp: defaultOpen,
|
|
2280
|
-
onChange: onOpenChange
|
|
2281
|
-
});
|
|
2282
|
-
return /* @__PURE__ */ React29.createElement(PopperPrimitive.Root, popperScope, /* @__PURE__ */ React29.createElement(PopoverProvider, {
|
|
2283
|
-
scope: __scopePopover,
|
|
2284
|
-
contentId: useId4(),
|
|
2285
|
-
triggerRef,
|
|
2286
|
-
open,
|
|
2287
|
-
onOpenChange: setOpen,
|
|
2288
|
-
onOpenToggle: useCallback8(() => setOpen((prevOpen) => !prevOpen), [
|
|
2289
|
-
setOpen
|
|
2290
|
-
]),
|
|
2291
|
-
hasCustomAnchor,
|
|
2292
|
-
onCustomAnchorAdd: useCallback8(() => setHasCustomAnchor(true), []),
|
|
2293
|
-
onCustomAnchorRemove: useCallback8(() => setHasCustomAnchor(false), []),
|
|
2294
|
-
modal
|
|
2295
|
-
}, children));
|
|
2296
|
-
};
|
|
2297
|
-
PopoverRoot.displayName = POPOVER_NAME;
|
|
2298
|
-
var ANCHOR_NAME = "PopoverAnchor";
|
|
2299
|
-
var PopoverAnchor = /* @__PURE__ */ forwardRef21((props, forwardedRef) => {
|
|
2300
|
-
const { __scopePopover, ...anchorProps } = props;
|
|
2301
|
-
const context = usePopoverContext(ANCHOR_NAME, __scopePopover);
|
|
2302
|
-
const popperScope = usePopperScope(__scopePopover);
|
|
2303
|
-
const { onCustomAnchorAdd, onCustomAnchorRemove } = context;
|
|
2304
|
-
useEffect6(() => {
|
|
2305
|
-
onCustomAnchorAdd();
|
|
2306
|
-
return () => onCustomAnchorRemove();
|
|
2307
|
-
}, [
|
|
2308
|
-
onCustomAnchorAdd,
|
|
2309
|
-
onCustomAnchorRemove
|
|
2310
|
-
]);
|
|
2311
|
-
return /* @__PURE__ */ React29.createElement(PopperPrimitive.Anchor, {
|
|
2312
|
-
...popperScope,
|
|
2313
|
-
...anchorProps,
|
|
2314
|
-
ref: forwardedRef
|
|
2315
|
-
});
|
|
2316
|
-
});
|
|
2317
|
-
PopoverAnchor.displayName = ANCHOR_NAME;
|
|
2318
|
-
var TRIGGER_NAME2 = "PopoverTrigger";
|
|
2319
|
-
var PopoverTrigger = /* @__PURE__ */ forwardRef21((props, forwardedRef) => {
|
|
2320
|
-
const { __scopePopover, ...triggerProps } = props;
|
|
2321
|
-
const context = usePopoverContext(TRIGGER_NAME2, __scopePopover);
|
|
2322
|
-
const popperScope = usePopperScope(__scopePopover);
|
|
2323
|
-
const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
|
|
2324
|
-
const trigger = /* @__PURE__ */ React29.createElement(Primitive11.button, {
|
|
2325
|
-
type: "button",
|
|
2326
|
-
"aria-haspopup": "dialog",
|
|
2327
|
-
"aria-expanded": context.open,
|
|
2328
|
-
"aria-controls": context.contentId,
|
|
2329
|
-
"data-state": getState(context.open),
|
|
2330
|
-
...triggerProps,
|
|
2331
|
-
ref: composedTriggerRef,
|
|
2332
|
-
onClick: composeEventHandlers2(props.onClick, context.onOpenToggle)
|
|
2333
|
-
});
|
|
2334
|
-
return context.hasCustomAnchor ? trigger : /* @__PURE__ */ React29.createElement(PopperPrimitive.Anchor, {
|
|
2335
|
-
asChild: true,
|
|
2336
|
-
...popperScope
|
|
2337
|
-
}, trigger);
|
|
2338
|
-
});
|
|
2339
|
-
PopoverTrigger.displayName = TRIGGER_NAME2;
|
|
2340
|
-
var VIRTUAL_TRIGGER_NAME2 = "PopoverVirtualTrigger";
|
|
2341
|
-
var PopoverVirtualTrigger = (props) => {
|
|
2342
|
-
const { __scopePopover, virtualRef } = props;
|
|
2343
|
-
const context = usePopoverContext(VIRTUAL_TRIGGER_NAME2, __scopePopover);
|
|
2344
|
-
const popperScope = usePopperScope(__scopePopover);
|
|
2345
|
-
useEffect6(() => {
|
|
2346
|
-
if (virtualRef.current) {
|
|
2347
|
-
context.triggerRef.current = virtualRef.current;
|
|
2348
|
-
}
|
|
2349
|
-
});
|
|
2350
|
-
return /* @__PURE__ */ React29.createElement(PopperPrimitive.Anchor, {
|
|
2351
|
-
...popperScope,
|
|
2352
|
-
virtualRef
|
|
2353
|
-
});
|
|
2354
|
-
};
|
|
2355
|
-
PopoverVirtualTrigger.displayName = VIRTUAL_TRIGGER_NAME2;
|
|
2356
|
-
var PORTAL_NAME2 = "PopoverPortal";
|
|
2357
|
-
var [PortalProvider, usePortalContext] = createPopoverContext(PORTAL_NAME2, {
|
|
2358
|
-
forceMount: void 0
|
|
2359
|
-
});
|
|
2360
|
-
var PopoverPortal = (props) => {
|
|
2361
|
-
const { __scopePopover, forceMount, children, container } = props;
|
|
2362
|
-
const context = usePopoverContext(PORTAL_NAME2, __scopePopover);
|
|
2363
|
-
return /* @__PURE__ */ React29.createElement(PortalProvider, {
|
|
2364
|
-
scope: __scopePopover,
|
|
2365
|
-
forceMount
|
|
2366
|
-
}, /* @__PURE__ */ React29.createElement(Presence, {
|
|
2367
|
-
present: forceMount || context.open
|
|
2368
|
-
}, /* @__PURE__ */ React29.createElement(PortalPrimitive, {
|
|
2369
|
-
asChild: true,
|
|
2370
|
-
container
|
|
2371
|
-
}, children)));
|
|
2372
|
-
};
|
|
2373
|
-
PopoverPortal.displayName = PORTAL_NAME2;
|
|
2374
|
-
var CONTENT_NAME2 = "PopoverContent";
|
|
2375
|
-
var PopoverContent = /* @__PURE__ */ forwardRef21((props, forwardedRef) => {
|
|
2376
|
-
const portalContext = usePortalContext(CONTENT_NAME2, props.__scopePopover);
|
|
2377
|
-
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
2378
|
-
const context = usePopoverContext(CONTENT_NAME2, props.__scopePopover);
|
|
2379
|
-
return /* @__PURE__ */ React29.createElement(Presence, {
|
|
2380
|
-
present: forceMount || context.open
|
|
2381
|
-
}, context.modal ? /* @__PURE__ */ React29.createElement(PopoverContentModal, {
|
|
2382
|
-
...contentProps,
|
|
2383
|
-
ref: forwardedRef
|
|
2384
|
-
}) : /* @__PURE__ */ React29.createElement(PopoverContentNonModal, {
|
|
2385
|
-
...contentProps,
|
|
2386
|
-
ref: forwardedRef
|
|
2387
|
-
}));
|
|
2388
|
-
});
|
|
2389
|
-
PopoverContent.displayName = CONTENT_NAME2;
|
|
2390
|
-
var PopoverContentModal = /* @__PURE__ */ forwardRef21((props, forwardedRef) => {
|
|
2391
|
-
const context = usePopoverContext(CONTENT_NAME2, props.__scopePopover);
|
|
2392
|
-
const contentRef = useRef3(null);
|
|
2393
|
-
const composedRefs = useComposedRefs(forwardedRef, contentRef);
|
|
2394
|
-
const isRightClickOutsideRef = useRef3(false);
|
|
2395
|
-
useEffect6(() => {
|
|
2396
|
-
const content = contentRef.current;
|
|
2397
|
-
if (content) {
|
|
2398
|
-
return hideOthers(content);
|
|
2399
|
-
}
|
|
2400
|
-
}, []);
|
|
2401
|
-
return /* @__PURE__ */ React29.createElement(RemoveScroll, {
|
|
2402
|
-
as: Slot12,
|
|
2403
|
-
allowPinchZoom: true
|
|
2404
|
-
}, /* @__PURE__ */ React29.createElement(PopoverContentImpl, {
|
|
2405
|
-
...props,
|
|
2406
|
-
ref: composedRefs,
|
|
2407
|
-
// we make sure we're not trapping once it's been closed
|
|
2408
|
-
// (closed !== unmounted when animating out)
|
|
2409
|
-
trapFocus: context.open,
|
|
2410
|
-
disableOutsidePointerEvents: true,
|
|
2411
|
-
onCloseAutoFocus: composeEventHandlers2(props.onCloseAutoFocus, (event) => {
|
|
2412
|
-
event.preventDefault();
|
|
2413
|
-
if (!isRightClickOutsideRef.current) {
|
|
2414
|
-
context.triggerRef.current?.focus();
|
|
2415
|
-
}
|
|
2416
|
-
}),
|
|
2417
|
-
onPointerDownOutside: composeEventHandlers2(props.onPointerDownOutside, (event) => {
|
|
2418
|
-
const originalEvent = event.detail.originalEvent;
|
|
2419
|
-
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
2420
|
-
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
2421
|
-
isRightClickOutsideRef.current = isRightClick;
|
|
2422
|
-
}, {
|
|
2423
|
-
checkForDefaultPrevented: false
|
|
2424
|
-
}),
|
|
2425
|
-
// When focus is trapped, a `focusout` event may still happen.
|
|
2426
|
-
// We make sure we don't trigger our `onDismiss` in such case.
|
|
2427
|
-
onFocusOutside: composeEventHandlers2(props.onFocusOutside, (event) => event.preventDefault(), {
|
|
2428
|
-
checkForDefaultPrevented: false
|
|
2429
|
-
})
|
|
2430
|
-
}));
|
|
2431
|
-
});
|
|
2432
|
-
var PopoverContentNonModal = /* @__PURE__ */ forwardRef21((props, forwardedRef) => {
|
|
2433
|
-
const context = usePopoverContext(CONTENT_NAME2, props.__scopePopover);
|
|
2434
|
-
const hasInteractedOutsideRef = useRef3(false);
|
|
2435
|
-
const hasPointerDownOutsideRef = useRef3(false);
|
|
2436
|
-
return /* @__PURE__ */ React29.createElement(PopoverContentImpl, {
|
|
2437
|
-
...props,
|
|
2438
|
-
ref: forwardedRef,
|
|
2439
|
-
trapFocus: false,
|
|
2440
|
-
disableOutsidePointerEvents: false,
|
|
2441
|
-
onCloseAutoFocus: (event) => {
|
|
2442
|
-
props.onCloseAutoFocus?.(event);
|
|
2443
|
-
if (!event.defaultPrevented) {
|
|
2444
|
-
if (!hasInteractedOutsideRef.current) {
|
|
2445
|
-
context.triggerRef.current?.focus();
|
|
2446
|
-
}
|
|
2447
|
-
event.preventDefault();
|
|
2448
|
-
}
|
|
2449
|
-
hasInteractedOutsideRef.current = false;
|
|
2450
|
-
hasPointerDownOutsideRef.current = false;
|
|
2451
|
-
},
|
|
2452
|
-
onInteractOutside: (event) => {
|
|
2453
|
-
props.onInteractOutside?.(event);
|
|
2454
|
-
if (!event.defaultPrevented) {
|
|
2455
|
-
hasInteractedOutsideRef.current = true;
|
|
2456
|
-
if (event.detail.originalEvent.type === "pointerdown") {
|
|
2457
|
-
hasPointerDownOutsideRef.current = true;
|
|
2458
|
-
}
|
|
2459
|
-
}
|
|
2460
|
-
const target = event.target;
|
|
2461
|
-
const targetIsTrigger = context.triggerRef.current?.contains(target);
|
|
2462
|
-
if (targetIsTrigger) {
|
|
2463
|
-
event.preventDefault();
|
|
2464
|
-
}
|
|
2465
|
-
if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
|
|
2466
|
-
event.preventDefault();
|
|
2467
|
-
}
|
|
2468
|
-
}
|
|
2469
|
-
});
|
|
2470
|
-
});
|
|
2471
|
-
var PopoverContentImpl = /* @__PURE__ */ forwardRef21((props, forwardedRef) => {
|
|
2472
|
-
const { __scopePopover, trapFocus, onOpenAutoFocus, onCloseAutoFocus, disableOutsidePointerEvents, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, collisionPadding = 8, classNames, ...contentProps } = props;
|
|
2473
|
-
const context = usePopoverContext(CONTENT_NAME2, __scopePopover);
|
|
2474
|
-
const popperScope = usePopperScope(__scopePopover);
|
|
2475
|
-
const { tx } = useThemeContext();
|
|
2476
|
-
const elevation = useElevationContext();
|
|
2477
|
-
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
2478
|
-
useFocusGuards();
|
|
2479
|
-
return /* @__PURE__ */ React29.createElement(FocusScope, {
|
|
2480
|
-
asChild: true,
|
|
2481
|
-
loop: true,
|
|
2482
|
-
trapped: trapFocus,
|
|
2483
|
-
onMountAutoFocus: onOpenAutoFocus,
|
|
2484
|
-
onUnmountAutoFocus: onCloseAutoFocus
|
|
2485
|
-
}, /* @__PURE__ */ React29.createElement(DismissableLayer, {
|
|
2486
|
-
asChild: true,
|
|
2487
|
-
disableOutsidePointerEvents,
|
|
2488
|
-
onInteractOutside,
|
|
2489
|
-
onEscapeKeyDown,
|
|
2490
|
-
onPointerDownOutside,
|
|
2491
|
-
onFocusOutside,
|
|
2492
|
-
onDismiss: () => context.onOpenChange(false)
|
|
2493
|
-
}, /* @__PURE__ */ React29.createElement(PopperPrimitive.Content, {
|
|
2494
|
-
"data-state": getState(context.open),
|
|
2495
|
-
role: "dialog",
|
|
2496
|
-
id: context.contentId,
|
|
2497
|
-
...popperScope,
|
|
2498
|
-
...contentProps,
|
|
2499
|
-
collisionPadding: safeCollisionPadding,
|
|
2500
|
-
className: tx("popover.content", "popover", {
|
|
2501
|
-
elevation
|
|
2502
|
-
}, classNames),
|
|
2503
|
-
ref: forwardedRef,
|
|
2504
|
-
style: {
|
|
2505
|
-
...contentProps.style,
|
|
2506
|
-
// re-namespace exposed content custom properties
|
|
2507
|
-
...{
|
|
2508
|
-
"--radix-popover-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
2509
|
-
"--radix-popover-content-available-width": "var(--radix-popper-available-width)",
|
|
2510
|
-
"--radix-popover-content-available-height": "var(--radix-popper-available-height)",
|
|
2511
|
-
"--radix-popover-trigger-width": "var(--radix-popper-anchor-width)",
|
|
2512
|
-
"--radix-popover-trigger-height": "var(--radix-popper-anchor-height)"
|
|
2513
|
-
}
|
|
2514
|
-
}
|
|
2515
|
-
})));
|
|
2516
|
-
});
|
|
2517
|
-
var CLOSE_NAME = "PopoverClose";
|
|
2518
|
-
var PopoverClose = /* @__PURE__ */ forwardRef21((props, forwardedRef) => {
|
|
2519
|
-
const { __scopePopover, ...closeProps } = props;
|
|
2520
|
-
const context = usePopoverContext(CLOSE_NAME, __scopePopover);
|
|
2521
|
-
return /* @__PURE__ */ React29.createElement(Primitive11.button, {
|
|
2522
|
-
type: "button",
|
|
2523
|
-
...closeProps,
|
|
2524
|
-
ref: forwardedRef,
|
|
2525
|
-
onClick: composeEventHandlers2(props.onClick, () => context.onOpenChange(false))
|
|
2526
|
-
});
|
|
2527
|
-
});
|
|
2528
|
-
PopoverClose.displayName = CLOSE_NAME;
|
|
2529
|
-
var ARROW_NAME2 = "PopoverArrow";
|
|
2530
|
-
var PopoverArrow = /* @__PURE__ */ forwardRef21((props, forwardedRef) => {
|
|
2531
|
-
const { __scopePopover, classNames, ...arrowProps } = props;
|
|
2532
|
-
const popperScope = usePopperScope(__scopePopover);
|
|
2533
|
-
const { tx } = useThemeContext();
|
|
2534
|
-
return /* @__PURE__ */ React29.createElement(PopperPrimitive.Arrow, {
|
|
2535
|
-
...popperScope,
|
|
2536
|
-
...arrowProps,
|
|
2537
|
-
className: tx("popover.arrow", "popover__arrow", {}, classNames),
|
|
2538
|
-
ref: forwardedRef
|
|
2539
|
-
});
|
|
2540
|
-
});
|
|
2541
|
-
PopoverArrow.displayName = ARROW_NAME2;
|
|
2542
|
-
var PopoverViewport = /* @__PURE__ */ forwardRef21(({ classNames, asChild, constrainInline = true, constrainBlock = true, children, ...props }, forwardedRef) => {
|
|
2543
|
-
const { tx } = useThemeContext();
|
|
2544
|
-
const Root5 = asChild ? Slot12 : Primitive11.div;
|
|
2545
|
-
return /* @__PURE__ */ React29.createElement(Root5, {
|
|
2546
|
-
...props,
|
|
2547
|
-
className: tx("popover.viewport", "popover__viewport", {
|
|
2548
|
-
constrainInline,
|
|
2549
|
-
constrainBlock
|
|
2550
|
-
}, classNames),
|
|
2551
|
-
ref: forwardedRef
|
|
2552
|
-
}, children);
|
|
2553
|
-
});
|
|
2554
|
-
var getState = (open) => open ? "open" : "closed";
|
|
2555
|
-
var Popover = {
|
|
2556
|
-
Root: PopoverRoot,
|
|
2557
|
-
Anchor: PopoverAnchor,
|
|
2558
|
-
Trigger: PopoverTrigger,
|
|
2559
|
-
VirtualTrigger: PopoverVirtualTrigger,
|
|
2560
|
-
Portal: PopoverPortal,
|
|
2561
|
-
Content: PopoverContent,
|
|
2562
|
-
Close: PopoverClose,
|
|
2563
|
-
Arrow: PopoverArrow,
|
|
2564
|
-
Viewport: PopoverViewport
|
|
2565
|
-
};
|
|
2566
|
-
|
|
2567
|
-
// packages/ui/react-ui/src/components/Status/Status.tsx
|
|
2568
|
-
import React30, { forwardRef as forwardRef22 } from "react";
|
|
2569
|
-
var Status = /* @__PURE__ */ forwardRef22(({ classNames, children, progress = 0, indeterminate, variant, ...props }, forwardedRef) => {
|
|
2570
|
-
const { tx } = useThemeContext();
|
|
2571
|
-
return /* @__PURE__ */ React30.createElement("span", {
|
|
2572
|
-
role: "status",
|
|
2573
|
-
...props,
|
|
2574
|
-
className: tx("status.root", "status", {
|
|
2575
|
-
indeterminate,
|
|
2576
|
-
variant
|
|
2577
|
-
}, classNames),
|
|
2578
|
-
ref: forwardedRef
|
|
2579
|
-
}, /* @__PURE__ */ React30.createElement("span", {
|
|
2580
|
-
role: "none",
|
|
2581
|
-
className: tx("status.bar", "status__bar", {
|
|
2582
|
-
indeterminate,
|
|
2583
|
-
variant
|
|
2584
|
-
}, classNames),
|
|
2585
|
-
...!indeterminate && {
|
|
2586
|
-
style: {
|
|
2587
|
-
width: `${Math.round(progress * 100)}%`
|
|
2588
|
-
}
|
|
2589
|
-
}
|
|
2590
|
-
}), children);
|
|
2591
|
-
});
|
|
2592
|
-
|
|
2593
|
-
// packages/ui/react-ui/src/components/ScrollArea/ScrollArea.tsx
|
|
2594
|
-
import { Root as ScrollAreaPrimitiveRoot, Viewport as ScrollAreaPrimitiveViewport, Scrollbar as ScrollAreaPrimitiveScrollbar, Thumb as ScrollAreaPrimitiveThumb, Corner as ScrollAreaPrimitiveCorner } from "@radix-ui/react-scroll-area";
|
|
2595
|
-
import React31, { forwardRef as forwardRef23 } from "react";
|
|
2596
|
-
var ScrollAreaRoot = /* @__PURE__ */ forwardRef23(({ classNames, ...props }, forwardedRef) => {
|
|
2597
|
-
const { tx } = useThemeContext();
|
|
2598
|
-
return /* @__PURE__ */ React31.createElement(ScrollAreaPrimitiveRoot, {
|
|
2599
|
-
...props,
|
|
2600
|
-
className: tx("scrollArea.root", "scroll-area", {}, classNames),
|
|
2601
|
-
ref: forwardedRef
|
|
2602
|
-
});
|
|
2603
|
-
});
|
|
2604
|
-
var ScrollAreaViewport = /* @__PURE__ */ forwardRef23(({ classNames, ...props }, forwardedRef) => {
|
|
2605
|
-
const { tx } = useThemeContext();
|
|
2606
|
-
return /* @__PURE__ */ React31.createElement(ScrollAreaPrimitiveViewport, {
|
|
2607
|
-
...props,
|
|
2608
|
-
className: tx("scrollArea.viewport", "scroll-area", {}, classNames),
|
|
2609
|
-
ref: forwardedRef
|
|
2610
|
-
});
|
|
2611
|
-
});
|
|
2612
|
-
var ScrollAreaScrollbar = /* @__PURE__ */ forwardRef23(({ classNames, variant = "fine", ...props }, forwardedRef) => {
|
|
2613
|
-
const { tx } = useThemeContext();
|
|
2614
|
-
return /* @__PURE__ */ React31.createElement(ScrollAreaPrimitiveScrollbar, {
|
|
2615
|
-
"data-variant": variant,
|
|
2616
|
-
...props,
|
|
2617
|
-
className: tx("scrollArea.scrollbar", "scroll-area__scrollbar", {}, classNames),
|
|
2618
|
-
ref: forwardedRef
|
|
2619
|
-
});
|
|
2620
|
-
});
|
|
2621
|
-
var ScrollAreaThumb = /* @__PURE__ */ forwardRef23(({ classNames, ...props }, forwardedRef) => {
|
|
2622
|
-
const { tx } = useThemeContext();
|
|
2623
|
-
return /* @__PURE__ */ React31.createElement(ScrollAreaPrimitiveThumb, {
|
|
2624
|
-
...props,
|
|
2625
|
-
className: tx("scrollArea.thumb", "scroll-area__thumb", {}, classNames),
|
|
2626
|
-
ref: forwardedRef
|
|
2627
|
-
});
|
|
2628
|
-
});
|
|
2629
|
-
var ScrollAreaCorner = /* @__PURE__ */ forwardRef23(({ classNames, ...props }, forwardedRef) => {
|
|
2630
|
-
const { tx } = useThemeContext();
|
|
2631
|
-
return /* @__PURE__ */ React31.createElement(ScrollAreaPrimitiveCorner, {
|
|
2632
|
-
...props,
|
|
2633
|
-
className: tx("scrollArea.corner", "scroll-area__corner", {}, classNames),
|
|
2634
|
-
ref: forwardedRef
|
|
2635
|
-
});
|
|
2636
|
-
});
|
|
2637
|
-
var ScrollArea = {
|
|
2638
|
-
Root: ScrollAreaRoot,
|
|
2639
|
-
Viewport: ScrollAreaViewport,
|
|
2640
|
-
Scrollbar: ScrollAreaScrollbar,
|
|
2641
|
-
Thumb: ScrollAreaThumb,
|
|
2642
|
-
Corner: ScrollAreaCorner
|
|
2643
|
-
};
|
|
2644
|
-
|
|
2645
|
-
// packages/ui/react-ui/src/components/Select/Select.tsx
|
|
2646
|
-
import { CaretDown as CaretDown2, CaretUp } from "@phosphor-icons/react";
|
|
2647
|
-
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
2648
|
-
import React32, { forwardRef as forwardRef24 } from "react";
|
|
2649
|
-
var SelectRoot = SelectPrimitive.Root;
|
|
2650
|
-
var SelectTrigger = SelectPrimitive.Trigger;
|
|
2651
|
-
var SelectValue = SelectPrimitive.Value;
|
|
2652
|
-
var SelectIcon = SelectPrimitive.Icon;
|
|
2653
|
-
var SelectPortal = SelectPrimitive.Portal;
|
|
2654
|
-
var SelectTriggerButton = /* @__PURE__ */ forwardRef24(({ children, placeholder, ...props }, forwardedRef) => {
|
|
2655
|
-
const { tx } = useThemeContext();
|
|
2656
|
-
return /* @__PURE__ */ React32.createElement(SelectPrimitive.Trigger, {
|
|
2657
|
-
asChild: true,
|
|
2658
|
-
ref: forwardedRef
|
|
2659
|
-
}, /* @__PURE__ */ React32.createElement(Button, props, /* @__PURE__ */ React32.createElement(SelectPrimitive.Value, {
|
|
2660
|
-
placeholder
|
|
2661
|
-
}, children), /* @__PURE__ */ React32.createElement("span", {
|
|
2662
|
-
className: "w-1 flex-1"
|
|
2663
|
-
}), /* @__PURE__ */ React32.createElement(SelectPrimitive.Icon, {
|
|
2664
|
-
asChild: true
|
|
2665
|
-
}, /* @__PURE__ */ React32.createElement(CaretDown2, {
|
|
2666
|
-
className: tx("select.triggerIcon", "select__trigger__icon", {}),
|
|
2667
|
-
weight: "bold"
|
|
2668
|
-
}))));
|
|
2669
|
-
});
|
|
2670
|
-
var SelectContent = /* @__PURE__ */ forwardRef24(({ classNames, children, collisionPadding = 8, ...props }, forwardedRef) => {
|
|
2671
|
-
const { tx } = useThemeContext();
|
|
2672
|
-
const elevation = useElevationContext();
|
|
2673
|
-
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
2674
|
-
return /* @__PURE__ */ React32.createElement(SelectPrimitive.Content, {
|
|
2675
|
-
...props,
|
|
2676
|
-
collisionPadding: safeCollisionPadding,
|
|
2677
|
-
className: tx("select.content", "select__content", {
|
|
2678
|
-
elevation
|
|
2679
|
-
}, classNames),
|
|
2680
|
-
position: "popper",
|
|
2681
|
-
ref: forwardedRef
|
|
2682
|
-
}, children);
|
|
2683
|
-
});
|
|
2684
|
-
var SelectScrollUpButton2 = /* @__PURE__ */ forwardRef24(({ classNames, children, ...props }, forwardedRef) => {
|
|
2685
|
-
const { tx } = useThemeContext();
|
|
2686
|
-
return /* @__PURE__ */ React32.createElement(SelectPrimitive.SelectScrollUpButton, {
|
|
2687
|
-
...props,
|
|
2688
|
-
className: tx("select.scrollButton", "select__scroll-button--up", {}, classNames),
|
|
2689
|
-
ref: forwardedRef
|
|
2690
|
-
}, children ?? /* @__PURE__ */ React32.createElement(CaretUp, {
|
|
2691
|
-
weight: "bold"
|
|
2692
|
-
}));
|
|
2693
|
-
});
|
|
2694
|
-
var SelectScrollDownButton2 = /* @__PURE__ */ forwardRef24(({ classNames, children, ...props }, forwardedRef) => {
|
|
2695
|
-
const { tx } = useThemeContext();
|
|
2696
|
-
return /* @__PURE__ */ React32.createElement(SelectPrimitive.SelectScrollDownButton, {
|
|
2697
|
-
...props,
|
|
2698
|
-
className: tx("select.scrollButton", "select__scroll-button--down", {}, classNames),
|
|
2699
|
-
ref: forwardedRef
|
|
2700
|
-
}, children ?? /* @__PURE__ */ React32.createElement(CaretDown2, {
|
|
2701
|
-
weight: "bold"
|
|
2702
|
-
}));
|
|
2703
|
-
});
|
|
2704
|
-
var SelectViewport2 = /* @__PURE__ */ forwardRef24(({ classNames, asChild, children, ...props }, forwardedRef) => {
|
|
2705
|
-
const { tx } = useThemeContext();
|
|
2706
|
-
return /* @__PURE__ */ React32.createElement(SelectPrimitive.SelectViewport, {
|
|
2707
|
-
...props,
|
|
2708
|
-
className: tx("select.viewport", "select__viewport", {}, classNames),
|
|
2709
|
-
ref: forwardedRef
|
|
2710
|
-
}, children);
|
|
2711
|
-
});
|
|
2712
|
-
var SelectItem = /* @__PURE__ */ forwardRef24(({ classNames, ...props }, forwardedRef) => {
|
|
2713
|
-
const { tx } = useThemeContext();
|
|
2714
|
-
return /* @__PURE__ */ React32.createElement(SelectPrimitive.Item, {
|
|
2715
|
-
...props,
|
|
2716
|
-
className: tx("select.item", "option", {}, classNames),
|
|
2717
|
-
ref: forwardedRef
|
|
2718
|
-
});
|
|
2719
|
-
});
|
|
2720
|
-
var SelectItemText = SelectPrimitive.ItemText;
|
|
2721
|
-
var SelectItemIndicator = /* @__PURE__ */ forwardRef24(({ classNames, children, ...props }, forwardedRef) => {
|
|
2722
|
-
const { tx } = useThemeContext();
|
|
2723
|
-
return /* @__PURE__ */ React32.createElement(SelectPrimitive.ItemIndicator, {
|
|
2724
|
-
...props,
|
|
2725
|
-
className: tx("select.itemIndicator", "option__indicator", {}, classNames),
|
|
2726
|
-
ref: forwardedRef
|
|
2727
|
-
}, children);
|
|
2728
|
-
});
|
|
2729
|
-
var SelectOption = /* @__PURE__ */ forwardRef24(({ children, classNames, ...props }, forwardedRef) => {
|
|
2730
|
-
const { tx } = useThemeContext();
|
|
2731
|
-
return /* @__PURE__ */ React32.createElement(SelectPrimitive.Item, {
|
|
2732
|
-
...props,
|
|
2733
|
-
className: tx("select.item", "option", {}, classNames),
|
|
2734
|
-
ref: forwardedRef
|
|
2735
|
-
}, /* @__PURE__ */ React32.createElement(SelectPrimitive.ItemText, null, children), /* @__PURE__ */ React32.createElement("span", {
|
|
2736
|
-
className: "grow w-1"
|
|
2737
|
-
}), /* @__PURE__ */ React32.createElement(Icon, {
|
|
2738
|
-
icon: "ph--check--regular"
|
|
2739
|
-
}));
|
|
2740
|
-
});
|
|
2741
|
-
var SelectGroup = SelectPrimitive.Group;
|
|
2742
|
-
var SelectLabel = SelectPrimitive.Label;
|
|
2743
|
-
var SelectSeparator = /* @__PURE__ */ forwardRef24(({ classNames, ...props }, forwardedRef) => {
|
|
2744
|
-
const { tx } = useThemeContext();
|
|
2745
|
-
return /* @__PURE__ */ React32.createElement(SelectPrimitive.Separator, {
|
|
2746
|
-
...props,
|
|
2747
|
-
className: tx("select.separator", "select__separator", {}, classNames),
|
|
2748
|
-
ref: forwardedRef
|
|
2749
|
-
});
|
|
2750
|
-
});
|
|
2751
|
-
var SelectArrow = /* @__PURE__ */ forwardRef24(({ classNames, ...props }, forwardedRef) => {
|
|
2752
|
-
const { tx } = useThemeContext();
|
|
2753
|
-
return /* @__PURE__ */ React32.createElement(SelectPrimitive.Arrow, {
|
|
2754
|
-
...props,
|
|
2755
|
-
className: tx("select.arrow", "select__arrow", {}, classNames),
|
|
2756
|
-
ref: forwardedRef
|
|
2757
|
-
});
|
|
2758
|
-
});
|
|
2759
|
-
var Select = {
|
|
2760
|
-
Root: SelectRoot,
|
|
2761
|
-
Trigger: SelectTrigger,
|
|
2762
|
-
TriggerButton: SelectTriggerButton,
|
|
2763
|
-
Value: SelectValue,
|
|
2764
|
-
Icon: SelectIcon,
|
|
2765
|
-
Portal: SelectPortal,
|
|
2766
|
-
Content: SelectContent,
|
|
2767
|
-
ScrollUpButton: SelectScrollUpButton2,
|
|
2768
|
-
ScrollDownButton: SelectScrollDownButton2,
|
|
2769
|
-
Viewport: SelectViewport2,
|
|
2770
|
-
Item: SelectItem,
|
|
2771
|
-
ItemText: SelectItemText,
|
|
2772
|
-
ItemIndicator: SelectItemIndicator,
|
|
2773
|
-
Option: SelectOption,
|
|
2774
|
-
Group: SelectGroup,
|
|
2775
|
-
Label: SelectLabel,
|
|
2776
|
-
Separator: SelectSeparator,
|
|
2777
|
-
Arrow: SelectArrow
|
|
2778
|
-
};
|
|
2779
|
-
|
|
2780
|
-
// packages/ui/react-ui/src/components/Separator/Separator.tsx
|
|
2781
|
-
import { Separator as SeparatorPrimitive } from "@radix-ui/react-separator";
|
|
2782
|
-
import React33, { forwardRef as forwardRef25 } from "react";
|
|
2783
|
-
var Separator4 = /* @__PURE__ */ forwardRef25(({ classNames, orientation = "horizontal", ...props }, forwardedRef) => {
|
|
2784
|
-
const { tx } = useThemeContext();
|
|
2785
|
-
return /* @__PURE__ */ React33.createElement(SeparatorPrimitive, {
|
|
2786
|
-
orientation,
|
|
2787
|
-
...props,
|
|
2788
|
-
className: tx("separator.root", "separator", {
|
|
2789
|
-
orientation
|
|
2790
|
-
}, classNames),
|
|
2791
|
-
ref: forwardedRef
|
|
2792
|
-
});
|
|
2793
|
-
});
|
|
2794
|
-
|
|
2795
|
-
// packages/ui/react-ui/src/components/Tag/Tag.tsx
|
|
2796
|
-
import { Primitive as Primitive12 } from "@radix-ui/react-primitive";
|
|
2797
|
-
import { Slot as Slot13 } from "@radix-ui/react-slot";
|
|
2798
|
-
import React34, { forwardRef as forwardRef26 } from "react";
|
|
2799
|
-
var Tag = /* @__PURE__ */ forwardRef26(({ asChild, palette = "neutral", classNames, ...props }, forwardedRef) => {
|
|
2800
|
-
const { tx } = useThemeContext();
|
|
2801
|
-
const Root5 = asChild ? Slot13 : Primitive12.span;
|
|
2802
|
-
return /* @__PURE__ */ React34.createElement(Root5, {
|
|
2803
|
-
...props,
|
|
2804
|
-
className: tx("tag.root", "dx-tag", {
|
|
2805
|
-
palette
|
|
2806
|
-
}, classNames),
|
|
2807
|
-
"data-hue": palette,
|
|
2808
|
-
ref: forwardedRef
|
|
2809
|
-
});
|
|
2810
|
-
});
|
|
2811
|
-
|
|
2812
|
-
// packages/ui/react-ui/src/components/Toast/Toast.tsx
|
|
2813
|
-
import { Primitive as Primitive13 } from "@radix-ui/react-primitive";
|
|
2814
|
-
import { Slot as Slot14 } from "@radix-ui/react-slot";
|
|
2815
|
-
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";
|
|
2816
|
-
import React35, { forwardRef as forwardRef27 } from "react";
|
|
2817
|
-
var ToastProvider = ToastProviderPrimitive;
|
|
2818
|
-
var ToastViewport = /* @__PURE__ */ forwardRef27(({ classNames, ...props }, forwardedRef) => {
|
|
2819
|
-
const { tx } = useThemeContext();
|
|
2820
|
-
return /* @__PURE__ */ React35.createElement(ToastViewportPrimitive, {
|
|
2821
|
-
className: tx("toast.viewport", "toast-viewport", {}, classNames),
|
|
2822
|
-
ref: forwardedRef
|
|
2823
|
-
});
|
|
2824
|
-
});
|
|
2825
|
-
var ToastRoot = /* @__PURE__ */ forwardRef27(({ classNames, children, ...props }, forwardedRef) => {
|
|
2826
|
-
const { tx } = useThemeContext();
|
|
2827
|
-
return /* @__PURE__ */ React35.createElement(ToastRootPrimitive, {
|
|
2828
|
-
...props,
|
|
2829
|
-
className: tx("toast.root", "toast", {}, classNames),
|
|
2830
|
-
ref: forwardedRef
|
|
2831
|
-
}, /* @__PURE__ */ React35.createElement(ElevationProvider, {
|
|
2832
|
-
elevation: "toast"
|
|
2833
|
-
}, children));
|
|
2834
|
-
});
|
|
2835
|
-
var ToastBody = /* @__PURE__ */ forwardRef27(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
2836
|
-
const { tx } = useThemeContext();
|
|
2837
|
-
const Root5 = asChild ? Slot14 : Primitive13.div;
|
|
2838
|
-
return /* @__PURE__ */ React35.createElement(Root5, {
|
|
2839
|
-
...props,
|
|
2840
|
-
className: tx("toast.body", "toast__body", {}, classNames),
|
|
2841
|
-
ref: forwardedRef
|
|
2842
|
-
});
|
|
2843
|
-
});
|
|
2844
|
-
var ToastTitle = /* @__PURE__ */ forwardRef27(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
2845
|
-
const { tx } = useThemeContext();
|
|
2846
|
-
const Root5 = asChild ? Slot14 : ToastTitlePrimitive;
|
|
2847
|
-
return /* @__PURE__ */ React35.createElement(Root5, {
|
|
2848
|
-
...props,
|
|
2849
|
-
className: tx("toast.title", "toast__title", {}, classNames),
|
|
2850
|
-
ref: forwardedRef
|
|
2851
|
-
});
|
|
2852
|
-
});
|
|
2853
|
-
var ToastDescription = /* @__PURE__ */ forwardRef27(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
2854
|
-
const { tx } = useThemeContext();
|
|
2855
|
-
const Root5 = asChild ? Slot14 : ToastDescriptionPrimitive;
|
|
2856
|
-
return /* @__PURE__ */ React35.createElement(Root5, {
|
|
2857
|
-
...props,
|
|
2858
|
-
className: tx("toast.description", "toast__description", {}, classNames),
|
|
2859
|
-
ref: forwardedRef
|
|
2860
|
-
});
|
|
2861
|
-
});
|
|
2862
|
-
var ToastActions = /* @__PURE__ */ forwardRef27(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
2863
|
-
const { tx } = useThemeContext();
|
|
2864
|
-
const Root5 = asChild ? Slot14 : Primitive13.div;
|
|
2865
|
-
return /* @__PURE__ */ React35.createElement(Root5, {
|
|
2866
|
-
...props,
|
|
2867
|
-
className: tx("toast.actions", "toast__actions", {}, classNames),
|
|
2868
|
-
ref: forwardedRef
|
|
2869
|
-
});
|
|
2870
|
-
});
|
|
2871
|
-
var ToastAction = ToastActionPrimitive;
|
|
2872
|
-
var ToastClose = ToastClosePrimitive;
|
|
2873
|
-
var Toast = {
|
|
2874
|
-
Provider: ToastProvider,
|
|
2875
|
-
Viewport: ToastViewport,
|
|
2876
|
-
Root: ToastRoot,
|
|
2877
|
-
Body: ToastBody,
|
|
2878
|
-
Title: ToastTitle,
|
|
2879
|
-
Description: ToastDescription,
|
|
2880
|
-
Actions: ToastActions,
|
|
2881
|
-
Action: ToastAction,
|
|
2882
|
-
Close: ToastClose
|
|
2883
|
-
};
|
|
2884
|
-
|
|
2885
|
-
// packages/ui/react-ui/src/components/Toolbar/Toolbar.tsx
|
|
2886
|
-
import * as ToolbarPrimitive from "@radix-ui/react-toolbar";
|
|
2887
|
-
import React36, { forwardRef as forwardRef28 } from "react";
|
|
2888
|
-
var ToolbarRoot = /* @__PURE__ */ forwardRef28(({ classNames, children, ...props }, forwardedRef) => {
|
|
2889
|
-
const { tx } = useThemeContext();
|
|
2890
|
-
return /* @__PURE__ */ React36.createElement(ToolbarPrimitive.Root, {
|
|
2891
|
-
...props,
|
|
2892
|
-
className: tx("toolbar.root", "toolbar", {}, classNames),
|
|
2893
|
-
ref: forwardedRef
|
|
2894
|
-
}, children);
|
|
2895
|
-
});
|
|
2896
|
-
var ToolbarButton = /* @__PURE__ */ forwardRef28((props, forwardedRef) => {
|
|
2897
|
-
return /* @__PURE__ */ React36.createElement(ToolbarPrimitive.Button, {
|
|
2898
|
-
asChild: true
|
|
2899
|
-
}, /* @__PURE__ */ React36.createElement(Button, {
|
|
2900
|
-
...props,
|
|
2901
|
-
ref: forwardedRef
|
|
2902
|
-
}));
|
|
2903
|
-
});
|
|
2904
|
-
var ToolbarIconButton = /* @__PURE__ */ forwardRef28((props, forwardedRef) => {
|
|
2905
|
-
return /* @__PURE__ */ React36.createElement(ToolbarPrimitive.Button, {
|
|
2906
|
-
asChild: true
|
|
2907
|
-
}, /* @__PURE__ */ React36.createElement(IconButton, {
|
|
2908
|
-
...props,
|
|
2909
|
-
ref: forwardedRef
|
|
2910
|
-
}));
|
|
2911
|
-
});
|
|
2912
|
-
var ToolbarToggle = /* @__PURE__ */ forwardRef28((props, forwardedRef) => {
|
|
2913
|
-
return /* @__PURE__ */ React36.createElement(ToolbarPrimitive.Button, {
|
|
2914
|
-
asChild: true
|
|
2915
|
-
}, /* @__PURE__ */ React36.createElement(Toggle, {
|
|
2916
|
-
...props,
|
|
2917
|
-
ref: forwardedRef
|
|
2918
|
-
}));
|
|
2919
|
-
});
|
|
2920
|
-
var ToolbarLink = /* @__PURE__ */ forwardRef28((props, forwardedRef) => {
|
|
2921
|
-
return /* @__PURE__ */ React36.createElement(ToolbarPrimitive.Link, {
|
|
2922
|
-
asChild: true
|
|
2923
|
-
}, /* @__PURE__ */ React36.createElement(Link, {
|
|
2924
|
-
...props,
|
|
2925
|
-
ref: forwardedRef
|
|
2926
|
-
}));
|
|
2927
|
-
});
|
|
2928
|
-
var ToolbarToggleGroup2 = /* @__PURE__ */ forwardRef28(({ classNames, children, elevation, ...props }, forwardedRef) => {
|
|
2929
|
-
return /* @__PURE__ */ React36.createElement(ToolbarPrimitive.ToolbarToggleGroup, {
|
|
2930
|
-
...props,
|
|
2931
|
-
asChild: true
|
|
2932
|
-
}, /* @__PURE__ */ React36.createElement(ButtonGroup, {
|
|
2933
|
-
classNames,
|
|
2934
|
-
children,
|
|
2935
|
-
elevation,
|
|
2936
|
-
ref: forwardedRef
|
|
2937
|
-
}));
|
|
2938
|
-
});
|
|
2939
|
-
var ToolbarToggleGroupItem = /* @__PURE__ */ forwardRef28(({ variant, density, elevation, classNames, children, ...props }, forwardedRef) => {
|
|
2940
|
-
return /* @__PURE__ */ React36.createElement(ToolbarPrimitive.ToolbarToggleItem, {
|
|
2941
|
-
...props,
|
|
2942
|
-
asChild: true
|
|
2943
|
-
}, /* @__PURE__ */ React36.createElement(Button, {
|
|
2944
|
-
variant,
|
|
2945
|
-
density,
|
|
2946
|
-
elevation,
|
|
2947
|
-
classNames,
|
|
2948
|
-
children,
|
|
2949
|
-
ref: forwardedRef
|
|
2950
|
-
}));
|
|
2951
|
-
});
|
|
2952
|
-
var ToolbarToggleGroupIconItem = /* @__PURE__ */ forwardRef28(({ variant, density, elevation, classNames, icon, label, iconOnly, ...props }, forwardedRef) => {
|
|
2953
|
-
return /* @__PURE__ */ React36.createElement(ToolbarPrimitive.ToolbarToggleItem, {
|
|
2954
|
-
...props,
|
|
2955
|
-
asChild: true
|
|
2956
|
-
}, /* @__PURE__ */ React36.createElement(IconButton, {
|
|
2957
|
-
variant,
|
|
2958
|
-
density,
|
|
2959
|
-
elevation,
|
|
2960
|
-
classNames,
|
|
2961
|
-
icon,
|
|
2962
|
-
label,
|
|
2963
|
-
iconOnly,
|
|
2964
|
-
ref: forwardedRef
|
|
2965
|
-
}));
|
|
2966
|
-
});
|
|
2967
|
-
var ToolbarSeparator = /* @__PURE__ */ forwardRef28(({ variant = "line", ...props }, forwardedRef) => {
|
|
2968
|
-
return variant === "line" ? /* @__PURE__ */ React36.createElement(ToolbarPrimitive.Separator, {
|
|
2969
|
-
asChild: true
|
|
2970
|
-
}, /* @__PURE__ */ React36.createElement(Separator4, {
|
|
2971
|
-
...props,
|
|
2972
|
-
ref: forwardedRef
|
|
2973
|
-
})) : /* @__PURE__ */ React36.createElement(ToolbarPrimitive.Separator, {
|
|
2974
|
-
className: "grow",
|
|
2975
|
-
ref: forwardedRef
|
|
2976
|
-
});
|
|
2977
|
-
});
|
|
2978
|
-
var Toolbar = {
|
|
2979
|
-
Root: ToolbarRoot,
|
|
2980
|
-
Button: ToolbarButton,
|
|
2981
|
-
IconButton: ToolbarIconButton,
|
|
2982
|
-
Link: ToolbarLink,
|
|
2983
|
-
Toggle: ToolbarToggle,
|
|
2984
|
-
ToggleGroup: ToolbarToggleGroup2,
|
|
2985
|
-
ToggleGroupItem: ToolbarToggleGroupItem,
|
|
2986
|
-
ToggleGroupIconItem: ToolbarToggleGroupIconItem,
|
|
2987
|
-
Separator: ToolbarSeparator
|
|
2988
|
-
};
|
|
2989
76
|
export {
|
|
2990
77
|
AlertDialog,
|
|
2991
78
|
AnchoredOverflow,
|
|
@@ -2995,7 +82,7 @@ export {
|
|
|
2995
82
|
Button,
|
|
2996
83
|
ButtonGroup,
|
|
2997
84
|
Clipboard,
|
|
2998
|
-
|
|
85
|
+
ContextMenu,
|
|
2999
86
|
DensityContext,
|
|
3000
87
|
DensityProvider,
|
|
3001
88
|
Dialog,
|
|
@@ -3015,7 +102,7 @@ export {
|
|
|
3015
102
|
Popover,
|
|
3016
103
|
ScrollArea,
|
|
3017
104
|
Select,
|
|
3018
|
-
|
|
105
|
+
Separator,
|
|
3019
106
|
Status,
|
|
3020
107
|
Tag,
|
|
3021
108
|
ThemeContext,
|
|
@@ -3032,6 +119,7 @@ export {
|
|
|
3032
119
|
Treegrid,
|
|
3033
120
|
createDropdownMenuScope,
|
|
3034
121
|
createPopoverScope,
|
|
122
|
+
createTooltipScope,
|
|
3035
123
|
hasIosKeyboard,
|
|
3036
124
|
initialSafeArea,
|
|
3037
125
|
isLabel,
|
|
@@ -3051,6 +139,7 @@ export {
|
|
|
3051
139
|
useSafeArea,
|
|
3052
140
|
useSidebars,
|
|
3053
141
|
useThemeContext,
|
|
142
|
+
useTooltipContext,
|
|
3054
143
|
useTranslation,
|
|
3055
144
|
useTranslationsContext,
|
|
3056
145
|
useVisualViewport
|