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