@dxos/react-ui 0.8.4-main.d05673bc65 → 0.8.4-main.e00bdcdb52
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-2FKSMWNY.mjs → chunk-BDBC6H6V.mjs} +79 -5
- package/dist/lib/browser/chunk-BDBC6H6V.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +921 -736
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +30 -18
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/browser/translations.mjs +18 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-ZNBLTSHI.mjs → chunk-3JSJK2ZY.mjs} +79 -5
- package/dist/lib/node-esm/chunk-3JSJK2ZY.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +921 -736
- 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 +30 -18
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/translations.mjs +20 -0
- package/dist/lib/node-esm/translations.mjs.map +7 -0
- package/dist/types/src/components/Avatars/Avatar.d.ts +1 -1
- package/dist/types/src/components/Avatars/Avatar.d.ts.map +1 -1
- package/dist/types/src/components/Avatars/Avatar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts.map +1 -1
- package/dist/types/src/components/Breadcrumb/Breadcrumb.d.ts.map +1 -1
- package/dist/types/src/components/Breadcrumb/Breadcrumb.stories.d.ts.map +1 -1
- package/dist/types/src/components/Button/Button.d.ts +2 -2
- package/dist/types/src/components/Button/Button.d.ts.map +1 -1
- package/dist/types/src/components/Button/Button.stories.d.ts +1 -1
- package/dist/types/src/components/Button/Button.stories.d.ts.map +1 -1
- package/dist/types/src/components/Button/IconButton.d.ts +1 -0
- package/dist/types/src/components/Button/IconButton.d.ts.map +1 -1
- package/dist/types/src/components/Button/IconButton.stories.d.ts +3 -0
- package/dist/types/src/components/Button/IconButton.stories.d.ts.map +1 -1
- package/dist/types/src/components/Button/Toggle.d.ts +2 -2
- package/dist/types/src/components/Button/Toggle.d.ts.map +1 -1
- package/dist/types/src/components/Button/Toggle.stories.d.ts.map +1 -1
- package/dist/types/src/components/Button/ToggleGroup.d.ts +6 -6
- package/dist/types/src/components/Button/ToggleGroup.d.ts.map +1 -1
- package/dist/types/src/components/Button/ToggleGroup.stories.d.ts +2 -2
- package/dist/types/src/components/Button/ToggleGroup.stories.d.ts.map +1 -1
- package/dist/types/src/components/Card/Card.d.ts +70 -50
- package/dist/types/src/components/Card/Card.d.ts.map +1 -1
- package/dist/types/src/components/Card/Card.stories.d.ts +2 -2
- package/dist/types/src/components/Card/Card.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.map +1 -1
- package/dist/types/src/components/Clipboard/index.d.ts +10 -1
- package/dist/types/src/components/Clipboard/index.d.ts.map +1 -1
- package/dist/types/src/components/DensityProvider/DensityProvider.d.ts.map +1 -1
- package/dist/types/src/components/Dialog/AlertDialog.d.ts +42 -31
- package/dist/types/src/components/Dialog/AlertDialog.d.ts.map +1 -1
- package/dist/types/src/components/Dialog/AlertDialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/Dialog/Dialog.d.ts +47 -30
- package/dist/types/src/components/Dialog/Dialog.d.ts.map +1 -1
- package/dist/types/src/components/Dialog/Dialog.stories.d.ts +3 -2
- package/dist/types/src/components/Dialog/Dialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/ElevationProvider/ElevationProvider.d.ts.map +1 -1
- package/dist/types/src/components/ErrorFallback/ErrorFallback.d.ts.map +1 -1
- package/dist/types/src/components/ErrorFallback/ErrorFallback.stories.d.ts.map +1 -1
- package/dist/types/src/components/ErrorFallback/ErrorStack.d.ts +14 -3
- package/dist/types/src/components/ErrorFallback/ErrorStack.d.ts.map +1 -1
- package/dist/types/src/components/ErrorFallback/ThrowError.d.ts.map +1 -1
- package/dist/types/src/components/Focus/Focus.d.ts +36 -0
- package/dist/types/src/components/Focus/Focus.d.ts.map +1 -0
- package/dist/types/src/components/Focus/Focus.stories.d.ts +9 -0
- package/dist/types/src/components/Focus/Focus.stories.d.ts.map +1 -0
- package/dist/types/src/components/Focus/index.d.ts +2 -0
- package/dist/types/src/components/Focus/index.d.ts.map +1 -0
- package/dist/types/src/components/Icon/Icon.d.ts +3 -0
- package/dist/types/src/components/Icon/Icon.d.ts.map +1 -1
- package/dist/types/src/components/Icon/Icon.stories.d.ts +11 -3
- package/dist/types/src/components/Icon/Icon.stories.d.ts.map +1 -1
- package/dist/types/src/components/Image/Image.d.ts +2 -1
- package/dist/types/src/components/Image/Image.d.ts.map +1 -1
- package/dist/types/src/components/Image/Image.stories.d.ts +3 -2
- package/dist/types/src/components/Image/Image.stories.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.d.ts +14 -17
- package/dist/types/src/components/Input/Input.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.stories.d.ts +3 -3
- package/dist/types/src/components/Input/Input.stories.d.ts.map +1 -1
- package/dist/types/src/components/Link/Link.stories.d.ts.map +1 -1
- package/dist/types/src/components/List/List.d.ts +5 -3
- package/dist/types/src/components/List/List.d.ts.map +1 -1
- package/dist/types/src/components/List/List.stories.d.ts +3 -1
- package/dist/types/src/components/List/List.stories.d.ts.map +1 -1
- package/dist/types/src/components/List/ListDropIndicator.d.ts.map +1 -1
- package/dist/types/src/components/List/Tree.d.ts +2 -2
- package/dist/types/src/components/List/Tree.d.ts.map +1 -1
- package/dist/types/src/components/List/Tree.stories.d.ts.map +1 -1
- package/dist/types/src/components/List/TreeDropIndicator.d.ts.map +1 -1
- package/dist/types/src/components/List/Treegrid.d.ts +5 -9
- package/dist/types/src/components/List/Treegrid.d.ts.map +1 -1
- package/dist/types/src/components/List/Treegrid.stories.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.d.ts +7 -3
- 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/Menu/ContextMenu.d.ts.map +1 -1
- package/dist/types/src/components/Menu/ContextMenu.stories.d.ts.map +1 -1
- package/dist/types/src/components/Menu/DropdownMenu.d.ts +58 -49
- package/dist/types/src/components/Menu/DropdownMenu.d.ts.map +1 -1
- package/dist/types/src/components/Menu/DropdownMenu.stories.d.ts +14 -1
- package/dist/types/src/components/Menu/DropdownMenu.stories.d.ts.map +1 -1
- package/dist/types/src/components/Message/Message.d.ts.map +1 -1
- package/dist/types/src/components/Message/Message.stories.d.ts +2 -2
- package/dist/types/src/components/Message/Message.stories.d.ts.map +1 -1
- package/dist/types/src/components/Popover/Popover.d.ts +38 -22
- package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
- package/dist/types/src/components/Popover/Popover.stories.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts +12 -9
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts +18 -5
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts.map +1 -1
- package/dist/types/src/components/ScrollContainer/ScrollContainer.d.ts +42 -13
- package/dist/types/src/components/ScrollContainer/ScrollContainer.d.ts.map +1 -1
- package/dist/types/src/components/ScrollContainer/ScrollContainer.stories.d.ts +5 -6
- package/dist/types/src/components/ScrollContainer/ScrollContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/Select/Select.d.ts.map +1 -1
- package/dist/types/src/components/Select/Select.stories.d.ts +2 -2
- package/dist/types/src/components/Select/Select.stories.d.ts.map +1 -1
- package/dist/types/src/components/Separator/Separator.d.ts +3 -3
- package/dist/types/src/components/Separator/Separator.d.ts.map +1 -1
- package/dist/types/src/components/Skeleton/Skeleton.stories.d.ts.map +1 -1
- package/dist/types/src/components/Splitter/Splitter.d.ts +19 -17
- package/dist/types/src/components/Splitter/Splitter.d.ts.map +1 -1
- package/dist/types/src/components/Splitter/Splitter.stories.d.ts.map +1 -1
- package/dist/types/src/components/Status/Status.d.ts +3 -4
- package/dist/types/src/components/Status/Status.d.ts.map +1 -1
- package/dist/types/src/components/Status/Status.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tag/Tag.stories.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.stories.d.ts +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.stories.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts +54 -55
- package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/index.d.ts +1 -1
- package/dist/types/src/components/ThemeProvider/index.d.ts.map +1 -1
- package/dist/types/src/components/Toast/Toast.d.ts +16 -16
- package/dist/types/src/components/Toast/Toast.d.ts.map +1 -1
- package/dist/types/src/components/Toast/Toast.stories.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +11 -19
- package/dist/types/src/components/Toolbar/Toolbar.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 +10 -10
- package/dist/types/src/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts +2 -2
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/exemplars/generics.stories.d.ts +6 -5
- package/dist/types/src/exemplars/generics.stories.d.ts.map +1 -1
- package/dist/types/src/exemplars/slot.stories.d.ts +1 -0
- package/dist/types/src/exemplars/slot.stories.d.ts.map +1 -1
- package/dist/types/src/exemplars/tabster.stories.d.ts.map +1 -1
- package/dist/types/src/exemplars/virtualizer.stories.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +1 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useDensityContext.d.ts +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/useSafeArea.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.map +1 -1
- package/dist/types/src/playground/Custom.stories.d.ts +1 -1
- package/dist/types/src/playground/Custom.stories.d.ts.map +1 -1
- package/dist/types/src/playground/Typography.stories.d.ts.map +1 -1
- package/dist/types/src/primitives/Column/Column.d.ts +21 -14
- package/dist/types/src/primitives/Column/Column.d.ts.map +1 -1
- package/dist/types/src/primitives/Column/Column.stories.d.ts +19 -0
- package/dist/types/src/primitives/Column/Column.stories.d.ts.map +1 -1
- package/dist/types/src/primitives/Container/Container.d.ts +4 -5
- package/dist/types/src/primitives/Container/Container.d.ts.map +1 -1
- package/dist/types/src/primitives/Container/Container.stories.d.ts.map +1 -1
- package/dist/types/src/primitives/Flex/Flex.d.ts +5 -7
- package/dist/types/src/primitives/Flex/Flex.d.ts.map +1 -1
- package/dist/types/src/primitives/Flex/Flex.stories.d.ts.map +1 -1
- package/dist/types/src/primitives/Grid/Grid.d.ts +3 -8
- package/dist/types/src/primitives/Grid/Grid.d.ts.map +1 -1
- package/dist/types/src/primitives/Grid/Grid.stories.d.ts.map +1 -1
- package/dist/types/src/primitives/Panel/Panel.d.ts +24 -15
- package/dist/types/src/primitives/Panel/Panel.d.ts.map +1 -1
- package/dist/types/src/primitives/Panel/Panel.stories.d.ts.map +1 -1
- package/dist/types/src/testing/Loading.d.ts.map +1 -1
- package/dist/types/src/testing/decorators/withLayout.d.ts.map +1 -1
- package/dist/types/src/testing/decorators/withLayoutVariants.d.ts.map +1 -1
- package/dist/types/src/testing/decorators/withTheme.d.ts +1 -1
- package/dist/types/src/testing/decorators/withTheme.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +3 -3
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/util/usePx.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +28 -25
- package/src/components/Avatars/Avatar.stories.tsx +2 -3
- package/src/components/Avatars/Avatar.tsx +1 -2
- package/src/components/Avatars/AvatarGroup.stories.tsx +0 -1
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +1 -2
- package/src/components/Button/Button.stories.tsx +0 -1
- package/src/components/Button/Button.tsx +5 -13
- package/src/components/Button/IconButton.stories.tsx +6 -4
- package/src/components/Button/IconButton.tsx +3 -4
- package/src/components/Button/Toggle.stories.tsx +0 -1
- package/src/components/Button/Toggle.tsx +4 -4
- package/src/components/Button/ToggleGroup.stories.tsx +0 -1
- package/src/components/Button/ToggleGroup.tsx +12 -16
- package/src/components/Card/Card.stories.tsx +12 -12
- package/src/components/Card/Card.tsx +266 -108
- package/src/components/Clipboard/CopyButton.tsx +3 -4
- package/src/components/Dialog/AlertDialog.stories.tsx +5 -6
- package/src/components/Dialog/AlertDialog.tsx +67 -126
- package/src/components/Dialog/Dialog.stories.tsx +64 -9
- package/src/components/Dialog/Dialog.tsx +84 -88
- package/src/components/ErrorFallback/ErrorFallback.stories.tsx +3 -8
- package/src/components/ErrorFallback/ErrorStack.tsx +36 -2
- package/src/components/Focus/AUDIT.md +43 -0
- package/src/components/Focus/Focus.stories.tsx +230 -0
- package/src/components/Focus/Focus.tsx +201 -0
- package/src/components/Focus/index.ts +5 -0
- package/src/components/Icon/Icon.stories.tsx +43 -13
- package/src/components/Icon/Icon.tsx +5 -1
- package/src/components/Image/Image.stories.tsx +3 -3
- package/src/components/Image/Image.tsx +31 -8
- package/src/components/Input/Input.stories.tsx +3 -4
- package/src/components/Input/Input.tsx +7 -7
- package/src/components/Link/Link.stories.tsx +0 -1
- package/src/components/List/List.stories.tsx +0 -1
- package/src/components/List/List.tsx +6 -5
- package/src/components/List/Tree.stories.tsx +1 -2
- package/src/components/List/Tree.tsx +0 -1
- package/src/components/List/Treegrid.stories.tsx +26 -27
- package/src/components/List/Treegrid.tsx +14 -14
- package/src/components/Main/Main.stories.tsx +0 -1
- package/src/components/Main/Main.tsx +1 -2
- package/src/components/Menu/ContextMenu.stories.tsx +0 -1
- package/src/components/Menu/DropdownMenu.stories.tsx +0 -1
- package/src/components/Menu/DropdownMenu.tsx +48 -42
- package/src/components/Message/Message.stories.tsx +6 -7
- package/src/components/Message/Message.tsx +1 -5
- package/src/components/Popover/Popover.stories.tsx +4 -5
- package/src/components/Popover/Popover.tsx +42 -42
- package/src/components/ScrollArea/ScrollArea.stories.tsx +93 -30
- package/src/components/ScrollArea/ScrollArea.tsx +39 -23
- package/src/components/ScrollContainer/ScrollContainer.stories.tsx +20 -18
- package/src/components/ScrollContainer/ScrollContainer.tsx +200 -91
- package/src/components/Select/Select.stories.tsx +5 -6
- package/src/components/Separator/Separator.tsx +4 -7
- package/src/components/Skeleton/Skeleton.stories.tsx +0 -1
- package/src/components/Splitter/Splitter.stories.tsx +29 -29
- package/src/components/Splitter/Splitter.tsx +35 -34
- package/src/components/Status/Status.stories.tsx +0 -1
- package/src/components/Status/Status.tsx +8 -5
- package/src/components/Tag/Tag.stories.tsx +0 -1
- package/src/components/ThemeProvider/ThemeProvider.stories.tsx +0 -1
- package/src/components/ThemeProvider/ThemeProvider.tsx +5 -4
- package/src/components/ThemeProvider/index.ts +1 -1
- package/src/components/Toast/Toast.stories.tsx +0 -1
- package/src/components/Toast/Toast.tsx +16 -31
- package/src/components/Toolbar/Toolbar.stories.tsx +0 -1
- package/src/components/Toolbar/Toolbar.tsx +21 -35
- package/src/components/Tooltip/Tooltip.stories.tsx +6 -7
- package/src/components/Tooltip/Tooltip.tsx +15 -16
- package/src/components/index.ts +1 -0
- package/src/exemplars/generics.stories.tsx +7 -15
- package/src/exemplars/slot.stories.tsx +67 -57
- package/src/exemplars/tabster.stories.tsx +1 -1
- package/src/exemplars/virtualizer.stories.tsx +4 -4
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useDensityContext.ts +2 -2
- package/src/playground/Custom.stories.tsx +6 -9
- package/src/primitives/Column/AUDIT.md +148 -0
- package/src/primitives/Column/Column.stories.tsx +122 -19
- package/src/primitives/Column/Column.tsx +73 -42
- package/src/primitives/Container/Container.stories.tsx +0 -1
- package/src/primitives/Container/Container.tsx +5 -8
- package/src/primitives/Flex/Flex.stories.tsx +0 -1
- package/src/primitives/Flex/Flex.tsx +10 -12
- package/src/primitives/Grid/Grid.stories.tsx +0 -1
- package/src/primitives/Grid/Grid.tsx +4 -9
- package/src/primitives/Panel/Panel.stories.tsx +9 -8
- package/src/primitives/Panel/Panel.tsx +64 -63
- package/src/testing/Loading.tsx +25 -4
- package/src/testing/decorators/withLayout.tsx +6 -6
- package/src/testing/decorators/withTheme.tsx +10 -7
- package/src/translations.ts +3 -3
- package/src/util/usePx.ts +1 -0
- package/dist/lib/browser/chunk-2FKSMWNY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ZNBLTSHI.mjs.map +0 -7
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
DensityProvider,
|
|
4
4
|
ElevationContext,
|
|
5
5
|
ElevationProvider,
|
|
6
|
+
ErrorStack,
|
|
6
7
|
ThemeContext,
|
|
7
8
|
ThemeProvider,
|
|
8
9
|
Tooltip,
|
|
@@ -10,12 +11,13 @@ import {
|
|
|
10
11
|
createTooltipScope,
|
|
11
12
|
hasIosKeyboard,
|
|
12
13
|
initialSafeArea,
|
|
14
|
+
parseCaptureOwnerStack,
|
|
13
15
|
useElevationContext,
|
|
14
16
|
useSafeArea,
|
|
15
17
|
useThemeContext,
|
|
16
18
|
useTooltipContext,
|
|
17
19
|
useTranslation
|
|
18
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-BDBC6H6V.mjs";
|
|
19
21
|
|
|
20
22
|
// src/index.ts
|
|
21
23
|
import { Trans } from "react-i18next";
|
|
@@ -23,13 +25,13 @@ export * from "@dxos/react-hooks";
|
|
|
23
25
|
export * from "@dxos/ui-types";
|
|
24
26
|
|
|
25
27
|
// src/components/ThemeProvider/index.ts
|
|
26
|
-
import { isLabel, toLocalizedString } from "@dxos/ui-types";
|
|
28
|
+
import { isLabel, toLocalizedString } from "@dxos/ui-types/translations";
|
|
27
29
|
|
|
28
30
|
// src/hooks/useDensityContext.ts
|
|
29
31
|
import { useContext } from "react";
|
|
30
|
-
var useDensityContext = (
|
|
32
|
+
var useDensityContext = (densityProp) => {
|
|
31
33
|
const { density } = useContext(DensityContext);
|
|
32
|
-
return
|
|
34
|
+
return densityProp ?? density;
|
|
33
35
|
};
|
|
34
36
|
|
|
35
37
|
// src/hooks/useIconHref.ts
|
|
@@ -40,6 +42,26 @@ var useIconHref = (icon) => {
|
|
|
40
42
|
return icon ? `${url}#${icon}` : void 0;
|
|
41
43
|
};
|
|
42
44
|
|
|
45
|
+
// src/hooks/useSafeCollisionPadding.ts
|
|
46
|
+
import { useMemo } from "react";
|
|
47
|
+
var propIsNumber = (prop) => Number.isFinite(prop);
|
|
48
|
+
var propsIsRecord = (prop) => !!(prop && typeof prop === "object");
|
|
49
|
+
var safePadding = (propsPadding, safePadding2, side) => {
|
|
50
|
+
return (propIsNumber(safePadding2[side]) ? safePadding2[side] : 0) + (propIsNumber(propsPadding) ? propsPadding : propsIsRecord(propsPadding) ? propsPadding[side] ?? 0 : 0);
|
|
51
|
+
};
|
|
52
|
+
var useSafeCollisionPadding = (collisionPadding) => {
|
|
53
|
+
const { safeAreaPadding } = useThemeContext();
|
|
54
|
+
return useMemo(() => ({
|
|
55
|
+
top: safePadding(collisionPadding, safeAreaPadding, "top"),
|
|
56
|
+
right: safePadding(collisionPadding, safeAreaPadding, "right"),
|
|
57
|
+
bottom: safePadding(collisionPadding, safeAreaPadding, "bottom"),
|
|
58
|
+
left: safePadding(collisionPadding, safeAreaPadding, "left")
|
|
59
|
+
}), [
|
|
60
|
+
collisionPadding,
|
|
61
|
+
safeAreaPadding
|
|
62
|
+
]);
|
|
63
|
+
};
|
|
64
|
+
|
|
43
65
|
// src/hooks/useTranslationsContext.ts
|
|
44
66
|
import { useContext as useContext2 } from "react";
|
|
45
67
|
var useTranslationsContext = () => useContext2(TranslationsContext);
|
|
@@ -64,7 +86,7 @@ var useVisualViewport = (deps) => {
|
|
|
64
86
|
};
|
|
65
87
|
|
|
66
88
|
// src/util/usePx.ts
|
|
67
|
-
import { useCallback as useCallback2, useEffect, useMemo, useState as useState2 } from "react";
|
|
89
|
+
import { useCallback as useCallback2, useEffect, useMemo as useMemo2, useState as useState2 } from "react";
|
|
68
90
|
var getDocumentElementFontSize = () => parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
69
91
|
var usePx = (rem) => {
|
|
70
92
|
const [fontSize, setFontSize] = useState2(() => {
|
|
@@ -100,17 +122,17 @@ var usePx = (rem) => {
|
|
|
100
122
|
}
|
|
101
123
|
};
|
|
102
124
|
}, []);
|
|
103
|
-
return
|
|
125
|
+
return useMemo2(() => rem * fontSize, [
|
|
104
126
|
fontSize
|
|
105
127
|
]);
|
|
106
128
|
};
|
|
107
129
|
|
|
108
130
|
// src/components/Avatars/Avatar.tsx
|
|
109
|
-
import "@dxos/lit-ui/dx-avatar.pcss";
|
|
110
131
|
import { createContext } from "@radix-ui/react-context";
|
|
111
132
|
import { Primitive } from "@radix-ui/react-primitive";
|
|
112
133
|
import { Slot } from "@radix-ui/react-slot";
|
|
113
134
|
import React, { forwardRef } from "react";
|
|
135
|
+
import "@dxos/lit-ui/dx-avatar.pcss";
|
|
114
136
|
import { DxAvatar } from "@dxos/lit-ui/react";
|
|
115
137
|
import { useId } from "@dxos/react-hooks";
|
|
116
138
|
import { mx } from "@dxos/ui-theme";
|
|
@@ -176,7 +198,7 @@ import React4, { forwardRef as forwardRef4 } from "react";
|
|
|
176
198
|
|
|
177
199
|
// src/components/Icon/Icon.tsx
|
|
178
200
|
import React2, { forwardRef as forwardRef2, memo } from "react";
|
|
179
|
-
var Icon = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef2(({ icon, classNames, size
|
|
201
|
+
var Icon = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef2(({ icon, classNames, size, ...props }, forwardedRef) => {
|
|
180
202
|
const { tx } = useThemeContext();
|
|
181
203
|
const href = useIconHref(icon);
|
|
182
204
|
return /* @__PURE__ */ React2.createElement("svg", {
|
|
@@ -284,11 +306,11 @@ var BUTTON_NAME = "Button";
|
|
|
284
306
|
var [ButtonGroupProvider, useButtonGroupContext] = createContext2(BUTTON_GROUP_NAME, {
|
|
285
307
|
inGroup: false
|
|
286
308
|
});
|
|
287
|
-
var Button = /* @__PURE__ */ memo2(/* @__PURE__ */ forwardRef5(({ classNames, children, density:
|
|
309
|
+
var Button = /* @__PURE__ */ memo2(/* @__PURE__ */ forwardRef5(({ classNames, children, density: densityProp, elevation: elevationProp, variant = "default", asChild, ...props }, ref) => {
|
|
288
310
|
const { inGroup } = useButtonGroupContext(BUTTON_NAME);
|
|
289
311
|
const { tx } = useThemeContext();
|
|
290
|
-
const elevation = useElevationContext(
|
|
291
|
-
const density = useDensityContext(
|
|
312
|
+
const elevation = useElevationContext(elevationProp);
|
|
313
|
+
const density = useDensityContext(densityProp);
|
|
292
314
|
const Comp = asChild ? Slot4 : Primitive4.button;
|
|
293
315
|
return /* @__PURE__ */ React5.createElement(Comp, {
|
|
294
316
|
ref,
|
|
@@ -351,12 +373,13 @@ var IconOnlyButton = /* @__PURE__ */ forwardRef6(({ noTooltip, tooltipSide, ...p
|
|
|
351
373
|
ref: forwardedRef
|
|
352
374
|
}));
|
|
353
375
|
});
|
|
354
|
-
var LabelledIconButton = /* @__PURE__ */ forwardRef6(({ size
|
|
376
|
+
var LabelledIconButton = /* @__PURE__ */ forwardRef6(({ size, icon, iconOnly, square, iconEnd, iconClassNames, label, caretDown, noTooltip: _, classNames, ...props }, forwardedRef) => {
|
|
355
377
|
const { tx } = useThemeContext();
|
|
356
378
|
return /* @__PURE__ */ React6.createElement(Button, {
|
|
357
379
|
...props,
|
|
358
380
|
classNames: tx("iconButton.root", {
|
|
359
|
-
iconOnly
|
|
381
|
+
iconOnly,
|
|
382
|
+
square
|
|
360
383
|
}, classNames),
|
|
361
384
|
ref: forwardedRef
|
|
362
385
|
}, icon && !iconEnd && /* @__PURE__ */ React6.createElement(Icon, {
|
|
@@ -376,10 +399,10 @@ var LabelledIconButton = /* @__PURE__ */ forwardRef6(({ size = 5, icon, iconOnly
|
|
|
376
399
|
});
|
|
377
400
|
|
|
378
401
|
// src/components/Button/Toggle.tsx
|
|
379
|
-
import
|
|
402
|
+
import * as TogglePrimitive from "@radix-ui/react-toggle";
|
|
380
403
|
import React7, { forwardRef as forwardRef7 } from "react";
|
|
381
404
|
var Toggle = /* @__PURE__ */ forwardRef7(({ defaultPressed, pressed, onPressedChange, ...props }, forwardedRef) => {
|
|
382
|
-
return /* @__PURE__ */ React7.createElement(TogglePrimitive, {
|
|
405
|
+
return /* @__PURE__ */ React7.createElement(TogglePrimitive.Root, {
|
|
383
406
|
defaultPressed,
|
|
384
407
|
pressed,
|
|
385
408
|
onPressedChange,
|
|
@@ -391,10 +414,10 @@ var Toggle = /* @__PURE__ */ forwardRef7(({ defaultPressed, pressed, onPressedCh
|
|
|
391
414
|
});
|
|
392
415
|
|
|
393
416
|
// src/components/Button/ToggleGroup.tsx
|
|
394
|
-
import
|
|
417
|
+
import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group";
|
|
395
418
|
import React8, { forwardRef as forwardRef8 } from "react";
|
|
396
419
|
var ToggleGroup = /* @__PURE__ */ forwardRef8(({ classNames, children, ...props }, forwardedRef) => {
|
|
397
|
-
return /* @__PURE__ */ React8.createElement(ToggleGroupPrimitive, {
|
|
420
|
+
return /* @__PURE__ */ React8.createElement(ToggleGroupPrimitive.Root, {
|
|
398
421
|
...props,
|
|
399
422
|
asChild: true
|
|
400
423
|
}, /* @__PURE__ */ React8.createElement(ButtonGroup, {
|
|
@@ -404,7 +427,7 @@ var ToggleGroup = /* @__PURE__ */ forwardRef8(({ classNames, children, ...props
|
|
|
404
427
|
}));
|
|
405
428
|
});
|
|
406
429
|
var ToggleGroupItem = /* @__PURE__ */ forwardRef8(({ variant, elevation, density, classNames, children, ...props }, forwardedRef) => {
|
|
407
|
-
return /* @__PURE__ */ React8.createElement(
|
|
430
|
+
return /* @__PURE__ */ React8.createElement(ToggleGroupPrimitive.Item, {
|
|
408
431
|
...props,
|
|
409
432
|
asChild: true
|
|
410
433
|
}, /* @__PURE__ */ React8.createElement(Button, {
|
|
@@ -417,7 +440,7 @@ var ToggleGroupItem = /* @__PURE__ */ forwardRef8(({ variant, elevation, density
|
|
|
417
440
|
}));
|
|
418
441
|
});
|
|
419
442
|
var ToggleGroupIconItem = /* @__PURE__ */ forwardRef8(({ variant, label, icon, size, elevation, density, classNames, ...props }, forwardedRef) => {
|
|
420
|
-
return /* @__PURE__ */ React8.createElement(
|
|
443
|
+
return /* @__PURE__ */ React8.createElement(ToggleGroupPrimitive.Item, {
|
|
421
444
|
...props,
|
|
422
445
|
asChild: true
|
|
423
446
|
}, /* @__PURE__ */ React8.createElement(IconButton, {
|
|
@@ -433,24 +456,25 @@ var ToggleGroupIconItem = /* @__PURE__ */ forwardRef8(({ variant, label, icon, s
|
|
|
433
456
|
});
|
|
434
457
|
|
|
435
458
|
// src/components/Card/Card.tsx
|
|
436
|
-
import { Primitive as
|
|
437
|
-
import { Slot as
|
|
438
|
-
import
|
|
439
|
-
import {
|
|
459
|
+
import { Primitive as Primitive12 } from "@radix-ui/react-primitive";
|
|
460
|
+
import { Slot as Slot12 } from "@radix-ui/react-slot";
|
|
461
|
+
import DOMPurify from "dompurify";
|
|
462
|
+
import React19, { createContext as createContext3, forwardRef as forwardRef13, useContext as useContext3, useMemo as useMemo4 } from "react";
|
|
463
|
+
import { composable as composable3, composableProps as composableProps7, iconSize, mx as mx6, slottable as slottable6 } from "@dxos/ui-theme";
|
|
440
464
|
|
|
441
465
|
// src/primitives/Column/Column.tsx
|
|
442
466
|
import { Primitive as Primitive5 } from "@radix-ui/react-primitive";
|
|
443
467
|
import { Slot as Slot5 } from "@radix-ui/react-slot";
|
|
444
|
-
import React9
|
|
445
|
-
import { composableProps } from "@dxos/ui-theme";
|
|
468
|
+
import React9 from "react";
|
|
469
|
+
import { composableProps, slottable } from "@dxos/ui-theme";
|
|
446
470
|
var COLUMN_ROOT_NAME = "Column.Root";
|
|
447
471
|
var gutterSizes = {
|
|
472
|
+
xs: "var(--dx-gutter-xs)",
|
|
448
473
|
sm: "var(--dx-gutter-sm)",
|
|
449
474
|
md: "var(--dx-gutter-md)",
|
|
450
|
-
lg: "var(--dx-gutter-lg)"
|
|
451
|
-
rail: "var(--dx-rail-item)"
|
|
475
|
+
lg: "var(--dx-gutter-lg)"
|
|
452
476
|
};
|
|
453
|
-
var
|
|
477
|
+
var ColumnRoot = slottable(({ children, asChild, role, gutter = "md", ...props }, forwardedRef) => {
|
|
454
478
|
const { className, ...rest } = composableProps(props);
|
|
455
479
|
const Comp = asChild ? Slot5 : Primitive5.div;
|
|
456
480
|
const { tx } = useThemeContext();
|
|
@@ -460,6 +484,7 @@ var Root = /* @__PURE__ */ forwardRef9(({ children, asChild, role, gutter = "md"
|
|
|
460
484
|
role: role ?? "none",
|
|
461
485
|
style: {
|
|
462
486
|
"--gutter": gutterSize,
|
|
487
|
+
"--dx-col": "2 / span 1",
|
|
463
488
|
gridTemplateColumns: [
|
|
464
489
|
gutterSize,
|
|
465
490
|
"minmax(0,1fr)",
|
|
@@ -472,9 +497,9 @@ var Root = /* @__PURE__ */ forwardRef9(({ children, asChild, role, gutter = "md"
|
|
|
472
497
|
ref: forwardedRef
|
|
473
498
|
}, children);
|
|
474
499
|
});
|
|
475
|
-
|
|
500
|
+
ColumnRoot.displayName = COLUMN_ROOT_NAME;
|
|
476
501
|
var COLUMN_ROW_NAME = "Column.Row";
|
|
477
|
-
var
|
|
502
|
+
var ColumnRow = slottable(({ children, asChild, role, ...props }, forwardedRef) => {
|
|
478
503
|
const { className, ...rest } = composableProps(props);
|
|
479
504
|
const Comp = asChild ? Slot5 : Primitive5.div;
|
|
480
505
|
const { tx } = useThemeContext();
|
|
@@ -485,37 +510,45 @@ var Row = /* @__PURE__ */ forwardRef9(({ children, asChild, role, ...props }, fo
|
|
|
485
510
|
ref: forwardedRef
|
|
486
511
|
}, children);
|
|
487
512
|
});
|
|
488
|
-
|
|
489
|
-
var
|
|
490
|
-
var
|
|
513
|
+
ColumnRow.displayName = COLUMN_ROW_NAME;
|
|
514
|
+
var COLUMN_BLEED_NAME = "Column.Bleed";
|
|
515
|
+
var ColumnBleed = slottable(({ children, asChild, ...props }, forwardedRef) => {
|
|
516
|
+
const { tx } = useThemeContext();
|
|
491
517
|
const { className, ...rest } = composableProps(props);
|
|
492
518
|
const Comp = asChild ? Slot5 : Primitive5.div;
|
|
519
|
+
return /* @__PURE__ */ React9.createElement(Comp, {
|
|
520
|
+
...rest,
|
|
521
|
+
className: tx("column.bleed", {}, className),
|
|
522
|
+
ref: forwardedRef
|
|
523
|
+
}, children);
|
|
524
|
+
});
|
|
525
|
+
ColumnBleed.displayName = COLUMN_BLEED_NAME;
|
|
526
|
+
var COLUMN_CENTER_NAME = "Column.Center";
|
|
527
|
+
var ColumnCenter = slottable(({ children, asChild, ...props }, forwardedRef) => {
|
|
493
528
|
const { tx } = useThemeContext();
|
|
529
|
+
const { className, ...rest } = composableProps(props);
|
|
530
|
+
const Comp = asChild ? Slot5 : Primitive5.div;
|
|
494
531
|
return /* @__PURE__ */ React9.createElement(Comp, {
|
|
495
532
|
...rest,
|
|
496
|
-
|
|
497
|
-
className: tx("column.segment", {}, className),
|
|
533
|
+
className: tx("column.center", {}, className),
|
|
498
534
|
ref: forwardedRef
|
|
499
|
-
},
|
|
500
|
-
className: "contents"
|
|
501
|
-
}, children));
|
|
535
|
+
}, children);
|
|
502
536
|
});
|
|
503
|
-
|
|
537
|
+
ColumnCenter.displayName = COLUMN_CENTER_NAME;
|
|
504
538
|
var Column = {
|
|
505
|
-
Root,
|
|
506
|
-
Row,
|
|
507
|
-
|
|
539
|
+
Root: ColumnRoot,
|
|
540
|
+
Row: ColumnRow,
|
|
541
|
+
Bleed: ColumnBleed,
|
|
542
|
+
Center: ColumnCenter
|
|
508
543
|
};
|
|
509
544
|
|
|
510
545
|
// src/primitives/Container/Container.tsx
|
|
511
|
-
import React10, { forwardRef as forwardRef10 } from "react";
|
|
512
|
-
import { composableProps as composableProps2, mx as mx2 } from "@dxos/ui-theme";
|
|
513
|
-
import { Slot as Slot6 } from "@radix-ui/react-slot";
|
|
514
546
|
import { Primitive as Primitive6 } from "@radix-ui/react-primitive";
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
547
|
+
import { Slot as Slot6 } from "@radix-ui/react-slot";
|
|
548
|
+
import React10 from "react";
|
|
549
|
+
import { composableProps as composableProps2, mx as mx2, slottable as slottable2 } from "@dxos/ui-theme";
|
|
550
|
+
var Container = slottable2(({ children, asChild, ...props }, forwardedRef) => {
|
|
551
|
+
const { className, ...rest } = composableProps2(props);
|
|
519
552
|
const Comp = asChild ? Slot6 : Primitive6.div;
|
|
520
553
|
return /* @__PURE__ */ React10.createElement(Comp, {
|
|
521
554
|
...rest,
|
|
@@ -525,22 +558,24 @@ var Container = /* @__PURE__ */ forwardRef10(({ children, asChild, ...props }, f
|
|
|
525
558
|
});
|
|
526
559
|
|
|
527
560
|
// src/primitives/Flex/Flex.tsx
|
|
528
|
-
import
|
|
529
|
-
import {
|
|
530
|
-
|
|
561
|
+
import { Primitive as Primitive7 } from "@radix-ui/react-primitive";
|
|
562
|
+
import { Slot as Slot7 } from "@radix-ui/react-slot";
|
|
563
|
+
import React11 from "react";
|
|
564
|
+
import { composableProps as composableProps3, mx as mx3, slottable as slottable3 } from "@dxos/ui-theme";
|
|
565
|
+
var Flex = slottable3(({ children, asChild, column, grow, ...props }, forwardedRef) => {
|
|
531
566
|
const { className, ...rest } = composableProps3(props);
|
|
532
|
-
|
|
567
|
+
const Comp = asChild ? Slot7 : Primitive7.div;
|
|
568
|
+
return /* @__PURE__ */ React11.createElement(Comp, {
|
|
533
569
|
ref: forwardedRef,
|
|
534
570
|
...rest,
|
|
535
|
-
role: role ?? "none",
|
|
536
571
|
className: mx3("flex", column && "flex-col", grow && "flex-1 overflow-hidden", className)
|
|
537
572
|
}, children);
|
|
538
573
|
});
|
|
539
574
|
|
|
540
575
|
// src/primitives/Grid/Grid.tsx
|
|
541
|
-
import React12
|
|
542
|
-
import { composableProps as composableProps4, mx as mx4 } from "@dxos/ui-theme";
|
|
543
|
-
var Grid =
|
|
576
|
+
import React12 from "react";
|
|
577
|
+
import { composable, composableProps as composableProps4, mx as mx4 } from "@dxos/ui-theme";
|
|
578
|
+
var Grid = composable(({ children, style, role, cols, rows, grow = true, ...props }, forwardedRef) => {
|
|
544
579
|
const { className, ...rest } = composableProps4(props);
|
|
545
580
|
return /* @__PURE__ */ React12.createElement("div", {
|
|
546
581
|
ref: forwardedRef,
|
|
@@ -556,15 +591,15 @@ var Grid = /* @__PURE__ */ forwardRef12(({ children, style, role, cols, rows, gr
|
|
|
556
591
|
});
|
|
557
592
|
|
|
558
593
|
// src/primitives/Panel/Panel.tsx
|
|
559
|
-
import { Primitive as
|
|
560
|
-
import { Slot as
|
|
561
|
-
import React13
|
|
562
|
-
import { composableProps as composableProps5 } from "@dxos/ui-theme";
|
|
594
|
+
import { Primitive as Primitive8 } from "@radix-ui/react-primitive";
|
|
595
|
+
import { Slot as Slot8 } from "@radix-ui/react-slot";
|
|
596
|
+
import React13 from "react";
|
|
597
|
+
import { composableProps as composableProps5, slottable as slottable4 } from "@dxos/ui-theme";
|
|
563
598
|
var GRID_TEMPLATE_ROWS = "auto 1fr auto";
|
|
564
599
|
var GRID_TEMPLATE_AREAS = '"toolbar" "content" "statusbar"';
|
|
565
|
-
var
|
|
600
|
+
var PanelRoot = slottable4(({ children, asChild, role, style, ...props }, forwardedRef) => {
|
|
566
601
|
const { className, ...rest } = composableProps5(props);
|
|
567
|
-
const Comp = asChild ?
|
|
602
|
+
const Comp = asChild ? Slot8 : Primitive8.div;
|
|
568
603
|
const { tx } = useThemeContext();
|
|
569
604
|
return /* @__PURE__ */ React13.createElement(Comp, {
|
|
570
605
|
...rest,
|
|
@@ -578,22 +613,24 @@ var Root2 = /* @__PURE__ */ forwardRef13(({ children, asChild, role, style, ...p
|
|
|
578
613
|
ref: forwardedRef
|
|
579
614
|
}, children);
|
|
580
615
|
});
|
|
581
|
-
|
|
582
|
-
var
|
|
616
|
+
PanelRoot.displayName = "Panel.Root";
|
|
617
|
+
var PanelToolbar = slottable4(({ children, asChild, size, ...props }, forwardedRef) => {
|
|
583
618
|
const { className, ...rest } = composableProps5(props);
|
|
584
|
-
const Comp = asChild ?
|
|
619
|
+
const Comp = asChild ? Slot8 : Primitive8.div;
|
|
585
620
|
const { tx } = useThemeContext();
|
|
586
621
|
return /* @__PURE__ */ React13.createElement(Comp, {
|
|
587
622
|
...rest,
|
|
588
623
|
"data-slot": "toolbar",
|
|
589
|
-
className: tx("panel.toolbar", {
|
|
624
|
+
className: tx("panel.toolbar", {
|
|
625
|
+
size
|
|
626
|
+
}, className),
|
|
590
627
|
ref: forwardedRef
|
|
591
628
|
}, children);
|
|
592
629
|
});
|
|
593
|
-
|
|
594
|
-
var
|
|
630
|
+
PanelToolbar.displayName = "Panel.Toolbar";
|
|
631
|
+
var PanelContent = slottable4(({ children, asChild, ...props }, forwardedRef) => {
|
|
595
632
|
const { className, ...rest } = composableProps5(props);
|
|
596
|
-
const Comp = asChild ?
|
|
633
|
+
const Comp = asChild ? Slot8 : Primitive8.div;
|
|
597
634
|
const { tx } = useThemeContext();
|
|
598
635
|
return /* @__PURE__ */ React13.createElement(Comp, {
|
|
599
636
|
...rest,
|
|
@@ -602,31 +639,33 @@ var Content = /* @__PURE__ */ forwardRef13(({ children, asChild, ...props }, for
|
|
|
602
639
|
ref: forwardedRef
|
|
603
640
|
}, children);
|
|
604
641
|
});
|
|
605
|
-
|
|
606
|
-
var
|
|
642
|
+
PanelContent.displayName = "Panel.Content";
|
|
643
|
+
var PanelStatusbar = slottable4(({ children, asChild, size, ...props }, forwardedRef) => {
|
|
607
644
|
const { className, ...rest } = composableProps5(props);
|
|
608
|
-
const Comp = asChild ?
|
|
645
|
+
const Comp = asChild ? Slot8 : Primitive8.div;
|
|
609
646
|
const { tx } = useThemeContext();
|
|
610
647
|
return /* @__PURE__ */ React13.createElement(Comp, {
|
|
611
648
|
...rest,
|
|
612
649
|
"data-slot": "statusbar",
|
|
613
|
-
className: tx("panel.statusbar", {
|
|
650
|
+
className: tx("panel.statusbar", {
|
|
651
|
+
size
|
|
652
|
+
}, className),
|
|
614
653
|
ref: forwardedRef
|
|
615
654
|
}, children);
|
|
616
655
|
});
|
|
617
|
-
|
|
656
|
+
PanelStatusbar.displayName = "Panel.Statusbar";
|
|
618
657
|
var Panel = {
|
|
619
|
-
Root:
|
|
620
|
-
Toolbar,
|
|
621
|
-
Content,
|
|
622
|
-
Statusbar
|
|
658
|
+
Root: PanelRoot,
|
|
659
|
+
Toolbar: PanelToolbar,
|
|
660
|
+
Content: PanelContent,
|
|
661
|
+
Statusbar: PanelStatusbar
|
|
623
662
|
};
|
|
624
663
|
|
|
625
664
|
// src/components/Image/Image.tsx
|
|
626
665
|
import React14, { useCallback as useCallback3, useRef, useState as useState3 } from "react";
|
|
627
666
|
import { mx as mx5 } from "@dxos/ui-theme";
|
|
628
667
|
var cache = /* @__PURE__ */ new Map();
|
|
629
|
-
var Image = ({ classNames, src, alt = "", crossOrigin = "anonymous", sampleSize = 64, contrast = 0.9 }) => {
|
|
668
|
+
var Image = ({ classNames, src, alt = "", fit = "contain", crossOrigin = "anonymous", sampleSize = 64, contrast = 0.9 }) => {
|
|
630
669
|
const [crossOriginState, setCrossOriginState] = useState3(crossOrigin);
|
|
631
670
|
const [dominantColor, setDominantColor] = useState3(void 0);
|
|
632
671
|
const [imageLoaded, setImageLoaded] = useState3(false);
|
|
@@ -665,7 +704,13 @@ var Image = ({ classNames, src, alt = "", crossOrigin = "anonymous", sampleSize
|
|
|
665
704
|
src
|
|
666
705
|
]);
|
|
667
706
|
return /* @__PURE__ */ React14.createElement("div", {
|
|
668
|
-
|
|
707
|
+
// `isolate` (`isolation: isolate`) creates a new stacking context so
|
|
708
|
+
// the inner <img>'s `z-10` stays scoped to this wrapper. Without it
|
|
709
|
+
// the z-10 leaks into the parent's stacking context and elevates the
|
|
710
|
+
// image above any pseudo-element rings (e.g. Focus.Item's
|
|
711
|
+
// `dx-ring-pseudo` `::after`) painted on ancestors — most visibly,
|
|
712
|
+
// the focus ring on a Card containing a Card.Poster.
|
|
713
|
+
className: mx5(`relative flex w-full justify-center overflow-hidden transition-all duration-700 isolate`, classNames),
|
|
669
714
|
style: {
|
|
670
715
|
backgroundColor: dominantColor
|
|
671
716
|
}
|
|
@@ -688,7 +733,7 @@ var Image = ({ classNames, src, alt = "", crossOrigin = "anonymous", sampleSize
|
|
|
688
733
|
crossOrigin: crossOriginState,
|
|
689
734
|
onError: handleImageError,
|
|
690
735
|
onLoad: handleImageLoad,
|
|
691
|
-
className: "z-10
|
|
736
|
+
className: mx5("z-10 transition-opacity duration-500", fit === "cover" ? "w-full h-full object-cover" : "object-contain"),
|
|
692
737
|
style: {
|
|
693
738
|
opacity: imageLoaded ? 1 : 0
|
|
694
739
|
}
|
|
@@ -726,7 +771,9 @@ var extractDominantColor = (canvas, img, { sampleSize = 64, contrast = 0.95 }) =
|
|
|
726
771
|
const green = pixels[i + 1];
|
|
727
772
|
const blue = pixels[i + 2];
|
|
728
773
|
const alpha = pixels[i + 3];
|
|
729
|
-
if (alpha === 0)
|
|
774
|
+
if (alpha === 0) {
|
|
775
|
+
continue;
|
|
776
|
+
}
|
|
730
777
|
const max = Math.max(red, green, blue);
|
|
731
778
|
const min = Math.min(red, green, blue);
|
|
732
779
|
const saturation = max === 0 ? 0 : (max - min) / max;
|
|
@@ -754,72 +801,45 @@ var isTransparent = (pixels, sampleSize, threshold = 0.5) => {
|
|
|
754
801
|
const edgePixels = sampleSize * 4 - 4;
|
|
755
802
|
for (let x = 0; x < sampleSize; x++) {
|
|
756
803
|
const topIndex = x * 4;
|
|
757
|
-
if (pixels[topIndex + 3] === 0)
|
|
804
|
+
if (pixels[topIndex + 3] === 0) {
|
|
805
|
+
edgeTransparentPixels++;
|
|
806
|
+
}
|
|
758
807
|
const bottomIndex = ((sampleSize - 1) * sampleSize + x) * 4;
|
|
759
|
-
if (pixels[bottomIndex + 3] === 0)
|
|
808
|
+
if (pixels[bottomIndex + 3] === 0) {
|
|
809
|
+
edgeTransparentPixels++;
|
|
810
|
+
}
|
|
760
811
|
}
|
|
761
812
|
for (let y = 1; y < sampleSize - 1; y++) {
|
|
762
813
|
const leftIndex = y * sampleSize * 4;
|
|
763
|
-
if (pixels[leftIndex + 3] === 0)
|
|
814
|
+
if (pixels[leftIndex + 3] === 0) {
|
|
815
|
+
edgeTransparentPixels++;
|
|
816
|
+
}
|
|
764
817
|
const rightIndex = (y * sampleSize + sampleSize - 1) * 4;
|
|
765
|
-
if (pixels[rightIndex + 3] === 0)
|
|
818
|
+
if (pixels[rightIndex + 3] === 0) {
|
|
819
|
+
edgeTransparentPixels++;
|
|
820
|
+
}
|
|
766
821
|
}
|
|
767
822
|
return edgeTransparentPixels / edgePixels > threshold;
|
|
768
823
|
};
|
|
769
824
|
|
|
770
825
|
// src/components/Toolbar/Toolbar.tsx
|
|
771
|
-
import { Primitive as
|
|
772
|
-
import { Slot as
|
|
826
|
+
import { Primitive as Primitive11 } from "@radix-ui/react-primitive";
|
|
827
|
+
import { Slot as Slot11 } from "@radix-ui/react-slot";
|
|
773
828
|
import * as ToolbarPrimitive from "@radix-ui/react-toolbar";
|
|
774
|
-
import React18, {
|
|
829
|
+
import React18, { forwardRef as forwardRef12 } from "react";
|
|
775
830
|
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
776
|
-
import { composableProps as composableProps6 } from "@dxos/ui-theme";
|
|
777
|
-
|
|
778
|
-
// src/translations.ts
|
|
779
|
-
var translationKey = "@dxos/react-ui";
|
|
780
|
-
var translations = [
|
|
781
|
-
{
|
|
782
|
-
"en-US": {
|
|
783
|
-
[translationKey]: {
|
|
784
|
-
"toolbar menu label": "Action menu",
|
|
785
|
-
"toolbar drag handle label": "Drag to rearrange",
|
|
786
|
-
"toolbar close label": "Close"
|
|
787
|
-
}
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
];
|
|
831
|
+
import { composable as composable2, composableProps as composableProps6, slottable as slottable5 } from "@dxos/ui-theme";
|
|
832
|
+
import { translationKey } from "#translations";
|
|
791
833
|
|
|
792
834
|
// src/components/Menu/ContextMenu.tsx
|
|
793
835
|
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
|
|
794
|
-
import { Primitive as
|
|
795
|
-
import { Slot as
|
|
796
|
-
import React15, { forwardRef as
|
|
797
|
-
|
|
798
|
-
// src/hooks/useSafeCollisionPadding.ts
|
|
799
|
-
import { useMemo as useMemo2 } from "react";
|
|
800
|
-
var propIsNumber = (prop) => Number.isFinite(prop);
|
|
801
|
-
var propsIsRecord = (prop) => !!(prop && typeof prop === "object");
|
|
802
|
-
var safePadding = (propsPadding, safePadding2, side) => {
|
|
803
|
-
return (propIsNumber(safePadding2[side]) ? safePadding2[side] : 0) + (propIsNumber(propsPadding) ? propsPadding : propsIsRecord(propsPadding) ? propsPadding[side] ?? 0 : 0);
|
|
804
|
-
};
|
|
805
|
-
var useSafeCollisionPadding = (collisionPadding) => {
|
|
806
|
-
const { safeAreaPadding } = useThemeContext();
|
|
807
|
-
return useMemo2(() => ({
|
|
808
|
-
top: safePadding(collisionPadding, safeAreaPadding, "top"),
|
|
809
|
-
right: safePadding(collisionPadding, safeAreaPadding, "right"),
|
|
810
|
-
bottom: safePadding(collisionPadding, safeAreaPadding, "bottom"),
|
|
811
|
-
left: safePadding(collisionPadding, safeAreaPadding, "left")
|
|
812
|
-
}), [
|
|
813
|
-
collisionPadding,
|
|
814
|
-
safeAreaPadding
|
|
815
|
-
]);
|
|
816
|
-
};
|
|
817
|
-
|
|
818
|
-
// src/components/Menu/ContextMenu.tsx
|
|
836
|
+
import { Primitive as Primitive9 } from "@radix-ui/react-primitive";
|
|
837
|
+
import { Slot as Slot9 } from "@radix-ui/react-slot";
|
|
838
|
+
import React15, { forwardRef as forwardRef9 } from "react";
|
|
819
839
|
var ContextMenuRoot = ContextMenuPrimitive.ContextMenu;
|
|
820
840
|
var ContextMenuTrigger = ContextMenuPrimitive.Trigger;
|
|
821
841
|
var ContextMenuPortal = ContextMenuPrimitive.Portal;
|
|
822
|
-
var ContextMenuContent = /* @__PURE__ */
|
|
842
|
+
var ContextMenuContent = /* @__PURE__ */ forwardRef9(({ classNames, children, collisionPadding = 8, ...props }, forwardedRef) => {
|
|
823
843
|
const { tx } = useThemeContext();
|
|
824
844
|
const elevation = useElevationContext();
|
|
825
845
|
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
@@ -833,16 +853,16 @@ var ContextMenuContent = /* @__PURE__ */ forwardRef14(({ classNames, children, c
|
|
|
833
853
|
ref: forwardedRef
|
|
834
854
|
}, children);
|
|
835
855
|
});
|
|
836
|
-
var ContextMenuViewport = /* @__PURE__ */
|
|
856
|
+
var ContextMenuViewport = /* @__PURE__ */ forwardRef9(({ classNames, asChild, children, ...props }, forwardedRef) => {
|
|
837
857
|
const { tx } = useThemeContext();
|
|
838
|
-
const Comp = asChild ?
|
|
858
|
+
const Comp = asChild ? Slot9 : Primitive9.div;
|
|
839
859
|
return /* @__PURE__ */ React15.createElement(Comp, {
|
|
840
860
|
...props,
|
|
841
861
|
className: tx("menu.viewport", {}, classNames),
|
|
842
862
|
ref: forwardedRef
|
|
843
863
|
}, children);
|
|
844
864
|
});
|
|
845
|
-
var ContextMenuArrow = /* @__PURE__ */
|
|
865
|
+
var ContextMenuArrow = /* @__PURE__ */ forwardRef9(({ classNames, ...props }, forwardedRef) => {
|
|
846
866
|
const { tx } = useThemeContext();
|
|
847
867
|
return /* @__PURE__ */ React15.createElement(ContextMenuPrimitive.Arrow, {
|
|
848
868
|
...props,
|
|
@@ -852,7 +872,7 @@ var ContextMenuArrow = /* @__PURE__ */ forwardRef14(({ classNames, ...props }, f
|
|
|
852
872
|
});
|
|
853
873
|
var ContextMenuGroup = ContextMenuPrimitive.Group;
|
|
854
874
|
var ContextMenuItemIndicator = ContextMenuPrimitive.ItemIndicator;
|
|
855
|
-
var ContextMenuItem = /* @__PURE__ */
|
|
875
|
+
var ContextMenuItem = /* @__PURE__ */ forwardRef9(({ classNames, ...props }, forwardedRef) => {
|
|
856
876
|
const { tx } = useThemeContext();
|
|
857
877
|
return /* @__PURE__ */ React15.createElement(ContextMenuPrimitive.Item, {
|
|
858
878
|
...props,
|
|
@@ -860,7 +880,7 @@ var ContextMenuItem = /* @__PURE__ */ forwardRef14(({ classNames, ...props }, fo
|
|
|
860
880
|
ref: forwardedRef
|
|
861
881
|
});
|
|
862
882
|
});
|
|
863
|
-
var ContextMenuCheckboxItem = /* @__PURE__ */
|
|
883
|
+
var ContextMenuCheckboxItem = /* @__PURE__ */ forwardRef9(({ classNames, ...props }, forwardedRef) => {
|
|
864
884
|
const { tx } = useThemeContext();
|
|
865
885
|
return /* @__PURE__ */ React15.createElement(ContextMenuPrimitive.CheckboxItem, {
|
|
866
886
|
...props,
|
|
@@ -868,7 +888,7 @@ var ContextMenuCheckboxItem = /* @__PURE__ */ forwardRef14(({ classNames, ...pro
|
|
|
868
888
|
ref: forwardedRef
|
|
869
889
|
});
|
|
870
890
|
});
|
|
871
|
-
var ContextMenuSeparator = /* @__PURE__ */
|
|
891
|
+
var ContextMenuSeparator = /* @__PURE__ */ forwardRef9(({ classNames, ...props }, forwardedRef) => {
|
|
872
892
|
const { tx } = useThemeContext();
|
|
873
893
|
return /* @__PURE__ */ React15.createElement(ContextMenuPrimitive.Separator, {
|
|
874
894
|
...props,
|
|
@@ -876,7 +896,7 @@ var ContextMenuSeparator = /* @__PURE__ */ forwardRef14(({ classNames, ...props
|
|
|
876
896
|
ref: forwardedRef
|
|
877
897
|
});
|
|
878
898
|
});
|
|
879
|
-
var ContextMenuGroupLabel = /* @__PURE__ */
|
|
899
|
+
var ContextMenuGroupLabel = /* @__PURE__ */ forwardRef9(({ classNames, ...props }, forwardedRef) => {
|
|
880
900
|
const { tx } = useThemeContext();
|
|
881
901
|
return /* @__PURE__ */ React15.createElement(ContextMenuPrimitive.Label, {
|
|
882
902
|
...props,
|
|
@@ -906,18 +926,17 @@ import { createContextScope } from "@radix-ui/react-context";
|
|
|
906
926
|
import { useId as useId2 } from "@radix-ui/react-id";
|
|
907
927
|
import * as MenuPrimitive from "@radix-ui/react-menu";
|
|
908
928
|
import { createMenuScope } from "@radix-ui/react-menu";
|
|
909
|
-
import { Primitive as
|
|
910
|
-
import { Slot as
|
|
929
|
+
import { Primitive as Primitive10 } from "@radix-ui/react-primitive";
|
|
930
|
+
import { Slot as Slot10 } from "@radix-ui/react-slot";
|
|
911
931
|
import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
|
912
|
-
import React16, { forwardRef as
|
|
932
|
+
import React16, { forwardRef as forwardRef10, useCallback as useCallback4, useEffect as useEffect2, useMemo as useMemo3, useRef as useRef2 } from "react";
|
|
913
933
|
var DROPDOWN_MENU_NAME = "DropdownMenu";
|
|
914
934
|
var [createDropdownMenuContext, createDropdownMenuScope] = createContextScope(DROPDOWN_MENU_NAME, [
|
|
915
935
|
createMenuScope
|
|
916
936
|
]);
|
|
917
937
|
var useMenuScope = createMenuScope();
|
|
918
938
|
var [DropdownMenuProvider, useDropdownMenuContext] = createDropdownMenuContext(DROPDOWN_MENU_NAME);
|
|
919
|
-
var DropdownMenuRoot = (
|
|
920
|
-
const { __scopeDropdownMenu, children, dir, open: openProp, defaultOpen, onOpenChange, modal = true } = props;
|
|
939
|
+
var DropdownMenuRoot = ({ __scopeDropdownMenu, children, dir, modal = true, open: openProp, defaultOpen, onOpenChange }) => {
|
|
921
940
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
922
941
|
const triggerRef = useRef2(null);
|
|
923
942
|
const [open = false, setOpen] = useControllableState({
|
|
@@ -938,22 +957,22 @@ var DropdownMenuRoot = (props) => {
|
|
|
938
957
|
modal
|
|
939
958
|
}, /* @__PURE__ */ React16.createElement(MenuPrimitive.Root, {
|
|
940
959
|
...menuScope,
|
|
941
|
-
open,
|
|
942
|
-
onOpenChange: setOpen,
|
|
943
960
|
dir,
|
|
944
|
-
modal
|
|
961
|
+
modal,
|
|
962
|
+
open,
|
|
963
|
+
onOpenChange: setOpen
|
|
945
964
|
}, children));
|
|
946
965
|
};
|
|
947
966
|
DropdownMenuRoot.displayName = DROPDOWN_MENU_NAME;
|
|
948
967
|
var TRIGGER_NAME = "DropdownMenuTrigger";
|
|
949
|
-
var DropdownMenuTrigger = /* @__PURE__ */
|
|
968
|
+
var DropdownMenuTrigger = /* @__PURE__ */ forwardRef10((props, forwardedRef) => {
|
|
950
969
|
const { __scopeDropdownMenu, disabled = false, ...triggerProps } = props;
|
|
951
970
|
const context = useDropdownMenuContext(TRIGGER_NAME, __scopeDropdownMenu);
|
|
952
971
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
953
972
|
return /* @__PURE__ */ React16.createElement(MenuPrimitive.Anchor, {
|
|
954
973
|
asChild: true,
|
|
955
974
|
...menuScope
|
|
956
|
-
}, /* @__PURE__ */ React16.createElement(
|
|
975
|
+
}, /* @__PURE__ */ React16.createElement(Primitive10.button, {
|
|
957
976
|
type: "button",
|
|
958
977
|
id: context.triggerId,
|
|
959
978
|
"aria-haspopup": "menu",
|
|
@@ -1023,9 +1042,9 @@ var DropdownMenuPortal = (props) => {
|
|
|
1023
1042
|
});
|
|
1024
1043
|
};
|
|
1025
1044
|
DropdownMenuPortal.displayName = PORTAL_NAME;
|
|
1026
|
-
var DropdownMenuViewport = /* @__PURE__ */
|
|
1045
|
+
var DropdownMenuViewport = /* @__PURE__ */ forwardRef10(({ classNames, asChild, children, ...props }, forwardedRef) => {
|
|
1027
1046
|
const { tx } = useThemeContext();
|
|
1028
|
-
const Comp = asChild ?
|
|
1047
|
+
const Comp = asChild ? Slot10 : Primitive10.div;
|
|
1029
1048
|
return /* @__PURE__ */ React16.createElement(Comp, {
|
|
1030
1049
|
...props,
|
|
1031
1050
|
className: tx("menu.viewport", {}, classNames),
|
|
@@ -1033,7 +1052,7 @@ var DropdownMenuViewport = /* @__PURE__ */ forwardRef15(({ classNames, asChild,
|
|
|
1033
1052
|
}, children);
|
|
1034
1053
|
});
|
|
1035
1054
|
var CONTENT_NAME = "DropdownMenuContent";
|
|
1036
|
-
var DropdownMenuContent = /* @__PURE__ */
|
|
1055
|
+
var DropdownMenuContent = /* @__PURE__ */ forwardRef10((props, forwardedRef) => {
|
|
1037
1056
|
const { __scopeDropdownMenu, classNames, collisionPadding = 8, collisionBoundary, ...contentProps } = props;
|
|
1038
1057
|
const { tx } = useThemeContext();
|
|
1039
1058
|
const context = useDropdownMenuContext(CONTENT_NAME, __scopeDropdownMenu);
|
|
@@ -1099,7 +1118,7 @@ var DropdownMenuContent = /* @__PURE__ */ forwardRef15((props, forwardedRef) =>
|
|
|
1099
1118
|
});
|
|
1100
1119
|
DropdownMenuContent.displayName = CONTENT_NAME;
|
|
1101
1120
|
var GROUP_NAME = "DropdownMenuGroup";
|
|
1102
|
-
var DropdownMenuGroup = /* @__PURE__ */
|
|
1121
|
+
var DropdownMenuGroup = /* @__PURE__ */ forwardRef10((props, forwardedRef) => {
|
|
1103
1122
|
const { __scopeDropdownMenu, ...groupProps } = props;
|
|
1104
1123
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1105
1124
|
return /* @__PURE__ */ React16.createElement(MenuPrimitive.Group, {
|
|
@@ -1110,7 +1129,7 @@ var DropdownMenuGroup = /* @__PURE__ */ forwardRef15((props, forwardedRef) => {
|
|
|
1110
1129
|
});
|
|
1111
1130
|
DropdownMenuGroup.displayName = GROUP_NAME;
|
|
1112
1131
|
var LABEL_NAME = "DropdownMenuLabel";
|
|
1113
|
-
var DropdownMenuGroupLabel = /* @__PURE__ */
|
|
1132
|
+
var DropdownMenuGroupLabel = /* @__PURE__ */ forwardRef10((props, forwardedRef) => {
|
|
1114
1133
|
const { __scopeDropdownMenu, classNames, ...labelProps } = props;
|
|
1115
1134
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1116
1135
|
const { tx } = useThemeContext();
|
|
@@ -1123,7 +1142,7 @@ var DropdownMenuGroupLabel = /* @__PURE__ */ forwardRef15((props, forwardedRef)
|
|
|
1123
1142
|
});
|
|
1124
1143
|
DropdownMenuGroupLabel.displayName = LABEL_NAME;
|
|
1125
1144
|
var ITEM_NAME = "DropdownMenuItem";
|
|
1126
|
-
var DropdownMenuItem = /* @__PURE__ */
|
|
1145
|
+
var DropdownMenuItem = /* @__PURE__ */ forwardRef10((props, forwardedRef) => {
|
|
1127
1146
|
const { __scopeDropdownMenu, classNames, ...itemProps } = props;
|
|
1128
1147
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1129
1148
|
const { tx } = useThemeContext();
|
|
@@ -1136,7 +1155,7 @@ var DropdownMenuItem = /* @__PURE__ */ forwardRef15((props, forwardedRef) => {
|
|
|
1136
1155
|
});
|
|
1137
1156
|
DropdownMenuItem.displayName = ITEM_NAME;
|
|
1138
1157
|
var CHECKBOX_ITEM_NAME = "DropdownMenuCheckboxItem";
|
|
1139
|
-
var DropdownMenuCheckboxItem = /* @__PURE__ */
|
|
1158
|
+
var DropdownMenuCheckboxItem = /* @__PURE__ */ forwardRef10((props, forwardedRef) => {
|
|
1140
1159
|
const { __scopeDropdownMenu, classNames, ...checkboxItemProps } = props;
|
|
1141
1160
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1142
1161
|
const { tx } = useThemeContext();
|
|
@@ -1149,7 +1168,7 @@ var DropdownMenuCheckboxItem = /* @__PURE__ */ forwardRef15((props, forwardedRef
|
|
|
1149
1168
|
});
|
|
1150
1169
|
DropdownMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;
|
|
1151
1170
|
var RADIO_GROUP_NAME = "DropdownMenuRadioGroup";
|
|
1152
|
-
var DropdownMenuRadioGroup = /* @__PURE__ */
|
|
1171
|
+
var DropdownMenuRadioGroup = /* @__PURE__ */ forwardRef10((props, forwardedRef) => {
|
|
1153
1172
|
const { __scopeDropdownMenu, ...radioGroupProps } = props;
|
|
1154
1173
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1155
1174
|
return /* @__PURE__ */ React16.createElement(MenuPrimitive.RadioGroup, {
|
|
@@ -1160,7 +1179,7 @@ var DropdownMenuRadioGroup = /* @__PURE__ */ forwardRef15((props, forwardedRef)
|
|
|
1160
1179
|
});
|
|
1161
1180
|
DropdownMenuRadioGroup.displayName = RADIO_GROUP_NAME;
|
|
1162
1181
|
var RADIO_ITEM_NAME = "DropdownMenuRadioItem";
|
|
1163
|
-
var DropdownMenuRadioItem = /* @__PURE__ */
|
|
1182
|
+
var DropdownMenuRadioItem = /* @__PURE__ */ forwardRef10((props, forwardedRef) => {
|
|
1164
1183
|
const { __scopeDropdownMenu, classNames, ...itemProps } = props;
|
|
1165
1184
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1166
1185
|
const { tx } = useThemeContext();
|
|
@@ -1173,7 +1192,7 @@ var DropdownMenuRadioItem = /* @__PURE__ */ forwardRef15((props, forwardedRef) =
|
|
|
1173
1192
|
});
|
|
1174
1193
|
DropdownMenuRadioItem.displayName = RADIO_ITEM_NAME;
|
|
1175
1194
|
var INDICATOR_NAME = "DropdownMenuItemIndicator";
|
|
1176
|
-
var DropdownMenuItemIndicator = /* @__PURE__ */
|
|
1195
|
+
var DropdownMenuItemIndicator = /* @__PURE__ */ forwardRef10((props, forwardedRef) => {
|
|
1177
1196
|
const { __scopeDropdownMenu, ...itemIndicatorProps } = props;
|
|
1178
1197
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1179
1198
|
return /* @__PURE__ */ React16.createElement(MenuPrimitive.ItemIndicator, {
|
|
@@ -1184,7 +1203,7 @@ var DropdownMenuItemIndicator = /* @__PURE__ */ forwardRef15((props, forwardedRe
|
|
|
1184
1203
|
});
|
|
1185
1204
|
DropdownMenuItemIndicator.displayName = INDICATOR_NAME;
|
|
1186
1205
|
var SEPARATOR_NAME = "DropdownMenuSeparator";
|
|
1187
|
-
var DropdownMenuSeparator = /* @__PURE__ */
|
|
1206
|
+
var DropdownMenuSeparator = /* @__PURE__ */ forwardRef10((props, forwardedRef) => {
|
|
1188
1207
|
const { __scopeDropdownMenu, classNames, ...separatorProps } = props;
|
|
1189
1208
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1190
1209
|
const { tx } = useThemeContext();
|
|
@@ -1197,7 +1216,7 @@ var DropdownMenuSeparator = /* @__PURE__ */ forwardRef15((props, forwardedRef) =
|
|
|
1197
1216
|
});
|
|
1198
1217
|
DropdownMenuSeparator.displayName = SEPARATOR_NAME;
|
|
1199
1218
|
var ARROW_NAME = "DropdownMenuArrow";
|
|
1200
|
-
var DropdownMenuArrow = /* @__PURE__ */
|
|
1219
|
+
var DropdownMenuArrow = /* @__PURE__ */ forwardRef10((props, forwardedRef) => {
|
|
1201
1220
|
const { __scopeDropdownMenu, classNames, ...arrowProps } = props;
|
|
1202
1221
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1203
1222
|
const { tx } = useThemeContext();
|
|
@@ -1224,7 +1243,7 @@ var DropdownMenuSub = (props) => {
|
|
|
1224
1243
|
}, children);
|
|
1225
1244
|
};
|
|
1226
1245
|
var SUB_TRIGGER_NAME = "DropdownMenuSubTrigger";
|
|
1227
|
-
var DropdownMenuSubTrigger = /* @__PURE__ */
|
|
1246
|
+
var DropdownMenuSubTrigger = /* @__PURE__ */ forwardRef10((props, forwardedRef) => {
|
|
1228
1247
|
const { __scopeDropdownMenu, ...subTriggerProps } = props;
|
|
1229
1248
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1230
1249
|
return /* @__PURE__ */ React16.createElement(MenuPrimitive.SubTrigger, {
|
|
@@ -1235,7 +1254,7 @@ var DropdownMenuSubTrigger = /* @__PURE__ */ forwardRef15((props, forwardedRef)
|
|
|
1235
1254
|
});
|
|
1236
1255
|
DropdownMenuSubTrigger.displayName = SUB_TRIGGER_NAME;
|
|
1237
1256
|
var SUB_CONTENT_NAME = "DropdownMenuSubContent";
|
|
1238
|
-
var DropdownMenuSubContent = /* @__PURE__ */
|
|
1257
|
+
var DropdownMenuSubContent = /* @__PURE__ */ forwardRef10((props, forwardedRef) => {
|
|
1239
1258
|
const { __scopeDropdownMenu, ...subContentProps } = props;
|
|
1240
1259
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1241
1260
|
return /* @__PURE__ */ React16.createElement(MenuPrimitive.SubContent, {
|
|
@@ -1279,13 +1298,13 @@ var DropdownMenu = {
|
|
|
1279
1298
|
var useDropdownMenuMenuScope = useMenuScope;
|
|
1280
1299
|
|
|
1281
1300
|
// src/components/Separator/Separator.tsx
|
|
1282
|
-
import
|
|
1283
|
-
import React17, { forwardRef as
|
|
1284
|
-
var Separator3 = /* @__PURE__ */
|
|
1301
|
+
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
1302
|
+
import React17, { forwardRef as forwardRef11 } from "react";
|
|
1303
|
+
var Separator3 = /* @__PURE__ */ forwardRef11(({ classNames, orientation = "horizontal", subdued, ...props }, forwardedRef) => {
|
|
1285
1304
|
const { tx } = useThemeContext();
|
|
1286
|
-
return /* @__PURE__ */ React17.createElement(SeparatorPrimitive, {
|
|
1287
|
-
orientation,
|
|
1305
|
+
return /* @__PURE__ */ React17.createElement(SeparatorPrimitive.Root, {
|
|
1288
1306
|
...props,
|
|
1307
|
+
orientation,
|
|
1289
1308
|
className: tx("separator.root", {
|
|
1290
1309
|
orientation,
|
|
1291
1310
|
subdued
|
|
@@ -1295,18 +1314,14 @@ var Separator3 = /* @__PURE__ */ forwardRef16(({ classNames, orientation = "hori
|
|
|
1295
1314
|
});
|
|
1296
1315
|
|
|
1297
1316
|
// src/components/Toolbar/Toolbar.tsx
|
|
1298
|
-
var ToolbarRoot =
|
|
1299
|
-
const { className,
|
|
1317
|
+
var ToolbarRoot = composable2(({ children, density, disabled, layoutManaged, orientation, ...props }, forwardedRef) => {
|
|
1318
|
+
const { className, role, ...rest } = composableProps6(props);
|
|
1300
1319
|
const { tx } = useThemeContext();
|
|
1301
|
-
const InnerRoot = textBlockWidthProp ? "div" : Fragment;
|
|
1302
|
-
const innerRootProps = textBlockWidthProp ? {
|
|
1303
|
-
role: "none",
|
|
1304
|
-
className: tx("toolbar.inner", {
|
|
1305
|
-
layoutManaged
|
|
1306
|
-
}, className)
|
|
1307
|
-
} : {};
|
|
1308
1320
|
return /* @__PURE__ */ React18.createElement(ToolbarPrimitive.Root, {
|
|
1309
1321
|
...rest,
|
|
1322
|
+
...role !== "none" && {
|
|
1323
|
+
role
|
|
1324
|
+
},
|
|
1310
1325
|
orientation,
|
|
1311
1326
|
"data-arrow-keys": orientation === "vertical" ? "up down" : "left right",
|
|
1312
1327
|
className: tx("toolbar.root", {
|
|
@@ -1315,11 +1330,11 @@ var ToolbarRoot = /* @__PURE__ */ forwardRef17(({ children, density, disabled, l
|
|
|
1315
1330
|
layoutManaged
|
|
1316
1331
|
}, className),
|
|
1317
1332
|
ref: forwardedRef
|
|
1318
|
-
},
|
|
1333
|
+
}, children);
|
|
1319
1334
|
});
|
|
1320
|
-
var ToolbarText =
|
|
1335
|
+
var ToolbarText = slottable5(({ children, asChild, ...props }, forwardedRef) => {
|
|
1321
1336
|
const { className, ...rest } = composableProps6(props);
|
|
1322
|
-
const Comp = asChild ?
|
|
1337
|
+
const Comp = asChild ? Slot11 : Primitive11.div;
|
|
1323
1338
|
const { tx } = useThemeContext();
|
|
1324
1339
|
return /* @__PURE__ */ React18.createElement(Comp, {
|
|
1325
1340
|
...rest,
|
|
@@ -1327,7 +1342,7 @@ var ToolbarText = /* @__PURE__ */ forwardRef17(({ children, asChild, ...props },
|
|
|
1327
1342
|
ref: forwardedRef
|
|
1328
1343
|
}, children);
|
|
1329
1344
|
});
|
|
1330
|
-
var ToolbarButton = /* @__PURE__ */
|
|
1345
|
+
var ToolbarButton = /* @__PURE__ */ forwardRef12((props, forwardedRef) => {
|
|
1331
1346
|
return /* @__PURE__ */ React18.createElement(ToolbarPrimitive.Button, {
|
|
1332
1347
|
asChild: true
|
|
1333
1348
|
}, /* @__PURE__ */ React18.createElement(Button, {
|
|
@@ -1335,7 +1350,7 @@ var ToolbarButton = /* @__PURE__ */ forwardRef17((props, forwardedRef) => {
|
|
|
1335
1350
|
ref: forwardedRef
|
|
1336
1351
|
}));
|
|
1337
1352
|
});
|
|
1338
|
-
var ToolbarIconButton = /* @__PURE__ */
|
|
1353
|
+
var ToolbarIconButton = /* @__PURE__ */ forwardRef12((props, forwardedRef) => {
|
|
1339
1354
|
return /* @__PURE__ */ React18.createElement(ToolbarPrimitive.Button, {
|
|
1340
1355
|
asChild: true
|
|
1341
1356
|
}, /* @__PURE__ */ React18.createElement(IconButton, {
|
|
@@ -1344,7 +1359,7 @@ var ToolbarIconButton = /* @__PURE__ */ forwardRef17((props, forwardedRef) => {
|
|
|
1344
1359
|
ref: forwardedRef
|
|
1345
1360
|
}));
|
|
1346
1361
|
});
|
|
1347
|
-
var ToolbarToggle = /* @__PURE__ */
|
|
1362
|
+
var ToolbarToggle = /* @__PURE__ */ forwardRef12((props, forwardedRef) => {
|
|
1348
1363
|
return /* @__PURE__ */ React18.createElement(ToolbarPrimitive.Button, {
|
|
1349
1364
|
asChild: true
|
|
1350
1365
|
}, /* @__PURE__ */ React18.createElement(Toggle, {
|
|
@@ -1352,7 +1367,7 @@ var ToolbarToggle = /* @__PURE__ */ forwardRef17((props, forwardedRef) => {
|
|
|
1352
1367
|
ref: forwardedRef
|
|
1353
1368
|
}));
|
|
1354
1369
|
});
|
|
1355
|
-
var ToolbarLink = /* @__PURE__ */
|
|
1370
|
+
var ToolbarLink = /* @__PURE__ */ forwardRef12((props, forwardedRef) => {
|
|
1356
1371
|
return /* @__PURE__ */ React18.createElement(ToolbarPrimitive.Link, {
|
|
1357
1372
|
asChild: true
|
|
1358
1373
|
}, /* @__PURE__ */ React18.createElement(Link, {
|
|
@@ -1360,7 +1375,7 @@ var ToolbarLink = /* @__PURE__ */ forwardRef17((props, forwardedRef) => {
|
|
|
1360
1375
|
ref: forwardedRef
|
|
1361
1376
|
}));
|
|
1362
1377
|
});
|
|
1363
|
-
var ToolbarToggleGroup2 = /* @__PURE__ */
|
|
1378
|
+
var ToolbarToggleGroup2 = /* @__PURE__ */ forwardRef12(({ classNames, children, elevation, ...props }, forwardedRef) => {
|
|
1364
1379
|
return /* @__PURE__ */ React18.createElement(ToolbarPrimitive.ToolbarToggleGroup, {
|
|
1365
1380
|
...props,
|
|
1366
1381
|
asChild: true
|
|
@@ -1371,7 +1386,7 @@ var ToolbarToggleGroup2 = /* @__PURE__ */ forwardRef17(({ classNames, children,
|
|
|
1371
1386
|
ref: forwardedRef
|
|
1372
1387
|
}));
|
|
1373
1388
|
});
|
|
1374
|
-
var ToolbarToggleGroupItem = /* @__PURE__ */
|
|
1389
|
+
var ToolbarToggleGroupItem = /* @__PURE__ */ forwardRef12(({ variant, density, elevation, classNames, children, ...props }, forwardedRef) => {
|
|
1375
1390
|
return /* @__PURE__ */ React18.createElement(ToolbarPrimitive.ToolbarToggleItem, {
|
|
1376
1391
|
...props,
|
|
1377
1392
|
asChild: true
|
|
@@ -1384,7 +1399,7 @@ var ToolbarToggleGroupItem = /* @__PURE__ */ forwardRef17(({ variant, density, e
|
|
|
1384
1399
|
ref: forwardedRef
|
|
1385
1400
|
}));
|
|
1386
1401
|
});
|
|
1387
|
-
var ToolbarToggleGroupIconItem = /* @__PURE__ */
|
|
1402
|
+
var ToolbarToggleGroupIconItem = /* @__PURE__ */ forwardRef12(({ variant, density, elevation, classNames, icon, label, iconOnly, ...props }, forwardedRef) => {
|
|
1388
1403
|
return /* @__PURE__ */ React18.createElement(ToolbarPrimitive.ToolbarToggleItem, {
|
|
1389
1404
|
...props,
|
|
1390
1405
|
asChild: true
|
|
@@ -1399,10 +1414,11 @@ var ToolbarToggleGroupIconItem = /* @__PURE__ */ forwardRef17(({ variant, densit
|
|
|
1399
1414
|
ref: forwardedRef
|
|
1400
1415
|
}));
|
|
1401
1416
|
});
|
|
1402
|
-
var ToolbarSeparator = /* @__PURE__ */
|
|
1417
|
+
var ToolbarSeparator = /* @__PURE__ */ forwardRef12(({ variant = "gap", ...props }, forwardedRef) => {
|
|
1403
1418
|
return variant === "line" ? /* @__PURE__ */ React18.createElement(ToolbarPrimitive.Separator, {
|
|
1404
1419
|
asChild: true
|
|
1405
1420
|
}, /* @__PURE__ */ React18.createElement(Separator3, {
|
|
1421
|
+
orientation: "vertical",
|
|
1406
1422
|
...props,
|
|
1407
1423
|
ref: forwardedRef
|
|
1408
1424
|
})) : /* @__PURE__ */ React18.createElement(ToolbarPrimitive.Separator, {
|
|
@@ -1410,30 +1426,29 @@ var ToolbarSeparator = /* @__PURE__ */ forwardRef17(({ variant = "gap", ...props
|
|
|
1410
1426
|
ref: forwardedRef
|
|
1411
1427
|
});
|
|
1412
1428
|
});
|
|
1413
|
-
var ToolbarDragHandle = /* @__PURE__ */
|
|
1429
|
+
var ToolbarDragHandle = /* @__PURE__ */ forwardRef12(({ testId = "drag-handle", label }, forwardedRef) => {
|
|
1414
1430
|
const { t } = useTranslation2(translationKey);
|
|
1415
1431
|
return /* @__PURE__ */ React18.createElement(ToolbarIconButton, {
|
|
1416
1432
|
"data-testid": testId,
|
|
1433
|
+
tabIndex: -1,
|
|
1417
1434
|
noTooltip: true,
|
|
1418
1435
|
iconOnly: true,
|
|
1419
1436
|
icon: "ph--dots-six-vertical--regular",
|
|
1420
1437
|
variant: "ghost",
|
|
1421
|
-
label: label ?? t("toolbar
|
|
1422
|
-
classNames: "cursor-pointer",
|
|
1423
|
-
size: 5,
|
|
1438
|
+
label: label ?? t("toolbar-drag-handle.label"),
|
|
1439
|
+
classNames: "dx-focus-ring-none cursor-pointer",
|
|
1424
1440
|
disabled: !forwardedRef,
|
|
1425
1441
|
ref: forwardedRef
|
|
1426
1442
|
});
|
|
1427
1443
|
});
|
|
1428
|
-
var ToolbarCloseIconButton = /* @__PURE__ */
|
|
1444
|
+
var ToolbarCloseIconButton = /* @__PURE__ */ forwardRef12(({ onClick, label }, forwardedRef) => {
|
|
1429
1445
|
const { t } = useTranslation2(translationKey);
|
|
1430
1446
|
return /* @__PURE__ */ React18.createElement(ToolbarIconButton, {
|
|
1431
1447
|
iconOnly: true,
|
|
1432
1448
|
icon: "ph--x--regular",
|
|
1433
1449
|
variant: "ghost",
|
|
1434
|
-
label: label ?? t("toolbar
|
|
1450
|
+
label: label ?? t("toolbar-close.label"),
|
|
1435
1451
|
classNames: "cursor-pointer",
|
|
1436
|
-
size: 5,
|
|
1437
1452
|
onClick,
|
|
1438
1453
|
ref: forwardedRef
|
|
1439
1454
|
});
|
|
@@ -1447,13 +1462,13 @@ var ToolbarMenu = ({ context, items }) => {
|
|
|
1447
1462
|
iconOnly: true,
|
|
1448
1463
|
variant: "ghost",
|
|
1449
1464
|
icon: "ph--dots-three-vertical--regular",
|
|
1450
|
-
label: t("toolbar
|
|
1465
|
+
label: t("toolbar-menu.label")
|
|
1451
1466
|
})), (items?.length ?? 0) > 0 && /* @__PURE__ */ React18.createElement(DropdownMenu.Portal, null, /* @__PURE__ */ React18.createElement(DropdownMenu.Content, null, /* @__PURE__ */ React18.createElement(DropdownMenu.Viewport, null, items?.map(({ label, onClick: onSelect }, index) => /* @__PURE__ */ React18.createElement(DropdownMenu.Item, {
|
|
1452
1467
|
key: index,
|
|
1453
1468
|
onSelect: () => onSelect(context)
|
|
1454
1469
|
}, label))), /* @__PURE__ */ React18.createElement(DropdownMenu.Arrow, null))));
|
|
1455
1470
|
};
|
|
1456
|
-
var
|
|
1471
|
+
var Toolbar = {
|
|
1457
1472
|
Root: ToolbarRoot,
|
|
1458
1473
|
Text: ToolbarText,
|
|
1459
1474
|
Button: ToolbarButton,
|
|
@@ -1471,9 +1486,10 @@ var Toolbar2 = {
|
|
|
1471
1486
|
|
|
1472
1487
|
// src/components/Card/Card.tsx
|
|
1473
1488
|
var CardContext = /* @__PURE__ */ createContext3({});
|
|
1474
|
-
var
|
|
1489
|
+
var CARD_ROOT_NAME = "Card.Root";
|
|
1490
|
+
var CardRoot = slottable6(({ children, id, asChild, role, border = true, fullWidth, density, ...props }, forwardedRef) => {
|
|
1475
1491
|
const { className, ...rest } = composableProps7(props);
|
|
1476
|
-
const Comp = asChild ?
|
|
1492
|
+
const Comp = asChild ? Slot12 : Primitive12.div;
|
|
1477
1493
|
const { tx } = useThemeContext();
|
|
1478
1494
|
return /* @__PURE__ */ React19.createElement(Comp, {
|
|
1479
1495
|
...rest,
|
|
@@ -1487,68 +1503,124 @@ var CardRoot = /* @__PURE__ */ forwardRef18(({ children, id, asChild, role, bord
|
|
|
1487
1503
|
}, className),
|
|
1488
1504
|
ref: forwardedRef
|
|
1489
1505
|
}, /* @__PURE__ */ React19.createElement(Column.Root, {
|
|
1490
|
-
gutter: "
|
|
1506
|
+
gutter: density === "coarse" ? "lg" : "md"
|
|
1491
1507
|
}, children));
|
|
1492
1508
|
});
|
|
1493
|
-
|
|
1509
|
+
CardRoot.displayName = CARD_ROOT_NAME;
|
|
1510
|
+
var CARD_TOOLBAR_NAME = "Card.Toolbar";
|
|
1511
|
+
var CardToolbar = composable3(({ children, classNames, ...props }, forwardedRef) => {
|
|
1494
1512
|
const { tx } = useThemeContext();
|
|
1495
|
-
return /* @__PURE__ */ React19.createElement(
|
|
1513
|
+
return /* @__PURE__ */ React19.createElement(Toolbar.Root, {
|
|
1496
1514
|
...props,
|
|
1515
|
+
style: iconSize(5),
|
|
1497
1516
|
classNames: [
|
|
1498
|
-
tx("card.toolbar", {
|
|
1499
|
-
coarse: density !== "fine"
|
|
1500
|
-
}),
|
|
1517
|
+
tx("card.toolbar", {}),
|
|
1501
1518
|
classNames
|
|
1502
1519
|
],
|
|
1503
1520
|
ref: forwardedRef
|
|
1504
1521
|
}, children);
|
|
1505
1522
|
});
|
|
1506
|
-
|
|
1523
|
+
CardToolbar.displayName = CARD_TOOLBAR_NAME;
|
|
1524
|
+
var CARD_DRAG_HANDLE_NAME = "Card.DragHandle";
|
|
1525
|
+
var CardDragHandle = /* @__PURE__ */ forwardRef13((props, forwardedRef) => {
|
|
1526
|
+
return /* @__PURE__ */ React19.createElement(CardIconBlock, {
|
|
1527
|
+
padding: true
|
|
1528
|
+
}, /* @__PURE__ */ React19.createElement(Toolbar.DragHandle, {
|
|
1529
|
+
...props,
|
|
1530
|
+
ref: forwardedRef
|
|
1531
|
+
}));
|
|
1532
|
+
});
|
|
1533
|
+
CardDragHandle.displayName = CARD_DRAG_HANDLE_NAME;
|
|
1534
|
+
var CARD_CLOSE_ICON_BUTTON_NAME = "Card.CloseIconButton";
|
|
1535
|
+
var CloseIconButton = /* @__PURE__ */ forwardRef13((props, forwardedRef) => {
|
|
1536
|
+
return /* @__PURE__ */ React19.createElement(CardIconBlock, {
|
|
1537
|
+
padding: true
|
|
1538
|
+
}, /* @__PURE__ */ React19.createElement(Toolbar.CloseIconButton, {
|
|
1539
|
+
...props,
|
|
1540
|
+
ref: forwardedRef
|
|
1541
|
+
}));
|
|
1542
|
+
});
|
|
1543
|
+
CloseIconButton.displayName = CARD_CLOSE_ICON_BUTTON_NAME;
|
|
1544
|
+
var CARD_MENU_NAME = "Card.Menu";
|
|
1545
|
+
var CardMenu = ({ context, items, ...props }) => {
|
|
1507
1546
|
const { menuItems } = useContext3(CardContext) ?? {};
|
|
1508
1547
|
const combinedItems = [
|
|
1509
1548
|
...items ?? [],
|
|
1510
1549
|
...menuItems ?? []
|
|
1511
1550
|
];
|
|
1512
|
-
return /* @__PURE__ */ React19.createElement(
|
|
1551
|
+
return /* @__PURE__ */ React19.createElement(CardIconBlock, {
|
|
1552
|
+
padding: true
|
|
1553
|
+
}, /* @__PURE__ */ React19.createElement(Toolbar.Menu, {
|
|
1554
|
+
...props,
|
|
1513
1555
|
context,
|
|
1514
1556
|
items: combinedItems
|
|
1515
|
-
});
|
|
1557
|
+
}));
|
|
1516
1558
|
};
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1559
|
+
CardMenu.displayName = CARD_MENU_NAME;
|
|
1560
|
+
var CARD_ICON_NAME = "Card.Icon";
|
|
1561
|
+
var CardIcon = (props) => {
|
|
1562
|
+
return /* @__PURE__ */ React19.createElement(CardIconBlock, null, /* @__PURE__ */ React19.createElement(Icon, props));
|
|
1563
|
+
};
|
|
1564
|
+
CardIcon.displayName = CARD_ICON_NAME;
|
|
1565
|
+
var CARD_ICON_BLOCK_NAME = "Card.IconBlock";
|
|
1566
|
+
var CardIconBlock = /* @__PURE__ */ forwardRef13(({ classNames, children, padding, ...props }, forwardedRef) => {
|
|
1520
1567
|
const { tx } = useThemeContext();
|
|
1568
|
+
return /* @__PURE__ */ React19.createElement("div", {
|
|
1569
|
+
...props,
|
|
1570
|
+
role: "none",
|
|
1571
|
+
className: tx("card.icon-block", {
|
|
1572
|
+
padding
|
|
1573
|
+
}, classNames),
|
|
1574
|
+
ref: forwardedRef
|
|
1575
|
+
}, children);
|
|
1576
|
+
});
|
|
1577
|
+
CardIconBlock.displayName = CARD_ICON_BLOCK_NAME;
|
|
1578
|
+
var CARD_TITLE_NAME = "Card.Title";
|
|
1579
|
+
var CardTitle = slottable6(({ children, asChild, ...props }, forwardedRef) => {
|
|
1580
|
+
const { tx } = useThemeContext();
|
|
1581
|
+
const { className, ...rest } = composableProps7(props, {
|
|
1582
|
+
role: "heading"
|
|
1583
|
+
});
|
|
1584
|
+
const Comp = asChild ? Slot12 : Primitive12.div;
|
|
1521
1585
|
return /* @__PURE__ */ React19.createElement(Comp, {
|
|
1522
1586
|
...rest,
|
|
1523
|
-
role: role ?? "heading",
|
|
1524
1587
|
className: tx("card.title", {}, className),
|
|
1525
1588
|
ref: forwardedRef
|
|
1526
1589
|
}, children);
|
|
1527
1590
|
});
|
|
1528
|
-
|
|
1591
|
+
CardTitle.displayName = CARD_TITLE_NAME;
|
|
1592
|
+
var CARD_CONTENT_NAME = "Card.Content";
|
|
1593
|
+
var CardContent = slottable6(({ children, asChild, ...props }, forwardedRef) => {
|
|
1594
|
+
const { className, ...rest } = composableProps7(props);
|
|
1595
|
+
const Comp = asChild ? Slot12 : Primitive12.div;
|
|
1529
1596
|
const { tx } = useThemeContext();
|
|
1530
|
-
return /* @__PURE__ */ React19.createElement(
|
|
1531
|
-
...
|
|
1532
|
-
|
|
1533
|
-
className: tx("card.content", {}),
|
|
1597
|
+
return /* @__PURE__ */ React19.createElement(Comp, {
|
|
1598
|
+
...rest,
|
|
1599
|
+
className: tx("card.content", {}, className),
|
|
1534
1600
|
ref: forwardedRef
|
|
1535
1601
|
}, children);
|
|
1536
1602
|
});
|
|
1537
|
-
|
|
1603
|
+
CardContent.displayName = CARD_CONTENT_NAME;
|
|
1604
|
+
var CARD_ROW_NAME = "Card.Row";
|
|
1605
|
+
var CardRow = slottable6(({ children, asChild, icon, ...props }, forwardedRef) => {
|
|
1538
1606
|
const { className, ...rest } = composableProps7(props);
|
|
1539
|
-
|
|
1607
|
+
const Comp = asChild ? Slot12 : Primitive12.div;
|
|
1608
|
+
const { tx } = useThemeContext();
|
|
1609
|
+
return /* @__PURE__ */ React19.createElement(Comp, {
|
|
1540
1610
|
...rest,
|
|
1541
|
-
|
|
1542
|
-
classNames: className,
|
|
1611
|
+
className: tx("card.row", {}, className),
|
|
1543
1612
|
ref: forwardedRef
|
|
1544
1613
|
}, icon && /* @__PURE__ */ React19.createElement(CardIcon, {
|
|
1545
1614
|
classNames: "text-subdued",
|
|
1546
|
-
icon
|
|
1547
|
-
|
|
1615
|
+
icon,
|
|
1616
|
+
size: 4
|
|
1617
|
+
}) || /* @__PURE__ */ React19.createElement("div", null), children);
|
|
1548
1618
|
});
|
|
1549
|
-
|
|
1619
|
+
CardRow.displayName = CARD_ROW_NAME;
|
|
1620
|
+
var CARD_SECTION_NAME = "Card.Section";
|
|
1621
|
+
var CardSection = slottable6(({ children, asChild, role, ...props }, forwardedRef) => {
|
|
1550
1622
|
const { className, ...rest } = composableProps7(props);
|
|
1551
|
-
const Comp = asChild ?
|
|
1623
|
+
const Comp = asChild ? Slot12 : Primitive12.div;
|
|
1552
1624
|
return /* @__PURE__ */ React19.createElement(Comp, {
|
|
1553
1625
|
...rest,
|
|
1554
1626
|
role: role ?? "none",
|
|
@@ -1556,9 +1628,11 @@ var CardSection = /* @__PURE__ */ forwardRef18(({ children, asChild, role, ...pr
|
|
|
1556
1628
|
ref: forwardedRef
|
|
1557
1629
|
}, children);
|
|
1558
1630
|
});
|
|
1559
|
-
|
|
1631
|
+
CardSection.displayName = CARD_SECTION_NAME;
|
|
1632
|
+
var CARD_HEADING_NAME = "Card.Heading";
|
|
1633
|
+
var CardHeading = slottable6(({ children, asChild, role, variant = "default", ...props }, forwardedRef) => {
|
|
1560
1634
|
const { className, ...rest } = composableProps7(props);
|
|
1561
|
-
const Comp = asChild ?
|
|
1635
|
+
const Comp = asChild ? Slot12 : Primitive12.div;
|
|
1562
1636
|
const { tx } = useThemeContext();
|
|
1563
1637
|
return /* @__PURE__ */ React19.createElement(Comp, {
|
|
1564
1638
|
...rest,
|
|
@@ -1569,9 +1643,11 @@ var CardHeading = /* @__PURE__ */ forwardRef18(({ children, asChild, role, varia
|
|
|
1569
1643
|
ref: forwardedRef
|
|
1570
1644
|
}, children);
|
|
1571
1645
|
});
|
|
1572
|
-
|
|
1646
|
+
CardHeading.displayName = CARD_HEADING_NAME;
|
|
1647
|
+
var CARD_TEXT_NAME = "Card.Text";
|
|
1648
|
+
var CardText = slottable6(({ children, asChild, role, truncate, variant = "default", ...props }, forwardedRef) => {
|
|
1573
1649
|
const { className, ...rest } = composableProps7(props);
|
|
1574
|
-
const Comp = asChild ?
|
|
1650
|
+
const Comp = asChild ? Slot12 : Primitive12.div;
|
|
1575
1651
|
const { tx } = useThemeContext();
|
|
1576
1652
|
return /* @__PURE__ */ React19.createElement(Comp, {
|
|
1577
1653
|
...rest,
|
|
@@ -1587,13 +1663,34 @@ var CardText = /* @__PURE__ */ forwardRef18(({ children, asChild, role, truncate
|
|
|
1587
1663
|
})
|
|
1588
1664
|
}, children));
|
|
1589
1665
|
});
|
|
1666
|
+
CardText.displayName = CARD_TEXT_NAME;
|
|
1667
|
+
var CARD_HTML_NAME = "Card.Html";
|
|
1668
|
+
var CardHtml = ({ html, variant = "default", ...props }) => {
|
|
1669
|
+
const { tx } = useThemeContext();
|
|
1670
|
+
const sanitized = useMemo4(() => DOMPurify.sanitize(html), [
|
|
1671
|
+
html
|
|
1672
|
+
]);
|
|
1673
|
+
return /* @__PURE__ */ React19.createElement("div", {
|
|
1674
|
+
...props,
|
|
1675
|
+
role: "none",
|
|
1676
|
+
className: tx("card.text", {
|
|
1677
|
+
variant
|
|
1678
|
+
}),
|
|
1679
|
+
// eslint-disable-next-line react/no-danger
|
|
1680
|
+
dangerouslySetInnerHTML: {
|
|
1681
|
+
__html: sanitized
|
|
1682
|
+
}
|
|
1683
|
+
});
|
|
1684
|
+
};
|
|
1685
|
+
CardHtml.displayName = CARD_HTML_NAME;
|
|
1686
|
+
var CARD_POSTER_NAME = "Card.Poster";
|
|
1590
1687
|
var CardPoster = (props) => {
|
|
1591
1688
|
const { tx } = useThemeContext();
|
|
1592
1689
|
const aspect = props.aspect === "auto" ? "aspect-auto" : "aspect-video";
|
|
1593
1690
|
if (props.image) {
|
|
1594
1691
|
return /* @__PURE__ */ React19.createElement("div", {
|
|
1595
1692
|
role: "none",
|
|
1596
|
-
className: "col-span-full
|
|
1693
|
+
className: "col-span-full"
|
|
1597
1694
|
}, /* @__PURE__ */ React19.createElement(Image, {
|
|
1598
1695
|
classNames: [
|
|
1599
1696
|
tx("card.poster", {}),
|
|
@@ -1601,7 +1698,8 @@ var CardPoster = (props) => {
|
|
|
1601
1698
|
props.classNames
|
|
1602
1699
|
],
|
|
1603
1700
|
src: props.image,
|
|
1604
|
-
alt: props.alt
|
|
1701
|
+
alt: props.alt,
|
|
1702
|
+
fit: props.fit
|
|
1605
1703
|
}));
|
|
1606
1704
|
}
|
|
1607
1705
|
if (props.icon) {
|
|
@@ -1618,6 +1716,8 @@ var CardPoster = (props) => {
|
|
|
1618
1716
|
}));
|
|
1619
1717
|
}
|
|
1620
1718
|
};
|
|
1719
|
+
CardPoster.displayName = CARD_POSTER_NAME;
|
|
1720
|
+
var CARD_ACTION_NAME = "Card.Action";
|
|
1621
1721
|
var CardAction = ({ icon, actionIcon = "ph--arrow-right--regular", label, onClick }) => {
|
|
1622
1722
|
const { tx } = useThemeContext();
|
|
1623
1723
|
return /* @__PURE__ */ React19.createElement(Button, {
|
|
@@ -1626,13 +1726,17 @@ var CardAction = ({ icon, actionIcon = "ph--arrow-right--regular", label, onClic
|
|
|
1626
1726
|
onClick
|
|
1627
1727
|
}, icon ? /* @__PURE__ */ React19.createElement(CardIcon, {
|
|
1628
1728
|
classNames: "text-subdued",
|
|
1629
|
-
icon
|
|
1729
|
+
icon,
|
|
1730
|
+
size: 4
|
|
1630
1731
|
}) : /* @__PURE__ */ React19.createElement("div", null), /* @__PURE__ */ React19.createElement("span", {
|
|
1631
1732
|
className: tx("card.action-label", {}, !actionIcon ? "col-span-2" : void 0)
|
|
1632
1733
|
}, label), actionIcon && /* @__PURE__ */ React19.createElement(CardIcon, {
|
|
1633
|
-
icon: actionIcon
|
|
1734
|
+
icon: actionIcon,
|
|
1735
|
+
size: 4
|
|
1634
1736
|
}));
|
|
1635
1737
|
};
|
|
1738
|
+
CardAction.displayName = CARD_ACTION_NAME;
|
|
1739
|
+
var CARD_LINK_NAME = "Card.Link";
|
|
1636
1740
|
var CardLink = ({ label, href }) => {
|
|
1637
1741
|
const { tx } = useThemeContext();
|
|
1638
1742
|
return /* @__PURE__ */ React19.createElement("a", {
|
|
@@ -1651,42 +1755,27 @@ var CardLink = ({ label, href }) => {
|
|
|
1651
1755
|
icon: "ph--arrow-square-out--regular"
|
|
1652
1756
|
}));
|
|
1653
1757
|
};
|
|
1654
|
-
|
|
1655
|
-
return /* @__PURE__ */ React19.createElement(CardIconBlock, null, /* @__PURE__ */ React19.createElement(Icon, {
|
|
1656
|
-
...props,
|
|
1657
|
-
size: toolbar ? 5 : 4
|
|
1658
|
-
}));
|
|
1659
|
-
};
|
|
1660
|
-
var CardIconBlock = ({ classNames, children, role, ...props }) => {
|
|
1661
|
-
const { tx } = useThemeContext();
|
|
1662
|
-
return /* @__PURE__ */ React19.createElement("div", {
|
|
1663
|
-
...props,
|
|
1664
|
-
role: role ?? "none",
|
|
1665
|
-
className: tx("card.icon-block", {}, classNames)
|
|
1666
|
-
}, children);
|
|
1667
|
-
};
|
|
1758
|
+
CardLink.displayName = CARD_LINK_NAME;
|
|
1668
1759
|
var Card = {
|
|
1669
1760
|
Root: CardRoot,
|
|
1670
1761
|
// Toolbar
|
|
1671
1762
|
Toolbar: CardToolbar,
|
|
1672
|
-
ToolbarIconButton:
|
|
1673
|
-
ToolbarSeparator:
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
})),
|
|
1679
|
-
CloseIconButton: Toolbar2.CloseIconButton,
|
|
1680
|
-
Title: CardTitle,
|
|
1763
|
+
ToolbarIconButton: Toolbar.IconButton,
|
|
1764
|
+
ToolbarSeparator: Toolbar.Separator,
|
|
1765
|
+
// Toolbar blocks
|
|
1766
|
+
IconBlock: CardIconBlock,
|
|
1767
|
+
DragHandle: CardDragHandle,
|
|
1768
|
+
CloseIconButton,
|
|
1681
1769
|
Menu: CardMenu,
|
|
1682
1770
|
Icon: CardIcon,
|
|
1683
|
-
|
|
1771
|
+
Title: CardTitle,
|
|
1684
1772
|
// Content
|
|
1685
1773
|
Content: CardContent,
|
|
1686
1774
|
Row: CardRow,
|
|
1687
1775
|
Section: CardSection,
|
|
1688
1776
|
Heading: CardHeading,
|
|
1689
1777
|
Text: CardText,
|
|
1778
|
+
Html: CardHtml,
|
|
1690
1779
|
Poster: CardPoster,
|
|
1691
1780
|
Action: CardAction,
|
|
1692
1781
|
Link: CardLink
|
|
@@ -1735,7 +1824,7 @@ var CopyButton = ({ classNames, value, size = 5, ...props }) => {
|
|
|
1735
1824
|
className: mx7("flex gap-1 items-center", isCopied && inactiveLabelStyles)
|
|
1736
1825
|
}, /* @__PURE__ */ React21.createElement("span", {
|
|
1737
1826
|
className: "px-1"
|
|
1738
|
-
}, t("copy
|
|
1827
|
+
}, t("copy.label")), /* @__PURE__ */ React21.createElement(Icon, {
|
|
1739
1828
|
icon: "ph--copy--regular",
|
|
1740
1829
|
size
|
|
1741
1830
|
})), /* @__PURE__ */ React21.createElement("div", {
|
|
@@ -1743,7 +1832,7 @@ var CopyButton = ({ classNames, value, size = 5, ...props }) => {
|
|
|
1743
1832
|
className: mx7("flex gap-1 items-center", !isCopied && inactiveLabelStyles)
|
|
1744
1833
|
}, /* @__PURE__ */ React21.createElement("span", {
|
|
1745
1834
|
className: "px-1"
|
|
1746
|
-
}, t("copy
|
|
1835
|
+
}, t("copy-success.label")), /* @__PURE__ */ React21.createElement(Icon, {
|
|
1747
1836
|
icon: "ph--check--regular",
|
|
1748
1837
|
size
|
|
1749
1838
|
})));
|
|
@@ -1752,7 +1841,7 @@ var CopyButtonIconOnly = ({ __scopeTooltip, value, classNames, size, variant, ..
|
|
|
1752
1841
|
const { t } = useTranslation(osTranslations);
|
|
1753
1842
|
const { textValue, setTextValue } = useClipboard();
|
|
1754
1843
|
const isCopied = textValue === value;
|
|
1755
|
-
const label = isCopied ? t("copy
|
|
1844
|
+
const label = isCopied ? t("copy-success.label") : props.label ?? t("copy.label");
|
|
1756
1845
|
const { onOpen } = useTooltipContext("CopyButton", __scopeTooltip);
|
|
1757
1846
|
return /* @__PURE__ */ React21.createElement(IconButton, {
|
|
1758
1847
|
iconOnly: true,
|
|
@@ -1778,20 +1867,27 @@ var Clipboard = {
|
|
|
1778
1867
|
|
|
1779
1868
|
// src/components/Dialog/Dialog.tsx
|
|
1780
1869
|
import { createContext as createContext5 } from "@radix-ui/react-context";
|
|
1781
|
-
import
|
|
1782
|
-
import
|
|
1870
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
1871
|
+
import { Primitive as Primitive13 } from "@radix-ui/react-primitive";
|
|
1872
|
+
import { Slot as Slot13 } from "@radix-ui/react-slot";
|
|
1873
|
+
import React22, { forwardRef as forwardRef14 } from "react";
|
|
1783
1874
|
import { useTranslation as useTranslation3 } from "react-i18next";
|
|
1784
|
-
import { osTranslations as osTranslations2 } from "@dxos/ui-theme";
|
|
1875
|
+
import { composableProps as composableProps8, osTranslations as osTranslations2, slottable as slottable7 } from "@dxos/ui-theme";
|
|
1785
1876
|
var DialogRoot = (props) => /* @__PURE__ */ React22.createElement(ElevationProvider, {
|
|
1786
1877
|
elevation: "dialog"
|
|
1787
|
-
}, /* @__PURE__ */ React22.createElement(
|
|
1788
|
-
|
|
1789
|
-
|
|
1878
|
+
}, /* @__PURE__ */ React22.createElement(DialogPrimitive.Root, {
|
|
1879
|
+
// NOTE: Radix warning unless set to undefined.
|
|
1880
|
+
// https://www.radix-ui.com/primitives/docs/components/dialog#description
|
|
1881
|
+
"aria-describedby": void 0,
|
|
1882
|
+
...props
|
|
1883
|
+
}));
|
|
1884
|
+
var DialogTrigger = DialogPrimitive.Trigger;
|
|
1885
|
+
var DialogPortal = DialogPrimitive.Portal;
|
|
1790
1886
|
var DIALOG_OVERLAY_NAME = "DialogOverlay";
|
|
1791
1887
|
var [OverlayLayoutProvider, useOverlayLayoutContext] = createContext5(DIALOG_OVERLAY_NAME, {});
|
|
1792
|
-
var DialogOverlay = /* @__PURE__ */
|
|
1888
|
+
var DialogOverlay = /* @__PURE__ */ forwardRef14(({ classNames, children, blockAlign, ...props }, forwardedRef) => {
|
|
1793
1889
|
const { tx } = useThemeContext();
|
|
1794
|
-
return /* @__PURE__ */ React22.createElement(
|
|
1890
|
+
return /* @__PURE__ */ React22.createElement(DialogPrimitive.Overlay, {
|
|
1795
1891
|
...props,
|
|
1796
1892
|
"data-block-align": blockAlign,
|
|
1797
1893
|
className: tx("dialog.overlay", {}, classNames),
|
|
@@ -1802,64 +1898,60 @@ var DialogOverlay = /* @__PURE__ */ forwardRef19(({ classNames, children, blockA
|
|
|
1802
1898
|
});
|
|
1803
1899
|
DialogOverlay.displayName = DIALOG_OVERLAY_NAME;
|
|
1804
1900
|
var DIALOG_CONTENT_NAME = "DialogContent";
|
|
1805
|
-
var DialogContent = /* @__PURE__ */
|
|
1901
|
+
var DialogContent = /* @__PURE__ */ forwardRef14(({ classNames, children, size = "md", inOverlayLayout: propsInOverlayLayout, ...props }, forwardedRef) => {
|
|
1806
1902
|
const { tx } = useThemeContext();
|
|
1807
1903
|
const { inOverlayLayout } = useOverlayLayoutContext(DIALOG_CONTENT_NAME);
|
|
1808
|
-
return /* @__PURE__ */ React22.createElement(
|
|
1904
|
+
return /* @__PURE__ */ React22.createElement(DialogPrimitive.Content, {
|
|
1809
1905
|
...props,
|
|
1810
1906
|
// NOTE: Radix warning unless set to undefined.
|
|
1811
1907
|
// https://www.radix-ui.com/primitives/docs/components/dialog#description
|
|
1812
1908
|
"aria-describedby": void 0,
|
|
1813
1909
|
className: tx("dialog.content", {
|
|
1814
|
-
|
|
1815
|
-
|
|
1910
|
+
size,
|
|
1911
|
+
inOverlayLayout: propsInOverlayLayout || inOverlayLayout
|
|
1816
1912
|
}, classNames),
|
|
1817
1913
|
ref: forwardedRef
|
|
1818
|
-
}, /* @__PURE__ */ React22.createElement(Column.Root,
|
|
1914
|
+
}, /* @__PURE__ */ React22.createElement(Column.Root, {
|
|
1915
|
+
classNames: "dx-expander",
|
|
1916
|
+
gutter: "sm"
|
|
1917
|
+
}, children));
|
|
1819
1918
|
});
|
|
1820
1919
|
DialogContent.displayName = DIALOG_CONTENT_NAME;
|
|
1821
|
-
var DialogHeader =
|
|
1920
|
+
var DialogHeader = slottable7(({ children, asChild, ...props }, forwardedRef) => {
|
|
1921
|
+
const { className, ...rest } = composableProps8(props);
|
|
1922
|
+
const Comp = asChild ? Slot13 : Primitive13.div;
|
|
1822
1923
|
const { tx } = useThemeContext();
|
|
1823
|
-
return /* @__PURE__ */ React22.createElement(
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
role: "heading",
|
|
1827
|
-
...props,
|
|
1828
|
-
className: tx("dialog.header", {
|
|
1829
|
-
srOnly
|
|
1830
|
-
}, [
|
|
1831
|
-
classNames
|
|
1832
|
-
]),
|
|
1924
|
+
return /* @__PURE__ */ React22.createElement(Comp, {
|
|
1925
|
+
...rest,
|
|
1926
|
+
className: tx("dialog.header", {}, className),
|
|
1833
1927
|
ref: forwardedRef
|
|
1834
|
-
})
|
|
1928
|
+
}, children);
|
|
1835
1929
|
});
|
|
1836
|
-
var DialogCloseIconButton = /* @__PURE__ */
|
|
1930
|
+
var DialogCloseIconButton = /* @__PURE__ */ forwardRef14(({ label, ...props }, forwardedRef) => {
|
|
1837
1931
|
const { t } = useTranslation3(osTranslations2);
|
|
1838
1932
|
return /* @__PURE__ */ React22.createElement(IconButton, {
|
|
1839
1933
|
...props,
|
|
1840
|
-
label: label ?? t("close
|
|
1934
|
+
label: label ?? t("close-dialog.label"),
|
|
1841
1935
|
icon: "ph--x--regular",
|
|
1842
1936
|
iconOnly: true,
|
|
1843
1937
|
size: 4,
|
|
1844
|
-
density: "fine",
|
|
1845
1938
|
variant: "ghost",
|
|
1846
1939
|
ref: forwardedRef
|
|
1847
1940
|
});
|
|
1848
1941
|
});
|
|
1849
|
-
var DialogBody =
|
|
1942
|
+
var DialogBody = slottable7(({ children, asChild, ...props }, forwardedRef) => {
|
|
1943
|
+
const { className, ...rest } = composableProps8(props);
|
|
1944
|
+
const Comp = asChild ? Slot13 : Primitive13.div;
|
|
1850
1945
|
const { tx } = useThemeContext();
|
|
1851
|
-
return /* @__PURE__ */ React22.createElement(
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
role: "none",
|
|
1855
|
-
...props,
|
|
1856
|
-
className: tx("dialog.body"),
|
|
1946
|
+
return /* @__PURE__ */ React22.createElement(Comp, {
|
|
1947
|
+
...rest,
|
|
1948
|
+
className: tx("dialog.body", {}, className),
|
|
1857
1949
|
ref: forwardedRef
|
|
1858
|
-
}, children)
|
|
1950
|
+
}, children);
|
|
1859
1951
|
});
|
|
1860
|
-
var DialogTitle = /* @__PURE__ */
|
|
1952
|
+
var DialogTitle = /* @__PURE__ */ forwardRef14(({ classNames, srOnly, ...props }, forwardedRef) => {
|
|
1861
1953
|
const { tx } = useThemeContext();
|
|
1862
|
-
return /* @__PURE__ */ React22.createElement(
|
|
1954
|
+
return /* @__PURE__ */ React22.createElement(DialogPrimitive.Title, {
|
|
1863
1955
|
...props,
|
|
1864
1956
|
className: tx("dialog.title", {
|
|
1865
1957
|
srOnly
|
|
@@ -1867,9 +1959,9 @@ var DialogTitle = /* @__PURE__ */ forwardRef19(({ classNames, srOnly, ...props }
|
|
|
1867
1959
|
ref: forwardedRef
|
|
1868
1960
|
});
|
|
1869
1961
|
});
|
|
1870
|
-
var DialogDescription = /* @__PURE__ */
|
|
1962
|
+
var DialogDescription = /* @__PURE__ */ forwardRef14(({ classNames, srOnly, ...props }, forwardedRef) => {
|
|
1871
1963
|
const { tx } = useThemeContext();
|
|
1872
|
-
return /* @__PURE__ */ React22.createElement(
|
|
1964
|
+
return /* @__PURE__ */ React22.createElement(DialogPrimitive.Description, {
|
|
1873
1965
|
...props,
|
|
1874
1966
|
className: tx("dialog.description", {
|
|
1875
1967
|
srOnly
|
|
@@ -1877,17 +1969,17 @@ var DialogDescription = /* @__PURE__ */ forwardRef19(({ classNames, srOnly, ...p
|
|
|
1877
1969
|
ref: forwardedRef
|
|
1878
1970
|
});
|
|
1879
1971
|
});
|
|
1880
|
-
var DialogActionBar =
|
|
1972
|
+
var DialogActionBar = slottable7(({ children, asChild, ...props }, forwardedRef) => {
|
|
1973
|
+
const { className: classNames, ...rest } = composableProps8(props);
|
|
1974
|
+
const Comp = asChild ? Slot13 : Primitive13.div;
|
|
1881
1975
|
const { tx } = useThemeContext();
|
|
1882
|
-
return /* @__PURE__ */ React22.createElement(
|
|
1883
|
-
|
|
1884
|
-
}, /* @__PURE__ */ React22.createElement("div", {
|
|
1885
|
-
...props,
|
|
1976
|
+
return /* @__PURE__ */ React22.createElement(Comp, {
|
|
1977
|
+
...rest,
|
|
1886
1978
|
className: tx("dialog.actionbar", {}, classNames),
|
|
1887
1979
|
ref: forwardedRef
|
|
1888
|
-
}, children)
|
|
1980
|
+
}, children);
|
|
1889
1981
|
});
|
|
1890
|
-
var DialogClose =
|
|
1982
|
+
var DialogClose = DialogPrimitive.Close;
|
|
1891
1983
|
var Dialog = {
|
|
1892
1984
|
Root: DialogRoot,
|
|
1893
1985
|
Trigger: DialogTrigger,
|
|
@@ -1904,109 +1996,86 @@ var Dialog = {
|
|
|
1904
1996
|
};
|
|
1905
1997
|
|
|
1906
1998
|
// src/components/Dialog/AlertDialog.tsx
|
|
1907
|
-
import
|
|
1999
|
+
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
|
|
1908
2000
|
import { createContext as createContext6 } from "@radix-ui/react-context";
|
|
1909
|
-
import React23, { forwardRef as
|
|
2001
|
+
import React23, { forwardRef as forwardRef15 } from "react";
|
|
1910
2002
|
var AlertDialogRoot = (props) => /* @__PURE__ */ React23.createElement(ElevationProvider, {
|
|
1911
2003
|
elevation: "dialog"
|
|
1912
|
-
}, /* @__PURE__ */ React23.createElement(
|
|
1913
|
-
var AlertDialogTrigger =
|
|
1914
|
-
var AlertDialogPortal =
|
|
1915
|
-
var AlertDialogCancel =
|
|
1916
|
-
var AlertDialogAction =
|
|
1917
|
-
var AlertDialogTitle = /* @__PURE__ */ forwardRef20(({ classNames, srOnly, ...props }, forwardedRef) => {
|
|
1918
|
-
const { tx } = useThemeContext();
|
|
1919
|
-
return /* @__PURE__ */ React23.createElement(AlertDialogTitlePrimitive, {
|
|
1920
|
-
...props,
|
|
1921
|
-
className: tx("dialog.title", {
|
|
1922
|
-
srOnly
|
|
1923
|
-
}, classNames),
|
|
1924
|
-
ref: forwardedRef
|
|
1925
|
-
});
|
|
1926
|
-
});
|
|
1927
|
-
var AlertDialogDescription = /* @__PURE__ */ forwardRef20(({ classNames, srOnly, ...props }, forwardedRef) => {
|
|
1928
|
-
const { tx } = useThemeContext();
|
|
1929
|
-
return /* @__PURE__ */ React23.createElement(AlertDialogDescriptionPrimitive, {
|
|
1930
|
-
...props,
|
|
1931
|
-
className: tx("dialog.description", {
|
|
1932
|
-
srOnly
|
|
1933
|
-
}, classNames),
|
|
1934
|
-
ref: forwardedRef
|
|
1935
|
-
});
|
|
1936
|
-
});
|
|
2004
|
+
}, /* @__PURE__ */ React23.createElement(AlertDialogPrimitive.Root, props));
|
|
2005
|
+
var AlertDialogTrigger = AlertDialogPrimitive.Trigger;
|
|
2006
|
+
var AlertDialogPortal = AlertDialogPrimitive.Portal;
|
|
2007
|
+
var AlertDialogCancel = AlertDialogPrimitive.Cancel;
|
|
2008
|
+
var AlertDialogAction = AlertDialogPrimitive.Action;
|
|
1937
2009
|
var ALERT_DIALOG_OVERLAY_NAME = "AlertDialogOverlay";
|
|
1938
2010
|
var ALERT_DIALOG_CONTENT_NAME = "AlertDialogContent";
|
|
1939
|
-
var ALERT_DIALOG_BODY_NAME = "AlertDialogBody";
|
|
1940
|
-
var ALERT_DIALOG_ACTIONBAR_NAME = "AlertDialogActionBar";
|
|
1941
2011
|
var [OverlayLayoutProvider2, useOverlayLayoutContext2] = createContext6(ALERT_DIALOG_OVERLAY_NAME, {
|
|
1942
2012
|
inOverlayLayout: false
|
|
1943
2013
|
});
|
|
1944
|
-
var AlertDialogOverlay = /* @__PURE__ */
|
|
2014
|
+
var AlertDialogOverlay = /* @__PURE__ */ forwardRef15(({ classNames, children, blockAlign, ...props }, forwardedRef) => {
|
|
1945
2015
|
const { tx } = useThemeContext();
|
|
1946
|
-
return /* @__PURE__ */ React23.createElement(
|
|
2016
|
+
return /* @__PURE__ */ React23.createElement(AlertDialogPrimitive.Overlay, {
|
|
1947
2017
|
...props,
|
|
1948
2018
|
"data-block-align": blockAlign,
|
|
1949
|
-
className: tx(
|
|
1950
|
-
"dialog.overlay",
|
|
1951
|
-
{},
|
|
1952
|
-
classNames,
|
|
1953
|
-
// TODO(burdon): Move to dialog.ts.
|
|
1954
|
-
"data-[h-align=start]:justify-center",
|
|
1955
|
-
"data-[h-align=start]:items-start",
|
|
1956
|
-
"data-[h-align=center]:place-content-center"
|
|
1957
|
-
),
|
|
2019
|
+
className: tx("dialog.overlay", {}, classNames),
|
|
1958
2020
|
ref: forwardedRef
|
|
1959
2021
|
}, /* @__PURE__ */ React23.createElement(OverlayLayoutProvider2, {
|
|
1960
2022
|
inOverlayLayout: true
|
|
1961
2023
|
}, children));
|
|
1962
2024
|
});
|
|
1963
2025
|
AlertDialogOverlay.displayName = ALERT_DIALOG_OVERLAY_NAME;
|
|
1964
|
-
var AlertDialogContent = /* @__PURE__ */
|
|
2026
|
+
var AlertDialogContent = /* @__PURE__ */ forwardRef15(({ classNames, children, size = "md", ...props }, forwardedRef) => {
|
|
1965
2027
|
const { tx } = useThemeContext();
|
|
1966
2028
|
const { inOverlayLayout } = useOverlayLayoutContext2(ALERT_DIALOG_CONTENT_NAME);
|
|
1967
|
-
return /* @__PURE__ */ React23.createElement(
|
|
2029
|
+
return /* @__PURE__ */ React23.createElement(AlertDialogPrimitive.Content, {
|
|
1968
2030
|
...props,
|
|
1969
2031
|
className: tx("dialog.content", {
|
|
1970
2032
|
inOverlayLayout,
|
|
1971
2033
|
size
|
|
1972
2034
|
}, classNames),
|
|
2035
|
+
// NOTE: Radix warning unless set to undefined.
|
|
2036
|
+
// https://www.radix-ui.com/primitives/docs/components/dialog#description
|
|
2037
|
+
"aria-describedby": void 0,
|
|
1973
2038
|
ref: forwardedRef
|
|
1974
|
-
}, /* @__PURE__ */ React23.createElement(Column.Root,
|
|
2039
|
+
}, /* @__PURE__ */ React23.createElement(Column.Root, {
|
|
2040
|
+
classNames: "dx-expander",
|
|
2041
|
+
gutter: "sm"
|
|
2042
|
+
}, children));
|
|
1975
2043
|
});
|
|
1976
2044
|
AlertDialogContent.displayName = ALERT_DIALOG_CONTENT_NAME;
|
|
1977
|
-
var
|
|
2045
|
+
var AlertDialogTitle = /* @__PURE__ */ forwardRef15(({ classNames, srOnly, ...props }, forwardedRef) => {
|
|
1978
2046
|
const { tx } = useThemeContext();
|
|
1979
|
-
return /* @__PURE__ */ React23.createElement(
|
|
1980
|
-
asChild: true
|
|
1981
|
-
}, /* @__PURE__ */ React23.createElement("div", {
|
|
1982
|
-
role: "none",
|
|
2047
|
+
return /* @__PURE__ */ React23.createElement(AlertDialogPrimitive.Title, {
|
|
1983
2048
|
...props,
|
|
1984
|
-
className: tx("dialog.
|
|
2049
|
+
className: tx("dialog.title", {
|
|
2050
|
+
srOnly
|
|
2051
|
+
}, classNames),
|
|
1985
2052
|
ref: forwardedRef
|
|
1986
|
-
}
|
|
2053
|
+
});
|
|
1987
2054
|
});
|
|
1988
|
-
|
|
1989
|
-
var AlertDialogActionBar = /* @__PURE__ */ forwardRef20(({ children, classNames, ...props }, forwardedRef) => {
|
|
2055
|
+
var AlertDialogDescription = /* @__PURE__ */ forwardRef15(({ classNames, srOnly, ...props }, forwardedRef) => {
|
|
1990
2056
|
const { tx } = useThemeContext();
|
|
1991
|
-
return /* @__PURE__ */ React23.createElement(
|
|
1992
|
-
asChild: true
|
|
1993
|
-
}, /* @__PURE__ */ React23.createElement("div", {
|
|
2057
|
+
return /* @__PURE__ */ React23.createElement(AlertDialogPrimitive.Description, {
|
|
1994
2058
|
...props,
|
|
1995
|
-
className: tx("dialog.
|
|
2059
|
+
className: tx("dialog.description", {
|
|
2060
|
+
srOnly
|
|
2061
|
+
}, classNames),
|
|
1996
2062
|
ref: forwardedRef
|
|
1997
|
-
}
|
|
2063
|
+
});
|
|
1998
2064
|
});
|
|
1999
|
-
AlertDialogActionBar.displayName = ALERT_DIALOG_ACTIONBAR_NAME;
|
|
2000
2065
|
var AlertDialog = {
|
|
2001
2066
|
Root: AlertDialogRoot,
|
|
2002
2067
|
Trigger: AlertDialogTrigger,
|
|
2003
2068
|
Portal: AlertDialogPortal,
|
|
2004
2069
|
Overlay: AlertDialogOverlay,
|
|
2005
2070
|
Content: AlertDialogContent,
|
|
2006
|
-
|
|
2071
|
+
// Shared with Dialog.
|
|
2072
|
+
Header: Dialog.Header,
|
|
2073
|
+
Body: Dialog.Body,
|
|
2007
2074
|
Title: AlertDialogTitle,
|
|
2008
2075
|
Description: AlertDialogDescription,
|
|
2009
|
-
ActionBar:
|
|
2076
|
+
ActionBar: Dialog.ActionBar,
|
|
2077
|
+
CloseIconButton: Dialog.CloseIconButton,
|
|
2078
|
+
// AlertDialog-specific dismissal.
|
|
2010
2079
|
Cancel: AlertDialogCancel,
|
|
2011
2080
|
Action: AlertDialogAction
|
|
2012
2081
|
};
|
|
@@ -2015,94 +2084,43 @@ var AlertDialog = {
|
|
|
2015
2084
|
import { ErrorBoundary } from "@dxos/react-error-boundary";
|
|
2016
2085
|
|
|
2017
2086
|
// src/components/ErrorFallback/ErrorFallback.tsx
|
|
2018
|
-
import React25 from "react";
|
|
2019
|
-
import { safeStringify } from "@dxos/util";
|
|
2020
|
-
|
|
2021
|
-
// src/components/ErrorFallback/ErrorStack.tsx
|
|
2022
|
-
import ErrorStackParser from "error-stack-parser";
|
|
2023
2087
|
import React24 from "react";
|
|
2024
|
-
import {
|
|
2025
|
-
var ErrorStack = ({ error }) => {
|
|
2026
|
-
const frames = ErrorStackParser.parse(error);
|
|
2027
|
-
return /* @__PURE__ */ React24.createElement("div", {
|
|
2028
|
-
className: "font-mono text-sm"
|
|
2029
|
-
}, frames.map((frame, i) => {
|
|
2030
|
-
const isLast = i === frames.length - 1;
|
|
2031
|
-
const local = frame.fileName ? parseLocalFrame(frame.fileName, frame.lineNumber, frame.columnNumber) : void 0;
|
|
2032
|
-
const name = frame.functionName ?? "<anonymous>";
|
|
2033
|
-
return /* @__PURE__ */ React24.createElement("div", {
|
|
2034
|
-
key: i,
|
|
2035
|
-
className: mx8("grid grid-cols-[16px_1fr_auto_auto] items-stretch gap-x-2", local && "cursor-pointer hover:bg-hover-surface")
|
|
2036
|
-
}, /* @__PURE__ */ React24.createElement("div", {
|
|
2037
|
-
className: "relative"
|
|
2038
|
-
}, /* @__PURE__ */ React24.createElement("div", {
|
|
2039
|
-
className: mx8("absolute left-1/2 -translate-x-1/2 w-px bg-neutral-500", isLast ? "top-0 h-1/2" : "inset-y-0")
|
|
2040
|
-
}), /* @__PURE__ */ React24.createElement("div", {
|
|
2041
|
-
className: "absolute top-1/2 -translate-y-1/2 left-1/2 right-0 h-px bg-neutral-500"
|
|
2042
|
-
})), local ? /* @__PURE__ */ React24.createElement("a", {
|
|
2043
|
-
href: local.href,
|
|
2044
|
-
className: "truncate self-center"
|
|
2045
|
-
}, name) : /* @__PURE__ */ React24.createElement("span", {
|
|
2046
|
-
className: "text-subdued truncate self-center"
|
|
2047
|
-
}, name), /* @__PURE__ */ React24.createElement("span", {
|
|
2048
|
-
className: "text-xs text-subdued truncate self-center"
|
|
2049
|
-
}, local?.fileName ?? ""), /* @__PURE__ */ React24.createElement("span", {
|
|
2050
|
-
className: "text-xs text-subdued text-right self-center"
|
|
2051
|
-
}, local ? `${frame.lineNumber}:${frame.columnNumber}` : ""));
|
|
2052
|
-
}));
|
|
2053
|
-
};
|
|
2054
|
-
var parseLocalFrame = (fileUrl, line, col) => {
|
|
2055
|
-
try {
|
|
2056
|
-
const { pathname } = new URL(fileUrl);
|
|
2057
|
-
if (!pathname.startsWith("/@fs/")) {
|
|
2058
|
-
return void 0;
|
|
2059
|
-
}
|
|
2060
|
-
const localPath = pathname.slice(4);
|
|
2061
|
-
return {
|
|
2062
|
-
href: `vscode://file/${localPath}:${line ?? 1}:${col ?? 1}`,
|
|
2063
|
-
fileName: pathname.split("/").pop() ?? localPath
|
|
2064
|
-
};
|
|
2065
|
-
} catch {
|
|
2066
|
-
return void 0;
|
|
2067
|
-
}
|
|
2068
|
-
};
|
|
2069
|
-
|
|
2070
|
-
// src/components/ErrorFallback/ErrorFallback.tsx
|
|
2088
|
+
import { safeStringify } from "@dxos/util";
|
|
2071
2089
|
var ErrorFallback = ({ children, error, title, data }) => {
|
|
2072
2090
|
const isDev = true;
|
|
2073
2091
|
const message = error instanceof Error ? error.message : String(error);
|
|
2074
|
-
return /* @__PURE__ */
|
|
2092
|
+
return /* @__PURE__ */ React24.createElement("div", {
|
|
2075
2093
|
role: "alert",
|
|
2076
2094
|
"data-testid": "error-boundary-fallback",
|
|
2077
2095
|
className: "flex flex-col p-4 gap-4 overflow-auto"
|
|
2078
|
-
}, /* @__PURE__ */
|
|
2096
|
+
}, /* @__PURE__ */ React24.createElement("h1", {
|
|
2079
2097
|
className: "text-lg text-info-text"
|
|
2080
|
-
}, title ?? "Runtime Error"), /* @__PURE__ */
|
|
2098
|
+
}, title ?? "Runtime Error"), /* @__PURE__ */ React24.createElement("p", null, message), isDev && error instanceof Error && /* @__PURE__ */ React24.createElement(Section, {
|
|
2081
2099
|
title: "Stack",
|
|
2082
2100
|
onClick: () => {
|
|
2083
2101
|
const text = error instanceof Error ? error.stack ?? error.message : String(error);
|
|
2084
2102
|
void navigator.clipboard.writeText(text);
|
|
2085
2103
|
}
|
|
2086
|
-
}, /* @__PURE__ */
|
|
2104
|
+
}, /* @__PURE__ */ React24.createElement(ErrorStack, {
|
|
2087
2105
|
error
|
|
2088
|
-
})), data && /* @__PURE__ */
|
|
2106
|
+
})), data && /* @__PURE__ */ React24.createElement(Section, {
|
|
2089
2107
|
title: "Data",
|
|
2090
2108
|
onClick: () => {
|
|
2091
2109
|
void navigator.clipboard.writeText(JSON.stringify(data, void 0, 2));
|
|
2092
2110
|
}
|
|
2093
|
-
}, /* @__PURE__ */
|
|
2111
|
+
}, /* @__PURE__ */ React24.createElement("pre", {
|
|
2094
2112
|
className: "overflow-x-auto text-xs"
|
|
2095
2113
|
}, safeStringify(data, void 0, 2))), children);
|
|
2096
2114
|
};
|
|
2097
2115
|
var Section = ({ children, title, onClick }) => {
|
|
2098
|
-
return /* @__PURE__ */
|
|
2116
|
+
return /* @__PURE__ */ React24.createElement("div", {
|
|
2099
2117
|
className: "flex flex-col gap-1"
|
|
2100
|
-
}, onClick && /* @__PURE__ */
|
|
2118
|
+
}, onClick && /* @__PURE__ */ React24.createElement("button", {
|
|
2101
2119
|
type: "button",
|
|
2102
2120
|
onClick,
|
|
2103
2121
|
className: "flex items-center gap-1 text-xs text-subdued hover:text-primary-500 transition-colors",
|
|
2104
2122
|
title: `Copy ${title}`
|
|
2105
|
-
}, /* @__PURE__ */
|
|
2123
|
+
}, /* @__PURE__ */ React24.createElement("h2", {
|
|
2106
2124
|
className: "text-xs uppercase text-subdued"
|
|
2107
2125
|
}, title)), children);
|
|
2108
2126
|
};
|
|
@@ -2135,13 +2153,122 @@ var generator = ({ error, delay }) => {
|
|
|
2135
2153
|
return error?.() ?? new Error(`Error generated after ${delay}ms`);
|
|
2136
2154
|
};
|
|
2137
2155
|
|
|
2156
|
+
// src/components/Focus/Focus.tsx
|
|
2157
|
+
import { useArrowNavigationGroup, useFocusableGroup, useMergedTabsterAttributes_unstable } from "@fluentui/react-tabster";
|
|
2158
|
+
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
2159
|
+
import { Primitive as Primitive14 } from "@radix-ui/react-primitive";
|
|
2160
|
+
import { Slot as Slot14 } from "@radix-ui/react-slot";
|
|
2161
|
+
import React25, { createContext as createContext7, useCallback as useCallback6, useContext as useContext5, useRef as useRef3, useState as useState6 } from "react";
|
|
2162
|
+
import { composableProps as composableProps9, slottable as slottable8 } from "@dxos/ui-theme";
|
|
2163
|
+
var FOCUS_STATE_ATTR = "focus-state";
|
|
2164
|
+
var FocusContext = /* @__PURE__ */ createContext7({});
|
|
2165
|
+
var useFocus = () => useContext5(FocusContext);
|
|
2166
|
+
var Group3 = slottable8(({ children, asChild, orientation = "vertical", border = false, ...props }, forwardedRef) => {
|
|
2167
|
+
const Comp = asChild ? Slot14 : Primitive14.div;
|
|
2168
|
+
const { tx } = useThemeContext();
|
|
2169
|
+
const rootRef = useRef3(null);
|
|
2170
|
+
const focusableGroupAttrs = useFocusableGroup({
|
|
2171
|
+
tabBehavior: "limited-trap-focus"
|
|
2172
|
+
});
|
|
2173
|
+
const arrowNavigationAttrs = useArrowNavigationGroup({
|
|
2174
|
+
axis: orientation,
|
|
2175
|
+
memorizeCurrent: true
|
|
2176
|
+
});
|
|
2177
|
+
const tabsterAttrs = useMergedTabsterAttributes_unstable(focusableGroupAttrs, arrowNavigationAttrs);
|
|
2178
|
+
const [state, setState] = useState6();
|
|
2179
|
+
const [groupHasFocus, setGroupHasFocus] = useState6(false);
|
|
2180
|
+
const handleFocusIn = useCallback6(() => setGroupHasFocus(true), []);
|
|
2181
|
+
const handleFocusOut = useCallback6((event) => {
|
|
2182
|
+
const related = event.relatedTarget;
|
|
2183
|
+
if (!related || !rootRef.current?.contains(related)) {
|
|
2184
|
+
setGroupHasFocus(false);
|
|
2185
|
+
}
|
|
2186
|
+
}, []);
|
|
2187
|
+
const { className, ...rest } = composableProps9(props);
|
|
2188
|
+
return /* @__PURE__ */ React25.createElement(FocusContext.Provider, {
|
|
2189
|
+
value: {
|
|
2190
|
+
setFocus: setState,
|
|
2191
|
+
groupHasFocus
|
|
2192
|
+
}
|
|
2193
|
+
}, /* @__PURE__ */ React25.createElement(Comp, {
|
|
2194
|
+
...rest,
|
|
2195
|
+
tabIndex: 0,
|
|
2196
|
+
className: tx("focus.group", {
|
|
2197
|
+
border
|
|
2198
|
+
}, className),
|
|
2199
|
+
...tabsterAttrs,
|
|
2200
|
+
...state && {
|
|
2201
|
+
[`data-${FOCUS_STATE_ATTR}`]: state
|
|
2202
|
+
},
|
|
2203
|
+
onBlur: handleFocusOut,
|
|
2204
|
+
onFocus: handleFocusIn,
|
|
2205
|
+
ref: useComposedRefs(rootRef, forwardedRef)
|
|
2206
|
+
}, children));
|
|
2207
|
+
});
|
|
2208
|
+
var Item4 = slottable8(({ children, asChild, current, border = false, onCurrentChange, onClick, onFocus, onBlur, ...props }, forwardedRef) => {
|
|
2209
|
+
const Comp = asChild ? Slot14 : Primitive14.div;
|
|
2210
|
+
const { tx } = useThemeContext();
|
|
2211
|
+
const focusableGroupAttrs = useFocusableGroup({
|
|
2212
|
+
ignoreDefaultKeydown: {
|
|
2213
|
+
Enter: true
|
|
2214
|
+
}
|
|
2215
|
+
});
|
|
2216
|
+
const [focused, setFocused] = useState6(false);
|
|
2217
|
+
const handleClick = useCallback6((event) => {
|
|
2218
|
+
onCurrentChange?.();
|
|
2219
|
+
onClick?.(event);
|
|
2220
|
+
}, [
|
|
2221
|
+
onCurrentChange,
|
|
2222
|
+
onClick
|
|
2223
|
+
]);
|
|
2224
|
+
const handleKeyDown = useCallback6((event) => {
|
|
2225
|
+
if (event.key === "Enter") {
|
|
2226
|
+
onCurrentChange?.();
|
|
2227
|
+
}
|
|
2228
|
+
}, [
|
|
2229
|
+
onCurrentChange
|
|
2230
|
+
]);
|
|
2231
|
+
const handleFocus = useCallback6((event) => {
|
|
2232
|
+
setFocused(true);
|
|
2233
|
+
onFocus?.(event);
|
|
2234
|
+
}, [
|
|
2235
|
+
onFocus
|
|
2236
|
+
]);
|
|
2237
|
+
const handleBlur = useCallback6((event) => {
|
|
2238
|
+
setFocused(false);
|
|
2239
|
+
onBlur?.(event);
|
|
2240
|
+
}, [
|
|
2241
|
+
onBlur
|
|
2242
|
+
]);
|
|
2243
|
+
const isCurrent = current ?? focused;
|
|
2244
|
+
const { className, ...rest } = composableProps9(props);
|
|
2245
|
+
return /* @__PURE__ */ React25.createElement(Comp, {
|
|
2246
|
+
...rest,
|
|
2247
|
+
tabIndex: 0,
|
|
2248
|
+
className: tx("focus.item", {
|
|
2249
|
+
border
|
|
2250
|
+
}, className),
|
|
2251
|
+
...focusableGroupAttrs,
|
|
2252
|
+
"aria-current": isCurrent || void 0,
|
|
2253
|
+
onClick: handleClick,
|
|
2254
|
+
onKeyDown: handleKeyDown,
|
|
2255
|
+
onFocus: handleFocus,
|
|
2256
|
+
onBlur: handleBlur,
|
|
2257
|
+
ref: forwardedRef
|
|
2258
|
+
}, children);
|
|
2259
|
+
});
|
|
2260
|
+
var Focus = {
|
|
2261
|
+
Group: Group3,
|
|
2262
|
+
Item: Item4
|
|
2263
|
+
};
|
|
2264
|
+
|
|
2138
2265
|
// src/components/Input/Input.tsx
|
|
2139
|
-
import
|
|
2266
|
+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
2140
2267
|
import { useControllableState as useControllableState2 } from "@radix-ui/react-use-controllable-state";
|
|
2141
|
-
import React26, { forwardRef as
|
|
2268
|
+
import React26, { forwardRef as forwardRef16 } from "react";
|
|
2142
2269
|
import { DescriptionAndValidation as DescriptionAndValidationPrimitive, Description as DescriptionPrimitive, INPUT_NAME, InputRoot, Label as LabelPrimitive, PinInput as PinInputPrimitive, TextArea as TextAreaPrimitive, TextInput as TextInputPrimitive, Validation as ValidationPrimitive, useInputContext } from "@dxos/react-input";
|
|
2143
|
-
import { mx as
|
|
2144
|
-
var Label3 = /* @__PURE__ */
|
|
2270
|
+
import { mx as mx8 } from "@dxos/ui-theme";
|
|
2271
|
+
var Label3 = /* @__PURE__ */ forwardRef16(({ classNames, children, srOnly, ...props }, forwardedRef) => {
|
|
2145
2272
|
const { tx } = useThemeContext();
|
|
2146
2273
|
return /* @__PURE__ */ React26.createElement(LabelPrimitive, {
|
|
2147
2274
|
...props,
|
|
@@ -2151,7 +2278,7 @@ var Label3 = /* @__PURE__ */ forwardRef21(({ classNames, children, srOnly, ...pr
|
|
|
2151
2278
|
ref: forwardedRef
|
|
2152
2279
|
}, children);
|
|
2153
2280
|
});
|
|
2154
|
-
var
|
|
2281
|
+
var Description3 = /* @__PURE__ */ forwardRef16(({ classNames, children, srOnly, ...props }, forwardedRef) => {
|
|
2155
2282
|
const { tx } = useThemeContext();
|
|
2156
2283
|
return /* @__PURE__ */ React26.createElement(DescriptionPrimitive, {
|
|
2157
2284
|
...props,
|
|
@@ -2161,7 +2288,7 @@ var Description = /* @__PURE__ */ forwardRef21(({ classNames, children, srOnly,
|
|
|
2161
2288
|
ref: forwardedRef
|
|
2162
2289
|
}, children);
|
|
2163
2290
|
});
|
|
2164
|
-
var Validation = /* @__PURE__ */
|
|
2291
|
+
var Validation = /* @__PURE__ */ forwardRef16(({ __inputScope, classNames, children, srOnly, ...props }, forwardedRef) => {
|
|
2165
2292
|
const { tx } = useThemeContext();
|
|
2166
2293
|
const { validationValence } = useInputContext(INPUT_NAME, __inputScope);
|
|
2167
2294
|
return /* @__PURE__ */ React26.createElement(ValidationPrimitive, {
|
|
@@ -2173,7 +2300,7 @@ var Validation = /* @__PURE__ */ forwardRef21(({ __inputScope, classNames, child
|
|
|
2173
2300
|
ref: forwardedRef
|
|
2174
2301
|
}, children);
|
|
2175
2302
|
});
|
|
2176
|
-
var DescriptionAndValidation = /* @__PURE__ */
|
|
2303
|
+
var DescriptionAndValidation = /* @__PURE__ */ forwardRef16(({ classNames, children, srOnly, ...props }, forwardedRef) => {
|
|
2177
2304
|
const { tx } = useThemeContext();
|
|
2178
2305
|
return /* @__PURE__ */ React26.createElement(DescriptionAndValidationPrimitive, {
|
|
2179
2306
|
...props,
|
|
@@ -2183,7 +2310,7 @@ var DescriptionAndValidation = /* @__PURE__ */ forwardRef21(({ classNames, child
|
|
|
2183
2310
|
ref: forwardedRef
|
|
2184
2311
|
}, children);
|
|
2185
2312
|
});
|
|
2186
|
-
var PinInput = /* @__PURE__ */
|
|
2313
|
+
var PinInput = /* @__PURE__ */ forwardRef16(({ classNames, density: propsDensity, elevation: propsElevation, ...props }, forwardedRef) => {
|
|
2187
2314
|
const { hasIosKeyboard: hasIosKeyboard2 } = useThemeContext();
|
|
2188
2315
|
const { tx } = useThemeContext();
|
|
2189
2316
|
const density = useDensityContext(propsDensity);
|
|
@@ -2204,11 +2331,11 @@ var PinInput = /* @__PURE__ */ forwardRef21(({ classNames, density: propsDensity
|
|
|
2204
2331
|
ref: forwardedRef
|
|
2205
2332
|
});
|
|
2206
2333
|
});
|
|
2207
|
-
var TextInput = /* @__PURE__ */
|
|
2334
|
+
var TextInput = /* @__PURE__ */ forwardRef16(({ __inputScope, classNames, density: densityProp, elevation: elevationProp, variant, noAutoFill, ...props }, forwardedRef) => {
|
|
2208
2335
|
const { hasIosKeyboard: hasIosKeyboard2 } = useThemeContext();
|
|
2209
2336
|
const { tx } = useThemeContext();
|
|
2210
|
-
const density = useDensityContext(
|
|
2211
|
-
const elevation = useElevationContext(
|
|
2337
|
+
const density = useDensityContext(densityProp);
|
|
2338
|
+
const elevation = useElevationContext(elevationProp);
|
|
2212
2339
|
const { validationValence } = useInputContext(INPUT_NAME, __inputScope);
|
|
2213
2340
|
return /* @__PURE__ */ React26.createElement(TextInputPrimitive, {
|
|
2214
2341
|
...props,
|
|
@@ -2226,7 +2353,7 @@ var TextInput = /* @__PURE__ */ forwardRef21(({ __inputScope, classNames, densit
|
|
|
2226
2353
|
ref: forwardedRef
|
|
2227
2354
|
});
|
|
2228
2355
|
});
|
|
2229
|
-
var TextArea = /* @__PURE__ */
|
|
2356
|
+
var TextArea = /* @__PURE__ */ forwardRef16(({ __inputScope, classNames, density: propsDensity, elevation: propsElevation, variant, ...props }, forwardedRef) => {
|
|
2230
2357
|
const { hasIosKeyboard: hasIosKeyboard2 } = useThemeContext();
|
|
2231
2358
|
const { tx } = useThemeContext();
|
|
2232
2359
|
const density = useDensityContext(propsDensity);
|
|
@@ -2247,7 +2374,7 @@ var TextArea = /* @__PURE__ */ forwardRef21(({ __inputScope, classNames, density
|
|
|
2247
2374
|
ref: forwardedRef
|
|
2248
2375
|
});
|
|
2249
2376
|
});
|
|
2250
|
-
var Checkbox = /* @__PURE__ */
|
|
2377
|
+
var Checkbox = /* @__PURE__ */ forwardRef16(({ __inputScope, classNames, checked: propsChecked, defaultChecked: propsDefaultChecked, onCheckedChange: propsOnCheckedChange, size, ...props }, forwardedRef) => {
|
|
2251
2378
|
const [checked, onCheckedChange] = useControllableState2({
|
|
2252
2379
|
prop: propsChecked,
|
|
2253
2380
|
defaultProp: propsDefaultChecked,
|
|
@@ -2255,7 +2382,7 @@ var Checkbox = /* @__PURE__ */ forwardRef21(({ __inputScope, classNames, checked
|
|
|
2255
2382
|
});
|
|
2256
2383
|
const { id, validationValence, descriptionId, errorMessageId } = useInputContext(INPUT_NAME, __inputScope);
|
|
2257
2384
|
const { tx } = useThemeContext();
|
|
2258
|
-
return /* @__PURE__ */ React26.createElement(CheckboxPrimitive, {
|
|
2385
|
+
return /* @__PURE__ */ React26.createElement(CheckboxPrimitive.Root, {
|
|
2259
2386
|
...props,
|
|
2260
2387
|
checked,
|
|
2261
2388
|
onCheckedChange,
|
|
@@ -2277,7 +2404,7 @@ var Checkbox = /* @__PURE__ */ forwardRef21(({ __inputScope, classNames, checked
|
|
|
2277
2404
|
})
|
|
2278
2405
|
}));
|
|
2279
2406
|
});
|
|
2280
|
-
var Switch = /* @__PURE__ */
|
|
2407
|
+
var Switch = /* @__PURE__ */ forwardRef16(({ __inputScope, classNames, checked: propsChecked, defaultChecked: propsDefaultChecked, onCheckedChange: propsOnCheckedChange, ...props }, forwardedRef) => {
|
|
2281
2408
|
const [checked, onCheckedChange] = useControllableState2({
|
|
2282
2409
|
prop: propsChecked,
|
|
2283
2410
|
defaultProp: propsDefaultChecked ?? false,
|
|
@@ -2286,7 +2413,7 @@ var Switch = /* @__PURE__ */ forwardRef21(({ __inputScope, classNames, checked:
|
|
|
2286
2413
|
const { id, validationValence, descriptionId, errorMessageId } = useInputContext(INPUT_NAME, __inputScope);
|
|
2287
2414
|
return /* @__PURE__ */ React26.createElement("input", {
|
|
2288
2415
|
type: "checkbox",
|
|
2289
|
-
className:
|
|
2416
|
+
className: mx8("dx-checkbox--switch dx-focus-ring", classNames),
|
|
2290
2417
|
checked,
|
|
2291
2418
|
onChange: (event) => {
|
|
2292
2419
|
onCheckedChange(event.target.checked);
|
|
@@ -2309,16 +2436,17 @@ var Input = {
|
|
|
2309
2436
|
Checkbox,
|
|
2310
2437
|
Switch,
|
|
2311
2438
|
Label: Label3,
|
|
2312
|
-
Description,
|
|
2439
|
+
Description: Description3,
|
|
2313
2440
|
Validation,
|
|
2314
2441
|
DescriptionAndValidation
|
|
2315
2442
|
};
|
|
2316
2443
|
|
|
2317
2444
|
// src/components/List/List.tsx
|
|
2318
|
-
import { Primitive as
|
|
2319
|
-
import { Slot as
|
|
2320
|
-
import React28, { forwardRef as
|
|
2445
|
+
import { Primitive as Primitive15 } from "@radix-ui/react-primitive";
|
|
2446
|
+
import { Slot as Slot15 } from "@radix-ui/react-slot";
|
|
2447
|
+
import React28, { forwardRef as forwardRef17 } from "react";
|
|
2321
2448
|
import { LIST_ITEM_NAME, LIST_NAME, ListItemCollapsibleContent, List as ListPrimitive, ListItem as ListPrimitiveItem, ListItemHeading as ListPrimitiveItemHeading, ListItemOpenTrigger as ListPrimitiveItemOpenTrigger, useListContext, useListItemContext } from "@dxos/react-list";
|
|
2449
|
+
import { composable as composable4, composableProps as composableProps10 } from "@dxos/ui-theme";
|
|
2322
2450
|
|
|
2323
2451
|
// src/components/List/ListDropIndicator.tsx
|
|
2324
2452
|
import React27 from "react";
|
|
@@ -2359,19 +2487,20 @@ var ListDropIndicator = ({ edge, gap = 0, lineInset = 0, terminalInset = lineIns
|
|
|
2359
2487
|
};
|
|
2360
2488
|
|
|
2361
2489
|
// src/components/List/List.tsx
|
|
2362
|
-
var List =
|
|
2490
|
+
var List = composable4(({ children, ...props }, forwardedRef) => {
|
|
2363
2491
|
const { tx } = useThemeContext();
|
|
2364
2492
|
const density = useDensityContext(props.density);
|
|
2493
|
+
const { className, ...rest } = composableProps10(props);
|
|
2365
2494
|
return /* @__PURE__ */ React28.createElement(DensityProvider, {
|
|
2366
2495
|
density
|
|
2367
2496
|
}, /* @__PURE__ */ React28.createElement(ListPrimitive, {
|
|
2368
|
-
...
|
|
2369
|
-
className: tx("list.root", {},
|
|
2497
|
+
...rest,
|
|
2498
|
+
className: tx("list.root", {}, className),
|
|
2370
2499
|
ref: forwardedRef
|
|
2371
2500
|
}, children));
|
|
2372
2501
|
});
|
|
2373
|
-
var ListItemEndcap = /* @__PURE__ */
|
|
2374
|
-
const Comp = asChild ?
|
|
2502
|
+
var ListItemEndcap = /* @__PURE__ */ forwardRef17(({ children, classNames, asChild, ...props }, forwardedRef) => {
|
|
2503
|
+
const Comp = asChild ? Slot15 : Primitive15.div;
|
|
2375
2504
|
const density = useDensityContext();
|
|
2376
2505
|
const { tx } = useThemeContext();
|
|
2377
2506
|
return /* @__PURE__ */ React28.createElement(Comp, {
|
|
@@ -2396,7 +2525,7 @@ var MockListItemOpenTrigger = ({ classNames, ...props }) => {
|
|
|
2396
2525
|
}, classNames)
|
|
2397
2526
|
});
|
|
2398
2527
|
};
|
|
2399
|
-
var ListItemHeading = /* @__PURE__ */
|
|
2528
|
+
var ListItemHeading = /* @__PURE__ */ forwardRef17(({ children, classNames, ...props }, forwardedRef) => {
|
|
2400
2529
|
const { tx } = useThemeContext();
|
|
2401
2530
|
const density = useDensityContext();
|
|
2402
2531
|
return /* @__PURE__ */ React28.createElement(ListPrimitiveItemHeading, {
|
|
@@ -2405,9 +2534,9 @@ var ListItemHeading = /* @__PURE__ */ forwardRef22(({ children, classNames, ...p
|
|
|
2405
2534
|
density
|
|
2406
2535
|
}, classNames),
|
|
2407
2536
|
ref: forwardedRef
|
|
2408
|
-
}, children);
|
|
2537
|
+
}, /* @__PURE__ */ React28.createElement("span", null, children));
|
|
2409
2538
|
});
|
|
2410
|
-
var ListItemOpenTrigger = /* @__PURE__ */
|
|
2539
|
+
var ListItemOpenTrigger = /* @__PURE__ */ forwardRef17(({ __listItemScope, classNames, children, ...props }, forwardedRef) => {
|
|
2411
2540
|
const { tx } = useThemeContext();
|
|
2412
2541
|
const density = useDensityContext();
|
|
2413
2542
|
const { open } = useListItemContext(LIST_ITEM_NAME, __listItemScope);
|
|
@@ -2423,7 +2552,7 @@ var ListItemOpenTrigger = /* @__PURE__ */ forwardRef22(({ __listItemScope, class
|
|
|
2423
2552
|
classNames: tx("list.item.openTriggerIcon", {})
|
|
2424
2553
|
}));
|
|
2425
2554
|
});
|
|
2426
|
-
var ListItemRoot = /* @__PURE__ */
|
|
2555
|
+
var ListItemRoot = /* @__PURE__ */ forwardRef17(({ classNames, children, ...props }, forwardedRef) => {
|
|
2427
2556
|
const { tx } = useThemeContext();
|
|
2428
2557
|
const density = useDensityContext();
|
|
2429
2558
|
return /* @__PURE__ */ React28.createElement(ListPrimitiveItem, {
|
|
@@ -2446,7 +2575,7 @@ var ListItem = {
|
|
|
2446
2575
|
};
|
|
2447
2576
|
|
|
2448
2577
|
// src/components/List/Tree.tsx
|
|
2449
|
-
import React30, { forwardRef as
|
|
2578
|
+
import React30, { forwardRef as forwardRef18 } from "react";
|
|
2450
2579
|
|
|
2451
2580
|
// src/components/List/TreeDropIndicator.tsx
|
|
2452
2581
|
import React29 from "react";
|
|
@@ -2494,13 +2623,13 @@ var TreeDropIndicator = ({ instruction, gap = 0 }) => {
|
|
|
2494
2623
|
};
|
|
2495
2624
|
|
|
2496
2625
|
// src/components/List/Tree.tsx
|
|
2497
|
-
var TreeRoot = /* @__PURE__ */
|
|
2626
|
+
var TreeRoot = /* @__PURE__ */ forwardRef18((props, forwardedRef) => {
|
|
2498
2627
|
return /* @__PURE__ */ React30.createElement(List, {
|
|
2499
2628
|
...props,
|
|
2500
2629
|
ref: forwardedRef
|
|
2501
2630
|
});
|
|
2502
2631
|
});
|
|
2503
|
-
var TreeBranch = /* @__PURE__ */
|
|
2632
|
+
var TreeBranch = /* @__PURE__ */ forwardRef18(({ __listScope, ...props }, forwardedRef) => {
|
|
2504
2633
|
const { headingId } = useListItemContext(LIST_ITEM_NAME, __listScope);
|
|
2505
2634
|
return /* @__PURE__ */ React30.createElement(List, {
|
|
2506
2635
|
...props,
|
|
@@ -2508,7 +2637,7 @@ var TreeBranch = /* @__PURE__ */ forwardRef23(({ __listScope, ...props }, forwar
|
|
|
2508
2637
|
ref: forwardedRef
|
|
2509
2638
|
});
|
|
2510
2639
|
});
|
|
2511
|
-
var TreeItemRoot = /* @__PURE__ */
|
|
2640
|
+
var TreeItemRoot = /* @__PURE__ */ forwardRef18((props, forwardedRef) => {
|
|
2512
2641
|
return /* @__PURE__ */ React30.createElement(ListItem.Root, {
|
|
2513
2642
|
role: "treeitem",
|
|
2514
2643
|
...props,
|
|
@@ -2535,20 +2664,24 @@ var TreeItem = {
|
|
|
2535
2664
|
// src/components/List/Treegrid.tsx
|
|
2536
2665
|
import { useFocusFinders } from "@fluentui/react-tabster";
|
|
2537
2666
|
import { createContextScope as createContextScope2 } from "@radix-ui/react-context";
|
|
2538
|
-
import { Primitive as
|
|
2539
|
-
import { Slot as
|
|
2667
|
+
import { Primitive as Primitive16 } from "@radix-ui/react-primitive";
|
|
2668
|
+
import { Slot as Slot16 } from "@radix-ui/react-slot";
|
|
2540
2669
|
import { useControllableState as useControllableState3 } from "@radix-ui/react-use-controllable-state";
|
|
2541
|
-
import React31, { forwardRef as
|
|
2670
|
+
import React31, { forwardRef as forwardRef19, useCallback as useCallback7 } from "react";
|
|
2671
|
+
import { composable as composable5, composableProps as composableProps11 } from "@dxos/ui-theme";
|
|
2542
2672
|
var TREEGRID_ROW_NAME = "TreegridRow";
|
|
2543
2673
|
var [createTreegridRowContext, createTreegridRowScope] = createContextScope2(TREEGRID_ROW_NAME, []);
|
|
2544
2674
|
var [TreegridRowProvider, useTreegridRowContext] = createTreegridRowContext(TREEGRID_ROW_NAME);
|
|
2545
|
-
var
|
|
2546
|
-
var
|
|
2547
|
-
var TreegridRoot =
|
|
2675
|
+
var TREEGRID_PATH_SEPARATOR = "~";
|
|
2676
|
+
var TREEGRID_PARENT_OF_SEPARATOR = " ";
|
|
2677
|
+
var TreegridRoot = composable5(({ asChild, classNames, children, style, gridTemplateColumns, onKeyDown: onKeyDownProp, ...props }, forwardedRef) => {
|
|
2548
2678
|
const { tx } = useThemeContext();
|
|
2549
|
-
const
|
|
2679
|
+
const { className, role: _role, ...rest } = composableProps11(props, {
|
|
2680
|
+
classNames
|
|
2681
|
+
});
|
|
2682
|
+
const Comp = asChild ? Slot16 : Primitive16.div;
|
|
2550
2683
|
const { findFirstFocusable } = useFocusFinders();
|
|
2551
|
-
const handleKeyDown =
|
|
2684
|
+
const handleKeyDown = useCallback7((event) => {
|
|
2552
2685
|
switch (event.key) {
|
|
2553
2686
|
case "ArrowDown":
|
|
2554
2687
|
case "ArrowUp": {
|
|
@@ -2577,14 +2710,15 @@ var TreegridRoot = /* @__PURE__ */ forwardRef24(({ asChild, classNames, children
|
|
|
2577
2710
|
break;
|
|
2578
2711
|
}
|
|
2579
2712
|
}
|
|
2580
|
-
|
|
2713
|
+
onKeyDownProp?.(event);
|
|
2581
2714
|
}, [
|
|
2582
|
-
findFirstFocusable
|
|
2715
|
+
findFirstFocusable,
|
|
2716
|
+
onKeyDownProp
|
|
2583
2717
|
]);
|
|
2584
2718
|
return /* @__PURE__ */ React31.createElement(Comp, {
|
|
2585
2719
|
role: "treegrid",
|
|
2586
|
-
...
|
|
2587
|
-
className: tx("treegrid.root", {},
|
|
2720
|
+
...rest,
|
|
2721
|
+
className: tx("treegrid.root", {}, className),
|
|
2588
2722
|
style: {
|
|
2589
2723
|
...style,
|
|
2590
2724
|
gridTemplateColumns
|
|
@@ -2593,10 +2727,10 @@ var TreegridRoot = /* @__PURE__ */ forwardRef24(({ asChild, classNames, children
|
|
|
2593
2727
|
ref: forwardedRef
|
|
2594
2728
|
}, children);
|
|
2595
2729
|
});
|
|
2596
|
-
var TreegridRow = /* @__PURE__ */
|
|
2730
|
+
var TreegridRow = /* @__PURE__ */ forwardRef19(({ __treegridRowScope, asChild, classNames, children, id, parentOf, open: propsOpen, defaultOpen, onOpenChange: propsOnOpenChange, ...props }, forwardedRef) => {
|
|
2597
2731
|
const { tx } = useThemeContext();
|
|
2598
|
-
const Comp = asChild ?
|
|
2599
|
-
const pathParts = id.split(
|
|
2732
|
+
const Comp = asChild ? Slot16 : Primitive16.div;
|
|
2733
|
+
const pathParts = id.split(TREEGRID_PATH_SEPARATOR);
|
|
2600
2734
|
const level = pathParts.length - 1;
|
|
2601
2735
|
const [open, onOpenChange] = useControllableState3({
|
|
2602
2736
|
prop: propsOpen,
|
|
@@ -2622,7 +2756,7 @@ var TreegridRow = /* @__PURE__ */ forwardRef24(({ __treegridRowScope, asChild, c
|
|
|
2622
2756
|
ref: forwardedRef
|
|
2623
2757
|
}, children));
|
|
2624
2758
|
});
|
|
2625
|
-
var TreegridCell = /* @__PURE__ */
|
|
2759
|
+
var TreegridCell = /* @__PURE__ */ forwardRef19(({ classNames, children, indent, ...props }, forwardedRef) => {
|
|
2626
2760
|
const { tx } = useThemeContext();
|
|
2627
2761
|
return /* @__PURE__ */ React31.createElement("div", {
|
|
2628
2762
|
role: "gridcell",
|
|
@@ -2636,28 +2770,24 @@ var TreegridCell = /* @__PURE__ */ forwardRef24(({ classNames, children, indent,
|
|
|
2636
2770
|
var Treegrid = {
|
|
2637
2771
|
Root: TreegridRoot,
|
|
2638
2772
|
Row: TreegridRow,
|
|
2639
|
-
Cell: TreegridCell
|
|
2640
|
-
PARENT_OF_SEPARATOR,
|
|
2641
|
-
PATH_SEPARATOR,
|
|
2642
|
-
createTreegridRowScope,
|
|
2643
|
-
useTreegridRowContext
|
|
2773
|
+
Cell: TreegridCell
|
|
2644
2774
|
};
|
|
2645
2775
|
|
|
2646
2776
|
// src/components/Main/Main.tsx
|
|
2647
|
-
import { useFocusableGroup } from "@fluentui/react-tabster";
|
|
2648
|
-
import { createContext as
|
|
2777
|
+
import { useFocusableGroup as useFocusableGroup2 } from "@fluentui/react-tabster";
|
|
2778
|
+
import { createContext as createContext8 } from "@radix-ui/react-context";
|
|
2649
2779
|
import { DialogContent as DialogContent2, Root as DialogRoot2, DialogTitle as DialogTitle2 } from "@radix-ui/react-dialog";
|
|
2650
|
-
import { Primitive as
|
|
2651
|
-
import { Slot as
|
|
2780
|
+
import { Primitive as Primitive17 } from "@radix-ui/react-primitive";
|
|
2781
|
+
import { Slot as Slot17 } from "@radix-ui/react-slot";
|
|
2652
2782
|
import { useControllableState as useControllableState4 } from "@radix-ui/react-use-controllable-state";
|
|
2653
|
-
import React32, { forwardRef as
|
|
2783
|
+
import React32, { forwardRef as forwardRef20, useCallback as useCallback9, useEffect as useEffect5, useRef as useRef4, useState as useState8 } from "react";
|
|
2654
2784
|
import { addEventListener } from "@dxos/async";
|
|
2655
2785
|
import { log } from "@dxos/log";
|
|
2656
2786
|
import { useForwardedRef, useMediaQuery } from "@dxos/react-hooks";
|
|
2657
2787
|
import { osTranslations as osTranslations3 } from "@dxos/ui-theme";
|
|
2658
2788
|
|
|
2659
2789
|
// src/components/Main/useSwipeToDismiss.ts
|
|
2660
|
-
import { useCallback as
|
|
2790
|
+
import { useCallback as useCallback8, useEffect as useEffect4, useState as useState7 } from "react";
|
|
2661
2791
|
var useSwipeToDismiss = (ref, {
|
|
2662
2792
|
onDismiss,
|
|
2663
2793
|
dismissThreshold = 64,
|
|
@@ -2666,22 +2796,22 @@ var useSwipeToDismiss = (ref, {
|
|
|
2666
2796
|
/* side = 'inline-start' */
|
|
2667
2797
|
}) => {
|
|
2668
2798
|
const $root = ref.current;
|
|
2669
|
-
const [motionState, setMotionState] =
|
|
2670
|
-
const [gestureStartX, setGestureStartX] =
|
|
2671
|
-
const setIdle =
|
|
2799
|
+
const [motionState, setMotionState] = useState7(0);
|
|
2800
|
+
const [gestureStartX, setGestureStartX] = useState7(0);
|
|
2801
|
+
const setIdle = useCallback8(() => {
|
|
2672
2802
|
setMotionState(0);
|
|
2673
2803
|
$root?.style.removeProperty("inset-inline-start");
|
|
2674
2804
|
$root?.style.setProperty("transition-duration", "200ms");
|
|
2675
2805
|
}, [
|
|
2676
2806
|
$root
|
|
2677
2807
|
]);
|
|
2678
|
-
const setFollowing =
|
|
2808
|
+
const setFollowing = useCallback8(() => {
|
|
2679
2809
|
setMotionState(2);
|
|
2680
2810
|
$root?.style.setProperty("transition-duration", "0ms");
|
|
2681
2811
|
}, [
|
|
2682
2812
|
$root
|
|
2683
2813
|
]);
|
|
2684
|
-
const handlePointerDown =
|
|
2814
|
+
const handlePointerDown = useCallback8(({ screenX }) => {
|
|
2685
2815
|
if (motionState === 0) {
|
|
2686
2816
|
setMotionState(1);
|
|
2687
2817
|
setGestureStartX(screenX);
|
|
@@ -2689,7 +2819,7 @@ var useSwipeToDismiss = (ref, {
|
|
|
2689
2819
|
}, [
|
|
2690
2820
|
motionState
|
|
2691
2821
|
]);
|
|
2692
|
-
const handlePointerMove =
|
|
2822
|
+
const handlePointerMove = useCallback8(({ screenX }) => {
|
|
2693
2823
|
if ($root) {
|
|
2694
2824
|
const delta = Math.min(screenX - gestureStartX, 0);
|
|
2695
2825
|
switch (motionState) {
|
|
@@ -2713,7 +2843,7 @@ var useSwipeToDismiss = (ref, {
|
|
|
2713
2843
|
motionState,
|
|
2714
2844
|
gestureStartX
|
|
2715
2845
|
]);
|
|
2716
|
-
const handlePointerUp =
|
|
2846
|
+
const handlePointerUp = useCallback8(() => {
|
|
2717
2847
|
setIdle();
|
|
2718
2848
|
}, [
|
|
2719
2849
|
setIdle
|
|
@@ -2759,7 +2889,7 @@ var handleOpenAutoFocus = (event) => {
|
|
|
2759
2889
|
};
|
|
2760
2890
|
var landmarkAttr = "data-main-landmark";
|
|
2761
2891
|
var useLandmarkMover = (propsOnKeyDown, landmark) => {
|
|
2762
|
-
const handleKeyDown =
|
|
2892
|
+
const handleKeyDown = useCallback9((event) => {
|
|
2763
2893
|
const target = event.target;
|
|
2764
2894
|
if (event.target === event.currentTarget && event.key === "Tab" && target.hasAttribute(landmarkAttr)) {
|
|
2765
2895
|
event.preventDefault();
|
|
@@ -2773,7 +2903,7 @@ var useLandmarkMover = (propsOnKeyDown, landmark) => {
|
|
|
2773
2903
|
}, [
|
|
2774
2904
|
propsOnKeyDown
|
|
2775
2905
|
]);
|
|
2776
|
-
const focusableGroupAttrs =
|
|
2906
|
+
const focusableGroupAttrs = useFocusableGroup2({
|
|
2777
2907
|
tabBehavior: "limited",
|
|
2778
2908
|
ignoreDefaultKeydown: {
|
|
2779
2909
|
Tab: true
|
|
@@ -2786,25 +2916,15 @@ var useLandmarkMover = (propsOnKeyDown, landmark) => {
|
|
|
2786
2916
|
...focusableGroupAttrs
|
|
2787
2917
|
};
|
|
2788
2918
|
};
|
|
2789
|
-
var [MainProvider, useMainContext] =
|
|
2919
|
+
var [MainProvider, useMainContext] = createContext8(MAIN_NAME, {
|
|
2790
2920
|
resizing: false,
|
|
2791
2921
|
navigationSidebarState: "closed",
|
|
2792
2922
|
setNavigationSidebarState: (_nextState) => {
|
|
2793
|
-
log.warn("Not initialized", void 0, {
|
|
2794
|
-
F: __dxlog_file,
|
|
2795
|
-
L: 111,
|
|
2796
|
-
S: void 0,
|
|
2797
|
-
C: (f, a) => f(...a)
|
|
2798
|
-
});
|
|
2923
|
+
log.warn("Not initialized", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 67, S: void 0 });
|
|
2799
2924
|
},
|
|
2800
2925
|
complementarySidebarState: "closed",
|
|
2801
2926
|
setComplementarySidebarState: (_nextState) => {
|
|
2802
|
-
log.warn("Not initialized", void 0, {
|
|
2803
|
-
F: __dxlog_file,
|
|
2804
|
-
L: 116,
|
|
2805
|
-
S: void 0,
|
|
2806
|
-
C: (f, a) => f(...a)
|
|
2807
|
-
});
|
|
2927
|
+
log.warn("Not initialized", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 71, S: void 0 });
|
|
2808
2928
|
}
|
|
2809
2929
|
});
|
|
2810
2930
|
var useSidebars = (consumerName) => {
|
|
@@ -2812,22 +2932,22 @@ var useSidebars = (consumerName) => {
|
|
|
2812
2932
|
return {
|
|
2813
2933
|
navigationSidebarState,
|
|
2814
2934
|
setNavigationSidebarState,
|
|
2815
|
-
toggleNavigationSidebar:
|
|
2935
|
+
toggleNavigationSidebar: useCallback9(() => setNavigationSidebarState(navigationSidebarState === "expanded" ? "closed" : "expanded"), [
|
|
2816
2936
|
navigationSidebarState,
|
|
2817
2937
|
setNavigationSidebarState
|
|
2818
2938
|
]),
|
|
2819
|
-
openNavigationSidebar:
|
|
2820
|
-
collapseNavigationSidebar:
|
|
2821
|
-
closeNavigationSidebar:
|
|
2939
|
+
openNavigationSidebar: useCallback9(() => setNavigationSidebarState("expanded"), []),
|
|
2940
|
+
collapseNavigationSidebar: useCallback9(() => setNavigationSidebarState("collapsed"), []),
|
|
2941
|
+
closeNavigationSidebar: useCallback9(() => setNavigationSidebarState("closed"), []),
|
|
2822
2942
|
complementarySidebarState,
|
|
2823
2943
|
setComplementarySidebarState,
|
|
2824
|
-
toggleComplementarySidebar:
|
|
2944
|
+
toggleComplementarySidebar: useCallback9(() => setComplementarySidebarState(complementarySidebarState === "expanded" ? "closed" : "expanded"), [
|
|
2825
2945
|
complementarySidebarState,
|
|
2826
2946
|
setComplementarySidebarState
|
|
2827
2947
|
]),
|
|
2828
|
-
openComplementarySidebar:
|
|
2829
|
-
collapseComplementarySidebar:
|
|
2830
|
-
closeComplementarySidebar:
|
|
2948
|
+
openComplementarySidebar: useCallback9(() => setComplementarySidebarState("expanded"), []),
|
|
2949
|
+
collapseComplementarySidebar: useCallback9(() => setComplementarySidebarState("collapsed"), []),
|
|
2950
|
+
closeComplementarySidebar: useCallback9(() => setComplementarySidebarState("closed"), [])
|
|
2831
2951
|
};
|
|
2832
2952
|
};
|
|
2833
2953
|
var MainRoot = ({ navigationSidebarState: propsNavigationSidebarState, defaultNavigationSidebarState = "closed", onNavigationSidebarStateChange, complementarySidebarState: propsComplementarySidebarState, defaultComplementarySidebarState = "closed", onComplementarySidebarStateChange, children, ...props }) => {
|
|
@@ -2842,8 +2962,8 @@ var MainRoot = ({ navigationSidebarState: propsNavigationSidebarState, defaultNa
|
|
|
2842
2962
|
defaultProp: defaultComplementarySidebarState,
|
|
2843
2963
|
onChange: onComplementarySidebarStateChange
|
|
2844
2964
|
});
|
|
2845
|
-
const [resizing, setResizing] =
|
|
2846
|
-
const resizeInterval =
|
|
2965
|
+
const [resizing, setResizing] = useState8(false);
|
|
2966
|
+
const resizeInterval = useRef4(null);
|
|
2847
2967
|
useEffect5(() => addEventListener(window, "resize", () => {
|
|
2848
2968
|
setResizing(true);
|
|
2849
2969
|
if (resizeInterval.current) {
|
|
@@ -2864,7 +2984,7 @@ var MainRoot = ({ navigationSidebarState: propsNavigationSidebarState, defaultNa
|
|
|
2864
2984
|
}, children);
|
|
2865
2985
|
};
|
|
2866
2986
|
MainRoot.displayName = MAIN_ROOT_NAME;
|
|
2867
|
-
var MainOverlay = /* @__PURE__ */
|
|
2987
|
+
var MainOverlay = /* @__PURE__ */ forwardRef20(({ classNames, ...props }, forwardedRef) => {
|
|
2868
2988
|
const [isLg] = useMediaQuery("lg");
|
|
2869
2989
|
const { navigationSidebarState, setNavigationSidebarState, complementarySidebarState, setComplementarySidebarState } = useMainContext(MAIN_OVERLAY_NAME);
|
|
2870
2990
|
const { tx } = useThemeContext();
|
|
@@ -2885,16 +3005,16 @@ var MainOverlay = /* @__PURE__ */ forwardRef25(({ classNames, ...props }, forwar
|
|
|
2885
3005
|
});
|
|
2886
3006
|
});
|
|
2887
3007
|
MainOverlay.displayName = MAIN_OVERLAY_NAME;
|
|
2888
|
-
var MainSidebar = /* @__PURE__ */
|
|
3008
|
+
var MainSidebar = /* @__PURE__ */ forwardRef20(({ classNames, children, swipeToDismiss, onOpenAutoFocus, state, resizing, onStateChange, side, label, ...props }, forwardedRef) => {
|
|
2889
3009
|
const [isLg] = useMediaQuery("lg");
|
|
2890
3010
|
const { tx } = useThemeContext();
|
|
2891
3011
|
const { t } = useTranslation(osTranslations3);
|
|
2892
3012
|
const ref = useForwardedRef(forwardedRef);
|
|
2893
|
-
const noopRef =
|
|
3013
|
+
const noopRef = useRef4(null);
|
|
2894
3014
|
useSwipeToDismiss(swipeToDismiss ? ref : noopRef, {
|
|
2895
3015
|
onDismiss: () => onStateChange?.("closed")
|
|
2896
3016
|
});
|
|
2897
|
-
const handleKeyDown =
|
|
3017
|
+
const handleKeyDown = useCallback9((event) => {
|
|
2898
3018
|
const focusGroupParent = event.target.closest("[data-tabster]");
|
|
2899
3019
|
if (event.key === "Escape" && focusGroupParent) {
|
|
2900
3020
|
event.preventDefault();
|
|
@@ -2905,14 +3025,14 @@ var MainSidebar = /* @__PURE__ */ forwardRef25(({ classNames, children, swipeToD
|
|
|
2905
3025
|
}, [
|
|
2906
3026
|
props.onKeyDown
|
|
2907
3027
|
]);
|
|
2908
|
-
const
|
|
3028
|
+
const Root14 = isLg ? Primitive17.div : DialogContent2;
|
|
2909
3029
|
return /* @__PURE__ */ React32.createElement(DialogRoot2, {
|
|
2910
3030
|
open: state !== "closed",
|
|
2911
3031
|
"aria-label": toLocalizedString(label, t),
|
|
2912
3032
|
modal: false
|
|
2913
3033
|
}, !isLg && /* @__PURE__ */ React32.createElement(DialogTitle2, {
|
|
2914
3034
|
className: "sr-only"
|
|
2915
|
-
}, toLocalizedString(label, t)), /* @__PURE__ */ React32.createElement(
|
|
3035
|
+
}, toLocalizedString(label, t)), /* @__PURE__ */ React32.createElement(Root14, {
|
|
2916
3036
|
...!isLg && {
|
|
2917
3037
|
forceMount: true,
|
|
2918
3038
|
tabIndex: -1,
|
|
@@ -2930,7 +3050,7 @@ var MainSidebar = /* @__PURE__ */ forwardRef25(({ classNames, children, swipeToD
|
|
|
2930
3050
|
ref
|
|
2931
3051
|
}, children));
|
|
2932
3052
|
});
|
|
2933
|
-
var MainNavigationSidebar = /* @__PURE__ */
|
|
3053
|
+
var MainNavigationSidebar = /* @__PURE__ */ forwardRef20((props, forwardedRef) => {
|
|
2934
3054
|
const { navigationSidebarState, setNavigationSidebarState, resizing } = useMainContext(NAVIGATION_SIDEBAR_NAME);
|
|
2935
3055
|
const mover = useLandmarkMover(props.onKeyDown, "0");
|
|
2936
3056
|
return /* @__PURE__ */ React32.createElement(MainSidebar, {
|
|
@@ -2944,7 +3064,7 @@ var MainNavigationSidebar = /* @__PURE__ */ forwardRef25((props, forwardedRef) =
|
|
|
2944
3064
|
});
|
|
2945
3065
|
});
|
|
2946
3066
|
MainNavigationSidebar.displayName = NAVIGATION_SIDEBAR_NAME;
|
|
2947
|
-
var MainComplementarySidebar = /* @__PURE__ */
|
|
3067
|
+
var MainComplementarySidebar = /* @__PURE__ */ forwardRef20((props, forwardedRef) => {
|
|
2948
3068
|
const { complementarySidebarState, setComplementarySidebarState, resizing } = useMainContext(COMPLEMENTARY_SIDEBAR_NAME);
|
|
2949
3069
|
const mover = useLandmarkMover(props.onKeyDown, "2");
|
|
2950
3070
|
return /* @__PURE__ */ React32.createElement(MainSidebar, {
|
|
@@ -2958,17 +3078,17 @@ var MainComplementarySidebar = /* @__PURE__ */ forwardRef25((props, forwardedRef
|
|
|
2958
3078
|
});
|
|
2959
3079
|
});
|
|
2960
3080
|
MainComplementarySidebar.displayName = COMPLEMENTARY_SIDEBAR_NAME;
|
|
2961
|
-
var MainContent = /* @__PURE__ */
|
|
3081
|
+
var MainContent = /* @__PURE__ */ forwardRef20(({ asChild, classNames, bounce, handlesFocus, children, role, ...props }, forwardedRef) => {
|
|
2962
3082
|
const { navigationSidebarState, complementarySidebarState } = useMainContext(MAIN_NAME);
|
|
2963
3083
|
const { tx } = useThemeContext();
|
|
2964
|
-
const Comp = asChild ?
|
|
3084
|
+
const Comp = asChild ? Slot17 : role ? Primitive17.div : "main";
|
|
2965
3085
|
const mover = useLandmarkMover(props.onKeyDown, "1");
|
|
2966
3086
|
return /* @__PURE__ */ React32.createElement(Comp, {
|
|
2967
|
-
role,
|
|
2968
3087
|
...handlesFocus && {
|
|
2969
3088
|
...mover
|
|
2970
3089
|
},
|
|
2971
3090
|
...props,
|
|
3091
|
+
role,
|
|
2972
3092
|
"data-sidebar-left-state": navigationSidebarState,
|
|
2973
3093
|
"data-sidebar-right-state": complementarySidebarState,
|
|
2974
3094
|
"data-handles-focus": handlesFocus,
|
|
@@ -2989,10 +3109,10 @@ var Main = {
|
|
|
2989
3109
|
};
|
|
2990
3110
|
|
|
2991
3111
|
// src/components/Message/Message.tsx
|
|
2992
|
-
import { createContext as
|
|
2993
|
-
import { Primitive as
|
|
2994
|
-
import { Slot as
|
|
2995
|
-
import React33, { forwardRef as
|
|
3112
|
+
import { createContext as createContext9 } from "@radix-ui/react-context";
|
|
3113
|
+
import { Primitive as Primitive18 } from "@radix-ui/react-primitive";
|
|
3114
|
+
import { Slot as Slot18 } from "@radix-ui/react-slot";
|
|
3115
|
+
import React33, { forwardRef as forwardRef21 } from "react";
|
|
2996
3116
|
import { useId as useId3 } from "@dxos/react-hooks";
|
|
2997
3117
|
var messageIcons = {
|
|
2998
3118
|
success: "ph--check-circle--duotone",
|
|
@@ -3002,13 +3122,13 @@ var messageIcons = {
|
|
|
3002
3122
|
neutral: "ph--info--duotone"
|
|
3003
3123
|
};
|
|
3004
3124
|
var MESSAGE_NAME = "Message";
|
|
3005
|
-
var [MessageProvider, useMessageContext] =
|
|
3006
|
-
var MessageRoot = /* @__PURE__ */
|
|
3125
|
+
var [MessageProvider, useMessageContext] = createContext9(MESSAGE_NAME);
|
|
3126
|
+
var MessageRoot = /* @__PURE__ */ forwardRef21(({ asChild, valence = "neutral", elevation: propsElevation, classNames, titleId: propsTitleId, descriptionId: propsDescriptionId, children, ...props }, forwardedRef) => {
|
|
3007
3127
|
const { tx } = useThemeContext();
|
|
3008
3128
|
const titleId = useId3("message__title", propsTitleId);
|
|
3009
3129
|
const descriptionId = useId3("message__description", propsDescriptionId);
|
|
3010
3130
|
const elevation = useElevationContext(propsElevation);
|
|
3011
|
-
const Comp = asChild ?
|
|
3131
|
+
const Comp = asChild ? Slot18 : Primitive18.div;
|
|
3012
3132
|
return /* @__PURE__ */ React33.createElement(MessageProvider, {
|
|
3013
3133
|
titleId,
|
|
3014
3134
|
descriptionId,
|
|
@@ -3027,10 +3147,10 @@ var MessageRoot = /* @__PURE__ */ forwardRef26(({ asChild, valence = "neutral",
|
|
|
3027
3147
|
});
|
|
3028
3148
|
MessageRoot.displayName = MESSAGE_NAME;
|
|
3029
3149
|
var MESSAGE_TITLE_NAME = "MessageTitle";
|
|
3030
|
-
var MessageTitle = /* @__PURE__ */
|
|
3150
|
+
var MessageTitle = /* @__PURE__ */ forwardRef21(({ asChild, classNames, children, icon: iconProp, ...props }, forwardedRef) => {
|
|
3031
3151
|
const { tx } = useThemeContext();
|
|
3032
3152
|
const { titleId, valence } = useMessageContext(MESSAGE_TITLE_NAME);
|
|
3033
|
-
const Comp = asChild ?
|
|
3153
|
+
const Comp = asChild ? Slot18 : Primitive18.h2;
|
|
3034
3154
|
const icon = iconProp ?? messageIcons[valence];
|
|
3035
3155
|
return /* @__PURE__ */ React33.createElement(Comp, {
|
|
3036
3156
|
...props,
|
|
@@ -3038,7 +3158,6 @@ var MessageTitle = /* @__PURE__ */ forwardRef26(({ asChild, classNames, children
|
|
|
3038
3158
|
id: titleId,
|
|
3039
3159
|
ref: forwardedRef
|
|
3040
3160
|
}, !icon && valence === "neutral" ? /* @__PURE__ */ React33.createElement("div", null) : /* @__PURE__ */ React33.createElement(Icon, {
|
|
3041
|
-
size: 5,
|
|
3042
3161
|
icon,
|
|
3043
3162
|
classNames: tx("message.icon", {
|
|
3044
3163
|
valence
|
|
@@ -3049,10 +3168,10 @@ var MessageTitle = /* @__PURE__ */ forwardRef26(({ asChild, classNames, children
|
|
|
3049
3168
|
});
|
|
3050
3169
|
MessageTitle.displayName = MESSAGE_TITLE_NAME;
|
|
3051
3170
|
var MESSAGE_CONTENT_NAME = "MessageContent";
|
|
3052
|
-
var MessageContent = /* @__PURE__ */
|
|
3171
|
+
var MessageContent = /* @__PURE__ */ forwardRef21(({ asChild, classNames, children, ...props }, forwardedRef) => {
|
|
3053
3172
|
const { tx } = useThemeContext();
|
|
3054
3173
|
const { descriptionId } = useMessageContext(MESSAGE_CONTENT_NAME);
|
|
3055
|
-
const Comp = asChild ?
|
|
3174
|
+
const Comp = asChild ? Slot18 : Primitive18.p;
|
|
3056
3175
|
return /* @__PURE__ */ React33.createElement(Comp, {
|
|
3057
3176
|
...props,
|
|
3058
3177
|
className: tx("message.content", {}, classNames),
|
|
@@ -3070,7 +3189,7 @@ var Callout = Message;
|
|
|
3070
3189
|
|
|
3071
3190
|
// src/components/Popover/Popover.tsx
|
|
3072
3191
|
import { composeEventHandlers as composeEventHandlers2 } from "@radix-ui/primitive";
|
|
3073
|
-
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
3192
|
+
import { useComposedRefs as useComposedRefs2 } from "@radix-ui/react-compose-refs";
|
|
3074
3193
|
import { createContextScope as createContextScope3 } from "@radix-ui/react-context";
|
|
3075
3194
|
import { DismissableLayer } from "@radix-ui/react-dismissable-layer";
|
|
3076
3195
|
import { useFocusGuards } from "@radix-ui/react-focus-guards";
|
|
@@ -3080,11 +3199,11 @@ import * as PopperPrimitive from "@radix-ui/react-popper";
|
|
|
3080
3199
|
import { createPopperScope } from "@radix-ui/react-popper";
|
|
3081
3200
|
import { Portal as PortalPrimitive } from "@radix-ui/react-portal";
|
|
3082
3201
|
import { Presence } from "@radix-ui/react-presence";
|
|
3083
|
-
import { Primitive as
|
|
3084
|
-
import { Slot as
|
|
3202
|
+
import { Primitive as Primitive19 } from "@radix-ui/react-primitive";
|
|
3203
|
+
import { Slot as Slot19 } from "@radix-ui/react-slot";
|
|
3085
3204
|
import { useControllableState as useControllableState5 } from "@radix-ui/react-use-controllable-state";
|
|
3086
3205
|
import { hideOthers } from "aria-hidden";
|
|
3087
|
-
import React34, { forwardRef as
|
|
3206
|
+
import React34, { forwardRef as forwardRef22, useCallback as useCallback10, useEffect as useEffect6, useMemo as useMemo5, useRef as useRef5, useState as useState9 } from "react";
|
|
3088
3207
|
import { RemoveScroll } from "react-remove-scroll";
|
|
3089
3208
|
var POPOVER_NAME = "Popover";
|
|
3090
3209
|
var [createPopoverContext, createPopoverScope] = createContextScope3(POPOVER_NAME, [
|
|
@@ -3095,8 +3214,8 @@ var [PopoverProvider, usePopoverContext] = createPopoverContext(POPOVER_NAME);
|
|
|
3095
3214
|
var PopoverRoot = (props) => {
|
|
3096
3215
|
const { __scopePopover, children, open: openProp, defaultOpen, onOpenChange, modal = false } = props;
|
|
3097
3216
|
const popperScope = usePopperScope(__scopePopover);
|
|
3098
|
-
const triggerRef =
|
|
3099
|
-
const [hasCustomAnchor, setHasCustomAnchor] =
|
|
3217
|
+
const triggerRef = useRef5(null);
|
|
3218
|
+
const [hasCustomAnchor, setHasCustomAnchor] = useState9(false);
|
|
3100
3219
|
const [open = false, setOpen] = useControllableState5({
|
|
3101
3220
|
prop: openProp,
|
|
3102
3221
|
defaultProp: defaultOpen,
|
|
@@ -3108,18 +3227,18 @@ var PopoverRoot = (props) => {
|
|
|
3108
3227
|
triggerRef,
|
|
3109
3228
|
open,
|
|
3110
3229
|
onOpenChange: setOpen,
|
|
3111
|
-
onOpenToggle:
|
|
3230
|
+
onOpenToggle: useCallback10(() => setOpen((prevOpen) => !prevOpen), [
|
|
3112
3231
|
setOpen
|
|
3113
3232
|
]),
|
|
3114
3233
|
hasCustomAnchor,
|
|
3115
|
-
onCustomAnchorAdd:
|
|
3116
|
-
onCustomAnchorRemove:
|
|
3234
|
+
onCustomAnchorAdd: useCallback10(() => setHasCustomAnchor(true), []),
|
|
3235
|
+
onCustomAnchorRemove: useCallback10(() => setHasCustomAnchor(false), []),
|
|
3117
3236
|
modal
|
|
3118
3237
|
}, children));
|
|
3119
3238
|
};
|
|
3120
3239
|
PopoverRoot.displayName = POPOVER_NAME;
|
|
3121
3240
|
var ANCHOR_NAME = "PopoverAnchor";
|
|
3122
|
-
var PopoverAnchor = /* @__PURE__ */
|
|
3241
|
+
var PopoverAnchor = /* @__PURE__ */ forwardRef22((props, forwardedRef) => {
|
|
3123
3242
|
const { __scopePopover, ...anchorProps } = props;
|
|
3124
3243
|
const context = usePopoverContext(ANCHOR_NAME, __scopePopover);
|
|
3125
3244
|
const popperScope = usePopperScope(__scopePopover);
|
|
@@ -3139,12 +3258,12 @@ var PopoverAnchor = /* @__PURE__ */ forwardRef27((props, forwardedRef) => {
|
|
|
3139
3258
|
});
|
|
3140
3259
|
PopoverAnchor.displayName = ANCHOR_NAME;
|
|
3141
3260
|
var TRIGGER_NAME2 = "PopoverTrigger";
|
|
3142
|
-
var PopoverTrigger = /* @__PURE__ */
|
|
3261
|
+
var PopoverTrigger = /* @__PURE__ */ forwardRef22((props, forwardedRef) => {
|
|
3143
3262
|
const { __scopePopover, asChild, ...triggerProps } = props;
|
|
3144
3263
|
const context = usePopoverContext(TRIGGER_NAME2, __scopePopover);
|
|
3145
3264
|
const popperScope = usePopperScope(__scopePopover);
|
|
3146
|
-
const composedTriggerRef =
|
|
3147
|
-
const Comp = asChild ?
|
|
3265
|
+
const composedTriggerRef = useComposedRefs2(forwardedRef, context.triggerRef);
|
|
3266
|
+
const Comp = asChild ? Slot19 : Primitive19.button;
|
|
3148
3267
|
const trigger = /* @__PURE__ */ React34.createElement(Comp, {
|
|
3149
3268
|
type: "button",
|
|
3150
3269
|
"aria-haspopup": "dialog",
|
|
@@ -3196,7 +3315,7 @@ var PopoverPortal = (props) => {
|
|
|
3196
3315
|
};
|
|
3197
3316
|
PopoverPortal.displayName = PORTAL_NAME2;
|
|
3198
3317
|
var CONTENT_NAME2 = "PopoverContent";
|
|
3199
|
-
var PopoverContent = /* @__PURE__ */
|
|
3318
|
+
var PopoverContent = /* @__PURE__ */ forwardRef22((props, forwardedRef) => {
|
|
3200
3319
|
const portalContext = usePortalContext(CONTENT_NAME2, props.__scopePopover);
|
|
3201
3320
|
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
3202
3321
|
const context = usePopoverContext(CONTENT_NAME2, props.__scopePopover);
|
|
@@ -3211,11 +3330,11 @@ var PopoverContent = /* @__PURE__ */ forwardRef27((props, forwardedRef) => {
|
|
|
3211
3330
|
}));
|
|
3212
3331
|
});
|
|
3213
3332
|
PopoverContent.displayName = CONTENT_NAME2;
|
|
3214
|
-
var PopoverContentModal = /* @__PURE__ */
|
|
3333
|
+
var PopoverContentModal = /* @__PURE__ */ forwardRef22((props, forwardedRef) => {
|
|
3215
3334
|
const context = usePopoverContext(CONTENT_NAME2, props.__scopePopover);
|
|
3216
|
-
const contentRef =
|
|
3217
|
-
const composedRefs =
|
|
3218
|
-
const isRightClickOutsideRef =
|
|
3335
|
+
const contentRef = useRef5(null);
|
|
3336
|
+
const composedRefs = useComposedRefs2(forwardedRef, contentRef);
|
|
3337
|
+
const isRightClickOutsideRef = useRef5(false);
|
|
3219
3338
|
useEffect6(() => {
|
|
3220
3339
|
const content = contentRef.current;
|
|
3221
3340
|
if (content) {
|
|
@@ -3223,7 +3342,7 @@ var PopoverContentModal = /* @__PURE__ */ forwardRef27((props, forwardedRef) =>
|
|
|
3223
3342
|
}
|
|
3224
3343
|
}, []);
|
|
3225
3344
|
return /* @__PURE__ */ React34.createElement(RemoveScroll, {
|
|
3226
|
-
as:
|
|
3345
|
+
as: Slot19,
|
|
3227
3346
|
allowPinchZoom: true
|
|
3228
3347
|
}, /* @__PURE__ */ React34.createElement(PopoverContentImpl, {
|
|
3229
3348
|
...props,
|
|
@@ -3252,10 +3371,10 @@ var PopoverContentModal = /* @__PURE__ */ forwardRef27((props, forwardedRef) =>
|
|
|
3252
3371
|
})
|
|
3253
3372
|
}));
|
|
3254
3373
|
});
|
|
3255
|
-
var PopoverContentNonModal = /* @__PURE__ */
|
|
3374
|
+
var PopoverContentNonModal = /* @__PURE__ */ forwardRef22((props, forwardedRef) => {
|
|
3256
3375
|
const context = usePopoverContext(CONTENT_NAME2, props.__scopePopover);
|
|
3257
|
-
const hasInteractedOutsideRef =
|
|
3258
|
-
const hasPointerDownOutsideRef =
|
|
3376
|
+
const hasInteractedOutsideRef = useRef5(false);
|
|
3377
|
+
const hasPointerDownOutsideRef = useRef5(false);
|
|
3259
3378
|
return /* @__PURE__ */ React34.createElement(PopoverContentImpl, {
|
|
3260
3379
|
...props,
|
|
3261
3380
|
ref: forwardedRef,
|
|
@@ -3291,7 +3410,7 @@ var PopoverContentNonModal = /* @__PURE__ */ forwardRef27((props, forwardedRef)
|
|
|
3291
3410
|
}
|
|
3292
3411
|
});
|
|
3293
3412
|
});
|
|
3294
|
-
var PopoverContentImpl = /* @__PURE__ */
|
|
3413
|
+
var PopoverContentImpl = /* @__PURE__ */ forwardRef22((props, forwardedRef) => {
|
|
3295
3414
|
const { __scopePopover, trapFocus, onOpenAutoFocus, onCloseAutoFocus, disableOutsidePointerEvents, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, collisionPadding = 8, collisionBoundary, classNames, ...contentProps } = props;
|
|
3296
3415
|
const context = usePopoverContext(CONTENT_NAME2, __scopePopover);
|
|
3297
3416
|
const popperScope = usePopperScope(__scopePopover);
|
|
@@ -3299,7 +3418,7 @@ var PopoverContentImpl = /* @__PURE__ */ forwardRef27((props, forwardedRef) => {
|
|
|
3299
3418
|
const elevation = useElevationContext();
|
|
3300
3419
|
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
3301
3420
|
useFocusGuards();
|
|
3302
|
-
const computedCollisionBoundary =
|
|
3421
|
+
const computedCollisionBoundary = useMemo5(() => {
|
|
3303
3422
|
const closestBoundary = context.triggerRef.current?.closest("[data-popover-collision-boundary]");
|
|
3304
3423
|
return closestBoundary ? Array.isArray(collisionBoundary) ? [
|
|
3305
3424
|
closestBoundary,
|
|
@@ -3355,10 +3474,10 @@ var PopoverContentImpl = /* @__PURE__ */ forwardRef27((props, forwardedRef) => {
|
|
|
3355
3474
|
})));
|
|
3356
3475
|
});
|
|
3357
3476
|
var CLOSE_NAME = "PopoverClose";
|
|
3358
|
-
var PopoverClose = /* @__PURE__ */
|
|
3477
|
+
var PopoverClose = /* @__PURE__ */ forwardRef22((props, forwardedRef) => {
|
|
3359
3478
|
const { __scopePopover, ...closeProps } = props;
|
|
3360
3479
|
const context = usePopoverContext(CLOSE_NAME, __scopePopover);
|
|
3361
|
-
return /* @__PURE__ */ React34.createElement(
|
|
3480
|
+
return /* @__PURE__ */ React34.createElement(Primitive19.button, {
|
|
3362
3481
|
type: "button",
|
|
3363
3482
|
...closeProps,
|
|
3364
3483
|
ref: forwardedRef,
|
|
@@ -3367,7 +3486,7 @@ var PopoverClose = /* @__PURE__ */ forwardRef27((props, forwardedRef) => {
|
|
|
3367
3486
|
});
|
|
3368
3487
|
PopoverClose.displayName = CLOSE_NAME;
|
|
3369
3488
|
var ARROW_NAME2 = "PopoverArrow";
|
|
3370
|
-
var PopoverArrow = /* @__PURE__ */
|
|
3489
|
+
var PopoverArrow = /* @__PURE__ */ forwardRef22((props, forwardedRef) => {
|
|
3371
3490
|
const { __scopePopover, classNames, ...arrowProps } = props;
|
|
3372
3491
|
const popperScope = usePopperScope(__scopePopover);
|
|
3373
3492
|
const { tx } = useThemeContext();
|
|
@@ -3379,9 +3498,9 @@ var PopoverArrow = /* @__PURE__ */ forwardRef27((props, forwardedRef) => {
|
|
|
3379
3498
|
});
|
|
3380
3499
|
});
|
|
3381
3500
|
PopoverArrow.displayName = ARROW_NAME2;
|
|
3382
|
-
var PopoverViewport = /* @__PURE__ */
|
|
3501
|
+
var PopoverViewport = /* @__PURE__ */ forwardRef22(({ classNames, asChild, constrainInline = true, constrainBlock = true, children, ...props }, forwardedRef) => {
|
|
3383
3502
|
const { tx } = useThemeContext();
|
|
3384
|
-
const Comp = asChild ?
|
|
3503
|
+
const Comp = asChild ? Slot19 : Primitive19.div;
|
|
3385
3504
|
return /* @__PURE__ */ React34.createElement(Comp, {
|
|
3386
3505
|
...props,
|
|
3387
3506
|
className: tx("popover.viewport", {
|
|
@@ -3405,8 +3524,8 @@ var Popover = {
|
|
|
3405
3524
|
};
|
|
3406
3525
|
|
|
3407
3526
|
// src/components/Status/Status.tsx
|
|
3408
|
-
import React35, { forwardRef as
|
|
3409
|
-
var Status = /* @__PURE__ */
|
|
3527
|
+
import React35, { forwardRef as forwardRef23 } from "react";
|
|
3528
|
+
var Status = /* @__PURE__ */ forwardRef23(({ classNames, children, progress = 0, indeterminate, variant, ...props }, forwardedRef) => {
|
|
3410
3529
|
const { tx } = useThemeContext();
|
|
3411
3530
|
return /* @__PURE__ */ React35.createElement("span", {
|
|
3412
3531
|
role: "status",
|
|
@@ -3431,26 +3550,33 @@ var Status = /* @__PURE__ */ forwardRef28(({ classNames, children, progress = 0,
|
|
|
3431
3550
|
});
|
|
3432
3551
|
|
|
3433
3552
|
// src/components/ScrollArea/ScrollArea.tsx
|
|
3434
|
-
import { createContext as
|
|
3435
|
-
import { Primitive as
|
|
3436
|
-
import { Slot as
|
|
3437
|
-
import React36, {
|
|
3438
|
-
import { composableProps as
|
|
3553
|
+
import { createContext as createContext10 } from "@radix-ui/react-context";
|
|
3554
|
+
import { Primitive as Primitive20 } from "@radix-ui/react-primitive";
|
|
3555
|
+
import { Slot as Slot20 } from "@radix-ui/react-slot";
|
|
3556
|
+
import React36, { useMemo as useMemo6 } from "react";
|
|
3557
|
+
import { composableProps as composableProps12, scrollbar, slottable as slottable9 } from "@dxos/ui-theme";
|
|
3439
3558
|
var SCROLLAREA_NAME = "ScrollArea";
|
|
3440
|
-
var [ScrollAreaProvider, useScrollAreaContext] =
|
|
3559
|
+
var [ScrollAreaProvider, useScrollAreaContext] = createContext10(SCROLLAREA_NAME);
|
|
3441
3560
|
var SCROLLAREA_ROOT_NAME = "ScrollArea.Root";
|
|
3442
|
-
var ScrollAreaRoot =
|
|
3443
|
-
const { className, ...rest } = composableProps8(props);
|
|
3444
|
-
const Comp = asChild ? Slot17 : Primitive17.div;
|
|
3561
|
+
var ScrollAreaRoot = slottable9(({ children, asChild, orientation = "vertical", autoHide = true, centered = false, padding = false, thin = false, snap = false, ...props }, forwardedRef) => {
|
|
3445
3562
|
const { tx } = useThemeContext();
|
|
3446
|
-
const
|
|
3563
|
+
const { className, ...rest } = composableProps12(props);
|
|
3564
|
+
const Comp = asChild ? Slot20 : Primitive20.div;
|
|
3565
|
+
const options = useMemo6(() => ({
|
|
3447
3566
|
orientation,
|
|
3448
3567
|
autoHide,
|
|
3449
|
-
|
|
3568
|
+
centered,
|
|
3450
3569
|
padding,
|
|
3451
3570
|
thin,
|
|
3452
3571
|
snap
|
|
3453
|
-
}
|
|
3572
|
+
}), [
|
|
3573
|
+
orientation,
|
|
3574
|
+
autoHide,
|
|
3575
|
+
centered,
|
|
3576
|
+
padding,
|
|
3577
|
+
thin,
|
|
3578
|
+
snap
|
|
3579
|
+
]);
|
|
3454
3580
|
return /* @__PURE__ */ React36.createElement(ScrollAreaProvider, options, /* @__PURE__ */ React36.createElement(Comp, {
|
|
3455
3581
|
...rest,
|
|
3456
3582
|
className: tx("scrollArea.root", options, className),
|
|
@@ -3459,12 +3585,21 @@ var ScrollAreaRoot = /* @__PURE__ */ forwardRef29(({ children, asChild, orientat
|
|
|
3459
3585
|
});
|
|
3460
3586
|
ScrollAreaRoot.displayName = SCROLLAREA_ROOT_NAME;
|
|
3461
3587
|
var SCROLLAREA_VIEWPORT_NAME = "ScrollArea.Viewport";
|
|
3462
|
-
var ScrollAreaViewport =
|
|
3588
|
+
var ScrollAreaViewport = slottable9(({ children, asChild, ...props }, forwardedRef) => {
|
|
3463
3589
|
const { tx } = useThemeContext();
|
|
3464
3590
|
const options = useScrollAreaContext(SCROLLAREA_VIEWPORT_NAME);
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3591
|
+
const density = options.thin ? scrollbar.thin : scrollbar.coarse;
|
|
3592
|
+
const { className, ...rest } = composableProps12(props);
|
|
3593
|
+
const { style, ...restWithoutStyle } = rest;
|
|
3594
|
+
const Comp = asChild ? Slot20 : Primitive20.div;
|
|
3595
|
+
return /* @__PURE__ */ React36.createElement(Comp, {
|
|
3596
|
+
...restWithoutStyle,
|
|
3597
|
+
style: {
|
|
3598
|
+
"--scroll-width": `${density.size}px`,
|
|
3599
|
+
"--scroll-padding": `${density.padding}px`,
|
|
3600
|
+
...style
|
|
3601
|
+
},
|
|
3602
|
+
className: tx("scrollArea.viewport", options, className),
|
|
3468
3603
|
ref: forwardedRef
|
|
3469
3604
|
}, children);
|
|
3470
3605
|
});
|
|
@@ -3475,161 +3610,204 @@ var ScrollArea = {
|
|
|
3475
3610
|
};
|
|
3476
3611
|
|
|
3477
3612
|
// src/components/ScrollContainer/ScrollContainer.tsx
|
|
3478
|
-
import { createContext as
|
|
3479
|
-
import React37, { forwardRef as
|
|
3613
|
+
import { createContext as createContext11 } from "@radix-ui/react-context";
|
|
3614
|
+
import React37, { forwardRef as forwardRef24, useCallback as useCallback11, useEffect as useEffect7, useImperativeHandle, useMemo as useMemo7, useRef as useRef6, useState as useState10 } from "react";
|
|
3480
3615
|
import { addEventListener as addEventListener2, combine } from "@dxos/async";
|
|
3481
3616
|
import { invariant } from "@dxos/invariant";
|
|
3482
|
-
import {
|
|
3483
|
-
import {
|
|
3617
|
+
import { useMergeRefs } from "@dxos/react-hooks";
|
|
3618
|
+
import { composable as composable6, composableProps as composableProps13, slottable as slottable10 } from "@dxos/ui-theme";
|
|
3619
|
+
import { mx as mx9 } from "@dxos/ui-theme";
|
|
3484
3620
|
var __dxlog_file2 = "/__w/dxos/dxos/packages/ui/react-ui/src/components/ScrollContainer/ScrollContainer.tsx";
|
|
3485
3621
|
var isBottom = (el) => {
|
|
3486
3622
|
return !!(el && el.scrollHeight - el.scrollTop === el.clientHeight);
|
|
3487
3623
|
};
|
|
3488
|
-
var [ScrollContainerProvider, useScrollContainerContext] =
|
|
3489
|
-
var
|
|
3490
|
-
const scrollerRef =
|
|
3491
|
-
const autoScrollRef =
|
|
3492
|
-
const [
|
|
3493
|
-
const [
|
|
3494
|
-
const timeoutRef =
|
|
3495
|
-
const scrollToBottom =
|
|
3624
|
+
var [ScrollContainerProvider, useScrollContainerContext] = createContext11("ScrollContainer");
|
|
3625
|
+
var Root10 = /* @__PURE__ */ forwardRef24(({ children, pin, behavior: behaviorProp = "smooth" }, forwardedRef) => {
|
|
3626
|
+
const scrollerRef = useRef6(null);
|
|
3627
|
+
const autoScrollRef = useRef6(false);
|
|
3628
|
+
const [pinned, setPinned] = useState10(pin);
|
|
3629
|
+
const [overflow, setOverflow] = useState10(false);
|
|
3630
|
+
const timeoutRef = useRef6(void 0);
|
|
3631
|
+
const scrollToBottom = useCallback11((behavior = behaviorProp) => {
|
|
3496
3632
|
if (scrollerRef.current) {
|
|
3497
|
-
autoScrollRef.current = true;
|
|
3498
|
-
scrollerRef.current.classList.add("scrollbar-none");
|
|
3499
|
-
scrollerRef.current.scrollTo({
|
|
3500
|
-
top: scrollerRef.current.scrollHeight,
|
|
3501
|
-
behavior
|
|
3502
|
-
});
|
|
3503
|
-
clearTimeout(timeoutRef.current);
|
|
3504
3633
|
if (behavior !== "instant") {
|
|
3634
|
+
autoScrollRef.current = true;
|
|
3635
|
+
scrollerRef.current.classList.add("scrollbar-none");
|
|
3636
|
+
clearTimeout(timeoutRef.current);
|
|
3505
3637
|
timeoutRef.current = setTimeout(() => {
|
|
3506
3638
|
scrollerRef.current?.classList.remove("scrollbar-none");
|
|
3507
3639
|
autoScrollRef.current = false;
|
|
3508
3640
|
}, 500);
|
|
3509
3641
|
}
|
|
3642
|
+
scrollerRef.current.scrollTo({
|
|
3643
|
+
top: scrollerRef.current.scrollHeight,
|
|
3644
|
+
behavior
|
|
3645
|
+
});
|
|
3510
3646
|
setPinned(true);
|
|
3511
3647
|
}
|
|
3512
|
-
}, [
|
|
3513
|
-
|
|
3514
|
-
|
|
3648
|
+
}, [
|
|
3649
|
+
behaviorProp
|
|
3650
|
+
]);
|
|
3651
|
+
const controller = useMemo7(() => ({
|
|
3652
|
+
get viewport() {
|
|
3653
|
+
return scrollerRef.current;
|
|
3654
|
+
},
|
|
3515
3655
|
scrollToTop: () => {
|
|
3516
|
-
invariant(scrollerRef.current, void 0, {
|
|
3517
|
-
F: __dxlog_file2,
|
|
3518
|
-
L: 95,
|
|
3519
|
-
S: void 0,
|
|
3520
|
-
A: [
|
|
3521
|
-
"scrollerRef.current",
|
|
3522
|
-
""
|
|
3523
|
-
]
|
|
3524
|
-
});
|
|
3656
|
+
invariant(scrollerRef.current, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 54, S: void 0, A: ["scrollerRef.current", ""] });
|
|
3525
3657
|
scrollerRef.current.scrollTo({
|
|
3526
3658
|
top: 0,
|
|
3527
3659
|
behavior: "smooth"
|
|
3528
3660
|
});
|
|
3529
3661
|
setPinned(false);
|
|
3530
3662
|
},
|
|
3531
|
-
scrollToBottom: () => {
|
|
3532
|
-
scrollToBottom(
|
|
3663
|
+
scrollToBottom: (behavior = "smooth") => {
|
|
3664
|
+
scrollToBottom(behavior);
|
|
3533
3665
|
}
|
|
3534
3666
|
}), [
|
|
3535
|
-
scrollToBottom
|
|
3536
|
-
scrollerRef.current
|
|
3667
|
+
scrollToBottom
|
|
3537
3668
|
]);
|
|
3538
3669
|
useImperativeHandle(forwardedRef, () => controller, [
|
|
3539
3670
|
controller
|
|
3540
3671
|
]);
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
return;
|
|
3544
|
-
}
|
|
3545
|
-
return combine(
|
|
3546
|
-
// Check if user scrolls.
|
|
3547
|
-
addEventListener2(scrollerRef.current, "wheel", () => {
|
|
3548
|
-
setPinned(isBottom(scrollerRef.current));
|
|
3549
|
-
}),
|
|
3550
|
-
// Check if scrolls.
|
|
3551
|
-
addEventListener2(scrollerRef.current, "scroll", () => {
|
|
3552
|
-
setOverflow((scrollerRef.current?.scrollTop ?? 0) > 0);
|
|
3553
|
-
})
|
|
3554
|
-
);
|
|
3672
|
+
const setViewport = useCallback11((el) => {
|
|
3673
|
+
scrollerRef.current = el;
|
|
3555
3674
|
}, []);
|
|
3556
3675
|
return /* @__PURE__ */ React37.createElement(ScrollContainerProvider, {
|
|
3557
3676
|
pinned,
|
|
3677
|
+
overflow,
|
|
3558
3678
|
controller,
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
},
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
},
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
});
|
|
3578
|
-
Root6.displayName = "ScrollContainer.Root";
|
|
3679
|
+
setViewport,
|
|
3680
|
+
setPinned,
|
|
3681
|
+
setOverflow
|
|
3682
|
+
}, children);
|
|
3683
|
+
});
|
|
3684
|
+
Root10.displayName = "ScrollContainer.Root";
|
|
3685
|
+
var Content6 = composable6(({ children, thin, padding, centered, ...props }, forwardedRef) => {
|
|
3686
|
+
return /* @__PURE__ */ React37.createElement(ScrollArea.Root, {
|
|
3687
|
+
...composableProps13(props, {
|
|
3688
|
+
classNames: "relative"
|
|
3689
|
+
}),
|
|
3690
|
+
thin,
|
|
3691
|
+
padding,
|
|
3692
|
+
centered,
|
|
3693
|
+
ref: forwardedRef
|
|
3694
|
+
}, children);
|
|
3695
|
+
});
|
|
3696
|
+
Content6.displayName = "ScrollContainer.Content";
|
|
3579
3697
|
var VIEWPORT_NAME = "ScrollContainer.Viewport";
|
|
3580
|
-
var Viewport =
|
|
3581
|
-
const
|
|
3582
|
-
const
|
|
3698
|
+
var Viewport = slottable10(({ children, asChild, ...props }, forwardedRef) => {
|
|
3699
|
+
const scrollerRef = useRef6(null);
|
|
3700
|
+
const mergedRef = useMergeRefs([
|
|
3701
|
+
forwardedRef,
|
|
3702
|
+
scrollerRef
|
|
3703
|
+
]);
|
|
3704
|
+
const { setViewport, setPinned, setOverflow } = useScrollContainerContext(VIEWPORT_NAME);
|
|
3583
3705
|
useEffect7(() => {
|
|
3584
|
-
|
|
3706
|
+
const el = scrollerRef.current;
|
|
3707
|
+
if (!el) {
|
|
3585
3708
|
return;
|
|
3586
3709
|
}
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
resizeObserver.observe(contentRef.current);
|
|
3590
|
-
return () => resizeObserver.disconnect();
|
|
3710
|
+
setViewport(el);
|
|
3711
|
+
return combine(addEventListener2(el, "wheel", () => setPinned(isBottom(el))), addEventListener2(el, "scroll", () => setOverflow((el.scrollTop ?? 0) > 0)), () => setViewport(null));
|
|
3591
3712
|
}, [
|
|
3592
|
-
|
|
3593
|
-
|
|
3713
|
+
setViewport,
|
|
3714
|
+
setPinned,
|
|
3715
|
+
setOverflow
|
|
3594
3716
|
]);
|
|
3595
|
-
return /* @__PURE__ */ React37.createElement(
|
|
3596
|
-
|
|
3597
|
-
...props,
|
|
3598
|
-
ref:
|
|
3599
|
-
}, children)
|
|
3717
|
+
return /* @__PURE__ */ React37.createElement(React37.Fragment, null, /* @__PURE__ */ React37.createElement(ScrollArea.Viewport, {
|
|
3718
|
+
asChild,
|
|
3719
|
+
...composableProps13(props),
|
|
3720
|
+
ref: mergedRef
|
|
3721
|
+
}, children), /* @__PURE__ */ React37.createElement(PinEffect, {
|
|
3722
|
+
scrollerRef
|
|
3723
|
+
}));
|
|
3600
3724
|
});
|
|
3601
3725
|
Viewport.displayName = VIEWPORT_NAME;
|
|
3726
|
+
var PIN_EFFECT_NAME = "ScrollContainer.PinEffect";
|
|
3727
|
+
var PinEffect = ({ scrollerRef }) => {
|
|
3728
|
+
const { pinned, controller } = useScrollContainerContext(PIN_EFFECT_NAME);
|
|
3729
|
+
useEffect7(() => {
|
|
3730
|
+
const viewport = scrollerRef.current;
|
|
3731
|
+
if (!pinned || !viewport) {
|
|
3732
|
+
return;
|
|
3733
|
+
}
|
|
3734
|
+
controller?.scrollToBottom("instant");
|
|
3735
|
+
const resizeObserver = new ResizeObserver(() => controller?.scrollToBottom("smooth"));
|
|
3736
|
+
Array.from(viewport.children).forEach((child) => {
|
|
3737
|
+
resizeObserver.observe(child);
|
|
3738
|
+
});
|
|
3739
|
+
const mutationObserver = new MutationObserver((mutations) => {
|
|
3740
|
+
mutations.forEach((mutation) => {
|
|
3741
|
+
mutation.addedNodes.forEach((node) => {
|
|
3742
|
+
if (node instanceof Element) {
|
|
3743
|
+
resizeObserver.observe(node);
|
|
3744
|
+
}
|
|
3745
|
+
});
|
|
3746
|
+
});
|
|
3747
|
+
controller?.scrollToBottom("smooth");
|
|
3748
|
+
});
|
|
3749
|
+
mutationObserver.observe(viewport, {
|
|
3750
|
+
childList: true
|
|
3751
|
+
});
|
|
3752
|
+
return () => {
|
|
3753
|
+
resizeObserver.disconnect();
|
|
3754
|
+
mutationObserver.disconnect();
|
|
3755
|
+
};
|
|
3756
|
+
}, [
|
|
3757
|
+
pinned,
|
|
3758
|
+
controller,
|
|
3759
|
+
scrollerRef
|
|
3760
|
+
]);
|
|
3761
|
+
return null;
|
|
3762
|
+
};
|
|
3763
|
+
var FADE_NAME = "ScrollContainer.Fade";
|
|
3764
|
+
var Fade = () => {
|
|
3765
|
+
const { overflow } = useScrollContainerContext(FADE_NAME);
|
|
3766
|
+
return /* @__PURE__ */ React37.createElement("div", {
|
|
3767
|
+
role: "none",
|
|
3768
|
+
"data-visible": overflow,
|
|
3769
|
+
className: mx9(
|
|
3770
|
+
// NOTE: Gradients may not be visible with dark reader extensions.
|
|
3771
|
+
"z-10 absolute top-0 inset-x-0 h-24 w-full",
|
|
3772
|
+
'opacity-0 duration-200 transition-opacity data-[visible="true"]:opacity-100',
|
|
3773
|
+
"bg-gradient-to-b from-(--surface-bg) to-transparent pointer-events-none"
|
|
3774
|
+
)
|
|
3775
|
+
});
|
|
3776
|
+
};
|
|
3777
|
+
Fade.displayName = FADE_NAME;
|
|
3602
3778
|
var SCROLL_DOWN_BUTTON_NAME = "ScrollContainer.ScrollDownButton";
|
|
3603
3779
|
var ScrollDownButton = ({ classNames }) => {
|
|
3604
|
-
const { pinned,
|
|
3780
|
+
const { pinned, controller } = useScrollContainerContext(SCROLL_DOWN_BUTTON_NAME);
|
|
3605
3781
|
return /* @__PURE__ */ React37.createElement("div", {
|
|
3606
3782
|
role: "none",
|
|
3607
|
-
className:
|
|
3783
|
+
className: mx9("absolute bottom-2 right-4 opacity-100 transition-opacity duration-300", pinned && "opacity-0", classNames)
|
|
3608
3784
|
}, /* @__PURE__ */ React37.createElement(IconButton, {
|
|
3609
3785
|
variant: "primary",
|
|
3610
3786
|
icon: "ph--arrow-down--regular",
|
|
3611
3787
|
iconOnly: true,
|
|
3612
3788
|
size: 4,
|
|
3613
3789
|
label: "Scroll down",
|
|
3614
|
-
onClick: () => scrollToBottom()
|
|
3790
|
+
onClick: () => controller?.scrollToBottom()
|
|
3615
3791
|
}));
|
|
3616
3792
|
};
|
|
3617
3793
|
ScrollDownButton.displayName = SCROLL_DOWN_BUTTON_NAME;
|
|
3618
3794
|
var ScrollContainer = {
|
|
3619
|
-
Root:
|
|
3795
|
+
Root: Root10,
|
|
3796
|
+
Content: Content6,
|
|
3620
3797
|
Viewport,
|
|
3798
|
+
Fade,
|
|
3621
3799
|
ScrollDownButton
|
|
3622
3800
|
};
|
|
3623
3801
|
|
|
3624
3802
|
// src/components/Select/Select.tsx
|
|
3625
3803
|
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
3626
|
-
import React38, { forwardRef as
|
|
3804
|
+
import React38, { forwardRef as forwardRef25 } from "react";
|
|
3627
3805
|
var SelectRoot = SelectPrimitive.Root;
|
|
3628
3806
|
var SelectTrigger = SelectPrimitive.Trigger;
|
|
3629
3807
|
var SelectValue = SelectPrimitive.Value;
|
|
3630
3808
|
var SelectIcon = SelectPrimitive.Icon;
|
|
3631
3809
|
var SelectPortal = SelectPrimitive.Portal;
|
|
3632
|
-
var SelectTriggerButton = /* @__PURE__ */
|
|
3810
|
+
var SelectTriggerButton = /* @__PURE__ */ forwardRef25(({ children, placeholder, ...props }, forwardedRef) => {
|
|
3633
3811
|
return /* @__PURE__ */ React38.createElement(SelectPrimitive.Trigger, {
|
|
3634
3812
|
asChild: true,
|
|
3635
3813
|
ref: forwardedRef
|
|
@@ -3644,7 +3822,7 @@ var SelectTriggerButton = /* @__PURE__ */ forwardRef31(({ children, placeholder,
|
|
|
3644
3822
|
icon: "ph--caret-down--bold"
|
|
3645
3823
|
}))));
|
|
3646
3824
|
});
|
|
3647
|
-
var SelectContent = /* @__PURE__ */
|
|
3825
|
+
var SelectContent = /* @__PURE__ */ forwardRef25(({ classNames, children, collisionPadding = 8, ...props }, forwardedRef) => {
|
|
3648
3826
|
const { tx } = useThemeContext();
|
|
3649
3827
|
const elevation = useElevationContext();
|
|
3650
3828
|
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
@@ -3659,7 +3837,7 @@ var SelectContent = /* @__PURE__ */ forwardRef31(({ classNames, children, collis
|
|
|
3659
3837
|
ref: forwardedRef
|
|
3660
3838
|
}, children);
|
|
3661
3839
|
});
|
|
3662
|
-
var SelectScrollUpButton2 = /* @__PURE__ */
|
|
3840
|
+
var SelectScrollUpButton2 = /* @__PURE__ */ forwardRef25(({ classNames, children, ...props }, forwardedRef) => {
|
|
3663
3841
|
const { tx } = useThemeContext();
|
|
3664
3842
|
return /* @__PURE__ */ React38.createElement(SelectPrimitive.SelectScrollUpButton, {
|
|
3665
3843
|
...props,
|
|
@@ -3670,7 +3848,7 @@ var SelectScrollUpButton2 = /* @__PURE__ */ forwardRef31(({ classNames, children
|
|
|
3670
3848
|
icon: "ph--caret-up--bold"
|
|
3671
3849
|
}));
|
|
3672
3850
|
});
|
|
3673
|
-
var SelectScrollDownButton2 = /* @__PURE__ */
|
|
3851
|
+
var SelectScrollDownButton2 = /* @__PURE__ */ forwardRef25(({ classNames, children, ...props }, forwardedRef) => {
|
|
3674
3852
|
const { tx } = useThemeContext();
|
|
3675
3853
|
return /* @__PURE__ */ React38.createElement(SelectPrimitive.SelectScrollDownButton, {
|
|
3676
3854
|
...props,
|
|
@@ -3681,7 +3859,7 @@ var SelectScrollDownButton2 = /* @__PURE__ */ forwardRef31(({ classNames, childr
|
|
|
3681
3859
|
icon: "ph--caret-down--bold"
|
|
3682
3860
|
}));
|
|
3683
3861
|
});
|
|
3684
|
-
var SelectViewport2 = /* @__PURE__ */
|
|
3862
|
+
var SelectViewport2 = /* @__PURE__ */ forwardRef25(({ classNames, children, ...props }, forwardedRef) => {
|
|
3685
3863
|
const { tx } = useThemeContext();
|
|
3686
3864
|
return /* @__PURE__ */ React38.createElement(SelectPrimitive.SelectViewport, {
|
|
3687
3865
|
...props,
|
|
@@ -3689,7 +3867,7 @@ var SelectViewport2 = /* @__PURE__ */ forwardRef31(({ classNames, children, ...p
|
|
|
3689
3867
|
ref: forwardedRef
|
|
3690
3868
|
}, children);
|
|
3691
3869
|
});
|
|
3692
|
-
var SelectItem = /* @__PURE__ */
|
|
3870
|
+
var SelectItem = /* @__PURE__ */ forwardRef25(({ classNames, ...props }, forwardedRef) => {
|
|
3693
3871
|
const { tx } = useThemeContext();
|
|
3694
3872
|
return /* @__PURE__ */ React38.createElement(SelectPrimitive.Item, {
|
|
3695
3873
|
...props,
|
|
@@ -3698,7 +3876,7 @@ var SelectItem = /* @__PURE__ */ forwardRef31(({ classNames, ...props }, forward
|
|
|
3698
3876
|
});
|
|
3699
3877
|
});
|
|
3700
3878
|
var SelectItemText = SelectPrimitive.ItemText;
|
|
3701
|
-
var SelectItemIndicator = /* @__PURE__ */
|
|
3879
|
+
var SelectItemIndicator = /* @__PURE__ */ forwardRef25(({ classNames, children, ...props }, forwardedRef) => {
|
|
3702
3880
|
const { tx } = useThemeContext();
|
|
3703
3881
|
return /* @__PURE__ */ React38.createElement(SelectPrimitive.ItemIndicator, {
|
|
3704
3882
|
...props,
|
|
@@ -3706,7 +3884,7 @@ var SelectItemIndicator = /* @__PURE__ */ forwardRef31(({ classNames, children,
|
|
|
3706
3884
|
ref: forwardedRef
|
|
3707
3885
|
}, children);
|
|
3708
3886
|
});
|
|
3709
|
-
var SelectOption = /* @__PURE__ */
|
|
3887
|
+
var SelectOption = /* @__PURE__ */ forwardRef25(({ children, classNames, ...props }, forwardedRef) => {
|
|
3710
3888
|
const { tx } = useThemeContext();
|
|
3711
3889
|
return /* @__PURE__ */ React38.createElement(SelectPrimitive.Item, {
|
|
3712
3890
|
...props,
|
|
@@ -3720,7 +3898,7 @@ var SelectOption = /* @__PURE__ */ forwardRef31(({ children, classNames, ...prop
|
|
|
3720
3898
|
});
|
|
3721
3899
|
var SelectGroup = SelectPrimitive.Group;
|
|
3722
3900
|
var SelectLabel = SelectPrimitive.Label;
|
|
3723
|
-
var SelectSeparator = /* @__PURE__ */
|
|
3901
|
+
var SelectSeparator = /* @__PURE__ */ forwardRef25(({ classNames, ...props }, forwardedRef) => {
|
|
3724
3902
|
const { tx } = useThemeContext();
|
|
3725
3903
|
return /* @__PURE__ */ React38.createElement(SelectPrimitive.Separator, {
|
|
3726
3904
|
...props,
|
|
@@ -3728,7 +3906,7 @@ var SelectSeparator = /* @__PURE__ */ forwardRef31(({ classNames, ...props }, fo
|
|
|
3728
3906
|
ref: forwardedRef
|
|
3729
3907
|
});
|
|
3730
3908
|
});
|
|
3731
|
-
var SelectArrow = /* @__PURE__ */
|
|
3909
|
+
var SelectArrow = /* @__PURE__ */ forwardRef25(({ classNames, ...props }, forwardedRef) => {
|
|
3732
3910
|
const { tx } = useThemeContext();
|
|
3733
3911
|
return /* @__PURE__ */ React38.createElement(SelectPrimitive.Arrow, {
|
|
3734
3912
|
...props,
|
|
@@ -3758,8 +3936,8 @@ var Select = {
|
|
|
3758
3936
|
};
|
|
3759
3937
|
|
|
3760
3938
|
// src/components/Skeleton/Skeleton.tsx
|
|
3761
|
-
import React39, { forwardRef as
|
|
3762
|
-
var Skeleton = /* @__PURE__ */
|
|
3939
|
+
import React39, { forwardRef as forwardRef26 } from "react";
|
|
3940
|
+
var Skeleton = /* @__PURE__ */ forwardRef26(({ classNames, variant = "default", ...props }, forwardedRef) => {
|
|
3763
3941
|
const { tx } = useThemeContext();
|
|
3764
3942
|
return /* @__PURE__ */ React39.createElement("div", {
|
|
3765
3943
|
...props,
|
|
@@ -3772,47 +3950,47 @@ var Skeleton = /* @__PURE__ */ forwardRef32(({ classNames, variant = "default",
|
|
|
3772
3950
|
|
|
3773
3951
|
// src/components/Splitter/Splitter.tsx
|
|
3774
3952
|
import { createContextScope as createContextScope4 } from "@radix-ui/react-context";
|
|
3775
|
-
import { Primitive as
|
|
3776
|
-
import { Slot as
|
|
3777
|
-
import React40
|
|
3778
|
-
import { composableProps as
|
|
3953
|
+
import { Primitive as Primitive21 } from "@radix-ui/react-primitive";
|
|
3954
|
+
import { Slot as Slot21 } from "@radix-ui/react-slot";
|
|
3955
|
+
import React40 from "react";
|
|
3956
|
+
import { composableProps as composableProps14, slottable as slottable11 } from "@dxos/ui-theme";
|
|
3779
3957
|
var SPLITTER_NAME = "Splitter";
|
|
3780
3958
|
var [createSplitterContext, createSplitterScope] = createContextScope4(SPLITTER_NAME);
|
|
3781
3959
|
var [SplitterProvider, useSplitterContext] = createSplitterContext(SPLITTER_NAME);
|
|
3782
3960
|
var ROOT_NAME = "Splitter.Root";
|
|
3783
|
-
var
|
|
3784
|
-
const { className, ...rest } = composableProps9(props);
|
|
3785
|
-
const Comp = asChild ? Slot18 : Primitive18.div;
|
|
3961
|
+
var Root12 = slottable11(({ asChild, mode = "top", ratio = 0.5, transition = 250, children, ...props }, forwardedRef) => {
|
|
3786
3962
|
const { tx } = useThemeContext();
|
|
3963
|
+
const { __scopeSplitter, ...rest } = props;
|
|
3964
|
+
const { className, ...restProps } = composableProps14(rest);
|
|
3965
|
+
const Comp = asChild ? Slot21 : Primitive21.div;
|
|
3787
3966
|
return /* @__PURE__ */ React40.createElement(SplitterProvider, {
|
|
3788
3967
|
scope: __scopeSplitter,
|
|
3789
3968
|
mode,
|
|
3790
3969
|
ratio,
|
|
3791
3970
|
transition
|
|
3792
3971
|
}, /* @__PURE__ */ React40.createElement(Comp, {
|
|
3793
|
-
|
|
3794
|
-
...rest,
|
|
3972
|
+
...restProps,
|
|
3795
3973
|
ref: forwardedRef,
|
|
3796
3974
|
className: tx("splitter.root", {}, className)
|
|
3797
3975
|
}, children));
|
|
3798
3976
|
});
|
|
3799
|
-
|
|
3977
|
+
Root12.displayName = ROOT_NAME;
|
|
3800
3978
|
var PANEL_NAME = "Splitter.Panel";
|
|
3801
|
-
var Panel2 =
|
|
3802
|
-
const { className, ...rest } = composableProps9(props);
|
|
3803
|
-
const Comp = asChild ? Slot18 : Primitive18.div;
|
|
3804
|
-
const { mode, ratio, transition } = useSplitterContext(PANEL_NAME, __scopeSplitter);
|
|
3979
|
+
var Panel2 = slottable11(({ classNames, asChild, children, position, style, ...props }, forwardedRef) => {
|
|
3805
3980
|
const { tx } = useThemeContext();
|
|
3806
|
-
const
|
|
3807
|
-
const
|
|
3808
|
-
const
|
|
3981
|
+
const { __scopeSplitter, ...rest } = props;
|
|
3982
|
+
const Comp = asChild ? Slot21 : Primitive21.div;
|
|
3983
|
+
const { mode, ratio = 0.5, transition } = useSplitterContext(PANEL_NAME, __scopeSplitter);
|
|
3984
|
+
const { className, ...restProps } = composableProps14(rest);
|
|
3985
|
+
const isTopPanel = position === "top";
|
|
3986
|
+
const topOffset = isTopPanel ? "0%" : mode === "top" ? "100%" : mode === "bottom" ? "0%" : `${ratio * 100}%`;
|
|
3987
|
+
const height = isTopPanel ? mode === "top" ? "100%" : mode === "bottom" ? "0%" : `${ratio * 100}%` : mode === "bottom" ? "100%" : mode === "top" ? "0%" : `${(1 - ratio) * 100}%`;
|
|
3809
3988
|
return /* @__PURE__ */ React40.createElement(Comp, {
|
|
3810
|
-
|
|
3811
|
-
...rest,
|
|
3989
|
+
...restProps,
|
|
3812
3990
|
ref: forwardedRef,
|
|
3813
3991
|
className: tx("splitter.panel", {}, className),
|
|
3814
3992
|
style: {
|
|
3815
|
-
top,
|
|
3993
|
+
top: topOffset,
|
|
3816
3994
|
height,
|
|
3817
3995
|
transition: `top ${transition}ms, height ${transition}ms ease-out`,
|
|
3818
3996
|
...style
|
|
@@ -3821,17 +3999,17 @@ var Panel2 = /* @__PURE__ */ forwardRef33(({ __scopeSplitter, asChild, children,
|
|
|
3821
3999
|
});
|
|
3822
4000
|
Panel2.displayName = PANEL_NAME;
|
|
3823
4001
|
var Splitter = {
|
|
3824
|
-
Root:
|
|
4002
|
+
Root: Root12,
|
|
3825
4003
|
Panel: Panel2
|
|
3826
4004
|
};
|
|
3827
4005
|
|
|
3828
4006
|
// src/components/Tag/Tag.tsx
|
|
3829
|
-
import { Primitive as
|
|
3830
|
-
import { Slot as
|
|
3831
|
-
import React41, { forwardRef as
|
|
3832
|
-
var Tag = /* @__PURE__ */
|
|
4007
|
+
import { Primitive as Primitive22 } from "@radix-ui/react-primitive";
|
|
4008
|
+
import { Slot as Slot22 } from "@radix-ui/react-slot";
|
|
4009
|
+
import React41, { forwardRef as forwardRef27 } from "react";
|
|
4010
|
+
var Tag = /* @__PURE__ */ forwardRef27(({ asChild, palette = "neutral", classNames, ...props }, forwardedRef) => {
|
|
3833
4011
|
const { tx } = useThemeContext();
|
|
3834
|
-
const Comp = asChild ?
|
|
4012
|
+
const Comp = asChild ? Slot22 : Primitive22.span;
|
|
3835
4013
|
return /* @__PURE__ */ React41.createElement(Comp, {
|
|
3836
4014
|
...props,
|
|
3837
4015
|
className: tx("tag.root", {
|
|
@@ -3843,21 +4021,22 @@ var Tag = /* @__PURE__ */ forwardRef34(({ asChild, palette = "neutral", classNam
|
|
|
3843
4021
|
});
|
|
3844
4022
|
|
|
3845
4023
|
// src/components/Toast/Toast.tsx
|
|
3846
|
-
import { Primitive as
|
|
3847
|
-
import { Slot as
|
|
3848
|
-
import
|
|
3849
|
-
import React42, { forwardRef as
|
|
3850
|
-
var ToastProvider =
|
|
3851
|
-
var ToastViewport = /* @__PURE__ */
|
|
4024
|
+
import { Primitive as Primitive23 } from "@radix-ui/react-primitive";
|
|
4025
|
+
import { Slot as Slot23 } from "@radix-ui/react-slot";
|
|
4026
|
+
import * as ToastPrimitive from "@radix-ui/react-toast";
|
|
4027
|
+
import React42, { forwardRef as forwardRef28 } from "react";
|
|
4028
|
+
var ToastProvider = ToastPrimitive.Provider;
|
|
4029
|
+
var ToastViewport = /* @__PURE__ */ forwardRef28(({ classNames, ...props }, forwardedRef) => {
|
|
3852
4030
|
const { tx } = useThemeContext();
|
|
3853
|
-
return /* @__PURE__ */ React42.createElement(
|
|
4031
|
+
return /* @__PURE__ */ React42.createElement(ToastPrimitive.Viewport, {
|
|
4032
|
+
...props,
|
|
3854
4033
|
className: tx("toast.viewport", {}, classNames),
|
|
3855
4034
|
ref: forwardedRef
|
|
3856
4035
|
});
|
|
3857
4036
|
});
|
|
3858
|
-
var ToastRoot = /* @__PURE__ */
|
|
4037
|
+
var ToastRoot = /* @__PURE__ */ forwardRef28(({ classNames, children, ...props }, forwardedRef) => {
|
|
3859
4038
|
const { tx } = useThemeContext();
|
|
3860
|
-
return /* @__PURE__ */ React42.createElement(
|
|
4039
|
+
return /* @__PURE__ */ React42.createElement(ToastPrimitive.Root, {
|
|
3861
4040
|
...props,
|
|
3862
4041
|
className: tx("toast.root", {}, classNames),
|
|
3863
4042
|
ref: forwardedRef
|
|
@@ -3865,44 +4044,44 @@ var ToastRoot = /* @__PURE__ */ forwardRef35(({ classNames, children, ...props }
|
|
|
3865
4044
|
elevation: "toast"
|
|
3866
4045
|
}, children));
|
|
3867
4046
|
});
|
|
3868
|
-
var ToastBody = /* @__PURE__ */
|
|
4047
|
+
var ToastBody = /* @__PURE__ */ forwardRef28(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
3869
4048
|
const { tx } = useThemeContext();
|
|
3870
|
-
const Comp = asChild ?
|
|
4049
|
+
const Comp = asChild ? Slot23 : Primitive23.div;
|
|
3871
4050
|
return /* @__PURE__ */ React42.createElement(Comp, {
|
|
3872
4051
|
...props,
|
|
3873
4052
|
className: tx("toast.body", {}, classNames),
|
|
3874
4053
|
ref: forwardedRef
|
|
3875
4054
|
});
|
|
3876
4055
|
});
|
|
3877
|
-
var ToastTitle = /* @__PURE__ */
|
|
4056
|
+
var ToastTitle = /* @__PURE__ */ forwardRef28(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
3878
4057
|
const { tx } = useThemeContext();
|
|
3879
|
-
const Comp = asChild ?
|
|
4058
|
+
const Comp = asChild ? Slot23 : ToastPrimitive.Title;
|
|
3880
4059
|
return /* @__PURE__ */ React42.createElement(Comp, {
|
|
3881
4060
|
...props,
|
|
3882
4061
|
className: tx("toast.title", {}, classNames),
|
|
3883
4062
|
ref: forwardedRef
|
|
3884
4063
|
});
|
|
3885
4064
|
});
|
|
3886
|
-
var ToastDescription = /* @__PURE__ */
|
|
4065
|
+
var ToastDescription = /* @__PURE__ */ forwardRef28(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
3887
4066
|
const { tx } = useThemeContext();
|
|
3888
|
-
const Comp = asChild ?
|
|
4067
|
+
const Comp = asChild ? Slot23 : ToastPrimitive.Description;
|
|
3889
4068
|
return /* @__PURE__ */ React42.createElement(Comp, {
|
|
3890
4069
|
...props,
|
|
3891
4070
|
className: tx("toast.description", {}, classNames),
|
|
3892
4071
|
ref: forwardedRef
|
|
3893
4072
|
});
|
|
3894
4073
|
});
|
|
3895
|
-
var ToastActions = /* @__PURE__ */
|
|
4074
|
+
var ToastActions = /* @__PURE__ */ forwardRef28(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
3896
4075
|
const { tx } = useThemeContext();
|
|
3897
|
-
const Comp = asChild ?
|
|
4076
|
+
const Comp = asChild ? Slot23 : Primitive23.div;
|
|
3898
4077
|
return /* @__PURE__ */ React42.createElement(Comp, {
|
|
3899
4078
|
...props,
|
|
3900
4079
|
className: tx("toast.actions", {}, classNames),
|
|
3901
4080
|
ref: forwardedRef
|
|
3902
4081
|
});
|
|
3903
4082
|
});
|
|
3904
|
-
var ToastAction =
|
|
3905
|
-
var ToastClose =
|
|
4083
|
+
var ToastAction = ToastPrimitive.Action;
|
|
4084
|
+
var ToastClose = ToastPrimitive.Close;
|
|
3906
4085
|
var Toast = {
|
|
3907
4086
|
Provider: ToastProvider,
|
|
3908
4087
|
Viewport: ToastViewport,
|
|
@@ -3937,6 +4116,7 @@ export {
|
|
|
3937
4116
|
ErrorFallback,
|
|
3938
4117
|
ErrorStack,
|
|
3939
4118
|
Flex,
|
|
4119
|
+
Focus,
|
|
3940
4120
|
Grid,
|
|
3941
4121
|
Icon,
|
|
3942
4122
|
IconButton,
|
|
@@ -3958,6 +4138,8 @@ export {
|
|
|
3958
4138
|
Skeleton,
|
|
3959
4139
|
Splitter,
|
|
3960
4140
|
Status,
|
|
4141
|
+
TREEGRID_PARENT_OF_SEPARATOR,
|
|
4142
|
+
TREEGRID_PATH_SEPARATOR,
|
|
3961
4143
|
Tag,
|
|
3962
4144
|
ThemeContext,
|
|
3963
4145
|
ThemeProvider,
|
|
@@ -3967,7 +4149,7 @@ export {
|
|
|
3967
4149
|
ToggleGroup,
|
|
3968
4150
|
ToggleGroupIconItem,
|
|
3969
4151
|
ToggleGroupItem,
|
|
3970
|
-
|
|
4152
|
+
Toolbar,
|
|
3971
4153
|
Tooltip,
|
|
3972
4154
|
Trans,
|
|
3973
4155
|
Tree,
|
|
@@ -3981,6 +4163,7 @@ export {
|
|
|
3981
4163
|
initialSafeArea,
|
|
3982
4164
|
isLabel,
|
|
3983
4165
|
messageIcons,
|
|
4166
|
+
parseCaptureOwnerStack,
|
|
3984
4167
|
toLocalizedString,
|
|
3985
4168
|
useAvatarContext,
|
|
3986
4169
|
useButtonGroupContext,
|
|
@@ -3989,6 +4172,7 @@ export {
|
|
|
3989
4172
|
useDropdownMenuContext,
|
|
3990
4173
|
useDropdownMenuMenuScope,
|
|
3991
4174
|
useElevationContext,
|
|
4175
|
+
useFocus,
|
|
3992
4176
|
useIconHref,
|
|
3993
4177
|
useLandmarkMover,
|
|
3994
4178
|
useListContext,
|
|
@@ -3996,6 +4180,7 @@ export {
|
|
|
3996
4180
|
useMainContext,
|
|
3997
4181
|
usePx,
|
|
3998
4182
|
useSafeArea,
|
|
4183
|
+
useSafeCollisionPadding,
|
|
3999
4184
|
useScrollContainerContext,
|
|
4000
4185
|
useSidebars,
|
|
4001
4186
|
useThemeContext,
|